@atelic-action/ui 8.1.0 → 8.3.0

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.
Files changed (45) hide show
  1. package/README.md +117 -34
  2. package/dist/monitoring/server.d.ts +58 -1
  3. package/dist/monitoring/server.js +129 -1
  4. package/package.json +1 -1
  5. package/src/chrome/BrandLockup.tsx +12 -3
  6. package/src/chrome/ContactDock.tsx +16 -2
  7. package/src/chrome/Footer.tsx +50 -12
  8. package/src/chrome/NavMegaPanel.tsx +6 -12
  9. package/src/chrome/SiteHeader.tsx +39 -17
  10. package/src/chrome/SiteMenu.tsx +211 -76
  11. package/src/chrome/SiteShell.tsx +9 -2
  12. package/src/chrome/StickyCTABar.tsx +48 -20
  13. package/src/chrome/index.ts +3 -0
  14. package/src/components/DataTable.tsx +1 -1
  15. package/src/components/ReportCard.tsx +3 -3
  16. package/src/lib/hours.ts +9 -2
  17. package/src/lib/phoneText.tsx +9 -0
  18. package/src/monitoring/ErrorCatcherScript.tsx +17 -6
  19. package/src/monitoring/index.ts +1 -1
  20. package/src/monitoring/server.ts +158 -1
  21. package/src/primitives/Button.tsx +2 -2
  22. package/src/routing/index.ts +10 -32
  23. package/src/routing/miss.ts +14 -3
  24. package/src/routing/routerErrors.tsx +57 -0
  25. package/src/routing/staticNotFound.tsx +77 -0
  26. package/src/scripts/check-sentry.ts +22 -1
  27. package/src/sections/CalloutPanel.tsx +4 -1
  28. package/src/sections/ContactInfoCard.tsx +9 -2
  29. package/src/sections/FeatureGrid.tsx +31 -7
  30. package/src/sections/Hero.tsx +2 -2
  31. package/src/sections/HoursTable.tsx +5 -3
  32. package/src/sections/LocationSection.tsx +2 -2
  33. package/src/sections/LogoMarquee.tsx +1 -1
  34. package/src/sections/PricingBand.tsx +1 -1
  35. package/src/sections/ProcessSteps.tsx +1 -1
  36. package/src/sections/ReviewWall.tsx +2 -2
  37. package/src/sections/index.ts +1 -0
  38. package/src/sections/siteConfig.ts +57 -0
  39. package/src/styles/base.css +34 -17
  40. package/src/styles/chrome.css +358 -42
  41. package/src/styles/components.css +0 -22
  42. package/src/styles/defaults.css +90 -3
  43. package/src/styles/primitives.css +9 -3
  44. package/src/styles/sections.css +46 -26
  45. package/src/types.ts +38 -1
@@ -1,13 +1,24 @@
1
1
  import { errorCatcherScript } from "./catcher";
2
2
 
3
+ export interface ErrorCatcherScriptProps {
4
+ /**
5
+ * Whether the catcher renders at all. Defaults to true. A root route
6
+ * passes whether the build has a DSN (`enabled={Boolean(env.VITE_SENTRY_DSN)}`),
7
+ * so a site built without one ships no catcher holding errors nobody reads.
8
+ */
9
+ enabled?: boolean;
10
+ }
11
+
3
12
  /**
4
- * The inline early catcher as an element, for the first place in a root
5
- * route's `<head>`, ahead of `<HeadContent />`: it runs before any other
6
- * script, so an error thrown before the app's own JavaScript is held until
7
- * `startErrorReporting` hands it to Sentry. It is a few hundred bytes, well
8
- * inside the first kilobyte a browser scans for the charset.
13
+ * The inline early catcher as an element, for a root route's `<head>` ahead
14
+ * of `<HeadContent />` and every other script: it is the page's first script
15
+ * and runs before any other, so an error thrown before the app's own
16
+ * JavaScript is held until `startErrorReporting` hands it to Sentry. React 19
17
+ * hoists the title, the meta tags, the preloads, and the stylesheets ahead of
18
+ * it, which changes nothing it does. With `enabled` false it renders nothing.
9
19
  */
