@posthog/rrweb-record 0.0.30 → 0.0.33

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.
@@ -1432,8 +1432,8 @@ function getAugmentedNamespace$1(n2) {
1432
1432
  if (n2.__esModule) return n2;
1433
1433
  var f2 = n2.default;
1434
1434
  if (typeof f2 == "function") {
1435
- var a2 = function a22() {
1436
- if (this instanceof a22) {
1435
+ var a2 = function a3() {
1436
+ if (this instanceof a3) {
1437
1437
  return Reflect.construct(f2, arguments, this.constructor);
1438
1438
  }
1439
1439
  return f2.apply(this, arguments);
@@ -1442,8 +1442,8 @@ function getAugmentedNamespace$1(n2) {
1442
1442
  } else a2 = {};
1443
1443
  Object.defineProperty(a2, "__esModule", { value: true });
1444
1444
  Object.keys(n2).forEach(function(k) {
1445
- var d = Object.getOwnPropertyDescriptor(n2, k);
1446
- Object.defineProperty(a2, k, d.get ? d : {
1445
+ var d2 = Object.getOwnPropertyDescriptor(n2, k);
1446
+ Object.defineProperty(a2, k, d2.get ? d2 : {
1447
1447
  enumerable: true,
1448
1448
  get: function() {
1449
1449
  return n2[k];
@@ -1819,8 +1819,8 @@ function requireStringifier$1() {
1819
1819
  if (root2.raws.indent) return root2.raws.indent;
1820
1820
  let value;
1821
1821
  root2.walk((i2) => {
1822
- let p = i2.parent;
1823
- if (p && p !== root2 && p.parent && p.parent === root2) {
1822
+ let p2 = i2.parent;
1823
+ if (p2 && p2 !== root2 && p2.parent && p2.parent === root2) {
1824
1824
  if (typeof i2.raws.before !== "undefined") {
1825
1825
  let parts = i2.raws.before.split("\n");
1826
1826
  value = parts[parts.length - 1];
@@ -1918,7 +1918,7 @@ function requireNode$1() {
1918
1918
  } else if (i2 === "source") {
1919
1919
  cloned[i2] = value;
1920
1920
  } else if (Array.isArray(value)) {
1921
- cloned[i2] = value.map((j) => cloneNode(j, cloned));
1921
+ cloned[i2] = value.map((j2) => cloneNode(j2, cloned));
1922
1922
  } else {
1923
1923
  if (type === "object" && value !== null) value = cloneNode(value);
1924
1924
  cloned[i2] = value;
@@ -2704,10 +2704,10 @@ function requireAtRule$1() {
2704
2704
  Container.registerAtRule(AtRule);
2705
2705
  return atRule$1;
2706
2706
  }
2707
- var document$1$1;
2707
+ var document$2;
2708
2708
  var hasRequiredDocument$1;
2709
2709
  function requireDocument$1() {
2710
- if (hasRequiredDocument$1) return document$1$1;
2710
+ if (hasRequiredDocument$1) return document$2;
2711
2711
  hasRequiredDocument$1 = 1;
2712
2712
  let Container = requireContainer$1();
2713
2713
  let LazyResult, Processor;
@@ -2729,9 +2729,9 @@ function requireDocument$1() {
2729
2729
  Document2.registerProcessor = (dependant) => {
2730
2730
  Processor = dependant;
2731
2731
  };
2732
- document$1$1 = Document2;
2732
+ document$2 = Document2;
2733
2733
  Document2.default = Document2;
2734
- return document$1$1;
2734
+ return document$2;
2735
2735
  }
2736
2736
  var nonSecure$1;
2737
2737
  var hasRequiredNonSecure$1;
@@ -3434,9 +3434,9 @@ function requireMapGenerator$1() {
3434
3434
  column += str.length;
3435
3435
  }
3436
3436
  if (node2 && type !== "start") {
3437
- let p = node2.parent || { raws: {} };
3437
+ let p2 = node2.parent || { raws: {} };
3438
3438
  let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
3439
- if (!childless || node2 !== p.last || p.raws.semicolon) {
3439
+ if (!childless || node2 !== p2.last || p2.raws.semicolon) {
3440
3440
  if (node2.source && node2.source.end) {
3441
3441
  mapping.source = this.sourcePath(node2);
3442
3442
  mapping.original.line = node2.source.end.line;
@@ -3929,8 +3929,8 @@ function requireParser$1() {
3929
3929
  if (colon === false) return;
3930
3930
  let founded = 0;
3931
3931
  let token;
3932
- for (let j = colon - 1; j >= 0; j--) {
3933
- token = tokens[j];
3932
+ for (let j2 = colon - 1; j2 >= 0; j2--) {
3933
+ token = tokens[j2];
3934
3934
  if (token[0] !== "space") {
3935
3935
  founded += 1;
3936
3936
  if (founded === 2) break;
@@ -4048,8 +4048,8 @@ function requireParser$1() {
4048
4048
  } else if (token[1].toLowerCase() === "important") {
4049
4049
  let cache = tokens.slice(0);
4050
4050
  let str = "";
4051
- for (let j = i2; j > 0; j--) {
4052
- let type = cache[j][0];
4051
+ for (let j2 = i2; j2 > 0; j2--) {
4052
+ let type = cache[j2][0];
4053
4053
  if (str.trim().startsWith("!") && type !== "space") {
4054
4054
  break;
4055
4055
  }
@@ -4637,8 +4637,8 @@ function requireLazyResult$1() {
4637
4637
  let pluginVer = plugin.postcssVersion;
4638
4638
  let runtimeVer = this.result.processor.version;
4639
4639
  let a2 = pluginVer.split(".");
4640
- let b = runtimeVer.split(".");
4641
- if (a2[0] !== b[0] || parseInt(a2[1]) > parseInt(b[1])) {
4640
+ let b2 = runtimeVer.split(".");
4641
+ if (a2[0] !== b2[0] || parseInt(a2[1]) > parseInt(b2[1])) {
4642
4642
  console.error(
4643
4643
  "Unknown error from PostCSS plugin. Your current PostCSS version is " + runtimeVer + ", but " + pluginName + " uses " + pluginVer + ". Perhaps this is the source of the error below."
4644
4644
  );
@@ -5347,8 +5347,8 @@ function getAugmentedNamespace(n2) {
5347
5347
  if (n2.__esModule) return n2;
5348
5348
  var f2 = n2.default;
5349
5349
  if (typeof f2 == "function") {
5350
- var a2 = function a22() {
5351
- if (this instanceof a22) {
5350
+ var a2 = function a3() {
5351
+ if (this instanceof a3) {
5352
5352
  return Reflect.construct(f2, arguments, this.constructor);
5353
5353
  }
5354
5354
  return f2.apply(this, arguments);
@@ -5357,8 +5357,8 @@ function getAugmentedNamespace(n2) {
5357
5357
  } else a2 = {};
5358
5358
  Object.defineProperty(a2, "__esModule", { value: true });
5359
5359
  Object.keys(n2).forEach(function(k) {
5360
- var d = Object.getOwnPropertyDescriptor(n2, k);
5361
- Object.defineProperty(a2, k, d.get ? d : {
5360
+ var d2 = Object.getOwnPropertyDescriptor(n2, k);
5361
+ Object.defineProperty(a2, k, d2.get ? d2 : {
5362
5362
  enumerable: true,
5363
5363
  get: function() {
5364
5364
  return n2[k];
@@ -5734,8 +5734,8 @@ function requireStringifier() {
5734
5734
  if (root2.raws.indent) return root2.raws.indent;
5735
5735
  let value;
5736
5736
  root2.walk((i2) => {
5737
- let p = i2.parent;
5738
- if (p && p !== root2 && p.parent && p.parent === root2) {
5737
+ let p2 = i2.parent;
5738
+ if (p2 && p2 !== root2 && p2.parent && p2.parent === root2) {
5739
5739
  if (typeof i2.raws.before !== "undefined") {
5740
5740
  let parts = i2.raws.before.split("\n");
5741
5741
  value = parts[parts.length - 1];
@@ -5833,7 +5833,7 @@ function requireNode() {
5833
5833
  } else if (i2 === "source") {
5834
5834
  cloned[i2] = value;
5835
5835
  } else if (Array.isArray(value)) {
5836
- cloned[i2] = value.map((j) => cloneNode(j, cloned));
5836
+ cloned[i2] = value.map((j2) => cloneNode(j2, cloned));
5837
5837
  } else {
5838
5838
  if (type === "object" && value !== null) value = cloneNode(value);
5839
5839
  cloned[i2] = value;
@@ -7349,9 +7349,9 @@ function requireMapGenerator() {
7349
7349
  column += str.length;
7350
7350
  }
7351
7351
  if (node2 && type !== "start") {
7352
- let p = node2.parent || { raws: {} };
7352
+ let p2 = node2.parent || { raws: {} };
7353
7353
  let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
7354
- if (!childless || node2 !== p.last || p.raws.semicolon) {
7354
+ if (!childless || node2 !== p2.last || p2.raws.semicolon) {
7355
7355
  if (node2.source && node2.source.end) {
7356
7356
  mapping.source = this.sourcePath(node2);
7357
7357
  mapping.original.line = node2.source.end.line;
@@ -7844,8 +7844,8 @@ function requireParser() {
7844
7844
  if (colon === false) return;
7845
7845
  let founded = 0;
7846
7846
  let token;
7847
- for (let j = colon - 1; j >= 0; j--) {
7848
- token = tokens[j];
7847
+ for (let j2 = colon - 1; j2 >= 0; j2--) {
7848
+ token = tokens[j2];
7849
7849
  if (token[0] !== "space") {
7850
7850
  founded += 1;
7851
7851
  if (founded === 2) break;
@@ -7963,8 +7963,8 @@ function requireParser() {
7963
7963
  } else if (token[1].toLowerCase() === "important") {
7964
7964
  let cache = tokens.slice(0);
7965
7965
  let str = "";
7966
- for (let j = i2; j > 0; j--) {
7967
- let type = cache[j][0];
7966
+ for (let j2 = i2; j2 > 0; j2--) {
7967
+ let type = cache[j2][0];
7968
7968
  if (str.trim().startsWith("!") && type !== "space") {
7969
7969
  break;
7970
7970
  }
@@ -8552,8 +8552,8 @@ function requireLazyResult() {
8552
8552
  let pluginVer = plugin.postcssVersion;
8553
8553
  let runtimeVer = this.result.processor.version;
8554
8554
  let a2 = pluginVer.split(".");
8555
- let b = runtimeVer.split(".");
8556
- if (a2[0] !== b[0] || parseInt(a2[1]) > parseInt(b[1])) {
8555
+ let b2 = runtimeVer.split(".");
8556
+ if (a2[0] !== b2[0] || parseInt(a2[1]) > parseInt(b2[1])) {
8557
8557
  console.error(
8558
8558
  "Unknown error from PostCSS plugin. Your current PostCSS version is " + runtimeVer + ", but " + pluginName + " uses " + pluginVer + ". Perhaps this is the source of the error below."
8559
8559
  );
@@ -11503,6 +11503,7 @@ class IframeManager {
11503
11503
  __publicField(this, "recordCrossOriginIframes");
11504
11504
  __publicField(this, "messageHandler");
11505
11505
  __publicField(this, "nestedIframeListeners", /* @__PURE__ */ new Map());
11506
+ __publicField(this, "attachedIframes", /* @__PURE__ */ new Map());
11506
11507
  this.mutationCb = options.mutationCb;
11507
11508
  this.wrappedEmit = options.wrappedEmit;
11508
11509
  this.stylesheetManager = options.stylesheetManager;
@@ -11531,6 +11532,7 @@ class IframeManager {
11531
11532
  }
11532
11533
  attachIframe(iframeEl, childSn) {
11533
11534
  var _a2;
11535
+ this.attachedIframes.set(iframeEl, childSn);
11534
11536
  this.mutationCb({
11535
11537
  adds: [
11536
11538
  {
@@ -11586,6 +11588,7 @@ class IframeManager {
11586
11588
  const rootId = e2.data.node.id;
11587
11589
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
11588
11590
  this.patchRootIdOnNode(e2.data.node, rootId);
11591
+ this.attachedIframes.set(iframeEl, e2.data.node);
11589
11592
  return {
11590
11593
  timestamp: e2.timestamp,
11591
11594
  type: EventType.IncrementalSnapshot,
@@ -11728,6 +11731,32 @@ class IframeManager {
11728
11731
  });
11729
11732
  }
11730
11733
  }
11734
+ reattachIframes() {
11735
+ this.attachedIframes.forEach((content, iframe) => {
11736
+ if (!iframe.isConnected) {
11737
+ this.attachedIframes.delete(iframe);
11738
+ return;
11739
+ }
11740
+ const parentId = this.mirror.getId(iframe);
11741
+ if (parentId === -1) {
11742
+ this.attachedIframes.delete(iframe);
11743
+ return;
11744
+ }
11745
+ this.mutationCb({
11746
+ adds: [
11747
+ {
11748
+ parentId,
11749
+ nextId: null,
11750
+ node: content
11751
+ }
11752
+ ],
11753
+ removes: [],
11754
+ texts: [],
11755
+ attributes: [],
11756
+ isAttachIframe: true
11757
+ });
11758
+ });
11759
+ }
11731
11760
  destroy() {
11732
11761
  if (this.recordCrossOriginIframes) {
11733
11762
  window.removeEventListener("message", this.messageHandler);
@@ -11738,6 +11767,7 @@ class IframeManager {
11738
11767
  this.nestedIframeListeners.clear();
11739
11768
  this.crossOriginIframeMirror.reset();
11740
11769
  this.crossOriginIframeStyleMirror.reset();
11770
+ this.attachedIframes.clear();
11741
11771
  }
11742
11772
  }
11743
11773
  class ShadowDomManager {
@@ -12820,6 +12850,9 @@ function record(options = {}) {
12820
12850
  isCheckout
12821
12851
  );
12822
12852
  mutationBuffers.forEach((buf) => buf.unlock());
12853
+ if (recordCrossOriginIframes) {
12854
+ iframeManager.reattachIframes();
12855
+ }
12823
12856
  if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
12824
12857
  stylesheetManager.adoptStyleSheets(
12825
12858
  document.adoptedStyleSheets,