From 4587079fe36163c6b083154f514e9422a4a3ffde Mon Sep 17 00:00:00 2001 From: Pritesh Date: Wed, 3 Jun 2026 04:22:18 +0530 Subject: [PATCH] feat(lead-gen): hire-an-expert modal with enterprise link Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/lead-forms/HireExpertModal.tsx | 195 ++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 ui/src/components/lead-forms/HireExpertModal.tsx diff --git a/ui/src/components/lead-forms/HireExpertModal.tsx b/ui/src/components/lead-forms/HireExpertModal.tsx new file mode 100644 index 00000000..bceffe12 --- /dev/null +++ b/ui/src/components/lead-forms/HireExpertModal.tsx @@ -0,0 +1,195 @@ +"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 { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Textarea } from "@/components/ui/textarea"; + +import { + HIRE_STAGE_OPTIONS, + HIRE_TIMELINE_OPTIONS, + HIRE_VOLUME_OPTIONS, + type LeadSource, +} from "./leadFieldOptions"; +import { MathCaptcha } from "./MathCaptcha"; +import { submitLead } from "./submitLead"; + +interface HireExpertModalProps { + open: boolean; + onOpenChange: (open: boolean) => void; + source: LeadSource; + onOpenEnterprise: () => void; +} + +export function HireExpertModal({ open, onOpenChange, source, onOpenEnterprise }: HireExpertModalProps) { + const [company, setCompany] = useState(""); + const [business, setBusiness] = useState(""); + const [agentGoal, setAgentGoal] = useState(""); + const [phone, setPhone] = useState(""); + const [timeline, setTimeline] = useState(""); + const [volume, setVolume] = useState(""); + const [hasScripts, setHasScripts] = useState(""); + const [stage, setStage] = useState(""); + const [captchaValid, setCaptchaValid] = useState(false); + const [submitting, setSubmitting] = useState(false); + + const reset = () => { + setCompany(""); setBusiness(""); setAgentGoal(""); setPhone(""); + setTimeline(""); setVolume(""); setHasScripts(""); setStage(""); + setCaptchaValid(false); setSubmitting(false); + }; + + const handleSubmit = async () => { + if (!company.trim() || !business.trim() || !timeline || !volume || !hasScripts || !stage) { + 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: "hire_expert", + source, + payload: { company, business, agentGoal, phone, timeline, volume, hasScripts, stage }, + }); + toast.success("Thanks — we'll reach out about building your agent."); + reset(); + onOpenChange(false); + } catch { + toast.error("Something went wrong. Please try again."); + setSubmitting(false); + } + }; + + return ( + { if (!o) reset(); onOpenChange(o); }}> + + + Let us build your voice agent + + Building good voice agents is nuanced. Tell us what you need and we'll take it end-to-end. + + + +
+
+ + setCompany(e.target.value)} /> +
+ +
+ + setBusiness(e.target.value)} /> +
+ +
+ +