@pushwoosh/kit-helpers 4.8.7 → 4.8.8

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.
@@ -1 +1,2 @@
1
- export declare const identifyMixpanel: (email: string) => void;
1
+ import { type MixpanelProperties } from './utils';
2
+ export declare const identifyMixpanel: (properties: MixpanelProperties) => void;
@@ -1,16 +1,14 @@
1
1
  import { isProductionMode, isUserActionsTrackingOff } from './utils';
2
- export const identifyMixpanel = email => {
2
+ export const identifyMixpanel = properties => {
3
3
  if (!isProductionMode() || isUserActionsTrackingOff()) {
4
4
  return;
5
5
  }
6
6
  if (!window.mixpanel) {
7
7
  const store = window.pwMixpanelIdentifyStore || [];
8
- store.push(email);
8
+ store.push(properties);
9
9
  window.pwMixpanelIdentifyStore = store;
10
10
  } else {
11
- window.mixpanel?.identify(email);
12
- window.mixpanel?.people?.set({
13
- $email: email
14
- });
11
+ window.mixpanel?.identify(properties?.$email);
12
+ window.mixpanel?.people?.set(properties);
15
13
  }
16
14
  };
@@ -1 +1,2 @@
1
- export declare const identifyOpenReplaySession: (email: string) => void;
1
+ import { type OpenReplayProperties } from './utils';
2
+ export declare const identifyOpenReplaySession: (properties: OpenReplayProperties) => void;
@@ -1,13 +1,16 @@
1
1
  import { isProductionMode, isUserActionsTrackingOff } from './utils';
2
- export const identifyOpenReplaySession = email => {
2
+ export const identifyOpenReplaySession = properties => {
3
3
  if (!isProductionMode() || isUserActionsTrackingOff()) {
4
4
  return;
5
5
  }
6
6
  if (!window.OpenReplay) {
7
7
  const store = window.pwOpenReplayIdentifyStore || [];
8
- store.push(email);
8
+ store.push(properties);
9
9
  window.pwOpenReplayIdentifyStore = store;
10
10
  } else {
11
- window.OpenReplay?.setUserID(email);
11
+ window.OpenReplay?.setUserID(properties.email);
12
+ if (properties.accountID) {
13
+ window.OpenReplay?.setMetadata('AccountID', `${properties.accountID}`);
14
+ }
12
15
  }
13
16
  };
@@ -1,17 +1,28 @@
1
1
  import { type Mixpanel } from 'mixpanel-browser';
2
2
  interface IOpenReplay {
3
3
  setUserID(id: string): void;
4
+ setMetadata(key: string, value: string): void;
4
5
  }
5
6
  export type Event = {
6
7
  readonly name: string;
7
8
  readonly properties?: Record<string, unknown>;
8
9
  };
10
+ export type MixpanelProperties = {
11
+ $email: string;
12
+ $name?: string;
13
+ AccountID?: string;
14
+ Restriction?: string;
15
+ };
16
+ export type OpenReplayProperties = {
17
+ email: string;
18
+ accountID?: string;
19
+ };
9
20
  declare global {
10
21
  interface Window {
11
22
  mixpanel?: Mixpanel;
12
23
  OpenReplay?: IOpenReplay;
13
- pwMixpanelIdentifyStore?: string[];
14
- pwOpenReplayIdentifyStore?: string[];
24
+ pwMixpanelIdentifyStore?: MixpanelProperties[];
25
+ pwOpenReplayIdentifyStore?: OpenReplayProperties[];
15
26
  pwMixpanelTrackingEventsStore?: Event[];
16
27
  }
17
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-helpers",
3
- "version": "4.8.7",
3
+ "version": "4.8.8",
4
4
  "description": "React component for build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",