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

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.
@@ -820,10 +820,13 @@ function inspectInlineEventHandlers$1() {
820
820
  });
821
821
  });
822
822
  }
823
- if (document.readyState === "complete" || document.readyState === "interactive") {
824
- inspectInlineEventHandlers$1();
825
- } else {
826
- document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
823
+ try {
824
+ if (document.readyState === "complete" || document.readyState === "interactive") {
825
+ inspectInlineEventHandlers$1();
826
+ } else {
827
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
828
+ }
829
+ } catch (error) {
827
830
  }
828
831
  let _id = 1;
829
832
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -5887,10 +5890,13 @@ function inspectInlineEventHandlers() {
5887
5890
  });
5888
5891
  });
5889
5892
  }
5890
- if (document.readyState === "complete" || document.readyState === "interactive") {
5891
- inspectInlineEventHandlers();
5892
- } else {
5893
- document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5893
+ try {
5894
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5895
+ inspectInlineEventHandlers();
5896
+ } else {
5897
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5898
+ }
5899
+ } catch (error) {
5894
5900
  }
5895
5901
  function getDefaultExportFromCjs(x2) {
5896
5902
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -12357,6 +12363,8 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
12357
12363
  }
12358
12364
  const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
12359
12365
  const lastInputValueMap = /* @__PURE__ */ new WeakMap();
