@sentry/replay 7.45.0 → 7.47.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 (38) hide show
  1. package/README.md +16 -4
  2. package/cjs/index.js +443 -211
  3. package/cjs/index.js.map +1 -1
  4. package/esm/index.js +444 -212
  5. package/esm/index.js.map +1 -1
  6. package/package.json +5 -5
  7. package/types/constants.d.ts +1 -0
  8. package/types/constants.d.ts.map +1 -1
  9. package/types/coreHandlers/handleFetch.d.ts +2 -2
  10. package/types/coreHandlers/handleFetch.d.ts.map +1 -1
  11. package/types/coreHandlers/handleHistory.d.ts.map +1 -1
  12. package/types/coreHandlers/handleNetworkBreadcrumbs.d.ts +5 -11
  13. package/types/coreHandlers/handleNetworkBreadcrumbs.d.ts.map +1 -1
  14. package/types/coreHandlers/handleXhr.d.ts +2 -2
  15. package/types/coreHandlers/handleXhr.d.ts.map +1 -1
  16. package/types/coreHandlers/{addBreadcrumbEvent.d.ts → util/addBreadcrumbEvent.d.ts} +1 -1
  17. package/types/coreHandlers/util/addBreadcrumbEvent.d.ts.map +1 -0
  18. package/types/coreHandlers/util/addNetworkBreadcrumb.d.ts +4 -0
  19. package/types/coreHandlers/util/addNetworkBreadcrumb.d.ts.map +1 -0
  20. package/types/coreHandlers/util/fetchUtils.d.ts +24 -0
  21. package/types/coreHandlers/util/fetchUtils.d.ts.map +1 -0
  22. package/types/coreHandlers/util/networkUtils.d.ts +15 -0
  23. package/types/coreHandlers/util/networkUtils.d.ts.map +1 -0
  24. package/types/coreHandlers/util/xhrUtils.d.ts +23 -0
  25. package/types/coreHandlers/util/xhrUtils.d.ts.map +1 -0
  26. package/types/replay.d.ts +2 -0
  27. package/types/replay.d.ts.map +1 -1
  28. package/types/types.d.ts +126 -5
  29. package/types/types.d.ts.map +1 -1
  30. package/types/util/addMemoryEntry.d.ts.map +1 -1
  31. package/types/util/createPerformanceEntries.d.ts +2 -2
  32. package/types/util/createPerformanceEntries.d.ts.map +1 -1
  33. package/types/util/createPerformanceSpans.d.ts +2 -2
  34. package/types/util/createPerformanceSpans.d.ts.map +1 -1
  35. package/types/util/sendReplayRequest.d.ts.map +1 -1
  36. package/types/coreHandlers/addBreadcrumbEvent.d.ts.map +0 -1
  37. package/types/coreHandlers/addNetworkBreadcrumb.d.ts +0 -4
  38. package/types/coreHandlers/addNetworkBreadcrumb.d.ts.map +0 -1
package/README.md CHANGED
@@ -60,6 +60,9 @@ If you do not want to start Replay immediately (e.g. if you want to lazy-load it
60
60
  you can also use `addIntegration` to load it later:
61
61
 
62
62
  ```js
63
+ import * as Sentry from "@sentry/react";
64
+ import { BrowserClient } from "@sentry/browser";
65
+
63
66
  Sentry.init({
64
67
  // Do not load it initially
65
68
  integrations: []
@@ -67,7 +70,10 @@ Sentry.init({
67
70
 
68
71
  // Sometime later
69
72
  const { Replay } = await import('@sentry/browser');
70
- getCurrentHub().getClient().addIntegration(new Replay());
73
+ const client = Sentry.getCurrentHub().getClient<BrowserClient>();
74
+
75
+ // Client can be undefined
76
+ client?.addIntegration(new Replay());
71
77
  ```
72
78
 
73
79
  ### Identifying Users
@@ -76,6 +82,7 @@ If you have only followed the above instructions to setup session replays, you w
76
82
 
77
83
  ```javascript
78
84
  import * as Sentry from "@sentry/browser";
85
+
79
86
  Sentry.setUser({ email: "jane.doe@example.com" });
80
87
  ```
81
88
 
@@ -84,17 +91,22 @@ Sentry.setUser({ email: "jane.doe@example.com" });
84
91
  Replay recording only starts when it is included in the `integrations` array when calling `Sentry.init` or calling `addIntegration` from the a Sentry client instance. To stop recording you can call the `stop()`.
85
92
 
86
93
  ```js
94
+ import * as Sentry from "@sentry/react";
95
+ import { BrowserClient } from "@sentry/browser";
96
+
87
97
  const replay = new Replay();
98
+
88
99
  Sentry.init({
89
100
  integrations: [replay]
90
101
  });
91
102
 
92
- const client = getClient();
103
+ const client = Sentry.getCurrentHub().getClient<BrowserClient>();
93
104
 
94
105
  // Add replay integration, will start recoring
95
- client.addIntegration(replay);
106
+ client?.addIntegration(replay);
96
107
 
97
- replay.stop(); // Stop recording
108
+ // Stop recording
109
+ replay.stop();
98
110
  ```
99
111
 
100
112
  ## Loading Replay as a CDN Bundle