1import{R as c,r as a,j as e}from"./index-jMRjrwn8.js";function l(){const{token:n}=c.useSearch(),[r,s]=a.useState("checking");a.useEffect(()=>{if(!n){s("invalid");return}(async()=>{try{const t=await fetch(`/email/unsubscribe?token=${encodeURIComponent(n)}`),i=await t.json();if(!t.ok||i.error)return s("invalid");if(i.valid===!1&&i.reason==="already_unsubscribed")return s("already");s("ready")}catch{s("invalid")}})()},[n]);const o=async()=>{if(n){s("submitting");try{const i=await(await fetch("/email/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:n})})).json();i.success?s("done"):i.reason==="already_unsubscribed"?s("already"):s("invalid")}catch{s("invalid")}}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-6 py-16",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-sm",children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground mb-2",children:"WinFlip email preferences"}),r==="checking"&&e.jsx("p",{className:"text-muted-foreground",children:"Checking your linkâ¦"}),r==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground mb-6",children:"Confirm you'd like to unsubscribe from WinFlip emails. You'll stop receiving product updates and notifications. Account-critical messages (like password resets) will still go through."}),e.jsx("button",{onClick:o,className:"w-full rounded-lg bg-primary px-4 py-3 font-medium text-primary-foreground hover:opacity-90 transition",children:"Confirm unsubscribe"})]}),r==="submitting"&&e.jsx("p",{className:"text-muted-foreground",children:"Updating your preferencesâ¦"}),r==="done"&&e.jsx("p",{className:"text-foreground",children:"You're unsubscribed. Winnie will miss you â you can always come back through your account settings."}),r==="already"&&e.jsx("p",{className:"text-foreground",children:"This address is already unsubscribed. Nothing more to do."}),r==="invalid"&&e.jsx("p",{className:"text-destructive",children:"This unsubscribe link is invalid or has expired. If you keep receiving unwanted emails, reply to any WinFlip message and we'll take care of it."})]})})}export{l 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.