@workleap/mixpanel 2.1.8 → 3.0.0

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/js/MixpanelClient.d.ts +22 -0
  3. package/dist/js/MixpanelClient.js +71 -0
  4. package/dist/js/MixpanelClient.js.map +1 -0
  5. package/dist/js/context.d.ts +2 -2
  6. package/dist/js/context.js +3 -0
  7. package/dist/js/context.js.map +1 -1
  8. package/dist/js/createTrackingFunction.d.ts +4 -4
  9. package/dist/js/createTrackingFunction.js +5 -2
  10. package/dist/js/createTrackingFunction.js.map +1 -1
  11. package/dist/js/env.d.ts +2 -2
  12. package/dist/js/env.js.map +1 -1
  13. package/dist/js/index.d.ts +5 -3
  14. package/dist/js/index.js +7 -3
  15. package/dist/js/index.js.map +1 -1
  16. package/dist/js/initializeMixpanel.d.ts +28 -7
  17. package/dist/js/initializeMixpanel.js +67 -56
  18. package/dist/js/initializeMixpanel.js.map +1 -1
  19. package/dist/js/properties.d.ts +1 -6
  20. package/dist/js/properties.js +1 -19
  21. package/dist/js/properties.js.map +1 -1
  22. package/dist/react/MixpanelContext.d.ts +18 -0
  23. package/dist/react/MixpanelContext.js +34 -0
  24. package/dist/react/MixpanelContext.js.map +1 -0
  25. package/dist/react/index.d.ts +2 -0
  26. package/dist/react/index.js +7 -1
  27. package/dist/react/index.js.map +1 -1
  28. package/dist/react/useTrackingFunction.d.ts +10 -3
  29. package/dist/react/useTrackingFunction.js +17 -4
  30. package/dist/react/useTrackingFunction.js.map +1 -1
  31. package/package.json +15 -16
  32. package/src/js/MixpanelClient.ts +85 -0
  33. package/src/js/context.ts +6 -2
  34. package/src/js/createTrackingFunction.ts +11 -7
  35. package/src/js/env.ts +5 -6
  36. package/src/js/index.ts +5 -3
  37. package/src/js/initializeMixpanel.ts +123 -73
  38. package/src/js/properties.ts +1 -28
  39. package/src/react/MixpanelContext.tsx +41 -0
  40. package/src/react/index.ts +2 -0
  41. package/src/react/useTrackingFunction.ts +24 -5
  42. package/dist/js/HasExecutedGuard.d.ts +0 -6
  43. package/dist/js/HasExecutedGuard.js +0 -21
  44. package/dist/js/HasExecutedGuard.js.map +0 -1
  45. package/dist/js/internal.d.ts +0 -2
  46. package/dist/js/internal.js +0 -14
  47. package/dist/js/internal.js.map +0 -1
  48. package/src/js/HasExecutedGuard.ts +0 -19
  49. package/src/js/internal.ts +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @workleap/mixpanel
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#86](https://github.com/workleap/wl-telemetry/pull/86) [`6d399dd`](https://github.com/workleap/wl-telemetry/commit/6d399dd6e01448a474ec098c64b185e45d9b6b5e) Thanks [@patricklafrance](https://github.com/patricklafrance)! - New API for telemetry packages and a new @workleap/telemetry umbrella package.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`6d399dd`](https://github.com/workleap/wl-telemetry/commit/6d399dd6e01448a474ec098c64b185e45d9b6b5e)]:
12
+ - @workleap/logrocket@2.0.0
13
+ - @workleap-telemetry/core@1.0.0
14
+
15
+ ## 2.1.9
16
+
17
+ ### Patch Changes
18
+
19
+ - [#76](https://github.com/workleap/wl-telemetry/pull/76) [`39f4cc7`](https://github.com/workleap/wl-telemetry/commit/39f4cc7485b5292ffaa3ea973109923c08330fb7) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fix Mixpanel package internal file export path.
20
+
3
21
  ## 2.1.8
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,22 @@
1
+ import type { Logger } from "@workleap/logging";
2
+ import type { CreateMixpanelTrackingFunctionOptions, MixpanelTrackingFunction } from "./createTrackingFunction.ts";
3
+ export type MixpanelGlobalEventProperties = Map<string, unknown>;
4
+ /**
5
+ * @see {@link https://workleap.github.io/wl-telemetry}
6
+ */
7
+ export declare class MixpanelClient {
8
+ #private;
9
+ constructor(productId: string, endpoint: string, globalEventProperties: MixpanelGlobalEventProperties, logger: Logger);
10
+ /**
11
+ * @see {@link https://workleap.github.io/wl-telemetry}
12
+ */
13
+ createTrackingFunction(options?: CreateMixpanelTrackingFunctionOptions): MixpanelTrackingFunction;
14
+ /**
15
+ * @see {@link https://workleap.github.io/wl-telemetry}
16
+ */
17
+ setGlobalEventProperty(key: string, value: unknown): void;
18
+ /**
19
+ * @see {@link https://workleap.github.io/wl-telemetry}
20
+ */
21
+ setGlobalEventProperties(values: Record<string, unknown>): void;
22
+ }
@@ -0,0 +1,71 @@
1
+ import { getBaseProperties } from "./properties.js";
2
+
3
+ ;// CONCATENATED MODULE: external "./properties.js"
4
+
5
+ ;// CONCATENATED MODULE: ./src/js/MixpanelClient.ts
6
+
7
+ /**
8
+ * @see {@link https://workleap.github.io/wl-telemetry}
9
+ */ class MixpanelClient {
10
+ #productId;
11
+ #endpoint;
12
+ #globalEventProperties;
13
+ #logger;
14
+ constructor(productId, endpoint, globalEventProperties, logger){
15
+ this.#productId = productId;
16
+ this.#endpoint = endpoint;
17
+ this.#globalEventProperties = globalEventProperties;
18
+ this.#logger = logger;
19
+ }
20
+ /**
21
+ * @see {@link https://workleap.github.io/wl-telemetry}
22
+ */ createTrackingFunction(options = {}) {
23
+ const { targetProductId } = options;
24
+ const trackFunction = async (eventName, properties, _options = {})=>{
25
+ try {
26
+ const { keepAlive = false } = _options;
27
+ const baseProperties = getBaseProperties();
28
+ const allProperties = {
29
+ ...baseProperties,
30
+ ...Object.fromEntries(this.#globalEventProperties),
31
+ ...properties
32
+ };
33
+ await fetch(this.#endpoint, {
34
+ method: "POST",
35
+ credentials: "include",
36
+ keepalive: keepAlive,
37
+ headers: {
38
+ "Content-Type": "application/json"
39
+ },
40
+ body: JSON.stringify({
41
+ eventName,
42
+ productIdentifier: this.#productId,
43
+ // Not sure why, but it seems important to send "null" if not target product identifier
44
+ // are provided.
45
+ targetProductIdentifier: targetProductId ?? null,
46
+ properties: allProperties
47
+ })
48
+ });
49
+ } catch (error) {
50
+ this.#logger.withText(`[mixpanel] An error occurred while sending a tracking event to "${this.#endpoint}":`).withError(error).error();
51
+ }
52
+ };
53
+ return trackFunction;
54
+ }
55
+ /**
56
+ * @see {@link https://workleap.github.io/wl-telemetry}
57
+ */ setGlobalEventProperty(key, value) {
58
+ this.#globalEventProperties.set(key, value);
59
+ }
60
+ /**
61
+ * @see {@link https://workleap.github.io/wl-telemetry}
62
+ */ setGlobalEventProperties(values) {
63
+ Object.keys(values).forEach((x)=>{
64
+ this.#globalEventProperties.set(x, values[x]);
65
+ });
66
+ }
67
+ }
68
+
69
+ export { MixpanelClient };
70
+
71
+ //# sourceMappingURL=MixpanelClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js/MixpanelClient.js","sources":["webpack://@workleap/mixpanel/./src/js/MixpanelClient.ts"],"sourcesContent":["import type { Logger } from \"@workleap/logging\";\nimport type { CreateMixpanelTrackingFunctionOptions, MixpanelTrackingFunction } from \"./createTrackingFunction.ts\";\nimport { getBaseProperties } from \"./properties.ts\";\n\nexport type MixpanelGlobalEventProperties = Map<string, unknown>;\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport class MixpanelClient {\n readonly #productId: string;\n readonly #endpoint: string;\n readonly #globalEventProperties: MixpanelGlobalEventProperties;\n readonly #logger: Logger;\n\n constructor(productId: string, endpoint: string, globalEventProperties: MixpanelGlobalEventProperties, logger: Logger) {\n this.#productId = productId;\n this.#endpoint = endpoint;\n this.#globalEventProperties = globalEventProperties;\n this.#logger = logger;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n createTrackingFunction(options: CreateMixpanelTrackingFunctionOptions = {}) {\n const {\n targetProductId\n } = options;\n\n const trackFunction: MixpanelTrackingFunction = async (eventName, properties, _options = {}) => {\n try {\n const {\n keepAlive = false\n } = _options;\n\n const baseProperties = getBaseProperties();\n\n const allProperties = {\n ...baseProperties,\n ...Object.fromEntries(this.#globalEventProperties),\n ...properties\n };\n\n await fetch(this.#endpoint, {\n method: \"POST\",\n credentials: \"include\",\n keepalive: keepAlive,\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n eventName,\n productIdentifier: this.#productId,\n // Not sure why, but it seems important to send \"null\" if not target product identifier\n // are provided.\n targetProductIdentifier : targetProductId ?? null,\n properties: allProperties\n })\n });\n } catch (error: unknown) {\n this.#logger\n .withText(`[mixpanel] An error occurred while sending a tracking event to \"${this.#endpoint}\":`)\n .withError(error as Error)\n .error();\n }\n };\n\n return trackFunction;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n setGlobalEventProperty(key: string, value: unknown) {\n this.#globalEventProperties.set(key, value);\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n setGlobalEventProperties(values: Record<string, unknown>) {\n Object.keys(values).forEach(x => {\n this.#globalEventProperties.set(x, values[x]);\n });\n }\n}\n"],"names":["getBaseProperties","MixpanelClient","productId","endpoint","globalEventProperties","logger","options","targetProductId","trackFunction","eventName","properties","_options","keepAlive","baseProperties","allProperties","Object","fetch","JSON","error","key","value","values","x"],"mappings":";;;;;AAEoD;AAIpD;;CAEC,GACM,MAAMC;IACA,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,sBAAsB,CAAgC;IACtD,OAAO,CAAS;IAEzB,YAAYC,SAAiB,EAAEC,QAAgB,EAAEC,qBAAoD,EAAEC,MAAc,CAAE;QACnH,IAAI,CAAC,UAAU,GAAGH;QAClB,IAAI,CAAC,SAAS,GAAGC;QACjB,IAAI,CAAC,sBAAsB,GAAGC;QAC9B,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA;;KAEC,GACD,uBAAuBC,UAAiD,CAAC,CAAC,EAAE;QACxE,MAAM,EACFC,eAAe,EAClB,GAAGD;QAEJ,MAAME,gBAA0C,OAAOC,WAAWC,YAAYC,WAAW,CAAC,CAAC;YACvF,IAAI;gBACA,MAAM,EACFC,YAAY,KAAK,EACpB,GAAGD;gBAEJ,MAAME,iBAAiBb,iBAAiBA;gBAExC,MAAMc,gBAAgB;oBAClB,GAAGD,cAAc;oBACjB,GAAGE,OAAO,WAAW,CAAC,IAAI,CAAC,sBAAsB,CAAC;oBAClD,GAAGL,UAAU;gBACjB;gBAEA,MAAMM,MAAM,IAAI,CAAC,SAAS,EAAE;oBACxB,QAAQ;oBACR,aAAa;oBACb,WAAWJ;oBACX,SAAS;wBAAE,gBAAgB;oBAAmB;oBAC9C,MAAMK,KAAK,SAAS,CAAC;wBACjBR;wBACA,mBAAmB,IAAI,CAAC,UAAU;wBAClC,uFAAuF;wBACvF,gBAAgB;wBAChB,yBAA0BF,mBAAmB;wBAC7C,YAAYO;oBAChB;gBACJ;YACJ,EAAE,OAAOI,OAAgB;gBACrB,IAAI,CAAC,OAAO,CACP,QAAQ,CAAC,CAAC,gEAAgE,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAC9F,SAAS,CAACA,OACV,KAAK;YACd;QACJ;QAEA,OAAOV;IACX;IAEA;;KAEC,GACD,uBAAuBW,GAAW,EAAEC,KAAc,EAAE;QAChD,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAACD,KAAKC;IACzC;IAEA;;KAEC,GACD,yBAAyBC,MAA+B,EAAE;QACtDN,OAAO,IAAI,CAACM,QAAQ,OAAO,CAACC,CAAAA;YACxB,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAACA,GAAGD,MAAM,CAACC,EAAE;QAChD;IACJ;AACJ"}
@@ -1,10 +1,10 @@
1
1
  import type { Logger } from "@workleap/logging";
2
- import type { SuperProperties } from "./properties.ts";
2
+ import type { MixpanelGlobalEventProperties } from "./MixpanelClient.ts";
3
3
  export declare const MixpanelContextVariableName = "__WLP_MIXPANEL_CONTEXT__";
4
4
  export interface MixpanelContext {
5
5
  productId: string;
6
6
  endpoint: string;
7
- superProperties: SuperProperties;
7
+ globalEventProperties: MixpanelGlobalEventProperties;
8
8
  logger: Logger;
9
9
  }
10
10
  export declare function setMixpanelContext(context: MixpanelContext): void;
@@ -1,5 +1,8 @@
1
1
 
2
2
  ;// CONCATENATED MODULE: ./src/js/context.ts
3
+ // DEPRECATED: Grace period ends on January 1th 2026.
4
+ // Must keep this code until the end of the grace period because host applications using version 2.* of
5
+ // this package would get runtime errors from the Platform Widgets CDN otherwise.
3
6
  const MixpanelContextVariableName = "__WLP_MIXPANEL_CONTEXT__";
4
7
  function setMixpanelContext(context) {
5
8
  // Will be used by the "track" function.
@@ -1 +1 @@
1
- {"version":3,"file":"js/context.js","sources":["webpack://@workleap/mixpanel/./src/js/context.ts"],"sourcesContent":["import type { Logger } from \"@workleap/logging\";\nimport type { SuperProperties } from \"./properties.ts\";\n\nexport const MixpanelContextVariableName = \"__WLP_MIXPANEL_CONTEXT__\";\n\nexport interface MixpanelContext {\n productId: string;\n endpoint: string;\n superProperties: SuperProperties;\n logger: Logger;\n}\n\nexport function setMixpanelContext(context: MixpanelContext) {\n // Will be used by the \"track\" function.\n // It's important to share the context with a global DOM object rather than\n // a singleton because projects like the platform widgets will use a distinct instance\n // of this package than the host application.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[MixpanelContextVariableName] = context;\n}\n\nexport function getMixpanelContext() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const context = globalThis[MixpanelContextVariableName] as MixpanelContext;\n\n if (!context) {\n throw new Error(\"[mixpanel] The Mixpanel context is not available. Did you initialize Mixpanel with the \\\"initializeMixpanel\\\" function?\");\n }\n\n return context;\n}\n\n\n"],"names":["MixpanelContextVariableName","setMixpanelContext","context","globalThis","getMixpanelContext","Error"],"mappings":";;AAGO,MAAMA,8BAA8B,2BAA2B;AAS/D,SAASC,mBAAmBC,OAAwB;IACvD,wCAAwC;IACxC,2EAA2E;IAC3E,sFAAsF;IACtF,6CAA6C;IAC7C,6DAA6D;IAC7D,aAAa;IACbC,UAAU,CAACH,4BAA4B,GAAGE;AAC9C;AAEO,SAASE;IACZ,6DAA6D;IAC7D,aAAa;IACb,MAAMF,UAAUC,UAAU,CAACH,4BAA4B;IAEvD,IAAI,CAACE,SAAS;QACV,MAAM,IAAIG,MAAM;IACpB;IAEA,OAAOH;AACX"}
1
+ {"version":3,"file":"js/context.js","sources":["webpack://@workleap/mixpanel/./src/js/context.ts"],"sourcesContent":["// DEPRECATED: Grace period ends on January 1th 2026.\n// Must keep this code until the end of the grace period because host applications using version 2.* of\n// this package would get runtime errors from the Platform Widgets CDN otherwise.\n\nimport type { Logger } from \"@workleap/logging\";\nimport type { MixpanelGlobalEventProperties } from \"./MixpanelClient.ts\";\n\nexport const MixpanelContextVariableName = \"__WLP_MIXPANEL_CONTEXT__\";\n\nexport interface MixpanelContext {\n productId: string;\n endpoint: string;\n globalEventProperties: MixpanelGlobalEventProperties;\n logger: Logger;\n}\n\nexport function setMixpanelContext(context: MixpanelContext) {\n // Will be used by the \"track\" function.\n // It's important to share the context with a global DOM object rather than\n // a singleton because projects like the platform widgets will use a distinct instance\n // of this package than the host application.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[MixpanelContextVariableName] = context;\n}\n\nexport function getMixpanelContext() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const context = globalThis[MixpanelContextVariableName] as MixpanelContext;\n\n if (!context) {\n throw new Error(\"[mixpanel] The Mixpanel context is not available. Did you initialize Mixpanel with the \\\"initializeMixpanel\\\" function?\");\n }\n\n return context;\n}\n\n\n"],"names":["MixpanelContextVariableName","setMixpanelContext","context","globalThis","getMixpanelContext","Error"],"mappings":";;AAAA,qDAAqD;AACrD,uGAAuG;AACvG,iFAAiF;AAK1E,MAAMA,8BAA8B,2BAA2B;AAS/D,SAASC,mBAAmBC,OAAwB;IACvD,wCAAwC;IACxC,2EAA2E;IAC3E,sFAAsF;IACtF,6CAA6C;IAC7C,6DAA6D;IAC7D,aAAa;IACbC,UAAU,CAACH,4BAA4B,GAAGE;AAC9C;AAEO,SAASE;IACZ,6DAA6D;IAC7D,aAAa;IACb,MAAMF,UAAUC,UAAU,CAACH,4BAA4B;IAEvD,IAAI,CAACE,SAAS;QACV,MAAM,IAAIG,MAAM;IACpB;IAEA,OAAOH;AACX"}
@@ -2,7 +2,7 @@ import { type MixpanelEventProperties } from "./properties.ts";
2
2
  /**
3
3
  * @see {@link https://workleap.github.io/wl-telemetry}
4
4
  */
5
- export interface CreateTrackingFunctionOptions {
5
+ export interface CreateMixpanelTrackingFunctionOptions {
6
6
  /**
7
7
  * The product identifier of the target product.
8
8
  */
@@ -11,7 +11,7 @@ export interface CreateTrackingFunctionOptions {
11
11
  /**
12
12
  * @see {@link https://workleap.github.io/wl-telemetry}
13
13
  */
14
- export interface TrackingFunctionOptions {
14
+ export interface MixpanelTrackingFunctionOptions {
15
15
  /**
16
16
  * Whether to keep the connection alive for the tracking request.
17
17
  * It is mostly used for tracking links where the user might navigate away before the request is completed.
@@ -31,8 +31,8 @@ export interface TrackingFunctionOptions {
31
31
  * @param options Options for tracking the event.
32
32
  * @see {@link https://workleap.github.io/wl-telemetry}
33
33
  */
34
- export type TrackingFunction = (eventName: string, properties: MixpanelEventProperties, options?: TrackingFunctionOptions) => Promise<void>;
34
+ export type MixpanelTrackingFunction = (eventName: string, properties: MixpanelEventProperties, options?: MixpanelTrackingFunctionOptions) => Promise<void>;
35
35
  /**
36
36
  * @see {@link https://workleap.github.io/wl-telemetry}
37
37
  */
38
- export declare function createTrackingFunction(options?: CreateTrackingFunctionOptions): TrackingFunction;
38
+ export declare function createTrackingFunction(options?: CreateMixpanelTrackingFunctionOptions): MixpanelTrackingFunction;
@@ -6,20 +6,23 @@ import { getBaseProperties } from "./properties.js";
6
6
  ;// CONCATENATED MODULE: external "./properties.js"
7
7
 
8
8
  ;// CONCATENATED MODULE: ./src/js/createTrackingFunction.ts
9
+ // DEPRECATED: Grace period ends on January 1th 2026.
10
+ // Must keep this code until the end of the grace period because host applications using version 2.* of
11
+ // this package would get runtime errors from the Platform Widgets CDN otherwise.
9
12
 
10
13
 
11
14
  /**
12
15
  * @see {@link https://workleap.github.io/wl-telemetry}
13
16
  */ function createTrackingFunction(options = {}) {
14
17
  const { targetProductId } = options;
15
- const { productId, endpoint, superProperties, logger } = getMixpanelContext();
18
+ const { productId, endpoint, globalEventProperties, logger } = getMixpanelContext();
16
19
  const trackFunction = async (eventName, properties, _options = {})=>{
17
20
  try {
18
21
  const { keepAlive = false } = _options;
19
22
  const baseProperties = getBaseProperties();
20
23
  const allProperties = {
21
24
  ...baseProperties,
22
- ...Object.fromEntries(superProperties),
25
+ ...Object.fromEntries(globalEventProperties),
23
26
  ...properties
24
27
  };
25
28
  await fetch(endpoint, {
@@ -1 +1 @@
1
- {"version":3,"file":"js/createTrackingFunction.js","sources":["webpack://@workleap/mixpanel/./src/js/createTrackingFunction.ts"],"sourcesContent":["import { getMixpanelContext } from \"./context.ts\";\nimport { getBaseProperties, type MixpanelEventProperties } from \"./properties.ts\";\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface CreateTrackingFunctionOptions {\n /**\n * The product identifier of the target product.\n */\n targetProductId?: string;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface TrackingFunctionOptions {\n /**\n * Whether to keep the connection alive for the tracking request.\n * It is mostly used for tracking links where the user might navigate away before the request is completed.\n *\n * Caution! The body size for keepalive requests is limited to 64 kibibytes.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#keepalive\n *\n * @default false\n */\n keepAlive?: boolean;\n}\n\n/**\n * A function that sends tracking events to the tracking API.\n * @param eventName The name of the event to track.\n * @param properties The properties to send with the event.\n * @param options Options for tracking the event.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport type TrackingFunction = (eventName: string, properties: MixpanelEventProperties, options?: TrackingFunctionOptions) => Promise<void>;\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function createTrackingFunction(options: CreateTrackingFunctionOptions = {}) {\n const {\n targetProductId\n } = options;\n\n const {\n productId,\n endpoint,\n superProperties,\n logger\n } = getMixpanelContext();\n\n const trackFunction: TrackingFunction = async (eventName, properties, _options = {}) => {\n try {\n const {\n keepAlive = false\n } = _options;\n\n const baseProperties = getBaseProperties();\n\n const allProperties = {\n ...baseProperties,\n ...Object.fromEntries(superProperties),\n ...properties\n };\n\n await fetch(endpoint, {\n method: \"POST\",\n credentials: \"include\",\n keepalive: keepAlive,\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n eventName,\n productIdentifier: productId,\n // Not sure why, but it seems important to send \"null\" if not target product identifier\n // are provided.\n targetProductIdentifier : targetProductId ?? null,\n properties: allProperties\n })\n });\n } catch (error: unknown) {\n logger\n .withText(`[mixpanel] An error occurred while sending a tracking event to \"${endpoint}\":`)\n .withError(error as Error)\n .error();\n }\n };\n\n return trackFunction;\n}\n"],"names":["getMixpanelContext","getBaseProperties","createTrackingFunction","options","targetProductId","productId","endpoint","superProperties","logger","trackFunction","eventName","properties","_options","keepAlive","baseProperties","allProperties","Object","fetch","JSON","error"],"mappings":";;;;;;;;AAAkD;AACgC;AAsClF;;CAEC,GACM,SAASE,uBAAuBC,UAAyC,CAAC,CAAC;IAC9E,MAAM,EACFC,eAAe,EAClB,GAAGD;IAEJ,MAAM,EACFE,SAAS,EACTC,QAAQ,EACRC,eAAe,EACfC,MAAM,EACT,GAAGR,kBAAkBA;IAEtB,MAAMS,gBAAkC,OAAOC,WAAWC,YAAYC,WAAW,CAAC,CAAC;QAC/E,IAAI;YACA,MAAM,EACFC,YAAY,KAAK,EACpB,GAAGD;YAEJ,MAAME,iBAAiBb,iBAAiBA;YAExC,MAAMc,gBAAgB;gBAClB,GAAGD,cAAc;gBACjB,GAAGE,OAAO,WAAW,CAACT,gBAAgB;gBACtC,GAAGI,UAAU;YACjB;YAEA,MAAMM,MAAMX,UAAU;gBAClB,QAAQ;gBACR,aAAa;gBACb,WAAWO;gBACX,SAAS;oBAAE,gBAAgB;gBAAmB;gBAC9C,MAAMK,KAAK,SAAS,CAAC;oBACjBR;oBACA,mBAAmBL;oBACnB,uFAAuF;oBACvF,gBAAgB;oBAChB,yBAA0BD,mBAAmB;oBAC7C,YAAYW;gBAChB;YACJ;QACJ,EAAE,OAAOI,OAAgB;YACrBX,OACK,QAAQ,CAAC,CAAC,gEAAgE,EAAEF,SAAS,EAAE,CAAC,EACxF,SAAS,CAACa,OACV,KAAK;QACd;IACJ;IAEA,OAAOV;AACX"}
1
+ {"version":3,"file":"js/createTrackingFunction.js","sources":["webpack://@workleap/mixpanel/./src/js/createTrackingFunction.ts"],"sourcesContent":["// DEPRECATED: Grace period ends on January 1th 2026.\n// Must keep this code until the end of the grace period because host applications using version 2.* of\n// this package would get runtime errors from the Platform Widgets CDN otherwise.\n\nimport { getMixpanelContext } from \"./context.ts\";\nimport { getBaseProperties, type MixpanelEventProperties } from \"./properties.ts\";\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface CreateMixpanelTrackingFunctionOptions {\n /**\n * The product identifier of the target product.\n */\n targetProductId?: string;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface MixpanelTrackingFunctionOptions {\n /**\n * Whether to keep the connection alive for the tracking request.\n * It is mostly used for tracking links where the user might navigate away before the request is completed.\n *\n * Caution! The body size for keepalive requests is limited to 64 kibibytes.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#keepalive\n *\n * @default false\n */\n keepAlive?: boolean;\n}\n\n/**\n * A function that sends tracking events to the tracking API.\n * @param eventName The name of the event to track.\n * @param properties The properties to send with the event.\n * @param options Options for tracking the event.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport type MixpanelTrackingFunction = (eventName: string, properties: MixpanelEventProperties, options?: MixpanelTrackingFunctionOptions) => Promise<void>;\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function createTrackingFunction(options: CreateMixpanelTrackingFunctionOptions = {}) {\n const {\n targetProductId\n } = options;\n\n const {\n productId,\n endpoint,\n globalEventProperties,\n logger\n } = getMixpanelContext();\n\n const trackFunction: MixpanelTrackingFunction = async (eventName, properties, _options = {}) => {\n try {\n const {\n keepAlive = false\n } = _options;\n\n const baseProperties = getBaseProperties();\n\n const allProperties = {\n ...baseProperties,\n ...Object.fromEntries(globalEventProperties),\n ...properties\n };\n\n await fetch(endpoint, {\n method: \"POST\",\n credentials: \"include\",\n keepalive: keepAlive,\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n eventName,\n productIdentifier: productId,\n // Not sure why, but it seems important to send \"null\" if not target product identifier\n // are provided.\n targetProductIdentifier : targetProductId ?? null,\n properties: allProperties\n })\n });\n } catch (error: unknown) {\n logger\n .withText(`[mixpanel] An error occurred while sending a tracking event to \"${endpoint}\":`)\n .withError(error as Error)\n .error();\n }\n };\n\n return trackFunction;\n}\n"],"names":["getMixpanelContext","getBaseProperties","createTrackingFunction","options","targetProductId","productId","endpoint","globalEventProperties","logger","trackFunction","eventName","properties","_options","keepAlive","baseProperties","allProperties","Object","fetch","JSON","error"],"mappings":";;;;;;;;AAAA,qDAAqD;AACrD,uGAAuG;AACvG,iFAAiF;AAE/B;AACgC;AAsClF;;CAEC,GACM,SAASE,uBAAuBC,UAAiD,CAAC,CAAC;IACtF,MAAM,EACFC,eAAe,EAClB,GAAGD;IAEJ,MAAM,EACFE,SAAS,EACTC,QAAQ,EACRC,qBAAqB,EACrBC,MAAM,EACT,GAAGR,kBAAkBA;IAEtB,MAAMS,gBAA0C,OAAOC,WAAWC,YAAYC,WAAW,CAAC,CAAC;QACvF,IAAI;YACA,MAAM,EACFC,YAAY,KAAK,EACpB,GAAGD;YAEJ,MAAME,iBAAiBb,iBAAiBA;YAExC,MAAMc,gBAAgB;gBAClB,GAAGD,cAAc;gBACjB,GAAGE,OAAO,WAAW,CAACT,sBAAsB;gBAC5C,GAAGI,UAAU;YACjB;YAEA,MAAMM,MAAMX,UAAU;gBAClB,QAAQ;gBACR,aAAa;gBACb,WAAWO;gBACX,SAAS;oBAAE,gBAAgB;gBAAmB;gBAC9C,MAAMK,KAAK,SAAS,CAAC;oBACjBR;oBACA,mBAAmBL;oBACnB,uFAAuF;oBACvF,gBAAgB;oBAChB,yBAA0BD,mBAAmB;oBAC7C,YAAYW;gBAChB;YACJ;QACJ,EAAE,OAAOI,OAAgB;YACrBX,OACK,QAAQ,CAAC,CAAC,gEAAgE,EAAEF,SAAS,EAAE,CAAC,EACxF,SAAS,CAACa,OACV,KAAK;QACd;IACJ;IAEA,OAAOV;AACX"}
package/dist/js/env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  declare const EnvironmentList: readonly ["development", "staging", "production", "local", "msw"];
2
- export type Environment = typeof EnvironmentList[number];
3
- export declare function getTrackingEndpoint(envOrTrackingApiBaseUrl: Environment | (string & {}), trackingEndpoint?: string): string;
2
+ export type MixpanelEnvironment = typeof EnvironmentList[number];
3
+ export declare function getTrackingEndpoint(envOrTrackingApiBaseUrl: MixpanelEnvironment | (string & {}), trackingEndpoint?: string): string;
4
4
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"js/env.js","sources":["webpack://@workleap/mixpanel/./src/js/env.ts"],"sourcesContent":["\nconst EnvironmentList = [\"development\", \"staging\", \"production\", \"local\", \"msw\"] as const;\n\nexport type Environment = typeof EnvironmentList[number];\n\nconst NavigationApiBaseUrl: Record<Environment, string> = {\n \"production\": \"https://api.platform.workleap.com/shell/navigation/\",\n \"staging\": \"https://api.platform.workleap-stg.com/shell/navigation/\",\n \"development\": \"https://api.platform.workleap-dev.com/shell/navigation/\",\n \"local\": \"https://api.platform.workleap-dev.com/shell/navigation/\",\n \"msw\": \"/api/shell/navigation/\"\n};\n\n// Cannot use URL() because it doesn't support relative base url: https://github.com/whatwg/url/issues/531.\nfunction resolveApiUrl(path: string, baseUrl: string | undefined) : string {\n return `${baseUrl}${baseUrl!.endsWith(\"/\") ? \"\" : \"/\"}${path.startsWith(\"/\") ? path.substring(1) : path}`;\n}\n\nexport function getTrackingEndpoint(envOrTrackingApiBaseUrl: Environment | (string & {}), trackingEndpoint = \"tracking/track\"): string {\n let baseUrl: string;\n\n if (EnvironmentList.includes(envOrTrackingApiBaseUrl as Environment)) {\n baseUrl = NavigationApiBaseUrl[envOrTrackingApiBaseUrl as Environment];\n } else {\n baseUrl = envOrTrackingApiBaseUrl;\n }\n\n return resolveApiUrl(trackingEndpoint, baseUrl);\n}\n"],"names":["EnvironmentList","NavigationApiBaseUrl","resolveApiUrl","path","baseUrl","getTrackingEndpoint","envOrTrackingApiBaseUrl","trackingEndpoint"],"mappings":";;AACA,MAAMA,kBAAkB;IAAC;IAAe;IAAW;IAAc;IAAS;CAAM;AAIhF,MAAMC,uBAAoD;IACtD,cAAc;IACd,WAAW;IACX,eAAe;IACf,SAAS;IACT,OAAO;AACX;AAEA,2GAA2G;AAC3G,SAASC,cAAcC,IAAY,EAAEC,OAA2B;IAC5D,OAAO,GAAGA,UAAUA,QAAS,QAAQ,CAAC,OAAO,KAAK,MAAMD,KAAK,UAAU,CAAC,OAAOA,KAAK,SAAS,CAAC,KAAKA,MAAM;AAC7G;AAEO,SAASE,oBAAoBC,uBAAoD,EAAEC,mBAAmB,gBAAgB;IACzH,IAAIH;IAEJ,IAAIJ,gBAAgB,QAAQ,CAACM,0BAAyC;QAClEF,UAAUH,oBAAoB,CAACK,wBAAuC;IAC1E,OAAO;QACHF,UAAUE;IACd;IAEA,OAAOJ,cAAcK,kBAAkBH;AAC3C"}
1
+ {"version":3,"file":"js/env.js","sources":["webpack://@workleap/mixpanel/./src/js/env.ts"],"sourcesContent":["const EnvironmentList = [\"development\", \"staging\", \"production\", \"local\", \"msw\"] as const;\n\nexport type MixpanelEnvironment = typeof EnvironmentList[number];\n\nconst NavigationApiBaseUrl: Record<MixpanelEnvironment, string> = {\n \"production\": \"https://api.platform.workleap.com/shell/navigation/\",\n \"staging\": \"https://api.platform.workleap-stg.com/shell/navigation/\",\n \"development\": \"https://api.platform.workleap-dev.com/shell/navigation/\",\n \"local\": \"https://api.platform.workleap-dev.com/shell/navigation/\",\n \"msw\": \"/api/shell/navigation/\"\n};\n\n// Cannot use URL() because it doesn't support relative base url: https://github.com/whatwg/url/issues/531.\nfunction resolveApiUrl(path: string, baseUrl: string | undefined) : string {\n return `${baseUrl}${baseUrl!.endsWith(\"/\") ? \"\" : \"/\"}${path.startsWith(\"/\") ? path.substring(1) : path}`;\n}\n\nexport function getTrackingEndpoint(envOrTrackingApiBaseUrl: MixpanelEnvironment | (string & {}), trackingEndpoint = \"tracking/track\"): string {\n let baseUrl: string;\n\n if (EnvironmentList.includes(envOrTrackingApiBaseUrl as MixpanelEnvironment)) {\n baseUrl = NavigationApiBaseUrl[envOrTrackingApiBaseUrl as MixpanelEnvironment];\n } else {\n baseUrl = envOrTrackingApiBaseUrl;\n }\n\n return resolveApiUrl(trackingEndpoint, baseUrl);\n}\n"],"names":["EnvironmentList","NavigationApiBaseUrl","resolveApiUrl","path","baseUrl","getTrackingEndpoint","envOrTrackingApiBaseUrl","trackingEndpoint"],"mappings":";;AAAA,MAAMA,kBAAkB;IAAC;IAAe;IAAW;IAAc;IAAS;CAAM;AAIhF,MAAMC,uBAA4D;IAC9D,cAAc;IACd,WAAW;IACX,eAAe;IACf,SAAS;IACT,OAAO;AACX;AAEA,2GAA2G;AAC3G,SAASC,cAAcC,IAAY,EAAEC,OAA2B;IAC5D,OAAO,GAAGA,UAAUA,QAAS,QAAQ,CAAC,OAAO,KAAK,MAAMD,KAAK,UAAU,CAAC,OAAOA,KAAK,SAAS,CAAC,KAAKA,MAAM;AAC7G;AAEO,SAASE,oBAAoBC,uBAA4D,EAAEC,mBAAmB,gBAAgB;IACjI,IAAIH;IAEJ,IAAIJ,gBAAgB,QAAQ,CAACM,0BAAiD;QAC1EF,UAAUH,oBAAoB,CAACK,wBAA+C;IAClF,OAAO;QACHF,UAAUE;IACd;IAEA,OAAOJ,cAAcK,kBAAkBH;AAC3C"}
@@ -1,4 +1,6 @@
1
- export { createTrackingFunction, type CreateTrackingFunctionOptions, type TrackingFunction, type TrackingFunctionOptions } from "./createTrackingFunction.ts";
2
- export type { Environment } from "./env.ts";
1
+ export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from "@workleap-telemetry/core";
2
+ export { createTrackingFunction, type CreateMixpanelTrackingFunctionOptions, type MixpanelTrackingFunction, type MixpanelTrackingFunctionOptions } from "./createTrackingFunction.ts";
3
+ export type { MixpanelEnvironment } from "./env.ts";
3
4
  export { initializeMixpanel, type InitializeMixpanelOptions } from "./initializeMixpanel.ts";
4
- export { setSuperProperties, setSuperProperty, type MixpanelEventProperties } from "./properties.ts";
5
+ export { MixpanelClient, type MixpanelGlobalEventProperties } from "./MixpanelClient.ts";
6
+ export { type MixpanelEventProperties } from "./properties.ts";
package/dist/js/index.js CHANGED
@@ -1,18 +1,22 @@
1
+ import { createTelemetryContext } from "@workleap-telemetry/core";
1
2
  import { createTrackingFunction } from "./createTrackingFunction.js";
2
3
  import { initializeMixpanel } from "./initializeMixpanel.js";
3
- import { setSuperProperties, setSuperProperty } from "./properties.js";
4
+ import { MixpanelClient } from "./MixpanelClient.js";
5
+
6
+ ;// CONCATENATED MODULE: external "@workleap-telemetry/core"
4
7
 
5
8
  ;// CONCATENATED MODULE: external "./createTrackingFunction.js"
6
9
 
7
10
  ;// CONCATENATED MODULE: external "./initializeMixpanel.js"
8
11
 
9
- ;// CONCATENATED MODULE: external "./properties.js"
12
+ ;// CONCATENATED MODULE: external "./MixpanelClient.js"
10
13
 
11
14
  ;// CONCATENATED MODULE: ./src/js/index.ts
12
15
 
13
16
 
14
17
 
15
18
 
16
- export { createTrackingFunction, initializeMixpanel, setSuperProperties, setSuperProperty };
19
+
20
+ export { MixpanelClient, createTelemetryContext, createTrackingFunction, initializeMixpanel };
17
21
 
18
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"js/index.js","sources":["webpack://@workleap/mixpanel/./src/js/index.ts"],"sourcesContent":["export { createTrackingFunction, type CreateTrackingFunctionOptions, type TrackingFunction, type TrackingFunctionOptions } from \"./createTrackingFunction.ts\";\nexport type { Environment } from \"./env.ts\";\nexport { initializeMixpanel, type InitializeMixpanelOptions } from \"./initializeMixpanel.ts\";\nexport { setSuperProperties, setSuperProperty, type MixpanelEventProperties } from \"./properties.ts\";\n\n"],"names":["createTrackingFunction","initializeMixpanel","setSuperProperties","setSuperProperty"],"mappings":";;;;;;;;;;;AAA8J;AAEjE;AACQ"}
1
+ {"version":3,"file":"js/index.js","sources":["webpack://@workleap/mixpanel/./src/js/index.ts"],"sourcesContent":["export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from \"@workleap-telemetry/core\";\nexport { createTrackingFunction, type CreateMixpanelTrackingFunctionOptions, type MixpanelTrackingFunction, type MixpanelTrackingFunctionOptions } from \"./createTrackingFunction.ts\";\nexport type { MixpanelEnvironment } from \"./env.ts\";\nexport { initializeMixpanel, type InitializeMixpanelOptions } from \"./initializeMixpanel.ts\";\nexport { MixpanelClient, type MixpanelGlobalEventProperties } from \"./MixpanelClient.ts\";\nexport { type MixpanelEventProperties } from \"./properties.ts\";\n\n"],"names":["createTelemetryContext","createTrackingFunction","initializeMixpanel","MixpanelClient"],"mappings":";;;;;;;;;;;;;;AAA6H;AACyD;AAEzF;AACJ"}
@@ -1,6 +1,9 @@
1
+ import { type LogRocketInstrumentationPartialClient, type TelemetryContext } from "@workleap-telemetry/core";
1
2
  import { type RootLogger } from "@workleap/logging";
2
- import { type Environment } from "./env.ts";
3
+ import { type MixpanelEnvironment } from "./env.ts";
4
+ import { MixpanelClient, type MixpanelGlobalEventProperties } from "./MixpanelClient.ts";
3
5
  export declare const IsInitializedVariableName = "__WLP_MIXPANEL_IS_INITIALIZED__";
6
+ export declare function __resetRegistrationGuard(): void;
4
7
  /**
5
8
  * @see {@link https://workleap.github.io/wl-telemetry}
6
9
  */
@@ -8,24 +11,42 @@ export interface InitializeMixpanelOptions {
8
11
  /**
9
12
  * An optional tracking endpoint.
10
13
  * @default "tracking/track"
14
+ * @see {@link https://workleap.github.io/wl-telemetry}
11
15
  */
12
16
  trackingEndpoint?: string;
17
+ /**
18
+ * Context including telemetry correlation ids.
19
+ * @see {@link https://workleap.github.io/wl-telemetry}
20
+ */
21
+ telemetryContext?: TelemetryContext;
22
+ /**
23
+ * An optional LogRocket client to automatically add the LogRocket
24
+ * session URL to Mixpanel events once it's available.
25
+ * @see {@link https://workleap.github.io/wl-telemetry}
26
+ */
27
+ logRocketInstrumentationClient?: LogRocketInstrumentationPartialClient;
13
28
  /**
14
29
  * Whether or not debug information should be logged to the console.
30
+ * @see {@link https://workleap.github.io/wl-telemetry}
15
31
  */
16
32
  verbose?: boolean;
17
33
  /**
18
34
  * An array of RootLogger instances.
35
+ * @see {@link https://workleap.github.io/wl-telemetry}
19
36
  */
20
37
  loggers?: RootLogger[];
21
38
  }
22
- export declare function __resetInitializationGuard(): void;
39
+ export declare class MixpanelInitializer {
40
+ #private;
41
+ constructor(globalEventProperties: MixpanelGlobalEventProperties);
42
+ initialize(productId: string, envOrTrackingApiBaseUrl: MixpanelEnvironment | (string & {}), options?: InitializeMixpanelOptions): MixpanelClient;
43
+ }
23
44
  /**
24
- * Creates a function that sends tracking events to the tracking API.
25
- * @param productId Your product identifier.
45
+ * Initialize Mixpanel telemetry.
46
+ * @param productId The Mixpanel product identifier.
26
47
  * @param envOrTrackingApiBaseUrl The environment to get the navigation url from or a base URL.
27
- * @param options Options for creating the tracking function.
28
- * @returns A function that sends tracking events to the tracking API.
48
+ * @param options Mixpanel instrumentation options.
49
+ * @returns {MixpanelClient} A Mixpanel client instance.
29
50
  * @see {@link https://workleap.github.io/wl-telemetry}
30
51
  */
31
- export declare function initializeMixpanel(productId: string, envOrTrackingApiBaseUrl: Environment | (string & {}), options?: InitializeMixpanelOptions): void;
52
+ export declare function initializeMixpanel(productId: string, envOrTrackingApiBaseUrl: MixpanelEnvironment | (string & {}), options?: InitializeMixpanelOptions): MixpanelClient;
@@ -1,19 +1,19 @@
1
+ import { HasExecutedGuard } from "@workleap-telemetry/core";
1
2
  import { createCompositeLogger } from "@workleap/logging";
2
- import { createBootstrappingStore, createTelemetryContext } from "@workleap/telemetry";
3
3
  import { setMixpanelContext } from "./context.js";
4
4
  import { getTrackingEndpoint } from "./env.js";
5
- import { HasExecutedGuard } from "./HasExecutedGuard.js";
6
- import { OtherProperties, getSuperProperties, getTelemetryProperties, setSuperProperties, setSuperProperty } from "./properties.js";
5
+ import { MixpanelClient } from "./MixpanelClient.js";
6
+ import { OtherProperties, getTelemetryProperties } from "./properties.js";
7
7
 
8
- ;// CONCATENATED MODULE: external "@workleap/logging"
8
+ ;// CONCATENATED MODULE: external "@workleap-telemetry/core"
9
9
 
10
- ;// CONCATENATED MODULE: external "@workleap/telemetry"
10
+ ;// CONCATENATED MODULE: external "@workleap/logging"
11
11
 
12
12
  ;// CONCATENATED MODULE: external "./context.js"
13
13
 
14
14
  ;// CONCATENATED MODULE: external "./env.js"
15
15
 
16
- ;// CONCATENATED MODULE: external "./HasExecutedGuard.js"
16
+ ;// CONCATENATED MODULE: external "./MixpanelClient.js"
17
17
 
18
18
  ;// CONCATENATED MODULE: external "./properties.js"
19
19
 
@@ -24,58 +24,15 @@ import { OtherProperties, getSuperProperties, getTelemetryProperties, setSuperPr
24
24
 
25
25
 
26
26
 
27
+ // DEPRECATED: Grace period ends on January 1th 2026.
28
+ // Don't forget to remove the tests as well.
27
29
  const IsInitializedVariableName = "__WLP_MIXPANEL_IS_INITIALIZED__";
28
- function registerLogRocketSessionUrlListener(logger) {
29
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
30
- // @ts-ignore
31
- if (globalThis.__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__) {
32
- // Automatically add the LogRocket session URL to all Honeycomb traces as an attribute.
33
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
34
- // @ts-ignore
35
- globalThis.__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__((sessionUrl)=>{
36
- logger.withText("[mixpanel] Received LogRocket session replay URL:").withText(sessionUrl).debug();
37
- setSuperProperty(OtherProperties.LogRocketSessionUrl, sessionUrl);
38
- });
39
- } else {
40
- logger.information("[mixpanel] Cannot integrate with LogRocket because \"globalThis.__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__\" is not available.");
41
- }
42
- }
43
- const initializationGuard = new HasExecutedGuard();
44
- // This function should only be used by tests.
45
- function __resetInitializationGuard() {
46
- initializationGuard.reset();
47
- }
48
- /**
49
- * Creates a function that sends tracking events to the tracking API.
50
- * @param productId Your product identifier.
51
- * @param envOrTrackingApiBaseUrl The environment to get the navigation url from or a base URL.
52
- * @param options Options for creating the tracking function.
53
- * @returns A function that sends tracking events to the tracking API.
54
- * @see {@link https://workleap.github.io/wl-telemetry}
55
- */ function initializeMixpanel(productId, envOrTrackingApiBaseUrl, options = {}) {
56
- const { trackingEndpoint, verbose = false, loggers = [] } = options;
57
- initializationGuard.throw("[mixpanel] Mixpanel has already been initialized. Did you call the \"initializeMixpanel\" function twice?");
58
- const logger = createCompositeLogger(verbose, loggers);
59
- const endpoint = getTrackingEndpoint(envOrTrackingApiBaseUrl, trackingEndpoint);
60
- const telemetryContext = createTelemetryContext(logger);
61
- setSuperProperties(getTelemetryProperties(telemetryContext));
62
- const bootstrappingStore = createBootstrappingStore(logger);
63
- // If LogRocket is already available, register the listener. Otherwise, subscribe to the bootstrapping store
64
- // and register the listener once a notification is received that LogRocket is registered.
65
- if (bootstrappingStore.state.isLogRocketReady) {
66
- registerLogRocketSessionUrlListener(logger);
67
- } else {
68
- bootstrappingStore.subscribe((action, store, unsubscribe)=>{
69
- if (store.state.isLogRocketReady) {
70
- unsubscribe();
71
- registerLogRocketSessionUrlListener(logger);
72
- }
73
- });
74
- }
30
+ // DEPRECATED: Grace period ends on January 1th 2026.
31
+ function registerDeprecatedContextAndGlobalVariables(productId, endpoint, globalEventProperties, logger) {
75
32
  setMixpanelContext({
76
33
  productId,
77
34
  endpoint,
78
- superProperties: getSuperProperties(),
35
+ globalEventProperties,
79
36
  logger
80
37
  });
81
38
  // Indicates to the host applications that Mixpanel has been initialized.
@@ -84,9 +41,63 @@ function __resetInitializationGuard() {
84
41
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
85
42
  // @ts-ignore
86
43
  globalThis[IsInitializedVariableName] = true;
87
- logger.information("[mixpanel] Mixpanel is initialized.");
44
+ }
45
+ ///////////////////////////
46
+ let registrationGuardInstance;
47
+ // It's important to use a lazy singleton instead of a singleton to avoid
48
+ // any future probleme related to HMR, tree-shaking, SSR, etc..
49
+ function getRegistrationGuard() {
50
+ if (!registrationGuardInstance) {
51
+ registrationGuardInstance = new HasExecutedGuard();
52
+ }
53
+ return registrationGuardInstance;
54
+ }
55
+ // This function should only be used by tests.
56
+ function __resetRegistrationGuard() {
57
+ if (registrationGuardInstance) {
58
+ registrationGuardInstance.reset();
59
+ }
60
+ }
61
+ class MixpanelInitializer {
62
+ #globalEventProperties;
63
+ constructor(globalEventProperties){
64
+ this.#globalEventProperties = globalEventProperties;
65
+ }
66
+ initialize(productId, envOrTrackingApiBaseUrl, options = {}) {
67
+ const { trackingEndpoint, telemetryContext, logRocketInstrumentationClient, verbose = false, loggers = [] } = options;
68
+ const logger = createCompositeLogger(verbose, loggers);
69
+ const endpoint = getTrackingEndpoint(envOrTrackingApiBaseUrl, trackingEndpoint);
70
+ // Set the telemetry correlation ids on every Mixpanel event.
71
+ if (telemetryContext) {
72
+ for (const [key, value] of Object.entries(getTelemetryProperties(telemetryContext))){
73
+ this.#globalEventProperties.set(key, value);
74
+ }
75
+ }
76
+ // If a LogRocket client is already available, register a listener to get the LogRocket session url
77
+ // once it's available to set it on every Mixpanel event.
78
+ if (logRocketInstrumentationClient) {
79
+ logRocketInstrumentationClient.registerGetSessionUrlListener((sessionUrl)=>{
80
+ logger.withText("[mixpanel] Received LogRocket session replay URL:").withText(sessionUrl).debug();
81
+ this.#globalEventProperties.set(OtherProperties.LogRocketSessionUrl, sessionUrl);
82
+ });
83
+ }
84
+ registerDeprecatedContextAndGlobalVariables(productId, endpoint, this.#globalEventProperties, logger);
85
+ logger.information("[mixpanel] Mixpanel is initialized.");
86
+ return new MixpanelClient(productId, endpoint, this.#globalEventProperties, logger);
87
+ }
88
+ }
89
+ /**
90
+ * Initialize Mixpanel telemetry.
91
+ * @param productId The Mixpanel product identifier.
92
+ * @param envOrTrackingApiBaseUrl The environment to get the navigation url from or a base URL.
93
+ * @param options Mixpanel instrumentation options.
94
+ * @returns {MixpanelClient} A Mixpanel client instance.
95
+ * @see {@link https://workleap.github.io/wl-telemetry}
96
+ */ function initializeMixpanel(productId, envOrTrackingApiBaseUrl, options) {
97
+ getRegistrationGuard().throw("[mixpanel] Mixpanel has already been initialized. Did you call the \"initializeMixpanel\" function twice?");
98
+ return new MixpanelInitializer(new Map()).initialize(productId, envOrTrackingApiBaseUrl, options);
88
99
  }
89
100
 
90
- export { IsInitializedVariableName, __resetInitializationGuard, initializeMixpanel };
101
+ export { IsInitializedVariableName, MixpanelInitializer, __resetRegistrationGuard, initializeMixpanel };
91
102
 
92
103
  //# sourceMappingURL=initializeMixpanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"js/initializeMixpanel.js","sources":["webpack://@workleap/mixpanel/./src/js/initializeMixpanel.ts"],"sourcesContent":["import { createCompositeLogger, type Logger, type RootLogger } from \"@workleap/logging\";\nimport { createBootstrappingStore, createTelemetryContext } from \"@workleap/telemetry\";\nimport { setMixpanelContext } from \"./context.ts\";\nimport { getTrackingEndpoint, type Environment } from \"./env.ts\";\nimport { HasExecutedGuard } from \"./HasExecutedGuard.ts\";\nimport { getSuperProperties, getTelemetryProperties, OtherProperties, setSuperProperties, setSuperProperty } from \"./properties.ts\";\n\nexport const IsInitializedVariableName = \"__WLP_MIXPANEL_IS_INITIALIZED__\";\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface InitializeMixpanelOptions {\n /**\n * An optional tracking endpoint.\n * @default \"tracking/track\"\n */\n trackingEndpoint?: string;\n /**\n * Whether or not debug information should be logged to the console.\n */\n verbose?: boolean;\n /**\n * An array of RootLogger instances.\n */\n loggers?: RootLogger[];\n}\n\nfunction registerLogRocketSessionUrlListener(logger: Logger) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (globalThis.__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__) {\n // Automatically add the LogRocket session URL to all Honeycomb traces as an attribute.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis.__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__((sessionUrl: string) => {\n logger\n .withText(\"[mixpanel] Received LogRocket session replay URL:\")\n .withText(sessionUrl)\n .debug();\n\n setSuperProperty(OtherProperties.LogRocketSessionUrl, sessionUrl);\n });\n } else {\n logger.information(\"[mixpanel] Cannot integrate with LogRocket because \\\"globalThis.__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__\\\" is not available.\");\n }\n}\n\nconst initializationGuard = new HasExecutedGuard();\n\n// This function should only be used by tests.\nexport function __resetInitializationGuard() {\n initializationGuard.reset();\n}\n\n/**\n * Creates a function that sends tracking events to the tracking API.\n * @param productId Your product identifier.\n * @param envOrTrackingApiBaseUrl The environment to get the navigation url from or a base URL.\n * @param options Options for creating the tracking function.\n * @returns A function that sends tracking events to the tracking API.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function initializeMixpanel(productId: string, envOrTrackingApiBaseUrl: Environment | (string & {}), options: InitializeMixpanelOptions = {}) {\n const {\n trackingEndpoint,\n verbose = false,\n loggers = []\n } = options;\n\n initializationGuard.throw(\"[mixpanel] Mixpanel has already been initialized. Did you call the \\\"initializeMixpanel\\\" function twice?\");\n\n const logger = createCompositeLogger(verbose, loggers);\n const endpoint = getTrackingEndpoint(envOrTrackingApiBaseUrl, trackingEndpoint);\n const telemetryContext = createTelemetryContext(logger);\n\n setSuperProperties(getTelemetryProperties(telemetryContext));\n\n const bootstrappingStore = createBootstrappingStore(logger);\n\n // If LogRocket is already available, register the listener. Otherwise, subscribe to the bootstrapping store\n // and register the listener once a notification is received that LogRocket is registered.\n if (bootstrappingStore.state.isLogRocketReady) {\n registerLogRocketSessionUrlListener(logger);\n } else {\n bootstrappingStore.subscribe((action, store, unsubscribe) => {\n if (store.state.isLogRocketReady) {\n unsubscribe();\n registerLogRocketSessionUrlListener(logger);\n }\n });\n }\n\n setMixpanelContext({\n productId,\n endpoint,\n superProperties: getSuperProperties(),\n logger\n });\n\n // Indicates to the host applications that Mixpanel has been initialized.\n // It's useful in cases where an \"add-on\", like the platform widgets needs\n // to know whether or not the host application is using Mixpanel.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[IsInitializedVariableName] = true;\n\n logger.information(\"[mixpanel] Mixpanel is initialized.\");\n}\n"],"names":["createCompositeLogger","createBootstrappingStore","createTelemetryContext","setMixpanelContext","getTrackingEndpoint","HasExecutedGuard","getSuperProperties","getTelemetryProperties","OtherProperties","setSuperProperties","setSuperProperty","IsInitializedVariableName","registerLogRocketSessionUrlListener","logger","globalThis","sessionUrl","initializationGuard","__resetInitializationGuard","initializeMixpanel","productId","envOrTrackingApiBaseUrl","options","trackingEndpoint","verbose","loggers","endpoint","telemetryContext","bootstrappingStore","action","store","unsubscribe"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwF;AACD;AACrC;AACe;AACR;AAC2E;AAE7H,MAAMW,4BAA4B,kCAAkC;AAqB3E,SAASC,oCAAoCC,MAAc;IACvD,6DAA6D;IAC7D,aAAa;IACb,IAAIC,WAAW,mEAAmE,EAAE;QAChF,uFAAuF;QACvF,6DAA6D;QAC7D,aAAa;QACbA,WAAW,mEAAmE,CAAC,CAACC;YAC5EF,OACK,QAAQ,CAAC,qDACT,QAAQ,CAACE,YACT,KAAK;YAEVL,gBAAgBA,CAACF,mCAAmC,EAAEO;QAC1D;IACJ,OAAO;QACHF,OAAO,WAAW,CAAC;IACvB;AACJ;AAEA,MAAMG,sBAAsB,IAAIX,gBAAgBA;AAEhD,8CAA8C;AACvC,SAASY;IACZD,oBAAoB,KAAK;AAC7B;AAEA;;;;;;;CAOC,GACM,SAASE,mBAAmBC,SAAiB,EAAEC,uBAAoD,EAAEC,UAAqC,CAAC,CAAC;IAC/I,MAAM,EACFC,gBAAgB,EAChBC,UAAU,KAAK,EACfC,UAAU,EAAE,EACf,GAAGH;IAEJL,oBAAoB,KAAK,CAAC;IAE1B,MAAMH,SAASb,qBAAqBA,CAACuB,SAASC;IAC9C,MAAMC,WAAWrB,mBAAmBA,CAACgB,yBAAyBE;IAC9D,MAAMI,mBAAmBxB,sBAAsBA,CAACW;IAEhDJ,kBAAkBA,CAACF,sBAAsBA,CAACmB;IAE1C,MAAMC,qBAAqB1B,wBAAwBA,CAACY;IAEpD,4GAA4G;IAC5G,0FAA0F;IAC1F,IAAIc,mBAAmB,KAAK,CAAC,gBAAgB,EAAE;QAC3Cf,oCAAoCC;IACxC,OAAO;QACHc,mBAAmB,SAAS,CAAC,CAACC,QAAQC,OAAOC;YACzC,IAAID,MAAM,KAAK,CAAC,gBAAgB,EAAE;gBAC9BC;gBACAlB,oCAAoCC;YACxC;QACJ;IACJ;IAEAV,kBAAkBA,CAAC;QACfgB;QACAM;QACA,iBAAiBnB,kBAAkBA;QACnCO;IACJ;IAEA,yEAAyE;IACzE,0EAA0E;IAC1E,iEAAiE;IACjE,6DAA6D;IAC7D,aAAa;IACbC,UAAU,CAACH,0BAA0B,GAAG;IAExCE,OAAO,WAAW,CAAC;AACvB"}
1
+ {"version":3,"file":"js/initializeMixpanel.js","sources":["webpack://@workleap/mixpanel/./src/js/initializeMixpanel.ts"],"sourcesContent":["import { HasExecutedGuard, type LogRocketInstrumentationPartialClient, type TelemetryContext } from \"@workleap-telemetry/core\";\nimport { createCompositeLogger, type Logger, type RootLogger } from \"@workleap/logging\";\nimport { setMixpanelContext } from \"./context.ts\";\nimport { getTrackingEndpoint, type MixpanelEnvironment } from \"./env.ts\";\nimport { MixpanelClient, type MixpanelGlobalEventProperties } from \"./MixpanelClient.ts\";\nimport { getTelemetryProperties, OtherProperties } from \"./properties.ts\";\n\n// DEPRECATED: Grace period ends on January 1th 2026.\n// Don't forget to remove the tests as well.\nexport const IsInitializedVariableName = \"__WLP_MIXPANEL_IS_INITIALIZED__\";\n\n// DEPRECATED: Grace period ends on January 1th 2026.\nfunction registerDeprecatedContextAndGlobalVariables(productId: string, endpoint: string, globalEventProperties: Map<string, unknown>, logger: Logger) {\n setMixpanelContext({\n productId,\n endpoint,\n globalEventProperties,\n logger\n });\n\n // Indicates to the host applications that Mixpanel has been initialized.\n // It's useful in cases where an \"add-on\", like the platform widgets needs\n // to know whether or not the host application is using Mixpanel.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[IsInitializedVariableName] = true;\n}\n\n///////////////////////////\n\nlet registrationGuardInstance: HasExecutedGuard | undefined;\n\n// It's important to use a lazy singleton instead of a singleton to avoid\n// any future probleme related to HMR, tree-shaking, SSR, etc..\nfunction getRegistrationGuard() {\n if (!registrationGuardInstance) {\n registrationGuardInstance = new HasExecutedGuard();\n }\n\n return registrationGuardInstance;\n}\n\n// This function should only be used by tests.\nexport function __resetRegistrationGuard() {\n if (registrationGuardInstance) {\n registrationGuardInstance.reset();\n }\n}\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface InitializeMixpanelOptions {\n /**\n * An optional tracking endpoint.\n * @default \"tracking/track\"\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n trackingEndpoint?: string;\n /**\n * Context including telemetry correlation ids.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n telemetryContext?: TelemetryContext;\n /**\n * An optional LogRocket client to automatically add the LogRocket\n * session URL to Mixpanel events once it's available.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n logRocketInstrumentationClient?: LogRocketInstrumentationPartialClient;\n /**\n * Whether or not debug information should be logged to the console.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n verbose?: boolean;\n /**\n * An array of RootLogger instances.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n loggers?: RootLogger[];\n}\n\n\nexport class MixpanelInitializer {\n readonly #globalEventProperties: MixpanelGlobalEventProperties;\n\n constructor(globalEventProperties: MixpanelGlobalEventProperties) {\n this.#globalEventProperties = globalEventProperties;\n }\n\n initialize(\n productId: string,\n envOrTrackingApiBaseUrl: MixpanelEnvironment | (string & {}),\n options: InitializeMixpanelOptions = {}\n ) {\n const {\n trackingEndpoint,\n telemetryContext,\n logRocketInstrumentationClient,\n verbose = false,\n loggers = []\n } = options;\n\n const logger = createCompositeLogger(verbose, loggers);\n const endpoint = getTrackingEndpoint(envOrTrackingApiBaseUrl, trackingEndpoint);\n\n // Set the telemetry correlation ids on every Mixpanel event.\n if (telemetryContext) {\n for (const [key, value] of Object.entries(getTelemetryProperties(telemetryContext))) {\n this.#globalEventProperties.set(key, value);\n }\n }\n\n // If a LogRocket client is already available, register a listener to get the LogRocket session url\n // once it's available to set it on every Mixpanel event.\n if (logRocketInstrumentationClient) {\n logRocketInstrumentationClient.registerGetSessionUrlListener((sessionUrl: string) => {\n logger\n .withText(\"[mixpanel] Received LogRocket session replay URL:\")\n .withText(sessionUrl)\n .debug();\n\n this.#globalEventProperties.set(OtherProperties.LogRocketSessionUrl, sessionUrl);\n });\n }\n\n registerDeprecatedContextAndGlobalVariables(productId, endpoint, this.#globalEventProperties, logger);\n\n logger.information(\"[mixpanel] Mixpanel is initialized.\");\n\n return new MixpanelClient(productId, endpoint, this.#globalEventProperties, logger);\n }\n}\n\n/**\n * Initialize Mixpanel telemetry.\n * @param productId The Mixpanel product identifier.\n * @param envOrTrackingApiBaseUrl The environment to get the navigation url from or a base URL.\n * @param options Mixpanel instrumentation options.\n * @returns {MixpanelClient} A Mixpanel client instance.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function initializeMixpanel(\n productId: string,\n envOrTrackingApiBaseUrl: MixpanelEnvironment | (string & {}),\n options?: InitializeMixpanelOptions\n) {\n getRegistrationGuard().throw(\"[mixpanel] Mixpanel has already been initialized. Did you call the \\\"initializeMixpanel\\\" function twice?\");\n\n return new MixpanelInitializer(\n new Map<string, unknown>()\n ).initialize(\n productId,\n envOrTrackingApiBaseUrl,\n options\n );\n}\n"],"names":["HasExecutedGuard","createCompositeLogger","setMixpanelContext","getTrackingEndpoint","MixpanelClient","getTelemetryProperties","OtherProperties","IsInitializedVariableName","registerDeprecatedContextAndGlobalVariables","productId","endpoint","globalEventProperties","logger","globalThis","registrationGuardInstance","getRegistrationGuard","__resetRegistrationGuard","MixpanelInitializer","envOrTrackingApiBaseUrl","options","trackingEndpoint","telemetryContext","logRocketInstrumentationClient","verbose","loggers","key","value","Object","sessionUrl","initializeMixpanel","Map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAA+H;AACvC;AACtC;AACuB;AACgB;AACf;AAE1E,qDAAqD;AACrD,4CAA4C;AACrC,MAAMO,4BAA4B,kCAAkC;AAE3E,qDAAqD;AACrD,SAASC,4CAA4CC,SAAiB,EAAEC,QAAgB,EAAEC,qBAA2C,EAAEC,MAAc;IACjJV,kBAAkBA,CAAC;QACfO;QACAC;QACAC;QACAC;IACJ;IAEA,yEAAyE;IACzE,0EAA0E;IAC1E,iEAAiE;IACjE,6DAA6D;IAC7D,aAAa;IACbC,UAAU,CAACN,0BAA0B,GAAG;AAC5C;AAEA,2BAA2B;AAE3B,IAAIO;AAEJ,yEAAyE;AACzE,+DAA+D;AAC/D,SAASC;IACL,IAAI,CAACD,2BAA2B;QAC5BA,4BAA4B,IAAId,gBAAgBA;IACpD;IAEA,OAAOc;AACX;AAEA,8CAA8C;AACvC,SAASE;IACZ,IAAIF,2BAA2B;QAC3BA,0BAA0B,KAAK;IACnC;AACJ;AAsCO,MAAMG;IACA,sBAAsB,CAAgC;IAE/D,YAAYN,qBAAoD,CAAE;QAC9D,IAAI,CAAC,sBAAsB,GAAGA;IAClC;IAEA,WACIF,SAAiB,EACjBS,uBAA4D,EAC5DC,UAAqC,CAAC,CAAC,EACzC;QACE,MAAM,EACFC,gBAAgB,EAChBC,gBAAgB,EAChBC,8BAA8B,EAC9BC,UAAU,KAAK,EACfC,UAAU,EAAE,EACf,GAAGL;QAEJ,MAAMP,SAASX,qBAAqBA,CAACsB,SAASC;QAC9C,MAAMd,WAAWP,mBAAmBA,CAACe,yBAAyBE;QAE9D,6DAA6D;QAC7D,IAAIC,kBAAkB;YAClB,KAAK,MAAM,CAACI,KAAKC,MAAM,IAAIC,OAAO,OAAO,CAACtB,sBAAsBA,CAACgB,mBAAoB;gBACjF,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAACI,KAAKC;YACzC;QACJ;QAEA,mGAAmG;QACnG,yDAAyD;QACzD,IAAIJ,gCAAgC;YAChCA,+BAA+B,6BAA6B,CAAC,CAACM;gBAC1DhB,OACK,QAAQ,CAAC,qDACT,QAAQ,CAACgB,YACT,KAAK;gBAEV,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAACtB,mCAAmC,EAAEsB;YACzE;QACJ;QAEApB,4CAA4CC,WAAWC,UAAU,IAAI,CAAC,sBAAsB,EAAEE;QAE9FA,OAAO,WAAW,CAAC;QAEnB,OAAO,IAAIR,cAAcA,CAACK,WAAWC,UAAU,IAAI,CAAC,sBAAsB,EAAEE;IAChF;AACJ;AAEA;;;;;;;CAOC,GACM,SAASiB,mBACZpB,SAAiB,EACjBS,uBAA4D,EAC5DC,OAAmC;IAEnCJ,uBAAuB,KAAK,CAAC;IAE7B,OAAO,IAAIE,oBACP,IAAIa,OACN,UAAU,CACRrB,WACAS,yBACAC;AAER"}
@@ -1,4 +1,4 @@
1
- import type { TelemetryContext } from "@workleap/telemetry";
1
+ import type { TelemetryContext } from "@workleap-telemetry/core";
2
2
  export type MixpanelEventProperties = Record<string, unknown>;
3
3
  export declare const BaseProperties: {
4
4
  readonly Browser: "$browser";
@@ -35,8 +35,3 @@ export declare function getTelemetryProperties(context: TelemetryContext): {
35
35
  export declare const OtherProperties: {
36
36
  LogRocketSessionUrl: string;
37
37
  };
38
- export type SuperProperties = Map<string, unknown>;
39
- export declare function setSuperProperty(key: string, value: unknown): void;
40
- export declare function setSuperProperties(values: Record<string, unknown>): void;
41
- export declare function getSuperProperties(): SuperProperties;
42
- export declare function __clearSuperProperties(): void;