@appsurify-testmap/rrweb-all 2.1.1-alpha.6 → 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.
@@ -12357,6 +12357,8 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
12357
12357
  }
12358
12358
  const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
12359
12359
  const lastInputValueMap = /* @__PURE__ */ new WeakMap();
12360
+ const FINALIZING_KEYS = ["Enter", "Tab", "Escape", "ArrowDown", "ArrowUp", "Delete"];
12361
+ const lastKeyInputValueMap = /* @__PURE__ */ new WeakMap();
12360
12362
  function initInputObserver({
12361
12363
  inputCb,
12362
12364
  doc,
@@ -12429,6 +12431,22 @@ function initInputObserver({
12429
12431
  const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12430
12432
  const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12431
12433
  if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
12434
+ console.debug(
12435
+ `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
12436
+ {
12437
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
12438
+ node: index.describeNode(el),
12439
+ tag: el.tagName,
12440
+ nodeType: el.nodeType,
12441
+ attribute: el.attributes,
12442
+ value: el.value,
12443
+ isLikelyPhantom,
12444
+ isRenderDrivenTextInput,
12445
+ isValueFromDefault,
12446
+ isPhantomCheckbox,
12447
+ isPhantomRadio
12448
+ }
12449
+ );
12432
12450
  return;
12433
12451
  }
12434
12452
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
@@ -12444,6 +12462,61 @@ function initInputObserver({
12444
12462
  const handlers = events.map(
12445
12463
  (eventName) => on(eventName, callbackWrapper(eventHandler), doc)
12446
12464
  );
12465
+ const keyboardHandler = (event) => {
12466
+ const target = getEventTarget(event);
12467
+ if (!target || !target.tagName) return;
12468
+ if (sampling.input === "all") {
12469
+ eventHandler(event);
12470
+ return;
12471
+ }
12472
+ const tag = target.tagName;
12473
+ const key = event.key;
12474
+ const isFinalizingKey = FINALIZING_KEYS.includes(key);
12475
+ const isTextarea = tag === "TEXTAREA";
12476
+ const isFocused = doc.activeElement === target;
12477
+ const valueNow = target.value;
12478
+ const valueBefore = lastKeyInputValueMap.get(target);
12479
+ lastKeyInputValueMap.set(target, valueNow);
12480
+ if (!isFocused) {
12481
+ eventHandler(event);
12482
+ return;
12483
+ }
12484
+ if (isFinalizingKey) {
12485
+ if (!isTextarea) {
12486
+ eventHandler(event);
12487
+ return;
12488
+ }
12489
+ let lastValue = valueBefore ?? "";
12490
+ let unchangedCount = 0;
12491
+ const REQUIRED_STABLE_FRAMES = 2;
12492
+ const checkFinal = () => {
12493
+ const currentValue = target.value;
12494
+ const stillFocused = doc.activeElement === target;
12495
+ const changed = currentValue !== lastValue;
12496
+ if (!stillFocused) {
12497
+ eventHandler(event);
12498
+ return;
12499
+ }
12500
+ if (!changed) {
12501
+ unchangedCount++;
12502
+ if (unchangedCount >= REQUIRED_STABLE_FRAMES) {
12503
+ eventHandler(event);
12504
+ return;
12505
+ }
12506
+ } else {
12507
+ unchangedCount = 0;
12508
+ lastValue = currentValue;
12509
+ }
12510
+ requestAnimationFrame(checkFinal);
12511
+ };
12512
+ requestAnimationFrame(checkFinal);
12513
+ return;
12514
+ }
12515
+ };
12516
+ handlers.push(
12517
+ on("keydown", callbackWrapper(keyboardHandler), doc)
12518
+ // on('keypress', callbackWrapper(keyboardHandler), doc),
12519
+ );
12447
12520
  const currentWindow = doc.defaultView;
12448
12521
  if (!currentWindow) {
12449
12522
  return () => {
@@ -14417,13 +14490,44 @@ class VisibilityManager {
14417
14490
  if (this.rafId) cancelAnimationFrame(this.rafId);
14418
14491
  }
14419
14492
  }
14493
+ const version$1 = "2.1.2-alpha.1";
14420
14494
  let wrappedEmit;
14421
14495
  let takeFullSnapshot$1;
14422
14496
  let canvasManager;
14423
14497
  let visibilityManager;
14424
14498
  let recording = false;
14425
14499
  const customEventQueue = [];
14426
- let flushCustomEventQueue;
14500
+ let flushCustomEventQueue$1;
14501
+ function waitForDOMStabilization(win) {
14502
+ const maxWaitMs = 5e3;
14503
+ return new Promise((resolve2) => {
14504
+ const captureAfterPaint = () => {
14505
+ requestAnimationFrame(() => {
14506
+ requestAnimationFrame(() => {
14507
+ resolve2();
14508
+ });
14509
+ });
14510
+ };
14511
+ const safeResolve = /* @__PURE__ */ (() => {
14512
+ let called = false;
14513
+ return () => {
14514
+ if (!called) {
14515
+ called = true;
14516
+ captureAfterPaint();
14517
+ }
14518
+ };
14519
+ })();
14520
+ if (["interactive", "complete"].includes(win.document.readyState)) {
14521
+ safeResolve();
14522
+ } else {
14523
+ win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
14524
+ win.addEventListener("load", safeResolve, { once: true });
14525
+ setTimeout(() => {
14526
+ safeResolve();
14527
+ }, maxWaitMs);
14528
+ }
14529
+ });
14530
+ }
14427
14531
  try {
14428
14532
  if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14429
14533
  const cleanFrame = document.createElement("iframe");
@@ -14763,7 +14867,7 @@ function record(options = {}) {
14763
14867
  mirror.getId(document)
14764
14868
  );
14765
14869
  };
14766
- flushCustomEventQueue = () => {
14870
+ flushCustomEventQueue$1 = () => {
14767
14871
  for (const e2 of customEventQueue) {
14768
14872
  wrappedEmit(e2);
14769
14873
  }
@@ -14906,13 +15010,30 @@ function record(options = {}) {
14906
15010
  });
14907
15011
  const init = () => {
14908
15012
  if (flushCustomEvent === "before") {
14909
- flushCustomEventQueue();
15013
+ flushCustomEventQueue$1();
15014
+ }
15015
+ takeFullSnapshot$1();
15016
+ handlers.push(observe(document));
15017
+ recording = true;
15018
+ if (flushCustomEvent === "after") {
15019
+ flushCustomEventQueue$1();
15020
+ }
15021
+ };
15022
+ const runInit = async () => {
15023
+ if (flushCustomEvent === "before") {
15024
+ flushCustomEventQueue$1();
15025
+ }
15026
+ if (recordAfter === "DOMContentStabilized") {
15027
+ console.debug(`[${nowTimestamp()}] [rrweb:record] 🟢 Waiting for DOM stabilization...`);
15028
+ await waitForDOMStabilization(window);
15029
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ DOM stabilized, starting recording`);
14910
15030
  }
15031
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ Init dom and takeFullSnapshot `);
14911
15032
  takeFullSnapshot$1();
14912
15033
  handlers.push(observe(document));
14913
15034
  recording = true;
14914
15035
  if (flushCustomEvent === "after") {
14915
- flushCustomEventQueue();
15036
+ flushCustomEventQueue$1();
14916
15037
  }
14917
15038
  };
14918
15039
  if (document.readyState === "interactive" || document.readyState === "complete") {
@@ -14942,7 +15063,7 @@ function record(options = {}) {
14942
15063
  );
14943
15064
  }
14944
15065
  return () => {
14945
- flushCustomEventQueue();
15066
+ flushCustomEventQueue$1();
14946
15067
  handlers.forEach((h) => h());
14947
15068
  processedNodeManager.destroy();
14948
15069
  recording = false;
@@ -14952,9 +15073,11 @@ function record(options = {}) {
14952
15073
  console.warn(error);
14953
15074
  }
14954
15075
  }
15076
+ record.getVersion = () => version$1;
15077
+ record.isRecording = () => recording;
14955
15078
  record.flushCustomEventQueue = () => {
14956
15079
  console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
14957
- flushCustomEventQueue();
15080
+ flushCustomEventQueue$1();
14958
15081
  };
14959
15082
  record.addCustomEvent = (tag, payload) => {
14960
15083
  const customEvent = {
@@ -17858,6 +17981,10 @@ class Replayer {
17858
17981
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
17859
17982
  }
17860
17983
  }
17984
+ const version = "2.1.2-alpha.1";
17985
+ const { getVersion } = record;
17986
+ const { isRecording } = record;
17987
+ const { flushCustomEventQueue } = record;
17861
17988
  const { addCustomEvent } = record;
17862
17989
  const { freezePage } = record;
17863
17990
  const { takeFullSnapshot } = record;
@@ -18580,10 +18707,14 @@ exports.Replayer = Replayer;
18580
18707
  exports.ReplayerEvents = ReplayerEvents;
18581
18708
  exports.addCustomEvent = addCustomEvent;
18582
18709
  exports.canvasMutation = canvasMutation;
18710
+ exports.flushCustomEventQueue = flushCustomEventQueue;
18583
18711
  exports.freezePage = freezePage;
18712
+ exports.getVersion = getVersion;
18713
+ exports.isRecording = isRecording;
18584
18714
  exports.pack = pack;
18585
18715
  exports.record = record;
18586
18716
  exports.takeFullSnapshot = takeFullSnapshot;
18587
18717
  exports.unpack = unpack;
18588
18718
  exports.utils = utils;
18719
+ exports.version = version;
18589
18720
  //# sourceMappingURL=rrweb-all.cjs.map