PageSourceSearch

https://keamusic.com/assets/newsletter-dialog-nPZeHx0I.js

js keamusic.com collected 2026-10-04 17:41:52 UTC 4,476 bytes, 1 lines download raw bytes

1import{c as w,r as n,j as e}from"./index-Bv7qqn-R.js";import{supabase as k}from"./client-CxLWlh71.js";import{t as i}from"./index-4S3XS5NS.js";import{u as D}from"./useServerFn-DPjAyI5p.js";import{c as S}from"./createServerFn-CNaXDLSn.js";import{D as _,c as T,a as C,d as E,b as z,e as L}from"./dialog-YLu9hl20.js";import{o as R,l as p,s as x}from"./types-BQL9YFC3.js";const F=S({method:"POST"}).handler(w("7b5c4725109c15c2025e55048f38a4b7084a905e6b724a5a2108e3191e902391")),M=R({first_name:x().trim().max(100).optional().or(p("")),email:x().trim().email("Email invalide").max(255),consent:p(!0,{errorMap:()=>({message:"Le consentement RGPD est obligatoire"})})});function K({trigger:o,source:f="site",open:g,onOpenChange:l}){const[b,h]=n.useState(!1),j=g??b,v=D(F),c=t=>{l?l(t):h(t)},[m,d]=n.useState(!1),[N,u]=n.useState(!1),y=async t=>{t.preventDefault();const a=new FormData(t.currentTarget),r=M.safeParse({first_name:a.get("first_name")||"",email:a.get("email"),consent:a.get("consent")==="on"});if(!r.success){i.error(r.error.issues[0]?.message??"Formulaire invalide");return}d(!0);try{await v({data:{prenom:r.data.first_name||null,email:r.data.email,consentement:r.data.consent}});const{error:s}=await k.from("newsletter_subscribers").insert({first_name:r.data.first_name||null,email:r.data.email.toLowerCase(),consent_given:!0,source:f});s&&s.code!=="23505"&&console.error("Newsletter database error",s),u(!0),i.success("Merci, votre inscription est bien enregistrée.")}catch(s){console.error("Webhook Make error",s),i.error("Une erreur est survenue. Réessayez plus tard.")}finally{d(!1)}};return e.jsxs(_,{open:j,onOpenChange:t=>{c(t),t||setTimeout(()=>u(!1),200)},children:[o?e.jsx(T,{asChild:!0,children:o}):null,e.jsxs(C,{className:"max-w-lg bg-ivory",children:[e.jsxs(E,{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider-kea text-bronze",children:"Lettre KEA"}),e.jsxs(z,{className:"font-serif text-3xl leading-tight",children:["La lettre ",e.jsx("em",{className:"font-display",children:"saisonnière"})]}),e.jsx(L,{className:"text-[14px] leading-relaxed text-muted-foreground",children:"Quatre rendez-vous par an. Immersions à venir, nouvelles créations, ouvertures de réservations, publications et correspondances sensibles autour du son, du souffle et du vivant. Une lettre rare, pensée sans agitation ni sollicitation commerciale."})]}),N?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx("div",{className:"font-serif text-2xl",children:"Merci."}),e.jsx("p",{className:"mt-3 text-[14px] text-muted-foreground",children:"Votre inscription est enregistrée. Vous pourrez vous désinscrire à tout moment depuis chaque envoi."})]}):e.jsxs("form",{onSubmit:y,className:"mt-2 space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"text-[11px] uppercase tracking-wider-kea text-foreground/70",children:["Prénom ",e.jsx("span",{className:"text-foreground/70",children:"(facultatif)"})]}),e.jsx("input",{name:"first_name",type:"text",maxLength:100,autoComplete:"given-name",className:"mt-2 w-full border-b border-foreground
1/20 bg-transparent px-0 py-2 text-[15px] outline-none focus:border-bronze"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] uppercase tracking-wider-kea text-foreground/70",children:"Email"}),e.jsx("input",{name:"email",type:"email",required:!0,maxLength:255,autoComplete:"email",className:"mt-2 w-full border-b border-foreground/20 bg-transparent px-0 py-2 text-[15px] outline-none focus:border-bronze"})]}),e.jsxs("label",{className:"flex items-start gap-3 pt-2 text-[12px] leading-relaxed text-muted-foreground",children:[e.jsx("input",{name:"consent",type:"checkbox",required:!0,className:"mt-1 h-4 w-4 shrink-0 accent-foreground"}),e.jsx("span",{children:"J’accepte de recevoir la lettre saisonnière KEA. Je peux me désinscrire à tout moment."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-4 pt-4",children:[e.jsx("button",{type:"button",onClick:()=>c(!1),className:"text-[12px] uppercase tracking-wider-kea text-foreground/70 hover:text-foreground",children:"Annuler"}),e.jsxs("button",{type:"submit",disabled:m,className:"inline-flex items-center gap-2 rounded-full bg-foreground px-7 py-3 text-[12px] uppercase tracking-wider-kea text-primary-foreground transition-transform hover:-translate-y-0.5 disabled:opacity-60",children:[m?"Envoi…":"Rejoindre la lettre",e.jsx("span",{"aria-hidden":!0,children:"→"})]})]})]})]})]})}export{K as N};

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.