@appsurify-testmap/rrweb-record 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.
@@ -13903,7 +13903,8 @@ function initInputObserver({
13903
13903
  maskInputOptions,
13904
13904
  maskInputFn,
13905
13905
  sampling,
13906
- userTriggeredOnInput
13906
+ userTriggeredOnInput,
13907
+ trustSyntheticInput
13907
13908
  }) {
13908
13909
  function eventHandler(event) {
13909
13910
  let target = getEventTarget(event);
@@ -13953,34 +13954,53 @@ function initInputObserver({
13953
13954
  function cbWithDedup(target, v2) {
13954
13955
  const lastInputValue = lastInputValueMap.get(target);
13955
13956
  const el = target;
13956
- const hasPlaceholder = el.hasAttribute("placeholder");
13957
- const isEmpty = el.value === "";
13958
- const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
13959
- const isNonUser = !v2.userTriggered;
13960
- const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
13961
- const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
13962
- const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
13963
- const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
13964
- const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
13965
- const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
13966
- if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
13967
- console.debug(
13968
- `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
13969
- {
13970
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
13971
- node: index.describeNode(el),
13972
- tag: el.tagName,
13973
- nodeType: el.nodeType,
13974
- attribute: el.attributes,
13975
- value: el.value,
13976
- isLikelyPhantom,
13977
- isRenderDrivenTextInput,
13978
- isValueFromDefault,
13979
- isPhantomCheckbox,
13980
- isPhantomRadio
13981
- }
13982
- );
13983
- return;
13957
+ if (trustSyntheticInput) {
13958
+ const isInitialEmpty = !v2.userTriggered && el.value === "" && !v2.isChecked && !lastInputValue;
13959
+ const isSelectDefaultSelection = el.tagName === "SELECT" && !v2.userTriggered && !lastInputValue && el.selectedIndex === 0;
13960
+ if (isInitialEmpty || isSelectDefaultSelection) {
13961
+ console.debug(
13962
+ `[${nowTimestamp()}] [rrweb:record/observer] phantom input ignored (trust mode)`,
13963
+ {
13964
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
13965
+ node: index.describeNode(el),
13966
+ tag: el.tagName,
13967
+ value: el.value,
13968
+ isInitialEmpty,
13969
+ isSelectDefaultSelection
13970
+ }
13971
+ );
13972
+ return;
13973
+ }
13974
+ } else {
13975
+ const hasPlaceholder = el.hasAttribute("placeholder");
13976
+ const isEmpty = el.value === "";
13977
+ const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
13978
+ const isNonUser = !v2.userTriggered;
13979
+ const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
13980
+ const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
13981
+ const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
13982
+ const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
13983
+ const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
13984
+ const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
13985
+ if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
13986
+ console.debug(
13987
+ `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
13988
+ {
13989
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
13990
+ node: index.describeNode(el),
13991
+ tag: el.tagName,
13992
+ nodeType: el.nodeType,
13993
+ attribute: el.attributes,
13994
+ value: el.value,
13995
+ isLikelyPhantom,
13996
+ isRenderDrivenTextInput,
13997
+ isValueFromDefault,
13998
+ isPhantomCheckbox,
13999
+ isPhantomRadio
14000
+ }
14001
+ );
14002
+ return;
14003
+ }
13984
14004
  }
13985
14005
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
13986
14006
  lastInputValueMap.set(target, v2);
@@ -16011,8 +16031,15 @@ class NavigationManager {
16011
16031
  handleNavigation(data) {
16012
16032
  if (this.disabled) return;
16013
16033
  if (this.locked) return;
16014
- this.cancelTimers();
16015
- this.disconnectSettlingObserver();
16034
+ if (this.pendingNavigation) {
16035
+ this.cancelTimers();
16036
+ this.disconnectSettlingObserver();
16037
+ this.pendingNavigation = null;
16038
+ this.onSnapshot(true);
16039
+ } else {
16040
+ this.cancelTimers();
16041
+ this.disconnectSettlingObserver();
16042
+ }
16016
16043
  this.pendingNavigation = data;
16017
16044
  if (this.frozen) {
16018
16045
  return;
@@ -16219,7 +16246,7 @@ class ProcessedNodeManager {
16219
16246
  destroy() {
16220
16247
  }
16221
16248
  }
16222
- const version$1 = "3.6.0-alpha.1";
16249
+ const version$1 = "3.10.0-alpha.1";
16223
16250
  let wrappedEmit;
16224
16251
  let takeFullSnapshot$1;
16225
16252
  let canvasManager;
@@ -16268,6 +16295,7 @@ function record(options = {}) {
16268
16295
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
16269
16296
  flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",
16270
16297
  userTriggeredOnInput = false,
16298
+ trustSyntheticInput = false,
16271
16299
  collectFonts = false,
16272
16300
  inlineImages = false,
16273
16301
  plugins,
@@ -16807,6 +16835,7 @@ function record(options = {}) {
16807
16835
  recordCanvas,
16808
16836
  inlineImages,
16809
16837
  userTriggeredOnInput,
16838
+ trustSyntheticInput,
16810
16839
  collectFonts,
16811
16840
  doc,
16812
16841
  maskInputFn,
@@ -16883,6 +16912,43 @@ function record(options = {}) {
16883
16912
  );
16884
16913
  }
16885
16914
  return () => {
16915
+ if (recording) {
16916
+ const activeEl = document.activeElement;
16917
+ if (activeEl && INPUT_TAGS.includes(activeEl.tagName)) {
16918
+ const inputEl = activeEl;
16919
+ const id = mirror.getId(inputEl);
16920
+ if (id !== -1) {
16921
+ const lastValue = lastInputValueMap.get(inputEl);
16922
+ let text = inputEl.value;
16923
+ let isChecked = false;
16924
+ const type = getInputType(inputEl) || "";
16925
+ if (type === "radio" || type === "checkbox") {
16926
+ isChecked = inputEl.checked;
16927
+ } else if (maskInputOptions[inputEl.tagName.toLowerCase()] || maskInputOptions[type]) {
16928
+ text = maskInputValue({
16929
+ element: inputEl,
16930
+ maskInputOptions,
16931
+ tagName: inputEl.tagName,
16932
+ type,
16933
+ value: text,
16934
+ maskInputFn
16935
+ });
16936
+ }
16937
+ if (!lastValue || lastValue.text !== text || lastValue.isChecked !== isChecked) {
16938
+ const inputData = userTriggeredOnInput ? { text, isChecked, userTriggered: false } : { text, isChecked };
16939
+ lastInputValueMap.set(inputEl, inputData);
16940
+ wrappedEmit({
16941
+ type: EventType.IncrementalSnapshot,
16942
+ data: {
16943
+ source: IncrementalSource.Input,
16944
+ ...inputData,
16945
+ id
16946
+ }
16947
+ });
16948
+ }
16949
+ }
16950
+ }
16951
+ }
16886
16952
  if (checkoutDebounceTimer) {
16887
16953
  clearTimeout(checkoutDebounceTimer);
16888
16954
  checkoutDebounceTimer = null;