@workleap/logrocket 2.1.2 → 2.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @workleap/logrocket
2
2
 
3
+ ## 2.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#111](https://github.com/workleap/wl-telemetry/pull/111) [`e146e03`](https://github.com/workleap/wl-telemetry/commit/e146e030aa9e4a624d4429e0ba4f0627153179cc) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added a `NoopTelemetryClient` and added `dontThrowOnUndefined` option to the hooks to retrieve the telemetry clients.
8
+
3
9
  ## 2.1.2
4
10
 
5
11
  ### Patch Changes
@@ -80,9 +80,7 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
80
80
  /**
81
81
  * @see {@link https://workleap.github.io/wl-telemetry}
82
82
  */
83
- export declare class LogRocketInstrumentationClient implements LogRocketInstrumentationPartialClient {
84
- #private;
85
- constructor(telemetryContext?: TelemetryContext);
83
+ export interface LogRocketInstrumentationClient extends LogRocketInstrumentationPartialClient {
86
84
  /**
87
85
  * Register a listener to receive the LogRocket session id when it's available.
88
86
  * This method is the equivalent of the LogRocket.getSessionURL function but is
@@ -90,11 +88,17 @@ export declare class LogRocketInstrumentationClient implements LogRocketInstrume
90
88
  * on `logrocket`.
91
89
  * @see {@link https://workleap.github.io/wl-telemetry}
92
90
  */
93
- registerGetSessionUrlListener(listener: GetLogRocketSessionUrlListener): void;
91
+ registerGetSessionUrlListener: (listener: GetLogRocketSessionUrlListener) => void;
94
92
  /**
95
93
  * Create the default user traits for a Workleap Platform user.
96
94
  * @see {@link https://workleap.github.io/wl-telemetry}
97
95
  */
96
+ createWorkleapPlatformDefaultUserTraits: (identification: LogRocketWorkleapPlatformIdentification) => LogRocketWorkleapPlatformUserTraits;
97
+ }
98
+ export declare class LogRocketInstrumentationClientImpl implements LogRocketInstrumentationClient {
99
+ #private;
100
+ constructor(telemetryContext?: TelemetryContext);
101
+ registerGetSessionUrlListener(listener: GetLogRocketSessionUrlListener): void;
98
102
  createWorkleapPlatformDefaultUserTraits(identification: LogRocketWorkleapPlatformIdentification): {
99
103
  "Plan Code - Compensation"?: string | undefined;
100
104
  "Plan Code - Pingboard"?: string | undefined;
@@ -10,29 +10,17 @@ import { isDefined } from "./assertions.js";
10
10
 
11
11
  const DeviceIdTrait = "Device Id";
12
12
  const TelemetryIdTrait = "Telemetry Id";
13
- ///////////////////////////
14
- /**
15
- * @see {@link https://workleap.github.io/wl-telemetry}
16
- */ class LogRocketInstrumentationClient {
13
+ class LogRocketInstrumentationClientImpl {
17
14
  #telemetryContext;
18
15
  constructor(telemetryContext){
19
16
  this.#telemetryContext = telemetryContext;
20
17
  }
21
18
  // IMPORTANT: If you update this method, make sure to update the LogRocketInstrumentationPartialClient
22
19
  // interface as well in @workleap-telemetry/core.
23
- /**
24
- * Register a listener to receive the LogRocket session id when it's available.
25
- * This method is the equivalent of the LogRocket.getSessionURL function but is
26
- * particularly useful for third party libraries that doesn't want to take a dependency
27
- * on `logrocket`.
28
- * @see {@link https://workleap.github.io/wl-telemetry}
29
- */ registerGetSessionUrlListener(listener) {
20
+ registerGetSessionUrlListener(listener) {
30
21
  logrocket.getSessionURL(listener);
31
22
  }
32
- /**
33
- * Create the default user traits for a Workleap Platform user.
34
- * @see {@link https://workleap.github.io/wl-telemetry}
35
- */ createWorkleapPlatformDefaultUserTraits(identification) {
23
+ createWorkleapPlatformDefaultUserTraits(identification) {
36
24
  const { userId, organizationId, organizationName, isMigratedToWorkleap, isOrganizationCreator, isAdmin, isExecutive, isCollaborator, isReportingManager, isTeamManager, planCode } = identification;
37
25
  const isExecutiveInAnyProduct = Boolean(isExecutive?.wov || isExecutive?.lms || isExecutive?.onb || isExecutive?.sks || isExecutive?.wpm || isExecutive?.pbd || isExecutive?.cmp);
38
26
  const isCollaboratorInAnyProduct = Boolean(isCollaborator?.wov || isCollaborator?.lms || isCollaborator?.onb || isCollaborator?.sks || isCollaborator?.wpm || isCollaborator?.pbd || isCollaborator?.cmp);
@@ -126,6 +114,6 @@ const TelemetryIdTrait = "Telemetry Id";
126
114
  }
127
115
  }
128
116
 
129
- export { DeviceIdTrait, LogRocketInstrumentationClient, TelemetryIdTrait };
117
+ export { DeviceIdTrait, LogRocketInstrumentationClientImpl, TelemetryIdTrait };
130
118
 
131
119
  //# sourceMappingURL=LogRocketInstrumentationClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"js/LogRocketInstrumentationClient.js","sources":["webpack://@workleap/logrocket/./src/js/LogRocketInstrumentationClient.ts"],"sourcesContent":["import type { LogRocketInstrumentationPartialClient, TelemetryContext } from \"@workleap-telemetry/core\";\nimport LogRocket from \"logrocket\";\nimport { isDefined } from \"./assertions.ts\";\n\nexport type GetLogRocketSessionUrlListener = (sessionURL: string) => void;\n\nexport const DeviceIdTrait = \"Device Id\";\nexport const TelemetryIdTrait = \"Telemetry Id\";\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketWorkleapPlatformIdentification {\n userId: string;\n organizationId: string;\n organizationName: string;\n isMigratedToWorkleap: boolean;\n isAdmin: boolean;\n isOrganizationCreator?: boolean;\n isExecutive?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n cmp?: boolean;\n };\n isCollaborator?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n cmp?: boolean;\n };\n isReportingManager?: boolean;\n isTeamManager?: boolean;\n planCode?: {\n wov?: string;\n lms?: string;\n onb?: string;\n sks?: string;\n wpm?: string;\n pbd?: string;\n cmp?: string;\n };\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketWorkleapPlatformUserTraits extends Record<string, unknown> {\n \"User Id\": string;\n \"Organization Id\": string;\n \"Organization Name\": string;\n \"Is Migrated To Workleap\": boolean;\n \"Is Admin\": boolean;\n [DeviceIdTrait]: string;\n [TelemetryIdTrait]: string;\n \"Is Organization Creator\"?: boolean;\n \"Is Executive\"?: boolean;\n \"Is Executive - Officevibe\"?: boolean;\n \"Is Executive - LMS\"?: boolean;\n \"Is Executive - Onboarding\"?: boolean;\n \"Is Executive - Skills\"?: boolean;\n \"Is Executive - Performance\"?: boolean;\n \"Is Executive - Pingboard\"?: boolean;\n \"Is Collaborator\"?: boolean;\n \"Is Collaborator - Officevibe\"?: boolean;\n \"Is Collaborator - LMS\"?: boolean;\n \"Is Collaborator - Onboarding\"?: boolean;\n \"Is Collaborator - Skills\"?: boolean;\n \"Is Collaborator - Performance\"?: boolean;\n \"Is Collaborator - Pingboard\"?: boolean;\n \"Is Reporting Manager\"?: boolean;\n \"Is Team Manager\"?: boolean;\n \"Plan Code - Officevibe\"?: string;\n \"Plan Code - LMS\"?: string;\n \"Plan Code - Onboarding\"?: string;\n \"Plan Code - Skills\"?: string;\n \"Plan Code - Performance\"?: string;\n \"Plan Code - Pingboard\"?: string;\n}\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport class LogRocketInstrumentationClient implements LogRocketInstrumentationPartialClient {\n readonly #telemetryContext?: TelemetryContext;\n\n constructor(telemetryContext?: TelemetryContext) {\n this.#telemetryContext = telemetryContext;\n }\n\n // IMPORTANT: If you update this method, make sure to update the LogRocketInstrumentationPartialClient\n // interface as well in @workleap-telemetry/core.\n /**\n * Register a listener to receive the LogRocket session id when it's available.\n * This method is the equivalent of the LogRocket.getSessionURL function but is\n * particularly useful for third party libraries that doesn't want to take a dependency\n * on `logrocket`.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n registerGetSessionUrlListener(listener: GetLogRocketSessionUrlListener) {\n LogRocket.getSessionURL(listener);\n }\n\n /**\n * Create the default user traits for a Workleap Platform user.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n createWorkleapPlatformDefaultUserTraits(identification: LogRocketWorkleapPlatformIdentification) {\n const {\n userId,\n organizationId,\n organizationName,\n isMigratedToWorkleap,\n isOrganizationCreator,\n isAdmin,\n isExecutive,\n isCollaborator,\n isReportingManager,\n isTeamManager,\n planCode\n } = identification;\n\n const isExecutiveInAnyProduct = Boolean(\n isExecutive?.wov ||\n isExecutive?.lms ||\n isExecutive?.onb ||\n isExecutive?.sks ||\n isExecutive?.wpm ||\n isExecutive?.pbd ||\n isExecutive?.cmp\n );\n\n const isCollaboratorInAnyProduct = Boolean(\n isCollaborator?.wov ||\n isCollaborator?.lms ||\n isCollaborator?.onb ||\n isCollaborator?.sks ||\n isCollaborator?.wpm ||\n isCollaborator?.pbd ||\n isCollaborator?.cmp\n );\n\n return {\n \"User Id\": userId,\n \"Organization Id\": organizationId,\n \"Organization Name\": organizationName,\n \"Is Migrated To Workleap\": isMigratedToWorkleap,\n \"Is Admin\": isAdmin,\n [DeviceIdTrait]: this.#telemetryContext?.deviceId ?? \"N/A\",\n [TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? \"N/A\",\n ...(isDefined(isOrganizationCreator) && { \"Is Organization Creator\": isOrganizationCreator }),\n ...(isExecutiveInAnyProduct && { \"Is Executive\": true }),\n ...(isDefined(isExecutive?.wov) && { \"Is Executive - Officevibe\": isExecutive.wov }),\n ...(isDefined(isExecutive?.lms) && { \"Is Executive - LMS\": isExecutive.lms }),\n ...(isDefined(isExecutive?.onb) && { \"Is Executive - Onboarding\": isExecutive.onb }),\n ...(isDefined(isExecutive?.sks) && { \"Is Executive - Skills\": isExecutive.sks }),\n ...(isDefined(isExecutive?.wpm) && { \"Is Executive - Performance\": isExecutive.wpm }),\n ...(isDefined(isExecutive?.pbd) && { \"Is Executive - Pingboard\": isExecutive.pbd }),\n ...(isDefined(isExecutive?.cmp) && { \"Is Executive - Compensation\": isExecutive.cmp }),\n ...(isCollaboratorInAnyProduct && { \"Is Collaborator\": isCollaboratorInAnyProduct }),\n ...(isDefined(isCollaborator?.wov) && { \"Is Collaborator - Officevibe\": isCollaborator.wov }),\n ...(isDefined(isCollaborator?.lms) && { \"Is Collaborator - LMS\": isCollaborator.lms }),\n ...(isDefined(isCollaborator?.onb) && { \"Is Collaborator - Onboarding\": isCollaborator.onb }),\n ...(isDefined(isCollaborator?.sks) && { \"Is Collaborator - Skills\": isCollaborator.sks }),\n ...(isDefined(isCollaborator?.wpm) && { \"Is Collaborator - Performance\": isCollaborator.wpm }),\n ...(isDefined(isCollaborator?.pbd) && { \"Is Collaborator - Pingboard\": isCollaborator.pbd }),\n ...(isDefined(isCollaborator?.cmp) && { \"Is Collaborator - Compensation\": isCollaborator.cmp }),\n ...(isDefined(isReportingManager) && { \"Is Reporting Manager\": isReportingManager }),\n ...(isDefined(isTeamManager) && { \"Is Team Manager\": isTeamManager }),\n ...(isDefined(planCode?.wov) && { \"Plan Code - Officevibe\": planCode.wov }),\n ...(isDefined(planCode?.lms) && { \"Plan Code - LMS\": planCode.lms }),\n ...(isDefined(planCode?.onb) && { \"Plan Code - Onboarding\": planCode.onb }),\n ...(isDefined(planCode?.sks) && { \"Plan Code - Skills\": planCode.sks }),\n ...(isDefined(planCode?.wpm) && { \"Plan Code - Performance\": planCode.wpm }),\n ...(isDefined(planCode?.pbd) && { \"Plan Code - Pingboard\": planCode.pbd }),\n ...(isDefined(planCode?.cmp) && { \"Plan Code - Compensation\": planCode.cmp })\n } satisfies LogRocketWorkleapPlatformUserTraits;\n }\n}\n"],"names":["LogRocket","isDefined","DeviceIdTrait","TelemetryIdTrait","LogRocketInstrumentationClient","telemetryContext","listener","identification","userId","organizationId","organizationName","isMigratedToWorkleap","isOrganizationCreator","isAdmin","isExecutive","isCollaborator","isReportingManager","isTeamManager","planCode","isExecutiveInAnyProduct","Boolean","isCollaboratorInAnyProduct"],"mappings":";;;;;;;;AACkC;AACU;AAIrC,MAAME,gBAAgB,YAAY;AAClC,MAAMC,mBAAmB,eAAe;AAiF/C,2BAA2B;A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C,CAAC;YACnE,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,0BAA0BA,SAAS,GAAG;YAAC,CAAC;YAC1E,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,sBAAsBA,SAAS,GAAG;YAAC,CAAC;YACtE,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,2BAA2BA,SAAS,GAAG;YAAC,CAAC;YAC3E,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,yBAAyBA,SAAS,GAAG;YAAC,CAAC;YACzE,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,4BAA4BA,SAAS,GAAG;YAAC,CAAC;QAChF;IACJ;AACJ"}
1
+ {"version":3,"file":"js/LogRocketInstrumentationClient.js","sources":["webpack://@workleap/logrocket/./src/js/LogRocketInstrumentationClient.ts"],"sourcesContent":["import type { LogRocketInstrumentationPartialClient, TelemetryContext } from \"@workleap-telemetry/core\";\nimport LogRocket from \"logrocket\";\nimport { isDefined } from \"./assertions.ts\";\n\nexport type GetLogRocketSessionUrlListener = (sessionURL: string) => void;\n\nexport const DeviceIdTrait = \"Device Id\";\nexport const TelemetryIdTrait = \"Telemetry Id\";\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketWorkleapPlatformIdentification {\n userId: string;\n organizationId: string;\n organizationName: string;\n isMigratedToWorkleap: boolean;\n isAdmin: boolean;\n isOrganizationCreator?: boolean;\n isExecutive?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n cmp?: boolean;\n };\n isCollaborator?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n cmp?: boolean;\n };\n isReportingManager?: boolean;\n isTeamManager?: boolean;\n planCode?: {\n wov?: string;\n lms?: string;\n onb?: string;\n sks?: string;\n wpm?: string;\n pbd?: string;\n cmp?: string;\n };\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketWorkleapPlatformUserTraits extends Record<string, unknown> {\n \"User Id\": string;\n \"Organization Id\": string;\n \"Organization Name\": string;\n \"Is Migrated To Workleap\": boolean;\n \"Is Admin\": boolean;\n [DeviceIdTrait]: string;\n [TelemetryIdTrait]: string;\n \"Is Organization Creator\"?: boolean;\n \"Is Executive\"?: boolean;\n \"Is Executive - Officevibe\"?: boolean;\n \"Is Executive - LMS\"?: boolean;\n \"Is Executive - Onboarding\"?: boolean;\n \"Is Executive - Skills\"?: boolean;\n \"Is Executive - Performance\"?: boolean;\n \"Is Executive - Pingboard\"?: boolean;\n \"Is Collaborator\"?: boolean;\n \"Is Collaborator - Officevibe\"?: boolean;\n \"Is Collaborator - LMS\"?: boolean;\n \"Is Collaborator - Onboarding\"?: boolean;\n \"Is Collaborator - Skills\"?: boolean;\n \"Is Collaborator - Performance\"?: boolean;\n \"Is Collaborator - Pingboard\"?: boolean;\n \"Is Reporting Manager\"?: boolean;\n \"Is Team Manager\"?: boolean;\n \"Plan Code - Officevibe\"?: string;\n \"Plan Code - LMS\"?: string;\n \"Plan Code - Onboarding\"?: string;\n \"Plan Code - Skills\"?: string;\n \"Plan Code - Performance\"?: string;\n \"Plan Code - Pingboard\"?: string;\n}\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketInstrumentationClient extends LogRocketInstrumentationPartialClient {\n /**\n * Register a listener to receive the LogRocket session id when it's available.\n * This method is the equivalent of the LogRocket.getSessionURL function but is\n * particularly useful for third party libraries that doesn't want to take a dependency\n * on `logrocket`.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n registerGetSessionUrlListener: (listener: GetLogRocketSessionUrlListener) => void;\n\n /**\n * Create the default user traits for a Workleap Platform user.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n createWorkleapPlatformDefaultUserTraits: (identification: LogRocketWorkleapPlatformIdentification) => LogRocketWorkleapPlatformUserTraits;\n}\n\nexport class LogRocketInstrumentationClientImpl implements LogRocketInstrumentationClient {\n readonly #telemetryContext?: TelemetryContext;\n\n constructor(telemetryContext?: TelemetryContext) {\n this.#telemetryContext = telemetryContext;\n }\n\n // IMPORTANT: If you update this method, make sure to update the LogRocketInstrumentationPartialClient\n // interface as well in @workleap-telemetry/core.\n registerGetSessionUrlListener(listener: GetLogRocketSessionUrlListener) {\n LogRocket.getSessionURL(listener);\n }\n\n createWorkleapPlatformDefaultUserTraits(identification: LogRocketWorkleapPlatformIdentification) {\n const {\n userId,\n organizationId,\n organizationName,\n isMigratedToWorkleap,\n isOrganizationCreator,\n isAdmin,\n isExecutive,\n isCollaborator,\n isReportingManager,\n isTeamManager,\n planCode\n } = identification;\n\n const isExecutiveInAnyProduct = Boolean(\n isExecutive?.wov ||\n isExecutive?.lms ||\n isExecutive?.onb ||\n isExecutive?.sks ||\n isExecutive?.wpm ||\n isExecutive?.pbd ||\n isExecutive?.cmp\n );\n\n const isCollaboratorInAnyProduct = Boolean(\n isCollaborator?.wov ||\n isCollaborator?.lms ||\n isCollaborator?.onb ||\n isCollaborator?.sks ||\n isCollaborator?.wpm ||\n isCollaborator?.pbd ||\n isCollaborator?.cmp\n );\n\n return {\n \"User Id\": userId,\n \"Organization Id\": organizationId,\n \"Organization Name\": organizationName,\n \"Is Migrated To Workleap\": isMigratedToWorkleap,\n \"Is Admin\": isAdmin,\n [DeviceIdTrait]: this.#telemetryContext?.deviceId ?? \"N/A\",\n [TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? \"N/A\",\n ...(isDefined(isOrganizationCreator) && { \"Is Organization Creator\": isOrganizationCreator }),\n ...(isExecutiveInAnyProduct && { \"Is Executive\": true }),\n ...(isDefined(isExecutive?.wov) && { \"Is Executive - Officevibe\": isExecutive.wov }),\n ...(isDefined(isExecutive?.lms) && { \"Is Executive - LMS\": isExecutive.lms }),\n ...(isDefined(isExecutive?.onb) && { \"Is Executive - Onboarding\": isExecutive.onb }),\n ...(isDefined(isExecutive?.sks) && { \"Is Executive - Skills\": isExecutive.sks }),\n ...(isDefined(isExecutive?.wpm) && { \"Is Executive - Performance\": isExecutive.wpm }),\n ...(isDefined(isExecutive?.pbd) && { \"Is Executive - Pingboard\": isExecutive.pbd }),\n ...(isDefined(isExecutive?.cmp) && { \"Is Executive - Compensation\": isExecutive.cmp }),\n ...(isCollaboratorInAnyProduct && { \"Is Collaborator\": isCollaboratorInAnyProduct }),\n ...(isDefined(isCollaborator?.wov) && { \"Is Collaborator - Officevibe\": isCollaborator.wov }),\n ...(isDefined(isCollaborator?.lms) && { \"Is Collaborator - LMS\": isCollaborator.lms }),\n ...(isDefined(isCollaborator?.onb) && { \"Is Collaborator - Onboarding\": isCollaborator.onb }),\n ...(isDefined(isCollaborator?.sks) && { \"Is Collaborator - Skills\": isCollaborator.sks }),\n ...(isDefined(isCollaborator?.wpm) && { \"Is Collaborator - Performance\": isCollaborator.wpm }),\n ...(isDefined(isCollaborator?.pbd) && { \"Is Collaborator - Pingboard\": isCollaborator.pbd }),\n ...(isDefined(isCollaborator?.cmp) && { \"Is Collaborator - Compensation\": isCollaborator.cmp }),\n ...(isDefined(isReportingManager) && { \"Is Reporting Manager\": isReportingManager }),\n ...(isDefined(isTeamManager) && { \"Is Team Manager\": isTeamManager }),\n ...(isDefined(planCode?.wov) && { \"Plan Code - Officevibe\": planCode.wov }),\n ...(isDefined(planCode?.lms) && { \"Plan Code - LMS\": planCode.lms }),\n ...(isDefined(planCode?.onb) && { \"Plan Code - Onboarding\": planCode.onb }),\n ...(isDefined(planCode?.sks) && { \"Plan Code - Skills\": planCode.sks }),\n ...(isDefined(planCode?.wpm) && { \"Plan Code - Performance\": planCode.wpm }),\n ...(isDefined(planCode?.pbd) && { \"Plan Code - Pingboard\": planCode.pbd }),\n ...(isDefined(planCode?.cmp) && { \"Plan Code - Compensation\": planCode.cmp })\n } satisfies LogRocketWorkleapPlatformUserTraits;\n }\n}\n"],"names":["LogRocket","isDefined","DeviceIdTrait","TelemetryIdTrait","LogRocketInstrumentationClientImpl","telemetryContext","listener","identification","userId","organizationId","organizationName","isMigratedToWorkleap","isOrganizationCreator","isAdmin","isExecutive","isCollaborator","isReportingManager","isTeamManager","planCode","isExecutiveInAnyProduct","Boolean","isCollaboratorInAnyProduct"],"mappings":";;;;;;;;AACkC;AACU;AAIrC,MAAME,gBAAgB,YAAY;AAClC,MAAMC,mBAAmB,eAAe;AAuGxC,MAAMC;IACA,iBAAiB,CAAoB;IAE9C,YAAYC,gBAAmC,CAAE;QAC7C,IAAI,CAAC,iBAAiB,GAAGA;IAC7B;IAEA,sGAAsG;IACtG,iDAAiD;IACjD,8BAA8BC,QAAwC,EAAE;QACpEN,uBAAuB,CAACM;IAC5B;IAEA,wCAAwCC,cAAuD,EAAE;QAC7F,MAAM,EACFC,MAAM,EACNC,cAAc,EACdC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,EACrBC,OAAO,EACPC,WAAW,EACXC,cAAc,EACdC,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,EACX,GAAGX;QAEJ,MAAMY,0BAA0BC,QAC5BN,aAAa,OACbA,aAAa,OACbA,aAAa,OACbA,aAAa,OACbA,aAAa,OACbA,aAAa,OACbA,aAAa;QAGjB,MAAMO,6BAA6BD,QAC/BL,gBAAgB,OAChBA,gBAAgB,OAChBA,gBAAgB,OAChBA,gBAAgB,OAChBA,gBAAgB,OAChBA,gBAAgB,OAChBA,gBAAgB;QAGpB,OAAO;YACH,WAAWP;YACX,mBAAmBC;YACnB,qBAAqBC;YACrB,2BAA2BC;YAC3B,YAAYE;YACZ,CAACX,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY;YACrD,CAACC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe;YAC3D,GAAIF,SAASA,CAACW,0BAA0B;gBAAE,2BAA2BA;YAAsB,CAAC;YAC5F,GAAIO,2BAA2B;gBAAE,g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uB;gBAAE,wBAAwBA;YAAmB,CAAC;YACnF,GAAIf,SAASA,CAACgB,kBAAkB;gBAAE,mBAAmBA;YAAc,CAAC;YACpE,GAAIhB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,0BAA0BA,SAAS,GAAG;YAAC,CAAC;YAC1E,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,mBAAmBA,SAAS,GAAG;YAAC,CAAC;YACnE,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,0BAA0BA,SAAS,GAAG;YAAC,CAAC;YAC1E,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,sBAAsBA,SAAS,GAAG;YAAC,CAAC;YACtE,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,2BAA2BA,SAAS,GAAG;YAAC,CAAC;YAC3E,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,yBAAyBA,SAAS,GAAG;YAAC,CAAC;YACzE,GAAIjB,SAASA,CAACiB,UAAU,QAAQ;gBAAE,4BAA4BA,SAAS,GAAG;YAAC,CAAC;QAChF;IACJ;AACJ"}
@@ -1,4 +1,5 @@
1
- import type { LogRocketInstrumentationPartialClient } from "@workleap-telemetry/core";
2
- export declare class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationPartialClient {
1
+ import type { LogRocketInstrumentationClient, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
2
+ export declare class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationClient {
3
+ createWorkleapPlatformDefaultUserTraits(): LogRocketWorkleapPlatformUserTraits;
3
4
  registerGetSessionUrlListener(): void;
4
5
  }
@@ -1,6 +1,9 @@
1
1
 
2
2
  ;// CONCATENATED MODULE: ./src/js/NoopLogRocketInstrumentationClient.ts
3
3
  class NoopLogRocketInstrumentationClient {
4
+ createWorkleapPlatformDefaultUserTraits() {
5
+ return {};
6
+ }
4
7
  registerGetSessionUrlListener() {}
5
8
  }
6
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"js/NoopLogRocketInstrumentationClient.js","sources":["webpack://@workleap/logrocket/./src/js/NoopLogRocketInstrumentationClient.ts"],"sourcesContent":["import type { LogRocketInstrumentationPartialClient } from \"@workleap-telemetry/core\";\n\nexport class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationPartialClient {\n registerGetSessionUrlListener() {}\n}\n"],"names":["NoopLogRocketInstrumentationClient"],"mappings":";;AAEO,MAAMA;IACT,gCAAgC,CAAC;AACrC"}
1
+ {"version":3,"file":"js/NoopLogRocketInstrumentationClient.js","sources":["webpack://@workleap/logrocket/./src/js/NoopLogRocketInstrumentationClient.ts"],"sourcesContent":["import type { LogRocketInstrumentationClient, LogRocketWorkleapPlatformUserTraits } from \"./LogRocketInstrumentationClient.ts\";\n\nexport class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationClient {\n createWorkleapPlatformDefaultUserTraits() {\n return {} as LogRocketWorkleapPlatformUserTraits;\n }\n\n registerGetSessionUrlListener() {}\n}\n"],"names":["NoopLogRocketInstrumentationClient"],"mappings":";;AAEO,MAAMA;IACT,0CAA0C;QACtC,OAAO,CAAC;IACZ;IAEA,gCAAgC,CAAC;AACrC"}
@@ -1,6 +1,6 @@
1
1
  export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from "@workleap-telemetry/core";
2
2
  export type { LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
3
- export { LogRocketInstrumentationClient, type GetLogRocketSessionUrlListener, type LogRocketWorkleapPlatformIdentification, type LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
3
+ export type { GetLogRocketSessionUrlListener, LogRocketInstrumentationClient, LogRocketWorkleapPlatformIdentification, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
4
4
  export { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.ts";
5
5
  export type * from "./logRocketTypes.ts";
6
6
  export { NoopLogRocketInstrumentationClient } from "./NoopLogRocketInstrumentationClient.ts";
package/dist/js/index.js CHANGED
@@ -1,13 +1,10 @@
1
1
  import { createTelemetryContext } from "@workleap-telemetry/core";
2
- import { LogRocketInstrumentationClient } from "./LogRocketInstrumentationClient.js";
3
2
  import { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.js";
4
3
  import { NoopLogRocketInstrumentationClient } from "./NoopLogRocketInstrumentationClient.js";
5
4
  import { registerLogRocketInstrumentation } from "./registerLogRocketInstrumentation.js";
6
5
 
7
6
  ;// CONCATENATED MODULE: external "@workleap-telemetry/core"
8
7
 
9
- ;// CONCATENATED MODULE: external "./LogRocketInstrumentationClient.js"
10
-
11
8
  ;// CONCATENATED MODULE: external "./LogRocketLogger.js"
12
9
 
13
10
  ;// CONCATENATED MODULE: external "./NoopLogRocketInstrumentationClient.js"
@@ -20,7 +17,6 @@ import { registerLogRocketInstrumentation } from "./registerLogRocketInstrumenta
20
17
 
21
18
 
22
19
 
23
-
24
- export { LogRocketInstrumentationClient, LogRocketLogger, LogRocketLoggerScope, NoopLogRocketInstrumentationClient, createTelemetryContext, registerLogRocketInstrumentation };
20
+ export { LogRocketLogger, LogRocketLoggerScope, NoopLogRocketInstrumentationClient, createTelemetryContext, registerLogRocketInstrumentation };
25
21
 
26
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"js/index.js","sources":["webpack://@workleap/logrocket/./src/js/index.ts"],"sourcesContent":["export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from \"@workleap-telemetry/core\";\nexport type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport { LogRocketInstrumentationClient, type GetLogRocketSessionUrlListener, type LogRocketWorkleapPlatformIdentification, type LogRocketWorkleapPlatformUserTraits } from \"./LogRocketInstrumentationClient.ts\";\nexport { LogRocketLogger, LogRocketLoggerScope } from \"./LogRocketLogger.ts\";\nexport type * from \"./logRocketTypes.ts\";\nexport { NoopLogRocketInstrumentationClient } from \"./NoopLogRocketInstrumentationClient.ts\";\nexport { registerLogRocketInstrumentation, type RegisterLogRocketInstrumentationOptions } from \"./registerLogRocketInstrumentation.ts\";\n\n\n"],"names":["createTelemetryContext","LogRocketInstrumentationClient","LogRocketLogger","LogRocketLoggerScope","NoopLogRocketInstrumentationClient","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;AAA6H;AAEqF;AACrI;AAEgB;AAC0C"}
1
+ {"version":3,"file":"js/index.js","sources":["webpack://@workleap/logrocket/./src/js/index.ts"],"sourcesContent":["export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from \"@workleap-telemetry/core\";\nexport type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport type { GetLogRocketSessionUrlListener, LogRocketInstrumentationClient, LogRocketWorkleapPlatformIdentification, LogRocketWorkleapPlatformUserTraits } from \"./LogRocketInstrumentationClient.ts\";\nexport { LogRocketLogger, LogRocketLoggerScope } from \"./LogRocketLogger.ts\";\nexport type * from \"./logRocketTypes.ts\";\nexport { NoopLogRocketInstrumentationClient } from \"./NoopLogRocketInstrumentationClient.ts\";\nexport { registerLogRocketInstrumentation, type RegisterLogRocketInstrumentationOptions } from \"./registerLogRocketInstrumentation.ts\";\n\n\n"],"names":["createTelemetryContext","LogRocketLogger","LogRocketLoggerScope","NoopLogRocketInstrumentationClient","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;;;;AAA6H;AAGhD;AAEgB;AAC0C"}
@@ -1,7 +1,7 @@
1
1
  import { type TelemetryContext } from "@workleap-telemetry/core";
2
2
  import { type RootLogger } from "@workleap/logging";
3
3
  import { type LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
4
- import { LogRocketInstrumentationClient } from "./LogRocketInstrumentationClient.ts";
4
+ import { type LogRocketInstrumentationClient } from "./LogRocketInstrumentationClient.ts";
5
5
  import type { LogRocketSdkOptions } from "./logRocketTypes.ts";
6
6
  /**
7
7
  * @see {@link https://workleap.github.io/wl-telemetry}
@@ -6,7 +6,7 @@ import { applyTransformers } from "./applyTransformers.js";
6
6
  import { createRequestSanitizer } from "./createRequestSanitizer.js";
7
7
  import { createResponseSanitizer } from "./createResponseSanitizer.js";
8
8
  import { createUrlSanitizer } from "./createUrlSanitizer.js";
9
- import { DeviceIdTrait, LogRocketInstrumentationClient, TelemetryIdTrait } from "./LogRocketInstrumentationClient.js";
9
+ import { DeviceIdTrait, LogRocketInstrumentationClientImpl, TelemetryIdTrait } from "./LogRocketInstrumentationClient.js";
10
10
 
11
11
  ;// CONCATENATED MODULE: external "@workleap-telemetry/core"
12
12
 
@@ -151,7 +151,9 @@ class LogRocketInstrumentationRegistrator {
151
151
  });
152
152
  registerDeprecatedGlobalVariables();
153
153
  logger.information("[logrocket] LogRocket instrumentation is registered.");
154
- return new LogRocketInstrumentationClient(telemetryContext);
154
+ const client = new LogRocketInstrumentationClientImpl(telemetryContext);
155
+ // The cast is to normalize the inferred return type to the "LogRocketInstrumentationClient" type.
156
+ return client;
155
157
  }
156
158
  }
157
159
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"js/registerLogRocketInstrumentation.js","sources":["webpack://@workleap/logrocket/./src/js/registerLogRocketInstrumentation.ts"],"sourcesContent":["import { HasExecutedGuard, type TelemetryContext } from \"@workleap-telemetry/core\";\nimport { createCompositeLogger, type RootLogger } from \"@workleap/logging\";\nimport LogRocket from \"logrocket\";\nimport LogrocketFuzzySanitizer from \"logrocket-fuzzy-search-sanitizer\";\nimport { applyTransformers, type LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nimport { createRequestSanitizer } from \"./createRequestSanitizer.ts\";\nimport { createResponseSanitizer } from \"./createResponseSanitizer.ts\";\nimport { createUrlSanitizer } from \"./createUrlSanitizer.ts\";\nimport { DeviceIdTrait, LogRocketInstrumentationClient, TelemetryIdTrait } from \"./LogRocketInstrumentationClient.ts\";\nimport type { LogRocketSdkOptions } from \"./logRocketTypes.ts\";\n\nconst DefaultPrivateFieldNames = [\n \"email\",\n \"personalEmail\",\n \"phoneNumber\",\n \"password\",\n \"firstName\",\n \"lastName\",\n \"givenName\",\n \"fullName\",\n \"gender\",\n \"timeZone\",\n \"birthday\"\n];\n\nconst DefaultPrivateQueryParameterNames = [\n \"token\",\n \"email\",\n \"password\"\n];\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface RegisterLogRocketInstrumentationOptions {\n /**\n * A root hostname to track sessions across subdomains. Set this option to capture traffic from all subdomains under one session: https://docs.logrocket.com/reference/roothostname.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n rootHostname?: LogRocketSdkOptions[\"rootHostname\"];\n /**\n * Names of additional fields to exclude from session replays. These fields will be removed from network requests, responses using a fuzzy-matching algorithm.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n privateFieldNames?: string[];\n /**\n * Names of additional fields to exclude from session replays. These fields will be removed from query parameters using a fuzzy-matching algorithm.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n privateQueryParameterNames?: string[];\n /**\n * Context including telemetry correlation ids.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n telemetryContext?: TelemetryContext;\n /**\n * Hooks to transform the resulting LogRocket SDK options.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n transformers?: LogRocketSdkOptionsTransformer[];\n /**\n * Indicates 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 * The logger instances that will output messages.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n loggers?: RootLogger[];\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function getLogRocketSdkOptions(userOptions: RegisterLogRocketInstrumentationOptions, logger: RootLogger): LogRocketSdkOptions {\n const {\n rootHostname = \"workleap.com\",\n privateFieldNames = [],\n privateQueryParameterNames = [],\n verbose = false,\n transformers = []\n } = userOptions;\n\n const mergedPrivateFieldNames = DefaultPrivateFieldNames.concat(privateFieldNames);\n const mergedPrivateQueryParameterNames = DefaultPrivateQueryParameterNames.concat(privateQueryParameterNames);\n\n // The \"LogrocketFuzzySearch.setup\" code is awkward. For now, we prefer to play it safe and call it once here, then forward the sanitize functions\n // to the appropriate factories.\n // No clue why the \"setup\" method is not available. This package is shady.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const { requestSanitizer: fuzzyRequestSanitizer, responseSanitizer: fuzzyResponseSanitizer } = LogrocketFuzzySanitizer.setup(mergedPrivateFieldNames);\n\n const sdkOptions = {\n console: {\n // Prevent console logs from being visible in LogRocket session replays and leaking PII.\n // To capture logs in a session replay, use the LogRocketLogger class.\n isEnabled: false\n },\n rootHostname,\n dom: {\n textSanitizer: true,\n inputSanitizer: true\n },\n network: {\n requestSanitizer: createRequestSanitizer(fuzzyRequestSanitizer),\n responseSanitizer: createResponseSanitizer(fuzzyResponseSanitizer)\n },\n browser: {\n urlSanitizer: createUrlSanitizer(mergedPrivateQueryParameterNames)\n },\n shouldDebugLog: verbose\n } satisfies LogRocketSdkOptions;\n\n return applyTransformers(sdkOptions, transformers, {\n verbose,\n logger\n });\n}\n\n///////////////////////////\n\n// DEPRECATED: Grace period ends on January 1th 2026.\nexport const IsRegisteredVariableName = \"__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__\";\nexport const RegisterGetSessionUrlFunctionName = \"__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__\";\n\n// DEPRECATED: Grace period ends on January 1th 2026.\nfunction registerDeprecatedGlobalVariables() {\n // Indicates to the host applications that logrocket 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 LogRocket.\n // While there are ways that the host application could tell to an \"add-on\" if\n // it's using LogRocket or not, doing it this way is transparent for the consumer,\n // which is great for DX.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[IsRegisteredVariableName] = true;\n\n // While consumers could directly call LogRocket.getSessionURL, by doing it this way,\n // it allow consumers to not take a direct dependency on the \"logrocket\" package.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[RegisterGetSessionUrlFunctionName] = listener => {\n LogRocket.getSessionURL(listener);\n };\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\nexport class LogRocketInstrumentationRegistrator {\n register(\n appId: string,\n options: RegisterLogRocketInstrumentationOptions = {}\n ) {\n const {\n telemetryContext,\n verbose = false,\n loggers = []\n } = options;\n\n const logger = createCompositeLogger(verbose, loggers);\n const sdkOptions = getLogRocketSdkOptions(options, logger);\n\n // Session starts anonymously when LogRocket.init() is called.\n LogRocket.init(appId, sdkOptions);\n\n // Identify the user with the correlation ids.\n if (telemetryContext) {\n // LogRocket maintains the same session even if the user starts as anonymous and later becomes identified via LogRocket.identify().\n // If LogRocket.identify is called multiple times during a recording, you can search for any of the identified users in the session.\n LogRocket.identify(telemetryContext.deviceId, {\n [DeviceIdTrait]: telemetryContext.deviceId,\n [TelemetryIdTrait]: telemetryContext.telemetryId\n });\n }\n\n LogRocket.getSessionURL(url => {\n logger\n .withText(\"[logrocket] Session replay URL is now available:\")\n .withText(url)\n .debug();\n });\n\n registerDeprecatedGlobalVariables();\n\n logger.information(\"[logrocket] LogRocket instrumentation is registered.\");\n\n return new LogRocketInstrumentationClient(telemetryContext);\n }\n}\n\n/**\n * Register the LogRocket instrumentation.\n * @param appId LogRocket application id.\n * @param options LogRocket instrumentation options.\n * @returns {LogRocketInstrumentationClient} A LogRocket instrumentation client instance.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function registerLogRocketInstrumentation(\n appId: string,\n options?: RegisterLogRocketInstrumentationOptions\n) {\n getRegistrationGuard().throw(\"[logrocket] The LogRocket instrumentation has already been registered. Did you call the \\\"registerLogRocketInstrumentation\\\" function twice?\");\n\n return new LogRocketInstrumentationRegistrator().register(appId, options);\n}\n"],"names":["HasExecutedGuard","createCompositeLogger","LogRocket","LogrocketFuzzySanitizer","applyTransformers","createRequestSanitizer","createResponseSanitizer","createUrlSanitizer","DeviceIdTrait","LogRocketInstrumentationClient","TelemetryIdTrait","DefaultPrivateFieldNames","DefaultPrivateQueryParameterNames","getLogRocketSdkOptions","userOptions","logger","rootHostname","privateFieldNames","privateQueryParameterNames","verbose","transformers","mergedPrivateFieldNames","mergedPrivateQueryParameterNames","fuzzyRequestSanitizer","fuzzyResponseSanitizer","sdkOptions","IsRegisteredVariableName","RegisterGetSessionUrlFunctionName","registerDeprecatedGlobalVariables","globalThis","listener","registrationGuardInstance","getRegistrationGuard","__resetRegistrationGuard","LogRocketInstrumentationRegistrator","appId","options","telemetryContext","loggers","url","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAmF;AACR;AACzC;AACqC;AACyB;AAC3B;AACE;AACV;AACyD;AAGtH,MAAMW,2BAA2B;IAC7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAED,MAAMC,oCAAoC;IACtC;IACA;IACA;CACH;AA6CD,2EAA2E;AACpE,SAASC,uBAAuBC,WAAoD,EAAEC,MAAkB;IAC3G,MAAM,EACFC,eAAe,cAAc,EAC7BC,oBAAoB,EAAE,EACtBC,6BAA6B,EAAE,EAC/BC,UAAU,KAAK,EACfC,eAAe,EAAE,EACpB,GAAGN;IAEJ,MAAMO,0BAA0BV,yBAAyB,MAAM,CAACM;IAChE,MAAMK,mCAAmCV,kCAAkC,MAAM,CAACM;IAElF,kJAAkJ;IAClJ,gCAAgC;IAChC,0EAA0E;IAC1E,6D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U,EAAE,EACf,GAAGF;QAEJ,MAAMrB,SAASd,qBAAqBA,CAACkB,SAASmB;QAC9C,MAAMb,aAAaZ,uBAAuBuB,SAASrB;QAEnD,8DAA8D;QAC9Db,cAAc,CAACiC,OAAOV;QAEtB,8CAA8C;QAC9C,IAAIY,kBAAkB;YAClB,mIAAmI;YACnI,oIAAoI;YACpInC,kBAAkB,CAACmC,iBAAiB,QAAQ,EAAE;gBAC1C,CAAC7B,aAAaA,CAAC,EAAE6B,iBAAiB,QAAQ;gBAC1C,CAAC3B,gBAAgBA,CAAC,EAAE2B,iBAAiB,WAAW;YACpD;QACJ;QAEAnC,uBAAuB,CAACqC,CAAAA;YACpBxB,OACK,QAAQ,CAAC,oDACT,QAAQ,CAACwB,KACT,KAAK;QACd;QAEAX;QAEAb,OAAO,WAAW,CAAC;QAEnB,OAAO,IAAIN,8BAA8BA,CAAC4B;IAC9C;AACJ;AAEA;;;;;;CAMC,GACM,SAASG,iCACZL,KAAa,EACbC,OAAiD;IAEjDJ,uBAAuB,KAAK,CAAC;IAE7B,OAAO,IAAIE,sCAAsC,QAAQ,CAACC,OAAOC;AACrE"}
1
+ {"version":3,"file":"js/registerLogRocketInstrumentation.js","sources":["webpack://@workleap/logrocket/./src/js/registerLogRocketInstrumentation.ts"],"sourcesContent":["import { HasExecutedGuard, type TelemetryContext } from \"@workleap-telemetry/core\";\nimport { createCompositeLogger, type RootLogger } from \"@workleap/logging\";\nimport LogRocket from \"logrocket\";\nimport LogrocketFuzzySanitizer from \"logrocket-fuzzy-search-sanitizer\";\nimport { applyTransformers, type LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nimport { createRequestSanitizer } from \"./createRequestSanitizer.ts\";\nimport { createResponseSanitizer } from \"./createResponseSanitizer.ts\";\nimport { createUrlSanitizer } from \"./createUrlSanitizer.ts\";\nimport { DeviceIdTrait, type LogRocketInstrumentationClient, LogRocketInstrumentationClientImpl, TelemetryIdTrait } from \"./LogRocketInstrumentationClient.ts\";\nimport type { LogRocketSdkOptions } from \"./logRocketTypes.ts\";\n\nconst DefaultPrivateFieldNames = [\n \"email\",\n \"personalEmail\",\n \"phoneNumber\",\n \"password\",\n \"firstName\",\n \"lastName\",\n \"givenName\",\n \"fullName\",\n \"gender\",\n \"timeZone\",\n \"birthday\"\n];\n\nconst DefaultPrivateQueryParameterNames = [\n \"token\",\n \"email\",\n \"password\"\n];\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface RegisterLogRocketInstrumentationOptions {\n /**\n * A root hostname to track sessions across subdomains. Set this option to capture traffic from all subdomains under one session: https://docs.logrocket.com/reference/roothostname.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n rootHostname?: LogRocketSdkOptions[\"rootHostname\"];\n /**\n * Names of additional fields to exclude from session replays. These fields will be removed from network requests, responses using a fuzzy-matching algorithm.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n privateFieldNames?: string[];\n /**\n * Names of additional fields to exclude from session replays. These fields will be removed from query parameters using a fuzzy-matching algorithm.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n privateQueryParameterNames?: string[];\n /**\n * Context including telemetry correlation ids.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n telemetryContext?: TelemetryContext;\n /**\n * Hooks to transform the resulting LogRocket SDK options.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n transformers?: LogRocketSdkOptionsTransformer[];\n /**\n * Indicates 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 * The logger instances that will output messages.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n loggers?: RootLogger[];\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function getLogRocketSdkOptions(userOptions: RegisterLogRocketInstrumentationOptions, logger: RootLogger): LogRocketSdkOptions {\n const {\n rootHostname = \"workleap.com\",\n privateFieldNames = [],\n privateQueryParameterNames = [],\n verbose = false,\n transformers = []\n } = userOptions;\n\n const mergedPrivateFieldNames = DefaultPrivateFieldNames.concat(privateFieldNames);\n const mergedPrivateQueryParameterNames = DefaultPrivateQueryParameterNames.concat(privateQueryParameterNames);\n\n // The \"LogrocketFuzzySearch.setup\" code is awkward. For now, we prefer to play it safe and call it once here, then forward the sanitize functions\n // to the appropriate factories.\n // No clue why the \"setup\" method is not available. This package is shady.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const { requestSanitizer: fuzzyRequestSanitizer, responseSanitizer: fuzzyResponseSanitizer } = LogrocketFuzzySanitizer.setup(mergedPrivateFieldNames);\n\n const sdkOptions = {\n console: {\n // Prevent console logs from being visible in LogRocket session replays and leaking PII.\n // To capture logs in a session replay, use the LogRocketLogger class.\n isEnabled: false\n },\n rootHostname,\n dom: {\n textSanitizer: true,\n inputSanitizer: true\n },\n network: {\n requestSanitizer: createRequestSanitizer(fuzzyRequestSanitizer),\n responseSanitizer: createResponseSanitizer(fuzzyResponseSanitizer)\n },\n browser: {\n urlSanitizer: createUrlSanitizer(mergedPrivateQueryParameterNames)\n },\n shouldDebugLog: verbose\n } satisfies LogRocketSdkOptions;\n\n return applyTransformers(sdkOptions, transformers, {\n verbose,\n logger\n });\n}\n\n///////////////////////////\n\n// DEPRECATED: Grace period ends on January 1th 2026.\nexport const IsRegisteredVariableName = \"__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__\";\nexport const RegisterGetSessionUrlFunctionName = \"__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__\";\n\n// DEPRECATED: Grace period ends on January 1th 2026.\nfunction registerDeprecatedGlobalVariables() {\n // Indicates to the host applications that logrocket 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 LogRocket.\n // While there are ways that the host application could tell to an \"add-on\" if\n // it's using LogRocket or not, doing it this way is transparent for the consumer,\n // which is great for DX.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[IsRegisteredVariableName] = true;\n\n // While consumers could directly call LogRocket.getSessionURL, by doing it this way,\n // it allow consumers to not take a direct dependency on the \"logrocket\" package.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[RegisterGetSessionUrlFunctionName] = listener => {\n LogRocket.getSessionURL(listener);\n };\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\nexport class LogRocketInstrumentationRegistrator {\n register(\n appId: string,\n options: RegisterLogRocketInstrumentationOptions = {}\n ) {\n const {\n telemetryContext,\n verbose = false,\n loggers = []\n } = options;\n\n const logger = createCompositeLogger(verbose, loggers);\n const sdkOptions = getLogRocketSdkOptions(options, logger);\n\n // Session starts anonymously when LogRocket.init() is called.\n LogRocket.init(appId, sdkOptions);\n\n // Identify the user with the correlation ids.\n if (telemetryContext) {\n // LogRocket maintains the same session even if the user starts as anonymous and later becomes identified via LogRocket.identify().\n // If LogRocket.identify is called multiple times during a recording, you can search for any of the identified users in the session.\n LogRocket.identify(telemetryContext.deviceId, {\n [DeviceIdTrait]: telemetryContext.deviceId,\n [TelemetryIdTrait]: telemetryContext.telemetryId\n });\n }\n\n LogRocket.getSessionURL(url => {\n logger\n .withText(\"[logrocket] Session replay URL is now available:\")\n .withText(url)\n .debug();\n });\n\n registerDeprecatedGlobalVariables();\n\n logger.information(\"[logrocket] LogRocket instrumentation is registered.\");\n\n const client = new LogRocketInstrumentationClientImpl(telemetryContext);\n\n // The cast is to normalize the inferred return type to the \"LogRocketInstrumentationClient\" type.\n return client as LogRocketInstrumentationClient;\n }\n}\n\n/**\n * Register the LogRocket instrumentation.\n * @param appId LogRocket application id.\n * @param options LogRocket instrumentation options.\n * @returns {LogRocketInstrumentationClient} A LogRocket instrumentation client instance.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function registerLogRocketInstrumentation(\n appId: string,\n options?: RegisterLogRocketInstrumentationOptions\n) {\n getRegistrationGuard().throw(\"[logrocket] The LogRocket instrumentation has already been registered. Did you call the \\\"registerLogRocketInstrumentation\\\" function twice?\");\n\n return new LogRocketInstrumentationRegistrator().register(appId, options);\n}\n"],"names":["HasExecutedGuard","createCompositeLogger","LogRocket","LogrocketFuzzySanitizer","applyTransformers","createRequestSanitizer","createResponseSanitizer","createUrlSanitizer","DeviceIdTrait","LogRocketInstrumentationClientImpl","TelemetryIdTrait","DefaultPrivateFieldNames","DefaultPrivateQueryParameterNames","getLogRocketSdkOptions","userOptions","logger","rootHostname","privateFieldNames","privateQueryParameterNames","verbose","transformers","mergedPrivateFieldNames","mergedPrivateQueryParameterNames","fuzzyRequestSanitizer","fuzzyResponseSanitizer","sdkOptions","IsRegisteredVariableName","RegisterGetSessionUrlFunctionName","registerDeprecatedGlobalVariables","globalThis","listener","registrationGuardInstance","getRegistrationGuard","__resetRegistrationGuard","LogRocketInstrumentationRegistrator","appId","options","telemetryContext","loggers","url","client","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAmF;AACR;AACzC;AACqC;AACyB;AAC3B;AACE;AACV;AACkG;AAG/J,MAAMW,2BAA2B;IAC7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAED,MAAMC,oCAAoC;IACtC;IACA;IACA;CACH;AA6CD,2EAA2E;AACpE,SAASC,uBAAuBC,WAAoD,EAAEC,MAAkB;IAC3G,MAAM,EACFC,eAAe,cAAc,EAC7BC,oBAAoB,EAAE,EACtBC,6BAA6B,EAAE,EAC/BC,UAAU,KAAK,EACfC,eA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C3BA,0BAA0B,KAAK;IACnC;AACJ;AAEA,2BAA2B;AAEpB,MAAMG;IACT,SACIC,KAAa,EACbC,UAAmD,CAAC,CAAC,EACvD;QACE,MAAM,EACFC,gBAAgB,EAChBlB,UAAU,KAAK,EACfmB,UAAU,EAAE,EACf,GAAGF;QAEJ,MAAMrB,SAASd,qBAAqBA,CAACkB,SAASmB;QAC9C,MAAMb,aAAaZ,uBAAuBuB,SAASrB;QAEnD,8DAA8D;QAC9Db,cAAc,CAACiC,OAAOV;QAEtB,8CAA8C;QAC9C,IAAIY,kBAAkB;YAClB,mIAAmI;YACnI,oIAAoI;YACpInC,kBAAkB,CAACmC,iBAAiB,QAAQ,EAAE;gBAC1C,CAAC7B,aAAaA,CAAC,EAAE6B,iBAAiB,QAAQ;gBAC1C,CAAC3B,gBAAgBA,CAAC,EAAE2B,iBAAiB,WAAW;YACpD;QACJ;QAEAnC,uBAAuB,CAACqC,CAAAA;YACpBxB,OACK,QAAQ,CAAC,oDACT,QAAQ,CAACwB,KACT,KAAK;QACd;QAEAX;QAEAb,OAAO,WAAW,CAAC;QAEnB,MAAMyB,SAAS,IAAI/B,kCAAkCA,CAAC4B;QAEtD,kGAAkG;QAClG,OAAOG;IACX;AACJ;AAEA;;;;;;CAMC,GACM,SAASC,iCACZN,KAAa,EACbC,OAAiD;IAEjDJ,uBAAuB,KAAK,CAAC;IAE7B,OAAO,IAAIE,sCAAsC,QAAQ,CAACC,OAAOC;AACrE"}
@@ -1,17 +1,24 @@
1
- import type { LogRocketInstrumentationPartialClient } from "@workleap-telemetry/core";
2
1
  import { type PropsWithChildren } from "react";
2
+ import type { LogRocketInstrumentationClient } from "../js/LogRocketInstrumentationClient.ts";
3
3
  /**
4
4
  * @see {@link https://workleap.github.io/wl-telemetry}
5
5
  */
6
6
  export interface LogRocketInstrumentationProviderProps extends PropsWithChildren {
7
- client: LogRocketInstrumentationPartialClient;
7
+ client: LogRocketInstrumentationClient;
8
8
  }
9
9
  /**
10
10
  * @see {@link https://workleap.github.io/wl-telemetry}
11
11
  */
12
12
  export declare function LogRocketInstrumentationProvider(props: LogRocketInstrumentationProviderProps): import("react/jsx-runtime").JSX.Element;
13
- /**
14
- * Retrieve the LogRocket instrumentation client.
15
- * @see {@link https://workleap.github.io/wl-telemetry}
16
- */
17
- export declare function useLogRocketInstrumentationClient(): LogRocketInstrumentationPartialClient;
13
+ export interface UseLogRocketInstrumentationClientOptions {
14
+ /**
15
+ * Whether or not an exception should be thrown if the client hasn't been provided.
16
+ */
17
+ dontThrowOnUndefined?: boolean;
18
+ }
19
+ export declare function useLogRocketInstrumentationClient(options?: {
20
+ dontThrowOnUndefined?: false;
21
+ }): LogRocketInstrumentationClient;
22
+ export declare function useLogRocketInstrumentationClient(options: {
23
+ dontThrowOnUndefined: true;
24
+ }): LogRocketInstrumentationClient | undefined;
@@ -21,9 +21,10 @@ const LogRocketInstrumentationContext = /*#__PURE__*/ createContext(undefined);
21
21
  /**
22
22
  * Retrieve the LogRocket instrumentation client.
23
23
  * @see {@link https://workleap.github.io/wl-telemetry}
24
- */ function useLogRocketInstrumentationClient() {
24
+ */ function useLogRocketInstrumentationClient(options = {}) {
25
+ const { dontThrowOnUndefined = false } = options;
25
26
  const client = useContext(LogRocketInstrumentationContext);
26
- if (!client) {
27
+ if (!client && !dontThrowOnUndefined) {
27
28
  throw new Error("[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.");
28
29
  }
29
30
  return client;
@@ -1 +1 @@
1
- {"version":3,"file":"react/LogRocketInstrumentationContext.js","sources":["webpack://@workleap/logrocket/./src/react/LogRocketInstrumentationContext.tsx"],"sourcesContent":["import type { LogRocketInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport { createContext, type PropsWithChildren, useContext } from \"react\";\n\nconst LogRocketInstrumentationContext = createContext<LogRocketInstrumentationPartialClient | undefined>(undefined);\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketInstrumentationProviderProps extends PropsWithChildren {\n client: LogRocketInstrumentationPartialClient;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function LogRocketInstrumentationProvider(props: LogRocketInstrumentationProviderProps) {\n const {\n client,\n children\n } = props;\n\n return (\n <LogRocketInstrumentationContext.Provider value={client}>\n {children}\n </LogRocketInstrumentationContext.Provider>\n );\n}\n\n/**\n * Retrieve the LogRocket instrumentation client.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function useLogRocketInstrumentationClient() {\n const client = useContext(LogRocketInstrumentationContext);\n\n if (!client) {\n throw new Error(\"[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.\");\n }\n\n return client;\n}\n"],"names":["createContext","useContext","LogRocketInstrumentationContext","undefined","LogRocketInstrumentationProvider","props","client","children","useLogRocketInstrumentationClient","Error"],"mappings":";;;;;;;;;AAC0E;AAE1E,MAAME,gDAAkCF,aAAaA,CAAoDG;AASzG;;CAEC,GACM,SAASC,iCAAiCC,KAA4C;IACzF,MAAM,EACFC,MAAM,EACNC,QAAQ,EACX,GAAGF;IAEJ,qBACI,IAACH,gCAAgC,QAAQ;QAAC,OAAOI;kBAC5CC;;AAGb;AAEA;;;CAGC,GACM,SAASC;IACZ,MAAMF,SAASL,UAAUA,CAACC;IAE1B,IAAI,CAACI,QAAQ;QACT,MAAM,IAAIG,MAAM;IACpB;IAEA,OAAOH;AACX"}
1
+ {"version":3,"file":"react/LogRocketInstrumentationContext.js","sources":["webpack://@workleap/logrocket/./src/react/LogRocketInstrumentationContext.tsx"],"sourcesContent":["import { createContext, type PropsWithChildren, useContext } from \"react\";\nimport type { LogRocketInstrumentationClient } from \"../js/LogRocketInstrumentationClient.ts\";\n\nconst LogRocketInstrumentationContext = createContext<LogRocketInstrumentationClient | undefined>(undefined);\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketInstrumentationProviderProps extends PropsWithChildren {\n client: LogRocketInstrumentationClient;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function LogRocketInstrumentationProvider(props: LogRocketInstrumentationProviderProps) {\n const {\n client,\n children\n } = props;\n\n return (\n <LogRocketInstrumentationContext.Provider value={client}>\n {children}\n </LogRocketInstrumentationContext.Provider>\n );\n}\n\nexport interface UseLogRocketInstrumentationClientOptions {\n /**\n * Whether or not an exception should be thrown if the client hasn't been provided.\n */\n dontThrowOnUndefined?: boolean;\n}\n\nexport function useLogRocketInstrumentationClient(options?: { dontThrowOnUndefined?: false }): LogRocketInstrumentationClient;\nexport function useLogRocketInstrumentationClient(options: { dontThrowOnUndefined: true }): LogRocketInstrumentationClient | undefined;\n\n/**\n * Retrieve the LogRocket instrumentation client.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function useLogRocketInstrumentationClient(options: UseLogRocketInstrumentationClientOptions = {}) {\n const {\n dontThrowOnUndefined = false\n } = options;\n\n const client = useContext(LogRocketInstrumentationContext);\n\n if (!client && !dontThrowOnUndefined) {\n throw new Error(\"[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.\");\n }\n\n return client;\n}\n"],"names":["createContext","useContext","LogRocketInstrumentationContext","undefined","LogRocketInstrumentationProvider","props","client","children","useLogRocketInstrumentationClient","options","dontThrowOnUndefined","Error"],"mappings":";;;;;;;;;AAA0E;AAG1E,MAAME,gDAAkCF,aAAaA,CAA6CG;AASlG;;CAEC,GACM,SAASC,iCAAiCC,KAA4C;IACzF,MAAM,EACFC,MAAM,EACNC,QAAQ,EACX,GAAGF;IAEJ,qBACI,IAACH,gCAAgC,QAAQ;QAAC,OAAOI;kBAC5CC;;AAGb;AAYA;;;CAGC,GACM,SAASC,kCAAkCC,UAAoD,CAAC,CAAC;IACpG,MAAM,EACFC,uBAAuB,KAAK,EAC/B,GAAGD;IAEJ,MAAMH,SAASL,UAAUA,CAACC;IAE1B,IAAI,CAACI,UAAU,CAACI,sBAAsB;QAClC,MAAM,IAAIC,MAAM;IACpB;IAEA,OAAOL;AACX"}
@@ -1,2 +1,2 @@
1
1
  export * from "../js/index.ts";
2
- export { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient } from "./LogRocketInstrumentationContext.tsx";
2
+ export { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient, type UseLogRocketInstrumentationClientOptions } from "./LogRocketInstrumentationContext.tsx";
@@ -1 +1 @@
1
- {"version":3,"file":"react/index.js","sources":["webpack://@workleap/logrocket/./src/react/index.ts"],"sourcesContent":["export * from \"../js/index.ts\";\nexport { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient } from \"./LogRocketInstrumentationContext.tsx\";\n\n"],"names":["LogRocketInstrumentationProvider","useLogRocketInstrumentationClient"],"mappings":";;;;;;AAA+B;AAC6F"}
1
+ {"version":3,"file":"react/index.js","sources":["webpack://@workleap/logrocket/./src/react/index.ts"],"sourcesContent":["export * from \"../js/index.ts\";\nexport { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient, type UseLogRocketInstrumentationClientOptions } from \"./LogRocketInstrumentationContext.tsx\";\n\n"],"names":["LogRocketInstrumentationProvider","useLogRocketInstrumentationClient"],"mappings":";;;;;;AAA+B;AAC4I"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workleap/logrocket",
3
3
  "author": "Workleap",
4
- "version": "2.1.2",
4
+ "version": "2.1.3",
5
5
  "description": "A package containing utilities for LogRocket.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -91,15 +91,7 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
91
91
  /**
92
92
  * @see {@link https://workleap.github.io/wl-telemetry}
93
93
  */
94
- export class LogRocketInstrumentationClient implements LogRocketInstrumentationPartialClient {
95
- readonly #telemetryContext?: TelemetryContext;
96
-
97
- constructor(telemetryContext?: TelemetryContext) {
98
- this.#telemetryContext = telemetryContext;
99
- }
100
-
101
- // IMPORTANT: If you update this method, make sure to update the LogRocketInstrumentationPartialClient
102
- // interface as well in @workleap-telemetry/core.
94
+ export interface LogRocketInstrumentationClient extends LogRocketInstrumentationPartialClient {
103
95
  /**
104
96
  * Register a listener to receive the LogRocket session id when it's available.
105
97
  * This method is the equivalent of the LogRocket.getSessionURL function but is
@@ -107,14 +99,28 @@ export class LogRocketInstrumentationClient implements LogRocketInstrumentationP
107
99
  * on `logrocket`.
108
100
  * @see {@link https://workleap.github.io/wl-telemetry}
109
101
  */
110
- registerGetSessionUrlListener(listener: GetLogRocketSessionUrlListener) {
111
- LogRocket.getSessionURL(listener);
112
- }
102
+ registerGetSessionUrlListener: (listener: GetLogRocketSessionUrlListener) => void;
113
103
 
114
104
  /**
115
105
  * Create the default user traits for a Workleap Platform user.
116
106
  * @see {@link https://workleap.github.io/wl-telemetry}
117
107
  */
108
+ createWorkleapPlatformDefaultUserTraits: (identification: LogRocketWorkleapPlatformIdentification) => LogRocketWorkleapPlatformUserTraits;
109
+ }
110
+
111
+ export class LogRocketInstrumentationClientImpl implements LogRocketInstrumentationClient {
112
+ readonly #telemetryContext?: TelemetryContext;
113
+
114
+ constructor(telemetryContext?: TelemetryContext) {
115
+ this.#telemetryContext = telemetryContext;
116
+ }
117
+
118
+ // IMPORTANT: If you update this method, make sure to update the LogRocketInstrumentationPartialClient
119
+ // interface as well in @workleap-telemetry/core.
120
+ registerGetSessionUrlListener(listener: GetLogRocketSessionUrlListener) {
121
+ LogRocket.getSessionURL(listener);
122
+ }
123
+
118
124
  createWorkleapPlatformDefaultUserTraits(identification: LogRocketWorkleapPlatformIdentification) {
119
125
  const {
120
126
  userId,
@@ -1,5 +1,9 @@
1
- import type { LogRocketInstrumentationPartialClient } from "@workleap-telemetry/core";
1
+ import type { LogRocketInstrumentationClient, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
2
+
3
+ export class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationClient {
4
+ createWorkleapPlatformDefaultUserTraits() {
5
+ return {} as LogRocketWorkleapPlatformUserTraits;
6
+ }
2
7
 
3
- export class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationPartialClient {
4
8
  registerGetSessionUrlListener() {}
5
9
  }
package/src/js/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from "@workleap-telemetry/core";
2
2
  export type { LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
3
- export { LogRocketInstrumentationClient, type GetLogRocketSessionUrlListener, type LogRocketWorkleapPlatformIdentification, type LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
3
+ export type { GetLogRocketSessionUrlListener, LogRocketInstrumentationClient, LogRocketWorkleapPlatformIdentification, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
4
4
  export { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.ts";
5
5
  export type * from "./logRocketTypes.ts";
6
6
  export { NoopLogRocketInstrumentationClient } from "./NoopLogRocketInstrumentationClient.ts";
@@ -6,7 +6,7 @@ import { applyTransformers, type LogRocketSdkOptionsTransformer } from "./applyT
6
6
  import { createRequestSanitizer } from "./createRequestSanitizer.ts";
7
7
  import { createResponseSanitizer } from "./createResponseSanitizer.ts";
8
8
  import { createUrlSanitizer } from "./createUrlSanitizer.ts";
9
- import { DeviceIdTrait, LogRocketInstrumentationClient, TelemetryIdTrait } from "./LogRocketInstrumentationClient.ts";
9
+ import { DeviceIdTrait, type LogRocketInstrumentationClient, LogRocketInstrumentationClientImpl, TelemetryIdTrait } from "./LogRocketInstrumentationClient.ts";
10
10
  import type { LogRocketSdkOptions } from "./logRocketTypes.ts";
11
11
 
12
12
  const DefaultPrivateFieldNames = [
@@ -207,7 +207,10 @@ export class LogRocketInstrumentationRegistrator {
207
207
 
208
208
  logger.information("[logrocket] LogRocket instrumentation is registered.");
209
209
 
210
- return new LogRocketInstrumentationClient(telemetryContext);
210
+ const client = new LogRocketInstrumentationClientImpl(telemetryContext);
211
+
212
+ // The cast is to normalize the inferred return type to the "LogRocketInstrumentationClient" type.
213
+ return client as LogRocketInstrumentationClient;
211
214
  }
212
215
  }
213
216
 
@@ -1,13 +1,13 @@
1
- import type { LogRocketInstrumentationPartialClient } from "@workleap-telemetry/core";
2
1
  import { createContext, type PropsWithChildren, useContext } from "react";
2
+ import type { LogRocketInstrumentationClient } from "../js/LogRocketInstrumentationClient.ts";
3
3
 
4
- const LogRocketInstrumentationContext = createContext<LogRocketInstrumentationPartialClient | undefined>(undefined);
4
+ const LogRocketInstrumentationContext = createContext<LogRocketInstrumentationClient | undefined>(undefined);
5
5
 
6
6
  /**
7
7
  * @see {@link https://workleap.github.io/wl-telemetry}
8
8
  */
9
9
  export interface LogRocketInstrumentationProviderProps extends PropsWithChildren {
10
- client: LogRocketInstrumentationPartialClient;
10
+ client: LogRocketInstrumentationClient;
11
11
  }
12
12
 
13
13
  /**
@@ -26,14 +26,28 @@ export function LogRocketInstrumentationProvider(props: LogRocketInstrumentation
26
26
  );
27
27
  }
28
28
 
29
+ export interface UseLogRocketInstrumentationClientOptions {
30
+ /**
31
+ * Whether or not an exception should be thrown if the client hasn't been provided.
32
+ */
33
+ dontThrowOnUndefined?: boolean;
34
+ }
35
+
36
+ export function useLogRocketInstrumentationClient(options?: { dontThrowOnUndefined?: false }): LogRocketInstrumentationClient;
37
+ export function useLogRocketInstrumentationClient(options: { dontThrowOnUndefined: true }): LogRocketInstrumentationClient | undefined;
38
+
29
39
  /**
30
40
  * Retrieve the LogRocket instrumentation client.
31
41
  * @see {@link https://workleap.github.io/wl-telemetry}
32
42
  */
33
- export function useLogRocketInstrumentationClient() {
43
+ export function useLogRocketInstrumentationClient(options: UseLogRocketInstrumentationClientOptions = {}) {
44
+ const {
45
+ dontThrowOnUndefined = false
46
+ } = options;
47
+
34
48
  const client = useContext(LogRocketInstrumentationContext);
35
49
 
36
- if (!client) {
50
+ if (!client && !dontThrowOnUndefined) {
37
51
  throw new Error("[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.");
38
52
  }
39
53
 
@@ -1,3 +1,3 @@
1
1
  export * from "../js/index.ts";
2
- export { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient } from "./LogRocketInstrumentationContext.tsx";
2
+ export { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient, type UseLogRocketInstrumentationClientOptions } from "./LogRocketInstrumentationContext.tsx";
3
3