From 5d4f906ede3bb9fc451b030e9ac413b07db9fbd7 Mon Sep 17 00:00:00 2001 From: Pritesh Date: Wed, 3 Jun 2026 04:20:57 +0530 Subject: [PATCH] feat(lead-gen): enterprise intake modal Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/lead-forms/EnterpriseModal.tsx | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 ui/src/components/lead-forms/EnterpriseModal.tsx diff --git a/ui/src/components/lead-forms/EnterpriseModal.tsx b/ui/src/components/lead-forms/EnterpriseModal.tsx new file mode 100644 index 00000000..4ffb9ae6 --- /dev/null +++ b/ui/src/components/lead-forms/EnterpriseModal.tsx @@ -0,0 +1,180 @@ +"use client"; + +import { useState } from "react"; +import { toast } from "sonner"; + +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Textarea } from "@/components/ui/textarea"; + +import { validateWorkEmail } from "./isPersonalEmail"; +import { + ENTERPRISE_COMPANY_SIZE_OPTIONS, + ENTERPRISE_INDUSTRY_OPTIONS, + ENTERPRISE_TIMELINE_OPTIONS, + type LeadSource, +} from "./leadFieldOptions"; +import { MathCaptcha } from "./MathCaptcha"; +import { submitLead } from "./submitLead"; + +interface EnterpriseModalProps { + open: boolean; + onOpenChange: (open: boolean) => void; + source: LeadSource; +} + +export function EnterpriseModal({ open, onOpenChange, source }: EnterpriseModalProps) { + const [company, setCompany] = useState(""); + const [industry, setIndustry] = useState(""); + const [companySize, setCompanySize] = useState(""); + const [timeline, setTimeline] = useState(""); + const [workEmail, setWorkEmail] = useState(""); + const [phone, setPhone] = useState(""); + const [notes, setNotes] = useState(""); + const [emailError, setEmailError] = useState(null); + const [captchaValid, setCaptchaValid] = useState(false); + const [submitting, setSubmitting] = useState(false); + + const reset = () => { + setCompany(""); setIndustry(""); setCompanySize(""); setTimeline(""); + setWorkEmail(""); setPhone(""); setNotes(""); setEmailError(null); + setCaptchaValid(false); setSubmitting(false); + }; + + const handleSubmit = async () => { + const err = validateWorkEmail(workEmail); + if (err) { setEmailError(err); return; } + if (!company.trim() || !industry || !companySize || !timeline) { + toast.error("Please fill in all required fields"); + return; + } + if (!captchaValid) { toast.error("Please answer the quick check"); return; } + + setSubmitting(true); + try { + await submitLead({ + kind: "enterprise", + source, + payload: { company, industry, companySize, timeline, workEmail, phone, notes }, + }); + toast.success("Thanks — our team will reach out about enterprise deployment."); + reset(); + onOpenChange(false); + } catch { + toast.error("Something went wrong. Please try again."); + setSubmitting(false); + } + }; + + return ( + { if (!o) reset(); onOpenChange(o); }}> + + + Enterprise deployment + + SSO, on-prem, SOC2, data residency. Tell us about your environment. + + + +
+
+ + setCompany(e.target.value)} /> +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + { setWorkEmail(e.target.value); setEmailError(null); }} + placeholder="you@company.com" + /> + {emailError &&

{emailError}

} +
+ +
+ + setPhone(e.target.value)} /> +
+ +
+ +