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
package/dist/mixpanel.amd.js
CHANGED
|
@@ -17,7 +17,9 @@ define((function () { 'use strict';
|
|
|
17
17
|
screen: { width: 0, height: 0 },
|
|
18
18
|
location: loc,
|
|
19
19
|
addEventListener: function() {},
|
|
20
|
-
removeEventListener: function() {}
|
|
20
|
+
removeEventListener: function() {},
|
|
21
|
+
dispatchEvent: function() {},
|
|
22
|
+
CustomEvent: function () {}
|
|
21
23
|
};
|
|
22
24
|
} else {
|
|
23
25
|
win = window;
|
|
@@ -324,30 +326,30 @@ define((function () { 'use strict';
|
|
|
324
326
|
};
|
|
325
327
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
326
328
|
}
|
|
327
|
-
var __defProp = Object.defineProperty;
|
|
328
|
-
var __defNormalProp = function(obj, key, value) {
|
|
329
|
-
return key in obj ? __defProp(obj, key, {
|
|
329
|
+
var __defProp$1 = Object.defineProperty;
|
|
330
|
+
var __defNormalProp$1 = function(obj, key, value) {
|
|
331
|
+
return key in obj ? __defProp$1(obj, key, {
|
|
330
332
|
enumerable: true,
|
|
331
333
|
configurable: true,
|
|
332
334
|
writable: true,
|
|
333
335
|
value: value
|
|
334
336
|
}) : obj[key] = value;
|
|
335
337
|
};
|
|
336
|
-
var __publicField = function(obj, key, value) {
|
|
337
|
-
return __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
338
|
+
var __publicField$1 = function(obj, key, value) {
|
|
339
|
+
return __defNormalProp$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
338
340
|
};
|
|
339
341
|
var _a;
|
|
340
|
-
var __defProp$1 = Object.defineProperty;
|
|
341
|
-
var __defNormalProp$1 = function(obj, key, value) {
|
|
342
|
-
return key in obj ? __defProp$1(obj, key, {
|
|
342
|
+
var __defProp$1$1 = Object.defineProperty;
|
|
343
|
+
var __defNormalProp$1$1 = function(obj, key, value) {
|
|
344
|
+
return key in obj ? __defProp$1$1(obj, key, {
|
|
343
345
|
enumerable: true,
|
|
344
346
|
configurable: true,
|
|
345
347
|
writable: true,
|
|
346
348
|
value: value
|
|
347
349
|
}) : obj[key] = value;
|
|
348
350
|
};
|
|
349
|
-
var __publicField$1 = function(obj, key, value) {
|
|
350
|
-
return __defNormalProp$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
351
|
+
var __publicField$1$1 = function(obj, key, value) {
|
|
352
|
+
return __defNormalProp$1$1(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
351
353
|
};
|
|
352
354
|
var NodeType$3 = /* @__PURE__ */ function(NodeType2) {
|
|
353
355
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
@@ -617,8 +619,8 @@ define((function () { 'use strict';
|
|
|
617
619
|
}
|
|
618
620
|
var Mirror = /*#__PURE__*/ function() {
|
|
619
621
|
function Mirror() {
|
|
620
|
-
__publicField$1(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
621
|
-
__publicField$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
|
|
622
|
+
__publicField$1$1(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
623
|
+
__publicField$1$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
|
|
622
624
|
}
|
|
623
625
|
var _proto = Mirror.prototype;
|
|
624
626
|
_proto.getId = function getId(n2) {
|
|
@@ -2502,7 +2504,8 @@ define((function () { 'use strict';
|
|
|
2502
2504
|
return id;
|
|
2503
2505
|
};
|
|
2504
2506
|
var nonSecure$1 = {
|
|
2505
|
-
nanoid: nanoid$1$1
|
|
2507
|
+
nanoid: nanoid$1$1
|
|
2508
|
+
};
|
|
2506
2509
|
var SourceMapConsumer$2$1 = require$$2$1.SourceMapConsumer, SourceMapGenerator$2$1 = require$$2$1.SourceMapGenerator;
|
|
2507
2510
|
var existsSync$1 = require$$2$1.existsSync, readFileSync$1 = require$$2$1.readFileSync;
|
|
2508
2511
|
var dirname$1$1 = require$$2$1.dirname, join$1 = require$$2$1.join;
|
|
@@ -6653,7 +6656,8 @@ define((function () { 'use strict';
|
|
|
6653
6656
|
return id;
|
|
6654
6657
|
};
|
|
6655
6658
|
var nonSecure = {
|
|
6656
|
-
nanoid: nanoid$1
|
|
6659
|
+
nanoid: nanoid$1
|
|
6660
|
+
};
|
|
6657
6661
|
var SourceMapConsumer$2 = require$$2.SourceMapConsumer, SourceMapGenerator$2 = require$$2.SourceMapGenerator;
|
|
6658
6662
|
var existsSync = require$$2.existsSync, readFileSync = require$$2.readFileSync;
|
|
6659
6663
|
var dirname$1 = require$$2.dirname, join = require$$2.join;
|
|
@@ -9813,7 +9817,7 @@ define((function () { 'use strict';
|
|
|
9813
9817
|
var LazyResult22 = lazyResult;
|
|
9814
9818
|
var Container22 = container;
|
|
9815
9819
|
var Processor22 = processor;
|
|
9816
|
-
var stringify = stringify_1;
|
|
9820
|
+
var stringify$6 = stringify_1;
|
|
9817
9821
|
var fromJSON = fromJSON_1;
|
|
9818
9822
|
var Document222 = document$1$2;
|
|
9819
9823
|
var Warning22 = warning;
|
|
@@ -9867,7 +9871,7 @@ define((function () { 'use strict';
|
|
|
9867
9871
|
};
|
|
9868
9872
|
return creator;
|
|
9869
9873
|
};
|
|
9870
|
-
postcss.stringify = stringify;
|
|
9874
|
+
postcss.stringify = stringify$6;
|
|
9871
9875
|
postcss.parse = parse;
|
|
9872
9876
|
postcss.fromJSON = fromJSON;
|
|
9873
9877
|
postcss.list = list;
|
|
@@ -10117,7 +10121,7 @@ define((function () { 'use strict';
|
|
|
10117
10121
|
function mutationObserverCtor() {
|
|
10118
10122
|
return getUntaintedPrototype("MutationObserver").constructor;
|
|
10119
10123
|
}
|
|
10120
|
-
function patch(source, name, replacement) {
|
|
10124
|
+
function patch$2(source, name, replacement) {
|
|
10121
10125
|
try {
|
|
10122
10126
|
if (!(name in source)) {
|
|
10123
10127
|
return function() {};
|
|
@@ -10154,7 +10158,7 @@ define((function () { 'use strict';
|
|
|
10154
10158
|
querySelector: querySelector,
|
|
10155
10159
|
querySelectorAll: querySelectorAll,
|
|
10156
10160
|
mutationObserver: mutationObserverCtor,
|
|
10157
|
-
patch: patch
|
|
10161
|
+
patch: patch$2
|
|
10158
10162
|
};
|
|
10159
10163
|
function on(type, fn, target) {
|
|
10160
10164
|
if (target === void 0) target = document;
|
|
@@ -10349,9 +10353,9 @@ define((function () { 'use strict';
|
|
|
10349
10353
|
}
|
|
10350
10354
|
var StyleSheetMirror = /*#__PURE__*/ function() {
|
|
10351
10355
|
function StyleSheetMirror() {
|
|
10352
|
-
__publicField(this, "id", 1);
|
|
10353
|
-
__publicField(this, "styleIDMap", /* @__PURE__ */ new WeakMap());
|
|
10354
|
-
__publicField(this, "idStyleMap", /* @__PURE__ */ new Map());
|
|
10356
|
+
__publicField$1(this, "id", 1);
|
|
10357
|
+
__publicField$1(this, "styleIDMap", /* @__PURE__ */ new WeakMap());
|
|
10358
|
+
__publicField$1(this, "idStyleMap", /* @__PURE__ */ new Map());
|
|
10355
10359
|
}
|
|
10356
10360
|
var _proto = StyleSheetMirror.prototype;
|
|
10357
10361
|
_proto.getId = function getId(stylesheet) {
|
|
@@ -10487,9 +10491,9 @@ define((function () { 'use strict';
|
|
|
10487
10491
|
}
|
|
10488
10492
|
var DoubleLinkedList = /*#__PURE__*/ function() {
|
|
10489
10493
|
function DoubleLinkedList() {
|
|
10490
|
-
__publicField(this, "length", 0);
|
|
10491
|
-
__publicField(this, "head", null);
|
|
10492
|
-
__publicField(this, "tail", null);
|
|
10494
|
+
__publicField$1(this, "length", 0);
|
|
10495
|
+
__publicField$1(this, "head", null);
|
|
10496
|
+
__publicField$1(this, "tail", null);
|
|
10493
10497
|
}
|
|
10494
10498
|
var _proto = DoubleLinkedList.prototype;
|
|
10495
10499
|
_proto.get = function get(position) {
|
|
@@ -10570,14 +10574,14 @@ define((function () { 'use strict';
|
|
|
10570
10574
|
var MutationBuffer = /*#__PURE__*/ function() {
|
|
10571
10575
|
function MutationBuffer() {
|
|
10572
10576
|
var _this = this;
|
|
10573
|
-
__publicField(this, "frozen", false);
|
|
10574
|
-
__publicField(this, "locked", false);
|
|
10575
|
-
__publicField(this, "texts", []);
|
|
10576
|
-
__publicField(this, "attributes", []);
|
|
10577
|
-
__publicField(this, "attributeMap", /* @__PURE__ */ new WeakMap());
|
|
10578
|
-
__publicField(this, "removes", []);
|
|
10579
|
-
__publicField(this, "mapRemoves", []);
|
|
10580
|
-
__publicField(this, "movedMap", {});
|
|
10577
|
+
__publicField$1(this, "frozen", false);
|
|
10578
|
+
__publicField$1(this, "locked", false);
|
|
10579
|
+
__publicField$1(this, "texts", []);
|
|
10580
|
+
__publicField$1(this, "attributes", []);
|
|
10581
|
+
__publicField$1(this, "attributeMap", /* @__PURE__ */ new WeakMap());
|
|
10582
|
+
__publicField$1(this, "removes", []);
|
|
10583
|
+
__publicField$1(this, "mapRemoves", []);
|
|
10584
|
+
__publicField$1(this, "movedMap", {});
|
|
10581
10585
|
/**
|
|
10582
10586
|
* the browser MutationObserver emits multiple mutations after
|
|
10583
10587
|
* a delay for performance reasons, making tracing added nodes hard
|
|
@@ -10594,37 +10598,37 @@ define((function () { 'use strict';
|
|
|
10594
10598
|
* collect added nodes from the Set which have no duplicate copy. But
|
|
10595
10599
|
* this also causes newly added nodes will not be serialized with id ASAP,
|
|
10596
10600
|
* which means all the id related calculation should be lazy too.
|
|
10597
|
-
*/ __publicField(this, "addedSet", /* @__PURE__ */ new Set());
|
|
10598
|
-
__publicField(this, "movedSet", /* @__PURE__ */ new Set());
|
|
10599
|
-
__publicField(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
10600
|
-
__publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
10601
|
-
__publicField(this, "mutationCb");
|
|
10602
|
-
__publicField(this, "blockClass");
|
|
10603
|
-
__publicField(this, "blockSelector");
|
|
10604
|
-
__publicField(this, "maskTextClass");
|
|
10605
|
-
__publicField(this, "maskTextSelector");
|
|
10606
|
-
__publicField(this, "inlineStylesheet");
|
|
10607
|
-
__publicField(this, "maskInputOptions");
|
|
10608
|
-
__publicField(this, "maskTextFn");
|
|
10609
|
-
__publicField(this, "maskInputFn");
|
|
10610
|
-
__publicField(this, "keepIframeSrcFn");
|
|
10611
|
-
__publicField(this, "recordCanvas");
|
|
10612
|
-
__publicField(this, "inlineImages");
|
|
10613
|
-
__publicField(this, "slimDOMOptions");
|
|
10614
|
-
__publicField(this, "dataURLOptions");
|
|
10615
|
-
__publicField(this, "doc");
|
|
10616
|
-
__publicField(this, "mirror");
|
|
10617
|
-
__publicField(this, "iframeManager");
|
|
10618
|
-
__publicField(this, "stylesheetManager");
|
|
10619
|
-
__publicField(this, "shadowDomManager");
|
|
10620
|
-
__publicField(this, "canvasManager");
|
|
10621
|
-
__publicField(this, "processedNodeManager");
|
|
10622
|
-
__publicField(this, "unattachedDoc");
|
|
10623
|
-
__publicField(this, "processMutations", function(mutations) {
|
|
10601
|
+
*/ __publicField$1(this, "addedSet", /* @__PURE__ */ new Set());
|
|
10602
|
+
__publicField$1(this, "movedSet", /* @__PURE__ */ new Set());
|
|
10603
|
+
__publicField$1(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
10604
|
+
__publicField$1(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
10605
|
+
__publicField$1(this, "mutationCb");
|
|
10606
|
+
__publicField$1(this, "blockClass");
|
|
10607
|
+
__publicField$1(this, "blockSelector");
|
|
10608
|
+
__publicField$1(this, "maskTextClass");
|
|
10609
|
+
__publicField$1(this, "maskTextSelector");
|
|
10610
|
+
__publicField$1(this, "inlineStylesheet");
|
|
10611
|
+
__publicField$1(this, "maskInputOptions");
|
|
10612
|
+
__publicField$1(this, "maskTextFn");
|
|
10613
|
+
__publicField$1(this, "maskInputFn");
|
|
10614
|
+
__publicField$1(this, "keepIframeSrcFn");
|
|
10615
|
+
__publicField$1(this, "recordCanvas");
|
|
10616
|
+
__publicField$1(this, "inlineImages");
|
|
10617
|
+
__publicField$1(this, "slimDOMOptions");
|
|
10618
|
+
__publicField$1(this, "dataURLOptions");
|
|
10619
|
+
__publicField$1(this, "doc");
|
|
10620
|
+
__publicField$1(this, "mirror");
|
|
10621
|
+
__publicField$1(this, "iframeManager");
|
|
10622
|
+
__publicField$1(this, "stylesheetManager");
|
|
10623
|
+
__publicField$1(this, "shadowDomManager");
|
|
10624
|
+
__publicField$1(this, "canvasManager");
|
|
10625
|
+
__publicField$1(this, "processedNodeManager");
|
|
10626
|
+
__publicField$1(this, "unattachedDoc");
|
|
10627
|
+
__publicField$1(this, "processMutations", function(mutations) {
|
|
10624
10628
|
mutations.forEach(_this.processMutation);
|
|
10625
10629
|
_this.emit();
|
|
10626
10630
|
});
|
|
10627
|
-
__publicField(this, "emit", function() {
|
|
10631
|
+
__publicField$1(this, "emit", function() {
|
|
10628
10632
|
if (_this.frozen || _this.locked) {
|
|
10629
10633
|
return;
|
|
10630
10634
|
}
|
|
@@ -10825,7 +10829,7 @@ define((function () { 'use strict';
|
|
|
10825
10829
|
_this.movedMap = {};
|
|
10826
10830
|
_this.mutationCb(payload);
|
|
10827
10831
|
});
|
|
10828
|
-
__publicField(this, "genTextAreaValueMutation", function(textarea) {
|
|
10832
|
+
__publicField$1(this, "genTextAreaValueMutation", function(textarea) {
|
|
10829
10833
|
var item = _this.attributeMap.get(textarea);
|
|
10830
10834
|
if (!item) {
|
|
10831
10835
|
item = {
|
|
@@ -10849,7 +10853,7 @@ define((function () { 'use strict';
|
|
|
10849
10853
|
maskInputFn: _this.maskInputFn
|
|
10850
10854
|
});
|
|
10851
10855
|
});
|
|
10852
|
-
__publicField(this, "processMutation", function(m) {
|
|
10856
|
+
__publicField$1(this, "processMutation", function(m) {
|
|
10853
10857
|
if (isIgnored(m.target, _this.mirror, _this.slimDOMOptions)) {
|
|
10854
10858
|
return;
|
|
10855
10859
|
}
|
|
@@ -10994,7 +10998,7 @@ define((function () { 'use strict';
|
|
|
10994
10998
|
});
|
|
10995
10999
|
/**
|
|
10996
11000
|
* Make sure you check if `n`'s parent is blocked before calling this function
|
|
10997
|
-
* */ __publicField(this, "genAdds", function(n2, target) {
|
|
11001
|
+
* */ __publicField$1(this, "genAdds", function(n2, target) {
|
|
10998
11002
|
if (_this.processedNodeManager.inOtherBuffer(n2, _this)) return;
|
|
10999
11003
|
if (_this.addedSet.has(n2) || _this.movedSet.has(n2)) return;
|
|
11000
11004
|
if (_this.mirror.hasNode(n2)) {
|
|
@@ -11840,7 +11844,7 @@ define((function () { 'use strict';
|
|
|
11840
11844
|
});
|
|
11841
11845
|
return fontFace;
|
|
11842
11846
|
};
|
|
11843
|
-
var restoreHandler = patch(doc.fonts, "add", function(original) {
|
|
11847
|
+
var restoreHandler = patch$2(doc.fonts, "add", function(original) {
|
|
11844
11848
|
return function(fontFace) {
|
|
11845
11849
|
setTimeout(callbackWrapper(function() {
|
|
11846
11850
|
var p = fontMap.get(fontFace);
|
|
@@ -11896,7 +11900,7 @@ define((function () { 'use strict';
|
|
|
11896
11900
|
var doc = param.doc, customElementCb = param.customElementCb;
|
|
11897
11901
|
var win = doc.defaultView;
|
|
11898
11902
|
if (!win || !win.customElements) return function() {};
|
|
11899
|
-
var restoreHandler = patch(win.customElements, "define", function(original) {
|
|
11903
|
+
var restoreHandler = patch$2(win.customElements, "define", function(original) {
|
|
11900
11904
|
return function(name, constructor, options) {
|
|
11901
11905
|
try {
|
|
11902
11906
|
customElementCb({
|
|
@@ -12123,8 +12127,8 @@ define((function () { 'use strict';
|
|
|
12123
12127
|
}
|
|
12124
12128
|
var CrossOriginIframeMirror = /*#__PURE__*/ function() {
|
|
12125
12129
|
function CrossOriginIframeMirror(generateIdFn) {
|
|
12126
|
-
__publicField(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());
|
|
12127
|
-
__publicField(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
12130
|
+
__publicField$1(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());
|
|
12131
|
+
__publicField$1(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
12128
12132
|
this.generateIdFn = generateIdFn;
|
|
12129
12133
|
}
|
|
12130
12134
|
var _proto = CrossOriginIframeMirror.prototype;
|
|
@@ -12190,17 +12194,17 @@ define((function () { 'use strict';
|
|
|
12190
12194
|
}();
|
|
12191
12195
|
var IframeManager = /*#__PURE__*/ function() {
|
|
12192
12196
|
function IframeManager(options) {
|
|
12193
|
-
__publicField(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
12194
|
-
__publicField(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
12195
|
-
__publicField(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
12196
|
-
__publicField(this, "crossOriginIframeStyleMirror");
|
|
12197
|
-
__publicField(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
12198
|
-
__publicField(this, "mirror");
|
|
12199
|
-
__publicField(this, "mutationCb");
|
|
12200
|
-
__publicField(this, "wrappedEmit");
|
|
12201
|
-
__publicField(this, "loadListener");
|
|
12202
|
-
__publicField(this, "stylesheetManager");
|
|
12203
|
-
__publicField(this, "recordCrossOriginIframes");
|
|
12197
|
+
__publicField$1(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
12198
|
+
__publicField$1(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
12199
|
+
__publicField$1(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
12200
|
+
__publicField$1(this, "crossOriginIframeStyleMirror");
|
|
12201
|
+
__publicField$1(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
12202
|
+
__publicField$1(this, "mirror");
|
|
12203
|
+
__publicField$1(this, "mutationCb");
|
|
12204
|
+
__publicField$1(this, "wrappedEmit");
|
|
12205
|
+
__publicField$1(this, "loadListener");
|
|
12206
|
+
__publicField$1(this, "stylesheetManager");
|
|
12207
|
+
__publicField$1(this, "recordCrossOriginIframes");
|
|
12204
12208
|
this.mutationCb = options.mutationCb;
|
|
12205
12209
|
this.wrappedEmit = options.wrappedEmit;
|
|
12206
12210
|
this.stylesheetManager = options.stylesheetManager;
|
|
@@ -12447,12 +12451,12 @@ define((function () { 'use strict';
|
|
|
12447
12451
|
}();
|
|
12448
12452
|
var ShadowDomManager = /*#__PURE__*/ function() {
|
|
12449
12453
|
function ShadowDomManager(options) {
|
|
12450
|
-
__publicField(this, "shadowDoms", /* @__PURE__ */ new WeakSet());
|
|
12451
|
-
__publicField(this, "mutationCb");
|
|
12452
|
-
__publicField(this, "scrollCb");
|
|
12453
|
-
__publicField(this, "bypassOptions");
|
|
12454
|
-
__publicField(this, "mirror");
|
|
12455
|
-
__publicField(this, "restoreHandlers", []);
|
|
12454
|
+
__publicField$1(this, "shadowDoms", /* @__PURE__ */ new WeakSet());
|
|
12455
|
+
__publicField$1(this, "mutationCb");
|
|
12456
|
+
__publicField$1(this, "scrollCb");
|
|
12457
|
+
__publicField$1(this, "bypassOptions");
|
|
12458
|
+
__publicField$1(this, "mirror");
|
|
12459
|
+
__publicField$1(this, "restoreHandlers", []);
|
|
12456
12460
|
this.mutationCb = options.mutationCb;
|
|
12457
12461
|
this.scrollCb = options.scrollCb;
|
|
12458
12462
|
this.bypassOptions = options.bypassOptions;
|
|
@@ -12503,7 +12507,7 @@ define((function () { 'use strict';
|
|
|
12503
12507
|
* Patch 'attachShadow' to observe newly added shadow doms.
|
|
12504
12508
|
*/ _proto.patchAttachShadow = function patchAttachShadow(element, doc) {
|
|
12505
12509
|
var manager = this;
|
|
12506
|
-
this.restoreHandlers.push(patch(element.prototype, "attachShadow", function(original) {
|
|
12510
|
+
this.restoreHandlers.push(patch$2(element.prototype, "attachShadow", function(original) {
|
|
12507
12511
|
return function(option) {
|
|
12508
12512
|
var sRoot = original.call(this, option);
|
|
12509
12513
|
var shadowRootEl = index.shadowRoot(this);
|
|
@@ -12669,7 +12673,7 @@ define((function () { 'use strict';
|
|
|
12669
12673
|
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== "function") {
|
|
12670
12674
|
return "continue";
|
|
12671
12675
|
}
|
|
12672
|
-
var restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function(original) {
|
|
12676
|
+
var restoreHandler = patch$2(win.CanvasRenderingContext2D.prototype, prop, function(original) {
|
|
12673
12677
|
return function() {
|
|
12674
12678
|
var _this = this;
|
|
12675
12679
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -12720,7 +12724,7 @@ define((function () { 'use strict';
|
|
|
12720
12724
|
function initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDrawingBufferToTrue) {
|
|
12721
12725
|
var handlers = [];
|
|
12722
12726
|
try {
|
|
12723
|
-
var restoreHandler = patch(win.HTMLCanvasElement.prototype, "getContext", function(original) {
|
|
12727
|
+
var restoreHandler = patch$2(win.HTMLCanvasElement.prototype, "getContext", function(original) {
|
|
12724
12728
|
return function(contextType) {
|
|
12725
12729
|
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
12726
12730
|
args[_key - 1] = arguments[_key];
|
|
@@ -12775,7 +12779,7 @@ define((function () { 'use strict';
|
|
|
12775
12779
|
if (typeof prototype[prop] !== "function") {
|
|
12776
12780
|
return "continue";
|
|
12777
12781
|
}
|
|
12778
|
-
var restoreHandler = patch(prototype, prop, function(original) {
|
|
12782
|
+
var restoreHandler = patch$2(prototype, prop, function(original) {
|
|
12779
12783
|
return function() {
|
|
12780
12784
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
12781
12785
|
args[_key] = arguments[_key];
|
|
@@ -12864,17 +12868,17 @@ define((function () { 'use strict';
|
|
|
12864
12868
|
var CanvasManager = /*#__PURE__*/ function() {
|
|
12865
12869
|
function CanvasManager(options) {
|
|
12866
12870
|
var _this = this;
|
|
12867
|
-
__publicField(this, "pendingCanvasMutations", /* @__PURE__ */ new Map());
|
|
12868
|
-
__publicField(this, "rafStamps", {
|
|
12871
|
+
__publicField$1(this, "pendingCanvasMutations", /* @__PURE__ */ new Map());
|
|
12872
|
+
__publicField$1(this, "rafStamps", {
|
|
12869
12873
|
latestId: 0,
|
|
12870
12874
|
invokeId: null
|
|
12871
12875
|
});
|
|
12872
|
-
__publicField(this, "mirror");
|
|
12873
|
-
__publicField(this, "mutationCb");
|
|
12874
|
-
__publicField(this, "resetObservers");
|
|
12875
|
-
__publicField(this, "frozen", false);
|
|
12876
|
-
__publicField(this, "locked", false);
|
|
12877
|
-
__publicField(this, "processMutation", function(target, mutation) {
|
|
12876
|
+
__publicField$1(this, "mirror");
|
|
12877
|
+
__publicField$1(this, "mutationCb");
|
|
12878
|
+
__publicField$1(this, "resetObservers");
|
|
12879
|
+
__publicField$1(this, "frozen", false);
|
|
12880
|
+
__publicField$1(this, "locked", false);
|
|
12881
|
+
__publicField$1(this, "processMutation", function(target, mutation) {
|
|
12878
12882
|
var newFrame = _this.rafStamps.invokeId && _this.rafStamps.latestId !== _this.rafStamps.invokeId;
|
|
12879
12883
|
if (newFrame || !_this.rafStamps.invokeId) _this.rafStamps.invokeId = _this.rafStamps.latestId;
|
|
12880
12884
|
if (!_this.pendingCanvasMutations.has(target)) {
|
|
@@ -13087,10 +13091,10 @@ define((function () { 'use strict';
|
|
|
13087
13091
|
}();
|
|
13088
13092
|
var StylesheetManager = /*#__PURE__*/ function() {
|
|
13089
13093
|
function StylesheetManager(options) {
|
|
13090
|
-
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
13091
|
-
__publicField(this, "mutationCb");
|
|
13092
|
-
__publicField(this, "adoptedStyleSheetCb");
|
|
13093
|
-
__publicField(this, "styleMirror", new StyleSheetMirror());
|
|
13094
|
+
__publicField$1(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
13095
|
+
__publicField$1(this, "mutationCb");
|
|
13096
|
+
__publicField$1(this, "adoptedStyleSheetCb");
|
|
13097
|
+
__publicField$1(this, "styleMirror", new StyleSheetMirror());
|
|
13094
13098
|
this.mutationCb = options.mutationCb;
|
|
13095
13099
|
this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;
|
|
13096
13100
|
}
|
|
@@ -13152,8 +13156,8 @@ define((function () { 'use strict';
|
|
|
13152
13156
|
}();
|
|
13153
13157
|
var ProcessedNodeManager = /*#__PURE__*/ function() {
|
|
13154
13158
|
function ProcessedNodeManager() {
|
|
13155
|
-
__publicField(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
13156
|
-
__publicField(this, "active", false);
|
|
13159
|
+
__publicField$1(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
13160
|
+
__publicField$1(this, "active", false);
|
|
13157
13161
|
}
|
|
13158
13162
|
var _proto = ProcessedNodeManager.prototype;
|
|
13159
13163
|
_proto.inOtherBuffer = function inOtherBuffer(node2, thisBuffer) {
|
|
@@ -13678,6 +13682,493 @@ define((function () { 'use strict';
|
|
|
13678
13682
|
record.addCustomEvent;
|
|
13679
13683
|
record.freezePage;
|
|
13680
13684
|
record.takeFullSnapshot;
|
|
13685
|
+
var __defProp = Object.defineProperty;
|
|
13686
|
+
var __defNormalProp = function(obj, key, value) {
|
|
13687
|
+
return key in obj ? __defProp(obj, key, {
|
|
13688
|
+
enumerable: true,
|
|
13689
|
+
configurable: true,
|
|
13690
|
+
writable: true,
|
|
13691
|
+
value: value
|
|
13692
|
+
}) : obj[key] = value;
|
|
13693
|
+
};
|
|
13694
|
+
var __publicField = function(obj, key, value) {
|
|
13695
|
+
return __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
13696
|
+
};
|
|
13697
|
+
function patch(source, name, replacement) {
|
|
13698
|
+
try {
|
|
13699
|
+
if (!(name in source)) {
|
|
13700
|
+
return function() {};
|
|
13701
|
+
}
|
|
13702
|
+
var original = source[name];
|
|
13703
|
+
var wrapped = replacement(original);
|
|
13704
|
+
if (typeof wrapped === "function") {
|
|
13705
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
13706
|
+
Object.defineProperties(wrapped, {
|
|
13707
|
+
__rrweb_original__: {
|
|
13708
|
+
enumerable: false,
|
|
13709
|
+
value: original
|
|
13710
|
+
}
|
|
13711
|
+
});
|
|
13712
|
+
}
|
|
13713
|
+
source[name] = wrapped;
|
|
13714
|
+
return function() {
|
|
13715
|
+
source[name] = original;
|
|
13716
|
+
};
|
|
13717
|
+
} catch (e) {
|
|
13718
|
+
return function() {};
|
|
13719
|
+
}
|
|
13720
|
+
}
|
|
13721
|
+
var StackFrame = /*#__PURE__*/ function() {
|
|
13722
|
+
function StackFrame(obj) {
|
|
13723
|
+
__publicField(this, "fileName");
|
|
13724
|
+
__publicField(this, "functionName");
|
|
13725
|
+
__publicField(this, "lineNumber");
|
|
13726
|
+
__publicField(this, "columnNumber");
|
|
13727
|
+
this.fileName = obj.fileName || "";
|
|
13728
|
+
this.functionName = obj.functionName || "";
|
|
13729
|
+
this.lineNumber = obj.lineNumber;
|
|
13730
|
+
this.columnNumber = obj.columnNumber;
|
|
13731
|
+
}
|
|
13732
|
+
var _proto = StackFrame.prototype;
|
|
13733
|
+
_proto.toString = function toString() {
|
|
13734
|
+
var lineNumber = this.lineNumber || "";
|
|
13735
|
+
var columnNumber = this.columnNumber || "";
|
|
13736
|
+
if (this.functionName) return this.functionName + " (" + this.fileName + ":" + lineNumber + ":" + columnNumber + ")";
|
|
13737
|
+
return this.fileName + ":" + lineNumber + ":" + columnNumber;
|
|
13738
|
+
};
|
|
13739
|
+
return StackFrame;
|
|
13740
|
+
}();
|
|
13741
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
13742
|
+
var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
13743
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
13744
|
+
var ErrorStackParser = {
|
|
13745
|
+
/**
|
|
13746
|
+
* Given an Error object, extract the most information from it.
|
|
13747
|
+
*/ parse: function parse(error) {
|
|
13748
|
+
if (!error) {
|
|
13749
|
+
return [];
|
|
13750
|
+
}
|
|
13751
|
+
if (// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13752
|
+
// @ts-ignore
|
|
13753
|
+
typeof error.stacktrace !== "undefined" || // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13754
|
+
// @ts-ignore
|
|
13755
|
+
typeof error["opera#sourceloc"] !== "undefined") {
|
|
13756
|
+
return this.parseOpera(error);
|
|
13757
|
+
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
13758
|
+
return this.parseV8OrIE(error);
|
|
13759
|
+
} else if (error.stack) {
|
|
13760
|
+
return this.parseFFOrSafari(error);
|
|
13761
|
+
} else {
|
|
13762
|
+
console.warn("[console-record-plugin]: Failed to parse error object:", error);
|
|
13763
|
+
return [];
|
|
13764
|
+
}
|
|
13765
|
+
},
|
|
13766
|
+
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
13767
|
+
extractLocation: function extractLocation(urlLike) {
|
|
13768
|
+
if (urlLike.indexOf(":") === -1) {
|
|
13769
|
+
return [
|
|
13770
|
+
urlLike
|
|
13771
|
+
];
|
|
13772
|
+
}
|
|
13773
|
+
var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
13774
|
+
var parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
13775
|
+
if (!parts) throw new Error("Cannot parse given url: " + urlLike);
|
|
13776
|
+
return [
|
|
13777
|
+
parts[1],
|
|
13778
|
+
parts[2] || void 0,
|
|
13779
|
+
parts[3] || void 0
|
|
13780
|
+
];
|
|
13781
|
+
},
|
|
13782
|
+
parseV8OrIE: function parseV8OrIE(error) {
|
|
13783
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13784
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
13785
|
+
}, this);
|
|
13786
|
+
return filtered.map(function(line) {
|
|
13787
|
+
if (line.indexOf("(eval ") > -1) {
|
|
13788
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(\),.*$)/g, "");
|
|
13789
|
+
}
|
|
13790
|
+
var sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(");
|
|
13791
|
+
var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
13792
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
13793
|
+
var tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
13794
|
+
var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
|
|
13795
|
+
var functionName = tokens.join(" ") || void 0;
|
|
13796
|
+
var fileName = [
|
|
13797
|
+
"eval",
|
|
13798
|
+
"<anonymous>"
|
|
13799
|
+
].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];
|
|
13800
|
+
return new StackFrame({
|
|
13801
|
+
functionName: functionName,
|
|
13802
|
+
fileName: fileName,
|
|
13803
|
+
lineNumber: locationParts[1],
|
|
13804
|
+
columnNumber: locationParts[2]
|
|
13805
|
+
});
|
|
13806
|
+
}, this);
|
|
13807
|
+
},
|
|
13808
|
+
parseFFOrSafari: function parseFFOrSafari(error) {
|
|
13809
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13810
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
13811
|
+
}, this);
|
|
13812
|
+
return filtered.map(function(line) {
|
|
13813
|
+
if (line.indexOf(" > eval") > -1) {
|
|
13814
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
|
|
13815
|
+
}
|
|
13816
|
+
if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
|
|
13817
|
+
return new StackFrame({
|
|
13818
|
+
functionName: line
|
|
13819
|
+
});
|
|
13820
|
+
} else {
|
|
13821
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
13822
|
+
var matches = line.match(functionNameRegex);
|
|
13823
|
+
var functionName = matches && matches[1] ? matches[1] : void 0;
|
|
13824
|
+
var locationParts = this.extractLocation(line.replace(functionNameRegex, ""));
|
|
13825
|
+
return new StackFrame({
|
|
13826
|
+
functionName: functionName,
|
|
13827
|
+
fileName: locationParts[0],
|
|
13828
|
+
lineNumber: locationParts[1],
|
|
13829
|
+
columnNumber: locationParts[2]
|
|
13830
|
+
});
|
|
13831
|
+
}
|
|
13832
|
+
}, this);
|
|
13833
|
+
},
|
|
13834
|
+
parseOpera: function parseOpera(e) {
|
|
13835
|
+
if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) {
|
|
13836
|
+
return this.parseOpera9(e);
|
|
13837
|
+
} else if (!e.stack) {
|
|
13838
|
+
return this.parseOpera10(e);
|
|
13839
|
+
} else {
|
|
13840
|
+
return this.parseOpera11(e);
|
|
13841
|
+
}
|
|
13842
|
+
},
|
|
13843
|
+
parseOpera9: function parseOpera9(e) {
|
|
13844
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
13845
|
+
var lines = e.message.split("\n");
|
|
13846
|
+
var result = [];
|
|
13847
|
+
for(var i = 2, len = lines.length; i < len; i += 2){
|
|
13848
|
+
var match = lineRE.exec(lines[i]);
|
|
13849
|
+
if (match) {
|
|
13850
|
+
result.push(new StackFrame({
|
|
13851
|
+
fileName: match[2],
|
|
13852
|
+
lineNumber: parseFloat(match[1])
|
|
13853
|
+
}));
|
|
13854
|
+
}
|
|
13855
|
+
}
|
|
13856
|
+
return result;
|
|
13857
|
+
},
|
|
13858
|
+
parseOpera10: function parseOpera10(e) {
|
|
13859
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
13860
|
+
var lines = e.stacktrace.split("\n");
|
|
13861
|
+
var result = [];
|
|
13862
|
+
for(var i = 0, len = lines.length; i < len; i += 2){
|
|
13863
|
+
var match = lineRE.exec(lines[i]);
|
|
13864
|
+
if (match) {
|
|
13865
|
+
result.push(new StackFrame({
|
|
13866
|
+
functionName: match[3] || void 0,
|
|
13867
|
+
fileName: match[2],
|
|
13868
|
+
lineNumber: parseFloat(match[1])
|
|
13869
|
+
}));
|
|
13870
|
+
}
|
|
13871
|
+
}
|
|
13872
|
+
return result;
|
|
13873
|
+
},
|
|
13874
|
+
// Opera 10.65+ Error.stack very similar to FF/Safari
|
|
13875
|
+
parseOpera11: function parseOpera11(error) {
|
|
13876
|
+
var filtered = error.stack.split("\n").filter(function(line) {
|
|
13877
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
13878
|
+
}, this);
|
|
13879
|
+
return filtered.map(function(line) {
|
|
13880
|
+
var tokens = line.split("@");
|
|
13881
|
+
var locationParts = this.extractLocation(tokens.pop());
|
|
13882
|
+
var functionCall = tokens.shift() || "";
|
|
13883
|
+
var functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0;
|
|
13884
|
+
return new StackFrame({
|
|
13885
|
+
functionName: functionName,
|
|
13886
|
+
fileName: locationParts[0],
|
|
13887
|
+
lineNumber: locationParts[1],
|
|
13888
|
+
columnNumber: locationParts[2]
|
|
13889
|
+
});
|
|
13890
|
+
}, this);
|
|
13891
|
+
}
|
|
13892
|
+
};
|
|
13893
|
+
function pathToSelector(node) {
|
|
13894
|
+
if (!node || !node.outerHTML) {
|
|
13895
|
+
return "";
|
|
13896
|
+
}
|
|
13897
|
+
var path = "";
|
|
13898
|
+
while(node.parentElement){
|
|
13899
|
+
var name = node.localName;
|
|
13900
|
+
if (!name) {
|
|
13901
|
+
break;
|
|
13902
|
+
}
|
|
13903
|
+
name = name.toLowerCase();
|
|
13904
|
+
var parent = node.parentElement;
|
|
13905
|
+
var domSiblings = [];
|
|
13906
|
+
if (parent.children && parent.children.length > 0) {
|
|
13907
|
+
for(var i = 0; i < parent.children.length; i++){
|
|
13908
|
+
var sibling = parent.children[i];
|
|
13909
|
+
if (sibling.localName && sibling.localName.toLowerCase) {
|
|
13910
|
+
if (sibling.localName.toLowerCase() === name) {
|
|
13911
|
+
domSiblings.push(sibling);
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13914
|
+
}
|
|
13915
|
+
}
|
|
13916
|
+
if (domSiblings.length > 1) {
|
|
13917
|
+
name += ":eq(" + domSiblings.indexOf(node) + ")";
|
|
13918
|
+
}
|
|
13919
|
+
path = name + (path ? ">" + path : "");
|
|
13920
|
+
node = parent;
|
|
13921
|
+
}
|
|
13922
|
+
return path;
|
|
13923
|
+
}
|
|
13924
|
+
function isObject(obj) {
|
|
13925
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
13926
|
+
}
|
|
13927
|
+
function isObjTooDeep(obj, limit) {
|
|
13928
|
+
if (limit === 0) {
|
|
13929
|
+
return true;
|
|
13930
|
+
}
|
|
13931
|
+
var keys = Object.keys(obj);
|
|
13932
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(keys), _step; !(_step = _iterator()).done;){
|
|
13933
|
+
var key = _step.value;
|
|
13934
|
+
if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
|
|
13935
|
+
return true;
|
|
13936
|
+
}
|
|
13937
|
+
}
|
|
13938
|
+
return false;
|
|
13939
|
+
}
|
|
13940
|
+
function stringify(obj, stringifyOptions) {
|
|
13941
|
+
var options = {
|
|
13942
|
+
numOfKeysLimit: 50,
|
|
13943
|
+
depthOfLimit: 4
|
|
13944
|
+
};
|
|
13945
|
+
Object.assign(options, stringifyOptions);
|
|
13946
|
+
var stack = [];
|
|
13947
|
+
var keys = [];
|
|
13948
|
+
return JSON.stringify(obj, function(key, value) {
|
|
13949
|
+
if (stack.length > 0) {
|
|
13950
|
+
var thisPos = stack.indexOf(this);
|
|
13951
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
13952
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
13953
|
+
if (~stack.indexOf(value)) {
|
|
13954
|
+
if (stack[0] === value) {
|
|
13955
|
+
value = "[Circular ~]";
|
|
13956
|
+
} else {
|
|
13957
|
+
value = "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
13958
|
+
}
|
|
13959
|
+
}
|
|
13960
|
+
} else {
|
|
13961
|
+
stack.push(value);
|
|
13962
|
+
}
|
|
13963
|
+
if (value === null) return value;
|
|
13964
|
+
if (value === void 0) return "undefined";
|
|
13965
|
+
if (shouldIgnore(value)) {
|
|
13966
|
+
return toString(value);
|
|
13967
|
+
}
|
|
13968
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "bigint") {
|
|
13969
|
+
return value.toString() + "n";
|
|
13970
|
+
}
|
|
13971
|
+
if (_instanceof(value, Event)) {
|
|
13972
|
+
var eventResult = {};
|
|
13973
|
+
for(var eventKey in value){
|
|
13974
|
+
var eventValue = value[eventKey];
|
|
13975
|
+
if (Array.isArray(eventValue)) {
|
|
13976
|
+
eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
|
|
13977
|
+
} else {
|
|
13978
|
+
eventResult[eventKey] = eventValue;
|
|
13979
|
+
}
|
|
13980
|
+
}
|
|
13981
|
+
return eventResult;
|
|
13982
|
+
} else if (_instanceof(value, Node)) {
|
|
13983
|
+
if (_instanceof(value, HTMLElement)) {
|
|
13984
|
+
return value ? value.outerHTML : "";
|
|
13985
|
+
}
|
|
13986
|
+
return value.nodeName;
|
|
13987
|
+
} else if (_instanceof(value, Error)) {
|
|
13988
|
+
return value.stack ? value.stack + "\nEnd of stack for Error object" : value.name + ": " + value.message;
|
|
13989
|
+
}
|
|
13990
|
+
return value;
|
|
13991
|
+
});
|
|
13992
|
+
function shouldIgnore(_obj) {
|
|
13993
|
+
if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
|
|
13994
|
+
return true;
|
|
13995
|
+
}
|
|
13996
|
+
if (typeof _obj === "function") {
|
|
13997
|
+
return true;
|
|
13998
|
+
}
|
|
13999
|
+
if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
14000
|
+
return true;
|
|
14001
|
+
}
|
|
14002
|
+
return false;
|
|
14003
|
+
}
|
|
14004
|
+
function toString(_obj) {
|
|
14005
|
+
var str = _obj.toString();
|
|
14006
|
+
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
14007
|
+
str = "" + str.slice(0, options.stringLengthLimit) + "...";
|
|
14008
|
+
}
|
|
14009
|
+
return str;
|
|
14010
|
+
}
|
|
14011
|
+
}
|
|
14012
|
+
var defaultLogOptions = {
|
|
14013
|
+
level: [
|
|
14014
|
+
"assert",
|
|
14015
|
+
"clear",
|
|
14016
|
+
"count",
|
|
14017
|
+
"countReset",
|
|
14018
|
+
"debug",
|
|
14019
|
+
"dir",
|
|
14020
|
+
"dirxml",
|
|
14021
|
+
"error",
|
|
14022
|
+
"group",
|
|
14023
|
+
"groupCollapsed",
|
|
14024
|
+
"groupEnd",
|
|
14025
|
+
"info",
|
|
14026
|
+
"log",
|
|
14027
|
+
"table",
|
|
14028
|
+
"time",
|
|
14029
|
+
"timeEnd",
|
|
14030
|
+
"timeLog",
|
|
14031
|
+
"trace",
|
|
14032
|
+
"warn"
|
|
14033
|
+
],
|
|
14034
|
+
lengthThreshold: 1e3,
|
|
14035
|
+
logger: "console"
|
|
14036
|
+
};
|
|
14037
|
+
function initLogObserver(cb, win, options) {
|
|
14038
|
+
var logOptions = options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions;
|
|
14039
|
+
var loggerType = logOptions.logger;
|
|
14040
|
+
if (!loggerType) {
|
|
14041
|
+
return function() {};
|
|
14042
|
+
}
|
|
14043
|
+
var logger;
|
|
14044
|
+
if (typeof loggerType === "string") {
|
|
14045
|
+
logger = win[loggerType];
|
|
14046
|
+
} else {
|
|
14047
|
+
logger = loggerType;
|
|
14048
|
+
}
|
|
14049
|
+
var logCount = 0;
|
|
14050
|
+
var inStack = false;
|
|
14051
|
+
var cancelHandlers = [];
|
|
14052
|
+
if (logOptions.level.includes("error")) {
|
|
14053
|
+
var errorHandler = function(event) {
|
|
14054
|
+
var message = event.message, error = event.error;
|
|
14055
|
+
var trace = ErrorStackParser.parse(error).map(function(stackFrame) {
|
|
14056
|
+
return stackFrame.toString();
|
|
14057
|
+
});
|
|
14058
|
+
var payload = [
|
|
14059
|
+
stringify(message, logOptions.stringifyOptions)
|
|
14060
|
+
];
|
|
14061
|
+
cb({
|
|
14062
|
+
level: "error",
|
|
14063
|
+
trace: trace,
|
|
14064
|
+
payload: payload
|
|
14065
|
+
});
|
|
14066
|
+
};
|
|
14067
|
+
win.addEventListener("error", errorHandler);
|
|
14068
|
+
cancelHandlers.push(function() {
|
|
14069
|
+
win.removeEventListener("error", errorHandler);
|
|
14070
|
+
});
|
|
14071
|
+
var unhandledrejectionHandler = function(event) {
|
|
14072
|
+
var error;
|
|
14073
|
+
var payload;
|
|
14074
|
+
if (_instanceof(event.reason, Error)) {
|
|
14075
|
+
error = event.reason;
|
|
14076
|
+
payload = [
|
|
14077
|
+
stringify("Uncaught (in promise) " + error.name + ": " + error.message, logOptions.stringifyOptions)
|
|
14078
|
+
];
|
|
14079
|
+
} else {
|
|
14080
|
+
error = new Error();
|
|
14081
|
+
payload = [
|
|
14082
|
+
stringify("Uncaught (in promise)", logOptions.stringifyOptions),
|
|
14083
|
+
stringify(event.reason, logOptions.stringifyOptions)
|
|
14084
|
+
];
|
|
14085
|
+
}
|
|
14086
|
+
var trace = ErrorStackParser.parse(error).map(function(stackFrame) {
|
|
14087
|
+
return stackFrame.toString();
|
|
14088
|
+
});
|
|
14089
|
+
cb({
|
|
14090
|
+
level: "error",
|
|
14091
|
+
trace: trace,
|
|
14092
|
+
payload: payload
|
|
14093
|
+
});
|
|
14094
|
+
};
|
|
14095
|
+
win.addEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
14096
|
+
cancelHandlers.push(function() {
|
|
14097
|
+
win.removeEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
14098
|
+
});
|
|
14099
|
+
}
|
|
14100
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(logOptions.level), _step; !(_step = _iterator()).done;){
|
|
14101
|
+
var levelType = _step.value;
|
|
14102
|
+
cancelHandlers.push(replace(logger, levelType));
|
|
14103
|
+
}
|
|
14104
|
+
return function() {
|
|
14105
|
+
cancelHandlers.forEach(function(h) {
|
|
14106
|
+
return h();
|
|
14107
|
+
});
|
|
14108
|
+
};
|
|
14109
|
+
function replace(_logger, level) {
|
|
14110
|
+
var _this = this;
|
|
14111
|
+
if (!_logger[level]) {
|
|
14112
|
+
return function() {};
|
|
14113
|
+
}
|
|
14114
|
+
return patch(_logger, level, function(original) {
|
|
14115
|
+
var _this1 = _this;
|
|
14116
|
+
return function() {
|
|
14117
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
14118
|
+
args[_key] = arguments[_key];
|
|
14119
|
+
}
|
|
14120
|
+
original.apply(_this1, args);
|
|
14121
|
+
if (level === "assert" && !!args[0]) {
|
|
14122
|
+
return;
|
|
14123
|
+
}
|
|
14124
|
+
if (inStack) {
|
|
14125
|
+
return;
|
|
14126
|
+
}
|
|
14127
|
+
inStack = true;
|
|
14128
|
+
try {
|
|
14129
|
+
var trace = ErrorStackParser.parse(new Error()).map(function(stackFrame) {
|
|
14130
|
+
return stackFrame.toString();
|
|
14131
|
+
}).splice(1);
|
|
14132
|
+
var argsForPayload = level === "assert" ? args.slice(1) : args;
|
|
14133
|
+
var payload = argsForPayload.map(function(s) {
|
|
14134
|
+
return stringify(s, logOptions.stringifyOptions);
|
|
14135
|
+
});
|
|
14136
|
+
logCount++;
|
|
14137
|
+
if (logCount < logOptions.lengthThreshold) {
|
|
14138
|
+
cb({
|
|
14139
|
+
level: level,
|
|
14140
|
+
trace: trace,
|
|
14141
|
+
payload: payload
|
|
14142
|
+
});
|
|
14143
|
+
} else if (logCount === logOptions.lengthThreshold) {
|
|
14144
|
+
cb({
|
|
14145
|
+
level: "warn",
|
|
14146
|
+
trace: [],
|
|
14147
|
+
payload: [
|
|
14148
|
+
stringify("The number of log records reached the threshold.")
|
|
14149
|
+
]
|
|
14150
|
+
});
|
|
14151
|
+
}
|
|
14152
|
+
} catch (error) {
|
|
14153
|
+
original.apply(void 0, [].concat([
|
|
14154
|
+
"rrweb logger error:",
|
|
14155
|
+
error
|
|
14156
|
+
], args));
|
|
14157
|
+
} finally{
|
|
14158
|
+
inStack = false;
|
|
14159
|
+
}
|
|
14160
|
+
};
|
|
14161
|
+
});
|
|
14162
|
+
}
|
|
14163
|
+
}
|
|
14164
|
+
var PLUGIN_NAME = "rrweb/console@1";
|
|
14165
|
+
var getRecordConsolePlugin = function(options) {
|
|
14166
|
+
return {
|
|
14167
|
+
name: PLUGIN_NAME,
|
|
14168
|
+
observer: initLogObserver,
|
|
14169
|
+
options: options
|
|
14170
|
+
};
|
|
14171
|
+
};
|
|
13681
14172
|
|
|
13682
14173
|
var setImmediate = win['setImmediate'];
|
|
13683
14174
|
var builtInProp, cycle, schedulingQueue,
|
|
@@ -14043,7 +14534,7 @@ define((function () { 'use strict';
|
|
|
14043
14534
|
|
|
14044
14535
|
var Config = {
|
|
14045
14536
|
DEBUG: false,
|
|
14046
|
-
LIB_VERSION: '2.
|
|
14537
|
+
LIB_VERSION: '2.73.0'
|
|
14047
14538
|
};
|
|
14048
14539
|
|
|
14049
14540
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15783,6 +16274,28 @@ define((function () { 'use strict';
|
|
|
15783
16274
|
JSONStringify = JSONStringify || _.JSONEncode;
|
|
15784
16275
|
JSONParse = JSONParse || _.JSONDecode;
|
|
15785
16276
|
|
|
16277
|
+
/**
|
|
16278
|
+
* Determines if CompressionStream API should be used.
|
|
16279
|
+
* Returns false for Safari 16.4 and 16.5 which have breaking CompressionStream bugs.
|
|
16280
|
+
* https://bugs.webkit.org/show_bug.cgi?id=254021
|
|
16281
|
+
* fixed in 16.6 https://developer.apple.com/documentation/safari-release-notes/safari-16_6-release-notes
|
|
16282
|
+
*/
|
|
16283
|
+
var canUseCompressionStream = function(userAgent, vendor, opera) {
|
|
16284
|
+
if (!win.CompressionStream) {
|
|
16285
|
+
return false;
|
|
16286
|
+
}
|
|
16287
|
+
|
|
16288
|
+
var browser = _.info.browser(userAgent, vendor, opera);
|
|
16289
|
+
var version = _.info.browserVersion(userAgent, vendor, opera);
|
|
16290
|
+
if (browser === 'Safari' || browser === 'Mobile Safari') {
|
|
16291
|
+
if (version >= 16.4 && version < 16.6) {
|
|
16292
|
+
return false;
|
|
16293
|
+
}
|
|
16294
|
+
}
|
|
16295
|
+
|
|
16296
|
+
return true;
|
|
16297
|
+
};
|
|
16298
|
+
|
|
15786
16299
|
// UNMINIFIED EXPORTS (for closure compiler)
|
|
15787
16300
|
_['info'] = _.info;
|
|
15788
16301
|
_['info']['browser'] = _.info.browser;
|
|
@@ -17158,6 +17671,7 @@ define((function () { 'use strict';
|
|
|
17158
17671
|
* @property {number} idleExpires
|
|
17159
17672
|
* @property {number} maxExpires
|
|
17160
17673
|
* @property {number} replayStartTime
|
|
17674
|
+
* @property {number} lastEventTimestamp
|
|
17161
17675
|
* @property {number} seqNo
|
|
17162
17676
|
* @property {string} batchStartUrl
|
|
17163
17677
|
* @property {string} replayId
|
|
@@ -17178,6 +17692,7 @@ define((function () { 'use strict';
|
|
|
17178
17692
|
* @property {number} idleExpires
|
|
17179
17693
|
* @property {number} maxExpires
|
|
17180
17694
|
* @property {number} replayStartTime
|
|
17695
|
+
* @property {number} lastEventTimestamp - the unix timestamp of the last recorded event from rrweb
|
|
17181
17696
|
* @property {number} seqNo
|
|
17182
17697
|
* @property {string} batchStartUrl
|
|
17183
17698
|
* @property {string} replayStartUrl
|
|
@@ -17211,6 +17726,7 @@ define((function () { 'use strict';
|
|
|
17211
17726
|
this.idleExpires = options.idleExpires || null;
|
|
17212
17727
|
this.maxExpires = options.maxExpires || null;
|
|
17213
17728
|
this.replayStartTime = options.replayStartTime || null;
|
|
17729
|
+
this.lastEventTimestamp = options.lastEventTimestamp || null;
|
|
17214
17730
|
this.seqNo = options.seqNo || 0;
|
|
17215
17731
|
|
|
17216
17732
|
this.idleTimeoutId = null;
|
|
@@ -17270,10 +17786,20 @@ define((function () { 'use strict';
|
|
|
17270
17786
|
|
|
17271
17787
|
SessionRecording.prototype.unloadPersistedData = function () {
|
|
17272
17788
|
this.batcher.stop();
|
|
17273
|
-
|
|
17274
|
-
|
|
17789
|
+
|
|
17790
|
+
return this.queueStorage.init().catch(function () {
|
|
17791
|
+
this.reportError('Error initializing IndexedDB storage for unloading persisted data.');
|
|
17792
|
+
}.bind(this)).then(function () {
|
|
17793
|
+
// if the recording is too short, just delete any stored events without flushing
|
|
17794
|
+
if (this.getDurationMs() < this._getRecordMinMs()) {
|
|
17275
17795
|
return this.queueStorage.removeItem(this.batcherKey);
|
|
17276
|
-
}
|
|
17796
|
+
}
|
|
17797
|
+
|
|
17798
|
+
return this.batcher.flush()
|
|
17799
|
+
.then(function () {
|
|
17800
|
+
return this.queueStorage.removeItem(this.batcherKey);
|
|
17801
|
+
}.bind(this));
|
|
17802
|
+
}.bind(this));
|
|
17277
17803
|
};
|
|
17278
17804
|
|
|
17279
17805
|
SessionRecording.prototype.getConfig = function(configVar) {
|
|
@@ -17308,11 +17834,7 @@ define((function () { 'use strict';
|
|
|
17308
17834
|
this.maxExpires = new Date().getTime() + this.recordMaxMs;
|
|
17309
17835
|
}
|
|
17310
17836
|
|
|
17311
|
-
this.recordMinMs = this.
|
|
17312
|
-
if (this.recordMinMs > MAX_VALUE_FOR_MIN_RECORDING_MS) {
|
|
17313
|
-
this.recordMinMs = MAX_VALUE_FOR_MIN_RECORDING_MS;
|
|
17314
|
-
logger$3.critical('record_min_ms cannot be greater than ' + MAX_VALUE_FOR_MIN_RECORDING_MS + 'ms. Capping value.');
|
|
17315
|
-
}
|
|
17837
|
+
this.recordMinMs = this._getRecordMinMs();
|
|
17316
17838
|
|
|
17317
17839
|
if (!this.replayStartTime) {
|
|
17318
17840
|
this.replayStartTime = new Date().getTime();
|
|
@@ -17360,6 +17882,11 @@ define((function () { 'use strict';
|
|
|
17360
17882
|
}
|
|
17361
17883
|
// promise only used to await during tests
|
|
17362
17884
|
this.__enqueuePromise = this.batcher.enqueue(ev);
|
|
17885
|
+
|
|
17886
|
+
// Capture the timestamp of the last event for duration calculation.
|
|
17887
|
+
if (this.lastEventTimestamp === null || ev.timestamp > this.lastEventTimestamp) {
|
|
17888
|
+
this.lastEventTimestamp = ev.timestamp;
|
|
17889
|
+
}
|
|
17363
17890
|
}.bind(this),
|
|
17364
17891
|
'blockClass': this.getConfig('record_block_class'),
|
|
17365
17892
|
'blockSelector': blockSelector,
|
|
@@ -17374,7 +17901,16 @@ define((function () { 'use strict';
|
|
|
17374
17901
|
'recordCanvas': this.getConfig('record_canvas'),
|
|
17375
17902
|
'sampling': {
|
|
17376
17903
|
'canvas': 15
|
|
17377
|
-
}
|
|
17904
|
+
},
|
|
17905
|
+
'plugins': this.getConfig('record_console') ? [
|
|
17906
|
+
getRecordConsolePlugin({
|
|
17907
|
+
stringifyOptions: {
|
|
17908
|
+
stringLengthLimit: 1000,
|
|
17909
|
+
numOfKeysLimit: 50,
|
|
17910
|
+
depthOfLimit: 2
|
|
17911
|
+
}
|
|
17912
|
+
})
|
|
17913
|
+
] : []
|
|
17378
17914
|
});
|
|
17379
17915
|
} catch (err) {
|
|
17380
17916
|
this.reportError('Unexpected error when starting rrweb recording.', err);
|
|
@@ -17459,6 +17995,7 @@ define((function () { 'use strict';
|
|
|
17459
17995
|
'replayStartTime': this.replayStartTime,
|
|
17460
17996
|
'batchStartUrl': this.batchStartUrl,
|
|
17461
17997
|
'replayStartUrl': this.replayStartUrl,
|
|
17998
|
+
'lastEventTimestamp': this.lastEventTimestamp,
|
|
17462
17999
|
'idleExpires': this.idleExpires,
|
|
17463
18000
|
'maxExpires': this.maxExpires,
|
|
17464
18001
|
'tabId': tabId,
|
|
@@ -17480,6 +18017,7 @@ define((function () { 'use strict';
|
|
|
17480
18017
|
idleExpires: serializedRecording['idleExpires'],
|
|
17481
18018
|
maxExpires: serializedRecording['maxExpires'],
|
|
17482
18019
|
replayStartTime: serializedRecording['replayStartTime'],
|
|
18020
|
+
lastEventTimestamp: serializedRecording['lastEventTimestamp'],
|
|
17483
18021
|
seqNo: serializedRecording['seqNo'],
|
|
17484
18022
|
sharedLockStorage: options.sharedLockStorage,
|
|
17485
18023
|
}));
|
|
@@ -17570,7 +18108,7 @@ define((function () { 'use strict';
|
|
|
17570
18108
|
var eventsJson = JSON.stringify(data);
|
|
17571
18109
|
Object.assign(reqParams, this.getUserIdInfo());
|
|
17572
18110
|
|
|
17573
|
-
if (
|
|
18111
|
+
if (canUseCompressionStream(userAgent, navigator.vendor, windowOpera)) {
|
|
17574
18112
|
var jsonStream = new Blob([eventsJson], {type: 'application/json'}).stream();
|
|
17575
18113
|
var gzipStream = jsonStream.pipeThrough(new CompressionStream('gzip'));
|
|
17576
18114
|
new Response(gzipStream)
|
|
@@ -17599,6 +18137,38 @@ define((function () { 'use strict';
|
|
|
17599
18137
|
}
|
|
17600
18138
|
};
|
|
17601
18139
|
|
|
18140
|
+
/**
|
|
18141
|
+
* Calculates the duration of the recording in milliseconds, based on the start time and time of last recorded event.
|
|
18142
|
+
* @returns {number} The duration of the recording in milliseconds. Returns 0 if recording hasn't started.
|
|
18143
|
+
*/
|
|
18144
|
+
SessionRecording.prototype.getDurationMs = function() {
|
|
18145
|
+
if (this.replayStartTime === null) {
|
|
18146
|
+
return 0;
|
|
18147
|
+
}
|
|
18148
|
+
|
|
18149
|
+
// If the recording has no events, assume it is in progress and use the current time as the end time.
|
|
18150
|
+
if (this.lastEventTimestamp === null) {
|
|
18151
|
+
return new Date().getTime() - this.replayStartTime;
|
|
18152
|
+
}
|
|
18153
|
+
|
|
18154
|
+
return this.lastEventTimestamp - this.replayStartTime;
|
|
18155
|
+
};
|
|
18156
|
+
|
|
18157
|
+
/**
|
|
18158
|
+
* Lazily loads the minimum recording length config in milliseconds, respecting the maximum limit.
|
|
18159
|
+
* @returns {number} The minimum recording length in milliseconds.
|
|
18160
|
+
*/
|
|
18161
|
+
SessionRecording.prototype._getRecordMinMs = function() {
|
|
18162
|
+
var configValue = this.getConfig('record_min_ms');
|
|
18163
|
+
|
|
18164
|
+
if (configValue > MAX_VALUE_FOR_MIN_RECORDING_MS) {
|
|
18165
|
+
logger$3.critical('record_min_ms cannot be greater than ' + MAX_VALUE_FOR_MIN_RECORDING_MS + 'ms. Capping value.');
|
|
18166
|
+
return MAX_VALUE_FOR_MIN_RECORDING_MS;
|
|
18167
|
+
}
|
|
18168
|
+
|
|
18169
|
+
return configValue;
|
|
18170
|
+
};
|
|
18171
|
+
|
|
17602
18172
|
/**
|
|
17603
18173
|
* Module for handling the storage and retrieval of recording metadata as well as any active recordings.
|
|
17604
18174
|
* Makes sure that only one tab can be recording at a time.
|
|
@@ -18608,20 +19178,65 @@ define((function () { 'use strict';
|
|
|
18608
19178
|
return false;
|
|
18609
19179
|
}
|
|
18610
19180
|
|
|
19181
|
+
/**
|
|
19182
|
+
* Get the composed path of a click event for elements embedded in shadow DOM.
|
|
19183
|
+
* @param {Event} event - event to get the composed path from
|
|
19184
|
+
* @returns {Array} the composed path of the click event
|
|
19185
|
+
*/
|
|
19186
|
+
function getClickEventComposedPath(event) {
|
|
19187
|
+
if ('composedPath' in event) {
|
|
19188
|
+
return event['composedPath']();
|
|
19189
|
+
}
|
|
19190
|
+
|
|
19191
|
+
return [];
|
|
19192
|
+
}
|
|
19193
|
+
|
|
19194
|
+
/**
|
|
19195
|
+
* Get the element from a click event, accounting for elements embedded in shadow DOM.
|
|
19196
|
+
* @param {Event} event - event to get the target from
|
|
19197
|
+
* @returns {Element | null} the element that was the target of the click event
|
|
19198
|
+
*/
|
|
19199
|
+
function getClickEventTargetElement(event) {
|
|
19200
|
+
var path = getClickEventComposedPath(event);
|
|
19201
|
+
|
|
19202
|
+
if (path && path.length > 0) {
|
|
19203
|
+
return path[0];
|
|
19204
|
+
}
|
|
19205
|
+
|
|
19206
|
+
return event['target'] || event['srcElement'];
|
|
19207
|
+
}
|
|
19208
|
+
|
|
18611
19209
|
/** @const */ var DEFAULT_RAGE_CLICK_THRESHOLD_PX = 30;
|
|
18612
19210
|
/** @const */ var DEFAULT_RAGE_CLICK_TIMEOUT_MS = 1000;
|
|
18613
19211
|
/** @const */ var DEFAULT_RAGE_CLICK_CLICK_COUNT = 4;
|
|
19212
|
+
/** @const */ var DEFAULT_RAGE_CLICK_INTERACTIVE_ELEMENTS_ONLY = false;
|
|
18614
19213
|
|
|
18615
19214
|
function RageClickTracker() {
|
|
18616
19215
|
this.clicks = [];
|
|
18617
19216
|
}
|
|
18618
19217
|
|
|
18619
|
-
|
|
19218
|
+
/**
|
|
19219
|
+
* Determines if a click event is part of a rage click sequence.
|
|
19220
|
+
* @param {Event} event - the original click event.
|
|
19221
|
+
* @param {import('../index.d.ts').RageClickConfig} options - configuration options for rage click detection.
|
|
19222
|
+
* @returns {boolean} - true if the click is considered a rage click, false otherwise.
|
|
19223
|
+
*/
|
|
19224
|
+
RageClickTracker.prototype.isRageClick = function(event, options) {
|
|
18620
19225
|
options = options || {};
|
|
18621
19226
|
var thresholdPx = options['threshold_px'] || DEFAULT_RAGE_CLICK_THRESHOLD_PX;
|
|
18622
19227
|
var timeoutMs = options['timeout_ms'] || DEFAULT_RAGE_CLICK_TIMEOUT_MS;
|
|
18623
19228
|
var clickCount = options['click_count'] || DEFAULT_RAGE_CLICK_CLICK_COUNT;
|
|
19229
|
+
var interactiveElementsOnly = options['interactive_elements_only'] || DEFAULT_RAGE_CLICK_INTERACTIVE_ELEMENTS_ONLY;
|
|
19230
|
+
|
|
19231
|
+
if (interactiveElementsOnly) {
|
|
19232
|
+
var target = getClickEventTargetElement(event);
|
|
19233
|
+
if (!target || isDefinitelyNonInteractive(target)) {
|
|
19234
|
+
return false;
|
|
19235
|
+
}
|
|
19236
|
+
}
|
|
19237
|
+
|
|
18624
19238
|
var timestamp = Date.now();
|
|
19239
|
+
var x = event['pageX'], y = event['pageY'];
|
|
18625
19240
|
|
|
18626
19241
|
var lastClick = this.clicks[this.clicks.length - 1];
|
|
18627
19242
|
if (
|
|
@@ -18652,28 +19267,16 @@ define((function () { 'use strict';
|
|
|
18652
19267
|
if (!this.observedShadowRoots) {
|
|
18653
19268
|
return;
|
|
18654
19269
|
}
|
|
18655
|
-
var path = this.getComposedPath(event);
|
|
18656
|
-
if (path && path.length) {
|
|
18657
|
-
return path[0];
|
|
18658
|
-
}
|
|
18659
19270
|
|
|
18660
|
-
return event
|
|
19271
|
+
return getClickEventTargetElement(event);
|
|
18661
19272
|
};
|
|
18662
19273
|
|
|
18663
|
-
|
|
18664
|
-
ShadowDOMObserver.prototype.getComposedPath = function(event) {
|
|
18665
|
-
if ('composedPath' in event) {
|
|
18666
|
-
return event['composedPath']();
|
|
18667
|
-
}
|
|
18668
|
-
|
|
18669
|
-
return [];
|
|
18670
|
-
};
|
|
18671
19274
|
ShadowDOMObserver.prototype.observeFromEvent = function(event) {
|
|
18672
19275
|
if (!this.observedShadowRoots) {
|
|
18673
19276
|
return;
|
|
18674
19277
|
}
|
|
18675
19278
|
|
|
18676
|
-
var path =
|
|
19279
|
+
var path = getClickEventComposedPath(event);
|
|
18677
19280
|
|
|
18678
19281
|
// Check each element in path for shadow roots
|
|
18679
19282
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -19425,7 +20028,7 @@ define((function () { 'use strict';
|
|
|
19425
20028
|
return;
|
|
19426
20029
|
}
|
|
19427
20030
|
|
|
19428
|
-
if (this._rageClickTracker.isRageClick(ev
|
|
20031
|
+
if (this._rageClickTracker.isRageClick(ev, currentRageClickConfig)) {
|
|
19429
20032
|
this.trackDomEvent(ev, MP_EV_RAGE_CLICK);
|
|
19430
20033
|
}
|
|
19431
20034
|
}.bind(this);
|
|
@@ -21199,8 +21802,6 @@ define((function () { 'use strict';
|
|
|
21199
21802
|
var INIT_MODULE = 0;
|
|
21200
21803
|
var INIT_SNIPPET = 1;
|
|
21201
21804
|
|
|
21202
|
-
var IDENTITY_FUNC = function(x) {return x;};
|
|
21203
|
-
|
|
21204
21805
|
/** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
|
|
21205
21806
|
/** @const */ var PAYLOAD_TYPE_BASE64 = 'base64';
|
|
21206
21807
|
/** @const */ var PAYLOAD_TYPE_JSON = 'json';
|
|
@@ -21294,6 +21895,7 @@ define((function () { 'use strict';
|
|
|
21294
21895
|
'record_block_selector': 'img, video, audio',
|
|
21295
21896
|
'record_canvas': false,
|
|
21296
21897
|
'record_collect_fonts': false,
|
|
21898
|
+
'record_console': true,
|
|
21297
21899
|
'record_heatmap_data': false,
|
|
21298
21900
|
'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
|
|
21299
21901
|
'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
|
|
@@ -21365,6 +21967,17 @@ define((function () { 'use strict';
|
|
|
21365
21967
|
// global debug to be true
|
|
21366
21968
|
Config.DEBUG = Config.DEBUG || instance.get_config('debug');
|
|
21367
21969
|
|
|
21970
|
+
var source = init_type === INIT_MODULE ? 'module' : 'snippet';
|
|
21971
|
+
win.dispatchEvent(new win.CustomEvent('$mp_sdk_to_extension_event', {
|
|
21972
|
+
'detail': {
|
|
21973
|
+
'instance': instance,
|
|
21974
|
+
'source': source,
|
|
21975
|
+
'token': token,
|
|
21976
|
+
'name': name,
|
|
21977
|
+
'info': _.info
|
|
21978
|
+
}
|
|
21979
|
+
}));
|
|
21980
|
+
|
|
21368
21981
|
// if target is not defined, we called init after the lib already
|
|
21369
21982
|
// loaded, so there won't be an array of things to execute
|
|
21370
21983
|
if (!_.isUndefined(target) && _.isArray(target)) {
|
|
@@ -21435,6 +22048,8 @@ define((function () { 'use strict';
|
|
|
21435
22048
|
}
|
|
21436
22049
|
}
|
|
21437
22050
|
|
|
22051
|
+
this.hooks = {};
|
|
22052
|
+
|
|
21438
22053
|
this.set_config(_.extend({}, DEFAULT_CONFIG, variable_features, config, {
|
|
21439
22054
|
'name': name,
|
|
21440
22055
|
'token': token,
|
|
@@ -22035,7 +22650,12 @@ define((function () { 'use strict';
|
|
|
22035
22650
|
);
|
|
22036
22651
|
}, this),
|
|
22037
22652
|
beforeSendHook: _.bind(function(item) {
|
|
22038
|
-
|
|
22653
|
+
var ret = this._run_hook('before_send_' + attrs.type, item);
|
|
22654
|
+
if (ret) {
|
|
22655
|
+
return ret[0];
|
|
22656
|
+
} else {
|
|
22657
|
+
return null;
|
|
22658
|
+
}
|
|
22039
22659
|
}, this),
|
|
22040
22660
|
stopAllBatchingFunc: _.bind(this.stop_batch_senders, this),
|
|
22041
22661
|
usePersistence: true,
|
|
@@ -22128,6 +22748,9 @@ define((function () { 'use strict';
|
|
|
22128
22748
|
var send_request_immediately = _.bind(function() {
|
|
22129
22749
|
if (!send_request_options.skip_hooks) {
|
|
22130
22750
|
truncated_data = this._run_hook('before_send_' + options.type, truncated_data);
|
|
22751
|
+
if (truncated_data) {
|
|
22752
|
+
truncated_data = truncated_data[0];
|
|
22753
|
+
}
|
|
22131
22754
|
}
|
|
22132
22755
|
if (truncated_data) {
|
|
22133
22756
|
console$1.log('MIXPANEL REQUEST:');
|
|
@@ -22182,6 +22805,17 @@ define((function () { 'use strict';
|
|
|
22182
22805
|
* with the tracking payload sent to the API server is returned; otherwise false.
|
|
22183
22806
|
*/
|
|
22184
22807
|
MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, properties, options, callback) {
|
|
22808
|
+
var ret;
|
|
22809
|
+
if (!(options && options.skip_hooks)) {
|
|
22810
|
+
ret = this._run_hook('before_track', event_name, properties);
|
|
22811
|
+
if (ret === null) {
|
|
22812
|
+
return;
|
|
22813
|
+
} else {
|
|
22814
|
+
event_name = ret[0];
|
|
22815
|
+
properties = ret[1];
|
|
22816
|
+
}
|
|
22817
|
+
}
|
|
22818
|
+
|
|
22185
22819
|
if (!callback && typeof options === 'function') {
|
|
22186
22820
|
callback = options;
|
|
22187
22821
|
options = null;
|
|
@@ -22251,7 +22885,7 @@ define((function () { 'use strict';
|
|
|
22251
22885
|
'event': event_name,
|
|
22252
22886
|
'properties': properties
|
|
22253
22887
|
};
|
|
22254
|
-
|
|
22888
|
+
ret = this._track_or_batch({
|
|
22255
22889
|
type: 'events',
|
|
22256
22890
|
data: data,
|
|
22257
22891
|
endpoint: this.get_api_host('events') + '/' + this.get_config('api_routes')['track'],
|
|
@@ -22597,6 +23231,14 @@ define((function () { 'use strict';
|
|
|
22597
23231
|
* @param {boolean} [days_or_options.persistent=true] - whether to put in persistent storage (cookie/localStorage)
|
|
22598
23232
|
*/
|
|
22599
23233
|
MixpanelLib.prototype.register = function(props, days_or_options) {
|
|
23234
|
+
var ret = this._run_hook('before_register', props, days_or_options);
|
|
23235
|
+
if (ret === null) {
|
|
23236
|
+
return;
|
|
23237
|
+
} else {
|
|
23238
|
+
props = ret[0];
|
|
23239
|
+
days_or_options = ret[1];
|
|
23240
|
+
}
|
|
23241
|
+
|
|
22600
23242
|
var options = options_for_register(days_or_options);
|
|
22601
23243
|
if (options['persistent']) {
|
|
22602
23244
|
this['persistence'].register(props, options['days']);
|
|
@@ -22633,6 +23275,15 @@ define((function () { 'use strict';
|
|
|
22633
23275
|
* @param {boolean} [days_or_options.persistent=true] - whether to put in persistent storage (cookie/localStorage)
|
|
22634
23276
|
*/
|
|
22635
23277
|
MixpanelLib.prototype.register_once = function(props, default_value, days_or_options) {
|
|
23278
|
+
var ret = this._run_hook('before_register_once', props, default_value, days_or_options);
|
|
23279
|
+
if (ret === null) {
|
|
23280
|
+
return;
|
|
23281
|
+
} else {
|
|
23282
|
+
props = ret[0];
|
|
23283
|
+
default_value = ret[1];
|
|
23284
|
+
days_or_options = ret[2];
|
|
23285
|
+
}
|
|
23286
|
+
|
|
22636
23287
|
var options = options_for_register(days_or_options);
|
|
22637
23288
|
if (options['persistent']) {
|
|
22638
23289
|
this['persistence'].register_once(props, default_value, options['days']);
|
|
@@ -22656,6 +23307,14 @@ define((function () { 'use strict';
|
|
|
22656
23307
|
* @param {boolean} [options.persistent=true] - whether to look in persistent storage (cookie/localStorage)
|
|
22657
23308
|
*/
|
|
22658
23309
|
MixpanelLib.prototype.unregister = function(property, options) {
|
|
23310
|
+
var ret = this._run_hook('before_unregister', property, options);
|
|
23311
|
+
if (ret === null) {
|
|
23312
|
+
return;
|
|
23313
|
+
} else {
|
|
23314
|
+
property = ret[0];
|
|
23315
|
+
options = ret[1];
|
|
23316
|
+
}
|
|
23317
|
+
|
|
22659
23318
|
options = options_for_register(options);
|
|
22660
23319
|
if (options['persistent']) {
|
|
22661
23320
|
this['persistence'].unregister(property);
|
|
@@ -22704,6 +23363,13 @@ define((function () { 'use strict';
|
|
|
22704
23363
|
// _set_once_callback:function A callback to be run if and when the People set_once queue is flushed
|
|
22705
23364
|
// _union_callback:function A callback to be run if and when the People union queue is flushed
|
|
22706
23365
|
// _unset_callback:function A callback to be run if and when the People unset queue is flushed
|
|
23366
|
+
var ret = this._run_hook('before_identify', new_distinct_id);
|
|
23367
|
+
|
|
23368
|
+
if (ret === null) {
|
|
23369
|
+
return -1;
|
|
23370
|
+
} else {
|
|
23371
|
+
new_distinct_id = ret[0];
|
|
23372
|
+
}
|
|
22707
23373
|
|
|
22708
23374
|
var previous_distinct_id = this.get_distinct_id();
|
|
22709
23375
|
if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
|
|
@@ -23028,6 +23694,25 @@ define((function () { 'use strict';
|
|
|
23028
23694
|
if (('autocapture' in config || 'record_heatmap_data' in config) && this.autocapture) {
|
|
23029
23695
|
this.autocapture.init();
|
|
23030
23696
|
}
|
|
23697
|
+
|
|
23698
|
+
if (_.isObject(config['hooks'])) {
|
|
23699
|
+
this.hooks = {};
|
|
23700
|
+
_.each(config['hooks'], function(hook_value, hook_name) {
|
|
23701
|
+
if (_.isFunction(hook_value)) {
|
|
23702
|
+
this.hooks[hook_name] = [hook_value];
|
|
23703
|
+
} else if (_.isArray(hook_value)) {
|
|
23704
|
+
this.hooks[hook_name] = [];
|
|
23705
|
+
for (var i = 0; i < hook_value.length; i++) {
|
|
23706
|
+
if (!_.isFunction(hook_value[i])) {
|
|
23707
|
+
console$1.critical('Invalid hook added. Hook is not a function');
|
|
23708
|
+
}
|
|
23709
|
+
this.hooks[hook_name].push(hook_value[i]);
|
|
23710
|
+
}
|
|
23711
|
+
} else {
|
|
23712
|
+
console$1.critical('Invalid hooks added. Ensure that the hook values passed into config.hooks are functions or arrays of functions.');
|
|
23713
|
+
}
|
|
23714
|
+
}, this);
|
|
23715
|
+
}
|
|
23031
23716
|
}
|
|
23032
23717
|
};
|
|
23033
23718
|
|
|
@@ -23045,12 +23730,26 @@ define((function () { 'use strict';
|
|
|
23045
23730
|
* @returns {any|null} return value of user-provided hook, or null if nothing was returned
|
|
23046
23731
|
*/
|
|
23047
23732
|
MixpanelLib.prototype._run_hook = function(hook_name) {
|
|
23048
|
-
var
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
|
|
23052
|
-
|
|
23053
|
-
|
|
23733
|
+
var hook_data = slice.call(arguments, 1);
|
|
23734
|
+
_.each(this.hooks[hook_name], function(hook) {
|
|
23735
|
+
if (hook_data === null) {
|
|
23736
|
+
return null;
|
|
23737
|
+
}
|
|
23738
|
+
|
|
23739
|
+
var ret = hook.apply(this, hook_data);
|
|
23740
|
+
|
|
23741
|
+
if (typeof ret === 'undefined') {
|
|
23742
|
+
this.report_error(hook_name + ' hook did not return a valid value');
|
|
23743
|
+
hook_data = null;
|
|
23744
|
+
} else {
|
|
23745
|
+
if (!_.isArray(ret)) {
|
|
23746
|
+
ret = [ret];
|
|
23747
|
+
}
|
|
23748
|
+
hook_data.splice.apply(hook_data, [0, ret.length].concat(ret));
|
|
23749
|
+
}
|
|
23750
|
+
}, this);
|
|
23751
|
+
|
|
23752
|
+
return hook_data;
|
|
23054
23753
|
};
|
|
23055
23754
|
|
|
23056
23755
|
/**
|
|
@@ -23361,6 +24060,25 @@ define((function () { 'use strict';
|
|
|
23361
24060
|
}
|
|
23362
24061
|
};
|
|
23363
24062
|
|
|
24063
|
+
MixpanelLib.prototype.add_hook = function(hook_name, hook_fn) {
|
|
24064
|
+
if (!this.hooks[hook_name]) {
|
|
24065
|
+
this.hooks[hook_name] = [];
|
|
24066
|
+
}
|
|
24067
|
+
this.hooks[hook_name].push(hook_fn);
|
|
24068
|
+
};
|
|
24069
|
+
|
|
24070
|
+
MixpanelLib.prototype.remove_hook = function(hook_name, hook_fn) {
|
|
24071
|
+
var fn_index;
|
|
24072
|
+
if (this.hooks[hook_name]) {
|
|
24073
|
+
fn_index = this.hooks[hook_name].indexOf(hook_fn);
|
|
24074
|
+
if (fn_index !== -1) {
|
|
24075
|
+
this.hooks[hook_name].splice(fn_index, 1);
|
|
24076
|
+
} else {
|
|
24077
|
+
console$1.log('remove_hook failed. Matching hook was not found');
|
|
24078
|
+
}
|
|
24079
|
+
}
|
|
24080
|
+
};
|
|
24081
|
+
|
|
23364
24082
|
// EXPORTS (for closure compiler)
|
|
23365
24083
|
|
|
23366
24084
|
// MixpanelLib Exports
|
|
@@ -23393,6 +24111,8 @@ define((function () { 'use strict';
|
|
|
23393
24111
|
MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
|
|
23394
24112
|
MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
|
|
23395
24113
|
MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
|
|
24114
|
+
MixpanelLib.prototype['add_hook'] = MixpanelLib.prototype.add_hook;
|
|
24115
|
+
MixpanelLib.prototype['remove_hook'] = MixpanelLib.prototype.remove_hook;
|
|
23396
24116
|
MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
|
|
23397
24117
|
MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
|
|
23398
24118
|
MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
|