1import{T as d,r as c,j as e,S as m,s as u}from"./index-Dgv2xMGN.js";const x="https://ltwnshkruuotjdcqikgf.supabase.co",b="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imx0d25zaGtydXVvdGpkY3Fpa2dmIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzc0MTA4NTIsImV4cCI6MjA5Mjk4Njg1Mn0.CZiXizENXgdm_0E5B3OeYrzUy1t6meiSc_kQ4QWcawk",f=()=>{const[l]=d(),t=l.get("token"),[a,s]=c.useState("loading");c.useEffect(()=>{if(!t){s("invalid");return}(async()=>{try{const r=await(await fetch(`${x}/functions/v1/handle-email-unsubscribe?token=${encodeURIComponent(t)}`,{headers:{apikey:b}})).json();r.valid?s("valid"):r.reason==="already_unsubscribed"?s("already"):s("invalid")}catch{s("invalid")}})()},[t]);const o=async()=>{if(!t)return;s("confirming");const{data:i,error:r}=await u.functions.invoke("handle-email-unsubscribe",{body:{token:t}});if(r)return s("error");i!=null&&i.success?s("success"):(i==null?void 0:i.reason)==="already_unsubscribed"?s("already"):s("error")},n={loading:null,confirming:null,error:null,valid:{title:e.jsxs(e.Fragment,{children:["Unsubscribe ",e.jsx("span",{className:"italic",children:"from emails?"})]}),body:"You'll stop receiving emails from NexoMind. Account-critical messages (like password resets) will still come through."},success:{title:e.jsxs(e.Fragment,{children:["You're ",e.jsx("span",{className:"italic",children:"out."})]}),body:"We won't email you again. Take care."},already:{title:e.jsxs(e.Fragment,{children:["Already ",e.jsx("span",{className:"italic",children:"unsubscribed."})]}),body:"You won't receive any further emails from us."},invalid:{title:e.jsxs(e.Fragment,{children:["Link ",e.jsx("span",{className:"italic",children:"expired."})]}),body:"This unsubscribe link is invalid or has expired."}}[a];return e.jsxs("main",{className:"min-h-screen bg-[#F3F4ED] text-[#111] flex items-center justify-center px-6",children:[e.jsx(m,{title:"Unsubscribe from NexoMind emails",description:"Manage your NexoMind email preferences and unsubscribe from reflection reminders or product updates at any time.",noindex:!0}),e.jsxs("div",{className:"max-w-md w-full bg-white rounded-[24px] p-8 md:p-10 border border-black/5 text-center",children:[e.jsxs("p",{className:"font-instrument text-[24px] mb-6",children:["nexo",e.jsx("span",{className:"italic opacity-55",children:"mind"})]}),n&&e.jsx("h1",{className:"font-instrument text-[32px] leading-tight mb-3",children:n.title}),(n==null?void 0:n.body)&&e.jsx("p",{className:"font-barlow text-[15px] text-[#111]/65 mb-7",children:n.body}),a==="loading"&&e.jsx("p",{className:"font-barlow text-[15px] text-[#111]/65",children:"Checking your linkâ¦"}),a==="valid"&&e.jsx("button",{onClick:o,className:"bg-[#111] text-white rounded-full px-7 py-3.5 font-barlow font-medium text-[14px] hover:bg-black transition-all",children:"Confirm unsubscribe"}),a==="confirming"&&e.jsx("p",{className:"font-barlow text-[15px] text-[#111]/65",children:"Unsubscribingâ¦"}),a==="error"&&e.jsx("p",{className:"font-barlow text-[15px] text-[#111]/65",children:"Something went wrong. Please try again."})]})]})};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.