PageSourceSearch

https://joyjohnston.com/assets/Contact-kicZbAHZ.js

js joyjohnston.com collected 2026-10-07 14:04:35 UTC 8,857 bytes, 1 lines download raw bytes

1import{r as d,h as u,j as e,B as v}from"./index-BvjdnlVO.js";import{C as g,a as h,b,d as p}from"./card-7EMdbtMv.js";const N=()=>{const[s,n]=d.useState({name:"",email:"",subject:"",message:"",honeypot:""}),[r,o]=d.useState(!1),[l]=d.useState(Date.now()),{toast:i}=u(),c=async m=>{if(m.preventDefault(),!s.name||!s.email||!s.message){i({title:"Error",description:"Please fill in all required fields.",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.email)){i({title:"Error",description:"Please enter a valid email address.",variant:"destructive"});return}if(s.name.length>100){i({title:"Error",description:"Name must be less than 100 characters.",variant:"destructive"});return}if(s.message.length>5e3){i({title:"Error",description:"Message must be less than 5000 characters.",variant:"destructive"});return}const f=[/\b(click here|free money|guaranteed|act now)\b/gi,/\b(viagra|cialis|pharmacy)\b/gi,/(http[s]?:\/\/[^\s]+){3,}/gi],x=`${s.name} ${s.message}`.toLowerCase();if(f.some(t=>t.test(x))){i({title:"Error",description:"Your message contains content that appears to be spam. Please revise your message.",variant:"destructive"});return}if(o(!0),console.log("Submitting contact form:",s),s.honeypot&&s.honeypot.trim()!==""){i({title:"Error",description:"Spam detected. Please try again.",variant:"destructive"});return}try{console.log("Sending contact form data to secure edge function...");const t=await fetch("https://zjqxdbokkbbjbmjhtyus.supabase.co/functions/v1/send-contact-notification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InpqcXhkYm9ra2JiamJtamh0eXVzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDgyOTI4NzgsImV4cCI6MjA2Mzg2ODg3OH0.mFxjUf-tnbn2zRviHMgcZfGV_qJlYPq0OZNFpooUZ30"},body:JSON.stringify({name:s.name,email:s.email,subject:s.subject,message:s.message,honeypot:s.honeypot,submissionTime:l,saveToDatabase:!0})});if(!t.ok){const y=await t.json().catch(()=>({error:"Unknown error"}));throw new Error(y.error||`HTTP ${t.status}: ${t.statusText}`)}const j=await t.json();console.log("Contact form submission successful:",j),i({title:"Message Sent Successfully!",description:"Thank you for your message. I'll get back to you as soon as possible."}),n({name:"",email:"",subject:"",message:"",honeypot:""})}catch(t){console.error("Error submitting form:",t),console.error("Error details:",{message:t.message,stack:t.stack,name:t.name}),i({title:"Error",description:`There was an error sending your message: ${t.message}. Please try again.`,variant:"destructive"})}finally{o(!1)}},a=m=>{n({...s,[m.target.name]:m.target.value})};return e.jsxs(g,{className:"bg-white shadow-lg",children:[e.jsx(h,{children:e.jsx(b,{className:"text-2xl font-serif text-sage-900",children:"Send Me a Message"})}),e.jsx(p,{children:e.jsxs("form",{onSubmit:c,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sage-700 font-medium mb-2",children:"Name *"}),e.jsx("input",{type:"text",id:"name",name:"name",required:!0,maxLength:100,value:s.name,onChange:a,disabled:r,className:"w-full px-4 py-2 border border-sage-300 rounded-md focus:outline-none focus:ring-2 focus:ring-sage-500 disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sage-700 font-medium mb-2",children:"Email *"}),e.jsx("input",{type:"email",id:"email",name:"email",required:!0,maxLength:254,value:s.email,onChange:a,disabled:r,className:"w-full px-4 py-2 border border-sage-300 rounded-md focus:outline-none focus:ring-2 focus:ring-sage-500 disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"subject",className:"block text-sage-700 font-medium mb-2",children:"Inquiry Type"}),e.jsxs("select",{id:"subject",name:"subject",value:s.subject,onChange:a,disabled:r,className:"w-full px-4 py-2 border border-sage-300 rounded-md focus:outline-none focus:ring-2 focus:ring-sage-500 disabled:opacity-50",children:[e.jsx("option",{value:"",children:"Select a topic"}),e.jsx("option",{value:"media-inquiry",children:"Media Inquiry"}),e.jsx("option",{value:"speaking-request",children:"Speaking Request"}
1),e.jsx("option",{value:"seo-consulting",children:"SEO Consulting"}),e.jsx("option",{value:"collaboration",children:"Collaboration"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"message",className:"block text-sage-700 font-medium mb-2",children:"Message *"}),e.jsx("textarea",{id:"message",name:"message",required:!0,rows:6,maxLength:5e3,value:s.message,onChange:a,disabled:r,className:"w-full px-4 py-2 border border-sage-300 rounded-md focus:outline-none focus:ring-2 focus:ring-sage-500 disabled:opacity-50",placeholder:"Tell me about your project or inquiry..."}),e.jsxs("div",{className:"text-sm text-sage-600 mt-1",children:[s.message.length,"/5000 characters"]})]}),e.jsxs("div",{style:{display:"none"},"aria-hidden":"true",children:[e.jsx("label",{htmlFor:"honeypot",children:"Don't fill this out:"}),e.jsx("input",{type:"text",id:"honeypot",name:"honeypot",value:s.honeypot,onChange:a,tabIndex:-1,autoComplete:"off"})]}),e.jsx(v,{type:"submit",disabled:r,className:"w-full bg-sage-700 hover:bg-sage-800 text-white py-3",children:r?"Sending...":"Send Message"})]})})]})},w=()=>{const[s,n]=d.useState(""),[r,o]=d.useState(!1),{toast:l}=u(),i=async c=>{if(c.preventDefault(),!s){l({title:"Email required",description:"Please enter your email address.",variant:"destructive"});return}o(!0);try{const a=new FormData;if(a.append("fields[email]",s),a.append("ml-submit","1"),a.append("anticsrf","true"),(await fetch("https://assets.mailerlite.com/jsonp/734516/forms/112914587798471798/subscribe",{method:"POST",body:a})).ok)l({title:"Successfully subscribed!",description:"Thank you for joining The Reluctant Caregiver Newsletter."}),n("");else throw new Error("Subscription failed")}catch{l({title:"Subscription failed",description:"There was an error subscribing to the newsletter. Please try again.",variant:"destructive"})}finally{o(!1)}};return e.jsxs(g,{id:"newsletter",className:"shadow-lg flex flex-col items-center justify-center bg-sage-700",children:[e.jsx(h,{children:e.jsx(b,{className:"text-2xl font-serif text-sage-50",children:"Newsletter Signup"})}),e.jsxs(p,{className:"w-full",children:[e.jsx("div",{id:"mlb2-13076352",className:"ml-form-embedContainer ml-subscribe-form ml-subscribe-form-13076352",children:e.jsx("div",{className:"ml-form-align-center",children:e.jsx("div",{className:"ml-form-embedWrapper embedForm",children:e.jsxs("div",{className:"ml-form-embedBody ml-form-embedBodyDefault row-form",children:[e.jsxs("div",{className:"ml-form-embedContent",children:[e.jsx("h4",{className:"text-lg font-bold mb-1 text-sage-100 font-serif",children:"The Reluctant Caregiver Newsletter"}),e.jsx("p",{className:"mb-4 text-sage-100",children:"Sign up for caregiving news, tips, and author updates from Joy Johnston."})]}),e.jsxs("form",{className:"ml-block-form",onSubmit:i,children:[e.jsx("div",{className:"ml-form-formContent",children:e.jsx("div",{className:"ml-form-fieldRow ml-last-item",children:e.jsx("div",{className:"ml-field-group ml-field-email ml-validate-email ml-validate-required",children:e.jsx("input",{"aria-label":"email","aria-required":"true",type:"email",className:"form-control w-full px-4 py-2 rounded-md border border-sage-500 bg-sage-50 text-sage-900 placeholder:text-sage-500 focus:outline-none focus:ring-2 focus:ring-sage-400",placeholder:"Email",autoComplete:"email",required:!0,value:s,onChange:c=>n(c.target.value),disabled:r})})})}),e.jsx("div",{className:"ml-form-embedSubmit",children:e.jsx("button",{type:"submit",disabled:r,className:"w-full mt-3 rounded-md bg-sage-800 hover:bg-sage-900 disabled:opacity-50 disabled:cursor-not-allowed text-sage-50 font-semibold px-3 py-2 transition-colors focus:outline-none focus:ring-2 focus:ring-sage-300",children:r?"Subscribing...":"Subscribe"})})]})]})})})}),e.jsxs("div",{className:"mt-2 text-xs text-center text-sage-100 opacity-80",children:["Powered by"," ",e.jsx("a",{href:"https://mailerlite.com/",className:"underline",target:"_blank",rel:"noopener noreferrer",children:"MailerLite"})]})]})]})},T=()=>e.jsx("section",{id:"contact",className:"py-20 bg-sage-50",children:e.jsxs("div",{className:"container mx-auto px-6",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-serif font-bold text-sage-900 mb-4",children:"Get in Touch"}),e.jsx("p",{className:"text-xl text-sage-700 max-w-2xl mx-auto",children:"Let's connect! I'm available as a source or speaker on topics ranging from caregiving to SEO."})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-12 max-w-5xl mx-auto",children:[e.jsx(N,{}),e.jsx(w,{})]})]})});export{T as default};

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.