12366
+ const FINALIZING_KEYS = ["Enter", "Tab", "Escape", "ArrowDown", "ArrowUp", "Delete"];
12367
+ const lastKeyInputValueMap = /* @__PURE__ */ new WeakMap();
12360
12368
  function initInputObserver({
12361
12369
  inputCb,
12362
12370
  doc,
@@ -12429,6 +12437,22 @@ function initInputObserver({
12429
12437
  const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12430
12438
  const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12431
12439
  if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
12440
+ console.debug(
12441
+ `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
12442
+ {
12443
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
12444
+ node: index.describeNode(el),
12445
+ tag: el.tagName,
12446
+ nodeType: el.nodeType,
12447
+ attribute: el.attributes,
12448
+ value: el.value,
12449
+ isLikelyPhantom,
12450
+ isRenderDrivenTextInput,
12451
+ isValueFromDefault,
12452
+ isPhantomCheckbox,
12453
+ isPhantomRadio
12454
+ }
12455
+ );
12432
12456
  return;
12433
12457
  }
12434
12458
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
@@ -12444,6 +12468,61 @@ function initInputObserver({
12444
12468
  const handlers = events.map(
12445
12469
  (eventName) => on(eventName, callbackWrapper(eventHandler), doc)
12446
12470
  );
12471
+ const keyboardHandler = (event) => {
12472
+ const target = getEventTarget(event);
12473
+ if (!target || !target.tagName) return;
12474
+ if (sampling.input === "all") {
12475
+ eventHandler(event);
12476
+ return;
12477
+ }
12478
+ const tag = target.tagName;
12479
+ const key = event.key;
12480
+ const isFinalizingKey = FINALIZING_KEYS.includes(key);
12481
+ const isTextarea = tag === "TEXTAREA";
12482
+ const isFocused = doc.activeElement === target;
12483
+ const valueNow = target.value;
12484
+ const valueBefore = lastKeyInputValueMap.get(target);
12485
+ lastKeyInputValueMap.set(target, valueNow);
12486
+ if (!isFocused) {
12487
+ eventHandler(event);
12488
+ return;
12489
+ }
12490
+ if (isFinalizingKey) {
12491
+ if (!isTextarea) {
12492
+ eventHandler(event);
12493
+ return;
12494
+ }
12495
+ let lastValue = valueBefore ?? "";
12496
+ let unchangedCount = 0;
12497
+ const REQUIRED_STABLE_FRAMES = 2;
12498
+ const checkFinal = () => {
12499
+ const currentValue = target.value;
12500
+ const stillFocused = doc.activeElement === target;
12501
+ const changed = currentValue !== lastValue;
12502
+ if (!stillFocused) {
12503
+ eventHandler(event);
12504
+ return;
12505
+ }
12506
+ if (!changed) {
12507
+ unchangedCount++;
12508
+ if (unchangedCount >= REQUIRED_STABLE_FRAMES) {
12509
+ eventHandler(event);
12510
+ return;
12511
+ }
12512
+ } else {
12513
+ unchangedCount = 0;
12514
+ lastValue = currentValue;
12515
+ }
12516
+ requestAnimationFrame(checkFinal);
12517
+ };
12518
+ requestAnimationFrame(checkFinal);
12519
+ return;
12520
+ }
12521
+ };
12522
+ handlers.push(
12523
+ on("keydown", callbackWrapper(keyboardHandler), doc)
12524
+ // on('keypress', callbackWrapper(keyboardHandler), doc),
12525
+ );
12447
12526
  const currentWindow = doc.defaultView;
12448
12527
  if (!currentWindow) {
12449
12528
  return () => {
@@ -14417,13 +14496,14 @@ class VisibilityManager {
14417
14496
  if (this.rafId) cancelAnimationFrame(this.rafId);
14418
14497
  }
14419
14498
  }
14499
+ const version$1 = "2.1.2-alpha.2";
14420
14500
  let wrappedEmit;
14421
14501
  let takeFullSnapshot$1;
14422
14502
  let canvasManager;
14423
14503
  let visibilityManager;
14424
14504
  let recording = false;
14425
14505
  const customEventQueue = [];
14426
- let flushCustomEventQueue;
14506
+ let flushCustomEventQueue$1;
14427
14507
  function waitForDOMStabilization(win) {
14428
14508
  const maxWaitMs = 5e3;
14429
14509
  return new Promise((resolve2) => {
@@ -14793,7 +14873,7 @@ function record(options = {}) {
14793
14873
  mirror.getId(document)
14794
14874
  );
14795
14875
  };
14796
- flushCustomEventQueue = () => {
14876
+ flushCustomEventQueue$1 = () => {
14797
14877
  for (const e2 of customEventQueue) {
14798
14878
  wrappedEmit(e2);
14799
14879
  }
@@ -14936,37 +15016,34 @@ function record(options = {}) {
14936
15016
  });
14937
15017
  const init = () => {
14938
15018
  if (flushCustomEvent === "before") {
14939
- flushCustomEventQueue();
15019
+ flushCustomEventQueue$1();
14940
15020
  }
14941
15021
  takeFullSnapshot$1();
14942
15022
  handlers.push(observe(document));
14943
15023
  recording = true;
14944
15024
  if (flushCustomEvent === "after") {
14945
- flushCustomEventQueue();
15025
+ flushCustomEventQueue$1();
14946
15026
  }
14947
15027
  };
14948
15028
  const runInit = async () => {
14949
15029
  if (flushCustomEvent === "before") {
14950
- flushCustomEventQueue();
15030
+ flushCustomEventQueue$1();
14951
15031
  }
14952
15032
  if (recordAfter === "DOMContentStabilized") {
14953
- console.log(`[rrweb] 🟢 Waiting for DOM stabilization...`);
15033
+ console.debug(`[${nowTimestamp()}] [rrweb:record] 🟢 Waiting for DOM stabilization...`);
14954
15034
  await waitForDOMStabilization(window);
14955
- console.log(`[rrweb] ✅ DOM stabilized, starting recording`);
15035
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ DOM stabilized, starting recording`);
14956
15036
  }
15037
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ Init dom and takeFullSnapshot `);
14957
15038
  takeFullSnapshot$1();
14958
15039
  handlers.push(observe(document));
14959
15040
  recording = true;
14960
15041
  if (flushCustomEvent === "after") {
14961
- flushCustomEventQueue();
15042
+ flushCustomEventQueue$1();
14962
15043
  }
14963
15044
  };
14964
15045
  if (document.readyState === "interactive" || document.readyState === "complete") {
14965
- if (recordAfter === "DOMContentStabilized") {
14966
- void runInit();
14967
- } else {
14968
- init();
14969
- }
15046
+ init();
14970
15047
  } else {
14971
15048
  handlers.push(
14972
15049
  on("DOMContentLoaded", () => {
@@ -14974,9 +15051,7 @@ function record(options = {}) {
14974
15051
  type: EventType.DomContentLoaded,
14975
15052
  data: {}
14976
15053
  });
14977
- if (recordAfter === "DOMContentLoaded" || recordAfter === "DOMContentStabilized") {
14978
- void runInit();
14979
- }
15054
+ if (recordAfter === "DOMContentLoaded") init();
14980
15055
  })
14981
15056
  );
14982
15057
  handlers.push(
@@ -14987,14 +15062,14 @@ function record(options = {}) {
14987
15062
  type: EventType.Load,
14988
15063
  data: {}
14989
15064
  });
14990
- if (recordAfter === "load") void runInit();
15065
+ if (recordAfter === "load") init();
14991
15066
  },
14992
15067
  window
14993
15068
  )
14994
15069
  );
14995
15070
  }
14996
15071
  return () => {
14997
- flushCustomEventQueue();
15072
+ flushCustomEventQueue$1();
14998
15073
  handlers.forEach((h) => h());
14999
15074
  processedNodeManager.destroy();
15000
15075
  recording = false;
@@ -15004,10 +15079,11 @@ function record(options = {}) {
15004
15079
  console.warn(error);
15005
15080
  }
15006
15081
  }
15082
+ record.getVersion = () => version$1;
15007
15083
  record.isRecording = () => recording;
15008
15084
  record.flushCustomEventQueue = () => {
15009
15085
  console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
15010
- flushCustomEventQueue();
15086
+ flushCustomEventQueue$1();
15011
15087
  };
15012
15088
  record.addCustomEvent = (tag, payload) => {
15013
15089
  const customEvent = {
@@ -17911,6 +17987,10 @@ class Replayer {
17911
17987
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
17912
17988
  }
17913
17989
  }
17990
+ const version = "2.1.2-alpha.2";
17991
+ const { getVersion } = record;
17992
+ const { isRecording } = record;
17993
+ const { flushCustomEventQueue } = record;
17914
17994
  const { addCustomEvent } = record;
17915
17995
  const { freezePage } = record;
17916
17996
  const { takeFullSnapshot } = record;
@@ -18633,10 +18713,14 @@ exports.Replayer = Replayer;
18633
18713
  exports.ReplayerEvents = ReplayerEvents;
18634
18714
  exports.addCustomEvent = addCustomEvent;
18635
18715
  exports.canvasMutation = canvasMutation;
18716
+ exports.flushCustomEventQueue = flushCustomEventQueue;
18636
18717
  exports.freezePage = freezePage;
18718
+ exports.getVersion = getVersion;
18719
+ exports.isRecording = isRecording;
18637
18720
  exports.pack = pack;
18638
18721
  exports.record = record;
18639
18722
  exports.takeFullSnapshot = takeFullSnapshot;
18640
18723
  exports.unpack = unpack;
18641
18724
  exports.utils = utils;
18725
+ exports.version = version;
18642
18726
  //# sourceMappingURL=rrweb-all.cjs.map