@absolutejs/beacon 0.7.0-beta.3 → 0.7.0-beta.5
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 +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -10
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
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
|
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.5";
|
|
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;
|
package/dist/index.js
CHANGED
|
@@ -199,7 +199,7 @@ var consumeEarlyLayoutShiftBuffer = () => {
|
|
|
199
199
|
|
|
200
200
|
// src/index.ts
|
|
201
201
|
var BEACON_TRACE_HEADER = "x-absolute-trace-id";
|
|
202
|
-
var BEACON_SDK_VERSION = "0.7.0-beta.
|
|
202
|
+
var BEACON_SDK_VERSION = "0.7.0-beta.5";
|
|
203
203
|
var inBrowser = () => typeof window !== "undefined";
|
|
204
204
|
var newId = () => {
|
|
205
205
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -450,14 +450,14 @@ var FACEBOOK_ANDROID_PERFORMANCE_LOGGER = "iabjs://navigation_performance_logger
|
|
|
450
450
|
var KNOWN_CRAWLER_USER_AGENT = /(?:AdsBot-Google|Googlebot|bingbot|Baiduspider|YandexBot|DuckDuckBot|Applebot|Bytespider|PetalBot|SemrushBot|AhrefsBot|DotBot|MJ12bot|GPTBot|ClaudeBot|PerplexityBot|Google-NotebookLM|BitSightBot|Dataprovider\.com|HubSpot Crawler|meta-external(?:agent|ads))/i;
|
|
451
451
|
var GOOGLE_WEB_RENDERER_SERVICE_WORKER_WRAPPER = "wrsParams.serviceWorkers.navigator.serviceWorker.register";
|
|
452
452
|
var EXTENSION_STACK_PROTOCOL = /(?:chrome|moz|safari-web)-extension:\/\//u;
|
|
453
|
+
var stackFrames = (stack) => (stack ?? "").split(`
|
|
454
|
+
`).map((line) => line.trim()).filter((line) => line.startsWith("at ") || /@(?:[a-z][a-z\d+.-]*:)?\/\//iu.test(line));
|
|
453
455
|
var isExtensionOnlyStack = (event) => {
|
|
454
|
-
const frames = (event.stack
|
|
455
|
-
`).slice(1).map((line) => line.trim()).filter(Boolean);
|
|
456
|
+
const frames = stackFrames(event.stack);
|
|
456
457
|
return frames.length > 0 && frames.every((frame) => EXTENSION_STACK_PROTOCOL.test(frame));
|
|
457
458
|
};
|
|
458
459
|
var isExtensionInjectedStack = (event) => {
|
|
459
|
-
const firstFrame = (event.stack
|
|
460
|
-
`).slice(1).map((line) => line.trim()).find(Boolean);
|
|
460
|
+
const [firstFrame] = stackFrames(event.stack);
|
|
461
461
|
return firstFrame !== undefined && EXTENSION_STACK_PROTOCOL.test(firstFrame);
|
|
462
462
|
};
|
|
463
463
|
var isStacklessBrowserAbort = (event) => event.name === "AbortError" && event.message === "The user aborted a request." && (event.stack ?? "").trim() === "";
|
|
@@ -631,6 +631,10 @@ var VOLATILE_SIGNAL_TAGS = new Set([
|
|
|
631
631
|
"layoutShiftSources",
|
|
632
632
|
"layoutShiftStartTimeMs",
|
|
633
633
|
"newestRelease",
|
|
634
|
+
"navigationAgeMs",
|
|
635
|
+
"navigationFrom",
|
|
636
|
+
"navigationTo",
|
|
637
|
+
"navigationType",
|
|
634
638
|
"obscuredPx",
|
|
635
639
|
"presentationDelayMs",
|
|
636
640
|
"processingDurationMs",
|
|
@@ -952,6 +956,7 @@ var createBeacon = (options) => {
|
|
|
952
956
|
const FORM_FRUSTRATION_THRESHOLD = 3;
|
|
953
957
|
const FORM_FRUSTRATION_WINDOW_MS = 60000;
|
|
954
958
|
const LAYOUT_SHIFT_RECENT_INTERACTION_MS = 500;
|
|
959
|
+
const LAYOUT_SHIFT_SPA_NAVIGATION_SETTLE_MS = 2000;
|
|
955
960
|
const LAYOUT_SHIFT_INTERACTION_PROVENANCE_MS = 1e4;
|
|
956
961
|
const LAYOUT_SHIFT_VIEWPORT_RESIZE_SETTLE_MS = 500;
|
|
957
962
|
const VIEWPORT_RESIZE_HISTORY_LIMIT = 8;
|
|
@@ -982,6 +987,7 @@ var createBeacon = (options) => {
|
|
|
982
987
|
let pageLifecycleGeneration = 0;
|
|
983
988
|
let pageRestoredAt;
|
|
984
989
|
let recentInteraction;
|
|
990
|
+
let recentNavigation;
|
|
985
991
|
let reportErrorClick = null;
|
|
986
992
|
const reportCapturedErrorClick = (error, tags2) => {
|
|
987
993
|
if (filterKnownNoise && isKnownBeaconNoise({
|
|
@@ -2948,11 +2954,13 @@ var createBeacon = (options) => {
|
|
|
2948
2954
|
];
|
|
2949
2955
|
const interactionAgeMs = interactionTimes.map((interactionAt) => entry.startTime - interactionAt).filter((age) => age >= 0).sort((left, right) => left - right)[0];
|
|
2950
2956
|
const beaconSawRecentInput = interactionAgeMs !== undefined && interactionAgeMs <= LAYOUT_SHIFT_RECENT_INTERACTION_MS;
|
|
2957
|
+
const navigationAgeMs = recentNavigation === undefined ? undefined : entry.startTime - recentNavigation.performanceAt;
|
|
2958
|
+
const navigationSettling = navigationAgeMs !== undefined && navigationAgeMs >= 0 && navigationAgeMs <= LAYOUT_SHIFT_SPA_NAVIGATION_SETTLE_MS;
|
|
2951
2959
|
const resizeAdjacent = viewportResizeTimes.some((resizedAt) => {
|
|
2952
2960
|
const resizeAgeMs = entry.startTime - resizedAt;
|
|
2953
2961
|
return resizeAgeMs >= 0 && resizeAgeMs <= LAYOUT_SHIFT_VIEWPORT_RESIZE_SETTLE_MS;
|
|
2954
2962
|
});
|
|
2955
|
-
if (entry.hadRecentInput || beaconSawRecentInput || resizeAdjacent || mobileKeyboardViewportActive() || entry.value < minimum)
|
|
2963
|
+
if (entry.hadRecentInput || beaconSawRecentInput || navigationSettling || resizeAdjacent || mobileKeyboardViewportActive() || entry.value < minimum)
|
|
2956
2964
|
return;
|
|
2957
2965
|
const sourceElements = entry.sources.map(({ node }) => node instanceof Element ? node : undefined).filter((node) => node !== undefined);
|
|
2958
2966
|
if (sourceElements.length > 0 && sourceElements.every((node) => node.closest(`[${BEACON_ATTRIBUTE.LAYOUT_SHIFT}="allow"]`) !== null))
|
|
@@ -2980,6 +2988,12 @@ var createBeacon = (options) => {
|
|
|
2980
2988
|
interactionType: interactionProvenance.type
|
|
2981
2989
|
}
|
|
2982
2990
|
} : {},
|
|
2991
|
+
...recentNavigation === undefined || navigationAgeMs === undefined || navigationAgeMs < 0 || navigationAgeMs > LAYOUT_SHIFT_INTERACTION_PROVENANCE_MS ? {} : {
|
|
2992
|
+
navigationAgeMs: String(Math.round(navigationAgeMs)),
|
|
2993
|
+
navigationFrom: recentNavigation.from,
|
|
2994
|
+
navigationTo: recentNavigation.to,
|
|
2995
|
+
navigationType: recentNavigation.type
|
|
2996
|
+
},
|
|
2983
2997
|
layoutShiftBuffered: String(entry.buffered),
|
|
2984
2998
|
layoutShiftObservedAtMs: String(Math.round(entry.observedAt)),
|
|
2985
2999
|
layoutShiftObserverStartedAtMs: String(Math.round(entry.observerStartedAt)),
|
|
@@ -4658,11 +4672,17 @@ var createBeacon = (options) => {
|
|
|
4658
4672
|
}
|
|
4659
4673
|
if (instrument.history !== false && typeof history !== "undefined") {
|
|
4660
4674
|
let recordedHistoryUrl = location.href;
|
|
4661
|
-
const record = () => {
|
|
4675
|
+
const record = (from, type) => {
|
|
4662
4676
|
addBreadcrumb({
|
|
4663
4677
|
message: `navigate ${location.pathname}${location.search}`,
|
|
4664
4678
|
type: "navigation"
|
|
4665
4679
|
});
|
|
4680
|
+
recentNavigation = {
|
|
4681
|
+
from: shortUrl(from),
|
|
4682
|
+
performanceAt: performance.now(),
|
|
4683
|
+
to: shortUrl(location.href),
|
|
4684
|
+
type
|
|
4685
|
+
};
|
|
4666
4686
|
recordedHistoryUrl = location.href;
|
|
4667
4687
|
overflowScanOnNavigation?.();
|
|
4668
4688
|
};
|
|
@@ -4684,7 +4704,7 @@ var createBeacon = (options) => {
|
|
|
4684
4704
|
if (!changesUrl)
|
|
4685
4705
|
return result;
|
|
4686
4706
|
reportFormAbandonmentOnNavigation?.(departedUrl);
|
|
4687
|
-
record();
|
|
4707
|
+
record(departedUrl, key);
|
|
4688
4708
|
return result;
|
|
4689
4709
|
};
|
|
4690
4710
|
return () => {
|
|
@@ -4696,7 +4716,7 @@ var createBeacon = (options) => {
|
|
|
4696
4716
|
if (location.href === recordedHistoryUrl)
|
|
4697
4717
|
return;
|
|
4698
4718
|
reportFormAbandonmentOnNavigation?.(recordedHistoryUrl);
|
|
4699
|
-
record();
|
|
4719
|
+
record(recordedHistoryUrl, "popstate");
|
|
4700
4720
|
};
|
|
4701
4721
|
window.addEventListener("popstate", onPopState);
|
|
4702
4722
|
cleanups.push(() => window.removeEventListener("popstate", onPopState));
|
|
@@ -4792,5 +4812,5 @@ export {
|
|
|
4792
4812
|
redactBeaconEvent
|
|
4793
4813
|
};
|
|
4794
4814
|
|
|
4795
|
-
//# debugId=
|
|
4815
|
+
//# debugId=69A1D614031FDB2864756E2164756E21
|
|
4796
4816
|
//# sourceMappingURL=index.js.map
|