@posthog/rrweb 0.0.40 → 0.0.42
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 +38 -6
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.d.cts +6 -0
- package/dist/rrweb.d.ts +6 -0
- package/dist/rrweb.js +39 -7
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +38 -6
- package/dist/rrweb.umd.cjs.map +4 -4
- 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
|
@@ -26,6 +26,7 @@ import { PackFn } from '@posthog/rrweb-types';
|
|
|
26
26
|
import { playerMetaData } from '@posthog/rrweb-types';
|
|
27
27
|
import { RecordPlugin } from '@posthog/rrweb-types';
|
|
28
28
|
import { ReplayerEvents } from '@posthog/rrweb-types';
|
|
29
|
+
import { resetMaxDepthState } from '@posthog/rrweb-snapshot';
|
|
29
30
|
import { RRDocument } from '@posthog/rrdom';
|
|
30
31
|
import { RRIFrameElement } from '@posthog/rrdom';
|
|
31
32
|
import { RRNode } from '@posthog/rrdom';
|
|
@@ -35,6 +36,7 @@ import { StateMachine } from '@xstate/fsm';
|
|
|
35
36
|
import { textMutation } from '@posthog/rrweb-types';
|
|
36
37
|
import { throttleOptions } from '@posthog/rrweb-types';
|
|
37
38
|
import { UnpackFn } from '@posthog/rrweb-types';
|
|
39
|
+
import { wasMaxDepthReached } from '@posthog/rrweb-snapshot';
|
|
38
40
|
|
|
39
41
|
export declare const addCustomEvent: <T>(tag: string, payload: T) => void;
|
|
40
42
|
|
|
@@ -355,6 +357,8 @@ export declare type ReplayPlugin = {
|
|
|
355
357
|
}) => void;
|
|
356
358
|
};
|
|
357
359
|
|
|
360
|
+
export { resetMaxDepthState }
|
|
361
|
+
|
|
358
362
|
declare type ResolveTree = {
|
|
359
363
|
value: addedNodeMutation;
|
|
360
364
|
children: ResolveTree[];
|
|
@@ -464,6 +468,8 @@ declare namespace utils {
|
|
|
464
468
|
}
|
|
465
469
|
export { utils }
|
|
466
470
|
|
|
471
|
+
export { wasMaxDepthReached }
|
|
472
|
+
|
|
467
473
|
export { }
|
|
468
474
|
|
|
469
475
|
|
package/dist/rrweb.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { PackFn } from '@posthog/rrweb-types';
|
|
|
26
26
|
import { playerMetaData } from '@posthog/rrweb-types';
|
|
27
27
|
import { RecordPlugin } from '@posthog/rrweb-types';
|
|
28
28
|
import { ReplayerEvents } from '@posthog/rrweb-types';
|
|
29
|
+
import { resetMaxDepthState } from '@posthog/rrweb-snapshot';
|
|
29
30
|
import { RRDocument } from '@posthog/rrdom';
|
|
30
31
|
import { RRIFrameElement } from '@posthog/rrdom';
|
|
31
32
|
import { RRNode } from '@posthog/rrdom';
|
|
@@ -35,6 +36,7 @@ import { StateMachine } from '@xstate/fsm';
|
|
|
35
36
|
import { textMutation } from '@posthog/rrweb-types';
|
|
36
37
|
import { throttleOptions } from '@posthog/rrweb-types';
|
|
37
38
|
import { UnpackFn } from '@posthog/rrweb-types';
|
|
39
|
+
import { wasMaxDepthReached } from '@posthog/rrweb-snapshot';
|
|
38
40
|
|
|
39
41
|
export declare const addCustomEvent: <T>(tag: string, payload: T) => void;
|
|
40
42
|
|
|
@@ -355,6 +357,8 @@ export declare type ReplayPlugin = {
|
|
|
355
357
|
}) => void;
|
|
356
358
|
};
|
|
357
359
|
|
|
360
|
+
export { resetMaxDepthState }
|
|
361
|
+
|
|
358
362
|
declare type ResolveTree = {
|
|
359
363
|
value: addedNodeMutation;
|
|
360
364
|
children: ResolveTree[];
|
|
@@ -464,6 +468,8 @@ declare namespace utils {
|
|
|
464
468
|
}
|
|
465
469
|
export { utils }
|
|
466
470
|
|
|
471
|
+
export { wasMaxDepthReached }
|
|
472
|
+
|
|
467
473
|
export { }
|
|
468
474
|
|
|
469
475
|
|
package/dist/rrweb.js
CHANGED
|
@@ -1146,6 +1146,16 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
return false;
|
|
1148
1148
|
}
|
|
1149
|
+
const DEFAULT_MAX_DEPTH = 50;
|
|
1150
|
+
let _maxDepthWarned = false;
|
|
1151
|
+
let _maxDepthReached = false;
|
|
1152
|
+
function wasMaxDepthReached() {
|
|
1153
|
+
return _maxDepthReached;
|
|
1154
|
+
}
|
|
1155
|
+
function resetMaxDepthState() {
|
|
1156
|
+
_maxDepthReached = false;
|
|
1157
|
+
_maxDepthWarned = false;
|
|
1158
|
+
}
|
|
1149
1159
|
function serializeNodeWithId(n2, options) {
|
|
1150
1160
|
const {
|
|
1151
1161
|
doc,
|
|
@@ -1169,10 +1179,22 @@ function serializeNodeWithId(n2, options) {
|
|
|
1169
1179
|
onStylesheetLoad,
|
|
1170
1180
|
stylesheetLoadTimeout = 5e3,
|
|
1171
1181
|
keepIframeSrcFn = () => false,
|
|
1172
|
-
newlyAddedElement = false
|
|
1182
|
+
newlyAddedElement = false,
|
|
1183
|
+
depth = 0,
|
|
1184
|
+
maxDepth = DEFAULT_MAX_DEPTH
|
|
1173
1185
|
} = options;
|
|
1174
1186
|
let { needsMask } = options;
|
|
1175
1187
|
let { preserveWhiteSpace = true } = options;
|
|
1188
|
+
if (depth >= maxDepth) {
|
|
1189
|
+
_maxDepthReached = true;
|
|
1190
|
+
if (!_maxDepthWarned) {
|
|
1191
|
+
_maxDepthWarned = true;
|
|
1192
|
+
console.warn(
|
|
1193
|
+
`[rrweb-snapshot] DOM tree depth exceeded max depth of ${maxDepth}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1176
1198
|
if (!needsMask) {
|
|
1177
1199
|
const checkAncestors = needsMask === void 0;
|
|
1178
1200
|
needsMask = needMaskingText(
|
|
@@ -1253,7 +1275,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1253
1275
|
iframeLoadTimeout,
|
|
1254
1276
|
onStylesheetLoad,
|
|
1255
1277
|
stylesheetLoadTimeout,
|
|
1256
|
-
keepIframeSrcFn
|
|
1278
|
+
keepIframeSrcFn,
|
|
1279
|
+
depth: depth + 1,
|
|
1280
|
+
maxDepth
|
|
1257
1281
|
};
|
|
1258
1282
|
if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1259
1283
|
else {
|
|
@@ -1308,7 +1332,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1308
1332
|
iframeLoadTimeout,
|
|
1309
1333
|
onStylesheetLoad,
|
|
1310
1334
|
stylesheetLoadTimeout,
|
|
1311
|
-
keepIframeSrcFn
|
|
1335
|
+
keepIframeSrcFn,
|
|
1336
|
+
depth: depth + 1,
|
|
1337
|
+
maxDepth
|
|
1312
1338
|
});
|
|
1313
1339
|
if (serializedIframeNode) {
|
|
1314
1340
|
onIframeLoad(
|
|
@@ -1349,7 +1375,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1349
1375
|
iframeLoadTimeout,
|
|
1350
1376
|
onStylesheetLoad,
|
|
1351
1377
|
stylesheetLoadTimeout,
|
|
1352
|
-
keepIframeSrcFn
|
|
1378
|
+
keepIframeSrcFn,
|
|
1379
|
+
depth,
|
|
1380
|
+
maxDepth
|
|
1353
1381
|
});
|
|
1354
1382
|
if (serializedLinkNode) {
|
|
1355
1383
|
onStylesheetLoad(
|
|
@@ -1385,7 +1413,8 @@ function snapshot(n2, options) {
|
|
|
1385
1413
|
iframeLoadTimeout,
|
|
1386
1414
|
onStylesheetLoad,
|
|
1387
1415
|
stylesheetLoadTimeout,
|
|
1388
|
-
keepIframeSrcFn = () => false
|
|
1416
|
+
keepIframeSrcFn = () => false,
|
|
1417
|
+
maxDepth
|
|
1389
1418
|
} = options || {};
|
|
1390
1419
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1391
1420
|
color: true,
|
|
@@ -1446,7 +1475,8 @@ function snapshot(n2, options) {
|
|
|
1446
1475
|
onStylesheetLoad,
|
|
1447
1476
|
stylesheetLoadTimeout,
|
|
1448
1477
|
keepIframeSrcFn,
|
|
1449
|
-
newlyAddedElement: false
|
|
1478
|
+
newlyAddedElement: false,
|
|
1479
|
+
maxDepth
|
|
1450
1480
|
});
|
|
1451
1481
|
}
|
|
1452
1482
|
const MEDIA_SELECTOR = /(max|min)-device-(width|height)/;
|
|
@@ -18181,7 +18211,9 @@ export {
|
|
|
18181
18211
|
freezePage,
|
|
18182
18212
|
_mirror as mirror,
|
|
18183
18213
|
record,
|
|
18214
|
+
resetMaxDepthState,
|
|
18184
18215
|
takeFullSnapshot,
|
|
18185
|
-
utils
|
|
18216
|
+
utils,
|
|
18217
|
+
wasMaxDepthReached
|
|
18186
18218
|
};
|
|
18187
18219
|
//# sourceMappingURL=rrweb.js.map
|