Skip to content

Commit

Permalink
Merge branch 'main' into web-api-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 authored Oct 4, 2024
2 parents ccf0aa5 + f45aa19 commit 2c251d3
Show file tree
Hide file tree
Showing 96 changed files with 203 additions and 240 deletions.
4 changes: 2 additions & 2 deletions components/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const Feedback = () => {
rating: emoji.score,
timeStamp: new Date().toLocaleString(),
customer_id: userDetails?.customer_id,
user_id: userDetails?.user_id,
internal_user_id: userDetails?.user_id,
email: userDetails?.email
});
setFirstSelection(emoji.score);
Expand Down Expand Up @@ -130,7 +130,7 @@ const Feedback = () => {
path: window.location.pathname,
timeStamp: new Date().toLocaleString(),
customer_id: userDetails?.customer_id,
user_id: userDetails?.user_id,
internal_user_id: userDetails?.user_id,
email: userDetails?.email
});
setSubmitSuccessful(true);
Expand Down
18 changes: 3 additions & 15 deletions components/SegmentAnalytics.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { AppAnalytics } from '../lib/publishEvents';

const SegmentAnalytics = ({ title, options }) => {
React.useEffect(() => {
if (typeof window !== 'undefined') {
Expand All @@ -12,24 +13,11 @@ const SegmentAnalytics = ({ title, options }) => {
}, {});
// @ts-ignore
const url = new URL(window.location.href);
AppAnalytics.page(title, {
...params,
...options,
title,
referrer: document.referrer,
path: window.location.hostname,
pathname: window.location.pathname,
href: window.location.href,
utm_source: url.searchParams.get('utm_source'),
utm_medium: url.searchParams.get('utm_medium'),
utm_campaign: url.searchParams.get('utm_campaign'),
utm_keyword: url.searchParams.get('utm_keyword'),
utm_term: url.searchParams.get('utm_term')
});
AppAnalytics.page();
AppAnalytics.track('page.viewed', {
...params,
...options,
title: document.title,
title: document.title || title,
referrer: document.referrer,
path: window.location.hostname,
pathname: window.location.pathname,
Expand Down
91 changes: 33 additions & 58 deletions lib/publishEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,20 @@ export const analyticsStore: {
const analyticsTrack = (title, options) => {
try {
const user = currentUser();
if (!user) {
if (Object.keys(user).length === 0) {
amplitude.track({
event_type: title,
event_properties: {
...getCommonOptions(),
...options
}
});
} else if (user && !user.is_admin) {
} else if (Object.keys(user).length > 0 && !user.is_admin && user !== null) {
amplitude.track({
event_type: title,
event_properties: {
email: user.email,
customer_id: user.customer_id,

workspaceOwnerEmail: (analyticsStore.get() as { workspaceOwnerEmail: string })
?.workspaceOwnerEmail,
api_version: user.api_version,
Expand All @@ -78,72 +77,48 @@ const analyticsTrack = (title, options) => {
}
};

const analyticsPage = (title, options) => {
const user = currentUser();
if (!user) {
try {
hubspotPageView();
} catch (e) {
console.error(e);
}
try {
window.analytics.page(title, {
...getCommonOptions(),
...options
});
} catch (e) {
console.error(e);
}
} else if (user && !user.is_admin) {
try {
window.analytics.page(title, {
email: user.email,
customer_id: user.customer_id,
api_version: user.api_version,
...getCommonOptions(),
...options
});
} catch (e) {
console.error(e);
}
try {
hubspotPageView();
} catch (e) {
console.error(e);
}
const analyticsPage = () => {
try {
hubspotPageView();
} catch (e) {
console.error(e);
}
};

const amplitudeIdentify = (userId, properties = {}) => {
amplitude.setUserId(userId);
const identifyEvent = new amplitude.Identify();
for (const key in properties) {
if (Object.prototype.hasOwnProperty.call(properties, key)) {
identifyEvent.set(key, properties[key]);
amplitude.setUserId(userId);
if (Object.keys(properties).length !== 0 && properties !== null && properties !== undefined) {
for (const key in properties) {
if (
Object.prototype.hasOwnProperty.call(properties, key) &&
properties?.[key] !== null &&
properties?.[key] !== undefined &&
key !== 'user_id'
) {
identifyEvent.set(key, properties?.[key]);
}
}
}
amplitude.identify(identifyEvent);
};

const analyticsIdentify = (id, options = {}) => {
const user = currentUser();
if (!user || (user && !user.is_admin)) {
const finalOptions = {
...getCommonOptions(),
...options
};
try {
hubspotIdentify({
properties: { ...finalOptions, refId: id, email: user.email, ...user }
});
} catch (e) {
console.error(e);
}
try {
amplitudeIdentify(id, finalOptions);
} catch (e) {
console.error(e);
}
const finalOptions = {
...getCommonOptions(),
...options
};
try {
hubspotIdentify({
properties: { ...finalOptions, refId: id, email: user.email, ...user }
});
} catch (e) {
console.error(e);
}
try {
amplitudeIdentify(id, finalOptions);
} catch (e) {
console.error(e);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div class="cover ">
<h1 class="cover"><span>get</span><wbr><span>Available</span><wbr><span>Communication</span><wbr><span><span>Devices</span></span></h1>
</div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi.html"><span class="token annotation builtin">RequiresApi</span></a><span class="token punctuation">(</span><span>value<span class="token operator"> = </span><span class="breakable-word"><span class="token constant">31</span></span></span><wbr><span class="token punctuation">)</span></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">fun </span><a href="get-available-communication-devices.html"><span class="token function">getAvailableCommunicationDevices</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/java/util/List.html">List</a><span class="token operator">&lt;</span><a href="https://developer.android.com/reference/kotlin/android/media/AudioDeviceInfo.html">AudioDeviceInfo</a><span class="token operator">&gt;</span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi.html"><span class="token annotation builtin">RequiresApi</span></a><span class="token punctuation">(</span><span>value<span class="token operator"> = </span><span class="breakable-word"><span class="token constant">31</span></span></span><wbr><span class="token punctuation">)</span></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">fun </span><a href="get-available-communication-devices.html"><span class="token function">getAvailableCommunicationDevices</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html">List</a><span class="token operator">&lt;</span><a href="https://developer.android.com/reference/kotlin/android/media/AudioDeviceInfo.html">AudioDeviceInfo</a><span class="token operator">&gt;</span></div></div></div>
</div>
<div class="footer">
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2024 Copyright</span><span class="pull-right"><span>Generated by </span><a href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ <h2 class="">Functions</h2>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi.html"><span class="token annotation builtin">RequiresApi</span></a><span class="token punctuation">(</span><span>value<span class="token operator"> = </span><span class="breakable-word"><span class="token constant">31</span></span></span><wbr><span class="token punctuation">)</span></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">fun </span><a href="get-available-communication-devices.html"><span class="token function">getAvailableCommunicationDevices</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/java/util/List.html">List</a><span class="token operator">&lt;</span><a href="https://developer.android.com/reference/kotlin/android/media/AudioDeviceInfo.html">AudioDeviceInfo</a><span class="token operator">&gt;</span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi.html"><span class="token annotation builtin">RequiresApi</span></a><span class="token punctuation">(</span><span>value<span class="token operator"> = </span><span class="breakable-word"><span class="token constant">31</span></span></span><wbr><span class="token punctuation">)</span></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">fun </span><a href="get-available-communication-devices.html"><span class="token function">getAvailableCommunicationDevices</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html">List</a><span class="token operator">&lt;</span><a href="https://developer.android.com/reference/kotlin/android/media/AudioDeviceInfo.html">AudioDeviceInfo</a><span class="token operator">&gt;</span></div></div></div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div class="cover ">
<h1 class="cover"><span>audio</span><wbr><span><span>Devices</span></span></h1>
</div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@get:</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/MainThread.html"><span class="token annotation builtin">MainThread</span></a></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">val </span><a href="audio-devices.html">audioDevices</a><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/java/util/Set.html">Set</a><span class="token operator">&lt;</span><a href="../-h-m-s-audio-manager/-audio-device/index.html">HMSAudioManager.AudioDevice</a><span class="token operator">&gt;</span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@get:</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/MainThread.html"><span class="token annotation builtin">MainThread</span></a></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">val </span><a href="audio-devices.html">audioDevices</a><span class="token operator">: </span><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Set.html">Set</a><span class="token operator">&lt;</span><a href="../-h-m-s-audio-manager/-audio-device/index.html">HMSAudioManager.AudioDevice</a><span class="token operator">&gt;</span></div></div></div>
</div>
<div class="footer">
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2024 Copyright</span><span class="pull-right"><span>Generated by </span><a href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div class="cover ">
<h1 class="cover"><span>get</span><wbr><span>Audio</span><wbr><span>Devices</span><wbr><span>Info</span><wbr><span><span>List</span></span></h1>
</div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html"><span class="token annotation builtin">NonNull</span></a></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">fun </span><a href="get-audio-devices-info-list.html"><span class="token function">getAudioDevicesInfoList</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/java/util/List.html">List</a><span class="token operator">&lt;</span><a href="../-h-m-s-audio-device-info/index.html">HMSAudioDeviceInfo</a><span class="token operator">&gt;</span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":lib:dokkaHtmlPartial/release"><div class="symbol monospace"><div class="block"><div class="block"><span class="token annotation builtin">@</span><a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html"><span class="token annotation builtin">NonNull</span></a></div></div><span class="token keyword">open </span><span class="token keyword"></span><span class="token keyword">fun </span><a href="get-audio-devices-info-list.html"><span class="token function">getAudioDevicesInfoList</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html">List</a><span class="token operator">&lt;</span><a href="../-h-m-s-audio-device-info/index.html">HMSAudioDeviceInfo</a><span class="token operator">&gt;</span></div></div></div>
</div>
<div class="footer">
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2024 Copyright</span><span class="pull-right"><span>Generated by </span><a href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
Expand Down
Loading

0 comments on commit 2c251d3

Please sign in to comment.