@sentry/replay 7.93.0 → 7.94.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/cjs/index.js +83 -67
- package/cjs/index.js.map +1 -1
- package/esm/index.js +83 -67
- package/esm/index.js.map +1 -1
- package/package.json +8 -8
- package/types/constants.d.ts +0 -29
- package/types/constants.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/integration.d.ts +2 -0
- package/types/integration.d.ts.map +1 -1
- package/types/replay.d.ts +8 -0
- package/types/replay.d.ts.map +1 -1
- package/types/types/replay.d.ts +14 -5
- package/types/types/replay.d.ts.map +1 -1
- package/types/types/replayFrame.d.ts +1 -0
- package/types/types/replayFrame.d.ts.map +1 -1
- package/types/types/rrweb.d.ts +6 -1
- package/types/types/rrweb.d.ts.map +1 -1
- package/types/util/handleRecordingEmit.d.ts.map +1 -1
- package/types-ts3.8/constants.d.ts +0 -29
- package/types-ts3.8/index.d.ts +1 -1
- package/types-ts3.8/integration.d.ts +2 -0
- package/types-ts3.8/replay.d.ts +8 -0
- package/types-ts3.8/types/replay.d.ts +14 -5
- package/types-ts3.8/types/replayFrame.d.ts +1 -0
- package/types-ts3.8/types/rrweb.d.ts +6 -1
package/esm/index.js
CHANGED
|
@@ -53,36 +53,6 @@ const MIN_REPLAY_DURATION_LIMIT = 15000;
|
|
|
53
53
|
/** The max. length of a replay. */
|
|
54
54
|
const MAX_REPLAY_DURATION = 3600000; // 60 minutes in ms;
|
|
55
55
|
|
|
56
|
-
const CANVAS_QUALITY = {
|
|
57
|
-
low: {
|
|
58
|
-
sampling: {
|
|
59
|
-
canvas: 1,
|
|
60
|
-
},
|
|
61
|
-
dataURLOptions: {
|
|
62
|
-
type: 'image/webp',
|
|
63
|
-
quality: 0.25,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
medium: {
|
|
67
|
-
sampling: {
|
|
68
|
-
canvas: 2,
|
|
69
|
-
},
|
|
70
|
-
dataURLOptions: {
|
|
71
|
-
type: 'image/webp',
|
|
72
|
-
quality: 0.4,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
high: {
|
|
76
|
-
sampling: {
|
|
77
|
-
canvas: 4,
|
|
78
|
-
},
|
|
79
|
-
dataURLOptions: {
|
|
80
|
-
type: 'image/webp',
|
|
81
|
-
quality: 0.5,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
|
|
86
56
|
function _nullishCoalesce$1(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var NodeType$1;
|
|
87
57
|
(function (NodeType) {
|
|
88
58
|
NodeType[NodeType["Document"] = 0] = "Document";
|
|
@@ -506,18 +476,23 @@ function createMatchPredicate(className, selector) {
|
|
|
506
476
|
const el = node;
|
|
507
477
|
if (el === null)
|
|
508
478
|
return false;
|
|
509
|
-
|
|
510
|
-
if (
|
|
511
|
-
if (
|
|
479
|
+
try {
|
|
480
|
+
if (className) {
|
|
481
|
+
if (typeof className === 'string') {
|
|
482
|
+
if (el.matches(`.${className}`))
|
|
483
|
+
return true;
|
|
484
|
+
}
|
|
485
|
+
else if (elementClassMatchesRegex(el, className)) {
|
|
512
486
|
return true;
|
|
487
|
+
}
|
|
513
488
|
}
|
|
514
|
-
|
|
489
|
+
if (selector && el.matches(selector))
|
|
515
490
|
return true;
|
|
516
|
-
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
catch (e2) {
|
|
494
|
+
return false;
|
|
517
495
|
}
|
|
518
|
-
if (selector && el.matches(selector))
|
|
519
|
-
return true;
|
|
520
|
-
return false;
|
|
521
496
|
};
|
|
522
497
|
}
|
|
523
498
|
function needMaskingText(node, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText) {
|
|
@@ -3412,6 +3387,8 @@ class CanvasManagerNoop {
|
|
|
3412
3387
|
}
|
|
3413
3388
|
unlock() {
|
|
3414
3389
|
}
|
|
3390
|
+
snapshot() {
|
|
3391
|
+
}
|
|
3415
3392
|
}
|
|
3416
3393
|
|
|
3417
3394
|
class StylesheetManager {
|
|
@@ -3512,7 +3489,6 @@ function wrapEvent(e) {
|
|
|
3512
3489
|
eWithTime.timestamp = nowTimestamp();
|
|
3513
3490
|
return eWithTime;
|
|
3514
3491
|
}
|
|
3515
|
-
let _wrappedEmit;
|
|
3516
3492
|
let _takeFullSnapshot;
|
|
3517
3493
|
const mirror = createMirror();
|
|
3518
3494
|
function record(options = {}) {
|
|
@@ -3632,7 +3608,6 @@ function record(options = {}) {
|
|
|
3632
3608
|
}
|
|
3633
3609
|
}
|
|
3634
3610
|
};
|
|
3635
|
-
_wrappedEmit = wrappedEmit;
|
|
3636
3611
|
const wrappedMutationEmit = (m) => {
|
|
3637
3612
|
wrappedEmit(wrapEvent({
|
|
3638
3613
|
type: EventType.IncrementalSnapshot,
|
|
@@ -3686,6 +3661,15 @@ function record(options = {}) {
|
|
|
3686
3661
|
}
|
|
3687
3662
|
const processedNodeManager = new ProcessedNodeManager();
|
|
3688
3663
|
const canvasManager = _getCanvasManager(getCanvasManager, {
|
|
3664
|
+
mirror,
|
|
3665
|
+
win: window,
|
|
3666
|
+
mutationCb: (p) => wrappedEmit(wrapEvent({
|
|
3667
|
+
type: EventType.IncrementalSnapshot,
|
|
3668
|
+
data: {
|
|
3669
|
+
source: IncrementalSource.CanvasMutation,
|
|
3670
|
+
...p,
|
|
3671
|
+
},
|
|
3672
|
+
})),
|
|
3689
3673
|
recordCanvas,
|
|
3690
3674
|
blockClass,
|
|
3691
3675
|
blockSelector,
|
|
@@ -3972,29 +3956,18 @@ function takeFullSnapshot(isCheckout) {
|
|
|
3972
3956
|
}
|
|
3973
3957
|
_takeFullSnapshot(isCheckout);
|
|
3974
3958
|
}
|
|
3975
|
-
function wrappedEmit(e) {
|
|
3976
|
-
if (!_wrappedEmit) {
|
|
3977
|
-
return;
|
|
3978
|
-
}
|
|
3979
|
-
_wrappedEmit(e);
|
|
3980
|
-
}
|
|
3981
3959
|
record.mirror = mirror;
|
|
3982
3960
|
record.takeFullSnapshot = takeFullSnapshot;
|
|
3983
3961
|
function _getCanvasManager(getCanvasManagerFn, options) {
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
...p,
|
|
3994
|
-
},
|
|
3995
|
-
})),
|
|
3996
|
-
})
|
|
3997
|
-
: new CanvasManagerNoop();
|
|
3962
|
+
try {
|
|
3963
|
+
return getCanvasManagerFn
|
|
3964
|
+
? getCanvasManagerFn(options)
|
|
3965
|
+
: new CanvasManagerNoop();
|
|
3966
|
+
}
|
|
3967
|
+
catch (e2) {
|
|
3968
|
+
console.warn('Unable to initialize CanvasManager');
|
|
3969
|
+
return new CanvasManagerNoop();
|
|
3970
|
+
}
|
|
3998
3971
|
}
|
|
3999
3972
|
|
|
4000
3973
|
const ReplayEventTypeIncrementalSnapshot = 3;
|
|
@@ -7432,6 +7405,7 @@ function createOptionsEvent(replay) {
|
|
|
7432
7405
|
data: {
|
|
7433
7406
|
tag: 'options',
|
|
7434
7407
|
payload: {
|
|
7408
|
+
shouldRecordCanvas: replay.isRecordingCanvas(),
|
|
7435
7409
|
sessionSampleRate: options.sessionSampleRate,
|
|
7436
7410
|
errorSampleRate: options.errorSampleRate,
|
|
7437
7411
|
useCompressionOption: options.useCompression,
|
|
@@ -7895,6 +7869,10 @@ class ReplayContainer {
|
|
|
7895
7869
|
* Function to stop recording
|
|
7896
7870
|
*/
|
|
7897
7871
|
|
|
7872
|
+
/**
|
|
7873
|
+
* Internal use for canvas recording options
|
|
7874
|
+
*/
|
|
7875
|
+
|
|
7898
7876
|
constructor({
|
|
7899
7877
|
options,
|
|
7900
7878
|
recordingOptions,
|
|
@@ -7967,6 +7945,13 @@ class ReplayContainer {
|
|
|
7967
7945
|
return this._isPaused;
|
|
7968
7946
|
}
|
|
7969
7947
|
|
|
7948
|
+
/**
|
|
7949
|
+
* Determine if canvas recording is enabled
|
|
7950
|
+
*/
|
|
7951
|
+
isRecordingCanvas() {
|
|
7952
|
+
return Boolean(this._canvas);
|
|
7953
|
+
}
|
|
7954
|
+
|
|
7970
7955
|
/** Get the replay integration options. */
|
|
7971
7956
|
getOptions() {
|
|
7972
7957
|
return this._options;
|
|
@@ -8087,7 +8072,8 @@ class ReplayContainer {
|
|
|
8087
8072
|
*/
|
|
8088
8073
|
startRecording() {
|
|
8089
8074
|
try {
|
|
8090
|
-
const
|
|
8075
|
+
const canvasOptions = this._canvas;
|
|
8076
|
+
|
|
8091
8077
|
this._stopRecording = record({
|
|
8092
8078
|
...this._recordingOptions,
|
|
8093
8079
|
// When running in error sampling mode, we need to overwrite `checkoutEveryNms`
|
|
@@ -8096,12 +8082,14 @@ class ReplayContainer {
|
|
|
8096
8082
|
...(this.recordingMode === 'buffer' && { checkoutEveryNms: BUFFER_CHECKOUT_TIME }),
|
|
8097
8083
|
emit: getHandleRecordingEmit(this),
|
|
8098
8084
|
onMutation: this._onMutationHandler,
|
|
8099
|
-
...(
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8085
|
+
...(canvasOptions
|
|
8086
|
+
? {
|
|
8087
|
+
recordCanvas: canvasOptions.recordCanvas,
|
|
8088
|
+
getCanvasManager: canvasOptions.getCanvasManager,
|
|
8089
|
+
sampling: canvasOptions.sampling,
|
|
8090
|
+
dataURLOptions: canvasOptions.dataURLOptions,
|
|
8091
|
+
}
|
|
8092
|
+
: {}),
|
|
8105
8093
|
});
|
|
8106
8094
|
} catch (err) {
|
|
8107
8095
|
this._handleException(err);
|
|
@@ -9427,6 +9415,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
9427
9415
|
|
|
9428
9416
|
return this._replay.getSessionId();
|
|
9429
9417
|
}
|
|
9418
|
+
|
|
9430
9419
|
/**
|
|
9431
9420
|
* Initializes replay.
|
|
9432
9421
|
*/
|
|
@@ -9435,6 +9424,12 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
9435
9424
|
return;
|
|
9436
9425
|
}
|
|
9437
9426
|
|
|
9427
|
+
// We have to run this in _initialize, because this runs in setTimeout
|
|
9428
|
+
// So when this runs all integrations have been added
|
|
9429
|
+
// Before this, we cannot access integrations on the client,
|
|
9430
|
+
// so we need to mutate the options here
|
|
9431
|
+
this._maybeLoadFromReplayCanvasIntegration();
|
|
9432
|
+
|
|
9438
9433
|
this._replay.initializeSampling();
|
|
9439
9434
|
}
|
|
9440
9435
|
|
|
@@ -9448,6 +9443,27 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
9448
9443
|
recordingOptions: this._recordingOptions,
|
|
9449
9444
|
});
|
|
9450
9445
|
}
|
|
9446
|
+
|
|
9447
|
+
/** Get canvas options from ReplayCanvas integration, if it is also added. */
|
|
9448
|
+
_maybeLoadFromReplayCanvasIntegration() {
|
|
9449
|
+
// To save bundle size, we skip checking for stuff here
|
|
9450
|
+
// and instead just try-catch everything - as generally this should all be defined
|
|
9451
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
9452
|
+
try {
|
|
9453
|
+
const client = getClient();
|
|
9454
|
+
const canvasIntegration = client.getIntegrationByName('ReplayCanvas')
|
|
9455
|
+
|
|
9456
|
+
;
|
|
9457
|
+
if (!canvasIntegration) {
|
|
9458
|
+
return;
|
|
9459
|
+
}
|
|
9460
|
+
|
|
9461
|
+
this._replay['_canvas'] = canvasIntegration.getOptions();
|
|
9462
|
+
} catch (e) {
|
|
9463
|
+
// ignore errors here
|
|
9464
|
+
}
|
|
9465
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
9466
|
+
}
|
|
9451
9467
|
}Replay.__initStatic();
|
|
9452
9468
|
|
|
9453
9469
|
/** Parse Replay-related options from SDK options */
|