import{j as e}from"./query-vendor-CZu0EHPe.js";import{f as E,r as c,R as b}from"./react-vendor-0bvDbF03.js";import{c as A,o as d,u as B,a as _,t as y,r as D,S as L,m as M,s as P}from"./index-DmqBj0U5.js";import{I as h}from"./input-DQxcCVQw.js";import{T as $}from"./textarea-DSqabm87.js";import{S as v,A as H,a as V,b as O,c as Q}from"./accordion-C4s_K-y2.js";import{F as R,X}from"./SocialIcons-DWGIwkB0.js";import{B as G}from"./BreadcrumbNavigation-D6teNZ8n.js";import{u as N}from"./i18n-vendor-Cl4-lKeC.js";import{M as z}from"./mail-CS4zEcsZ.js";import{C as J}from"./circle-check-big-D0jRH6XB.js";import"./supabase-vendor-CNV44oIa.js";import"./helmet-vendor-NlTFkN97.js";import"./index-Doa5m1Nz.js";import"./chevron-down-DHDW2a1r.js";/**
* @license lucide-react v0.554.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]],Y=A("badge-question-mark",K),Z=({className:o="",isSubmitting:t=!1})=>{const{t:l}=N("contact");return e.jsx(d,{variant:"create",type:"submit",disabled:t,leftIcon:e.jsx(v,{}),className:o,children:l(t?"form.submittingButton":"form.submitButton")})},pe=()=>{const{user:o}=B(),{t}=N("contact"),l=E(),[n,u]=c.useState({name:o?.user_metadata?.full_name||"",email:o?.email||"",subject:"",message:""}),[w,p]=c.useState(!1),[S,g]=c.useState(!1),{toast:x}=_();c.useEffect(()=>{if(l.hash!=="#faq-section")return;const s=72,a=()=>{const i=document.getElementById("faq-section");i&&window.scrollTo({top:i.getBoundingClientRect().top+window.scrollY-s,behavior:"smooth"})},r=requestAnimationFrame(()=>{setTimeout(a,100)});return()=>cancelAnimationFrame(r)},[l.hash]);const f=()=>{window.scrollTo({top:0,behavior:"smooth"})};c.useEffect(()=>{o&&u(s=>({...s,name:o.user_metadata?.full_name||s.name,email:o.email||s.email}))},[o]);const q=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),m=s=>{const{name:a,value:r}=s.target;u(i=>({...i,[a]:r}))},k=async s=>{if(s.preventDefault(),p(!0),!q(n.email)){x({title:t("toast.invalidEmail"),description:t("toast.invalidEmailDescription"),variant:"destructive"}),p(!1);return}try{console.log("Sending contact form email...",n);const{data:a,error:r}=await P.functions.invoke("send-contact-email",{body:n});if(r)throw console.error("Error invoking function:",r),r;console.log("Email sent successfully:",a),g(!0),f(),x({title:t("toast.successTitle"),description:t("toast.successDescription")})}catch(a){console.error("Error sending contact form:",a),x({title:t("toast.errorTitle"),description:t("toast.errorDescription"),variant:"destructive"})}finally{p(!1)}},j=["uniqueness","ageGroups","dyslexiaHelp","talkingHead","storyMaker","vocabulary","progressTracking","devices","pricing","support"],I=j.map(s=>({question:t(`faq.questions.${s}.question`),answer:e.jsx(e.Fragment,{children:t(`faq.questions.${s}.answer`).split("StorySparkle").map((a,r,i)=>e.jsxs(b.Fragment,{children:[a,r<i.length-1&&e.jsx(y,{variant:"inline"})]},r))})})),T=[{href:"#",Icon:R,label:"Facebook"},{href:"#",Icon:X,label:"X"}];D([{name:"Home",url:"/"},{name:"Contact",url:"/contact"}]);const C={"@context":"https://schema.org","@type":"FAQPage",mainEntity:j.map(s=>({"@type":"Question",name:t(`faq.questions.${s}.question`),acceptedAnswer:{"@type":"Answer",text:t(`faq.questions.${s}.answer`)}}))},F={"@context":"https://schema.org","@type":"ContactPage",name:"Contact StorySparkle",description:"Get in touch with StorySparkle for support, questions, or feedback about our interactive reading platform.",mainEntity:{"@type":"Organization",name:"StorySparkle",contactPoint:{"@type":"ContactPoint",contactType:"customer service",email:"support@storysparkle.org"}}};return e.jsxs("div",{className:"min-h-screen bg-page-surface",children:[e.jsx(L,{title:t("meta.title"),description:t("meta.description"),keywords:t("meta.keywords",{defaultValue:""})||void 0,canonical:"/contact",structuredData:[F,C]}),e.jsxs("div",{className:"container pt-4 pb-6 md:pt-6 md:pb-8",children:[e.jsx(G,{}),e.jsx("div",{className:"mb-6 md:mb-8",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center justify-center gap-3 md:gap-6 lg:gap-8",children:[e.jsx("div",{className:"w-32 h-32 lg:w-44 lg:h-44 flex-shrink-0",children:e.jsx(M.div,{animate:{y:[0,-8,0]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},children:e.jsx("img",{src:"https://cdn.storysparkle.org/ui_elements/Hero%20Icons/Contact.webp",alt:"Contact",className:"w-full h-full object-contain drop-shadow-2xl"})})}),e.jsxs("div",{className:"flex flex-col items-center lg:items-start text-center lg:text-left",children:[e.jsx("h1",{className:"text-[22px] lg:text-[32px] font-bold mb-4 text-ink",children:t("pageTitle")}),e.jsx("p",{className:"text-sm lg:text-xl text-nature-forest",children:t("pageSubtitle").split("StorySparkle").map((s,a,r)=>e.jsxs(b.Fragment,{children:[s,a<r.length-1&&e.jsx(y,{variant:"inline"})]},a))})]})]})}),e.jsxs("div",{className:"space-y-8 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"bg-white rounded-xl p-6 shadow-md border border-border",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx(d,{variant:"premium",href:"mailto:support@storysparkle.org?subject=Support Inquiry",leftIcon:e.jsx(z,{}),children:"support@storysparkle.org"})}),S?e.jsxs("div",{className:"bg-nature-forest/10 border border-nature-forest/30 rounded-xl p-6 text-center",children:[e.jsx("div",{className:"bg-nature-forest/20 p-3 rounded-full mx-auto w-fit mb-4",children:e.jsx(J,{className:"h-12 w-12 text-nature-forest"})}),e.jsx("h3",{className:"text-2xl font-semibold",children:t("success.title")}),e.jsx("p",{className:"text-muted-foreground mt-2 mb-6 max-w-md mx-auto",children:t("success.description")}),e.jsx(d,{variant:"create",leftIcon:e.jsx(v,{}),onClick:()=>{g(!1),u({name:o?.user_metadata?.full_name||"",email:o?.email||"",subject:"",message:""}),f()},children:t("success.sendAnotherButton")})]}):e.jsxs("form",{onSubmit:k,className:"space-y-6",children:[e.jsx("h2",{className:"text-xl font-semibold mb-4 text-center",children:t("form.title")}),e.jsxs("div",{className:"grid sm:grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"name",className:"text-sm font-medium",children:t("form.nameLabel")}),e.jsx(h,{id:"name",name:"name",placeholder:"John Doe",value:n.name,onChange:m,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"email",className:"text-sm font-medium",children:t("form.emailLabel")}),e.jsx(h,{id:"email",name:"email",type:"email",placeholder:"john@example.com",value:n.email,onChange:m,required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"subject",className:"text-sm font-medium",children:t("form.subjectLabel")}),e.jsx(h,{id:"subject",name:"subject",placeholder:"I have a question about...",value:n.subject,onChange:m,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"message",className:"text-sm font-medium",children:t("form.messageLabel")}),e.jsx($,{id:"message",name:"message",placeholder:"Type your message here...",rows:5,value:n.message,onChange:m,required:!0})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(Z,{isSubmitting:w})})]}),e.jsxs("div",{className:"mt-8 pt-6 border-t border-border",children:[e.jsx("p",{className:"text-center text-sm text-muted-foreground mb-4",children:t("socialText")}),e.jsx("div",{className:"flex justify-center gap-6",children:T.map(({href:s,Icon:a,label:r})=>e.jsx("a",{href:s,className:"hover:scale-110 transition-transform","aria-label":r,children:e.jsx(a,{alt:r})},r))})]})]}),e.jsxs("div",{id:"faq-section",className:"scroll-mt-20 bg-white rounded-xl p-6 shadow-md border border-border",children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:t("faq.title")}),e.jsx(H,{type:"single",collapsible:!0,className:"w-full",children:I.map((s,a)=>e.jsxs(V,{value:`item-${a}`,children:[e.jsx(O,{className:"text-left",children:s.question}),e.jsx(Q,{children:s.answer})]},a))}),e.jsx("div",{className:"mt-8 flex justify-center",children:e.jsx(d,{variant:"primary",onClick:f,leftIcon:e.jsx(Y,{}),children:t("faq.stillHaveQuestions")})})]})]})]})]})};export{pe as default};
//# sourceMappingURL=ContactPage-BkHCwg1Y.js.map