@workleap/logrocket 3.0.5 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @workleap/logrocket
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#216](https://github.com/workleap/wl-telemetry/pull/216) [`63681db`](https://github.com/workleap/wl-telemetry/commit/63681db29d72515f435df680acb0946ee7ff9625) Thanks [@mahmoudmoravej](https://github.com/mahmoudmoravej)! - Fixed the default user traits so they can be forwarded to `LogRocket.identify` as documented, and removed the ShareGate partner program trait.
|
|
8
|
+
|
|
9
|
+
## Breaking changes
|
|
10
|
+
- The `isInPartnerProgram` option of `LogRocketShareGateIdentification` and the `Is In Partner Program` trait it produced have been removed.
|
|
11
|
+
- `LogRocketWorkleapPlatformUserTraits` and `LogRocketShareGateUserTraits` are no longer extending `Record<string, unknown>`. The `unknown` index signature made them incompatible with LogRocket `IUserTraits` type, causing a `TS2345` error when the traits were passed to `LogRocket.identify`. They are now declared as type aliases, which means accessing an unknown trait is a compilation error rather than an `unknown` value.
|
|
12
|
+
|
|
13
|
+
## Improvements
|
|
14
|
+
- The `microsoftUserId`, `microsoftTenantId` and `workspaceId` options of `LogRocketShareGateIdentification` are now optional. The matching traits fall back to `N/A` when no value is provided, as the correlation ids already do.
|
|
15
|
+
- `LogRocketWorkleapPlatformUserTraits` now includes the `Is Executive - Compensation`, `Is Collaborator - Compensation` and `Plan Code - Compensation` traits, which `createWorkleapPlatformDefaultUserTraits` was already returning.
|
|
16
|
+
|
|
3
17
|
## 3.0.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -45,7 +45,7 @@ export interface LogRocketWorkleapPlatformIdentification {
|
|
|
45
45
|
/**
|
|
46
46
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export type LogRocketWorkleapPlatformUserTraits = {
|
|
49
49
|
"User Id": string;
|
|
50
50
|
"Organization Id": string;
|
|
51
51
|
"Organization Name": string;
|
|
@@ -61,6 +61,7 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
61
61
|
"Is Executive - Skills"?: boolean;
|
|
62
62
|
"Is Executive - Performance"?: boolean;
|
|
63
63
|
"Is Executive - Pingboard"?: boolean;
|
|
64
|
+
"Is Executive - Compensation"?: boolean;
|
|
64
65
|
"Is Collaborator"?: boolean;
|
|
65
66
|
"Is Collaborator - Officevibe"?: boolean;
|
|
66
67
|
"Is Collaborator - LMS"?: boolean;
|
|
@@ -68,6 +69,7 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
68
69
|
"Is Collaborator - Skills"?: boolean;
|
|
69
70
|
"Is Collaborator - Performance"?: boolean;
|
|
70
71
|
"Is Collaborator - Pingboard"?: boolean;
|
|
72
|
+
"Is Collaborator - Compensation"?: boolean;
|
|
71
73
|
"Is Reporting Manager"?: boolean;
|
|
72
74
|
"Is Team Manager"?: boolean;
|
|
73
75
|
"Plan Code - Officevibe"?: string;
|
|
@@ -76,29 +78,28 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
76
78
|
"Plan Code - Skills"?: string;
|
|
77
79
|
"Plan Code - Performance"?: string;
|
|
78
80
|
"Plan Code - Pingboard"?: string;
|
|
79
|
-
|
|
81
|
+
"Plan Code - Compensation"?: string;
|
|
82
|
+
};
|
|
80
83
|
/**
|
|
81
84
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
82
85
|
*/
|
|
83
86
|
export interface LogRocketShareGateIdentification {
|
|
84
87
|
shareGateAccountId: string;
|
|
85
|
-
microsoftUserId
|
|
86
|
-
microsoftTenantId
|
|
87
|
-
workspaceId
|
|
88
|
-
isInPartnerProgram?: boolean;
|
|
88
|
+
microsoftUserId?: string;
|
|
89
|
+
microsoftTenantId?: string;
|
|
90
|
+
workspaceId?: string;
|
|
89
91
|
}
|
|
90
92
|
/**
|
|
91
93
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
92
94
|
*/
|
|
93
|
-
export
|
|
95
|
+
export type LogRocketShareGateUserTraits = {
|
|
94
96
|
"ShareGate Account Id": string;
|
|
95
97
|
"Microsoft User Id": string;
|
|
96
98
|
"Microsoft Tenant Id": string;
|
|
97
99
|
"Workspace Id": string;
|
|
98
100
|
"Device Id": string;
|
|
99
101
|
"Telemetry Id": string;
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
+
};
|
|
102
103
|
/**
|
|
103
104
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
104
105
|
*/
|
|
@@ -171,6 +172,5 @@ export declare class LogRocketInstrumentationClientImpl implements LogRocketInst
|
|
|
171
172
|
"Workspace Id": string;
|
|
172
173
|
"Device Id": string;
|
|
173
174
|
"Telemetry Id": string;
|
|
174
|
-
"Is In Partner Program": boolean | undefined;
|
|
175
175
|
};
|
|
176
176
|
}
|
|
@@ -114,12 +114,11 @@ const TelemetryIdTrait = "Telemetry Id";
|
|
|
114
114
|
createShareGateDefaultUserTraits(identification) {
|
|
115
115
|
return {
|
|
116
116
|
"ShareGate Account Id": identification.shareGateAccountId,
|
|
117
|
-
"Microsoft User Id": identification.microsoftUserId,
|
|
118
|
-
"Microsoft Tenant Id": identification.microsoftTenantId,
|
|
119
|
-
"Workspace Id": identification.workspaceId,
|
|
117
|
+
"Microsoft User Id": identification.microsoftUserId ?? "N/A",
|
|
118
|
+
"Microsoft Tenant Id": identification.microsoftTenantId ?? "N/A",
|
|
119
|
+
"Workspace Id": identification.workspaceId ?? "N/A",
|
|
120
120
|
[DeviceIdTrait]: this.#telemetryContext?.deviceId ?? "N/A",
|
|
121
|
-
[TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? "N/A"
|
|
122
|
-
"Is In Partner Program": identification.isInPartnerProgram
|
|
121
|
+
[TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? "N/A"
|
|
123
122
|
};
|
|
124
123
|
}
|
|
125
124
|
}
|
|
@@ -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 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,aAAaA,GAAG,YAAY;AAClC,MAAMC,gBAAgBA,GAAG,eAAe;AAuI/C;;CAEC,GACM,MAAMC,kCAAkCA;IAClC,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,EACl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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,aAAaA,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY;YACrD,CAACC,gBAAgBA,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe;YAC3D,yBAAyBI,eAAe,kBAAkB;QAC9D;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// Must remain assignable to the LogRocket \"IUserTraits\" type, otherwise the traits cannot be forwarded to\n// LogRocket.identify. Hence the type alias: an index signature would either widen the trait values beyond what\n// LogRocket accepts or forbid optional traits, while a plain interface has no implicit index signature.\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport type LogRocketWorkleapPlatformUserTraits = {\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 Executive - Compensation\"?: 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 Collaborator - Compensation\"?: 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 \"Plan Code - Compensation\"?: 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}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport type LogRocketShareGateUserTraits = {\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};\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/A\",\n \"Microsoft Tenant Id\": identification.microsoftTenantId ?? \"N/A\",\n \"Workspace Id\": identification.workspaceId ?? \"N/A\",\n [DeviceIdTrait]: this.#telemetryContext?.deviceId ?? \"N/A\",\n [TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? \"N/A\"\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,aAAaA,GAAG,YAA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;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,IAAI;YACvD,uBAAuBA,eAAe,iBAAiB,IAAI;YAC3D,gBAAgBA,eAAe,WAAW,IAAI;YAC9C,CAACL,aAAaA,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY;YACrD,CAACC,gBAAgBA,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe;QAC/D;IACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -50,10 +50,13 @@ export interface LogRocketWorkleapPlatformIdentification {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// Must remain assignable to the LogRocket "IUserTraits" type, otherwise the traits cannot be forwarded to
|
|
54
|
+
// LogRocket.identify. Hence the type alias: an index signature would either widen the trait values beyond what
|
|
55
|
+
// LogRocket accepts or forbid optional traits, while a plain interface has no implicit index signature.
|
|
53
56
|
/**
|
|
54
57
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
55
58
|
*/
|
|
56
|
-
export
|
|
59
|
+
export type LogRocketWorkleapPlatformUserTraits = {
|
|
57
60
|
"User Id": string;
|
|
58
61
|
"Organization Id": string;
|
|
59
62
|
"Organization Name": string;
|
|
@@ -69,6 +72,7 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
69
72
|
"Is Executive - Skills"?: boolean;
|
|
70
73
|
"Is Executive - Performance"?: boolean;
|
|
71
74
|
"Is Executive - Pingboard"?: boolean;
|
|
75
|
+
"Is Executive - Compensation"?: boolean;
|
|
72
76
|
"Is Collaborator"?: boolean;
|
|
73
77
|
"Is Collaborator - Officevibe"?: boolean;
|
|
74
78
|
"Is Collaborator - LMS"?: boolean;
|
|
@@ -76,6 +80,7 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
76
80
|
"Is Collaborator - Skills"?: boolean;
|
|
77
81
|
"Is Collaborator - Performance"?: boolean;
|
|
78
82
|
"Is Collaborator - Pingboard"?: boolean;
|
|
83
|
+
"Is Collaborator - Compensation"?: boolean;
|
|
79
84
|
"Is Reporting Manager"?: boolean;
|
|
80
85
|
"Is Team Manager"?: boolean;
|
|
81
86
|
"Plan Code - Officevibe"?: string;
|
|
@@ -84,7 +89,8 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
84
89
|
"Plan Code - Skills"?: string;
|
|
85
90
|
"Plan Code - Performance"?: string;
|
|
86
91
|
"Plan Code - Pingboard"?: string;
|
|
87
|
-
|
|
92
|
+
"Plan Code - Compensation"?: string;
|
|
93
|
+
};
|
|
88
94
|
|
|
89
95
|
///////////////////////////
|
|
90
96
|
|
|
@@ -93,24 +99,22 @@ export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unkn
|
|
|
93
99
|
*/
|
|
94
100
|
export interface LogRocketShareGateIdentification {
|
|
95
101
|
shareGateAccountId: string;
|
|
96
|
-
microsoftUserId
|
|
97
|
-
microsoftTenantId
|
|
98
|
-
workspaceId
|
|
99
|
-
isInPartnerProgram?: boolean;
|
|
102
|
+
microsoftUserId?: string;
|
|
103
|
+
microsoftTenantId?: string;
|
|
104
|
+
workspaceId?: string;
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
/**
|
|
103
108
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
104
109
|
*/
|
|
105
|
-
export
|
|
110
|
+
export type LogRocketShareGateUserTraits = {
|
|
106
111
|
"ShareGate Account Id": string;
|
|
107
112
|
"Microsoft User Id": string;
|
|
108
113
|
"Microsoft Tenant Id": string;
|
|
109
114
|
"Workspace Id": string;
|
|
110
115
|
"Device Id": string;
|
|
111
116
|
"Telemetry Id": string;
|
|
112
|
-
|
|
113
|
-
}
|
|
117
|
+
};
|
|
114
118
|
|
|
115
119
|
///////////////////////////
|
|
116
120
|
|
|
@@ -231,12 +235,11 @@ export class LogRocketInstrumentationClientImpl implements LogRocketInstrumentat
|
|
|
231
235
|
createShareGateDefaultUserTraits(identification: LogRocketShareGateIdentification) {
|
|
232
236
|
return {
|
|
233
237
|
"ShareGate Account Id": identification.shareGateAccountId,
|
|
234
|
-
"Microsoft User Id": identification.microsoftUserId,
|
|
235
|
-
"Microsoft Tenant Id": identification.microsoftTenantId,
|
|
236
|
-
"Workspace Id": identification.workspaceId,
|
|
238
|
+
"Microsoft User Id": identification.microsoftUserId ?? "N/A",
|
|
239
|
+
"Microsoft Tenant Id": identification.microsoftTenantId ?? "N/A",
|
|
240
|
+
"Workspace Id": identification.workspaceId ?? "N/A",
|
|
237
241
|
[DeviceIdTrait]: this.#telemetryContext?.deviceId ?? "N/A",
|
|
238
|
-
[TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? "N/A"
|
|
239
|
-
"Is In Partner Program": identification.isInPartnerProgram
|
|
242
|
+
[TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? "N/A"
|
|
240
243
|
} satisfies LogRocketShareGateUserTraits;
|
|
241
244
|
}
|
|
242
245
|
}
|