@atelic-action/ui 8.0.0 → 8.1.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 (56) hide show
  1. package/README.md +135 -14
  2. package/bin/atelic-check-sentry.ts +5 -0
  3. package/dist/gate/middleware.js +15 -1
  4. package/dist/monitoring/server.d.ts +72 -0
  5. package/dist/monitoring/server.js +201 -0
  6. package/dist/vite/index.d.ts +1 -1
  7. package/dist/vite/index.js +1 -1
  8. package/dist/vite/marketing-config.d.ts +28 -1
  9. package/dist/vite/marketing-config.js +62 -0
  10. package/package.json +10 -2
  11. package/src/app/layout/DesktopRail.tsx +6 -4
  12. package/src/app/layout/MobileMenu.tsx +10 -5
  13. package/src/app/layout/MobileTabBar.tsx +3 -2
  14. package/src/app/layout/PageError.tsx +2 -2
  15. package/src/app/layout/SectionCards.tsx +7 -2
  16. package/src/app/layout/UserMenu.tsx +1 -1
  17. package/src/app/ui/alert.tsx +1 -1
  18. package/src/app/ui/form.tsx +2 -2
  19. package/src/artifact/AppErrorBoundary.tsx +12 -7
  20. package/src/chrome/BrandLockup.tsx +35 -5
  21. package/src/chrome/ContactDock.tsx +45 -13
  22. package/src/chrome/Footer.tsx +97 -25
  23. package/src/chrome/NavMegaPanel.tsx +17 -6
  24. package/src/chrome/SiteHeader.tsx +35 -7
  25. package/src/chrome/SiteMenu.tsx +6 -3
  26. package/src/chrome/SiteShell.tsx +22 -2
  27. package/src/chrome/StickyCTABar.tsx +12 -8
  28. package/src/components/NotFound.tsx +3 -2
  29. package/src/gate/middleware.ts +15 -1
  30. package/src/lib/emailText.tsx +26 -0
  31. package/src/lib/phoneText.tsx +40 -0
  32. package/src/monitoring/ErrorCatcherScript.tsx +15 -0
  33. package/src/monitoring/catcher.ts +118 -0
  34. package/src/monitoring/index.ts +25 -0
  35. package/src/monitoring/sdk.ts +112 -0
  36. package/src/monitoring/server.ts +244 -0
  37. package/src/monitoring/start.ts +118 -0
  38. package/src/primitives/Button.tsx +3 -1
  39. package/src/primitives/Eyebrow.tsx +6 -2
  40. package/src/routing/index.ts +1 -0
  41. package/src/routing/miss.ts +32 -0
  42. package/src/scripts/check-sentry.ts +77 -0
  43. package/src/sections/FullBleedVideo.tsx +13 -4
  44. package/src/sections/Hero.tsx +8 -1
  45. package/src/sections/LinkColumns.tsx +30 -14
  46. package/src/sections/Locations.tsx +1 -1
  47. package/src/sections/siteConfig.ts +35 -5
  48. package/src/styles/app.css +9 -0
  49. package/src/styles/base.css +26 -0
  50. package/src/styles/chrome.css +218 -28
  51. package/src/styles/defaults.css +5 -2
  52. package/src/styles/primitives.css +11 -4
  53. package/src/styles/sections.css +26 -3
  54. package/src/types.ts +8 -1
  55. package/src/vite/index.ts +4 -0
  56. package/src/vite/marketing-config.ts +81 -1
@@ -15,7 +15,7 @@
15
15
  import { resolve } from "node:path";
16
16
  import { tanstackStart } from "@tanstack/react-start/plugin/vite";
17
17
  import react from "@vitejs/plugin-react";
18
- import { mergeConfig, type UserConfig } from "vite";
18
+ import { mergeConfig, type Plugin, type PluginOption, type UserConfig } from "vite";
19
19
  import { normalizeBasePath } from "../routing/basePath.js";
20
20
 
21
21
  /** One entry of the prerender list, as TanStack Start takes it. */
@@ -49,6 +49,76 @@ export interface MarketingConfigOptions {
49
49
  env?: Record<string, string | undefined>;
50
50
  }
51
51
 
