@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.
package/dist/rrweb.cjs CHANGED
@@ -15922,7 +15922,8 @@ function initInputObserver({
15922
15922
  maskInputOptions,
15923
15923
  maskInputFn,
15924
15924
  sampling,
15925
- userTriggeredOnInput
15925
+ userTriggeredOnInput,
15926
+ trustSyntheticInput
15926
15927
  }) {
15927
15928
  function eventHandler(event) {
15928
15929
  let target = getEventTarget(event);
@@ -15972,34 +15973,53 @@ function initInputObserver({
15972
15973
  function cbWithDedup(target, v2) {
15973
15974
  const lastInputValue = lastInputValueMap.get(target);
15974
15975
  const el = target;
15975
- const hasPlaceholder = el.hasAttribute("placeholder");
15976
- const isEmpty = el.value === "";
15977
- const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
15978
- const isNonUser = !v2.userTriggered;
15979
- const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
15980
- const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
15981
- const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
15982
- const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
15983
- const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
15984
- const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
15985
- if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
15986
- console.debug(
15987
- `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
15988
- {
15989
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
15990
- node: index.describeNode(el),
15991
- tag: el.tagName,
15992
- nodeType: el.nodeType,
15993
- attribute: el.attributes,
15994
- value: el.value,
15995
- isLikelyPhantom,
15996
- isRenderDrivenTextInput,
15997
- isValueFromDefault,
15998
- isPhantomCheckbox,
15999
- isPhantomRadio
16000
- }
16001
- );
16002
- return;
15976
+ if (trustSyntheticInput) {
15977
+ const isInitialEmpty = !v2.userTriggered && el.value === "" && !v2.isChecked && !lastInputValue;
15978
+ const isSelectDefaultSelection = el.tagName === "SELECT" && !v2.userTriggered && !lastInputValue && el.selectedIndex === 0;
15979
+ if (isInitialEmpty || isSelectDefaultSelection) {
15980
+ console.debug(
15981
+ `[${nowTimestamp()}] [rrweb:record/observer] phantom input ignored (trust mode)`,
15982
+ {
15983
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
15984
+ node: index.describeNode(el),
15985
+ tag: el.tagName,
15986
+ value: el.value,
15987
+ isInitialEmpty,
15988
+ isSelectDefaultSelection
15989
+ }
15990
+ );
15991
+ return;
15992
+ }
15993
+ } else {
15994
+ const hasPlaceholder = el.hasAttribute("placeholder");
15995
+ const isEmpty = el.value === "";
15996
+ const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
15997
+ const isNonUser = !v2.userTriggered;
15998
+ const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
15999
+ const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16000
+ const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
16001
+ const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16002
+ const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16003
+ const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16004
+ if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
16005
+ console.debug(
16006
+ `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
16007
+ {
16008
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
16009
+ node: index.describeNode(el),
16010
+ tag: el.tagName,
16011
+ nodeType: el.nodeType,
16012
+ attribute: el.attributes,
16013
+ value: el.value,
16014
+ isLikelyPhantom,
16015
+ isRenderDrivenTextInput,
16016
+ isValueFromDefault,
16017
+ isPhantomCheckbox,
16018
+ isPhantomRadio
16019
+ }
16020
+ );
16021
+ return;
16022
+ }
16003
16023
  }
16004
16024
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
16005
16025
  lastInputValueMap.set(target, v2);
@@ -18050,8 +18070,15 @@ class NavigationManager {
18050
18070
  handleNavigation(data) {
18051
18071
  if (this.disabled) return;
18052
18072
  if (this.locked) return;
18053
- this.cancelTimers();
18054
- this.disconnectSettlingObserver();
18073
+ if (this.pendingNavigation) {
18074
+ this.cancelTimers();
18075
+ this.disconnectSettlingObserver();
18076
+ this.pendingNavigation = null;
18077
+ this.onSnapshot(true);
18078
+ } else {
18079
+ this.cancelTimers();
18080
+ this.disconnectSettlingObserver();
18081
+ }
18055
18082
  this.pendingNavigation = data;
18056
18083
  if (this.frozen) {
18057
18084
  return;
@@ -18258,7 +18285,7 @@ class ProcessedNodeManager {
18258
18285
  destroy() {
18259
18286
  }
18260
18287
  }
18261
- const version$1 = "3.6.0-alpha.1";
18288
+ const version$1 = "3.10.0-alpha.1";
18262
18289
  let wrappedEmit;
18263
18290
  let takeFullSnapshot$1;
18264
18291
  let canvasManager;
@@ -18307,6 +18334,7 @@ function record(options = {}) {
18307
18334
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
18308
18335
  flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",
18309
18336
  userTriggeredOnInput = false,
18337
+ trustSyntheticInput = false,
18310
18338
  collectFonts = false,
18311
18339
  inlineImages = false,
18312
18340
  plugins,
@@ -18846,6 +18874,7 @@ function record(options = {}) {
18846
18874
  recordCanvas,
18847
18875
  inlineImages,
18848
18876
  userTriggeredOnInput,
18877
+ trustSyntheticInput,
18849
18878
  collectFonts,
18850
18879
  doc,
18851
18880
  maskInputFn,
@@ -18922,6 +18951,43 @@ function record(options = {}) {
18922
18951
  );
18923
18952
  }
18924
18953
  return () => {
18954
+ if (recording) {
18955
+ const activeEl = document.activeElement;
18956
+ if (activeEl && INPUT_TAGS.includes(activeEl.tagName)) {
18957
+ const inputEl = activeEl;
18958
+ const id = mirror.getId(inputEl);
18959
+ if (id !== -1) {
18960
+ const lastValue = lastInputValueMap.get(inputEl);
18961
+ let text = inputEl.value;
18962
+ let isChecked = false;
18963
+ const type = getInputType(inputEl) || "";
18964
+ if (type === "radio" || type === "checkbox") {
18965
+ isChecked = inputEl.checked;
18966
+ } else if (maskInputOptions[inputEl.tagName.toLowerCase()] || maskInputOptions[type]) {
18967
+ text = maskInputValue({
18968
+ element: inputEl,
18969
+ maskInputOptions,
18970
+ tagName: inputEl.tagName,
18971
+ type,
18972
+ value: text,
18973
+ maskInputFn
18974
+ });
18975
+ }
18976
+ if (!lastValue || lastValue.text !== text || lastValue.isChecked !== isChecked) {
18977
+ const inputData = userTriggeredOnInput ? { text, isChecked, userTriggered: false } : { text, isChecked };
18978
+ lastInputValueMap.set(inputEl, inputData);
18979
+ wrappedEmit({
18980
+ type: EventType.IncrementalSnapshot,
18981
+ data: {
18982
+ source: IncrementalSource.Input,
18983
+ ...inputData,
18984
+ id
18985
+ }
18986
+ });
18987
+ }
18988
+ }
18989
+ }
18990
+ }
18925
18991
  if (checkoutDebounceTimer) {
18926
18992
  clearTimeout(checkoutDebounceTimer);
18927
18993
  checkoutDebounceTimer = null;
@@ -21861,7 +21927,7 @@ class Replayer {
21861
21927
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
21862
21928
  }
21863
21929
  }
21864
- const version = "3.6.0-alpha.1";
21930
+ const version = "3.10.0-alpha.1";
21865
21931
  const { getVersion } = record;
21866
21932
  const { isRecording } = record;
21867
21933
  const { flushCustomEventQueue } = record;