@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.
@@ -14367,7 +14367,8 @@ function initInputObserver({
14367
14367
  maskInputOptions,
14368
14368
  maskInputFn,
14369
14369
  sampling,
14370
- userTriggeredOnInput
14370
+ userTriggeredOnInput,
14371
+ trustSyntheticInput
14371
14372
  }) {
14372
14373
  function eventHandler(event) {
14373
14374
  let target = getEventTarget(event);
@@ -14417,34 +14418,53 @@ function initInputObserver({
14417
14418
  function cbWithDedup(target, v2) {
14418
14419
  const lastInputValue = lastInputValueMap.get(target);
14419
14420
  const el = target;
14420
- const hasPlaceholder = el.hasAttribute("placeholder");
14421
- const isEmpty = el.value === "";
14422
- const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
14423
- const isNonUser = !v2.userTriggered;
14424
- const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
14425
- const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
14426
- const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
14427
- const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
14428
- const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
14429
- const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
14430
- if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
14431
- console.debug(
14432
- `[${nowTimestamp()}] [rrweb:record/observer] \u26D4 phantom input ignored`,
14433
- {
14434
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
14435
- node: index.describeNode(el),
14436
- tag: el.tagName,
14437
- nodeType: el.nodeType,
14438
- attribute: el.attributes,
14439
- value: el.value,
14440
- isLikelyPhantom,
14441
- isRenderDrivenTextInput,
14442
- isValueFromDefault,
14443
- isPhantomCheckbox,
14444
- isPhantomRadio
14445
- }
14446
- );
14447
- return;
14421
+ if (trustSyntheticInput) {
14422
+ const isInitialEmpty = !v2.userTriggered && el.value === "" && !v2.isChecked && !lastInputValue;
14423
+ const isSelectDefaultSelection = el.tagName === "SELECT" && !v2.userTriggered && !lastInputValue && el.selectedIndex === 0;
14424
+ if (isInitialEmpty || isSelectDefaultSelection) {
14425
+ console.debug(
14426
+ `[${nowTimestamp()}] [rrweb:record/observer] phantom input ignored (trust mode)`,
14427
+ {
14428
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
14429
+ node: index.describeNode(el),
14430
+ tag: el.tagName,
14431
+ value: el.value,
14432
+ isInitialEmpty,
14433
+ isSelectDefaultSelection
14434
+ }
14435
+ );
14436
+ return;
14437
+ }
14438
+ } else {
14439
+ const hasPlaceholder = el.hasAttribute("placeholder");
14440
+ const isEmpty = el.value === "";
14441
+ const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
14442
+ const isNonUser = !v2.userTriggered;
14443
+ const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
14444
+ const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
14445
+ const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
14446
+ const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
14447
+ const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
14448
+ const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
14449
+ if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
14450
+ console.debug(
14451
+ `[${nowTimestamp()}] [rrweb:record/observer] \u26D4 phantom input ignored`,
14452
+ {
14453
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
14454
+ node: index.describeNode(el),
14455
+ tag: el.tagName,
14456
+ nodeType: el.nodeType,
14457
+ attribute: el.attributes,
14458
+ value: el.value,
14459
+ isLikelyPhantom,
14460
+ isRenderDrivenTextInput,
14461
+ isValueFromDefault,
14462
+ isPhantomCheckbox,
14463
+ isPhantomRadio
14464
+ }
14465
+ );
14466
+ return;
14467
+ }
14448
14468
  }
14449
14469
  if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
14450
14470
  lastInputValueMap.set(target, v2);
@@ -16508,8 +16528,15 @@ class NavigationManager {
16508
16528
  return;
16509
16529
  if (this.locked)
16510
16530
  return;
16511
- this.cancelTimers();
16512
- this.disconnectSettlingObserver();
16531
+ if (this.pendingNavigation) {
16532
+ this.cancelTimers();
16533
+ this.disconnectSettlingObserver();
16534
+ this.pendingNavigation = null;
16535
+ this.onSnapshot(true);
16536
+ } else {
16537
+ this.cancelTimers();
16538
+ this.disconnectSettlingObserver();
16539
+ }
16513
16540
  this.pendingNavigation = data;
16514
16541
  if (this.frozen) {
16515
16542
  return;
@@ -16723,7 +16750,7 @@ class ProcessedNodeManager {
16723
16750
  destroy() {
16724
16751
  }
16725
16752
  }
16726
- const version$1 = "3.6.0-alpha.1";
16753
+ const version$1 = "3.10.0-alpha.1";
16727
16754
  let wrappedEmit;
16728
16755
  let takeFullSnapshot$1;
16729
16756
  let canvasManager;
@@ -16772,6 +16799,7 @@ function record(options = {}) {
16772
16799
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
16773
16800
  flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",
16774
16801
  userTriggeredOnInput = false,
16802
+ trustSyntheticInput = false,
16775
16803
  collectFonts = false,
16776
16804
  inlineImages = false,
16777
16805
  plugins,
@@ -17298,6 +17326,7 @@ function record(options = {}) {
17298
17326
  recordCanvas,
17299
17327
  inlineImages,
17300
17328
  userTriggeredOnInput,
17329
+ trustSyntheticInput,
17301
17330
  collectFonts,
17302
17331
  doc,
17303
17332
  maskInputFn,
@@ -17376,6 +17405,43 @@ function record(options = {}) {
17376
17405
  );
17377
17406
  }
17378
17407
  return () => {
17408
+ if (recording) {
17409
+ const activeEl = document.activeElement;
17410
+ if (activeEl && INPUT_TAGS.includes(activeEl.tagName)) {
17411
+ const inputEl = activeEl;
17412
+ const id = mirror.getId(inputEl);
17413
+ if (id !== -1) {
17414
+ const lastValue = lastInputValueMap.get(inputEl);
17415
+ let text = inputEl.value;
17416
+ let isChecked = false;
17417
+ const type = getInputType(inputEl) || "";
17418
+ if (type === "radio" || type === "checkbox") {
17419
+ isChecked = inputEl.checked;
17420
+ } else if (maskInputOptions[inputEl.tagName.toLowerCase()] || maskInputOptions[type]) {
17421
+ text = maskInputValue({
17422
+ element: inputEl,
17423
+ maskInputOptions,
17424
+ tagName: inputEl.tagName,
17425
+ type,
17426
+ value: text,
17427
+ maskInputFn
17428
+ });
17429
+ }
17430
+ if (!lastValue || lastValue.text !== text || lastValue.isChecked !== isChecked) {
17431
+ const inputData = userTriggeredOnInput ? { text, isChecked, userTriggered: false } : { text, isChecked };
17432
+ lastInputValueMap.set(inputEl, inputData);
17433
+ wrappedEmit({
17434
+ type: EventType.IncrementalSnapshot,
17435
+ data: __spreadProps(__spreadValues({
17436
+ source: IncrementalSource.Input
17437
+ }, inputData), {
17438
+ id
17439
+ })
17440
+ });
17441
+ }
17442
+ }
17443
+ }
17444
+ }
17379
17445
  if (checkoutDebounceTimer) {
17380
17446
  clearTimeout(checkoutDebounceTimer);
17381
17447
  checkoutDebounceTimer = null;