PageSourceSearch

https://theworldyacht.com/assets/Unsubscribe-BSMWhq1u.js

js theworldyacht.com collected 2026-10-09 22:55:18 UTC 3,703 bytes, 1 lines download raw bytes

1import{f,r as a,s as j,j as e,S as g,m as w,n as y,b as N,o,t as l,p as v,L as k,B as C}from"./index-D8tRRnO5.js";import{C as S}from"./circle-check-big-CHbaFWLV.js";import{C as E}from"./circle-x-DP0V13TR.js";import{H as U}from"./house-C5x_CmdQ.js";const P=()=>{const[m]=f(),[s,n]=a.useState("loading"),[h,c]=a.useState(""),[u,x]=a.useState("");a.useEffect(()=>{const t=m.get("token");if(!t){n("error"),c("Invalid unsubscribe link. Missing token.");return}b(t)},[m]);const b=async t=>{try{const{data:i,error:F}=await j.functions.invoke("unsubscribe-newsletter",{body:{},method:"GET"}),p=`https://zxnscphfcaeaisnxzbrp.supabase.co/functions/v1/unsubscribe-newsletter?token=${encodeURIComponent(t)}`,d=await fetch(p,{method:"GET",headers:{"Content-Type":"application/json"}}),r=await d.json();if(!d.ok||r.error)throw new Error(r.error||"Failed to unsubscribe");n("success"),x(r.email||""),c(r.message||"You have been successfully unsubscribed from our newsletter.")}catch(i){console.error("Error unsubscribing:",i),n("error"),c(i.message||"Failed to unsubscribe. Please try again or contact support.")}};return e.jsxs(e.Fragment,{children:[e.jsx(g,{title:"Unsubscribe from Newsletter",description:"Manage your newsletter subscription preferences. Unsubscribe from The World of Superyachts newsletter.",canonical:"/unsubscribe",structuredData:{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:"https://theworldyacht.com"},{"@type":"ListItem",position:2,name:"Unsubscribe",item:"https://theworldyacht.com/unsubscribe"}]}}),e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-dark-900 via-dark-800 to-dark-900 flex items-center justify-center p-4",children:e.jsxs(w,{className:"max-w-md w-full bg-card border-chrome-700",children:[e.jsxs(y,{className:"text-center",children:[s==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(N,{className:"h-12 w-12 text-pulse-500 animate-spin"})}),e.jsx(o,{className:"text-2xl",children:"Processing..."}),e.jsx(l,{children:"Please wait while we unsubscribe you from our newsletter"})]}),s==="success"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(S,{className:"h-12 w-12 text-green-500"})}),e.jsx(o,{className:"text-2xl",children:"Unsubscribed Successfully"}),e.jsx(l,{children:u&&e.jsx("span",{className:"block mt-2 font-medium text-foreground",children:u})})]}),s==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(E,{className:"h-12 w-12 text-destructive"})}),e.jsx(o,{className:"text-2xl",children:"Unsubscribe Failed"}),e.jsx(l,{className:"text-destructive",children:"Something went wrong"})]})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsx("p",{className:"text-center text-muted-foreground",children:h}),s==="success"&&e.jsx("div",{className:"bg-muted/50 p-4 rounded-lg",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"You will no longer receive emails from The World of Superyachts newsletter. We're sorry to see you go!"})}),s==="error"&&e.jsx("div",{className:"bg-destructive/10 p-4 rounded-lg",children:e.jsxs("p",{className:"text-sm text-destructive",children:["If this problem persists, please contact us directly at"," ",e.jsx("a",{href:"mailto:[email protected]",className:"underline font-medium",children:"[email protected]"})]})}),e.jsx("div",{className:"pt-4",children:e.jsx(k,{to:"/",className:"block",children:e.jsxs(C,{className:"w-full",variant:"outline",children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),"Return to Homepage"]})})})]})]})})]})};export{P 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.