PageSourceSearch

https://shelbyshelter.org/assets/Unsubscribe-CY0JFFur.js

js shelbyshelter.org collected 2026-10-05 21:58:59 UTC 3,444 bytes, 1 lines download raw bytes

1import{o as u,r as n,j as e,C as x,H as h,B as b,s as f}from"./index-BPcx6MvH.js";import{L as l}from"./loader-circle-BgY0SdOs.js";import{C as o}from"./circle-check-big-DEKYNY_8.js";import{C as c}from"./circle-alert-wcH-bfIx.js";const g="https://fpiwgamxocacglswdgmm.supabase.co",p="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZwaXdnYW14b2NhY2dsc3dkZ21tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Njg0MTEwNjYsImV4cCI6MjA4Mzk4NzA2Nn0.kdOJCzlf23c3fb7oX4JQUl5h9_GIi2_B4JneJgqJC1Q",v=()=>{const[m]=u(),i=m.get("token"),[r,s]=n.useState("loading");n.useEffect(()=>{if(document.title="Unsubscribe — Shelby Shelter",!i){s("invalid");return}(async()=>{try{const t=await fetch(`${g}/functions/v1/handle-email-unsubscribe?token=${encodeURIComponent(i)}`,{headers:{apikey:p}}),a=await t.json();t.ok?a.valid===!1&&a.reason==="already_unsubscribed"?s("already"):a.valid?s("valid"):s("invalid"):s("invalid")}catch{s("error")}})()},[i]);const d=async()=>{if(i){s("submitting");try{const{data:t,error:a}=await f.functions.invoke("handle-email-unsubscribe",{body:{token:i}});if(a)throw a;t!=null&&t.success||(t==null?void 0:t.reason)==="already_unsubscribed"?s("done"):s("error")}catch{s("error")}}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-secondary/30 p-4",children:e.jsxs(x,{className:"max-w-lg w-full p-8 text-center",children:[e.jsx(h,{className:"w-12 h-12 text-primary mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Email Preferences"}),r==="loading"&&e.jsx("div",{className:"py-8",children:e.jsx(l,{className:"w-8 h-8 animate-spin mx-auto text-muted-foreground"})}),r==="valid"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground mb-6",children:"Click below to confirm you'd like to unsubscribe from Shelby Shelter emails."}),e.jsx(b,{variant:"destructive",onClick:d,size:"lg",children:"Confirm Unsubscribe"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-4",children:["You can resubscribe anytime at ",e.jsx("a",{href:"/",className:"underline",children:"shelbyshelter.org"}),"."]})]}),r==="submitting"&&e.jsx("div",{className:"py-8",children:e.jsx(l,{className:"w-8 h-8 animate-spin mx-auto text-muted-foreground"})}),r==="done"&&e.jsxs(e.Fragment,{children:[e.jsx(o,{className:"w-16 h-16 text-primary mx-auto my-4"}),e.jsx("p",{className:"text-lg font-semibold mb-2",children:"You've been unsubscribed"}),e.jsx("p",{className:"text-muted-foreground",children:"We're sorry to see you go. The animals thank you for your past support. 🐾"})]}),r==="already"&&e.jsxs(e.Fragment,{children:[e.jsx(o,{className:"w-16 h-16 text-muted-foreground mx-auto my-4"}),e.jsx("p",{className:"text-lg font-semibold",children:"Already unsubscribed"}),e.jsx("p",{className:"text-muted-foreground",children:"This email is no longer subscribed."})]}),r==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx(c,{className:"w-16 h-16 text-destructive mx-auto my-4"}),e.jsx("p",{className:"text-lg font-semibold",children:"Invalid link"}),e.jsx("p",{className:"text-muted-foreground",children:"This unsubscribe link is invalid or expired."})]}),r==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(c,{className:"w-16 h-16 text-destructive mx-auto my-4"}),e.jsx("p",{className:"text-lg font-semibold",children:"Something went wrong"}),e.jsx("p",{className:"text-muted-foreground",children:"Please try again or email [email protected]."})]})]})})};export{v 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.