@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.
@@ -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,14 @@ 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;
14427
14501
  function waitForDOMStabilization(win) {
14428
14502
  const maxWaitMs = 5e3;
14429
14503
  return new Promise((resolve2) => {
@@ -14793,7 +14867,7 @@ function record(options = {}) {
14793
14867
  mirror.getId(document)
14794
14868
  );
14795
14869
  };
14796
- flushCustomEventQueue = () => {
14870
+ flushCustomEventQueue$1 = () => {
14797
14871
  for (const e2 of customEventQueue) {
14798
14872
  wrappedEmit(e2);
14799
14873
  }
@@ -14936,37 +15010,34 @@ function record(options = {}) {
14936
15010
  });
14937
15011
  const init = () => {
14938
15012
  if (flushCustomEvent === "before") {
14939
- flushCustomEventQueue();
15013
+ flushCustomEventQueue$1();
14940
15014
  }
14941
15015
  takeFullSnapshot$1();
14942
15016
  handlers.push(observe(document));
14943
15017
  recording = true;
14944
15018
  if (flushCustomEvent === "after") {
14945
- flushCustomEventQueue();
15019
+ flushCustomEventQueue$1();
14946
15020
  }
14947
15021
  };
14948
15022
  const runInit = async () => {
14949
15023
  if (flushCustomEvent === "before") {
14950
- flushCustomEventQueue();
15024
+ flushCustomEventQueue$1();
14951
15025
  }
14952
15026
  if (recordAfter === "DOMContentStabilized") {
14953
- console.log(`[rrweb] 🟢 Waiting for DOM stabilization...`);
15027
+ console.debug(`[${nowTimestamp()}] [rrweb:record] 🟢 Waiting for DOM stabilization...`);
14954
15028
  await waitForDOMStabilization(window);
14955
- console.log(`[rrweb] ✅ DOM stabilized, starting recording`);
15029
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ DOM stabilized, starting recording`);
14956
15030
  }
15031
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ Init dom and takeFullSnapshot `);
14957
15032
  takeFullSnapshot$1();
14958
15033
  handlers.push(observe(document));
14959
15034
  recording = true;
14960
15035
  if (flushCustomEvent === "after") {
14961
- flushCustomEventQueue();
15036
+ flushCustomEventQueue$1();
14962
15037
  }
14963
15038
  };
14964
15039
  if (document.readyState === "interactive" || document.readyState === "complete") {
14965
- if (recordAfter === "DOMContentStabilized") {
14966
- void runInit();
14967
- } else {
14968
- init();
14969
- }
15040
+ init();
14970
15041
  } else {
14971
15042
  handlers.push(
14972
15043
  on("DOMContentLoaded", () => {
@@ -14974,9 +15045,7 @@ function record(options = {}) {
14974
15045
  type: EventType.DomContentLoaded,
14975
15046
  data: {}
14976
15047
  });
14977
- if (recordAfter === "DOMContentLoaded" || recordAfter === "DOMContentStabilized") {
14978
- void runInit();
14979
- }
15048
+ if (recordAfter === "DOMContentLoaded") init();
14980
15049
  })
14981
15050
  );
14982
15051
  handlers.push(
@@ -14987,14 +15056,14 @@ function record(options = {}) {
14987
15056
  type: EventType.Load,
14988
15057
  data: {}
14989
15058
  });
14990
- if (recordAfter === "load") void runInit();
15059
+ if (recordAfter === "load") init();
14991
15060
  },
14992
15061
  window
14993
15062
  )
14994
15063
  );
14995
15064
  }
14996
15065
  return () => {
14997
- flushCustomEventQueue();
15066
+ flushCustomEventQueue$1();
14998
15067
  handlers.forEach((h) => h());
14999
15068
  processedNodeManager.destroy();
15000
15069
  recording = false;
@@ -15004,10 +15073,11 @@ function record(options = {}) {
15004
15073
  console.warn(error);
15005
15074
  }
15006
15075
  }
15076
+ record.getVersion = () => version$1;
15007
15077
  record.isRecording = () => recording;
15008
15078
  record.flushCustomEventQueue = () => {
15009
15079
  console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
15010
- flushCustomEventQueue();
15080
+ flushCustomEventQueue$1();
15011
15081
  };
15012
15082
  record.addCustomEvent = (tag, payload) => {
15013
15083
  const customEvent = {
@@ -17911,6 +17981,10 @@ class Replayer {
17911
17981
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
17912
17982
  }
17913
17983
  }
17984
+ const version = "2.1.2-alpha.1";
17985
+ const { getVersion } = record;
17986
+ const { isRecording } = record;
17987
+ const { flushCustomEventQueue } = record;
17914
17988
  const { addCustomEvent } = record;
17915
17989
  const { freezePage } = record;
17916
17990
  const { takeFullSnapshot } = record;
@@ -18633,10 +18707,14 @@ exports.Replayer = Replayer;
18633
18707
  exports.ReplayerEvents = ReplayerEvents;
18634
18708
  exports.addCustomEvent = addCustomEvent;
18635
18709
  exports.canvasMutation = canvasMutation;
18710
+ exports.flushCustomEventQueue = flushCustomEventQueue;
18636
18711
  exports.freezePage = freezePage;
18712
+ exports.getVersion = getVersion;
18713
+ exports.isRecording = isRecording;
18637
18714
  exports.pack = pack;
18638
18715
  exports.record = record;
18639
18716
  exports.takeFullSnapshot = takeFullSnapshot;
18640
18717
  exports.unpack = unpack;
18641
18718
  exports.utils = utils;
18719
+ exports.version = version;
18642
18720
  //# sourceMappingURL=rrweb-all.cjs.map