@workleap/logrocket 1.2.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/js/LogRocketInstrumentationClient.d.ts +133 -0
  3. package/dist/js/LogRocketInstrumentationClient.js +129 -0
  4. package/dist/js/LogRocketInstrumentationClient.js.map +1 -0
  5. package/dist/{LogRocketLogger.js → js/LogRocketLogger.js} +1 -1
  6. package/dist/js/LogRocketLogger.js.map +1 -0
  7. package/dist/{applyTransformers.js → js/applyTransformers.js} +1 -1
  8. package/dist/js/applyTransformers.js.map +1 -0
  9. package/dist/{assertions.js → js/assertions.js} +1 -1
  10. package/dist/js/assertions.js.map +1 -0
  11. package/dist/{createRequestSanitizer.js → js/createRequestSanitizer.js} +1 -1
  12. package/dist/js/createRequestSanitizer.js.map +1 -0
  13. package/dist/{createResponseSanitizer.js → js/createResponseSanitizer.js} +1 -1
  14. package/dist/js/createResponseSanitizer.js.map +1 -0
  15. package/dist/{createUrlSanitizer.js → js/createUrlSanitizer.js} +1 -1
  16. package/dist/js/createUrlSanitizer.js.map +1 -0
  17. package/dist/js/index.d.ts +6 -0
  18. package/dist/js/index.js +22 -0
  19. package/dist/js/index.js.map +1 -0
  20. package/dist/js/logRocketTypes.js +7 -0
  21. package/dist/js/logRocketTypes.js.map +1 -0
  22. package/dist/{registerLogRocketInstrumentation.d.ts → js/registerLogRocketInstrumentation.d.ts} +27 -7
  23. package/dist/{registerLogRocketInstrumentation.js → js/registerLogRocketInstrumentation.js} +64 -43
  24. package/dist/js/registerLogRocketInstrumentation.js.map +1 -0
  25. package/dist/react/LogRocketInstrumentationContext.d.ts +17 -0
  26. package/dist/react/LogRocketInstrumentationContext.js +34 -0
  27. package/dist/react/LogRocketInstrumentationContext.js.map +1 -0
  28. package/dist/react/index.d.ts +2 -0
  29. package/dist/react/index.js +12 -0
  30. package/dist/react/index.js.map +1 -0
  31. package/package.json +29 -13
  32. package/src/js/LogRocketInstrumentationClient.ts +187 -0
  33. package/src/js/index.ts +8 -0
  34. package/src/{registerLogRocketInstrumentation.ts → js/registerLogRocketInstrumentation.ts} +104 -53
  35. package/src/react/LogRocketInstrumentationContext.tsx +41 -0
  36. package/src/react/index.ts +3 -0
  37. package/dist/HasExecutedGuard.d.ts +0 -6
  38. package/dist/HasExecutedGuard.js +0 -21
  39. package/dist/HasExecutedGuard.js.map +0 -1
  40. package/dist/LogRocketLogger.js.map +0 -1
  41. package/dist/applyTransformers.js.map +0 -1
  42. package/dist/assertions.js.map +0 -1
  43. package/dist/createDefaultUserTraits.d.ts +0 -116
  44. package/dist/createDefaultUserTraits.js +0 -112
  45. package/dist/createDefaultUserTraits.js.map +0 -1
  46. package/dist/createRequestSanitizer.js.map +0 -1
  47. package/dist/createResponseSanitizer.js.map +0 -1
  48. package/dist/createUrlSanitizer.js.map +0 -1
  49. package/dist/index.d.ts +0 -5
  50. package/dist/index.js +0 -18
  51. package/dist/index.js.map +0 -1
  52. package/dist/logRocketTypes.js +0 -7
  53. package/dist/logRocketTypes.js.map +0 -1
  54. package/dist/registerLogRocketInstrumentation.js.map +0 -1
  55. package/src/HasExecutedGuard.ts +0 -19
  56. package/src/createDefaultUserTraits.ts +0 -160
  57. package/src/index.ts +0 -6
  58. /package/dist/{LogRocketLogger.d.ts → js/LogRocketLogger.d.ts} +0 -0
  59. /package/dist/{applyTransformers.d.ts → js/applyTransformers.d.ts} +0 -0
  60. /package/dist/{assertions.d.ts → js/assertions.d.ts} +0 -0
  61. /package/dist/{createRequestSanitizer.d.ts → js/createRequestSanitizer.d.ts} +0 -0
  62. /package/dist/{createResponseSanitizer.d.ts → js/createResponseSanitizer.d.ts} +0 -0
  63. /package/dist/{createUrlSanitizer.d.ts → js/createUrlSanitizer.d.ts} +0 -0
  64. /package/dist/{logRocketTypes.d.ts → js/logRocketTypes.d.ts} +0 -0
  65. /package/src/{LogRocketLogger.ts → js/LogRocketLogger.ts} +0 -0
  66. /package/src/{applyTransformers.ts → js/applyTransformers.ts} +0 -0
  67. /package/src/{assertions.ts → js/assertions.ts} +0 -0
  68. /package/src/{createRequestSanitizer.ts → js/createRequestSanitizer.ts} +0 -0
  69. /package/src/{createResponseSanitizer.ts → js/createResponseSanitizer.ts} +0 -0
  70. /package/src/{createUrlSanitizer.ts → js/createUrlSanitizer.ts} +0 -0
  71. /package/src/{logRocketTypes.ts → js/logRocketTypes.ts} +0 -0
@@ -1,18 +1,14 @@
1
+ import { HasExecutedGuard, type TelemetryContext } from "@workleap-telemetry/core";
1
2
  import { createCompositeLogger, type RootLogger } from "@workleap/logging";
2
- import { createBootstrappingStore, createTelemetryContext } from "@workleap/telemetry";
3
3
  import LogRocket from "logrocket";
4
4
  import LogrocketFuzzySanitizer from "logrocket-fuzzy-search-sanitizer";
