function ConsultModal({ open, onClose }) { const [submitted, setSubmitted] = React.useState(false); const [loading, setLoading] = React.useState(false); const [error, setError] = React.useState(''); const nameRef = React.useRef(null); const companyRef = React.useRef(null); const emailRef = React.useRef(null); const roleRef = React.useRef(null); React.useEffect(() => { if (!open) { setSubmitted(false); setError(''); setLoading(false); } }, [open]); const handleSubmit = async () => { const name = nameRef.current.value.trim(); const company = companyRef.current.value.trim(); const email = emailRef.current.value.trim(); const role = roleRef.current.value.trim(); if (!name || !email) { setError('Please fill in your name and email.'); return; } if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { setError('Please enter a valid email address.'); return; } setLoading(true); setError(''); try { const res = await fetch('/api/consult', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name, company, email, role }), }); if (res.ok) { setSubmitted(true); } else { const d = await res.json().catch(() => ({})); setError(d.error || 'Submission failed. Please try again.'); } } catch (e) { setError('Network error. Please try again.'); } finally { setLoading(false); } }; return (
e.stopPropagation()} style={{position:'relative'}}> {!submitted ? ( <>

Schedule a consultation.

Tell us about the role. A Synvori partner will be in touch within one business day.

{error &&

{error}

} ) : (

Thank you.

A Synvori partner will reach out within one business day. All inquiries are treated as confidential.

)}
); } window.ConsultModal = ConsultModal;