// early-access-modal.jsx — Werkd isn't open for public sign-up yet. Every // former "Start trial / Sign up" CTA now opens this instead: a simple email // capture that POSTs to send-early-access.php (PHP mail(), works on // Hostinger shared hosting with no extra setup — see that file's header). // Open via window.dispatchEvent(new CustomEvent('werkd:open-early-access')). function EarlyAccessModal() { const DA = window.DA; const [open, setOpen] = React.useState(false); const [email, setEmail] = React.useState(''); const [company, setCompany] = React.useState(''); // honeypot — left blank by humans const [sent, setSent] = React.useState(false); const [submitting, setSubmitting] = React.useState(false); const [error, setError] = React.useState(''); const inputRef = React.useRef(null); React.useEffect(() => { const onOpen = () => { setOpen(true); setSent(false); setEmail(''); setError(''); setSubmitting(false); }; window.addEventListener('werkd:open-early-access', onOpen); return () => window.removeEventListener('werkd:open-early-access', onOpen); }, []); React.useEffect(() => { if (!open) return; const onKey = (e) => { if (e.key === 'Escape') setOpen(false); }; window.addEventListener('keydown', onKey); const prevOverflow = document.body.style.overflow; document.body.style.overflow = 'hidden'; const t = setTimeout(() => inputRef.current && inputRef.current.focus(), 60); return () => { window.removeEventListener('keydown', onKey); document.body.style.overflow = prevOverflow; clearTimeout(t); }; }, [open]); if (!open) return null; const submit = async (e) => { e.preventDefault(); if (!email.trim() || submitting) return; setSubmitting(true); setError(''); try { const res = await fetch('send-early-access.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, company }), }); const data = await res.json().catch(() => null); if (res.ok && data && data.ok) { setSent(true); } else { setError((data && data.error) || 'Something went wrong — please try again.'); } } catch { setError('Could not reach the server — please try again, or email contact@werkd.pro directly.'); } finally { setSubmitting(false); } }; const modal = (
{ if (e.target === e.currentTarget) setOpen(false); }} style={{ position: 'fixed', inset: 0, zIndex: 9999, background: 'rgba(8,8,9,0.82)', backdropFilter: 'blur(8px)', WebkitBackdropFilter: 'blur(8px)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 20, fontFamily: DA ? DA.font : 'Inter, sans-serif', }} >

Request early access

{sent ? (

Thanks — we'll reach out as soon as werkd opens up.

) : (

Werkd isn't open for sign-ups yet. Leave your email and we'll let you know the moment it is.

setEmail(e.target.value)} style={{ flex: 1, minWidth: 0, height: 44, padding: '0 13px', borderRadius: 6, border: '1px solid rgba(255,255,255,0.18)', background: 'rgba(255,255,255,0.05)', color: '#fff', fontSize: 14, fontFamily: 'inherit', }} /> {/* Honeypot — hidden from sighted users and screen readers, off the tab order. Bots that auto-fill every field trip it; humans never see it. */} setCompany(e.target.value)} style={{ position: 'absolute', width: 1, height: 1, opacity: 0, pointerEvents: 'none' }} />
{error && (

{error}

)}
)}
); return ReactDOM.createPortal(modal, document.body); } window.EarlyAccessModal = EarlyAccessModal; window.openEarlyAccess = () => window.dispatchEvent(new CustomEvent('werkd:open-early-access'));