@workleap/logrocket 2.1.9 → 3.0.1
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 +17 -0
- package/dist/js/LogRocketInstrumentationClient.d.ts +39 -0
- package/dist/js/LogRocketInstrumentationClient.js +14 -1
- package/dist/js/LogRocketInstrumentationClient.js.map +1 -1
- package/dist/js/NoopLogRocketInstrumentationClient.d.ts +2 -1
- package/dist/js/NoopLogRocketInstrumentationClient.js +3 -0
- package/dist/js/NoopLogRocketInstrumentationClient.js.map +1 -1
- package/dist/js/index.d.ts +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/registerLogRocketInstrumentation.d.ts +0 -2
- package/dist/js/registerLogRocketInstrumentation.js +1 -25
- package/dist/js/registerLogRocketInstrumentation.js.map +1 -1
- package/package.json +3 -3
- package/src/js/LogRocketInstrumentationClient.ts +47 -0
- package/src/js/NoopLogRocketInstrumentationClient.ts +5 -1
- package/src/js/index.ts +8 -1
- package/src/js/registerLogRocketInstrumentation.ts +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @workleap/logrocket
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165](https://github.com/workleap/wl-telemetry/pull/165) [`049e75d`](https://github.com/workleap/wl-telemetry/commit/049e75d3954c8564b757bb15bf6b75c4f8e79cb7) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated packages to use range version for workspace dependency versions.
|
|
8
|
+
|
|
9
|
+
## 3.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#150](https://github.com/workleap/wl-telemetry/pull/150) [`133e534`](https://github.com/workleap/wl-telemetry/commit/133e53429453d821086574789e29437001a3c0d5) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Remove deprecated global variables and functions. View [migration documentation](https://workleap.github.io/wl-telemetry/updating/logrocket/migrate-to-v3.0/).
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`133e534`](https://github.com/workleap/wl-telemetry/commit/133e53429453d821086574789e29437001a3c0d5)]:
|
|
18
|
+
- @workleap-telemetry/core@2.0.0
|
|
19
|
+
|
|
3
20
|
## 2.1.9
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -77,6 +77,28 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
77
77
|
"Plan Code - Performance"?: string;
|
|
78
78
|
"Plan Code - Pingboard"?: string;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
82
|
+
*/
|
|
83
|
+
export interface LogRocketShareGateIdentification {
|
|
84
|
+
shareGateAccountId: string;
|
|
85
|
+
microsoftUserId: string;
|
|
86
|
+
microsoftTenantId: string;
|
|
87
|
+
workspaceId: string;
|
|
88
|
+
isInPartnerProgram?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
92
|
+
*/
|
|
93
|
+
export interface LogRocketShareGateUserTraits extends Record<string, unknown> {
|
|
94
|
+
"ShareGate Account Id": string;
|
|
95
|
+
"Microsoft User Id": string;
|
|
96
|
+
"Microsoft Tenant Id": string;
|
|
97
|
+
"Workspace Id": string;
|
|
98
|
+
"Device Id": string;
|
|
99
|
+
"Telemetry Id": string;
|
|
100
|
+
"Is In Partner Program"?: boolean;
|
|
101
|
+
}
|
|
80
102
|
/**
|
|
81
103
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
82
104
|
*/
|
|
@@ -94,7 +116,15 @@ export interface LogRocketInstrumentationClient extends LogRocketInstrumentation
|
|
|
94
116
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
95
117
|
*/
|
|
96
118
|
createWorkleapPlatformDefaultUserTraits: (identification: LogRocketWorkleapPlatformIdentification) => LogRocketWorkleapPlatformUserTraits;
|
|
119
|
+
/**
|
|
120
|
+
* Create the default user traits for a ShareGate user.
|
|
121
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
122
|
+
*/
|
|
123
|
+
createShareGateDefaultUserTraits: (identification: LogRocketShareGateIdentification) => LogRocketShareGateUserTraits;
|
|
97
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
127
|
+
*/
|
|
98
128
|
export declare class LogRocketInstrumentationClientImpl implements LogRocketInstrumentationClient {
|
|
99
129
|
#private;
|
|
100
130
|
constructor(telemetryContext?: TelemetryContext);
|
|
@@ -134,4 +164,13 @@ export declare class LogRocketInstrumentationClientImpl implements LogRocketInst
|
|
|
134
164
|
"Device Id": string;
|
|
135
165
|
"Telemetry Id": string;
|
|
136
166
|
};
|
|
167
|
+
createShareGateDefaultUserTraits(identification: LogRocketShareGateIdentification): {
|
|
168
|
+
"ShareGate Account Id": string;
|
|
169
|
+
"Microsoft User Id": string;
|
|
170
|
+
"Microsoft Tenant Id": string;
|
|
171
|
+
"Workspace Id": string;
|
|
172
|
+
"Device Id": string;
|
|
173
|
+
"Telemetry Id": string;
|
|
174
|
+
"Is In Partner Program": boolean | undefined;
|
|
175
|
+
};
|
|
137
176
|
}
|
|
@@ -10,7 +10,9 @@ import { isDefined } from "./assertions.js";
|
|
|
10
10
|
|
|
11
11
|
const DeviceIdTrait = "Device Id";
|
|
12
12
|
const TelemetryIdTrait = "Telemetry Id";
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
15
|
+
*/ class LogRocketInstrumentationClientImpl {
|
|
14
16
|
#telemetryContext;
|
|
15
17
|
constructor(telemetryContext){
|
|
16
18
|
this.#telemetryContext = telemetryContext;
|
|
@@ -112,6 +114,17 @@ class LogRocketInstrumentationClientImpl {
|
|
|
112
114
|
}
|
|
113
115
|
};
|
|
114
116
|
}
|
|
117
|
+
createShareGateDefaultUserTraits(identification) {
|
|
118
|
+
return {
|
|
119
|
+
"ShareGate Account Id": identification.shareGateAccountId,
|
|
120
|
+
"Microsoft User Id": identification.microsoftUserId,
|
|
121
|
+
"Microsoft Tenant Id": identification.microsoftTenantId,
|
|
122
|
+
"Workspace Id": identification.workspaceId,
|
|
123
|
+
[DeviceIdTrait]: this.#telemetryContext?.deviceId ?? "N/A",
|
|
124
|
+
[TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? "N/A",
|
|
125
|
+
"Is In Partner Program": identification.isInPartnerProgram
|
|
126
|
+
};
|
|
127
|
+
}
|
|
115
128
|
}
|
|
116
129
|
|
|
117
130
|
export { DeviceIdTrait, LogRocketInstrumentationClientImpl, TelemetryIdTrait };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/LogRocketInstrumentationClient.js","sources":["../../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,S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B,QAAQ;gBAAE,kCAAkCA,eAAe,GAAG;YAAC,CAAC;YAC9F,GAAId,SAASA,CAACe,uBAAuB;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
|
+
{"version":3,"file":"js/LogRocketInstrumentationClient.js","sources":["../../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 LogRocketShareGateIdentification {\n shareGateAccountId: string;\n microsoftUserId: string;\n microsoftTenantId: string;\n workspaceId: string;\n isInPartnerProgram?: boolean;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketShareGateUserTraits extends Record<string, unknown> {\n \"ShareGate Account Id\": string;\n \"Microsoft User Id\": string;\n \"Microsoft Tenant Id\": string;\n \"Workspace Id\": string;\n \"Device Id\": string;\n \"Telemetry Id\": string;\n \"Is In Partner Program\"?: boolean;\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 /**\n * Create the default user traits for a ShareGate user.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n createShareGateDefaultUserTraits: (identification: LogRocketShareGateIdentification) => LogRocketShareGateUserTraits;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\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 createShareGateDefaultUserTraits(identification: LogRocketShareGateIdentification) {\n return {\n \"ShareGate Account Id\": identification.shareGateAccountId,\n \"Microsoft User Id\": identification.microsoftUserId,\n \"Microsoft Tenant Id\": identification.microsoftTenantId,\n \"Workspace Id\": identification.workspaceId,\n [DeviceIdTrait]: this.#telemetryContext?.deviceId ?? \"N/A\",\n [TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? \"N/A\",\n \"Is In Partner Program\": identification.isInPartnerProgram\n } satisfies LogRocketShareGateUserTraits;\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;AAuI/C;;CAEC,GACM,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,gBAAgB;YAAK,CAA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BA;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;IAEA,iCAAiCX,cAAgD,EAAE;QAC/E,OAAO;YACH,wBAAwBA,eAAe,kBAAkB;YACzD,qBAAqBA,eAAe,eAAe;YACnD,uBAAuBA,eAAe,iBAAiB;YACvD,gBAAgBA,eAAe,WAAW;YAC1C,CAACL,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY;YACrD,CAACC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe;YAC3D,yBAAyBI,eAAe,kBAAkB;QAC9D;IACJ;AACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { LogRocketInstrumentationClient, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
|
|
1
|
+
import type { LogRocketInstrumentationClient, LogRocketShareGateUserTraits, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
|
|
2
2
|
export declare class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationClient {
|
|
3
3
|
createWorkleapPlatformDefaultUserTraits(): LogRocketWorkleapPlatformUserTraits;
|
|
4
|
+
createShareGateDefaultUserTraits(): LogRocketShareGateUserTraits;
|
|
4
5
|
registerGetSessionUrlListener(): void;
|
|
5
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/NoopLogRocketInstrumentationClient.js","sources":["../../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
|
+
{"version":3,"file":"js/NoopLogRocketInstrumentationClient.js","sources":["../../src/js/NoopLogRocketInstrumentationClient.ts"],"sourcesContent":["import type { LogRocketInstrumentationClient, LogRocketShareGateUserTraits, LogRocketWorkleapPlatformUserTraits } from \"./LogRocketInstrumentationClient.ts\";\n\nexport class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationClient {\n createWorkleapPlatformDefaultUserTraits() {\n return {} as LogRocketWorkleapPlatformUserTraits;\n }\n\n createShareGateDefaultUserTraits() {\n return {} as LogRocketShareGateUserTraits;\n }\n\n registerGetSessionUrlListener() {}\n}\n"],"names":["NoopLogRocketInstrumentationClient"],"mappings":";;AAEO,MAAMA;IACT,0CAA0C;QACtC,OAAO,CAAC;IACZ;IAEA,mCAAmC;QAC/B,OAAO,CAAC;IACZ;IAEA,gCAAgC,CAAC;AACrC"}
|
package/dist/js/index.d.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 type { GetLogRocketSessionUrlListener, LogRocketInstrumentationClient, LogRocketWorkleapPlatformIdentification, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
|
|
3
|
+
export type { GetLogRocketSessionUrlListener, LogRocketInstrumentationClient, LogRocketShareGateIdentification, LogRocketShareGateUserTraits, 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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/index.js","sources":["../../src/js/index.ts"],"sourcesContent":["export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from \"@workleap-telemetry/core\";\nexport type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport type {
|
|
1
|
+
{"version":3,"file":"js/index.js","sources":["../../src/js/index.ts"],"sourcesContent":["export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from \"@workleap-telemetry/core\";\nexport type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport type {\n GetLogRocketSessionUrlListener,\n LogRocketInstrumentationClient,\n LogRocketShareGateIdentification,\n LogRocketShareGateUserTraits,\n LogRocketWorkleapPlatformIdentification,\n LogRocketWorkleapPlatformUserTraits\n} 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"],"names":["createTelemetryContext","LogRocketLogger","LogRocketLoggerScope","NoopLogRocketInstrumentationClient","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;;;;AAA6H;AAUhD;AAEgB;AAC0C"}
|
|
@@ -44,8 +44,6 @@ export interface RegisterLogRocketInstrumentationOptions {
|
|
|
44
44
|
loggers?: RootLogger[];
|
|
45
45
|
}
|
|
46
46
|
export declare function getLogRocketSdkOptions(userOptions: RegisterLogRocketInstrumentationOptions, logger: RootLogger): LogRocketSdkOptions;
|
|
47
|
-
export declare const IsRegisteredVariableName = "__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__";
|
|
48
|
-
export declare const RegisterGetSessionUrlFunctionName = "__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__";
|
|
49
47
|
export declare function __resetRegistrationGuard(): void;
|
|
50
48
|
export declare class LogRocketInstrumentationRegistrator {
|
|
51
49
|
register(appId: string, options?: RegisterLogRocketInstrumentationOptions): LogRocketInstrumentationClient;
|
|
@@ -91,29 +91,6 @@ function getLogRocketSdkOptions(userOptions, logger) {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
///////////////////////////
|
|
94
|
-
// DEPRECATED: Grace period ends on January 1th 2026.
|
|
95
|
-
const IsRegisteredVariableName = "__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__";
|
|
96
|
-
const RegisterGetSessionUrlFunctionName = "__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__";
|
|
97
|
-
// DEPRECATED: Grace period ends on January 1th 2026.
|
|
98
|
-
function registerDeprecatedGlobalVariables() {
|
|
99
|
-
// Indicates to the host applications that logrocket has been initialized.
|
|
100
|
-
// It's useful in cases where an "add-on", like the platform widgets needs
|
|
101
|
-
// to know whether or not the host application is using LogRocket.
|
|
102
|
-
// While there are ways that the host application could tell to an "add-on" if
|
|
103
|
-
// it's using LogRocket or not, doing it this way is transparent for the consumer,
|
|
104
|
-
// which is great for DX.
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
globalThis[IsRegisteredVariableName] = true;
|
|
108
|
-
// While consumers could directly call LogRocket.getSessionURL, by doing it this way,
|
|
109
|
-
// it allow consumers to not take a direct dependency on the "logrocket" package.
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
globalThis[RegisterGetSessionUrlFunctionName] = (listener)=>{
|
|
113
|
-
logrocket.getSessionURL(listener);
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
///////////////////////////
|
|
117
94
|
let registrationGuardInstance;
|
|
118
95
|
// It's important to use a lazy singleton instead of a singleton to avoid
|
|
119
96
|
// any future probleme related to HMR, tree-shaking, SSR, etc..
|
|
@@ -149,7 +126,6 @@ class LogRocketInstrumentationRegistrator {
|
|
|
149
126
|
logrocket.getSessionURL((url)=>{
|
|
150
127
|
logger.withText("[logrocket] Session replay URL is now available:").withText(url).debug();
|
|
151
128
|
});
|
|
152
|
-
registerDeprecatedGlobalVariables();
|
|
153
129
|
logger.information("[logrocket] LogRocket instrumentation is registered.");
|
|
154
130
|
const client = new LogRocketInstrumentationClientImpl(telemetryContext);
|
|
155
131
|
// The cast is to normalize the inferred return type to the "LogRocketInstrumentationClient" type.
|
|
@@ -167,6 +143,6 @@ class LogRocketInstrumentationRegistrator {
|
|
|
167
143
|
return new LogRocketInstrumentationRegistrator().register(appId, options);
|
|
168
144
|
}
|
|
169
145
|
|
|
170
|
-
export {
|
|
146
|
+
export { LogRocketInstrumentationRegistrator, __resetRegistrationGuard, getLogRocketSdkOptions, registerLogRocketInstrumentation };
|
|
171
147
|
|
|
172
148
|
//# sourceMappingURL=registerLogRocketInstrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/registerLogRocketInstrumentation.js","sources":["../../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,eAAe,EAAE,EACpB,GAAGN;IAEJ,MAAMO,0BAA0BV,yBAAyB,MAAM,CAACM;IAChE,MAAMK,mCAAmCV,kCAAkC,MAAM,CAACM;IAElF,kJAAkJ;IAClJ,gCAAgC;IAChC,0EAA0E;IAC1E,6DAA6D;IAC7D,aAAa;IACb,MAAM,EAAE,kBAAkBK,qBAAqB,EAAE,mBAAmBC,sBAAsB,EAAE,GAAGrB,sCAA6B,CAACkB;IAE7H,MAAMI,aAAa;QACf,SAAS;YACL,wFAAwF;YACxF,sEAAsE;YACtE,WAAW;QACf;QACAT;QACA,KAAK;YACD,eAAe;YACf,gBAAgB;QACpB;QACA,SAAS;YACL,kBAAkBX,sBAAsBA,CAACkB;YACzC,mBAAmBjB,uBAAuBA,CAACkB;QAC/C;QACA,SAAS;YACL,cAAcjB,kBAAkBA,CAACe;QACrC;QACA,gBAAgBH;IACpB;IAEA,OAAOf,iBAAiBA,CAACqB,YAAYL,cAAc;QAC/CD;QACAJ;IACJ;AACJ;AAEA,2BAA2B;AAE3B,qDAAqD;AAC9C,MAAMW,2BAA2B,kDAAkD;AACnF,MAAMC,oCAAoC,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AAI/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
|
+
{"version":3,"file":"js/registerLogRocketInstrumentation.js","sources":["../../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\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 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","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,eAAe,EAAE,EACpB,GAAGN;IAEJ,MAAMO,0BAA0BV,yBAA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EAAEwB,iBAAiB,QAAQ;gBAC1C,CAACtB,gBAAgBA,CAAC,EAAEsB,iBAAiB,WAAW;YACpD;QACJ;QAEA9B,uBAAuB,CAACgC,CAAAA;YACpBnB,OACK,QAAQ,CAAC,oDACT,QAAQ,CAACmB,KACT,KAAK;QACd;QAEAnB,OAAO,WAAW,CAAC;QAEnB,MAAMoB,SAAS,IAAI1B,kCAAkCA,CAACuB;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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workleap/logrocket",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"description": "A package containing utilities for LogRocket.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@workleap/logging": "^1.3.6",
|
|
49
49
|
"logrocket-fuzzy-search-sanitizer": "0.0.2",
|
|
50
|
-
"@workleap-telemetry/core": "
|
|
50
|
+
"@workleap-telemetry/core": "^2.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@eslint/js": "9.39.2",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@rslib/core": "0.19.5",
|
|
56
56
|
"@types/react": "19.2.13",
|
|
57
57
|
"@typescript-eslint/parser": "8.55.0",
|
|
58
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
58
|
+
"@typescript/native-preview": "7.0.0-dev.20260227.1",
|
|
59
59
|
"@workleap/eslint-configs": "1.1.12",
|
|
60
60
|
"@workleap/rslib-configs": "1.1.7",
|
|
61
61
|
"@workleap/typescript-configs": "3.0.7",
|
|
@@ -88,6 +88,32 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
88
88
|
|
|
89
89
|
///////////////////////////
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
93
|
+
*/
|
|
94
|
+
export interface LogRocketShareGateIdentification {
|
|
95
|
+
shareGateAccountId: string;
|
|
96
|
+
microsoftUserId: string;
|
|
97
|
+
microsoftTenantId: string;
|
|
98
|
+
workspaceId: string;
|
|
99
|
+
isInPartnerProgram?: boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
104
|
+
*/
|
|
105
|
+
export interface LogRocketShareGateUserTraits extends Record<string, unknown> {
|
|
106
|
+
"ShareGate Account Id": string;
|
|
107
|
+
"Microsoft User Id": string;
|
|
108
|
+
"Microsoft Tenant Id": string;
|
|
109
|
+
"Workspace Id": string;
|
|
110
|
+
"Device Id": string;
|
|
111
|
+
"Telemetry Id": string;
|
|
112
|
+
"Is In Partner Program"?: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
///////////////////////////
|
|
116
|
+
|
|
91
117
|
/**
|
|
92
118
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
93
119
|
*/
|
|
@@ -106,8 +132,17 @@ export interface LogRocketInstrumentationClient extends LogRocketInstrumentation
|
|
|
106
132
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
107
133
|
*/
|
|
108
134
|
createWorkleapPlatformDefaultUserTraits: (identification: LogRocketWorkleapPlatformIdentification) => LogRocketWorkleapPlatformUserTraits;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Create the default user traits for a ShareGate user.
|
|
138
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
139
|
+
*/
|
|
140
|
+
createShareGateDefaultUserTraits: (identification: LogRocketShareGateIdentification) => LogRocketShareGateUserTraits;
|
|
109
141
|
}
|
|
110
142
|
|
|
143
|
+
/**
|
|
144
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
145
|
+
*/
|
|
111
146
|
export class LogRocketInstrumentationClientImpl implements LogRocketInstrumentationClient {
|
|
112
147
|
readonly #telemetryContext?: TelemetryContext;
|
|
113
148
|
|
|
@@ -192,4 +227,16 @@ export class LogRocketInstrumentationClientImpl implements LogRocketInstrumentat
|
|
|
192
227
|
...(isDefined(planCode?.cmp) && { "Plan Code - Compensation": planCode.cmp })
|
|
193
228
|
} satisfies LogRocketWorkleapPlatformUserTraits;
|
|
194
229
|
}
|
|
230
|
+
|
|
231
|
+
createShareGateDefaultUserTraits(identification: LogRocketShareGateIdentification) {
|
|
232
|
+
return {
|
|
233
|
+
"ShareGate Account Id": identification.shareGateAccountId,
|
|
234
|
+
"Microsoft User Id": identification.microsoftUserId,
|
|
235
|
+
"Microsoft Tenant Id": identification.microsoftTenantId,
|
|
236
|
+
"Workspace Id": identification.workspaceId,
|
|
237
|
+
[DeviceIdTrait]: this.#telemetryContext?.deviceId ?? "N/A",
|
|
238
|
+
[TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? "N/A",
|
|
239
|
+
"Is In Partner Program": identification.isInPartnerProgram
|
|
240
|
+
} satisfies LogRocketShareGateUserTraits;
|
|
241
|
+
}
|
|
195
242
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { LogRocketInstrumentationClient, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
|
|
1
|
+
import type { LogRocketInstrumentationClient, LogRocketShareGateUserTraits, LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
|
|
2
2
|
|
|
3
3
|
export class NoopLogRocketInstrumentationClient implements LogRocketInstrumentationClient {
|
|
4
4
|
createWorkleapPlatformDefaultUserTraits() {
|
|
5
5
|
return {} as LogRocketWorkleapPlatformUserTraits;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
createShareGateDefaultUserTraits() {
|
|
9
|
+
return {} as LogRocketShareGateUserTraits;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
registerGetSessionUrlListener() {}
|
|
9
13
|
}
|
package/src/js/index.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from "@workleap-telemetry/core";
|
|
2
2
|
export type { LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
|
|
3
|
-
export type {
|
|
3
|
+
export type {
|
|
4
|
+
GetLogRocketSessionUrlListener,
|
|
5
|
+
LogRocketInstrumentationClient,
|
|
6
|
+
LogRocketShareGateIdentification,
|
|
7
|
+
LogRocketShareGateUserTraits,
|
|
8
|
+
LogRocketWorkleapPlatformIdentification,
|
|
9
|
+
LogRocketWorkleapPlatformUserTraits
|
|
10
|
+
} from "./LogRocketInstrumentationClient.ts";
|
|
4
11
|
export { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.ts";
|
|
5
12
|
export type * from "./logRocketTypes.ts";
|
|
6
13
|
export { NoopLogRocketInstrumentationClient } from "./NoopLogRocketInstrumentationClient.ts";
|
|
@@ -121,33 +121,6 @@ export function getLogRocketSdkOptions(userOptions: RegisterLogRocketInstrumenta
|
|
|
121
121
|
|
|
122
122
|
///////////////////////////
|
|
123
123
|
|
|
124
|
-
// DEPRECATED: Grace period ends on January 1th 2026.
|
|
125
|
-
export const IsRegisteredVariableName = "__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__";
|
|
126
|
-
export const RegisterGetSessionUrlFunctionName = "__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__";
|
|
127
|
-
|
|
128
|
-
// DEPRECATED: Grace period ends on January 1th 2026.
|
|
129
|
-
function registerDeprecatedGlobalVariables() {
|
|
130
|
-
// Indicates to the host applications that logrocket has been initialized.
|
|
131
|
-
// It's useful in cases where an "add-on", like the platform widgets needs
|
|
132
|
-
// to know whether or not the host application is using LogRocket.
|
|
133
|
-
// While there are ways that the host application could tell to an "add-on" if
|
|
134
|
-
// it's using LogRocket or not, doing it this way is transparent for the consumer,
|
|
135
|
-
// which is great for DX.
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
137
|
-
// @ts-ignore
|
|
138
|
-
globalThis[IsRegisteredVariableName] = true;
|
|
139
|
-
|
|
140
|
-
// While consumers could directly call LogRocket.getSessionURL, by doing it this way,
|
|
141
|
-
// it allow consumers to not take a direct dependency on the "logrocket" package.
|
|
142
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
143
|
-
// @ts-ignore
|
|
144
|
-
globalThis[RegisterGetSessionUrlFunctionName] = listener => {
|
|
145
|
-
LogRocket.getSessionURL(listener);
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
///////////////////////////
|
|
150
|
-
|
|
151
124
|
let registrationGuardInstance: HasExecutedGuard | undefined;
|
|
152
125
|
|
|
153
126
|
// It's important to use a lazy singleton instead of a singleton to avoid
|
|
@@ -203,8 +176,6 @@ export class LogRocketInstrumentationRegistrator {
|
|
|
203
176
|
.debug();
|
|
204
177
|
});
|
|
205
178
|
|
|
206
|
-
registerDeprecatedGlobalVariables();
|
|
207
|
-
|
|
208
179
|
logger.information("[logrocket] LogRocket instrumentation is registered.");
|
|
209
180
|
|
|
210
181
|
const client = new LogRocketInstrumentationClientImpl(telemetryContext);
|