PageSourceSearch

https://thechaincademy.com/assets/Unsubscribe-Qg_xVn0l.js

js thechaincademy.com collected 2026-10-05 22:45:03 UTC 4,381 bytes, 11 lines download raw bytes

1import{c as m,l as b,i as f,r as o,j as e,B as g}from"./index-CNPsGjEa.js";import{S as p}from"./SEO-BK0024z7.js";import{s as y}from"./client-BomsTZso.js";import{L as l}from"./loader-circle-B_Dgc8V5.js";import{C as d}from"./circle-check-big-B5ETXx7f.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 u=m("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const j=m("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"}]]),v="https://nfbvydepyixhzmxilube.supabase.co",N="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5mYnZ5ZGVweWl4aHpteGlsdWJlIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjA2MTkzMjUsImV4cCI6MjA3NjE5NTMyNX0.SGQndn_UengHDMLFCSkFx3WP0e070vm5pEabLv0nqnc",F=()=>{const{t:c}=b(),[x]=f(),t=x.get("token"),[a,s]=o.useState("loading");o.useEffect(()=>{if(!t){s("invalid");return}(async()=>{try{const n=await fetch(`${v}/functions/v1/handle-email-unsubscribe?token=${t}`,{headers:{apikey:N}}),i=await n.json();
11n.ok?i.valid===!1&&i.reason==="already_unsubscribed"?s("already_unsubscribed"):i.valid?s("valid"):s("invalid"):s("invalid")}catch{s("invalid")}})()},[t]);const h=async()=>{s("confirming");try{const{data:r,error:n}=await y.functions.invoke("handle-email-unsubscribe",{body:{token:t}});n?s("error"):r!=null&&r.success?s("success"):(r==null?void 0:r.reason)==="already_unsubscribed"?s("already_unsubscribed"):s("error")}catch{s("error")}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:[e.jsx(p,{title:c("seo.unsubscribe.title"),description:c("seo.unsubscribe.description"),canonicalUrl:"/unsubscribe",noIndex:!0}),e.jsxs("div",{className:"max-w-md w-full text-center space-y-6",children:[a==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"h-12 w-12 animate-spin text-primary mx-auto"}),e.jsx("p",{className:"text-muted-foreground",children:"Validating your request..."})]}),a==="valid"&&e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"h-12 w-12 text-primary mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Unsubscribe from emails"}),e.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to unsubscribe? You will no longer receive email notifications from Chaincademy."}),e.jsx(g,{onClick:h,variant:"destructive",size:"lg",children:"Confirm Unsubscribe"})]}),a==="confirming"&&e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"h-12 w-12 animate-spin text-primary mx-auto"}),e.jsx("p",{className:"text-muted-foreground",children:"Processing your request..."})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"h-12 w-12 text-green-500 mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"You have been unsubscribed"}),e.jsx("p",{className:"text-muted-foreground",children:"You will no longer receive email notifications from Chaincademy."})]}),a==="already_unsubscribed"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"h-12 w-12 text-muted-foreground mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Already unsubscribed"}),e.jsx("p",{className:"text-muted-foreground",children:"This email address has already been unsubscribed."})]}),a==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"h-12 w-12 text-destructive mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Invalid link"}),e.jsx("p",{className:"text-muted-foreground",children:"This unsubscribe link is invalid or has expired."})]}),a==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"h-12 w-12 text-destructive mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Something went wrong"}),e.jsx("p",{className:"text-muted-foreground",children:"We could not process your request. Please try again later."})]})]})]})};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.