// Forms.jsx — shared form delivery for every form on the site. // Submissions are emailed to FORM_TO via FormSubmit (https://formsubmit.co): // no backend, no account. ONE-TIME SETUP: the first submission triggers an // activation email to FORM_TO; someone must click "Activate" in that email // before deliveries start. Until then FormSubmit returns success but holds mail. const FORM_TO = 'info@greysurface.com'; const FORM_ENDPOINT = `https://formsubmit.co/ajax/${FORM_TO}`; // fields: plain object of name → value. subject: email subject line. // Resolves on delivery, rejects with an Error on any failure. async function submitToInbox(fields, { subject = 'Website form submission', page } = {}) { const payload = { ...fields, _subject: subject, _template: 'table', _captcha: 'false', page: page || (typeof location !== 'undefined' ? location.href : ''), }; const res = await fetch(FORM_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify(payload), }); let data = {}; try { data = await res.json(); } catch (_) { /* non-JSON error body */ } if (!res.ok || String(data.success) !== 'true') { throw new Error(data.message || `Could not send (HTTP ${res.status})`); } return data; } // Read a