@absolutejs/beacon 0.6.50 → 0.6.51

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
@@ -104,7 +104,7 @@ export declare const BEACON_ATTRIBUTE: {
104
104
  /** Response header used to correlate a browser signal with its server request. */
105
105
  export declare const BEACON_TRACE_HEADER = "x-absolute-trace-id";
106
106
  /** Beacon package version retained with every captured event. */
107
- export declare const BEACON_SDK_VERSION = "0.6.50";
107
+ export declare const BEACON_SDK_VERSION = "0.6.51";
108
108
  /** Arbitrary event tags, with Beacon's reserved `signal` tag type-checked. */
109
109
  export type BeaconTags = Record<string, string> & {
110
110
  signal?: BeaconSignal;
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ var BEACON_ATTRIBUTE = {
75
75
  THEME: "data-beacon-theme"
76
76
  };
77
77
  var BEACON_TRACE_HEADER = "x-absolute-trace-id";
78
- var BEACON_SDK_VERSION = "0.6.50";
78
+ var BEACON_SDK_VERSION = "0.6.51";
79
79
  var inBrowser = () => typeof window !== "undefined";
80
80
  var newId = () => {
81
81
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -331,6 +331,11 @@ var isExtensionOnlyStack = (event) => {
331
331
  `).slice(1).map((line) => line.trim()).filter(Boolean);
332
332
  return frames.length > 0 && frames.every((frame) => EXTENSION_STACK_PROTOCOL.test(frame));
333
333
  };
334
+ var isExtensionInjectedStack = (event) => {
335
+ const firstFrame = (event.stack ?? "").split(`
336
+ `).slice(1).map((line) => line.trim()).find(Boolean);
337
+ return firstFrame !== undefined && EXTENSION_STACK_PROTOCOL.test(firstFrame);
338
+ };
334
339
  var isInjectedServiceWorkerRejection = (event) => {
335
340
  const stack = event.stack ?? "";
336
341
  if (stack.includes(GOOGLE_WEB_RENDERER_SERVICE_WORKER_WRAPPER))
@@ -823,6 +828,16 @@ var createBeacon = (options) => {
823
828
  let pageRestoredAt;
824
829
  let recentInteraction;
825
830
  let reportErrorClick = null;
831
+ const reportCapturedErrorClick = (error, tags2) => {
832
+ if (filterKnownNoise && isKnownBeaconNoise({
833
+ message: error.message,
834
+ name: error.name,
835
+ stack: error.stack,
836
+ tags: tags2
837
+ }))
838
+ return;
839
+ reportErrorClick?.(error.name);
840
+ };
826
841
  let reportFormAbandonmentOnNavigation = null;
827
842
  const focusedEditable = () => {
828
843
  const active = document.activeElement;
@@ -1352,6 +1367,8 @@ var createBeacon = (options) => {
1352
1367
  if (signals === null || signals.failedRequests === false)
1353
1368
  return;
1354
1369
  const error = toError(errorValue);
1370
+ if (filterKnownNoise && isExtensionInjectedStack(error))
1371
+ return;
1355
1372
  const kind = failureKind(error);
1356
1373
  if (kind === "aborted" || kind === "transport" && pageLifecycleEnding)
1357
1374
  return;
@@ -1684,7 +1701,7 @@ var createBeacon = (options) => {
1684
1701
  level: "error",
1685
1702
  tags: errorEventTags(event)
1686
1703
  });
1687
- reportErrorClick?.(error.name);
1704
+ reportCapturedErrorClick(error, errorEventTags(event));
1688
1705
  return;
1689
1706
  }
1690
1707
  const target = event.target;
@@ -1723,7 +1740,7 @@ var createBeacon = (options) => {
1723
1740
  const reason = event.reason;
1724
1741
  if (reason instanceof Error) {
1725
1742
  captureException(reason, { level: "error" });
1726
- reportErrorClick?.(reason.name);
1743
+ reportCapturedErrorClick(reason);
1727
1744
  return;
1728
1745
  }
1729
1746
  if (typeof reason === "object" && reason !== null && typeof reason.stack === "string") {
@@ -2587,19 +2604,33 @@ var createBeacon = (options) => {
2587
2604
  const media = link.media.trim();
2588
2605
  return media === "" || typeof window.matchMedia !== "function" || window.matchMedia(media).matches;
2589
2606
  });
2590
- return stylesheets.every((link) => link.sheet !== null);
2607
+ if (!stylesheets.every((link) => link.sheet !== null))
2608
+ return false;
2609
+ if (stylesheets.length === 0)
2610
+ return true;
2611
+ const utilityExpectations = [
2612
+ ['[class~="absolute"]', "position", "absolute"],
2613
+ ['[class~="fixed"]', "position", "fixed"],
2614
+ ['[class~="flex"]', "display", "flex"],
2615
+ ['[class~="grid"]', "display", "grid"],
2616
+ ['[class~="hidden"]', "display", "none"]
2617
+ ];
2618
+ return utilityExpectations.every(([selector, property, expected]) => {
2619
+ const sample = document.querySelector(selector);
2620
+ return sample === null || window.getComputedStyle(sample)[property] === expected;
2621
+ });
2591
2622
  };
2592
2623
  const runSettledScan = () => {
2593
- const visualStylesReady = documentStylesAreReady();
2594
- if (detectOverflow && visualStylesReady)
2624
+ const geometryReady = documentStylesAreReady() && !mobileKeyboardViewportActive();
2625
+ if (detectOverflow && geometryReady)
2595
2626
  scanForOverflow();
2596
- if (detectControlCollision && visualStylesReady)
2627
+ if (detectControlCollision && geometryReady)
2597
2628
  scanForControlCollisions();
2598
- if (detectOcclusion && visualStylesReady)
2629
+ if (detectOcclusion && geometryReady)
2599
2630
  scanForOcclusion();
2600
- if (detectInvisibleText && visualStylesReady)
2631
+ if (detectInvisibleText && geometryReady)
2601
2632
  scanForInvisibleText();
2602
- if (detectThemeMismatch && visualStylesReady)
2633
+ if (detectThemeMismatch && geometryReady)
2603
2634
  scanForThemeMismatch();
2604
2635
  if (detectStuckLoading)
2605
2636
  checkStuckLoading();
@@ -2754,7 +2785,7 @@ var createBeacon = (options) => {
2754
2785
  const processingDurationMs = hasPhaseTiming ? Math.round(Math.max(0, entry.processingEnd - entry.processingStart)) : undefined;
2755
2786
  const presentationDelayMs = hasPhaseTiming ? Math.round(Math.max(0, interactionEnd - entry.processingEnd)) : undefined;
2756
2787
  const inputDelayMs = hasPhaseTiming ? Math.round(Math.max(0, entry.processingStart - entry.startTime)) : undefined;
2757
- if (target === "unknown" && overlappingFrame === undefined && processingDurationMs !== undefined && processingDurationMs <= 16 && presentationDelayMs !== undefined && presentationDelayMs >= minimum)
2788
+ if (overlappingFrame === undefined && processingDurationMs !== undefined && processingDurationMs <= 16 && presentationDelayMs !== undefined && presentationDelayMs >= minimum)
2758
2789
  continue;
2759
2790
  if (blockingObserver !== undefined && overlappingFrame === undefined && inputDelayMs !== undefined && inputDelayMs >= minimum && processingDurationMs !== undefined && processingDurationMs <= 16 && presentationDelayMs !== undefined && presentationDelayMs < minimum)
2760
2791
  continue;
@@ -4395,5 +4426,5 @@ export {
4395
4426
  BEACON_ATTRIBUTE
4396
4427
  };
4397
4428
 
4398
- //# debugId=429074B23CDFDDC864756E2164756E21
4429
+ //# debugId=6D704346382EE6C664756E2164756E21
4399
4430
  //# sourceMappingURL=index.js.map