@sentry/replay 7.52.1 → 7.53.1
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 +11 -11
- package/cjs/index.js +78 -32
- package/cjs/index.js.map +1 -1
- package/esm/index.js +78 -32
- package/esm/index.js.map +1 -1
- package/package.json +5 -5
- package/types/integration.d.ts +1 -1
- package/types/integration.d.ts.map +1 -1
- package/types/replay.d.ts +8 -5
- package/types/replay.d.ts.map +1 -1
- package/types/types.d.ts +19 -1
- package/types/types.d.ts.map +1 -1
- package/types/util/addEvent.d.ts.map +1 -1
- package/types/util/handleRecordingEmit.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -195,17 +195,17 @@ The following options can be configured as options to the integration, in `new R
|
|
|
195
195
|
|
|
196
196
|
The following options can be configured as options to the integration, in `new Replay({})`:
|
|
197
197
|
|
|
198
|
-
| key | type | default | description
|
|
199
|
-
| ---------------- | ------------------------ |
|
|
200
|
-
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `
|
|
201
|
-
| maskAllInputs | boolean | `true` | Mask values of `<input>` elements. Passes input values through `maskInputFn` before sending to server.
|
|
202
|
-
| blockAllMedia | boolean | `true` | Block _all_ media elements (`img, svg, video, object, picture, embed, map, audio`)
|
|
203
|
-
|
|
|
204
|
-
| block | Array<string> | `.sentry-block, [data-sentry-block]` | Redact any elements that match the DOM selectors. See [privacy](#blocking) section for an example.
|
|
205
|
-
| unblock | Array<string> | `.sentry-unblock, [data-sentry-unblock]`| Do not redact any elements that match the DOM selectors. Useful when using `blockAllMedia`. See [privacy](#blocking) section for an example.
|
|
206
|
-
| mask | Array<string> | `.sentry-mask, [data-sentry-mask]` | Mask all elements that match the given DOM selectors. See [privacy](#masking) section for an example.
|
|
207
|
-
| unmask | Array<string> | `.sentry-unmask, [data-sentry-unmask]` | Unmask all elements that match the given DOM selectors. Useful when using `maskAllText`. See [privacy](#masking) section for an example.
|
|
208
|
-
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example.
|
|
198
|
+
| key | type | default | description |
|
|
199
|
+
| ---------------- | ------------------------ | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
200
|
+
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `maskFn` before sending to server. |
|
|
201
|
+
| maskAllInputs | boolean | `true` | Mask values of `<input>` elements. Passes input values through `maskInputFn` before sending to server. |
|
|
202
|
+
| blockAllMedia | boolean | `true` | Block _all_ media elements (`img, svg, video, object, picture, embed, map, audio`) |
|
|
203
|
+
| maskFn | (text: string) => string | `(text) => '*'.repeat(text.length)` | Function to customize how text content is masked before sending to server. By default, masks text with `*`. |
|
|
204
|
+
| block | Array<string> | `.sentry-block, [data-sentry-block]` | Redact any elements that match the DOM selectors. See [privacy](#blocking) section for an example. |
|
|
205
|
+
| unblock | Array<string> | `.sentry-unblock, [data-sentry-unblock]`| Do not redact any elements that match the DOM selectors. Useful when using `blockAllMedia`. See [privacy](#blocking) section for an example. |
|
|
206
|
+
| mask | Array<string> | `.sentry-mask, [data-sentry-mask]` | Mask all elements that match the given DOM selectors. See [privacy](#masking) section for an example. |
|
|
207
|
+
| unmask | Array<string> | `.sentry-unmask, [data-sentry-unmask]` | Unmask all elements that match the given DOM selectors. Useful when using `maskAllText`. See [privacy](#masking) section for an example. |
|
|
208
|
+
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example. |
|
|
209
209
|
|
|
210
210
|
#### Deprecated options
|
|
211
211
|
In order to streamline our privacy options, the following have been deprecated in favor for the respective options above.
|
package/cjs/index.js
CHANGED
|
@@ -3287,6 +3287,23 @@ var NodeType;
|
|
|
3287
3287
|
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
3288
3288
|
})(NodeType || (NodeType = {}));
|
|
3289
3289
|
|
|
3290
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3291
|
+
|
|
3292
|
+
var EventType; (function (EventType) {
|
|
3293
|
+
const DomContentLoaded = 0; EventType[EventType["DomContentLoaded"] = DomContentLoaded] = "DomContentLoaded";
|
|
3294
|
+
const Load = 1; EventType[EventType["Load"] = Load] = "Load";
|
|
3295
|
+
const FullSnapshot = 2; EventType[EventType["FullSnapshot"] = FullSnapshot] = "FullSnapshot";
|
|
3296
|
+
const IncrementalSnapshot = 3; EventType[EventType["IncrementalSnapshot"] = IncrementalSnapshot] = "IncrementalSnapshot";
|
|
3297
|
+
const Meta = 4; EventType[EventType["Meta"] = Meta] = "Meta";
|
|
3298
|
+
const Custom = 5; EventType[EventType["Custom"] = Custom] = "Custom";
|
|
3299
|
+
const Plugin = 6; EventType[EventType["Plugin"] = Plugin] = "Plugin";
|
|
3300
|
+
})(EventType || (EventType = {}));
|
|
3301
|
+
|
|
3302
|
+
/**
|
|
3303
|
+
* This is a partial copy of rrweb's eventWithTime type which only contains the properties
|
|
3304
|
+
* we specifcally need in the SDK.
|
|
3305
|
+
*/
|
|
3306
|
+
|
|
3290
3307
|
/**
|
|
3291
3308
|
* Converts a timestamp to ms, if it was in s, or keeps it as ms.
|
|
3292
3309
|
*/
|
|
@@ -3329,7 +3346,18 @@ async function addEvent(
|
|
|
3329
3346
|
replay.eventBuffer.clear();
|
|
3330
3347
|
}
|
|
3331
3348
|
|
|
3332
|
-
|
|
3349
|
+
const replayOptions = replay.getOptions();
|
|
3350
|
+
|
|
3351
|
+
const eventAfterPossibleCallback =
|
|
3352
|
+
typeof replayOptions.beforeAddRecordingEvent === 'function' && event.type === EventType.Custom
|
|
3353
|
+
? replayOptions.beforeAddRecordingEvent(event)
|
|
3354
|
+
: event;
|
|
3355
|
+
|
|
3356
|
+
if (!eventAfterPossibleCallback) {
|
|
3357
|
+
return;
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
return await replay.eventBuffer.addEvent(eventAfterPossibleCallback);
|
|
3333
3361
|
} catch (error) {
|
|
3334
3362
|
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.error(error);
|
|
3335
3363
|
await replay.stop('addEvent');
|
|
@@ -6305,23 +6333,6 @@ function debounce(func, wait, options) {
|
|
|
6305
6333
|
return debounced;
|
|
6306
6334
|
}
|
|
6307
6335
|
|
|
6308
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6309
|
-
|
|
6310
|
-
var EventType; (function (EventType) {
|
|
6311
|
-
const DomContentLoaded = 0; EventType[EventType["DomContentLoaded"] = DomContentLoaded] = "DomContentLoaded";
|
|
6312
|
-
const Load = 1; EventType[EventType["Load"] = Load] = "Load";
|
|
6313
|
-
const FullSnapshot = 2; EventType[EventType["FullSnapshot"] = FullSnapshot] = "FullSnapshot";
|
|
6314
|
-
const IncrementalSnapshot = 3; EventType[EventType["IncrementalSnapshot"] = IncrementalSnapshot] = "IncrementalSnapshot";
|
|
6315
|
-
const Meta = 4; EventType[EventType["Meta"] = Meta] = "Meta";
|
|
6316
|
-
const Custom = 5; EventType[EventType["Custom"] = Custom] = "Custom";
|
|
6317
|
-
const Plugin = 6; EventType[EventType["Plugin"] = Plugin] = "Plugin";
|
|
6318
|
-
})(EventType || (EventType = {}));
|
|
6319
|
-
|
|
6320
|
-
/**
|
|
6321
|
-
* This is a partial copy of rrweb's eventWithTime type which only contains the properties
|
|
6322
|
-
* we specifcally need in the SDK.
|
|
6323
|
-
*/
|
|
6324
|
-
|
|
6325
6336
|
/**
|
|
6326
6337
|
* Handler for recording events.
|
|
6327
6338
|
*
|
|
@@ -6395,6 +6406,30 @@ function getHandleRecordingEmit(replay) {
|
|
|
6395
6406
|
}
|
|
6396
6407
|
}
|
|
6397
6408
|
|
|
6409
|
+
const options = replay.getOptions();
|
|
6410
|
+
|
|
6411
|
+
// TODO: We want this as an experiment so that we can test
|
|
6412
|
+
// internally and create metrics before making this the default
|
|
6413
|
+
if (options._experiments.delayFlushOnCheckout) {
|
|
6414
|
+
// If the full snapshot is due to an initial load, we will not have
|
|
6415
|
+
// a previous session ID. In this case, we want to buffer events
|
|
6416
|
+
// for a set amount of time before flushing. This can help avoid
|
|
6417
|
+
// capturing replays of users that immediately close the window.
|
|
6418
|
+
setTimeout(() => replay.conditionalFlush(), options._experiments.delayFlushOnCheckout);
|
|
6419
|
+
|
|
6420
|
+
// Cancel any previously debounced flushes to ensure there are no [near]
|
|
6421
|
+
// simultaneous flushes happening. The latter request should be
|
|
6422
|
+
// insignificant in this case, so wait for additional user interaction to
|
|
6423
|
+
// trigger a new flush.
|
|
6424
|
+
//
|
|
6425
|
+
// This can happen because there's no guarantee that a recording event
|
|
6426
|
+
// happens first. e.g. a mouse click can happen and trigger a debounced
|
|
6427
|
+
// flush before the checkout.
|
|
6428
|
+
replay.cancelFlush();
|
|
6429
|
+
|
|
6430
|
+
return true;
|
|
6431
|
+
}
|
|
6432
|
+
|
|
6398
6433
|
// Flush immediately so that we do not miss the first segment, otherwise
|
|
6399
6434
|
// it can prevent loading on the UI. This will cause an increase in short
|
|
6400
6435
|
// replays (e.g. opening and closing a tab quickly), but these can be
|
|
@@ -7024,7 +7059,9 @@ class ReplayContainer {
|
|
|
7024
7059
|
this._debouncedFlush.cancel();
|
|
7025
7060
|
// See comment above re: `_isEnabled`, we "force" a flush, ignoring the
|
|
7026
7061
|
// `_isEnabled` state of the plugin since it was disabled above.
|
|
7027
|
-
|
|
7062
|
+
if (this.recordingMode === 'session') {
|
|
7063
|
+
await this._flush({ force: true });
|
|
7064
|
+
}
|
|
7028
7065
|
|
|
7029
7066
|
// After flush, destroy event buffer
|
|
7030
7067
|
this.eventBuffer && this.eventBuffer.destroy();
|
|
@@ -7160,7 +7197,17 @@ class ReplayContainer {
|
|
|
7160
7197
|
}
|
|
7161
7198
|
|
|
7162
7199
|
/**
|
|
7163
|
-
*
|
|
7200
|
+
* Only flush if `this.recordingMode === 'session'`
|
|
7201
|
+
*/
|
|
7202
|
+
conditionalFlush() {
|
|
7203
|
+
if (this.recordingMode === 'buffer') {
|
|
7204
|
+
return Promise.resolve();
|
|
7205
|
+
}
|
|
7206
|
+
|
|
7207
|
+
return this.flushImmediate();
|
|
7208
|
+
}
|
|
7209
|
+
|
|
7210
|
+
/**
|
|
7164
7211
|
* Always flush via `_debouncedFlush` so that we do not have flushes triggered
|
|
7165
7212
|
* from calling both `flush` and `_debouncedFlush`. Otherwise, there could be
|
|
7166
7213
|
* cases of mulitple flushes happening closely together.
|
|
@@ -7171,6 +7218,13 @@ class ReplayContainer {
|
|
|
7171
7218
|
return this._debouncedFlush.flush() ;
|
|
7172
7219
|
}
|
|
7173
7220
|
|
|
7221
|
+
/**
|
|
7222
|
+
* Cancels queued up flushes.
|
|
7223
|
+
*/
|
|
7224
|
+
cancelFlush() {
|
|
7225
|
+
this._debouncedFlush.cancel();
|
|
7226
|
+
}
|
|
7227
|
+
|
|
7174
7228
|
/** Get the current sesion (=replay) ID */
|
|
7175
7229
|
getSessionId() {
|
|
7176
7230
|
return this.session && this.session.id;
|
|
@@ -7420,7 +7474,7 @@ class ReplayContainer {
|
|
|
7420
7474
|
// Send replay when the page/tab becomes hidden. There is no reason to send
|
|
7421
7475
|
// replay if it becomes visible, since no actions we care about were done
|
|
7422
7476
|
// while it was hidden
|
|
7423
|
-
this.
|
|
7477
|
+
void this.conditionalFlush();
|
|
7424
7478
|
}
|
|
7425
7479
|
|
|
7426
7480
|
/**
|
|
@@ -7504,17 +7558,6 @@ class ReplayContainer {
|
|
|
7504
7558
|
return Promise.all(createPerformanceSpans(this, createPerformanceEntries(entries)));
|
|
7505
7559
|
}
|
|
7506
7560
|
|
|
7507
|
-
/**
|
|
7508
|
-
* Only flush if `this.recordingMode === 'session'`
|
|
7509
|
-
*/
|
|
7510
|
-
_conditionalFlush() {
|
|
7511
|
-
if (this.recordingMode === 'buffer') {
|
|
7512
|
-
return;
|
|
7513
|
-
}
|
|
7514
|
-
|
|
7515
|
-
void this.flushImmediate();
|
|
7516
|
-
}
|
|
7517
|
-
|
|
7518
7561
|
/**
|
|
7519
7562
|
* Clear _context
|
|
7520
7563
|
*/
|
|
@@ -7876,6 +7919,8 @@ class Replay {
|
|
|
7876
7919
|
ignore = [],
|
|
7877
7920
|
maskFn,
|
|
7878
7921
|
|
|
7922
|
+
beforeAddRecordingEvent,
|
|
7923
|
+
|
|
7879
7924
|
// eslint-disable-next-line deprecation/deprecation
|
|
7880
7925
|
blockClass,
|
|
7881
7926
|
// eslint-disable-next-line deprecation/deprecation
|
|
@@ -7933,6 +7978,7 @@ class Replay {
|
|
|
7933
7978
|
networkCaptureBodies,
|
|
7934
7979
|
networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders),
|
|
7935
7980
|
networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders),
|
|
7981
|
+
beforeAddRecordingEvent,
|
|
7936
7982
|
|
|
7937
7983
|
_experiments,
|
|
7938
7984
|
};
|