@absolutejs/beacon 0.6.18 → 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/README.md +3 -0
- package/dist/index.js +14 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,6 +142,9 @@ beacon.captureMessage("checkout started", "info");
|
|
|
142
142
|
inverted brand/media surfaces use `data-beacon-theme="allow"`. Loading UI
|
|
143
143
|
participates through native `aria-busy`/`role="progressbar"` semantics or
|
|
144
144
|
`data-beacon-loading`, without coupling the SDK to framework class names.
|
|
145
|
+
Determinate progressbars with `aria-valuenow` are persistent status meters,
|
|
146
|
+
not loaders, unless also marked with `aria-busy="true"` or
|
|
147
|
+
`data-beacon-loading`.
|
|
145
148
|
Long-running loaders can set `data-beacon-loading-timeout="60000"` to
|
|
146
149
|
override the global stuck-loading deadline for that element only.
|
|
147
150
|
- **Browser capability failures** — rejected clipboard writes are observed even
|
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;
|
|
@@ -2181,6 +2184,7 @@ var createBeacon = (options) => {
|
|
|
2181
2184
|
};
|
|
2182
2185
|
const loadingFirstSeen = new WeakMap;
|
|
2183
2186
|
const reportedStuckLoading = new WeakSet;
|
|
2187
|
+
const isPersistentDeterminateProgress = (indicator) => indicator.getAttribute("role") === "progressbar" && indicator.hasAttribute("aria-valuenow") && indicator.getAttribute("aria-busy") !== "true" && !indicator.hasAttribute(BEACON_ATTRIBUTE.LOADING);
|
|
2184
2188
|
const loadingDeadlineMs = (indicator) => {
|
|
2185
2189
|
const configured = indicator.getAttribute(BEACON_ATTRIBUTE.LOADING_TIMEOUT)?.trim();
|
|
2186
2190
|
if (!configured)
|
|
@@ -2194,6 +2198,8 @@ var createBeacon = (options) => {
|
|
|
2194
2198
|
const indicators = document.querySelectorAll(`[aria-busy="true"], [role="progressbar"], [${BEACON_ATTRIBUTE.LOADING}]`);
|
|
2195
2199
|
const now = Date.now();
|
|
2196
2200
|
for (const indicator of Array.from(indicators)) {
|
|
2201
|
+
if (isPersistentDeterminateProgress(indicator))
|
|
2202
|
+
continue;
|
|
2197
2203
|
if (isScanExempt(indicator))
|
|
2198
2204
|
continue;
|
|
2199
2205
|
const rect = indicator.getBoundingClientRect();
|
|
@@ -3281,6 +3287,7 @@ var createBeacon = (options) => {
|
|
|
3281
3287
|
construct(target, args) {
|
|
3282
3288
|
const socket = Reflect.construct(target, args);
|
|
3283
3289
|
const label = shortUrl(String(args[0]));
|
|
3290
|
+
const socketLifecycleGeneration = pageLifecycleGeneration;
|
|
3284
3291
|
let applicationClose = false;
|
|
3285
3292
|
const originalClose = socket.close.bind(socket);
|
|
3286
3293
|
socket.close = (code, reason) => {
|
|
@@ -3288,7 +3295,8 @@ var createBeacon = (options) => {
|
|
|
3288
3295
|
originalClose(code, reason);
|
|
3289
3296
|
};
|
|
3290
3297
|
socket.addEventListener("close", (event) => {
|
|
3291
|
-
|
|
3298
|
+
const restoredLifecycleClose = pageRestoredAt !== undefined && socketLifecycleGeneration < pageLifecycleGeneration && Date.now() - pageRestoredAt <= RESTORED_SOCKET_CLOSE_GRACE_MS;
|
|
3299
|
+
if (pageLifecycleEnding || applicationClose || restoredLifecycleClose)
|
|
3292
3300
|
return;
|
|
3293
3301
|
if (signals.socketAbnormalCloses !== false && typeof CloseEvent !== "undefined" && event instanceof CloseEvent && !event.wasClean) {
|
|
3294
3302
|
const abnormalKey = `${label}|${event.code}`;
|
|
@@ -3742,11 +3750,14 @@ var createBeacon = (options) => {
|
|
|
3742
3750
|
cleanups.push(() => clearInterval(timer));
|
|
3743
3751
|
const onPageHide = () => {
|
|
3744
3752
|
pageLifecycleEnding = true;
|
|
3753
|
+
pageLifecycleGeneration += 1;
|
|
3754
|
+
pageRestoredAt = undefined;
|
|
3745
3755
|
pendingNetworkFailures.delete("transport");
|
|
3746
3756
|
flush(true);
|
|
3747
3757
|
};
|
|
3748
|
-
const onPageShow = () => {
|
|
3758
|
+
const onPageShow = (event) => {
|
|
3749
3759
|
pageLifecycleEnding = false;
|
|
3760
|
+
pageRestoredAt = event.persisted ? Date.now() : undefined;
|
|
3750
3761
|
};
|
|
3751
3762
|
const onVisibilityChange = () => {
|
|
3752
3763
|
if (document.visibilityState === "hidden")
|
|
@@ -3800,5 +3811,5 @@ export {
|
|
|
3800
3811
|
BEACON_ATTRIBUTE
|
|
3801
3812
|
};
|
|
3802
3813
|
|
|
3803
|
-
//# debugId=
|
|
3814
|
+
//# debugId=55452890CDD1A21064756E2164756E21
|
|
3804
3815
|
//# sourceMappingURL=index.js.map
|