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