@appsurify-testmap/rrweb 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.cjs +220 -57
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +220 -57
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +227 -57
- package/dist/rrweb.umd.cjs.map +3 -3
- package/dist/rrweb.umd.min.cjs +42 -42
- package/dist/rrweb.umd.min.cjs.map +4 -4
- package/package.json +5 -5
package/dist/rrweb.cjs
CHANGED
|
@@ -15879,6 +15879,30 @@ function initNavigationObserver({
|
|
|
15879
15879
|
handlers.push(restoreReplaceState);
|
|
15880
15880
|
handlers.push(on("popstate", () => emitNavigation("popstate"), win));
|
|
15881
15881
|
handlers.push(on("hashchange", () => emitNavigation("hashchange"), win));
|
|
15882
|
+
const useNavigationAPI = typeof sampling.navigation === "object" ? sampling.navigation.useNavigationAPI ?? true : true;
|
|
15883
|
+
if (useNavigationAPI && "navigation" in win) {
|
|
15884
|
+
try {
|
|
15885
|
+
const nav = win.navigation;
|
|
15886
|
+
const handler = (event) => {
|
|
15887
|
+
var _a2;
|
|
15888
|
+
const navEvent = event;
|
|
15889
|
+
if (navEvent.navigationType === "push" || navEvent.navigationType === "replace") {
|
|
15890
|
+
const destUrl = (_a2 = navEvent.destination) == null ? void 0 : _a2.url;
|
|
15891
|
+
if (destUrl && destUrl !== lastHref) {
|
|
15892
|
+
navigationCb({
|
|
15893
|
+
href: destUrl,
|
|
15894
|
+
oldHref: lastHref,
|
|
15895
|
+
navigationType: "navigate"
|
|
15896
|
+
});
|
|
15897
|
+
lastHref = destUrl;
|
|
15898
|
+
}
|
|
15899
|
+
}
|
|
15900
|
+
};
|
|
15901
|
+
nav.addEventListener("navigate", handler);
|
|
15902
|
+
handlers.push(() => nav.removeEventListener("navigate", handler));
|
|
15903
|
+
} catch {
|
|
15904
|
+
}
|
|
15905
|
+
}
|
|
15882
15906
|
return callbackWrapper(() => {
|
|
15883
15907
|
handlers.forEach((h) => h());
|
|
15884
15908
|
});
|
|
@@ -17997,6 +18021,162 @@ class VisibilityManager {
|
|
|
17997
18021
|
}
|
|
17998
18022
|
}
|
|
17999
18023
|
}
|
|
18024
|
+
const DEFAULT_SETTLE_TIMEOUT = 150;
|
|
18025
|
+
const DEFAULT_MAX_WAIT = 5e3;
|
|
18026
|
+
const DEFAULT_DEBOUNCE = 100;
|
|
18027
|
+
class NavigationManager {
|
|
18028
|
+
constructor(options) {
|
|
18029
|
+
__publicField(this, "frozen", false);
|
|
18030
|
+
__publicField(this, "locked", false);
|
|
18031
|
+
__publicField(this, "disabled", false);
|
|
18032
|
+
__publicField(this, "settleTimeout");
|
|
18033
|
+
__publicField(this, "maxWait");
|
|
18034
|
+
__publicField(this, "debounceMs");
|
|
18035
|
+
__publicField(this, "settlingObserver", null);
|
|
18036
|
+
__publicField(this, "debounceTimer", null);
|
|
18037
|
+
__publicField(this, "settleCheckTimer", null);
|
|
18038
|
+
__publicField(this, "maxWaitTimer", null);
|
|
18039
|
+
__publicField(this, "lastMutationTime", 0);
|
|
18040
|
+
__publicField(this, "pendingNavigation", null);
|
|
18041
|
+
__publicField(this, "doc");
|
|
18042
|
+
__publicField(this, "onSnapshot");
|
|
18043
|
+
const { doc, config, onSnapshot } = options;
|
|
18044
|
+
this.doc = doc;
|
|
18045
|
+
this.onSnapshot = callbackWrapper(onSnapshot);
|
|
18046
|
+
this.settleTimeout = config.settleTimeout ?? DEFAULT_SETTLE_TIMEOUT;
|
|
18047
|
+
this.maxWait = config.maxWait ?? DEFAULT_MAX_WAIT;
|
|
18048
|
+
this.debounceMs = config.debounce ?? DEFAULT_DEBOUNCE;
|
|
18049
|
+
}
|
|
18050
|
+
handleNavigation(data) {
|
|
18051
|
+
if (this.disabled) return;
|
|
18052
|
+
if (this.locked) return;
|
|
18053
|
+
this.cancelTimers();
|
|
18054
|
+
this.disconnectSettlingObserver();
|
|
18055
|
+
this.pendingNavigation = data;
|
|
18056
|
+
if (this.frozen) {
|
|
18057
|
+
return;
|
|
18058
|
+
}
|
|
18059
|
+
this.startDebounce();
|
|
18060
|
+
}
|
|
18061
|
+
cancelPending() {
|
|
18062
|
+
this.cancelTimers();
|
|
18063
|
+
this.disconnectSettlingObserver();
|
|
18064
|
+
this.pendingNavigation = null;
|
|
18065
|
+
}
|
|
18066
|
+
freeze() {
|
|
18067
|
+
this.frozen = true;
|
|
18068
|
+
this.cancelTimers();
|
|
18069
|
+
this.disconnectSettlingObserver();
|
|
18070
|
+
}
|
|
18071
|
+
unfreeze() {
|
|
18072
|
+
this.frozen = false;
|
|
18073
|
+
if (this.pendingNavigation && !this.locked && !this.disabled) {
|
|
18074
|
+
this.startDebounce();
|
|
18075
|
+
}
|
|
18076
|
+
}
|
|
18077
|
+
lock() {
|
|
18078
|
+
this.locked = true;
|
|
18079
|
+
this.cancelTimers();
|
|
18080
|
+
this.disconnectSettlingObserver();
|
|
18081
|
+
}
|
|
18082
|
+
unlock() {
|
|
18083
|
+
this.locked = false;
|
|
18084
|
+
this.pendingNavigation = null;
|
|
18085
|
+
}
|
|
18086
|
+
unsetFrozen() {
|
|
18087
|
+
this.frozen = false;
|
|
18088
|
+
}
|
|
18089
|
+
reset() {
|
|
18090
|
+
this.cancelTimers();
|
|
18091
|
+
this.disconnectSettlingObserver();
|
|
18092
|
+
this.pendingNavigation = null;
|
|
18093
|
+
this.frozen = false;
|
|
18094
|
+
this.locked = false;
|
|
18095
|
+
}
|
|
18096
|
+
destroy() {
|
|
18097
|
+
const hadPending = this.pendingNavigation !== null;
|
|
18098
|
+
this.reset();
|
|
18099
|
+
this.disabled = true;
|
|
18100
|
+
if (hadPending) {
|
|
18101
|
+
this.onSnapshot(true);
|
|
18102
|
+
}
|
|
18103
|
+
}
|
|
18104
|
+
startDebounce() {
|
|
18105
|
+
this.debounceTimer = setTimeout(() => {
|
|
18106
|
+
this.debounceTimer = null;
|
|
18107
|
+
this.startDOMSettling();
|
|
18108
|
+
}, this.debounceMs);
|
|
18109
|
+
}
|
|
18110
|
+
startDOMSettling() {
|
|
18111
|
+
if (this.frozen || this.locked || this.disabled) return;
|
|
18112
|
+
this.lastMutationTime = performance.now();
|
|
18113
|
+
const ObserverCtor = mutationObserverCtor();
|
|
18114
|
+
this.settlingObserver = new ObserverCtor(() => {
|
|
18115
|
+
this.lastMutationTime = performance.now();
|
|
18116
|
+
if (this.settleCheckTimer !== null) {
|
|
18117
|
+
clearTimeout(this.settleCheckTimer);
|
|
18118
|
+
}
|
|
18119
|
+
this.settleCheckTimer = setTimeout(
|
|
18120
|
+
() => this.checkSettled(),
|
|
18121
|
+
this.settleTimeout
|
|
18122
|
+
);
|
|
18123
|
+
});
|
|
18124
|
+
this.settlingObserver.observe(this.doc, {
|
|
18125
|
+
childList: true,
|
|
18126
|
+
subtree: true,
|
|
18127
|
+
attributes: true,
|
|
18128
|
+
characterData: true
|
|
18129
|
+
});
|
|
18130
|
+
this.settleCheckTimer = setTimeout(
|
|
18131
|
+
() => this.checkSettled(),
|
|
18132
|
+
this.settleTimeout
|
|
18133
|
+
);
|
|
18134
|
+
this.maxWaitTimer = setTimeout(() => {
|
|
18135
|
+
this.maxWaitTimer = null;
|
|
18136
|
+
this.completeSettling();
|
|
18137
|
+
}, this.maxWait);
|
|
18138
|
+
}
|
|
18139
|
+
checkSettled() {
|
|
18140
|
+
this.settleCheckTimer = null;
|
|
18141
|
+
const elapsed = performance.now() - this.lastMutationTime;
|
|
18142
|
+
if (elapsed >= this.settleTimeout) {
|
|
18143
|
+
this.completeSettling();
|
|
18144
|
+
} else {
|
|
18145
|
+
this.settleCheckTimer = setTimeout(
|
|
18146
|
+
() => this.checkSettled(),
|
|
18147
|
+
this.settleTimeout - elapsed
|
|
18148
|
+
);
|
|
18149
|
+
}
|
|
18150
|
+
}
|
|
18151
|
+
completeSettling() {
|
|
18152
|
+
if (this.frozen || this.locked || this.disabled) return;
|
|
18153
|
+
if (!this.pendingNavigation) return;
|
|
18154
|
+
this.cancelTimers();
|
|
18155
|
+
this.disconnectSettlingObserver();
|
|
18156
|
+
this.pendingNavigation = null;
|
|
18157
|
+
this.onSnapshot(true);
|
|
18158
|
+
}
|
|
18159
|
+
cancelTimers() {
|
|
18160
|
+
if (this.debounceTimer !== null) {
|
|
18161
|
+
clearTimeout(this.debounceTimer);
|
|
18162
|
+
this.debounceTimer = null;
|
|
18163
|
+
}
|
|
18164
|
+
if (this.settleCheckTimer !== null) {
|
|
18165
|
+
clearTimeout(this.settleCheckTimer);
|
|
18166
|
+
this.settleCheckTimer = null;
|
|
18167
|
+
}
|
|
18168
|
+
if (this.maxWaitTimer !== null) {
|
|
18169
|
+
clearTimeout(this.maxWaitTimer);
|
|
18170
|
+
this.maxWaitTimer = null;
|
|
18171
|
+
}
|
|
18172
|
+
}
|
|
18173
|
+
disconnectSettlingObserver() {
|
|
18174
|
+
if (this.settlingObserver) {
|
|
18175
|
+
this.settlingObserver.disconnect();
|
|
18176
|
+
this.settlingObserver = null;
|
|
18177
|
+
}
|
|
18178
|
+
}
|
|
18179
|
+
}
|
|
18000
18180
|
class StylesheetManager {
|
|
18001
18181
|
constructor(options) {
|
|
18002
18182
|
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
@@ -18080,43 +18260,13 @@ class ProcessedNodeManager {
|
|
|
18080
18260
|
destroy() {
|
|
18081
18261
|
}
|
|
18082
18262
|
}
|
|
18083
|
-
const version$1 = "3.
|
|
18263
|
+
const version$1 = "3.4.0-alpha.1";
|
|
18084
18264
|
let wrappedEmit;
|
|
18085
18265
|
let takeFullSnapshot$1;
|
|
18086
18266
|
let canvasManager;
|
|
18087
18267
|
let recording = false;
|
|
18088
18268
|
const customEventQueue = [];
|
|
18089
18269
|
let flushCustomEventQueue$1;
|
|
18090
|
-
function waitForDOMStabilization(win) {
|
|
18091
|
-
const maxWaitMs = 5e3;
|
|
18092
|
-
return new Promise((resolve2) => {
|
|
18093
|
-
const captureAfterPaint = () => {
|
|
18094
|
-
requestAnimationFrame(() => {
|
|
18095
|
-
requestAnimationFrame(() => {
|
|
18096
|
-
resolve2();
|
|
18097
|
-
});
|
|
18098
|
-
});
|
|
18099
|
-
};
|
|
18100
|
-
const safeResolve = /* @__PURE__ */ (() => {
|
|
18101
|
-
let called = false;
|
|
18102
|
-
return () => {
|
|
18103
|
-
if (!called) {
|
|
18104
|
-
called = true;
|
|
18105
|
-
captureAfterPaint();
|
|
18106
|
-
}
|
|
18107
|
-
};
|
|
18108
|
-
})();
|
|
18109
|
-
if (["interactive", "complete"].includes(win.document.readyState)) {
|
|
18110
|
-
safeResolve();
|
|
18111
|
-
} else {
|
|
18112
|
-
win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
|
|
18113
|
-
win.addEventListener("load", safeResolve, { once: true });
|
|
18114
|
-
setTimeout(() => {
|
|
18115
|
-
safeResolve();
|
|
18116
|
-
}, maxWaitMs);
|
|
18117
|
-
}
|
|
18118
|
-
});
|
|
18119
|
-
}
|
|
18120
18270
|
try {
|
|
18121
18271
|
if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
|
|
18122
18272
|
const cleanFrame = document.createElement("iframe");
|
|
@@ -18249,6 +18399,7 @@ function record(options = {}) {
|
|
|
18249
18399
|
checkoutDebounceTimer = null;
|
|
18250
18400
|
checkoutPending = false;
|
|
18251
18401
|
checkoutFreezeTimestamp = null;
|
|
18402
|
+
navigationManager == null ? void 0 : navigationManager.cancelPending();
|
|
18252
18403
|
takeFullSnapshot$1(true);
|
|
18253
18404
|
mutationBuffers.forEach((buf) => {
|
|
18254
18405
|
buf.resetBuffers();
|
|
@@ -18257,6 +18408,9 @@ function record(options = {}) {
|
|
|
18257
18408
|
if (visibilityManager) {
|
|
18258
18409
|
visibilityManager.unsetFrozen();
|
|
18259
18410
|
}
|
|
18411
|
+
if (navigationManager) {
|
|
18412
|
+
navigationManager.unsetFrozen();
|
|
18413
|
+
}
|
|
18260
18414
|
};
|
|
18261
18415
|
wrappedEmit = (r2, isCheckout) => {
|
|
18262
18416
|
var _a2;
|
|
@@ -18266,6 +18420,7 @@ function record(options = {}) {
|
|
|
18266
18420
|
if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
|
|
18267
18421
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
18268
18422
|
visibilityManager == null ? void 0 : visibilityManager.unfreeze();
|
|
18423
|
+
navigationManager == null ? void 0 : navigationManager.unfreeze();
|
|
18269
18424
|
}
|
|
18270
18425
|
if (inEmittingFrame) {
|
|
18271
18426
|
emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);
|
|
@@ -18475,6 +18630,7 @@ function record(options = {}) {
|
|
|
18475
18630
|
shadowDomManager.init();
|
|
18476
18631
|
mutationBuffers.forEach((buf) => buf.lock());
|
|
18477
18632
|
visibilityManager == null ? void 0 : visibilityManager.lock();
|
|
18633
|
+
navigationManager == null ? void 0 : navigationManager.lock();
|
|
18478
18634
|
const node2 = snapshot(document, {
|
|
18479
18635
|
mirror,
|
|
18480
18636
|
blockClass,
|
|
@@ -18526,6 +18682,7 @@ function record(options = {}) {
|
|
|
18526
18682
|
);
|
|
18527
18683
|
mutationBuffers.forEach((buf) => buf.unlock());
|
|
18528
18684
|
visibilityManager == null ? void 0 : visibilityManager.unlock();
|
|
18685
|
+
navigationManager == null ? void 0 : navigationManager.unlock();
|
|
18529
18686
|
if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
|
|
18530
18687
|
stylesheetManager.adoptStyleSheets(
|
|
18531
18688
|
document.adoptedStyleSheets,
|
|
@@ -18538,6 +18695,31 @@ function record(options = {}) {
|
|
|
18538
18695
|
}
|
|
18539
18696
|
customEventQueue.length = 0;
|
|
18540
18697
|
};
|
|
18698
|
+
let navigationManager;
|
|
18699
|
+
const navigationSampling = sampling.navigation;
|
|
18700
|
+
if (navigationSampling !== false) {
|
|
18701
|
+
const navConfig = typeof navigationSampling === "object" ? navigationSampling : {};
|
|
18702
|
+
navigationManager = new NavigationManager({
|
|
18703
|
+
doc: document,
|
|
18704
|
+
config: navConfig,
|
|
18705
|
+
onSnapshot: (isCheckout) => {
|
|
18706
|
+
if (checkoutPending) {
|
|
18707
|
+
if (checkoutDebounceTimer) {
|
|
18708
|
+
clearTimeout(checkoutDebounceTimer);
|
|
18709
|
+
checkoutDebounceTimer = null;
|
|
18710
|
+
}
|
|
18711
|
+
checkoutPending = false;
|
|
18712
|
+
checkoutFreezeTimestamp = null;
|
|
18713
|
+
mutationBuffers.forEach((buf) => {
|
|
18714
|
+
buf.resetBuffers();
|
|
18715
|
+
buf.unsetFrozen();
|
|
18716
|
+
});
|
|
18717
|
+
visibilityManager == null ? void 0 : visibilityManager.unsetFrozen();
|
|
18718
|
+
}
|
|
18719
|
+
takeFullSnapshot$1(isCheckout);
|
|
18720
|
+
}
|
|
18721
|
+
});
|
|
18722
|
+
}
|
|
18541
18723
|
try {
|
|
18542
18724
|
const handlers = [];
|
|
18543
18725
|
const observe = (doc) => {
|
|
@@ -18568,14 +18750,11 @@ function record(options = {}) {
|
|
|
18568
18750
|
}
|
|
18569
18751
|
}),
|
|
18570
18752
|
navigationCb: (navData) => {
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
|
|
18574
|
-
|
|
18575
|
-
|
|
18576
|
-
navData.href
|
|
18577
|
-
);
|
|
18578
|
-
takeFullSnapshot$1(true);
|
|
18753
|
+
if (navigationManager) {
|
|
18754
|
+
navigationManager.handleNavigation(navData);
|
|
18755
|
+
} else {
|
|
18756
|
+
takeFullSnapshot$1(true);
|
|
18757
|
+
}
|
|
18579
18758
|
},
|
|
18580
18759
|
inputCb: (v2) => wrappedEmit({
|
|
18581
18760
|
type: EventType.IncrementalSnapshot,
|
|
@@ -18694,23 +18873,6 @@ function record(options = {}) {
|
|
|
18694
18873
|
flushCustomEventQueue$1();
|
|
18695
18874
|
}
|
|
18696
18875
|
};
|
|
18697
|
-
const runInit = async () => {
|
|
18698
|
-
if (flushCustomEvent === "before") {
|
|
18699
|
-
flushCustomEventQueue$1();
|
|
18700
|
-
}
|
|
18701
|
-
if (recordAfter === "DOMContentStabilized") {
|
|
18702
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] 🟢 Waiting for DOM stabilization...`);
|
|
18703
|
-
await waitForDOMStabilization(window);
|
|
18704
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ DOM stabilized, starting recording`);
|
|
18705
|
-
}
|
|
18706
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] ✅ Init dom and takeFullSnapshot `);
|
|
18707
|
-
takeFullSnapshot$1();
|
|
18708
|
-
handlers.push(observe(document));
|
|
18709
|
-
recording = true;
|
|
18710
|
-
if (flushCustomEvent === "after") {
|
|
18711
|
-
flushCustomEventQueue$1();
|
|
18712
|
-
}
|
|
18713
|
-
};
|
|
18714
18876
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
18715
18877
|
init();
|
|
18716
18878
|
} else {
|
|
@@ -18744,6 +18906,7 @@ function record(options = {}) {
|
|
|
18744
18906
|
}
|
|
18745
18907
|
flushCustomEventQueue$1();
|
|
18746
18908
|
handlers.forEach((h) => h());
|
|
18909
|
+
navigationManager == null ? void 0 : navigationManager.destroy();
|
|
18747
18910
|
processedNodeManager.destroy();
|
|
18748
18911
|
recording = false;
|
|
18749
18912
|
unregisterErrorHandler();
|
|
@@ -21676,7 +21839,7 @@ class Replayer {
|
|
|
21676
21839
|
this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
|
|
21677
21840
|
}
|
|
21678
21841
|
}
|
|
21679
|
-
const version = "3.
|
|
21842
|
+
const version = "3.4.0-alpha.1";
|
|
21680
21843
|
const { getVersion } = record;
|
|
21681
21844
|
const { isRecording } = record;
|
|
21682
21845
|
const { flushCustomEventQueue } = record;
|