PageSourceSearch

https://petwellhk.com/assets/DeleteAccount-DKVPodVd.js

js petwellhk.com collected 2026-10-06 05:22:58 UTC 10,317 bytes, 7 lines download raw bytes

1import{r,j as e,n as se}from"./react-vendor-BDHNqS4B.js";import{b as oe}from"./Header-BkbupWq-.js";import{F as re}from"./Footer-CtylQEAH.js";import{Y as le,a5 as b,a6 as ne,a7 as ie,a8 as w,a9 as ce,aa as de,a0 as me,ab as pe,ac as ue,ad as C,ae as xe,af as ge,ag as fe,b as m,ah as E,u as he,d as Ae,I as D,B as y,n as ve}from"./main-m_sUF2N4.js";import{C as Ne}from"./checkbox-BkyFxaQM.js";import{s as v}from"./client-DdjVEhXX.js";import{T as je}from"./triangle-alert-1QSShUG6.js";import"./amplify-DYDcjoow.js";import"./chevron-right-CpkQxGj-.js";import"./check-DS0-tR9o.js";import"./tag-D40gy_Nl.js";import"./query-7-WHkg5t.js";import"./textarea-D7qsgB_p.js";import"./reportService-tEzofQZ6.js";import"./phone-B2rvvDkK.js";import"./type-CVgQCqWZ.js";import"./index-CFf87M6S.js";var R="AlertDialog",[De,Ze]=le(R,[b]),i=b(),S=t=>{const{__scopeAlertDialog:a,...s}=t,o=i(a);return e.jsx(xe,{...o,...s,modal:!0})};S.displayName=R;var ye="AlertDialogTrigger",be=r.forwardRef((t,a)=>{const{__scopeAlertDialog:s,...o}=t,l=i(s);return e.jsx(ne,{...l,...o,ref:a})});be.displayName=ye;var we="AlertDialogPortal",_=t=>{const{__scopeAlertDialog:a,...s}=t,o=i(a);return e.jsx(ge,{...o,...s})};_.displayName=we;var Ce="AlertDialogOverlay",T=r.forwardRef((t,a)=>{const{__scopeAlertDialog:s,...o}=t,l=i(s);return e.jsx(ie,{...l,...o,ref:a})});T.displayName=Ce;var u="AlertDialogContent",[Ee,Re]=De(u),Se=fe("AlertDialogContent"),P=r.forwardRef((t,a)=>{const{__scopeAlertDialog:s,children:o,...l}=t,x=i(s),c=r.useRef(null),p=w(a,c),g=r.useRef(null);return e.jsx(ce,{contentName:u,titleName:O,docsSlug:"alert-dialog",children:e.jsx(Ee,{scope:s,cancelRef:g,children:e.jsxs(de,{role:"alertdialog",...x,...l,ref:p,onOpenAutoFocus:me(l.onOpenAutoFocus,n=>{var f;n.preventDefault(),(f=g.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:n=>n.preventDefault(),onInteractOutside:n=>n.preventDefault(),children:[e.jsx(Se,{children:o}),e.jsx(Te,{contentRef:c})]})})})});P.displayName=u;var O="AlertDialogTitle",k=r.forwardRef((t,a)=>{const{__scopeAlertDialog:s,...o}=t,l=i(s);return e.jsx(pe,{...l,...o,ref:a})});k.displayName=O;var M="AlertDialogDescription",$=r.forwardRef((t,a)=>{const{__scopeAlertDialog:s,...o}=t,l=i(s);return e.jsx(ue,{...l,...o,ref:a})});$.displayName=M;var _e="AlertDialogAction",I=r.forwardRef((t,a)=>{const{__scopeAlertDialog:s,...o}=t,l=i(s);return e.jsx(C,{...l,...o,ref:a})});I.displayName=_e;var F="AlertDialogCancel",L=r.forwardRef((t,a)=>{const{__scopeAlertDialog:s,...o}=t,{cancelRef:l}=Re(F,s),x=i(s),c=w(a,l);return e.jsx(C,{...x,...o,ref:c})});L.displayName=F;var Te=({contentRef:t})=>{const a=`\`${u}\` requires a description for the component to be accessible for screen reader users.
2
3You can add a description to the \`${u}\` by passing a \`${M}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
5Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${u}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
7For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return r.useEffect(()=>{var o;document.getElementById((o=t.current)==null?void 0:o.getAttribute("aria-describedby"))||console.warn(a)},[a,t]),null},Pe=S,Oe=_,q=T,H=P,z=I,B=L,W=k,G=$;
7const ke=Pe,Me=Oe,Y=r.forwardRef(({className:t,...a},s)=>e.jsx(q,{className:m("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a,ref:s}));Y.displayName=q.displayName;const U=r.forwardRef(({className:t,...a},s)=>e.jsxs(Me,{children:[e.jsx(Y,{}),e.jsx(H,{ref:s,className:m("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a})]}));U.displayName=H.displayName;const V=({className:t,...a})=>e.jsx("div",{className:m("flex flex-col space-y-2 text-center sm:text-left",t),...a});V.displayName="AlertDialogHeader";const J=({className:t,...a})=>e.jsx("div",{className:m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});J.displayName="AlertDialogFooter";const K=r.forwardRef(({className:t,...a},s)=>e.jsx(W,{ref:s,className:m("text-lg font-semibold",t),...a}));K.displayName=W.displayName;const Q=r.forwardRef(({className:t,...a},s)=>e.jsx(G,{ref:s,className:m("text-sm text-muted-foreground",t),...a}));Q.displayName=G.displayName;const X=r.forwardRef(({className:t,...a},s)=>e.jsx(z,{ref:s,className:m(E(),t),...a}));X.displayName=z.displayName;const Z=r.forwardRef(({className:t,...a},s)=>e.jsx(B,{ref:s,className:m(E({variant:"outline"}),"mt-2 sm:mt-0",t),...a}));Z.displayName=B.displayName;const et=()=>{const{t}=he(),{toast:a}=Ae(),s=se(),[o,l]=r.useState(!1),[x,c]=r.useState(!1),[p,g]=r.useState(""),[n,f]=r.useState(""),[A,ee]=r.useState(!1),te=async()=>{var d;if(p!=="DELETE"&&p!=="刪除"){a({title:t("deleteAccount.error"),description:t("deleteAccount.confirmError"),variant:"destructive"});return}if(!A){a({title:t("deleteAccount.error"),description:t("deleteAccount.checkboxError"),variant:"destructive"});return}l(!0);try{const{data:{user:h}}=await v.auth.getUser();if(!h)throw new Error("No user found");if(n.toLowerCase().trim()!==((d=h.email)==null?void 0:d.toLowerCase().trim())){a({title:t("deleteAccount.error"),description:t("deleteAccount.emailMismatch"),variant:"destructive"}),l(!1);return}const{data:{session:N}}=await v.auth.getSession();if(!N)throw new Error("No active session");const j=await fetch("https://acyttnqicmxqrjodohud.supabase.co/functions/v1/delete-account",{method:"POST",headers:{Authorization:`Bearer ${N.access_token}`,"Content-Type":"application/json"}});if(!j.ok){const ae=await j.json();throw new Error(ae.error||"Failed to delete account")}a({title:t("deleteAccount.success"),description:t("deleteAccount.successMessage")}),await v.auth.signOut(),s("/")}catch(h){console.error("Error deleting account:",h),a({title:t("deleteAccount.error"),description:t("deleteAccount.errorMessage"),variant:"destructive"})}finally{l(!1),c(!1)}};return e.jsxs("div",{className:"min-h-screen flex flex-col",children:[e.jsx(oe,{}),e.jsx("main",{className:"flex-1 py-10 md:py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("div",{className:"bg-destructive/10 border border-destructive rounded-lg p-6 mb-8",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(je,{className:"w-6 h-6 text-destructive flex-shrink-0 mt-1"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-destructive mb-2",children:t("deleteAccount.title")}),e.jsx("p",{className:"text-foreground",children:t("deleteAccount.warning")})]})]})}),e.jsxs("div",{className:"bg-secondary rounded-2xl p-8 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:t("deleteAccount.whatHappens")}),e.jsxs("ul",{className:"space-y-3 text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-destructive mt-1",children:"•"}),e.jsx("span",{children:t("deleteAccount.consequence1")})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-destructive mt-1",children:"•"}),e.jsx("span",{children:t("deleteAccount.consequence2")})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-destructive mt-1",children:"•"}),e.jsx("span",{children:t("deleteAccount.consequence3")})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-destructive mt-1",children:"•"}),e.jsx("span",{children:t("deleteAccount.consequence4")})]})]})]}),e.jsxs("div",{className:"border-t border-border pt-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:t("deleteAccount.confirmTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:t("deleteAccount.emailLabel")}),e.jsx(D,{type:"email",value:n,onChange:d=>f(d.target.value),placeholder:t("deleteAccount.emailPlaceholder"),className:"max-w-md"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t("deleteAccount.emailHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:t("deleteAccount.typeDelete")}),e.jsx(D,{type:"text",value:p,onChange:d=>g(d.target.value),placeholder:t("deleteAccount.deletePlaceholder"),className:"max-w-xs"})]}),e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx(Ne,{id:"understood",checked:A,onCheckedChange:d=>
7ee(d)}),e.jsx("label",{htmlFor:"understood",className:"text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:t("deleteAccount.understand")})]})]})]}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsx(y,{variant:"outline",onClick:()=>s(-1),className:"flex-1",children:t("deleteAccount.cancel")}),e.jsx(y,{variant:"destructive",onClick:()=>c(!0),disabled:!p||!n||!A,className:"flex-1",children:t("deleteAccount.deleteButton")})]})]})]})})}),e.jsx(re,{}),e.jsx(ke,{open:x,onOpenChange:c,children:e.jsxs(U,{children:[e.jsxs(V,{children:[e.jsx(K,{children:t("deleteAccount.finalWarning")}),e.jsx(Q,{children:t("deleteAccount.finalWarningMessage")})]}),e.jsxs(J,{children:[e.jsx(Z,{disabled:o,children:t("deleteAccount.cancel")}),e.jsx(X,{onClick:te,disabled:o,className:"bg-destructive hover:bg-destructive/90",children:o?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"mr-2 h-4 w-4 animate-spin"}),t("deleteAccount.deleting")]}):t("deleteAccount.confirmDelete")})]})]})})]})};export{et 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.