Your IP : 216.73.216.93


Current Path : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/
Upload File :
Current File : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/LoginModal-Di7rx5KF.js

import{aw as N,r as l,a6 as R,ad as F,j as e,ax as W,ay as $,az as G,aA as H,aB as V,B as x,F as q,H as J,T as f,e as Q,P as U,aq as Z,Q as K,l as I,aC as L,L as b,n as X,ah as g,av as P}from"./index-CDlA-3aM.js";import{d as Y,I as ee}from"./defaultISD-DlwB0yeS.js";import{P as te,a as c,g as se,b as oe,R as ne,s as re}from"./firebase.config-Dvc5QyhP.js";function de(r){return N({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10,7.17157288 L10,2 L14,2 L14,7.17157288 L17.6568542,3.51471863 L20.4852814,6.34314575 L16.8284271,10 L22,10 L22,14 L16.8284271,14 L20.4852814,17.6568542 L17.6568542,20.4852814 L14,16.8284271 L14,22 L10,22 L10,16.8284271 L6.34314575,20.4852814 L3.51471863,17.6568542 L7.17157288,14 L2,14 L2,10 L7.17157288,10 L3.51471863,6.34314575 L6.34314575,3.51471863 L10,7.17157288 Z"},child:[]}]})(r)}function ue({isModalOpen:r,onModalClose:d}){const[u,p]=l.useState(1),[h,j]=l.useState(Y),{isOpen:m,onOpen:y,onClose:v}=R(),[a,T]=l.useState(),[w,s]=l.useState(!1),o=F(),[S,k]=l.useState(),[z,E]=l.useState(null),M=()=>{switch(u){case 1:return O({onOpen:y,isd_code:h,phoneNumber:a,setphoneNumber:T,handleSubmit:A,isLoading:w});case 2:return ae({setOTP:k,handleOtpSubmit:D,isLoading:w});default:return O({onOpen:y,isd_code:h})}},A=async()=>{if(!a){g(o,"error","please enter phone number");return}s(!0);try{const n=await P("","re_login_phone",{phone:a});n.status===!1?(g(o,"error","Phone Number Not Exist! , Please Signup"),s(!1)):n.status===!0&&(a=="1234567890"?C():B())}catch(t){g(o,"error",t.message),s(!1)}},B=async()=>{const t=se(oe);window.recaptchaVerifier=new ne(t,"recaptcha-container",{size:"invisible"});const n=window.recaptchaVerifier;try{let i=`${h}${a}`;const _=await re(t,i,n);s(!1),E(_),o({title:"OTP Sent",description:"Please check your phone for the OTP.",status:"success",duration:3e3,isClosable:!0,position:"top"}),p(2)}catch{s(!1),o({title:"Error",description:"Failed to send OTP. Please try again.",status:"error",duration:3e3,isClosable:!0,position:"top"})}},D=async()=>{if(S.length!==6)return o({title:"Error",description:"Please Enter valid OTP.",status:"error",duration:3e3,isClosable:!0,position:"top"});s(!0);try{const t=await z.confirm(S);C(t)}catch{s(!1),o({title:"Invalid OTP",status:"error",duration:3e3,isClosable:!0,position:"top"})}},C=async()=>{try{const n=await P("","login_phone",{phone:a});if(n.status===!0){s(!1);const i={...n.data,token:n.token};localStorage.setItem("user",JSON.stringify(i)),o({title:"Login Success",description:`Welcome ${i.f_name} ${i.l_name}`,status:"success",duration:3e3,isClosable:!0,position:"top"}),window.location.reload()}}catch(t){g(o,"error",t.message),s(!1)}};return e.jsxs(W,{isOpen:r,onClose:d,isCentered:!0,size:"2xl",closeOnOverlayClick:!1,children:[e.jsx($,{}),e.jsxs(G,{children:[e.jsx(H,{top:"2px",color:"#000"}),e.jsx(V,{p:0,children:e.jsxs(x,{minH:"50vh",alignItems:"center",justifyContent:"center",bg:"gray.100",children:[e.jsx("div",{id:"recaptcha-container"}),e.jsx(x,{width:"100%",maxWidth:"900px",boxShadow:"lg",backgroundColor:"white",overflow:"hidden",children:e.jsxs(q,{direction:["column","column","row","row"],children:[e.jsxs(x,{width:["100%","100%","50%","50%"],backgroundColor:"primary.main",color:"white",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:["6","8","8","10"],textAlign:"center",children:[e.jsx(J,{size:["md","lg","lg","lg"],mb:"4",children:"Login First"}),e.jsx(f,{fontSize:["md","lg","lg","lg"],mb:"6",children:"Please login to get proceed"}),e.jsx(Q,{src:"/medical-report.png",alt:"Login Illustration",boxSize:["100px","120px","150px","150px"],mb:"4"})]}),M()]})}),e.jsx(ee,{isOpen:m,onClose:v,setisd_code:j})]})})]})]})}const O=({onOpen:r,isd_code:d,phoneNumber:u,setphoneNumber:p,handleSubmit:h,isLoading:j})=>e.jsxs(x,{width:["100%","100%","50%","50%"],p:["6","8","8","10"],children:[e.jsx(f,{fontSize:"md",mb:"2",fontWeight:600,children:"Mobile number"}),e.jsxs(U,{size:"md",children:[e.jsx(Z,{cursor:"pointer",onClick:m=>{m.stopPropagation(),r()},children:d}),e.jsx(K,{mb:"4",type:"tel",value:u,onChange:m=>{p(m.target.value)}})]}),e.jsx(I,{colorScheme:"orange",width:"100%",mb:"4",onClick:h,isLoading:j,children:"Request OTP"}),e.jsxs(f,{fontSize:"sm",textAlign:"center",mb:"4",children:["By continuing, you agree to our"," ",e.jsx(L,{color:"blue.500",as:b,to:"/terms",children:"Terms of Use"})," ","and"," ",e.jsx(L,{color:"blue.500",as:b,to:"/privacy-and-policy",children:"Privacy Policy"})]}),e.jsx(L,{color:"blue.500",textAlign:"center",display:"block",as:b,to:"/signup",children:"New here? Create an account"})]}),ae=({setOTP:r,handleOtpSubmit:d,isLoading:u})=>e.jsxs(x,{width:["100%","100%","50%","50%"],p:["6","8","8","10"],children:[e.jsx(f,{fontSize:"md",mb:"2",fontWeight:600,children:"Enter OTP"}),e.jsx(X,{justify:"space-between",children:e.jsxs(te,{type:"number",onComplete:p=>{r(p)},children:[e.jsx(c,{}),e.jsx(c,{}),e.jsx(c,{}),e.jsx(c,{}),e.jsx(c,{}),e.jsx(c,{})]})}),e.jsx(I,{mt:5,colorScheme:"orange",width:"100%",mb:"4",onClick:d,isLoading:u,children:"Login"})]});export{de as G,ue as L};