PageSourceSearch

https://pursuit-of-happiness.org/assets/contact-us-CvgoaYMG.js

js pursuit-of-happiness.org collected 2026-09-24 17:33:46 UTC 3,917 bytes, 1 lines download raw bytes

1import{r as m,j as e}from"./index-BRTybXNV.js";import{P as b}from"./PageHero-Cv4Qe4M6.js";function y(){const[t,s]=m.useState("idle"),[u,o]=m.useState("");async function g(r){r.preventDefault();const x=r.currentTarget,a=new FormData(x),n=String(a.get("name")??"").trim(),l=String(a.get("email")??"").trim(),c=String(a.get("message")??"").trim();if(!(!n||!l||!c)){s("submitting"),o("");try{const i=await fetch("https://api.web3forms.com/submit",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({access_key:"3ee36f8b-9153-45c8-a3d5-4b9ccd274349",subject:"New enquiry from pursuit-of-happiness.org",botcheck:String(a.get("botcheck")??""),name:n,email:l,message:c})}),d=await i.json().catch(()=>null);i.ok&&d?.success?s("success"):(s("error"),o(d?.message||"The message could not be sent. Please try again in a moment."))}catch{s("error"),o("The message could not be sent — please check your connection and try again.")}}}return e.jsxs(e.Fragment,{children:[e.jsx(b,{title:"Contact us",intro:"Questions about our courses, articles, or the science of happiness? Send us a message and we will get back to you."}),e.jsx("article",{className:"mx-auto max-w-2xl px-4 py-12 lg:px-6",style:{background:"var(--cream)"},children:t==="success"?e.jsxs("div",{className:"rounded-lg border p-8 text-center",style:{borderColor:"var(--gold-soft)",background:"var(--navy)",color:"var(--cream)"},role:"status",children:[e.jsx("h2",{className:"font-serif text-2xl",style:{color:"var(--gold)"},children:"Message sent"}),e.jsx("p",{className:"mt-3 text-sm leading-relaxed",children:"Thank you for getting in touch. We read every message and will reply as soon as we can."})]}):e.jsxs("form",{onSubmit:g,className:"space-y-6",noValidate:!1,children:[e.jsx("input",{type:"text",name:"botcheck",tabIndex:-1,autoComplete:"off","aria-hidden":"true",className:"hidden",style:{display:"none"}}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"contact-name",className:"mb-1 block text-sm font-semibold",style:{color:"var(--navy)"},children:["Name ",e.jsx("span",{"aria-hidden":"true",style:{color:"var(--gold)"},children:"*"})]}),e.jsx("input",{id:"contact-name",name:"name",type:"text",required:!0,maxLength:100,autoComplete:"name",className:"w-full rounded-md border bg-white px-3 py-2 text-sm outline-none focus:ring-2",style:{borderColor:"var(--gold-soft)",color:"var(--navy)"}})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"contact-email",className:"mb-1 block text-sm font-semibold",style:{color:"var(--navy)"},children:["Email ",e.jsx("span",{"aria-hidden":"true",style:{color:"var(--gold)"},children:"*"})]}),e.jsx("input",{id:"contact-email",name:"email",type:"email",required:!0,maxLength:255,autoComplete:"email",className:"w-full rounded-md border bg-white px-3 py-2 text-sm outline-none focus:ring-2",style:{borderColor:"var(--gold-soft)",color:"var(--navy)"}})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"contact-message",className:"mb-1 block text-sm font-semibold",style:{color:"var(--navy)"},children:["Message ",e.jsx("span",{"aria-hidden":"true",style:{color:"var(--gold)"},children:"*"})]}),e.jsx("textarea",{id:"contact-message",name:"message",required:!0,maxLength:5e3,rows:7,className:"w-full rounded-md border bg-white px-3 py-2 text-sm outline-none focus:ring-2",style:{borderColor:"var(--gold-soft)",color:"var(--navy)"}})]}),t==="error"&&e.jsxs("p",{role:"alert",className:"rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-800",children:[u," Your message text is still in the form above — nothing has been lost."]}),e.jsx("button",{type:"submit",disabled:t==="submitting",className:"rounded-md px-6 py-3 text-sm font-semibold transition disabled:cursor-not-allowed disabled:opacity-60",style:{background:"var(--gold)",color:"var(--navy-deep)"},children:t==="submitting"?"Sending…":"Submit"})]})})]})}export{y as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.