1import{b8 as v,a0 as w,r as t,j as e,aP as f,aF as k,aO as C}from"./vendor-oQ3iKzUC.js";import{u as E,A as g}from"./app-dashboard-BDXKP92W.js";import"./index-Ds5Tl8B9.js";import"./app-ui-CE-hBORx.js";import"./app-frontoffice-ROqPrAti.js";function H(){const{token:a}=v(),d=w(),{t:s,currentLanguage:c}=E(),[m,b]=t.useState(!1),[x,o]=t.useState("idle"),[u,n]=t.useState(""),[h,p]=t.useState("");t.useEffect(()=>{a&&j(a)},[a]);const j=async r=>{try{const i=await g.checkUnsubscribeStatus(r);i.user_email&&p(i.user_email)}catch(i){console.error("Error fetching user info:",i)}},N=async()=>{if(a){b(!0);try{const r=await g.unsubscribeEmail(a,"all");r.status==="success"?(o("success"),n(r.message||s("dashboard.profile.unsubscribedSuccess"))):r.status==="already_unsubscribed"?(o("success"),n(r.message)):(o("error"),n(r.message||s("dashboard.profile.unsubscribeError")))}catch(r){o("error"),n(r.response?.data?.error||r.response?.data?.message||s("dashboard.profile.unsubscribeError"))}finally{b(!1)}}},y=()=>{d(`/${c}/login`)},l=()=>{d(`/${c}/`)};return a?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white p-4 sm:p-8",children:e.jsx("div",{className:"tr z-[1] w-full max-w-md rounded-[20px] bg-white px-6 py-8 shadow-lg sm:px-8 sm:py-10 sm:shadow-xl",children:x==="idle"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx("h1",{className:"font-ebGaramond text-3xl font-bold leading-[50px] text-marron sm:text-[41px]",children:s("dashboard.profile.unsubscribe")}),e.jsx("p",{className:"mt-4 font-lato text-base text-gray-600 sm:text-lg",children:s("dashboard.profile.unsubscribeConfirmation")}),h&&e.jsxs("div",{className:"mt-6 rounded-lg border border-marron bg-gray-50 p-4",children:[e.jsx("p",{className:"font-ebGaramond text-sm font-bold text-marron",children:s("dashboard.profile.emailAddress")}),e.jsx("p",{className:"mt-1 font-lato text-base text-gray-800",children:h})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("button",{onClick:N,disabled:m,className:"w-full rounded-lg bg-marron py-3 font-lato font-semibold text-white transition hover:bg-marron/90 disabled:opacity-50",children:m?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"mr-2 inline h-4 w-4 animate-spin"}),s("dashboard.profile.unsubscribing")]}):s("dashboard.profile.confirmUnsubscribe")}),e.jsx("button",{onClick:l,className:"w-full rounded-lg border-2 border-marron py-3 font-lato font-semibold text-marron transition hover:bg-gray-50",children:s("dashboard.profile.cancel")})]})]}):x==="success"?e.jsxs("div",{className:"text-center",children:[e.jsx(C,{className:"mx-auto h-16 w-16 text-marron"}),e.jsx("h1",{className:"mt-4 font-ebGaramond text-3xl font-bold text-marron",children:s("dashboard.profile.unsubscribed")}),e.jsx("p",{className:"mt-4 font-lato text-base text-gray-600",children:u}),e.jsxs("div",{className:"mt-6 space-y-3",children:[e.jsx("button",{onClick:y,className:"w-full rounded-lg bg-marron py-3 font-lato font-semibold text-white transition hover:bg-marron/90",children:s("dashboard.profile.goToLogin")}),e.jsx("button",{onClick:l,className:"w-full rounded-lg border-2 border-marron py-3 font-lato font-semibold text-marron transition hover:bg-gray-50",children:s("dashboard.profile.goToHome")})]})]}):e.jsxs("div",{className:"text-center",children:[e.jsx(f,{className:"mx-auto h-16 w-16 text-marron"}),e.jsx("h1",{className:"mt-4 font-ebGaramond text-3xl font-bold text-marron",children:s("dashboard.profile.error")}),e.jsx("p",{className:"mt-4 font-lato text-base text-gray-600",children:u}),e.jsx("button",{onClick:l,className:"mt-6 w-full rounded-lg border-2 border-marron py-3 font-lato font-semibold text-marron transition hover:bg-gray-50",children:s("dashboard.profile.goToHome")})]})})}):e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(f,{className:"mx-auto h-12 w-12 text-marron"}),e.jsx("h1",{className:"mt-4 font-ebGaramond text-3xl font-bold text-marron",children:s("dashboard.profile.invalidLink")}),e.jsx("p",{className:"mt-4 font-lato text-base text-gray-600",children:s("dashboard.profile.invali
1dLinkDescription")}),e.jsx("button",{onClick:l,className:"mt-6 rounded-lg bg-marron px-6 py-3 font-lato font-semibold text-white transition hover:bg-marron/90",children:s("dashboard.profile.goToHome")})]})})}export{H 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.