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