"use client"; import React, { useState } from "react"; import { motion } from "framer-motion"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import { Send, CheckCircle } from "lucide-react"; import { toast } from "sonner"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; const blockedDomains = [ "gmail.com", "yahoo.com", "outlook.com", "hotmail.com", "icloud.com", ]; // Contact Form Component const ContactForm: React.FC = () => { const [form, setForm] = useState({ name: "", email: "", phoneNumber: "", company: "", designation: "", solution: "", description: "", }); const [loading, setLoading] = useState(false); const [submitted, setSubmitted] = useState(false); // 🔹 Business Email Validation const isBusinessEmail = (email: string) => { const domain = email.split("@")[1]; return domain && !blockedDomains.includes(domain.toLowerCase()); }; const handleSubmit = async () => { if ( !form.name || !form.email || !form.phoneNumber || !form.company || !form.designation || !form.solution ) { toast.error("Please fill all required fields."); return; } if (!isBusinessEmail(form.email)) { toast.error("Please use your business email (no Gmail/Yahoo etc.)"); return; } try { setLoading(true); // 🔹 Call API (you will create below) const res = await fetch("/api/demo-lead", { method: "POST", body: JSON.stringify(form), }); if (!res.ok) throw new Error(); toast.success("Demo request submitted successfully!"); setSubmitted(true); setForm({ name: "", email: "", phoneNumber: "", company: "", designation: "", solution: "", description: "", }); setTimeout(() => setSubmitted(false), 3000); } catch (err) { toast.error("Something went wrong. Try again."); } finally { setLoading(false); } }; return (

Send us a message

Fill out the form below and we'll get back to you within 24 hours

{submitted ? (

Thank you!

Your message has been sent successfully.

) : (
setForm({ ...form, name: e.target.value })} />
setForm({ ...form, email: e.target.value }) } />
setForm({ ...form, phoneNumber: e.target.value }) } />
setForm({ ...form, company: e.target.value }) } />
setForm({ ...form, designation: e.target.value }) } />