@appsurify-testmap/rrweb-all 3.2.0-alpha.1 → 3.4.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-all.cjs +220 -57
- package/dist/rrweb-all.cjs.map +1 -1
- package/dist/rrweb-all.js +220 -57
- package/dist/rrweb-all.js.map +1 -1
- package/dist/rrweb-all.umd.cjs +227 -57
- package/dist/rrweb-all.umd.cjs.map +3 -3
- package/dist/rrweb-all.umd.min.cjs +44 -44
- package/dist/rrweb-all.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-all.cjs
CHANGED
|
@@ -15859,6 +15859,30 @@ function initNavigationObserver({
|
|
|
15859
15859
|
handlers.push(restoreReplaceState);
|
|
15860
15860
|
handlers.push(on("popstate", () => emitNavigation("popstate"), win));
|
|
15861
15861
|
handlers.push(on("hashchange", () => emitNavigation("hashchange"), win));
|
|
15862
|
+
const useNavigationAPI = typeof sampling.navigation === "object" ? sampling.navigation.useNavigationAPI ?? true : true;
|
|
15863
|
+
if (useNavigationAPI && "navigation" in win) {
|
|
15864
|
+
try {
|
|
15865
|
+
const nav = win.navigation;
|
|
15866
|
+
const handler = (event) => {
|
|
15867
|
+
var _a2;
|
|
15868
|
+
const navEvent = event;
|
|
15869
|
+
if (navEvent.navigationType === "push" || navEvent.navigationType === "replace") {
|
|
15870
|
+
const destUrl = (_a2 = navEvent.destination) == null ? void 0 : _a2.url;
|
|
15871
|
+
if (destUrl && destUrl !== lastHref) {
|
|
15872
|
+
navigationCb({
|
|
15873
|
+
href: destUrl,
|
|
15874
|
+
oldHref: lastHref,
|
|
15875
|
+
navigationType: "navigate"
|
|
15876
|
+
});
|
|
15877
|
+
lastHref = destUrl;
|
|
15878
|
+
}
|
|
15879
|
+
}
|
|
15880
|
+
};
|
|
15881
|
+
nav.addEventListener("navigate", handler);
|
|
15882
|
+
handlers.push(() => nav.removeEventListener("navigate", handler));
|
|
15883
|
+
} catch {
|
|
15884
|
+
}
|
|
15885
|
+
}
|
|
15862
15886
|
return callbackWrapper(() => {
|
|
15863
15887
|
handlers.forEach((h) => h());
|
|
15864
15888
|
});
|
|
@@ -17977,6 +18001,162 @@ class VisibilityManager {
|
|
|
17977
18001
|
}
|
|
17978
18002
|
}
|
|
17979
18003
|
}
|
|
18004
|
+
const DEFAULT_SETTLE_TIMEOUT = 150;
|
|
18005
|
+
const DEFAULT_MAX_WAIT = 5e3;
|
|
18006
|
+
const DEFAULT_DEBOUNCE = 100;
|
|
18007
|
+
class NavigationManager {
|
|
18008
|
+
constructor(options) {
|
|
18009
|
+
__publicField(this, "frozen", false);
|
|
18010
|
+
__publicField(this, "locked", false);
|
|
18011
|
+
__publicField(this, "disabled", false);
|
|
18012
|
+
__publicField(this, "settleTimeout");
|
|
18013
|
+
__publicField(this, "maxWait");
|
|
18014
|
+
__publicField(this, "debounceMs");
|
|
18015
|
+
__publicField(this, "settlingObserver", null);
|
|
18016
|
+
__publicField(this, "debounceTimer", null);
|
|
18017
|
+
__publicField(this, "settleCheckTimer", null);
|
|
18018
|
+
__publicField(this, "maxWaitTimer", null);
|
|
18019
|
+
__publicField(this, "lastMutationTime", 0);
|
|
18020
|
+
__publicField(this, "pendingNavigation", null);
|
|
18021
|
+
__publicField(this, "doc");
|
|
18022
|
+
__publicField(this, "onSnapshot");
|
|
18023
|
+
const { doc, config, onSnapshot } = options;
|
|
18024
|
+
this.doc = doc;
|
|
18025
|
+
this.onSnapshot = callbackWrapper(onSnapshot);
|
|
18026
|
+
this.settleTimeout = config.settleTimeout ?? DEFAULT_SETTLE_TIMEOUT;
|
|
18027
|
+
this.maxWait = config.maxWait ?? DEFAULT_MAX_WAIT;
|
|
18028
|
+
this.debounceMs = config.debounce ?? DEFAULT_DEBOUNCE;
|
|
18029
|
+
}
|
|
18030
|
+
handleNavigation(data) {
|
|
18031
|
+
if (this.disabled) return;
|
|
18032
|
+
if (this.locked) return;
|
|
18033
|
+
this.cancelTimers();
|
|
18034
|
+
this.disconnectSettlingObserver();
|
|
18035
|
+
this.pendingNavigation = data;
|
|
18036
|
+
if (this.frozen) {
|
|
18037
|
+
return;
|
|
18038
|
+
}
|
|
18039
|
+
this.startDebounce();
|
|
18040
|
+
}
|
|
18041
|
+
cancelPending() {
|
|
18042
|
+
this.cancelTimers();
|
|
18043
|
+
this.disconnectSettlingObserver();
|
|
18044
|
+
this.pendingNavigation = null;
|
|
18045
|
+
}
|
|
18046
|
+
freeze() {
|
|
18047
|
+
this.frozen = true;
|
|
18048
|
+
this.cancelTimers();
|
|
18049
|
+
this.disconnectSettlingObserver();
|
|
18050
|
+
}
|
|
18051
|
+
unfreeze() {
|
|
18052
|
+
this.frozen = false;
|
|
18053
|
+
if (this.pendingNavigation && !this.locked && !this.disabled) {
|
|
18054
|
+
this.startDebounce();
|
|
18055
|
+
}
|
|
18056
|
+
}
|
|
18057
|
+
lock() {
|
|
18058
|
+
this.locked = true;
|
|
18059
|
+
this.cancelTimers();
|
|
18060
|
+
this.disconnectSettlingObserver();
|
|
18061
|
+
}
|
|
18062
|
+
unlock() {
|
|
18063
|
+
this.locked = false;
|
|
18064
|
+
this.pendingNavigation = null;
|
|
18065
|
+
}
|
|
18066
|
+
unsetFrozen() {
|
|
18067
|
+
this.frozen = false;
|
|
18068
|
+
}
|
|
18069
|
+
reset() {
|
|
18070
|
+
this.cancelTimers();
|
|
18071
|
+
this.disconnectSettlingObserver();
|
|
18072
|
+
this.pendingNavigation = null;
|
|
18073
|
+
this.frozen = false;
|
|
18074
|
+
this.locked = false;
|
|
18075
|
+
}
|
|
18076
|
+
destroy() {
|
|
18077
|
+
const hadPending = this.pendingNavigation !== null;
|
|
18078
|
+
this.reset();
|
|
18079
|
+
this.disabled = true;
|
|
18080
|
+
if (hadPending) {
|
|
18081
|
+
this.onSnapshot(true);
|
|
18082
|
+
}
|
|
18083
|
+
}
|
|
18084
|
+
startDebounce() {
|
|
18085
|
+
this.debounceTimer = setTimeout(() => {
|
|
18086
|
+
this.debounceTimer = null;
|
|
18087
|
+
this.startDOMSettling();
|
|
18088
|
+
}, this.debounceMs);
|
|
18089
|
+
}
|
|
18090
|
+
startDOMSettling() {
|
|
18091
|
+
if (this.frozen || this.locked || this.disabled) return;
|
|
18092
|
+
this.lastMutationTime = performance.now();
|
|
18093
|
+
const ObserverCtor = mutationObserverCtor();
|
|
18094
|
+
this.settlingObserver = new ObserverCtor(() => {
|
|
18095
|
+
this.lastMutationTime = performance.now();
|
|
18096
|
+
if (this.settleCheckTimer !== null) {
|
|
18097
|
+
clearTimeout(this.settleCheckTimer);
|
|
18098
|
+
}
|
|
18099
|
+
this.settleCheckTimer = setTimeout(
|
|
18100
|
+
() => this.checkSettled(),
|
|
18101
|
+
this.settleTimeout
|
|
18102
|
+
);
|
|
18103
|
+
});
|
|
18104
|
+
this.settlingObserver.observe(this.doc, {
|
|
18105
|
+
childList: true,
|
|
18106
|
+
subtree: true,
|
|
18107
|
+
attributes: true,
|
|
18108
|
+
characterData: true
|
|
18109
|
+
});
|
|
18110
|
+
this.settleCheckTimer = setTimeout(
|
|
18111
|
+
() => this.checkSettled(),
|
|
18112
|
+
this.settleTimeout
|
|
18113
|
+
);
|
|
18114
|
+
this.maxWaitTimer = setTimeout(() => {
|
|
18115
|
+
this.maxWaitTimer = null;
|
|
18116
|
+
this.completeSettling();
|
|
18117
|
+
}, this.maxWait);
|
|
18118
|
+
}
|
|
18119
|
+
checkSettled() {
|
|
18120
|
+
this.settleCheckTimer = null;
|
|
18121
|
+
const elapsed = performance.now() - this.lastMutationTime;
|
|
18122
|
+
if (elapsed >= this.settleTimeout) {
|
|
18123
|
+
this.completeSettling();
|
|
18124
|
+
} else {
|
|
18125
|
+
this.settleCheckTimer = setTimeout(
|
|
18126
|
+
() => this.checkSettled(),
|
|
18127
|
+
this.settleTimeout - elapsed
|
|
18128
|
+
);
|
|
18129
|
+
}
|
|
18130
|
+
}
|
|
18131
|
+
completeSettling() {
|
|
18132
|
+
if (this.frozen || this.locked || this.disabled) return;
|
|
18133
|
+
if (!this.pendingNavigation) return;
|
|
18134
|
+
this.cancelTimers();
|
|
18135
|
+
this.disconnectSettlingObserver();
|
|
18136
|
+
this.pendingNavigation = null;
|
|
18137
|
+
this.onSnapshot(true);
|
|
18138
|
+
}
|
|
18139
|
+
cancelTimers() {
|
|
18140
|
+
if (this.debounceTimer !== null) {
|
|
18141
|
+
clearTimeout(this.debounceTimer);
|
|
18142
|
+
this.debounceTimer = null;
|
|
18143
|
+
}
|
|
18144
|
+
if (this.settleCheckTimer !== null) {
|
|
18145
|
+
clearTimeout(this.settleCheckTimer);
|
|
18146
|
+
this.settleCheckTimer = null;
|
|
18147
|
+
}
|
|
18148
|
+
if (this.maxWaitTimer !== null) {
|
|
18149
|
+
clearTimeout(this.maxWaitTimer);
|
|
18150
|
+
this.maxWaitTimer = null;
|
|
18151
|
+
}
|
|
18152
|
+
}
|
|
18153
|
+
disconnectSettlingObserver() {
|
|
18154
|
+
if (this.settlingObserver) {
|
|
18155
|
+
this.settlingObserver.disconnect();
|
|
18156
|
+
this.settlingObserver = null;
|
|
18157
|
+
}
|
|
18158
|
+
}
|
|
18159
|
+
}
|
|
17980
18160
|
class StylesheetManager {
|
|
17981
18161
|
constructor(options) {
|
|
17982
18162
|
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
@@ -18060,43 +18240,13 @@ class ProcessedNodeManager {
|
|
|
18060
18240
|
destroy() {
|
|
18061
18241
|
}
|
|
18062
18242
|
}
|
|
18063
|
-
const version$1 = "3.
|
|
18243
|
+
const version$1 = "3.4.0-alpha.1";
|
|
18064
18244
|
let wrappedEmit;
|
|
18065
18245
|
let takeFullSnapshot$1;
|
|
18066
18246
|
let canvasManager;
|
|
18067
18247
|
let recording = false;
|
|
18068
18248
|
const customEventQueue = [];
|
|
18069
18249
|
let flushCustomEventQueue$1;
|
|
18070
|
-
function waitForDOMStabilization(win) {
|
|
18071
|
-
const maxWaitMs = 5e3;
|
|
18072
|
-
return new Promise((resolve2) => {
|
|
18073
|
-
const captureAfterPaint = () => {
|
|
18074
|
-
requestAnimationFrame(() => {
|
|
18075
|
-
requestAnimationFrame(() => {
|
|
18076
|
-
resolve2();
|
|
18077
|
-
});
|
|
18078
|
-
});
|
|
18079
|
-
};
|
|
18080
|
-
const safeResolve = /* @__PURE__ */ (() => {
|
|
18081
|
-
let called = false;
|
|
18082
|
-
return () => {
|
|
18083
|
-
if (!called) {
|
|
18084
|
-
called = true;
|
|
18085
|
-
captureAfterPaint();
|
|
18086
|
-
}
|
|
18087
|
-
};
|
|
18088
|
-
})();
|
|
18089
|
-
if (["interactive", "complete"].includes(win.document.readyState)) {
|
|
18090
|
-
safeResolve();
|
|
18091
|
-
} else {
|
|
18092
|
-
win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
|
|
18093
|
-
win.addEventListener("load", safeResolve, { once: true });
|
|
18094
|
-
setTimeout(() => {
|
|
18095
|
-
safeResolve();
|
|
18096
|
-
}, maxWaitMs);
|
|
18097
|
-
}
|
|
18098
|
-
});
|
|
18099
|
-
}
|
|
18100
18250
|
try {
|
|
18101
18251
|
if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
|
|
18102
18252
|
const cleanFrame = document.createElement("iframe");
|
|
@@ -18229,6 +18379,7 @@ function record(options = {}) {
|
|
|
18229
18379
|
checkoutDebounceTimer = null;
|
|
18230
18380
|
checkoutPending = false;
|
|
18231
18381
|
checkoutFreezeTimestamp = null;
|
|
18382
|
+
navigationManager == null ? void 0 : navigationManager.cancelPending();
|
|
18232
18383
|
takeFullSnapshot$1(true);
|
|
18233
18384
|
mutationBuffers.forEach((buf) => {
|
|
18234
18385
|
buf.resetBuffers();
|
|
@@ -18237,6 +18388,9 @@ function record(options = {}) {
|
|
|
18237
18388
|
if (visibilityManager) {
|
|
18238
18389
|
visibilityManager.unsetFrozen();
|
|
18239
18390
|
}
|
|
18391
|
+
if (navigationManager) {
|
|
18392
|
+
navigationManager.unsetFrozen();
|
|
18393
|
+
}
|
|
18240
18394
|
};
|
|
18241
18395
|
wrappedEmit = (r2, isCheckout) => {
|
|
18242
18396
|
var _a2;
|
|
@@ -18246,6 +18400,7 @@ function record(options = {}) {
|
|
|
18246
18400
|
if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
|
|
18247
18401
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
18248
18402
|
visibilityManager == null ? void 0 : visibilityManager.unfreeze();
|
|
18403
|
+
navigationManager == null ? void 0 : navigationManager.unfreeze();
|
|
18249
18404
|
}
|
|
18250
18405
|
if (inEmittingFrame) {
|
|
18251
18406
|
emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);
|
|
@@ -18455,6 +18610,7 @@ function record(options = {}) {
|
|
|
18455
18610
|
shadowDomManager.init();
|
|
18456
18611
|
mutationBuffers.forEach((buf) => buf.lock());
|
|
18457
18612
|
visibilityManager == null ? void 0 : visibilityManager.lock();
|
|
18613
|
+
navigationManager == null ? void 0 : navigationManager.lock();
|
|
18458
18614
|
const node2 = snapshot(document, {
|
|
18459
18615
|
mirror,
|
|
18460
18616
|
blockClass,
|
|
@@ -18506,6 +18662,7 @@ function record(options = {}) {
|
|
|
18506
18662
|
);
|
|
18507
18663
|
mutationBuffers.forEach((buf) => buf.unlock());
|
|
18508
18664
|
visibilityManager == null ? void 0 : visibilityManager.unlock();
|
|
18665
|
+
navigationManager == null ? void 0 : navigationManager.unlock();
|
|
18509
18666
|
if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
|
|
18510
18667
|
stylesheetManager.adoptStyleSheets(
|
|
18511
18668
|
document.adoptedStyleSheets,
|
|
@@ -18518,6 +18675,31 @@ function record(options = {}) {
|
|
|
18518
18675
|
}
|
|
18519
18676
|
customEventQueue.length = 0;
|
|
18520
18677
|
};
|
|
18678
|
+
let navigationManager;
|
|
18679
|
+
const navigationSampling = sampling.navigation;
|
|
18680
|
+
if (navigationSampling !== false) {
|
|
18681
|
+
const navConfig = typeof navigationSampling === "object" ? navigationSampling : {};
|
|
18682
|
+
navigationManager = new NavigationManager({
|
|
18683
|
+
doc: document,
|
|
18684
|
+
config: navConfig,
|
|
18685
|
+
onSnapshot: (isCheckout) => {
|
|
18686
|
+
if (checkoutPending) {
|
|
18687
|
+
if (checkoutDebounceTimer) {
|
|
18688
|
+
clearTimeout(checkoutDebounceTimer);
|
|
18689
|
+
checkoutDebounceTimer = null;
|
|
18690
|
+
}
|
|
18691
|
+
checkoutPending = false;
|
|
18692
|
+
checkoutFreezeTimestamp = null;
|
|
18693
|
+
mutationBuffers.forEach((buf) => {
|
|
18694
|
+
buf.resetBuffers();
|
|
18695
|
+
buf.unsetFrozen();
|
|
18696
|
+
});
|
|
18697
|
+
visibilityManager == null ? void 0 : visibilityManager.unsetFrozen();
|
|
18698
|
+
}
|
|
18699
|
+
takeFullSnapshot$1(isCheckout);
|
|
18700
|
+
}
|
|
18701
|
+
});
|
|
18702
|
+
}
|
|
18521
18703
|
try {
|
|
18522
18704
|
const handlers = [];
|
|
18523
18705
|
const observe = (doc) => {
|
|
@@ -18548,14 +18730,11 @@ function record(options = {}) {
|
|
|
18548
18730
|
}
|
|
18549
18731
|
}),
|
|
18550
18732
|
navigationCb: (navData) => {
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
navData.href
|
|
18557
|
-
);
|
|
18558
|
-
takeFullSnapshot$1(true);
|
|
18733
|
+
if (navigationManager) {
|
|
18734
|
+
navigationManager.handleNavigation(navData);
|
|
18735
|
+
} else {
|
|
18736
|
+
takeFullSnapshot$1(true);
|
|
18737
|
+
}
|
|
18559
18738
|
},
|
|
18560
18739
|
inputCb: (v2) => wrappedEmit({
|
|
18561
18740
|
type: EventType.IncrementalSnapshot,
|
|
@@ -18674,23 +18853,6 @@ function record(options = {}) {
|
|
|
18674
18853
|
flushCustomEventQueue$1();
|
|
18675
18854
|
}
|
|
18676
18855
|
};
|
|
18677
|
-
const runInit = async () => {
|
|
18678
|
-
if (flushCustomEvent === "before") {
|
|
18679
|
-
flushCustomEventQueue$1();
|
|
18680
|
-
}
|
|
18681
|
-
if (recordAfter === "DOMContentStabilized") {
|
|
18682
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] 🟢 Waiting for DOM stabilization...`);
|
|
18683
|
-
await waitForDOMStabilization(window);
|
|
18684
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ DOM stabilized, starting recording`);
|
|
18685
|
-
}
|
|
18686
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ Init dom and takeFullSnapshot `);
|
|
18687
|
-
takeFullSnapshot$1();
|
|
18688
|
-
handlers.push(observe(document));
|
|
18689
|
-
recording = true;
|
|
18690
|
-
if (flushCustomEvent === "after") {
|
|
18691
|
-
flushCustomEventQueue$1();
|
|
18692
|
-
}
|
|
18693
|
-
};
|
|
18694
18856
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
18695
18857
|
init();
|
|
18696
18858
|
} else {
|
|
@@ -18724,6 +18886,7 @@ function record(options = {}) {
|
|
|
18724
18886
|
}
|
|
18725
18887
|
flushCustomEventQueue$1();
|
|
18726
18888
|
handlers.forEach((h) => h());
|
|
18889
|
+
navigationManager == null ? void 0 : navigationManager.destroy();
|
|
18727
18890
|
processedNodeManager.destroy();
|
|
18728
18891
|
recording = false;
|
|
18729
18892
|
unregisterErrorHandler();
|
|
@@ -21648,7 +21811,7 @@ class Replayer {
|
|
|
21648
21811
|
this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
|
|
21649
21812
|
}
|
|
21650
21813
|
}
|
|
21651
|
-
const version = "3.
|
|
21814
|
+
const version = "3.4.0-alpha.1";
|
|
21652
21815
|
const { getVersion } = record;
|
|
21653
21816
|
const { isRecording } = record;
|
|
21654
21817
|
const { flushCustomEventQueue } = record;
|