@sentry/replay 7.57.0 → 7.58.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 +29 -36
- package/cjs/index.js.map +1 -1
- package/esm/index.js +29 -36
- package/esm/index.js.map +1 -1
- package/package.json +5 -5
- package/types/constants.d.ts +0 -1
- package/types/constants.d.ts.map +1 -1
- package/types/coreHandlers/handleClick.d.ts +2 -3
- package/types/coreHandlers/handleClick.d.ts.map +1 -1
- package/types/coreHandlers/handleNetworkBreadcrumbs.d.ts.map +1 -1
- package/types/integration.d.ts +1 -1
- package/types/integration.d.ts.map +1 -1
- package/types/replay.d.ts.map +1 -1
- package/types/types/replay.d.ts +11 -4
- package/types/types/replay.d.ts.map +1 -1
- package/types/util/sendReplayRequest.d.ts.map +1 -1
package/esm/index.js
CHANGED
|
@@ -42,8 +42,6 @@ const CONSOLE_ARG_MAX_SIZE = 5000;
|
|
|
42
42
|
const SLOW_CLICK_THRESHOLD = 3000;
|
|
43
43
|
/* For scroll actions after a click, we only look for a very short time period to detect programmatic scrolling. */
|
|
44
44
|
const SLOW_CLICK_SCROLL_TIMEOUT = 300;
|
|
45
|
-
/* Clicks in this time period are considered e.g. double/triple clicks. */
|
|
46
|
-
const MULTI_CLICK_TIMEOUT = 1000;
|
|
47
45
|
|
|
48
46
|
/** When encountering a total segment size exceeding this size, stop the replay (as we cannot properly ingest it). */
|
|
49
47
|
const REPLAY_MAX_EVENT_BUFFER_SIZE = 20000000; // ~20MB
|
|
@@ -3396,7 +3394,6 @@ class ClickDetector {
|
|
|
3396
3394
|
) {ClickDetector.prototype.__init.call(this);ClickDetector.prototype.__init2.call(this);ClickDetector.prototype.__init3.call(this);
|
|
3397
3395
|
// We want everything in s, but options are in ms
|
|
3398
3396
|
this._timeout = slowClickConfig.timeout / 1000;
|
|
3399
|
-
this._multiClickTimeout = slowClickConfig.multiClickTimeout / 1000;
|
|
3400
3397
|
this._threshold = slowClickConfig.threshold / 1000;
|
|
3401
3398
|
this._scollTimeout = slowClickConfig.scrollTimeout / 1000;
|
|
3402
3399
|
this._replay = replay;
|
|
@@ -3471,13 +3468,6 @@ class ClickDetector {
|
|
|
3471
3468
|
return;
|
|
3472
3469
|
}
|
|
3473
3470
|
|
|
3474
|
-
const click = this._getClick(node);
|
|
3475
|
-
|
|
3476
|
-
if (click) {
|
|
3477
|
-
// this means a click on the same element was captured in the last 1s, so we consider this a multi click
|
|
3478
|
-
return;
|
|
3479
|
-
}
|
|
3480
|
-
|
|
3481
3471
|
const newClick = {
|
|
3482
3472
|
timestamp: breadcrumb.timestamp,
|
|
3483
3473
|
clickBreadcrumb: breadcrumb,
|
|
@@ -3495,22 +3485,14 @@ class ClickDetector {
|
|
|
3495
3485
|
|
|
3496
3486
|
/** Count multiple clicks on elements. */
|
|
3497
3487
|
_handleMultiClick(node) {
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
return;
|
|
3502
|
-
}
|
|
3503
|
-
|
|
3504
|
-
click.clickCount++;
|
|
3488
|
+
this._getClicks(node).forEach(click => {
|
|
3489
|
+
click.clickCount++;
|
|
3490
|
+
});
|
|
3505
3491
|
}
|
|
3506
3492
|
|
|
3507
|
-
/**
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
// Find any click on the same element in the last second
|
|
3512
|
-
// If one exists, we consider this click as a double/triple/etc click
|
|
3513
|
-
return this._clicks.find(click => click.node === node && now - click.timestamp < this._multiClickTimeout);
|
|
3493
|
+
/** Get all pending clicks for a given node. */
|
|
3494
|
+
_getClicks(node) {
|
|
3495
|
+
return this._clicks.filter(click => click.node === node);
|
|
3514
3496
|
}
|
|
3515
3497
|
|
|
3516
3498
|
/** Check the clicks that happened. */
|
|
@@ -3527,13 +3509,6 @@ class ClickDetector {
|
|
|
3527
3509
|
click.scrollAfter = click.timestamp <= this._lastScroll ? this._lastScroll - click.timestamp : undefined;
|
|
3528
3510
|
}
|
|
3529
3511
|
|
|
3530
|
-
// If an action happens after the multi click threshold, we can skip waiting and handle the click right away
|
|
3531
|
-
const actionTime = click.scrollAfter || click.mutationAfter || 0;
|
|
3532
|
-
if (actionTime && actionTime >= this._multiClickTimeout) {
|
|
3533
|
-
timedOutClicks.push(click);
|
|
3534
|
-
return;
|
|
3535
|
-
}
|
|
3536
|
-
|
|
3537
3512
|
if (click.timestamp + this._timeout <= now) {
|
|
3538
3513
|
timedOutClicks.push(click);
|
|
3539
3514
|
}
|
|
@@ -3614,6 +3589,10 @@ class ClickDetector {
|
|
|
3614
3589
|
|
|
3615
3590
|
/** Schedule to check current clicks. */
|
|
3616
3591
|
_scheduleCheckClicks() {
|
|
3592
|
+
if (this._checkClickTimeout) {
|
|
3593
|
+
clearTimeout(this._checkClickTimeout);
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3617
3596
|
this._checkClickTimeout = setTimeout(() => this._checkClicks(), 1000);
|
|
3618
3597
|
}
|
|
3619
3598
|
}
|
|
@@ -5754,7 +5733,8 @@ async function _prepareFetchData(
|
|
|
5754
5733
|
response_body_size: responseBodySize,
|
|
5755
5734
|
} = breadcrumb.data;
|
|
5756
5735
|
|
|
5757
|
-
const captureDetails =
|
|
5736
|
+
const captureDetails =
|
|
5737
|
+
urlMatches(url, options.networkDetailAllowUrls) && !urlMatches(url, options.networkDetailDenyUrls);
|
|
5758
5738
|
|
|
5759
5739
|
const request = captureDetails
|
|
5760
5740
|
? _getRequestInfo(options, hint.input, requestBodySize)
|
|
@@ -5968,7 +5948,7 @@ function _prepareXhrData(
|
|
|
5968
5948
|
return null;
|
|
5969
5949
|
}
|
|
5970
5950
|
|
|
5971
|
-
if (!urlMatches(url, options.networkDetailAllowUrls)) {
|
|
5951
|
+
if (!urlMatches(url, options.networkDetailAllowUrls) || urlMatches(url, options.networkDetailDenyUrls)) {
|
|
5972
5952
|
const request = buildSkippedNetworkRequestOrResponse(requestBodySize);
|
|
5973
5953
|
const response = buildSkippedNetworkRequestOrResponse(responseBodySize);
|
|
5974
5954
|
return {
|
|
@@ -6036,13 +6016,19 @@ function handleNetworkBreadcrumbs(replay) {
|
|
|
6036
6016
|
try {
|
|
6037
6017
|
const textEncoder = new TextEncoder();
|
|
6038
6018
|
|
|
6039
|
-
const {
|
|
6040
|
-
|
|
6019
|
+
const {
|
|
6020
|
+
networkDetailAllowUrls,
|
|
6021
|
+
networkDetailDenyUrls,
|
|
6022
|
+
networkCaptureBodies,
|
|
6023
|
+
networkRequestHeaders,
|
|
6024
|
+
networkResponseHeaders,
|
|
6025
|
+
} = replay.getOptions();
|
|
6041
6026
|
|
|
6042
6027
|
const options = {
|
|
6043
6028
|
replay,
|
|
6044
6029
|
textEncoder,
|
|
6045
6030
|
networkDetailAllowUrls,
|
|
6031
|
+
networkDetailDenyUrls,
|
|
6046
6032
|
networkCaptureBodies,
|
|
6047
6033
|
networkRequestHeaders,
|
|
6048
6034
|
networkResponseHeaders,
|
|
@@ -6849,6 +6835,12 @@ async function sendReplayRequest({
|
|
|
6849
6835
|
}
|
|
6850
6836
|
*/
|
|
6851
6837
|
|
|
6838
|
+
// Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to
|
|
6839
|
+
// sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may
|
|
6840
|
+
// have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid
|
|
6841
|
+
// of this `delete`, lest we miss putting it back in the next time the property is in use.)
|
|
6842
|
+
delete replayEvent.sdkProcessingMetadata;
|
|
6843
|
+
|
|
6852
6844
|
const envelope = createReplayEnvelope(replayEvent, preparedRecordingData, dsn, client.getOptions().tunnel);
|
|
6853
6845
|
|
|
6854
6846
|
let response;
|
|
@@ -7122,7 +7114,6 @@ class ReplayContainer {
|
|
|
7122
7114
|
timeout: slowClickTimeout,
|
|
7123
7115
|
scrollTimeout: SLOW_CLICK_SCROLL_TIMEOUT,
|
|
7124
7116
|
ignoreSelector: slowClickIgnoreSelectors ? slowClickIgnoreSelectors.join(',') : '',
|
|
7125
|
-
multiClickTimeout: MULTI_CLICK_TIMEOUT,
|
|
7126
7117
|
}
|
|
7127
7118
|
: undefined;
|
|
7128
7119
|
|
|
@@ -8262,6 +8253,7 @@ class Replay {
|
|
|
8262
8253
|
slowClickIgnoreSelectors = [],
|
|
8263
8254
|
|
|
8264
8255
|
networkDetailAllowUrls = [],
|
|
8256
|
+
networkDetailDenyUrls = [],
|
|
8265
8257
|
networkCaptureBodies = true,
|
|
8266
8258
|
networkRequestHeaders = [],
|
|
8267
8259
|
networkResponseHeaders = [],
|
|
@@ -8333,6 +8325,7 @@ class Replay {
|
|
|
8333
8325
|
slowClickTimeout,
|
|
8334
8326
|
slowClickIgnoreSelectors,
|
|
8335
8327
|
networkDetailAllowUrls,
|
|
8328
|
+
networkDetailDenyUrls,
|
|
8336
8329
|
networkCaptureBodies,
|
|
8337
8330
|
networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders),
|
|
8338
8331
|
networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders),
|