@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.
@@ -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,