@workleap/logrocket 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @workleap/logrocket
2
2
 
3
+ ## 2.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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.
8
+
3
9
  ## 2.1.3
4
10
 
5
11
  ### Patch Changes
@@ -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
- dontThrowOnUndefined?: boolean;
17
+ throwOnUndefined?: boolean;
18
18
  }
19
19
  export declare function useLogRocketInstrumentationClient(options?: {
20
- dontThrowOnUndefined?: false;
20
+ throwOnUndefined?: true;
21
21
  }): LogRocketInstrumentationClient;
22
22
  export declare function useLogRocketInstrumentationClient(options: {
23
- dontThrowOnUndefined: true;
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 { dontThrowOnUndefined = false } = options;
25
+ const { throwOnUndefined = true } = options;
26
26
  const client = useContext(LogRocketInstrumentationContext);
27
- if (!client && !dontThrowOnUndefined) {
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 dontThrowOnUndefined?: boolean;\n}\n\nexport function useLogRocketInstrumentationClient(options?: { dontThrowOnUndefined?: false }): LogRocketInstrumentationClient;\nexport function useLogRocketInstrumentationClient(options: { dontThrowOnUndefined: true }): 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 dontThrowOnUndefined = false\n } = options;\n\n const client = useContext(LogRocketInstrumentationContext);\n\n if (!client && !dontThrowOnUndefined) {\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","dontThrowOnUndefined","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,uBAAuB,KAAK,EAC/B,GAAGD;IAEJ,MAAMH,SAASL,UAAUA,CAACC;IAE1B,IAAI,CAACI,UAAU,CAACI,sBAAsB;QAClC,MAAM,IAAIC,MAAM;IACpB;IAEA,OAAOL;AACX"}
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.3",
4
+ "version": "2.1.4",
5
5
  "description": "A package containing utilities for LogRocket.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -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
- dontThrowOnUndefined?: boolean;
33
+ throwOnUndefined?: boolean;
34
34
  }
35
35
 
36
- export function useLogRocketInstrumentationClient(options?: { dontThrowOnUndefined?: false }): LogRocketInstrumentationClient;
37
- export function useLogRocketInstrumentationClient(options: { dontThrowOnUndefined: true }): LogRocketInstrumentationClient | undefined;
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
- dontThrowOnUndefined = false
45
+ throwOnUndefined = true
46
46
  } = options;
47
47
 
48
48
  const client = useContext(LogRocketInstrumentationContext);
49
49
 
50
- if (!client && !dontThrowOnUndefined) {
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