@appsurify-testmap/rrweb-all 3.5.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.
@@ -15902,7 +15902,8 @@ function initInputObserver({
15902
15902
  maskInputOptions,
15903
15903
  maskInputFn,
15904
15904
  sampling,
15905
- userTriggeredOnInput
15905
+ userTriggeredOnInput,
15906
+ trustSyntheticInput
15906
15907
  }) {
15907
15908
  function eventHandler(event) {
15908
15909
  let target = getEventTarget(event);
@@ -15952,34 +15953,53 @@ function initInputObserver({
15952
15953
  function cbWithDedup(target, v2) {
15953
15954
  const lastInputValue = lastInputValueMap.get(target);
15954
15955
  const el = target;
15955
- const hasPlaceholder = el.hasAttribute("placeholder");
15956
- const isEmpty = el.value === "";
15957
- const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
15958
- const isNonUser = !v2.userTriggered;
15959
- const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
15960
- const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
15961
- const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
15962
- const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
15963
- const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
15964
- const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
15965
- if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
15966
- console.debug(
15967
- `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
15968
- {
15969
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
15970
- node: index.describeNode(el),
15971
- tag: el.tagName,
15972
- nodeType: el.nodeType,
15973
- attribute: el.attributes,
15974
- value: el.value,
15975
- isLikelyPhantom,
15976
- isRenderDrivenTextInput,
15977
- isValueFromDefault,
15978
- isPhantomCheckbox,
15979
- isPhantomRadio
15980
- }
15981
- );
15982
- return;
15956
+ if (trustSyntheticInput) {
15957
+ const isInitialEmpty = !v2.userTriggered && el.value === "" && !v2.isChecked && !lastInputValue;
15958
+ const isSelectDefaultSelection = el.tagName === "SELECT" && !v2.userTriggered && !lastInputValue && el.selectedIndex === 0;
15959
+ if (isInitialEmpty || isSelectDefaultSelection) {
15960
+ console.debug(
15961
+ `[${nowTimestamp()}] [rrweb:record/observer] phantom input ignored (trust mode)`,
15962
+ {
15963
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
15964
+ node: index.describeNode(el),
15965
+ tag: el.tagName,
15966
+ value: el.value,
15967
+ isInitialEmpty,
15968
+ isSelectDefaultSelection
15969
+ }
15970
+ );
15971
+ return;
15972
+ }
15973
+ } else {
15974
+ const hasPlaceholder = el.hasAttribute("placeholder");
15975
+ const isEmpty = el.value === "";
15976
+ const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
15977
+ const isNonUser = !v2.userTriggered;
15978
+ const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
15979
+ const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
15980
+ const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
15981
+ const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
15982
+ const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
15983
+ const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
15984
+ if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
15985
+ console.debug(
15986
+ `[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
15987
+ {
15988
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
15989
+ node: index.describeNode(el),
15990
+ tag: el.tagName,
15991
+ nodeType: el.nodeType,
15992
+ attribute: el.attributes,
15993
+ value: el.value,
15994
+ isLikelyPhantom,
15995
+ isRenderDrivenTextInput,
15996
+ isValueFromDefault,
15997
+ isPhantomCheckbox,
15998
+ isPhantomRadio
15999
+ }
16000
+ );
16001
+ return;
16002
+ }
15983
16003
  }
15984
16004
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
15985
16005
  lastInputValueMap.set(target, v2);
@@ -18030,8 +18050,15 @@ class NavigationManager {
18030
18050
  handleNavigation(data) {
18031
18051
  if (this.disabled) return;
18032
18052
  if (this.locked) return;
18033
- this.cancelTimers();
18034
- this.disconnectSettlingObserver();
18053
+ if (this.pendingNavigation) {
18054
+ this.cancelTimers();
18055
+ this.disconnectSettlingObserver();
18056
+ this.pendingNavigation = null;
18057
+ this.onSnapshot(true);
18058
+ } else {
18059
+ this.cancelTimers();
18060
+ this.disconnectSettlingObserver();
18061
+ }
18035
18062
  this.pendingNavigation = data;
18036
18063
  if (this.frozen) {
18037
18064
  return;
@@ -18238,7 +18265,7 @@ class ProcessedNodeManager {
18238
18265
  destroy() {
18239
18266
  }
18240
18267
  }
18241
- const version$1 = "3.5.0-alpha.1";
18268
+ const version$1 = "3.10.0-alpha.1";
18242
18269
  let wrappedEmit;
18243
18270
  let takeFullSnapshot$1;
18244
18271
  let canvasManager;
@@ -18287,6 +18314,7 @@ function record(options = {}) {
18287
18314
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
18288
18315
  flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",
18289
18316
  userTriggeredOnInput = false,
18317
+ trustSyntheticInput = false,
18290
18318
  collectFonts = false,
18291
18319
  inlineImages = false,
18292
18320
  plugins,
@@ -18361,6 +18389,11 @@ function record(options = {}) {
18361
18389
  let checkoutPending = false;
18362
18390
  let checkoutDebounceTimer = null;
18363
18391
  let checkoutFreezeTimestamp = null;
18392
+ let lastScrollEmitTime = 0;
18393
+ const scrollSettleTime = (sampling.scroll || 100) * 2;
18394
+ let lastSignificantMutationTime = 0;
18395
+ const mutationGracePeriod = 500;
18396
+ let hadVisibilityCheckoutInGrace = false;
18364
18397
  const eventProcessor = (e2) => {
18365
18398
  for (const plugin3 of plugins || []) {
18366
18399
  if (plugin3.eventProcessor) {
@@ -18451,6 +18484,12 @@ function record(options = {}) {
18451
18484
  }
18452
18485
  };
18453
18486
  const wrappedMutationEmit = (m) => {
18487
+ var _a2, _b2;
18488
+ const totalChanges = (((_a2 = m.adds) == null ? void 0 : _a2.length) ?? 0) + (((_b2 = m.removes) == null ? void 0 : _b2.length) ?? 0);
18489
+ if (totalChanges > 10) {
18490
+ lastSignificantMutationTime = nowTimestamp();
18491
+ hadVisibilityCheckoutInGrace = false;
18492
+ }
18454
18493
  wrappedEmit({
18455
18494
  type: EventType.IncrementalSnapshot,
18456
18495
  data: {
@@ -18468,13 +18507,16 @@ function record(options = {}) {
18468
18507
  }
18469
18508
  });
18470
18509
  };
18471
- const wrappedScrollEmit = (p) => wrappedEmit({
18472
- type: EventType.IncrementalSnapshot,
18473
- data: {
18474
- source: IncrementalSource.Scroll,
18475
- ...p
18476
- }
18477
- });
18510
+ const wrappedScrollEmit = (p) => {
18511
+ lastScrollEmitTime = nowTimestamp();
18512
+ wrappedEmit({
18513
+ type: EventType.IncrementalSnapshot,
18514
+ data: {
18515
+ source: IncrementalSource.Scroll,
18516
+ ...p
18517
+ }
18518
+ });
18519
+ };
18478
18520
  const wrappedCanvasMutationEmit = (p) => wrappedEmit({
18479
18521
  type: EventType.IncrementalSnapshot,
18480
18522
  data: {
@@ -18558,9 +18600,19 @@ function record(options = {}) {
18558
18600
  mutationCb: recordVisibility ? wrappedVisibilityEmit : () => {
18559
18601
  },
18560
18602
  notifyActivity: checkoutEveryNvm != null ? (count) => {
18603
+ const now = nowTimestamp();
18604
+ const scrollRecent = now - lastScrollEmitTime < scrollSettleTime;
18605
+ const mutationRecent = now - lastSignificantMutationTime < mutationGracePeriod;
18606
+ if (scrollRecent && !mutationRecent) {
18607
+ return;
18608
+ }
18609
+ if (mutationRecent && hadVisibilityCheckoutInGrace) {
18610
+ return;
18611
+ }
18561
18612
  visibilityMutationCount += count;
18562
18613
  if (visibilityMutationCount >= checkoutEveryNvm) {
18563
18614
  visibilityMutationCount = 0;
18615
+ hadVisibilityCheckoutInGrace = true;
18564
18616
  if (checkoutDebounce) {
18565
18617
  if (!checkoutPending) {
18566
18618
  checkoutPending = true;
@@ -18802,6 +18854,7 @@ function record(options = {}) {
18802
18854
  recordCanvas,
18803
18855
  inlineImages,
18804
18856
  userTriggeredOnInput,
18857
+ trustSyntheticInput,
18805
18858
  collectFonts,
18806
18859
  doc,
18807
18860
  maskInputFn,
@@ -18878,6 +18931,43 @@ function record(options = {}) {
18878
18931
  );
18879
18932
  }
18880
18933
  return () => {
18934
+ if (recording) {
18935
+ const activeEl = document.activeElement;
18936
+ if (activeEl && INPUT_TAGS.includes(activeEl.tagName)) {
18937
+ const inputEl = activeEl;
18938
+ const id = mirror.getId(inputEl);
18939
+ if (id !== -1) {
18940
+ const lastValue = lastInputValueMap.get(inputEl);
18941
+ let text = inputEl.value;
18942
+ let isChecked = false;
18943
+ const type = getInputType(inputEl) || "";
18944
+ if (type === "radio" || type === "checkbox") {
18945
+ isChecked = inputEl.checked;
18946
+ } else if (maskInputOptions[inputEl.tagName.toLowerCase()] || maskInputOptions[type]) {
18947
+ text = maskInputValue({
18948
+ element: inputEl,
18949
+ maskInputOptions,
18950
+ tagName: inputEl.tagName,
18951
+ type,
18952
+ value: text,
18953
+ maskInputFn
18954
+ });
18955
+ }
18956
+ if (!lastValue || lastValue.text !== text || lastValue.isChecked !== isChecked) {
18957
+ const inputData = userTriggeredOnInput ? { text, isChecked, userTriggered: false } : { text, isChecked };
18958
+ lastInputValueMap.set(inputEl, inputData);
18959
+ wrappedEmit({
18960
+ type: EventType.IncrementalSnapshot,
18961
+ data: {
18962
+ source: IncrementalSource.Input,
18963
+ ...inputData,
18964
+ id
18965
+ }
18966
+ });
18967
+ }
18968
+ }
18969
+ }
18970
+ }
18881
18971
  if (checkoutDebounceTimer) {
18882
18972
  clearTimeout(checkoutDebounceTimer);
18883
18973
  checkoutDebounceTimer = null;
@@ -21809,7 +21899,7 @@ class Replayer {
21809
21899
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
21810
21900
  }
21811
21901
  }
21812
- const version = "3.5.0-alpha.1";
21902
+ const version = "3.10.0-alpha.1";
21813
21903
  const { getVersion } = record;
21814
21904
  const { isRecording } = record;
21815
21905
  const { flushCustomEventQueue } = record;