1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="acd027df-22d4-473a-8a14-bbe60437ef12",e._sentryDebugIdIdentifier="sentry-dbid-acd027df-22d4-473a-8a14-bbe60437ef12")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7333],{67333:(e,t,s)=>{s.d(t,{A:()=>y});var o=s(37876),a=s(38383),l=s(37731),r=s(24783),n=s(82067),i=s(89099),d=s(14232),c=s(80155),u=s(94693),m=s(47374),p=s(6483),h=s(53939),v=s(14124),_=s(36905);let y=d.memo(e=>{let{translation:t,locale:s}=e,y=(0,i.useRouter)(),f=(0,a.G)(l.i),{executeRecaptcha:g}=(0,_._Y)(),[x,w]=r.Ay.useMessage(),[j,A]=(0,d.useState)(""),[b,N]=(0,d.useState)(!1),[S,P]=(0,d.useState)(!1),[O,T]=(0,d.useState)(null),[I,k]=(0,d.useState)(!1),C="updatable",z=async e=>{e.user_type="customer",e.fcm_token="fcm-token-123",x.open({key:C,type:"loading",content:null==t?void 0:t.verify_loading,duration:2}),A(e.email);try{let t=await g(v.ev.FORGOT_PASSWORD),a=await fetch(v.lJ.VERIFY_RECAPTCHA,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t})}),l=await a.json();if(!l.success)return k(!0),x.open({key:C,type:"error",content:"Captcha verification failed. Please try again.",duration:2});if(null==l?void 0:l.success)try{let t=await fetch("".concat("https://www.thegroves-sa.com/").concat(v.lJ.DATA),{method:"POST",headers:{"Content-Type":"application/json",url:v.QQ.FORGOT_PASSWORD,Authorization:f,locale:s},body:JSON.stringify({...e})}),a=await t.json();if((null==a?void 0:a.status)===!0)N(!0),x.open({key:C,type:"success",content:null==a?void 0:a.message,duration:2});else{var o;x.open({key:C,type:"error",content:(null==a?void 0:a.message)?null==a?void 0:a.message:null==a||null==(o=a.data)?void 0:o.message,duration:2})}}catch(e){console.error(e)}}catch(e){console.error("Error verifying reCAPTCHA:",e),x.open({key:C,type:"error",content:"Something went wrong. Please try again.",duration:2})}},F=async e=>{try{let a=await fetch("".concat("https://www.thegroves-sa.com/","api/data"),{method:"POST",headers:{"Content-Type":"application/json",url:"verify/otp",Authorization:f,locale:s},body:JSON.stringify({...e,email:j})}),l=await a.json();if((null==l?void 0:l.status)===!0)x.open({key:C,type:"success",content:null==t?void 0:t.otp_success,duration:2}),T(null==e?void 0:e.otp),N(!1),P(!0);else{var o;x.open({key:C,type:"error",content:null!=(o=null==l?void 0:l.message)?o:null==t?void 0:t.otp_matched,duration:2})}}catch(e){console.error(e)}},R=async e=>{let{check_password:s,password:o}=e;if(s!==o)return void x.open({key:C,type:"error",content:null==t?void 0:t.password_not_match,duration:2});x.open({key:C,type:"loading",content:null==t?void 0:t.verify_loading,duration:10});try{let t=await fetch("".concat("https://www.thegroves-sa.com/","api/data"),{method:"POST",headers:{"Content-Type":"application/json",url:"reset/password",Authorization:f,locale:null==y?void 0:y.locale},body:JSON.stringify({...e,otp:O,email:j})}),s=await t.json();if((null==s?void 0:s.status)===!0)x.open({key:C,type:"success",content:null==s?void 0:s.message,duration:2}),y.push("/login");else{var a,l;x.open({key:C,type:"error",content:(null==s?void 0:s.message)?null==s?void 0:s.message:null==s||null==(l=s.error)||null==(a=l.password)?void 0:a.map(e=>e).join(", "),duration:2})}}catch(e){console.error(e)}};return(0,o.jsxs)(o.Fragment,{children:[b?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"text-center custom_form small",style:{marginBottom:20},children:[(0,o.jsx)(m.A,{text:null==t?void 0:t.otp_text,className:"playfair form_heading"}),(0,o.jsx)(p.A,{text:null==t?void 0:t.otp_description,className:"playfair "})]}),(0,o.jsxs)(n.A,{layout:"vertical",className:"custom_form small ".concat("ar_"===s?"rtl":""),onFinish:F,children:[(0,o.jsx)(n.A.Item,{name:"otp",rules:[e=>{let{getFieldValue:s}=e;return{validator(e,o){let a=s("otp");return v.QL.ONLY_NUMBER_WITHOUT_PLUS.test(a)?Promise.resolve():Promise.reject(null==t?void 0:t.otp_rule)}}}],children:(0,o.jsx)(u.A,{placeholder:null==t?void 0:t.otp_placeholder,type:"custom-input",n
1ame:"otp",maxLength:4})}),(0,o.jsx)(n.A.Item,{children:(0,o.jsx)(c.A,{text:null==t?void 0:t.otp_button_text,textSize:"small",className:"horizontal",type:"submit"})})]})]}):S?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"text-center small",children:[(0,o.jsx)(m.A,{text:null==t?void 0:t.reset_password_text,className:"playfair form_heading"}),(0,o.jsx)("div",{style:{marginTop:30}})]}),(0,o.jsxs)(n.A,{layout:"vertical",className:"custom_form small ".concat("ar_"===s?"rtl":""),onFinish:R,children:[(0,o.jsx)(n.A.Item,{name:"password",rules:[{validator:async(e,s)=>(0,h.sl)(s)?s.length<10?Promise.reject(null==t?void 0:t.password_check_rule):Promise.resolve():Promise.reject(null==t?void 0:t.invalid_password_format)},{required:!0,message:null==t?void 0:t.password_rule}],children:(0,o.jsx)(u.A,{placeholder:null==t?void 0:t.password,type:"password",name:"password"})}),(0,o.jsx)(n.A.Item,{name:"check_password",rules:[{validator:async(e,s)=>s.match(/^(?=.*[a-zA-Z])(?=.*[0-9])/)?s.length<10?Promise.reject(null==t?void 0:t.password_check_rule):Promise.resolve():Promise.reject(null==t?void 0:t.invalid_password_format)},{required:!0,message:null==t?void 0:t.password_rule}],children:(0,o.jsx)(u.A,{placeholder:null==t?void 0:t.confirm_password,type:"password",name:"check_password"})}),(0,o.jsx)(n.A.Item,{children:(0,o.jsx)(c.A,{text:null==t?void 0:t.new_password_text,textSize:"small",className:"horizontal",type:"submit"})})]})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"text-center custom_form ",children:[(0,o.jsx)(m.A,{text:null==t?void 0:t.forgot_password_text,className:"playfair form_heading"}),(0,o.jsx)(p.A,{text:null==t?void 0:t.forgot_password_description,className:"playfair form_heading"})]}),(0,o.jsx)("div",{style:{marginBottom:20}}),(0,o.jsxs)(n.A,{layout:"vertical",className:"custom_form small ".concat("ar_"===s?"rtl":""),onFinish:z,children:[(0,o.jsx)(n.A.Item,{name:"email",rules:[{type:"email",message:null==t?void 0:t.email_rule},{required:!0,message:null==t?void 0:t.email_rule_req}],children:(0,o.jsx)(u.A,{placeholder:null==t?void 0:t.email_address,type:"email",name:"email"})}),(0,o.jsx)(n.A.Item,{children:(0,o.jsx)(c.A,{text:null==t?void 0:t.forgot_password_button_text,textSize:"small",className:"horizontal",type:"submit",disabled:I})})]})]}),w]})})}}]);
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.