@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.
- package/CHANGELOG.md +11 -0
- package/dist/js/LogRocketInstrumentationClient.d.ts +133 -0
- package/dist/js/LogRocketInstrumentationClient.js +129 -0
- package/dist/js/LogRocketInstrumentationClient.js.map +1 -0
- package/dist/{LogRocketLogger.js → js/LogRocketLogger.js} +1 -1
- package/dist/js/LogRocketLogger.js.map +1 -0
- package/dist/{applyTransformers.js → js/applyTransformers.js} +1 -1
- package/dist/js/applyTransformers.js.map +1 -0
- package/dist/{assertions.js → js/assertions.js} +1 -1
- package/dist/js/assertions.js.map +1 -0
- package/dist/{createRequestSanitizer.js → js/createRequestSanitizer.js} +1 -1
- package/dist/js/createRequestSanitizer.js.map +1 -0
- package/dist/{createResponseSanitizer.js → js/createResponseSanitizer.js} +1 -1
- package/dist/js/createResponseSanitizer.js.map +1 -0
- package/dist/{createUrlSanitizer.js → js/createUrlSanitizer.js} +1 -1
- package/dist/js/createUrlSanitizer.js.map +1 -0
- package/dist/js/index.d.ts +6 -0
- package/dist/js/index.js +22 -0
- package/dist/js/index.js.map +1 -0
- package/dist/js/logRocketTypes.js +7 -0
- package/dist/js/logRocketTypes.js.map +1 -0
- package/dist/{registerLogRocketInstrumentation.d.ts → js/registerLogRocketInstrumentation.d.ts} +27 -7
- package/dist/{registerLogRocketInstrumentation.js → js/registerLogRocketInstrumentation.js} +64 -43
- package/dist/js/registerLogRocketInstrumentation.js.map +1 -0
- package/dist/react/LogRocketInstrumentationContext.d.ts +17 -0
- package/dist/react/LogRocketInstrumentationContext.js +34 -0
- package/dist/react/LogRocketInstrumentationContext.js.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +12 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +29 -13
- package/src/js/LogRocketInstrumentationClient.ts +187 -0
- package/src/js/index.ts +8 -0
- package/src/{registerLogRocketInstrumentation.ts → js/registerLogRocketInstrumentation.ts} +104 -53
- package/src/react/LogRocketInstrumentationContext.tsx +41 -0
- package/src/react/index.ts +3 -0
- package/dist/HasExecutedGuard.d.ts +0 -6
- package/dist/HasExecutedGuard.js +0 -21
- package/dist/HasExecutedGuard.js.map +0 -1
- package/dist/LogRocketLogger.js.map +0 -1
- package/dist/applyTransformers.js.map +0 -1
- package/dist/assertions.js.map +0 -1
- package/dist/createDefaultUserTraits.d.ts +0 -116
- package/dist/createDefaultUserTraits.js +0 -112
- package/dist/createDefaultUserTraits.js.map +0 -1
- package/dist/createRequestSanitizer.js.map +0 -1
- package/dist/createResponseSanitizer.js.map +0 -1
- package/dist/createUrlSanitizer.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- package/dist/logRocketTypes.js +0 -7
- package/dist/logRocketTypes.js.map +0 -1
- package/dist/registerLogRocketInstrumentation.js.map +0 -1
- package/src/HasExecutedGuard.ts +0 -19
- package/src/createDefaultUserTraits.ts +0 -160
- package/src/index.ts +0 -6
- /package/dist/{LogRocketLogger.d.ts → js/LogRocketLogger.d.ts} +0 -0
- /package/dist/{applyTransformers.d.ts → js/applyTransformers.d.ts} +0 -0
- /package/dist/{assertions.d.ts → js/assertions.d.ts} +0 -0
- /package/dist/{createRequestSanitizer.d.ts → js/createRequestSanitizer.d.ts} +0 -0
- /package/dist/{createResponseSanitizer.d.ts → js/createResponseSanitizer.d.ts} +0 -0
- /package/dist/{createUrlSanitizer.d.ts → js/createUrlSanitizer.d.ts} +0 -0
- /package/dist/{logRocketTypes.d.ts → js/logRocketTypes.d.ts} +0 -0
- /package/src/{LogRocketLogger.ts → js/LogRocketLogger.ts} +0 -0
- /package/src/{applyTransformers.ts → js/applyTransformers.ts} +0 -0
- /package/src/{assertions.ts → js/assertions.ts} +0 -0
- /package/src/{createRequestSanitizer.ts → js/createRequestSanitizer.ts} +0 -0
- /package/src/{createResponseSanitizer.ts → js/createResponseSanitizer.ts} +0 -0
- /package/src/{createUrlSanitizer.ts → js/createUrlSanitizer.ts} +0 -0
- /package/src/{logRocketTypes.ts → js/logRocketTypes.ts} +0 -0
|
@@ -1,17 +1,16 @@
|
|
|
1
|
+
import { HasExecutedGuard } from "@workleap-telemetry/core";
|
|
1
2
|
import { createCompositeLogger } from "@workleap/logging";
|
|
2
|
-
import { createBootstrappingStore, createTelemetryContext } from "@workleap/telemetry";
|
|
3
3
|
import logrocket from "logrocket";
|
|
4
4
|
import logrocket_fuzzy_search_sanitizer from "logrocket-fuzzy-search-sanitizer";
|
|
5
5
|
import { applyTransformers } from "./applyTransformers.js";
|
|
6
|
-
import { DeviceIdTrait, TelemetryIdTrait } from "./createDefaultUserTraits.js";
|
|
7
6
|
import { createRequestSanitizer } from "./createRequestSanitizer.js";
|
|
8
7
|
import { createResponseSanitizer } from "./createResponseSanitizer.js";
|
|
9
8
|
import { createUrlSanitizer } from "./createUrlSanitizer.js";
|
|
10
|
-
import {
|
|
9
|
+
import { DeviceIdTrait, LogRocketInstrumentationClient, TelemetryIdTrait } from "./LogRocketInstrumentationClient.js";
|
|
11
10
|
|
|
12
|
-
;// CONCATENATED MODULE: external "@workleap/
|
|
11
|
+
;// CONCATENATED MODULE: external "@workleap-telemetry/core"
|
|
13
12
|
|
|
14
|
-
;// CONCATENATED MODULE: external "@workleap/
|
|
13
|
+
;// CONCATENATED MODULE: external "@workleap/logging"
|
|
15
14
|
|
|
16
15
|
;// CONCATENATED MODULE: external "logrocket"
|
|
17
16
|
|
|
@@ -19,17 +18,15 @@ import { HasExecutedGuard } from "./HasExecutedGuard.js";
|
|
|
19
18
|
|
|
20
19
|
;// CONCATENATED MODULE: external "./applyTransformers.js"
|
|
21
20
|
|
|
22
|
-
;// CONCATENATED MODULE: external "./createDefaultUserTraits.js"
|
|
23
|
-
|
|
24
21
|
;// CONCATENATED MODULE: external "./createRequestSanitizer.js"
|
|
25
22
|
|
|
26
23
|
;// CONCATENATED MODULE: external "./createResponseSanitizer.js"
|
|
27
24
|
|
|
28
25
|
;// CONCATENATED MODULE: external "./createUrlSanitizer.js"
|
|
29
26
|
|
|
30
|
-
;// CONCATENATED MODULE: external "./
|
|
27
|
+
;// CONCATENATED MODULE: external "./LogRocketInstrumentationClient.js"
|
|
31
28
|
|
|
32
|
-
;// CONCATENATED MODULE: ./src/registerLogRocketInstrumentation.ts
|
|
29
|
+
;// CONCATENATED MODULE: ./src/js/registerLogRocketInstrumentation.ts
|
|
33
30
|
|
|
34
31
|
|
|
35
32
|
|
|
@@ -39,9 +36,6 @@ import { HasExecutedGuard } from "./HasExecutedGuard.js";
|
|
|
39
36
|
|
|
40
37
|
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
const IsRegisteredVariableName = "__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__";
|
|
44
|
-
const RegisterGetSessionUrlFunctionName = "__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__";
|
|
45
39
|
const DefaultPrivateFieldNames = [
|
|
46
40
|
"email",
|
|
47
41
|
"personalEmail",
|
|
@@ -96,30 +90,12 @@ function getLogRocketSdkOptions(userOptions, logger) {
|
|
|
96
90
|
logger
|
|
97
91
|
});
|
|
98
92
|
}
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
106
|
-
*/ function registerLogRocketInstrumentation(appId, options = {}) {
|
|
107
|
-
const { verbose = false, loggers = [] } = options;
|
|
108
|
-
const logger = createCompositeLogger(verbose, loggers);
|
|
109
|
-
registrationGuard.throw("[logrocket] The LogRocket instrumentation has already been registered. Did you call the \"registerLogRocketInstrumentation\" function twice?");
|
|
110
|
-
const sdkOptions = getLogRocketSdkOptions(options, logger);
|
|
111
|
-
// Session starts anonymously when LogRocket.init() is called.
|
|
112
|
-
logrocket.init(appId, sdkOptions);
|
|
113
|
-
const telemetryContext = createTelemetryContext(logger);
|
|
114
|
-
// LogRocket maintains the same session even if the user starts as anonymous and later becomes identified via LogRocket.identify().
|
|
115
|
-
// If LogRocket.identify is called multiple times during a recording, you can search for any of the identified users in the session.
|
|
116
|
-
logrocket.identify(telemetryContext.deviceId, {
|
|
117
|
-
[DeviceIdTrait]: telemetryContext.deviceId,
|
|
118
|
-
[TelemetryIdTrait]: telemetryContext.telemetryId
|
|
119
|
-
});
|
|
120
|
-
logrocket.getSessionURL((url)=>{
|
|
121
|
-
logger.withText("[logrocket] Session replay URL is now available:").withText(url).debug();
|
|
122
|
-
});
|
|
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() {
|
|
123
99
|
// Indicates to the host applications that logrocket has been initialized.
|
|
124
100
|
// It's useful in cases where an "add-on", like the platform widgets needs
|
|
125
101
|
// to know whether or not the host application is using LogRocket.
|
|
@@ -136,14 +112,59 @@ function __resetRegistrationGuard() {
|
|
|
136
112
|
globalThis[RegisterGetSessionUrlFunctionName] = (listener)=>{
|
|
137
113
|
logrocket.getSessionURL(listener);
|
|
138
114
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
115
|
+
}
|
|
116
|
+
///////////////////////////
|
|
117
|
+
let registrationGuardInstance;
|
|
118
|
+
// It's important to use a lazy singleton instead of a singleton to avoid
|
|
119
|
+
// any future probleme related to HMR, tree-shaking, SSR, etc..
|
|
120
|
+
function getRegistrationGuard() {
|
|
121
|
+
if (!registrationGuardInstance) {
|
|
122
|
+
registrationGuardInstance = new HasExecutedGuard();
|
|
123
|
+
}
|
|
124
|
+
return registrationGuardInstance;
|
|
125
|
+
}
|
|
126
|
+
// This function should only be used by tests.
|
|
127
|
+
function __resetRegistrationGuard() {
|
|
128
|
+
if (registrationGuardInstance) {
|
|
129
|
+
registrationGuardInstance.reset();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
///////////////////////////
|
|
133
|
+
class LogRocketInstrumentationRegistrator {
|
|
134
|
+
register(appId, options = {}) {
|
|
135
|
+
const { telemetryContext, verbose = false, loggers = [] } = options;
|
|
136
|
+
const logger = createCompositeLogger(verbose, loggers);
|
|
137
|
+
const sdkOptions = getLogRocketSdkOptions(options, logger);
|
|
138
|
+
// Session starts anonymously when LogRocket.init() is called.
|
|
139
|
+
logrocket.init(appId, sdkOptions);
|
|
140
|
+
// Identify the user with the correlation ids.
|
|
141
|
+
if (telemetryContext) {
|
|
142
|
+
// LogRocket maintains the same session even if the user starts as anonymous and later becomes identified via LogRocket.identify().
|
|
143
|
+
// If LogRocket.identify is called multiple times during a recording, you can search for any of the identified users in the session.
|
|
144
|
+
logrocket.identify(telemetryContext.deviceId, {
|
|
145
|
+
[DeviceIdTrait]: telemetryContext.deviceId,
|
|
146
|
+
[TelemetryIdTrait]: telemetryContext.telemetryId
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
logrocket.getSessionURL((url)=>{
|
|
150
|
+
logger.withText("[logrocket] Session replay URL is now available:").withText(url).debug();
|
|
151
|
+
});
|
|
152
|
+
registerDeprecatedGlobalVariables();
|
|
153
|
+
logger.information("[logrocket] LogRocket instrumentation is registered.");
|
|
154
|
+
return new LogRocketInstrumentationClient(telemetryContext);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Register the LogRocket instrumentation.
|
|
159
|
+
* @param appId LogRocket application id.
|
|
160
|
+
* @param options LogRocket instrumentation options.
|
|
161
|
+
* @returns {LogRocketInstrumentationClient} A LogRocket instrumentation client instance.
|
|
162
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
163
|
+
*/ function registerLogRocketInstrumentation(appId, options) {
|
|
164
|
+
getRegistrationGuard().throw("[logrocket] The LogRocket instrumentation has already been registered. Did you call the \"registerLogRocketInstrumentation\" function twice?");
|
|
165
|
+
return new LogRocketInstrumentationRegistrator().register(appId, options);
|
|
145
166
|
}
|
|
146
167
|
|
|
147
|
-
export { IsRegisteredVariableName, RegisterGetSessionUrlFunctionName, __resetRegistrationGuard, getLogRocketSdkOptions, registerLogRocketInstrumentation };
|
|
168
|
+
export { IsRegisteredVariableName, LogRocketInstrumentationRegistrator, RegisterGetSessionUrlFunctionName, __resetRegistrationGuard, getLogRocketSdkOptions, registerLogRocketInstrumentation };
|
|
148
169
|
|
|
149
170
|
//# sourceMappingURL=registerLogRocketInstrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js/registerLogRocketInstrumentation.js","sources":["webpack://@workleap/logrocket/./src/js/registerLogRocketInstrumentation.ts"],"sourcesContent":["import { HasExecutedGuard, type TelemetryContext } from \"@workleap-telemetry/core\";\nimport { createCompositeLogger, type RootLogger } from \"@workleap/logging\";\nimport LogRocket from \"logrocket\";\nimport LogrocketFuzzySanitizer from \"logrocket-fuzzy-search-sanitizer\";\nimport { applyTransformers, type LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nimport { createRequestSanitizer } from \"./createRequestSanitizer.ts\";\nimport { createResponseSanitizer } from \"./createResponseSanitizer.ts\";\nimport { createUrlSanitizer } from \"./createUrlSanitizer.ts\";\nimport { DeviceIdTrait, LogRocketInstrumentationClient, TelemetryIdTrait } from \"./LogRocketInstrumentationClient.ts\";\nimport type { LogRocketSdkOptions } from \"./logRocketTypes.ts\";\n\nconst DefaultPrivateFieldNames = [\n \"email\",\n \"personalEmail\",\n \"phoneNumber\",\n \"password\",\n \"firstName\",\n \"lastName\",\n \"givenName\",\n \"fullName\",\n \"gender\",\n \"timeZone\",\n \"birthday\"\n];\n\nconst DefaultPrivateQueryParameterNames = [\n \"token\",\n \"email\",\n \"password\"\n];\n\n///////////////////////////\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface RegisterLogRocketInstrumentationOptions {\n /**\n * A root hostname to track sessions across subdomains. Set this option to capture traffic from all subdomains under one session: https://docs.logrocket.com/reference/roothostname.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n rootHostname?: LogRocketSdkOptions[\"rootHostname\"];\n /**\n * Names of additional fields to exclude from session replays. These fields will be removed from network requests, responses using a fuzzy-matching algorithm.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n privateFieldNames?: string[];\n /**\n * Names of additional fields to exclude from session replays. These fields will be removed from query parameters using a fuzzy-matching algorithm.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n privateQueryParameterNames?: string[];\n /**\n * Context including telemetry correlation ids.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n telemetryContext?: TelemetryContext;\n /**\n * Hooks to transform the resulting LogRocket SDK options.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n transformers?: LogRocketSdkOptionsTransformer[];\n /**\n * Indicates whether or not debug information should be logged to the console.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n verbose?: boolean;\n /**\n * The logger instances that will output messages.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\n loggers?: RootLogger[];\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function getLogRocketSdkOptions(userOptions: RegisterLogRocketInstrumentationOptions, logger: RootLogger): LogRocketSdkOptions {\n const {\n rootHostname = \"workleap.com\",\n privateFieldNames = [],\n privateQueryParameterNames = [],\n verbose = false,\n transformers = []\n } = userOptions;\n\n const mergedPrivateFieldNames = DefaultPrivateFieldNames.concat(privateFieldNames);\n const mergedPrivateQueryParameterNames = DefaultPrivateQueryParameterNames.concat(privateQueryParameterNames);\n\n // The \"LogrocketFuzzySearch.setup\" code is awkward. For now, we prefer to play it safe and call it once here, then forward the sanitize functions\n // to the appropriate factories.\n // No clue why the \"setup\" method is not available. This package is shady.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const { requestSanitizer: fuzzyRequestSanitizer, responseSanitizer: fuzzyResponseSanitizer } = LogrocketFuzzySanitizer.setup(mergedPrivateFieldNames);\n\n const sdkOptions = {\n console: {\n // Prevent console logs from being visible in LogRocket session replays and leaking PII.\n // To capture logs in a session replay, use the LogRocketLogger class.\n isEnabled: false\n },\n rootHostname,\n dom: {\n textSanitizer: true,\n inputSanitizer: true\n },\n network: {\n requestSanitizer: createRequestSanitizer(fuzzyRequestSanitizer),\n responseSanitizer: createResponseSanitizer(fuzzyResponseSanitizer)\n },\n browser: {\n urlSanitizer: createUrlSanitizer(mergedPrivateQueryParameterNames)\n },\n shouldDebugLog: verbose\n } satisfies LogRocketSdkOptions;\n\n return applyTransformers(sdkOptions, transformers, {\n verbose,\n logger\n });\n}\n\n///////////////////////////\n\n// DEPRECATED: Grace period ends on January 1th 2026.\nexport const IsRegisteredVariableName = \"__WLP_LOGROCKET_INSTRUMENTATION_IS_REGISTERED__\";\nexport const RegisterGetSessionUrlFunctionName = \"__WLP_LOGROCKET_INSTRUMENTATION_REGISTER_GET_SESSION_URL_LISTENER__\";\n\n// DEPRECATED: Grace period ends on January 1th 2026.\nfunction registerDeprecatedGlobalVariables() {\n // Indicates to the host applications that logrocket has been initialized.\n // It's useful in cases where an \"add-on\", like the platform widgets needs\n // to know whether or not the host application is using LogRocket.\n // While there are ways that the host application could tell to an \"add-on\" if\n // it's using LogRocket or not, doing it this way is transparent for the consumer,\n // which is great for DX.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[IsRegisteredVariableName] = true;\n\n // While consumers could directly call LogRocket.getSessionURL, by doing it this way,\n // it allow consumers to not take a direct dependency on the \"logrocket\" package.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[RegisterGetSessionUrlFunctionName] = listener => {\n LogRocket.getSessionURL(listener);\n };\n}\n\n///////////////////////////\n\nlet registrationGuardInstance: HasExecutedGuard | undefined;\n\n// It's important to use a lazy singleton instead of a singleton to avoid\n// any future probleme related to HMR, tree-shaking, SSR, etc..\nfunction getRegistrationGuard() {\n if (!registrationGuardInstance) {\n registrationGuardInstance = new HasExecutedGuard();\n }\n\n return registrationGuardInstance;\n}\n\n// This function should only be used by tests.\nexport function __resetRegistrationGuard() {\n if (registrationGuardInstance) {\n registrationGuardInstance.reset();\n }\n}\n\n///////////////////////////\n\nexport class LogRocketInstrumentationRegistrator {\n register(\n appId: string,\n options: RegisterLogRocketInstrumentationOptions = {}\n ) {\n const {\n telemetryContext,\n verbose = false,\n loggers = []\n } = options;\n\n const logger = createCompositeLogger(verbose, loggers);\n const sdkOptions = getLogRocketSdkOptions(options, logger);\n\n // Session starts anonymously when LogRocket.init() is called.\n LogRocket.init(appId, sdkOptions);\n\n // Identify the user with the correlation ids.\n if (telemetryContext) {\n // LogRocket maintains the same session even if the user starts as anonymous and later becomes identified via LogRocket.identify().\n // If LogRocket.identify is called multiple times during a recording, you can search for any of the identified users in the session.\n LogRocket.identify(telemetryContext.deviceId, {\n [DeviceIdTrait]: telemetryContext.deviceId,\n [TelemetryIdTrait]: telemetryContext.telemetryId\n });\n }\n\n LogRocket.getSessionURL(url => {\n logger\n .withText(\"[logrocket] Session replay URL is now available:\")\n .withText(url)\n .debug();\n });\n\n registerDeprecatedGlobalVariables();\n\n logger.information(\"[logrocket] LogRocket instrumentation is registered.\");\n\n return new LogRocketInstrumentationClient(telemetryContext);\n }\n}\n\n/**\n * Register the LogRocket instrumentation.\n * @param appId LogRocket application id.\n * @param options LogRocket instrumentation options.\n * @returns {LogRocketInstrumentationClient} A LogRocket instrumentation client instance.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function registerLogRocketInstrumentation(\n appId: string,\n options?: RegisterLogRocketInstrumentationOptions\n) {\n getRegistrationGuard().throw(\"[logrocket] The LogRocket instrumentation has already been registered. Did you call the \\\"registerLogRocketInstrumentation\\\" function twice?\");\n\n return new LogRocketInstrumentationRegistrator().register(appId, options);\n}\n"],"names":["HasExecutedGuard","createCompositeLogger","LogRocket","LogrocketFuzzySanitizer","applyTransformers","createRequestSanitizer","createResponseSanitizer","createUrlSanitizer","DeviceIdTrait","LogRocketInstrumentationClient","TelemetryIdTrait","DefaultPrivateFieldNames","DefaultPrivateQueryParameterNames","getLogRocketSdkOptions","userOptions","logger","rootHostname","privateFieldNames","privateQueryParameterNames","verbose","transformers","mergedPrivateFieldNames","mergedPrivateQueryParameterNames","fuzzyRequestSanitizer","fuzzyResponseSanitizer","sdkOptions","IsRegisteredVariableName","RegisterGetSessionUrlFunctionName","registerDeprecatedGlobalVariables","globalThis","listener","registrationGuardInstance","getRegistrationGuard","__resetRegistrationGuard","LogRocketInstrumentationRegistrator","appId","options","telemetryContext","loggers","url","registerLogRocketInstrumentation"],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import type { LogRocketInstrumentationClient } from "../js/LogRocketInstrumentationClient.ts";
|
|
3
|
+
/**
|
|
4
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
5
|
+
*/
|
|
6
|
+
export interface LogRocketInstrumentationProviderProps extends PropsWithChildren {
|
|
7
|
+
client: LogRocketInstrumentationClient;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
11
|
+
*/
|
|
12
|
+
export declare function LogRocketInstrumentationProvider(props: LogRocketInstrumentationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve the LogRocket instrumentation client.
|
|
15
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
16
|
+
*/
|
|
17
|
+
export declare function useLogRocketInstrumentationClient(): LogRocketInstrumentationClient;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
|
|
4
|
+
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
5
|
+
|
|
6
|
+
;// CONCATENATED MODULE: external "react"
|
|
7
|
+
|
|
8
|
+
;// CONCATENATED MODULE: ./src/react/LogRocketInstrumentationContext.tsx
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const LogRocketInstrumentationContext = /*#__PURE__*/ createContext(undefined);
|
|
12
|
+
/**
|
|
13
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
14
|
+
*/ function LogRocketInstrumentationProvider(props) {
|
|
15
|
+
const { client, children } = props;
|
|
16
|
+
return /*#__PURE__*/ jsx(LogRocketInstrumentationContext.Provider, {
|
|
17
|
+
value: client,
|
|
18
|
+
children: children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieve the LogRocket instrumentation client.
|
|
23
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
24
|
+
*/ function useLogRocketInstrumentationClient() {
|
|
25
|
+
const client = useContext(LogRocketInstrumentationContext);
|
|
26
|
+
if (!client) {
|
|
27
|
+
throw new Error("[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.");
|
|
28
|
+
}
|
|
29
|
+
return client;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=LogRocketInstrumentationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react/LogRocketInstrumentationContext.js","sources":["webpack://@workleap/logrocket/./src/react/LogRocketInstrumentationContext.tsx"],"sourcesContent":["import { createContext, type PropsWithChildren, useContext } from \"react\";\nimport type { LogRocketInstrumentationClient } from \"../js/LogRocketInstrumentationClient.ts\";\n\nconst LogRocketInstrumentationContext = createContext<LogRocketInstrumentationClient | undefined>(undefined);\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketInstrumentationProviderProps extends PropsWithChildren {\n client: LogRocketInstrumentationClient;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function LogRocketInstrumentationProvider(props: LogRocketInstrumentationProviderProps) {\n const {\n client,\n children\n } = props;\n\n return (\n <LogRocketInstrumentationContext.Provider value={client}>\n {children}\n </LogRocketInstrumentationContext.Provider>\n );\n}\n\n/**\n * Retrieve the LogRocket instrumentation client.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function useLogRocketInstrumentationClient() {\n const client = useContext(LogRocketInstrumentationContext);\n\n if (!client) {\n throw new Error(\"[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.\");\n }\n\n return client;\n}\n"],"names":["createContext","useContext","LogRocketInstrumentationContext","undefined","LogRocketInstrumentationProvider","props","client","children","useLogRocketInstrumentationClient","Error"],"mappings":";;;;;;;;;AAA0E;AAG1E,MAAME,gDAAkCF,aAAaA,CAA6CG;AASlG;;CAEC,GACM,SAASC,iCAAiCC,KAA4C;IACzF,MAAM,EACFC,MAAM,EACNC,QAAQ,EACX,GAAGF;IAEJ,qBACI,IAACH,gCAAgC,QAAQ;QAAC,OAAOI;kBAC5CC;;AAGb;AAEA;;;CAGC,GACM,SAASC;IACZ,MAAMF,SAASL,UAAUA,CAACC;IAE1B,IAAI,CAACI,QAAQ;QACT,MAAM,IAAIG,MAAM;IACpB;IAEA,OAAOH;AACX"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient } from "./LogRocketInstrumentationContext.js";
|
|
2
|
+
export * from "../js/index.js";
|
|
3
|
+
|
|
4
|
+
;// CONCATENATED MODULE: external "./LogRocketInstrumentationContext.js"
|
|
5
|
+
|
|
6
|
+
;// CONCATENATED MODULE: ./src/react/index.ts
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react/index.js","sources":["webpack://@workleap/logrocket/./src/react/index.ts"],"sourcesContent":["export * from \"../js/index.ts\";\nexport { LogRocketInstrumentationProvider, useLogRocketInstrumentationClient } from \"./LogRocketInstrumentationContext.tsx\";\n\n"],"names":["LogRocketInstrumentationProvider","useLogRocketInstrumentationClient"],"mappings":";;;;;;AAA+B;AAC6F"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workleap/logrocket",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "A package containing utilities for LogRocket.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -16,9 +16,14 @@
|
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
20
|
-
"import": "./dist/index.js",
|
|
21
|
-
"default": "./dist/index.js"
|
|
19
|
+
"types": "./dist/js/index.d.ts",
|
|
20
|
+
"import": "./dist/js/index.js",
|
|
21
|
+
"default": "./dist/js/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./react": {
|
|
24
|
+
"types": "./dist/react/index.d.ts",
|
|
25
|
+
"import": "./dist/react/index.js",
|
|
26
|
+
"default": "./dist/react/index.js"
|
|
22
27
|
}
|
|
23
28
|
},
|
|
24
29
|
"files": [
|
|
@@ -28,22 +33,33 @@
|
|
|
28
33
|
"README.md"
|
|
29
34
|
],
|
|
30
35
|
"peerDependencies": {
|
|
31
|
-
"logrocket": "^10.1.0"
|
|
36
|
+
"logrocket": "^10.1.0",
|
|
37
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
38
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"react": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"react-dom": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
32
47
|
},
|
|
33
48
|
"dependencies": {
|
|
34
|
-
"@workleap/logging": "^1.
|
|
49
|
+
"@workleap/logging": "^1.3.0",
|
|
35
50
|
"logrocket-fuzzy-search-sanitizer": "0.0.2",
|
|
36
|
-
"@workleap/
|
|
51
|
+
"@workleap-telemetry/core": "1.0.0"
|
|
37
52
|
},
|
|
38
53
|
"devDependencies": {
|
|
39
|
-
"@rsbuild/core": "1.
|
|
40
|
-
"@rslib/core": "0.
|
|
41
|
-
"@
|
|
42
|
-
"@workleap/
|
|
54
|
+
"@rsbuild/core": "1.5.13",
|
|
55
|
+
"@rslib/core": "0.15.0",
|
|
56
|
+
"@types/react": "19.2.0",
|
|
57
|
+
"@workleap/eslint-plugin": "3.5.0",
|
|
58
|
+
"@workleap/rslib-configs": "1.1.0",
|
|
43
59
|
"@workleap/typescript-configs": "3.0.4",
|
|
44
60
|
"eslint": "8.57.1",
|
|
45
|
-
"happy-dom": "
|
|
46
|
-
"typescript": "5.
|
|
61
|
+
"happy-dom": "19.0.2",
|
|
62
|
+
"typescript": "5.9.3",
|
|
47
63
|
"vitest": "3.2.4"
|
|
48
64
|
},
|
|
49
65
|
"sideEffects": false,
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { TelemetryContext } from "@workleap-telemetry/core";
|
|
2
|
+
import LogRocket from "logrocket";
|
|
3
|
+
import { isDefined } from "./assertions.ts";
|
|
4
|
+
|
|
5
|
+
export type GetLogRocketSessionUrlListener = (sessionURL: string) => void;
|
|
6
|
+
|
|
7
|
+
export const DeviceIdTrait = "Device Id";
|
|
8
|
+
export const TelemetryIdTrait = "Telemetry Id";
|
|
9
|
+
|
|
10
|
+
///////////////////////////
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
14
|
+
*/
|
|
15
|
+
export interface LogRocketWorkleapPlatformIdentification {
|
|
16
|
+
userId: string;
|
|
17
|
+
organizationId: string;
|
|
18
|
+
organizationName: string;
|
|
19
|
+
isMigratedToWorkleap: boolean;
|
|
20
|
+
isAdmin: boolean;
|
|
21
|
+
isOrganizationCreator?: boolean;
|
|
22
|
+
isExecutive?: {
|
|
23
|
+
wov?: boolean;
|
|
24
|
+
lms?: boolean;
|
|
25
|
+
onb?: boolean;
|
|
26
|
+
sks?: boolean;
|
|
27
|
+
wpm?: boolean;
|
|
28
|
+
pbd?: boolean;
|
|
29
|
+
cmp?: boolean;
|
|
30
|
+
};
|
|
31
|
+
isCollaborator?: {
|
|
32
|
+
wov?: boolean;
|
|
33
|
+
lms?: boolean;
|
|
34
|
+
onb?: boolean;
|
|
35
|
+
sks?: boolean;
|
|
36
|
+
wpm?: boolean;
|
|
37
|
+
pbd?: boolean;
|
|
38
|
+
cmp?: boolean;
|
|
39
|
+
};
|
|
40
|
+
isReportingManager?: boolean;
|
|
41
|
+
isTeamManager?: boolean;
|
|
42
|
+
planCode?: {
|
|
43
|
+
wov?: string;
|
|
44
|
+
lms?: string;
|
|
45
|
+
onb?: string;
|
|
46
|
+
sks?: string;
|
|
47
|
+
wpm?: string;
|
|
48
|
+
pbd?: string;
|
|
49
|
+
cmp?: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
55
|
+
*/
|
|
56
|
+
export interface LogRocketWorkleapPlatformUserTraits extends Record<string, unknown> {
|
|
57
|
+
"User Id": string;
|
|
58
|
+
"Organization Id": string;
|
|
59
|
+
"Organization Name": string;
|
|
60
|
+
"Is Migrated To Workleap": boolean;
|
|
61
|
+
"Is Admin": boolean;
|
|
62
|
+
[DeviceIdTrait]: string;
|
|
63
|
+
[TelemetryIdTrait]: string;
|
|
64
|
+
"Is Organization Creator"?: boolean;
|
|
65
|
+
"Is Executive"?: boolean;
|
|
66
|
+
"Is Executive - Officevibe"?: boolean;
|
|
67
|
+
"Is Executive - LMS"?: boolean;
|
|
68
|
+
"Is Executive - Onboarding"?: boolean;
|
|
69
|
+
"Is Executive - Skills"?: boolean;
|
|
70
|
+
"Is Executive - Performance"?: boolean;
|
|
71
|
+
"Is Executive - Pingboard"?: boolean;
|
|
72
|
+
"Is Collaborator"?: boolean;
|
|
73
|
+
"Is Collaborator - Officevibe"?: boolean;
|
|
74
|
+
"Is Collaborator - LMS"?: boolean;
|
|
75
|
+
"Is Collaborator - Onboarding"?: boolean;
|
|
76
|
+
"Is Collaborator - Skills"?: boolean;
|
|
77
|
+
"Is Collaborator - Performance"?: boolean;
|
|
78
|
+
"Is Collaborator - Pingboard"?: boolean;
|
|
79
|
+
"Is Reporting Manager"?: boolean;
|
|
80
|
+
"Is Team Manager"?: boolean;
|
|
81
|
+
"Plan Code - Officevibe"?: string;
|
|
82
|
+
"Plan Code - LMS"?: string;
|
|
83
|
+
"Plan Code - Onboarding"?: string;
|
|
84
|
+
"Plan Code - Skills"?: string;
|
|
85
|
+
"Plan Code - Performance"?: string;
|
|
86
|
+
"Plan Code - Pingboard"?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
///////////////////////////
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
93
|
+
*/
|
|
94
|
+
export class LogRocketInstrumentationClient {
|
|
95
|
+
readonly #telemetryContext?: TelemetryContext;
|
|
96
|
+
|
|
97
|
+
constructor(telemetryContext?: TelemetryContext) {
|
|
98
|
+
this.#telemetryContext = telemetryContext;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Register a listener to receive the LogRocket session id when it's available.
|
|
103
|
+
* This method is the equivalent of the LogRocket.getSessionURL function but is
|
|
104
|
+
* particularly useful for third party libraries that doesn't want to take a dependency
|
|
105
|
+
* on `logrocket`.
|
|
106
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
107
|
+
*/
|
|
108
|
+
registerGetSessionUrlListener(listener: GetLogRocketSessionUrlListener) {
|
|
109
|
+
LogRocket.getSessionURL(listener);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Create the default user traits for a Workleap Platform user.
|
|
114
|
+
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
115
|
+
*/
|
|
116
|
+
createWorkleapPlatformDefaultUserTraits(identification: LogRocketWorkleapPlatformIdentification) {
|
|
117
|
+
const {
|
|
118
|
+
userId,
|
|
119
|
+
organizationId,
|
|
120
|
+
organizationName,
|
|
121
|
+
isMigratedToWorkleap,
|
|
122
|
+
isOrganizationCreator,
|
|
123
|
+
isAdmin,
|
|
124
|
+
isExecutive,
|
|
125
|
+
isCollaborator,
|
|
126
|
+
isReportingManager,
|
|
127
|
+
isTeamManager,
|
|
128
|
+
planCode
|
|
129
|
+
} = identification;
|
|
130
|
+
|
|
131
|
+
const isExecutiveInAnyProduct = Boolean(
|
|
132
|
+
isExecutive?.wov ||
|
|
133
|
+
isExecutive?.lms ||
|
|
134
|
+
isExecutive?.onb ||
|
|
135
|
+
isExecutive?.sks ||
|
|
136
|
+
isExecutive?.wpm ||
|
|
137
|
+
isExecutive?.pbd ||
|
|
138
|
+
isExecutive?.cmp
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const isCollaboratorInAnyProduct = Boolean(
|
|
142
|
+
isCollaborator?.wov ||
|
|
143
|
+
isCollaborator?.lms ||
|
|
144
|
+
isCollaborator?.onb ||
|
|
145
|
+
isCollaborator?.sks ||
|
|
146
|
+
isCollaborator?.wpm ||
|
|
147
|
+
isCollaborator?.pbd ||
|
|
148
|
+
isCollaborator?.cmp
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
"User Id": userId,
|
|
153
|
+
"Organization Id": organizationId,
|
|
154
|
+
"Organization Name": organizationName,
|
|
155
|
+
"Is Migrated To Workleap": isMigratedToWorkleap,
|
|
156
|
+
"Is Admin": isAdmin,
|
|
157
|
+
[DeviceIdTrait]: this.#telemetryContext?.deviceId ?? "N/A",
|
|
158
|
+
[TelemetryIdTrait]: this.#telemetryContext?.telemetryId ?? "N/A",
|
|
159
|
+
...(isDefined(isOrganizationCreator) && { "Is Organization Creator": isOrganizationCreator }),
|
|
160
|
+
...(isExecutiveInAnyProduct && { "Is Executive": true }),
|
|
161
|
+
...(isDefined(isExecutive?.wov) && { "Is Executive - Officevibe": isExecutive.wov }),
|
|
162
|
+
...(isDefined(isExecutive?.lms) && { "Is Executive - LMS": isExecutive.lms }),
|
|
163
|
+
...(isDefined(isExecutive?.onb) && { "Is Executive - Onboarding": isExecutive.onb }),
|
|
164
|
+
...(isDefined(isExecutive?.sks) && { "Is Executive - Skills": isExecutive.sks }),
|
|
165
|
+
...(isDefined(isExecutive?.wpm) && { "Is Executive - Performance": isExecutive.wpm }),
|
|
166
|
+
...(isDefined(isExecutive?.pbd) && { "Is Executive - Pingboard": isExecutive.pbd }),
|
|
167
|
+
...(isDefined(isExecutive?.cmp) && { "Is Executive - Compensation": isExecutive.cmp }),
|
|
168
|
+
...(isCollaboratorInAnyProduct && { "Is Collaborator": isCollaboratorInAnyProduct }),
|
|
169
|
+
...(isDefined(isCollaborator?.wov) && { "Is Collaborator - Officevibe": isCollaborator.wov }),
|
|
170
|
+
...(isDefined(isCollaborator?.lms) && { "Is Collaborator - LMS": isCollaborator.lms }),
|
|
171
|
+
...(isDefined(isCollaborator?.onb) && { "Is Collaborator - Onboarding": isCollaborator.onb }),
|
|
172
|
+
...(isDefined(isCollaborator?.sks) && { "Is Collaborator - Skills": isCollaborator.sks }),
|
|
173
|
+
...(isDefined(isCollaborator?.wpm) && { "Is Collaborator - Performance": isCollaborator.wpm }),
|
|
174
|
+
...(isDefined(isCollaborator?.pbd) && { "Is Collaborator - Pingboard": isCollaborator.pbd }),
|
|
175
|
+
...(isDefined(isCollaborator?.cmp) && { "Is Collaborator - Compensation": isCollaborator.cmp }),
|
|
176
|
+
...(isDefined(isReportingManager) && { "Is Reporting Manager": isReportingManager }),
|
|
177
|
+
...(isDefined(isTeamManager) && { "Is Team Manager": isTeamManager }),
|
|
178
|
+
...(isDefined(planCode?.wov) && { "Plan Code - Officevibe": planCode.wov }),
|
|
179
|
+
...(isDefined(planCode?.lms) && { "Plan Code - LMS": planCode.lms }),
|
|
180
|
+
...(isDefined(planCode?.onb) && { "Plan Code - Onboarding": planCode.onb }),
|
|
181
|
+
...(isDefined(planCode?.sks) && { "Plan Code - Skills": planCode.sks }),
|
|
182
|
+
...(isDefined(planCode?.wpm) && { "Plan Code - Performance": planCode.wpm }),
|
|
183
|
+
...(isDefined(planCode?.pbd) && { "Plan Code - Pingboard": planCode.pbd }),
|
|
184
|
+
...(isDefined(planCode?.cmp) && { "Plan Code - Compensation": planCode.cmp })
|
|
185
|
+
} satisfies LogRocketWorkleapPlatformUserTraits;
|
|
186
|
+
}
|
|
187
|
+
}
|
package/src/js/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from "@workleap-telemetry/core";
|
|
2
|
+
export type { LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
|
|
3
|
+
export { LogRocketInstrumentationClient, type GetLogRocketSessionUrlListener, type LogRocketWorkleapPlatformIdentification, type LogRocketWorkleapPlatformUserTraits } from "./LogRocketInstrumentationClient.ts";
|
|
4
|
+
export { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.ts";
|
|
5
|
+
export type * from "./logRocketTypes.ts";
|
|
6
|
+
export { registerLogRocketInstrumentation, type RegisterLogRocketInstrumentationOptions } from "./registerLogRocketInstrumentation.ts";
|
|
7
|
+
|
|
8
|
+
|