@appsurify-testmap/rrweb-record 2.0.0-alpha.32 → 2.0.0-alpha.35

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.
@@ -12116,6 +12116,7 @@ try {
12116
12116
  }
12117
12117
  const mirror = createMirror$2();
12118
12118
  function record(options = {}) {
12119
+ var _a2;
12119
12120
  const {
12120
12121
  emit,
12121
12122
  checkoutEveryNms,
@@ -12150,12 +12151,24 @@ function record(options = {}) {
12150
12151
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
12151
12152
  errorHandler: errorHandler2
12152
12153
  } = options;
12154
+ const win = options.customWindow || window;
12155
+ const doc = options.customDocument || document;
12156
+ try {
12157
+ if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
12158
+ const cleanFrame = doc.createElement("iframe");
12159
+ doc.body.appendChild(cleanFrame);
12160
+ Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
12161
+ doc.body.removeChild(cleanFrame);
12162
+ }
12163
+ } catch (err) {
12164
+ console.debug("Unable to override Array.from", err);
12165
+ }
12153
12166
  registerErrorHandler(errorHandler2);
12154
- const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
12167
+ const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
12155
12168
  let passEmitsToParent = false;
12156
12169
  if (!inEmittingFrame) {
12157
12170
  try {
12158
- if (window.parent.document) {
12171
+ if (win.parent.document) {
12159
12172
  passEmitsToParent = false;
12160
12173
  }
12161
12174
  } catch (e2) {
@@ -12222,10 +12235,10 @@ function record(options = {}) {
12222
12235
  return e2;
12223
12236
  };
12224
12237
  wrappedEmit = (r2, isCheckout) => {
12225
- var _a2;
12238
+ var _a3;
12226
12239
  const e2 = r2;
12227
12240
  e2.timestamp = nowTimestamp();
12228
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12241
+ if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12229
12242
  mutationBuffers.forEach((buf) => buf.unfreeze());
12230
12243
  }
12231
12244
  if (inEmittingFrame) {
@@ -12234,10 +12247,10 @@ function record(options = {}) {
12234
12247
  const message = {
12235
12248
  type: "rrweb",
12236
12249
  event: eventProcessor(e2),
12237
- origin: window.location.origin,
12250
+ origin: win.location.origin,
12238
12251
  isCheckout
12239
12252
  };
12240
- window.parent.postMessage(message, "*");
12253
+ win.parent.postMessage(message, "*");
12241
12254
  }
12242
12255
  if (e2.type === EventType.FullSnapshot) {
12243
12256
  lastFullSnapshotEvent = e2;
@@ -12344,7 +12357,7 @@ function record(options = {}) {
12344
12357
  {
12345
12358
  type: EventType.Meta,
12346
12359
  data: {
12347
- href: window.location.href,
12360
+ href: win.location.href,
12348
12361
  width: getWindowWidth(),
12349
12362
  height: getWindowHeight()
12350
12363
  }
@@ -12402,16 +12415,16 @@ function record(options = {}) {
12402
12415
  isCheckout
12403
12416
  );
12404
12417
  mutationBuffers.forEach((buf) => buf.unlock());
12405
- if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
12418
+ if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
12406
12419
  stylesheetManager.adoptStyleSheets(
12407
- document.adoptedStyleSheets,
12408
- mirror.getId(document)
12420
+ doc.adoptedStyleSheets,
12421
+ mirror.getId(doc)
12409
12422
  );
12410
12423
  };
12411
12424
  try {
12412
12425
  const handlers = [];
12413
- const observe = (doc) => {
12414
- var _a2;
12426
+ const observe = (doc2) => {
12427
+ var _a3;
12415
12428
  return callbackWrapper(initObservers)(
12416
12429
  {
12417
12430
  mutationCb: wrappedMutationEmit,
@@ -12503,7 +12516,7 @@ function record(options = {}) {
12503
12516
  inlineImages,
12504
12517
  userTriggeredOnInput,
12505
12518
  collectFonts,
12506
- doc,
12519
+ doc: doc2,
12507
12520
  maskInputFn,
12508
12521
  maskTextFn,
12509
12522
  keepIframeSrcFn,
@@ -12517,7 +12530,7 @@ function record(options = {}) {
12517
12530
  processedNodeManager,
12518
12531
  canvasManager,
12519
12532
  ignoreCSSAttributes,
12520
- plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
12533
+ plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
12521
12534
  observer: p.observer,
12522
12535
  options: p.options,
12523
12536
  callback: (payload) => wrappedEmit({
@@ -12544,7 +12557,7 @@ function record(options = {}) {
12544
12557
  handlers.push(observe(document));
12545
12558
  recording = true;
12546
12559
  };
12547
- if (document.readyState === "interactive" || document.readyState === "complete") {
12560
+ if (doc.readyState === "interactive" || doc.readyState === "complete") {
12548
12561
  init();
12549
12562
  } else {
12550
12563
  handlers.push(