@absolutejs/beacon 0.6.17 → 0.6.19
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 +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,6 +142,11 @@ 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`.
|
|
148
|
+
Long-running loaders can set `data-beacon-loading-timeout="60000"` to
|
|
149
|
+
override the global stuck-loading deadline for that element only.
|
|
145
150
|
- **Browser capability failures** — rejected clipboard writes are observed even
|
|
146
151
|
when application code catches them (contents are never read), visible WebGL
|
|
147
152
|
contexts that do not restore after `webglcontextlost` become warnings, and a
|
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ export declare const BEACON_ATTRIBUTE: {
|
|
|
83
83
|
readonly EMBED: "data-beacon-embed";
|
|
84
84
|
/** Marks loading UI that should participate in the stuck-loading watchdog. */
|
|
85
85
|
readonly LOADING: "data-beacon-loading";
|
|
86
|
+
/** Overrides the stuck-loading deadline for one loading element, in ms. */
|
|
87
|
+
readonly LOADING_TIMEOUT: "data-beacon-loading-timeout";
|
|
86
88
|
/** Names a form whose dirty navigation should be reported as abandonment. */
|
|
87
89
|
readonly FORM: "data-beacon-form";
|
|
88
90
|
/** Names media whose user-visible playback should be watched. */
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,7 @@ var BEACON_ATTRIBUTE = {
|
|
|
65
65
|
NAME: "data-beacon-name",
|
|
66
66
|
EMBED: "data-beacon-embed",
|
|
67
67
|
LOADING: "data-beacon-loading",
|
|
68
|
+
LOADING_TIMEOUT: "data-beacon-loading-timeout",
|
|
68
69
|
FORM: "data-beacon-form",
|
|
69
70
|
MEDIA: "data-beacon-media",
|
|
70
71
|
OVERFLOW: "data-beacon-overflow",
|
|
@@ -2180,12 +2181,22 @@ var createBeacon = (options) => {
|
|
|
2180
2181
|
};
|
|
2181
2182
|
const loadingFirstSeen = new WeakMap;
|
|
2182
2183
|
const reportedStuckLoading = new WeakSet;
|
|
2184
|
+
const isPersistentDeterminateProgress = (indicator) => indicator.getAttribute("role") === "progressbar" && indicator.hasAttribute("aria-valuenow") && indicator.getAttribute("aria-busy") !== "true" && !indicator.hasAttribute(BEACON_ATTRIBUTE.LOADING);
|
|
2185
|
+
const loadingDeadlineMs = (indicator) => {
|
|
2186
|
+
const configured = indicator.getAttribute(BEACON_ATTRIBUTE.LOADING_TIMEOUT)?.trim();
|
|
2187
|
+
if (!configured)
|
|
2188
|
+
return stuckLoadingMs;
|
|
2189
|
+
const parsed = Number(configured);
|
|
2190
|
+
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : stuckLoadingMs;
|
|
2191
|
+
};
|
|
2183
2192
|
const checkStuckLoading = () => {
|
|
2184
2193
|
if (document.visibilityState === "hidden")
|
|
2185
2194
|
return;
|
|
2186
2195
|
const indicators = document.querySelectorAll(`[aria-busy="true"], [role="progressbar"], [${BEACON_ATTRIBUTE.LOADING}]`);
|
|
2187
2196
|
const now = Date.now();
|
|
2188
2197
|
for (const indicator of Array.from(indicators)) {
|
|
2198
|
+
if (isPersistentDeterminateProgress(indicator))
|
|
2199
|
+
continue;
|
|
2189
2200
|
if (isScanExempt(indicator))
|
|
2190
2201
|
continue;
|
|
2191
2202
|
const rect = indicator.getBoundingClientRect();
|
|
@@ -2196,11 +2207,15 @@ var createBeacon = (options) => {
|
|
|
2196
2207
|
loadingFirstSeen.set(indicator, now);
|
|
2197
2208
|
continue;
|
|
2198
2209
|
}
|
|
2199
|
-
|
|
2210
|
+
const deadlineMs = loadingDeadlineMs(indicator);
|
|
2211
|
+
if (now - firstSeen < deadlineMs || reportedStuckLoading.has(indicator)) {
|
|
2200
2212
|
continue;
|
|
2201
2213
|
}
|
|
2202
2214
|
reportedStuckLoading.add(indicator);
|
|
2203
|
-
reportScanIssue(indicator, BEACON_SIGNAL.STUCK_LOADING, `Stuck loading — ${describeElement(indicator)} never resolved`, {
|
|
2215
|
+
reportScanIssue(indicator, BEACON_SIGNAL.STUCK_LOADING, `Stuck loading — ${describeElement(indicator)} never resolved`, {
|
|
2216
|
+
deadlineMs: String(deadlineMs),
|
|
2217
|
+
visibleMs: String(now - firstSeen)
|
|
2218
|
+
});
|
|
2204
2219
|
}
|
|
2205
2220
|
};
|
|
2206
2221
|
const checkBlankAppRoots = () => {
|
|
@@ -3788,5 +3803,5 @@ export {
|
|
|
3788
3803
|
BEACON_ATTRIBUTE
|
|
3789
3804
|
};
|
|
3790
3805
|
|
|
3791
|
-
//# debugId=
|
|
3806
|
+
//# debugId=F9CD9BC8D9B8849F64756E2164756E21
|
|
3792
3807
|
//# sourceMappingURL=index.js.map
|