5
5
  import { applyTransformers, type LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
6
- import { DeviceIdTrait, TelemetryIdTrait } from "./createDefaultUserTraits.ts";
7
6
  import { createRequestSanitizer } from "./createRequestSanitizer.ts";
8
7
  import { createResponseSanitizer } from "./createResponseSanitizer.ts";
9
8
  import { createUrlSanitizer } from "./createUrlSanitizer.ts";
10
- import { HasExecutedGuard } from "./HasExecutedGuard.ts";
9
+ import { DeviceIdTrait, LogRocketInstrumentationClient, TelemetryIdTrait } from "./LogRocketInstrumentationClient.ts";
11
10
  import type { LogRocketSdkOptions } from "./logRocketTypes.ts";
12
11
 
13
- export const IsRegisteredVariableName = "__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__";
14
- export const RegisterGetSessionUrlFunctionName = "__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__";
15
-
16
12
  const DefaultPrivateFieldNames = [
17
13
  "email",
18
14
  "personalEmail",
@@ -33,34 +29,47 @@ const DefaultPrivateQueryParameterNames = [
33
29
  "password"
34
30
  ];
35
31
 
32
+ ///////////////////////////
33
+
36
34
  /**
37
35
  * @see {@link https://workleap.github.io/wl-telemetry}
38
36
  */
39
37
  export interface RegisterLogRocketInstrumentationOptions {
40
38
  /**
41
39
  * 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.
40
+ * @see {@link https://workleap.github.io/wl-telemetry}
42
41
  */
43
42
  rootHostname?: LogRocketSdkOptions["rootHostname"];
44
43
  /**
45
44
  * Names of additional fields to exclude from session replays. These fields will be removed from network requests, responses using a fuzzy-matching algorithm.
45
+ * @see {@link https://workleap.github.io/wl-telemetry}
46
46
  */
47
47
  privateFieldNames?: string[];
48
48
  /**
49
49
  * Names of additional fields to exclude from session replays. These fields will be removed from query parameters using a fuzzy-matching algorithm.
50
+ * @see {@link https://workleap.github.io/wl-telemetry}
50
51
  */
51
52
  privateQueryParameterNames?: string[];
53
+ /**
54
+ * Context including telemetry correlation ids.
55
+ * @see {@link https://workleap.github.io/wl-telemetry}
56
+ */
57
+ telemetryContext?: TelemetryContext;
58
+ /**
59
+ * Hooks to transform the resulting LogRocket SDK options.
60
+ * @see {@link https://workleap.github.io/wl-telemetry}
61
+ */
62
+ transformers?: LogRocketSdkOptionsTransformer[];
52
63
  /**
53
64
  * Indicates whether or not debug information should be logged to the console.
65
+ * @see {@link https://workleap.github.io/wl-telemetry}
54
66
  */
55
67
  verbose?: boolean;
56
68
  /**
57
69
  * The logger instances that will output messages.
70
+ * @see {@link https://workleap.github.io/wl-telemetry}
58
71
  */
59
72
  loggers?: RootLogger[];
60
- /**
61
- * Hooks to transform the resulting LogRocket SDK options.
62
- */
63
- transformers?: LogRocketSdkOptionsTransformer[];
64
73
  }
65
74
 
66
75
  // The function return type is mandatory, otherwise we got an error TS4058.
@@ -110,47 +119,14 @@ export function getLogRocketSdkOptions(userOptions: RegisterLogRocketInstrumenta
110
119
  });
111
120
  }
112
121
 
