PageSourceSearch

https://unbrokenbsg.com/assets/Unsubscribe-D6Z-bM2h.js

js unbrokenbsg.com collected 2026-09-25 03:01:28 UTC 4,831 bytes, 6 lines download raw bytes

1import{H as h,E as b,r as a,j as e,S as f,D as o,B as p}from"./index-zn1t1zaJ.js";import{C as l}from"./circle-check-V_8AOX5c.js";import{C as j}from"./circle-x-Byq6AmEs.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 g=h("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]),d="https://uobcqahlbsneygdowhcu.supabase.co/functions/v1/email-unsubscribe";function I(){const[u]=b(),i=u.get("token"),[t,n]=a.useState({kind:"loading"}),[c,m]=a.useState(!1);a.useEffect(()=>{if(!i){n({kind:"error",message:"Missing unsubscribe token."});return}(async()=>{try{const r=await fetch(`${d}?token=${encodeURIComponent(i)}`,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVvYmNxYWhsYnNuZXlnZG93aGN1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzYyODM3MDYsImV4cCI6MjA5MTg1OTcwNn0.x_vMcsxxEvSin6qjBH5EcZXrcyEwv72O4e3bVAbt9QM"}}),s=await r.json();if(!r.ok){n({kind:"error",message:(s==null?void 0:s.error)??"Invalid link."});return}s.used?n({kind:"already"}):n({kind:"ready",email:s.email})}catch(r){n({kind:"error",message:r.message})}})()},[i]);const x=async()=>{if(i){m(!0);try{const r=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVvYmNxYWhsYnNuZXlnZG93aGN1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzYyODM3MDYsImV4cCI6MjA5MTg1OTcwNn0.x_vMcsxxEvSin6qjBH5EcZXrcyEwv72O4e3bVAbt9QM"},body:JSON.stringify({token:i})}),s=await r.json();if(!r.ok){n({kind:"error",message:(s==null?void 0:s.error)??"Could not unsubscribe."});return}n({kind:"done",email:s.email})}finally{m(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsx(f,{title:"Unsubscribe | BSG",description:"Manage your email preferences.",canonical:"/unsubscribe",noIndex:!0}),e.jsx("section",{className:"min-h-[70vh] flex items-center justify-center px-4 py-16",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-lg",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx("div",{className:"h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(g,{className:"h-7 w-7 text-primary"})})}),t.kind==="loading"&&e.jsxs("div",{className:"text-center",children:[e.jsx(o,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Verifying your link…"})]}),t.kind==="ready"&&e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-serif text-2xl mb-2",children:"Unsubscribe from emails"}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["You're about to stop receiving emails sent to"," ",e.jsx("span",{className:"font-medium text-foreground",children:t.email}),"."]}),e.jsx(p,{onClick:x,disabled:c,className:"w-full",size:"lg",children:c?e.jsxs(e.Fragment,{children:[e.jsx(o,{className:"h-4 w-4 animate-spin mr-2"}),"Unsubscribing…"]}):"Confirm unsubscribe"}),e.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"Changed your mind? Just close this tab — nothing happens until you confirm."})]}),t.kind==="already"&&e.jsxs("div",{className:"text-center",children:[e.jsx(l,{className:"h-10 w-10 text-primary mx-auto mb-3"}),e.jsx("h1",{className:"font-serif text-2xl mb-2",children:"Already unsubscribed"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This email is no longer receiving messages from us."})]}),t.kind==="done"&&e.jsxs("div",{className:"text-center",children:[e.jsx(l,{className:"h-10 w-10 text-primary mx-auto mb-3"}),e.jsx("h1",{className:"font-serif text-2xl mb-2",children:"You're unsubscribed"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:t.email})," won't receive further emails. Need to reach us? Email"," ",e.jsx("a",{className:"underline",href:"mailto:[email protected]",children:"[email protected]"}),"."]})]}),t.kind==="error"&&e.jsxs("div",{className:"text-center",children:[e.jsx(j,{className:"h-10 w-10 text-destructive mx-auto mb-3"}),e.jsx("h1",{className:"font-serif text-2xl mb-2",children:"Link not val
6id"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.message}),e.jsxs("p",{className:"mt-4 text-xs text-muted-foreground",children:["If you keep seeing this, email"," ",e.jsx("a",{className:"underline",href:"mailto:[email protected]",children:"[email protected]"})," ","and we'll remove you manually."]})]})]})})]})}export{I 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.