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