PageSourceSearch

https://naturerescue.org/build/routes/$locale/profile/change-email/index-CFJUCWSU.js

js naturerescue.org collected 2026-09-25 03:24:23 UTC 3,407 bytes, 1 lines download raw bytes

1import{a as D}from"/build/_shared/chunk-QGXJAMSU.js";import{a as N}from"/build/_shared/chunk-PYRW4Z6D.js";import{a as Q,b as B,c as h,d as A}from"/build/_shared/chunk-E37BRKEW.js";import{e as V}from"/build/_shared/chunk-NH5M5SP5.js";import{a as U}from"/build/_shared/chunk-Z6J2HG2B.js";import{a as X}from"/build/_shared/chunk-GRTEO3EB.js";import{b as T}from"/build/_shared/chunk-FHNQKSCA.js";import{b as F}from"/build/_shared/chunk-JWFMXZSW.js";import{h as L}from"/build/_shared/chunk-L6GH5KTC.js";import"/build/_shared/chunk-T4TFS3CC.js";import{G as E,M as p,Pa as v,Ra as I,la as c,na as q,sa as z,ua as d,w as P,x as M,z as g}from"/build/_shared/chunk-YMKKZPDR.js";import{J as x}from"/build/_shared/chunk-BEVEQTPJ.js";import{d as f}from"/build/_shared/chunk-W6WK5VNR.js";var Z=f(X());var e=f(x());var ee=a=>{var r;let{data:t}=a,u=U(a);return[{title:`${(r=t==null?void 0:t.title)!=null?r:"Unknown Title"} - ${u}`}]};function $(){var b,_;let a=v(),t=z(),u=I(),{usersLoginResult:r}=T(),o=r==null?void 0:r.user,H=A({email:h().email(a("myProfile.changeEmail.error_message")).required(a("myProfile.changeEmail.error_message")).matches(/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/,a("myProfile.changeEmail.error_lowercase")).test("uniqueEmail",a("register.profile_form.field_email_error_message_duplicated"),async i=>i&&/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/.test(i)?await G({variables:{email:i}}).then(l=>{var k,w;return(w=(k=l.data)==null?void 0:k.emailCheckUnique)!=null?w:!1}):!0),confirmEmail:h().oneOf([B("email")],a("myProfile.changeEmail.error_message")).required(a("myProfile.changeEmail.error_message")).matches(/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/,a("myProfile.changeEmail.error_lowercase"))}),{formState:{errors:s,isSubmitting:R},register:y,handleSubmit:W,watch:C,setValue:j}=V({defaultValues:{email:"",confirmEmail:""},resolver:Q(H)}),[G]=F(N),[K]=L(D),O=async i=>{var m,n;if(o!=null&&o.id){let l=await K({variables:{action:"changeEmail",email:(m=i.email)==null?void 0:m.toLowerCase(),lang:o.displayLanguage,tbId:o.tbId||""}});(n=l==null?void 0:l.data)!=null&&n.sendEmail?u("/profile/change-email/success"):t({description:a("myProfile.changeEmail.failToChange"),status:"error",isClosable:!0})}else t({description:a("myProfile.changeEmail.failToChange"),status:"error",isClosable:!0})},Y=!!C("email"),J=!!C("confirmEmail"),S=(i,m)=>{let n=i.target.value;j(m,n.toLowerCase())};return(0,e.jsx)(P,{mx:"auto",w:"full",maxW:"container.md",as:"form",onSubmit:W(O),children:(0,e.jsxs)(q,{p:4,spacing:4,alignItems:"stretch",children:[(0,e.jsxs)(c,{spacing:2,children:[(0,e.jsxs)(g,{isInvalid:!!s.email,children:[(0,e.jsxs)(c,{py:2,children:[(0,e.jsx)(d,{fontSize:"sm",children:a("myProfile.changeEmail.newEmail")}),(0,e.jsx)(p,{variant:"flushed",focusBorderColor:"teal.500",...y("email"),onChange:i=>S(i,"email")})]}),(0,e.jsx)(E,{children:(b=s.email)==null?void 0:b.message})]}),(0,e.jsxs)(g,{isInvalid:!!s.confirmEmail,children:[(0,e.jsxs)(c,{py:2,children:[(0,e.jsx)(d,{fontSize:"sm",children:a("myProfile.changeEmail.reEnter_email")}),(0,e.jsx)(p,{variant:"flushed",focusBorderColor:"teal.500",...y("confirmEmail"),onChange:i=>S(i,"confirmEmail")})]}),(0,e.jsx)(E,{children:(_=s.confirmEmail)==null?void 0:_.message})]})]}),(0,e.jsx)(M,{type:"submit",colorScheme:"teal",w:"full",mt:4,isLoading:R,isDisabled:!Y||!J,children:a("myProfile.changeEmail.confirm")})]})})}export{$ as default,ee as meta};

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.