@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.
package/dist/rrweb-all.js CHANGED
@@ -12355,6 +12355,8 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
12355
12355
  }
12356
12356
  const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
12357
12357
  const lastInputValueMap = /* @__PURE__ */ new WeakMap();
12358
+ const FINALIZING_KEYS = ["Enter", "Tab", "Escape", "ArrowDown", "ArrowUp", "Delete"];
12359
+ const lastKeyInputValueMap = /* @__PURE__ */ new WeakMap();
12358
12360
  function initInputObserver({
12359
12361
  inputCb,
12360
12362
  doc,
@@ -12427,6 +12429,22 @@ function initInputObserver({
12427
12429
  const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12428
12430
  const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12429
12431
  if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
12432
+ console.debug(
12433
+ `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
12434
+ {
12435
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
12436
+ node: index.describeNode(el),
12437
+ tag: el.tagName,
12438
+ nodeType: el.nodeType,
12439
+ attribute: el.attributes,
12440
+ value: el.value,
12441
+ isLikelyPhantom,
12442
+ isRenderDrivenTextInput,
12443
+ isValueFromDefault,
12444
+ isPhantomCheckbox,
12445
+ isPhantomRadio
12446
+ }
12447
+ );
12430
12448
  return;
12431
12449
  }
12432
12450
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
@@ -12442,6 +12460,61 @@ function initInputObserver({
12442
12460
  const handlers = events.map(
12443
12461
  (eventName) => on(eventName, callbackWrapper(eventHandler), doc)
12444
12462
  );
12463
+ const keyboardHandler = (event) => {
12464
+ const target = getEventTarget(event);
12465
+ if (!target || !target.tagName) return;
12466
+ if (sampling.input === "all") {
12467
+ eventHandler(event);
12468
+ return;
12469
+ }
12470
+ const tag = target.tagName;
12471
+ const key = event.key;
12472
+ const isFinalizingKey = FINALIZING_KEYS.includes(key);
12473
+ const isTextarea = tag === "TEXTAREA";
12474
+ const isFocused = doc.activeElement === target;
12475
+ const valueNow = target.value;
12476
+ const valueBefore = lastKeyInputValueMap.get(target);
12477
+ lastKeyInputValueMap.set(target, valueNow);
12478
+ if (!isFocused) {
12479
+ eventHandler(event);
12480
+ return;
12481
+ }
12482
+ if (isFinalizingKey) {
12483
+ if (!isTextarea) {
12484
+ eventHandler(event);
12485
+ return;
12486
+ }
12487
+ let lastValue = valueBefore ?? "";
12488
+ let unchangedCount = 0;
12489
+ const REQUIRED_STABLE_FRAMES = 2;
12490
+ const checkFinal = () => {
12491
+ const currentValue = target.value;
12492
+ const stillFocused = doc.activeElement === target;
12493
+ const changed = currentValue !== lastValue;
12494
+ if (!stillFocused) {
12495
+ eventHandler(event);
12496
+ return;
12497
+ }
12498
+ if (!changed) {
12499
+ unchangedCount++;
12500
+ if (unchangedCount >= REQUIRED_STABLE_FRAMES) {
12501
+ eventHandler(event);
12502
+ return;
12503
+ }
12504
+ } else {
12505
+ unchangedCount = 0;
12506
+ lastValue = currentValue;
12507
+ }
12508
+ requestAnimationFrame(checkFinal);
12509
+ };
12510
+ requestAnimationFrame(checkFinal);
12511
+ return;
12512
+ }
12513
+ };
12514
+ handlers.push(
12515
+ on("keydown", callbackWrapper(keyboardHandler), doc)
12516
+ // on('keypress', callbackWrapper(keyboardHandler), doc),
12517
+ );
12445
12518
  const currentWindow = doc.defaultView;
12446
12519
  if (!currentWindow) {
12447
12520
  return () => {
@@ -14415,13 +14488,14 @@ class VisibilityManager {
14415
14488
  if (this.rafId) cancelAnimationFrame(this.rafId);
14416
14489
  }
14417
14490
  }
14491
+ const version$1 = "2.1.2-alpha.1";
14418
14492
  let wrappedEmit;
14419
14493
  let takeFullSnapshot$1;
14420
14494
  let canvasManager;
14421
14495
  let visibilityManager;
14422
14496
  let recording = false;
14423
14497
  const customEventQueue = [];
14424
- let flushCustomEventQueue;
14498
+ let flushCustomEventQueue$1;
14425
14499
  function waitForDOMStabilization(win) {
14426
14500
  const maxWaitMs = 5e3;
14427
14501
  return new Promise((resolve2) => {
@@ -14791,7 +14865,7 @@ function record(options = {}) {
14791
14865
  mirror.getId(document)
14792
14866
  );
14793
14867
  };
14794
- flushCustomEventQueue = () => {
14868
+ flushCustomEventQueue$1 = () => {
14795
14869
  for (const e2 of customEventQueue) {
14796
14870
  wrappedEmit(e2);
14797
14871
  }
@@ -14934,37 +15008,34 @@ function record(options = {}) {
14934
15008
  });
14935
15009
  const init = () => {
14936
15010
  if (flushCustomEvent === "before") {
14937
- flushCustomEventQueue();
15011
+ flushCustomEventQueue$1();
14938
15012
  }
14939
15013
  takeFullSnapshot$1();
14940
15014
  handlers.push(observe(document));
14941
15015
  recording = true;
14942
15016
  if (flushCustomEvent === "after") {
14943
- flushCustomEventQueue();
15017
+ flushCustomEventQueue$1();
14944
15018
  }
14945
15019
  };
14946
15020
  const runInit = async () => {
14947
15021
  if (flushCustomEvent === "before") {
14948
- flushCustomEventQueue();
15022
+ flushCustomEventQueue$1();
14949
15023
  }
14950
15024
  if (recordAfter === "DOMContentStabilized") {
14951
- console.log(`[rrweb] 🟢 Waiting for DOM stabilization...`);
15025
+ console.debug(`[${nowTimestamp()}] [rrweb:record] 🟢 Waiting for DOM stabilization...`);
14952
15026
  await waitForDOMStabilization(window);
14953
- console.log(`[rrweb] ✅ DOM stabilized, starting recording`);
15027
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ DOM stabilized, starting recording`);
14954
15028
  }
15029
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ Init dom and takeFullSnapshot `);
14955
15030
  takeFullSnapshot$1();
14956
15031
  handlers.push(observe(document));
14957
15032
  recording = true;
14958
15033
  if (flushCustomEvent === "after") {
14959
- flushCustomEventQueue();
15034
+ flushCustomEventQueue$1();
14960
15035
  }
14961
15036
  };
14962
15037
  if (document.readyState === "interactive" || document.readyState === "complete") {
14963
- if (recordAfter === "DOMContentStabilized") {
14964
- void runInit();
14965
- } else {
14966
- init();
14967
- }
15038
+ init();
14968
15039
  } else {
14969
15040
  handlers.push(
14970
15041
  on("DOMContentLoaded", () => {
@@ -14972,9 +15043,7 @@ function record(options = {}) {
14972
15043
  type: EventType.DomContentLoaded,
14973
15044
  data: {}
14974
15045
  });
14975
- if (recordAfter === "DOMContentLoaded" || recordAfter === "DOMContentStabilized") {
14976
- void runInit();
14977
- }
15046
+ if (recordAfter === "DOMContentLoaded") init();
14978
15047
  })
14979
15048
  );
14980
15049
  handlers.push(
@@ -14985,14 +15054,14 @@ function record(options = {}) {
14985
15054
  type: EventType.Load,
14986
15055
  data: {}
14987
15056
  });
14988
- if (recordAfter === "load") void runInit();
15057
+ if (recordAfter === "load") init();
14989
15058
  },
14990
15059
  window
14991
15060
  )
14992
15061
  );
14993
15062
  }
14994
15063
  return () => {
14995
- flushCustomEventQueue();
15064
+ flushCustomEventQueue$1();
14996
15065
  handlers.forEach((h) => h());
14997
15066
  processedNodeManager.destroy();
14998
15067
  recording = false;
@@ -15002,10 +15071,11 @@ function record(options = {}) {
15002
15071
  console.warn(error);
15003
15072
  }
15004
15073
  }
15074
+ record.getVersion = () => version$1;
15005
15075
  record.isRecording = () => recording;
15006
15076
  record.flushCustomEventQueue = () => {
15007
15077
  console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
15008
- flushCustomEventQueue();
15078
+ flushCustomEventQueue$1();
15009
15079
  };
15010
15080
  record.addCustomEvent = (tag, payload) => {
15011
15081
  const customEvent = {
@@ -17909,6 +17979,10 @@ class Replayer {
17909
17979
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
17910
17980
  }
17911
17981
  }
17982
+ const version = "2.1.2-alpha.1";
17983
+ const { getVersion } = record;
17984
+ const { isRecording } = record;
17985
+ const { flushCustomEventQueue } = record;
17912
17986
  const { addCustomEvent } = record;
17913
17987
  const { freezePage } = record;
17914
17988
  const { takeFullSnapshot } = record;
@@ -18632,12 +18706,16 @@ export {
18632
18706
  ReplayerEvents,
18633
18707
  addCustomEvent,
18634
18708
  canvasMutation,
18709
+ flushCustomEventQueue,
18635
18710
  freezePage,
18711
+ getVersion,
18712
+ isRecording,
18636
18713
  _mirror as mirror,
18637
18714
  pack,
18638
18715
  record,
18639
18716
  takeFullSnapshot,
18640
18717
  unpack,
18641
- utils
18718
+ utils,
18719
+ version
18642
18720
  };
18643
18721
  //# sourceMappingURL=rrweb-all.js.map