(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1826],{90926:function(e,t,n){Promise.resolve().then(n.bind(n,95439))},95439:function(e,t,n){"use strict";n.d(t,{default:function(){return P}});var s=n(57437),l=n(2265),r=n(383),a=n(89751),o=n(70919),i=n(54887),d=e=>{let{pending:t}=(0,i.useFormStatus)(),{children:n=null,className:l,noBorder:d,showBoth:c,reverseArrow:u,title:m="",disabled:h,...x}=e;return(0,s.jsx)("div",{className:(0,r.cn)(l),children:(0,s.jsx)("button",{...x,className:(0,r.cn)("select-none rounded-3xl md:rounded-full ","text-center font-tofinoText text-lg font-bold md:text-xl","px-5 py-3 md:px-6 ","disabled:hover:scale-1 disabled:cursor-not-allowed disabled:bg-gray-300 disabled:text-gray-400","bg-dino-blue text-white",d?"border-none":"border-2 border-black ","ease transform transition duration-200 hover:scale-[1.01]","w-full md:w-auto "),disabled:h||t,children:(0,s.jsx)("div",{className:"flex select-none items-center justify-center rounded-full md:justify-start",children:t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{className:"mr-2 h-4 w-4 animate-spin"})," Please wait..."]}):(0,s.jsxs)(s.Fragment,{children:[m,(0,s.jsx)(o.Z,{className:(0,r.cn)("h-4 w-4",u?"mr-2 rotate-180 transform ":"ml-2 ")})]})})})})},c=n(78619);let u=(0,n(13e3).Ue)()(()=>({inProgress:!1,phoneNumber:"",otp:"",hash:""}));var m=n(17432),h=n(22333),x=n(94962),f=n(30798),p=n(76158),b=n(16463),g=n(38351);n(74590);var y=(0,n(58064).$)("12e742059a6f78ff4238f86f050ce65734a9efd5"),w=n(13550),v=()=>{let e=(0,b.useSearchParams)(),{phoneNumber:t,hash:n}=u(),[r,a]=(0,l.useState)(""),o=(0,b.useRouter)(),i=async()=>{var s,l;let a=await m.Z.verifyOTP({referralCode:null!==(l=null==e?void 0:e.get("referralCode"))&&void 0!==l?l:"",phoneNumber:t,hash:n,otp:r});if((0,h.V)(a)){x.default.error(a.message,{position:"top-center",duration:3e3});return}(0,w.G)(await y()),f.Z.queue(p.M.Login,{user_id:null==a?void 0:null===(s=a.user)||void 0===s?void 0:s.id,has_purchased:(null==a?void 0:a.orderCount)>0}),setTimeout(()=>{u.setState({hash:"",phoneNumber:"",inProgress:!1})},1200),o.refresh()},v=(0,l.useCallback)(async()=>{let e=await m.Z.sendOTP({phoneNumber:t});if((0,h.V)(e)){x.default.error(e.message,{position:"top-center",duration:3e3});return}u.setState({hash:e.hash,inProgress:!0,phoneNumber:t}),x.default.success("OTP sent successfully.",{position:"top-center",duration:3e3})},[t]),j=(0,l.useCallback)(e=>a(e.target.value),[a]);return(0,s.jsxs)("form",{action:i,children:[(0,s.jsx)("h2",{className:"font-tofinoWide text-3xl font-black md:text-5xl",children:"Verify OTP"}),(0,s.jsxs)("div",{className:"md:w-100 mt-2.5 w-5/6 font-tofinoText text-xs leading-tight md:mt-4 md:text-base",children:[(0,s.jsxs)("span",{children:["Please provide the OTP sent on ",(0,s.jsx)("b",{children:t}),"."," "]}),(0,s.jsx)("button",{type:"button",className:"font-medium text-blue-700 underline opacity-100",onClick:(0,g.Z)(v),children:"Resend OTP"})]}),(0,s.jsxs)("div",{className:" mt-6",children:[(0,s.jsx)("input",{className:"w-full rounded-xl border-2  border-black/80 bg-white px-3.5 py-3 text-xl font-black placeholder-black/60 shadow-md placeholder:text-lg placeholder:font-medium placeholder:leading-tight placeholder:tracking-tighter focus:outline-none  md:py-3.5 ",placeholder:"Provide OTP",type:"tel",pattern:"\\d*",id:"otp",name:"otp",title:"Please provide only numbers in phone number.",maxLength:4,onChange:j,onKeyDown:c.L}),(0,s.jsx)("p",{className:"help-text ml-0.5 mt-1 text-[0.55rem] opacity-40 md:mt-1.5 md:text-xs",children:"A 4 digit OTP has been sent."})]}),(0,s.jsx)(d,{title:"Verify",noBorder:!0,className:"mt-7 w-full md:mt-7 md:w-auto ",type:"submit",disabled:4!==r.length})]})},j=()=>{let[e,t]=(0,l.useState)(""),n=(0,l.useCallback)(e=>t(e.target.value),[t]),r=async()=>{let t=await m.Z.sendOTP({phoneNumber:e});if((0,h.V)(t)){x.default.error(t.message,{position:"top-center",duration:3e3});return}x.default.success("OTP sent successfully.",{position:"top-center",duration:3e3}),u.setState({hash:t.hash,inProgress:!0,phoneNumber:e})};return(0,s.jsxs)("form",{action:r,children:[(0,s.jsx)("h2",{className:"font-tofinoWide text-3xl font-black md:text-5xl",children:"Login with OTP"}),(0,s.jsx)("p",{className:"mt-2.5 w-5/6 font-tofinoText text-xs leading-tight md:mt-4 md:w-4/6 md:text-base",children:"Please enter your mobile number to login to your account"}),(0,s.jsxs)("div",{className:" mt-6 ",children:[(0,s.jsx)("input",{className:"w-full rounded-xl border-2  border-black/80 bg-white px-3.5 py-3 text-xl font-black placeholder-black/60 shadow-md placeholder:text-lg placeholder:font-medium placeholder:leading-tight placeholder:tracking-tighter focus:outline-none  md:py-3.5 ",placeholder:"Enter your phone number*",type:"tel",pattern:"\\d*",id:"phoneNumber",name:"phoneNumber",title:"Please provide only numbers in phone number.",maxLength:10,onChange:n,onKeyDown:c.L}),(0,s.jsx)("p",{className:"help-text ml-0.5 mt-1 text-[0.55rem] opacity-40 md:mt-1.5 md:text-xs",children:"we'll send you an OTP on this number to verify it."})]}),(0,s.jsx)(d,{title:"Request OTP",noBorder:!0,className:"mt-7",type:"submit",disabled:10!==e.length})]})},P=()=>u(e=>e.inProgress)?(0,s.jsx)(v,{}):(0,s.jsx)(j,{})},78619:function(e,t,n){"use strict";n.d(t,{L:function(){return s}});let s=e=>{e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||["Backspace","Delete","Tab","Escape","ArrowLeft","ArrowRight","0","1","2","3","4","5","6","7","8","9"].includes(e.key)||e.preventDefault()}},38351:function(e,t,n){"use strict";var s=n(22170),l=n.n(s);t.Z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return l()(e,t,{leading:!0,trailing:!1})}}},function(e){e.O(0,[7139,2512,7080,2241,5499,1777,7031,2166,2971,7023,1744],function(){return e(e.s=90926)}),_N_E=e.O()}]);