@absolutejs/beacon 0.7.0-beta.14 → 0.7.0-beta.16
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/CHANGELOG.md +12 -0
- package/README.md +52 -0
- package/changelog.json +30 -0
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.js +2 -1
- package/dist/contracts.js.map +3 -3
- package/dist/index.d.ts +5 -1
- package/dist/index.js +86 -2
- package/dist/index.js.map +4 -4
- package/dist/outbox.d.ts +42 -0
- package/dist/policy.js +2 -1
- package/dist/policy.js.map +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ This file is generated by `absolute-changelog` from the entries in
|
|
|
6
6
|
`changelog/`. Edit an entry, not this file — and add new ones under
|
|
7
7
|
`changelog/unreleased/`.
|
|
8
8
|
|
|
9
|
+
## 0.7.0-beta.16 — 2026-10-24
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **A durable browser outbox (@absolutejs/beacon/outbox): bounded IndexedDB or memory storage, acknowledged delivery, retry backoff and pruning** (`BEACON_SDK_VERSION`)
|
|
14
|
+
|
|
15
|
+
## 0.7.0-beta.15 — 2026-09-30
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **Report a modal (an open `<dialog>` or `aria-modal` element) that opens with content but renders under 24px in either direction, such as a flex layout one browser engine collapses to zero height: to the person the click did nothing. New `collapsed_modal` signal with the rendered and content sizes; `signals.collapsedModals: false` turns it off.** (`createBeacon`, `BEACON_SIGNAL`, `BeaconSignal`, `BeaconSignals`, `BEACON_SDK_VERSION`)
|
|
20
|
+
|
|
9
21
|
## 0.7.0-beta.14 — 2026-09-30
|
|
10
22
|
|
|
11
23
|
### Added
|
package/README.md
CHANGED
|
@@ -346,3 +346,55 @@ the bundler merge the whole SDK back into it, defeating lazy startup.
|
|
|
346
346
|
|
|
347
347
|
BSL-1.1 with a named carveout against hosted error-tracking / session-replay
|
|
348
348
|
SaaS (Sentry, Datadog, LogRocket). See `LICENSE`.
|
|
349
|
+
|
|
350
|
+
## Durable outbox
|
|
351
|
+
|
|
352
|
+
`@absolutejs/beacon/outbox` exports `createOutbox`, `createIndexedDBOutboxStore`,
|
|
353
|
+
`createMemoryOutboxStore`, and the `OutboxStore`/`OutboxRecord` types. It is a
|
|
354
|
+
separate browser entry point: existing beacon collectors keep their current API.
|
|
355
|
+
The host supplies already-redacted payloads and owns scheduling and server storage.
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
import {
|
|
359
|
+
createOutbox,
|
|
360
|
+
createIndexedDBOutboxStore,
|
|
361
|
+
} from "@absolutejs/beacon/outbox";
|
|
362
|
+
const outbox = createOutbox({
|
|
363
|
+
store: createIndexedDBOutboxStore("my-app-telemetry"),
|
|
364
|
+
send: async (record, signal) => {
|
|
365
|
+
const response = await fetch("/diagnostics/batches", {
|
|
366
|
+
method: "POST",
|
|
367
|
+
signal,
|
|
368
|
+
headers: { "Content-Type": "application/json" },
|
|
369
|
+
body: record.body,
|
|
370
|
+
});
|
|
371
|
+
if (!response.ok) throw Error("Delivery failed");
|
|
372
|
+
return (await response.json()).ack;
|
|
373
|
+
},
|
|
374
|
+
});
|
|
375
|
+
const id = crypto.randomUUID();
|
|
376
|
+
await outbox.enqueue({ id, events: [] }, id);
|
|
377
|
+
await outbox.flush();
|
|
378
|
+
// Also flush on a host-owned interval, online, and next startup.
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
A successful `enqueue` means the store accepted the record; it does not mean the
|
|
382
|
+
server received it. The server must deduplicate IDs and return the same ID only
|
|
383
|
+
after committing storage. `flush()` leaves records in place on timeout, failed
|
|
384
|
+
transport or a mismatched acknowledgement; it coalesces concurrent calls and
|
|
385
|
+
honors exponential retry backoff. It does not start timers/listeners itself.
|
|
386
|
+
|
|
387
|
+
Defaults: 128 records, 4 MB total, 1 MB each, two-day expiry, five-second attempt
|
|
388
|
+
timeout. Oldest records are pruned under pressure. `stats()` reports pending
|
|
389
|
+
records/bytes, drop/expiry/error/acknowledgement counts, cumulative persistence
|
|
390
|
+
latency and retry time. Counters are per instance. Multiple tabs can resend a
|
|
391
|
+
record and their bounds are not an atomic global quota. Browser eviction and
|
|
392
|
+
storage failure remain possible; persistence errors are surfaced to the host.
|
|
393
|
+
Memory storage is explicit and does not survive reloads. IndexedDB accepts
|
|
394
|
+
bounded JSON batches, not blobs or a full gameplay replay. The custom store and
|
|
395
|
+
transport interfaces allow later adapters without changing game code.
|
|
396
|
+
|
|
397
|
+
Validation: `bun test tests/outbox.test.ts` covers restart recovery, unchanged
|
|
398
|
+
retry IDs, acknowledgement mismatch, overlapping flushes, capacity/age limits,
|
|
399
|
+
timeouts and quota failure. Exercised by Hello World's real browser offline /
|
|
400
|
+
reload / retry workflow.
|
package/changelog.json
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "@absolutejs/beacon",
|
|
4
4
|
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "added",
|
|
9
|
+
"summary": "A durable browser outbox (@absolutejs/beacon/outbox): bounded IndexedDB or memory storage, acknowledged delivery, retry backoff and pruning",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"BEACON_SDK_VERSION"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"date": "2026-10-24",
|
|
16
|
+
"version": "0.7.0-beta.16"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"changes": [
|
|
20
|
+
{
|
|
21
|
+
"kind": "added",
|
|
22
|
+
"summary": "Report a modal (an open `<dialog>` or `aria-modal` element) that opens with content but renders under 24px in either direction, such as a flex layout one browser engine collapses to zero height: to the person the click did nothing. New `collapsed_modal` signal with the rendered and content sizes; `signals.collapsedModals: false` turns it off.",
|
|
23
|
+
"symbols": [
|
|
24
|
+
"createBeacon",
|
|
25
|
+
"BEACON_SIGNAL",
|
|
26
|
+
"BeaconSignal",
|
|
27
|
+
"BeaconSignals",
|
|
28
|
+
"BEACON_SDK_VERSION"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"date": "2026-09-30",
|
|
33
|
+
"version": "0.7.0-beta.15"
|
|
34
|
+
},
|
|
5
35
|
{
|
|
6
36
|
"changes": [
|
|
7
37
|
{
|
package/dist/contracts.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const BEACON_SIGNAL: {
|
|
|
10
10
|
readonly CONTROL_COLLISION: "control_collision";
|
|
11
11
|
readonly CSP_VIOLATION: "csp_violation";
|
|
12
12
|
readonly CLIPBOARD_FAILURE: "clipboard_failure";
|
|
13
|
+
readonly COLLAPSED_MODAL: "collapsed_modal";
|
|
13
14
|
readonly DEAD_CLICK: "dead_click";
|
|
14
15
|
readonly DISRUPTIVE_LAYOUT_SHIFT: "disruptive_layout_shift";
|
|
15
16
|
readonly DOCUMENT_DISCARDED: "document_discarded";
|
package/dist/contracts.js
CHANGED
|
@@ -10,6 +10,7 @@ var BEACON_SIGNAL = {
|
|
|
10
10
|
CONTROL_COLLISION: "control_collision",
|
|
11
11
|
CSP_VIOLATION: "csp_violation",
|
|
12
12
|
CLIPBOARD_FAILURE: "clipboard_failure",
|
|
13
|
+
COLLAPSED_MODAL: "collapsed_modal",
|
|
13
14
|
DEAD_CLICK: "dead_click",
|
|
14
15
|
DISRUPTIVE_LAYOUT_SHIFT: "disruptive_layout_shift",
|
|
15
16
|
DOCUMENT_DISCARDED: "document_discarded",
|
|
@@ -73,5 +74,5 @@ export {
|
|
|
73
74
|
BEACON_SIGNAL
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
//# debugId=
|
|
77
|
+
//# debugId=CC210BEB9F1502B164756E2164756E21
|
|
77
78
|
//# sourceMappingURL=contracts.js.map
|
package/dist/contracts.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/contracts.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/** Stable names for Beacon's built-in UX and health signals. */\nexport const BEACON_SIGNAL = {\n AUTH_FAILURE_STORM: \"auth_failure_storm\",\n BROWSER_INTERVENTION: \"browser_intervention\",\n BROWSER_POLICY_VIOLATION: \"browser_policy_violation\",\n BFCACHE_BLOCKED: \"bfcache_blocked\",\n CAPABILITY_FAILURE: \"capability_failure\",\n BLANK_APP_ROOT: \"blank_app_root\",\n CONSOLE_ERROR: \"console_error\",\n CONTROL_COLLISION: \"control_collision\",\n CSP_VIOLATION: \"csp_violation\",\n CLIPBOARD_FAILURE: \"clipboard_failure\",\n DEAD_CLICK: \"dead_click\",\n DISRUPTIVE_LAYOUT_SHIFT: \"disruptive_layout_shift\",\n DOCUMENT_DISCARDED: \"document_discarded\",\n ERROR_CLICK: \"error_click\",\n FETCH_FAILED: \"fetch_failed\",\n FOCUS_LOST: \"focus_lost\",\n FONT_FAILURE: \"font_failure\",\n FORM_FRUSTRATION: \"form_frustration\",\n FORM_ABANDONMENT: \"form_abandonment\",\n FOCUSED_CONTROL_OFFSCREEN: \"focused_control_offscreen\",\n HTTP_5XX: \"http_5xx\",\n HTTP_RESPONSE_FAILURE: \"http_response_failure\",\n INVISIBLE_TEXT: \"invisible_text\",\n EMBEDDED_CONTENT_STALLED: \"embedded_content_stalled\",\n LAYOUT_OVERFLOW: \"layout_overflow\",\n MAIN_THREAD_STALL: \"main_thread_stall\",\n MEDIA_PLAYBACK_FAILED: \"media_playback_failed\",\n MEDIA_PLAYBACK_STALLED: \"media_playback_stalled\",\n MODAL_FOCUS_ESCAPE: \"modal_focus_escape\",\n OCCLUDED_CONTROL: \"occluded_control\",\n RAGE_CLICK: \"rage_click\",\n RATE_LIMITED: \"rate_limited\",\n NAVIGATION_STALLED: \"navigation_stalled\",\n RELOAD_LOOP: \"reload_loop\",\n REQUEST_STORM: \"request_storm\",\n SEMANTIC_RESPONSE_FAILURE: \"semantic_response_failure\",\n SCROLL_JAIL: \"scroll_jail\",\n SLOW_RESPONSE: \"slow_response\",\n SLOW_RESOURCE: \"slow_resource\",\n SLOW_INTERACTION: \"slow_interaction\",\n SOCKET_ABNORMAL_CLOSE: \"socket_abnormal_close\",\n SOCKET_FLAPPING: \"socket_flapping\",\n SSE_FLAPPING: \"sse_flapping\",\n STALE_RELEASE: \"stale_release\",\n STALLED_STREAM: \"stalled_stream\",\n STUCK_LOADING: \"stuck_loading\",\n THEME_MISMATCH: \"theme_mismatch\",\n THRASHED_CURSOR: \"thrashed_cursor\",\n STORAGE_FAILURE: \"storage_failure\",\n WEBGL_CONTEXT_LOST: \"webgl_context_lost\",\n SERVICE_WORKER_FAILURE: \"service_worker_failure\",\n WORKER_FAILURE: \"worker_failure\",\n} as const;\n\nexport type BeaconSignal = (typeof BEACON_SIGNAL)[keyof typeof BEACON_SIGNAL];\n\n/** Stable DOM attributes understood by Beacon's instrumentation. */\nexport const BEACON_ATTRIBUTE = {\n APP_ROOT: \"data-beacon-app-root\",\n CONTROL_GROUP: \"data-beacon-control-group\",\n DEAD_CLICK: \"data-beacon-dead-click\",\n NAME: \"data-beacon-name\",\n EMBED: \"data-beacon-embed\",\n LOADING: \"data-beacon-loading\",\n LOADING_TIMEOUT: \"data-beacon-loading-timeout\",\n FORM: \"data-beacon-form\",\n /** `=\"allow\"` exempts an intentional dynamic subtree from layout-shift issues. */\n LAYOUT_SHIFT: \"data-beacon-layout-shift\",\n MEDIA: \"data-beacon-media\",\n OVERFLOW: \"data-beacon-overflow\",\n SCAN: \"data-beacon-scan\",\n THEME: \"data-beacon-theme\",\n} as const;\n"
|
|
5
|
+
"/** Stable names for Beacon's built-in UX and health signals. */\nexport const BEACON_SIGNAL = {\n AUTH_FAILURE_STORM: \"auth_failure_storm\",\n BROWSER_INTERVENTION: \"browser_intervention\",\n BROWSER_POLICY_VIOLATION: \"browser_policy_violation\",\n BFCACHE_BLOCKED: \"bfcache_blocked\",\n CAPABILITY_FAILURE: \"capability_failure\",\n BLANK_APP_ROOT: \"blank_app_root\",\n CONSOLE_ERROR: \"console_error\",\n CONTROL_COLLISION: \"control_collision\",\n CSP_VIOLATION: \"csp_violation\",\n CLIPBOARD_FAILURE: \"clipboard_failure\",\n COLLAPSED_MODAL: \"collapsed_modal\",\n DEAD_CLICK: \"dead_click\",\n DISRUPTIVE_LAYOUT_SHIFT: \"disruptive_layout_shift\",\n DOCUMENT_DISCARDED: \"document_discarded\",\n ERROR_CLICK: \"error_click\",\n FETCH_FAILED: \"fetch_failed\",\n FOCUS_LOST: \"focus_lost\",\n FONT_FAILURE: \"font_failure\",\n FORM_FRUSTRATION: \"form_frustration\",\n FORM_ABANDONMENT: \"form_abandonment\",\n FOCUSED_CONTROL_OFFSCREEN: \"focused_control_offscreen\",\n HTTP_5XX: \"http_5xx\",\n HTTP_RESPONSE_FAILURE: \"http_response_failure\",\n INVISIBLE_TEXT: \"invisible_text\",\n EMBEDDED_CONTENT_STALLED: \"embedded_content_stalled\",\n LAYOUT_OVERFLOW: \"layout_overflow\",\n MAIN_THREAD_STALL: \"main_thread_stall\",\n MEDIA_PLAYBACK_FAILED: \"media_playback_failed\",\n MEDIA_PLAYBACK_STALLED: \"media_playback_stalled\",\n MODAL_FOCUS_ESCAPE: \"modal_focus_escape\",\n OCCLUDED_CONTROL: \"occluded_control\",\n RAGE_CLICK: \"rage_click\",\n RATE_LIMITED: \"rate_limited\",\n NAVIGATION_STALLED: \"navigation_stalled\",\n RELOAD_LOOP: \"reload_loop\",\n REQUEST_STORM: \"request_storm\",\n SEMANTIC_RESPONSE_FAILURE: \"semantic_response_failure\",\n SCROLL_JAIL: \"scroll_jail\",\n SLOW_RESPONSE: \"slow_response\",\n SLOW_RESOURCE: \"slow_resource\",\n SLOW_INTERACTION: \"slow_interaction\",\n SOCKET_ABNORMAL_CLOSE: \"socket_abnormal_close\",\n SOCKET_FLAPPING: \"socket_flapping\",\n SSE_FLAPPING: \"sse_flapping\",\n STALE_RELEASE: \"stale_release\",\n STALLED_STREAM: \"stalled_stream\",\n STUCK_LOADING: \"stuck_loading\",\n THEME_MISMATCH: \"theme_mismatch\",\n THRASHED_CURSOR: \"thrashed_cursor\",\n STORAGE_FAILURE: \"storage_failure\",\n WEBGL_CONTEXT_LOST: \"webgl_context_lost\",\n SERVICE_WORKER_FAILURE: \"service_worker_failure\",\n WORKER_FAILURE: \"worker_failure\",\n} as const;\n\nexport type BeaconSignal = (typeof BEACON_SIGNAL)[keyof typeof BEACON_SIGNAL];\n\n/** Stable DOM attributes understood by Beacon's instrumentation. */\nexport const BEACON_ATTRIBUTE = {\n APP_ROOT: \"data-beacon-app-root\",\n CONTROL_GROUP: \"data-beacon-control-group\",\n DEAD_CLICK: \"data-beacon-dead-click\",\n NAME: \"data-beacon-name\",\n EMBED: \"data-beacon-embed\",\n LOADING: \"data-beacon-loading\",\n LOADING_TIMEOUT: \"data-beacon-loading-timeout\",\n FORM: \"data-beacon-form\",\n /** `=\"allow\"` exempts an intentional dynamic subtree from layout-shift issues. */\n LAYOUT_SHIFT: \"data-beacon-layout-shift\",\n MEDIA: \"data-beacon-media\",\n OVERFLOW: \"data-beacon-overflow\",\n SCAN: \"data-beacon-scan\",\n THEME: \"data-beacon-theme\",\n} as const;\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";AACO,IAAM,gBAAgB;AAAA,EAC3B,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,0BAA0B;AAAA,EAC1B,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,yBAAyB;AAAA,EACzB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,gBAAgB;AAClB;AAKO,IAAM,mBAAmB;AAAA,EAC9B,UAAU;AAAA,EACV,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,MAAM;AAAA,EAEN,cAAc;AAAA,EACd,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AACT;",
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AACO,IAAM,gBAAgB;AAAA,EAC3B,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,0BAA0B;AAAA,EAC1B,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,yBAAyB;AAAA,EACzB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,gBAAgB;AAClB;AAKO,IAAM,mBAAmB;AAAA,EAC9B,UAAU;AAAA,EACV,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,MAAM;AAAA,EAEN,cAAc;AAAA,EACd,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AACT;",
|
|
8
|
+
"debugId": "CC210BEB9F1502B164756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type BeaconLevel = "fatal" | "error" | "warning" | "info";
|
|
|
25
25
|
/** Response header used to correlate a browser signal with its server request. */
|
|
26
26
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
27
27
|
/** Beacon package version retained with every captured event. */
|
|
28
|
-
export declare const BEACON_SDK_VERSION = "0.7.0-beta.
|
|
28
|
+
export declare const BEACON_SDK_VERSION = "0.7.0-beta.16";
|
|
29
29
|
/** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
|
|
30
30
|
export type BeaconTags = Record<string, string> & {
|
|
31
31
|
signal?: BeaconSignal;
|
|
@@ -256,6 +256,10 @@ export type BeaconSignals = {
|
|
|
256
256
|
mainThreadStallCount?: number;
|
|
257
257
|
/** Window for repeated main-thread stalls. Default 10000ms. */
|
|
258
258
|
mainThreadStallWindowMs?: number;
|
|
259
|
+
/** A modal (open `<dialog>` or `aria-modal`) that opens with content but
|
|
260
|
+
* renders too small to see, such as a flex layout one engine collapses to
|
|
261
|
+
* zero height. To the user the click simply did nothing. Default true. */
|
|
262
|
+
collapsedModals?: boolean;
|
|
259
263
|
/** Focus outside an open modal, including a modal that never receives
|
|
260
264
|
* initial focus. Default true. */
|
|
261
265
|
modalFocusEscape?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var BEACON_SIGNAL = {
|
|
|
10
10
|
CONTROL_COLLISION: "control_collision",
|
|
11
11
|
CSP_VIOLATION: "csp_violation",
|
|
12
12
|
CLIPBOARD_FAILURE: "clipboard_failure",
|
|
13
|
+
COLLAPSED_MODAL: "collapsed_modal",
|
|
13
14
|
DEAD_CLICK: "dead_click",
|
|
14
15
|
DISRUPTIVE_LAYOUT_SHIFT: "disruptive_layout_shift",
|
|
15
16
|
DOCUMENT_DISCARDED: "document_discarded",
|
|
@@ -191,7 +192,7 @@ var consumeEarlyLayoutShiftBuffer = () => {
|
|
|
191
192
|
|
|
192
193
|
// src/index.ts
|
|
193
194
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
194
|
-
var BEACON_SDK_VERSION = "0.7.0-beta.
|
|
195
|
+
var BEACON_SDK_VERSION = "0.7.0-beta.16";
|
|
195
196
|
var inBrowser = () => typeof window !== "undefined";
|
|
196
197
|
var newId = () => {
|
|
197
198
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -976,6 +977,8 @@ var createBeacon = (options) => {
|
|
|
976
977
|
const STALLED_STREAM_DEFAULT_MS = 60000;
|
|
977
978
|
const SERVICE_WORKER_RECOVERY_DEFAULT_MS = 8000;
|
|
978
979
|
const MODAL_FOCUS_SETTLE_MS = 100;
|
|
980
|
+
const COLLAPSED_MODAL_MIN_PX = 24;
|
|
981
|
+
const COLLAPSED_MODAL_SETTLE_MS = 400;
|
|
979
982
|
const MAIN_THREAD_STALL_DEFAULT_MS = 200;
|
|
980
983
|
const MAIN_THREAD_STALL_DEFAULT_COUNT = 3;
|
|
981
984
|
const MAIN_THREAD_STALL_DEFAULT_WINDOW_MS = 1e4;
|
|
@@ -3796,6 +3799,87 @@ var createBeacon = (options) => {
|
|
|
3796
3799
|
});
|
|
3797
3800
|
cleanups.push(() => document.removeEventListener("pointermove", onPointerMove));
|
|
3798
3801
|
}
|
|
3802
|
+
if (signals.collapsedModals !== false && typeof MutationObserver !== "undefined") {
|
|
3803
|
+
const COLLAPSED_MODAL_SELECTOR = '[aria-modal="true"], dialog[open]';
|
|
3804
|
+
const reportedCollapsedModals = new WeakSet;
|
|
3805
|
+
const pendingCollapsedModals = new WeakSet;
|
|
3806
|
+
const collapsedModalTimers = new Set;
|
|
3807
|
+
const isHiddenOnPurpose = (modal) => {
|
|
3808
|
+
let current = modal;
|
|
3809
|
+
while (current !== null) {
|
|
3810
|
+
if (current.hasAttribute("hidden") || current.getAttribute("aria-hidden")?.toLowerCase() === "true") {
|
|
3811
|
+
return true;
|
|
3812
|
+
}
|
|
3813
|
+
const style = getComputedStyle(current);
|
|
3814
|
+
if (style.display === "none" || style.visibility === "hidden" || style.visibility === "collapse" || style.contentVisibility === "hidden") {
|
|
3815
|
+
return true;
|
|
3816
|
+
}
|
|
3817
|
+
current = current.parentElement;
|
|
3818
|
+
}
|
|
3819
|
+
return false;
|
|
3820
|
+
};
|
|
3821
|
+
const checkCollapsedModal = (modal) => {
|
|
3822
|
+
if (reportedCollapsedModals.has(modal) || pendingCollapsedModals.has(modal)) {
|
|
3823
|
+
return;
|
|
3824
|
+
}
|
|
3825
|
+
pendingCollapsedModals.add(modal);
|
|
3826
|
+
const timer = setTimeout(() => {
|
|
3827
|
+
collapsedModalTimers.delete(timer);
|
|
3828
|
+
pendingCollapsedModals.delete(modal);
|
|
3829
|
+
if (!modal.isConnected || !modal.matches(COLLAPSED_MODAL_SELECTOR) || modal.childElementCount === 0 || document.visibilityState === "hidden" || isHiddenOnPurpose(modal)) {
|
|
3830
|
+
return;
|
|
3831
|
+
}
|
|
3832
|
+
const rect = modal.getBoundingClientRect();
|
|
3833
|
+
if (rect.width >= COLLAPSED_MODAL_MIN_PX && rect.height >= COLLAPSED_MODAL_MIN_PX) {
|
|
3834
|
+
return;
|
|
3835
|
+
}
|
|
3836
|
+
reportedCollapsedModals.add(modal);
|
|
3837
|
+
const modalDescriptor = describeElement(modal);
|
|
3838
|
+
emitSignal(`Collapsed modal — ${modalDescriptor} opened at ${Math.round(rect.width)}×${Math.round(rect.height)}px — ${shortUrl(location.href)}`, {
|
|
3839
|
+
contentHeightPx: String(Math.round(modal.scrollHeight)),
|
|
3840
|
+
contentWidthPx: String(Math.round(modal.scrollWidth)),
|
|
3841
|
+
heightPx: String(Math.round(rect.height)),
|
|
3842
|
+
modal: modalDescriptor,
|
|
3843
|
+
signal: BEACON_SIGNAL.COLLAPSED_MODAL,
|
|
3844
|
+
widthPx: String(Math.round(rect.width))
|
|
3845
|
+
});
|
|
3846
|
+
}, COLLAPSED_MODAL_SETTLE_MS);
|
|
3847
|
+
collapsedModalTimers.add(timer);
|
|
3848
|
+
};
|
|
3849
|
+
const scanForModals = (root) => {
|
|
3850
|
+
if (root.matches(COLLAPSED_MODAL_SELECTOR))
|
|
3851
|
+
checkCollapsedModal(root);
|
|
3852
|
+
for (const modal of Array.from(root.querySelectorAll(COLLAPSED_MODAL_SELECTOR))) {
|
|
3853
|
+
checkCollapsedModal(modal);
|
|
3854
|
+
}
|
|
3855
|
+
};
|
|
3856
|
+
scanForModals(document.documentElement);
|
|
3857
|
+
const collapsedModalObserver = new MutationObserver((records) => {
|
|
3858
|
+
for (const record of records) {
|
|
3859
|
+
if (record.type === "attributes") {
|
|
3860
|
+
if (record.target instanceof Element)
|
|
3861
|
+
scanForModals(record.target);
|
|
3862
|
+
continue;
|
|
3863
|
+
}
|
|
3864
|
+
for (const node of Array.from(record.addedNodes)) {
|
|
3865
|
+
if (node instanceof Element)
|
|
3866
|
+
scanForModals(node);
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
});
|
|
3870
|
+
collapsedModalObserver.observe(document.documentElement, {
|
|
3871
|
+
attributeFilter: ["open", "aria-modal"],
|
|
3872
|
+
attributes: true,
|
|
3873
|
+
childList: true,
|
|
3874
|
+
subtree: true
|
|
3875
|
+
});
|
|
3876
|
+
cleanups.push(() => {
|
|
3877
|
+
collapsedModalObserver.disconnect();
|
|
3878
|
+
for (const timer of collapsedModalTimers)
|
|
3879
|
+
clearTimeout(timer);
|
|
3880
|
+
collapsedModalTimers.clear();
|
|
3881
|
+
});
|
|
3882
|
+
}
|
|
3799
3883
|
if (signals.focusLoss !== false || signals.modalFocusEscape !== false) {
|
|
3800
3884
|
const DIALOG_SELECTOR = '[role="dialog"], [aria-modal="true"], dialog';
|
|
3801
3885
|
const MODAL_SELECTOR = '[aria-modal="true"], dialog[open]';
|
|
@@ -4947,5 +5031,5 @@ export {
|
|
|
4947
5031
|
redactBeaconEvent
|
|
4948
5032
|
};
|
|
4949
5033
|
|
|
4950
|
-
//# debugId=
|
|
5034
|
+
//# debugId=339819F98DD5749264756E2164756E21
|
|
4951
5035
|
//# sourceMappingURL=index.js.map
|