feat(demo-request): block personal email domains#3786
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview The Written by Cursor Bugbot for commit cdc8194. Configure here. |
Greptile SummaryThis PR adds personal/consumer email domain filtering to the demo request form by integrating the Key observations:
Confidence Score: 4/5Safe to merge; the domain-blocking logic is correct and server-side validation is preserved — one minor bundle-size trade-off worth acknowledging. The implementation is clean and logically sound, dual validation is properly wired, no regressions are introduced, and the only concern (domain list in client bundle) is a deliberate design choice called out in the PR description rather than a bug. apps/sim/app/(home)/components/demo-request/consts.ts — the free-email-domains import lands in the client bundle; consider splitting schema or lazy-loading if bundle size becomes a concern. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Modal as DemoRequestModal (client)
participant Schema as demoRequestSchema (shared)
participant API as /api/demo-requests (server)
User->>Modal: Types work email & submits form
Modal->>Schema: safeParse(formData)
Note over Schema: 1. quickValidateEmail refine<br/>2. FREE_EMAIL_DOMAINS.has(domain) refine
alt Personal domain (e.g. gmail.com)
Schema-->>Modal: Error: "Please use your work email address"
Modal-->>User: Shows inline field error
else Valid work email
Schema-->>Modal: Parsed & lowercased data
Modal->>API: POST /api/demo-requests (JSON)
API->>Schema: safeParse(body) — re-validates server-side
alt Domain slipped through client (direct API call)
Schema-->>API: 400 Invalid request data
API-->>Modal: 400 response
else Valid
API->>API: sendEmail(enterprise@sim.ai)
API-->>Modal: 201 success
Modal-->>User: Success state
end
end
Reviews (1): Last reviewed commit: "feat(demo-request): block personal email..." | Re-trigger Greptile |
Summary
free-email-domainspackage (~3k domains, gmail/yahoo/hotmail/etc.)Setfor O(1) lookups at module load timeType of Change
Testing
Tested manually
Checklist