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