@absolutejs/beacon 0.7.0-beta.2 → 0.7.0-beta.21
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 +89 -0
- package/README.md +56 -1
- package/changelog.json +201 -0
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.js +2 -9
- package/dist/contracts.js.map +3 -3
- package/dist/early.js +2 -10
- package/dist/early.js.map +3 -3
- package/dist/index.d.ts +13 -1
- package/dist/index.js +447 -195
- package/dist/index.js.map +5 -5
- package/dist/manifest.js +1 -9
- package/dist/manifest.js.map +2 -2
- package/dist/outbox.d.ts +42 -0
- package/dist/outbox.js +170 -0
- package/dist/outbox.js.map +10 -0
- package/dist/policy.d.ts +9 -0
- package/dist/policy.js +8 -10
- package/dist/policy.js.map +4 -4
- package/package.json +17 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@absolutejs/beacon`.
|
|
4
|
+
|
|
5
|
+
This file is generated by `absolute-changelog` from the entries in
|
|
6
|
+
`changelog/`. Edit an entry, not this file — and add new ones under
|
|
7
|
+
`changelog/unreleased/`.
|
|
8
|
+
|
|
9
|
+
## 0.7.0-beta.21 — 2026-10-27
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Group generated Vue control identities consistently and avoid unnecessary layout reads in layout-shift diagnostics.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
14
|
+
|
|
15
|
+
## 0.7.0-beta.20 — 2026-10-26
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Ship the public outbox export and compiled browser entry** (`createOutbox`, `createMemoryOutboxStore`, `createIndexedDBOutboxStore`, `BEACON_SDK_VERSION`)
|
|
20
|
+
|
|
21
|
+
## 0.7.0-beta.19 — 2026-10-25
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **Keep media playback issues grouped across playback timestamps and buffering states while retaining those measurements as evidence.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
26
|
+
|
|
27
|
+
## 0.7.0-beta.18 — 2026-10-24
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **Ignore predominantly horizontal wheel gestures when detecting blocked vertical scrolling, while retaining vertical failures and wheel-axis diagnostics.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
32
|
+
|
|
33
|
+
## 0.7.0-beta.17 — 2026-10-24
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- **Keep loading and mobile-focus issue fingerprints stable when wait durations, deadlines and keyboard viewport measurements vary.** (`BEACON_SDK_VERSION`)
|
|
38
|
+
|
|
39
|
+
## 0.7.0-beta.16 — 2026-10-24
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- **A durable browser outbox (@absolutejs/beacon/outbox): bounded IndexedDB or memory storage, acknowledged delivery, retry backoff and pruning** (`BEACON_SDK_VERSION`)
|
|
44
|
+
|
|
45
|
+
## 0.7.0-beta.15 — 2026-09-30
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- **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`)
|
|
50
|
+
|
|
51
|
+
## 0.7.0-beta.14 — 2026-09-30
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
- **The noise policy drops an opaque cross-origin "Script error." that carries no stack (`ignoreOpaqueScriptErrors`, default true), and exports `isOpaqueScriptError`.** (`createNoisePolicy`, `isOpaqueScriptError`, `NoisePolicyOptions`)
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- **Do not report stacked shapes inside one SVG drawing (donut segments, chart bars) as colliding controls; they are hit by their painted geometry, not their shared bounding box.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
60
|
+
|
|
61
|
+
## 0.7.0-beta.13 — 2026-09-30
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
|
|
65
|
+
- **Do not report a service worker as a failed installation when a newer release replaced it: one that finished installing and then waited, or one cut off mid-install by a newer worker. A worker that fails its own install still reports.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
66
|
+
|
|
67
|
+
## 0.7.0-beta.12 — 2026-09-27
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- **Stop TBT observation after its measurement window and clean up on close; ignore late vital delivery.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
72
|
+
|
|
73
|
+
## 0.7.0-beta.11 — 2026-09-27
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
|
|
77
|
+
- **Do not promote presentation-only Event Timing waits when every overlapping animation frame explicitly reports zero blocking and no scripts. Preserve incidents with positive blocking, script activity, missing attribution, long handlers or meaningful input delay; Web Vitals collection is unchanged.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
78
|
+
|
|
79
|
+
## 0.7.0-beta.10 — 2026-09-27
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
|
|
83
|
+
- **Ignore wheel events cancelled by later handlers when detecting scroll jail, and capture bounded scroll geometry, overflow policy, direction and modal ownership for genuine immobility without changing issue grouping.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
84
|
+
|
|
85
|
+
## 0.7.0-beta.9 — 2026-09-27
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- **Exclude known 1Password notification covers and retain request origins in network-failure diagnostics without credentials or query strings. Same-origin grouping remains stable across environments. Keep layout pixel measurements out of fingerprints and include geometry and sticky/fixed ancestor context in collision and occlusion reports. Read only browser-exposed XHR response headers to avoid unsafe-header console errors while preserving available trace correlation.** (`createBeacon`, `BeaconNetworkFailure`, `BEACON_SDK_VERSION`)
|
package/README.md
CHANGED
|
@@ -225,7 +225,10 @@ entry point does not initialize Beacon, send telemetry, or import the main SDK.
|
|
|
225
225
|
Instability names shifted elements. When the browser supplies no shifted
|
|
226
226
|
node, Beacon retains startup/runtime phase plus recent interaction type,
|
|
227
227
|
target, and age; stable provenance separates issue grouping while volatile
|
|
228
|
-
age remains diagnostic-only.
|
|
228
|
+
age remains diagnostic-only. Layout shifts during the first two seconds after
|
|
229
|
+
an accepted `pushState`, `replaceState`, or `popstate` route change are treated
|
|
230
|
+
as route settling; later shifts retain navigation type, source, destination,
|
|
231
|
+
and age for diagnosis. Successful HTTP responses can be
|
|
229
232
|
classified through the host-owned `instrument.classifyResponse` callback for
|
|
230
233
|
GraphQL-style errors. Selected HTTP 4xx/5xx responses can be promoted through
|
|
231
234
|
the opt-in `instrument.classifyErrorResponse` callback when application context
|
|
@@ -343,3 +346,55 @@ the bundler merge the whole SDK back into it, defeating lazy startup.
|
|
|
343
346
|
|
|
344
347
|
BSL-1.1 with a named carveout against hosted error-tracking / session-replay
|
|
345
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
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contract": 1,
|
|
3
|
+
"name": "@absolutejs/beacon",
|
|
4
|
+
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "fixed",
|
|
9
|
+
"summary": "Group generated Vue control identities consistently and avoid unnecessary layout reads in layout-shift diagnostics.",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"createBeacon",
|
|
12
|
+
"BEACON_SDK_VERSION"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"date": "2026-10-27",
|
|
17
|
+
"version": "0.7.0-beta.21"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"changes": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "fixed",
|
|
23
|
+
"summary": "Ship the public outbox export and compiled browser entry",
|
|
24
|
+
"symbols": [
|
|
25
|
+
"createOutbox",
|
|
26
|
+
"createMemoryOutboxStore",
|
|
27
|
+
"createIndexedDBOutboxStore",
|
|
28
|
+
"BEACON_SDK_VERSION"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"date": "2026-10-26",
|
|
33
|
+
"version": "0.7.0-beta.20"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"changes": [
|
|
37
|
+
{
|
|
38
|
+
"kind": "fixed",
|
|
39
|
+
"summary": "Keep media playback issues grouped across playback timestamps and buffering states while retaining those measurements as evidence.",
|
|
40
|
+
"symbols": [
|
|
41
|
+
"createBeacon",
|
|
42
|
+
"BEACON_SDK_VERSION"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"date": "2026-10-25",
|
|
47
|
+
"version": "0.7.0-beta.19"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"changes": [
|
|
51
|
+
{
|
|
52
|
+
"kind": "fixed",
|
|
53
|
+
"summary": "Ignore predominantly horizontal wheel gestures when detecting blocked vertical scrolling, while retaining vertical failures and wheel-axis diagnostics.",
|
|
54
|
+
"symbols": [
|
|
55
|
+
"createBeacon",
|
|
56
|
+
"BEACON_SDK_VERSION"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"date": "2026-10-24",
|
|
61
|
+
"version": "0.7.0-beta.18"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"changes": [
|
|
65
|
+
{
|
|
66
|
+
"kind": "fixed",
|
|
67
|
+
"summary": "Keep loading and mobile-focus issue fingerprints stable when wait durations, deadlines and keyboard viewport measurements vary.",
|
|
68
|
+
"symbols": [
|
|
69
|
+
"BEACON_SDK_VERSION"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"date": "2026-10-24",
|
|
74
|
+
"version": "0.7.0-beta.17"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"changes": [
|
|
78
|
+
{
|
|
79
|
+
"kind": "added",
|
|
80
|
+
"summary": "A durable browser outbox (@absolutejs/beacon/outbox): bounded IndexedDB or memory storage, acknowledged delivery, retry backoff and pruning",
|
|
81
|
+
"symbols": [
|
|
82
|
+
"BEACON_SDK_VERSION"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"date": "2026-10-24",
|
|
87
|
+
"version": "0.7.0-beta.16"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"changes": [
|
|
91
|
+
{
|
|
92
|
+
"kind": "added",
|
|
93
|
+
"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.",
|
|
94
|
+
"symbols": [
|
|
95
|
+
"createBeacon",
|
|
96
|
+
"BEACON_SIGNAL",
|
|
97
|
+
"BeaconSignal",
|
|
98
|
+
"BeaconSignals",
|
|
99
|
+
"BEACON_SDK_VERSION"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"date": "2026-09-30",
|
|
104
|
+
"version": "0.7.0-beta.15"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"changes": [
|
|
108
|
+
{
|
|
109
|
+
"kind": "fixed",
|
|
110
|
+
"summary": "Do not report stacked shapes inside one SVG drawing (donut segments, chart bars) as colliding controls; they are hit by their painted geometry, not their shared bounding box.",
|
|
111
|
+
"symbols": [
|
|
112
|
+
"createBeacon",
|
|
113
|
+
"BEACON_SDK_VERSION"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"kind": "added",
|
|
118
|
+
"summary": "The noise policy drops an opaque cross-origin \"Script error.\" that carries no stack (`ignoreOpaqueScriptErrors`, default true), and exports `isOpaqueScriptError`.",
|
|
119
|
+
"symbols": [
|
|
120
|
+
"createNoisePolicy",
|
|
121
|
+
"isOpaqueScriptError",
|
|
122
|
+
"NoisePolicyOptions"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"date": "2026-09-30",
|
|
127
|
+
"version": "0.7.0-beta.14"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"changes": [
|
|
131
|
+
{
|
|
132
|
+
"kind": "fixed",
|
|
133
|
+
"summary": "Do not report a service worker as a failed installation when a newer release replaced it: one that finished installing and then waited, or one cut off mid-install by a newer worker. A worker that fails its own install still reports.",
|
|
134
|
+
"symbols": [
|
|
135
|
+
"createBeacon",
|
|
136
|
+
"BEACON_SDK_VERSION"
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"date": "2026-09-30",
|
|
141
|
+
"version": "0.7.0-beta.13"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"changes": [
|
|
145
|
+
{
|
|
146
|
+
"kind": "fixed",
|
|
147
|
+
"summary": "Stop TBT observation after its measurement window and clean up on close; ignore late vital delivery.",
|
|
148
|
+
"symbols": [
|
|
149
|
+
"createBeacon",
|
|
150
|
+
"BEACON_SDK_VERSION"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"date": "2026-09-27",
|
|
155
|
+
"version": "0.7.0-beta.12"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"changes": [
|
|
159
|
+
{
|
|
160
|
+
"kind": "fixed",
|
|
161
|
+
"summary": "Do not promote presentation-only Event Timing waits when every overlapping animation frame explicitly reports zero blocking and no scripts. Preserve incidents with positive blocking, script activity, missing attribution, long handlers or meaningful input delay; Web Vitals collection is unchanged.",
|
|
162
|
+
"symbols": [
|
|
163
|
+
"createBeacon",
|
|
164
|
+
"BEACON_SDK_VERSION"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"date": "2026-09-27",
|
|
169
|
+
"version": "0.7.0-beta.11"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"changes": [
|
|
173
|
+
{
|
|
174
|
+
"kind": "fixed",
|
|
175
|
+
"summary": "Ignore wheel events cancelled by later handlers when detecting scroll jail, and capture bounded scroll geometry, overflow policy, direction and modal ownership for genuine immobility without changing issue grouping.",
|
|
176
|
+
"symbols": [
|
|
177
|
+
"createBeacon",
|
|
178
|
+
"BEACON_SDK_VERSION"
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"date": "2026-09-27",
|
|
183
|
+
"version": "0.7.0-beta.10"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"changes": [
|
|
187
|
+
{
|
|
188
|
+
"kind": "fixed",
|
|
189
|
+
"summary": "Exclude known 1Password notification covers and retain request origins in network-failure diagnostics without credentials or query strings. Same-origin grouping remains stable across environments. Keep layout pixel measurements out of fingerprints and include geometry and sticky/fixed ancestor context in collision and occlusion reports. Read only browser-exposed XHR response headers to avoid unsafe-header console errors while preserving available trace correlation.",
|
|
190
|
+
"symbols": [
|
|
191
|
+
"createBeacon",
|
|
192
|
+
"BeaconNetworkFailure",
|
|
193
|
+
"BEACON_SDK_VERSION"
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"date": "2026-09-27",
|
|
198
|
+
"version": "0.7.0-beta.9"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
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
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
1
|
// src/contracts.ts
|
|
10
2
|
var BEACON_SIGNAL = {
|
|
11
3
|
AUTH_FAILURE_STORM: "auth_failure_storm",
|
|
@@ -18,6 +10,7 @@ var BEACON_SIGNAL = {
|
|
|
18
10
|
CONTROL_COLLISION: "control_collision",
|
|
19
11
|
CSP_VIOLATION: "csp_violation",
|
|
20
12
|
CLIPBOARD_FAILURE: "clipboard_failure",
|
|
13
|
+
COLLAPSED_MODAL: "collapsed_modal",
|
|
21
14
|
DEAD_CLICK: "dead_click",
|
|
22
15
|
DISRUPTIVE_LAYOUT_SHIFT: "disruptive_layout_shift",
|
|
23
16
|
DOCUMENT_DISCARDED: "document_discarded",
|
|
@@ -81,5 +74,5 @@ export {
|
|
|
81
74
|
BEACON_SIGNAL
|
|
82
75
|
};
|
|
83
76
|
|
|
84
|
-
//# debugId=
|
|
77
|
+
//# debugId=CC210BEB9F1502B164756E2164756E21
|
|
85
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-the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AAM;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/early.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
1
|
// src/early.ts
|
|
10
2
|
var HISTORY_LIMIT = 16;
|
|
11
3
|
var ENTRY_LIMIT = 50;
|
|
@@ -86,6 +78,7 @@ var installEarlyLayoutShiftBuffer = () => {
|
|
|
86
78
|
"pointerdown",
|
|
87
79
|
"submit"
|
|
88
80
|
];
|
|
81
|
+
observer.observe({ buffered: true, type: "layout-shift" });
|
|
89
82
|
for (const event of interactionEvents)
|
|
90
83
|
window.addEventListener(event, recordInteraction, true);
|
|
91
84
|
window.addEventListener("resize", recordResize);
|
|
@@ -105,7 +98,6 @@ var installEarlyLayoutShiftBuffer = () => {
|
|
|
105
98
|
recordEntries,
|
|
106
99
|
resizeTimes
|
|
107
100
|
};
|
|
108
|
-
observer.observe({ buffered: true, type: "layout-shift" });
|
|
109
101
|
} catch {}
|
|
110
102
|
};
|
|
111
103
|
var consumeEarlyLayoutShiftBuffer = () => {
|
|
@@ -130,5 +122,5 @@ export {
|
|
|
130
122
|
installEarlyLayoutShiftBuffer
|
|
131
123
|
};
|
|
132
124
|
|
|
133
|
-
//# debugId=
|
|
125
|
+
//# debugId=FBC94D8BDFC5AD8064756E2164756E21
|
|
134
126
|
//# sourceMappingURL=early.js.map
|
package/dist/early.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/early.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/** Lightweight pre-hydration layout-shift recorder. */\n\nexport type EarlyLayoutShiftRect = {\n bottom: number;\n height: number;\n left: number;\n right: number;\n top: number;\n width: number;\n x: number;\n y: number;\n};\n\nexport type EarlyLayoutShiftViewport = {\n documentHeight: number;\n documentWidth: number;\n innerHeight: number;\n innerWidth: number;\n visualHeight?: number;\n visualOffsetLeft?: number;\n visualOffsetTop?: number;\n visualScale?: number;\n visualWidth?: number;\n};\n\nexport type EarlyLayoutShiftSource = {\n currentRect?: EarlyLayoutShiftRect;\n node?: Node;\n previousRect?: EarlyLayoutShiftRect;\n target: string;\n};\n\nexport type EarlyLayoutShiftEntry = {\n documentReadyState: DocumentReadyState;\n hadRecentInput: boolean;\n observedAt: number;\n sources: EarlyLayoutShiftSource[];\n startTime: number;\n value: number;\n viewport: EarlyLayoutShiftViewport;\n};\n\nexport type EarlyLayoutShiftBuffer = {\n entries: EarlyLayoutShiftEntry[];\n interactionTimes: number[];\n observerStartedAt: number;\n resizeTimes: number[];\n};\n\ntype LayoutShiftSourceLike = {\n currentRect?: DOMRectReadOnly;\n node?: Node | null;\n previousRect?: DOMRectReadOnly;\n};\ntype LayoutShiftEntryLike = PerformanceEntry & {\n hadRecentInput?: boolean;\n sources?: LayoutShiftSourceLike[];\n value?: number;\n};\ntype InstalledEarlyLayoutShiftBuffer = EarlyLayoutShiftBuffer & {\n cleanup: () => void;\n observer: PerformanceObserver;\n recordEntries: (entries: PerformanceEntry[]) => void;\n};\n\ndeclare global {\n interface Window {\n __absoluteBeaconEarlyLayoutShift?: InstalledEarlyLayoutShiftBuffer;\n }\n}\n\nconst HISTORY_LIMIT = 16;\nconst ENTRY_LIMIT = 50;\nconst now = (): number =>\n typeof performance === \"undefined\" ? 0 : performance.now();\n\nconst describeNode = (node: Node | null | undefined): string => {\n if (!(node instanceof Element)) return \"unknown\";\n const id = node.id === \"\" ? \"\" : `#${node.id}`;\n const classes = [...node.classList]\n .slice(0, 3)\n .map((name) => `.${name}`)\n .join(\"\");\n return `${node.tagName.toLowerCase()}${id}${classes}`;\n};\n\nconst copyRect = (\n rect: DOMRectReadOnly | undefined,\n): EarlyLayoutShiftRect | undefined =>\n rect === undefined\n ? undefined\n : {\n bottom: rect.bottom,\n height: rect.height,\n left: rect.left,\n right: rect.right,\n top: rect.top,\n width: rect.width,\n x: rect.x,\n y: rect.y,\n };\n\nconst viewportSnapshot = (): EarlyLayoutShiftViewport => {\n const visual = window.visualViewport;\n return {\n documentHeight: document.documentElement.scrollHeight,\n documentWidth: document.documentElement.scrollWidth,\n innerHeight: window.innerHeight,\n innerWidth: window.innerWidth,\n ...(visual == null\n ? {}\n : {\n visualHeight: visual.height,\n visualOffsetLeft: visual.offsetLeft,\n visualOffsetTop: visual.offsetTop,\n visualScale: visual.scale,\n visualWidth: visual.width,\n }),\n };\n};\n\nconst appendLimited = (values: number[], value: number): void => {\n values.push(value);\n if (values.length > HISTORY_LIMIT)\n values.splice(0, values.length - HISTORY_LIMIT);\n};\n\n/** Install once from the application's synchronous entry module. SSR-safe. */\nexport const installEarlyLayoutShiftBuffer = (): void => {\n if (\n typeof window === \"undefined\" ||\n typeof document === \"undefined\" ||\n typeof PerformanceObserver === \"undefined\" ||\n window.__absoluteBeaconEarlyLayoutShift !== undefined\n )\n return;\n\n const interactionTimes: number[] = [];\n const resizeTimes: number[] = [];\n const entries: EarlyLayoutShiftEntry[] = [];\n const recordInteraction = (): void => appendLimited(interactionTimes, now());\n const recordResize = (): void => appendLimited(resizeTimes, now());\n const recordEntries = (rawEntries: PerformanceEntry[]): void => {\n for (const raw of rawEntries) {\n const entry = raw as LayoutShiftEntryLike;\n entries.push({\n documentReadyState: document.readyState,\n hadRecentInput: entry.hadRecentInput === true,\n observedAt: now(),\n sources: (entry.sources ?? []).slice(0, 5).map((source) => ({\n ...(source.currentRect === undefined\n ? {}\n : { currentRect: copyRect(source.currentRect) }),\n ...(source.node === undefined || source.node === null\n ? {}\n : { node: source.node }),\n ...(source.previousRect === undefined\n ? {}\n : { previousRect: copyRect(source.previousRect) }),\n target: describeNode(source.node),\n })),\n startTime: entry.startTime,\n value: entry.value ?? 0,\n viewport: viewportSnapshot(),\n });\n }\n if (entries.length > ENTRY_LIMIT)\n entries.splice(0, entries.length - ENTRY_LIMIT);\n };\n\n try {\n const observerStartedAt = now();\n const observer = new PerformanceObserver((list) =>\n recordEntries(list.getEntries()),\n );\n const interactionEvents = [\n \"click\",\n \"keydown\",\n \"pointerdown\",\n \"submit\",\n ] as const;\n for (const event of interactionEvents)\n window.addEventListener(event, recordInteraction, true);\n window.addEventListener(\"resize\", recordResize);\n window.visualViewport?.addEventListener(\"resize\", recordResize);\n const cleanup = (): void => {\n for (const event of interactionEvents)\n window.removeEventListener(event, recordInteraction, true);\n window.removeEventListener(\"resize\", recordResize);\n window.visualViewport?.removeEventListener(\"resize\", recordResize);\n };\n window.__absoluteBeaconEarlyLayoutShift = {\n cleanup,\n entries,\n interactionTimes,\n observer,\n observerStartedAt,\n recordEntries,\n resizeTimes,\n };\n
|
|
5
|
+
"/** Lightweight pre-hydration layout-shift recorder. */\n\nexport type EarlyLayoutShiftRect = {\n bottom: number;\n height: number;\n left: number;\n right: number;\n top: number;\n width: number;\n x: number;\n y: number;\n};\n\nexport type EarlyLayoutShiftViewport = {\n documentHeight: number;\n documentWidth: number;\n innerHeight: number;\n innerWidth: number;\n visualHeight?: number;\n visualOffsetLeft?: number;\n visualOffsetTop?: number;\n visualScale?: number;\n visualWidth?: number;\n};\n\nexport type EarlyLayoutShiftSource = {\n currentRect?: EarlyLayoutShiftRect;\n node?: Node;\n previousRect?: EarlyLayoutShiftRect;\n target: string;\n};\n\nexport type EarlyLayoutShiftEntry = {\n documentReadyState: DocumentReadyState;\n hadRecentInput: boolean;\n observedAt: number;\n sources: EarlyLayoutShiftSource[];\n startTime: number;\n value: number;\n viewport: EarlyLayoutShiftViewport;\n};\n\nexport type EarlyLayoutShiftBuffer = {\n entries: EarlyLayoutShiftEntry[];\n interactionTimes: number[];\n observerStartedAt: number;\n resizeTimes: number[];\n};\n\ntype LayoutShiftSourceLike = {\n currentRect?: DOMRectReadOnly;\n node?: Node | null;\n previousRect?: DOMRectReadOnly;\n};\ntype LayoutShiftEntryLike = PerformanceEntry & {\n hadRecentInput?: boolean;\n sources?: LayoutShiftSourceLike[];\n value?: number;\n};\ntype InstalledEarlyLayoutShiftBuffer = EarlyLayoutShiftBuffer & {\n cleanup: () => void;\n observer: PerformanceObserver;\n recordEntries: (entries: PerformanceEntry[]) => void;\n};\n\ndeclare global {\n interface Window {\n __absoluteBeaconEarlyLayoutShift?: InstalledEarlyLayoutShiftBuffer;\n }\n}\n\nconst HISTORY_LIMIT = 16;\nconst ENTRY_LIMIT = 50;\nconst now = (): number =>\n typeof performance === \"undefined\" ? 0 : performance.now();\n\nconst describeNode = (node: Node | null | undefined): string => {\n if (!(node instanceof Element)) return \"unknown\";\n const id = node.id === \"\" ? \"\" : `#${node.id}`;\n const classes = [...node.classList]\n .slice(0, 3)\n .map((name) => `.${name}`)\n .join(\"\");\n return `${node.tagName.toLowerCase()}${id}${classes}`;\n};\n\nconst copyRect = (\n rect: DOMRectReadOnly | undefined,\n): EarlyLayoutShiftRect | undefined =>\n rect === undefined\n ? undefined\n : {\n bottom: rect.bottom,\n height: rect.height,\n left: rect.left,\n right: rect.right,\n top: rect.top,\n width: rect.width,\n x: rect.x,\n y: rect.y,\n };\n\nconst viewportSnapshot = (): EarlyLayoutShiftViewport => {\n const visual = window.visualViewport;\n return {\n documentHeight: document.documentElement.scrollHeight,\n documentWidth: document.documentElement.scrollWidth,\n innerHeight: window.innerHeight,\n innerWidth: window.innerWidth,\n ...(visual == null\n ? {}\n : {\n visualHeight: visual.height,\n visualOffsetLeft: visual.offsetLeft,\n visualOffsetTop: visual.offsetTop,\n visualScale: visual.scale,\n visualWidth: visual.width,\n }),\n };\n};\n\nconst appendLimited = (values: number[], value: number): void => {\n values.push(value);\n if (values.length > HISTORY_LIMIT)\n values.splice(0, values.length - HISTORY_LIMIT);\n};\n\n/** Install once from the application's synchronous entry module. SSR-safe. */\nexport const installEarlyLayoutShiftBuffer = (): void => {\n if (\n typeof window === \"undefined\" ||\n typeof document === \"undefined\" ||\n typeof PerformanceObserver === \"undefined\" ||\n window.__absoluteBeaconEarlyLayoutShift !== undefined\n )\n return;\n\n const interactionTimes: number[] = [];\n const resizeTimes: number[] = [];\n const entries: EarlyLayoutShiftEntry[] = [];\n const recordInteraction = (): void => appendLimited(interactionTimes, now());\n const recordResize = (): void => appendLimited(resizeTimes, now());\n const recordEntries = (rawEntries: PerformanceEntry[]): void => {\n for (const raw of rawEntries) {\n const entry = raw as LayoutShiftEntryLike;\n entries.push({\n documentReadyState: document.readyState,\n hadRecentInput: entry.hadRecentInput === true,\n observedAt: now(),\n sources: (entry.sources ?? []).slice(0, 5).map((source) => ({\n ...(source.currentRect === undefined\n ? {}\n : { currentRect: copyRect(source.currentRect) }),\n ...(source.node === undefined || source.node === null\n ? {}\n : { node: source.node }),\n ...(source.previousRect === undefined\n ? {}\n : { previousRect: copyRect(source.previousRect) }),\n target: describeNode(source.node),\n })),\n startTime: entry.startTime,\n value: entry.value ?? 0,\n viewport: viewportSnapshot(),\n });\n }\n if (entries.length > ENTRY_LIMIT)\n entries.splice(0, entries.length - ENTRY_LIMIT);\n };\n\n try {\n const observerStartedAt = now();\n const observer = new PerformanceObserver((list) =>\n recordEntries(list.getEntries()),\n );\n const interactionEvents = [\n \"click\",\n \"keydown\",\n \"pointerdown\",\n \"submit\",\n ] as const;\n observer.observe({ buffered: true, type: \"layout-shift\" });\n for (const event of interactionEvents)\n window.addEventListener(event, recordInteraction, true);\n window.addEventListener(\"resize\", recordResize);\n window.visualViewport?.addEventListener(\"resize\", recordResize);\n const cleanup = (): void => {\n for (const event of interactionEvents)\n window.removeEventListener(event, recordInteraction, true);\n window.removeEventListener(\"resize\", recordResize);\n window.visualViewport?.removeEventListener(\"resize\", recordResize);\n };\n window.__absoluteBeaconEarlyLayoutShift = {\n cleanup,\n entries,\n interactionTimes,\n observer,\n observerStartedAt,\n recordEntries,\n resizeTimes,\n };\n } catch {\n // Unsupported browsers must not have their startup affected by telemetry.\n }\n};\n\n/** Consume and remove the pre-hydration recorder, if one was installed. */\nexport const consumeEarlyLayoutShiftBuffer = ():\n EarlyLayoutShiftBuffer | undefined => {\n if (typeof window === \"undefined\") return undefined;\n const installed = window.__absoluteBeaconEarlyLayoutShift;\n if (installed === undefined) return undefined;\n installed.recordEntries(installed.observer.takeRecords());\n installed.observer.disconnect();\n installed.cleanup();\n delete window.__absoluteBeaconEarlyLayoutShift;\n return {\n entries: installed.entries,\n interactionTimes: installed.interactionTimes,\n observerStartedAt: installed.observerStartedAt,\n resizeTimes: installed.resizeTimes,\n };\n};\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AAuEA,IAAM,gBAAgB;AACtB,IAAM,cAAc;AACpB,IAAM,MAAM,MACV,OAAO,gBAAgB,cAAc,IAAI,YAAY,IAAI;AAE3D,IAAM,eAAe,CAAC,SAA0C;AAAA,EAC9D,IAAI,EAAE,gBAAgB;AAAA,IAAU,OAAO;AAAA,EACvC,MAAM,KAAK,KAAK,OAAO,KAAK,KAAK,IAAI,KAAK;AAAA,EAC1C,MAAM,UAAU,CAAC,GAAG,KAAK,SAAS,EAC/B,MAAM,GAAG,CAAC,EACV,IAAI,CAAC,SAAS,IAAI,MAAM,EACxB,KAAK,EAAE;AAAA,EACV,OAAO,GAAG,KAAK,QAAQ,YAAY,IAAI,KAAK;AAAA;AAG9C,IAAM,WAAW,CACf,SAEA,SAAS,YACL,YACA;AA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,YAAY;AAAA;AAAA,IAEnE,OAAO,mCAAmC;AAAA,MACxC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,MAAM;AAAA;AAMH,IAAM,gCAAgC,MACL;AAAA,EACtC,IAAI,OAAO,WAAW;AAAA,IAAa;AAAA,EACnC,MAAM,YAAY,OAAO;AAAA,EACzB,IAAI,cAAc;AAAA,IAAW;AAAA,EAC7B,UAAU,cAAc,UAAU,SAAS,YAAY,CAAC;AAAA,EACxD,UAAU,SAAS,WAAW;AAAA,EAC9B,UAAU,QAAQ;AAAA,EAClB,OAAO,OAAO;AAAA,EACd,OAAO;AAAA,IACL,SAAS,UAAU;AAAA,IACnB,kBAAkB,UAAU;AAAA,IAC5B,mBAAmB,UAAU;AAAA,IAC7B,aAAa,UAAU;AAAA,EACzB;AAAA;",
|
|
8
|
+
"debugId": "FBC94D8BDFC5AD8064756E2164756E21",
|
|
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.21";
|
|
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;
|
|
@@ -140,6 +140,10 @@ export type BeaconResourceFailure = {
|
|
|
140
140
|
* `console.error`. Each detector is feature-gated and independently tunable.
|
|
141
141
|
*/
|
|
142
142
|
export type BeaconSignals = {
|
|
143
|
+
/** Suppress synthetic watchdog findings for WebDriver and explicitly
|
|
144
|
+
* identified crawler/audit user agents. Explicit exceptions and messages
|
|
145
|
+
* are unaffected. Default false. */
|
|
146
|
+
suppressAutomatedBrowsers?: boolean;
|
|
143
147
|
/** Back/forward navigations the browser could not restore from bfcache. */
|
|
144
148
|
bfcacheBlocks?: boolean;
|
|
145
149
|
/** Browser-specific bfcache reason strings that are inherent to an
|
|
@@ -252,6 +256,10 @@ export type BeaconSignals = {
|
|
|
252
256
|
mainThreadStallCount?: number;
|
|
253
257
|
/** Window for repeated main-thread stalls. Default 10000ms. */
|
|
254
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;
|
|
255
263
|
/** Focus outside an open modal, including a modal that never receives
|
|
256
264
|
* initial focus. Default true. */
|
|
257
265
|
modalFocusEscape?: boolean;
|
|
@@ -372,6 +380,9 @@ export type BeaconReleaseProbe = {
|
|
|
372
380
|
}) => void;
|
|
373
381
|
};
|
|
374
382
|
export type BeaconNetworkFailure = {
|
|
383
|
+
/** Request origin only; credentials, path and query are never included. */
|
|
384
|
+
origin?: string;
|
|
385
|
+
sameOrigin?: boolean;
|
|
375
386
|
at: number;
|
|
376
387
|
durationMs: number;
|
|
377
388
|
endpoint: string;
|
|
@@ -543,6 +554,7 @@ export type Beacon = {
|
|
|
543
554
|
export declare const redactBeaconEvent: (event: BeaconEvent) => BeaconEvent;
|
|
544
555
|
/** Known browser-host/scanner failures that do not originate in page code. */
|
|
545
556
|
export declare const isKnownBeaconNoise: (event: Pick<BeaconEvent, "message" | "name" | "stack" | "tags">, userAgent?: string) => boolean;
|
|
557
|
+
export declare const isAutomatedBrowser: () => boolean;
|
|
546
558
|
export declare const createBeacon: (options: BeaconOptions) => Beacon;
|
|
547
559
|
/** Initialize the global beacon. Returns the instance. */
|
|
548
560
|
export declare const initBeacon: (options: BeaconOptions) => Beacon;
|