@posthog/rrweb 0.0.48 → 0.0.50
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/dist/rrweb.cjs +104 -66
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.d.cts +1 -1
- package/dist/rrweb.d.ts +1 -1
- package/dist/rrweb.js +104 -66
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +100 -66
- package/dist/rrweb.umd.cjs.map +3 -3
- package/dist/rrweb.umd.min.cjs +19 -19
- package/dist/rrweb.umd.min.cjs.map +4 -4
- package/package.json +5 -5
package/dist/rrweb.cjs
CHANGED
|
@@ -1127,7 +1127,9 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1127
1127
|
return true;
|
|
1128
1128
|
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
|
|
1129
1129
|
/^msapplication-tile(image|color)$/
|
|
1130
|
-
) || lowerIfExists(sn.attributes.name) === "application-name" ||
|
|
1130
|
+
) || lowerIfExists(sn.attributes.name) === "application-name" || ["icon", "apple-touch-icon", "shortcut icon"].includes(
|
|
1131
|
+
lowerIfExists(sn.attributes.rel)
|
|
1132
|
+
)))) {
|
|
1131
1133
|
return true;
|
|
1132
1134
|
} else if (sn.tagName === "meta") {
|
|
1133
1135
|
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
@@ -1135,13 +1137,25 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1135
1137
|
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)
|
|
1136
1138
|
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
1137
1139
|
return true;
|
|
1138
|
-
} else if (slimDOMOptions.headMetaRobots &&
|
|
1140
|
+
} else if (slimDOMOptions.headMetaRobots && ["robots", "googlebot", "bingbot"].includes(
|
|
1141
|
+
lowerIfExists(sn.attributes.name)
|
|
1142
|
+
)) {
|
|
1139
1143
|
return true;
|
|
1140
1144
|
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
1141
1145
|
return true;
|
|
1142
|
-
} else if (slimDOMOptions.headMetaAuthorship && (
|
|
1146
|
+
} else if (slimDOMOptions.headMetaAuthorship && (["author", "generator", "framework", "publisher", "progid"].includes(
|
|
1147
|
+
lowerIfExists(sn.attributes.name)
|
|
1148
|
+
) || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
1143
1149
|
return true;
|
|
1144
|
-
} else if (slimDOMOptions.headMetaVerification &&
|
|
1150
|
+
} else if (slimDOMOptions.headMetaVerification && [
|
|
1151
|
+
"google-site-verification",
|
|
1152
|
+
"yandex-verification",
|
|
1153
|
+
"csrf-token",
|
|
1154
|
+
"p:domain_verify",
|
|
1155
|
+
"verify-v1",
|
|
1156
|
+
"verification",
|
|
1157
|
+
"shopify-checkout-api-token"
|
|
1158
|
+
].includes(lowerIfExists(sn.attributes.name))) {
|
|
1145
1159
|
return true;
|
|
1146
1160
|
}
|
|
1147
1161
|
}
|
|
@@ -1394,6 +1408,27 @@ function serializeNodeWithId(n2, options) {
|
|
|
1394
1408
|
}
|
|
1395
1409
|
return serializedNode;
|
|
1396
1410
|
}
|
|
1411
|
+
function slimDOMDefaults(slimDOM) {
|
|
1412
|
+
if (slimDOM === true || slimDOM === "all") {
|
|
1413
|
+
return {
|
|
1414
|
+
script: true,
|
|
1415
|
+
comment: true,
|
|
1416
|
+
headFavicon: true,
|
|
1417
|
+
headWhitespace: true,
|
|
1418
|
+
headMetaSocial: true,
|
|
1419
|
+
headMetaRobots: true,
|
|
1420
|
+
headMetaHttpEquiv: true,
|
|
1421
|
+
headMetaVerification: true,
|
|
1422
|
+
headMetaAuthorship: slimDOM === "all",
|
|
1423
|
+
headMetaDescKeywords: slimDOM === "all",
|
|
1424
|
+
headTitleMutations: slimDOM === "all"
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
if (slimDOM === false) {
|
|
1428
|
+
return {};
|
|
1429
|
+
}
|
|
1430
|
+
return slimDOM;
|
|
1431
|
+
}
|
|
1397
1432
|
function snapshot(n2, options) {
|
|
1398
1433
|
const {
|
|
1399
1434
|
mirror: mirror2 = new Mirror(),
|
|
@@ -1438,22 +1473,7 @@ function snapshot(n2, options) {
|
|
|
1438
1473
|
} : maskAllInputs === false ? {
|
|
1439
1474
|
password: true
|
|
1440
1475
|
} : maskAllInputs;
|
|
1441
|
-
const slimDOMOptions = slimDOM
|
|
1442
|
-
// if true: set of sensible options that should not throw away any information
|
|
1443
|
-
{
|
|
1444
|
-
script: true,
|
|
1445
|
-
comment: true,
|
|
1446
|
-
headFavicon: true,
|
|
1447
|
-
headWhitespace: true,
|
|
1448
|
-
headMetaDescKeywords: slimDOM === "all",
|
|
1449
|
-
// destructive
|
|
1450
|
-
headMetaSocial: true,
|
|
1451
|
-
headMetaRobots: true,
|
|
1452
|
-
headMetaHttpEquiv: true,
|
|
1453
|
-
headMetaAuthorship: true,
|
|
1454
|
-
headMetaVerification: true
|
|
1455
|
-
}
|
|
1456
|
-
) : slimDOM === false ? {} : slimDOM;
|
|
1476
|
+
const slimDOMOptions = slimDOMDefaults(slimDOM);
|
|
1457
1477
|
return serializeNodeWithId(n2, {
|
|
1458
1478
|
doc: n2,
|
|
1459
1479
|
mirror: mirror2,
|
|
@@ -11739,14 +11759,14 @@ function hasShadowRoot(n2) {
|
|
|
11739
11759
|
return Boolean(index.shadowRoot(n2));
|
|
11740
11760
|
}
|
|
11741
11761
|
function getNestedRule(rules2, position) {
|
|
11742
|
-
const rule2 = rules2[position[0]];
|
|
11762
|
+
const rule2 = rules2 == null ? void 0 : rules2[position[0]];
|
|
11763
|
+
if (!rule2) {
|
|
11764
|
+
return null;
|
|
11765
|
+
}
|
|
11743
11766
|
if (position.length === 1) {
|
|
11744
11767
|
return rule2;
|
|
11745
11768
|
} else {
|
|
11746
|
-
return getNestedRule(
|
|
11747
|
-
rule2.cssRules[position[1]].cssRules,
|
|
11748
|
-
position.slice(2)
|
|
11749
|
-
);
|
|
11769
|
+
return getNestedRule(rule2.cssRules, position.slice(1));
|
|
11750
11770
|
}
|
|
11751
11771
|
}
|
|
11752
11772
|
function getPositionsAndIndex(nestedIndex) {
|
|
@@ -12290,10 +12310,18 @@ class MutationBuffer {
|
|
|
12290
12310
|
this.attributes.push(item);
|
|
12291
12311
|
this.attributeMap.set(textarea, item);
|
|
12292
12312
|
}
|
|
12293
|
-
|
|
12313
|
+
const value = Array.from(
|
|
12294
12314
|
index.childNodes(textarea),
|
|
12295
12315
|
(cn) => index.textContent(cn) || ""
|
|
12296
12316
|
).join("");
|
|
12317
|
+
item.attributes.value = maskInputValue({
|
|
12318
|
+
element: textarea,
|
|
12319
|
+
maskInputOptions: this.maskInputOptions,
|
|
12320
|
+
tagName: textarea.tagName,
|
|
12321
|
+
type: getInputType(textarea),
|
|
12322
|
+
value,
|
|
12323
|
+
maskInputFn: this.maskInputFn
|
|
12324
|
+
});
|
|
12297
12325
|
});
|
|
12298
12326
|
__publicField(this, "processMutation", (m) => {
|
|
12299
12327
|
if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
|
|
@@ -12966,6 +12994,7 @@ function getNestedCSSRulePositions(rule2) {
|
|
|
12966
12994
|
);
|
|
12967
12995
|
const index2 = rules2.indexOf(childRule);
|
|
12968
12996
|
pos.unshift(index2);
|
|
12997
|
+
return recurse(childRule.parentRule, pos);
|
|
12969
12998
|
} else if (childRule.parentStyleSheet) {
|
|
12970
12999
|
const rules2 = Array.from(childRule.parentStyleSheet.cssRules);
|
|
12971
13000
|
const index2 = rules2.indexOf(childRule);
|
|
@@ -14404,17 +14433,19 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win, d
|
|
|
14404
14433
|
}
|
|
14405
14434
|
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
14406
14435
|
const handlers = [];
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14436
|
+
if (typeof win.WebGLRenderingContext !== "undefined") {
|
|
14437
|
+
handlers.push(
|
|
14438
|
+
...patchGLPrototype(
|
|
14439
|
+
win.WebGLRenderingContext.prototype,
|
|
14440
|
+
CanvasContext.WebGL,
|
|
14441
|
+
cb,
|
|
14442
|
+
blockClass,
|
|
14443
|
+
blockSelector,
|
|
14444
|
+
win,
|
|
14445
|
+
dataURLOptions
|
|
14446
|
+
)
|
|
14447
|
+
);
|
|
14448
|
+
}
|
|
14418
14449
|
if (typeof win.WebGL2RenderingContext !== "undefined") {
|
|
14419
14450
|
handlers.push(
|
|
14420
14451
|
...patchGLPrototype(
|
|
@@ -14881,21 +14912,9 @@ function record(options = {}) {
|
|
|
14881
14912
|
select: true,
|
|
14882
14913
|
password: true
|
|
14883
14914
|
} : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };
|
|
14884
|
-
const slimDOMOptions =
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
headFavicon: true,
|
|
14888
|
-
headWhitespace: true,
|
|
14889
|
-
headMetaSocial: true,
|
|
14890
|
-
headMetaRobots: true,
|
|
14891
|
-
headMetaHttpEquiv: true,
|
|
14892
|
-
headMetaVerification: true,
|
|
14893
|
-
// the following are off for slimDOMOptions === true,
|
|
14894
|
-
// as they destroy some (hidden) info:
|
|
14895
|
-
headMetaAuthorship: _slimDOMOptions === "all",
|
|
14896
|
-
headMetaDescKeywords: _slimDOMOptions === "all",
|
|
14897
|
-
headTitleMutations: _slimDOMOptions === "all"
|
|
14898
|
-
} : _slimDOMOptions ? _slimDOMOptions : {};
|
|
14915
|
+
const slimDOMOptions = slimDOMDefaults(
|
|
14916
|
+
_slimDOMOptions !== void 0 ? _slimDOMOptions : false
|
|
14917
|
+
);
|
|
14899
14918
|
polyfill$1();
|
|
14900
14919
|
let lastFullSnapshotEvent;
|
|
14901
14920
|
let incrementalSnapshotCount = 0;
|
|
@@ -15281,7 +15300,7 @@ function record(options = {}) {
|
|
|
15281
15300
|
handlers.push(observe(document));
|
|
15282
15301
|
recording = true;
|
|
15283
15302
|
};
|
|
15284
|
-
if (
|
|
15303
|
+
if (["interactive", "complete"].includes(document.readyState)) {
|
|
15285
15304
|
init();
|
|
15286
15305
|
} else {
|
|
15287
15306
|
handlers.push(
|
|
@@ -15308,7 +15327,17 @@ function record(options = {}) {
|
|
|
15308
15327
|
);
|
|
15309
15328
|
}
|
|
15310
15329
|
return () => {
|
|
15311
|
-
handlers.forEach((h) =>
|
|
15330
|
+
handlers.forEach((h) => {
|
|
15331
|
+
try {
|
|
15332
|
+
h();
|
|
15333
|
+
} catch (error) {
|
|
15334
|
+
const msg = String(error);
|
|
15335
|
+
const isCrossOriginFrameError = msg.includes("from accessing a cross-origin frame") && msg.includes("Blocked a frame with origin");
|
|
15336
|
+
if (!isCrossOriginFrameError) {
|
|
15337
|
+
throw error;
|
|
15338
|
+
}
|
|
15339
|
+
}
|
|
15340
|
+
});
|
|
15312
15341
|
processedNodeManager.destroy();
|
|
15313
15342
|
iframeManager.removeLoadListener();
|
|
15314
15343
|
iframeManager.destroy();
|
|
@@ -17876,18 +17905,27 @@ class Replayer {
|
|
|
17876
17905
|
const newSn = mirror2.getMeta(
|
|
17877
17906
|
target
|
|
17878
17907
|
);
|
|
17908
|
+
const newNode = buildNodeWithSN(
|
|
17909
|
+
{
|
|
17910
|
+
...newSn,
|
|
17911
|
+
attributes: {
|
|
17912
|
+
...newSn.attributes,
|
|
17913
|
+
...mutation.attributes
|
|
17914
|
+
}
|
|
17915
|
+
},
|
|
17916
|
+
{
|
|
17917
|
+
doc: target.ownerDocument,
|
|
17918
|
+
// can be Document or RRDocument
|
|
17919
|
+
mirror: mirror2,
|
|
17920
|
+
skipChild: true,
|
|
17921
|
+
hackCss: true,
|
|
17922
|
+
cache: this.cache
|
|
17923
|
+
}
|
|
17924
|
+
);
|
|
17879
17925
|
Object.assign(
|
|
17880
17926
|
newSn.attributes,
|
|
17881
17927
|
mutation.attributes
|
|
17882
17928
|
);
|
|
17883
|
-
const newNode = buildNodeWithSN(newSn, {
|
|
17884
|
-
doc: target.ownerDocument,
|
|
17885
|
-
// can be Document or RRDocument
|
|
17886
|
-
mirror: mirror2,
|
|
17887
|
-
skipChild: true,
|
|
17888
|
-
hackCss: true,
|
|
17889
|
-
cache: this.cache
|
|
17890
|
-
});
|
|
17891
17929
|
const siblingNode = target.nextSibling;
|
|
17892
17930
|
const parentNode2 = target.parentNode;
|
|
17893
17931
|
if (newNode && parentNode2) {
|
|
@@ -18037,7 +18075,7 @@ class Replayer {
|
|
|
18037
18075
|
if (Array.isArray(nestedIndex)) {
|
|
18038
18076
|
const { positions, index: index2 } = getPositionsAndIndex(nestedIndex);
|
|
18039
18077
|
const nestedRule = getNestedRule(styleSheet.cssRules, positions);
|
|
18040
|
-
nestedRule.insertRule(rule2, index2);
|
|
18078
|
+
nestedRule == null ? void 0 : nestedRule.insertRule(rule2, index2);
|
|
18041
18079
|
} else {
|
|
18042
18080
|
const index2 = nestedIndex === void 0 ? void 0 : Math.min(nestedIndex, styleSheet.cssRules.length);
|
|
18043
18081
|
styleSheet == null ? void 0 : styleSheet.insertRule(rule2, index2);
|
|
@@ -18050,19 +18088,19 @@ class Replayer {
|
|
|
18050
18088
|
if (Array.isArray(nestedIndex)) {
|
|
18051
18089
|
const { positions, index: index2 } = getPositionsAndIndex(nestedIndex);
|
|
18052
18090
|
const nestedRule = getNestedRule(styleSheet.cssRules, positions);
|
|
18053
|
-
nestedRule.deleteRule(index2 || 0);
|
|
18091
|
+
nestedRule == null ? void 0 : nestedRule.deleteRule(index2 || 0);
|
|
18054
18092
|
} else {
|
|
18055
18093
|
styleSheet == null ? void 0 : styleSheet.deleteRule(nestedIndex);
|
|
18056
18094
|
}
|
|
18057
18095
|
} catch (e2) {
|
|
18058
18096
|
}
|
|
18059
18097
|
});
|
|
18060
|
-
if (data.replace)
|
|
18098
|
+
if (typeof data.replace === "string")
|
|
18061
18099
|
try {
|
|
18062
18100
|
void ((_c = styleSheet.replace) == null ? void 0 : _c.call(styleSheet, data.replace));
|
|
18063
18101
|
} catch (e2) {
|
|
18064
18102
|
}
|
|
18065
|
-
if (data.replaceSync)
|
|
18103
|
+
if (typeof data.replaceSync === "string")
|
|
18066
18104
|
try {
|
|
18067
18105
|
(_d = styleSheet.replaceSync) == null ? void 0 : _d.call(styleSheet, data.replaceSync);
|
|
18068
18106
|
} catch (e2) {
|