mixpanel-browser 2.71.1 → 2.72.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/.github/workflows/tests.yml +1 -0
- package/CHANGELOG.md +7 -0
- package/dist/mixpanel-core.cjs.d.ts +47 -10
- package/dist/mixpanel-core.cjs.js +51 -17
- package/dist/mixpanel-recorder.js +681 -113
- package/dist/mixpanel-recorder.min.js +1 -1
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.d.ts +47 -10
- package/dist/mixpanel-with-async-recorder.cjs.js +51 -17
- package/dist/mixpanel-with-recorder.d.ts +47 -10
- package/dist/mixpanel-with-recorder.js +731 -129
- package/dist/mixpanel-with-recorder.min.d.ts +47 -10
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.d.ts +47 -10
- package/dist/mixpanel.amd.js +731 -129
- package/dist/mixpanel.cjs.d.ts +47 -10
- package/dist/mixpanel.cjs.js +731 -129
- package/dist/mixpanel.globals.js +51 -17
- package/dist/mixpanel.min.js +144 -144
- package/dist/mixpanel.module.d.ts +47 -10
- package/dist/mixpanel.module.js +731 -129
- package/dist/mixpanel.umd.d.ts +47 -10
- package/dist/mixpanel.umd.js +731 -129
- package/dist/rrweb-bundled.js +12760 -0
- package/dist/rrweb-compiled.js +2496 -7176
- package/package.json +3 -2
- package/rollup.config.mjs +15 -4
- package/src/autocapture/index.js +1 -1
- package/src/autocapture/rageclick.js +20 -1
- package/src/autocapture/shadow-dom-observer.js +3 -15
- package/src/autocapture/utils.js +30 -0
- package/src/config.js +1 -1
- package/src/index.d.ts +47 -10
- package/src/mixpanel-core.js +1 -0
- package/src/recorder/recorder.js +1 -1
- package/src/recorder/rrweb-entrypoint.js +6 -0
- package/src/recorder/session-recording.js +69 -12
- package/src/utils.js +24 -0
package/dist/mixpanel.cjs.js
CHANGED
|
@@ -324,30 +324,30 @@ function _ts_values(o) {
|
|
|
324
324
|
};
|
|
325
325
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
326
326
|
}
|
|
327
|
-
var __defProp = Object.defineProperty;
|
|
328
|
-
var __defNormalProp = function(obj, key, value) {
|
|
329
|
-
return key in obj ? __defProp(obj, key, {
|
|
327
|
+
var __defProp$1 = Object.defineProperty;
|
|
328
|
+
var __defNormalProp$1 = function(obj, key, value) {
|
|
329
|
+
return key in obj ? __defProp$1(obj, key, {
|
|
330
330
|
enumerable: true,
|
|
331
331
|
configurable: true,
|
|
332
332
|
writable: true,
|
|
333
333
|
value: value
|
|
334
334
|
}) : obj[key] = value;
|
|
335
335
|
};
|
|
336
|
-
var __publicField = function(obj, key, value) {
|
|
337
|
-
return __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
336
|
+
var __publicField$1 = function(obj, key, value) {
|
|
337
|
+
return __defNormalProp$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
338
338
|
};
|
|
339
339
|
var _a;
|
|
340
|
-
var __defProp$1 = Object.defineProperty;
|
|
341
|
-
var __defNormalProp$1 = function(obj, key, value) {
|
|
342
|
-
return key in obj ? __defProp$1(obj, key, {
|
|
340
|
+
var __defProp$1$1 = Object.defineProperty;
|
|
341
|
+
var __defNormalProp$1$1 = function(obj, key, value) {
|
|
342
|
+
return key in obj ? __defProp$1$1(obj, key, {
|
|
343
343
|
enumerable: true,
|
|
344
344
|
configurable: true,
|
|
345
345
|
writable: true,
|
|
346
346
|
value: value
|
|
347
347
|
}) : obj[key] = value;
|
|
348
348
|
};
|
|
349
|
-
var __publicField$1 = function(obj, key, value) {
|
|
350
|
-
return __defNormalProp$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
349
|
+
var __publicField$1$1 = function(obj, key, value) {
|
|
350
|
+
return __defNormalProp$1$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
351
351
|
};
|
|
352
352
|
var NodeType$3 = /* @__PURE__ */ function(NodeType2) {
|
|
353
353
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
@@ -617,8 +617,8 @@ function isCSSStyleRule(rule2) {
|
|
|
617
617
|
}
|
|
618
618
|
var Mirror = /*#__PURE__*/ function() {
|
|
619
619
|
function Mirror() {
|
|
620
|
-
__publicField$1(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
621
|
-
__publicField$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
|
|
620
|
+
__publicField$1$1(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
621
|
+
__publicField$1$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
|
|
622
622
|
}
|
|
623
623
|
var _proto = Mirror.prototype;
|
|
624
624
|
_proto.getId = function getId(n2) {
|
|
@@ -2502,7 +2502,8 @@ var nanoid$1$1 = function(size) {
|
|
|
2502
2502
|
return id;
|
|
2503
2503
|
};
|
|
2504
2504
|
var nonSecure$1 = {
|
|
2505
|
-
nanoid: nanoid$1$1
|
|
2505
|
+
nanoid: nanoid$1$1
|
|
2506
|
+
};
|
|
2506
2507
|
var SourceMapConsumer$2$1 = require$$2$1.SourceMapConsumer, SourceMapGenerator$2$1 = require$$2$1.SourceMapGenerator;
|
|
2507
2508
|
var existsSync$1 = require$$2$1.existsSync, readFileSync$1 = require$$2$1.readFileSync;
|
|
2508
2509
|
var dirname$1$1 = require$$2$1.dirname, join$1 = require$$2$1.join;
|
|
@@ -6653,7 +6654,8 @@ var nanoid$1 = function(size) {
|
|
|
6653
6654
|
return id;
|
|
6654
6655
|
};
|
|
6655
6656
|
var nonSecure = {
|
|
6656
|
-
nanoid: nanoid$1
|
|
6657
|
+
nanoid: nanoid$1
|
|
6658
|
+
};
|
|
6657
6659
|
var SourceMapConsumer$2 = require$$2.SourceMapConsumer, SourceMapGenerator$2 = require$$2.SourceMapGenerator;
|
|
6658
6660
|
var existsSync = require$$2.existsSync, readFileSync = require$$2.readFileSync;
|
|
6659
6661
|
var dirname$1 = require$$2.dirname, join = require$$2.join;
|
|
@@ -9813,7 +9815,7 @@ var Declaration22 = declaration;
|
|
|
9813
9815
|
var LazyResult22 = lazyResult;
|
|
9814
9816
|
var Container22 = container;
|
|
9815
9817
|
var Processor22 = processor;
|
|
9816
|
-
var stringify = stringify_1;
|
|
9818
|
+
var stringify$6 = stringify_1;
|
|
9817
9819
|
var fromJSON = fromJSON_1;
|
|
9818
9820
|
var Document222 = document$1$2;
|
|
9819
9821
|
var Warning22 = warning;
|
|
@@ -9867,7 +9869,7 @@ postcss.plugin = function plugin2(name, initializer) {
|
|
|
9867
9869
|
};
|
|
9868
9870
|
return creator;
|
|
9869
9871
|
};
|
|
9870
|
-
postcss.stringify = stringify;
|
|
9872
|
+
postcss.stringify = stringify$6;
|
|
9871
9873
|
postcss.parse = parse;
|
|
9872
9874
|
postcss.fromJSON = fromJSON;
|
|
9873
9875
|
postcss.list = list;
|
|
@@ -10117,7 +10119,7 @@ function querySelectorAll(n2, selectors) {
|
|
|
10117
10119
|
function mutationObserverCtor() {
|
|
10118
10120
|
return getUntaintedPrototype("MutationObserver").constructor;
|
|
10119
10121
|
}
|
|
10120
|
-
function patch(source, name, replacement) {
|
|
10122
|
+
function patch$2(source, name, replacement) {
|
|
10121
10123
|
try {
|
|
10122
10124
|
if (!(name in source)) {
|
|
10123
10125
|
return function() {};
|
|
@@ -10154,7 +10156,7 @@ var index = {
|
|
|
10154
10156
|
querySelector: querySelector,
|
|
10155
10157
|
querySelectorAll: querySelectorAll,
|
|
10156
10158
|
mutationObserver: mutationObserverCtor,
|
|
10157
|
-
patch: patch
|
|
10159
|
+
patch: patch$2
|
|
10158
10160
|
};
|
|
10159
10161
|
function on(type, fn, target) {
|
|
10160
10162
|
if (target === void 0) target = document;
|
|
@@ -10349,9 +10351,9 @@ function hasShadowRoot(n2) {
|
|
|
10349
10351
|
}
|
|
10350
10352
|
var StyleSheetMirror = /*#__PURE__*/ function() {
|
|
10351
10353
|
function StyleSheetMirror() {
|
|
10352
|
-
__publicField(this, "id", 1);
|
|
10353
|
-
__publicField(this, "styleIDMap", /* @__PURE__ */ new WeakMap());
|
|
10354
|
-
__publicField(this, "idStyleMap", /* @__PURE__ */ new Map());
|
|
10354
|
+
__publicField$1(this, "id", 1);
|
|
10355
|
+
__publicField$1(this, "styleIDMap", /* @__PURE__ */ new WeakMap());
|
|
10356
|
+
__publicField$1(this, "idStyleMap", /* @__PURE__ */ new Map());
|
|
10355
10357
|
}
|
|
10356
10358
|
var _proto = StyleSheetMirror.prototype;
|
|
10357
10359
|
_proto.getId = function getId(stylesheet) {
|
|
@@ -10487,9 +10489,9 @@ function isNodeInLinkedList(n2) {
|
|
|
10487
10489
|
}
|
|
10488
10490
|
var DoubleLinkedList = /*#__PURE__*/ function() {
|
|
10489
10491
|
function DoubleLinkedList() {
|
|
10490
|
-
__publicField(this, "length", 0);
|
|
10491
|
-
__publicField(this, "head", null);
|
|
10492
|
-
__publicField(this, "tail", null);
|
|
10492
|
+
__publicField$1(this, "length", 0);
|
|
10493
|
+
__publicField$1(this, "head", null);
|
|
10494
|
+
__publicField$1(this, "tail", null);
|
|
10493
10495
|
}
|
|
10494
10496
|
var _proto = DoubleLinkedList.prototype;
|
|
10495
10497
|
_proto.get = function get(position) {
|
|
@@ -10570,14 +10572,14 @@ var moveKey = function(id, parentId) {
|
|
|
10570
10572
|
var MutationBuffer = /*#__PURE__*/ function() {
|
|
10571
10573
|
function MutationBuffer() {
|
|
10572
10574
|
var _this = this;
|
|
10573
|
-
__publicField(this, "frozen", false);
|
|
10574
|
-
__publicField(this, "locked", false);
|
|
10575
|
-
__publicField(this, "texts", []);
|
|
10576
|
-
__publicField(this, "attributes", []);
|
|
10577
|
-
__publicField(this, "attributeMap", /* @__PURE__ */ new WeakMap());
|
|
10578
|
-
__publicField(this, "removes", []);
|
|
10579
|
-
__publicField(this, "mapRemoves", []);
|
|
10580
|
-
__publicField(this, "movedMap", {});
|
|
10575
|
+
__publicField$1(this, "frozen", false);
|
|
10576
|
+
__publicField$1(this, "locked", false);
|
|
10577
|
+
__publicField$1(this, "texts", []);
|
|
10578
|
+
__publicField$1(this, "attributes", []);
|
|
10579
|
+
__publicField$1(this, "attributeMap", /* @__PURE__ */ new WeakMap());
|
|
10580
|
+
__publicField$1(this, "removes", []);
|
|
10581
|
+
__publicField$1(this, "mapRemoves", []);
|
|
10582
|
+
__publicField$1(this, "movedMap", {});
|
|
10581
10583
|
/**
|
|
10582
10584
|
* the browser MutationObserver emits multiple mutations after
|
|
10583
10585
|
* a delay for performance reasons, making tracing added nodes hard
|
|
@@ -10594,37 +10596,37 @@ var MutationBuffer = /*#__PURE__*/ function() {
|
|
|
10594
10596
|
* collect added nodes from the Set which have no duplicate copy. But
|
|
10595
10597
|
* this also causes newly added nodes will not be serialized with id ASAP,
|
|
10596
10598
|
* which means all the id related calculation should be lazy too.
|
|
10597
|
-
*/ __publicField(this, "addedSet", /* @__PURE__ */ new Set());
|
|
10598
|
-
__publicField(this, "movedSet", /* @__PURE__ */ new Set());
|
|
10599
|
-
__publicField(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
10600
|
-
__publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
10601
|
-
__publicField(this, "mutationCb");
|
|
10602
|
-
__publicField(this, "blockClass");
|
|
10603
|
-
__publicField(this, "blockSelector");
|
|
10604
|
-
__publicField(this, "maskTextClass");
|
|
10605
|
-
__publicField(this, "maskTextSelector");
|
|
10606
|
-
__publicField(this, "inlineStylesheet");
|
|
10607
|
-
__publicField(this, "maskInputOptions");
|
|
10608
|
-
__publicField(this, "maskTextFn");
|
|
10609
|
-
__publicField(this, "maskInputFn");
|
|
10610
|
-
__publicField(this, "keepIframeSrcFn");
|
|
10611
|
-
__publicField(this, "recordCanvas");
|
|
10612
|
-
__publicField(this, "inlineImages");
|
|
10613
|
-
__publicField(this, "slimDOMOptions");
|
|
10614
|
-
__publicField(this, "dataURLOptions");
|
|
10615
|
-
__publicField(this, "doc");
|
|
10616
|
-
__publicField(this, "mirror");
|
|
10617
|
-
__publicField(this, "iframeManager");
|
|
10618
|
-
__publicField(this, "stylesheetManager");
|
|
10619
|
-
__publicField(this, "shadowDomManager");
|
|
10620
|
-
__publicField(this, "canvasManager");
|
|
10621
|
-
__publicField(this, "processedNodeManager");
|
|
10622
|
-
__publicField(this, "unattachedDoc");
|
|
10623
|
-
__publicField(this, "processMutations", function(mutations) {
|
|
10599
|
+
*/ __publicField$1(this, "addedSet", /* @__PURE__ */ new Set());
|
|
10600
|
+
__publicField$1(this, "movedSet", /* @__PURE__ */ new Set());
|
|
10601
|
+
__publicField$1(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
10602
|
+
__publicField$1(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
10603
|
+
__publicField$1(this, "mutationCb");
|
|
10604
|
+
__publicField$1(this, "blockClass");
|
|
10605
|
+
__publicField$1(this, "blockSelector");
|
|
10606
|
+
__publicField$1(this, "maskTextClass");
|
|
10607
|
+
__publicField$1(this, "maskTextSelector");
|
|
10608
|
+
__publicField$1(this, "inlineStylesheet");
|
|
10609
|
+
__publicField$1(this, "maskInputOptions");
|
|
10610
|
+
__publicField$1(this, "maskTextFn");
|
|
10611
|
+
__publicField$1(this, "maskInputFn");
|
|
10612
|
+
__publicField$1(this, "keepIframeSrcFn");
|
|
10613
|
+
__publicField$1(this, "recordCanvas");
|
|
10614
|
+
__publicField$1(this, "inlineImages");
|
|
10615
|
+
__publicField$1(this, "slimDOMOptions");
|
|
10616
|
+
__publicField$1(this, "dataURLOptions");
|
|
10617
|
+
__publicField$1(this, "doc");
|
|
10618
|
+
__publicField$1(this, "mirror");
|
|
10619
|
+
__publicField$1(this, "iframeManager");
|
|
10620
|
+
__publicField$1(this, "stylesheetManager");
|
|
10621
|
+
__publicField$1(this, "shadowDomManager");
|
|
10622
|
+
__publicField$1(this, "canvasManager");
|
|
10623
|
+
__publicField$1(this, "processedNodeManager");
|
|
10624
|
+
__publicField$1(this, "unattachedDoc");
|
|
10625
|
+
__publicField$1(this, "processMutations", function(mutations) {
|
|
10624
10626
|
mutations.forEach(_this.processMutation);
|
|
10625
10627
|
_this.emit();
|
|
10626
10628
|
});
|
|
10627
|
-
__publicField(this, "emit", function() {
|
|
10629
|
+
__publicField$1(this, "emit", function() {
|
|
10628
10630
|
if (_this.frozen || _this.locked) {
|
|
10629
10631
|
return;
|
|
10630
10632
|
}
|
|
@@ -10825,7 +10827,7 @@ var MutationBuffer = /*#__PURE__*/ function() {
|
|
|
10825
10827
|
_this.movedMap = {};
|
|
10826
10828
|
_this.mutationCb(payload);
|
|
10827
10829
|
});
|
|
10828
|
-
__publicField(this, "genTextAreaValueMutation", function(textarea) {
|
|
10830
|
+
__publicField$1(this, "genTextAreaValueMutation", function(textarea) {
|
|
10829
10831
|
var item = _this.attributeMap.get(textarea);
|
|
10830
10832
|
if (!item) {
|
|
10831
10833
|
item = {
|
|
@@ -10849,7 +10851,7 @@ var MutationBuffer = /*#__PURE__*/ function() {
|
|
|
10849
10851
|
maskInputFn: _this.maskInputFn
|
|
10850
10852
|
});
|
|
10851
10853
|
});
|
|
10852
|
-
__publicField(this, "processMutation", function(m) {
|
|
10854
|
+
__publicField$1(this, "processMutation", function(m) {
|
|
10853
10855
|
if (isIgnored(m.target, _this.mirror, _this.slimDOMOptions)) {
|
|
10854
10856
|
return;
|
|
10855
10857
|
}
|
|
@@ -10994,7 +10996,7 @@ var MutationBuffer = /*#__PURE__*/ function() {
|
|
|
10994
10996
|
});
|
|
10995
10997
|
/**
|
|
10996
10998
|
* Make sure you check if `n`'s parent is blocked before calling this function
|
|
10997
|
-
* */ __publicField(this, "genAdds", function(n2, target) {
|
|
10999
|
+
* */ __publicField$1(this, "genAdds", function(n2, target) {
|
|
10998
11000
|
if (_this.processedNodeManager.inOtherBuffer(n2, _this)) return;
|
|
10999
11001
|
if (_this.addedSet.has(n2) || _this.movedSet.has(n2)) return;
|
|
11000
11002
|
if (_this.mirror.hasNode(n2)) {
|
|
@@ -11840,7 +11842,7 @@ function initFontObserver(param) {
|
|
|
11840
11842
|
});
|
|
11841
11843
|
return fontFace;
|
|
11842
11844
|
};
|
|
11843
|
-
var restoreHandler = patch(doc.fonts, "add", function(original) {
|
|
11845
|
+
var restoreHandler = patch$2(doc.fonts, "add", function(original) {
|
|
11844
11846
|
return function(fontFace) {
|
|
11845
11847
|
setTimeout(callbackWrapper(function() {
|
|
11846
11848
|
var p = fontMap.get(fontFace);
|
|
@@ -11896,7 +11898,7 @@ function initCustomElementObserver(param) {
|
|
|
11896
11898
|
var doc = param.doc, customElementCb = param.customElementCb;
|
|
11897
11899
|
var win = doc.defaultView;
|
|
11898
11900
|
if (!win || !win.customElements) return function() {};
|
|
11899
|
-
var restoreHandler = patch(win.customElements, "define", function(original) {
|
|
11901
|
+
var restoreHandler = patch$2(win.customElements, "define", function(original) {
|
|
11900
11902
|
return function(name, constructor, options) {
|
|
11901
11903
|
try {
|
|
11902
11904
|
customElementCb({
|
|
@@ -12123,8 +12125,8 @@ function canMonkeyPatchNestedCSSRule(prop) {
|
|
|
12123
12125
|
}
|
|
12124
12126
|
var CrossOriginIframeMirror = /*#__PURE__*/ function() {
|
|
12125
12127
|
function CrossOriginIframeMirror(generateIdFn) {
|
|
12126
|
-
__publicField(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());
|
|
12127
|
-
__publicField(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
12128
|
+
__publicField$1(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());
|
|
12129
|
+
__publicField$1(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
12128
12130
|
this.generateIdFn = generateIdFn;
|
|
12129
12131
|
}
|
|
12130
12132
|
var _proto = CrossOriginIframeMirror.prototype;
|
|
@@ -12190,17 +12192,17 @@ var CrossOriginIframeMirror = /*#__PURE__*/ function() {
|
|
|
12190
12192
|
}();
|
|
12191
12193
|
var IframeManager = /*#__PURE__*/ function() {
|
|
12192
12194
|
function IframeManager(options) {
|
|
12193
|
-
__publicField(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
12194
|
-
__publicField(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
12195
|
-
__publicField(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
12196
|
-
__publicField(this, "crossOriginIframeStyleMirror");
|
|
12197
|
-
__publicField(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
12198
|
-
__publicField(this, "mirror");
|
|
12199
|
-
__publicField(this, "mutationCb");
|
|
12200
|
-
__publicField(this, "wrappedEmit");
|
|
12201
|
-
__publicField(this, "loadListener");
|
|
12202
|
-
__publicField(this, "stylesheetManager");
|
|
12203
|
-
__publicField(this, "recordCrossOriginIframes");
|
|
12195
|
+
__publicField$1(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
12196
|
+
__publicField$1(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
12197
|
+
__publicField$1(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
12198
|
+
__publicField$1(this, "crossOriginIframeStyleMirror");
|
|
12199
|
+
__publicField$1(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
12200
|
+
__publicField$1(this, "mirror");
|
|
12201
|
+
__publicField$1(this, "mutationCb");
|
|
12202
|
+
__publicField$1(this, "wrappedEmit");
|
|
12203
|
+
__publicField$1(this, "loadListener");
|
|
12204
|
+
__publicField$1(this, "stylesheetManager");
|
|
12205
|
+
__publicField$1(this, "recordCrossOriginIframes");
|
|
12204
12206
|
this.mutationCb = options.mutationCb;
|
|
12205
12207
|
this.wrappedEmit = options.wrappedEmit;
|
|
12206
12208
|
this.stylesheetManager = options.stylesheetManager;
|
|
@@ -12447,12 +12449,12 @@ var IframeManager = /*#__PURE__*/ function() {
|
|
|
12447
12449
|
}();
|
|
12448
12450
|
var ShadowDomManager = /*#__PURE__*/ function() {
|
|
12449
12451
|
function ShadowDomManager(options) {
|
|
12450
|
-
__publicField(this, "shadowDoms", /* @__PURE__ */ new WeakSet());
|
|
12451
|
-
__publicField(this, "mutationCb");
|
|
12452
|
-
__publicField(this, "scrollCb");
|
|
12453
|
-
__publicField(this, "bypassOptions");
|
|
12454
|
-
__publicField(this, "mirror");
|
|
12455
|
-
__publicField(this, "restoreHandlers", []);
|
|
12452
|
+
__publicField$1(this, "shadowDoms", /* @__PURE__ */ new WeakSet());
|
|
12453
|
+
__publicField$1(this, "mutationCb");
|
|
12454
|
+
__publicField$1(this, "scrollCb");
|
|
12455
|
+
__publicField$1(this, "bypassOptions");
|
|
12456
|
+
__publicField$1(this, "mirror");
|
|
12457
|
+
__publicField$1(this, "restoreHandlers", []);
|
|
12456
12458
|
this.mutationCb = options.mutationCb;
|
|
12457
12459
|
this.scrollCb = options.scrollCb;
|
|
12458
12460
|
this.bypassOptions = options.bypassOptions;
|
|
@@ -12503,7 +12505,7 @@ var ShadowDomManager = /*#__PURE__*/ function() {
|
|
|
12503
12505
|
* Patch 'attachShadow' to observe newly added shadow doms.
|
|
12504
12506
|
*/ _proto.patchAttachShadow = function patchAttachShadow(element, doc) {
|
|
12505
12507
|
var manager = this;
|
|
12506
|
-
this.restoreHandlers.push(patch(element.prototype, "attachShadow", function(original) {
|
|
12508
|
+
this.restoreHandlers.push(patch$2(element.prototype, "attachShadow", function(original) {
|
|
12507
12509
|
return function(option) {
|
|
12508
12510
|
var sRoot = original.call(this, option);
|
|
12509
12511
|
var shadowRootEl = index.shadowRoot(this);
|
|
@@ -12669,7 +12671,7 @@ function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
12669
12671
|
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== "function") {
|
|
12670
12672
|
return "continue";
|
|
12671
12673
|
}
|
|
12672
|
-
var restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function(original) {
|
|
12674
|
+
var restoreHandler = patch$2(win.CanvasRenderingContext2D.prototype, prop, function(original) {
|
|
12673
12675
|
return function() {
|
|
12674
12676
|
var _this = this;
|
|
12675
12677
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -12720,7 +12722,7 @@ function getNormalizedContextName(contextType) {
|
|
|
12720
12722
|
function initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDrawingBufferToTrue) {
|
|
12721
12723
|
var handlers = [];
|
|
12722
12724
|
try {
|
|
12723
|
-
var restoreHandler = patch(win.HTMLCanvasElement.prototype, "getContext", function(original) {
|
|
12725
|
+
var restoreHandler = patch$2(win.HTMLCanvasElement.prototype, "getContext", function(original) {
|
|
12724
12726
|
return function(contextType) {
|
|
12725
12727
|
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
12726
12728
|
args[_key - 1] = arguments[_key];
|
|
@@ -12775,7 +12777,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
12775
12777
|
if (typeof prototype[prop] !== "function") {
|
|
12776
12778
|
return "continue";
|
|
12777
12779
|
}
|
|
12778
|
-
var restoreHandler = patch(prototype, prop, function(original) {
|
|
12780
|
+
var restoreHandler = patch$2(prototype, prop, function(original) {
|
|
12779
12781
|
return function() {
|
|
12780
12782
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
12781
12783
|
args[_key] = arguments[_key];
|
|
@@ -12864,17 +12866,17 @@ function WorkerWrapper(options) {
|
|
|
12864
12866
|
var CanvasManager = /*#__PURE__*/ function() {
|
|
12865
12867
|
function CanvasManager(options) {
|
|
12866
12868
|
var _this = this;
|
|
12867
|
-
__publicField(this, "pendingCanvasMutations", /* @__PURE__ */ new Map());
|
|
12868
|
-
__publicField(this, "rafStamps", {
|
|
12869
|
+
__publicField$1(this, "pendingCanvasMutations", /* @__PURE__ */ new Map());
|
|
12870
|
+
__publicField$1(this, "rafStamps", {
|
|
12869
12871
|
latestId: 0,
|
|
12870
12872
|
invokeId: null
|
|
12871
12873
|
});
|
|
12872
|
-
__publicField(this, "mirror");
|
|
12873
|
-
__publicField(this, "mutationCb");
|
|
12874
|
-
__publicField(this, "resetObservers");
|
|
12875
|
-
__publicField(this, "frozen", false);
|
|
12876
|
-
__publicField(this, "locked", false);
|
|
12877
|
-
__publicField(this, "processMutation", function(target, mutation) {
|
|
12874
|
+
__publicField$1(this, "mirror");
|
|
12875
|
+
__publicField$1(this, "mutationCb");
|
|
12876
|
+
__publicField$1(this, "resetObservers");
|
|
12877
|
+
__publicField$1(this, "frozen", false);
|
|
12878
|
+
__publicField$1(this, "locked", false);
|
|
12879
|
+
__publicField$1(this, "processMutation", function(target, mutation) {
|
|
12878
12880
|
var newFrame = _this.rafStamps.invokeId && _this.rafStamps.latestId !== _this.rafStamps.invokeId;
|
|
12879
12881
|
if (newFrame || !_this.rafStamps.invokeId) _this.rafStamps.invokeId = _this.rafStamps.latestId;
|
|
12880
12882
|
if (!_this.pendingCanvasMutations.has(target)) {
|
|
@@ -13087,10 +13089,10 @@ var CanvasManager = /*#__PURE__*/ function() {
|
|
|
13087
13089
|
}();
|
|
13088
13090
|
var StylesheetManager = /*#__PURE__*/ function() {
|
|
13089
13091
|
function StylesheetManager(options) {
|
|
13090
|
-
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
13091
|
-
__publicField(this, "mutationCb");
|
|
13092
|
-
__publicField(this, "adoptedStyleSheetCb");
|
|
13093
|
-
__publicField(this, "styleMirror", new StyleSheetMirror());
|
|
13092
|
+
__publicField$1(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
13093
|
+
__publicField$1(this, "mutationCb");
|
|
13094
|
+
__publicField$1(this, "adoptedStyleSheetCb");
|
|
13095
|
+
__publicField$1(this, "styleMirror", new StyleSheetMirror());
|
|
13094
13096
|
this.mutationCb = options.mutationCb;
|
|
13095
13097
|
this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;
|
|
13096
13098
|
}
|
|
@@ -13152,8 +13154,8 @@ var StylesheetManager = /*#__PURE__*/ function() {
|
|
|
13152
13154
|
}();
|
|
13153
13155
|
var ProcessedNodeManager = /*#__PURE__*/ function() {
|
|
13154
13156
|
function ProcessedNodeManager() {
|
|
13155
|
-
__publicField(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
13156
|
-
__publicField(this, "active", false);
|
|
13157
|
+
__publicField$1(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
13158
|
+
__publicField$1(this, "active", false);
|
|
13157
13159
|
}
|
|
13158
13160
|
var _proto = ProcessedNodeManager.prototype;
|
|
13159
13161
|
_proto.inOtherBuffer = function inOtherBuffer(node2, thisBuffer) {
|
|
@@ -13678,6 +13680,493 @@ var n;
|
|
|
13678
13680
|
record.addCustomEvent;
|
|
13679
13681
|
record.freezePage;
|
|
13680
13682
|
record.takeFullSnapshot;
|
|
13683
|
+
var __defProp = Object.defineProperty;
|
|
13684
|
+
var __defNormalProp = function(obj, key, value) {
|
|
13685
|
+
return key in obj ? __defProp(obj, key, {
|
|
13686
|
+
enumerable: true,
|
|
13687
|
+
configurable: true,
|
|
13688
|
+
writable: true,
|
|
13689
|
+
value: value
|
|
13690
|
+
}) : obj[key] = value;
|
|
13691
|
+
};
|
|
13692
|
+
var __publicField = function(obj, key, value) {
|
|
13693
|
+
return __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
13694
|
+
};
|
|
13695
|
+
function patch(source, name, replacement) {
|
|
13696
|
+
try {
|
|
13697
|
+
if (!(name in source)) {
|
|
13698
|
+
return function() {};
|
|
13699
|
+
}
|
|
13700
|
+
var original = source[name];
|
|
13701
|
+
var wrapped = replacement(original);
|
|
13702
|
+
if (typeof wrapped === "function") {
|
|
13703
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
13704
|
+
Object.defineProperties(wrapped, {
|
|
13705
|
+
__rrweb_original__: {
|
|
13706
|
+
enumerable: false,
|
|
13707
|
+
value: original
|
|
13708
|
+
}
|
|
13709
|
+
});
|
|
13710
|
+
}
|
|
13711
|
+
source[name] = wrapped;
|
|
13712
|
+
return function() {
|
|
13713
|
+
source[name] = original;
|
|
13714
|
+
};
|
|
13715
|
+
} catch (e) {
|
|
13716
|
+
return function() {};
|
|
13717
|
+
}
|
|
13718
|
+
}
|
|
13719
|
+
var StackFrame = /*#__PURE__*/ function() {
|
|
13720
|
+
function StackFrame(obj) {
|
|
13721
|
+
__publicField(this, "fileName");
|
|
13722
|
+
__publicField(this, "functionName");
|
|
13723
|
+
__publicField(this, "lineNumber");
|
|
13724
|
+
__publicField(this, "columnNumber");
|
|
13725
|
+
this.fileName = obj.fileName || "";
|
|
13726
|
+
this.functionName = obj.functionName || "";
|
|
13727
|
+
this.lineNumber = obj.lineNumber;
|
|
13728
|
+
this.columnNumber = obj.columnNumber;
|
|
13729
|
+
}
|
|
13730
|
+
var _proto = StackFrame.prototype;
|
|
13731
|
+
_proto.toString = function toString() {
|
|
13732
|
+
var lineNumber = this.lineNumber || "";
|
|
13733
|
+
var columnNumber = this.columnNumber || "";
|
|
13734
|
+
if (this.functionName) return this.functionName + " (" + this.fileName + ":" + lineNumber + ":" + columnNumber + ")";
|
|
13735
|
+
return this.fileName + ":" + lineNumber + ":" + columnNumber;
|
|
13736
|
+
};
|
|
13737
|
+
return StackFrame;
|
|
13738
|
+
}();
|
|
13739
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
13740
|
+
var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
13741
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
13742
|
+
var ErrorStackParser = {
|
|
13743
|
+
/**
|
|
13744
|
+
* Given an Error object, extract the most information from it.
|
|
13745
|
+
*/ parse: function parse(error) {
|
|
13746
|
+
if (!error) {
|
|
13747
|
+
return [];
|
|
13748
|
+
}
|
|
13749
|
+
if (// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13750
|
+
// @ts-ignore
|
|
13751
|
+
typeof error.stacktrace !== "undefined" || // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13752
|
+
// @ts-ignore
|
|
13753
|
+
typeof error["opera#sourceloc"] !== "undefined") {
|
|
13754
|
+
return this.parseOpera(error);
|
|
13755
|
+
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
13756
|
+
return this.parseV8OrIE(error);
|
|
13757
|
+
} else if (error.stack) {
|
|
13758
|
+
return this.parseFFOrSafari(error);
|
|
13759
|
+
} else {
|
|
13760
|
+
console.warn("[console-record-plugin]: Failed to parse error object:", error);
|
|
13761
|
+
return [];
|
|
13762
|
+
}
|
|
13763
|
+
},
|
|
13764
|
+
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
13765
|
+
extractLocation: function extractLocation(urlLike) {
|
|
13766
|
+
if (urlLike.indexOf(":") === -1) {
|
|
13767
|
+
return [
|
|
13768
|
+
urlLike
|
|
13769
|
+
];
|
|
13770
|
+
}
|
|
13771
|
+
var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
13772
|
+
var parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
13773
|
+
if (!parts) throw new Error("Cannot parse given url: " + urlLike);
|
|
13774
|
+
return [
|
|
13775
|
+
parts[1],
|
|
13776
|
+
parts[2] || void 0,
|
|
13777
|
+
parts[3] || void 0
|
|
13778
|
+
];
|
|
13779
|
+
},
|
|
13780
|
+
parseV8OrIE: function parseV8OrIE(error) {
|
|
13781
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13782
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
13783
|
+
}, this);
|
|
13784
|
+
return filtered.map(function(line) {
|
|
13785
|
+
if (line.indexOf("(eval ") > -1) {
|
|
13786
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(\),.*$)/g, "");
|
|
13787
|
+
}
|
|
13788
|
+
var sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(");
|
|
13789
|
+
var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
13790
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
13791
|
+
var tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
13792
|
+
var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
|
|
13793
|
+
var functionName = tokens.join(" ") || void 0;
|
|
13794
|
+
var fileName = [
|
|
13795
|
+
"eval",
|
|
13796
|
+
"<anonymous>"
|
|
13797
|
+
].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];
|
|
13798
|
+
return new StackFrame({
|
|
13799
|
+
functionName: functionName,
|
|
13800
|
+
fileName: fileName,
|
|
13801
|
+
lineNumber: locationParts[1],
|
|
13802
|
+
columnNumber: locationParts[2]
|
|
13803
|
+
});
|
|
13804
|
+
}, this);
|
|
13805
|
+
},
|
|
13806
|
+
parseFFOrSafari: function parseFFOrSafari(error) {
|
|
13807
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13808
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
13809
|
+
}, this);
|
|
13810
|
+
return filtered.map(function(line) {
|
|
13811
|
+
if (line.indexOf(" > eval") > -1) {
|
|
13812
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
|
|
13813
|
+
}
|
|
13814
|
+
if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
|
|
13815
|
+
return new StackFrame({
|
|
13816
|
+
functionName: line
|
|
13817
|
+
});
|
|
13818
|
+
} else {
|
|
13819
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
13820
|
+
var matches = line.match(functionNameRegex);
|
|
13821
|
+
var functionName = matches && matches[1] ? matches[1] : void 0;
|
|
13822
|
+
var locationParts = this.extractLocation(line.replace(functionNameRegex, ""));
|
|
13823
|
+
return new StackFrame({
|
|
13824
|
+
functionName: functionName,
|
|
13825
|
+
fileName: locationParts[0],
|
|
13826
|
+
lineNumber: locationParts[1],
|
|
13827
|
+
columnNumber: locationParts[2]
|
|
13828
|
+
});
|
|
13829
|
+
}
|
|
13830
|
+
}, this);
|
|
13831
|
+
},
|
|
13832
|
+
parseOpera: function parseOpera(e) {
|
|
13833
|
+
if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) {
|
|
13834
|
+
return this.parseOpera9(e);
|
|
13835
|
+
} else if (!e.stack) {
|
|
13836
|
+
return this.parseOpera10(e);
|
|
13837
|
+
} else {
|
|
13838
|
+
return this.parseOpera11(e);
|
|
13839
|
+
}
|
|
13840
|
+
},
|
|
13841
|
+
parseOpera9: function parseOpera9(e) {
|
|
13842
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
13843
|
+
var lines = e.message.split("\n");
|
|
13844
|
+
var result = [];
|
|
13845
|
+
for(var i = 2, len = lines.length; i < len; i += 2){
|
|
13846
|
+
var match = lineRE.exec(lines[i]);
|
|
13847
|
+
if (match) {
|
|
13848
|
+
result.push(new StackFrame({
|
|
13849
|
+
fileName: match[2],
|
|
13850
|
+
lineNumber: parseFloat(match[1])
|
|
13851
|
+
}));
|
|
13852
|
+
}
|
|
13853
|
+
}
|
|
13854
|
+
return result;
|
|
13855
|
+
},
|
|
13856
|
+
parseOpera10: function parseOpera10(e) {
|
|
13857
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
13858
|
+
var lines = e.stacktrace.split("\n");
|
|
13859
|
+
var result = [];
|
|
13860
|
+
for(var i = 0, len = lines.length; i < len; i += 2){
|
|
13861
|
+
var match = lineRE.exec(lines[i]);
|
|
13862
|
+
if (match) {
|
|
13863
|
+
result.push(new StackFrame({
|
|
13864
|
+
functionName: match[3] || void 0,
|
|
13865
|
+
fileName: match[2],
|
|
13866
|
+
lineNumber: parseFloat(match[1])
|
|
13867
|
+
}));
|
|
13868
|
+
}
|
|
13869
|
+
}
|
|
13870
|
+
return result;
|
|
13871
|
+
},
|
|
13872
|
+
// Opera 10.65+ Error.stack very similar to FF/Safari
|
|
13873
|
+
parseOpera11: function parseOpera11(error) {
|
|
13874
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13875
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
13876
|
+
}, this);
|
|
13877
|
+
return filtered.map(function(line) {
|
|
13878
|
+
var tokens = line.split("@");
|
|
13879
|
+
var locationParts = this.extractLocation(tokens.pop());
|
|
13880
|
+
var functionCall = tokens.shift() || "";
|
|
13881
|
+
var functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0;
|
|
13882
|
+
return new StackFrame({
|
|
13883
|
+
functionName: functionName,
|
|
13884
|
+
fileName: locationParts[0],
|
|
13885
|
+
lineNumber: locationParts[1],
|
|
13886
|
+
columnNumber: locationParts[2]
|
|
13887
|
+
});
|
|
13888
|
+
}, this);
|
|
13889
|
+
}
|
|
13890
|
+
};
|
|
13891
|
+
function pathToSelector(node) {
|
|
13892
|
+
if (!node || !node.outerHTML) {
|
|
13893
|
+
return "";
|
|
13894
|
+
}
|
|
13895
|
+
var path = "";
|
|
13896
|
+
while(node.parentElement){
|
|
13897
|
+
var name = node.localName;
|
|
13898
|
+
if (!name) {
|
|
13899
|
+
break;
|
|
13900
|
+
}
|
|
13901
|
+
name = name.toLowerCase();
|
|
13902
|
+
var parent = node.parentElement;
|
|
13903
|
+
var domSiblings = [];
|
|
13904
|
+
if (parent.children && parent.children.length > 0) {
|
|
13905
|
+
for(var i = 0; i < parent.children.length; i++){
|
|
13906
|
+
var sibling = parent.children[i];
|
|
13907
|
+
if (sibling.localName && sibling.localName.toLowerCase) {
|
|
13908
|
+
if (sibling.localName.toLowerCase() === name) {
|
|
13909
|
+
domSiblings.push(sibling);
|
|
13910
|
+
}
|
|
13911
|
+
}
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13914
|
+
if (domSiblings.length > 1) {
|
|
13915
|
+
name += ":eq(" + domSiblings.indexOf(node) + ")";
|
|
13916
|
+
}
|
|
13917
|
+
path = name + (path ? ">" + path : "");
|
|
13918
|
+
node = parent;
|
|
13919
|
+
}
|
|
13920
|
+
return path;
|
|
13921
|
+
}
|
|
13922
|
+
function isObject(obj) {
|
|
13923
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
13924
|
+
}
|
|
13925
|
+
function isObjTooDeep(obj, limit) {
|
|
13926
|
+
if (limit === 0) {
|
|
13927
|
+
return true;
|
|
13928
|
+
}
|
|
13929
|
+
var keys = Object.keys(obj);
|
|
13930
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(keys), _step; !(_step = _iterator()).done;){
|
|
13931
|
+
var key = _step.value;
|
|
13932
|
+
if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
|
|
13933
|
+
return true;
|
|
13934
|
+
}
|
|
13935
|
+
}
|
|
13936
|
+
return false;
|
|
13937
|
+
}
|
|
13938
|
+
function stringify(obj, stringifyOptions) {
|
|
13939
|
+
var options = {
|
|
13940
|
+
numOfKeysLimit: 50,
|
|
13941
|
+
depthOfLimit: 4
|
|
13942
|
+
};
|
|
13943
|
+
Object.assign(options, stringifyOptions);
|
|
13944
|
+
var stack = [];
|
|
13945
|
+
var keys = [];
|
|
13946
|
+
return JSON.stringify(obj, function(key, value) {
|
|
13947
|
+
if (stack.length > 0) {
|
|
13948
|
+
var thisPos = stack.indexOf(this);
|
|
13949
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
13950
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
13951
|
+
if (~stack.indexOf(value)) {
|
|
13952
|
+
if (stack[0] === value) {
|
|
13953
|
+
value = "[Circular ~]";
|
|
13954
|
+
} else {
|
|
13955
|
+
value = "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
13956
|
+
}
|
|
13957
|
+
}
|
|
13958
|
+
} else {
|
|
13959
|
+
stack.push(value);
|
|
13960
|
+
}
|
|
13961
|
+
if (value === null) return value;
|
|
13962
|
+
if (value === void 0) return "undefined";
|
|
13963
|
+
if (shouldIgnore(value)) {
|
|
13964
|
+
return toString(value);
|
|
13965
|
+
}
|
|
13966
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "bigint") {
|
|
13967
|
+
return value.toString() + "n";
|
|
13968
|
+
}
|
|
13969
|
+
if (_instanceof(value, Event)) {
|
|
13970
|
+
var eventResult = {};
|
|
13971
|
+
for(var eventKey in value){
|
|
13972
|
+
var eventValue = value[eventKey];
|
|
13973
|
+
if (Array.isArray(eventValue)) {
|
|
13974
|
+
eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
|
|
13975
|
+
} else {
|
|
13976
|
+
eventResult[eventKey] = eventValue;
|
|
13977
|
+
}
|
|
13978
|
+
}
|
|
13979
|
+
return eventResult;
|
|
13980
|
+
} else if (_instanceof(value, Node)) {
|
|
13981
|
+
if (_instanceof(value, HTMLElement)) {
|
|
13982
|
+
return value ? value.outerHTML : "";
|
|
13983
|
+
}
|
|
13984
|
+
return value.nodeName;
|
|
13985
|
+
} else if (_instanceof(value, Error)) {
|
|
13986
|
+
return value.stack ? value.stack + "\nEnd of stack for Error object" : value.name + ": " + value.message;
|
|
13987
|
+
}
|
|
13988
|
+
return value;
|
|
13989
|
+
});
|
|
13990
|
+
function shouldIgnore(_obj) {
|
|
13991
|
+
if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
|
|
13992
|
+
return true;
|
|
13993
|
+
}
|
|
13994
|
+
if (typeof _obj === "function") {
|
|
13995
|
+
return true;
|
|
13996
|
+
}
|
|
13997
|
+
if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
13998
|
+
return true;
|
|
13999
|
+
}
|
|
14000
|
+
return false;
|
|
14001
|
+
}
|
|
14002
|
+
function toString(_obj) {
|
|
14003
|
+
var str = _obj.toString();
|
|
14004
|
+
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
14005
|
+
str = "" + str.slice(0, options.stringLengthLimit) + "...";
|
|
14006
|
+
}
|
|
14007
|
+
return str;
|
|
14008
|
+
}
|
|
14009
|
+
}
|
|
14010
|
+
var defaultLogOptions = {
|
|
14011
|
+
level: [
|
|
14012
|
+
"assert",
|
|
14013
|
+
"clear",
|
|
14014
|
+
"count",
|
|
14015
|
+
"countReset",
|
|
14016
|
+
"debug",
|
|
14017
|
+
"dir",
|
|
14018
|
+
"dirxml",
|
|
14019
|
+
"error",
|
|
14020
|
+
"group",
|
|
14021
|
+
"groupCollapsed",
|
|
14022
|
+
"groupEnd",
|
|
14023
|
+
"info",
|
|
14024
|
+
"log",
|
|
14025
|
+
"table",
|
|
14026
|
+
"time",
|
|
14027
|
+
"timeEnd",
|
|
14028
|
+
"timeLog",
|
|
14029
|
+
"trace",
|
|
14030
|
+
"warn"
|
|
14031
|
+
],
|
|
14032
|
+
lengthThreshold: 1e3,
|
|
14033
|
+
logger: "console"
|
|
14034
|
+
};
|
|
14035
|
+
function initLogObserver(cb, win, options) {
|
|
14036
|
+
var logOptions = options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions;
|
|
14037
|
+
var loggerType = logOptions.logger;
|
|
14038
|
+
if (!loggerType) {
|
|
14039
|
+
return function() {};
|
|
14040
|
+
}
|
|
14041
|
+
var logger;
|
|
14042
|
+
if (typeof loggerType === "string") {
|
|
14043
|
+
logger = win[loggerType];
|
|
14044
|
+
} else {
|
|
14045
|
+
logger = loggerType;
|
|
14046
|
+
}
|
|
14047
|
+
var logCount = 0;
|
|
14048
|
+
var inStack = false;
|
|
14049
|
+
var cancelHandlers = [];
|
|
14050
|
+
if (logOptions.level.includes("error")) {
|
|
14051
|
+
var errorHandler = function(event) {
|
|
14052
|
+
var message = event.message, error = event.error;
|
|
14053
|
+
var trace = ErrorStackParser.parse(error).map(function(stackFrame) {
|
|
14054
|
+
return stackFrame.toString();
|
|
14055
|
+
});
|
|
14056
|
+
var payload = [
|
|
14057
|
+
stringify(message, logOptions.stringifyOptions)
|
|
14058
|
+
];
|
|
14059
|
+
cb({
|
|
14060
|
+
level: "error",
|
|
14061
|
+
trace: trace,
|
|
14062
|
+
payload: payload
|
|
14063
|
+
});
|
|
14064
|
+
};
|
|
14065
|
+
win.addEventListener("error", errorHandler);
|
|
14066
|
+
cancelHandlers.push(function() {
|
|
14067
|
+
win.removeEventListener("error", errorHandler);
|
|
14068
|
+
});
|
|
14069
|
+
var unhandledrejectionHandler = function(event) {
|
|
14070
|
+
var error;
|
|
14071
|
+
var payload;
|
|
14072
|
+
if (_instanceof(event.reason, Error)) {
|
|
14073
|
+
error = event.reason;
|
|
14074
|
+
payload = [
|
|
14075
|
+
stringify("Uncaught (in promise) " + error.name + ": " + error.message, logOptions.stringifyOptions)
|
|
14076
|
+
];
|
|
14077
|
+
} else {
|
|
14078
|
+
error = new Error();
|
|
14079
|
+
payload = [
|
|
14080
|
+
stringify("Uncaught (in promise)", logOptions.stringifyOptions),
|
|
14081
|
+
stringify(event.reason, logOptions.stringifyOptions)
|
|
14082
|
+
];
|
|
14083
|
+
}
|
|
14084
|
+
var trace = ErrorStackParser.parse(error).map(function(stackFrame) {
|
|
14085
|
+
return stackFrame.toString();
|
|
14086
|
+
});
|
|
14087
|
+
cb({
|
|
14088
|
+
level: "error",
|
|
14089
|
+
trace: trace,
|
|
14090
|
+
payload: payload
|
|
14091
|
+
});
|
|
14092
|
+
};
|
|
14093
|
+
win.addEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
14094
|
+
cancelHandlers.push(function() {
|
|
14095
|
+
win.removeEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
14096
|
+
});
|
|
14097
|
+
}
|
|
14098
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(logOptions.level), _step; !(_step = _iterator()).done;){
|
|
14099
|
+
var levelType = _step.value;
|
|
14100
|
+
cancelHandlers.push(replace(logger, levelType));
|
|
14101
|
+
}
|
|
14102
|
+
return function() {
|
|
14103
|
+
cancelHandlers.forEach(function(h) {
|
|
14104
|
+
return h();
|
|
14105
|
+
});
|
|
14106
|
+
};
|
|
14107
|
+
function replace(_logger, level) {
|
|
14108
|
+
var _this = this;
|
|
14109
|
+
if (!_logger[level]) {
|
|
14110
|
+
return function() {};
|
|
14111
|
+
}
|
|
14112
|
+
return patch(_logger, level, function(original) {
|
|
14113
|
+
var _this1 = _this;
|
|
14114
|
+
return function() {
|
|
14115
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
14116
|
+
args[_key] = arguments[_key];
|
|
14117
|
+
}
|
|
14118
|
+
original.apply(_this1, args);
|
|
14119
|
+
if (level === "assert" && !!args[0]) {
|
|
14120
|
+
return;
|
|
14121
|
+
}
|
|
14122
|
+
if (inStack) {
|
|
14123
|
+
return;
|
|
14124
|
+
}
|
|
14125
|
+
inStack = true;
|
|
14126
|
+
try {
|
|
14127
|
+
var trace = ErrorStackParser.parse(new Error()).map(function(stackFrame) {
|
|
14128
|
+
return stackFrame.toString();
|
|
14129
|
+
}).splice(1);
|
|
14130
|
+
var argsForPayload = level === "assert" ? args.slice(1) : args;
|
|
14131
|
+
var payload = argsForPayload.map(function(s) {
|
|
14132
|
+
return stringify(s, logOptions.stringifyOptions);
|
|
14133
|
+
});
|
|
14134
|
+
logCount++;
|
|
14135
|
+
if (logCount < logOptions.lengthThreshold) {
|
|
14136
|
+
cb({
|
|
14137
|
+
level: level,
|
|
14138
|
+
trace: trace,
|
|
14139
|
+
payload: payload
|
|
14140
|
+
});
|
|
14141
|
+
} else if (logCount === logOptions.lengthThreshold) {
|
|
14142
|
+
cb({
|
|
14143
|
+
level: "warn",
|
|
14144
|
+
trace: [],
|
|
14145
|
+
payload: [
|
|
14146
|
+
stringify("The number of log records reached the threshold.")
|
|
14147
|
+
]
|
|
14148
|
+
});
|
|
14149
|
+
}
|
|
14150
|
+
} catch (error) {
|
|
14151
|
+
original.apply(void 0, [].concat([
|
|
14152
|
+
"rrweb logger error:",
|
|
14153
|
+
error
|
|
14154
|
+
], args));
|
|
14155
|
+
} finally{
|
|
14156
|
+
inStack = false;
|
|
14157
|
+
}
|
|
14158
|
+
};
|
|
14159
|
+
});
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14162
|
+
var PLUGIN_NAME = "rrweb/console@1";
|
|
14163
|
+
var getRecordConsolePlugin = function(options) {
|
|
14164
|
+
return {
|
|
14165
|
+
name: PLUGIN_NAME,
|
|
14166
|
+
observer: initLogObserver,
|
|
14167
|
+
options: options
|
|
14168
|
+
};
|
|
14169
|
+
};
|
|
13681
14170
|
|
|
13682
14171
|
var setImmediate = win['setImmediate'];
|
|
13683
14172
|
var builtInProp, cycle, schedulingQueue,
|
|
@@ -14043,7 +14532,7 @@ if (typeof Promise !== 'undefined' && Promise.toString().indexOf('[native code]'
|
|
|
14043
14532
|
|
|
14044
14533
|
var Config = {
|
|
14045
14534
|
DEBUG: false,
|
|
14046
|
-
LIB_VERSION: '2.
|
|
14535
|
+
LIB_VERSION: '2.72.0'
|
|
14047
14536
|
};
|
|
14048
14537
|
|
|
14049
14538
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15783,6 +16272,28 @@ if (typeof JSON !== 'undefined') {
|
|
|
15783
16272
|
JSONStringify = JSONStringify || _.JSONEncode;
|
|
15784
16273
|
JSONParse = JSONParse || _.JSONDecode;
|
|
15785
16274
|
|
|
16275
|
+
/**
|
|
16276
|
+
* Determines if CompressionStream API should be used.
|
|
16277
|
+
* Returns false for Safari 16.4 and 16.5 which have breaking CompressionStream bugs.
|
|
16278
|
+
* https://bugs.webkit.org/show_bug.cgi?id=254021
|
|
16279
|
+
* fixed in 16.6 https://developer.apple.com/documentation/safari-release-notes/safari-16_6-release-notes
|
|
16280
|
+
*/
|
|
16281
|
+
var canUseCompressionStream = function(userAgent, vendor, opera) {
|
|
16282
|
+
if (!win.CompressionStream) {
|
|
16283
|
+
return false;
|
|
16284
|
+
}
|
|
16285
|
+
|
|
16286
|
+
var browser = _.info.browser(userAgent, vendor, opera);
|
|
16287
|
+
var version = _.info.browserVersion(userAgent, vendor, opera);
|
|
16288
|
+
if (browser === 'Safari' || browser === 'Mobile Safari') {
|
|
16289
|
+
if (version >= 16.4 && version < 16.6) {
|
|
16290
|
+
return false;
|
|
16291
|
+
}
|
|
16292
|
+
}
|
|
16293
|
+
|
|
16294
|
+
return true;
|
|
16295
|
+
};
|
|
16296
|
+
|
|
15786
16297
|
// UNMINIFIED EXPORTS (for closure compiler)
|
|
15787
16298
|
_['info'] = _.info;
|
|
15788
16299
|
_['info']['browser'] = _.info.browser;
|
|
@@ -17158,6 +17669,7 @@ function isUserEvent(ev) {
|
|
|
17158
17669
|
* @property {number} idleExpires
|
|
17159
17670
|
* @property {number} maxExpires
|
|
17160
17671
|
* @property {number} replayStartTime
|
|
17672
|
+
* @property {number} lastEventTimestamp
|
|
17161
17673
|
* @property {number} seqNo
|
|
17162
17674
|
* @property {string} batchStartUrl
|
|
17163
17675
|
* @property {string} replayId
|
|
@@ -17178,6 +17690,7 @@ function isUserEvent(ev) {
|
|
|
17178
17690
|
* @property {number} idleExpires
|
|
17179
17691
|
* @property {number} maxExpires
|
|
17180
17692
|
* @property {number} replayStartTime
|
|
17693
|
+
* @property {number} lastEventTimestamp - the unix timestamp of the last recorded event from rrweb
|
|
17181
17694
|
* @property {number} seqNo
|
|
17182
17695
|
* @property {string} batchStartUrl
|
|
17183
17696
|
* @property {string} replayStartUrl
|
|
@@ -17211,6 +17724,7 @@ var SessionRecording = function(options) {
|
|
|
17211
17724
|
this.idleExpires = options.idleExpires || null;
|
|
17212
17725
|
this.maxExpires = options.maxExpires || null;
|
|
17213
17726
|
this.replayStartTime = options.replayStartTime || null;
|
|
17727
|
+
this.lastEventTimestamp = options.lastEventTimestamp || null;
|
|
17214
17728
|
this.seqNo = options.seqNo || 0;
|
|
17215
17729
|
|
|
17216
17730
|
this.idleTimeoutId = null;
|
|
@@ -17270,10 +17784,20 @@ SessionRecording.prototype.getUserIdInfo = function () {
|
|
|
17270
17784
|
|
|
17271
17785
|
SessionRecording.prototype.unloadPersistedData = function () {
|
|
17272
17786
|
this.batcher.stop();
|
|
17273
|
-
|
|
17274
|
-
|
|
17787
|
+
|
|
17788
|
+
return this.queueStorage.init().catch(function () {
|
|
17789
|
+
this.reportError('Error initializing IndexedDB storage for unloading persisted data.');
|
|
17790
|
+
}.bind(this)).then(function () {
|
|
17791
|
+
// if the recording is too short, just delete any stored events without flushing
|
|
17792
|
+
if (this.getDurationMs() < this._getRecordMinMs()) {
|
|
17275
17793
|
return this.queueStorage.removeItem(this.batcherKey);
|
|
17276
|
-
}
|
|
17794
|
+
}
|
|
17795
|
+
|
|
17796
|
+
return this.batcher.flush()
|
|
17797
|
+
.then(function () {
|
|
17798
|
+
return this.queueStorage.removeItem(this.batcherKey);
|
|
17799
|
+
}.bind(this));
|
|
17800
|
+
}.bind(this));
|
|
17277
17801
|
};
|
|
17278
17802
|
|
|
17279
17803
|
SessionRecording.prototype.getConfig = function(configVar) {
|
|
@@ -17308,11 +17832,7 @@ SessionRecording.prototype.startRecording = function (shouldStopBatcher) {
|
|
|
17308
17832
|
this.maxExpires = new Date().getTime() + this.recordMaxMs;
|
|
17309
17833
|
}
|
|
17310
17834
|
|
|
17311
|
-
this.recordMinMs = this.
|
|
17312
|
-
if (this.recordMinMs > MAX_VALUE_FOR_MIN_RECORDING_MS) {
|
|
17313
|
-
this.recordMinMs = MAX_VALUE_FOR_MIN_RECORDING_MS;
|
|
17314
|
-
logger$3.critical('record_min_ms cannot be greater than ' + MAX_VALUE_FOR_MIN_RECORDING_MS + 'ms. Capping value.');
|
|
17315
|
-
}
|
|
17835
|
+
this.recordMinMs = this._getRecordMinMs();
|
|
17316
17836
|
|
|
17317
17837
|
if (!this.replayStartTime) {
|
|
17318
17838
|
this.replayStartTime = new Date().getTime();
|
|
@@ -17360,6 +17880,11 @@ SessionRecording.prototype.startRecording = function (shouldStopBatcher) {
|
|
|
17360
17880
|
}
|
|
17361
17881
|
// promise only used to await during tests
|
|
17362
17882
|
this.__enqueuePromise = this.batcher.enqueue(ev);
|
|
17883
|
+
|
|
17884
|
+
// Capture the timestamp of the last event for duration calculation.
|
|
17885
|
+
if (this.lastEventTimestamp === null || ev.timestamp > this.lastEventTimestamp) {
|
|
17886
|
+
this.lastEventTimestamp = ev.timestamp;
|
|
17887
|
+
}
|
|
17363
17888
|
}.bind(this),
|
|
17364
17889
|
'blockClass': this.getConfig('record_block_class'),
|
|
17365
17890
|
'blockSelector': blockSelector,
|
|
@@ -17374,7 +17899,16 @@ SessionRecording.prototype.startRecording = function (shouldStopBatcher) {
|
|
|
17374
17899
|
'recordCanvas': this.getConfig('record_canvas'),
|
|
17375
17900
|
'sampling': {
|
|
17376
17901
|
'canvas': 15
|
|
17377
|
-
}
|
|
17902
|
+
},
|
|
17903
|
+
'plugins': this.getConfig('record_console') ? [
|
|
17904
|
+
getRecordConsolePlugin({
|
|
17905
|
+
stringifyOptions: {
|
|
17906
|
+
stringLengthLimit: 1000,
|
|
17907
|
+
numOfKeysLimit: 50,
|
|
17908
|
+
depthOfLimit: 2
|
|
17909
|
+
}
|
|
17910
|
+
})
|
|
17911
|
+
] : []
|
|
17378
17912
|
});
|
|
17379
17913
|
} catch (err) {
|
|
17380
17914
|
this.reportError('Unexpected error when starting rrweb recording.', err);
|
|
@@ -17459,6 +17993,7 @@ SessionRecording.prototype.serialize = function () {
|
|
|
17459
17993
|
'replayStartTime': this.replayStartTime,
|
|
17460
17994
|
'batchStartUrl': this.batchStartUrl,
|
|
17461
17995
|
'replayStartUrl': this.replayStartUrl,
|
|
17996
|
+
'lastEventTimestamp': this.lastEventTimestamp,
|
|
17462
17997
|
'idleExpires': this.idleExpires,
|
|
17463
17998
|
'maxExpires': this.maxExpires,
|
|
17464
17999
|
'tabId': tabId,
|
|
@@ -17480,6 +18015,7 @@ SessionRecording.deserialize = function (serializedRecording, options) {
|
|
|
17480
18015
|
idleExpires: serializedRecording['idleExpires'],
|
|
17481
18016
|
maxExpires: serializedRecording['maxExpires'],
|
|
17482
18017
|
replayStartTime: serializedRecording['replayStartTime'],
|
|
18018
|
+
lastEventTimestamp: serializedRecording['lastEventTimestamp'],
|
|
17483
18019
|
seqNo: serializedRecording['seqNo'],
|
|
17484
18020
|
sharedLockStorage: options.sharedLockStorage,
|
|
17485
18021
|
}));
|
|
@@ -17570,7 +18106,7 @@ SessionRecording.prototype._flushEvents = addOptOutCheckMixpanelLib(function (da
|
|
|
17570
18106
|
var eventsJson = JSON.stringify(data);
|
|
17571
18107
|
Object.assign(reqParams, this.getUserIdInfo());
|
|
17572
18108
|
|
|
17573
|
-
if (
|
|
18109
|
+
if (canUseCompressionStream(userAgent, navigator.vendor, windowOpera)) {
|
|
17574
18110
|
var jsonStream = new Blob([eventsJson], {type: 'application/json'}).stream();
|
|
17575
18111
|
var gzipStream = jsonStream.pipeThrough(new CompressionStream('gzip'));
|
|
17576
18112
|
new Response(gzipStream)
|
|
@@ -17599,6 +18135,38 @@ SessionRecording.prototype.reportError = function(msg, err) {
|
|
|
17599
18135
|
}
|
|
17600
18136
|
};
|
|
17601
18137
|
|
|
18138
|
+
/**
|
|
18139
|
+
* Calculates the duration of the recording in milliseconds, based on the start time and time of last recorded event.
|
|
18140
|
+
* @returns {number} The duration of the recording in milliseconds. Returns 0 if recording hasn't started.
|
|
18141
|
+
*/
|
|
18142
|
+
SessionRecording.prototype.getDurationMs = function() {
|
|
18143
|
+
if (this.replayStartTime === null) {
|
|
18144
|
+
return 0;
|
|
18145
|
+
}
|
|
18146
|
+
|
|
18147
|
+
// If the recording has no events, assume it is in progress and use the current time as the end time.
|
|
18148
|
+
if (this.lastEventTimestamp === null) {
|
|
18149
|
+
return new Date().getTime() - this.replayStartTime;
|
|
18150
|
+
}
|
|
18151
|
+
|
|
18152
|
+
return this.lastEventTimestamp - this.replayStartTime;
|
|
18153
|
+
};
|
|
18154
|
+
|
|
18155
|
+
/**
|
|
18156
|
+
* Lazily loads the minimum recording length config in milliseconds, respecting the maximum limit.
|
|
18157
|
+
* @returns {number} The minimum recording length in milliseconds.
|
|
18158
|
+
*/
|
|
18159
|
+
SessionRecording.prototype._getRecordMinMs = function() {
|
|
18160
|
+
var configValue = this.getConfig('record_min_ms');
|
|
18161
|
+
|
|
18162
|
+
if (configValue > MAX_VALUE_FOR_MIN_RECORDING_MS) {
|
|
18163
|
+
logger$3.critical('record_min_ms cannot be greater than ' + MAX_VALUE_FOR_MIN_RECORDING_MS + 'ms. Capping value.');
|
|
18164
|
+
return MAX_VALUE_FOR_MIN_RECORDING_MS;
|
|
18165
|
+
}
|
|
18166
|
+
|
|
18167
|
+
return configValue;
|
|
18168
|
+
};
|
|
18169
|
+
|
|
17602
18170
|
/**
|
|
17603
18171
|
* Module for handling the storage and retrieval of recording metadata as well as any active recordings.
|
|
17604
18172
|
* Makes sure that only one tab can be recording at a time.
|
|
@@ -18608,20 +19176,65 @@ function isDefinitelyNonInteractive(element) {
|
|
|
18608
19176
|
return false;
|
|
18609
19177
|
}
|
|
18610
19178
|
|
|
19179
|
+
/**
|
|
19180
|
+
* Get the composed path of a click event for elements embedded in shadow DOM.
|
|
19181
|
+
* @param {Event} event - event to get the composed path from
|
|
19182
|
+
* @returns {Array} the composed path of the click event
|
|
19183
|
+
*/
|
|
19184
|
+
function getClickEventComposedPath(event) {
|
|
19185
|
+
if ('composedPath' in event) {
|
|
19186
|
+
return event['composedPath']();
|
|
19187
|
+
}
|
|
19188
|
+
|
|
19189
|
+
return [];
|
|
19190
|
+
}
|
|
19191
|
+
|
|
19192
|
+
/**
|
|
19193
|
+
* Get the element from a click event, accounting for elements embedded in shadow DOM.
|
|
19194
|
+
* @param {Event} event - event to get the target from
|
|
19195
|
+
* @returns {Element | null} the element that was the target of the click event
|
|
19196
|
+
*/
|
|
19197
|
+
function getClickEventTargetElement(event) {
|
|
19198
|
+
var path = getClickEventComposedPath(event);
|
|
19199
|
+
|
|
19200
|
+
if (path && path.length > 0) {
|
|
19201
|
+
return path[0];
|
|
19202
|
+
}
|
|
19203
|
+
|
|
19204
|
+
return event['target'] || event['srcElement'];
|
|
19205
|
+
}
|
|
19206
|
+
|
|
18611
19207
|
/** @const */ var DEFAULT_RAGE_CLICK_THRESHOLD_PX = 30;
|
|
18612
19208
|
/** @const */ var DEFAULT_RAGE_CLICK_TIMEOUT_MS = 1000;
|
|
18613
19209
|
/** @const */ var DEFAULT_RAGE_CLICK_CLICK_COUNT = 4;
|
|
19210
|
+
/** @const */ var DEFAULT_RAGE_CLICK_INTERACTIVE_ELEMENTS_ONLY = false;
|
|
18614
19211
|
|
|
18615
19212
|
function RageClickTracker() {
|
|
18616
19213
|
this.clicks = [];
|
|
18617
19214
|
}
|
|
18618
19215
|
|
|
18619
|
-
|
|
19216
|
+
/**
|
|
19217
|
+
* Determines if a click event is part of a rage click sequence.
|
|
19218
|
+
* @param {Event} event - the original click event.
|
|
19219
|
+
* @param {import('../index.d.ts').RageClickConfig} options - configuration options for rage click detection.
|
|
19220
|
+
* @returns {boolean} - true if the click is considered a rage click, false otherwise.
|
|
19221
|
+
*/
|
|
19222
|
+
RageClickTracker.prototype.isRageClick = function(event, options) {
|
|
18620
19223
|
options = options || {};
|
|
18621
19224
|
var thresholdPx = options['threshold_px'] || DEFAULT_RAGE_CLICK_THRESHOLD_PX;
|
|
18622
19225
|
var timeoutMs = options['timeout_ms'] || DEFAULT_RAGE_CLICK_TIMEOUT_MS;
|
|
18623
19226
|
var clickCount = options['click_count'] || DEFAULT_RAGE_CLICK_CLICK_COUNT;
|
|
19227
|
+
var interactiveElementsOnly = options['interactive_elements_only'] || DEFAULT_RAGE_CLICK_INTERACTIVE_ELEMENTS_ONLY;
|
|
19228
|
+
|
|
19229
|
+
if (interactiveElementsOnly) {
|
|
19230
|
+
var target = getClickEventTargetElement(event);
|
|
19231
|
+
if (!target || isDefinitelyNonInteractive(target)) {
|
|
19232
|
+
return false;
|
|
19233
|
+
}
|
|
19234
|
+
}
|
|
19235
|
+
|
|
18624
19236
|
var timestamp = Date.now();
|
|
19237
|
+
var x = event['pageX'], y = event['pageY'];
|
|
18625
19238
|
|
|
18626
19239
|
var lastClick = this.clicks[this.clicks.length - 1];
|
|
18627
19240
|
if (
|
|
@@ -18652,28 +19265,16 @@ ShadowDOMObserver.prototype.getEventTarget = function(event) {
|
|
|
18652
19265
|
if (!this.observedShadowRoots) {
|
|
18653
19266
|
return;
|
|
18654
19267
|
}
|
|
18655
|
-
var path = this.getComposedPath(event);
|
|
18656
|
-
if (path && path.length) {
|
|
18657
|
-
return path[0];
|
|
18658
|
-
}
|
|
18659
19268
|
|
|
18660
|
-
return event
|
|
19269
|
+
return getClickEventTargetElement(event);
|
|
18661
19270
|
};
|
|
18662
19271
|
|
|
18663
|
-
|
|
18664
|
-
ShadowDOMObserver.prototype.getComposedPath = function(event) {
|
|
18665
|
-
if ('composedPath' in event) {
|
|
18666
|
-
return event['composedPath']();
|
|
18667
|
-
}
|
|
18668
|
-
|
|
18669
|
-
return [];
|
|
18670
|
-
};
|
|
18671
19272
|
ShadowDOMObserver.prototype.observeFromEvent = function(event) {
|
|
18672
19273
|
if (!this.observedShadowRoots) {
|
|
18673
19274
|
return;
|
|
18674
19275
|
}
|
|
18675
19276
|
|
|
18676
|
-
var path =
|
|
19277
|
+
var path = getClickEventComposedPath(event);
|
|
18677
19278
|
|
|
18678
19279
|
// Check each element in path for shadow roots
|
|
18679
19280
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -19425,7 +20026,7 @@ Autocapture.prototype.initRageClickTracking = function() {
|
|
|
19425
20026
|
return;
|
|
19426
20027
|
}
|
|
19427
20028
|
|
|
19428
|
-
if (this._rageClickTracker.isRageClick(ev
|
|
20029
|
+
if (this._rageClickTracker.isRageClick(ev, currentRageClickConfig)) {
|
|
19429
20030
|
this.trackDomEvent(ev, MP_EV_RAGE_CLICK);
|
|
19430
20031
|
}
|
|
19431
20032
|
}.bind(this);
|
|
@@ -21294,6 +21895,7 @@ var DEFAULT_CONFIG = {
|
|
|
21294
21895
|
'record_block_selector': 'img, video, audio',
|
|
21295
21896
|
'record_canvas': false,
|
|
21296
21897
|
'record_collect_fonts': false,
|
|
21898
|
+
'record_console': true,
|
|
21297
21899
|
'record_heatmap_data': false,
|
|
21298
21900
|
'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
|
|
21299
21901
|
'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
|