@posthog/rrweb 0.0.49 → 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 +93 -65
- 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 +93 -65
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +89 -65
- 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.d.cts
CHANGED
|
@@ -70,7 +70,7 @@ export declare const freezePage: () => void;
|
|
|
70
70
|
|
|
71
71
|
declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
|
|
72
72
|
|
|
73
|
-
declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule;
|
|
73
|
+
declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule | null;
|
|
74
74
|
|
|
75
75
|
declare function getPositionsAndIndex(nestedIndex: number[]): {
|
|
76
76
|
positions: number[];
|
package/dist/rrweb.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare const freezePage: () => void;
|
|
|
70
70
|
|
|
71
71
|
declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
|
|
72
72
|
|
|
73
|
-
declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule;
|
|
73
|
+
declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule | null;
|
|
74
74
|
|
|
75
75
|
declare function getPositionsAndIndex(nestedIndex: number[]): {
|
|
76
76
|
positions: number[];
|
package/dist/rrweb.js
CHANGED
|
@@ -1125,7 +1125,9 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1125
1125
|
return true;
|
|
1126
1126
|
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
|
|
1127
1127
|
/^msapplication-tile(image|color)$/
|
|
1128
|
-
) || lowerIfExists(sn.attributes.name) === "application-name" ||
|
|
1128
|
+
) || lowerIfExists(sn.attributes.name) === "application-name" || ["icon", "apple-touch-icon", "shortcut icon"].includes(
|
|
1129
|
+
lowerIfExists(sn.attributes.rel)
|
|
1130
|
+
)))) {
|
|
1129
1131
|
return true;
|
|
1130
1132
|
} else if (sn.tagName === "meta") {
|
|
1131
1133
|
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
@@ -1133,13 +1135,25 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1133
1135
|
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)
|
|
1134
1136
|
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
1135
1137
|
return true;
|
|
1136
|
-
} else if (slimDOMOptions.headMetaRobots &&
|
|
1138
|
+
} else if (slimDOMOptions.headMetaRobots && ["robots", "googlebot", "bingbot"].includes(
|
|
1139
|
+
lowerIfExists(sn.attributes.name)
|
|
1140
|
+
)) {
|
|
1137
1141
|
return true;
|
|
1138
1142
|
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
1139
1143
|
return true;
|
|
1140
|
-
} else if (slimDOMOptions.headMetaAuthorship && (
|
|
1144
|
+
} else if (slimDOMOptions.headMetaAuthorship && (["author", "generator", "framework", "publisher", "progid"].includes(
|
|
1145
|
+
lowerIfExists(sn.attributes.name)
|
|
1146
|
+
) || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
1141
1147
|
return true;
|
|
1142
|
-
} else if (slimDOMOptions.headMetaVerification &&
|
|
1148
|
+
} else if (slimDOMOptions.headMetaVerification && [
|
|
1149
|
+
"google-site-verification",
|
|
1150
|
+
"yandex-verification",
|
|
1151
|
+
"csrf-token",
|
|
1152
|
+
"p:domain_verify",
|
|
1153
|
+
"verify-v1",
|
|
1154
|
+
"verification",
|
|
1155
|
+
"shopify-checkout-api-token"
|
|
1156
|
+
].includes(lowerIfExists(sn.attributes.name))) {
|
|
1143
1157
|
return true;
|
|
1144
1158
|
}
|
|
1145
1159
|
}
|
|
@@ -1392,6 +1406,27 @@ function serializeNodeWithId(n2, options) {
|
|
|
1392
1406
|
}
|
|
1393
1407
|
return serializedNode;
|
|
1394
1408
|
}
|
|
1409
|
+
function slimDOMDefaults(slimDOM) {
|
|
1410
|
+
if (slimDOM === true || slimDOM === "all") {
|
|
1411
|
+
return {
|
|
1412
|
+
script: true,
|
|
1413
|
+
comment: true,
|
|
1414
|
+
headFavicon: true,
|
|
1415
|
+
headWhitespace: true,
|
|
1416
|
+
headMetaSocial: true,
|
|
1417
|
+
headMetaRobots: true,
|
|
1418
|
+
headMetaHttpEquiv: true,
|
|
1419
|
+
headMetaVerification: true,
|
|
1420
|
+
headMetaAuthorship: slimDOM === "all",
|
|
1421
|
+
headMetaDescKeywords: slimDOM === "all",
|
|
1422
|
+
headTitleMutations: slimDOM === "all"
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
if (slimDOM === false) {
|
|
1426
|
+
return {};
|
|
1427
|
+
}
|
|
1428
|
+
return slimDOM;
|
|
1429
|
+
}
|
|
1395
1430
|
function snapshot(n2, options) {
|
|
1396
1431
|
const {
|
|
1397
1432
|
mirror: mirror2 = new Mirror(),
|
|
@@ -1436,22 +1471,7 @@ function snapshot(n2, options) {
|
|
|
1436
1471
|
} : maskAllInputs === false ? {
|
|
1437
1472
|
password: true
|
|
1438
1473
|
} : maskAllInputs;
|
|
1439
|
-
const slimDOMOptions = slimDOM
|
|
1440
|
-
// if true: set of sensible options that should not throw away any information
|
|
1441
|
-
{
|
|
1442
|
-
script: true,
|
|
1443
|
-
comment: true,
|
|
1444
|
-
headFavicon: true,
|
|
1445
|
-
headWhitespace: true,
|
|
1446
|
-
headMetaDescKeywords: slimDOM === "all",
|
|
1447
|
-
// destructive
|
|
1448
|
-
headMetaSocial: true,
|
|
1449
|
-
headMetaRobots: true,
|
|
1450
|
-
headMetaHttpEquiv: true,
|
|
1451
|
-
headMetaAuthorship: true,
|
|
1452
|
-
headMetaVerification: true
|
|
1453
|
-
}
|
|
1454
|
-
) : slimDOM === false ? {} : slimDOM;
|
|
1474
|
+
const slimDOMOptions = slimDOMDefaults(slimDOM);
|
|
1455
1475
|
return serializeNodeWithId(n2, {
|
|
1456
1476
|
doc: n2,
|
|
1457
1477
|
mirror: mirror2,
|
|
@@ -11737,14 +11757,14 @@ function hasShadowRoot(n2) {
|
|
|
11737
11757
|
return Boolean(index.shadowRoot(n2));
|
|
11738
11758
|
}
|
|
11739
11759
|
function getNestedRule(rules2, position) {
|
|
11740
|
-
const rule2 = rules2[position[0]];
|
|
11760
|
+
const rule2 = rules2 == null ? void 0 : rules2[position[0]];
|
|
11761
|
+
if (!rule2) {
|
|
11762
|
+
return null;
|
|
11763
|
+
}
|
|
11741
11764
|
if (position.length === 1) {
|
|
11742
11765
|
return rule2;
|
|
11743
11766
|
} else {
|
|
11744
|
-
return getNestedRule(
|
|
11745
|
-
rule2.cssRules[position[1]].cssRules,
|
|
11746
|
-
position.slice(2)
|
|
11747
|
-
);
|
|
11767
|
+
return getNestedRule(rule2.cssRules, position.slice(1));
|
|
11748
11768
|
}
|
|
11749
11769
|
}
|
|
11750
11770
|
function getPositionsAndIndex(nestedIndex) {
|
|
@@ -12288,10 +12308,18 @@ class MutationBuffer {
|
|
|
12288
12308
|
this.attributes.push(item);
|
|
12289
12309
|
this.attributeMap.set(textarea, item);
|
|
12290
12310
|
}
|
|
12291
|
-
|
|
12311
|
+
const value = Array.from(
|
|
12292
12312
|
index.childNodes(textarea),
|
|
12293
12313
|
(cn) => index.textContent(cn) || ""
|
|
12294
12314
|
).join("");
|
|
12315
|
+
item.attributes.value = maskInputValue({
|
|
12316
|
+
element: textarea,
|
|
12317
|
+
maskInputOptions: this.maskInputOptions,
|
|
12318
|
+
tagName: textarea.tagName,
|
|
12319
|
+
type: getInputType(textarea),
|
|
12320
|
+
value,
|
|
12321
|
+
maskInputFn: this.maskInputFn
|
|
12322
|
+
});
|
|
12295
12323
|
});
|
|
12296
12324
|
__publicField(this, "processMutation", (m) => {
|
|
12297
12325
|
if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
|
|
@@ -12964,6 +12992,7 @@ function getNestedCSSRulePositions(rule2) {
|
|
|
12964
12992
|
);
|
|
12965
12993
|
const index2 = rules2.indexOf(childRule);
|
|
12966
12994
|
pos.unshift(index2);
|
|
12995
|
+
return recurse(childRule.parentRule, pos);
|
|
12967
12996
|
} else if (childRule.parentStyleSheet) {
|
|
12968
12997
|
const rules2 = Array.from(childRule.parentStyleSheet.cssRules);
|
|
12969
12998
|
const index2 = rules2.indexOf(childRule);
|
|
@@ -14402,17 +14431,19 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win, d
|
|
|
14402
14431
|
}
|
|
14403
14432
|
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
14404
14433
|
const handlers = [];
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14434
|
+
if (typeof win.WebGLRenderingContext !== "undefined") {
|
|
14435
|
+
handlers.push(
|
|
14436
|
+
...patchGLPrototype(
|
|
14437
|
+
win.WebGLRenderingContext.prototype,
|
|
14438
|
+
CanvasContext.WebGL,
|
|
14439
|
+
cb,
|
|
14440
|
+
blockClass,
|
|
14441
|
+
blockSelector,
|
|
14442
|
+
win,
|
|
14443
|
+
dataURLOptions
|
|
14444
|
+
)
|
|
14445
|
+
);
|
|
14446
|
+
}
|
|
14416
14447
|
if (typeof win.WebGL2RenderingContext !== "undefined") {
|
|
14417
14448
|
handlers.push(
|
|
14418
14449
|
...patchGLPrototype(
|
|
@@ -14879,21 +14910,9 @@ function record(options = {}) {
|
|
|
14879
14910
|
select: true,
|
|
14880
14911
|
password: true
|
|
14881
14912
|
} : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };
|
|
14882
|
-
const slimDOMOptions =
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
headFavicon: true,
|
|
14886
|
-
headWhitespace: true,
|
|
14887
|
-
headMetaSocial: true,
|
|
14888
|
-
headMetaRobots: true,
|
|
14889
|
-
headMetaHttpEquiv: true,
|
|
14890
|
-
headMetaVerification: true,
|
|
14891
|
-
// the following are off for slimDOMOptions === true,
|
|
14892
|
-
// as they destroy some (hidden) info:
|
|
14893
|
-
headMetaAuthorship: _slimDOMOptions === "all",
|
|
14894
|
-
headMetaDescKeywords: _slimDOMOptions === "all",
|
|
14895
|
-
headTitleMutations: _slimDOMOptions === "all"
|
|
14896
|
-
} : _slimDOMOptions ? _slimDOMOptions : {};
|
|
14913
|
+
const slimDOMOptions = slimDOMDefaults(
|
|
14914
|
+
_slimDOMOptions !== void 0 ? _slimDOMOptions : false
|
|
14915
|
+
);
|
|
14897
14916
|
polyfill$1();
|
|
14898
14917
|
let lastFullSnapshotEvent;
|
|
14899
14918
|
let incrementalSnapshotCount = 0;
|
|
@@ -15279,7 +15298,7 @@ function record(options = {}) {
|
|
|
15279
15298
|
handlers.push(observe(document));
|
|
15280
15299
|
recording = true;
|
|
15281
15300
|
};
|
|
15282
|
-
if (
|
|
15301
|
+
if (["interactive", "complete"].includes(document.readyState)) {
|
|
15283
15302
|
init();
|
|
15284
15303
|
} else {
|
|
15285
15304
|
handlers.push(
|
|
@@ -17884,18 +17903,27 @@ class Replayer {
|
|
|
17884
17903
|
const newSn = mirror2.getMeta(
|
|
17885
17904
|
target
|
|
17886
17905
|
);
|
|
17906
|
+
const newNode = buildNodeWithSN(
|
|
17907
|
+
{
|
|
17908
|
+
...newSn,
|
|
17909
|
+
attributes: {
|
|
17910
|
+
...newSn.attributes,
|
|
17911
|
+
...mutation.attributes
|
|
17912
|
+
}
|
|
17913
|
+
},
|
|
17914
|
+
{
|
|
17915
|
+
doc: target.ownerDocument,
|
|
17916
|
+
// can be Document or RRDocument
|
|
17917
|
+
mirror: mirror2,
|
|
17918
|
+
skipChild: true,
|
|
17919
|
+
hackCss: true,
|
|
17920
|
+
cache: this.cache
|
|
17921
|
+
}
|
|
17922
|
+
);
|
|
17887
17923
|
Object.assign(
|
|
17888
17924
|
newSn.attributes,
|
|
17889
17925
|
mutation.attributes
|
|
17890
17926
|
);
|
|
17891
|
-
const newNode = buildNodeWithSN(newSn, {
|
|
17892
|
-
doc: target.ownerDocument,
|
|
17893
|
-
// can be Document or RRDocument
|
|
17894
|
-
mirror: mirror2,
|
|
17895
|
-
skipChild: true,
|
|
17896
|
-
hackCss: true,
|
|
17897
|
-
cache: this.cache
|
|
17898
|
-
});
|
|
17899
17927
|
const siblingNode = target.nextSibling;
|
|
17900
17928
|
const parentNode2 = target.parentNode;
|
|
17901
17929
|
if (newNode && parentNode2) {
|
|
@@ -18045,7 +18073,7 @@ class Replayer {
|
|
|
18045
18073
|
if (Array.isArray(nestedIndex)) {
|
|
18046
18074
|
const { positions, index: index2 } = getPositionsAndIndex(nestedIndex);
|
|
18047
18075
|
const nestedRule = getNestedRule(styleSheet.cssRules, positions);
|
|
18048
|
-
nestedRule.insertRule(rule2, index2);
|
|
18076
|
+
nestedRule == null ? void 0 : nestedRule.insertRule(rule2, index2);
|
|
18049
18077
|
} else {
|
|
18050
18078
|
const index2 = nestedIndex === void 0 ? void 0 : Math.min(nestedIndex, styleSheet.cssRules.length);
|
|
18051
18079
|
styleSheet == null ? void 0 : styleSheet.insertRule(rule2, index2);
|
|
@@ -18058,19 +18086,19 @@ class Replayer {
|
|
|
18058
18086
|
if (Array.isArray(nestedIndex)) {
|
|
18059
18087
|
const { positions, index: index2 } = getPositionsAndIndex(nestedIndex);
|
|
18060
18088
|
const nestedRule = getNestedRule(styleSheet.cssRules, positions);
|
|
18061
|
-
nestedRule.deleteRule(index2 || 0);
|
|
18089
|
+
nestedRule == null ? void 0 : nestedRule.deleteRule(index2 || 0);
|
|
18062
18090
|
} else {
|
|
18063
18091
|
styleSheet == null ? void 0 : styleSheet.deleteRule(nestedIndex);
|
|
18064
18092
|
}
|
|
18065
18093
|
} catch (e2) {
|
|
18066
18094
|
}
|
|
18067
18095
|
});
|
|
18068
|
-
if (data.replace)
|
|
18096
|
+
if (typeof data.replace === "string")
|
|
18069
18097
|
try {
|
|
18070
18098
|
void ((_c = styleSheet.replace) == null ? void 0 : _c.call(styleSheet, data.replace));
|
|
18071
18099
|
} catch (e2) {
|
|
18072
18100
|
}
|
|
18073
|
-
if (data.replaceSync)
|
|
18101
|
+
if (typeof data.replaceSync === "string")
|
|
18074
18102
|
try {
|
|
18075
18103
|
(_d = styleSheet.replaceSync) == null ? void 0 : _d.call(styleSheet, data.replaceSync);
|
|
18076
18104
|
} catch (e2) {
|