"use client"; // Shared enterprise lead fields, rendered by BOTH the standalone EnterpriseModal // and the inline on-prem expansion of the onboarding form. One source of truth so // the two stay identical and submit through the same /api/v1/leads/enterprise // path. Controlled: the parent owns the values + the submit/captcha flow. 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 { ENTERPRISE_DEPLOYMENT_OPTIONS, ENTERPRISE_VOLUME_OPTIONS, } from "./leadFieldOptions"; import { PhoneField } from "./PhoneField"; export interface EnterpriseFieldsValue { name: string; company: string; jobTitle: string; workEmail: string; phone: string; volume: string; deployment: string; agentGoal: string; } export const EMPTY_ENTERPRISE_FIELDS: EnterpriseFieldsValue = { name: "", company: "", jobTitle: "", workEmail: "", phone: "", volume: "", deployment: "", agentGoal: "", }; interface EnterpriseLeadFieldsProps { // Unique prefix for input ids/labels (e.g. "ent", "ob-op") so the two // instances never collide when both exist in the DOM. idPrefix: string; value: EnterpriseFieldsValue; onChange: (patch: Partial) => void; // The deployment question is surfaced only for certain entry points; elsewhere // it is hidden and the caller defaults the payload to "yes". showDeployment: boolean; emailError?: string | null; } export function EnterpriseLeadFields({ idPrefix: p, value, onChange, showDeployment, emailError, }: EnterpriseLeadFieldsProps) { return (
onChange({ name: e.target.value })} />
onChange({ company: e.target.value })} />
onChange({ jobTitle: e.target.value })} />
onChange({ workEmail: e.target.value })} /> {emailError &&

{emailError}

}
onChange({ phone })} required />
{showDeployment && (
)}