@appsurify-testmap/rrweb 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.d.cts CHANGED
@@ -65,6 +65,8 @@ export { EventType }
65
65
 
66
66
  export { eventWithTime }
67
67
 
68
+ export declare const flushCustomEventQueue: () => void;
69
+
68
70
  export declare const freezePage: () => void;
69
71
 
70
72
  declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
@@ -80,6 +82,8 @@ declare function getRootShadowHost(n: Node): Node;
80
82
 
81
83
  declare function getShadowHost(n: Node): Element | null;
82
84
 
85
+ export declare const getVersion: () => string;
86
+
83
87
  declare function getWindowHeight(win?: Window): number;
84
88
 
85
89
  declare function getWindowScroll(win?: Window): {
@@ -105,6 +109,8 @@ declare function isBlocked(node: Node | null, blockClass: blockClass, blockSelec
105
109
 
106
110
  declare function isIgnored(n: Node, mirror: Mirror, slimDOMOptions: SlimDOMOptions): boolean;
107
111
 
112
+ export declare const isRecording: () => boolean;
113
+
108
114
  declare function isSerialized(n: Node, mirror: Mirror): boolean;
109
115
 
110
116
  declare function isSerializedIframe<TNode extends Node | RRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
@@ -213,6 +219,7 @@ declare function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[];
213
219
  export declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
214
220
 
215
221
  export declare namespace record {
222
+ var getVersion: () => string;
216
223
  var isRecording: () => boolean;
217
224
  var flushCustomEventQueue: () => void;
218
225
  var addCustomEvent: <T>(tag: string, payload: T) => void;
@@ -465,10 +472,13 @@ declare namespace utils {
465
472
  }
466
473
  export { utils }
467
474
 
475
+ export declare const version: string;
476
+
468
477
  export { }
469
478
 
470
479
 
471
480
  declare namespace record {
481
+ var getVersion: () => string;
472
482
  var isRecording: () => boolean;
473
483
  var flushCustomEventQueue: () => void;
474
484
  var addCustomEvent: <T>(tag: string, payload: T) => void;
package/dist/rrweb.d.ts CHANGED
@@ -65,6 +65,8 @@ export { EventType }
65
65
 
66
66
  export { eventWithTime }
67
67
 
68
+ export declare const flushCustomEventQueue: () => void;
69
+
68
70
  export declare const freezePage: () => void;
69
71
 
70
72
  declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
@@ -80,6 +82,8 @@ declare function getRootShadowHost(n: Node): Node;
80
82
 
81
83
  declare function getShadowHost(n: Node): Element | null;
82
84
 
85
+ export declare const getVersion: () => string;
86
+
83
87
  declare function getWindowHeight(win?: Window): number;
84
88
 
85
89
  declare function getWindowScroll(win?: Window): {
@@ -105,6 +109,8 @@ declare function isBlocked(node: Node | null, blockClass: blockClass, blockSelec
105
109
 
106
110
  declare function isIgnored(n: Node, mirror: Mirror, slimDOMOptions: SlimDOMOptions): boolean;
107
111
 
112
+ export declare const isRecording: () => boolean;
113
+
108
114
  declare function isSerialized(n: Node, mirror: Mirror): boolean;
109
115
 
110
116
  declare function isSerializedIframe<TNode extends Node | RRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
@@ -213,6 +219,7 @@ declare function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[];
213
219
  export declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
214
220
 
215
221
  export declare namespace record {
222
+ var getVersion: () => string;
216
223
  var isRecording: () => boolean;
217
224
  var flushCustomEventQueue: () => void;
218
225
  var addCustomEvent: <T>(tag: string, payload: T) => void;
@@ -465,10 +472,13 @@ declare namespace utils {
465
472
  }
466
473
  export { utils }
467
474
 
475
+ export declare const version: string;
476
+
468
477
  export { }
469
478
 
470
479
 
471
480
  declare namespace record {
481
+ var getVersion: () => string;
472
482
  var isRecording: () => boolean;
473
483
  var flushCustomEventQueue: () => void;
474
484
  var addCustomEvent: <T>(tag: string, payload: T) => void;
package/dist/rrweb.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;
@@ -12375,6 +12381,8 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
12375
12381
  }
12376
12382
  const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
12377
12383
  const lastInputValueMap = /* @__PURE__ */ new WeakMap();
12384
+ const FINALIZING_KEYS = ["Enter", "Tab", "Escape", "ArrowDown", "ArrowUp", "Delete"];
12385
+ const lastKeyInputValueMap = /* @__PURE__ */ new WeakMap();
12378
12386
  function initInputObserver({
12379
12387
  inputCb,
12380
12388
  doc,
@@ -12447,6 +12455,22 @@ function initInputObserver({
12447
12455
  const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12448
12456
  const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
12449
12457
  if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
12458
+ console.debug(
12459
+ `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
12460
+ {
12461
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
12462
+ node: index.describeNode(el),
12463
+ tag: el.tagName,
12464
+ nodeType: el.nodeType,
12465
+ attribute: el.attributes,
12466
+ value: el.value,
12467
+ isLikelyPhantom,
12468
+ isRenderDrivenTextInput,
12469
+ isValueFromDefault,
12470
+ isPhantomCheckbox,
12471
+ isPhantomRadio
12472
+ }
12473
+ );
12450
12474
  return;
12451
12475
  }
12452
12476
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
@@ -12462,6 +12486,61 @@ function initInputObserver({
12462
12486
  const handlers = events.map(
12463
12487
  (eventName) => on(eventName, callbackWrapper(eventHandler), doc)
12464
12488
  );
12489
+ const keyboardHandler = (event) => {
12490
+ const target = getEventTarget(event);
12491
+ if (!target || !target.tagName) return;
12492
+ if (sampling.input === "all") {
12493
+ eventHandler(event);
12494
+ return;
12495
+ }
12496
+ const tag = target.tagName;
12497
+ const key = event.key;
12498
+ const isFinalizingKey = FINALIZING_KEYS.includes(key);
12499
+ const isTextarea = tag === "TEXTAREA";
12500
+ const isFocused = doc.activeElement === target;
12501
+ const valueNow = target.value;
12502
+ const valueBefore = lastKeyInputValueMap.get(target);
12503
+ lastKeyInputValueMap.set(target, valueNow);
12504
+ if (!isFocused) {
12505
+ eventHandler(event);
12506
+ return;
12507
+ }
12508
+ if (isFinalizingKey) {
12509
+ if (!isTextarea) {
12510
+ eventHandler(event);
12511
+ return;
12512
+ }
12513
+ let lastValue = valueBefore ?? "";
12514
+ let unchangedCount = 0;
12515
+ const REQUIRED_STABLE_FRAMES = 2;
12516
+ const checkFinal = () => {
12517
+ const currentValue = target.value;
12518
+ const stillFocused = doc.activeElement === target;
12519
+ const changed = currentValue !== lastValue;
12520
+ if (!stillFocused) {
12521
+ eventHandler(event);
12522
+ return;
12523
+ }
12524
+ if (!changed) {
12525
+ unchangedCount++;
12526
+ if (unchangedCount >= REQUIRED_STABLE_FRAMES) {
12527
+ eventHandler(event);
12528
+ return;
12529
+ }
12530
+ } else {
12531
+ unchangedCount = 0;
12532
+ lastValue = currentValue;
12533
+ }
12534
+ requestAnimationFrame(checkFinal);
12535
+ };
12536
+ requestAnimationFrame(checkFinal);
12537
+ return;
12538
+ }
12539
+ };
12540
+ handlers.push(
12541
+ on("keydown", callbackWrapper(keyboardHandler), doc)
12542
+ // on('keypress', callbackWrapper(keyboardHandler), doc),
12543
+ );
12465
12544
  const currentWindow = doc.defaultView;
12466
12545
  if (!currentWindow) {
12467
12546
  return () => {
@@ -14435,13 +14514,14 @@ class VisibilityManager {
14435
14514
  if (this.rafId) cancelAnimationFrame(this.rafId);
14436
14515
  }
14437
14516
  }
14517
+ const version$1 = "2.1.2-alpha.2";
14438
14518
  let wrappedEmit;
14439
14519
  let takeFullSnapshot$1;
14440
14520
  let canvasManager;
14441
14521
  let visibilityManager;
14442
14522
  let recording = false;
14443
14523
  const customEventQueue = [];
14444
- let flushCustomEventQueue;
14524
+ let flushCustomEventQueue$1;
14445
14525
  function waitForDOMStabilization(win) {
14446
14526
  const maxWaitMs = 5e3;
14447
14527
  return new Promise((resolve2) => {
@@ -14811,7 +14891,7 @@ function record(options = {}) {
14811
14891
  mirror.getId(document)
14812
14892
  );
14813
14893
  };
14814
- flushCustomEventQueue = () => {
14894
+ flushCustomEventQueue$1 = () => {
14815
14895
  for (const e2 of customEventQueue) {
14816
14896
  wrappedEmit(e2);
14817
14897
  }
@@ -14954,37 +15034,34 @@ function record(options = {}) {
14954
15034
  });
14955
15035
  const init = () => {
14956
15036
  if (flushCustomEvent === "before") {
14957
- flushCustomEventQueue();
15037
+ flushCustomEventQueue$1();
14958
15038
  }
14959
15039
  takeFullSnapshot$1();
14960
15040
  handlers.push(observe(document));
14961
15041
  recording = true;
14962
15042
  if (flushCustomEvent === "after") {
14963
- flushCustomEventQueue();
15043
+ flushCustomEventQueue$1();
14964
15044
  }
14965
15045
  };
14966
15046
  const runInit = async () => {
14967
15047
  if (flushCustomEvent === "before") {
14968
- flushCustomEventQueue();
15048
+ flushCustomEventQueue$1();
14969
15049
  }
14970
15050
  if (recordAfter === "DOMContentStabilized") {
14971
- console.log(`[rrweb] 🟢 Waiting for DOM stabilization...`);
15051
+ console.debug(`[${nowTimestamp()}] [rrweb:record] 🟢 Waiting for DOM stabilization...`);
14972
15052
  await waitForDOMStabilization(window);
14973
- console.log(`[rrweb] ✅ DOM stabilized, starting recording`);
15053
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ DOM stabilized, starting recording`);
14974
15054
  }
15055
+ console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ Init dom and takeFullSnapshot `);
14975
15056
  takeFullSnapshot$1();
14976
15057
  handlers.push(observe(document));
14977
15058
  recording = true;
14978
15059
  if (flushCustomEvent === "after") {
14979
- flushCustomEventQueue();
15060
+ flushCustomEventQueue$1();
14980
15061
  }
14981
15062
  };
14982
15063
  if (document.readyState === "interactive" || document.readyState === "complete") {
14983
- if (recordAfter === "DOMContentStabilized") {
14984
- void runInit();
14985
- } else {
14986
- init();
14987
- }
15064
+ init();
14988
15065
  } else {
14989
15066
  handlers.push(
14990
15067
  on("DOMContentLoaded", () => {
@@ -14992,9 +15069,7 @@ function record(options = {}) {
14992
15069
  type: EventType.DomContentLoaded,
14993
15070
  data: {}
14994
15071
  });
14995
- if (recordAfter === "DOMContentLoaded" || recordAfter === "DOMContentStabilized") {
14996
- void runInit();
14997
- }
15072
+ if (recordAfter === "DOMContentLoaded") init();
14998
15073
  })
14999
15074
  );
15000
15075
  handlers.push(
@@ -15005,14 +15080,14 @@ function record(options = {}) {
15005
15080
  type: EventType.Load,
15006
15081
  data: {}
15007
15082
  });
15008
- if (recordAfter === "load") void runInit();
15083
+ if (recordAfter === "load") init();
15009
15084
  },
15010
15085
  window
15011
15086
  )
15012
15087
  );
15013
15088
  }
15014
15089
  return () => {
15015
- flushCustomEventQueue();
15090
+ flushCustomEventQueue$1();
15016
15091
  handlers.forEach((h) => h());
15017
15092
  processedNodeManager.destroy();
15018
15093
  recording = false;
@@ -15022,10 +15097,11 @@ function record(options = {}) {
15022
15097
  console.warn(error);
15023
15098
  }
15024
15099
  }
15100
+ record.getVersion = () => version$1;
15025
15101
  record.isRecording = () => recording;
15026
15102
  record.flushCustomEventQueue = () => {
15027
15103
  console.warn(`[rrweb] CustomEvent flushing: ${customEventQueue.length} events`);
15028
- flushCustomEventQueue();
15104
+ flushCustomEventQueue$1();
15029
15105
  };
15030
15106
  record.addCustomEvent = (tag, payload) => {
15031
15107
  const customEvent = {
@@ -17937,6 +18013,10 @@ class Replayer {
17937
18013
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
17938
18014
  }
17939
18015
  }
18016
+ const version = "2.1.2-alpha.2";
18017
+ const { getVersion } = record;
18018
+ const { isRecording } = record;
18019
+ const { flushCustomEventQueue } = record;
17940
18020
  const { addCustomEvent } = record;
17941
18021
  const { freezePage } = record;
17942
18022
  const { takeFullSnapshot } = record;
@@ -17948,10 +18028,14 @@ export {
17948
18028
  ReplayerEvents,
17949
18029
  addCustomEvent,
17950
18030
  canvasMutation,
18031
+ flushCustomEventQueue,
17951
18032
  freezePage,
18033
+ getVersion,
18034
+ isRecording,
17952
18035
  _mirror as mirror,
17953
18036
  record,
17954
18037
  takeFullSnapshot,
17955
- utils
18038
+ utils,
18039
+ version
17956
18040
  };
17957
18041
  //# sourceMappingURL=rrweb.js.map