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