@the-portland-company/shell 0.65.0 → 0.65.1

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.
@@ -1368,11 +1368,14 @@ function useLocationHref() {
1368
1368
  return href;
1369
1369
  }
1370
1370
  function specOverlayFetchJson(path) {
1371
- return fetch(`${SPECS_ORIGIN}${path}`, { credentials: "include" }).then((res) => {
1371
+ return fetch(`${SPECS_ORIGIN}${path}`, { credentials: "include", signal: AbortSignal.timeout(1e4) }).then((res) => {
1372
1372
  if (!res.ok) throw new Error(`spec overlay ${path}: ${res.status}`);
1373
1373
  return res.json();
1374
1374
  });
1375
1375
  }
1376
+ function isAutomatedCaptureSession() {
1377
+ return typeof navigator !== "undefined" && navigator.webdriver === true;
1378
+ }
1376
1379
  function currentChromeTheme() {
1377
1380
  const root = document.documentElement;
1378
1381
  if (root.classList.contains("dark") || root.getAttribute("data-theme") === "dark") return "dark";
@@ -1424,7 +1427,8 @@ async function captureMyView(status, orgId, orgName) {
1424
1427
  method: "POST",
1425
1428
  credentials: "include",
1426
1429
  headers: { "X-Spec-Capture": "1" },
1427
- body: form
1430
+ body: form,
1431
+ signal: AbortSignal.timeout(1e4)
1428
1432
  });
1429
1433
  if (!res.ok) throw new Error(`capture ${res.status}: ${(await res.text()).slice(0, 160)}`);
1430
1434
  }
@@ -1457,8 +1461,9 @@ function SpecOverlayAction({ orgId, orgName } = {}) {
1457
1461
  const [frameKey, setFrameKey] = react.useState(0);
1458
1462
  const [copied, setCopied] = react.useState("idle");
1459
1463
  const href = useLocationHref();
1464
+ const automated = isAutomatedCaptureSession();
1460
1465
  react.useEffect(() => {
1461
- if (access) return;
1466
+ if (access || automated) return;
1462
1467
  let cancelled = false;
1463
1468
  specOverlayFetchJson("/api/overlay/access").then((data) => {
1464
1469
  if (cancelled) return;
@@ -1476,7 +1481,7 @@ function SpecOverlayAction({ orgId, orgName } = {}) {
1476
1481
  };
1477
1482
  }, [access]);
1478
1483
  react.useEffect(() => {
1479
- if (!access?.allowed || typeof window === "undefined") return;
1484
+ if (automated || !access?.allowed || typeof window === "undefined") return;
1480
1485
  const timer = window.setTimeout(() => {
1481
1486
  specOverlayFetchJson(specOverlayStatusPath()).then((data) => setStatus(data)).catch(() => setStatus(null));
1482
1487
  }, 300);
@@ -1507,13 +1512,13 @@ function SpecOverlayAction({ orgId, orgName } = {}) {
1507
1512
  }
1508
1513
  };
1509
1514
  react.useEffect(() => {
1510
- if (!open || !status || !status.matched) return;
1515
+ if (automated || !open || !status || !status.matched) return;
1511
1516
  void runCapture(status);
1512
1517
  return () => {
1513
1518
  captureRun.current++;
1514
1519
  };
1515
1520
  }, [open, status && status.matched ? status.target_id : null]);
1516
- if (!access?.allowed) return null;
1521
+ if (automated || !access?.allowed) return null;
1517
1522
  const badgeLabel = status && status.matched ? `${Math.round(status.mismatch_pct)}%` : status ? "\u2014" : void 0;
1518
1523
  const badgeTone = status && status.matched ? status.passed ? "default" : "danger" : "default";
1519
1524
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [