@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.
@@ -12066,6 +12066,7 @@ try {
12066
12066
  }
12067
12067
  const mirror = createMirror$2();
12068
12068
  function record(options = {}) {
12069
+ var _a2;
12069
12070
  const {
12070
12071
  emit,
12071
12072
  checkoutEveryNms,
@@ -12100,12 +12101,24 @@ function record(options = {}) {
12100
12101
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
12101
12102
  errorHandler: errorHandler2
12102
12103
  } = options;
12104
+ const win = options.customWindow || window;
12105
+ const doc = options.customDocument || document;
12106
+ try {
12107
+ if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
12108
+ const cleanFrame = doc.createElement("iframe");
12109
+ doc.body.appendChild(cleanFrame);
12110
+ Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
12111
+ doc.body.removeChild(cleanFrame);
12112
+ }
12113
+ } catch (err) {
12114
+ console.debug("Unable to override Array.from", err);
12115
+ }
12103
12116
  registerErrorHandler(errorHandler2);
12104
- const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
12117
+ const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
12105
12118
  let passEmitsToParent = false;
12106
12119
  if (!inEmittingFrame) {
12107
12120
  try {
12108
- if (window.parent.document) {
12121
+ if (win.parent.document) {
12109
12122
  passEmitsToParent = false;
12110
12123
  }
12111
12124
  } catch (e2) {
@@ -12172,10 +12185,10 @@ function record(options = {}) {
12172
12185
  return e2;
12173
12186
  };
12174
12187
  wrappedEmit = (r2, isCheckout) => {
12175
- var _a2;
12188
+ var _a3;
12176
12189
  const e2 = r2;
12177
12190
  e2.timestamp = nowTimestamp();
12178
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12191
+ if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12179
12192
  mutationBuffers.forEach((buf) => buf.unfreeze());
12180
12193
  }
12181
12194
  if (inEmittingFrame) {
@@ -12184,10 +12197,10 @@ function record(options = {}) {
12184
12197
  const message = {
12185
12198
  type: "rrweb",
12186
12199
  event: eventProcessor(e2),
12187
- origin: window.location.origin,
12200
+ origin: win.location.origin,
12188
12201
  isCheckout
12189
12202
  };
12190
- window.parent.postMessage(message, "*");
12203
+ win.parent.postMessage(message, "*");
12191
12204
  }
12192
12205
  if (e2.type === EventType.FullSnapshot) {
12193
12206
  lastFullSnapshotEvent = e2;
@@ -12298,7 +12311,7 @@ function record(options = {}) {
12298
12311
  {
12299
12312
  type: EventType.Meta,
12300
12313
  data: {
12301
- href: window.location.href,
12314
+ href: win.location.href,
12302
12315
  width: getWindowWidth(),
12303
12316
  height: getWindowHeight()
12304
12317
  }
@@ -12356,16 +12369,16 @@ function record(options = {}) {
12356
12369
  isCheckout
12357
12370
  );
12358
12371
  mutationBuffers.forEach((buf) => buf.unlock());
12359
- if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
12372
+ if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
12360
12373
  stylesheetManager.adoptStyleSheets(
12361
- document.adoptedStyleSheets,
12362
- mirror.getId(document)
12374
+ doc.adoptedStyleSheets,
12375
+ mirror.getId(doc)
12363
12376
  );
12364
12377
  };
12365
12378
  try {
12366
12379
  const handlers = [];
12367
- const observe = (doc) => {
12368
- var _a2;
12380
+ const observe = (doc2) => {
12381
+ var _a3;
12369
12382
  return callbackWrapper(initObservers)(
12370
12383
  {
12371
12384
  mutationCb: wrappedMutationEmit,
@@ -12467,7 +12480,7 @@ function record(options = {}) {
12467
12480
  inlineImages,
12468
12481
  userTriggeredOnInput,
12469
12482
  collectFonts,
12470
- doc,
12483
+ doc: doc2,
12471
12484
  maskInputFn,
12472
12485
  maskTextFn,
12473
12486
  keepIframeSrcFn,
@@ -12481,7 +12494,7 @@ function record(options = {}) {
12481
12494
  processedNodeManager,
12482
12495
  canvasManager,
12483
12496
  ignoreCSSAttributes,
12484
- plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
12497
+ plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
12485
12498
  observer: p.observer,
12486
12499
  options: p.options,
12487
12500
  callback: (payload) => wrappedEmit({
@@ -12508,7 +12521,7 @@ function record(options = {}) {
12508
12521
  handlers.push(observe(document));
12509
12522
  recording = true;
12510
12523
  };
12511
- if (document.readyState === "interactive" || document.readyState === "complete") {
12524
+ if (doc.readyState === "interactive" || doc.readyState === "complete") {
12512
12525
  init();
12513
12526
  } else {
12514
12527
  handlers.push(