@posthog/rrweb 0.0.41 → 0.0.43

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.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
@@ -1148,6 +1148,14 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1148
1148
  }
1149
1149
  const DEFAULT_MAX_DEPTH = 50;
1150
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
+ }
1151
1159
  function serializeNodeWithId(n2, options) {
1152
1160
  const {
1153
1161
  doc,
@@ -1178,6 +1186,7 @@ function serializeNodeWithId(n2, options) {
1178
1186
  let { needsMask } = options;
1179
1187
  let { preserveWhiteSpace = true } = options;
1180
1188
  if (depth >= maxDepth) {
1189
+ _maxDepthReached = true;
1181
1190
  if (!_maxDepthWarned) {
1182
1191
  _maxDepthWarned = true;
1183
1192
  console.warn(
@@ -14402,7 +14411,7 @@ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, dat
14402
14411
  handlers.forEach((h) => h());
14403
14412
  };
14404
14413
  }
14405
- const jsContent = '(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n';
14414
+ const jsContent = '(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-DqRH07Di.js.map\n';
14406
14415
  const blob = typeof self !== "undefined" && self.Blob && new Blob([jsContent], { type: "text/javascript;charset=utf-8" });
14407
14416
  function WorkerWrapper(options) {
14408
14417
  let objURL;
@@ -18202,7 +18211,9 @@ export {
18202
18211
  freezePage,
18203
18212
  _mirror as mirror,
18204
18213
  record,
18214
+ resetMaxDepthState,
18205
18215
  takeFullSnapshot,
18206
- utils
18216
+ utils,
18217
+ wasMaxDepthReached
18207
18218
  };
18208
18219
  //# sourceMappingURL=rrweb.js.map