// ─────────────────────────────────────────────────────────── // Lead form destination config — edit here if URLs change. // ─────────────────────────────────────────────────────────── const FORMSPREE_ENDPOINT = "https://formspree.io/f/xqewgnad"; const CALENDLY_URL = "https://calendly.com/augusto-difiorecreative/30min"; const LeadForm = ({ variant = "light", compact = false, onSubmit }) => { const [state, setState] = React.useState({ name: "", email: "", company: "", website: "" }); const [phase, setPhase] = React.useState("idle"); // idle | sending | success | error const [errorMsg, setErrorMsg] = React.useState(""); const dark = variant === "dark"; const APPLE_SANS = "-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif"; const APPLE_TEXT = "-apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif"; const set = (k) => (e) => setState((s) => ({ ...s, [k]: e.target.value })); const submit = async (e) => { e.preventDefault(); if (phase === "sending") return; setPhase("sending"); setErrorMsg(""); try { const response = await fetch(FORMSPREE_ENDPOINT, { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify({ ...state, _subject: `🔥 New Free Month lead — ${state.name || "unknown"} (${state.company || ""})`, }), }); if (!response.ok) throw new Error("bad response"); onSubmit?.(state); setPhase("success"); // Brief pause so user sees "Booking your call…" then redirect to Calendly setTimeout(() => { window.location.href = CALENDLY_URL; }, 900); } catch (err) { setPhase("error"); setErrorMsg("Something went wrong. Please retry, or email us at info@difiorecreative.com."); } }; const inputStyle = { width: "100%", padding: "15px 16px", fontFamily: APPLE_TEXT, fontSize: 16, letterSpacing: "-0.01em", color: dark ? "#fff" : "#051B42", background: dark ? "rgba(255,255,255,0.06)" : "#fff", border: `1px solid ${dark ? "rgba(255,255,255,0.14)" : "rgba(5,27,66,0.18)"}`, borderRadius: 12, outline: "none", boxSizing: "border-box", transition: "all 140ms ease", }; const labelStyle = { fontFamily: APPLE_TEXT, fontSize: 12, fontWeight: 500, letterSpacing: "-0.005em", color: dark ? "rgba(255,255,255,0.65)" : "rgba(5,27,66,0.55)", marginBottom: 6, display: "block", }; const sending = phase === "sending"; const successfulSend = phase === "success"; const buttonLabel = successfulSend ? "Booking your call…" : sending ? "Sending…" : "Claim my free month"; return (
); }; window.LeadForm = LeadForm;