@absolutejs/beacon 0.6.56 → 0.6.58
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 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -12
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,7 +142,8 @@ beacon.captureMessage("checkout started", "info");
|
|
|
142
142
|
become warning issues: scroll jail (a leaked modal scroll lock), stuck
|
|
143
143
|
loading (`aria-busy`/`role="progressbar"` that never resolves), occluded
|
|
144
144
|
controls (leaked scrims/z-index bugs, skipped while a dialog is open),
|
|
145
|
-
invisible
|
|
145
|
+
invisible headings, controls, and semantic prose (fg composites to its
|
|
146
|
+
background — theme-token bugs),
|
|
146
147
|
stalled `EventSource` streams, WebSocket connect/close flapping, request
|
|
147
148
|
storms (one endpoint hammered in seconds), reload loops, stale releases (a
|
|
148
149
|
service worker serving a build older than one this browser already ran),
|
package/dist/index.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare const BEACON_ATTRIBUTE: {
|
|
|
107
107
|
/** Response header used to correlate a browser signal with its server request. */
|
|
108
108
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
109
109
|
/** Beacon package version retained with every captured event. */
|
|
110
|
-
export declare const BEACON_SDK_VERSION = "0.6.
|
|
110
|
+
export declare const BEACON_SDK_VERSION = "0.6.58";
|
|
111
111
|
/** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
|
|
112
112
|
export type BeaconTags = Record<string, string> & {
|
|
113
113
|
signal?: BeaconSignal;
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var BEACON_ATTRIBUTE = {
|
|
|
76
76
|
THEME: "data-beacon-theme"
|
|
77
77
|
};
|
|
78
78
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
79
|
-
var BEACON_SDK_VERSION = "0.6.
|
|
79
|
+
var BEACON_SDK_VERSION = "0.6.58";
|
|
80
80
|
var inBrowser = () => typeof window !== "undefined";
|
|
81
81
|
var newId = () => {
|
|
82
82
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -793,6 +793,7 @@ var createBeacon = (options) => {
|
|
|
793
793
|
const NAVIGATION_INTENT_MAX_AGE_MS = 30000;
|
|
794
794
|
const RELOAD_LOOP_STORAGE_KEY = "beacon:reload-history-v4";
|
|
795
795
|
const NAVIGATION_INTENT_STORAGE_KEY = "beacon:navigation-intent-v1";
|
|
796
|
+
const SERVICE_WORKER_UPDATE_INTENT_STORAGE_KEY = "beacon:service-worker-update-intent-v1";
|
|
796
797
|
const STALE_RELEASE_STORAGE_KEY = "beacon:release-first-seen";
|
|
797
798
|
const STALE_RELEASE_GRACE_MS = 600000;
|
|
798
799
|
const STALE_RELEASE_HISTORY_LIMIT = 5;
|
|
@@ -1086,7 +1087,7 @@ var createBeacon = (options) => {
|
|
|
1086
1087
|
push(event);
|
|
1087
1088
|
};
|
|
1088
1089
|
const emitSignal = (message, signalTags, traceId, extra, stackBoundary, fallbackFramesToDrop = 1, useDefaultFingerprint = false) => {
|
|
1089
|
-
if (staleClientRelease && signalTags.signal !== BEACON_SIGNAL.STALE_RELEASE)
|
|
1090
|
+
if (staleClientRelease && signalTags.signal !== BEACON_SIGNAL.STALE_RELEASE && signalTags.signal !== BEACON_SIGNAL.RELOAD_LOOP)
|
|
1090
1091
|
return;
|
|
1091
1092
|
const error = new Error(message);
|
|
1092
1093
|
const captureStackTrace = Error.captureStackTrace;
|
|
@@ -1141,7 +1142,8 @@ var createBeacon = (options) => {
|
|
|
1141
1142
|
return;
|
|
1142
1143
|
staleClientRelease = true;
|
|
1143
1144
|
for (let index = buffer.length - 1;index >= 0; index -= 1) {
|
|
1144
|
-
|
|
1145
|
+
const signal = buffer[index]?.tags?.signal;
|
|
1146
|
+
if (signal !== undefined && signal !== BEACON_SIGNAL.RELOAD_LOOP) {
|
|
1145
1147
|
buffer.splice(index, 1);
|
|
1146
1148
|
}
|
|
1147
1149
|
}
|
|
@@ -2461,9 +2463,14 @@ var createBeacon = (options) => {
|
|
|
2461
2463
|
const scanForInvisibleText = () => {
|
|
2462
2464
|
const viewportWidth = document.documentElement.clientWidth;
|
|
2463
2465
|
const viewportHeight = document.documentElement.clientHeight;
|
|
2464
|
-
const
|
|
2466
|
+
const priorityCandidates = document.querySelectorAll('h1, h2, h3, button, a[href], label, [role="button"]');
|
|
2467
|
+
const proseCandidates = document.querySelectorAll("p, li, dt, dd, td, th, blockquote, figcaption");
|
|
2468
|
+
const candidates = [
|
|
2469
|
+
...Array.from(priorityCandidates),
|
|
2470
|
+
...Array.from(proseCandidates)
|
|
2471
|
+
];
|
|
2465
2472
|
let sampled = 0;
|
|
2466
|
-
for (const element of
|
|
2473
|
+
for (const element of candidates) {
|
|
2467
2474
|
if (sampled >= INVISIBLE_TEXT_SAMPLE_LIMIT)
|
|
2468
2475
|
return;
|
|
2469
2476
|
if (isScanExempt(element))
|
|
@@ -4055,6 +4062,15 @@ var createBeacon = (options) => {
|
|
|
4055
4062
|
});
|
|
4056
4063
|
} catch {}
|
|
4057
4064
|
}
|
|
4065
|
+
if (typeof navigator.serviceWorker?.addEventListener === "function" && typeof sessionStorage !== "undefined") {
|
|
4066
|
+
const markServiceWorkerUpdate = () => {
|
|
4067
|
+
try {
|
|
4068
|
+
sessionStorage.setItem(SERVICE_WORKER_UPDATE_INTENT_STORAGE_KEY, String(Date.now()));
|
|
4069
|
+
} catch {}
|
|
4070
|
+
};
|
|
4071
|
+
navigator.serviceWorker.addEventListener("controllerchange", markServiceWorkerUpdate);
|
|
4072
|
+
cleanups.push(() => navigator.serviceWorker?.removeEventListener("controllerchange", markServiceWorkerUpdate));
|
|
4073
|
+
}
|
|
4058
4074
|
if (signals !== null && signals.reloadLoops !== false && typeof sessionStorage !== "undefined") {
|
|
4059
4075
|
try {
|
|
4060
4076
|
const navigation = performance.getEntriesByType("navigation")[0];
|
|
@@ -4072,17 +4088,18 @@ var createBeacon = (options) => {
|
|
|
4072
4088
|
history2 = [];
|
|
4073
4089
|
entryKind = "intentional-navigation";
|
|
4074
4090
|
}
|
|
4091
|
+
const rawServiceWorkerUpdateIntent = sessionStorage.getItem(SERVICE_WORKER_UPDATE_INTENT_STORAGE_KEY);
|
|
4092
|
+
sessionStorage.removeItem(SERVICE_WORKER_UPDATE_INTENT_STORAGE_KEY);
|
|
4093
|
+
const serviceWorkerUpdateIntentAt = Number(rawServiceWorkerUpdateIntent);
|
|
4094
|
+
if (rawServiceWorkerUpdateIntent !== null && Number.isFinite(serviceWorkerUpdateIntentAt) && now - serviceWorkerUpdateIntentAt >= 0 && now - serviceWorkerUpdateIntentAt <= NAVIGATION_INTENT_MAX_AGE_MS) {
|
|
4095
|
+
history2 = [];
|
|
4096
|
+
entryKind = "service-worker-update";
|
|
4097
|
+
}
|
|
4075
4098
|
if (document.referrer !== "") {
|
|
4076
4099
|
const referrer = new URL(document.referrer, location.href);
|
|
4077
4100
|
if (referrer.origin !== location.origin) {
|
|
4078
4101
|
history2 = [];
|
|
4079
4102
|
entryKind = "external";
|
|
4080
|
-
} else {
|
|
4081
|
-
const controllerScript = navigator.serviceWorker?.controller?.scriptURL;
|
|
4082
|
-
if (controllerScript !== undefined && new URL(controllerScript, location.href).pathname === referrer.pathname) {
|
|
4083
|
-
history2 = [];
|
|
4084
|
-
entryKind = "service-worker-update";
|
|
4085
|
-
}
|
|
4086
4103
|
}
|
|
4087
4104
|
}
|
|
4088
4105
|
history2.push({ at: now, route });
|
|
@@ -4096,12 +4113,16 @@ var createBeacon = (options) => {
|
|
|
4096
4113
|
if (loadCount === RELOAD_LOOP_COUNT) {
|
|
4097
4114
|
const firstLoad = history2.at(-loadCount)?.at ?? now;
|
|
4098
4115
|
emitSignal(`Reload loop — repeated page loads within a minute — ${shortUrl(location.href)}`, {
|
|
4116
|
+
currentRelease: options.release ?? "unknown",
|
|
4099
4117
|
entryKind,
|
|
4100
4118
|
loadCount: String(loadCount),
|
|
4101
4119
|
navigationType: navigation?.type ?? "unknown",
|
|
4120
|
+
serviceWorkerControlled: String(navigator.serviceWorker?.controller !== null && navigator.serviceWorker?.controller !== undefined),
|
|
4121
|
+
serviceWorkerScript: navigator.serviceWorker?.controller?.scriptURL ?? "none",
|
|
4102
4122
|
signal: BEACON_SIGNAL.RELOAD_LOOP,
|
|
4103
4123
|
windowMs: String(now - firstLoad)
|
|
4104
4124
|
});
|
|
4125
|
+
flush(true);
|
|
4105
4126
|
}
|
|
4106
4127
|
}
|
|
4107
4128
|
} catch {}
|
|
@@ -4522,5 +4543,5 @@ export {
|
|
|
4522
4543
|
BEACON_ATTRIBUTE
|
|
4523
4544
|
};
|
|
4524
4545
|
|
|
4525
|
-
//# debugId=
|
|
4546
|
+
//# debugId=D975CF731E75A99264756E2164756E21
|
|
4526
4547
|
//# sourceMappingURL=index.js.map
|