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