(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3949],{9936:function(t,e,n){Promise.resolve().then(n.bind(n,2344))},9115:function(t,e,n){"use strict";var s=n(7437);n(2265),e.Z=function(t){let{text:e,customClass:n}=t;return(0,s.jsx)("p",{className:"text-darkBrown font-bold text-2xl font-GeneralSans tracking-tight ".concat(n),children:e})}},2150:function(t,e,n){"use strict";var s=n(7437);n(2265),e.Z=function(t){let{text:e,customClass:n}=t;return(0,s.jsx)("p",{className:" text-textBlackLight font-[400] font-GeneralSans text-base ".concat(n),children:e})}},2344:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return w}});var s=n(7437),r=n(6648),a=n(2265),o=n(9115),i=n(2150),c={src:"/_next/static/media/telephone.e7bc13ff.svg",height:24,width:24,blurWidth:0,blurHeight:0},u=n(5136),l=n(6486),d=n(8702),x=n(5080),p=n(7568),h=n(1213),f=n(3559),m=n(1890),g=n(6463),v=n(7896),w=function(){let t=(0,g.useRouter)(),[e,n]=(0,a.useState)(""),[w,j]=(0,a.useState)(""),[b,y]=(0,a.useState)(!1),[Z,N]=(0,a.useState)(!1);m.v.use.updateUser();let[k,E]=(0,a.useState)({emailError:"",passwordError:""});return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-6 md:px-8 ",children:(0,s.jsx)(o.Z,{text:"Log in"})}),(0,s.jsx)("div",{className:"pt-[6px] px-6 md:px-8 ",children:(0,s.jsx)(i.Z,{text:"Welcome back to sharesell"})}),(0,s.jsxs)("div",{id:"change to phonenumber",className:"  px-6 md:px-8 w-full mb-8 flex justify-between items-center py-8 border-solid border-b-[1px]",children:[(0,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsx)(r.default,{src:c,alt:"whatsapp icon",className:" w-[20px]"}),(0,s.jsx)("p",{className:" text-textBlackMedium font-semibold",onClick:()=>N(!Z),children:Z?"Login with phone number":"Login with email"})]}),(0,s.jsx)(r.default,{src:u.Z,alt:"foward-icon"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-6 md:px-8",children:(0,s.jsx)(p.Z,{inputs:[(0,s.jsx)(x.Z,{onChange:t=>{n(t)},initialValue:"",type:Z?"text":"email",placeHolder:Z?"Enter your Phone number":"Enter your Email",label:Z?"Phone number":"Email",error:k.emailError},Z?"phone":"email"),(0,s.jsx)(x.Z,{onChange:t=>{j(t)},initialValue:"",type:"password",placeHolder:"Enter password",label:"Password",error:k.passwordError},"password")],submitButton:(0,s.jsx)(l.Z,{text:"Log in",onClick:()=>{0===(0,f.Le)(e).length&&0===(0,f.ym)(w).length?(y(!0),(0,h.UD)({email:e,password:w},e=>{t.push("/"),y(!1)},t=>{var e,n;console.log(t),(0,v.x)("error",null==t?void 0:null===(n=t.response)||void 0===n?void 0:null===(e=n.data)||void 0===e?void 0:e.message),y(!1)}),t.push("/")):E(t=>({...t,emailError:(0,f.Le)(e),passwordError:(0,f.ym)(w)}))},loading:b}),submitFunction:()=>{}})}),(0,s.jsx)("div",{id:"forgot password",className:"flex justify-center px-6 md:px-8 pt-8 pb-12",children:(0,s.jsx)(d.Z,{text:"I forgot my password",route:"/authentication/forgot-password"})}),(0,s.jsx)("div",{id:"forgot password",className:"flex justify-center pb-12 px-6 md:px-8",children:(0,s.jsxs)("p",{className:"leading-tight text-textGreyLight",children:["Don’t have an account?"," ",(0,s.jsx)("span",{children:(0,s.jsx)(d.Z,{text:"Create Account",route:"/authentication/signup",customClass:" font-semibold"})})]})})]})]})}},7568:function(t,e,n){"use strict";var s=n(7437);n(2265),e.Z=function(t){let{inputs:e,submitButton:n,submitFunction:r}=t;return(0,s.jsxs)("form",{onSubmit:r,className:"flex flex-col gap-4",children:[...e,(0,s.jsx)("div",{className:"pt-2 mb:pt-4",children:n})]})}},8702:function(t,e,n){"use strict";var s=n(7437),r=n(7138);n(2265),e.Z=function(t){let{text:e,route:n,customClass:a}=t;return(0,s.jsx)(r.default,{href:n,className:" text-lightBrown text-lg ".concat(a),children:e})}},6463:function(t,e,n){"use strict";var s=n(1169);n.o(s,"useRouter")&&n.d(e,{useRouter:function(){return s.useRouter}})},1213:function(t,e,n){"use strict";n.d(e,{Cp:function(){return p},ND:function(){return c},Tc:function(){return l},UD:function(){return x},Yd:function(){return u},ju:function(){return h},t_:function(){return d},uP:function(){return f}});var s=n(9733),r=n(6923),a=n(5184),o=n(7896),i=n(2538);async function c(t,e,n){try{let a=await s.Z.post("auth/send-otp",t);return(0,r.s)(a,e,n,!0),a}catch(t){(0,o.x)("error",[t.message]),n(t)}}async function u(t,e,n){try{var i,c;let o=await s.Z.post("auth/verify-otp",t);return console.log(o),(0,r.s)(o,e,n,!0),(null===(i=o.data)||void 0===i?void 0:i.accessToken)&&(0,a.fe)("token",null==o?void 0:null===(c=o.data)||void 0===c?void 0:c.accessToken),o}catch(t){(0,o.x)("error",[t.message]),n(t)}}async function l(t,e,n){try{let a=await s.Z.post("auth/resend-otp",t);return(0,r.s)(a,e,n,!0),a}catch(t){(0,o.x)("error",[t.message]),n(t)}}async function d(t,e,n){try{let a=await s.Z.post("auth/signup",t);return(0,r.s)(a,e,n,!0),console.log("sign:",a),a}catch(t){(0,o.x)("error",[t.response.data.message]),n(t)}}async function x(t,e,n){try{var a,c;let o=await s.Z.post("auth/login",t);return(null===(a=o.data)||void 0===a?void 0:a.token)&&(0,i.mB)({token:null==o?void 0:null===(c=o.data)||void 0===c?void 0:c.token}),await (0,i.LP)()&&(0,r.s)(o,e,n,!0),o}catch(t){(0,o.x)("error",[t.message]),n(t)}}async function p(t,e,n){try{let a=await s.Z.post("users/change-password",t);return console.log(a),(0,r.s)(a,e,n,!0),a}catch(t){(0,o.x)("error",[t.message]),n(t)}}async function h(t,e,n){try{let a=await s.Z.post("auth/forgot-password",t);return(0,r.s)(a,e,n),a}catch(t){(0,o.x)("error",[t.message]),n(t)}}async function f(t,e,n){try{let a=await s.Z.post("auth/reset-password",t);return console.log(a),(0,r.s)(a,e,n,!0),a}catch(t){(0,o.x)("error",[t.message]),n(t)}}},5136:function(t,e){"use strict";e.Z={src:"/_next/static/media/forward-icon.3d74d514.svg",height:24,width:24,blurWidth:0,blurHeight:0}}},function(t){t.O(0,[4705,8173,1231,9905,3393,7138,1187,2971,7023,1744],function(){return t(t.s=9936)}),_N_E=t.O()}]);