@absolutejs/beacon 0.4.17 → 0.4.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 +32 -8
- package/dist/index.d.ts +86 -2
- package/dist/index.js +738 -9
- package/dist/index.js.map +3 -3
- package/dist/manifest.js +2 -2
- package/dist/manifest.js.map +2 -2
- package/dist/manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -123,15 +123,39 @@ beacon.captureMessage("checkout started", "info");
|
|
|
123
123
|
storms (one endpoint hammered in seconds), reload loops, stale releases (a
|
|
124
124
|
service worker serving a build older than one this browser already ran),
|
|
125
125
|
font-face load failures, focus dropped to `<body>` when a dialog unmounts,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
focus escaping or never entering an explicit modal, browser interventions,
|
|
127
|
+
enforced CSP violations, repeated visible-page main-thread stalls, and form
|
|
128
|
+
frustration (identical resubmits / repeated native-validation failures).
|
|
129
|
+
Each is individually toggleable on `signals`, deduped, capped, and exempts
|
|
130
|
+
`data-beacon-scan="allow"` subtrees where a DOM scan is involved.
|
|
131
|
+
- **Theme and loading contracts** — mark an application boundary with
|
|
132
|
+
`data-beacon-theme="adaptive"` to report large opaque surfaces whose
|
|
133
|
+
luminance polarity contradicts the active light/dark mode. Intentional
|
|
134
|
+
inverted brand/media surfaces use `data-beacon-theme="allow"`. Loading UI
|
|
135
|
+
participates through native `aria-busy`/`role="progressbar"` semantics or
|
|
136
|
+
`data-beacon-loading`, without coupling the SDK to framework class names.
|
|
137
|
+
- **Browser capability failures** — rejected clipboard writes are observed even
|
|
138
|
+
when application code catches them (contents are never read), visible WebGL
|
|
139
|
+
contexts that do not restore after `webglcontextlost` become warnings, and a
|
|
140
|
+
focused editable control stranded behind the mobile visual viewport is
|
|
141
|
+
reported after the keyboard settles.
|
|
142
|
+
- **Embedded-content stalls** — visible iframes explicitly named with
|
|
143
|
+
`data-beacon-embed` report when their initial `load` never arrives. Generic
|
|
144
|
+
cross-origin error pages cannot be inspected, so Beacon deliberately makes no
|
|
145
|
+
stronger claim than the load deadline.
|
|
130
146
|
- **Actionable network signals** — expected aborts remain breadcrumbs instead of
|
|
131
147
|
issues; offline, timeout, isolated-endpoint, and multi-endpoint connectivity
|
|
132
|
-
failures are classified separately.
|
|
133
|
-
|
|
134
|
-
|
|
148
|
+
failures are classified separately. HTTP 429 responses and repeated 401/403
|
|
149
|
+
responses surface rate-limit and authorization storms without treating one
|
|
150
|
+
ordinary authorization rejection as an issue. Concurrent failures become one
|
|
151
|
+
event with every attempt, method, endpoint, duration, original error/stack,
|
|
152
|
+
online state, transport, and page visibility preserved in
|
|
153
|
+
`extra.networkFailures`.
|
|
154
|
+
- **Runtime boundary signals** — abnormal WebSocket closes, WebSocket and SSE
|
|
155
|
+
reconnect flapping, handled service-worker registration/install failures, and
|
|
156
|
+
dedicated/shared worker construction, runtime, and message-decoding failures
|
|
157
|
+
become replay-linked warnings. Normal socket closes, page teardown, hidden-tab
|
|
158
|
+
SSE errors, and successfully replaced service workers are exempt.
|
|
135
159
|
|
|
136
160
|
## API
|
|
137
161
|
|
|
@@ -148,7 +172,7 @@ setTags(tags) · setUser(user | null)
|
|
|
148
172
|
flush() => Promise<void> // buffered events out now
|
|
149
173
|
close() => Promise<void> // remove listeners + final flush
|
|
150
174
|
|
|
151
|
-
// Typed names for event.tags.signal in beforeSend policies:
|
|
175
|
+
// Typed names for event.tags.signal in beforeSend policies (all built-ins):
|
|
152
176
|
BEACON_SIGNAL.FETCH_FAILED
|
|
153
177
|
BEACON_SIGNAL.SLOW_RESPONSE
|
|
154
178
|
BEACON_SIGNAL.HTTP_5XX
|
package/dist/index.d.ts
CHANGED
|
@@ -21,37 +21,59 @@
|
|
|
21
21
|
export type BeaconLevel = "fatal" | "error" | "warning" | "info";
|
|
22
22
|
/** Stable names for Beacon's built-in UX and health signals. */
|
|
23
23
|
export declare const BEACON_SIGNAL: {
|
|
24
|
+
readonly AUTH_FAILURE_STORM: "auth_failure_storm";
|
|
25
|
+
readonly BROWSER_INTERVENTION: "browser_intervention";
|
|
24
26
|
readonly CONSOLE_ERROR: "console_error";
|
|
27
|
+
readonly CSP_VIOLATION: "csp_violation";
|
|
28
|
+
readonly CLIPBOARD_FAILURE: "clipboard_failure";
|
|
25
29
|
readonly DEAD_CLICK: "dead_click";
|
|
26
30
|
readonly FETCH_FAILED: "fetch_failed";
|
|
27
31
|
readonly FOCUS_LOST: "focus_lost";
|
|
28
32
|
readonly FONT_FAILURE: "font_failure";
|
|
29
33
|
readonly FORM_FRUSTRATION: "form_frustration";
|
|
34
|
+
readonly FOCUSED_CONTROL_OFFSCREEN: "focused_control_offscreen";
|
|
30
35
|
readonly HTTP_5XX: "http_5xx";
|
|
31
36
|
readonly INVISIBLE_TEXT: "invisible_text";
|
|
37
|
+
readonly EMBEDDED_CONTENT_STALLED: "embedded_content_stalled";
|
|
32
38
|
readonly LAYOUT_OVERFLOW: "layout_overflow";
|
|
39
|
+
readonly MAIN_THREAD_STALL: "main_thread_stall";
|
|
40
|
+
readonly MODAL_FOCUS_ESCAPE: "modal_focus_escape";
|
|
33
41
|
readonly OCCLUDED_CONTROL: "occluded_control";
|
|
34
42
|
readonly RAGE_CLICK: "rage_click";
|
|
43
|
+
readonly RATE_LIMITED: "rate_limited";
|
|
35
44
|
readonly RELOAD_LOOP: "reload_loop";
|
|
36
45
|
readonly REQUEST_STORM: "request_storm";
|
|
37
46
|
readonly SCROLL_JAIL: "scroll_jail";
|
|
38
47
|
readonly SLOW_RESPONSE: "slow_response";
|
|
48
|
+
readonly SOCKET_ABNORMAL_CLOSE: "socket_abnormal_close";
|
|
39
49
|
readonly SOCKET_FLAPPING: "socket_flapping";
|
|
50
|
+
readonly SSE_FLAPPING: "sse_flapping";
|
|
40
51
|
readonly STALE_RELEASE: "stale_release";
|
|
41
52
|
readonly STALLED_STREAM: "stalled_stream";
|
|
42
53
|
readonly STUCK_LOADING: "stuck_loading";
|
|
54
|
+
readonly THEME_MISMATCH: "theme_mismatch";
|
|
55
|
+
readonly WEBGL_CONTEXT_LOST: "webgl_context_lost";
|
|
56
|
+
readonly SERVICE_WORKER_FAILURE: "service_worker_failure";
|
|
57
|
+
readonly WORKER_FAILURE: "worker_failure";
|
|
43
58
|
};
|
|
44
59
|
export type BeaconSignal = (typeof BEACON_SIGNAL)[keyof typeof BEACON_SIGNAL];
|
|
45
60
|
/** Stable DOM attributes understood by Beacon's instrumentation. */
|
|
46
61
|
export declare const BEACON_ATTRIBUTE: {
|
|
47
62
|
readonly DEAD_CLICK: "data-beacon-dead-click";
|
|
48
63
|
readonly NAME: "data-beacon-name";
|
|
64
|
+
/** Names an iframe whose initial load should be watched for a stall. */
|
|
65
|
+
readonly EMBED: "data-beacon-embed";
|
|
66
|
+
/** Marks loading UI that should participate in the stuck-loading watchdog. */
|
|
67
|
+
readonly LOADING: "data-beacon-loading";
|
|
49
68
|
/** `="allow"` exempts an element AND its subtree from layout-overflow
|
|
50
69
|
* detection — for deliberate bleeds (decorative shapes, marquees). */
|
|
51
70
|
readonly OVERFLOW: "data-beacon-overflow";
|
|
52
71
|
/** `="allow"` exempts an element AND its subtree from the visual scan
|
|
53
72
|
* detectors (occluded controls, invisible text, stuck loading). */
|
|
54
73
|
readonly SCAN: "data-beacon-scan";
|
|
74
|
+
/** `="adaptive"` opts a subtree into theme-polarity checks; `="allow"`
|
|
75
|
+
* exempts an intentional opposite-theme surface and its subtree. */
|
|
76
|
+
readonly THEME: "data-beacon-theme";
|
|
55
77
|
};
|
|
56
78
|
/** Response header used to correlate a browser signal with its server request. */
|
|
57
79
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
@@ -141,10 +163,24 @@ export type BeaconResourceFailure = {
|
|
|
141
163
|
* full session streaming. Each enabled signal becomes a warning-level issue
|
|
142
164
|
* (via `captureException`, so it carries breadcrumbs + the replayId), surfacing
|
|
143
165
|
* silent problems no thrown error or user report would: rage/dead clicks,
|
|
144
|
-
* server
|
|
145
|
-
*
|
|
166
|
+
* server failures, policy violations, worker/realtime faults, and
|
|
167
|
+
* `console.error`. Each detector is feature-gated and independently tunable.
|
|
146
168
|
*/
|
|
147
169
|
export type BeaconSignals = {
|
|
170
|
+
/** Repeated 401/403 responses from one endpoint inside a short window.
|
|
171
|
+
* Default true. */
|
|
172
|
+
authFailureStorms?: boolean;
|
|
173
|
+
/** Authorization failures from one endpoint that trip a storm. Default 4. */
|
|
174
|
+
authFailureStormCount?: number;
|
|
175
|
+
/** Window for the authorization-failure storm counter. Default 30000ms. */
|
|
176
|
+
authFailureStormWindowMs?: number;
|
|
177
|
+
/** Browser intervention reports surfaced by ReportingObserver. Default true. */
|
|
178
|
+
browserInterventions?: boolean;
|
|
179
|
+
/** Enforced Content Security Policy violations. Default true. */
|
|
180
|
+
cspViolations?: boolean;
|
|
181
|
+
/** Rejected clipboard writes, including failures handled by application
|
|
182
|
+
* code. Clipboard contents are never captured. Default true. */
|
|
183
|
+
clipboardFailures?: boolean;
|
|
148
184
|
/** N rapid clicks in roughly the same spot. Default true. */
|
|
149
185
|
rageClicks?: boolean;
|
|
150
186
|
/** An interactive control clicked with no DOM/nav/scroll/focus/request response. Default true. */
|
|
@@ -166,6 +202,16 @@ export type BeaconSignals = {
|
|
|
166
202
|
/** The same form submitted or failing native validation repeatedly within a
|
|
167
203
|
* minute — the quiet sibling of a rage click. Default true. */
|
|
168
204
|
formFrustration?: boolean;
|
|
205
|
+
/** A focused editable control left outside the mobile visual viewport after
|
|
206
|
+
* the on-screen keyboard settles. Default true. */
|
|
207
|
+
focusedControlsOffscreen?: boolean;
|
|
208
|
+
/** Grace period after focus/visual-viewport movement. Default 500ms. */
|
|
209
|
+
focusedControlSettleMs?: number;
|
|
210
|
+
/** Opt-in iframes marked with `data-beacon-embed` that never fire their
|
|
211
|
+
* initial load event. Default true. */
|
|
212
|
+
embeddedContentStalls?: boolean;
|
|
213
|
+
/** Initial iframe load deadline. Default 15000ms. */
|
|
214
|
+
embeddedContentStallMs?: number;
|
|
169
215
|
/** Sampled scan for text rendered nearly the same color as its opaque
|
|
170
216
|
* background (theme-token bugs). Default true. */
|
|
171
217
|
invisibleText?: boolean;
|
|
@@ -183,12 +229,25 @@ export type BeaconSignals = {
|
|
|
183
229
|
/** Quiet period after load/resize/navigation before the settled visual
|
|
184
230
|
* scan runs, letting transitions and lazy content settle. Default 600ms. */
|
|
185
231
|
layoutOverflowSettleMs?: number;
|
|
232
|
+
/** Repeated long animation frames/tasks on a visible page. Default true. */
|
|
233
|
+
mainThreadStalls?: boolean;
|
|
234
|
+
/** Long-frame duration that counts as a main-thread stall. Default 200ms. */
|
|
235
|
+
mainThreadStallMs?: number;
|
|
236
|
+
/** Stalls inside the window that trip a report. Default 3. */
|
|
237
|
+
mainThreadStallCount?: number;
|
|
238
|
+
/** Window for repeated main-thread stalls. Default 10000ms. */
|
|
239
|
+
mainThreadStallWindowMs?: number;
|
|
240
|
+
/** Focus outside an open modal, including a modal that never receives
|
|
241
|
+
* initial focus. Default true. */
|
|
242
|
+
modalFocusEscape?: boolean;
|
|
186
243
|
/** Sampled `elementFromPoint` check for interactive controls covered by an
|
|
187
244
|
* unrelated element (leaked scrims, z-index bugs). Skipped entirely while
|
|
188
245
|
* a dialog is open. Default true. */
|
|
189
246
|
occludedControls?: boolean;
|
|
190
247
|
/** Rapid-click count that trips a rage click. Default 3. */
|
|
191
248
|
rageClickCount?: number;
|
|
249
|
+
/** HTTP 429 responses. Default true. */
|
|
250
|
+
rateLimits?: boolean;
|
|
192
251
|
/** Several full page loads within a minute — a crash or reload loop.
|
|
193
252
|
* Default true. */
|
|
194
253
|
reloadLoops?: boolean;
|
|
@@ -204,9 +263,20 @@ export type BeaconSignals = {
|
|
|
204
263
|
* scroll lock leaked by a closed modal. Boundary scrolling (already at the
|
|
205
264
|
* top/bottom) is exempt. Default true. */
|
|
206
265
|
scrollJail?: boolean;
|
|
266
|
+
/** Service-worker registration and installation failures. Default true. */
|
|
267
|
+
serviceWorkerFailures?: boolean;
|
|
268
|
+
/** Abnormal WebSocket closes (`wasClean: false` or non-normal codes).
|
|
269
|
+
* Default true. */
|
|
270
|
+
socketAbnormalCloses?: boolean;
|
|
207
271
|
/** WebSocket connect/close cycles to one URL tripping a flap report.
|
|
208
272
|
* Default true. */
|
|
209
273
|
socketFlapping?: boolean;
|
|
274
|
+
/** Repeated EventSource error/reconnect cycles. Default true. */
|
|
275
|
+
sseFlapping?: boolean;
|
|
276
|
+
/** EventSource failures that trip a flap report. Default 4. */
|
|
277
|
+
sseFlapCount?: number;
|
|
278
|
+
/** Window for EventSource flap detection. Default 60000ms. */
|
|
279
|
+
sseFlapWindowMs?: number;
|
|
210
280
|
/** This page's `release` is older than one this browser has already run —
|
|
211
281
|
* a service worker or cache serving a stale build. Default true. */
|
|
212
282
|
staleReleases?: boolean;
|
|
@@ -223,6 +293,20 @@ export type BeaconSignals = {
|
|
|
223
293
|
/** Age at which a visible loading indicator counts as stuck.
|
|
224
294
|
* Default 20000ms. */
|
|
225
295
|
stuckLoadingMs?: number;
|
|
296
|
+
/** Opposite-polarity opaque surfaces inside subtrees explicitly marked
|
|
297
|
+
* `data-beacon-theme="adaptive"`. Default true. */
|
|
298
|
+
themeMismatches?: boolean;
|
|
299
|
+
/** Visible surface area required for theme-polarity checks. Default
|
|
300
|
+
* 10000px². */
|
|
301
|
+
themeMismatchMinArea?: number;
|
|
302
|
+
/** Visible WebGL canvases whose context remains lost after a restoration
|
|
303
|
+
* grace period. Default true. */
|
|
304
|
+
webglContextLosses?: boolean;
|
|
305
|
+
/** Grace period for `webglcontextrestored`. Default 2000ms. */
|
|
306
|
+
webglRestoreGraceMs?: number;
|
|
307
|
+
/** Dedicated/shared worker construction, runtime, and message decoding
|
|
308
|
+
* failures. Default true. */
|
|
309
|
+
workerFailures?: boolean;
|
|
226
310
|
/**
|
|
227
311
|
* Maximum wait for a same-origin link accepted by an SPA router to finish
|
|
228
312
|
* navigating before it is considered dead. Default 8000ms; never shorter
|