PageSourceSearch

https://www.earswrap.com/assets/unsubscribe-BovHNnU-.js

js earswrap.com collected 2026-10-07 17:49:04 UTC 2,316 bytes, 1 lines download raw bytes

1import{bq as d,r as a,j as e}from"./index-BJpQ1SV3.js";function u(){const{token:i}=d.useSearch(),[n,r]=a.useState({kind:"loading"});a.useEffect(()=>{if(!i){r({kind:"invalid"});return}fetch(`/email/unsubscribe?token=${encodeURIComponent(i)}`).then(async t=>{const s=await t.json().catch(()=>({}));if(!t.ok){r({kind:"invalid"});return}if(s.valid===!1&&s.reason==="already_unsubscribed"){r({kind:"already"});return}if(s.valid===!0){r({kind:"confirm"});return}r({kind:"invalid"})}).catch(()=>r({kind:"error",message:"Network error"}))},[i]);async function o(){if(i){r({kind:"submitting"});try{const s=await(await fetch(`/email/unsubscribe?token=${encodeURIComponent(i)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({token:i})})).json().catch(()=>({}));s.success?r({kind:"success"}):s.reason==="already_unsubscribed"?r({kind:"already"}):r({kind:"error",message:s.error??"Something went wrong"})}catch{r({kind:"error",message:"Network error"})}}}return e.jsx("main",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:e.jsxs("div",{className:"max-w-md w-full bg-card border border-border rounded-2xl p-8 text-center shadow-sm",children:[e.jsx("h1",{className:"text-2xl font-semibold mb-3 text-foreground",children:"Unsubscribe"}),n.kind==="loading"&&e.jsx("p",{className:"text-muted-foreground",children:"Checking your link..."}),n.kind==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground mb-6",children:"Click below to unsubscribe from Earswrap emails."}),e.jsx("button",{onClick:o,className:"w-full bg-primary text-primary-foreground rounded-full py-3 font-medium hover:opacity-90 transition",children:"Confirm unsubscribe"})]}),n.kind==="submitting"&&e.jsx("p",{className:"text-muted-foreground",children:"Unsubscribing..."}),n.kind==="success"&&e.jsx("p",{className:"text-foreground",children:"You've been unsubscribed. You won't receive further emails from Earswrap."}),n.kind==="already"&&e.jsx("p",{className:"text-foreground",children:"This email is already unsubscribed."}),n.kind==="invalid"&&e.jsx("p",{className:"text-muted-foreground",children:"This unsubscribe link is invalid or has expired."}),n.kind==="error"&&e.jsx("p",{className:"text-destructive",children:n.message})]})})}export{u 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.