@appsurify-testmap/rrweb 3.6.0-alpha.1 → 3.10.0-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.
@@ -16409,7 +16409,8 @@ function initInputObserver({
16409
16409
  maskInputOptions,
16410
16410
  maskInputFn,
16411
16411
  sampling,
16412
- userTriggeredOnInput
16412
+ userTriggeredOnInput,
16413
+ trustSyntheticInput
16413
16414
  }) {
16414
16415
  function eventHandler(event) {
16415
16416
  let target = getEventTarget(event);
@@ -16459,34 +16460,53 @@ function initInputObserver({
16459
16460
  function cbWithDedup(target, v2) {
16460
16461
  const lastInputValue = lastInputValueMap.get(target);
16461
16462
  const el = target;
16462
- const hasPlaceholder = el.hasAttribute("placeholder");
16463
- const isEmpty = el.value === "";
16464
- const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
16465
- const isNonUser = !v2.userTriggered;
16466
- const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
16467
- const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16468
- const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
16469
- const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16470
- const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16471
- const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16472
- if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
16473
- console.debug(
16474
- `[${nowTimestamp()}] [rrweb:record/observer] \u26D4 phantom input ignored`,
16475
- {
16476
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
16477
- node: index.describeNode(el),
16478
- tag: el.tagName,
16479
- nodeType: el.nodeType,
16480
- attribute: el.attributes,
16481
- value: el.value,
16482
- isLikelyPhantom,
16483
- isRenderDrivenTextInput,
16484
- isValueFromDefault,
16485
- isPhantomCheckbox,
16486
- isPhantomRadio
16487
- }
16488
- );
16489
- return;
16463
+ if (trustSyntheticInput) {
16464
+ const isInitialEmpty = !v2.userTriggered && el.value === "" && !v2.isChecked && !lastInputValue;
16465
+ const isSelectDefaultSelection = el.tagName === "SELECT" && !v2.userTriggered && !lastInputValue && el.selectedIndex === 0;
16466
+ if (isInitialEmpty || isSelectDefaultSelection) {
16467
+ console.debug(
16468
+ `[${nowTimestamp()}] [rrweb:record/observer] phantom input ignored (trust mode)`,
16469
+ {
16470
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
16471
+ node: index.describeNode(el),
16472
+ tag: el.tagName,
16473
+ value: el.value,
16474
+ isInitialEmpty,
16475
+ isSelectDefaultSelection
16476
+ }
16477
+ );
16478
+ return;
16479
+ }
16480
+ } else {
16481
+ const hasPlaceholder = el.hasAttribute("placeholder");
16482
+ const isEmpty = el.value === "";
16483
+ const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
16484
+ const isNonUser = !v2.userTriggered;
16485
+ const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
16486
+ const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16487
+ const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
16488
+ const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16489
+ const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16490
+ const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16491
+ if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
16492
+ console.debug(
16493
+ `[${nowTimestamp()}] [rrweb:record/observer] \u26D4 phantom input ignored`,
16494
+ {
16495
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
16496
+ node: index.describeNode(el),
16497
+ tag: el.tagName,
16498
+ nodeType: el.nodeType,
16499
+ attribute: el.attributes,
16500
+ value: el.value,
16501
+ isLikelyPhantom,
16502
+ isRenderDrivenTextInput,
16503
+ isValueFromDefault,
16504
+ isPhantomCheckbox,
16505
+ isPhantomRadio
16506
+ }
16507
+ );
16508
+ return;
16509
+ }
16490
16510
  }
16491
16511
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
16492
16512
  lastInputValueMap.set(target, v2);
@@ -18570,8 +18590,15 @@ class NavigationManager {
18570
18590
  return;
18571
18591
  if (this.locked)
18572
18592
  return;
18573
- this.cancelTimers();
18574
- this.disconnectSettlingObserver();
18593
+ if (this.pendingNavigation) {
18594
+ this.cancelTimers();
18595
+ this.disconnectSettlingObserver();
18596
+ this.pendingNavigation = null;
18597
+ this.onSnapshot(true);
18598
+ } else {
18599
+ this.cancelTimers();
18600
+ this.disconnectSettlingObserver();
18601
+ }
18575
18602
  this.pendingNavigation = data;
18576
18603
  if (this.frozen) {
18577
18604
  return;
@@ -18785,7 +18812,7 @@ class ProcessedNodeManager {
18785
18812
  destroy() {
18786
18813
  }
18787
18814
  }
18788
- const version$1 = "3.6.0-alpha.1";
18815
+ const version$1 = "3.10.0-alpha.1";
18789
18816
  let wrappedEmit;
18790
18817
  let takeFullSnapshot$1;
18791
18818
  let canvasManager;
@@ -18834,6 +18861,7 @@ function record(options = {}) {
18834
18861
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
18835
18862
  flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",
18836
18863
  userTriggeredOnInput = false,
18864
+ trustSyntheticInput = false,
18837
18865
  collectFonts = false,
18838
18866
  inlineImages = false,
18839
18867
  plugins,
@@ -19360,6 +19388,7 @@ function record(options = {}) {
19360
19388
  recordCanvas,
19361
19389
  inlineImages,
19362
19390
  userTriggeredOnInput,
19391
+ trustSyntheticInput,
19363
19392
  collectFonts,
19364
19393
  doc,
19365
19394
  maskInputFn,
@@ -19438,6 +19467,43 @@ function record(options = {}) {
19438
19467
  );
19439
19468
  }
19440
19469
  return () => {
19470
+ if (recording) {
19471
+ const activeEl = document.activeElement;
19472
+ if (activeEl && INPUT_TAGS.includes(activeEl.tagName)) {
19473
+ const inputEl = activeEl;
19474
+ const id = mirror.getId(inputEl);
19475
+ if (id !== -1) {
19476
+ const lastValue = lastInputValueMap.get(inputEl);
19477
+ let text = inputEl.value;
19478
+ let isChecked = false;
19479
+ const type = getInputType(inputEl) || "";
19480
+ if (type === "radio" || type === "checkbox") {
19481
+ isChecked = inputEl.checked;
19482
+ } else if (maskInputOptions[inputEl.tagName.toLowerCase()] || maskInputOptions[type]) {
19483
+ text = maskInputValue({
19484
+ element: inputEl,
19485
+ maskInputOptions,
19486
+ tagName: inputEl.tagName,
19487
+ type,
19488
+ value: text,
19489
+ maskInputFn
19490
+ });
19491
+ }
19492
+ if (!lastValue || lastValue.text !== text || lastValue.isChecked !== isChecked) {
19493
+ const inputData = userTriggeredOnInput ? { text, isChecked, userTriggered: false } : { text, isChecked };
19494
+ lastInputValueMap.set(inputEl, inputData);
19495
+ wrappedEmit({
19496
+ type: EventType.IncrementalSnapshot,
19497
+ data: __spreadProps(__spreadValues({
19498
+ source: IncrementalSource.Input
19499
+ }, inputData), {
19500
+ id
19501
+ })
19502
+ });
19503
+ }
19504
+ }
19505
+ }
19506
+ }
19441
19507
  if (checkoutDebounceTimer) {
19442
19508
  clearTimeout(checkoutDebounceTimer);
19443
19509
  checkoutDebounceTimer = null;
@@ -22409,7 +22475,7 @@ class Replayer {
22409
22475
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
22410
22476
  }
22411
22477
  }
22412
- const version = "3.6.0-alpha.1";
22478
+ const version = "3.10.0-alpha.1";
22413
22479
  const { getVersion } = record;
22414
22480
  const { isRecording } = record;
22415
22481
  const { flushCustomEventQueue } = record;