113
- const registrationGuard = new HasExecutedGuard();
114
-
115
- // This function should only be used by tests.
116
- export function __resetRegistrationGuard() {
117
- registrationGuard.reset();
118
- }
119
-
120
- /**
121
- * @see {@link https://workleap.github.io/wl-telemetry}
122
- */
123
- export function registerLogRocketInstrumentation(appId: string, options: RegisterLogRocketInstrumentationOptions = {}) {
124
- const {
125
- verbose = false,
126
- loggers = []
127
- } = options;
128
-
129
- const logger = createCompositeLogger(verbose, loggers);
122
+ ///////////////////////////
130
123
 
131
- registrationGuard.throw("[logrocket] The LogRocket instrumentation has already been registered. Did you call the \"registerLogRocketInstrumentation\" function twice?");
132
-
133
- const sdkOptions = getLogRocketSdkOptions(options, logger);
134
-
135
- // Session starts anonymously when LogRocket.init() is called.
136
- LogRocket.init(appId, sdkOptions);
137
-
138
- const telemetryContext = createTelemetryContext(logger);
139
-
140
- // LogRocket maintains the same session even if the user starts as anonymous and later becomes identified via LogRocket.identify().
141
- // If LogRocket.identify is called multiple times during a recording, you can search for any of the identified users in the session.
142
- LogRocket.identify(telemetryContext.deviceId, {
143
- [DeviceIdTrait]: telemetryContext.deviceId,
144
- [TelemetryIdTrait]: telemetryContext.telemetryId
145
- });
146
-
147
- LogRocket.getSessionURL(url => {
148
- logger
149
- .withText("[logrocket] Session replay URL is now available:")
150
- .withText(url)
151
- .debug();
152
- });
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__";
153
127
 
128
+ // DEPRECATED: Grace period ends on January 1th 2026.
129
+ function registerDeprecatedGlobalVariables() {
154
130
  // Indicates to the host applications that logrocket has been initialized.
155
131
  // It's useful in cases where an "add-on", like the platform widgets needs
156
132
  // to know whether or not the host application is using LogRocket.
@@ -168,10 +144,85 @@ export function registerLogRocketInstrumentation(appId: string, options: Registe
168
144
  globalThis[RegisterGetSessionUrlFunctionName] = listener => {
169
145
  LogRocket.getSessionURL(listener);
170
146
  };
147
+ }
148
+
149
+ ///////////////////////////
150
+
151
+ let registrationGuardInstance: HasExecutedGuard | undefined;
171
152
 
172
- const bootstrappingStore = createBootstrappingStore(logger);
173
- // Let the other telemetry libraries know that LogRocket instrumentation is ready.
174
- bootstrappingStore.dispatch({ type: "logrocket-ready" });
153
+ // It's important to use a lazy singleton instead of a singleton to avoid
154
+ // any future probleme related to HMR, tree-shaking, SSR, etc..
155
+ function getRegistrationGuard() {
156
+ if (!registrationGuardInstance) {
157
+ registrationGuardInstance = new HasExecutedGuard();
158
+ }
159
+
160
+ return registrationGuardInstance;
161
+ }
162
+
163
+ // This function should only be used by tests.
164
+ export function __resetRegistrationGuard() {
165
+ if (registrationGuardInstance) {
166
+ registrationGuardInstance.reset();
167
+ }
168
+ }
169
+
170
+ ///////////////////////////
171
+
172
+ export class LogRocketInstrumentationRegistrator {
173
+ register(
174
+ appId: string,
175
+ options: RegisterLogRocketInstrumentationOptions = {}
176
+ ) {
177
+ const {
178
+ telemetryContext,
179
+ verbose = false,
180
+ loggers = []
181
+ } = options;
182
+
183
+ const logger = createCompositeLogger(verbose, loggers);
184
+ const sdkOptions = getLogRocketSdkOptions(options, logger);
185
+
186
+ // Session starts anonymously when LogRocket.init() is called.
187
+ LogRocket.init(appId, sdkOptions);
188
+
189
+ // Identify the user with the correlation ids.
190
+ if (telemetryContext) {
191
+ // LogRocket maintains the same session even if the user starts as anonymous and later becomes identified via LogRocket.identify().
192
+ // If LogRocket.identify is called multiple times during a recording, you can search for any of the identified users in the session.
193
+ LogRocket.identify(telemetryContext.deviceId, {
194
+ [DeviceIdTrait]: telemetryContext.deviceId,
195
+ [TelemetryIdTrait]: telemetryContext.telemetryId
196
+ });
197
+ }
198
+
199
+ LogRocket.getSessionURL(url => {
200
+ logger
201
+ .withText("[logrocket] Session replay URL is now available:")
202
+ .withText(url)
203
+ .debug();
204
+ });
205
+
206
+ registerDeprecatedGlobalVariables();
207
+
208
+ logger.information("[logrocket] LogRocket instrumentation is registered.");
209
+
210
+ return new LogRocketInstrumentationClient(telemetryContext);
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Register the LogRocket instrumentation.
216
+ * @param appId LogRocket application id.
217
+ * @param options LogRocket instrumentation options.
218
+ * @returns {LogRocketInstrumentationClient} A LogRocket instrumentation client instance.
219
+ * @see {@link https://workleap.github.io/wl-telemetry}
220
+ */
221
+ export function registerLogRocketInstrumentation(
222
+ appId: string,
223
+ options?: RegisterLogRocketInstrumentationOptions
224
+ ) {
225
+ getRegistrationGuard().throw("[logrocket] The LogRocket instrumentation has already been registered. Did you call the \"registerLogRocketInstrumentation\" function twice?");
175
226
 
176
- logger.information("[logrocket] LogRocket instrumentation is registered.");
227
+ return new LogRocketInstrumentationRegistrator().register(appId, options);
177
228
  }
@@ -0,0 +1,41 @@
1
+ import { createContext, type PropsWithChildren, useContext } from "react";
2
+ import type { LogRocketInstrumentationClient } from "../js/LogRocketInstrumentationClient.ts";
3
+
4
+ const LogRocketInstrumentationContext = createContext<LogRocketInstrumentationClient | undefined>(undefined);
5
+
6
+ /**
7
+ * @see {@link https://workleap.github.io/wl-telemetry}
8
+ */
9
+ export interface LogRocketInstrumentationProviderProps extends PropsWithChildren {
10
+ client: LogRocketInstrumentationClient;
11
+ }
12
+
13
+ /**
14
+ * @see {@link https://workleap.github.io/wl-telemetry}
15
+ */
16
+ export function LogRocketInstrumentationProvider(props: LogRocketInstrumentationProviderProps) {
17
+ const {
18
+ client,
19
+ children
20
+ } = props;
21
+
22
+ return (
23
+ <LogRocketInstrumentationContext.Provider value={client}>
24
+ {children}
25
+ </LogRocketInstrumentationContext.Provider>
26
+ );
27
+ }
28
+
29
+ /**
30
+ * Retrieve the LogRocket instrumentation client.
31
+ * @see {@link https://workleap.github.io/wl-telemetry}
32
+ */
33
+ export function useLogRocketInstrumentationClient() {
34
+ const client = useContext(LogRocketInstrumentationContext);
35
+
36
+ if (!client) {
37
+ throw new Error("[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.");
38
+ }
39
+
40
+ return client;
41
+ }
@@ -0,0 +1,3 @@
1
+ export * from "../js/index.ts";
2
+ export { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient } from "./LogRocketInstrumentationContext.tsx";
3
+
@@ -1,6 +0,0 @@
1
- export declare class HasExecutedGuard {
2
- #private;
3
- throw(message: string): void;
4
- get hasExecuted(): boolean;
5
- reset(): void;
6
- }
@@ -1,21 +0,0 @@
1
-
2
- ;// CONCATENATED MODULE: ./src/HasExecutedGuard.ts
3
- class HasExecutedGuard {
4
- #hasExecuted = false;
5
- throw(message) {
6
- if (this.#hasExecuted) {
7
- throw new Error(message);
8
- }
9
- this.#hasExecuted = true;
10
- }
11
- get hasExecuted() {
12
- return this.#hasExecuted;
13
- }
14
- reset() {
15
- this.#hasExecuted = false;
16
- }
17
- }
18
-
19
- export { HasExecutedGuard };
20
-
21
- //# sourceMappingURL=HasExecutedGuard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HasExecutedGuard.js","sources":["webpack://@workleap/logrocket/./src/HasExecutedGuard.ts"],"sourcesContent":["export class HasExecutedGuard {\n #hasExecuted: boolean = false;\n\n throw(message: string) {\n if (this.#hasExecuted) {\n throw new Error(message);\n }\n\n this.#hasExecuted = true;\n }\n\n get hasExecuted() {\n return this.#hasExecuted;\n }\n\n reset() {\n this.#hasExecuted = false;\n }\n}\n"],"names":["HasExecutedGuard","message","Error"],"mappings":";;AAAO,MAAMA;IACT,YAAY,GAAY,MAAM;IAE9B,MAAMC,OAAe,EAAE;QACnB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,MAAM,IAAIC,MAAMD;QACpB;QAEA,IAAI,CAAC,YAAY,GAAG;IACxB;IAEA,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,YAAY;IAC5B;IAEA,QAAQ;QACJ,IAAI,CAAC,YAAY,GAAG;IACxB;AACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogRocketLogger.js","sources":["webpack://@workleap/logrocket/./src/LogRocketLogger.ts"],"sourcesContent":["import { type Logger, type LoggerOptions, type LoggerScope, type LoggerScopeEndOptions, LogLevel, type LogOptions } from \"@workleap/logging\";\nimport LogRocket from \"logrocket\";\n\ninterface Segment {\n type: \"text\" | \"object\" | \"error\" | \"line-change\";\n value: unknown;\n options?: LogOptions;\n}\n\nfunction appendText(currentText: string, newText: string, options: { leadingSpace?: boolean } = {}) {\n const {\n leadingSpace = true\n } = options;\n\n if (currentText.length > 0) {\n return `${currentText}${leadingSpace ? \" \" : \"\"}${newText}`;\n }\n\n return newText;\n}\n\n/**\n * Formats an array of Segment objects into a list of log arguments.\n *\n * - Consecutive \"text\" segments are concatenated into a single string, separated by spaces (unless `leadingSpace` is false).\n * - Non-\"text\" segments (\"object\", \"error\", \"line-change\") are added directly to the output array.\n * - When a non-\"text\" segment is encountered, any buffered text is flushed to the output before adding the segment.\n * - At the end, any remaining buffered text is flushed.\n */\nfunction formatSegments(segments: Segment[]) {\n const logs: unknown[] = [];\n\n let textBuffer = \"\";\n\n const flushText = () => {\n if (textBuffer.length > 0) {\n logs.push(textBuffer);\n\n textBuffer = \"\";\n }\n };\n\n segments.forEach(x => {\n if (x.type === \"text\") {\n textBuffer = appendText(textBuffer, x.value as string, {\n leadingSpace: x.options?.leadingSpace\n });\n } else {\n flushText();\n\n logs.push(x.value);\n }\n });\n\n // If the last segment is text, the text buffer hasn't been flushed.\n flushText();\n\n return logs;\n}\n\ntype LogFunction = (...rest: unknown[]) => void;\ntype PendingLog = () => void;\n\n/**\n * An scope implementation for the LogRocket logger.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport class LogRocketLoggerScope implements LoggerScope {\n readonly #logLevel: LogLevel;\n readonly #label: string;\n\n #segments: Segment[] = [];\n #pendingLogs: PendingLog[] = [];\n #hasEnded: boolean = false;\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n constructor(label: string, logLevel: LogLevel) {\n this.#logLevel = logLevel;\n this.#label = label;\n }\n\n #resetSegments() {\n this.#segments = [];\n }\n\n #log(fct: LogFunction, threshold: LogLevel) {\n if (this.#segments.length > 0) {\n if (this.#logLevel <= threshold) {\n // Required closure to preserved the current log items for when they will be formatted when the scope is ended.\n const segments = this.#segments;\n\n this.#pendingLogs.push(() => {\n const formattedSegments = formatSegments(segments);\n // Since LogRocket session replay UI doesn't have a concept similar to console.group,\n // the logs of a group are indented by 4 spaces under the group label.\n formattedSegments.unshift(\" \");\n\n fct(...formattedSegments);\n });\n }\n\n this.#resetSegments();\n }\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withText(text?: string, options?: Omit<LogOptions, \"style\">) {\n if (text) {\n this.#segments.push({\n type: \"text\",\n value: text,\n options\n });\n }\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withError(error?: Error) {\n if (error) {\n this.#segments.push({\n type: \"error\",\n value: error\n });\n }\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withObject(obj?: unknown) {\n if (obj) {\n this.#segments.push({\n type: \"object\",\n value: obj\n });\n }\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withLineChange() {\n this.#segments.push({\n type: \"line-change\",\n value: \"\\r\\n\"\n });\n\n return this;\n }\n\n /**\n * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n debug(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.log, LogLevel.debug);\n }\n\n /**\n * Write an information log. The log will be processed only if the logger LogLevel is >= information.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n information(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.log, LogLevel.information);\n }\n\n /**\n * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n warning(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.warn, LogLevel.warning);\n }\n\n /**\n * Write an error log. The log will be processed only if the logger LogLevel is >= error.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n error(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.error, LogLevel.error);\n }\n\n /**\n * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n critical(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.error, LogLevel.critical);\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n end(options: LoggerScopeEndOptions = {}) {\n const {\n dismiss = false\n } = options;\n\n if (!this.#hasEnded) {\n this.#hasEnded = true;\n\n if (!dismiss) {\n if (this.#pendingLogs.length > 0) {\n LogRocket.log(this.#label);\n\n this.#pendingLogs.forEach(x => {\n x();\n });\n\n this.#pendingLogs = [];\n }\n }\n }\n }\n}\n\n/**\n * A logger implementation for LogRocket.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport class LogRocketLogger implements Logger {\n readonly #logLevel: LogLevel;\n #segments: Segment[] = [];\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n constructor(options: LoggerOptions = {}) {\n const {\n logLevel = LogLevel.debug\n } = options;\n\n this.#logLevel = logLevel;\n }\n\n #resetSegments() {\n this.#segments = [];\n }\n\n #log(fct: LogFunction, threshold: LogLevel) {\n if (this.#segments.length > 0) {\n if (this.#logLevel <= threshold) {\n const formattedSegments = formatSegments(this.#segments);\n\n fct(...formattedSegments);\n }\n\n this.#resetSegments();\n }\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n getName() {\n return LogRocketLogger.name;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withText(text?: string, options?: Omit<LogOptions, \"style\">) {\n if (text) {\n this.#segments.push({\n type: \"text\",\n value: text,\n options\n });\n }\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withError(error?: Error) {\n if (error) {\n this.#segments.push({\n type: \"error\",\n value: error\n });\n }\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withObject(obj?: unknown) {\n if (obj) {\n this.#segments.push({\n type: \"object\",\n value: obj\n });\n }\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withLineChange() {\n this.#segments.push({\n type: \"line-change\",\n value: \"\\r\\n\"\n });\n\n return this;\n }\n\n /**\n * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n debug(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.log, LogLevel.debug);\n }\n\n /**\n * Write an information log. The log will be processed only if the logger LogLevel is >= information.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n information(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.log, LogLevel.information);\n }\n\n /**\n * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n warning(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.warn, LogLevel.warning);\n }\n\n /**\n * Write an error log. The log will be processed only if the logger LogLevel is >= error.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n error(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.error, LogLevel.error);\n }\n\n /**\n * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n critical(log?: string) {\n if (log) {\n this.#segments.push({\n type: \"text\",\n value: log\n });\n }\n\n this.#log(LogRocket.error, LogLevel.critical);\n }\n\n /**\n * Start a new logging scope. The scope will inherit the LogLevel of the root logger.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n startScope(label: string) {\n return new LogRocketLoggerScope(label, this.#logLevel);\n }\n}\n"],"names":["LogLevel","LogRocket","appendText","currentText","newText","options","leadingSpace","formatSegments","segments","logs","textBuffer","flushText","x","LogRocketLoggerScope","label","logLevel","fct","threshold","formattedSegments","text","error","obj","log","dismiss","LogRocketLogger"],"mappings":";;;;;;;;AAA6I;AAC3G;AAQlC,SAASE,WAAWC,WAAmB,EAAEC,OAAe,EAAEC,UAAsC,CAAC,CAAC;IAC9F,MAAM,EACFC,eAAe,IAAI,EACtB,GAAGD;IAEJ,IAAIF,YAAY,MAAM,GAAG,GAAG;QACxB,OAAO,GAAGA,cAAcG,eAAe,MAAM,KAAKF,SAAS;IAC/D;IAEA,OAAOA;AACX;AAEA;;;;;;;CAOC,GACD,SAASG,eAAeC,QAAmB;IACvC,MAAMC,OAAkB,EAAE;IAE1B,IAAIC,aAAa;IAEjB,MAAMC,YAAY;QACd,IAAID,WAAW,MAAM,GAAG,GAAG;YACvBD,KAAK,IAAI,CAACC;YAEVA,aAAa;QACjB;IACJ;IAEAF,SAAS,OAAO,CAACI,CAAAA;QACb,IAAIA,EAAE,IAAI,KAAK,QAAQ;YACnBF,aAAaR,WAAWQ,YAAYE,EAAE,KAAK,EAAY;gBACnD,cAAcA,EAAE,OAAO,EAAE;YAC7B;QACJ,OAAO;YACHD;YAEAF,KAAK,IAAI,CAACG,EAAE,KAAK;QACrB;IACJ;IAEA,oEAAoE;IACpED;IAEA,OAAOF;AACX;AAKA;;;CAGC,GACM,MAAMI;IACA,SAAS,CAAW;IACpB,MAAM,CAAS;IAExB,SAAS,GAAc,EAAE,CAAC;IAC1B,YAAY,GAAiB,EAAE,CAAC;IAChC,SAAS,GAAY,MAAM;IAE3B;;KAEC,GACD,YAAYC,KAAa,EAAEC,QAAkB,CAAE;QAC3C,IAAI,CAAC,SAAS,GAAGA;QACjB,IAAI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AY,EAAE;QAChB,IAAIA,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAM;gBACN,OAAOA;YACX;QACJ;QAEA,IAAI,CAAC,IAAI,CAACrB,aAAa,EAAED,cAAc;IAC3C;IAEA;;;KAGC,GACD,YAAYsB,GAAY,EAAE;QACtB,IAAIA,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAM;gBACN,OAAOA;YACX;QACJ;QAEA,IAAI,CAAC,IAAI,CAACrB,aAAa,EAAED,oBAAoB;IACjD;IAEA;;;KAGC,GACD,QAAQsB,GAAY,EAAE;QAClB,IAAIA,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAM;gBACN,OAAOA;YACX;QACJ;QAEA,IAAI,CAAC,IAAI,CAACrB,cAAc,EAAED,gBAAgB;IAC9C;IAEA;;;KAGC,GACD,MAAMsB,GAAY,EAAE;QAChB,IAAIA,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAM;gBACN,OAAOA;YACX;QACJ;QAEA,IAAI,CAAC,IAAI,CAACrB,eAAe,EAAED,cAAc;IAC7C;IAEA;;;KAGC,GACD,SAASsB,GAAY,EAAE;QACnB,IAAIA,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAM;gBACN,OAAOA;YACX;QACJ;QAEA,IAAI,CAAC,IAAI,CAACrB,eAAe,EAAED,iBAAiB;IAChD;IAEA;;;KAGC,GACD,WAAWc,KAAa,EAAE;QACtB,OAAO,IAAID,qBAAqBC,OAAO,IAAI,CAAC,SAAS;IACzD;AACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"applyTransformers.js","sources":["webpack://@workleap/logrocket/./src/applyTransformers.ts"],"sourcesContent":["import type { RootLogger } from \"@workleap/logging\";\nimport type { LogRocketSdkOptions } from \"./logRocketTypes.ts\";\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketSdkOptionsTransformerContext {\n verbose: boolean;\n logger: RootLogger;\n}\n\n/**\n * Hook to transform the resulting LogRocket SDK options.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport type LogRocketSdkOptionsTransformer = (options: LogRocketSdkOptions, context: LogRocketSdkOptionsTransformerContext) => LogRocketSdkOptions;\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function applyTransformers(options: LogRocketSdkOptions, transformers: LogRocketSdkOptionsTransformer[], context: LogRocketSdkOptionsTransformerContext): LogRocketSdkOptions {\n return transformers.reduce((acc, transformer) => transformer(acc, context), options);\n}\n\n\n"],"names":["applyTransformers","options","transformers","context","acc","transformer"],"mappings":";;AAiBA,2EAA2E;AACpE,SAASA,kBAAkBC,OAA4B,EAAEC,YAA8C,EAAEC,OAA8C;IAC1J,OAAOD,aAAa,MAAM,CAAC,CAACE,KAAKC,cAAgBA,YAAYD,KAAKD,UAAUF;AAChF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"assertions.js","sources":["webpack://@workleap/logrocket/./src/assertions.ts"],"sourcesContent":["export function isDefined(value: unknown) {\n return typeof value !== \"undefined\" && value !== undefined;\n}\n"],"names":["isDefined","value","undefined"],"mappings":";;AAAO,SAASA,UAAUC,KAAc;IACpC,OAAO,OAAOA,UAAU,eAAeA,UAAUC;AACrD"}
@@ -1,116 +0,0 @@
1
- /**
2
- * @see {@link https://workleap.github.io/wl-telemetry}
3
- */
4
- export interface LogRocketIdentification {
5
- userId: string;
6
- organizationId: string;
7
- organizationName: string;
8
- isMigratedToWorkleap: boolean;
9
- isAdmin: boolean;
10
- isOrganizationCreator?: boolean;
11
- isExecutive?: {
12
- wov?: boolean;
13
- lms?: boolean;
14
- onb?: boolean;
15
- sks?: boolean;
16
- wpm?: boolean;
17
- pbd?: boolean;
18
- cmp?: boolean;
19
- };
20
- isCollaborator?: {
21
- wov?: boolean;
22
- lms?: boolean;
23
- onb?: boolean;
24
- sks?: boolean;
25
- wpm?: boolean;
26
- pbd?: boolean;
27
- cmp?: boolean;
28
- };
29
- isReportingManager?: boolean;
30
- isTeamManager?: boolean;
31
- planCode?: {
32
- wov?: string;
33
- lms?: string;
34
- onb?: string;
35
- sks?: string;
36
- wpm?: string;
37
- pbd?: string;
38
- cmp?: string;
39
- };
40
- }
41
- /**
42
- * @see {@link https://workleap.github.io/wl-telemetry}
43
- */
44
- export interface LogRocketUserTraits extends Record<string, unknown> {
45
- "User Id": string;
46
- "Organization Id": string;
47
- "Organization Name": string;
48
- "Is Migrated To Workleap": boolean;
49
- "Is Admin": boolean;
50
- "Device Id": string;
51
- "Telemetry Id": string;
52
- "Is Organization Creator"?: boolean;
53
- "Is Executive"?: boolean;
54
- "Is Executive - Officevibe"?: boolean;
55
- "Is Executive - LMS"?: boolean;
56
- "Is Executive - Onboarding"?: boolean;
57
- "Is Executive - Skills"?: boolean;
58
- "Is Executive - Performance"?: boolean;
59
- "Is Executive - Pingboard"?: boolean;
60
- "Is Collaborator"?: boolean;
61
- "Is Collaborator - Officevibe"?: boolean;
62
- "Is Collaborator - LMS"?: boolean;
63
- "Is Collaborator - Onboarding"?: boolean;
64
- "Is Collaborator - Skills"?: boolean;
65
- "Is Collaborator - Performance"?: boolean;
66
- "Is Collaborator - Pingboard"?: boolean;
67
- "Is Reporting Manager"?: boolean;
68
- "Is Team Manager"?: boolean;
69
- "Plan Code - Officevibe"?: string;
70
- "Plan Code - LMS"?: string;
71
- "Plan Code - Onboarding"?: string;
72
- "Plan Code - Skills"?: string;
73
- "Plan Code - Performance"?: string;
74
- "Plan Code - Pingboard"?: string;
75
- }
76
- export declare const DeviceIdTrait = "Device Id";
77
- export declare const TelemetryIdTrait = "Telemetry Id";
78
- /**
79
- * Create the default user traits for a WLP user.
80
- * @see {@link https://workleap.github.io/wl-telemetry}
81
- */
82
- export declare function createDefaultUserTraits(identification: LogRocketIdentification): {
83
- "Plan Code - Compensation"?: string | undefined;
84
- "Plan Code - Pingboard"?: string | undefined;
85
- "Plan Code - Performance"?: string | undefined;
86
- "Plan Code - Skills"?: string | undefined;
87
- "Plan Code - Onboarding"?: string | undefined;
88
- "Plan Code - LMS"?: string | undefined;
89
- "Plan Code - Officevibe"?: string | undefined;
90
- "Is Team Manager"?: boolean | undefined;
91
- "Is Reporting Manager"?: boolean | undefined;
92
- "Is Collaborator - Compensation"?: boolean | undefined;
93
- "Is Collaborator - Pingboard"?: boolean | undefined;
94
- "Is Collaborator - Performance"?: boolean | undefined;
95
- "Is Collaborator - Skills"?: boolean | undefined;
96
- "Is Collaborator - Onboarding"?: boolean | undefined;
97
- "Is Collaborator - LMS"?: boolean | undefined;
98
- "Is Collaborator - Officevibe"?: boolean | undefined;
99
- "Is Collaborator"?: true | undefined;
100
- "Is Executive - Compensation"?: boolean | undefined;
101
- "Is Executive - Pingboard"?: boolean | undefined;
102
- "Is Executive - Performance"?: boolean | undefined;
103
- "Is Executive - Skills"?: boolean | undefined;
104
- "Is Executive - Onboarding"?: boolean | undefined;
105
- "Is Executive - LMS"?: boolean | undefined;
106
- "Is Executive - Officevibe"?: boolean | undefined;
107
- "Is Executive"?: true | undefined;
108
- "Is Organization Creator"?: boolean | undefined;
109
- "User Id": string;
110
- "Organization Id": string;
111
- "Organization Name": string;
112
- "Is Migrated To Workleap": boolean;
113
- "Is Admin": boolean;
114
- "Device Id": string;
115
- "Telemetry Id": string;
116
- };
@@ -1,112 +0,0 @@
1
- import { getTelemetryContext } from "@workleap/telemetry";
2
- import { isDefined } from "./assertions.js";
3
-
4
- ;// CONCATENATED MODULE: external "@workleap/telemetry"
5
-
6
- ;// CONCATENATED MODULE: external "./assertions.js"
7
-
8
- ;// CONCATENATED MODULE: ./src/createDefaultUserTraits.ts
9
-
10
-
11
- const DeviceIdTrait = "Device Id";
12
- const TelemetryIdTrait = "Telemetry Id";
13
- /**
14
- * Create the default user traits for a WLP user.
15
- * @see {@link https://workleap.github.io/wl-telemetry}
16
- */ function createDefaultUserTraits(identification) {
17
- const { userId, organizationId, organizationName, isMigratedToWorkleap, isOrganizationCreator, isAdmin, isExecutive, isCollaborator, isReportingManager, isTeamManager, planCode } = identification;
18
- const isExecutiveInAnyProduct = Boolean(isExecutive?.wov || isExecutive?.lms || isExecutive?.onb || isExecutive?.sks || isExecutive?.wpm || isExecutive?.pbd || isExecutive?.cmp);
19
- const isCollaboratorInAnyProduct = Boolean(isCollaborator?.wov || isCollaborator?.lms || isCollaborator?.onb || isCollaborator?.sks || isCollaborator?.wpm || isCollaborator?.pbd || isCollaborator?.cmp);
20
- const telemetryContext = getTelemetryContext();
21
- return {
22
- "User Id": userId,
23
- "Organization Id": organizationId,
24
- "Organization Name": organizationName,
25
- "Is Migrated To Workleap": isMigratedToWorkleap,
26
- "Is Admin": isAdmin,
27
- [DeviceIdTrait]: telemetryContext ? telemetryContext.deviceId : "N/A",
28
- [TelemetryIdTrait]: telemetryContext ? telemetryContext.telemetryId : "N/A",
29
- ...isDefined(isOrganizationCreator) && {
30
- "Is Organization Creator": isOrganizationCreator
31
- },
32
- ...isExecutiveInAnyProduct && {
33
- "Is Executive": true
34
- },
35
- ...isDefined(isExecutive?.wov) && {
36
- "Is Executive - Officevibe": isExecutive.wov
37
- },
38
- ...isDefined(isExecutive?.lms) && {
39
- "Is Executive - LMS": isExecutive.lms
40
- },
41
- ...isDefined(isExecutive?.onb) && {
42
- "Is Executive - Onboarding": isExecutive.onb
43
- },
44
- ...isDefined(isExecutive?.sks) && {
45
- "Is Executive - Skills": isExecutive.sks
46
- },
47
- ...isDefined(isExecutive?.wpm) && {
48
- "Is Executive - Performance": isExecutive.wpm
49
- },
50
- ...isDefined(isExecutive?.pbd) && {
51
- "Is Executive - Pingboard": isExecutive.pbd
52
- },
53
- ...isDefined(isExecutive?.cmp) && {
54
- "Is Executive - Compensation": isExecutive.cmp
55
- },
56
- ...isCollaboratorInAnyProduct && {
57
- "Is Collaborator": isCollaboratorInAnyProduct
58
- },
59
- ...isDefined(isCollaborator?.wov) && {
60
- "Is Collaborator - Officevibe": isCollaborator.wov
61
- },
62
- ...isDefined(isCollaborator?.lms) && {
63
- "Is Collaborator - LMS": isCollaborator.lms
64
- },
65
- ...isDefined(isCollaborator?.onb) && {
66
- "Is Collaborator - Onboarding": isCollaborator.onb
67
- },
68
- ...isDefined(isCollaborator?.sks) && {
69
- "Is Collaborator - Skills": isCollaborator.sks
70
- },
71
- ...isDefined(isCollaborator?.wpm) && {
72
- "Is Collaborator - Performance": isCollaborator.wpm
73
- },
74
- ...isDefined(isCollaborator?.pbd) && {
75
- "Is Collaborator - Pingboard": isCollaborator.pbd
76
- },
77
- ...isDefined(isCollaborator?.cmp) && {
78
- "Is Collaborator - Compensation": isCollaborator.cmp
79
- },
80
- ...isDefined(isReportingManager) && {
81
- "Is Reporting Manager": isReportingManager
82
- },
83
- ...isDefined(isTeamManager) && {
84
- "Is Team Manager": isTeamManager
85
- },
86
- ...isDefined(planCode?.wov) && {
87
- "Plan Code - Officevibe": planCode.wov
88
- },
89
- ...isDefined(planCode?.lms) && {
90
- "Plan Code - LMS": planCode.lms
91
- },
92
- ...isDefined(planCode?.onb) && {
93
- "Plan Code - Onboarding": planCode.onb
94
- },
95
- ...isDefined(planCode?.sks) && {
96
- "Plan Code - Skills": planCode.sks
97
- },
98
- ...isDefined(planCode?.wpm) && {
99
- "Plan Code - Performance": planCode.wpm
100
- },
101
- ...isDefined(planCode?.pbd) && {
102
- "Plan Code - Pingboard": planCode.pbd
103
- },
104
- ...isDefined(planCode?.cmp) && {
105
- "Plan Code - Compensation": planCode.cmp
106
- }
107
- };
108
- }
109
-
110
- export { DeviceIdTrait, TelemetryIdTrait, createDefaultUserTraits };
111
-
112
- //# sourceMappingURL=createDefaultUserTraits.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDefaultUserTraits.js","sources":["webpack://@workleap/logrocket/./src/createDefaultUserTraits.ts"],"sourcesContent":["import { getTelemetryContext } from \"@workleap/telemetry\";\nimport { isDefined } from \"./assertions.ts\";\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketIdentification {\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 LogRocketUserTraits 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 \"Device Id\": string;\n \"Telemetry Id\": 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\nexport const DeviceIdTrait = \"Device Id\";\nexport const TelemetryIdTrait = \"Telemetry Id\";\n\n/**\n * Create the default user traits for a WLP user.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function createDefaultUserTraits(identification: LogRocketIdentification) {\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 const telemetryContext = getTelemetryContext();\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]: telemetryContext ? telemetryContext.deviceId : \"N/A\",\n [TelemetryIdTrait]: telemetryContext ? 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 LogRocketUserTraits;\n}\n"],"names":["getTelemetryContext","isDefined","DeviceIdTrait","TelemetryIdTrait","createDefaultUserTraits","identification","userId","organizationId","organizationName","isMigratedToWorkleap","isOrganizationCreator","isAdmin","isExecutive","isCollaborator","isReportingManager","isTeamManager","planCode","isExecuti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AAG;QAAC,CAAC;QAC1E,GAAIf,SAASA,CAACe,UAAU,QAAQ;YAAE,sBAAsBA,SAAS,GAAG;QAAC,CAAC;QACtE,GAAIf,SAASA,CAACe,UAAU,QAAQ;YAAE,2BAA2BA,SAAS,GAAG;QAAC,CAAC;QAC3E,GAAIf,SAASA,CAACe,UAAU,QAAQ;YAAE,yBAAyBA,SAAS,GAAG;QAAC,CAAC;QACzE,GAAIf,SAASA,CAACe,UAAU,QAAQ;YAAE,4BAA4BA,SAAS,GAAG;QAAC,CAAC;IAChF;AACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRequestSanitizer.js","sources":["webpack://@workleap/logrocket/./src/createRequestSanitizer.ts"],"sourcesContent":["import type { LogRocketRequest } from \"./logRocketTypes.ts\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type RequestSanitizerFunction = (req: LogRocketRequest) => any;\n\nexport function createRequestSanitizer(fuzzyRequestSanitizer: RequestSanitizerFunction) {\n return (req: LogRocketRequest) => {\n if (req.headers[\"Authorization\"]) {\n req.headers[\"Authorization\"] = \"**redacted**\";\n }\n\n if (req.body) {\n // Do not return the request body, which could contain sensitive information.\n req.body = \"**redacted**\";\n }\n\n return fuzzyRequestSanitizer(req);\n };\n}\n"],"names":["createRequestSanitizer","fuzzyRequestSanitizer","req"],"mappings":";;AAKO,SAASA,uBAAuBC,qBAA+C;IAClF,OAAO,CAACC;QACJ,IAAIA,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC9BA,IAAI,OAAO,CAAC,gBAAgB,GAAG;QACnC;QAEA,IAAIA,IAAI,IAAI,EAAE;YACV,6EAA6E;YAC7EA,IAAI,IAAI,GAAG;QACf;QAEA,OAAOD,sBAAsBC;IACjC;AACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createResponseSanitizer.js","sources":["webpack://@workleap/logrocket/./src/createResponseSanitizer.ts"],"sourcesContent":["import type { LogRocketResponse } from \"./logRocketTypes.ts\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ResponseSanitizerFunction = (res: LogRocketResponse) => any;\n\nexport function createResponseSanitizer(fuzzyResponseSanitizer: ResponseSanitizerFunction) {\n return (res: LogRocketResponse) => {\n if (res.body) {\n // Do not return the response body, which could contain sensitive information.\n res.body = \"**redacted**\";\n }\n\n return fuzzyResponseSanitizer(res);\n };\n}\n"],"names":["createResponseSanitizer","fuzzyResponseSanitizer","res"],"mappings":";;AAKO,SAASA,wBAAwBC,sBAAiD;IACrF,OAAO,CAACC;QACJ,IAAIA,IAAI,IAAI,EAAE;YACV,8EAA8E;YAC9EA,IAAI,IAAI,GAAG;QACf;QAEA,OAAOD,uBAAuBC;IAClC;AACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createUrlSanitizer.js","sources":["webpack://@workleap/logrocket/./src/createUrlSanitizer.ts"],"sourcesContent":["export function createUrlSanitizer(queryParametersToRemove: string[]) {\n return (url: string) => {\n let sanitizedUrl = url;\n\n for (const x of queryParametersToRemove) {\n sanitizedUrl = sanitizedUrl.replace(new RegExp(`${x}=([^&]*)`, \"i\"), `${x}=**redacted**`);\n }\n\n return sanitizedUrl;\n };\n}\n"],"names":["createUrlSanitizer","queryParametersToRemove","url","sanitizedUrl","x","RegExp"],"mappings":";;AAAO,SAASA,mBAAmBC,uBAAiC;IAChE,OAAO,CAACC;QACJ,IAAIC,eAAeD;QAEnB,KAAK,MAAME,KAAKH,wBAAyB;YACrCE,eAAeA,aAAa,OAAO,CAAC,IAAIE,OAAO,GAAGD,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAGA,EAAE,aAAa,CAAC;QAC5F;QAEA,OAAOD;IACX;AACJ"}
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export type { LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
2
- export { createDefaultUserTraits, type LogRocketIdentification, type LogRocketUserTraits } from "./createDefaultUserTraits.ts";
3
- export { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.ts";
4
- export type * from "./logRocketTypes.ts";
5
- export { registerLogRocketInstrumentation } from "./registerLogRocketInstrumentation.ts";
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- import { createDefaultUserTraits } from "./createDefaultUserTraits.js";
2
- import { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.js";
3
- import { registerLogRocketInstrumentation } from "./registerLogRocketInstrumentation.js";
4
-
5
- ;// CONCATENATED MODULE: external "./createDefaultUserTraits.js"
6
-
7
- ;// CONCATENATED MODULE: external "./LogRocketLogger.js"
8
-
9
- ;// CONCATENATED MODULE: external "./registerLogRocketInstrumentation.js"
10
-
11
- ;// CONCATENATED MODULE: ./src/index.ts
12
-
13
-
14
-
15
-
16
- export { LogRocketLogger, LogRocketLoggerScope, createDefaultUserTraits, registerLogRocketInstrumentation };
17
-
18
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["webpack://@workleap/logrocket/./src/index.ts"],"sourcesContent":["export type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport { createDefaultUserTraits, type LogRocketIdentification, type LogRocketUserTraits } from \"./createDefaultUserTraits.ts\";\nexport { LogRocketLogger, LogRocketLoggerScope } from \"./LogRocketLogger.ts\";\nexport type * from \"./logRocketTypes.ts\";\nexport { registerLogRocketInstrumentation } from \"./registerLogRocketInstrumentation.ts\";\n\n"],"names":["createDefaultUserTraits","LogRocketLogger","LogRocketLoggerScope","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;AAC+H;AAClD;AAEY"}