diff --git a/apps/website/app/api/contact/route.ts b/apps/website/app/api/contact/route.ts index b437e7f..310b0d6 100644 --- a/apps/website/app/api/contact/route.ts +++ b/apps/website/app/api/contact/route.ts @@ -8,6 +8,8 @@ const FREE_EMAIL_DOMAINS: Set = new Set(require("free-email-domains")); interface ContactFormData { inquiryType: "support" | "sales"; + teamSize?: string; + serverCount?: string; firstName: string; lastName: string; email: string; @@ -103,6 +105,10 @@ export async function POST(request: NextRequest) { // Format email content const emailSubject = `[${body.inquiryType.toUpperCase()}] New contact form submission from ${body.firstName} ${body.lastName}`; + const salesFields = + body.inquiryType === "sales" + ? `Employees: ${body.teamSize || "N/A"}\nServers: ${body.serverCount || "N/A"}\n` + : ""; const emailBody = ` New contact form submission: @@ -111,7 +117,7 @@ First Name: ${body.firstName} Last Name: ${body.lastName} Email: ${body.email} Company: ${body.company} - +${salesFields} Message: ${body.message} diff --git a/apps/website/components/ContactForm.tsx b/apps/website/components/ContactForm.tsx index bf2fb3c..365b21e 100644 --- a/apps/website/components/ContactForm.tsx +++ b/apps/website/components/ContactForm.tsx @@ -17,6 +17,8 @@ const FREE_EMAIL_DOMAINS: Set = new Set(require("free-email-domains")); interface ContactFormData { inquiryType: "" | "support" | "sales"; deploymentType: "" | "cloud" | "self-hosted"; + teamSize: string; + serverCount: string; firstName: string; lastName: string; email: string; @@ -44,6 +46,8 @@ export function ContactForm({ const [formData, setFormData] = useState({ inquiryType: defaultInquiryType || "", deploymentType: "", + teamSize: "", + serverCount: "", firstName: "", lastName: "", email: "", @@ -78,6 +82,9 @@ export function ContactForm({ newErrors.email = "Please use your work email address to contact sales"; } + if (formData.inquiryType === "sales" && !formData.teamSize) { + newErrors.teamSize = "Please select your team size"; + } if (!formData.company.trim()) { newErrors.company = "Company name is required"; } @@ -125,6 +132,8 @@ export function ContactForm({ setFormData({ inquiryType: defaultInquiryType || "", deploymentType: "", + teamSize: "", + serverCount: "", firstName: "", lastName: "", email: "", @@ -297,6 +306,67 @@ export function ContactForm({ )} + {formData.inquiryType === "sales" && ( +
+
+ + + {errors.teamSize && ( +

{errors.teamSize}

+ )} +
+ +
+ + + {errors.serverCount && ( +

{errors.serverCount}

+ )} +
+
+ )} +