@absolutejs/beacon 0.7.0-beta.6 → 0.7.0-beta.8

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/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.6";
28
+ export declare const BEACON_SDK_VERSION = "0.7.0-beta.8";
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,8 +140,9 @@ 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 while `navigator.webdriver` is true.
144
- * Explicit exceptions and messages are unaffected. Default false. */
143
+ /** Suppress synthetic watchdog findings for WebDriver and explicitly
144
+ * identified crawler/audit user agents. Explicit exceptions and messages
145
+ * are unaffected. Default false. */
145
146
  suppressAutomatedBrowsers?: boolean;
146
147
  /** Back/forward navigations the browser could not restore from bfcache. */
147
148
  bfcacheBlocks?: boolean;
@@ -546,6 +547,7 @@ export type Beacon = {
546
547
  export declare const redactBeaconEvent: (event: BeaconEvent) => BeaconEvent;
547
548
  /** Known browser-host/scanner failures that do not originate in page code. */
548
549
  export declare const isKnownBeaconNoise: (event: Pick<BeaconEvent, "message" | "name" | "stack" | "tags">, userAgent?: string) => boolean;
550
+ export declare const isAutomatedBrowser: () => boolean;
549
551
  export declare const createBeacon: (options: BeaconOptions) => Beacon;
550
552
  /** Initialize the global beacon. Returns the instance. */
551
553
  export declare const initBeacon: (options: BeaconOptions) => Beacon;
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.6";
202
+ var BEACON_SDK_VERSION = "0.7.0-beta.8";
203
203
  var inBrowser = () => typeof window !== "undefined";
204
204
  var newId = () => {
205
205
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -643,11 +643,17 @@ var VOLATILE_SIGNAL_TAGS = new Set([
643
643
  "responseMs",
644
644
  "shiftValue",
645
645
  "signal",
646
+ "scriptAttribution",
646
647
  "scriptCount",
647
648
  "scriptDurationMs",
649
+ "scriptFunction",
648
650
  "scriptForcedStyleAndLayoutMs",
651
+ "scriptInvoker",
652
+ "scriptInvokerType",
649
653
  "scriptPauseDurationMs",
654
+ "scriptSource",
650
655
  "scriptSourceCharPosition",
656
+ "scriptWindowAttribution",
651
657
  "spillPx",
652
658
  "stallCount",
653
659
  "styleAndLayoutDurationMs",
@@ -685,6 +691,8 @@ var signalGroupingKey = (signalTags) => {
685
691
  const hash = stableIdentityHash(identity, 2166136261) + stableIdentityHash(identity, 2654435769);
686
692
  return `beacon-signal:${signalTags.signal}:${hash}`;
687
693
  };
694
+ var AUTOMATED_BROWSER_USER_AGENT = /(?:\b(?:adsbot|bingbot|crawler|googlebot|headlesschrome|lighthouse|pagespeed|spider)\b|\b(?:bot|crawl|spider)\/)/iu;
695
+ var isAutomatedBrowser = () => typeof navigator !== "undefined" && (navigator.webdriver === true || AUTOMATED_BROWSER_USER_AGENT.test(navigator.userAgent));
688
696
  var isInvisibleAnchor = (anchor) => {
689
697
  if (anchor.target === "_blank" || anchor.hasAttribute("download"))
690
698
  return true;
@@ -1247,7 +1255,7 @@ var createBeacon = (options) => {
1247
1255
  push(event);
1248
1256
  };
1249
1257
  const emitSignal = (message, signalTags, traceId, extra, stackBoundary, fallbackFramesToDrop = 1, useDefaultFingerprint = false) => {
1250
- if (signals?.suppressAutomatedBrowsers === true && typeof navigator !== "undefined" && navigator.webdriver === true)
1258
+ if (signals?.suppressAutomatedBrowsers === true && isAutomatedBrowser())
1251
1259
  return;
1252
1260
  if (staleClientRelease && signalTags.signal !== BEACON_SIGNAL.STALE_RELEASE && signalTags.signal !== BEACON_SIGNAL.RELOAD_LOOP)
1253
1261
  return;
@@ -2950,6 +2958,9 @@ var createBeacon = (options) => {
2950
2958
  };
2951
2959
  };
2952
2960
  const processLayoutShift = (entry) => {
2961
+ const firstContentfulPaint = performance.getEntriesByName("first-contentful-paint")[0]?.startTime;
2962
+ if (firstContentfulPaint !== undefined && entry.startTime < firstContentfulPaint)
2963
+ return;
2953
2964
  const interactionTimes = [
2954
2965
  ...earlyInteractionTimes,
2955
2966
  ...recentInteraction === undefined ? [] : [recentInteraction.performanceAt]
@@ -4812,10 +4823,11 @@ export {
4812
4823
  createBeacon,
4813
4824
  getBeacon,
4814
4825
  initBeacon,
4826
+ isAutomatedBrowser,
4815
4827
  isKnownBeaconNoise,
4816
4828
  observeCapability,
4817
4829
  redactBeaconEvent
4818
4830
  };
4819
4831
 
4820
- //# debugId=B2E4D5B70391586864756E2164756E21
4832
+ //# debugId=6833B5EED4A6D0D164756E2164756E21
4821
4833
  //# sourceMappingURL=index.js.map