PageSourceSearch

https://adrianadesousalages.com/assets/unsubscribe-BkKCuzOi.js

js adrianadesousalages.com collected 2026-10-06 07:22:09 UTC 4,141 bytes, 1 lines download raw bytes

1import{u,r as i,j as e,L as o}from"./index-Bp246fRD.js";function h(){const{token:r}=u({from:"/unsubscribe"}),[t,s]=i.useState("loading"),[x,d]=i.useState(null),[n,c]=i.useState(!1);i.useEffect(()=>{if(!r){s("invalid");return}fetch(`/email/unsubscribe?token=${encodeURIComponent(r)}`).then(a=>a.json()).then(a=>{a.valid===!1&&a.reason==="already_unsubscribed"?s("already"):a.valid===!0?s("valid"):s("invalid")}).catch(()=>s("invalid"))},[r]);async function m(){if(r){c(!0);try{const l=await(await fetch("/email/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r})})).json();l.success?s("success"):l.reason==="already_unsubscribed"?s("already"):(s("error"),d(l.error||"Ocorreu um erro."))}catch{s("error"),d("Ocorreu um erro de rede.")}finally{c(!1)}}}return e.jsx("section",{className:"min-h-[70vh] flex items-center justify-center bg-gradient-warm px-6 py-24",children:e.jsxs("div",{className:"max-w-md w-full bg-white rounded-3xl border border-line shadow-elegant p-8 md:p-10 text-center",children:[e.jsx("div",{className:"mb-6",children:e.jsx("span",{className:"serif-italic text-gold text-xl",children:"ASL"})}),t==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"serif-display text-2xl text-emerald-deep mb-4",children:"A verificar..."}),e.jsx("p",{className:"text-ink-soft",children:"Aguarde enquanto validamos o seu pedido."})]}),t==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"serif-display text-2xl text-emerald-deep mb-4",children:"Ligação inválida"}),e.jsx("p",{className:"text-ink-soft mb-6",children:"O link de cancelamento está incorreto ou expirou. Se precisar de ajuda, contacte-nos."}),e.jsx(o,{to:"/",className:"inline-flex items-center justify-center rounded-full bg-emerald-deep text-sand px-8 py-3 text-[11px] font-bold uppercase tracking-[0.24em] hover:shadow-glow transition-shadow",children:"Voltar ao site"})]}),t==="already"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"serif-display text-2xl text-emerald-deep mb-4",children:"Já cancelado"}),e.jsx("p",{className:"text-ink-soft mb-6",children:"Este email já foi removido da nossa lista de envios."}),e.jsx(o,{to:"/",className:"inline-flex items-center justify-center rounded-full bg-emerald-deep text-sand px-8 py-3 text-[11px] font-bold uppercase tracking-[0.24em] hover:shadow-glow transition-shadow",children:"Voltar ao site"})]}),t==="valid"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"serif-display text-2xl text-emerald-deep mb-4",children:"Cancelar subscrição"}),e.jsx("p",{className:"text-ink-soft mb-8",children:"Tem a certeza de que pretende cancelar o recebimento de emails nossos?"}),e.jsx("button",{onClick:m,disabled:n,className:"w-full rounded-full bg-gold text-emerald-deep px-8 py-3 text-[11px] font-bold uppercase tracking-[0.24em] hover:bg-sand transition-colors disabled:opacity-60",children:n?"A processar...":"Confirmar cancelamento"})]}),t==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mx-auto mb-6 h-16 w-16 rounded-full bg-gold/20 text-gold grid place-items-center text-3xl",children:"✓"}),e.jsx("h1",{className:"serif-display text-2xl text-emerald-deep mb-4",children:"Subscrição cancelada"}),e.jsx("p",{className:"text-ink-soft mb-6",children:"Deixará de receber emails promocionais ou informativos. Pode voltar ao site quando quiser."}),e.jsx(o,{to:"/",className:"inline-flex items-center justify-center rounded-full bg-emerald-deep text-sand px-8 py-3 text-[11px] font-bold uppercase tracking-[0.24em] hover:shadow-glow transition-shadow",children:"Voltar ao site"})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"serif-display text-2xl text-emerald-deep mb-4",children:"Erro"}),e.jsx("p",{className:"text-ink-soft mb-6",children:x||"Ocorreu um erro inesperado. Tente novamente mais tarde."}),e.jsx("button",{onClick:m,disabled:n,className:"w-full rounded-full bg-gold text-emerald-deep px-8 py-3 text-[11px] font-bold uppercase tracking-[0.24em] hover:bg-sand transition-colors disabled:opacity-60",children:n?"A processar...":"Tentar novamente"})]})]})})}export{h 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.