mixpanel-browser 2.71.0 → 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/.claude/settings.local.json +9 -0
- package/.github/workflows/tests.yml +1 -0
- package/CHANGELOG.md +10 -0
- package/dist/mixpanel-core.cjs.d.ts +47 -10
- package/dist/mixpanel-core.cjs.js +57 -21
- 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 +57 -21
- package/dist/mixpanel-with-recorder.d.ts +47 -10
- package/dist/mixpanel-with-recorder.js +737 -133
- 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 +737 -133
- package/dist/mixpanel.cjs.d.ts +47 -10
- package/dist/mixpanel.cjs.js +737 -133
- package/dist/mixpanel.globals.js +57 -21
- package/dist/mixpanel.min.js +149 -149
- package/dist/mixpanel.module.d.ts +47 -10
- package/dist/mixpanel.module.js +737 -133
- package/dist/mixpanel.umd.d.ts +47 -10
- package/dist/mixpanel.umd.js +737 -133
- 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 +7 -5
- 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
|
@@ -325,30 +325,30 @@
|
|
|
325
325
|
};
|
|
326
326
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
327
327
|
}
|
|
328
|
-
var __defProp = Object.defineProperty;
|
|
329
|
-
var __defNormalProp = function(obj, key, value) {
|
|
330
|
-
return key in obj ? __defProp(obj, key, {
|
|
328
|
+
var __defProp$1 = Object.defineProperty;
|
|
329
|
+
var __defNormalProp$1 = function(obj, key, value) {
|
|
330
|
+
return key in obj ? __defProp$1(obj, key, {
|
|
331
331
|
enumerable: true,
|
|
332
332
|
configurable: true,
|
|
333
333
|
writable: true,
|
|
334
334
|
value: value
|
|
335
335
|
}) : obj[key] = value;
|
|
336
336
|
};
|
|
337
|
-
var __publicField = function(obj, key, value) {
|
|
338
|
-
return __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
337
|
+
var __publicField$1 = function(obj, key, value) {
|
|
338
|
+
return __defNormalProp$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
339
339
|
};
|
|
340
340
|
var _a;
|
|
341
|
-
var __defProp$1 = Object.defineProperty;
|
|
342
|
-
var __defNormalProp$1 = function(obj, key, value) {
|
|
343
|
-
return key in obj ? __defProp$1(obj, key, {
|
|
341
|
+
var __defProp$1$1 = Object.defineProperty;
|
|
342
|
+
var __defNormalProp$1$1 = function(obj, key, value) {
|
|
343
|
+
return key in obj ? __defProp$1$1(obj, key, {
|
|
344
344
|
enumerable: true,
|
|
345
345
|
configurable: true,
|
|
346
346
|
writable: true,
|
|
347
347
|
value: value
|
|
348
348
|
}) : obj[key] = value;
|
|
349
349
|
};
|
|
350
|
-
var __publicField$1 = function(obj, key, value) {
|
|
351
|
-
return __defNormalProp$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
350
|
+
var __publicField$1$1 = function(obj, key, value) {
|
|
351
|
+
return __defNormalProp$1$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
352
352
|
};
|
|
353
353
|
var NodeType$3 = /* @__PURE__ */ function(NodeType2) {
|
|
354
354
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
@@ -618,8 +618,8 @@
|
|
|
618
618
|
}
|
|
619
619
|
var Mirror = /*#__PURE__*/ function() {
|
|
620
620
|
function Mirror() {
|
|
621
|
-
__publicField$1(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
622
|
-
__publicField$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
|
|
621
|
+
__publicField$1$1(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
622
|
+
__publicField$1$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
|
|
623
623
|
}
|
|
624
624
|
var _proto = Mirror.prototype;
|
|
625
625
|
_proto.getId = function getId(n2) {
|
|
@@ -2503,7 +2503,8 @@
|
|
|
2503
2503
|
return id;
|
|
2504
2504
|
};
|
|
2505
2505
|
var nonSecure$1 = {
|
|
2506
|
-
nanoid: nanoid$1$1
|
|
2506
|
+
nanoid: nanoid$1$1
|
|
2507
|
+
};
|
|
2507
2508
|
var SourceMapConsumer$2$1 = require$$2$1.SourceMapConsumer, SourceMapGenerator$2$1 = require$$2$1.SourceMapGenerator;
|
|
2508
2509
|
var existsSync$1 = require$$2$1.existsSync, readFileSync$1 = require$$2$1.readFileSync;
|
|
2509
2510
|
var dirname$1$1 = require$$2$1.dirname, join$1 = require$$2$1.join;
|
|
@@ -6654,7 +6655,8 @@
|
|
|
6654
6655
|
return id;
|
|
6655
6656
|
};
|
|
6656
6657
|
var nonSecure = {
|
|
6657
|
-
nanoid: nanoid$1
|
|
6658
|
+
nanoid: nanoid$1
|
|
6659
|
+
};
|
|
6658
6660
|
var SourceMapConsumer$2 = require$$2.SourceMapConsumer, SourceMapGenerator$2 = require$$2.SourceMapGenerator;
|
|
6659
6661
|
var existsSync = require$$2.existsSync, readFileSync = require$$2.readFileSync;
|
|
6660
6662
|
var dirname$1 = require$$2.dirname, join = require$$2.join;
|
|
@@ -9814,7 +9816,7 @@
|
|
|
9814
9816
|
var LazyResult22 = lazyResult;
|
|
9815
9817
|
var Container22 = container;
|
|
9816
9818
|
var Processor22 = processor;
|
|
9817
|
-
var stringify = stringify_1;
|
|
9819
|
+
var stringify$6 = stringify_1;
|
|
9818
9820
|
var fromJSON = fromJSON_1;
|
|
9819
9821
|
var Document222 = document$1$2;
|
|
9820
9822
|
var Warning22 = warning;
|
|
@@ -9868,7 +9870,7 @@
|
|
|
9868
9870
|
};
|
|
9869
9871
|
return creator;
|
|
9870
9872
|
};
|
|
9871
|
-
postcss.stringify = stringify;
|
|
9873
|
+
postcss.stringify = stringify$6;
|
|
9872
9874
|
postcss.parse = parse;
|
|
9873
9875
|
postcss.fromJSON = fromJSON;
|
|
9874
9876
|
postcss.list = list;
|
|
@@ -10118,7 +10120,7 @@
|
|
|
10118
10120
|
function mutationObserverCtor() {
|
|
10119
10121
|
return getUntaintedPrototype("MutationObserver").constructor;
|
|
10120
10122
|
}
|
|
10121
|
-
function patch(source, name, replacement) {
|
|
10123
|
+
function patch$2(source, name, replacement) {
|
|
10122
10124
|
try {
|
|
10123
10125
|
if (!(name in source)) {
|
|
10124
10126
|
return function() {};
|
|
@@ -10155,7 +10157,7 @@
|
|
|
10155
10157
|
querySelector: querySelector,
|
|
10156
10158
|
querySelectorAll: querySelectorAll,
|
|
10157
10159
|
mutationObserver: mutationObserverCtor,
|
|
10158
|
-
patch: patch
|
|
10160
|
+
patch: patch$2
|
|
10159
10161
|
};
|
|
10160
10162
|
function on(type, fn, target) {
|
|
10161
10163
|
if (target === void 0) target = document;
|
|
@@ -10350,9 +10352,9 @@
|
|
|
10350
10352
|
}
|
|
10351
10353
|
var StyleSheetMirror = /*#__PURE__*/ function() {
|
|
10352
10354
|
function StyleSheetMirror() {
|
|
10353
|
-
__publicField(this, "id", 1);
|
|
10354
|
-
__publicField(this, "styleIDMap", /* @__PURE__ */ new WeakMap());
|
|
10355
|
-
__publicField(this, "idStyleMap", /* @__PURE__ */ new Map());
|
|
10355
|
+
__publicField$1(this, "id", 1);
|
|
10356
|
+
__publicField$1(this, "styleIDMap", /* @__PURE__ */ new WeakMap());
|
|
10357
|
+
__publicField$1(this, "idStyleMap", /* @__PURE__ */ new Map());
|
|
10356
10358
|
}
|
|
10357
10359
|
var _proto = StyleSheetMirror.prototype;
|
|
10358
10360
|
_proto.getId = function getId(stylesheet) {
|
|
@@ -10488,9 +10490,9 @@
|
|
|
10488
10490
|
}
|
|
10489
10491
|
var DoubleLinkedList = /*#__PURE__*/ function() {
|
|
10490
10492
|
function DoubleLinkedList() {
|
|
10491
|
-
__publicField(this, "length", 0);
|
|
10492
|
-
__publicField(this, "head", null);
|
|
10493
|
-
__publicField(this, "tail", null);
|
|
10493
|
+
__publicField$1(this, "length", 0);
|
|
10494
|
+
__publicField$1(this, "head", null);
|
|
10495
|
+
__publicField$1(this, "tail", null);
|
|
10494
10496
|
}
|
|
10495
10497
|
var _proto = DoubleLinkedList.prototype;
|
|
10496
10498
|
_proto.get = function get(position) {
|
|
@@ -10571,14 +10573,14 @@
|
|
|
10571
10573
|
var MutationBuffer = /*#__PURE__*/ function() {
|
|
10572
10574
|
function MutationBuffer() {
|
|
10573
10575
|
var _this = this;
|
|
10574
|
-
__publicField(this, "frozen", false);
|
|
10575
|
-
__publicField(this, "locked", false);
|
|
10576
|
-
__publicField(this, "texts", []);
|
|
10577
|
-
__publicField(this, "attributes", []);
|
|
10578
|
-
__publicField(this, "attributeMap", /* @__PURE__ */ new WeakMap());
|
|
10579
|
-
__publicField(this, "removes", []);
|
|
10580
|
-
__publicField(this, "mapRemoves", []);
|
|
10581
|
-
__publicField(this, "movedMap", {});
|
|
10576
|
+
__publicField$1(this, "frozen", false);
|
|
10577
|
+
__publicField$1(this, "locked", false);
|
|
10578
|
+
__publicField$1(this, "texts", []);
|
|
10579
|
+
__publicField$1(this, "attributes", []);
|
|
10580
|
+
__publicField$1(this, "attributeMap", /* @__PURE__ */ new WeakMap());
|
|
10581
|
+
__publicField$1(this, "removes", []);
|
|
10582
|
+
__publicField$1(this, "mapRemoves", []);
|
|
10583
|
+
__publicField$1(this, "movedMap", {});
|
|
10582
10584
|
/**
|
|
10583
10585
|
* the browser MutationObserver emits multiple mutations after
|
|
10584
10586
|
* a delay for performance reasons, making tracing added nodes hard
|
|
@@ -10595,37 +10597,37 @@
|
|
|
10595
10597
|
* collect added nodes from the Set which have no duplicate copy. But
|
|
10596
10598
|
* this also causes newly added nodes will not be serialized with id ASAP,
|
|
10597
10599
|
* which means all the id related calculation should be lazy too.
|
|
10598
|
-
*/ __publicField(this, "addedSet", /* @__PURE__ */ new Set());
|
|
10599
|
-
__publicField(this, "movedSet", /* @__PURE__ */ new Set());
|
|
10600
|
-
__publicField(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
10601
|
-
__publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
10602
|
-
__publicField(this, "mutationCb");
|
|
10603
|
-
__publicField(this, "blockClass");
|
|
10604
|
-
__publicField(this, "blockSelector");
|
|
10605
|
-
__publicField(this, "maskTextClass");
|
|
10606
|
-
__publicField(this, "maskTextSelector");
|
|
10607
|
-
__publicField(this, "inlineStylesheet");
|
|
10608
|
-
__publicField(this, "maskInputOptions");
|
|
10609
|
-
__publicField(this, "maskTextFn");
|
|
10610
|
-
__publicField(this, "maskInputFn");
|
|
10611
|
-
__publicField(this, "keepIframeSrcFn");
|
|
10612
|
-
__publicField(this, "recordCanvas");
|
|
10613
|
-
__publicField(this, "inlineImages");
|
|
10614
|
-
__publicField(this, "slimDOMOptions");
|
|
10615
|
-
__publicField(this, "dataURLOptions");
|
|
10616
|
-
__publicField(this, "doc");
|
|
10617
|
-
__publicField(this, "mirror");
|
|
10618
|
-
__publicField(this, "iframeManager");
|
|
10619
|
-
__publicField(this, "stylesheetManager");
|
|
10620
|
-
__publicField(this, "shadowDomManager");
|
|
10621
|
-
__publicField(this, "canvasManager");
|
|
10622
|
-
__publicField(this, "processedNodeManager");
|
|
10623
|
-
__publicField(this, "unattachedDoc");
|
|
10624
|
-
__publicField(this, "processMutations", function(mutations) {
|
|
10600
|
+
*/ __publicField$1(this, "addedSet", /* @__PURE__ */ new Set());
|
|
10601
|
+
__publicField$1(this, "movedSet", /* @__PURE__ */ new Set());
|
|
10602
|
+
__publicField$1(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
10603
|
+
__publicField$1(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
10604
|
+
__publicField$1(this, "mutationCb");
|
|
10605
|
+
__publicField$1(this, "blockClass");
|
|
10606
|
+
__publicField$1(this, "blockSelector");
|
|
10607
|
+
__publicField$1(this, "maskTextClass");
|
|
10608
|
+
__publicField$1(this, "maskTextSelector");
|
|
10609
|
+
__publicField$1(this, "inlineStylesheet");
|
|
10610
|
+
__publicField$1(this, "maskInputOptions");
|
|
10611
|
+
__publicField$1(this, "maskTextFn");
|
|
10612
|
+
__publicField$1(this, "maskInputFn");
|
|
10613
|
+
__publicField$1(this, "keepIframeSrcFn");
|
|
10614
|
+
__publicField$1(this, "recordCanvas");
|
|
10615
|
+
__publicField$1(this, "inlineImages");
|
|
10616
|
+
__publicField$1(this, "slimDOMOptions");
|
|
10617
|
+
__publicField$1(this, "dataURLOptions");
|
|
10618
|
+
__publicField$1(this, "doc");
|
|
10619
|
+
__publicField$1(this, "mirror");
|
|
10620
|
+
__publicField$1(this, "iframeManager");
|
|
10621
|
+
__publicField$1(this, "stylesheetManager");
|
|
10622
|
+
__publicField$1(this, "shadowDomManager");
|
|
10623
|
+
__publicField$1(this, "canvasManager");
|
|
10624
|
+
__publicField$1(this, "processedNodeManager");
|
|
10625
|
+
__publicField$1(this, "unattachedDoc");
|
|
10626
|
+
__publicField$1(this, "processMutations", function(mutations) {
|
|
10625
10627
|
mutations.forEach(_this.processMutation);
|
|
10626
10628
|
_this.emit();
|
|
10627
10629
|
});
|
|
10628
|
-
__publicField(this, "emit", function() {
|
|
10630
|
+
__publicField$1(this, "emit", function() {
|
|
10629
10631
|
if (_this.frozen || _this.locked) {
|
|
10630
10632
|
return;
|
|
10631
10633
|
}
|
|
@@ -10826,7 +10828,7 @@
|
|
|
10826
10828
|
_this.movedMap = {};
|
|
10827
10829
|
_this.mutationCb(payload);
|
|
10828
10830
|
});
|
|
10829
|
-
__publicField(this, "genTextAreaValueMutation", function(textarea) {
|
|
10831
|
+
__publicField$1(this, "genTextAreaValueMutation", function(textarea) {
|
|
10830
10832
|
var item = _this.attributeMap.get(textarea);
|
|
10831
10833
|
if (!item) {
|
|
10832
10834
|
item = {
|
|
@@ -10850,7 +10852,7 @@
|
|
|
10850
10852
|
maskInputFn: _this.maskInputFn
|
|
10851
10853
|
});
|
|
10852
10854
|
});
|
|
10853
|
-
__publicField(this, "processMutation", function(m) {
|
|
10855
|
+
__publicField$1(this, "processMutation", function(m) {
|
|
10854
10856
|
if (isIgnored(m.target, _this.mirror, _this.slimDOMOptions)) {
|
|
10855
10857
|
return;
|
|
10856
10858
|
}
|
|
@@ -10995,7 +10997,7 @@
|
|
|
10995
10997
|
});
|
|
10996
10998
|
/**
|
|
10997
10999
|
* Make sure you check if `n`'s parent is blocked before calling this function
|
|
10998
|
-
* */ __publicField(this, "genAdds", function(n2, target) {
|
|
11000
|
+
* */ __publicField$1(this, "genAdds", function(n2, target) {
|
|
10999
11001
|
if (_this.processedNodeManager.inOtherBuffer(n2, _this)) return;
|
|
11000
11002
|
if (_this.addedSet.has(n2) || _this.movedSet.has(n2)) return;
|
|
11001
11003
|
if (_this.mirror.hasNode(n2)) {
|
|
@@ -11841,7 +11843,7 @@
|
|
|
11841
11843
|
});
|
|
11842
11844
|
return fontFace;
|
|
11843
11845
|
};
|
|
11844
|
-
var restoreHandler = patch(doc.fonts, "add", function(original) {
|
|
11846
|
+
var restoreHandler = patch$2(doc.fonts, "add", function(original) {
|
|
11845
11847
|
return function(fontFace) {
|
|
11846
11848
|
setTimeout(callbackWrapper(function() {
|
|
11847
11849
|
var p = fontMap.get(fontFace);
|
|
@@ -11897,7 +11899,7 @@
|
|
|
11897
11899
|
var doc = param.doc, customElementCb = param.customElementCb;
|
|
11898
11900
|
var win = doc.defaultView;
|
|
11899
11901
|
if (!win || !win.customElements) return function() {};
|
|
11900
|
-
var restoreHandler = patch(win.customElements, "define", function(original) {
|
|
11902
|
+
var restoreHandler = patch$2(win.customElements, "define", function(original) {
|
|
11901
11903
|
return function(name, constructor, options) {
|
|
11902
11904
|
try {
|
|
11903
11905
|
customElementCb({
|
|
@@ -12124,8 +12126,8 @@
|
|
|
12124
12126
|
}
|
|
12125
12127
|
var CrossOriginIframeMirror = /*#__PURE__*/ function() {
|
|
12126
12128
|
function CrossOriginIframeMirror(generateIdFn) {
|
|
12127
|
-
__publicField(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());
|
|
12128
|
-
__publicField(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
12129
|
+
__publicField$1(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());
|
|
12130
|
+
__publicField$1(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
12129
12131
|
this.generateIdFn = generateIdFn;
|
|
12130
12132
|
}
|
|
12131
12133
|
var _proto = CrossOriginIframeMirror.prototype;
|
|
@@ -12191,17 +12193,17 @@
|
|
|
12191
12193
|
}();
|
|
12192
12194
|
var IframeManager = /*#__PURE__*/ function() {
|
|
12193
12195
|
function IframeManager(options) {
|
|
12194
|
-
__publicField(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
12195
|
-
__publicField(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
12196
|
-
__publicField(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
12197
|
-
__publicField(this, "crossOriginIframeStyleMirror");
|
|
12198
|
-
__publicField(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
12199
|
-
__publicField(this, "mirror");
|
|
12200
|
-
__publicField(this, "mutationCb");
|
|
12201
|
-
__publicField(this, "wrappedEmit");
|
|
12202
|
-
__publicField(this, "loadListener");
|
|
12203
|
-
__publicField(this, "stylesheetManager");
|
|
12204
|
-
__publicField(this, "recordCrossOriginIframes");
|
|
12196
|
+
__publicField$1(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
12197
|
+
__publicField$1(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
12198
|
+
__publicField$1(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
12199
|
+
__publicField$1(this, "crossOriginIframeStyleMirror");
|
|
12200
|
+
__publicField$1(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
12201
|
+
__publicField$1(this, "mirror");
|
|
12202
|
+
__publicField$1(this, "mutationCb");
|
|
12203
|
+
__publicField$1(this, "wrappedEmit");
|
|
12204
|
+
__publicField$1(this, "loadListener");
|
|
12205
|
+
__publicField$1(this, "stylesheetManager");
|
|
12206
|
+
__publicField$1(this, "recordCrossOriginIframes");
|
|
12205
12207
|
this.mutationCb = options.mutationCb;
|
|
12206
12208
|
this.wrappedEmit = options.wrappedEmit;
|
|
12207
12209
|
this.stylesheetManager = options.stylesheetManager;
|
|
@@ -12448,12 +12450,12 @@
|
|
|
12448
12450
|
}();
|
|
12449
12451
|
var ShadowDomManager = /*#__PURE__*/ function() {
|
|
12450
12452
|
function ShadowDomManager(options) {
|
|
12451
|
-
__publicField(this, "shadowDoms", /* @__PURE__ */ new WeakSet());
|
|
12452
|
-
__publicField(this, "mutationCb");
|
|
12453
|
-
__publicField(this, "scrollCb");
|
|
12454
|
-
__publicField(this, "bypassOptions");
|
|
12455
|
-
__publicField(this, "mirror");
|
|
12456
|
-
__publicField(this, "restoreHandlers", []);
|
|
12453
|
+
__publicField$1(this, "shadowDoms", /* @__PURE__ */ new WeakSet());
|
|
12454
|
+
__publicField$1(this, "mutationCb");
|
|
12455
|
+
__publicField$1(this, "scrollCb");
|
|
12456
|
+
__publicField$1(this, "bypassOptions");
|
|
12457
|
+
__publicField$1(this, "mirror");
|
|
12458
|
+
__publicField$1(this, "restoreHandlers", []);
|
|
12457
12459
|
this.mutationCb = options.mutationCb;
|
|
12458
12460
|
this.scrollCb = options.scrollCb;
|
|
12459
12461
|
this.bypassOptions = options.bypassOptions;
|
|
@@ -12504,7 +12506,7 @@
|
|
|
12504
12506
|
* Patch 'attachShadow' to observe newly added shadow doms.
|
|
12505
12507
|
*/ _proto.patchAttachShadow = function patchAttachShadow(element, doc) {
|
|
12506
12508
|
var manager = this;
|
|
12507
|
-
this.restoreHandlers.push(patch(element.prototype, "attachShadow", function(original) {
|
|
12509
|
+
this.restoreHandlers.push(patch$2(element.prototype, "attachShadow", function(original) {
|
|
12508
12510
|
return function(option) {
|
|
12509
12511
|
var sRoot = original.call(this, option);
|
|
12510
12512
|
var shadowRootEl = index.shadowRoot(this);
|
|
@@ -12670,7 +12672,7 @@
|
|
|
12670
12672
|
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== "function") {
|
|
12671
12673
|
return "continue";
|
|
12672
12674
|
}
|
|
12673
|
-
var restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function(original) {
|
|
12675
|
+
var restoreHandler = patch$2(win.CanvasRenderingContext2D.prototype, prop, function(original) {
|
|
12674
12676
|
return function() {
|
|
12675
12677
|
var _this = this;
|
|
12676
12678
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -12721,7 +12723,7 @@
|
|
|
12721
12723
|
function initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDrawingBufferToTrue) {
|
|
12722
12724
|
var handlers = [];
|
|
12723
12725
|
try {
|
|
12724
|
-
var restoreHandler = patch(win.HTMLCanvasElement.prototype, "getContext", function(original) {
|
|
12726
|
+
var restoreHandler = patch$2(win.HTMLCanvasElement.prototype, "getContext", function(original) {
|
|
12725
12727
|
return function(contextType) {
|
|
12726
12728
|
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
12727
12729
|
args[_key - 1] = arguments[_key];
|
|
@@ -12776,7 +12778,7 @@
|
|
|
12776
12778
|
if (typeof prototype[prop] !== "function") {
|
|
12777
12779
|
return "continue";
|
|
12778
12780
|
}
|
|
12779
|
-
var restoreHandler = patch(prototype, prop, function(original) {
|
|
12781
|
+
var restoreHandler = patch$2(prototype, prop, function(original) {
|
|
12780
12782
|
return function() {
|
|
12781
12783
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
12782
12784
|
args[_key] = arguments[_key];
|
|
@@ -12865,17 +12867,17 @@
|
|
|
12865
12867
|
var CanvasManager = /*#__PURE__*/ function() {
|
|
12866
12868
|
function CanvasManager(options) {
|
|
12867
12869
|
var _this = this;
|
|
12868
|
-
__publicField(this, "pendingCanvasMutations", /* @__PURE__ */ new Map());
|
|
12869
|
-
__publicField(this, "rafStamps", {
|
|
12870
|
+
__publicField$1(this, "pendingCanvasMutations", /* @__PURE__ */ new Map());
|
|
12871
|
+
__publicField$1(this, "rafStamps", {
|
|
12870
12872
|
latestId: 0,
|
|
12871
12873
|
invokeId: null
|
|
12872
12874
|
});
|
|
12873
|
-
__publicField(this, "mirror");
|
|
12874
|
-
__publicField(this, "mutationCb");
|
|
12875
|
-
__publicField(this, "resetObservers");
|
|
12876
|
-
__publicField(this, "frozen", false);
|
|
12877
|
-
__publicField(this, "locked", false);
|
|
12878
|
-
__publicField(this, "processMutation", function(target, mutation) {
|
|
12875
|
+
__publicField$1(this, "mirror");
|
|
12876
|
+
__publicField$1(this, "mutationCb");
|
|
12877
|
+
__publicField$1(this, "resetObservers");
|
|
12878
|
+
__publicField$1(this, "frozen", false);
|
|
12879
|
+
__publicField$1(this, "locked", false);
|
|
12880
|
+
__publicField$1(this, "processMutation", function(target, mutation) {
|
|
12879
12881
|
var newFrame = _this.rafStamps.invokeId && _this.rafStamps.latestId !== _this.rafStamps.invokeId;
|
|
12880
12882
|
if (newFrame || !_this.rafStamps.invokeId) _this.rafStamps.invokeId = _this.rafStamps.latestId;
|
|
12881
12883
|
if (!_this.pendingCanvasMutations.has(target)) {
|
|
@@ -13088,10 +13090,10 @@
|
|
|
13088
13090
|
}();
|
|
13089
13091
|
var StylesheetManager = /*#__PURE__*/ function() {
|
|
13090
13092
|
function StylesheetManager(options) {
|
|
13091
|
-
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
13092
|
-
__publicField(this, "mutationCb");
|
|
13093
|
-
__publicField(this, "adoptedStyleSheetCb");
|
|
13094
|
-
__publicField(this, "styleMirror", new StyleSheetMirror());
|
|
13093
|
+
__publicField$1(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
13094
|
+
__publicField$1(this, "mutationCb");
|
|
13095
|
+
__publicField$1(this, "adoptedStyleSheetCb");
|
|
13096
|
+
__publicField$1(this, "styleMirror", new StyleSheetMirror());
|
|
13095
13097
|
this.mutationCb = options.mutationCb;
|
|
13096
13098
|
this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;
|
|
13097
13099
|
}
|
|
@@ -13153,8 +13155,8 @@
|
|
|
13153
13155
|
}();
|
|
13154
13156
|
var ProcessedNodeManager = /*#__PURE__*/ function() {
|
|
13155
13157
|
function ProcessedNodeManager() {
|
|
13156
|
-
__publicField(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
13157
|
-
__publicField(this, "active", false);
|
|
13158
|
+
__publicField$1(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
13159
|
+
__publicField$1(this, "active", false);
|
|
13158
13160
|
}
|
|
13159
13161
|
var _proto = ProcessedNodeManager.prototype;
|
|
13160
13162
|
_proto.inOtherBuffer = function inOtherBuffer(node2, thisBuffer) {
|
|
@@ -13679,6 +13681,493 @@
|
|
|
13679
13681
|
record.addCustomEvent;
|
|
13680
13682
|
record.freezePage;
|
|
13681
13683
|
record.takeFullSnapshot;
|
|
13684
|
+
var __defProp = Object.defineProperty;
|
|
13685
|
+
var __defNormalProp = function(obj, key, value) {
|
|
13686
|
+
return key in obj ? __defProp(obj, key, {
|
|
13687
|
+
enumerable: true,
|
|
13688
|
+
configurable: true,
|
|
13689
|
+
writable: true,
|
|
13690
|
+
value: value
|
|
13691
|
+
}) : obj[key] = value;
|
|
13692
|
+
};
|
|
13693
|
+
var __publicField = function(obj, key, value) {
|
|
13694
|
+
return __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
13695
|
+
};
|
|
13696
|
+
function patch(source, name, replacement) {
|
|
13697
|
+
try {
|
|
13698
|
+
if (!(name in source)) {
|
|
13699
|
+
return function() {};
|
|
13700
|
+
}
|
|
13701
|
+
var original = source[name];
|
|
13702
|
+
var wrapped = replacement(original);
|
|
13703
|
+
if (typeof wrapped === "function") {
|
|
13704
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
13705
|
+
Object.defineProperties(wrapped, {
|
|
13706
|
+
__rrweb_original__: {
|
|
13707
|
+
enumerable: false,
|
|
13708
|
+
value: original
|
|
13709
|
+
}
|
|
13710
|
+
});
|
|
13711
|
+
}
|
|
13712
|
+
source[name] = wrapped;
|
|
13713
|
+
return function() {
|
|
13714
|
+
source[name] = original;
|
|
13715
|
+
};
|
|
13716
|
+
} catch (e) {
|
|
13717
|
+
return function() {};
|
|
13718
|
+
}
|
|
13719
|
+
}
|
|
13720
|
+
var StackFrame = /*#__PURE__*/ function() {
|
|
13721
|
+
function StackFrame(obj) {
|
|
13722
|
+
__publicField(this, "fileName");
|
|
13723
|
+
__publicField(this, "functionName");
|
|
13724
|
+
__publicField(this, "lineNumber");
|
|
13725
|
+
__publicField(this, "columnNumber");
|
|
13726
|
+
this.fileName = obj.fileName || "";
|
|
13727
|
+
this.functionName = obj.functionName || "";
|
|
13728
|
+
this.lineNumber = obj.lineNumber;
|
|
13729
|
+
this.columnNumber = obj.columnNumber;
|
|
13730
|
+
}
|
|
13731
|
+
var _proto = StackFrame.prototype;
|
|
13732
|
+
_proto.toString = function toString() {
|
|
13733
|
+
var lineNumber = this.lineNumber || "";
|
|
13734
|
+
var columnNumber = this.columnNumber || "";
|
|
13735
|
+
if (this.functionName) return this.functionName + " (" + this.fileName + ":" + lineNumber + ":" + columnNumber + ")";
|
|
13736
|
+
return this.fileName + ":" + lineNumber + ":" + columnNumber;
|
|
13737
|
+
};
|
|
13738
|
+
return StackFrame;
|
|
13739
|
+
}();
|
|
13740
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
13741
|
+
var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
13742
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
13743
|
+
var ErrorStackParser = {
|
|
13744
|
+
/**
|
|
13745
|
+
* Given an Error object, extract the most information from it.
|
|
13746
|
+
*/ parse: function parse(error) {
|
|
13747
|
+
if (!error) {
|
|
13748
|
+
return [];
|
|
13749
|
+
}
|
|
13750
|
+
if (// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13751
|
+
// @ts-ignore
|
|
13752
|
+
typeof error.stacktrace !== "undefined" || // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13753
|
+
// @ts-ignore
|
|
13754
|
+
typeof error["opera#sourceloc"] !== "undefined") {
|
|
13755
|
+
return this.parseOpera(error);
|
|
13756
|
+
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
13757
|
+
return this.parseV8OrIE(error);
|
|
13758
|
+
} else if (error.stack) {
|
|
13759
|
+
return this.parseFFOrSafari(error);
|
|
13760
|
+
} else {
|
|
13761
|
+
console.warn("[console-record-plugin]: Failed to parse error object:", error);
|
|
13762
|
+
return [];
|
|
13763
|
+
}
|
|
13764
|
+
},
|
|
13765
|
+
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
13766
|
+
extractLocation: function extractLocation(urlLike) {
|
|
13767
|
+
if (urlLike.indexOf(":") === -1) {
|
|
13768
|
+
return [
|
|
13769
|
+
urlLike
|
|
13770
|
+
];
|
|
13771
|
+
}
|
|
13772
|
+
var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
13773
|
+
var parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
13774
|
+
if (!parts) throw new Error("Cannot parse given url: " + urlLike);
|
|
13775
|
+
return [
|
|
13776
|
+
parts[1],
|
|
13777
|
+
parts[2] || void 0,
|
|
13778
|
+
parts[3] || void 0
|
|
13779
|
+
];
|
|
13780
|
+
},
|
|
13781
|
+
parseV8OrIE: function parseV8OrIE(error) {
|
|
13782
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13783
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
13784
|
+
}, this);
|
|
13785
|
+
return filtered.map(function(line) {
|
|
13786
|
+
if (line.indexOf("(eval ") > -1) {
|
|
13787
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(\),.*$)/g, "");
|
|
13788
|
+
}
|
|
13789
|
+
var sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(");
|
|
13790
|
+
var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
13791
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
13792
|
+
var tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
13793
|
+
var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
|
|
13794
|
+
var functionName = tokens.join(" ") || void 0;
|
|
13795
|
+
var fileName = [
|
|
13796
|
+
"eval",
|
|
13797
|
+
"<anonymous>"
|
|
13798
|
+
].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];
|
|
13799
|
+
return new StackFrame({
|
|
13800
|
+
functionName: functionName,
|
|
13801
|
+
fileName: fileName,
|
|
13802
|
+
lineNumber: locationParts[1],
|
|
13803
|
+
columnNumber: locationParts[2]
|
|
13804
|
+
});
|
|
13805
|
+
}, this);
|
|
13806
|
+
},
|
|
13807
|
+
parseFFOrSafari: function parseFFOrSafari(error) {
|
|
13808
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13809
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
13810
|
+
}, this);
|
|
13811
|
+
return filtered.map(function(line) {
|
|
13812
|
+
if (line.indexOf(" > eval") > -1) {
|
|
13813
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
|
|
13814
|
+
}
|
|
13815
|
+
if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
|
|
13816
|
+
return new StackFrame({
|
|
13817
|
+
functionName: line
|
|
13818
|
+
});
|
|
13819
|
+
} else {
|
|
13820
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
13821
|
+
var matches = line.match(functionNameRegex);
|
|
13822
|
+
var functionName = matches && matches[1] ? matches[1] : void 0;
|
|
13823
|
+
var locationParts = this.extractLocation(line.replace(functionNameRegex, ""));
|
|
13824
|
+
return new StackFrame({
|
|
13825
|
+
functionName: functionName,
|
|
13826
|
+
fileName: locationParts[0],
|
|
13827
|
+
lineNumber: locationParts[1],
|
|
13828
|
+
columnNumber: locationParts[2]
|
|
13829
|
+
});
|
|
13830
|
+
}
|
|
13831
|
+
}, this);
|
|
13832
|
+
},
|
|
13833
|
+
parseOpera: function parseOpera(e) {
|
|
13834
|
+
if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) {
|
|
13835
|
+
return this.parseOpera9(e);
|
|
13836
|
+
} else if (!e.stack) {
|
|
13837
|
+
return this.parseOpera10(e);
|
|
13838
|
+
} else {
|
|
13839
|
+
return this.parseOpera11(e);
|
|
13840
|
+
}
|
|
13841
|
+
},
|
|
13842
|
+
parseOpera9: function parseOpera9(e) {
|
|
13843
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
13844
|
+
var lines = e.message.split("\n");
|
|
13845
|
+
var result = [];
|
|
13846
|
+
for(var i = 2, len = lines.length; i < len; i += 2){
|
|
13847
|
+
var match = lineRE.exec(lines[i]);
|
|
13848
|
+
if (match) {
|
|
13849
|
+
result.push(new StackFrame({
|
|
13850
|
+
fileName: match[2],
|
|
13851
|
+
lineNumber: parseFloat(match[1])
|
|
13852
|
+
}));
|
|
13853
|
+
}
|
|
13854
|
+
}
|
|
13855
|
+
return result;
|
|
13856
|
+
},
|
|
13857
|
+
parseOpera10: function parseOpera10(e) {
|
|
13858
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
13859
|
+
var lines = e.stacktrace.split("\n");
|
|
13860
|
+
var result = [];
|
|
13861
|
+
for(var i = 0, len = lines.length; i < len; i += 2){
|
|
13862
|
+
var match = lineRE.exec(lines[i]);
|
|
13863
|
+
if (match) {
|
|
13864
|
+
result.push(new StackFrame({
|
|
13865
|
+
functionName: match[3] || void 0,
|
|
13866
|
+
fileName: match[2],
|
|
13867
|
+
lineNumber: parseFloat(match[1])
|
|
13868
|
+
}));
|
|
13869
|
+
}
|
|
13870
|
+
}
|
|
13871
|
+
return result;
|
|
13872
|
+
},
|
|
13873
|
+
// Opera 10.65+ Error.stack very similar to FF/Safari
|
|
13874
|
+
parseOpera11: function parseOpera11(error) {
|
|
13875
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13876
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
13877
|
+
}, this);
|
|
13878
|
+
return filtered.map(function(line) {
|
|
13879
|
+
var tokens = line.split("@");
|
|
13880
|
+
var locationParts = this.extractLocation(tokens.pop());
|
|
13881
|
+
var functionCall = tokens.shift() || "";
|
|
13882
|
+
var functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0;
|
|
13883
|
+
return new StackFrame({
|
|
13884
|
+
functionName: functionName,
|
|
13885
|
+
fileName: locationParts[0],
|
|
13886
|
+
lineNumber: locationParts[1],
|
|
13887
|
+
columnNumber: locationParts[2]
|
|
13888
|
+
});
|
|
13889
|
+
}, this);
|
|
13890
|
+
}
|
|
13891
|
+
};
|
|
13892
|
+
function pathToSelector(node) {
|
|
13893
|
+
if (!node || !node.outerHTML) {
|
|
13894
|
+
return "";
|
|
13895
|
+
}
|
|
13896
|
+
var path = "";
|
|
13897
|
+
while(node.parentElement){
|
|
13898
|
+
var name = node.localName;
|
|
13899
|
+
if (!name) {
|
|
13900
|
+
break;
|
|
13901
|
+
}
|
|
13902
|
+
name = name.toLowerCase();
|
|
13903
|
+
var parent = node.parentElement;
|
|
13904
|
+
var domSiblings = [];
|
|
13905
|
+
if (parent.children && parent.children.length > 0) {
|
|
13906
|
+
for(var i = 0; i < parent.children.length; i++){
|
|
13907
|
+
var sibling = parent.children[i];
|
|
13908
|
+
if (sibling.localName && sibling.localName.toLowerCase) {
|
|
13909
|
+
if (sibling.localName.toLowerCase() === name) {
|
|
13910
|
+
domSiblings.push(sibling);
|
|
13911
|
+
}
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13914
|
+
}
|
|
13915
|
+
if (domSiblings.length > 1) {
|
|
13916
|
+
name += ":eq(" + domSiblings.indexOf(node) + ")";
|
|
13917
|
+
}
|
|
13918
|
+
path = name + (path ? ">" + path : "");
|
|
13919
|
+
node = parent;
|
|
13920
|
+
}
|
|
13921
|
+
return path;
|
|
13922
|
+
}
|
|
13923
|
+
function isObject(obj) {
|
|
13924
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
13925
|
+
}
|
|
13926
|
+
function isObjTooDeep(obj, limit) {
|
|
13927
|
+
if (limit === 0) {
|
|
13928
|
+
return true;
|
|
13929
|
+
}
|
|
13930
|
+
var keys = Object.keys(obj);
|
|
13931
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(keys), _step; !(_step = _iterator()).done;){
|
|
13932
|
+
var key = _step.value;
|
|
13933
|
+
if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
|
|
13934
|
+
return true;
|
|
13935
|
+
}
|
|
13936
|
+
}
|
|
13937
|
+
return false;
|
|
13938
|
+
}
|
|
13939
|
+
function stringify(obj, stringifyOptions) {
|
|
13940
|
+
var options = {
|
|
13941
|
+
numOfKeysLimit: 50,
|
|
13942
|
+
depthOfLimit: 4
|
|
13943
|
+
};
|
|
13944
|
+
Object.assign(options, stringifyOptions);
|
|
13945
|
+
var stack = [];
|
|
13946
|
+
var keys = [];
|
|
13947
|
+
return JSON.stringify(obj, function(key, value) {
|
|
13948
|
+
if (stack.length > 0) {
|
|
13949
|
+
var thisPos = stack.indexOf(this);
|
|
13950
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
13951
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
13952
|
+
if (~stack.indexOf(value)) {
|
|
13953
|
+
if (stack[0] === value) {
|
|
13954
|
+
value = "[Circular ~]";
|
|
13955
|
+
} else {
|
|
13956
|
+
value = "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
13957
|
+
}
|
|
13958
|
+
}
|
|
13959
|
+
} else {
|
|
13960
|
+
stack.push(value);
|
|
13961
|
+
}
|
|
13962
|
+
if (value === null) return value;
|
|
13963
|
+
if (value === void 0) return "undefined";
|
|
13964
|
+
if (shouldIgnore(value)) {
|
|
13965
|
+
return toString(value);
|
|
13966
|
+
}
|
|
13967
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "bigint") {
|
|
13968
|
+
return value.toString() + "n";
|
|
13969
|
+
}
|
|
13970
|
+
if (_instanceof(value, Event)) {
|
|
13971
|
+
var eventResult = {};
|
|
13972
|
+
for(var eventKey in value){
|
|
13973
|
+
var eventValue = value[eventKey];
|
|
13974
|
+
if (Array.isArray(eventValue)) {
|
|
13975
|
+
eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
|
|
13976
|
+
} else {
|
|
13977
|
+
eventResult[eventKey] = eventValue;
|
|
13978
|
+
}
|
|
13979
|
+
}
|
|
13980
|
+
return eventResult;
|
|
13981
|
+
} else if (_instanceof(value, Node)) {
|
|
13982
|
+
if (_instanceof(value, HTMLElement)) {
|
|
13983
|
+
return value ? value.outerHTML : "";
|
|
13984
|
+
}
|
|
13985
|
+
return value.nodeName;
|
|
13986
|
+
} else if (_instanceof(value, Error)) {
|
|
13987
|
+
return value.stack ? value.stack + "\nEnd of stack for Error object" : value.name + ": " + value.message;
|
|
13988
|
+
}
|
|
13989
|
+
return value;
|
|
13990
|
+
});
|
|
13991
|
+
function shouldIgnore(_obj) {
|
|
13992
|
+
if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
|
|
13993
|
+
return true;
|
|
13994
|
+
}
|
|
13995
|
+
if (typeof _obj === "function") {
|
|
13996
|
+
return true;
|
|
13997
|
+
}
|
|
13998
|
+
if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
13999
|
+
return true;
|
|
14000
|
+
}
|
|
14001
|
+
return false;
|
|
14002
|
+
}
|
|
14003
|
+
function toString(_obj) {
|
|
14004
|
+
var str = _obj.toString();
|
|
14005
|
+
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
14006
|
+
str = "" + str.slice(0, options.stringLengthLimit) + "...";
|
|
14007
|
+
}
|
|
14008
|
+
return str;
|
|
14009
|
+
}
|
|
14010
|
+
}
|
|
14011
|
+
var defaultLogOptions = {
|
|
14012
|
+
level: [
|
|
14013
|
+
"assert",
|
|
14014
|
+
"clear",
|
|
14015
|
+
"count",
|
|
14016
|
+
"countReset",
|
|
14017
|
+
"debug",
|
|
14018
|
+
"dir",
|
|
14019
|
+
"dirxml",
|
|
14020
|
+
"error",
|
|
14021
|
+
"group",
|
|
14022
|
+
"groupCollapsed",
|
|
14023
|
+
"groupEnd",
|
|
14024
|
+
"info",
|
|
14025
|
+
"log",
|
|
14026
|
+
"table",
|
|
14027
|
+
"time",
|
|
14028
|
+
"timeEnd",
|
|
14029
|
+
"timeLog",
|
|
14030
|
+
"trace",
|
|
14031
|
+
"warn"
|
|
14032
|
+
],
|
|
14033
|
+
lengthThreshold: 1e3,
|
|
14034
|
+
logger: "console"
|
|
14035
|
+
};
|
|
14036
|
+
function initLogObserver(cb, win, options) {
|
|
14037
|
+
var logOptions = options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions;
|
|
14038
|
+
var loggerType = logOptions.logger;
|
|
14039
|
+
if (!loggerType) {
|
|
14040
|
+
return function() {};
|
|
14041
|
+
}
|
|
14042
|
+
var logger;
|
|
14043
|
+
if (typeof loggerType === "string") {
|
|
14044
|
+
logger = win[loggerType];
|
|
14045
|
+
} else {
|
|
14046
|
+
logger = loggerType;
|
|
14047
|
+
}
|
|
14048
|
+
var logCount = 0;
|
|
14049
|
+
var inStack = false;
|
|
14050
|
+
var cancelHandlers = [];
|
|
14051
|
+
if (logOptions.level.includes("error")) {
|
|
14052
|
+
var errorHandler = function(event) {
|
|
14053
|
+
var message = event.message, error = event.error;
|
|
14054
|
+
var trace = ErrorStackParser.parse(error).map(function(stackFrame) {
|
|
14055
|
+
return stackFrame.toString();
|
|
14056
|
+
});
|
|
14057
|
+
var payload = [
|
|
14058
|
+
stringify(message, logOptions.stringifyOptions)
|
|
14059
|
+
];
|
|
14060
|
+
cb({
|
|
14061
|
+
level: "error",
|
|
14062
|
+
trace: trace,
|
|
14063
|
+
payload: payload
|
|
14064
|
+
});
|
|
14065
|
+
};
|
|
14066
|
+
win.addEventListener("error", errorHandler);
|
|
14067
|
+
cancelHandlers.push(function() {
|
|
14068
|
+
win.removeEventListener("error", errorHandler);
|
|
14069
|
+
});
|
|
14070
|
+
var unhandledrejectionHandler = function(event) {
|
|
14071
|
+
var error;
|
|
14072
|
+
var payload;
|
|
14073
|
+
if (_instanceof(event.reason, Error)) {
|
|
14074
|
+
error = event.reason;
|
|
14075
|
+
payload = [
|
|
14076
|
+
stringify("Uncaught (in promise) " + error.name + ": " + error.message, logOptions.stringifyOptions)
|
|
14077
|
+
];
|
|
14078
|
+
} else {
|
|
14079
|
+
error = new Error();
|
|
14080
|
+
payload = [
|
|
14081
|
+
stringify("Uncaught (in promise)", logOptions.stringifyOptions),
|
|
14082
|
+
stringify(event.reason, logOptions.stringifyOptions)
|
|
14083
|
+
];
|
|
14084
|
+
}
|
|
14085
|
+
var trace = ErrorStackParser.parse(error).map(function(stackFrame) {
|
|
14086
|
+
return stackFrame.toString();
|
|
14087
|
+
});
|
|
14088
|
+
cb({
|
|
14089
|
+
level: "error",
|
|
14090
|
+
trace: trace,
|
|
14091
|
+
payload: payload
|
|
14092
|
+
});
|
|
14093
|
+
};
|
|
14094
|
+
win.addEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
14095
|
+
cancelHandlers.push(function() {
|
|
14096
|
+
win.removeEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
14097
|
+
});
|
|
14098
|
+
}
|
|
14099
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(logOptions.level), _step; !(_step = _iterator()).done;){
|
|
14100
|
+
var levelType = _step.value;
|
|
14101
|
+
cancelHandlers.push(replace(logger, levelType));
|
|
14102
|
+
}
|
|
14103
|
+
return function() {
|
|
14104
|
+
cancelHandlers.forEach(function(h) {
|
|
14105
|
+
return h();
|
|
14106
|
+
});
|
|
14107
|
+
};
|
|
14108
|
+
function replace(_logger, level) {
|
|
14109
|
+
var _this = this;
|
|
14110
|
+
if (!_logger[level]) {
|
|
14111
|
+
return function() {};
|
|
14112
|
+
}
|
|
14113
|
+
return patch(_logger, level, function(original) {
|
|
14114
|
+
var _this1 = _this;
|
|
14115
|
+
return function() {
|
|
14116
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
14117
|
+
args[_key] = arguments[_key];
|
|
14118
|
+
}
|
|
14119
|
+
original.apply(_this1, args);
|
|
14120
|
+
if (level === "assert" && !!args[0]) {
|
|
14121
|
+
return;
|
|
14122
|
+
}
|
|
14123
|
+
if (inStack) {
|
|
14124
|
+
return;
|
|
14125
|
+
}
|
|
14126
|
+
inStack = true;
|
|
14127
|
+
try {
|
|
14128
|
+
var trace = ErrorStackParser.parse(new Error()).map(function(stackFrame) {
|
|
14129
|
+
return stackFrame.toString();
|
|
14130
|
+
}).splice(1);
|
|
14131
|
+
var argsForPayload = level === "assert" ? args.slice(1) : args;
|
|
14132
|
+
var payload = argsForPayload.map(function(s) {
|
|
14133
|
+
return stringify(s, logOptions.stringifyOptions);
|
|
14134
|
+
});
|
|
14135
|
+
logCount++;
|
|
14136
|
+
if (logCount < logOptions.lengthThreshold) {
|
|
14137
|
+
cb({
|
|
14138
|
+
level: level,
|
|
14139
|
+
trace: trace,
|
|
14140
|
+
payload: payload
|
|
14141
|
+
});
|
|
14142
|
+
} else if (logCount === logOptions.lengthThreshold) {
|
|
14143
|
+
cb({
|
|
14144
|
+
level: "warn",
|
|
14145
|
+
trace: [],
|
|
14146
|
+
payload: [
|
|
14147
|
+
stringify("The number of log records reached the threshold.")
|
|
14148
|
+
]
|
|
14149
|
+
});
|
|
14150
|
+
}
|
|
14151
|
+
} catch (error) {
|
|
14152
|
+
original.apply(void 0, [].concat([
|
|
14153
|
+
"rrweb logger error:",
|
|
14154
|
+
error
|
|
14155
|
+
], args));
|
|
14156
|
+
} finally{
|
|
14157
|
+
inStack = false;
|
|
14158
|
+
}
|
|
14159
|
+
};
|
|
14160
|
+
});
|
|
14161
|
+
}
|
|
14162
|
+
}
|
|
14163
|
+
var PLUGIN_NAME = "rrweb/console@1";
|
|
14164
|
+
var getRecordConsolePlugin = function(options) {
|
|
14165
|
+
return {
|
|
14166
|
+
name: PLUGIN_NAME,
|
|
14167
|
+
observer: initLogObserver,
|
|
14168
|
+
options: options
|
|
14169
|
+
};
|
|
14170
|
+
};
|
|
13682
14171
|
|
|
13683
14172
|
var setImmediate = win['setImmediate'];
|
|
13684
14173
|
var builtInProp, cycle, schedulingQueue,
|
|
@@ -14043,7 +14532,7 @@
|
|
|
14043
14532
|
}
|
|
14044
14533
|
|
|
14045
14534
|
var Config = {
|
|
14046
|
-
LIB_VERSION: '2.
|
|
14535
|
+
LIB_VERSION: '2.72.0'
|
|
14047
14536
|
};
|
|
14048
14537
|
|
|
14049
14538
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15717,6 +16206,28 @@
|
|
|
15717
16206
|
JSONStringify = JSONStringify || _.JSONEncode;
|
|
15718
16207
|
JSONParse = JSONParse || _.JSONDecode;
|
|
15719
16208
|
|
|
16209
|
+
/**
|
|
16210
|
+
* Determines if CompressionStream API should be used.
|
|
16211
|
+
* Returns false for Safari 16.4 and 16.5 which have breaking CompressionStream bugs.
|
|
16212
|
+
* https://bugs.webkit.org/show_bug.cgi?id=254021
|
|
16213
|
+
* fixed in 16.6 https://developer.apple.com/documentation/safari-release-notes/safari-16_6-release-notes
|
|
16214
|
+
*/
|
|
16215
|
+
var canUseCompressionStream = function(userAgent, vendor, opera) {
|
|
16216
|
+
if (!win.CompressionStream) {
|
|
16217
|
+
return false;
|
|
16218
|
+
}
|
|
16219
|
+
|
|
16220
|
+
var browser = _.info.browser(userAgent, vendor, opera);
|
|
16221
|
+
var version = _.info.browserVersion(userAgent, vendor, opera);
|
|
16222
|
+
if (browser === 'Safari' || browser === 'Mobile Safari') {
|
|
16223
|
+
if (version >= 16.4 && version < 16.6) {
|
|
16224
|
+
return false;
|
|
16225
|
+
}
|
|
16226
|
+
}
|
|
16227
|
+
|
|
16228
|
+
return true;
|
|
16229
|
+
};
|
|
16230
|
+
|
|
15720
16231
|
// UNMINIFIED EXPORTS (for closure compiler)
|
|
15721
16232
|
_['info'] = _.info;
|
|
15722
16233
|
_['info']['browser'] = _.info.browser;
|
|
@@ -16960,6 +17471,7 @@
|
|
|
16960
17471
|
* @property {number} idleExpires
|
|
16961
17472
|
* @property {number} maxExpires
|
|
16962
17473
|
* @property {number} replayStartTime
|
|
17474
|
+
* @property {number} lastEventTimestamp
|
|
16963
17475
|
* @property {number} seqNo
|
|
16964
17476
|
* @property {string} batchStartUrl
|
|
16965
17477
|
* @property {string} replayId
|
|
@@ -16980,6 +17492,7 @@
|
|
|
16980
17492
|
* @property {number} idleExpires
|
|
16981
17493
|
* @property {number} maxExpires
|
|
16982
17494
|
* @property {number} replayStartTime
|
|
17495
|
+
* @property {number} lastEventTimestamp - the unix timestamp of the last recorded event from rrweb
|
|
16983
17496
|
* @property {number} seqNo
|
|
16984
17497
|
* @property {string} batchStartUrl
|
|
16985
17498
|
* @property {string} replayStartUrl
|
|
@@ -17013,6 +17526,7 @@
|
|
|
17013
17526
|
this.idleExpires = options.idleExpires || null;
|
|
17014
17527
|
this.maxExpires = options.maxExpires || null;
|
|
17015
17528
|
this.replayStartTime = options.replayStartTime || null;
|
|
17529
|
+
this.lastEventTimestamp = options.lastEventTimestamp || null;
|
|
17016
17530
|
this.seqNo = options.seqNo || 0;
|
|
17017
17531
|
|
|
17018
17532
|
this.idleTimeoutId = null;
|
|
@@ -17072,10 +17586,20 @@
|
|
|
17072
17586
|
|
|
17073
17587
|
SessionRecording.prototype.unloadPersistedData = function () {
|
|
17074
17588
|
this.batcher.stop();
|
|
17075
|
-
|
|
17076
|
-
|
|
17589
|
+
|
|
17590
|
+
return this.queueStorage.init().catch(function () {
|
|
17591
|
+
this.reportError('Error initializing IndexedDB storage for unloading persisted data.');
|
|
17592
|
+
}.bind(this)).then(function () {
|
|
17593
|
+
// if the recording is too short, just delete any stored events without flushing
|
|
17594
|
+
if (this.getDurationMs() < this._getRecordMinMs()) {
|
|
17077
17595
|
return this.queueStorage.removeItem(this.batcherKey);
|
|
17078
|
-
}
|
|
17596
|
+
}
|
|
17597
|
+
|
|
17598
|
+
return this.batcher.flush()
|
|
17599
|
+
.then(function () {
|
|
17600
|
+
return this.queueStorage.removeItem(this.batcherKey);
|
|
17601
|
+
}.bind(this));
|
|
17602
|
+
}.bind(this));
|
|
17079
17603
|
};
|
|
17080
17604
|
|
|
17081
17605
|
SessionRecording.prototype.getConfig = function(configVar) {
|
|
@@ -17110,11 +17634,7 @@
|
|
|
17110
17634
|
this.maxExpires = new Date().getTime() + this.recordMaxMs;
|
|
17111
17635
|
}
|
|
17112
17636
|
|
|
17113
|
-
this.recordMinMs = this.
|
|
17114
|
-
if (this.recordMinMs > MAX_VALUE_FOR_MIN_RECORDING_MS) {
|
|
17115
|
-
this.recordMinMs = MAX_VALUE_FOR_MIN_RECORDING_MS;
|
|
17116
|
-
logger$1.critical('record_min_ms cannot be greater than ' + MAX_VALUE_FOR_MIN_RECORDING_MS + 'ms. Capping value.');
|
|
17117
|
-
}
|
|
17637
|
+
this.recordMinMs = this._getRecordMinMs();
|
|
17118
17638
|
|
|
17119
17639
|
if (!this.replayStartTime) {
|
|
17120
17640
|
this.replayStartTime = new Date().getTime();
|
|
@@ -17162,6 +17682,11 @@
|
|
|
17162
17682
|
}
|
|
17163
17683
|
// promise only used to await during tests
|
|
17164
17684
|
this.__enqueuePromise = this.batcher.enqueue(ev);
|
|
17685
|
+
|
|
17686
|
+
// Capture the timestamp of the last event for duration calculation.
|
|
17687
|
+
if (this.lastEventTimestamp === null || ev.timestamp > this.lastEventTimestamp) {
|
|
17688
|
+
this.lastEventTimestamp = ev.timestamp;
|
|
17689
|
+
}
|
|
17165
17690
|
}.bind(this),
|
|
17166
17691
|
'blockClass': this.getConfig('record_block_class'),
|
|
17167
17692
|
'blockSelector': blockSelector,
|
|
@@ -17176,7 +17701,16 @@
|
|
|
17176
17701
|
'recordCanvas': this.getConfig('record_canvas'),
|
|
17177
17702
|
'sampling': {
|
|
17178
17703
|
'canvas': 15
|
|
17179
|
-
}
|
|
17704
|
+
},
|
|
17705
|
+
'plugins': this.getConfig('record_console') ? [
|
|
17706
|
+
getRecordConsolePlugin({
|
|
17707
|
+
stringifyOptions: {
|
|
17708
|
+
stringLengthLimit: 1000,
|
|
17709
|
+
numOfKeysLimit: 50,
|
|
17710
|
+
depthOfLimit: 2
|
|
17711
|
+
}
|
|
17712
|
+
})
|
|
17713
|
+
] : []
|
|
17180
17714
|
});
|
|
17181
17715
|
} catch (err) {
|
|
17182
17716
|
this.reportError('Unexpected error when starting rrweb recording.', err);
|
|
@@ -17261,6 +17795,7 @@
|
|
|
17261
17795
|
'replayStartTime': this.replayStartTime,
|
|
17262
17796
|
'batchStartUrl': this.batchStartUrl,
|
|
17263
17797
|
'replayStartUrl': this.replayStartUrl,
|
|
17798
|
+
'lastEventTimestamp': this.lastEventTimestamp,
|
|
17264
17799
|
'idleExpires': this.idleExpires,
|
|
17265
17800
|
'maxExpires': this.maxExpires,
|
|
17266
17801
|
'tabId': tabId,
|
|
@@ -17282,6 +17817,7 @@
|
|
|
17282
17817
|
idleExpires: serializedRecording['idleExpires'],
|
|
17283
17818
|
maxExpires: serializedRecording['maxExpires'],
|
|
17284
17819
|
replayStartTime: serializedRecording['replayStartTime'],
|
|
17820
|
+
lastEventTimestamp: serializedRecording['lastEventTimestamp'],
|
|
17285
17821
|
seqNo: serializedRecording['seqNo'],
|
|
17286
17822
|
sharedLockStorage: options.sharedLockStorage,
|
|
17287
17823
|
}));
|
|
@@ -17372,7 +17908,7 @@
|
|
|
17372
17908
|
var eventsJson = JSON.stringify(data);
|
|
17373
17909
|
Object.assign(reqParams, this.getUserIdInfo());
|
|
17374
17910
|
|
|
17375
|
-
if (
|
|
17911
|
+
if (canUseCompressionStream(userAgent, navigator.vendor, windowOpera)) {
|
|
17376
17912
|
var jsonStream = new Blob([eventsJson], {type: 'application/json'}).stream();
|
|
17377
17913
|
var gzipStream = jsonStream.pipeThrough(new CompressionStream('gzip'));
|
|
17378
17914
|
new Response(gzipStream)
|
|
@@ -17401,6 +17937,38 @@
|
|
|
17401
17937
|
}
|
|
17402
17938
|
};
|
|
17403
17939
|
|
|
17940
|
+
/**
|
|
17941
|
+
* Calculates the duration of the recording in milliseconds, based on the start time and time of last recorded event.
|
|
17942
|
+
* @returns {number} The duration of the recording in milliseconds. Returns 0 if recording hasn't started.
|
|
17943
|
+
*/
|
|
17944
|
+
SessionRecording.prototype.getDurationMs = function() {
|
|
17945
|
+
if (this.replayStartTime === null) {
|
|
17946
|
+
return 0;
|
|
17947
|
+
}
|
|
17948
|
+
|
|
17949
|
+
// If the recording has no events, assume it is in progress and use the current time as the end time.
|
|
17950
|
+
if (this.lastEventTimestamp === null) {
|
|
17951
|
+
return new Date().getTime() - this.replayStartTime;
|
|
17952
|
+
}
|
|
17953
|
+
|
|
17954
|
+
return this.lastEventTimestamp - this.replayStartTime;
|
|
17955
|
+
};
|
|
17956
|
+
|
|
17957
|
+
/**
|
|
17958
|
+
* Lazily loads the minimum recording length config in milliseconds, respecting the maximum limit.
|
|
17959
|
+
* @returns {number} The minimum recording length in milliseconds.
|
|
17960
|
+
*/
|
|
17961
|
+
SessionRecording.prototype._getRecordMinMs = function() {
|
|
17962
|
+
var configValue = this.getConfig('record_min_ms');
|
|
17963
|
+
|
|
17964
|
+
if (configValue > MAX_VALUE_FOR_MIN_RECORDING_MS) {
|
|
17965
|
+
logger$1.critical('record_min_ms cannot be greater than ' + MAX_VALUE_FOR_MIN_RECORDING_MS + 'ms. Capping value.');
|
|
17966
|
+
return MAX_VALUE_FOR_MIN_RECORDING_MS;
|
|
17967
|
+
}
|
|
17968
|
+
|
|
17969
|
+
return configValue;
|
|
17970
|
+
};
|
|
17971
|
+
|
|
17404
17972
|
/**
|
|
17405
17973
|
* Module for handling the storage and retrieval of recording metadata as well as any active recordings.
|
|
17406
17974
|
* Makes sure that only one tab can be recording at a time.
|