const { Tag, Icon, Button, Field, ConsentCheckbox, ChipGroup, FormAlert } = window.CoolZoneSolutionDesignSystem_12e696; function Contact({ t }) { const S = window.CZ_SETTINGS; const [v, setV] = React.useState({ name: '', email: '', phone: '', msg: '', consent: false }); const [when, setWhen] = React.useState('any'); const [sent, setSent] = React.useState(false); const [tried, setTried] = React.useState(false); const bad = { name: !v.name.trim(), email: !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v.email), phone: v.phone.trim().length < 6, msg: v.msg.trim().length < 5, consent: !v.consent }; const set = (k) => (e) => setV({ ...v, [k]: e.target.type === 'checkbox' ? e.target.checked : e.target.value }); const submit = (e) => { e.preventDefault(); setTried(true); if (Object.values(bad).some(Boolean)) return; setSent(true); fetch('/api/leads-api.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: v.name, email: v.email, phone: v.phone, notes: v.msg + (when !== 'any' ? ` (preferred contact time: ${when})` : ''), problems: [] }) }).catch(() => {}); }; const hoursLine = window.CZ_FORMAT_HOURS(S.hoursRaw, t) || t.cHoursVal; const info = [ ['phone', t.cPhone, S.phoneDisplay, 'tel:' + S.phoneHref], ['mail', t.cEmail, S.email, 'mailto:' + S.email], ['pin', t.cArea, t.cAreaVal, null], ...(S.addressLine ? [['pin', t.cAddress, S.addressLine, null]] : []), ['clock', t.cHours, hoursLine, null] ]; return (
{t.contactTag}

{t.contactH2}

{t.contactLead}

    {info.map(([ic, label, value, href]) => (
  • {label}{href ? {value} : {value}}
  • ))}

{t.formH3}

{t.formSub}

s[0])} /> {t.fConsent}

{t.fNote}

{sent ? : null}
); } Object.assign(window, { Contact });