'use client' import { useState, FormEvent } from 'react' import { EarlyAccessLead, useEarlyAccessCapture } from '../hooks/useEarlyAccessCapture' import { LeadSourceType } from '../hooks/useEarlyAccessCapture' interface EarlyAccessFormProps { isOpen: boolean onClose: () => void leadSource: LeadSourceType } export default function EarlyAccessForm({ isOpen, onClose, leadSource }: EarlyAccessFormProps) { const { submitEarlyAccess, isSubmitting, submitStatus, errorMessage } = useEarlyAccessCapture() const [formData, setFormData] = useState({ firstName: '', lastName: '', email: '', companyName: '', companyRole: '', interestLevel: 'general_interest', leadSource: leadSource, gdprConsent: false, marketingConsent: false, }) const handleSubmit = async (e: FormEvent) => { e.preventDefault() if (!formData.gdprConsent) { alert('Please accept the privacy policy to continue.') return } const result = await submitEarlyAccess(formData) if (result.success) { // Reset form on success setFormData({ firstName: '', lastName: '', email: '', companyName: '', companyRole: '', interestLevel: 'general_interest', leadSource: leadSource, gdprConsent: false, marketingConsent: false, }) } } const handleInputChange = (field: keyof EarlyAccessLead, value: string | boolean) => { setFormData(prev => ({ ...prev, [field]: value })) } if (!isOpen) return null return (
e.stopPropagation()} > {/* Close Button */} {/* Form Header */}

{leadSource === 'request_early_access' ? 'Request Early Access to CHORUS' : 'Join the CHORUS Waitlist'}

{leadSource === 'request_early_access' ? 'Get priority access to contextual AI orchestration' : 'Be notified when CHORUS becomes available'}

{/* Success State */} {submitStatus === 'success' ? (

{leadSource === 'request_early_access' ? 'Request submitted successfully!' : 'Welcome to the waitlist!'}

{leadSource === 'request_early_access' ? 'We\'ll prioritize your request and contact you soon.' : 'We\'ll notify you when CHORUS becomes available.'}

) : ( /* Form */
{/* Name Fields */}
handleInputChange('firstName', e.target.value)} className="form-input" placeholder="John" />
handleInputChange('lastName', e.target.value)} className="form-input" placeholder="Doe" />
{/* Email */}
handleInputChange('email', e.target.value)} className="form-input" placeholder="john@company.com" />
{/* Company Information */}
handleInputChange('companyName', e.target.value)} className="form-input" placeholder="Company Name" />
handleInputChange('companyRole', e.target.value)} className="form-input" placeholder="CTO, Director, etc." />
{/* Interest Level */}
{/* GDPR Consent */}
{/* Error Message */} {submitStatus === 'error' && errorMessage && (
⚠ {errorMessage}
)} {/* Submit Button */}
)} {/* Footer */}

By joining our waitlist, you'll receive exclusive early access and product updates. We respect your privacy and won't spam you.

) }