@absolutejs/beacon 0.6.51 → 0.6.53
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 +5 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.js +70 -7
- package/dist/index.js.map +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -130,8 +130,11 @@ beacon.captureMessage("checkout started", "info");
|
|
|
130
130
|
with effectively no spacing. Same-parent rows, semantic control groups,
|
|
131
131
|
navigation, and positioned controls that merely touch are excluded so tabs,
|
|
132
132
|
segmented controls, and floating actions remain quiet. Tune the near-touch
|
|
133
|
-
threshold with `signals.controlCollisionGapPx
|
|
134
|
-
|
|
133
|
+
threshold with `signals.controlCollisionGapPx`. Mark nested controls that
|
|
134
|
+
intentionally meet with `data-beacon-control-group`; this suppresses only
|
|
135
|
+
near-touch reports, while true overlaps remain visible. Use
|
|
136
|
+
`data-beacon-scan="allow"` only when the whole subtree must be exempt from
|
|
137
|
+
every visual scan.
|
|
135
138
|
- **Ambient watchdogs** — silent failures users abandon instead of reporting
|
|
136
139
|
become warning issues: scroll jail (a leaked modal scroll lock), stuck
|
|
137
140
|
loading (`aria-busy`/`role="progressbar"` that never resolves), occluded
|
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,9 @@ export type BeaconSignal = (typeof BEACON_SIGNAL)[keyof typeof BEACON_SIGNAL];
|
|
|
79
79
|
export declare const BEACON_ATTRIBUTE: {
|
|
80
80
|
/** Names an application root whose settled empty state is a failure. */
|
|
81
81
|
readonly APP_ROOT: "data-beacon-app-root";
|
|
82
|
+
/** Groups controls whose intentional near-touching layout should not be
|
|
83
|
+
* reported as a collision. True border-box overlaps remain reportable. */
|
|
84
|
+
readonly CONTROL_GROUP: "data-beacon-control-group";
|
|
82
85
|
readonly DEAD_CLICK: "data-beacon-dead-click";
|
|
83
86
|
readonly NAME: "data-beacon-name";
|
|
84
87
|
/** Names an iframe whose initial load should be watched for a stall. */
|
|
@@ -104,7 +107,7 @@ export declare const BEACON_ATTRIBUTE: {
|
|
|
104
107
|
/** Response header used to correlate a browser signal with its server request. */
|
|
105
108
|
export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
106
109
|
/** Beacon package version retained with every captured event. */
|
|
107
|
-
export declare const BEACON_SDK_VERSION = "0.6.
|
|
110
|
+
export declare const BEACON_SDK_VERSION = "0.6.53";
|
|
108
111
|
/** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
|
|
109
112
|
export type BeaconTags = Record<string, string> & {
|
|
110
113
|
signal?: BeaconSignal;
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,7 @@ var BEACON_SIGNAL = {
|
|
|
63
63
|
};
|
|
64
64
|
var BEACON_ATTRIBUTE = {
|
|
65
65
|
APP_ROOT: "data-beacon-app-root",
|
|
66
|
+
CONTROL_GROUP: "data-beacon-control-group",
|
|
66
67
|
DEAD_CLICK: "data-beacon-dead-click",
|
|
67
68
|
NAME: "data-beacon-name",
|
|
68
69
|
EMBED: "data-beacon-embed",
|
|
@@ -75,7 +76,7 @@ var BEACON_ATTRIBUTE = {
|
|
|
75
76
|
THEME: "data-beacon-theme"
|
|
76
77
|
};
|
|
77
78
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
78
|
-
var BEACON_SDK_VERSION = "0.6.
|
|
79
|
+
var BEACON_SDK_VERSION = "0.6.53";
|
|
79
80
|
var inBrowser = () => typeof window !== "undefined";
|
|
80
81
|
var newId = () => {
|
|
81
82
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -1575,20 +1576,64 @@ var createBeacon = (options) => {
|
|
|
1575
1576
|
if (stallTimes.length < stallCount)
|
|
1576
1577
|
continue;
|
|
1577
1578
|
reported = true;
|
|
1578
|
-
const
|
|
1579
|
+
const scriptsByDuration = [...animationFrame.scripts ?? []].sort((left, right) => (right.duration ?? 0) - (left.duration ?? 0));
|
|
1580
|
+
const script = scriptsByDuration[0];
|
|
1581
|
+
const frameEnd = entry.startTime + entry.duration;
|
|
1582
|
+
const renderDuration = animationFrame.renderStart === undefined || animationFrame.renderStart <= 0 ? undefined : Math.max(0, frameEnd - animationFrame.renderStart);
|
|
1583
|
+
const styleAndLayoutDuration = animationFrame.styleAndLayoutStart === undefined || animationFrame.styleAndLayoutStart <= 0 ? undefined : Math.max(0, frameEnd - animationFrame.styleAndLayoutStart);
|
|
1584
|
+
const scriptDuration = (animationFrame.scripts ?? []).reduce((total, timing) => total + (timing.duration ?? 0), 0);
|
|
1585
|
+
const scriptTimings = scriptsByDuration.slice(0, 5).map((timing) => ({
|
|
1586
|
+
durationMs: Math.round(timing.duration ?? 0),
|
|
1587
|
+
...timing.forcedStyleAndLayoutDuration === undefined ? {} : {
|
|
1588
|
+
forcedStyleAndLayoutDurationMs: Math.round(timing.forcedStyleAndLayoutDuration)
|
|
1589
|
+
},
|
|
1590
|
+
...timing.invoker === undefined ? {} : { invoker: timing.invoker },
|
|
1591
|
+
...timing.invokerType === undefined ? {} : { invokerType: timing.invokerType },
|
|
1592
|
+
...timing.pauseDuration === undefined ? {} : { pauseDurationMs: Math.round(timing.pauseDuration) },
|
|
1593
|
+
...timing.sourceCharPosition === undefined ? {} : { sourceCharPosition: timing.sourceCharPosition },
|
|
1594
|
+
...timing.sourceFunctionName === undefined && timing.functionName === undefined ? {} : {
|
|
1595
|
+
sourceFunctionName: timing.sourceFunctionName ?? timing.functionName
|
|
1596
|
+
},
|
|
1597
|
+
...timing.sourceURL === undefined ? {} : { sourceURL: shortUrl(timing.sourceURL) },
|
|
1598
|
+
...timing.windowAttribution === undefined ? {} : { windowAttribution: timing.windowAttribution }
|
|
1599
|
+
}));
|
|
1579
1600
|
emitSignal(`Main-thread stall — repeated long frames blocked the page — ${shortUrl(location.href)}`, {
|
|
1580
1601
|
...animationFrame.blockingDuration === undefined ? {} : {
|
|
1581
1602
|
blockingDurationMs: String(Math.round(animationFrame.blockingDuration))
|
|
1582
1603
|
},
|
|
1583
1604
|
durationMs: String(Math.round(entry.duration)),
|
|
1584
1605
|
entryType: entry.entryType,
|
|
1606
|
+
framePhase: entry.startTime < stallWindowMs ? "startup" : "runtime",
|
|
1607
|
+
...animationFrame.firstUIEventTimestamp === undefined || animationFrame.firstUIEventTimestamp <= 0 ? {} : {
|
|
1608
|
+
firstUIEventAtMs: String(Math.round(animationFrame.firstUIEventTimestamp))
|
|
1609
|
+
},
|
|
1610
|
+
...renderDuration === undefined ? {} : { renderDurationMs: String(Math.round(renderDuration)) },
|
|
1585
1611
|
signal: BEACON_SIGNAL.MAIN_THREAD_STALL,
|
|
1586
|
-
|
|
1612
|
+
scriptAttribution: script === undefined ? "unavailable" : "available",
|
|
1613
|
+
scriptCount: String(animationFrame.scripts?.length ?? 0),
|
|
1614
|
+
scriptDurationMs: String(Math.round(scriptDuration)),
|
|
1615
|
+
...script?.forcedStyleAndLayoutDuration === undefined ? {} : {
|
|
1616
|
+
scriptForcedStyleAndLayoutMs: String(Math.round(script.forcedStyleAndLayoutDuration))
|
|
1617
|
+
},
|
|
1618
|
+
...script?.sourceFunctionName === undefined && script?.functionName === undefined ? {} : {
|
|
1619
|
+
scriptFunction: script.sourceFunctionName ?? script.functionName ?? ""
|
|
1620
|
+
},
|
|
1587
1621
|
...script?.invoker === undefined ? {} : { scriptInvoker: script.invoker },
|
|
1622
|
+
...script?.invokerType === undefined ? {} : { scriptInvokerType: script.invokerType },
|
|
1623
|
+
...script?.pauseDuration === undefined ? {} : {
|
|
1624
|
+
scriptPauseDurationMs: String(Math.round(script.pauseDuration))
|
|
1625
|
+
},
|
|
1626
|
+
...script?.sourceCharPosition === undefined ? {} : {
|
|
1627
|
+
scriptSourceCharPosition: String(script.sourceCharPosition)
|
|
1628
|
+
},
|
|
1588
1629
|
...script?.sourceURL === undefined ? {} : { scriptSource: shortUrl(script.sourceURL) },
|
|
1630
|
+
...script?.windowAttribution === undefined ? {} : { scriptWindowAttribution: script.windowAttribution },
|
|
1589
1631
|
stallCount: String(stallTimes.length),
|
|
1632
|
+
...styleAndLayoutDuration === undefined ? {} : {
|
|
1633
|
+
styleAndLayoutDurationMs: String(Math.round(styleAndLayoutDuration))
|
|
1634
|
+
},
|
|
1590
1635
|
windowMs: String(stallWindowMs)
|
|
1591
|
-
});
|
|
1636
|
+
}, undefined, scriptTimings.length === 0 ? undefined : { scriptTimings });
|
|
1592
1637
|
break;
|
|
1593
1638
|
}
|
|
1594
1639
|
});
|
|
@@ -1770,8 +1815,26 @@ var createBeacon = (options) => {
|
|
|
1770
1815
|
if (method === "error" && signals !== null && signals.consoleErrors !== false && !inSignalConsole) {
|
|
1771
1816
|
inSignalConsole = true;
|
|
1772
1817
|
const text = args.map(String).join(" ").trim().slice(0, SIGNAL_TEXT_MAX);
|
|
1773
|
-
|
|
1818
|
+
const loggedError = args.find((argument) => {
|
|
1819
|
+
if (argument instanceof Error)
|
|
1820
|
+
return true;
|
|
1821
|
+
if (typeof argument !== "object" || argument === null)
|
|
1822
|
+
return false;
|
|
1823
|
+
try {
|
|
1824
|
+
return typeof Reflect.get(argument, "stack") === "string";
|
|
1825
|
+
} catch {
|
|
1826
|
+
return false;
|
|
1827
|
+
}
|
|
1828
|
+
});
|
|
1829
|
+
if (text !== "" && loggedError !== undefined) {
|
|
1830
|
+
captureException(loggedError, {
|
|
1831
|
+
extra: { consoleMessage: text },
|
|
1832
|
+
level: "warning",
|
|
1833
|
+
tags: { signal: BEACON_SIGNAL.CONSOLE_ERROR }
|
|
1834
|
+
});
|
|
1835
|
+
} else if (text !== "") {
|
|
1774
1836
|
emitSignal(text, { signal: BEACON_SIGNAL.CONSOLE_ERROR }, undefined, undefined, wrappedConsole, 2, true);
|
|
1837
|
+
}
|
|
1775
1838
|
if (text !== "")
|
|
1776
1839
|
reportErrorClick?.("ConsoleError");
|
|
1777
1840
|
inSignalConsole = false;
|
|
@@ -2104,7 +2167,7 @@ var createBeacon = (options) => {
|
|
|
2104
2167
|
visit(body, null);
|
|
2105
2168
|
};
|
|
2106
2169
|
const CONTROL_SELECTOR = 'a[href], button, input, select, textarea, [role="button"]';
|
|
2107
|
-
const INTENTIONAL_CONTROL_GROUP_SELECTOR =
|
|
2170
|
+
const INTENTIONAL_CONTROL_GROUP_SELECTOR = `nav, [role="group"], [role="menu"], [role="radiogroup"], [role="tablist"], [role="toolbar"], [${BEACON_ATTRIBUTE.CONTROL_GROUP}]`;
|
|
2108
2171
|
const clipsAxis = (overflow) => overflow === "auto" || overflow === "scroll" || overflow === "hidden" || overflow === "clip";
|
|
2109
2172
|
const visibleControlRect = (control, rect, viewportWidth, viewportHeight) => {
|
|
2110
2173
|
const visible = {
|
|
@@ -4426,5 +4489,5 @@ export {
|
|
|
4426
4489
|
BEACON_ATTRIBUTE
|
|
4427
4490
|
};
|
|
4428
4491
|
|
|
4429
|
-
//# debugId=
|
|
4492
|
+
//# debugId=EE83C567E5E182D764756E2164756E21
|
|
4430
4493
|
//# sourceMappingURL=index.js.map
|