@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.
@@ -1477,8 +1477,8 @@ function getAugmentedNamespace$1(n2) {
1477
1477
  if (n2.__esModule) return n2;
1478
1478
  var f2 = n2.default;
1479
1479
  if (typeof f2 == "function") {
1480
- var a2 = function a22() {
1481
- if (this instanceof a22) {
1480
+ var a2 = function a3() {
1481
+ if (this instanceof a3) {
1482
1482
  return Reflect.construct(f2, arguments, this.constructor);
1483
1483
  }
1484
1484
  return f2.apply(this, arguments);
@@ -1487,8 +1487,8 @@ function getAugmentedNamespace$1(n2) {
1487
1487
  } else a2 = {};
1488
1488
  Object.defineProperty(a2, "__esModule", { value: true });
1489
1489
  Object.keys(n2).forEach(function(k) {
1490
- var d = Object.getOwnPropertyDescriptor(n2, k);
1491
- Object.defineProperty(a2, k, d.get ? d : {
1490
+ var d2 = Object.getOwnPropertyDescriptor(n2, k);
1491
+ Object.defineProperty(a2, k, d2.get ? d2 : {
1492
1492
  enumerable: true,
1493
1493
  get: function() {
1494
1494
  return n2[k];
@@ -1864,8 +1864,8 @@ function requireStringifier$1() {
1864
1864
  if (root2.raws.indent) return root2.raws.indent;
1865
1865
  let value;
1866
1866
  root2.walk((i2) => {
1867
- let p = i2.parent;
1868
- if (p && p !== root2 && p.parent && p.parent === root2) {
1867
+ let p2 = i2.parent;
1868
+ if (p2 && p2 !== root2 && p2.parent && p2.parent === root2) {
1869
1869
  if (typeof i2.raws.before !== "undefined") {
1870
1870
  let parts = i2.raws.before.split("\n");
1871
1871
  value = parts[parts.length - 1];
@@ -1963,7 +1963,7 @@ function requireNode$1() {
1963
1963
  } else if (i2 === "source") {
1964
1964
  cloned[i2] = value;
1965
1965
  } else if (Array.isArray(value)) {
1966
- cloned[i2] = value.map((j) => cloneNode(j, cloned));
1966
+ cloned[i2] = value.map((j2) => cloneNode(j2, cloned));
1967
1967
  } else {
1968
1968
  if (type === "object" && value !== null) value = cloneNode(value);
1969
1969
  cloned[i2] = value;
@@ -2749,10 +2749,10 @@ function requireAtRule$1() {
2749
2749
  Container.registerAtRule(AtRule);
2750
2750
  return atRule$1;
2751
2751
  }
2752
- var document$1$1;
2752
+ var document$2;
2753
2753
  var hasRequiredDocument$1;
2754
2754
  function requireDocument$1() {
2755
- if (hasRequiredDocument$1) return document$1$1;
2755
+ if (hasRequiredDocument$1) return document$2;
2756
2756
  hasRequiredDocument$1 = 1;
2757
2757
  let Container = requireContainer$1();
2758
2758
  let LazyResult, Processor;
@@ -2774,9 +2774,9 @@ function requireDocument$1() {
2774
2774
  Document2.registerProcessor = (dependant) => {
2775
2775
  Processor = dependant;
2776
2776
  };
2777
- document$1$1 = Document2;
2777
+ document$2 = Document2;
2778
2778
  Document2.default = Document2;
2779
- return document$1$1;
2779
+ return document$2;
2780
2780
  }
2781
2781
  var nonSecure$1;
2782
2782
  var hasRequiredNonSecure$1;
@@ -3478,9 +3478,9 @@ function requireMapGenerator$1() {
3478
3478
  column += str.length;
3479
3479
  }
3480
3480
  if (node2 && type !== "start") {
3481
- let p = node2.parent || { raws: {} };
3481
+ let p2 = node2.parent || { raws: {} };
3482
3482
  let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
3483
- if (!childless || node2 !== p.last || p.raws.semicolon) {
3483
+ if (!childless || node2 !== p2.last || p2.raws.semicolon) {
3484
3484
  if (node2.source && node2.source.end) {
3485
3485
  mapping.source = this.sourcePath(node2);
3486
3486
  mapping.original.line = node2.source.end.line;
@@ -3973,8 +3973,8 @@ function requireParser$1() {
3973
3973
  if (colon === false) return;
3974
3974
  let founded = 0;
3975
3975
  let token;
3976
- for (let j = colon - 1; j >= 0; j--) {
3977
- token = tokens[j];
3976
+ for (let j2 = colon - 1; j2 >= 0; j2--) {
3977
+ token = tokens[j2];
3978
3978
  if (token[0] !== "space") {
3979
3979
  founded += 1;
3980
3980
  if (founded === 2) break;
@@ -4092,8 +4092,8 @@ function requireParser$1() {
4092
4092
  } else if (token[1].toLowerCase() === "important") {
4093
4093
  let cache = tokens.slice(0);
4094
4094
  let str = "";
4095
- for (let j = i2; j > 0; j--) {
4096
- let type = cache[j][0];
4095
+ for (let j2 = i2; j2 > 0; j2--) {
4096
+ let type = cache[j2][0];
4097
4097
  if (str.trim().startsWith("!") && type !== "space") {
4098
4098
  break;
4099
4099
  }
@@ -4681,8 +4681,8 @@ function requireLazyResult$1() {
4681
4681
  let pluginVer = plugin.postcssVersion;
4682
4682
  let runtimeVer = this.result.processor.version;
4683
4683
  let a2 = pluginVer.split(".");
4684
- let b = runtimeVer.split(".");
4685
- if (a2[0] !== b[0] || parseInt(a2[1]) > parseInt(b[1])) {
4684
+ let b2 = runtimeVer.split(".");
4685
+ if (a2[0] !== b2[0] || parseInt(a2[1]) > parseInt(b2[1])) {
4686
4686
  console.error(
4687
4687
  "Unknown error from PostCSS plugin. Your current PostCSS version is " + runtimeVer + ", but " + pluginName + " uses " + pluginVer + ". Perhaps this is the source of the error below."
4688
4688
  );
@@ -5391,8 +5391,8 @@ function getAugmentedNamespace(n2) {
5391
5391
  if (n2.__esModule) return n2;
5392
5392
  var f2 = n2.default;
5393
5393
  if (typeof f2 == "function") {
5394
- var a2 = function a22() {
5395
- if (this instanceof a22) {
5394
+ var a2 = function a3() {
5395
+ if (this instanceof a3) {
5396
5396
  return Reflect.construct(f2, arguments, this.constructor);
5397
5397
  }
5398
5398
  return f2.apply(this, arguments);
@@ -5401,8 +5401,8 @@ function getAugmentedNamespace(n2) {
5401
5401
  } else a2 = {};
5402
5402
  Object.defineProperty(a2, "__esModule", { value: true });
5403
5403
  Object.keys(n2).forEach(function(k) {
5404
- var d = Object.getOwnPropertyDescriptor(n2, k);
5405
- Object.defineProperty(a2, k, d.get ? d : {
5404
+ var d2 = Object.getOwnPropertyDescriptor(n2, k);
5405
+ Object.defineProperty(a2, k, d2.get ? d2 : {
5406
5406
  enumerable: true,
5407
5407
  get: function() {
5408
5408
  return n2[k];
@@ -5778,8 +5778,8 @@ function requireStringifier() {
5778
5778
  if (root2.raws.indent) return root2.raws.indent;
5779
5779
  let value;
5780
5780
  root2.walk((i2) => {
5781
- let p = i2.parent;
5782
- if (p && p !== root2 && p.parent && p.parent === root2) {
5781
+ let p2 = i2.parent;
5782
+ if (p2 && p2 !== root2 && p2.parent && p2.parent === root2) {
5783
5783
  if (typeof i2.raws.before !== "undefined") {
5784
5784
  let parts = i2.raws.before.split("\n");
5785
5785
  value = parts[parts.length - 1];
@@ -5877,7 +5877,7 @@ function requireNode() {
5877
5877
  } else if (i2 === "source") {
5878
5878
  cloned[i2] = value;
5879
5879
  } else if (Array.isArray(value)) {
5880
- cloned[i2] = value.map((j) => cloneNode(j, cloned));
5880
+ cloned[i2] = value.map((j2) => cloneNode(j2, cloned));
5881
5881
  } else {
5882
5882
  if (type === "object" && value !== null) value = cloneNode(value);
5883
5883
  cloned[i2] = value;
@@ -7392,9 +7392,9 @@ function requireMapGenerator() {
7392
7392
  column += str.length;
7393
7393
  }
7394
7394
  if (node2 && type !== "start") {
7395
- let p = node2.parent || { raws: {} };
7395
+ let p2 = node2.parent || { raws: {} };
7396
7396
  let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
7397
- if (!childless || node2 !== p.last || p.raws.semicolon) {
7397
+ if (!childless || node2 !== p2.last || p2.raws.semicolon) {
7398
7398
  if (node2.source && node2.source.end) {
7399
7399
  mapping.source = this.sourcePath(node2);
7400
7400
  mapping.original.line = node2.source.end.line;
@@ -7887,8 +7887,8 @@ function requireParser() {
7887
7887
  if (colon === false) return;
7888
7888
  let founded = 0;
7889
7889
  let token;
7890
- for (let j = colon - 1; j >= 0; j--) {
7891
- token = tokens[j];
7890
+ for (let j2 = colon - 1; j2 >= 0; j2--) {
7891
+ token = tokens[j2];
7892
7892
  if (token[0] !== "space") {
7893
7893
  founded += 1;
7894
7894
  if (founded === 2) break;
@@ -8006,8 +8006,8 @@ function requireParser() {
8006
8006
  } else if (token[1].toLowerCase() === "important") {
8007
8007
  let cache = tokens.slice(0);
8008
8008
  let str = "";
8009
- for (let j = i2; j > 0; j--) {
8010
- let type = cache[j][0];
8009
+ for (let j2 = i2; j2 > 0; j2--) {
8010
+ let type = cache[j2][0];
8011
8011
  if (str.trim().startsWith("!") && type !== "space") {
8012
8012
  break;
8013
8013
  }
@@ -8595,8 +8595,8 @@ function requireLazyResult() {
8595
8595
  let pluginVer = plugin.postcssVersion;
8596
8596
  let runtimeVer = this.result.processor.version;
8597
8597
  let a2 = pluginVer.split(".");
8598
- let b = runtimeVer.split(".");
8599
- if (a2[0] !== b[0] || parseInt(a2[1]) > parseInt(b[1])) {
8598
+ let b2 = runtimeVer.split(".");
8599
+ if (a2[0] !== b2[0] || parseInt(a2[1]) > parseInt(b2[1])) {
8600
8600
  console.error(
8601
8601
  "Unknown error from PostCSS plugin. Your current PostCSS version is " + runtimeVer + ", but " + pluginName + " uses " + pluginVer + ". Perhaps this is the source of the error below."
8602
8602
  );
@@ -11545,6 +11545,7 @@ class IframeManager {
11545
11545
  __publicField(this, "recordCrossOriginIframes");
11546
11546
  __publicField(this, "messageHandler");
11547
11547
  __publicField(this, "nestedIframeListeners", /* @__PURE__ */ new Map());
11548
+ __publicField(this, "attachedIframes", /* @__PURE__ */ new Map());
11548
11549
  this.mutationCb = options.mutationCb;
11549
11550
  this.wrappedEmit = options.wrappedEmit;
11550
11551
  this.stylesheetManager = options.stylesheetManager;
@@ -11573,6 +11574,7 @@ class IframeManager {
11573
11574
  }
11574
11575
  attachIframe(iframeEl, childSn) {
11575
11576
  var _a2;
11577
+ this.attachedIframes.set(iframeEl, childSn);
11576
11578
  this.mutationCb({
11577
11579
  adds: [
11578
11580
  {
@@ -11628,6 +11630,7 @@ class IframeManager {
11628
11630
  const rootId = e2.data.node.id;
11629
11631
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
11630
11632
  this.patchRootIdOnNode(e2.data.node, rootId);
11633
+ this.attachedIframes.set(iframeEl, e2.data.node);
11631
11634
  return {
11632
11635
  timestamp: e2.timestamp,
11633
11636
  type: EventType.IncrementalSnapshot,
@@ -11770,6 +11773,32 @@ class IframeManager {
11770
11773
  });
11771
11774
  }
11772
11775
  }
11776
+ reattachIframes() {
11777
+ this.attachedIframes.forEach((content, iframe) => {
11778
+ if (!iframe.isConnected) {
11779
+ this.attachedIframes.delete(iframe);
11780
+ return;
11781
+ }
11782
+ const parentId = this.mirror.getId(iframe);
11783
+ if (parentId === -1) {
11784
+ this.attachedIframes.delete(iframe);
11785
+ return;
11786
+ }
11787
+ this.mutationCb({
11788
+ adds: [
11789
+ {
11790
+ parentId,
11791
+ nextId: null,
11792
+ node: content
11793
+ }
11794
+ ],
11795
+ removes: [],
11796
+ texts: [],
11797
+ attributes: [],
11798
+ isAttachIframe: true
11799
+ });
11800
+ });
11801
+ }
11773
11802
  destroy() {
11774
11803
  if (this.recordCrossOriginIframes) {
11775
11804
  window.removeEventListener("message", this.messageHandler);
@@ -11780,6 +11809,7 @@ class IframeManager {
11780
11809
  this.nestedIframeListeners.clear();
11781
11810
  this.crossOriginIframeMirror.reset();
11782
11811
  this.crossOriginIframeStyleMirror.reset();
11812
+ this.attachedIframes.clear();
11783
11813
  }
11784
11814
  }
11785
11815
  class ShadowDomManager {
@@ -12855,6 +12885,9 @@ function record(options = {}) {
12855
12885
  isCheckout
12856
12886
  );
12857
12887
  mutationBuffers.forEach((buf) => buf.unlock());
12888
+ if (recordCrossOriginIframes) {
12889
+ iframeManager.reattachIframes();
12890
+ }
12858
12891
  if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
12859
12892
  stylesheetManager.adoptStyleSheets(
12860
12893
  document.adoptedStyleSheets,