@posthog/rrweb-snapshot 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.
@@ -234,6 +234,8 @@ export declare function serializeNodeWithId(n: Node, options: {
234
234
  onMaxDepthReached?: () => void;
235
235
  }): serializedNodeWithId | null;
236
236
 
237
+ export declare function slimDOMDefaults(slimDOM: 'all' | boolean | SlimDOMOptions): SlimDOMOptions;
238
+
237
239
  export declare type SlimDOMOptions = Partial<{
238
240
  script: boolean;
239
241
  comment: boolean;
@@ -1,6 +1,6 @@
1
- import { D, I, b, c, g, i, n, r, a, s, t, v, w } from "./record-B2nV9UFB.js";
1
+ import { D, I, b, c, g, i, n, r, a, d, s, t, v, w } from "./record-CbT7EKn4.js";
2
2
  import { adaptCssForReplay, buildNodeWithSN, createCache, rebuild } from "./replay.js";
3
- import { M, N, o, p, h, e, n as n2, f, l, j, d, g as g2, i as i2, b as b2, k, a as a2, m, r as r2, c as c2, s as s2, t as t2 } from "./types-OLXvwyjP.js";
3
+ import { M, N, o, p, h, e, n as n2, f, l, j, d as d2, g as g2, i as i2, b as b2, k, a as a2, m, r as r2, c as c2, s as s2, t as t2 } from "./types-OLXvwyjP.js";
4
4
  export {
5
5
  D as DEFAULT_MAX_DEPTH,
6
6
  I as IGNORED_NODE,
@@ -21,7 +21,7 @@ export {
21
21
  l as getInputType,
22
22
  i as ignoreAttribute,
23
23
  j as is2DCanvasBlank,
24
- d as isCSSImportRule,
24
+ d2 as isCSSImportRule,
25
25
  g2 as isCSSStyleRule,
26
26
  i2 as isElement,
27
27
  b2 as isNativeShadowDom,
@@ -33,6 +33,7 @@ export {
33
33
  r2 as recompressBase64Image,
34
34
  r as resetMaxDepthState,
35
35
  a as serializeNodeWithId,
36
+ d as slimDOMDefaults,
36
37
  s as snapshot,
37
38
  c2 as stringifyRule,
38
39
  s2 as stringifyStylesheet,
@@ -587,9 +587,9 @@ var require_types_B7TTv7Jc = __commonJS({
587
587
  }
588
588
  });
589
589
 
590
- // dist/record-oACzRSl-.cjs
591
- var require_record_oACzRSl = __commonJS({
592
- "dist/record-oACzRSl-.cjs"(exports2) {
590
+ // dist/record-BUfdSR_C.cjs
591
+ var require_record_BUfdSR_C = __commonJS({
592
+ "dist/record-BUfdSR_C.cjs"(exports2) {
593
593
  "use strict";
594
594
  var types2 = require_types_B7TTv7Jc();
595
595
  var _id = 1;
@@ -1204,7 +1204,9 @@ var require_record_oACzRSl = __commonJS({
1204
1204
  return true;
1205
1205
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
1206
1206
  /^msapplication-tile(image|color)$/
1207
- ) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
1207
+ ) || lowerIfExists(sn.attributes.name) === "application-name" || ["icon", "apple-touch-icon", "shortcut icon"].includes(
1208
+ lowerIfExists(sn.attributes.rel)
1209
+ )))) {
1208
1210
  return true;
1209
1211
  } else if (sn.tagName === "meta") {
1210
1212
  if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
@@ -1212,13 +1214,25 @@ var require_record_oACzRSl = __commonJS({
1212
1214
  } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)
1213
1215
  lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
1214
1216
  return true;
1215
- } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
1217
+ } else if (slimDOMOptions.headMetaRobots && ["robots", "googlebot", "bingbot"].includes(
1218
+ lowerIfExists(sn.attributes.name)
1219
+ )) {
1216
1220
  return true;
1217
1221
  } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
1218
1222
  return true;
1219
- } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
1223
+ } else if (slimDOMOptions.headMetaAuthorship && (["author", "generator", "framework", "publisher", "progid"].includes(
1224
+ lowerIfExists(sn.attributes.name)
1225
+ ) || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
1220
1226
  return true;
1221
- } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) {
1227
+ } else if (slimDOMOptions.headMetaVerification && [
1228
+ "google-site-verification",
1229
+ "yandex-verification",
1230
+ "csrf-token",
1231
+ "p:domain_verify",
1232
+ "verify-v1",
1233
+ "verification",
1234
+ "shopify-checkout-api-token"
1235
+ ].includes(lowerIfExists(sn.attributes.name))) {
1222
1236
  return true;
1223
1237
  }
1224
1238
  }
@@ -1471,6 +1485,27 @@ var require_record_oACzRSl = __commonJS({
1471
1485
  }
1472
1486
  return serializedNode;
1473
1487
  }
1488
+ function slimDOMDefaults(slimDOM) {
1489
+ if (slimDOM === true || slimDOM === "all") {
1490
+ return {
1491
+ script: true,
1492
+ comment: true,
1493
+ headFavicon: true,
1494
+ headWhitespace: true,
1495
+ headMetaSocial: true,
1496
+ headMetaRobots: true,
1497
+ headMetaHttpEquiv: true,
1498
+ headMetaVerification: true,
1499
+ headMetaAuthorship: slimDOM === "all",
1500
+ headMetaDescKeywords: slimDOM === "all",
1501
+ headTitleMutations: slimDOM === "all"
1502
+ };
1503
+ }
1504
+ if (slimDOM === false) {
1505
+ return {};
1506
+ }
1507
+ return slimDOM;
1508
+ }
1474
1509
  function snapshot(n, options) {
1475
1510
  const {
1476
1511
  mirror = new types2.Mirror(),
@@ -1515,22 +1550,7 @@ var require_record_oACzRSl = __commonJS({
1515
1550
  } : maskAllInputs === false ? {
1516
1551
  password: true
1517
1552
  } : maskAllInputs;
1518
- const slimDOMOptions = slimDOM === true || slimDOM === "all" ? (
1519
- // if true: set of sensible options that should not throw away any information
1520
- {
1521
- script: true,
1522
- comment: true,
1523
- headFavicon: true,
1524
- headWhitespace: true,
1525
- headMetaDescKeywords: slimDOM === "all",
1526
- // destructive
1527
- headMetaSocial: true,
1528
- headMetaRobots: true,
1529
- headMetaHttpEquiv: true,
1530
- headMetaAuthorship: true,
1531
- headMetaVerification: true
1532
- }
1533
- ) : slimDOM === false ? {} : slimDOM;
1553
+ const slimDOMOptions = slimDOMDefaults(slimDOM);
1534
1554
  return serializeNodeWithId(n, {
1535
1555
  doc: n,
1536
1556
  mirror,
@@ -1579,6 +1599,7 @@ var require_record_oACzRSl = __commonJS({
1579
1599
  exports2.needMaskingText = needMaskingText;
1580
1600
  exports2.resetMaxDepthState = resetMaxDepthState;
1581
1601
  exports2.serializeNodeWithId = serializeNodeWithId;
1602
+ exports2.slimDOMDefaults = slimDOMDefaults;
1582
1603
  exports2.snapshot = snapshot;
1583
1604
  exports2.transformAttribute = transformAttribute;
1584
1605
  exports2.visitSnapshot = visitSnapshot;
@@ -5987,7 +6008,7 @@ var require_replay = __commonJS({
5987
6008
 
5988
6009
  // dist/rrweb-snapshot.cjs
5989
6010
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5990
- var record = require_record_oACzRSl();
6011
+ var record = require_record_BUfdSR_C();
5991
6012
  var replay = require_replay();
5992
6013
  var types = require_types_B7TTv7Jc();
5993
6014
  exports.DEFAULT_MAX_DEPTH = record.DEFAULT_MAX_DEPTH;
@@ -5999,6 +6020,7 @@ exports.ignoreAttribute = record.ignoreAttribute;
5999
6020
  exports.needMaskingText = record.needMaskingText;
6000
6021
  exports.resetMaxDepthState = record.resetMaxDepthState;
6001
6022
  exports.serializeNodeWithId = record.serializeNodeWithId;
6023
+ exports.slimDOMDefaults = record.slimDOMDefaults;
6002
6024
  exports.snapshot = record.snapshot;
6003
6025
  exports.transformAttribute = record.transformAttribute;
6004
6026
  exports.visitSnapshot = record.visitSnapshot;