@absolutejs/beacon 0.6.9 → 0.6.10

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.js CHANGED
@@ -713,6 +713,7 @@ var createBeacon = (options) => {
713
713
  const STALE_RELEASE_HISTORY_LIMIT = 5;
714
714
  const FORM_FRUSTRATION_THRESHOLD = 3;
715
715
  const FORM_FRUSTRATION_WINDOW_MS = 60000;
716
+ const LAYOUT_SHIFT_RECENT_INTERACTION_MS = 500;
716
717
  const FORM_INVALID_BURST_GAP_MS = 100;
717
718
  const SIGNAL_TEXT_MAX = 180;
718
719
  const slowResponseMs = signals?.slowResponseMs ?? SLOW_RESPONSE_DEFAULT_MS;
@@ -1611,6 +1612,7 @@ var createBeacon = (options) => {
1611
1612
  return;
1612
1613
  recentInteraction = {
1613
1614
  at: Date.now(),
1615
+ performanceAt: performance.now(),
1614
1616
  target: targetName,
1615
1617
  type: "click"
1616
1618
  };
@@ -1663,6 +1665,7 @@ var createBeacon = (options) => {
1663
1665
  beginAction("submit", target);
1664
1666
  recentInteraction = {
1665
1667
  at: Date.now(),
1668
+ performanceAt: performance.now(),
1666
1669
  target,
1667
1670
  type: "submit"
1668
1671
  };
@@ -1677,6 +1680,7 @@ var createBeacon = (options) => {
1677
1680
  beginAction("keyboard", targetName);
1678
1681
  recentInteraction = {
1679
1682
  at: Date.now(),
1683
+ performanceAt: performance.now(),
1680
1684
  target: targetName,
1681
1685
  type: "keyboard"
1682
1686
  };
@@ -2214,7 +2218,9 @@ var createBeacon = (options) => {
2214
2218
  const observer = new PerformanceObserver((list) => {
2215
2219
  for (const raw of list.getEntries()) {
2216
2220
  const entry = raw;
2217
- if (entry.hadRecentInput === true || (entry.value ?? 0) < minimum)
2221
+ const interactionAgeMs = recentInteraction === undefined ? undefined : entry.startTime - recentInteraction.performanceAt;
2222
+ const beaconSawRecentInput = interactionAgeMs !== undefined && interactionAgeMs >= 0 && interactionAgeMs <= LAYOUT_SHIFT_RECENT_INTERACTION_MS;
2223
+ if (entry.hadRecentInput === true || beaconSawRecentInput || (entry.value ?? 0) < minimum)
2218
2224
  continue;
2219
2225
  const targets = (entry.sources ?? []).map(({ node }) => node instanceof Element ? describeElement(node) : undefined).filter((target) => target !== undefined).slice(0, 5);
2220
2226
  const key = targets.join(",") || "unknown";
@@ -3695,5 +3701,5 @@ export {
3695
3701
  BEACON_ATTRIBUTE
3696
3702
  };
3697
3703
 
3698
- //# debugId=D59101AFB8434CF164756E2164756E21
3704
+ //# debugId=FB8AF5475A58E78864756E2164756E21
3699
3705
  //# sourceMappingURL=index.js.map