@absolutejs/beacon 0.6.28 → 0.6.30

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
@@ -784,6 +784,7 @@ var createBeacon = (options) => {
784
784
  let networkRequestCount = 0;
785
785
  let externalNavigationCount = 0;
786
786
  let externalShareCount = 0;
787
+ let nativeFilePickerCount = 0;
787
788
  let clipboardWriteCount = 0;
788
789
  let inSignalConsole = false;
789
790
  let pageLifecycleEnding = false;
@@ -1278,6 +1279,7 @@ var createBeacon = (options) => {
1278
1279
  const networkRequestsBefore = networkRequestCount;
1279
1280
  const externalNavigationsBefore = externalNavigationCount;
1280
1281
  const externalSharesBefore = externalShareCount;
1282
+ const nativeFilePickersBefore = nativeFilePickerCount;
1281
1283
  const clipboardWritesBefore = clipboardWriteCount;
1282
1284
  let routerAcceptedNavigation = false;
1283
1285
  let mutated = false;
@@ -1289,7 +1291,7 @@ var createBeacon = (options) => {
1289
1291
  return;
1290
1292
  routerAcceptedNavigation = control instanceof HTMLAnchorElement && handledEvent.defaultPrevented;
1291
1293
  };
1292
- const responded = () => mutated || formStateChanged(formBefore) || location.href !== urlBefore || window.scrollY !== scrollBefore || document.activeElement !== activeBefore || networkRequestCount !== networkRequestsBefore || externalNavigationCount !== externalNavigationsBefore || externalShareCount !== externalSharesBefore || clipboardWriteCount !== clipboardWritesBefore;
1294
+ const responded = () => mutated || formStateChanged(formBefore) || location.href !== urlBefore || window.scrollY !== scrollBefore || document.activeElement !== activeBefore || networkRequestCount !== networkRequestsBefore || externalNavigationCount !== externalNavigationsBefore || externalShareCount !== externalSharesBefore || nativeFilePickerCount !== nativeFilePickersBefore || clipboardWriteCount !== clipboardWritesBefore;
1293
1295
  const finish = (didRespond, navigationStalled = false) => {
1294
1296
  if (finished)
1295
1297
  return;
@@ -1710,6 +1712,20 @@ var createBeacon = (options) => {
1710
1712
  });
1711
1713
  } catch {}
1712
1714
  }
1715
+ const inputPrototype = HTMLInputElement.prototype;
1716
+ const originalInputClick = inputPrototype.click;
1717
+ const wrappedInputClick = function() {
1718
+ originalInputClick.call(this);
1719
+ if (this.type === "file")
1720
+ nativeFilePickerCount += 1;
1721
+ };
1722
+ try {
1723
+ inputPrototype.click = wrappedInputClick;
1724
+ cleanups.push(() => {
1725
+ if (inputPrototype.click === wrappedInputClick)
1726
+ inputPrototype.click = originalInputClick;
1727
+ });
1728
+ } catch {}
1713
1729
  }
1714
1730
  let unresponsiveClicks = [];
1715
1731
  const onClick = (event) => {
@@ -1982,6 +1998,12 @@ var createBeacon = (options) => {
1982
1998
  }
1983
1999
  return visible;
1984
2000
  };
2001
+ const isExtensionOwnedCover = (element) => {
2002
+ if (element.tagName !== "IFRAME")
2003
+ return false;
2004
+ const source = element.getAttribute("src")?.trim().toLowerCase() ?? "";
2005
+ return source.startsWith("chrome-extension:") || source.startsWith("moz-extension:") || source.startsWith("safari-web-extension:");
2006
+ };
1985
2007
  const scanForOcclusion = () => {
1986
2008
  if (typeof document.elementFromPoint !== "function")
1987
2009
  return;
@@ -2004,7 +2026,7 @@ var createBeacon = (options) => {
2004
2026
  continue;
2005
2027
  sampled += 1;
2006
2028
  const top = document.elementFromPoint((visibleRect.left + visibleRect.right) / 2, (visibleRect.top + visibleRect.bottom) / 2);
2007
- if (top === null || top === control || control.contains(top) || top.contains(control)) {
2029
+ if (top === null || top === control || control.contains(top) || top.contains(control) || isExtensionOwnedCover(top)) {
2008
2030
  continue;
2009
2031
  }
2010
2032
  const topRect = top.getBoundingClientRect();
@@ -3574,12 +3596,15 @@ var createBeacon = (options) => {
3574
3596
  registration.addEventListener("updatefound", onUpdateFound);
3575
3597
  serviceWorkerListenerCleanups.push(() => registration.removeEventListener("updatefound", onUpdateFound));
3576
3598
  };
3599
+ const isServiceWorkerRegistration = (registration) => typeof registration === "object" && registration !== null && ("installing" in registration) && typeof registration.addEventListener === "function";
3577
3600
  const originalRegister = container.register;
3578
3601
  const wrappedRegister = async function(scriptURL, registrationOptions) {
3579
3602
  const endpointLabel = shortUrl(String(scriptURL));
3580
3603
  try {
3581
3604
  const registration = await originalRegister.call(this, scriptURL, registrationOptions);
3582
- watchRegistration(registration);
3605
+ if (isServiceWorkerRegistration(registration)) {
3606
+ watchRegistration(registration);
3607
+ }
3583
3608
  return registration;
3584
3609
  } catch (error) {
3585
3610
  reportServiceWorkerFailure(endpointLabel, "registration", toError(error));
@@ -3929,5 +3954,5 @@ export {
3929
3954
  BEACON_ATTRIBUTE
3930
3955
  };
3931
3956
 
3932
- //# debugId=7A92BA6CC955EDCF64756E2164756E21
3957
+ //# debugId=04B2D89C632EBE5464756E2164756E21
3933
3958
  //# sourceMappingURL=index.js.map