@workleap/logrocket 2.1.3 → 2.1.5
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 +15 -0
- package/dist/js/applyTransformers.js.map +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/react/LogRocketInstrumentationContext.d.ts +3 -3
- package/dist/react/LogRocketInstrumentationContext.js +2 -2
- package/dist/react/LogRocketInstrumentationContext.js.map +1 -1
- package/package.json +16 -14
- package/src/js/applyTransformers.ts +0 -2
- package/src/js/index.ts +0 -1
- package/src/react/LogRocketInstrumentationContext.tsx +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @workleap/logrocket
|
|
2
2
|
|
|
3
|
+
## 2.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#117](https://github.com/workleap/wl-telemetry/pull/117) [`5bc65a7`](https://github.com/workleap/wl-telemetry/commit/5bc65a700b3b2066498456f470e1b914998c6bb8) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Bumped dependency versions.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`5bc65a7`](https://github.com/workleap/wl-telemetry/commit/5bc65a700b3b2066498456f470e1b914998c6bb8)]:
|
|
10
|
+
- @workleap-telemetry/core@1.0.4
|
|
11
|
+
|
|
12
|
+
## 2.1.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#115](https://github.com/workleap/wl-telemetry/pull/115) [`97f3f76`](https://github.com/workleap/wl-telemetry/commit/97f3f76199231d43a56d78209e8193a781df490d) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Renamed `dontThrowOnUndefined` to `throwOnUndefined` for the hooks to retrieve the telemetry clients.
|
|
17
|
+
|
|
3
18
|
## 2.1.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/applyTransformers.js","sources":["webpack://@workleap/logrocket/./src/js/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
|
|
1
|
+
{"version":3,"file":"js/applyTransformers.js","sources":["webpack://@workleap/logrocket/./src/js/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"],"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"}
|
package/dist/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/index.js","sources":["webpack://@workleap/logrocket/./src/js/index.ts"],"sourcesContent":["export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from \"@workleap-telemetry/core\";\nexport type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport type { GetLogRocketSessionUrlListener, LogRocketInstrumentationClient, LogRocketWorkleapPlatformIdentification, LogRocketWorkleapPlatformUserTraits } from \"./LogRocketInstrumentationClient.ts\";\nexport { LogRocketLogger, LogRocketLoggerScope } from \"./LogRocketLogger.ts\";\nexport type * from \"./logRocketTypes.ts\";\nexport { NoopLogRocketInstrumentationClient } from \"./NoopLogRocketInstrumentationClient.ts\";\nexport { registerLogRocketInstrumentation, type RegisterLogRocketInstrumentationOptions } from \"./registerLogRocketInstrumentation.ts\";\n\n
|
|
1
|
+
{"version":3,"file":"js/index.js","sources":["webpack://@workleap/logrocket/./src/js/index.ts"],"sourcesContent":["export { createTelemetryContext, type CreateTelemetryContextOptions, type TelemetryContext } from \"@workleap-telemetry/core\";\nexport type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport type { GetLogRocketSessionUrlListener, LogRocketInstrumentationClient, LogRocketWorkleapPlatformIdentification, LogRocketWorkleapPlatformUserTraits } from \"./LogRocketInstrumentationClient.ts\";\nexport { LogRocketLogger, LogRocketLoggerScope } from \"./LogRocketLogger.ts\";\nexport type * from \"./logRocketTypes.ts\";\nexport { NoopLogRocketInstrumentationClient } from \"./NoopLogRocketInstrumentationClient.ts\";\nexport { registerLogRocketInstrumentation, type RegisterLogRocketInstrumentationOptions } from \"./registerLogRocketInstrumentation.ts\";\n\n"],"names":["createTelemetryContext","LogRocketLogger","LogRocketLoggerScope","NoopLogRocketInstrumentationClient","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;;;;AAA6H;AAGhD;AAEgB;AAC0C"}
|
|
@@ -14,11 +14,11 @@ export interface UseLogRocketInstrumentationClientOptions {
|
|
|
14
14
|
/**
|
|
15
15
|
* Whether or not an exception should be thrown if the client hasn't been provided.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
throwOnUndefined?: boolean;
|
|
18
18
|
}
|
|
19
19
|
export declare function useLogRocketInstrumentationClient(options?: {
|
|
20
|
-
|
|
20
|
+
throwOnUndefined?: true;
|
|
21
21
|
}): LogRocketInstrumentationClient;
|
|
22
22
|
export declare function useLogRocketInstrumentationClient(options: {
|
|
23
|
-
|
|
23
|
+
throwOnUndefined: false;
|
|
24
24
|
}): LogRocketInstrumentationClient | undefined;
|
|
@@ -22,9 +22,9 @@ const LogRocketInstrumentationContext = /*#__PURE__*/ createContext(undefined);
|
|
|
22
22
|
* Retrieve the LogRocket instrumentation client.
|
|
23
23
|
* @see {@link https://workleap.github.io/wl-telemetry}
|
|
24
24
|
*/ function useLogRocketInstrumentationClient(options = {}) {
|
|
25
|
-
const {
|
|
25
|
+
const { throwOnUndefined = true } = options;
|
|
26
26
|
const client = useContext(LogRocketInstrumentationContext);
|
|
27
|
-
if (!client &&
|
|
27
|
+
if (!client && throwOnUndefined) {
|
|
28
28
|
throw new Error("[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.");
|
|
29
29
|
}
|
|
30
30
|
return client;
|
|
@@ -1 +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\nexport interface UseLogRocketInstrumentationClientOptions {\n /**\n * Whether or not an exception should be thrown if the client hasn't been provided.\n */\n
|
|
1
|
+
{"version":3,"file":"react/LogRocketInstrumentationContext.js","sources":["webpack://@workleap/logrocket/./src/react/LogRocketInstrumentationContext.tsx"],"sourcesContent":["import { createContext, type PropsWithChildren, useContext } from \"react\";\nimport type { LogRocketInstrumentationClient } from \"../js/LogRocketInstrumentationClient.ts\";\n\nconst LogRocketInstrumentationContext = createContext<LogRocketInstrumentationClient | undefined>(undefined);\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketInstrumentationProviderProps extends PropsWithChildren {\n client: LogRocketInstrumentationClient;\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function LogRocketInstrumentationProvider(props: LogRocketInstrumentationProviderProps) {\n const {\n client,\n children\n } = props;\n\n return (\n <LogRocketInstrumentationContext.Provider value={client}>\n {children}\n </LogRocketInstrumentationContext.Provider>\n );\n}\n\nexport interface UseLogRocketInstrumentationClientOptions {\n /**\n * Whether or not an exception should be thrown if the client hasn't been provided.\n */\n throwOnUndefined?: boolean;\n}\n\nexport function useLogRocketInstrumentationClient(options?: { throwOnUndefined?: true }): LogRocketInstrumentationClient;\nexport function useLogRocketInstrumentationClient(options: { throwOnUndefined: false }): LogRocketInstrumentationClient | undefined;\n\n/**\n * Retrieve the LogRocket instrumentation client.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function useLogRocketInstrumentationClient(options: UseLogRocketInstrumentationClientOptions = {}) {\n const {\n throwOnUndefined = true\n } = options;\n\n const client = useContext(LogRocketInstrumentationContext);\n\n if (!client && throwOnUndefined) {\n throw new Error(\"[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.\");\n }\n\n return client;\n}\n"],"names":["createContext","useContext","LogRocketInstrumentationContext","undefined","LogRocketInstrumentationProvider","props","client","children","useLogRocketInstrumentationClient","options","throwOnUndefined","Error"],"mappings":";;;;;;;;;AAA0E;AAG1E,MAAME,gDAAkCF,aAAaA,CAA6CG;AASlG;;CAEC,GACM,SAASC,iCAAiCC,KAA4C;IACzF,MAAM,EACFC,MAAM,EACNC,QAAQ,EACX,GAAGF;IAEJ,qBACI,IAACH,gCAAgC,QAAQ;QAAC,OAAOI;kBAC5CC;;AAGb;AAYA;;;CAGC,GACM,SAASC,kCAAkCC,UAAoD,CAAC,CAAC;IACpG,MAAM,EACFC,mBAAmB,IAAI,EAC1B,GAAGD;IAEJ,MAAMH,SAASL,UAAUA,CAACC;IAE1B,IAAI,CAACI,UAAUI,kBAAkB;QAC7B,MAAM,IAAIC,MAAM;IACpB;IAEA,OAAOL;AACX"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workleap/logrocket",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.5",
|
|
5
5
|
"description": "A package containing utilities for LogRocket.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
|
31
31
|
"dist",
|
|
32
|
-
"CHANGELOG.md"
|
|
33
|
-
"README.md"
|
|
32
|
+
"CHANGELOG.md"
|
|
34
33
|
],
|
|
35
34
|
"peerDependencies": {
|
|
36
35
|
"logrocket": "^10.1.0",
|
|
@@ -46,21 +45,24 @@
|
|
|
46
45
|
}
|
|
47
46
|
},
|
|
48
47
|
"dependencies": {
|
|
49
|
-
"@workleap/logging": "^1.3.
|
|
48
|
+
"@workleap/logging": "^1.3.1",
|
|
50
49
|
"logrocket-fuzzy-search-sanitizer": "0.0.2",
|
|
51
|
-
"@workleap-telemetry/core": "1.0.
|
|
50
|
+
"@workleap-telemetry/core": "1.0.4"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@workleap/
|
|
60
|
-
"
|
|
61
|
-
"
|
|
53
|
+
"@eslint/js": "9.38.0",
|
|
54
|
+
"@rsbuild/core": "1.5.17",
|
|
55
|
+
"@rslib/core": "0.16.1",
|
|
56
|
+
"@types/react": "19.2.2",
|
|
57
|
+
"@typescript-eslint/parser": "8.46.2",
|
|
58
|
+
"@workleap/eslint-configs": "1.0.1",
|
|
59
|
+
"@workleap/rslib-configs": "1.1.3",
|
|
60
|
+
"@workleap/typescript-configs": "3.0.7",
|
|
61
|
+
"eslint": "9.38.0",
|
|
62
|
+
"happy-dom": "20.0.10",
|
|
62
63
|
"typescript": "5.9.3",
|
|
63
|
-
"
|
|
64
|
+
"typescript-eslint": "8.46.2",
|
|
65
|
+
"vitest": "4.0.4"
|
|
64
66
|
},
|
|
65
67
|
"sideEffects": false,
|
|
66
68
|
"scripts": {
|
|
@@ -19,5 +19,3 @@ export type LogRocketSdkOptionsTransformer = (options: LogRocketSdkOptions, cont
|
|
|
19
19
|
export function applyTransformers(options: LogRocketSdkOptions, transformers: LogRocketSdkOptionsTransformer[], context: LogRocketSdkOptionsTransformerContext): LogRocketSdkOptions {
|
|
20
20
|
return transformers.reduce((acc, transformer) => transformer(acc, context), options);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
package/src/js/index.ts
CHANGED
|
@@ -6,4 +6,3 @@ export type * from "./logRocketTypes.ts";
|
|
|
6
6
|
export { NoopLogRocketInstrumentationClient } from "./NoopLogRocketInstrumentationClient.ts";
|
|
7
7
|
export { registerLogRocketInstrumentation, type RegisterLogRocketInstrumentationOptions } from "./registerLogRocketInstrumentation.ts";
|
|
8
8
|
|
|
9
|
-
|
|
@@ -30,11 +30,11 @@ export interface UseLogRocketInstrumentationClientOptions {
|
|
|
30
30
|
/**
|
|
31
31
|
* Whether or not an exception should be thrown if the client hasn't been provided.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
throwOnUndefined?: boolean;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function useLogRocketInstrumentationClient(options?: {
|
|
37
|
-
export function useLogRocketInstrumentationClient(options: {
|
|
36
|
+
export function useLogRocketInstrumentationClient(options?: { throwOnUndefined?: true }): LogRocketInstrumentationClient;
|
|
37
|
+
export function useLogRocketInstrumentationClient(options: { throwOnUndefined: false }): LogRocketInstrumentationClient | undefined;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Retrieve the LogRocket instrumentation client.
|
|
@@ -42,12 +42,12 @@ export function useLogRocketInstrumentationClient(options: { dontThrowOnUndefine
|
|
|
42
42
|
*/
|
|
43
43
|
export function useLogRocketInstrumentationClient(options: UseLogRocketInstrumentationClientOptions = {}) {
|
|
44
44
|
const {
|
|
45
|
-
|
|
45
|
+
throwOnUndefined = true
|
|
46
46
|
} = options;
|
|
47
47
|
|
|
48
48
|
const client = useContext(LogRocketInstrumentationContext);
|
|
49
49
|
|
|
50
|
-
if (!client &&
|
|
50
|
+
if (!client && throwOnUndefined) {
|
|
51
51
|
throw new Error("[logrocket] The useLogRocketInstrumentationClient function is called before an LogRocketInstrumentationClient instance has been provided.");
|
|
52
52
|
}
|
|
53
53
|
|