@pushwoosh/kit-helpers 4.12.2 → 4.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analytics/utils.d.ts +0 -13
- package/analytics/utils.js +1 -7
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -1
- package/analytics/identifyOpenReplay.d.ts +0 -2
- package/analytics/identifyOpenReplay.js +0 -16
package/analytics/utils.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
interface IOpenReplay {
|
|
2
|
-
setUserID(id: string): void;
|
|
3
|
-
setMetadata(key: string, value: string): void;
|
|
4
|
-
}
|
|
5
1
|
export interface PWTrackingEvent {
|
|
6
2
|
name: string;
|
|
7
3
|
properties?: Record<string, unknown>;
|
|
@@ -9,17 +5,8 @@ export interface PWTrackingEvent {
|
|
|
9
5
|
export interface PWTrackingEventsStoreAPI {
|
|
10
6
|
push(event: PWTrackingEvent): void;
|
|
11
7
|
}
|
|
12
|
-
export type OpenReplayProperties = {
|
|
13
|
-
email: string;
|
|
14
|
-
accountID?: string;
|
|
15
|
-
};
|
|
16
8
|
declare global {
|
|
17
9
|
interface Window {
|
|
18
|
-
OpenReplay?: IOpenReplay;
|
|
19
|
-
pwOpenReplayIdentifyStore?: OpenReplayProperties[];
|
|
20
10
|
__trackingEventsStore?: PWTrackingEventsStoreAPI | Array<PWTrackingEvent>;
|
|
21
11
|
}
|
|
22
12
|
}
|
|
23
|
-
export declare const isProductionMode: () => boolean;
|
|
24
|
-
export declare const isUserActionsTrackingOff: () => boolean;
|
|
25
|
-
export {};
|
package/analytics/utils.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export const isUserActionsTrackingOff = () => {
|
|
3
|
-
const turnOffTracking = localStorage.getItem('pw_off_user_actions_tracking');
|
|
4
|
-
// Any value other than these specific "falsey" ones means tracking is off.
|
|
5
|
-
const trackingOnValues = [null, '', '0', 'false'];
|
|
6
|
-
return !trackingOnValues.includes(turnOffTracking);
|
|
7
|
-
};
|
|
1
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './grid';
|
|
|
2
2
|
export * from './flex';
|
|
3
3
|
export * from './expand';
|
|
4
4
|
export * from './hooks/useClickAway';
|
|
5
|
-
export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
|
|
6
5
|
export { trackEvent } from './analytics/trackEvent';
|
|
7
6
|
export { formatNumber } from './formatNumber';
|
|
8
7
|
export { callWithRetry, RetryExhaustedError } from './callWithRetry';
|
package/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export * from './grid';
|
|
|
2
2
|
export * from './flex';
|
|
3
3
|
export * from './expand';
|
|
4
4
|
export * from './hooks/useClickAway';
|
|
5
|
-
export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
|
|
6
5
|
export { trackEvent } from './analytics/trackEvent';
|
|
7
6
|
export { formatNumber } from './formatNumber';
|
|
8
7
|
export { callWithRetry, RetryExhaustedError } from './callWithRetry';
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { isProductionMode, isUserActionsTrackingOff } from './utils';
|
|
2
|
-
export const identifyOpenReplaySession = properties => {
|
|
3
|
-
if (!isProductionMode() || isUserActionsTrackingOff()) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
if (!window.OpenReplay) {
|
|
7
|
-
const store = window.pwOpenReplayIdentifyStore || [];
|
|
8
|
-
store.push(properties);
|
|
9
|
-
window.pwOpenReplayIdentifyStore = store;
|
|
10
|
-
} else {
|
|
11
|
-
window.OpenReplay?.setUserID(properties.email);
|
|
12
|
-
if (properties.accountID) {
|
|
13
|
-
window.OpenReplay?.setMetadata('AccountID', `${properties.accountID}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|