@absolutejs/beacon 0.6.19 → 0.6.20
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/index.js +11 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -729,6 +729,7 @@ var createBeacon = (options) => {
|
|
|
729
729
|
const STALE_RELEASE_STORAGE_KEY = "beacon:release-first-seen";
|
|
730
730
|
const STALE_RELEASE_GRACE_MS = 600000;
|
|
731
731
|
const STALE_RELEASE_HISTORY_LIMIT = 5;
|
|
732
|
+
const RESTORED_SOCKET_CLOSE_GRACE_MS = 1000;
|
|
732
733
|
const FORM_FRUSTRATION_THRESHOLD = 3;
|
|
733
734
|
const FORM_FRUSTRATION_WINDOW_MS = 60000;
|
|
734
735
|
const LAYOUT_SHIFT_RECENT_INTERACTION_MS = 500;
|
|
@@ -756,6 +757,8 @@ var createBeacon = (options) => {
|
|
|
756
757
|
let clipboardWriteCount = 0;
|
|
757
758
|
let inSignalConsole = false;
|
|
758
759
|
let pageLifecycleEnding = false;
|
|
760
|
+
let pageLifecycleGeneration = 0;
|
|
761
|
+
let pageRestoredAt;
|
|
759
762
|
let recentInteraction;
|
|
760
763
|
let reportErrorClick = null;
|
|
761
764
|
let reportFormAbandonmentOnNavigation = null;
|
|
@@ -3284,6 +3287,7 @@ var createBeacon = (options) => {
|
|
|
3284
3287
|
construct(target, args) {
|
|
3285
3288
|
const socket = Reflect.construct(target, args);
|
|
3286
3289
|
const label = shortUrl(String(args[0]));
|
|
3290
|
+
const socketLifecycleGeneration = pageLifecycleGeneration;
|
|
3287
3291
|
let applicationClose = false;
|
|
3288
3292
|
const originalClose = socket.close.bind(socket);
|
|
3289
3293
|
socket.close = (code, reason) => {
|
|
@@ -3291,7 +3295,8 @@ var createBeacon = (options) => {
|
|
|
3291
3295
|
originalClose(code, reason);
|
|
3292
3296
|
};
|
|
3293
3297
|
socket.addEventListener("close", (event) => {
|
|
3294
|
-
|
|
3298
|
+
const restoredLifecycleClose = pageRestoredAt !== undefined && socketLifecycleGeneration < pageLifecycleGeneration && Date.now() - pageRestoredAt <= RESTORED_SOCKET_CLOSE_GRACE_MS;
|
|
3299
|
+
if (pageLifecycleEnding || applicationClose || restoredLifecycleClose)
|
|
3295
3300
|
return;
|
|
3296
3301
|
if (signals.socketAbnormalCloses !== false && typeof CloseEvent !== "undefined" && event instanceof CloseEvent && !event.wasClean) {
|
|
3297
3302
|
const abnormalKey = `${label}|${event.code}`;
|
|
@@ -3745,11 +3750,14 @@ var createBeacon = (options) => {
|
|
|
3745
3750
|
cleanups.push(() => clearInterval(timer));
|
|
3746
3751
|
const onPageHide = () => {
|
|
3747
3752
|
pageLifecycleEnding = true;
|
|
3753
|
+
pageLifecycleGeneration += 1;
|
|
3754
|
+
pageRestoredAt = undefined;
|
|
3748
3755
|
pendingNetworkFailures.delete("transport");
|
|
3749
3756
|
flush(true);
|
|
3750
3757
|
};
|
|
3751
|
-
const onPageShow = () => {
|
|
3758
|
+
const onPageShow = (event) => {
|
|
3752
3759
|
pageLifecycleEnding = false;
|
|
3760
|
+
pageRestoredAt = event.persisted ? Date.now() : undefined;
|
|
3753
3761
|
};
|
|
3754
3762
|
const onVisibilityChange = () => {
|
|
3755
3763
|
if (document.visibilityState === "hidden")
|
|
@@ -3803,5 +3811,5 @@ export {
|
|
|
3803
3811
|
BEACON_ATTRIBUTE
|
|
3804
3812
|
};
|
|
3805
3813
|
|
|
3806
|
-
//# debugId=
|
|
3814
|
+
//# debugId=55452890CDD1A21064756E2164756E21
|
|
3807
3815
|
//# sourceMappingURL=index.js.map
|