Code-resolved env config, PostHog error tracking, email + auth UX fixes#645
Open
spashii wants to merge 5 commits into
Open
Code-resolved env config, PostHog error tracking, email + auth UX fixes#645spashii wants to merge 5 commits into
spashii wants to merge 5 commits into
Conversation
…h UX fixes Frontend: - Resolve environment (production/next/testing/local) from hostname in src/config.ts via byEnv(); base URLs, PostHog, agentic chat, and the agentation overlay all resolve in code. No Vercel env vars needed. - Replace Sentry with PostHog error tracking (capture_exceptions autocapture, captureException at former Sentry call sites, ErrorBoundary reporting). - Auth-aware ErrorPage: logged-out visitors on errored or unmatched routes redirect to /login; fallbacks offer Reload and Return home. - Registration page: "Trying to join an existing organization?" disclosure. - Delete .env and .env.sample; .env.example documents escape-hatch overrides. Emails (directus/templates + server/email_templates): - Single Regular (400) DM Sans weight, single text color (graphite) with Royal Blue accents, per brand guide. - Logo: new minified PNG at 30px, served from frontend/public on echo-next (flip host to dashboard.dembrane.com at GA). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
c579871 to
197c38d
Compare
… hatch - Base URLs (API, admin, participant, Directus), Slack URL, and Plausible host are plain code now; byEnv() covers every environment. - Participant router detects portal.* hostnames, or port 5174 locally, so the participant:dev script needs no env var. - Delete .env.example: the frontend has no env files at all. The two remaining knobs (VITE_DEBUG_MODE, VITE_ENABLE_AGENTATION=0) are documented in AGENTS.md. - Note that plausible.io is already the EU host (EU-owned, German servers). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Replace plausible-tracker with posthog.capture at every call site; snake_case past-tense names per convention. Remove the analytics wrapper, event constants, dep, and PLAUSIBLE_API_HOST. Pageviews come from PostHog defaults (history_change), so no pageview tracker. - Merge near-duplicates: contact_sales_clicked with a source property; chat_mode_selected captured once inside ChatModeSelector for all entry points (was split between a Plausible click event and a route-level capture). Audio interruption stays on captureException. - New funnel events: workspace_request_started (UpgradeModal open, pairs with workspace_request_submitted) and registration_details_completed (pairs $pageview -> user_registered). - CSP: drop Sentry and Plausible hosts, allow eu.i.posthog.com and eu-assets.i.posthog.com (PostHog was not in the CSP at all). - Drop two dead Plausible events (announcement created, Slack join) and the unused ReactQueryDevtools import. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Unknown hostnames (Vercel previews, LAN IPs) now resolve to "next"
instead of "production": prod requires an explicit hostname match, so
stray hosts can never capture into prod analytics or hit prod backends
- ErrorPage no longer shows the not-found message for non-404 route
errors; fallback copy now branches on isNotFound
- PostHog loaded callback opts back in when capture is enabled, so a
persisted opt-out can't outlive a config flip (no $opt_in event)
- useAuthenticated takes an enabled flag; ErrorPage disables the session
query on the participant portal instead of firing a doomed refresh
- ErrorBoundary honors fallback={null} as "render nothing" instead of
falling through to the full-height default screen
- ErrorPage and ErrorBoundary strings wrapped in Lingui Trans; catalogs
extracted, new error-surface strings translated, compiled
- Root AGENTS.md feature-flag section updated: frontend flags are code
constants via byEnv(), not VITE_* env vars
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Environment config in code (no more Vercel env vars)
src/config.tsresolves the environment (production / next / testing / local) from the hostname and exposesbyEnv(). Base URLs (API, Directus, dashboard, portal), PostHog token/host/capture, agentic chat, and the agentation overlay all resolve in plain code.vite previewnever pollutes prod analytics.portal.*hostnames.VITE_*vars remain honored as escape-hatch overrides, so existing Vercel vars can be deleted gradually without breakage.frontend/.envand.env.sampledeleted;.env.exampledocuments the overrides.Sentry removed, PostHog error tracking wired
@sentry/reactuninstalled; init, DSNs, and all capture sites removed.capture_exceptionsautocapture inposthog.init,posthog.captureExceptionat the former Sentry call sites, and the sharedErrorBoundaryreports React render errors with component stacks.Error surface
ErrorPageis auth-aware: a logged-out visitor on an errored or unmatched route (e.g./en-US/w) is redirected to/login?next=...instead of seeing "Oops!". Logged-in users get a real 404 or error with Reload / Return home. Participant portal and auth pages are excluded from the gate.Registration page
Email templates (all 20, both Directus liquid and SendGrid Jinja)
brand/STYLE_GUIDE.md"one or two weights max".frontend/public/dembrane-logo-email.png. Templates point at the echo-next dashboard host for the verify-first release; flip todashboard.dembrane.comat GA.Notes for reviewers
dbr-echo-directusimage; these template fixes reach inboxes only after that image is rebuilt and redeployed.__sourceBabel transform is now on in every build (runtime gate decides rendering; prod never downloads the lazy chunk). Main bundle grows ~290 kB raw;VITE_ENABLE_AGENTATION=0builds without it.*.vercel.app) resolve toproduction; say the word if previews should map tonext.Test plan
tsc --noEmit, biome, and fullvite buildpass/en-US/wredirects to login; register flow shows the disclosure; emails render single weight/color with the new logo🤖 Generated with Claude Code