@appsurify-testmap/rrweb-record 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.
- package/dist/rrweb-record.cjs +129 -39
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +129 -39
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +129 -38
- package/dist/rrweb-record.umd.cjs.map +3 -3
- package/dist/rrweb-record.umd.min.cjs +34 -34
- package/dist/rrweb-record.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-record.cjs
CHANGED
|
@@ -13903,7 +13903,8 @@ function initInputObserver({
|
|
|
13903
13903
|
maskInputOptions,
|
|
13904
13904
|
maskInputFn,
|
|
13905
13905
|
sampling,
|
|
13906
|
-
userTriggeredOnInput
|
|
13906
|
+
userTriggeredOnInput,
|
|
13907
|
+
trustSyntheticInput
|
|
13907
13908
|
}) {
|
|
13908
13909
|
function eventHandler(event) {
|
|
13909
13910
|
let target = getEventTarget(event);
|
|
@@ -13953,34 +13954,53 @@ function initInputObserver({
|
|
|
13953
13954
|
function cbWithDedup(target, v2) {
|
|
13954
13955
|
const lastInputValue = lastInputValueMap.get(target);
|
|
13955
13956
|
const el = target;
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13957
|
+
if (trustSyntheticInput) {
|
|
13958
|
+
const isInitialEmpty = !v2.userTriggered && el.value === "" && !v2.isChecked && !lastInputValue;
|
|
13959
|
+
const isSelectDefaultSelection = el.tagName === "SELECT" && !v2.userTriggered && !lastInputValue && el.selectedIndex === 0;
|
|
13960
|
+
if (isInitialEmpty || isSelectDefaultSelection) {
|
|
13961
|
+
console.debug(
|
|
13962
|
+
`[${nowTimestamp()}] [rrweb:record/observer] phantom input ignored (trust mode)`,
|
|
13963
|
+
{
|
|
13964
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
|
13965
|
+
node: index.describeNode(el),
|
|
13966
|
+
tag: el.tagName,
|
|
13967
|
+
value: el.value,
|
|
13968
|
+
isInitialEmpty,
|
|
13969
|
+
isSelectDefaultSelection
|
|
13970
|
+
}
|
|
13971
|
+
);
|
|
13972
|
+
return;
|
|
13973
|
+
}
|
|
13974
|
+
} else {
|
|
13975
|
+
const hasPlaceholder = el.hasAttribute("placeholder");
|
|
13976
|
+
const isEmpty = el.value === "";
|
|
13977
|
+
const isDefaultEmpty = typeof el.defaultValue === "string" ? el.defaultValue === "" : true;
|
|
13978
|
+
const isNonUser = !v2.userTriggered;
|
|
13979
|
+
const isRepeatEmpty = !lastInputValue || lastInputValue.text === "";
|
|
13980
|
+
const isLikelyPhantom = hasPlaceholder && isEmpty && isDefaultEmpty && isRepeatEmpty && isNonUser && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
|
|
13981
|
+
const isRenderDrivenTextInput = el.tagName === "INPUT" && el.type === "text" && !v2.userTriggered && v2.text === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder");
|
|
13982
|
+
const isValueFromDefault = !v2.userTriggered && el.value === el.defaultValue && !lastInputValue && el.hasAttribute("placeholder") && !v2.isChecked && el.type !== "hidden" && INPUT_TAGS.includes(el.tagName);
|
|
13983
|
+
const isPhantomCheckbox = el.type === "checkbox" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
|
|
13984
|
+
const isPhantomRadio = el.type === "radio" && !v2.userTriggered && !v2.isChecked && !lastInputValue;
|
|
13985
|
+
if (isLikelyPhantom || isRenderDrivenTextInput || isValueFromDefault || isPhantomCheckbox || isPhantomRadio) {
|
|
13986
|
+
console.debug(
|
|
13987
|
+
`[${nowTimestamp()}] [rrweb:record/observer] ⛔ phantom input ignored`,
|
|
13988
|
+
{
|
|
13989
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
|
13990
|
+
node: index.describeNode(el),
|
|
13991
|
+
tag: el.tagName,
|
|
13992
|
+
nodeType: el.nodeType,
|
|
13993
|
+
attribute: el.attributes,
|
|
13994
|
+
value: el.value,
|
|
13995
|
+
isLikelyPhantom,
|
|
13996
|
+
isRenderDrivenTextInput,
|
|
13997
|
+
isValueFromDefault,
|
|
13998
|
+
isPhantomCheckbox,
|
|
13999
|
+
isPhantomRadio
|
|
14000
|
+
}
|
|
14001
|
+
);
|
|
14002
|
+
return;
|
|
14003
|
+
}
|
|
13984
14004
|
}
|
|
13985
14005
|
if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
|
|
13986
14006
|
lastInputValueMap.set(target, v2);
|
|
@@ -16011,8 +16031,15 @@ class NavigationManager {
|
|
|
16011
16031
|
handleNavigation(data) {
|
|
16012
16032
|
if (this.disabled) return;
|
|
16013
16033
|
if (this.locked) return;
|
|
16014
|
-
this.
|
|
16015
|
-
|
|
16034
|
+
if (this.pendingNavigation) {
|
|
16035
|
+
this.cancelTimers();
|
|
16036
|
+
this.disconnectSettlingObserver();
|
|
16037
|
+
this.pendingNavigation = null;
|
|
16038
|
+
this.onSnapshot(true);
|
|
16039
|
+
} else {
|
|
16040
|
+
this.cancelTimers();
|
|
16041
|
+
this.disconnectSettlingObserver();
|
|
16042
|
+
}
|
|
16016
16043
|
this.pendingNavigation = data;
|
|
16017
16044
|
if (this.frozen) {
|
|
16018
16045
|
return;
|
|
@@ -16219,7 +16246,7 @@ class ProcessedNodeManager {
|
|
|
16219
16246
|
destroy() {
|
|
16220
16247
|
}
|
|
16221
16248
|
}
|
|
16222
|
-
const version$1 = "3.
|
|
16249
|
+
const version$1 = "3.10.0-alpha.1";
|
|
16223
16250
|
let wrappedEmit;
|
|
16224
16251
|
let takeFullSnapshot$1;
|
|
16225
16252
|
let canvasManager;
|
|
@@ -16268,6 +16295,7 @@ function record(options = {}) {
|
|
|
16268
16295
|
recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
|
|
16269
16296
|
flushCustomEvent = options.flushCustomEvent !== void 0 ? options.flushCustomEvent : "after",
|
|
16270
16297
|
userTriggeredOnInput = false,
|
|
16298
|
+
trustSyntheticInput = false,
|
|
16271
16299
|
collectFonts = false,
|
|
16272
16300
|
inlineImages = false,
|
|
16273
16301
|
plugins,
|
|
@@ -16342,6 +16370,11 @@ function record(options = {}) {
|
|
|
16342
16370
|
let checkoutPending = false;
|
|
16343
16371
|
let checkoutDebounceTimer = null;
|
|
16344
16372
|
let checkoutFreezeTimestamp = null;
|
|
16373
|
+
let lastScrollEmitTime = 0;
|
|
16374
|
+
const scrollSettleTime = (sampling.scroll || 100) * 2;
|
|
16375
|
+
let lastSignificantMutationTime = 0;
|
|
16376
|
+
const mutationGracePeriod = 500;
|
|
16377
|
+
let hadVisibilityCheckoutInGrace = false;
|
|
16345
16378
|
const eventProcessor = (e2) => {
|
|
16346
16379
|
for (const plugin3 of plugins || []) {
|
|
16347
16380
|
if (plugin3.eventProcessor) {
|
|
@@ -16432,6 +16465,12 @@ function record(options = {}) {
|
|
|
16432
16465
|
}
|
|
16433
16466
|
};
|
|
16434
16467
|
const wrappedMutationEmit = (m) => {
|
|
16468
|
+
var _a2, _b;
|
|
16469
|
+
const totalChanges = (((_a2 = m.adds) == null ? void 0 : _a2.length) ?? 0) + (((_b = m.removes) == null ? void 0 : _b.length) ?? 0);
|
|
16470
|
+
if (totalChanges > 10) {
|
|
16471
|
+
lastSignificantMutationTime = nowTimestamp();
|
|
16472
|
+
hadVisibilityCheckoutInGrace = false;
|
|
16473
|
+
}
|
|
16435
16474
|
wrappedEmit({
|
|
16436
16475
|
type: EventType.IncrementalSnapshot,
|
|
16437
16476
|
data: {
|
|
@@ -16449,13 +16488,16 @@ function record(options = {}) {
|
|
|
16449
16488
|
}
|
|
16450
16489
|
});
|
|
16451
16490
|
};
|
|
16452
|
-
const wrappedScrollEmit = (p) =>
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16491
|
+
const wrappedScrollEmit = (p) => {
|
|
16492
|
+
lastScrollEmitTime = nowTimestamp();
|
|
16493
|
+
wrappedEmit({
|
|
16494
|
+
type: EventType.IncrementalSnapshot,
|
|
16495
|
+
data: {
|
|
16496
|
+
source: IncrementalSource.Scroll,
|
|
16497
|
+
...p
|
|
16498
|
+
}
|
|
16499
|
+
});
|
|
16500
|
+
};
|
|
16459
16501
|
const wrappedCanvasMutationEmit = (p) => wrappedEmit({
|
|
16460
16502
|
type: EventType.IncrementalSnapshot,
|
|
16461
16503
|
data: {
|
|
@@ -16539,9 +16581,19 @@ function record(options = {}) {
|
|
|
16539
16581
|
mutationCb: recordVisibility ? wrappedVisibilityEmit : () => {
|
|
16540
16582
|
},
|
|
16541
16583
|
notifyActivity: checkoutEveryNvm != null ? (count) => {
|
|
16584
|
+
const now = nowTimestamp();
|
|
16585
|
+
const scrollRecent = now - lastScrollEmitTime < scrollSettleTime;
|
|
16586
|
+
const mutationRecent = now - lastSignificantMutationTime < mutationGracePeriod;
|
|
16587
|
+
if (scrollRecent && !mutationRecent) {
|
|
16588
|
+
return;
|
|
16589
|
+
}
|
|
16590
|
+
if (mutationRecent && hadVisibilityCheckoutInGrace) {
|
|
16591
|
+
return;
|
|
16592
|
+
}
|
|
16542
16593
|
visibilityMutationCount += count;
|
|
16543
16594
|
if (visibilityMutationCount >= checkoutEveryNvm) {
|
|
16544
16595
|
visibilityMutationCount = 0;
|
|
16596
|
+
hadVisibilityCheckoutInGrace = true;
|
|
16545
16597
|
if (checkoutDebounce) {
|
|
16546
16598
|
if (!checkoutPending) {
|
|
16547
16599
|
checkoutPending = true;
|
|
@@ -16783,6 +16835,7 @@ function record(options = {}) {
|
|
|
16783
16835
|
recordCanvas,
|
|
16784
16836
|
inlineImages,
|
|
16785
16837
|
userTriggeredOnInput,
|
|
16838
|
+
trustSyntheticInput,
|
|
16786
16839
|
collectFonts,
|
|
16787
16840
|
doc,
|
|
16788
16841
|
maskInputFn,
|
|
@@ -16859,6 +16912,43 @@ function record(options = {}) {
|
|
|
16859
16912
|
);
|
|
16860
16913
|
}
|
|
16861
16914
|
return () => {
|
|
16915
|
+
if (recording) {
|
|
16916
|
+
const activeEl = document.activeElement;
|
|
16917
|
+
if (activeEl && INPUT_TAGS.includes(activeEl.tagName)) {
|
|
16918
|
+
const inputEl = activeEl;
|
|
16919
|
+
const id = mirror.getId(inputEl);
|
|
16920
|
+
if (id !== -1) {
|
|
16921
|
+
const lastValue = lastInputValueMap.get(inputEl);
|
|
16922
|
+
let text = inputEl.value;
|
|
16923
|
+
let isChecked = false;
|
|
16924
|
+
const type = getInputType(inputEl) || "";
|
|
16925
|
+
if (type === "radio" || type === "checkbox") {
|
|
16926
|
+
isChecked = inputEl.checked;
|
|
16927
|
+
} else if (maskInputOptions[inputEl.tagName.toLowerCase()] || maskInputOptions[type]) {
|
|
16928
|
+
text = maskInputValue({
|
|
16929
|
+
element: inputEl,
|
|
16930
|
+
maskInputOptions,
|
|
16931
|
+
tagName: inputEl.tagName,
|
|
16932
|
+
type,
|
|
16933
|
+
value: text,
|
|
16934
|
+
maskInputFn
|
|
16935
|
+
});
|
|
16936
|
+
}
|
|
16937
|
+
if (!lastValue || lastValue.text !== text || lastValue.isChecked !== isChecked) {
|
|
16938
|
+
const inputData = userTriggeredOnInput ? { text, isChecked, userTriggered: false } : { text, isChecked };
|
|
16939
|
+
lastInputValueMap.set(inputEl, inputData);
|
|
16940
|
+
wrappedEmit({
|
|
16941
|
+
type: EventType.IncrementalSnapshot,
|
|
16942
|
+
data: {
|
|
16943
|
+
source: IncrementalSource.Input,
|
|
16944
|
+
...inputData,
|
|
16945
|
+
id
|
|
16946
|
+
}
|
|
16947
|
+
});
|
|
16948
|
+
}
|
|
16949
|
+
}
|
|
16950
|
+
}
|
|
16951
|
+
}
|
|
16862
16952
|
if (checkoutDebounceTimer) {
|
|
16863
16953
|
clearTimeout(checkoutDebounceTimer);
|
|
16864
16954
|
checkoutDebounceTimer = null;
|