1import{r as t,j as e,H as M,L as m,w as P,B as b,$ as c,a0 as g,a2 as O,J as d,I as j}from"./index-CwRyDTkN.js";import{z as r}from"./index-DXqQCM1T.js";import{S as U}from"./shield-off-DjLkUzIo.js";const a="GentleBirth",A=r.object({full_name:r.string().trim().max(120).optional().or(r.literal("")),phone_e164:r.string().trim().regex(/^\+[1-9]\d{6,14}$/,{message:"Enter your phone in E.164 format, e.g. +14155552671"}),reason:r.string().trim().max(500).optional().or(r.literal(""))});function B(){const[l,y]=t.useState(""),[n,N]=t.useState(""),[i,v]=t.useState(""),[u,h]=t.useState(!1),[w,S]=t.useState(!1),[_,x]=t.useState(null),k=t.useMemo(()=>typeof navigator<"u"?navigator.userAgent:"",[]),C=t.useMemo(()=>typeof window<"u"?window.location.href:"",[]);t.useEffect(()=>{fetch("https://api.ipify.org?format=json").then(s=>s.json()).then(s=>x(s.ip)).catch(()=>x(null))},[]);const F=async s=>{var f;s.preventDefault();const p=A.safeParse({full_name:l,phone_e164:n,reason:i});if(!p.success){d.error(((f=p.error.issues[0])==null?void 0:f.message)??"Please check the form");return}h(!0);try{const{error:o}=await j.from("sms_opt_outs").insert({full_name:l.trim()||null,phone_e164:n.trim(),reason:i.trim()||null,source:"web_form",ip_address:_,user_agent:k,source_url:C});if(o)throw o;await j.from("sms_consents").update({opted_out:!0,opted_out_at:new Date().toISOString()}).eq("phone_e164",n.trim()),S(!0),d.success("You've been unsubscribed from SMS messages.")}catch(o){console.error(o),d.error("Something went wrong. Please try again or reply STOP to any text.")}finally{h(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(M,{children:[e.jsxs("title",{children:["SMS Unsubscribe | ",a]}),e.jsx("meta",{name:"description",content:`Unsubscribe your phone number from ${a} text messages. Free, instant, and TCPA-compliant.`}),e.jsx("link",{rel:"canonical",href:"https://gentlebirth.com/sms-opt-out"}),e.jsx("meta",{name:"robots",content:"noindex,follow"})]}),e.jsx("main",{className:"min-h-screen bg-background py-16 px-4",children:e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsxs("div",{className:"mb-8 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive",children:e.jsx(U,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-semibold text-foreground",children:"Unsubscribe from SMS"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stop receiving text messages from ",a,"."," ",e.jsx(m,{to:"/sms-consent",className:"underline text-primary font-medium",children:"Want to opt in instead?"})]})]})]}),w?e.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 text-primary",children:e.jsx(P,{className:"h-6 w-6"})}),e.jsx("h2",{className:"mb-2 text-xl font-semibold text-foreground",children:"You're unsubscribed"}),e.jsxs("p",{className:"mb-6 text-sm text-muted-foreground",children:["We've recorded your request and will stop sending SMS messages to"," ",e.jsx("span",{className:"font-medium text-foreground",children:n}),". It may take up to 24 hours for any in-flight messages to clear."]}),e.jsx(b,{asChild:!0,variant:"outline",children:e.jsx(m,{to:"/",children:"Back to home"})})]}):e.jsxs("form",{onSubmit:F,className:"space-y-6 rounded-lg border border-border bg-card p-6",children:[e.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-4 text-sm text-muted-foreground",children:[e.jsx("p",{className:"mb-2 font-medium text-foreground",children:"The fastest way to unsubscribe"}),e.jsxs("p",{children:["Reply ",e.jsx("span",{className:"font-mono font-semibold",children:"STOP"})," to any text message you've received from ",a,". You'll be opted out automatically and won't be charged."]}),e.jsx("p",{className:"mt-2",children:"Prefer to do it here? Fill out the form below â it works the same way."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(c,{htmlFor:"phone",children:["Mobile number ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(g,{id:"phone",type:"tel",inputMode:"tel",autoComplete:"tel",placeholder:"+14155552671",value:n,onChange:s=>N(s.target.value),required:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use international format with country code (E.164)."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"name",children:"Full name (optional)"}),e.jsx(g,{id:"name",type:"text",autoComplete:"name",value:l,onCh
1ange:s=>y(s.target.value),maxLength:120})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"reason",children:"Reason (optional)"}),e.jsx(O,{id:"reason",value:i,onChange:s=>v(s.target.value),maxLength:500,placeholder:"Help us improve â let us know why you're opting out."})]}),e.jsx(b,{type:"submit",className:"w-full",disabled:u,children:u?"Unsubscribing...":"Unsubscribe my number"}),e.jsxs("p",{className:"text-center text-xs text-muted-foreground",children:["Looking to opt back in?"," ",e.jsx(m,{to:"/sms-consent",className:"underline",children:"Re-subscribe here"}),"."]})]})]})})]})}export{B 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.