@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.
package/dist/rrweb.d.cts CHANGED
@@ -255,6 +255,8 @@ export declare type recordOptions<T> = {
255
255
  mousemoveWait?: number;
256
256
  keepIframeSrcFn?: KeepIframeSrcFn;
257
257
  errorHandler?: ErrorHandler;
258
+ customWindow?: Window;
259
+ customDocument?: Document;
258
260
  };
259
261
 
260
262
  export declare class Replayer {
package/dist/rrweb.d.ts CHANGED
@@ -255,6 +255,8 @@ export declare type recordOptions<T> = {
255
255
  mousemoveWait?: number;
256
256
  keepIframeSrcFn?: KeepIframeSrcFn;
257
257
  errorHandler?: ErrorHandler;
258
+ customWindow?: Window;
259
+ customDocument?: Document;
258
260
  };
259
261
 
260
262
  export declare class Replayer {
package/dist/rrweb.js CHANGED
@@ -13961,6 +13961,7 @@ try {
13961
13961
  }
13962
13962
  const mirror = createMirror$2();
13963
13963
  function record(options = {}) {
13964
+ var _a2;
13964
13965
  const {
13965
13966
  emit,
13966
13967
  checkoutEveryNms,
@@ -13995,12 +13996,24 @@ function record(options = {}) {
13995
13996
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
13996
13997
  errorHandler: errorHandler2
13997
13998
  } = options;
13999
+ const win = options.customWindow || window;
14000
+ const doc = options.customDocument || document;
14001
+ try {
14002
+ if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14003
+ const cleanFrame = doc.createElement("iframe");
14004
+ doc.body.appendChild(cleanFrame);
14005
+ Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
14006
+ doc.body.removeChild(cleanFrame);
14007
+ }
14008
+ } catch (err) {
14009
+ console.debug("Unable to override Array.from", err);
14010
+ }
13998
14011
  registerErrorHandler(errorHandler2);
13999
- const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14012
+ const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14000
14013
  let passEmitsToParent = false;
14001
14014
  if (!inEmittingFrame) {
14002
14015
  try {
14003
- if (window.parent.document) {
14016
+ if (win.parent.document) {
14004
14017
  passEmitsToParent = false;
14005
14018
  }
14006
14019
  } catch (e2) {
@@ -14067,10 +14080,10 @@ function record(options = {}) {
14067
14080
  return e2;
14068
14081
  };
14069
14082
  wrappedEmit = (r2, isCheckout) => {
14070
- var _a2;
14083
+ var _a3;
14071
14084
  const e2 = r2;
14072
14085
  e2.timestamp = nowTimestamp();
14073
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14086
+ if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14074
14087
  mutationBuffers.forEach((buf) => buf.unfreeze());
14075
14088
  }
14076
14089
  if (inEmittingFrame) {
@@ -14079,10 +14092,10 @@ function record(options = {}) {
14079
14092
  const message = {
14080
14093
  type: "rrweb",
14081
14094
  event: eventProcessor(e2),
14082
- origin: window.location.origin,
14095
+ origin: win.location.origin,
14083
14096
  isCheckout
14084
14097
  };
14085
- window.parent.postMessage(message, "*");
14098
+ win.parent.postMessage(message, "*");
14086
14099
  }
14087
14100
  if (e2.type === EventType.FullSnapshot) {
14088
14101
  lastFullSnapshotEvent = e2;
@@ -14193,7 +14206,7 @@ function record(options = {}) {
14193
14206
  {
14194
14207
  type: EventType.Meta,
14195
14208
  data: {
14196
- href: window.location.href,
14209
+ href: win.location.href,
14197
14210
  width: getWindowWidth(),
14198
14211
  height: getWindowHeight()
14199
14212
  }
@@ -14251,16 +14264,16 @@ function record(options = {}) {
14251
14264
  isCheckout
14252
14265
  );
14253
14266
  mutationBuffers.forEach((buf) => buf.unlock());
14254
- if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14267
+ if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14255
14268
  stylesheetManager.adoptStyleSheets(
14256
- document.adoptedStyleSheets,
14257
- mirror.getId(document)
14269
+ doc.adoptedStyleSheets,
14270
+ mirror.getId(doc)
14258
14271
  );
14259
14272
  };
14260
14273
  try {
14261
14274
  const handlers = [];
14262
- const observe = (doc) => {
14263
- var _a2;
14275
+ const observe = (doc2) => {
14276
+ var _a3;
14264
14277
  return callbackWrapper(initObservers)(
14265
14278
  {
14266
14279
  mutationCb: wrappedMutationEmit,
@@ -14362,7 +14375,7 @@ function record(options = {}) {
14362
14375
  inlineImages,
14363
14376
  userTriggeredOnInput,
14364
14377
  collectFonts,
14365
- doc,
14378
+ doc: doc2,
14366
14379
  maskInputFn,
14367
14380
  maskTextFn,
14368
14381
  keepIframeSrcFn,
@@ -14376,7 +14389,7 @@ function record(options = {}) {
14376
14389
  processedNodeManager,
14377
14390
  canvasManager,
14378
14391
  ignoreCSSAttributes,
14379
- plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14392
+ plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14380
14393
  observer: p.observer,
14381
14394
  options: p.options,
14382
14395
  callback: (payload) => wrappedEmit({
@@ -14403,7 +14416,7 @@ function record(options = {}) {
14403
14416
  handlers.push(observe(document));
14404
14417
  recording = true;
14405
14418
  };
14406
- if (document.readyState === "interactive" || document.readyState === "complete") {
14419
+ if (doc.readyState === "interactive" || doc.readyState === "complete") {
14407
14420
  init();
14408
14421
  } else {
14409
14422
  handlers.push(