@posthog/rrweb-record 0.0.32 → 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.
@@ -11501,6 +11501,7 @@ class IframeManager {
11501
11501
  __publicField(this, "recordCrossOriginIframes");
11502
11502
  __publicField(this, "messageHandler");
11503
11503
  __publicField(this, "nestedIframeListeners", /* @__PURE__ */ new Map());
11504
+ __publicField(this, "attachedIframes", /* @__PURE__ */ new Map());
11504
11505
  this.mutationCb = options.mutationCb;
11505
11506
  this.wrappedEmit = options.wrappedEmit;
11506
11507
  this.stylesheetManager = options.stylesheetManager;
@@ -11529,6 +11530,7 @@ class IframeManager {
11529
11530
  }
11530
11531
  attachIframe(iframeEl, childSn) {
11531
11532
  var _a2;
11533
+ this.attachedIframes.set(iframeEl, childSn);
11532
11534
  this.mutationCb({
11533
11535
  adds: [
11534
11536
  {
@@ -11584,6 +11586,7 @@ class IframeManager {
11584
11586
  const rootId = e2.data.node.id;
11585
11587
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
11586
11588
  this.patchRootIdOnNode(e2.data.node, rootId);
11589
+ this.attachedIframes.set(iframeEl, e2.data.node);
11587
11590
  return {
11588
11591
  timestamp: e2.timestamp,
11589
11592
  type: EventType.IncrementalSnapshot,
@@ -11726,6 +11729,32 @@ class IframeManager {
11726
11729
  });
11727
11730
  }
11728
11731
  }
11732
+ reattachIframes() {
11733
+ this.attachedIframes.forEach((content, iframe) => {
11734
+ if (!iframe.isConnected) {
11735
+ this.attachedIframes.delete(iframe);
11736
+ return;
11737
+ }
11738
+ const parentId = this.mirror.getId(iframe);
11739
+ if (parentId === -1) {
11740
+ this.attachedIframes.delete(iframe);
11741
+ return;
11742
+ }
11743
+ this.mutationCb({
11744
+ adds: [
11745
+ {
11746
+ parentId,
11747
+ nextId: null,
11748
+ node: content
11749
+ }
11750
+ ],
11751
+ removes: [],
11752
+ texts: [],
11753
+ attributes: [],
11754
+ isAttachIframe: true
11755
+ });
11756
+ });
11757
+ }
11729
11758
  destroy() {
11730
11759
  if (this.recordCrossOriginIframes) {
11731
11760
  window.removeEventListener("message", this.messageHandler);
@@ -11736,6 +11765,7 @@ class IframeManager {
11736
11765
  this.nestedIframeListeners.clear();
11737
11766
  this.crossOriginIframeMirror.reset();
11738
11767
  this.crossOriginIframeStyleMirror.reset();
11768
+ this.attachedIframes.clear();
11739
11769
  }
11740
11770
  }
11741
11771
  class ShadowDomManager {
@@ -12818,6 +12848,9 @@ function record(options = {}) {
12818
12848
  isCheckout
12819
12849
  );
12820
12850
  mutationBuffers.forEach((buf) => buf.unlock());
12851
+ if (recordCrossOriginIframes) {
12852
+ iframeManager.reattachIframes();
12853
+ }
12821
12854
  if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
12822
12855
  stylesheetManager.adoptStyleSheets(
12823
12856
  document.adoptedStyleSheets,