1import{c as d,ae as m,r as l,j as e,q as x,af as u,M as c,aa as h,ag as j}from"./index-C2MFVOEl.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const p=d("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),g="https://iaxyslqpcclcuskzshez.supabase.co",b="sb_publishable_PEFGXOKLtLyLn0tcv2l6Mg_0EdKlmcy",f=()=>{const[i]=m(),t=i.get("token"),[r,a]=l.useState("loading");l.useEffect(()=>{if(!t){a("invalid");return}(async()=>{try{const s=await fetch(`${g}/functions/v1/handle-email-unsubscribe?token=${encodeURIComponent(t)}`,{headers:{apikey:b}}),n=await s.json();if(!s.ok){a("invalid");return}n.valid===!1&&n.reason==="already_unsubscribed"?a("already"):n.valid===!0?a("ready"):a("invalid")}catch{a("invalid")}})()},[t]);const o=async()=>{if(t){a("submitting");try{const{data:s,error:n}=await j.functions.invoke("handle-email-unsubscribe",{body:{token:t}});if(n)throw n;s!=null&&s.success?a("success"):(s==null?void 0:s.reason)==="already_unsubscribed"?a("already"):a("error")}catch{a("error")}}};return e.jsxs("main",{className:"min-h-screen flex items-center justify-center px-4 py-16",style:{background:"var(--jn-page-bg)",color:"var(--jn-page-fg)"},children:[e.jsxs(x,{children:[e.jsx("meta",{name:"robots",content:"noindex, nofollow"}),e.jsx("link",{rel:"canonical",href:"https://justicenow.ai/unsubscribe"})]}),e.jsxs("div",{className:"w-full max-w-lg border p-10 md:p-12",style:{borderColor:"var(--jn-rule)",background:"var(--jn-warm-surface)"},children:[e.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full mb-6",style:{background:"var(--jn-page-bg)",color:"var(--jn-brand)"},children:e.jsx(u,{className:"w-5 h-5",strokeWidth:1.5})}),r==="loading"&&e.jsxs("div",{className:"flex items-center gap-3 text-sm",style:{color:"var(--jn-page-muted)"},children:[e.jsx(c,{className:"w-4 h-4 animate-spin"})," Validando enlace..."]}),r==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-3xl font-light tracking-[-0.02em] mb-3",children:"Confirmar baja"}),e.jsx("p",{className:"text-sm leading-relaxed mb-8",style:{color:"var(--jn-page-muted)"},children:"Si confirmas, dejarás de recibir correos de JusticeN
6ow en este email."}),e.jsx("button",{type:"button",onClick:o,className:"w-full px-5 py-4 text-sm font-medium tracking-wide transition-opacity hover:opacity-90",style:{background:"var(--jn-page-fg)",color:"var(--jn-page-bg)"},children:"Confirmar baja"})]}),r==="submitting"&&e.jsxs("div",{className:"flex items-center gap-3 text-sm",style:{color:"var(--jn-page-muted)"},children:[e.jsx(c,{className:"w-4 h-4 animate-spin"})," Procesando..."]}),r==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",style:{color:"var(--jn-brand)"},children:[e.jsx(h,{className:"w-5 h-5"})," ",e.jsx("span",{className:"text-[11px] uppercase tracking-[0.18em] font-medium",children:"Listo"})]}),e.jsx("h1",{className:"text-3xl font-light tracking-[-0.02em] mb-3",children:"Te has dado de baja"}),e.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--jn-page-muted)"},children:"No volverás a recibir correos de JusticeNow en este email."})]}),r==="already"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-3xl font-light tracking-[-0.02em] mb-3",children:"Ya estás dado de baja"}),e.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--jn-page-muted)"},children:"Este email ya habÃa sido eliminado de nuestra lista previamente."})]}),(r==="invalid"||r==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",style:{color:"#dc2626"},children:[e.jsx(p,{className:"w-5 h-5"})," ",e.jsx("span",{className:"text-[11px] uppercase tracking-[0.18em] font-medium",children:"Error"})]}),e.jsx("h1",{className:"text-3xl font-light tracking-[-0.02em] mb-3",children:"Enlace inválido"}),e.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--jn-page-muted)"},children:"El enlace no es válido o ha expirado. Si necesitas ayuda, escrÃbenos a [email protected]."})]})]})]})};export{f 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.