@pushwoosh/kit-helpers 4.9.0 → 4.9.2

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.
@@ -0,0 +1,2 @@
1
+ import { type PWTrackingEvent } from './utils';
2
+ export declare const trackEvent: (event: PWTrackingEvent) => void;
@@ -0,0 +1,5 @@
1
+ /* eslint no-underscore-dangle: 0 */
2
+ export const trackEvent = event => {
3
+ window.__trackingEventsStore = window.__trackingEventsStore ?? [];
4
+ window.__trackingEventsStore.push(event);
5
+ };
@@ -2,10 +2,13 @@ interface IOpenReplay {
2
2
  setUserID(id: string): void;
3
3
  setMetadata(key: string, value: string): void;
4
4
  }
5
- export type Event = {
6
- readonly name: string;
7
- readonly properties?: Record<string, unknown>;
8
- };
5
+ export interface PWTrackingEvent {
6
+ name: string;
7
+ properties?: Record<string, unknown>;
8
+ }
9
+ export interface PWTrackingEventsStoreAPI {
10
+ push(event: PWTrackingEvent): void;
11
+ }
9
12
  export type OpenReplayProperties = {
10
13
  email: string;
11
14
  accountID?: string;
@@ -14,6 +17,7 @@ declare global {
14
17
  interface Window {
15
18
  OpenReplay?: IOpenReplay;
16
19
  pwOpenReplayIdentifyStore?: OpenReplayProperties[];
20
+ __trackingEventsStore?: PWTrackingEventsStoreAPI | Array<PWTrackingEvent>;
17
21
  }
18
22
  }
19
23
  export declare const isProductionMode: () => boolean;
package/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './grid';
2
2
  export * from './expand';
3
3
  export * from './hooks/useClickAway';
4
4
  export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
5
+ export { trackEvent } from './analytics/trackEvent';
5
6
  export { formatNumber } from './formatNumber';
6
7
  export { default as usePersistentFunction } from './hooks/usePersistentFunction';
7
8
  export { default as useEffectOnce } from './hooks/useEffectOnce';
package/index.js CHANGED
@@ -2,6 +2,7 @@ export * from './grid';
2
2
  export * from './expand';
3
3
  export * from './hooks/useClickAway';
4
4
  export { identifyOpenReplaySession } from './analytics/identifyOpenReplay';
5
+ export { trackEvent } from './analytics/trackEvent';
5
6
  export { formatNumber } from './formatNumber';
6
7
  export { default as usePersistentFunction } from './hooks/usePersistentFunction';
7
8
  export { default as useEffectOnce } from './hooks/useEffectOnce';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-helpers",
3
- "version": "4.9.0",
3
+ "version": "4.9.2",
4
4
  "description": "React component for build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",