@appsurify-testmap/rrweb-all 2.1.1-alpha.7 → 2.1.2-alpha.1

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.
@@ -12789,6 +12789,8 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
12789
12789
  }
12790
12790
  const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
12791
12791
  const lastInputValueMap = /* @__PURE__ */ new WeakMap();
12792
+ const FINALIZING_KEYS = ["Enter", "Tab", "Escape", "ArrowDown", "ArrowUp", "Delete"];
12793
+ const lastKeyInputValueMap = /* @__PURE__ */ new WeakMap();
12792
12794
  function initInputObserver({
12793
12795
  inputCb,
12794
12796
  doc,
@@ -12861,6 +12863,22 @@ function initInputObserver({
12861
12863
  const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12862
12864
  const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12863
12865
  if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
12866
+ console.debug(
12867
+ `[${nowTimestamp()}] [rrweb:record/observer] \u26D4 phantom input ignored`,
12868
+ {
12869
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
12870
+ node: index.describeNode(el),
12871
+ tag: el.tagName,
12872
+ nodeType: el.nodeType,
12873
+ attribute: el.attributes,
12874
+ value: el.value,
12875
+ isLikelyPhantom,
12876
+ isRenderDrivenTextInput,
12877
+ isValueFromDefault,
12878
+ isPhantomCheckbox,
12879
+ isPhantomRadio
12880
+ }
12881
+ );
12864
12882
  return;
12865
12883
  }
12866
12884
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
@@ -12875,6 +12893,62 @@ function initInputObserver({
12875
12893
  const handlers = events.map(
12876
12894
  (eventName) => on(eventName, callbackWrapper(eventHandler), doc)
12877
12895
  );
12896
+ const keyboardHandler = (event) => {
12897
+ const target = getEventTarget(event);
12898
+ if (!target || !target.tagName)
12899
+ return;
12900
+ if (sampling.input === "all") {
12901
+ eventHandler(event);
12902
+ return;
12903
+ }
12904
+ const tag = target.tagName;
12905
+ const key = event.key;
12906
+ const isFinalizingKey = FINALIZING_KEYS.includes(key);
12907
+ const isTextarea = tag === "TEXTAREA";
12908
+ const isFocused = doc.activeElement === target;
12909
+ const valueNow = target.value;
12910
+ const valueBefore = lastKeyInputValueMap.get(target);
12911
+ lastKeyInputValueMap.set(target, valueNow);
12912
+ if (!isFocused) {
12913
+ eventHandler(event);
12914
+ return;
12915
+ }
12916
+ if (isFinalizingKey) {
12917
+ if (!isTextarea) {
12918
+ eventHandler(event);
12919
+ return;
12920
+ }
12921
+ let lastValue = valueBefore != null ? valueBefore : "";
12922
+ let unchangedCount = 0;
12923
+ const REQUIRED_STABLE_FRAMES = 2;
12924
+ const checkFinal = () => {
12925
+ const currentValue = target.value;
12926
+ const stillFocused = doc.activeElement === target;
12927
+ const changed = currentValue !== lastValue;
12928
+ if (!stillFocused) {
12929
+ eventHandler(event);
12930
+ return;
12931
+ }
12932
+ if (!changed) {
12933
+ unchangedCount++;
12934
+ if (unchangedCount >= REQUIRED_STABLE_FRAMES) {
12935
+ eventHandler(event);
12936
+ return;
12937
+ }
12938
+ } else {
12939
+ unchangedCount = 0;
12940
+ lastValue = currentValue;
12941
+ }
12942
+ requestAnimationFrame(checkFinal);
12943
+ };
12944
+ requestAnimationFrame(checkFinal);
12945
+ return;
12946
+ }
12947
+ };
12948
+ handlers.push(
12949
+ on("keydown", callbackWrapper(keyboardHandler), doc)
12950
+ // on('keypress', callbackWrapper(keyboardHandler), doc),
12951
+ );
12878
12952
  const currentWindow = doc.defaultView;
12879
12953
  if (!currentWindow) {
12880
12954
  return () => {
@@ -14882,13 +14956,14 @@ class VisibilityManager {
14882
14956
  cancelAnimationFrame(this.rafId);
14883
14957
  }
14884
14958
  }
14959
+ const version$1 = "2.1.2-alpha.1";
14885
14960
  let wrappedEmit;
14886
14961
  let takeFullSnapshot$1;
14887
14962
  let canvasManager;
14888
14963
  let visibilityManager;
14889
14964
  let recording = false;
14890
14965
  const customEventQueue = [];
14891
- let flushCustomEventQueue;
14966
+ let flushCustomEventQueue$1;
14892
14967
  function waitForDOMStabilization(win) {
14893
14968
  const maxWaitMs = 5e3;
14894
14969
  return new Promise((resolve2) => {
@@ -15253,7 +15328,7 @@ function record(options = {}) {
15253
15328
  mirror.getId(document)
15254
15329
  );
15255
15330
  };
15256
- flushCustomEventQueue = () => {
15331
+ flushCustomEventQueue$1 = () => {
15257
15332
  for (const e2 of customEventQueue) {
15258
15333
  wrappedEmit(e2);
15259
15334
  }
@@ -15387,37 +15462,34 @@ function record(options = {}) {
15387
15462
  });
15388
15463
  const init = () => {
15389
15464
  if (flushCustomEvent === "before") {
15390
- flushCustomEventQueue();
15465
+ flushCustomEventQueue$1();
15391
15466
  }
15392
15467
  takeFullSnapshot$1();
15393
15468
  handlers.push(observe(document));
15394
15469
  recording = true;
15395
15470
  if (flushCustomEvent === "after") {
15396
- flushCustomEventQueue();
15471
+ flushCustomEventQueue$1();
15397
15472
  }
15398
15473
  };
15399
15474
  const runInit = async () => {
15400
15475
  if (flushCustomEvent === "before") {
15401
- flushCustomEventQueue();
15476
+ flushCustomEventQueue$1();
15402
15477
  }
15403
15478
  if (recordAfter === "DOMContentStabilized") {
15404
- console.log(`[rrweb] \u{1F7E2} Waiting for DOM stabilization...`);
15479
+ console.debug(`[${nowTimestamp()}] [rrweb:record] \u{1F7E2} Waiting for DOM stabilization...`);
15405
15480
  await waitForDOMStabilization(window);
15406
- console.log(`[rrweb] \u2705 DOM stabilized, starting recording`);
15481
+ console.debug(`[${nowTimestamp()}] [rrweb:record] \u2705 DOM stabilized, starting recording`);
15407
15482
  }
15483
+ console.debug(`[${nowTimestamp()}] [rrweb:record] \u2705 Init dom and takeFullSnapshot `);
15408
15484
  takeFullSnapshot$1();
15409
15485
  handlers.push(observe(document));
15410
15486
  recording = true;
15411
15487
  if (flushCustomEvent === "after") {
15412
- flushCustomEventQueue();
15488
+ flushCustomEventQueue$1();
15413
15489
  }
15414
15490
  };
15415
15491
  if (document.readyState === "interactive" || document.readyState === "complete") {
15416
- if (recordAfter === "DOMContentStabilized") {
15417
- void runInit();
15418
- } else {
15419
- init();
15420
- }
15492
+ init();
15421
15493
  } else {
15422
15494
  handlers.push(
15423
15495
  on("DOMContentLoaded", () => {
@@ -15425,9 +15497,8 @@ function record(options = {}) {
15425
15497
  type: EventType.DomContentLoaded,
15426
15498
  data: {}
15427
15499
  });
15428
- if (recordAfter === "DOMContentLoaded" || recordAfter === "DOMContentStabilized") {
15429
- void runInit();
15430
- }
15500
+ if (recordAfter === "DOMContentLoaded")
15501
+ init();
15431
15502
  })
15432
15503
  );
15433
15504
  handlers.push(
@@ -15439,14 +15510,14 @@ function record(options = {}) {
15439
15510
  data: {}
15440
15511
  });
15441
15512
  if (recordAfter === "load")
15442
- void runInit();
15513
+ init();
15443
15514
  },
15444
15515
  window
15445
15516
  )
15446
15517
  );
15447
15518
  }
15448
15519
  return () => {
15449
- flushCustomEventQueue();
15520
+ flushCustomEventQueue$1();
15450
15521
  handlers.forEach((h) => h());
15451
15522
  processedNodeManager.destroy();
15452
15523
  recording = false;
@@ -15456,10 +15527,11 @@ function record(options = {}) {
15456
15527
  console.warn(error);
15457
15528
  }
15458
15529
  }
15530
+ record.getVersion = () => version$1;
15459
15531
  record.isRecording = () => recording;
15460
15532
  record.flushCustomEventQueue = () => {
15461
15533
  console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
15462
- flushCustomEventQueue();
15534
+ flushCustomEventQueue$1();
15463
15535
  };
15464
15536
  record.addCustomEvent = (tag, payload) => {
15465
15537
  const customEvent = {
@@ -18402,6 +18474,10 @@ class Replayer {
18402
18474
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
18403
18475
  }
18404
18476
  }
18477
+ const version = "2.1.2-alpha.1";
18478
+ const { getVersion } = record;
18479
+ const { isRecording } = record;
18480
+ const { flushCustomEventQueue } = record;
18405
18481
  const { addCustomEvent } = record;
18406
18482
  const { freezePage } = record;
18407
18483
  const { takeFullSnapshot } = record;
@@ -19131,12 +19207,16 @@ exports.Replayer = Replayer;
19131
19207
  exports.ReplayerEvents = ReplayerEvents;
19132
19208
  exports.addCustomEvent = addCustomEvent;
19133
19209
  exports.canvasMutation = canvasMutation;
19210
+ exports.flushCustomEventQueue = flushCustomEventQueue;
19134
19211
  exports.freezePage = freezePage;
19212
+ exports.getVersion = getVersion;
19213
+ exports.isRecording = isRecording;
19135
19214
  exports.pack = pack;
19136
19215
  exports.record = record;
19137
19216
  exports.takeFullSnapshot = takeFullSnapshot;
19138
19217
  exports.unpack = unpack;
19139
19218
  exports.utils = utils;
19219
+ exports.version = version;
19140
19220
  if (typeof module.exports == "object" && typeof exports == "object") {
19141
19221
  var __cp = (to, from, except, desc) => {
19142
19222
  if ((from && typeof from === "object") || typeof from === "function") {