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