PageSourceSearch

https://shopperce.ai/assets/Validate-DnVRzR31.js

js shopperce.ai collected 2026-10-05 15:09:06 UTC 2,848 bytes, 1 lines download raw bytes

1import{G as S,b as V,E as I,p as j,q as P,ab as T,ac as B,r as x,B as l,j as r,N as L,w as R,x as C,a4 as F,y as w}from"./index-d_wRIAYy.js";import{S as _}from"./ScreenLoader-C30JNqWo.js";import{O as h}from"./OtpVerifyForm-1TR82qz4.js";import{u as A}from"./useRedirectFromQuery-JOJVyF19.js";import{u as G,I as U,m as D}from"./formValidationRules-DGuZrxoy.js";import{B as Q}from"./Button-BajbHsJR.js";function Z(){var f,p;const m=S(),[d]=V(),y=A(I),{isLoggedIn:u,login:E}=j(),{showStrictCloseCustomModal:c,hideModal:b}=P(),t=d.get("token")??d.get("code"),e=T(t,{enabled:!!t&&!u}),o=B();function s(a){E(a),y("/"),l.success(F)}const{formData:i,displayError:N,handleFocusOut:M,handleInputChange:g,handleSubmit:v}=G({mobile:((f=e.data)==null?void 0:f.mobileNumber)??""},{...D},O);async function O(){try{await o.mutateAsync({mobile_number:i.mobile,token:t}),c(r.jsx("div",{className:"w-auto lg:w-96",children:r.jsx(h,{heading:"Enter OTP",buttonText:"Verify",showEditButton:!0,handleMobileEdit:b,mobile:i.mobile,customMessage:"Please verify your mobile number first!",verificationType:"MOBILE_NUMBER_VERIFICATION",handleOTPVerifySuccess:s})}),!0)}catch(a){console.error(a),l.error(w)}}return x.useEffect(()=>{e.isError&&(l.error("Login Failed!"),m("/"))},[e.isError,m]),x.useEffect(()=>{e.data&&(e.data.mobileNumber&&e.data.isNumberVerified?s(e.data):e.data.mobileNumber&&!e.data.isNumberVerified&&c(r.jsx("div",{className:"w-auto lg:w-96",children:r.jsx(h,{heading:"Enter OTP",buttonText:"Verify",showEditButton:!0,handleMobileEdit:b,mobile:e.data.mobileNumber,customMessage:"Please verify your mobile number first!",verificationType:"MOBILE_NUMBER_VERIFICATION",handleOTPVerifySuccess:s})}),!0))},[e.data]),u||!t?r.jsx(L,{to:"/"}):r.jsxs("main",{className:"mx-auto grid grid-cols-12 items-center main-margin-top bg-lightGrey px-4 py-8 remaining-screen-height",children:[e.isPending&&r.jsx(_,{}),e.data&&r.jsxs("div",{className:"bg-primaryBg col-span-12 sm:col-start-2 sm:col-span-10 md:col-start-3 md:col-span-8 lg:col-start-4 lg:col-span-6 xl:col-start-5 xl:col-span-4 py-10 px-[30px] border border-cardBorder rounded flex flex-col gap-6 max-w-[520px]",children:[r.jsx("h3",{className:"text-[18px] md:text-[22px] text-center font-medium",children:"Validate Mobile"}),!((p=e.data)!=null&&p.mobileNumber)&&r.jsxs("form",{className:"text-primaryColor font-sans flex flex-col gap-4",onSubmit:v,children:[r.jsx(U,{value:i.mobile,onChange:a=>{const n=R(a);g({target:{name:a.target.name,value:n}})},id:"mobile",name:"mobile",type:"number",label:"Mobile Number",error:N.mobile,required:!0,otherProps:{onWheel(a){a.target.blur()},onBlur:a=>{const n=C(a.target.value);g({target:{name:a.target.name,value:n}}),M(a)}}}),r.jsx(Q,{className:"primary-button",type:"submit",disabled:o.isPending,loading:o.isPending,children:"Send OTP"})]})]})]})}export{Z 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.