fix(site): wire Resend waitlist via astro:env, fix TS errors + deprecations

- Move secrets to Astro's typed astro:env/server (schema in astro.config.mjs);
  removes process.env usage and the 3 TS2580 "Cannot find name 'process'" errors
  without adding @types/node.
- Replace deprecated contacts.create({ audienceId }) with segments: [{ id }]
  (env var RESEND_AUDIENCE_ID -> RESEND_SEGMENT_ID).
- Check the { error } return on both Resend calls: contact add is best-effort
  (non-fatal); a failed confirmation send now returns 502 instead of a false 200.
- Type the waitlist fetch result in WaitlistForm.astro.
- Add @astrojs/check + typescript devDeps and an `npm run check` script.

Verified: npm run check (0 errors), npm run build, secret not inlined into the
build output, and a runtime smoke test of the validation/honeypot/GET paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-06-08 14:26:54 +02:00
commit 37a1df2315
6 changed files with 1031 additions and 26 deletions

View file

@ -10,6 +10,7 @@
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"check": "astro check",
"astro": "astro"
},
"dependencies": {
@ -19,7 +20,9 @@
"resend": "^6.12.4"
},
"devDependencies": {
"@astrojs/check": "^0.9.9",
"@tailwindcss/postcss": "^4.3.0",
"tailwindcss": "^4.3.0"
"tailwindcss": "^4.3.0",
"typescript": "^6.0.3"
}
}