@absolutejs/beacon 0.7.0-beta.26 → 0.7.0-beta.28
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 +20 -0
- package/changelog.json +28 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +82 -27
- package/dist/index.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.28 — 2026-11-30
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Retain page and script origins plus installation state transitions for service-worker failures. Keep same-path failures from different origins distinct within the observer without retaining URL query values or changing existing issue messages.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
14
|
+
|
|
15
|
+
## 0.7.0-beta.27 — 2026-11-30
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Describe removed-control focus loss without claiming dialog closure; retain bounded dialog visibility, focus destination and recovery timing evidence, honor focusLoss opt-out, and cancel pending checks on close. Existing issue grouping and detected warnings are preserved.** (`createBeacon`, `BEACON_SDK_VERSION`)
|
|
20
|
+
|
|
9
21
|
## 0.7.0-beta.26 — 2026-11-22
|
|
10
22
|
|
|
11
23
|
### Fixed
|
package/README.md
CHANGED
|
@@ -410,3 +410,23 @@ before Beacon initialized or prove that a high paint value meant a blank page.
|
|
|
410
410
|
No page content, user identifiers, extra request, or polling timer is added.
|
|
411
411
|
Hosts using strict attribution schemas must allow the optional `pageLifecycle`
|
|
412
412
|
object to retain this context. `close()` removes its listeners.
|
|
413
|
+
|
|
414
|
+
### Focus-loss diagnostics
|
|
415
|
+
|
|
416
|
+
The `focus_lost` watchdog observes a disconnected dialog control and keyboard focus
|
|
417
|
+
on the document body after a zero-delay check. It does not prove that the dialog
|
|
418
|
+
closed. `extra.focusLoss` records content-free snapshots at focusout, detection,
|
|
419
|
+
and after a bounded 100 ms observation: dialog connectivity/rendered state, control
|
|
420
|
+
connectivity, active element tag, dialog focus ownership, and elapsed time.
|
|
421
|
+
`focusRecovered` records whether focus returned by the final snapshot; recovery
|
|
422
|
+
does not discard an already detected warning. Synchronous or microtask restoration
|
|
423
|
+
before detection does not produce a warning. Later restoration is not observed.
|
|
424
|
+
`focusEventTrusted` describes browser dispatch, not human intent: calling
|
|
425
|
+
`focus()` or `blur()` programmatically can produce trusted events.
|
|
426
|
+
|
|
427
|
+
The signal retains its dialog-based grouping across the wording change.
|
|
428
|
+
`signals.focusLoss: false` disables it independently of modal escape detection,
|
|
429
|
+
and closing the SDK cancels pending observations. Rendered state checks DOM
|
|
430
|
+
connectivity, native dialog open state, hidden/inert attributes, and computed
|
|
431
|
+
visibility on the element and its ancestors; it does not establish viewport
|
|
432
|
+
intersection or lack of occlusion.
|
package/changelog.json
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "@absolutejs/beacon",
|
|
4
4
|
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "fixed",
|
|
9
|
+
"summary": "Retain page and script origins plus installation state transitions for service-worker failures. Keep same-path failures from different origins distinct within the observer without retaining URL query values or changing existing issue messages.",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"createBeacon",
|
|
12
|
+
"BEACON_SDK_VERSION"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"date": "2026-11-30",
|
|
17
|
+
"version": "0.7.0-beta.28"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"changes": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "fixed",
|
|
23
|
+
"summary": "Describe removed-control focus loss without claiming dialog closure; retain bounded dialog visibility, focus destination and recovery timing evidence, honor focusLoss opt-out, and cancel pending checks on close. Existing issue grouping and detected warnings are preserved.",
|
|
24
|
+
"symbols": [
|
|
25
|
+
"createBeacon",
|
|
26
|
+
"BEACON_SDK_VERSION"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"date": "2026-11-30",
|
|
31
|
+
"version": "0.7.0-beta.27"
|
|
32
|
+
},
|
|
5
33
|
{
|
|
6
34
|
"changes": [
|
|
7
35
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type BeaconLevel = "fatal" | "error" | "warning" | "info";
|
|
|
5
5
|
/** Response header used to correlate a browser signal with its server request. */
|
|
6
6
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
7
7
|
/** Beacon package version retained with every captured event. */
|
|
8
|
-
export declare const BEACON_SDK_VERSION = "0.7.0-beta.
|
|
8
|
+
export declare const BEACON_SDK_VERSION = "0.7.0-beta.28";
|
|
9
9
|
/** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
|
|
10
10
|
export type BeaconTags = Record<string, string> & {
|
|
11
11
|
signal?: BeaconSignal;
|
package/dist/index.js
CHANGED
|
@@ -311,7 +311,7 @@ var consumeEarlyLayoutShiftBuffer = () => {
|
|
|
311
311
|
|
|
312
312
|
// src/index.ts
|
|
313
313
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
314
|
-
var BEACON_SDK_VERSION = "0.7.0-beta.
|
|
314
|
+
var BEACON_SDK_VERSION = "0.7.0-beta.28";
|
|
315
315
|
var inBrowser = () => typeof window !== "undefined";
|
|
316
316
|
var newId = () => {
|
|
317
317
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -4055,8 +4055,10 @@ var createBeacon = (options) => {
|
|
|
4055
4055
|
const modalTimers = new Set;
|
|
4056
4056
|
const modalVisibility = new WeakMap;
|
|
4057
4057
|
const knownModals = new Set;
|
|
4058
|
-
const
|
|
4059
|
-
if (!modal.isConnected
|
|
4058
|
+
const isRenderedDialog = (modal) => {
|
|
4059
|
+
if (!modal.isConnected)
|
|
4060
|
+
return false;
|
|
4061
|
+
if (modal.localName === "dialog" && !modal.hasAttribute("open"))
|
|
4060
4062
|
return false;
|
|
4061
4063
|
let current = modal;
|
|
4062
4064
|
while (current !== null) {
|
|
@@ -4071,6 +4073,7 @@ var createBeacon = (options) => {
|
|
|
4071
4073
|
}
|
|
4072
4074
|
return true;
|
|
4073
4075
|
};
|
|
4076
|
+
const isRenderedModal = (modal) => modal.matches(MODAL_SELECTOR) && isRenderedDialog(modal);
|
|
4074
4077
|
const reportModalEscape = (modal, active, reason) => {
|
|
4075
4078
|
if (signals.modalFocusEscape === false || reportedModalEscapes.has(modal) || document.visibilityState === "hidden") {
|
|
4076
4079
|
return;
|
|
@@ -4132,31 +4135,60 @@ var createBeacon = (options) => {
|
|
|
4132
4135
|
}
|
|
4133
4136
|
};
|
|
4134
4137
|
const onFocusOut = (event) => {
|
|
4138
|
+
if (signals.focusLoss === false)
|
|
4139
|
+
return;
|
|
4135
4140
|
const target = event.target;
|
|
4136
4141
|
if (!(target instanceof Element))
|
|
4137
4142
|
return;
|
|
4138
4143
|
const dialog = target.closest(DIALOG_SELECTOR);
|
|
4139
4144
|
if (dialog === null)
|
|
4140
4145
|
return;
|
|
4146
|
+
const startedAt = performance.now();
|
|
4141
4147
|
const dialogDescriptor = describeElement(dialog);
|
|
4148
|
+
const descriptor = describeElement(target);
|
|
4142
4149
|
const focusEventTrusted = event.isTrusted === true;
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4150
|
+
const snapshot = () => ({
|
|
4151
|
+
elapsedMs: Math.max(0, Math.round(performance.now() - startedAt)),
|
|
4152
|
+
targetConnected: target.isConnected,
|
|
4153
|
+
dialogConnected: dialog.isConnected,
|
|
4154
|
+
dialogRendered: isRenderedDialog(dialog),
|
|
4155
|
+
activeTag: document.activeElement?.localName ?? null,
|
|
4156
|
+
bodyFocused: document.activeElement === null || document.activeElement === document.body,
|
|
4157
|
+
dialogOwnsFocus: dialog.contains(document.activeElement)
|
|
4158
|
+
});
|
|
4159
|
+
const atFocusOut = snapshot();
|
|
4160
|
+
const relatedTargetTag = event.relatedTarget instanceof Element ? event.relatedTarget.localName : null;
|
|
4161
|
+
const timer = setTimeout(() => {
|
|
4162
|
+
modalTimers.delete(timer);
|
|
4163
|
+
const atDetection = snapshot();
|
|
4164
|
+
if (!atDetection.bodyFocused || atDetection.targetConnected)
|
|
4147
4165
|
return;
|
|
4148
|
-
const descriptor = describeElement(target);
|
|
4149
4166
|
if (reportedFocusLoss.has(descriptor))
|
|
4150
4167
|
return;
|
|
4151
4168
|
reportedFocusLoss.add(descriptor);
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4169
|
+
const observation = setTimeout(() => {
|
|
4170
|
+
modalTimers.delete(observation);
|
|
4171
|
+
const afterObservation = snapshot();
|
|
4172
|
+
emitSignal(`Focus lost — a focused dialog control was removed and keyboard focus fell to body — ${shortUrl(location.href)}`, {
|
|
4173
|
+
dialog: dialogDescriptor,
|
|
4174
|
+
focusEventTrusted: String(focusEventTrusted),
|
|
4175
|
+
lastFocused: descriptor,
|
|
4176
|
+
signal: BEACON_SIGNAL.FOCUS_LOST,
|
|
4177
|
+
...navigator.webdriver === true ? { automation: "webdriver" } : {}
|
|
4178
|
+
}, undefined, {
|
|
4179
|
+
focusLoss: {
|
|
4180
|
+
atFocusOut,
|
|
4181
|
+
atDetection,
|
|
4182
|
+
afterObservation,
|
|
4183
|
+
relatedTargetTag,
|
|
4184
|
+
focusRecovered: !afterObservation.bodyFocused,
|
|
4185
|
+
observationMs: MODAL_FOCUS_SETTLE_MS
|
|
4186
|
+
}
|
|
4187
|
+
});
|
|
4188
|
+
}, MODAL_FOCUS_SETTLE_MS);
|
|
4189
|
+
modalTimers.add(observation);
|
|
4159
4190
|
}, 0);
|
|
4191
|
+
modalTimers.add(timer);
|
|
4160
4192
|
};
|
|
4161
4193
|
document.addEventListener("focusin", onFocusIn, true);
|
|
4162
4194
|
document.addEventListener("focusout", onFocusOut, true);
|
|
@@ -4606,26 +4638,40 @@ var createBeacon = (options) => {
|
|
|
4606
4638
|
"TimeoutError",
|
|
4607
4639
|
"TypeError"
|
|
4608
4640
|
]);
|
|
4609
|
-
const reportServiceWorkerFailure = (
|
|
4610
|
-
const
|
|
4641
|
+
const reportServiceWorkerFailure = (scriptUrl, failureKind, error, workerState) => {
|
|
4642
|
+
const endpointLabel = shortUrl(scriptUrl);
|
|
4643
|
+
let endpointOrigin;
|
|
4644
|
+
try {
|
|
4645
|
+
if (scriptUrl !== "service-worker")
|
|
4646
|
+
endpointOrigin = new URL(scriptUrl, location.href).origin;
|
|
4647
|
+
} catch {}
|
|
4648
|
+
const key = `${endpointOrigin ?? "unknown"}|${endpointLabel}|${failureKind}`;
|
|
4611
4649
|
if (reportedServiceWorkerFailures.has(key))
|
|
4612
4650
|
return;
|
|
4613
4651
|
reportedServiceWorkerFailures.add(key);
|
|
4614
4652
|
emitSignal(`Service worker failure — ${endpointLabel} failed during ${failureKind} — ${shortUrl(location.href)}`, {
|
|
4615
4653
|
endpoint: endpointLabel,
|
|
4654
|
+
...endpointOrigin === undefined ? {} : { endpointOrigin },
|
|
4655
|
+
pageOrigin: location.origin,
|
|
4616
4656
|
failureKind,
|
|
4617
4657
|
signal: BEACON_SIGNAL.SERVICE_WORKER_FAILURE
|
|
4618
|
-
}, undefined,
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4658
|
+
}, undefined, {
|
|
4659
|
+
...workerState === undefined ? {} : { serviceWorkerState: workerState },
|
|
4660
|
+
...error === undefined ? {} : {
|
|
4661
|
+
serviceWorkerError: {
|
|
4662
|
+
message: error.message,
|
|
4663
|
+
name: error.name,
|
|
4664
|
+
...error.stack === undefined ? {} : { stack: error.stack }
|
|
4665
|
+
}
|
|
4623
4666
|
}
|
|
4624
4667
|
});
|
|
4625
4668
|
};
|
|
4626
4669
|
const watchInstallingWorker = (worker, registration) => {
|
|
4627
4670
|
let settled = worker.state === "installed" || worker.state === "activated";
|
|
4671
|
+
let previousState = worker.state;
|
|
4628
4672
|
const onStateChange = () => {
|
|
4673
|
+
const fromState = previousState;
|
|
4674
|
+
previousState = worker.state;
|
|
4629
4675
|
if (worker.state === "installed" || worker.state === "activated")
|
|
4630
4676
|
settled = true;
|
|
4631
4677
|
if (worker.state !== "redundant" || settled)
|
|
@@ -4633,7 +4679,12 @@ var createBeacon = (options) => {
|
|
|
4633
4679
|
const successor = registration?.installing ?? registration?.waiting;
|
|
4634
4680
|
if (successor !== null && successor !== undefined && successor !== worker)
|
|
4635
4681
|
return;
|
|
4636
|
-
reportServiceWorkerFailure(
|
|
4682
|
+
reportServiceWorkerFailure(worker.scriptURL, "installation", undefined, {
|
|
4683
|
+
previousState: fromState,
|
|
4684
|
+
state: worker.state,
|
|
4685
|
+
hasActiveWorker: Boolean(registration?.active),
|
|
4686
|
+
hasWaitingWorker: Boolean(registration?.waiting)
|
|
4687
|
+
});
|
|
4637
4688
|
};
|
|
4638
4689
|
worker.addEventListener("statechange", onStateChange);
|
|
4639
4690
|
serviceWorkerListenerCleanups.push(() => worker.removeEventListener("statechange", onStateChange));
|
|
@@ -4653,7 +4704,11 @@ var createBeacon = (options) => {
|
|
|
4653
4704
|
const isServiceWorkerRegistration = (registration) => typeof registration === "object" && registration !== null && ("installing" in registration) && typeof registration.addEventListener === "function";
|
|
4654
4705
|
const originalRegister = container.register;
|
|
4655
4706
|
const wrappedRegister = async function(scriptURL, registrationOptions) {
|
|
4656
|
-
const
|
|
4707
|
+
const rawScriptUrl = String(scriptURL);
|
|
4708
|
+
let endpointLabel = shortUrl(rawScriptUrl);
|
|
4709
|
+
try {
|
|
4710
|
+
endpointLabel = new URL(rawScriptUrl, location.href).origin + endpointLabel;
|
|
4711
|
+
} catch {}
|
|
4657
4712
|
try {
|
|
4658
4713
|
const registration = await originalRegister.call(this, scriptURL, registrationOptions);
|
|
4659
4714
|
if (isServiceWorkerRegistration(registration)) {
|
|
@@ -4680,13 +4735,13 @@ var createBeacon = (options) => {
|
|
|
4680
4735
|
error: registrationError,
|
|
4681
4736
|
timeout: setTimeout(() => {
|
|
4682
4737
|
pendingRegistrationFailures.delete(endpointLabel);
|
|
4683
|
-
reportServiceWorkerFailure(
|
|
4738
|
+
reportServiceWorkerFailure(rawScriptUrl, "registration", pending.error);
|
|
4684
4739
|
}, recoveryMs)
|
|
4685
4740
|
};
|
|
4686
4741
|
pendingRegistrationFailures.set(endpointLabel, pending);
|
|
4687
4742
|
}
|
|
4688
4743
|
} else {
|
|
4689
|
-
reportServiceWorkerFailure(
|
|
4744
|
+
reportServiceWorkerFailure(rawScriptUrl, "registration", registrationError);
|
|
4690
4745
|
}
|
|
4691
4746
|
throw error;
|
|
4692
4747
|
}
|
|
@@ -5198,5 +5253,5 @@ export {
|
|
|
5198
5253
|
redactBeaconEvent
|
|
5199
5254
|
};
|
|
5200
5255
|
|
|
5201
|
-
//# debugId=
|
|
5256
|
+
//# debugId=C87616922B09895C64756E2164756E21
|
|
5202
5257
|
//# sourceMappingURL=index.js.map
|