@appsurify-testmap/rrweb 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.
@@ -16409,7 +16409,8 @@ function initInputObserver({
16409
16409
  maskInputOptions,
16410
16410
  maskInputFn,
16411
16411
  sampling,
16412
- userTriggeredOnInput
16412
+ userTriggeredOnInput,
16413
+ trustSyntheticInput
16413
16414
  }) {
16414
16415
  function eventHandler(event) {
16415
16416
  let target = getEventTarget(event);
@@ -16459,34 +16460,53 @@ function initInputObserver({
16459
16460
  function cbWithDedup(target, v2) {
16460
16461
  const lastInputValue = lastInputValueMap.get(target);
16461
16462
  const el = target;
16462
- const hasPlaceholder = el.hasAttribute("placeholder");
16463
- const isEmpty = el.value === "";
16464
- const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
16465
- const isNonUser = !v2.userTriggered;
16466
- const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
16467
- const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16468
- const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
16469
- const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16470
- const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16471
- const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16472
- if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
16473
- console.debug(
16474
- `[${nowTimestamp()}] [rrweb:record/observer] \u26D4 phantom input ignored`,
16475
- {
16476
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
16477
- node: index.describeNode(el),
16478
- tag: el.tagName,
16479
- nodeType: el.nodeType,
16480
- attribute: el.attributes,
16481
- value: el.value,
16482
- isLikelyPhantom,
16483
- isRenderDrivenTextInput,
16484
- isValueFromDefault,
16485
- isPhantomCheckbox,
16486
- isPhantomRadio
16487
- }
16488
- );
16489
- return;
16463
+ if (trustSyntheticInput) {
16464
+ const isInitialEmpty = !v2.userTriggered && el.value === "" && !v2.isChecked && !lastInputValue;
16465
+ const isSelectDefaultSelection = el.tagName === "SELECT" && !v2.userTriggered && !lastInputValue && el.selectedIndex === 0;
16466
+ if (isInitialEmpty || isSelectDefaultSelection) {
16467
+ console.debug(
16468
+ `[${nowTimestamp()}] [rrweb:record/observer] phantom input ignored (trust mode)`,
16469
+ {
16470
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
16471
+ node: index.describeNode(el),
16472
+ tag: el.tagName,
16473
+ value: el.value,
16474
+ isInitialEmpty,
16475
+ isSelectDefaultSelection
16476
+ }
16477
+ );
16478
+ return;
16479
+ }
16480
+ } else {
16481
+ const hasPlaceholder = el.hasAttribute("placeholder");
16482
+ const isEmpty = el.value === "";
16483
+ const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
16484
+ const isNonUser = !v2.userTriggered;
16485
+ const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
16486
+ const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16487
+ const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
16488
+ const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
16489
+ const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16490
+ const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
16491
+ if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
16492
+ console.debug(
16493
+ `[${nowTimestamp()}] [rrweb:record/observer] \u26D4 phantom input ignored`,
16494
+ {
16495
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
16496
+ node: index.describeNode(el),
16497
+ tag: el.tagName,
16498
+ nodeType: el.nodeType,
16499
+ attribute: el.attributes,
16500
+ value: el.value,
16501
+ isLikelyPhantom,
16502
+ isRenderDrivenTextInput,
16503
+ isValueFromDefault,
16504
+ isPhantomCheckbox,
16505
+ isPhantomRadio
16506
+ }
16507
+ );
16508
+ return;
16509
+ }
16490
16510
  }
16491
16511
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
16492
16512
  lastInputValueMap.set(target, v2);
@@ -18570,8 +18590,15 @@ class NavigationManager {
18570
18590
  return;
18571
18591
  if (this.locked)
18572
18592
  return;
18573
- this.cancelTimers();
18574
- this.disconnectSettlingObserver();
18593
+ if (this.pendingNavigation) {
18594
+ this.cancelTimers();
18595
+ this.disconnectSettlingObserver();
18596
+ this.pendingNavigation = null;
18597
+ this.onSnapshot(true);
18598
+ } else {
18599
+ this.cancelTimers();
18600
+ this.disconnectSettlingObserver();
18601
+ }
18575
18602
  this.pendingNavigation = data;
18576
18603
  if (this.frozen) {
18577
18604
  return;
@@ -18785,7 +18812,7 @@ class ProcessedNodeManager {
18785
18812
  destroy() {
18786
18813
  }
18787
18814
  }
18788
- const version$1 = "3.5.0-alpha.1";
18815
+ const version$1 = "3.10.0-alpha.1";
18789
18816
  let wrappedEmit;
18790
18817
  let takeFullSnapshot$1;
18791
18818
  let canvasManager;
@@ -18834,6 +18861,7 @@ function record(options = {}) {
18834
18861
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
18835
18862
  flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",
18836
18863
  userTriggeredOnInput = false,
18864
+ trustSyntheticInput = false,
18837
18865
  collectFonts = false,
18838
18866
  inlineImages = false,
18839
18867
  plugins,
@@ -18908,6 +18936,11 @@ function record(options = {}) {
18908
18936
  let checkoutPending = false;
18909
18937
  let checkoutDebounceTimer = null;
18910
18938
  let checkoutFreezeTimestamp = null;
18939
+ let lastScrollEmitTime = 0;
18940
+ const scrollSettleTime = (sampling.scroll || 100) * 2;
18941
+ let lastSignificantMutationTime = 0;
18942
+ const mutationGracePeriod = 500;
18943
+ let hadVisibilityCheckoutInGrace = false;
18911
18944
  const eventProcessor = (e2) => {
18912
18945
  for (const plugin3 of plugins || []) {
18913
18946
  if (plugin3.eventProcessor) {
@@ -18998,6 +19031,13 @@ function record(options = {}) {
18998
19031
  }
18999
19032
  };
19000
19033
  const wrappedMutationEmit = (m) => {
19034
+ var _a3, _b2;
19035
+ var _a2, _b;
19036
+ const totalChanges = ((_a3 = (_a2 = m.adds) == null ? void 0 : _a2.length) != null ? _a3 : 0) + ((_b2 = (_b = m.removes) == null ? void 0 : _b.length) != null ? _b2 : 0);
19037
+ if (totalChanges > 10) {
19038
+ lastSignificantMutationTime = nowTimestamp();
19039
+ hadVisibilityCheckoutInGrace = false;
19040
+ }
19001
19041
  wrappedEmit({
19002
19042
  type: EventType.IncrementalSnapshot,
19003
19043
  data: __spreadValues({
@@ -19013,12 +19053,15 @@ function record(options = {}) {
19013
19053
  }, v2)
19014
19054
  });
19015
19055
  };
19016
- const wrappedScrollEmit = (p) => wrappedEmit({
19017
- type: EventType.IncrementalSnapshot,
19018
- data: __spreadValues({
19019
- source: IncrementalSource.Scroll
19020
- }, p)
19021
- });
19056
+ const wrappedScrollEmit = (p) => {
19057
+ lastScrollEmitTime = nowTimestamp();
19058
+ wrappedEmit({
19059
+ type: EventType.IncrementalSnapshot,
19060
+ data: __spreadValues({
19061
+ source: IncrementalSource.Scroll
19062
+ }, p)
19063
+ });
19064
+ };
19022
19065
  const wrappedCanvasMutationEmit = (p) => wrappedEmit({
19023
19066
  type: EventType.IncrementalSnapshot,
19024
19067
  data: __spreadValues({
@@ -19100,9 +19143,19 @@ function record(options = {}) {
19100
19143
  mutationCb: recordVisibility ? wrappedVisibilityEmit : () => {
19101
19144
  },
19102
19145
  notifyActivity: checkoutEveryNvm != null ? (count) => {
19146
+ const now = nowTimestamp();
19147
+ const scrollRecent = now - lastScrollEmitTime < scrollSettleTime;
19148
+ const mutationRecent = now - lastSignificantMutationTime < mutationGracePeriod;
19149
+ if (scrollRecent && !mutationRecent) {
19150
+ return;
19151
+ }
19152
+ if (mutationRecent && hadVisibilityCheckoutInGrace) {
19153
+ return;
19154
+ }
19103
19155
  visibilityMutationCount += count;
19104
19156
  if (visibilityMutationCount >= checkoutEveryNvm) {
19105
19157
  visibilityMutationCount = 0;
19158
+ hadVisibilityCheckoutInGrace = true;
19106
19159
  if (checkoutDebounce) {
19107
19160
  if (!checkoutPending) {
19108
19161
  checkoutPending = true;
@@ -19335,6 +19388,7 @@ function record(options = {}) {
19335
19388
  recordCanvas,
19336
19389
  inlineImages,
19337
19390
  userTriggeredOnInput,
19391
+ trustSyntheticInput,
19338
19392
  collectFonts,
19339
19393
  doc,
19340
19394
  maskInputFn,
@@ -19413,6 +19467,43 @@ function record(options = {}) {
19413
19467
  );
19414
19468
  }
19415
19469
  return () => {
19470
+ if (recording) {
19471
+ const activeEl = document.activeElement;
19472
+ if (activeEl && INPUT_TAGS.includes(activeEl.tagName)) {
19473
+ const inputEl = activeEl;
19474
+ const id = mirror.getId(inputEl);
19475
+ if (id !== -1) {
19476
+ const lastValue = lastInputValueMap.get(inputEl);
19477
+ let text = inputEl.value;
19478
+ let isChecked = false;
19479
+ const type = getInputType(inputEl) || "";
19480
+ if (type === "radio" || type === "checkbox") {
19481
+ isChecked = inputEl.checked;
19482
+ } else if (maskInputOptions[inputEl.tagName.toLowerCase()] || maskInputOptions[type]) {
19483
+ text = maskInputValue({
19484
+ element: inputEl,
19485
+ maskInputOptions,
19486
+ tagName: inputEl.tagName,
19487
+ type,
19488
+ value: text,
19489
+ maskInputFn
19490
+ });
19491
+ }
19492
+ if (!lastValue || lastValue.text !== text || lastValue.isChecked !== isChecked) {
19493
+ const inputData = userTriggeredOnInput ? { text, isChecked, userTriggered: false } : { text, isChecked };
19494
+ lastInputValueMap.set(inputEl, inputData);
19495
+ wrappedEmit({
19496
+ type: EventType.IncrementalSnapshot,
19497
+ data: __spreadProps(__spreadValues({
19498
+ source: IncrementalSource.Input
19499
+ }, inputData), {
19500
+ id
19501
+ })
19502
+ });
19503
+ }
19504
+ }
19505
+ }
19506
+ }
19416
19507
  if (checkoutDebounceTimer) {
19417
19508
  clearTimeout(checkoutDebounceTimer);
19418
19509
  checkoutDebounceTimer = null;
@@ -22384,7 +22475,7 @@ class Replayer {
22384
22475
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
22385
22476
  }
22386
22477
  }
22387
- const version = "3.5.0-alpha.1";
22478
+ const version = "3.10.0-alpha.1";
22388
22479
  const { getVersion } = record;
22389
22480
  const { isRecording } = record;
22390
22481
  const { flushCustomEventQueue } = record;