@absolutejs/beacon 0.6.16 → 0.6.18
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -4
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,6 +142,8 @@ 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
|
+
Long-running loaders can set `data-beacon-loading-timeout="60000"` to
|
|
146
|
+
override the global stuck-loading deadline for that element only.
|
|
145
147
|
- **Browser capability failures** — rejected clipboard writes are observed even
|
|
146
148
|
when application code catches them (contents are never read), visible WebGL
|
|
147
149
|
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",
|
|
@@ -315,7 +316,7 @@ var META_IOS_WEBKIT_BRIDGE_FAILURE = "TypeError: undefined is not an object (eva
|
|
|
315
316
|
var isInstagramIosBridgeInjection = (event, userAgent) => INSTAGRAM_IOS_IN_APP_BROWSER.test(userAgent) && event.message === META_IOS_WEBKIT_BRIDGE_FAILURE && event.stack?.includes("sendDataToNative") === true && event.stack.includes("sendPageHideMessage");
|
|
316
317
|
var FACEBOOK_ANDROID_DETACHED_BRIDGE_MESSAGE = "Error invoking postMessage: Java object is gone";
|
|
317
318
|
var FACEBOOK_ANDROID_PERFORMANCE_LOGGER = "iabjs://navigation_performance_logger_android";
|
|
318
|
-
var KNOWN_CRAWLER_USER_AGENT = /(?:AdsBot-Google|Googlebot|bingbot|Baiduspider|YandexBot|DuckDuckBot|Applebot|Bytespider|PetalBot|SemrushBot|AhrefsBot|DotBot|MJ12bot|GPTBot|ClaudeBot|PerplexityBot|Google-NotebookLM|BitSightBot|Dataprovider\.com|meta-
|
|
319
|
+
var KNOWN_CRAWLER_USER_AGENT = /(?:AdsBot-Google|Googlebot|bingbot|Baiduspider|YandexBot|DuckDuckBot|Applebot|Bytespider|PetalBot|SemrushBot|AhrefsBot|DotBot|MJ12bot|GPTBot|ClaudeBot|PerplexityBot|Google-NotebookLM|BitSightBot|Dataprovider\.com|meta-external(?:agent|ads))/i;
|
|
319
320
|
var browserUserAgent = () => typeof navigator === "undefined" ? "" : navigator.userAgent;
|
|
320
321
|
var isKnownBeaconNoise = (event, userAgent = browserUserAgent()) => KNOWN_CRAWLER_USER_AGENT.test(userAgent) || event.name === "UnhandledRejection" && CEF_SHARP_REJECTION.test(event.message) || FACEBOOK_IOS_IN_APP_BROWSER.test(userAgent) && FACEBOOK_IOS_HOST_INJECTION.has(event.message) || isInstagramIosBridgeInjection(event, userAgent) || event.name === "Error" && event.message === FACEBOOK_ANDROID_DETACHED_BRIDGE_MESSAGE && event.tags?.errorFilename === FACEBOOK_ANDROID_PERFORMANCE_LOGGER && event.stack?.includes(FACEBOOK_ANDROID_PERFORMANCE_LOGGER) === true;
|
|
321
322
|
var errorWithStack = (name, message, location2) => {
|
|
@@ -2180,6 +2181,13 @@ var createBeacon = (options) => {
|
|
|
2180
2181
|
};
|
|
2181
2182
|
const loadingFirstSeen = new WeakMap;
|
|
2182
2183
|
const reportedStuckLoading = new WeakSet;
|
|
2184
|
+
const loadingDeadlineMs = (indicator) => {
|
|
2185
|
+
const configured = indicator.getAttribute(BEACON_ATTRIBUTE.LOADING_TIMEOUT)?.trim();
|
|
2186
|
+
if (!configured)
|
|
2187
|
+
return stuckLoadingMs;
|
|
2188
|
+
const parsed = Number(configured);
|
|
2189
|
+
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : stuckLoadingMs;
|
|
2190
|
+
};
|
|
2183
2191
|
const checkStuckLoading = () => {
|
|
2184
2192
|
if (document.visibilityState === "hidden")
|
|
2185
2193
|
return;
|
|
@@ -2196,11 +2204,15 @@ var createBeacon = (options) => {
|
|
|
2196
2204
|
loadingFirstSeen.set(indicator, now);
|
|
2197
2205
|
continue;
|
|
2198
2206
|
}
|
|
2199
|
-
|
|
2207
|
+
const deadlineMs = loadingDeadlineMs(indicator);
|
|
2208
|
+
if (now - firstSeen < deadlineMs || reportedStuckLoading.has(indicator)) {
|
|
2200
2209
|
continue;
|
|
2201
2210
|
}
|
|
2202
2211
|
reportedStuckLoading.add(indicator);
|
|
2203
|
-
reportScanIssue(indicator, BEACON_SIGNAL.STUCK_LOADING, `Stuck loading — ${describeElement(indicator)} never resolved`, {
|
|
2212
|
+
reportScanIssue(indicator, BEACON_SIGNAL.STUCK_LOADING, `Stuck loading — ${describeElement(indicator)} never resolved`, {
|
|
2213
|
+
deadlineMs: String(deadlineMs),
|
|
2214
|
+
visibleMs: String(now - firstSeen)
|
|
2215
|
+
});
|
|
2204
2216
|
}
|
|
2205
2217
|
};
|
|
2206
2218
|
const checkBlankAppRoots = () => {
|
|
@@ -3788,5 +3800,5 @@ export {
|
|
|
3788
3800
|
BEACON_ATTRIBUTE
|
|
3789
3801
|
};
|
|
3790
3802
|
|
|
3791
|
-
//# debugId=
|
|
3803
|
+
//# debugId=41713D2C1F9DB43B64756E2164756E21
|
|
3792
3804
|
//# sourceMappingURL=index.js.map
|