PageSourceSearch

https://proficienthomefinance.com/assets/unsubscribe-BYa5SO38.js

js proficienthomefinance.com collected 2026-10-04 17:55:44 UTC 3,408 bytes, 1 lines download raw bytes

1import{D as m,r as o,j as e}from"./index-DWMXDMG-.js";import{P as f}from"./PageShell-CYLBJ8Or.js";import{B as h}from"./button-BdlQt-a0.js";import{L as x}from"./label-0kvb6gbM.js";import"./phone-Bhc_6Y7D.js";import"./user-CVuIe9AH.js";import"./index-C2_ke3Oo.js";import"./clsx-B-dksMZM.js";function w(){const{token:n,list:u}=m({from:"/unsubscribe"}),[t,s]=o.useState({status:"loading"}),[i,d]=o.useState("");o.useEffect(()=>{if(!n){s({status:"invalid"});return}let r=!1;return(async()=>{try{const a=await fetch(`/email/unsubscribe?token=${encodeURIComponent(n)}`);if(r)return;if(!a.ok){s({status:"invalid"});return}const l=await a.json();l.valid===!0?s({status:"valid"}):l.reason==="already_unsubscribed"?s({status:"already"}):s({status:"invalid"})}catch{r||s({status:"error",message:"Network error"})}})(),()=>{r=!0}},[n]);async function c(){if(n){s({status:"submitting"});try{const a=await(await fetch("/email/unsubscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:n,list:u??"marketing",reason:i||void 0})})).json().catch(()=>({}));a.success?s({status:"done"}):a.reason==="already_unsubscribed"?s({status:"already"}):s({status:"error",message:a.error??"Could not process request"})}catch{s({status:"error",message:"Network error"})}}}return e.jsx(f,{children:e.jsxs("section",{className:"mx-auto max-w-xl px-4 py-20 text-center",children:[e.jsx("h1",{className:"font-serif text-3xl font-semibold text-foreground",children:"Email preferences"}),t.status==="loading"&&e.jsx("p",{className:"mt-6 text-muted-foreground",children:"Checking your link…"}),t.status==="valid"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-6 text-muted-foreground",children:"Click below to unsubscribe this email address from Proficient Home Finance messages. You can still reach out to us at any time."}),e.jsxs("div",{className:"mt-8 text-left",children:[e.jsx(x,{htmlFor:"reason",className:"text-sm font-medium",children:"Optional: tell us why (helps us improve)"}),e.jsxs("select",{id:"reason",value:i,onChange:r=>d(r.target.value),className:"mt-2 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"",children:"Prefer not to say"}),e.jsx("option",{value:"too_frequent",children:"Too many emails"}),e.jsx("option",{value:"not_relevant",children:"Not relevant to me anymore"}),e.jsx("option",{value:"never_signed_up",children:"I never signed up"}),e.jsx("option",{value:"found_alternative",children:"Found a different lender"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsx("div",{className:"mt-8",children:e.jsx(h,{onClick:c,size:"lg",children:"Confirm unsubscribe"})})]}),t.status==="submitting"&&e.jsx("p",{className:"mt-6 text-muted-foreground",children:"Processing…"}),t.status==="done"&&e.jsx("p",{className:"mt-6 text-muted-foreground",children:"You've been unsubscribed. We're sorry to see you go."}),t.status==="already"&&e.jsx("p",{className:"mt-6 text-muted-foreground",children:"This address is already unsubscribed — no further action needed."}),t.status==="invalid"&&e.jsx("p",{className:"mt-6 text-muted-foreground",children:"This unsubscribe link is invalid or has expired. If you'd still like to opt out, please reply to one of our emails and we'll handle it manually."}),t.status==="error"&&e.jsx("p",{className:"mt-6 text-destructive",children:t.message})]})})}export{w as component};

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.