@sentry/replay 7.89.0 → 7.90.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/cjs/index.js +83 -24
- package/cjs/index.js.map +1 -1
- package/esm/index.js +83 -24
- package/esm/index.js.map +1 -1
- package/package.json +6 -6
- package/types/constants.d.ts +29 -0
- package/types/constants.d.ts.map +1 -1
- package/types/coreHandlers/handleGlobalEvent.d.ts.map +1 -1
- package/types/coreHandlers/handleNetworkBreadcrumbs.d.ts.map +1 -1
- package/types/coreHandlers/util/addBreadcrumbEvent.d.ts.map +1 -1
- package/types/coreHandlers/util/addFeedbackBreadcrumb.d.ts.map +1 -1
- package/types/eventBuffer/EventBufferCompressionWorker.d.ts.map +1 -1
- package/types/replay.d.ts.map +1 -1
- package/types/types/replay.d.ts +1 -3
- package/types/types/replay.d.ts.map +1 -1
- package/types/util/addEvent.d.ts.map +1 -1
- package/types/util/addGlobalListeners.d.ts.map +1 -1
- package/types/util/handleRecordingEmit.d.ts.map +1 -1
- package/types-ts3.8/constants.d.ts +29 -0
- package/types-ts3.8/types/replay.d.ts +1 -3
package/cjs/index.js
CHANGED
|
@@ -54,6 +54,36 @@ const MIN_REPLAY_DURATION_LIMIT = 15000;
|
|
|
54
54
|
/** The max. length of a replay. */
|
|
55
55
|
const MAX_REPLAY_DURATION = 3600000; // 60 minutes in ms;
|
|
56
56
|
|
|
57
|
+
const CANVAS_QUALITY = {
|
|
58
|
+
low: {
|
|
59
|
+
sampling: {
|
|
60
|
+
canvas: 1,
|
|
61
|
+
},
|
|
62
|
+
dataURLOptions: {
|
|
63
|
+
type: 'image/webp',
|
|
64
|
+
quality: 0.25,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
medium: {
|
|
68
|
+
sampling: {
|
|
69
|
+
canvas: 2,
|
|
70
|
+
},
|
|
71
|
+
dataURLOptions: {
|
|
72
|
+
type: 'image/webp',
|
|
73
|
+
quality: 0.4,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
high: {
|
|
77
|
+
sampling: {
|
|
78
|
+
canvas: 4,
|
|
79
|
+
},
|
|
80
|
+
dataURLOptions: {
|
|
81
|
+
type: 'image/webp',
|
|
82
|
+
quality: 0.5,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
57
87
|
var NodeType$1;
|
|
58
88
|
(function (NodeType) {
|
|
59
89
|
NodeType[NodeType["Document"] = 0] = "Document";
|
|
@@ -3916,7 +3946,9 @@ function addBreadcrumbEvent(replay, breadcrumb) {
|
|
|
3916
3946
|
}
|
|
3917
3947
|
|
|
3918
3948
|
replay.addUpdate(() => {
|
|
3919
|
-
|
|
3949
|
+
// This should never reject
|
|
3950
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3951
|
+
replay.throttledAddEvent({
|
|
3920
3952
|
type: EventType.Custom,
|
|
3921
3953
|
// TODO: We were converting from ms to seconds for breadcrumbs, spans,
|
|
3922
3954
|
// but maybe we should just keep them as milliseconds
|
|
@@ -5030,7 +5062,9 @@ class EventBufferCompressionWorker {
|
|
|
5030
5062
|
this.hasCheckout = false;
|
|
5031
5063
|
|
|
5032
5064
|
// We do not wait on this, as we assume the order of messages is consistent for the worker
|
|
5033
|
-
|
|
5065
|
+
this._worker.postMessage('clear').then(null, e => {
|
|
5066
|
+
DEBUG_BUILD && utils.logger.warn('[Replay] Sending "clear" message to worker failed', e);
|
|
5067
|
+
});
|
|
5034
5068
|
}
|
|
5035
5069
|
|
|
5036
5070
|
/** @inheritdoc */
|
|
@@ -5466,7 +5500,9 @@ function addEventSync(replay, event, isCheckout) {
|
|
|
5466
5500
|
return false;
|
|
5467
5501
|
}
|
|
5468
5502
|
|
|
5469
|
-
|
|
5503
|
+
// This should never reject
|
|
5504
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5505
|
+
_addEvent(replay, event, isCheckout);
|
|
5470
5506
|
|
|
5471
5507
|
return true;
|
|
5472
5508
|
}
|
|
@@ -5663,7 +5699,9 @@ function handleErrorEvent(replay, event) {
|
|
|
5663
5699
|
|
|
5664
5700
|
setTimeout(() => {
|
|
5665
5701
|
// Capture current event buffer as new replay
|
|
5666
|
-
|
|
5702
|
+
// This should never reject
|
|
5703
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5704
|
+
replay.sendBufferedReplayOrFlush();
|
|
5667
5705
|
});
|
|
5668
5706
|
}
|
|
5669
5707
|
|
|
@@ -5707,8 +5745,9 @@ function handleHydrationError(replay, event) {
|
|
|
5707
5745
|
// Example https://reactjs.org/docs/error-decoder.html?invariant=423
|
|
5708
5746
|
exceptionValue.match(/reactjs\.org\/docs\/error-decoder\.html\?invariant=(418|419|422|423|425)/) ||
|
|
5709
5747
|
// Development builds of react-dom
|
|
5710
|
-
//
|
|
5711
|
-
|
|
5748
|
+
// Error 1: Hydration failed because the initial UI does not match what was rendered on the server.
|
|
5749
|
+
// Error 2: Text content does not match server-rendered HTML. Warning: Text content did not match.
|
|
5750
|
+
exceptionValue.match(/(does not match server-rendered HTML|Hydration failed because)/i)
|
|
5712
5751
|
) {
|
|
5713
5752
|
const breadcrumb = createBreadcrumb({
|
|
5714
5753
|
category: 'replay.hydrate-error',
|
|
@@ -5745,7 +5784,9 @@ function addFeedbackBreadcrumb(replay, event) {
|
|
|
5745
5784
|
return true;
|
|
5746
5785
|
}
|
|
5747
5786
|
|
|
5748
|
-
|
|
5787
|
+
// This should never reject
|
|
5788
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5789
|
+
replay.throttledAddEvent({
|
|
5749
5790
|
type: EventType.Custom,
|
|
5750
5791
|
timestamp: event.timestamp * 1000,
|
|
5751
5792
|
data: {
|
|
@@ -5823,7 +5864,9 @@ function handleGlobalEventListener(
|
|
|
5823
5864
|
}
|
|
5824
5865
|
|
|
5825
5866
|
if (isFeedbackEvent(event)) {
|
|
5826
|
-
|
|
5867
|
+
// This should never reject
|
|
5868
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
5869
|
+
replay.flush();
|
|
5827
5870
|
event.contexts.feedback.replay_id = replay.getSessionId();
|
|
5828
5871
|
// Add a replay breadcrumb for this piece of feedback
|
|
5829
5872
|
addFeedbackBreadcrumb(replay, event);
|
|
@@ -6877,7 +6920,9 @@ function beforeAddNetworkBreadcrumb(
|
|
|
6877
6920
|
// So any async mutations to it will not be reflected in the final breadcrumb
|
|
6878
6921
|
enrichXhrBreadcrumb(breadcrumb, hint, options);
|
|
6879
6922
|
|
|
6880
|
-
|
|
6923
|
+
// This call should not reject
|
|
6924
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6925
|
+
captureXhrBreadcrumbToReplay(breadcrumb, hint, options);
|
|
6881
6926
|
}
|
|
6882
6927
|
|
|
6883
6928
|
if (_isFetchBreadcrumb(breadcrumb) && _isFetchHint(hint)) {
|
|
@@ -6886,7 +6931,9 @@ function beforeAddNetworkBreadcrumb(
|
|
|
6886
6931
|
// So any async mutations to it will not be reflected in the final breadcrumb
|
|
6887
6932
|
enrichFetchBreadcrumb(breadcrumb, hint, options);
|
|
6888
6933
|
|
|
6889
|
-
|
|
6934
|
+
// This call should not reject
|
|
6935
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6936
|
+
captureFetchBreadcrumbToReplay(breadcrumb, hint, options);
|
|
6890
6937
|
}
|
|
6891
6938
|
} catch (e) {
|
|
6892
6939
|
DEBUG_BUILD && utils.logger.warn('Error when enriching network breadcrumb');
|
|
@@ -7069,7 +7116,9 @@ function addGlobalListeners(replay) {
|
|
|
7069
7116
|
client.on('beforeSendFeedback', (feedbackEvent, options) => {
|
|
7070
7117
|
const replayId = replay.getSessionId();
|
|
7071
7118
|
if (options && options.includeReplay && replay.isEnabled() && replayId) {
|
|
7072
|
-
|
|
7119
|
+
// This should never reject
|
|
7120
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
7121
|
+
replay.flush();
|
|
7073
7122
|
if (feedbackEvent.contexts && feedbackEvent.contexts.feedback) {
|
|
7074
7123
|
feedbackEvent.contexts.feedback.replay_id = replayId;
|
|
7075
7124
|
}
|
|
@@ -7275,6 +7324,9 @@ function getHandleRecordingEmit(replay) {
|
|
|
7275
7324
|
// a previous session ID. In this case, we want to buffer events
|
|
7276
7325
|
// for a set amount of time before flushing. This can help avoid
|
|
7277
7326
|
// capturing replays of users that immediately close the window.
|
|
7327
|
+
|
|
7328
|
+
// This should never reject
|
|
7329
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
7278
7330
|
void replay.flush();
|
|
7279
7331
|
}
|
|
7280
7332
|
|
|
@@ -7957,15 +8009,12 @@ class ReplayContainer {
|
|
|
7957
8009
|
...(this.recordingMode === 'buffer' && { checkoutEveryNms: BUFFER_CHECKOUT_TIME }),
|
|
7958
8010
|
emit: getHandleRecordingEmit(this),
|
|
7959
8011
|
onMutation: this._onMutationHandler,
|
|
7960
|
-
...(canvas &&
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
},
|
|
7967
|
-
getCanvasManager: canvas.manager,
|
|
7968
|
-
}),
|
|
8012
|
+
...(canvas &&
|
|
8013
|
+
canvas.manager && {
|
|
8014
|
+
recordCanvas: true,
|
|
8015
|
+
getCanvasManager: canvas.manager,
|
|
8016
|
+
...(CANVAS_QUALITY[canvas.quality || 'medium'] || CANVAS_QUALITY.medium),
|
|
8017
|
+
}),
|
|
7969
8018
|
});
|
|
7970
8019
|
} catch (err) {
|
|
7971
8020
|
this._handleException(err);
|
|
@@ -8405,7 +8454,9 @@ class ReplayContainer {
|
|
|
8405
8454
|
maxReplayDuration: this._options.maxReplayDuration,
|
|
8406
8455
|
})
|
|
8407
8456
|
) {
|
|
8408
|
-
|
|
8457
|
+
// This should never reject
|
|
8458
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8459
|
+
this._refreshSession(currentSession);
|
|
8409
8460
|
return false;
|
|
8410
8461
|
}
|
|
8411
8462
|
|
|
@@ -8544,6 +8595,8 @@ class ReplayContainer {
|
|
|
8544
8595
|
// Send replay when the page/tab becomes hidden. There is no reason to send
|
|
8545
8596
|
// replay if it becomes visible, since no actions we care about were done
|
|
8546
8597
|
// while it was hidden
|
|
8598
|
+
// This should never reject
|
|
8599
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8547
8600
|
void this.conditionalFlush();
|
|
8548
8601
|
}
|
|
8549
8602
|
|
|
@@ -8592,7 +8645,9 @@ class ReplayContainer {
|
|
|
8592
8645
|
*/
|
|
8593
8646
|
_createCustomBreadcrumb(breadcrumb) {
|
|
8594
8647
|
this.addUpdate(() => {
|
|
8595
|
-
|
|
8648
|
+
// This should never reject
|
|
8649
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8650
|
+
this.throttledAddEvent({
|
|
8596
8651
|
type: EventType.Custom,
|
|
8597
8652
|
timestamp: breadcrumb.timestamp || 0,
|
|
8598
8653
|
data: {
|
|
@@ -8733,7 +8788,9 @@ class ReplayContainer {
|
|
|
8733
8788
|
// This means we retried 3 times and all of them failed,
|
|
8734
8789
|
// or we ran into a problem we don't want to retry, like rate limiting.
|
|
8735
8790
|
// In this case, we want to completely stop the replay - otherwise, we may get inconsistent segments
|
|
8736
|
-
|
|
8791
|
+
// This should never reject
|
|
8792
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8793
|
+
this.stop({ reason: 'sendReplay' });
|
|
8737
8794
|
|
|
8738
8795
|
const client = core.getClient();
|
|
8739
8796
|
|
|
@@ -8852,7 +8909,9 @@ class ReplayContainer {
|
|
|
8852
8909
|
|
|
8853
8910
|
// Stop replay if over the mutation limit
|
|
8854
8911
|
if (overMutationLimit) {
|
|
8855
|
-
|
|
8912
|
+
// This should never reject
|
|
8913
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8914
|
+
this.stop({ reason: 'mutationLimit', forceFlush: this.recordingMode === 'session' });
|
|
8856
8915
|
return false;
|
|
8857
8916
|
}
|
|
8858
8917
|
|