@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.umd.cjs
CHANGED
|
@@ -16315,6 +16315,7 @@ function initNavigationObserver({
|
|
|
16315
16315
|
doc,
|
|
16316
16316
|
sampling
|
|
16317
16317
|
}) {
|
|
16318
|
+
var _a2;
|
|
16318
16319
|
if (sampling.navigation === false) {
|
|
16319
16320
|
return () => {
|
|
16320
16321
|
};
|
|
@@ -16365,6 +16366,30 @@ function initNavigationObserver({
|
|
|
16365
16366
|
handlers.push(restoreReplaceState);
|
|
16366
16367
|
handlers.push(on("popstate", () => emitNavigation("popstate"), win));
|
|
16367
16368
|
handlers.push(on("hashchange", () => emitNavigation("hashchange"), win));
|
|
16369
|
+
const useNavigationAPI = typeof sampling.navigation === "object" ? (_a2 = sampling.navigation.useNavigationAPI) != null ? _a2 : true : true;
|
|
16370
|
+
if (useNavigationAPI && "navigation" in win) {
|
|
16371
|
+
try {
|
|
16372
|
+
const nav = win.navigation;
|
|
16373
|
+
const handler = (event) => {
|
|
16374
|
+
var _a22;
|
|
16375
|
+
const navEvent = event;
|
|
16376
|
+
if (navEvent.navigationType === "push" || navEvent.navigationType === "replace") {
|
|
16377
|
+
const destUrl = (_a22 = navEvent.destination) == null ? void 0 : _a22.url;
|
|
16378
|
+
if (destUrl && destUrl !== lastHref) {
|
|
16379
|
+
navigationCb({
|
|
16380
|
+
href: destUrl,
|
|
16381
|
+
oldHref: lastHref,
|
|
16382
|
+
navigationType: "navigate"
|
|
16383
|
+
});
|
|
16384
|
+
lastHref = destUrl;
|
|
16385
|
+
}
|
|
16386
|
+
}
|
|
16387
|
+
};
|
|
16388
|
+
nav.addEventListener("navigate", handler);
|
|
16389
|
+
handlers.push(() => nav.removeEventListener("navigate", handler));
|
|
16390
|
+
} catch (e2) {
|
|
16391
|
+
}
|
|
16392
|
+
}
|
|
16368
16393
|
return callbackWrapper(() => {
|
|
16369
16394
|
handlers.forEach((h) => h());
|
|
16370
16395
|
});
|
|
@@ -18513,6 +18538,168 @@ class VisibilityManager {
|
|
|
18513
18538
|
}
|
|
18514
18539
|
}
|
|
18515
18540
|
}
|
|
18541
|
+
const DEFAULT_SETTLE_TIMEOUT = 150;
|
|
18542
|
+
const DEFAULT_MAX_WAIT = 5e3;
|
|
18543
|
+
const DEFAULT_DEBOUNCE = 100;
|
|
18544
|
+
class NavigationManager {
|
|
18545
|
+
constructor(options) {
|
|
18546
|
+
var _a2, _b, _c;
|
|
18547
|
+
__publicField(this, "frozen", false);
|
|
18548
|
+
__publicField(this, "locked", false);
|
|
18549
|
+
__publicField(this, "disabled", false);
|
|
18550
|
+
__publicField(this, "settleTimeout");
|
|
18551
|
+
__publicField(this, "maxWait");
|
|
18552
|
+
__publicField(this, "debounceMs");
|
|
18553
|
+
__publicField(this, "settlingObserver", null);
|
|
18554
|
+
__publicField(this, "debounceTimer", null);
|
|
18555
|
+
__publicField(this, "settleCheckTimer", null);
|
|
18556
|
+
__publicField(this, "maxWaitTimer", null);
|
|
18557
|
+
__publicField(this, "lastMutationTime", 0);
|
|
18558
|
+
__publicField(this, "pendingNavigation", null);
|
|
18559
|
+
__publicField(this, "doc");
|
|
18560
|
+
__publicField(this, "onSnapshot");
|
|
18561
|
+
const { doc, config, onSnapshot } = options;
|
|
18562
|
+
this.doc = doc;
|
|
18563
|
+
this.onSnapshot = callbackWrapper(onSnapshot);
|
|
18564
|
+
this.settleTimeout = (_a2 = config.settleTimeout) != null ? _a2 : DEFAULT_SETTLE_TIMEOUT;
|
|
18565
|
+
this.maxWait = (_b = config.maxWait) != null ? _b : DEFAULT_MAX_WAIT;
|
|
18566
|
+
this.debounceMs = (_c = config.debounce) != null ? _c : DEFAULT_DEBOUNCE;
|
|
18567
|
+
}
|
|
18568
|
+
handleNavigation(data) {
|
|
18569
|
+
if (this.disabled)
|
|
18570
|
+
return;
|
|
18571
|
+
if (this.locked)
|
|
18572
|
+
return;
|
|
18573
|
+
this.cancelTimers();
|
|
18574
|
+
this.disconnectSettlingObserver();
|
|
18575
|
+
this.pendingNavigation = data;
|
|
18576
|
+
if (this.frozen) {
|
|
18577
|
+
return;
|
|
18578
|
+
}
|
|
18579
|
+
this.startDebounce();
|
|
18580
|
+
}
|
|
18581
|
+
cancelPending() {
|
|
18582
|
+
this.cancelTimers();
|
|
18583
|
+
this.disconnectSettlingObserver();
|
|
18584
|
+
this.pendingNavigation = null;
|
|
18585
|
+
}
|
|
18586
|
+
freeze() {
|
|
18587
|
+
this.frozen = true;
|
|
18588
|
+
this.cancelTimers();
|
|
18589
|
+
this.disconnectSettlingObserver();
|
|
18590
|
+
}
|
|
18591
|
+
unfreeze() {
|
|
18592
|
+
this.frozen = false;
|
|
18593
|
+
if (this.pendingNavigation && !this.locked && !this.disabled) {
|
|
18594
|
+
this.startDebounce();
|
|
18595
|
+
}
|
|
18596
|
+
}
|
|
18597
|
+
lock() {
|
|
18598
|
+
this.locked = true;
|
|
18599
|
+
this.cancelTimers();
|
|
18600
|
+
this.disconnectSettlingObserver();
|
|
18601
|
+
}
|
|
18602
|
+
unlock() {
|
|
18603
|
+
this.locked = false;
|
|
18604
|
+
this.pendingNavigation = null;
|
|
18605
|
+
}
|
|
18606
|
+
unsetFrozen() {
|
|
18607
|
+
this.frozen = false;
|
|
18608
|
+
}
|
|
18609
|
+
reset() {
|
|
18610
|
+
this.cancelTimers();
|
|
18611
|
+
this.disconnectSettlingObserver();
|
|
18612
|
+
this.pendingNavigation = null;
|
|
18613
|
+
this.frozen = false;
|
|
18614
|
+
this.locked = false;
|
|
18615
|
+
}
|
|
18616
|
+
destroy() {
|
|
18617
|
+
const hadPending = this.pendingNavigation !== null;
|
|
18618
|
+
this.reset();
|
|
18619
|
+
this.disabled = true;
|
|
18620
|
+
if (hadPending) {
|
|
18621
|
+
this.onSnapshot(true);
|
|
18622
|
+
}
|
|
18623
|
+
}
|
|
18624
|
+
startDebounce() {
|
|
18625
|
+
this.debounceTimer = setTimeout(() => {
|
|
18626
|
+
this.debounceTimer = null;
|
|
18627
|
+
this.startDOMSettling();
|
|
18628
|
+
}, this.debounceMs);
|
|
18629
|
+
}
|
|
18630
|
+
startDOMSettling() {
|
|
18631
|
+
if (this.frozen || this.locked || this.disabled)
|
|
18632
|
+
return;
|
|
18633
|
+
this.lastMutationTime = performance.now();
|
|
18634
|
+
const ObserverCtor = mutationObserverCtor();
|
|
18635
|
+
this.settlingObserver = new ObserverCtor(() => {
|
|
18636
|
+
this.lastMutationTime = performance.now();
|
|
18637
|
+
if (this.settleCheckTimer !== null) {
|
|
18638
|
+
clearTimeout(this.settleCheckTimer);
|
|
18639
|
+
}
|
|
18640
|
+
this.settleCheckTimer = setTimeout(
|
|
18641
|
+
() => this.checkSettled(),
|
|
18642
|
+
this.settleTimeout
|
|
18643
|
+
);
|
|
18644
|
+
});
|
|
18645
|
+
this.settlingObserver.observe(this.doc, {
|
|
18646
|
+
childList: true,
|
|
18647
|
+
subtree: true,
|
|
18648
|
+
attributes: true,
|
|
18649
|
+
characterData: true
|
|
18650
|
+
});
|
|
18651
|
+
this.settleCheckTimer = setTimeout(
|
|
18652
|
+
() => this.checkSettled(),
|
|
18653
|
+
this.settleTimeout
|
|
18654
|
+
);
|
|
18655
|
+
this.maxWaitTimer = setTimeout(() => {
|
|
18656
|
+
this.maxWaitTimer = null;
|
|
18657
|
+
this.completeSettling();
|
|
18658
|
+
}, this.maxWait);
|
|
18659
|
+
}
|
|
18660
|
+
checkSettled() {
|
|
18661
|
+
this.settleCheckTimer = null;
|
|
18662
|
+
const elapsed = performance.now() - this.lastMutationTime;
|
|
18663
|
+
if (elapsed >= this.settleTimeout) {
|
|
18664
|
+
this.completeSettling();
|
|
18665
|
+
} else {
|
|
18666
|
+
this.settleCheckTimer = setTimeout(
|
|
18667
|
+
() => this.checkSettled(),
|
|
18668
|
+
this.settleTimeout - elapsed
|
|
18669
|
+
);
|
|
18670
|
+
}
|
|
18671
|
+
}
|
|
18672
|
+
completeSettling() {
|
|
18673
|
+
if (this.frozen || this.locked || this.disabled)
|
|
18674
|
+
return;
|
|
18675
|
+
if (!this.pendingNavigation)
|
|
18676
|
+
return;
|
|
18677
|
+
this.cancelTimers();
|
|
18678
|
+
this.disconnectSettlingObserver();
|
|
18679
|
+
this.pendingNavigation = null;
|
|
18680
|
+
this.onSnapshot(true);
|
|
18681
|
+
}
|
|
18682
|
+
cancelTimers() {
|
|
18683
|
+
if (this.debounceTimer !== null) {
|
|
18684
|
+
clearTimeout(this.debounceTimer);
|
|
18685
|
+
this.debounceTimer = null;
|
|
18686
|
+
}
|
|
18687
|
+
if (this.settleCheckTimer !== null) {
|
|
18688
|
+
clearTimeout(this.settleCheckTimer);
|
|
18689
|
+
this.settleCheckTimer = null;
|
|
18690
|
+
}
|
|
18691
|
+
if (this.maxWaitTimer !== null) {
|
|
18692
|
+
clearTimeout(this.maxWaitTimer);
|
|
18693
|
+
this.maxWaitTimer = null;
|
|
18694
|
+
}
|
|
18695
|
+
}
|
|
18696
|
+
disconnectSettlingObserver() {
|
|
18697
|
+
if (this.settlingObserver) {
|
|
18698
|
+
this.settlingObserver.disconnect();
|
|
18699
|
+
this.settlingObserver = null;
|
|
18700
|
+
}
|
|
18701
|
+
}
|
|
18702
|
+
}
|
|
18516
18703
|
class StylesheetManager {
|
|
18517
18704
|
constructor(options) {
|
|
18518
18705
|
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
@@ -18600,43 +18787,13 @@ class ProcessedNodeManager {
|
|
|
18600
18787
|
destroy() {
|
|
18601
18788
|
}
|
|
18602
18789
|
}
|
|
18603
|
-
const version$1 = "3.
|
|
18790
|
+
const version$1 = "3.4.0-alpha.1";
|
|
18604
18791
|
let wrappedEmit;
|
|
18605
18792
|
let takeFullSnapshot$1;
|
|
18606
18793
|
let canvasManager;
|
|
18607
18794
|
let recording = false;
|
|
18608
18795
|
const customEventQueue = [];
|
|
18609
18796
|
let flushCustomEventQueue$1;
|
|
18610
|
-
function waitForDOMStabilization(win) {
|
|
18611
|
-
const maxWaitMs = 5e3;
|
|
18612
|
-
return new Promise((resolve2) => {
|
|
18613
|
-
const captureAfterPaint = () => {
|
|
18614
|
-
requestAnimationFrame(() => {
|
|
18615
|
-
requestAnimationFrame(() => {
|
|
18616
|
-
resolve2();
|
|
18617
|
-
});
|
|
18618
|
-
});
|
|
18619
|
-
};
|
|
18620
|
-
const safeResolve = /* @__PURE__ */ (() => {
|
|
18621
|
-
let called = false;
|
|
18622
|
-
return () => {
|
|
18623
|
-
if (!called) {
|
|
18624
|
-
called = true;
|
|
18625
|
-
captureAfterPaint();
|
|
18626
|
-
}
|
|
18627
|
-
};
|
|
18628
|
-
})();
|
|
18629
|
-
if (["interactive", "complete"].includes(win.document.readyState)) {
|
|
18630
|
-
safeResolve();
|
|
18631
|
-
} else {
|
|
18632
|
-
win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
|
|
18633
|
-
win.addEventListener("load", safeResolve, { once: true });
|
|
18634
|
-
setTimeout(() => {
|
|
18635
|
-
safeResolve();
|
|
18636
|
-
}, maxWaitMs);
|
|
18637
|
-
}
|
|
18638
|
-
});
|
|
18639
|
-
}
|
|
18640
18797
|
try {
|
|
18641
18798
|
if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
|
|
18642
18799
|
const cleanFrame = document.createElement("iframe");
|
|
@@ -18769,6 +18926,7 @@ function record(options = {}) {
|
|
|
18769
18926
|
checkoutDebounceTimer = null;
|
|
18770
18927
|
checkoutPending = false;
|
|
18771
18928
|
checkoutFreezeTimestamp = null;
|
|
18929
|
+
navigationManager == null ? void 0 : navigationManager.cancelPending();
|
|
18772
18930
|
takeFullSnapshot$1(true);
|
|
18773
18931
|
mutationBuffers.forEach((buf) => {
|
|
18774
18932
|
buf.resetBuffers();
|
|
@@ -18777,6 +18935,9 @@ function record(options = {}) {
|
|
|
18777
18935
|
if (visibilityManager) {
|
|
18778
18936
|
visibilityManager.unsetFrozen();
|
|
18779
18937
|
}
|
|
18938
|
+
if (navigationManager) {
|
|
18939
|
+
navigationManager.unsetFrozen();
|
|
18940
|
+
}
|
|
18780
18941
|
};
|
|
18781
18942
|
wrappedEmit = (r2, isCheckout) => {
|
|
18782
18943
|
var _a2;
|
|
@@ -18786,6 +18947,7 @@ function record(options = {}) {
|
|
|
18786
18947
|
if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
|
|
18787
18948
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
18788
18949
|
visibilityManager == null ? void 0 : visibilityManager.unfreeze();
|
|
18950
|
+
navigationManager == null ? void 0 : navigationManager.unfreeze();
|
|
18789
18951
|
}
|
|
18790
18952
|
if (inEmittingFrame) {
|
|
18791
18953
|
emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);
|
|
@@ -18990,6 +19152,7 @@ function record(options = {}) {
|
|
|
18990
19152
|
shadowDomManager.init();
|
|
18991
19153
|
mutationBuffers.forEach((buf) => buf.lock());
|
|
18992
19154
|
visibilityManager == null ? void 0 : visibilityManager.lock();
|
|
19155
|
+
navigationManager == null ? void 0 : navigationManager.lock();
|
|
18993
19156
|
const node2 = snapshot(document, {
|
|
18994
19157
|
mirror,
|
|
18995
19158
|
blockClass,
|
|
@@ -19041,6 +19204,7 @@ function record(options = {}) {
|
|
|
19041
19204
|
);
|
|
19042
19205
|
mutationBuffers.forEach((buf) => buf.unlock());
|
|
19043
19206
|
visibilityManager == null ? void 0 : visibilityManager.unlock();
|
|
19207
|
+
navigationManager == null ? void 0 : navigationManager.unlock();
|
|
19044
19208
|
if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
|
|
19045
19209
|
stylesheetManager.adoptStyleSheets(
|
|
19046
19210
|
document.adoptedStyleSheets,
|
|
@@ -19053,6 +19217,31 @@ function record(options = {}) {
|
|
|
19053
19217
|
}
|
|
19054
19218
|
customEventQueue.length = 0;
|
|
19055
19219
|
};
|
|
19220
|
+
let navigationManager;
|
|
19221
|
+
const navigationSampling = sampling.navigation;
|
|
19222
|
+
if (navigationSampling !== false) {
|
|
19223
|
+
const navConfig = typeof navigationSampling === "object" ? navigationSampling : {};
|
|
19224
|
+
navigationManager = new NavigationManager({
|
|
19225
|
+
doc: document,
|
|
19226
|
+
config: navConfig,
|
|
19227
|
+
onSnapshot: (isCheckout) => {
|
|
19228
|
+
if (checkoutPending) {
|
|
19229
|
+
if (checkoutDebounceTimer) {
|
|
19230
|
+
clearTimeout(checkoutDebounceTimer);
|
|
19231
|
+
checkoutDebounceTimer = null;
|
|
19232
|
+
}
|
|
19233
|
+
checkoutPending = false;
|
|
19234
|
+
checkoutFreezeTimestamp = null;
|
|
19235
|
+
mutationBuffers.forEach((buf) => {
|
|
19236
|
+
buf.resetBuffers();
|
|
19237
|
+
buf.unsetFrozen();
|
|
19238
|
+
});
|
|
19239
|
+
visibilityManager == null ? void 0 : visibilityManager.unsetFrozen();
|
|
19240
|
+
}
|
|
19241
|
+
takeFullSnapshot$1(isCheckout);
|
|
19242
|
+
}
|
|
19243
|
+
});
|
|
19244
|
+
}
|
|
19056
19245
|
try {
|
|
19057
19246
|
const handlers = [];
|
|
19058
19247
|
const observe = (doc) => {
|
|
@@ -19081,14 +19270,11 @@ function record(options = {}) {
|
|
|
19081
19270
|
}, d)
|
|
19082
19271
|
}),
|
|
19083
19272
|
navigationCb: (navData) => {
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
navData.href
|
|
19090
|
-
);
|
|
19091
|
-
takeFullSnapshot$1(true);
|
|
19273
|
+
if (navigationManager) {
|
|
19274
|
+
navigationManager.handleNavigation(navData);
|
|
19275
|
+
} else {
|
|
19276
|
+
takeFullSnapshot$1(true);
|
|
19277
|
+
}
|
|
19092
19278
|
},
|
|
19093
19279
|
inputCb: (v2) => wrappedEmit({
|
|
19094
19280
|
type: EventType.IncrementalSnapshot,
|
|
@@ -19200,23 +19386,6 @@ function record(options = {}) {
|
|
|
19200
19386
|
flushCustomEventQueue$1();
|
|
19201
19387
|
}
|
|
19202
19388
|
};
|
|
19203
|
-
const runInit = async () => {
|
|
19204
|
-
if (flushCustomEvent === "before") {
|
|
19205
|
-
flushCustomEventQueue$1();
|
|
19206
|
-
}
|
|
19207
|
-
if (recordAfter === "DOMContentStabilized") {
|
|
19208
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] \u{1F7E2} Waiting for DOM stabilization...`);
|
|
19209
|
-
await waitForDOMStabilization(window);
|
|
19210
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] \u2705 DOM stabilized, starting recording`);
|
|
19211
|
-
}
|
|
19212
|
-
console.debug(`[${nowTimestamp()}] [rrweb:record] \u2705 Init dom and takeFullSnapshot `);
|
|
19213
|
-
takeFullSnapshot$1();
|
|
19214
|
-
handlers.push(observe(document));
|
|
19215
|
-
recording = true;
|
|
19216
|
-
if (flushCustomEvent === "after") {
|
|
19217
|
-
flushCustomEventQueue$1();
|
|
19218
|
-
}
|
|
19219
|
-
};
|
|
19220
19389
|
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
19221
19390
|
init();
|
|
19222
19391
|
} else {
|
|
@@ -19252,6 +19421,7 @@ function record(options = {}) {
|
|
|
19252
19421
|
}
|
|
19253
19422
|
flushCustomEventQueue$1();
|
|
19254
19423
|
handlers.forEach((h) => h());
|
|
19424
|
+
navigationManager == null ? void 0 : navigationManager.destroy();
|
|
19255
19425
|
processedNodeManager.destroy();
|
|
19256
19426
|
recording = false;
|
|
19257
19427
|
unregisterErrorHandler();
|
|
@@ -22216,7 +22386,7 @@ class Replayer {
|
|
|
22216
22386
|
this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
|
|
22217
22387
|
}
|
|
22218
22388
|
}
|
|
22219
|
-
const version = "3.
|
|
22389
|
+
const version = "3.4.0-alpha.1";
|
|
22220
22390
|
const { getVersion } = record;
|
|
22221
22391
|
const { isRecording } = record;
|
|
22222
22392
|
const { flushCustomEventQueue } = record;
|