PageSourceSearch

https://calvinyoung.ai/assets/Unsubscribe-BO9s9zMT.js

js calvinyoung.ai collected 2026-10-05 13:25:52 UTC 3,204 bytes, 1 lines download raw bytes

1import{j as s}from"./vendor-motion-CV0WANha.js";import{f as h,r as i}from"./vendor-react-k0VQgkRk.js";import{s as x}from"./index-CSyFnivx.js";import"./vendor-supabase-BaWiknf2.js";const g=()=>{const[u]=h(),t=u.get("token"),[a,e]=i.useState("loading"),[o,c]=i.useState(!1);i.useEffect(()=>{if(!t){e("invalid");return}(async()=>{try{const d=await fetch(`https://prdymnydxldutmbgrves.supabase.co/functions/v1/handle-email-unsubscribe?token=${t}`,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InByZHltbnlkeGxkdXRtYmdydmVzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQzMzQ1MDgsImV4cCI6MjA4OTkxMDUwOH0.bIEVcN83dYwoXwFUbi009skI_eEa1fml45ndoUH7KbU"}}),b=await d.json();d.ok&&b.valid?e("valid"):b.reason==="already_unsubscribed"?e("already"):e("invalid")}catch{e("invalid")}})()},[t]);const m=async()=>{if(t){c(!0);try{const{data:l,error:r}=await x.functions.invoke("handle-email-unsubscribe",{body:{token:t}});if(r)throw r;const n=typeof l=="string"?JSON.parse(l):l;n.success?e("success"):n.reason==="already_unsubscribed"?e("already"):e("error")}catch{e("error")}finally{c(!1)}}};return s.jsx("div",{className:"min-h-screen flex items-center justify-center px-4",style:{background:"hsl(0 0% 96%)"},children:s.jsxs("div",{className:"max-w-md w-full rounded-2xl p-8 text-center",style:{background:"hsl(0 0% 100%)",boxShadow:"0 4px 40px -10px rgba(0,0,0,0.08)"},children:[a==="loading"&&s.jsx("p",{className:"text-base",style:{color:"hsl(0 0% 40%)"},children:"Verifying your request…"}),a==="valid"&&s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-2xl font-bold mb-3",style:{color:"hsl(0 0% 10%)"},children:"Unsubscribe"}),s.jsx("p",{className:"text-base mb-6",style:{color:"hsl(0 0% 40%)"},children:"Are you sure you want to unsubscribe from email notifications?"}),s.jsx("button",{onClick:m,disabled:o,className:"px-6 py-3 rounded-full text-sm font-semibold transition-opacity hover:opacity-90 disabled:opacity-60",style:{background:"hsl(221 83% 53%)",color:"white"},children:o?"Processing…":"Confirm Unsubscribe"})]}),a==="success"&&s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-2xl font-bold mb-3",style:{color:"hsl(0 0% 10%)"},children:"Unsubscribed"}),s.jsx("p",{className:"text-base",style:{color:"hsl(0 0% 40%)"},children:"You've been unsubscribed. You won't receive any more emails."})]}),a==="already"&&s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-2xl font-bold mb-3",style:{color:"hsl(0 0% 10%)"},children:"Already Unsubscribed"}),s.jsx("p",{className:"text-base",style:{color:"hsl(0 0% 40%)"},children:"You're already unsubscribed from these emails."})]}),a==="invalid"&&s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-2xl font-bold mb-3",style:{color:"hsl(0 0% 10%)"},children:"Invalid Link"}),s.jsx("p",{className:"text-base",style:{color:"hsl(0 0% 40%)"},children:"This unsubscribe link is invalid or has expired."})]}),a==="error"&&s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-2xl font-bold mb-3",style:{color:"hsl(0 0% 10%)"},children:"Something Went Wrong"}),s.jsx("p",{className:"text-base",style:{color:"hsl(0 0% 40%)"},children:"Please try again later or contact support."})]})]})})};export{g 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.