10
- export function ErrorCatcherScript() {
20
+ export function ErrorCatcherScript({ enabled = true }: ErrorCatcherScriptProps = {}) {
21
+ if (!enabled) return null;
11
22
  return (
12
23
  // biome-ignore lint/security/noDangerouslySetInnerHtml: the package's own constant script, no outside input
13
24
  <script dangerouslySetInnerHTML={{ __html: errorCatcherScript }} />
@@ -15,7 +15,7 @@ export {
15
15
  readCatcher,
16
16
  reportError,
17
17
  } from "./catcher";
18
- export { ErrorCatcherScript } from "./ErrorCatcherScript";
18
+ export { ErrorCatcherScript, type ErrorCatcherScriptProps } from "./ErrorCatcherScript";
19
19
  export {
20
20
  afterFirstPaint,
21
21
  type ErrorReportingOptions,
@@ -5,7 +5,7 @@
5
5
  * shipped, so this file imports nothing and touches only what a function and
6
6
  * the middleware runtime both have (fetch, `AbortController`, `crypto`).
7
7
  *
8
- * import { reportServerError, withErrorReporting } from "@atelic-action/ui/monitoring/server";
8
+ * import { reportServerError, reportServerErrorLater, withErrorReporting } from "@atelic-action/ui/monitoring/server";
9
9
  *
10
10
  * Privacy: a report carries the request's method and path, and its user
11
11
  * agent, never its body, its query string, or any other header. A contact
@@ -224,6 +224,163 @@ export async function reportServerError(
224
224
  }
225
225
  }
226
226
 
227
+ /**
228
+ * What a handler's context offers to keep work running after the answer has
229
+ * gone: the second argument of an edge middleware or a Vercel function
230
+ * (`context.waitUntil`), or any object holding a `waitUntil` like it.
231
+ */
232
+ export interface WaitUntilContext {
233
+ waitUntil(promise: Promise<unknown>): void;
234
+ }
235
+
236
+ /**
237
+ * The platform's own `waitUntil`, read the way `@vercel/functions` reads it,
238
+ * from the request context Vercel keeps on a global symbol, so this file
239
+ * needs no dependency for it. Undefined anywhere else.
240
+ */
241
+ function platformWaitUntil(): ((promise: Promise<unknown>) => void) | undefined {
242
+ try {
243
+ const store = (globalThis as Record<symbol, unknown>)[Symbol.for("@vercel/request-context")] as
244
+ | { get?: () => { waitUntil?: (promise: Promise<unknown>) => void } | undefined }
245
+ | undefined;
246
+ const context = store?.get?.();
247
+ const waitUntil = context?.waitUntil;
248
+ return typeof waitUntil === "function" ? waitUntil.bind(context) : undefined;
249
+ } catch {
250
+ return undefined;
251
+ }
252
+ }
253
+
254
+ /**
255
+ * Reports an error without making the caller wait for it. The send starts
256
+ * at once and is handed to the platform's `waitUntil` (the `context` given,
257
+ * else Vercel's request context), which keeps the function alive until it
258
+ * finishes after the answer has gone. With neither, the send still runs,
259
+ * never blocking the answer, and may be cut short if the runtime freezes
260
+ * once the answer is out. Never throws, and returns nothing to wait on.
261
+ *
262
+ * Use `reportServerError`, awaited, where the report must land before the
263
+ * handler goes on (before a throw, in a handler that already waits); use
264
+ * this one where the answer should leave at once (a refusal the person is
265
+ * waiting to read).
266
+ */
267
+ export function reportServerErrorLater(
268
+ error: unknown,
269
+ options: ServerReportOptions & { context?: WaitUntilContext } = {},
270
+ ): void {
271
+ const { context, ...report } = options;
272
+ const sending = reportServerError(error, report);
273
+ // The context's own waitUntil first, then the platform's; a context with
274
+ // none that can be called, or one that throws, falls through to the
275
+ // next, and with neither the send runs on its own, never blocking.
276
+ const own = (context as { waitUntil?: unknown } | undefined)?.waitUntil;
277
+ const fromContext =
278
+ typeof own === "function"
279
+ ? (promise: Promise<unknown>) => own.call(context, promise)
280
+ : undefined;
281
+ for (const find of [() => fromContext, platformWaitUntil]) {
282
+ try {
283
+ const hold = find();
284
+ if (!hold) continue;
285
+ hold(sending);
286
+ return;
287
+ } catch {
288
+ // This one could not hold the send; the next is tried.
289
+ }
290
+ }
291
+ }
292
+
293
+ /**
294
+ * Anything shaped like an email address, which a refusal may quote (the
295
+ * recipient, the sender). The domain is labels of letters in any script,
296
+ * digits, hyphens, and underscores joined by dots, so an internationalized
297
+ * domain is caught and a sentence's closing period stays outside it.
298
+ */
299
+ const ADDRESS = /[^\s@<>()[\]"',;:]+@[\p{L}\p{N}_-]+(?:\.[\p{L}\p{N}_-]+)+/gu;
300
+
301
+ /** A separator inside a phone number: a space, a dot, a slash, or any hyphen or dash. */
302
+ const SEP = "[\\s./\\u2010-\\u2015\\u2212-]";
303
+
304
+ /**
305
+ * A run shaped like a phone number: an optional country code, then an area
306
+ * code in parentheses and the number after it, or at least three groups of
307
+ * digits joined by separators, the last of three or four digits, or a plus
308
+ * sign and seven to fifteen digits run together (E.164). A date
309
+ * (2026-11-23), a bare id (12345678), and a count beside a year (120 2026)
310
+ * are none of these, and stay.
311
+ */
312
+ const PHONE = new RegExp(
313
+ `(?<![\\w+-])\\+\\d{7,15}(?![\\w-])|(?<![\\w+-])(?:\\+\\d{1,3}${SEP}?)?(?:\\(\\d{2,4}\\)${SEP}?\\d{2,4}(?:${SEP}\\d{3,4})?|\\d{2,4}(?:${SEP}\\d{2,4}){1,2}${SEP}\\d{3,4})(?![\\w-])`,
314
+ "gu",
315
+ );
316
+
317
+ /** A refusal's field with every address and phone number in it replaced. */
318
+ function scrub(text: string): string {
319
+ return text.replace(ADDRESS, "[address]").replace(PHONE, "[number]");
320
+ }
321
+
322
+ /** The longest a refusal's field is kept, so a report never carries a page of text. */
323
+ const REFUSAL_FIELD_MAX = 300;
324
+
325
+ /**
326
+ * A refused upstream answer as an error a report may carry: the service's
327
+ * name, the status, and the error body's `name` and `message` fields alone,
328
+ * each with anything shaped like an email address replaced by `[address]`
329
+ * and anything shaped like a phone number (grouped as one is written) by
330
+ * `[number]`, then cut to 300
331
+ * characters. Nothing else of the body is read, and a body that is not JSON
332
+ * leaves the status alone. Never throws.
333
+ *
334
+ * The scrub takes out the shapes it knows and nothing more: the fields are
335
+ * still the upstream's free text, and a name, a street, or a message quoted
336
+ * in it in words passes through. Report a refusal from a service whose
337
+ * errors are about the request, never one that echoes what a person wrote.
338
+ *
339
+ * await refusalError(response, "Resend") // Error("Resend answered 422: validation_error: ...")
340
+ */
341
+ export async function refusalError(
342
+ response: Response,
343
+ service = "The upstream service",
344
+ ): Promise<Error> {
345
+ let body: { name?: unknown; message?: unknown } = {};
346
+ try {
347
+ const parsed: unknown = await response.json();
348
+ if (parsed && typeof parsed === "object") body = parsed as typeof body;
349
+ } catch {
350
+ // Not JSON, or already read: the status says what there is to say.
351
+ }
352
+ const parts = [body.name, body.message]
353
+ .filter((part): part is string => typeof part === "string" && part.trim() !== "")
354
+ .map((part) => scrub(part).slice(0, REFUSAL_FIELD_MAX));
355
+ return new Error(
356
+ `${service} answered ${response.status}${parts.length ? `: ${parts.join(": ")}` : ""}`,
357
+ );
358
+ }
359
+
360
+ /**
361
+ * Reports a refused upstream answer (a send the mail service would not
362
+ * take) without holding the caller's own answer: the error is built by
363
+ * `refusalError`, so no address in the refusal survives, and sent by
364
+ * `reportServerErrorLater`. Resolves once the refusal's body is read, never
365
+ * waiting on the send, and never throws.
366
+ *
367
+ * if (!response.ok) {
368
+ * await reportRefusedResponse(response, { service: "Resend", request, tags: { route: "contact" } });
369
+ * return json(502, { ok: false, error: "Sending failed. Please try again in a moment." });
370
+ * }
371
+ */
372
+ export async function reportRefusedResponse(
373
+ response: Response,
374
+ options: ServerReportOptions & { service?: string; context?: WaitUntilContext } = {},
375
+ ): Promise<void> {
376
+ const { service, ...report } = options;
377
+ try {
378
+ reportServerErrorLater(await refusalError(response, service), report);
379
+ } catch {
380
+ // A report never becomes a second failure.
381
+ }
382
+ }
383
+
227
384
  /**
228
385
  * Wraps a function's handler so a throw is reported, then thrown again: the
229
386
  * platform still answers the request as it would have, and Sentry hears of
@@ -1,6 +1,6 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
2
  import { newTabProps } from "../lib/newTabProps";
3
- import { holdPhoneNumbers, isTel } from "../lib/phoneText";
3
+ import { telText } from "../lib/phoneText";
4
4
  import { useWithBase } from "../routing/BasePathProvider";
5
5
 
6
6
  export interface ButtonProps {
@@ -56,7 +56,7 @@ export function Button({
56
56
  // A call button with words beside its number holds the number whole.
57
57
  const content = (
58
58
  <>
59
- {isTel(href) ? holdPhoneNumbers(children) : children}
59
+ {telText(href, children)}
60
60
  {arrow && (
61
61
  <span className="arrow" aria-hidden="true">
62
62
  →
@@ -1,35 +1,3 @@
1
- /**
2
- * The router options that keep a not found page alive on a statically
3
- * prerendered TanStack Start site. Spread them into createRouter:
4
- *
5
- * createRouter({ routeTree, ...staticNotFoundRouting(NotFoundPage) })
6
- *
7
- * The static host serves the /404 prerender for every unknown path, and it
8
- * takes a catch all route (src/routes/$.tsx rendering the same page) plus
9
- * these two options to survive hydration:
10
- *
11
- * - The splat gives the client a match below the root. With a dedicated
12
- * /404 route instead, an unknown path matches only the root, hydrate takes
13
- * its SPA branch, throws, and the page goes blank.
14
- * - The splat's match id still carries the path, so it differs from the
15
- * dehydrated /404 match and hydrate renders the pending state first.
16
- * Pending as the page itself keeps that first render identical to the
17
- * server HTML; the default null is a hydration mismatch.
18
- *
19
- * Static sites only. On a live app the pending state is a real loading
20
- * moment, and this would flash the not found page through every slow load;
21
- * an app sets defaultNotFoundComponent alone.
22
- *
23
- * Generic over the page so the router checks it against its own component
24
- * type; the package stays free of any router import.
25
- */
26
- export function staticNotFoundRouting<Page>(page: Page) {
27
- return {
28
- defaultNotFoundComponent: page,
29
- defaultPendingComponent: page,
30
- };
31
- }
32
-
33
1
  export {
34
2
  BasePathProvider,
35
3
  type BasePathProviderProps,
@@ -38,3 +6,13 @@ export {
38
6
  } from "./BasePathProvider";
39
7
  export { hasBase, joinBase, normalizeBasePath, stripBase } from "./basePath";
40
8
  export { CATCH_ALL_ROUTE_ID, isMiss, type MissMatch } from "./miss";
9
+ export {
10
+ RouteErrorFallback,
11
+ type RouteErrorProps,
12
+ reportRouteError,
13
+ routerErrorOptions,
14
+ } from "./routerErrors";
15
+ export {
16
+ type StaticNotFoundOptions,
17
+ staticNotFoundRouting,
18
+ } from "./staticNotFound";
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Whether the router's matches are a miss: the catch all route took the
3
- * path (an unknown page), or a route with params says its params name a page
4
- * it does not have (a blog slug nobody wrote) through `staticData.missing`.
3
+ * path (an unknown page), a route with params says its params name a page
4
+ * it does not have (a blog slug nobody wrote) through `staticData.missing`,
5
+ * or the router already reports a match not found (a loader's `notFound()`,
6
+ * 8.3.0). The one predicate the root's 404 head and the not found pending
7
+ * view both ask, so the two never disagree.
5
8
  * Router free: it reads the plain fields every TanStack match carries, so a
6
9
  * site's root route asks it from `head` and from `useMatches`.
7
10
  *
@@ -17,6 +20,10 @@ export interface MissMatch {
17
20
  routeId: string;
18
21
  params: Record<string, string>;
19
22
  staticData?: { missing?: (params: Record<string, string>) => boolean };
23
+ /** The match's state; `notFound` once a route's loader has thrown `notFound()`. */
24
+ status?: string;
25
+ /** Set on the match that renders a not found nothing below it handled. */
26
+ globalNotFound?: boolean;
20
27
  }
21
28
 
22
29
  /** The catch all route's id in a TanStack file route tree. */
@@ -27,6 +34,10 @@ export function isMiss(
27
34
  catchAllId: string = CATCH_ALL_ROUTE_ID,
28
35
  ): boolean {
29
36
  return matches.some(
30
- (match) => match.routeId === catchAllId || match.staticData?.missing?.(match.params) === true,
37
+ (match) =>
38
+ match.routeId === catchAllId ||
39
+ match.staticData?.missing?.(match.params) === true ||
40
+ match.status === "notFound" ||
41
+ match.globalNotFound === true,
31
42
  );
32
43
  }
@@ -0,0 +1,57 @@
1
+ import { ErrorFallback } from "../artifact/ErrorFallback";
2
+ import { reportError } from "../monitoring/catcher";
3
+
4
+ /** What a router hands its error component: the error and a way to try again. */
5
+ export interface RouteErrorProps {
6
+ error: unknown;
7
+ reset: () => void;
8
+ /** Reloads the page; defaults to the window's own. For a test. */
9
+ reload?: () => void;
10
+ }
11
+
12
+ /**
13
+ * The package's `ErrorFallback` as a router's error component: the same
14
+ * dependency free page `AppErrorBoundary` draws. Try Again reloads the page.
15
+ * A loader or beforeLoad error stays on the router's match, so the boundary's
16
+ * own reset throws it again (and reports it a second time), and recovering in
17
+ * place takes the router's invalidate, which this entry cannot import. The
18
+ * `reload` prop is there for a test; a router never passes it.
19
+ */
20
+ export function RouteErrorFallback({ error, reload }: RouteErrorProps) {
21
+ const retry = reload ?? (() => window.location.reload());
22
+ return <ErrorFallback error={error} resetError={retry} />;
23
+ }
24
+
25
+ /**
26
+ * Hands a crash a router's own boundary caught to error reporting, exactly
27
+ * as `AppErrorBoundary` does (`reportError(error, "boundary")`).
28
+ */
29
+ export function reportRouteError(error: unknown): void {
30
+ reportError(error, "boundary");
31
+ }
32
+
33
+ /**
34
+ * The router options that make a route's render crash reach error reporting
35
+ * whichever boundary catches it. TanStack Router (1.170) gives a route its
36
+ * own catch boundary only when an `errorComponent` applies to it; with none,
37
+ * a crash rises to the site's `AppErrorBoundary`, which reports it. A route
38
+ * or a site that sets its own `errorComponent` with no `onCatch` puts a
39
+ * boundary in the way that catches the crash and reports it to nobody, since
40
+ * React keeps a caught crash from the window's handlers. With these spread
41
+ * into `createRouter`, every route has the boundary, `defaultOnCatch` reports
42
+ * what it catches once, and `defaultErrorComponent` draws the package's error
43
+ * page in its place, so the report no longer depends on which boundary is
44
+ * nearest:
45
+ *
46
+ * createRouter({ routeTree, ...routerErrorOptions() })
47
+ *
48
+ * A route's own `onCatch` or `errorComponent` wins over these; a not found
49
+ * is never caught here, since the router rethrows it to its not found
50
+ * handling first. Like the rest of this entry, it imports no router.
51
+ */
52
+ export function routerErrorOptions() {
53
+ return {
54
+ defaultOnCatch: reportRouteError,
55
+ defaultErrorComponent: RouteErrorFallback,
56
+ };
57
+ }
@@ -0,0 +1,77 @@
1
+ import { type ComponentType, createElement, type ReactElement } from "react";
2
+ import { CATCH_ALL_ROUTE_ID, isMiss, type MissMatch } from "./miss";
3
+
4
+ /** What the pending view needs from the site's router, handed in so this entry imports none. */
5
+ export interface StaticNotFoundOptions {
6
+ /**
7
+ * The router's own `useMatches` (`import { useMatches } from
8
+ * "@tanstack/react-router"`). With it, the pending view draws the not
9
+ * found page on a miss alone and nothing on any other route's pending
10
+ * state, so a slow client navigation never flashes a bare 404 body. A
11
+ * miss is the catch all route's match, a route whose
12
+ * `staticData.missing(params)` says its params name no page, or a match
13
+ * the router already reports as not found.
14
+ */
15
+ useMatches: (options: { select: (matches: ReadonlyArray<MissMatch>) => boolean }) => boolean;
16
+ /** The catch all route's id, when it is not `/$`. */
17
+ catchAllId?: string;
18
+ }
19
+
20
+ /**
21
+ * The router options that keep a not found page alive on a statically
22
+ * prerendered TanStack Start site. Spread them into createRouter:
23
+ *
24
+ * createRouter({ routeTree, ...staticNotFoundRouting(NotFoundPage, { useMatches }) })
25
+ *
26
+ * The static host serves the /404 prerender for every unknown path, and it
27
+ * takes a catch all route (src/routes/$.tsx rendering the same page) plus
28
+ * these two options to survive hydration:
29
+ *
30
+ * - The splat gives the client a match below the root. With a dedicated
31
+ * /404 route instead, an unknown path matches only the root, hydrate takes
32
+ * its SPA branch, throws, and the page goes blank.
33
+ * - The splat's match id still carries the path, so it differs from the
34
+ * dehydrated /404 match and hydrate renders the pending state first.
35
+ * Pending as the page itself keeps that first render identical to the
36
+ * server HTML; a pending view of plain null is a hydration mismatch (React
37
+ * error 418) and a blank body on every miss.
38
+ *
39
+ * Given the router's `useMatches` (8.2.0), the pending view draws the page
40
+ * on a miss (`isMiss`) and nothing otherwise, so another route's pending
41
+ * state on a slow client navigation shows no bare 404 body. Without it the
42
+ * pending view is the page itself, as before.
43
+ *
44
+ * What a route must set: a route with params that can claim a path with no
45
+ * page behind it (a blog slug nobody wrote) sets `staticData.missing(params)`.
46
+ * The static host serves such a path the 404 prerender, and it hydrates
47
+ * through the pending state before the route's loader has run, so its
48
+ * `notFound()` arrives too late for that first render: without `missing`,
49
+ * the pending view draws nothing where the server drew the page, and the
50
+ * page hydrates blank. A loader's `notFound()` is still honored once the
51
+ * router reports it (a client navigation to the slug).
52
+ *
53
+ * Static sites only. On a live app the pending state is a real loading
54
+ * moment; an app sets defaultNotFoundComponent alone.
55
+ *
56
+ * Generic over the page so the router checks it against its own component
57
+ * type; the package stays free of any router import.
58
+ */
59
+ export function staticNotFoundRouting<Page>(page: Page): {
60
+ defaultNotFoundComponent: Page;
61
+ defaultPendingComponent: Page;
62
+ };
63
+ export function staticNotFoundRouting<Page extends ComponentType>(
64
+ page: Page,
65
+ options: StaticNotFoundOptions,
66
+ ): { defaultNotFoundComponent: Page; defaultPendingComponent: () => ReactElement | null };
67
+ export function staticNotFoundRouting<Page>(page: Page, options?: StaticNotFoundOptions) {
68
+ if (!options) return { defaultNotFoundComponent: page, defaultPendingComponent: page };
69
+ const { useMatches, catchAllId = CATCH_ALL_ROUTE_ID } = options;
70
+ // The one miss predicate the root's 404 head asks too, so the two agree.
71
+ const select = (matches: ReadonlyArray<MissMatch>) => isMiss(matches, catchAllId);
72
+ function NotFoundPending(): ReactElement | null {
73
+ const miss = useMatches({ select });
74
+ return miss ? createElement(page as ComponentType) : null;
75
+ }
76
+ return { defaultNotFoundComponent: page, defaultPendingComponent: NotFoundPending };
77
+ }
@@ -33,7 +33,28 @@ export interface SentryCheckResult {
33
33
  /** The check, kept pure so it can be tested without a build. */
34
34
  export function checkSentry({ env, args }: SentryCheckInput): SentryCheckResult {
35
35
  const production = env.VERCEL_ENV === "production";
36
- const dsn = (env.VITE_SENTRY_DSN ?? "").trim();
36
+ const raw = env.VITE_SENTRY_DSN ?? "";
37
+ const dsn = raw.trim();
38
+ // A value of whitespace alone is set as far as the site's own checks go
39
+ // (`Boolean(dsn)` mounts the catcher and starts reporting) and sends
40
+ // nothing: it is malformed, on any environment, waiver or not.
41
+ if (raw !== "" && dsn === "") {
42
+ return {
43
+ code: 1,
44
+ message:
45
+ "[sentry] VITE_SENTRY_DSN is set to whitespace alone, which the site treats as set and which is not a DSN. Set it to the DSN, or remove it.",
46
+ };
47
+ }
48
+ // The build ships the value as it is set, untrimmed, so a DSN with a
49
+ // space or a line break around it is checked as shipped, not as it reads
50
+ // once trimmed: it fails here, on any environment, waiver or not.
51
+ if (dsn && raw !== dsn) {
52
+ return {
53
+ code: 1,
54
+ message:
55
+ "[sentry] VITE_SENTRY_DSN has a space or a line break around it, which the build would ship as it is. Set it again with nothing around the DSN.",
56
+ };
57
+ }
37
58
  // A DSN that is set but cannot be read sends nothing, whatever the build:
38
59
  // it fails here, on any environment, waiver or not.
39
60
  if (dsn && !parseDSN(dsn)) {
@@ -21,7 +21,10 @@ export interface CalloutPanelProps {
21
21
  */
22
22
  export function CalloutPanel({ items, className }: CalloutPanelProps) {
23
23
  return (
24
- <ul className={["callout-panel", "on-primary", className].filter(Boolean).join(" ")}>
24
+ <ul
25
+ className={["callout-panel", "on-primary", className].filter(Boolean).join(" ")}
26
+ data-ground="primary"
27
+ >
25
28
  {items.map((item, i) => (
26
29
  // biome-ignore lint/suspicious/noArrayIndexKey: callouts are static content in a fixed order
27
30
  <li key={i}>
@@ -28,6 +28,12 @@ export interface ContactInfoCardProps {
28
28
  * broken card, and inventing one is worse.
29
29
  */
30
30
  showAddress?: boolean;
31
+ /**
32
+ * The words beside the single `site.phone` row. Defaults to "Call", which
33
+ * asserts nothing a business may not do; a line that answers texts says
34
+ * so here ("Call or text").
35
+ */
36
+ phoneLabel?: string;
31
37
  }
32
38
 
33
39
  /** Dark card with direct contact rows: call, email, visit, portal. */
@@ -36,11 +42,12 @@ export function ContactInfoCard({
36
42
  title = "Reach us directly",
37
43
  phones,
38
44
  showAddress = true,
45
+ phoneLabel = "Call",
39
46
  }: ContactInfoCardProps) {
40
47
  const withBase = useWithBase();
41
48
  const portal = site.footerLinks?.find((link) => link.label.toLowerCase().includes("portal"));
42
49
  return (
43
- <div className="contact-info-card">
50
+ <div className="contact-info-card" data-ground="dark">
44
51
  <h3>{title}</h3>
45
52
  <div className="ci-rows">
46
53
  {phones?.length
@@ -54,7 +61,7 @@ export function ContactInfoCard({
54
61
  ))
55
62
  : site.phone && (
56
63
  <div className="ci-row">
57
- <span className="k">Call / Text</span>
64
+ <span className="k">{phoneLabel}</span>
58
65
  <span className="v">
59
66
  <a href={`tel:${site.phone.e164}`}>{site.phone.display}</a>
60
67
  </span>
@@ -1,4 +1,5 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
+ import { newTabProps } from "../lib/newTabProps";
2
3
  import { SectionHeading } from "../primitives";
3
4
  import { useWithBase } from "../routing/BasePathProvider";
4
5
  import type { Surface } from "./siteConfig";
@@ -22,8 +23,19 @@ interface FeatureCardBase {
22
23
  * rather than a constraint.
23
24
  */
24
25
  export type FeatureCard =
25
- | (FeatureCardBase & { description: ReactNode; href?: never; linkLabel?: never })
26
- | (FeatureCardBase & { description: string; href: string; linkLabel?: string });
26
+ | (FeatureCardBase & {
27
+ description: ReactNode;
28
+ href?: never;
29
+ linkLabel?: never;
30
+ external?: never;
31
+ })
32
+ | (FeatureCardBase & {
33
+ description: string;
34
+ href: string;
35
+ linkLabel?: string;
36
+ /** Opens in a new tab, except on mailto, tel, and sms links, and says so to a screen reader. */
37
+ external?: boolean;
38
+ });
27
39
 
28
40
  export interface FeatureGridProps {
29
41
  eyebrow?: string;
@@ -37,6 +49,11 @@ export interface FeatureGridProps {
37
49
  columns?: 2 | 3 | 4;
38
50
  surface?: Surface;
39
51
  id?: string;
52
+ /**
53
+ * The words a screen reader hears after a card that opens in a new tab.
54
+ * Defaults to "opens in a new tab".
55
+ */
56
+ newTabLabel?: string;
40
57
  }
41
58
 
42
59
  /** Numbered feature/service card grid with hover lift. */
@@ -48,6 +65,7 @@ export function FeatureGrid({
48
65
  columns = 4,
49
66
  surface = "alt",
50
67
  id,
68
+ newTabLabel = "opens in a new tab",
51
69
  }: FeatureGridProps) {
52
70
  const withBase = useWithBase();
53
71
  const sectionClasses = ["section", surface === "alt" && "surface-alt"].filter(Boolean).join(" ");
@@ -70,11 +88,17 @@ export function FeatureGrid({
70
88
  )}
71
89
  </>
72
90
  );
73
- return item.href ? (
74
- <a key={item.title} className="feature-card" href={withBase(item.href)}>
75
- {inner}
76
- </a>
77
- ) : (
91
+ if (item.href) {
92
+ const tab = newTabProps(item.href, item.external);
93
+ return (
94
+ <a key={item.title} className="feature-card" href={withBase(item.href)} {...tab}>
95
+ {inner}
96
+ {/* Said to a screen reader only, as the card's last words. */}
97
+ {tab.target && <span className="visually-hidden">, {newTabLabel}</span>}
98
+ </a>
99
+ );
100
+ }
101
+ return (
78
102
  <div key={item.title} className="feature-card">
79
103
  {inner}
80
104
  </div>
@@ -115,7 +115,7 @@ export function Hero({
115
115
 
116
116
  if (layout === "split") {
117
117
  return (
118
- <section className="hero is-split">
118
+ <section className="hero is-split" data-ground="dark">
119
119
  <div className="hero-split-copy on-primary">
120
120
  <div className="hero-split-inner">{copy}</div>
121
121
  </div>
@@ -125,7 +125,7 @@ export function Hero({
125
125
  }
126
126
 
127
127
  return (
128
- <section className="hero">
128
+ <section className="hero" data-ground="dark">
129
129
  <div className="hero-media">
130
130
  {media}
131
131
  <div className="hero-scrim" />
@@ -1,14 +1,16 @@
1
1
  import { formatHoursRange, isClosed } from "../lib/hours";
2
- import type { Clock, OpeningHours } from "./siteConfig";
2
+ import type { Clock, Meridiem, OpeningHours } from "./siteConfig";
3
3
 
4
4
  export interface HoursTableProps {
5
5
  hours: OpeningHours[];
6
6
  /** "12h" (the default) or "24h"; pass the site's `SiteConfig.clock`. */
7
7
  clock?: Clock;
8
+ /** "letter" (the default) or "word"; pass the site's `SiteConfig.meridiem`. */
9
+ meridiem?: Meridiem;
8
10
  }
9
11
 
10
12
  /** Day-by-day hours rows with dashed rules and mono times. */
11
- export function HoursTable({ hours, clock }: HoursTableProps) {
13
+ export function HoursTable({ hours, clock, meridiem }: HoursTableProps) {
12
14
  return (
13
15
  <div>
14
16
  {hours.map((row) => (
@@ -17,7 +19,7 @@ export function HoursTable({ hours, clock }: HoursTableProps) {
17
19
  className={["hours-row", isClosed(row) && "closed"].filter(Boolean).join(" ")}
18
20
  >
19
21
  <span className="day">{row.label}</span>
20
- <span className="time">{formatHoursRange(row, { clock })}</span>
22
+ <span className="time">{formatHoursRange(row, { clock, meridiem })}</span>
21
23
  </div>
22
24
  ))}
23
25
  </div>
@@ -7,7 +7,7 @@ import type { SiteConfig, Surface } from "./siteConfig";
7
7
 
8
8
  /** The keys of the site config the section reads; a whole `SiteConfig` passes as it is. */
9
9
  export type LocationSectionSite = MapEmbedSite &
10
- Pick<SiteConfig, "serviceAreas" | "hours" | "clock" | "phone">;
10
+ Pick<SiteConfig, "serviceAreas" | "hours" | "clock" | "meridiem" | "phone">;
11
11
 
12
12
  export interface LocationSectionProps {
13
13
  site: LocationSectionSite;
@@ -64,7 +64,7 @@ export function LocationSection({
64
64
  <div className="loc-heading" role="heading" aria-level={headingLevel + 1}>
65
65
  Hours
66
66
  </div>
67
- <HoursTable hours={site.hours} clock={site.clock} />
67
+ <HoursTable hours={site.hours} clock={site.clock} meridiem={site.meridiem} />
68
68
  </div>
69
69
 
70
70
  <div className="loc-actions">