Skip to content

Commit 509f954

Browse files
Make Company optional on the waitlist form
UX: - Form labels Company "optional"; client validation no longer flags it as Required when blank. Server: - Drop the "Company is required" throw in normalizeSignup. Email-domain inference still runs as a "free upgrade" for corporate emails, but freemail addresses with a blank field are now accepted with company = null (the schema already allows null). Lower friction for the waitlist while preserving the auto-inferred company name when we can detect one. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent c4590d7 commit 509f954

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

apps/marketing/src/pages/workspaces/index.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ const teamSizes = [
153153
<input type="email" name="email" placeholder="jane@company.com" autocomplete="email" maxlength="320" />
154154
</div>
155155
<div class="ws-field">
156-
<label class="ws-label">Company</label>
156+
<label class="ws-label">
157+
Company <span class="ws-opt">optional</span>
158+
</label>
157159
<input type="text" name="company" placeholder="Acme Inc." autocomplete="organization" maxlength="160" />
158160
</div>
159161
</div>
@@ -475,7 +477,8 @@ const teamSizes = [
475477
else if (!/^[^\s@]+@[^\s@.]+\.[^\s@]+$/.test(email)) {
476478
showErr(get('email'), 'Looks invalid'); ok = false;
477479
}
478-
if (!company) { showErr(get('company'), 'Required'); ok = false; }
480+
// Company is optional now; the worker fills it in from the email
481+
// domain when possible, otherwise stores null.
479482
if (!team_size) {
480483
showErr(form.querySelector('[data-field="teamSize"]'), 'Pick one');
481484
ok = false;

apps/waitlist-service/core/validation.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export interface RawSignup {
6060

6161
export interface NormalizedSignup {
6262
email: string;
63-
company: string;
63+
company: string | null;
6464
company_inferred: boolean;
6565
team_size: string;
6666
note: string | null;
@@ -145,9 +145,10 @@ export function normalizeSignup(raw: RawSignup): NormalizedSignup {
145145
const email = emailRaw.toLowerCase();
146146
if (!EMAIL_RE.test(email)) throw new ValidationError("Email looks invalid");
147147

148-
// Company is required by the form. If a caller leaves it blank we still
149-
// try the email-domain inference — better to capture *something* than to
150-
// 400 someone who hit "submit" without filling the field.
148+
// Company is optional from the form's perspective. If a caller leaves it
149+
// blank, try the email-domain inference as a "free upgrade" so corporate
150+
// emails still land with a usable company name. If even that fails (e.g.
151+
// freemail like @gmail.com), we just store null — schema allows it.
151152
let company = trimStr(raw.company, 160);
152153
let companyInferred = false;
153154
if (!company) {
@@ -157,7 +158,6 @@ export function normalizeSignup(raw: RawSignup): NormalizedSignup {
157158
companyInferred = true;
158159
}
159160
}
160-
if (!company) throw new ValidationError("Company is required");
161161

162162
const teamSizeRaw = trimStr(raw.team_size, 16)?.toLowerCase() ?? null;
163163
if (!teamSizeRaw || !ALLOWED_TEAM_SIZES.has(teamSizeRaw)) {

0 commit comments

Comments
 (0)