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