52
+ /**
53
+ * The commit a build is filed under in Sentry: Vercel's commit, else the CI's.
54
+ * The same value names the release the Sentry plugin creates and the release
55
+ * the browser reports under, so a stack trace meets its source maps.
56
+ */
57
+ export function buildRelease(
58
+ env: Record<string, string | undefined> = process.env,
59
+ ): string | undefined {
60
+ return env.VERCEL_GIT_COMMIT_SHA || env.GITHUB_SHA || undefined;
61
+ }
62
+
63
+ /** What the Sentry plugin is given, when it runs at all. */
64
+ export interface SentryUpload {
65
+ org: string;
66
+ project: string;
67
+ authToken: string;
68
+ release: string;
69
+ }
70
+
71
+ /**
72
+ * The source map upload, on only when `SENTRY_AUTH_TOKEN`, `SENTRY_ORG`, and
73
+ * `SENTRY_PROJECT` are all set and the build knows its commit. Off, the
74
+ * build is exactly what it was: no plugin, no source maps.
75
+ */
76
+ export function sentryUpload(
77
+ env: Record<string, string | undefined> = process.env,
78
+ ): SentryUpload | undefined {
79
+ const { SENTRY_AUTH_TOKEN: authToken, SENTRY_ORG: org, SENTRY_PROJECT: project } = env;
80
+ const release = buildRelease(env);
81
+ if (!authToken || !org || !project || !release) return undefined;
82
+ return { org, project, authToken, release };
83
+ }
84
+
85
+ /**
86
+ * The Sentry Vite plugin, loaded only when it runs: it creates the release
87
+ * named by the commit, uploads the build's hidden source maps, and deletes
88
+ * every map file from the output afterwards, so none is ever served.
89
+ */
90
+ function sentryPlugin(upload: SentryUpload): PluginOption {
91
+ return import("@sentry/vite-plugin").then(
92
+ ({ sentryVitePlugin }) =>
93
+ sentryVitePlugin({
94
+ org: upload.org,
95
+ project: upload.project,
96
+ authToken: upload.authToken,
97
+ release: { name: upload.release, inject: false },
98
+ sourcemaps: { filesToDeleteAfterUpload: ["./dist/**/*.map"] },
99
+ telemetry: false,
100
+ }) as PluginOption,
101
+ );
102
+ }
103
+
104
+ /**
105
+ * The environment the browser files its errors under, as
106
+ * `import.meta.env.VITE_ENVIRONMENT`: Vercel's (production, preview,
107
+ * development) when the build runs there, else the build's mode. A Vite
108
+ * production build's mode is production on every deploy, a preview's
109
+ * included, so the mode alone filed every error as production.
110
+ */
111
+ export function environmentPlugin(env: Record<string, string | undefined> = process.env): Plugin {
112
+ return {
113
+ name: "atelic-build-environment",
114
+ config: (_config, { mode }) => ({
115
+ define: {
116
+ "import.meta.env.VITE_ENVIRONMENT": JSON.stringify(env.VERCEL_ENV || mode),
117
+ },
118
+ }),
119
+ };
120
+ }
121
+
52
122
  /** The 404 page, prerendered and copied to 404.html by the build, never in the sitemap. */
53
123
  export const NOT_FOUND_PAGE: MarketingPage = {
54
124
  path: "/404",
@@ -84,6 +154,8 @@ export function marketingConfig({
84
154
  env = process.env,
85
155
  }: MarketingConfigOptions): UserConfig {
86
156
  const basePath = marketingBasePath(site, env);
157
+ const release = buildRelease(env);
158
+ const upload = sentryUpload(env);
87
159
  const listed = pages.filter((page) => page.path !== NOT_FOUND_PAGE.path);
88
160
  const config: UserConfig = {
89
161
  // The base becomes Vite's `base`, so every built asset URL and every
@@ -110,7 +182,15 @@ export function marketingConfig({
110
182
  },
111
183
  }),
112
184
  react(),
185
+ environmentPlugin(env),
186
+ ...(upload ? [sentryPlugin(upload)] : []),
113
187
  ],
188
+ // The commit, for the browser to report under (`startErrorReporting`'s
189
+ // `release`), read as `import.meta.env.VITE_RELEASE`.
190
+ ...(release ? { define: { "import.meta.env.VITE_RELEASE": JSON.stringify(release) } } : {}),
191
+ // Maps only for Sentry, and hidden: the bundles carry no comment
192
+ // pointing at one, and the plugin deletes them once uploaded.
193
+ ...(upload ? { build: { sourcemap: "hidden" as const } } : {}),
114
194
  resolve: {
115
195
  alias: {
116
196
  // The site's src, from the directory Vite is run in: this file