@appsurify-testmap/rrweb 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.
@@ -13993,6 +13993,7 @@ try {
13993
13993
  }
13994
13994
  const mirror = createMirror$2();
13995
13995
  function record(options = {}) {
13996
+ var _a2;
13996
13997
  const {
13997
13998
  emit,
13998
13999
  checkoutEveryNms,
@@ -14027,12 +14028,24 @@ function record(options = {}) {
14027
14028
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
14028
14029
  errorHandler: errorHandler2
14029
14030
  } = options;
14031
+ const win = options.customWindow || window;
14032
+ const doc = options.customDocument || document;
14033
+ try {
14034
+ if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14035
+ const cleanFrame = doc.createElement("iframe");
14036
+ doc.body.appendChild(cleanFrame);
14037
+ Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
14038
+ doc.body.removeChild(cleanFrame);
14039
+ }
14040
+ } catch (err) {
14041
+ console.debug("Unable to override Array.from", err);
14042
+ }
14030
14043
  registerErrorHandler(errorHandler2);
14031
- const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14044
+ const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14032
14045
  let passEmitsToParent = false;
14033
14046
  if (!inEmittingFrame) {
14034
14047
  try {
14035
- if (window.parent.document) {
14048
+ if (win.parent.document) {
14036
14049
  passEmitsToParent = false;
14037
14050
  }
14038
14051
  } catch (e2) {
@@ -14099,10 +14112,10 @@ function record(options = {}) {
14099
14112
  return e2;
14100
14113
  };
14101
14114
  wrappedEmit = (r2, isCheckout) => {
14102
- var _a2;
14115
+ var _a3;
14103
14116
  const e2 = r2;
14104
14117
  e2.timestamp = nowTimestamp();
14105
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14118
+ if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14106
14119
  mutationBuffers.forEach((buf) => buf.unfreeze());
14107
14120
  }
14108
14121
  if (inEmittingFrame) {
@@ -14111,10 +14124,10 @@ function record(options = {}) {
14111
14124
  const message = {
14112
14125
  type: "rrweb",
14113
14126
  event: eventProcessor(e2),
14114
- origin: window.location.origin,
14127
+ origin: win.location.origin,
14115
14128
  isCheckout
14116
14129
  };
14117
- window.parent.postMessage(message, "*");
14130
+ win.parent.postMessage(message, "*");
14118
14131
  }
14119
14132
  if (e2.type === EventType.FullSnapshot) {
14120
14133
  lastFullSnapshotEvent = e2;
@@ -14221,7 +14234,7 @@ function record(options = {}) {
14221
14234
  {
14222
14235
  type: EventType.Meta,
14223
14236
  data: {
14224
- href: window.location.href,
14237
+ href: win.location.href,
14225
14238
  width: getWindowWidth(),
14226
14239
  height: getWindowHeight()
14227
14240
  }
@@ -14279,16 +14292,16 @@ function record(options = {}) {
14279
14292
  isCheckout
14280
14293
  );
14281
14294
  mutationBuffers.forEach((buf) => buf.unlock());
14282
- if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14295
+ if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14283
14296
  stylesheetManager.adoptStyleSheets(
14284
- document.adoptedStyleSheets,
14285
- mirror.getId(document)
14297
+ doc.adoptedStyleSheets,
14298
+ mirror.getId(doc)
14286
14299
  );
14287
14300
  };
14288
14301
  try {
14289
14302
  const handlers = [];
14290
- const observe = (doc) => {
14291
- var _a2;
14303
+ const observe = (doc2) => {
14304
+ var _a3;
14292
14305
  return callbackWrapper(initObservers)(
14293
14306
  {
14294
14307
  mutationCb: wrappedMutationEmit,
@@ -14380,7 +14393,7 @@ function record(options = {}) {
14380
14393
  inlineImages,
14381
14394
  userTriggeredOnInput,
14382
14395
  collectFonts,
14383
- doc,
14396
+ doc: doc2,
14384
14397
  maskInputFn,
14385
14398
  maskTextFn,
14386
14399
  keepIframeSrcFn,
@@ -14394,7 +14407,7 @@ function record(options = {}) {
14394
14407
  processedNodeManager,
14395
14408
  canvasManager,
14396
14409
  ignoreCSSAttributes,
14397
- plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14410
+ plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14398
14411
  observer: p.observer,
14399
14412
  options: p.options,
14400
14413
  callback: (payload) => wrappedEmit({
@@ -14421,7 +14434,7 @@ function record(options = {}) {
14421
14434
  handlers.push(observe(document));
14422
14435
  recording = true;
14423
14436
  };
14424
- if (document.readyState === "interactive" || document.readyState === "complete") {
14437
+ if (doc.readyState === "interactive" || doc.readyState === "complete") {
14425
14438
  init();
14426
14439
  } else {
14427
14440
  handlers.push(