@sentry/replay 7.92.0 → 7.94.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 +241 -130
- package/cjs/index.js.map +1 -1
- package/esm/index.js +238 -131
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _nullishCoalesce, _optionalChain } from '@sentry/utils';
|
|
2
|
+
import { addBreadcrumb, getClient, isSentryRequestUrl, getCurrentScope, addEventProcessor, prepareEvent, getIsolationScope, setContext, captureException, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
|
|
2
3
|
import { GLOBAL_OBJ, normalize, fill, htmlTreeAsString, browserPerformanceTimeOrigin, logger, uuid4, SENTRY_XHR_DATA_KEY, dropUndefinedKeys, stringMatchesSomePattern, addFetchInstrumentationHandler, addXhrInstrumentationHandler, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, updateRateLimits, isRateLimited, consoleSandbox, isBrowser } from '@sentry/utils';
|
|
3
4
|
import { addPerformanceInstrumentationHandler, addLcpInstrumentationHandler } from '@sentry-internal/tracing';
|
|
4
5
|
|
|
@@ -52,37 +53,7 @@ const MIN_REPLAY_DURATION_LIMIT = 15000;
|
|
|
52
53
|
/** The max. length of a replay. */
|
|
53
54
|
const MAX_REPLAY_DURATION = 3600000; // 60 minutes in ms;
|
|
54
55
|
|
|
55
|
-
const
|
|
56
|
-
low: {
|
|
57
|
-
sampling: {
|
|
58
|
-
canvas: 1,
|
|
59
|
-
},
|
|
60
|
-
dataURLOptions: {
|
|
61
|
-
type: 'image/webp',
|
|
62
|
-
quality: 0.25,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
medium: {
|
|
66
|
-
sampling: {
|
|
67
|
-
canvas: 2,
|
|
68
|
-
},
|
|
69
|
-
dataURLOptions: {
|
|
70
|
-
type: 'image/webp',
|
|
71
|
-
quality: 0.4,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
high: {
|
|
75
|
-
sampling: {
|
|
76
|
-
canvas: 4,
|
|
77
|
-
},
|
|
78
|
-
dataURLOptions: {
|
|
79
|
-
type: 'image/webp',
|
|
80
|
-
quality: 0.5,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
var NodeType$1;
|
|
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;
|
|
86
57
|
(function (NodeType) {
|
|
87
58
|
NodeType[NodeType["Document"] = 0] = "Document";
|
|
88
59
|
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
@@ -96,8 +67,8 @@ function isElement$1(n) {
|
|
|
96
67
|
return n.nodeType === n.ELEMENT_NODE;
|
|
97
68
|
}
|
|
98
69
|
function isShadowRoot(n) {
|
|
99
|
-
const host = n
|
|
100
|
-
return Boolean((host
|
|
70
|
+
const host = _optionalChain$5([n, 'optionalAccess', _ => _.host]);
|
|
71
|
+
return Boolean(_optionalChain$5([host, 'optionalAccess', _2 => _2.shadowRoot]) === n);
|
|
101
72
|
}
|
|
102
73
|
function isNativeShadowDom(shadowRoot) {
|
|
103
74
|
return Object.prototype.toString.call(shadowRoot) === '[object ShadowRoot]';
|
|
@@ -171,11 +142,10 @@ class Mirror {
|
|
|
171
142
|
this.nodeMetaMap = new WeakMap();
|
|
172
143
|
}
|
|
173
144
|
getId(n) {
|
|
174
|
-
var _a;
|
|
175
145
|
if (!n)
|
|
176
146
|
return -1;
|
|
177
|
-
const id = (
|
|
178
|
-
return id
|
|
147
|
+
const id = _optionalChain$5([this, 'access', _3 => _3.getMeta, 'call', _4 => _4(n), 'optionalAccess', _5 => _5.id]);
|
|
148
|
+
return _nullishCoalesce$1(id, () => ( -1));
|
|
179
149
|
}
|
|
180
150
|
getNode(id) {
|
|
181
151
|
return this.idNodeMap.get(id) || null;
|
|
@@ -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) {
|
|
@@ -697,7 +672,6 @@ function getRootId(doc, mirror) {
|
|
|
697
672
|
return docId === 1 ? undefined : docId;
|
|
698
673
|
}
|
|
699
674
|
function serializeTextNode(n, options) {
|
|
700
|
-
var _a;
|
|
701
675
|
const { maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, maskTextFn, maskInputOptions, maskInputFn, rootId, } = options;
|
|
702
676
|
const parentTagName = n.parentNode && n.parentNode.tagName;
|
|
703
677
|
let textContent = n.textContent;
|
|
@@ -708,7 +682,7 @@ function serializeTextNode(n, options) {
|
|
|
708
682
|
try {
|
|
709
683
|
if (n.nextSibling || n.previousSibling) {
|
|
710
684
|
}
|
|
711
|
-
else if ((
|
|
685
|
+
else if (_optionalChain$5([n, 'access', _6 => _6.parentNode, 'access', _7 => _7.sheet, 'optionalAccess', _8 => _8.cssRules])) {
|
|
712
686
|
textContent = stringifyStylesheet(n.parentNode.sheet);
|
|
713
687
|
}
|
|
714
688
|
}
|
|
@@ -1261,6 +1235,7 @@ function snapshot(n, options) {
|
|
|
1261
1235
|
});
|
|
1262
1236
|
}
|
|
1263
1237
|
|
|
1238
|
+
function _optionalChain$4(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; }
|
|
1264
1239
|
function on(type, fn, target = document) {
|
|
1265
1240
|
const options = { capture: true, passive: true };
|
|
1266
1241
|
target.addEventListener(type, fn, options);
|
|
@@ -1367,7 +1342,7 @@ function patch(source, name, replacement) {
|
|
|
1367
1342
|
source[name] = original;
|
|
1368
1343
|
};
|
|
1369
1344
|
}
|
|
1370
|
-
catch (
|
|
1345
|
+
catch (e2) {
|
|
1371
1346
|
return () => {
|
|
1372
1347
|
};
|
|
1373
1348
|
}
|
|
@@ -1377,24 +1352,23 @@ if (!(/[1-9][0-9]{12}/.test(Date.now().toString()))) {
|
|
|
1377
1352
|
nowTimestamp = () => new Date().getTime();
|
|
1378
1353
|
}
|
|
1379
1354
|
function getWindowScroll(win) {
|
|
1380
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1381
1355
|
const doc = win.document;
|
|
1382
1356
|
return {
|
|
1383
1357
|
left: doc.scrollingElement
|
|
1384
1358
|
? doc.scrollingElement.scrollLeft
|
|
1385
1359
|
: win.pageXOffset !== undefined
|
|
1386
1360
|
? win.pageXOffset
|
|
1387
|
-
: (doc
|
|
1388
|
-
(
|
|
1389
|
-
(
|
|
1361
|
+
: _optionalChain$4([doc, 'optionalAccess', _ => _.documentElement, 'access', _2 => _2.scrollLeft]) ||
|
|
1362
|
+
_optionalChain$4([doc, 'optionalAccess', _3 => _3.body, 'optionalAccess', _4 => _4.parentElement, 'optionalAccess', _5 => _5.scrollLeft]) ||
|
|
1363
|
+
_optionalChain$4([doc, 'optionalAccess', _6 => _6.body, 'optionalAccess', _7 => _7.scrollLeft]) ||
|
|
1390
1364
|
0,
|
|
1391
1365
|
top: doc.scrollingElement
|
|
1392
1366
|
? doc.scrollingElement.scrollTop
|
|
1393
1367
|
: win.pageYOffset !== undefined
|
|
1394
1368
|
? win.pageYOffset
|
|
1395
|
-
: (doc
|
|
1396
|
-
(
|
|
1397
|
-
(
|
|
1369
|
+
: _optionalChain$4([doc, 'optionalAccess', _8 => _8.documentElement, 'access', _9 => _9.scrollTop]) ||
|
|
1370
|
+
_optionalChain$4([doc, 'optionalAccess', _10 => _10.body, 'optionalAccess', _11 => _11.parentElement, 'optionalAccess', _12 => _12.scrollTop]) ||
|
|
1371
|
+
_optionalChain$4([doc, 'optionalAccess', _13 => _13.body, 'optionalAccess', _14 => _14.scrollTop]) ||
|
|
1398
1372
|
0,
|
|
1399
1373
|
};
|
|
1400
1374
|
}
|
|
@@ -1496,7 +1470,7 @@ function isSerializedStylesheet(n, mirror) {
|
|
|
1496
1470
|
mirror.getMeta(n));
|
|
1497
1471
|
}
|
|
1498
1472
|
function hasShadowRoot(n) {
|
|
1499
|
-
return Boolean(n
|
|
1473
|
+
return Boolean(_optionalChain$4([n, 'optionalAccess', _18 => _18.shadowRoot]));
|
|
1500
1474
|
}
|
|
1501
1475
|
class StyleSheetMirror {
|
|
1502
1476
|
constructor() {
|
|
@@ -1505,8 +1479,7 @@ class StyleSheetMirror {
|
|
|
1505
1479
|
this.idStyleMap = new Map();
|
|
1506
1480
|
}
|
|
1507
1481
|
getId(stylesheet) {
|
|
1508
|
-
|
|
1509
|
-
return (_a = this.styleIDMap.get(stylesheet)) !== null && _a !== void 0 ? _a : -1;
|
|
1482
|
+
return _nullishCoalesce(this.styleIDMap.get(stylesheet), () => ( -1));
|
|
1510
1483
|
}
|
|
1511
1484
|
has(stylesheet) {
|
|
1512
1485
|
return this.styleIDMap.has(stylesheet);
|
|
@@ -1537,9 +1510,8 @@ class StyleSheetMirror {
|
|
|
1537
1510
|
}
|
|
1538
1511
|
}
|
|
1539
1512
|
function getShadowHost(n) {
|
|
1540
|
-
var _a, _b;
|
|
1541
1513
|
let shadowHost = null;
|
|
1542
|
-
if ((
|
|
1514
|
+
if (_optionalChain$4([n, 'access', _19 => _19.getRootNode, 'optionalCall', _20 => _20(), 'optionalAccess', _21 => _21.nodeType]) === Node.DOCUMENT_FRAGMENT_NODE &&
|
|
1543
1515
|
n.getRootNode().host)
|
|
1544
1516
|
shadowHost = n.getRootNode().host;
|
|
1545
1517
|
return shadowHost;
|
|
@@ -1564,6 +1536,34 @@ function inDom(n) {
|
|
|
1564
1536
|
return false;
|
|
1565
1537
|
return doc.contains(n) || shadowHostInDom(n);
|
|
1566
1538
|
}
|
|
1539
|
+
let cachedRequestAnimationFrameImplementation;
|
|
1540
|
+
function getRequestAnimationFrameImplementation() {
|
|
1541
|
+
if (cachedRequestAnimationFrameImplementation) {
|
|
1542
|
+
return cachedRequestAnimationFrameImplementation;
|
|
1543
|
+
}
|
|
1544
|
+
const document = window.document;
|
|
1545
|
+
let requestAnimationFrameImplementation = window.requestAnimationFrame;
|
|
1546
|
+
if (document && typeof document.createElement === 'function') {
|
|
1547
|
+
try {
|
|
1548
|
+
const sandbox = document.createElement('iframe');
|
|
1549
|
+
sandbox.hidden = true;
|
|
1550
|
+
document.head.appendChild(sandbox);
|
|
1551
|
+
const contentWindow = sandbox.contentWindow;
|
|
1552
|
+
if (contentWindow && contentWindow.requestAnimationFrame) {
|
|
1553
|
+
requestAnimationFrameImplementation =
|
|
1554
|
+
contentWindow.requestAnimationFrame;
|
|
1555
|
+
}
|
|
1556
|
+
document.head.removeChild(sandbox);
|
|
1557
|
+
}
|
|
1558
|
+
catch (e) {
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
return (cachedRequestAnimationFrameImplementation =
|
|
1562
|
+
requestAnimationFrameImplementation.bind(window));
|
|
1563
|
+
}
|
|
1564
|
+
function onRequestAnimationFrame(...rest) {
|
|
1565
|
+
return getRequestAnimationFrameImplementation()(...rest);
|
|
1566
|
+
}
|
|
1567
1567
|
|
|
1568
1568
|
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
1569
1569
|
EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
@@ -1616,6 +1616,7 @@ var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
|
|
|
1616
1616
|
return PointerTypes2;
|
|
1617
1617
|
})(PointerTypes || {});
|
|
1618
1618
|
|
|
1619
|
+
function _optionalChain$3(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; }
|
|
1619
1620
|
function isNodeInLinkedList(n) {
|
|
1620
1621
|
return '__ln' in n;
|
|
1621
1622
|
}
|
|
@@ -1631,7 +1632,7 @@ class DoubleLinkedList {
|
|
|
1631
1632
|
}
|
|
1632
1633
|
let current = this.head;
|
|
1633
1634
|
for (let index = 0; index < position; index++) {
|
|
1634
|
-
current = (current
|
|
1635
|
+
current = _optionalChain$3([current, 'optionalAccess', _ => _.next]) || null;
|
|
1635
1636
|
}
|
|
1636
1637
|
return current;
|
|
1637
1638
|
}
|
|
@@ -2218,6 +2219,7 @@ const callbackWrapper = (cb) => {
|
|
|
2218
2219
|
return rrwebWrapped;
|
|
2219
2220
|
};
|
|
2220
2221
|
|
|
2222
|
+
function _optionalChain$2(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; }
|
|
2221
2223
|
const mutationBuffers = [];
|
|
2222
2224
|
function getEventTarget(event) {
|
|
2223
2225
|
try {
|
|
@@ -2231,18 +2233,17 @@ function getEventTarget(event) {
|
|
|
2231
2233
|
return event.path[0];
|
|
2232
2234
|
}
|
|
2233
2235
|
}
|
|
2234
|
-
catch (
|
|
2236
|
+
catch (e2) {
|
|
2235
2237
|
}
|
|
2236
2238
|
return event && event.target;
|
|
2237
2239
|
}
|
|
2238
2240
|
function initMutationObserver(options, rootEl) {
|
|
2239
|
-
var _a, _b;
|
|
2240
2241
|
const mutationBuffer = new MutationBuffer();
|
|
2241
2242
|
mutationBuffers.push(mutationBuffer);
|
|
2242
2243
|
mutationBuffer.init(options);
|
|
2243
2244
|
let mutationObserverCtor = window.MutationObserver ||
|
|
2244
2245
|
window.__rrMutationObserver;
|
|
2245
|
-
const angularZoneSymbol = (
|
|
2246
|
+
const angularZoneSymbol = _optionalChain$2([window, 'optionalAccess', _ => _.Zone, 'optionalAccess', _2 => _2.__symbol__, 'optionalCall', _3 => _3('MutationObserver')]);
|
|
2246
2247
|
if (angularZoneSymbol &&
|
|
2247
2248
|
window[angularZoneSymbol]) {
|
|
2248
2249
|
mutationObserverCtor = window[angularZoneSymbol];
|
|
@@ -2377,7 +2378,13 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror, blockCl
|
|
|
2377
2378
|
}
|
|
2378
2379
|
const id = mirror.getId(target);
|
|
2379
2380
|
const { clientX, clientY } = e;
|
|
2380
|
-
callbackWrapper(mouseInteractionCb)(
|
|
2381
|
+
callbackWrapper(mouseInteractionCb)({
|
|
2382
|
+
type: MouseInteractions[thisEventKey],
|
|
2383
|
+
id,
|
|
2384
|
+
x: clientX,
|
|
2385
|
+
y: clientY,
|
|
2386
|
+
...(pointerType !== null && { pointerType }),
|
|
2387
|
+
});
|
|
2381
2388
|
};
|
|
2382
2389
|
};
|
|
2383
2390
|
Object.keys(MouseInteractions)
|
|
@@ -2514,7 +2521,10 @@ function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, un
|
|
|
2514
2521
|
lastInputValue.isChecked !== v.isChecked) {
|
|
2515
2522
|
lastInputValueMap.set(target, v);
|
|
2516
2523
|
const id = mirror.getId(target);
|
|
2517
|
-
callbackWrapper(inputCb)(
|
|
2524
|
+
callbackWrapper(inputCb)({
|
|
2525
|
+
...v,
|
|
2526
|
+
id,
|
|
2527
|
+
});
|
|
2518
2528
|
}
|
|
2519
2529
|
}
|
|
2520
2530
|
const events = sampling.input === 'last' ? ['change'] : ['input', 'change'];
|
|
@@ -2728,17 +2738,16 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror, stylesheetManager },
|
|
|
2728
2738
|
});
|
|
2729
2739
|
}
|
|
2730
2740
|
function initAdoptedStyleSheetObserver({ mirror, stylesheetManager, }, host) {
|
|
2731
|
-
var _a, _b, _c;
|
|
2732
2741
|
let hostId = null;
|
|
2733
2742
|
if (host.nodeName === '#document')
|
|
2734
2743
|
hostId = mirror.getId(host);
|
|
2735
2744
|
else
|
|
2736
2745
|
hostId = mirror.getId(host.host);
|
|
2737
2746
|
const patchTarget = host.nodeName === '#document'
|
|
2738
|
-
? (
|
|
2739
|
-
: (
|
|
2740
|
-
const originalPropertyDescriptor = (patchTarget
|
|
2741
|
-
? Object.getOwnPropertyDescriptor(patchTarget
|
|
2747
|
+
? _optionalChain$2([host, 'access', _4 => _4.defaultView, 'optionalAccess', _5 => _5.Document])
|
|
2748
|
+
: _optionalChain$2([host, 'access', _6 => _6.ownerDocument, 'optionalAccess', _7 => _7.defaultView, 'optionalAccess', _8 => _8.ShadowRoot]);
|
|
2749
|
+
const originalPropertyDescriptor = _optionalChain$2([patchTarget, 'optionalAccess', _9 => _9.prototype])
|
|
2750
|
+
? Object.getOwnPropertyDescriptor(_optionalChain$2([patchTarget, 'optionalAccess', _10 => _10.prototype]), 'adoptedStyleSheets')
|
|
2742
2751
|
: undefined;
|
|
2743
2752
|
if (hostId === null ||
|
|
2744
2753
|
hostId === -1 ||
|
|
@@ -2750,12 +2759,10 @@ function initAdoptedStyleSheetObserver({ mirror, stylesheetManager, }, host) {
|
|
|
2750
2759
|
configurable: originalPropertyDescriptor.configurable,
|
|
2751
2760
|
enumerable: originalPropertyDescriptor.enumerable,
|
|
2752
2761
|
get() {
|
|
2753
|
-
|
|
2754
|
-
return (_a = originalPropertyDescriptor.get) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2762
|
+
return _optionalChain$2([originalPropertyDescriptor, 'access', _11 => _11.get, 'optionalAccess', _12 => _12.call, 'call', _13 => _13(this)]);
|
|
2755
2763
|
},
|
|
2756
2764
|
set(sheets) {
|
|
2757
|
-
|
|
2758
|
-
const result = (_a = originalPropertyDescriptor.set) === null || _a === void 0 ? void 0 : _a.call(this, sheets);
|
|
2765
|
+
const result = _optionalChain$2([originalPropertyDescriptor, 'access', _14 => _14.set, 'optionalAccess', _15 => _15.call, 'call', _16 => _16(this, sheets)]);
|
|
2759
2766
|
if (hostId !== null && hostId !== -1) {
|
|
2760
2767
|
try {
|
|
2761
2768
|
stylesheetManager.adoptStyleSheets(sheets, hostId);
|
|
@@ -2779,12 +2786,11 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror, ignoreCSSAtt
|
|
|
2779
2786
|
const setProperty = win.CSSStyleDeclaration.prototype.setProperty;
|
|
2780
2787
|
win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {
|
|
2781
2788
|
apply: callbackWrapper((target, thisArg, argumentsList) => {
|
|
2782
|
-
var _a;
|
|
2783
2789
|
const [property, value, priority] = argumentsList;
|
|
2784
2790
|
if (ignoreCSSAttributes.has(property)) {
|
|
2785
2791
|
return setProperty.apply(thisArg, [property, value, priority]);
|
|
2786
2792
|
}
|
|
2787
|
-
const { id, styleId } = getIdAndStyleId((
|
|
2793
|
+
const { id, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, 'access', _17 => _17.parentRule, 'optionalAccess', _18 => _18.parentStyleSheet]), mirror, stylesheetManager.styleMirror);
|
|
2788
2794
|
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2789
2795
|
styleDeclarationCb({
|
|
2790
2796
|
id,
|
|
@@ -2803,12 +2809,11 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror, ignoreCSSAtt
|
|
|
2803
2809
|
const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
|
|
2804
2810
|
win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {
|
|
2805
2811
|
apply: callbackWrapper((target, thisArg, argumentsList) => {
|
|
2806
|
-
var _a;
|
|
2807
2812
|
const [property] = argumentsList;
|
|
2808
2813
|
if (ignoreCSSAttributes.has(property)) {
|
|
2809
2814
|
return removeProperty.apply(thisArg, [property]);
|
|
2810
2815
|
}
|
|
2811
|
-
const { id, styleId } = getIdAndStyleId((
|
|
2816
|
+
const { id, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, 'access', _19 => _19.parentRule, 'optionalAccess', _20 => _20.parentStyleSheet]), mirror, stylesheetManager.styleMirror);
|
|
2812
2817
|
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2813
2818
|
styleDeclarationCb({
|
|
2814
2819
|
id,
|
|
@@ -2901,7 +2906,7 @@ function initSelectionObserver(param) {
|
|
|
2901
2906
|
let collapsed = true;
|
|
2902
2907
|
const updateSelection = callbackWrapper(() => {
|
|
2903
2908
|
const selection = doc.getSelection();
|
|
2904
|
-
if (!selection || (collapsed && (selection
|
|
2909
|
+
if (!selection || (collapsed && _optionalChain$2([selection, 'optionalAccess', _21 => _21.isCollapsed])))
|
|
2905
2910
|
return;
|
|
2906
2911
|
collapsed = selection.isCollapsed || false;
|
|
2907
2912
|
const ranges = [];
|
|
@@ -3067,6 +3072,7 @@ class CrossOriginIframeMirror {
|
|
|
3067
3072
|
}
|
|
3068
3073
|
}
|
|
3069
3074
|
|
|
3075
|
+
function _optionalChain$1(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; }
|
|
3070
3076
|
class IframeManagerNoop {
|
|
3071
3077
|
constructor() {
|
|
3072
3078
|
this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId);
|
|
@@ -3104,7 +3110,6 @@ class IframeManager {
|
|
|
3104
3110
|
this.loadListener = cb;
|
|
3105
3111
|
}
|
|
3106
3112
|
attachIframe(iframeEl, childSn) {
|
|
3107
|
-
var _a;
|
|
3108
3113
|
this.mutationCb({
|
|
3109
3114
|
adds: [
|
|
3110
3115
|
{
|
|
@@ -3118,7 +3123,7 @@ class IframeManager {
|
|
|
3118
3123
|
attributes: [],
|
|
3119
3124
|
isAttachIframe: true,
|
|
3120
3125
|
});
|
|
3121
|
-
(
|
|
3126
|
+
_optionalChain$1([this, 'access', _ => _.loadListener, 'optionalCall', _2 => _2(iframeEl)]);
|
|
3122
3127
|
if (iframeEl.contentDocument &&
|
|
3123
3128
|
iframeEl.contentDocument.adoptedStyleSheets &&
|
|
3124
3129
|
iframeEl.contentDocument.adoptedStyleSheets.length > 0)
|
|
@@ -3140,7 +3145,6 @@ class IframeManager {
|
|
|
3140
3145
|
this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout);
|
|
3141
3146
|
}
|
|
3142
3147
|
transformCrossOriginEvent(iframeEl, e) {
|
|
3143
|
-
var _a;
|
|
3144
3148
|
switch (e.type) {
|
|
3145
3149
|
case EventType.FullSnapshot: {
|
|
3146
3150
|
this.crossOriginIframeMirror.reset(iframeEl);
|
|
@@ -3241,9 +3245,9 @@ class IframeManager {
|
|
|
3241
3245
|
case IncrementalSource.AdoptedStyleSheet: {
|
|
3242
3246
|
this.replaceIds(e.data, iframeEl, ['id']);
|
|
3243
3247
|
this.replaceStyleIds(e.data, iframeEl, ['styleIds']);
|
|
3244
|
-
(
|
|
3248
|
+
_optionalChain$1([e, 'access', _3 => _3.data, 'access', _4 => _4.styles, 'optionalAccess', _5 => _5.forEach, 'call', _6 => _6((style) => {
|
|
3245
3249
|
this.replaceStyleIds(style, iframeEl, ['styleId']);
|
|
3246
|
-
});
|
|
3250
|
+
})]);
|
|
3247
3251
|
return e;
|
|
3248
3252
|
}
|
|
3249
3253
|
}
|
|
@@ -3319,9 +3323,20 @@ class ShadowDomManager {
|
|
|
3319
3323
|
if (this.shadowDoms.has(shadowRoot))
|
|
3320
3324
|
return;
|
|
3321
3325
|
this.shadowDoms.add(shadowRoot);
|
|
3322
|
-
const observer = initMutationObserver(
|
|
3326
|
+
const observer = initMutationObserver({
|
|
3327
|
+
...this.bypassOptions,
|
|
3328
|
+
doc,
|
|
3329
|
+
mutationCb: this.mutationCb,
|
|
3330
|
+
mirror: this.mirror,
|
|
3331
|
+
shadowDomManager: this,
|
|
3332
|
+
}, shadowRoot);
|
|
3323
3333
|
this.restoreHandlers.push(() => observer.disconnect());
|
|
3324
|
-
this.restoreHandlers.push(initScrollObserver(
|
|
3334
|
+
this.restoreHandlers.push(initScrollObserver({
|
|
3335
|
+
...this.bypassOptions,
|
|
3336
|
+
scrollCb: this.scrollCb,
|
|
3337
|
+
doc: shadowRoot,
|
|
3338
|
+
mirror: this.mirror,
|
|
3339
|
+
}));
|
|
3325
3340
|
setTimeout(() => {
|
|
3326
3341
|
if (shadowRoot.adoptedStyleSheets &&
|
|
3327
3342
|
shadowRoot.adoptedStyleSheets.length > 0)
|
|
@@ -3372,6 +3387,8 @@ class CanvasManagerNoop {
|
|
|
3372
3387
|
}
|
|
3373
3388
|
unlock() {
|
|
3374
3389
|
}
|
|
3390
|
+
snapshot() {
|
|
3391
|
+
}
|
|
3375
3392
|
}
|
|
3376
3393
|
|
|
3377
3394
|
class StylesheetManager {
|
|
@@ -3446,7 +3463,7 @@ class ProcessedNodeManager {
|
|
|
3446
3463
|
this.periodicallyClear();
|
|
3447
3464
|
}
|
|
3448
3465
|
periodicallyClear() {
|
|
3449
|
-
|
|
3466
|
+
onRequestAnimationFrame(() => {
|
|
3450
3467
|
this.clear();
|
|
3451
3468
|
if (this.loop)
|
|
3452
3469
|
this.periodicallyClear();
|
|
@@ -3472,7 +3489,6 @@ function wrapEvent(e) {
|
|
|
3472
3489
|
eWithTime.timestamp = nowTimestamp();
|
|
3473
3490
|
return eWithTime;
|
|
3474
3491
|
}
|
|
3475
|
-
let _wrappedEmit;
|
|
3476
3492
|
let _takeFullSnapshot;
|
|
3477
3493
|
const mirror = createMirror();
|
|
3478
3494
|
function record(options = {}) {
|
|
@@ -3556,15 +3572,14 @@ function record(options = {}) {
|
|
|
3556
3572
|
return e;
|
|
3557
3573
|
};
|
|
3558
3574
|
const wrappedEmit = (e, isCheckout) => {
|
|
3559
|
-
|
|
3560
|
-
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
|
|
3575
|
+
if (_optionalChain([mutationBuffers, 'access', _ => _[0], 'optionalAccess', _2 => _2.isFrozen, 'call', _3 => _3()]) &&
|
|
3561
3576
|
e.type !== EventType.FullSnapshot &&
|
|
3562
3577
|
!(e.type === EventType.IncrementalSnapshot &&
|
|
3563
3578
|
e.data.source === IncrementalSource.Mutation)) {
|
|
3564
3579
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
3565
3580
|
}
|
|
3566
3581
|
if (inEmittingFrame) {
|
|
3567
|
-
emit
|
|
3582
|
+
_optionalChain([emit, 'optionalCall', _4 => _4(eventProcessor(e), isCheckout)]);
|
|
3568
3583
|
}
|
|
3569
3584
|
else if (passEmitsToParent) {
|
|
3570
3585
|
const message = {
|
|
@@ -3593,24 +3608,35 @@ function record(options = {}) {
|
|
|
3593
3608
|
}
|
|
3594
3609
|
}
|
|
3595
3610
|
};
|
|
3596
|
-
_wrappedEmit = wrappedEmit;
|
|
3597
3611
|
const wrappedMutationEmit = (m) => {
|
|
3598
3612
|
wrappedEmit(wrapEvent({
|
|
3599
3613
|
type: EventType.IncrementalSnapshot,
|
|
3600
|
-
data:
|
|
3614
|
+
data: {
|
|
3615
|
+
source: IncrementalSource.Mutation,
|
|
3616
|
+
...m,
|
|
3617
|
+
},
|
|
3601
3618
|
}));
|
|
3602
3619
|
};
|
|
3603
3620
|
const wrappedScrollEmit = (p) => wrappedEmit(wrapEvent({
|
|
3604
3621
|
type: EventType.IncrementalSnapshot,
|
|
3605
|
-
data:
|
|
3622
|
+
data: {
|
|
3623
|
+
source: IncrementalSource.Scroll,
|
|
3624
|
+
...p,
|
|
3625
|
+
},
|
|
3606
3626
|
}));
|
|
3607
3627
|
const wrappedCanvasMutationEmit = (p) => wrappedEmit(wrapEvent({
|
|
3608
3628
|
type: EventType.IncrementalSnapshot,
|
|
3609
|
-
data:
|
|
3629
|
+
data: {
|
|
3630
|
+
source: IncrementalSource.CanvasMutation,
|
|
3631
|
+
...p,
|
|
3632
|
+
},
|
|
3610
3633
|
}));
|
|
3611
3634
|
const wrappedAdoptedStyleSheetEmit = (a) => wrappedEmit(wrapEvent({
|
|
3612
3635
|
type: EventType.IncrementalSnapshot,
|
|
3613
|
-
data:
|
|
3636
|
+
data: {
|
|
3637
|
+
source: IncrementalSource.AdoptedStyleSheet,
|
|
3638
|
+
...a,
|
|
3639
|
+
},
|
|
3614
3640
|
}));
|
|
3615
3641
|
const stylesheetManager = new StylesheetManager({
|
|
3616
3642
|
mutationCb: wrappedMutationEmit,
|
|
@@ -3635,6 +3661,15 @@ function record(options = {}) {
|
|
|
3635
3661
|
}
|
|
3636
3662
|
const processedNodeManager = new ProcessedNodeManager();
|
|
3637
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
|
+
})),
|
|
3638
3673
|
recordCanvas,
|
|
3639
3674
|
blockClass,
|
|
3640
3675
|
blockSelector,
|
|
@@ -3745,7 +3780,6 @@ function record(options = {}) {
|
|
|
3745
3780
|
try {
|
|
3746
3781
|
const handlers = [];
|
|
3747
3782
|
const observe = (doc) => {
|
|
3748
|
-
var _a;
|
|
3749
3783
|
return callbackWrapper(initObservers)({
|
|
3750
3784
|
onMutation,
|
|
3751
3785
|
mutationCb: wrappedMutationEmit,
|
|
@@ -3758,44 +3792,71 @@ function record(options = {}) {
|
|
|
3758
3792
|
})),
|
|
3759
3793
|
mouseInteractionCb: (d) => wrappedEmit(wrapEvent({
|
|
3760
3794
|
type: EventType.IncrementalSnapshot,
|
|
3761
|
-
data:
|
|
3795
|
+
data: {
|
|
3796
|
+
source: IncrementalSource.MouseInteraction,
|
|
3797
|
+
...d,
|
|
3798
|
+
},
|
|
3762
3799
|
})),
|
|
3763
3800
|
scrollCb: wrappedScrollEmit,
|
|
3764
3801
|
viewportResizeCb: (d) => wrappedEmit(wrapEvent({
|
|
3765
3802
|
type: EventType.IncrementalSnapshot,
|
|
3766
|
-
data:
|
|
3803
|
+
data: {
|
|
3804
|
+
source: IncrementalSource.ViewportResize,
|
|
3805
|
+
...d,
|
|
3806
|
+
},
|
|
3767
3807
|
})),
|
|
3768
3808
|
inputCb: (v) => wrappedEmit(wrapEvent({
|
|
3769
3809
|
type: EventType.IncrementalSnapshot,
|
|
3770
|
-
data:
|
|
3810
|
+
data: {
|
|
3811
|
+
source: IncrementalSource.Input,
|
|
3812
|
+
...v,
|
|
3813
|
+
},
|
|
3771
3814
|
})),
|
|
3772
3815
|
mediaInteractionCb: (p) => wrappedEmit(wrapEvent({
|
|
3773
3816
|
type: EventType.IncrementalSnapshot,
|
|
3774
|
-
data:
|
|
3817
|
+
data: {
|
|
3818
|
+
source: IncrementalSource.MediaInteraction,
|
|
3819
|
+
...p,
|
|
3820
|
+
},
|
|
3775
3821
|
})),
|
|
3776
3822
|
styleSheetRuleCb: (r) => wrappedEmit(wrapEvent({
|
|
3777
3823
|
type: EventType.IncrementalSnapshot,
|
|
3778
|
-
data:
|
|
3824
|
+
data: {
|
|
3825
|
+
source: IncrementalSource.StyleSheetRule,
|
|
3826
|
+
...r,
|
|
3827
|
+
},
|
|
3779
3828
|
})),
|
|
3780
3829
|
styleDeclarationCb: (r) => wrappedEmit(wrapEvent({
|
|
3781
3830
|
type: EventType.IncrementalSnapshot,
|
|
3782
|
-
data:
|
|
3831
|
+
data: {
|
|
3832
|
+
source: IncrementalSource.StyleDeclaration,
|
|
3833
|
+
...r,
|
|
3834
|
+
},
|
|
3783
3835
|
})),
|
|
3784
3836
|
canvasMutationCb: wrappedCanvasMutationEmit,
|
|
3785
3837
|
fontCb: (p) => wrappedEmit(wrapEvent({
|
|
3786
3838
|
type: EventType.IncrementalSnapshot,
|
|
3787
|
-
data:
|
|
3839
|
+
data: {
|
|
3840
|
+
source: IncrementalSource.Font,
|
|
3841
|
+
...p,
|
|
3842
|
+
},
|
|
3788
3843
|
})),
|
|
3789
3844
|
selectionCb: (p) => {
|
|
3790
3845
|
wrappedEmit(wrapEvent({
|
|
3791
3846
|
type: EventType.IncrementalSnapshot,
|
|
3792
|
-
data:
|
|
3847
|
+
data: {
|
|
3848
|
+
source: IncrementalSource.Selection,
|
|
3849
|
+
...p,
|
|
3850
|
+
},
|
|
3793
3851
|
}));
|
|
3794
3852
|
},
|
|
3795
3853
|
customElementCb: (c) => {
|
|
3796
3854
|
wrappedEmit(wrapEvent({
|
|
3797
3855
|
type: EventType.IncrementalSnapshot,
|
|
3798
|
-
data:
|
|
3856
|
+
data: {
|
|
3857
|
+
source: IncrementalSource.CustomElement,
|
|
3858
|
+
...c,
|
|
3859
|
+
},
|
|
3799
3860
|
}));
|
|
3800
3861
|
},
|
|
3801
3862
|
blockClass,
|
|
@@ -3829,7 +3890,9 @@ function record(options = {}) {
|
|
|
3829
3890
|
processedNodeManager,
|
|
3830
3891
|
canvasManager,
|
|
3831
3892
|
ignoreCSSAttributes,
|
|
3832
|
-
plugins: (
|
|
3893
|
+
plugins: _optionalChain([plugins
|
|
3894
|
+
, 'optionalAccess', _5 => _5.filter, 'call', _6 => _6((p) => p.observer)
|
|
3895
|
+
, 'optionalAccess', _7 => _7.map, 'call', _8 => _8((p) => ({
|
|
3833
3896
|
observer: p.observer,
|
|
3834
3897
|
options: p.options,
|
|
3835
3898
|
callback: (payload) => wrappedEmit(wrapEvent({
|
|
@@ -3839,7 +3902,7 @@ function record(options = {}) {
|
|
|
3839
3902
|
payload,
|
|
3840
3903
|
},
|
|
3841
3904
|
})),
|
|
3842
|
-
}))) || [],
|
|
3905
|
+
}))]) || [],
|
|
3843
3906
|
}, {});
|
|
3844
3907
|
};
|
|
3845
3908
|
iframeManager.addLoadListener((iframeEl) => {
|
|
@@ -3893,21 +3956,18 @@ function takeFullSnapshot(isCheckout) {
|
|
|
3893
3956
|
}
|
|
3894
3957
|
_takeFullSnapshot(isCheckout);
|
|
3895
3958
|
}
|
|
3896
|
-
function wrappedEmit(e) {
|
|
3897
|
-
if (!_wrappedEmit) {
|
|
3898
|
-
return;
|
|
3899
|
-
}
|
|
3900
|
-
_wrappedEmit(e);
|
|
3901
|
-
}
|
|
3902
3959
|
record.mirror = mirror;
|
|
3903
3960
|
record.takeFullSnapshot = takeFullSnapshot;
|
|
3904
3961
|
function _getCanvasManager(getCanvasManagerFn, options) {
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
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
|
+
}
|
|
3911
3971
|
}
|
|
3912
3972
|
|
|
3913
3973
|
const ReplayEventTypeIncrementalSnapshot = 3;
|
|
@@ -7345,6 +7405,7 @@ function createOptionsEvent(replay) {
|
|
|
7345
7405
|
data: {
|
|
7346
7406
|
tag: 'options',
|
|
7347
7407
|
payload: {
|
|
7408
|
+
shouldRecordCanvas: replay.isRecordingCanvas(),
|
|
7348
7409
|
sessionSampleRate: options.sessionSampleRate,
|
|
7349
7410
|
errorSampleRate: options.errorSampleRate,
|
|
7350
7411
|
useCompressionOption: options.useCompression,
|
|
@@ -7808,6 +7869,10 @@ class ReplayContainer {
|
|
|
7808
7869
|
* Function to stop recording
|
|
7809
7870
|
*/
|
|
7810
7871
|
|
|
7872
|
+
/**
|
|
7873
|
+
* Internal use for canvas recording options
|
|
7874
|
+
*/
|
|
7875
|
+
|
|
7811
7876
|
constructor({
|
|
7812
7877
|
options,
|
|
7813
7878
|
recordingOptions,
|
|
@@ -7880,6 +7945,13 @@ class ReplayContainer {
|
|
|
7880
7945
|
return this._isPaused;
|
|
7881
7946
|
}
|
|
7882
7947
|
|
|
7948
|
+
/**
|
|
7949
|
+
* Determine if canvas recording is enabled
|
|
7950
|
+
*/
|
|
7951
|
+
isRecordingCanvas() {
|
|
7952
|
+
return Boolean(this._canvas);
|
|
7953
|
+
}
|
|
7954
|
+
|
|
7883
7955
|
/** Get the replay integration options. */
|
|
7884
7956
|
getOptions() {
|
|
7885
7957
|
return this._options;
|
|
@@ -8000,7 +8072,8 @@ class ReplayContainer {
|
|
|
8000
8072
|
*/
|
|
8001
8073
|
startRecording() {
|
|
8002
8074
|
try {
|
|
8003
|
-
const
|
|
8075
|
+
const canvasOptions = this._canvas;
|
|
8076
|
+
|
|
8004
8077
|
this._stopRecording = record({
|
|
8005
8078
|
...this._recordingOptions,
|
|
8006
8079
|
// When running in error sampling mode, we need to overwrite `checkoutEveryNms`
|
|
@@ -8009,12 +8082,14 @@ class ReplayContainer {
|
|
|
8009
8082
|
...(this.recordingMode === 'buffer' && { checkoutEveryNms: BUFFER_CHECKOUT_TIME }),
|
|
8010
8083
|
emit: getHandleRecordingEmit(this),
|
|
8011
8084
|
onMutation: this._onMutationHandler,
|
|
8012
|
-
...(
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8085
|
+
...(canvasOptions
|
|
8086
|
+
? {
|
|
8087
|
+
recordCanvas: canvasOptions.recordCanvas,
|
|
8088
|
+
getCanvasManager: canvasOptions.getCanvasManager,
|
|
8089
|
+
sampling: canvasOptions.sampling,
|
|
8090
|
+
dataURLOptions: canvasOptions.dataURLOptions,
|
|
8091
|
+
}
|
|
8092
|
+
: {}),
|
|
8018
8093
|
});
|
|
8019
8094
|
} catch (err) {
|
|
8020
8095
|
this._handleException(err);
|
|
@@ -8367,12 +8442,16 @@ class ReplayContainer {
|
|
|
8367
8442
|
* This is only available if performance is enabled, and if an instrumented router is used.
|
|
8368
8443
|
*/
|
|
8369
8444
|
getCurrentRoute() {
|
|
8445
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
8370
8446
|
const lastTransaction = this.lastTransaction || getCurrentScope().getTransaction();
|
|
8371
|
-
|
|
8447
|
+
|
|
8448
|
+
const attributes = (lastTransaction && spanToJSON(lastTransaction).data) || {};
|
|
8449
|
+
const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
8450
|
+
if (!lastTransaction || !source || !['route', 'custom'].includes(source)) {
|
|
8372
8451
|
return undefined;
|
|
8373
8452
|
}
|
|
8374
8453
|
|
|
8375
|
-
return lastTransaction.
|
|
8454
|
+
return spanToJSON(lastTransaction).description;
|
|
8376
8455
|
}
|
|
8377
8456
|
|
|
8378
8457
|
/**
|
|
@@ -9336,6 +9415,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
9336
9415
|
|
|
9337
9416
|
return this._replay.getSessionId();
|
|
9338
9417
|
}
|
|
9418
|
+
|
|
9339
9419
|
/**
|
|
9340
9420
|
* Initializes replay.
|
|
9341
9421
|
*/
|
|
@@ -9344,6 +9424,12 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
9344
9424
|
return;
|
|
9345
9425
|
}
|
|
9346
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
|
+
|
|
9347
9433
|
this._replay.initializeSampling();
|
|
9348
9434
|
}
|
|
9349
9435
|
|
|
@@ -9357,7 +9443,28 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
9357
9443
|
recordingOptions: this._recordingOptions,
|
|
9358
9444
|
});
|
|
9359
9445
|
}
|
|
9360
|
-
|
|
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
|
+
}
|
|
9467
|
+
}Replay.__initStatic();
|
|
9361
9468
|
|
|
9362
9469
|
/** Parse Replay-related options from SDK options */
|
|
9363
9470
|
function loadReplayOptionsFromClient(initialOptions) {
|