@sentry/replay 7.46.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.
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
package/cjs/index.js CHANGED
@@ -4071,7 +4071,7 @@ function addBreadcrumbEvent(replay, breadcrumb) {
4071
4071
  timestamp: (breadcrumb.timestamp || 0) * 1000,
4072
4072
  data: {
4073
4073
  tag: 'breadcrumb',
4074
- payload: breadcrumb,
4074
+ payload: utils.normalize(breadcrumb),
4075
4075
  },
4076
4076
  });
4077
4077
 
@@ -5500,7 +5500,6 @@ async function sendReplayRequest({
5500
5500
  }
5501
5501
 
5502
5502
  const baseEvent = {
5503
- // @ts-ignore private api
5504
5503
  type: REPLAY_EVENT_NAME,
5505
5504
  ...(includeReplayStartTimestamp ? { replay_start_timestamp: initialTimestamp / 1000 } : {}),
5506
5505
  timestamp: timestamp / 1000,