PageSourceSearch

https://itembo.com/assets/NewsletterUnsubscribe-C3RgauVJ.js

js itembo.com collected 2026-10-02 23:52:30 UTC 3,966 bytes, 2 lines download raw bytes

1import{j as e}from"./vendor-ui-core-f4RPl4TF.js";import{h as f,r as t}from"./vendor-react-DzMUrXFC.js";import{b6 as h,B as o,x as g,K as j,N as v,O as l,s as y}from"./main-COU9NYKu.js";import{T as N}from"./textarea-CwNxo5Gp.js";import"./vendor-supabase-B3U3ReBo.js";import"./vendor-query-CelRYDLG.js";import"./vendor-charts-w47NHhQX.js";import"./vendor-ui-extra-gWUI_Cot.js";import"./vendor-motion-DTL9cwpm.js";import"./vendor-forms-BIjZt7Hz.js";const T=()=>{const[a]=f(),[r,c]=t.useState(""),[m,p]=t.useState(""),[u,d]=t.useState(!1),[i,n]=t.useState("idle");t.useEffect(()=>{const s=a.get("email");s&&c(s)},[a]);const b=async()=>{if(!r||!r.includes("@")){l({title:"Invalid Email",description:"Please provide a valid email address.",variant:"destructive"});return}d(!0);try{const{data:s,error:x}=await y.functions.invoke("unsubscribe-newsletter",{body:{email:r,reason:m}});if(x)throw x;if(s!=null&&s.success)n("success"),l({title:"Successfully Unsubscribed",description:s.message,variant:"success"});else throw new Error((s==null?void 0:s.error)||"Failed to unsubscribe")}catch(s){console.error("Unsubscribe error:",s),n("error"),l({title:"Unsubscribe Failed",description:s.message||"An error occurred while processing your request.",variant:"destructive"})}finally{d(!1)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",children:e.jsxs("div",{className:"max-w-md w-full bg-card rounded-lg p-8 border",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Unsubscribe from Newsletter"}),e.jsx("p",{className:"text-muted-foreground",children:"We're sorry to see you go. You can unsubscribe from our newsletter below."})]}),i==="idle"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(h,{htmlFor:"email",children:"Email Address"}),e.jsx("input",{id:"email",type:"email",value:r,onChange:s=>c(s.target.value),className:"w-full mt-1.5 px-3 py-2 bg-background border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-primary",placeholder:"[email protected]",disabled:!!a.get("email")})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"reason",children:"Reason for Unsubscribing (Optional)"}),e.jsx(N,{id:"reason",value:m,onChange:s=>p(s.target.value),className:"w-full mt-1.5 min-h-[100px]",placeholder:"Help us improve by sharing why you're unsubscribing..."})]}),e.jsx(o,{onClick:b,disabled:u||!r,className:"w-full",children:u?e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):"Unsubscribe"})]}),i==="success"&&e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(j,{className:"h-16 w-16 text-green-500 mx-auto"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Successfully Unsubscribed"}),e.jsx("p",{className:"text-muted-foreground",children:"You have been removed from our newsletter mailing list. You won't receive any more emails from us."})]}),e.jsx(o,{onClick:()=>window.location.href="/",variant:"outline",className:"mt-4",children:"Return to Home"})]}),i==="error"&&e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(v,{className:"h-16 w-16 text-destructive mx-auto"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Unsubscribe Failed"}),e.jsx("p",{className:"text-muted-foreground",children:"There was an error processing your request. Please try again or contact support."})]}),e.jsx(o,{onClick:()=>n("idle"),variant:"outline",className:"mt-4",children:"Try Again"})]}),e.jsx("div",{className:"mt-8 pt-6 border-t text-center text-sm text-muted-foreground",children:e.jsxs("p",{children:["If you have any questions, please contact us at","",e.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})]})})]})})};export{T as default};
2//# sourceMappingURL=NewsletterUnsubscribe-C3RgauVJ.js.map

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.