1import{r as a,t as Le,A as Ve,b as qe,j as e,y as O,o as ge,au as ss,q as ae,x as D,u as Fe,av as Be,w as fe,d as he,g as ts}from"./index-DOEDGpFv.js";import{E as as,G as Oe,F as ns}from"./ForgotPassqordRecuiter-C2HhNl_v.js";import{A as rs}from"./ArrowBack-Bk3NTM5B.js";import{O as ls}from"./OTPTimer-23lobUh5.js";import{F as is,f as os,g as De,E as Ue,c as cs,b as Me}from"./index.esm-DaRz_fRj.js";import{R as ds,V as us}from"./VisibilityOffOutlined-CSqV7B5e.js";import{I as ms}from"./InputAdornment-CYJ-dB-y.js";import"./user.service-vzbCZA7Y.js";const ps=cs({user_name:Me().required("User name is required"),password:Me().min(6,"Password must be at least 6 characters").required("Password is required")});function fs({closemodel:U}){const{openSnackbar:M}=a.useContext(Le),{setUser:i,setAccessToken:m,startSilentRefresh:L,GetSignUpDependency:V,setIsLoaded:H,checkNewNotification:ne,setIsProfileFreezed:Q,setIsForgotPopup:re,setIsSignUpPopup:le}=a.useContext(Ve),b=qe(),[ie,X]=a.useState(!1),[P,q]=a.useState(!1),y=()=>q(!P),Y=n=>{n.preventDefault()},oe=n=>{try{if(!n||typeof n!="string")throw new Error("Invalid token");const r=n.split(".")[1];if(!r)throw new Error("Invalid token format");const l=r.replace(/-/g,"+").replace(/_/g,"/"),I=decodeURIComponent(atob(l).split("").map(S=>"%"+("00"+S.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(I)}catch(r){return console.error("Error parsing JWT:",r),{exp:Math.floor(Date.now()/1e3)+3600}}},xe=async(n,{setSubmitting:r,resetForm:l})=>{var I,S,w,Z,z,T,A;X(!0),H(!1);try{const N={user_name:n.user_name,password:n.password},o=await ss.signinwithuser(N);console.log("Full response:",o);const t=((I=o.data)==null?void 0:I.user)||o.user,p=((S=o.data)==null?void 0:S.token)||o.token||((w=o.data)==null?void 0:w.accessToken)||o.accessToken;if(console.log("User:",t),console.log("Token:",p),!t)throw new Error("User data not found in response");if(!p)throw new Error("Token not found in response");U(),le(!1);const R=oe(p),E={token:p,expires:new Date(R.exp*1e3).toISOString()};if(localStorage.setItem("hasValidUserSession","true"),i(t),m(E),await V(),t!=null&&t.isFreezed?Q(!0):Q(!1),(t==null?void 0:t.user_type)===2){console.log("User recruiter data:",t==null?void 0:t.recruiter),(Z=t==null?void 0:t.recruiter)!=null&&Z.is_profile_creation_completed?b("/app/my-projects"):b(`/app/recruiter-form/${t.userUniqueId}`);const W={user_id:`${t.user_id}`,message:`<p><a class="talent_name" href="${ae.admin_url}/app/recruiter/details/${t.user_id}">${t.first_name} (Recruiter ${t.user_id})</a> signed in with user name</p>`};await D.createLog(W)}else if((t==null?void 0:t.user_type)===1){(z=t==null?void 0:t.talenter)!=null&&z.is_profile_creation_completed?t.profile_status===1?b("/app/openings/my-applications"):b(`/talent/${t.userUniqueId}`):b("/app/dashboard");const W={user_id:`${t.user_id}`,message:`<p><a class="talent_name" href="${ae.admin_url}/app/talent-management/profile/${t.user_id}">${t.first_name} (Talent ${t.user_id})</a> signed in with user name</p>`};await D.createLog(W)}M("Signed in successfully!","success"),ne(t==null?void 0:t.user_id),L(),l()}catch(N){console.error("Login error:",N);const o=((A=(T=N.response)==null?void 0:T.data)==null?void 0:A.message)||N.message||"Invalid user name or password.";M(o,"error"),localStorage.removeItem("hasValidUserSession"),i(null),m(null)}finally{X(!1),r(!1),H(!0)}},ce=(n,r,l)=>({"& .MuiInput-root:before":{borderBottomColor:r[n]&&!l[n]?"#9B26B6":"rgba(0, 0, 0, 0.42)"},"& .MuiInput-root:hover:before":{borderBottomColor:r[n]&&!l[n]?"#9B26B6":"rgba(0, 0, 0, 0.87)"},"& .MuiInput-root:after":{borderBottomColor:"#9B26B6"}});return e.jsx("div",{className:"Requiterdetails form_action_container",children:e.jsx(is,{initialValues:{user_name:"",password:""},validationSchema:ps,onSubmit:xe,children:({errors:n,touched:r,isSubmitting:l})=>e.jsxs(os,{children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("p",{children:"Username (For Recruiters Only)"}),e.jsx(De,{as:O,name:"user_name",variant:"standard",fullWidth:!0,sx:ce("user_name",r,n),error:r.user_name&&!!n.user_name,helperText:e.jsx(Ue,{name:"user_name"})})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("p",{children:"Password"}),e.jsx(De,{as:O,name:"password",variant:"standard",type:P?"text":"password",fullWidth:!0,sx:ce("password",r,n),error:r.password&&!!n.password,helperText:e.jsx(Ue,{name:"password"}),InputProps:{endAdornment:e.jsx(ms,{position:"end",children:P?e.jsx(ds,{onClick:y,onMouseDown:Y,style:{cursor:"pointer",color:"#9B26B6",fontSize:"19px"}}):e.jsx(us,{onClick:y,onMouseDown:Y,style:{cursor:"pointer",color:"#9B26B6",fontSize:"19px"}})})}})]}),e.jsx("p",{className:"terms_info pt-3 pb-5 text-end",children:e.jsx("button",{type:"button",onClick:()=>{re(!0)},className:"link terms_conditon",children:e.jsx("b",{children:"Forgot Password"})})}),e.jsx(ge,{text:"Sign in",type:"submit",disabled:ie||l,style:{marginBottom:"10px"}})]})})})}function Ss({open:U,onClose:M}){var ke,Ce,Pe;const{pathname:i}=Fe(),m=qe(),{setIsSignUpPopup:L,setIsSignInPopup:V,setUser:H,setA
1ccessToken:ne,startSilentRefresh:Q,GetSignUpDependency:re,setIsLoaded:le,setSignInTabs:b,isJobapply:ie,checkNewNotification:X,setIsProfileFreezed:P,signInTabs:q,isForgotPopup:y,setIsForgotPopup:Y,isResetPopup:oe,setIsResetPopup:xe,submitted:ce,resetSubmitted:n}=a.useContext(Ve),{openSnackbar:r}=a.useContext(Le),l=Fe(),I=(ke=l==null?void 0:l.pathname)!=null&&ke.includes("find-jobs")?(Pe=(Ce=l==null?void 0:l.pathname)==null?void 0:Ce.split("/"))==null?void 0:Pe.pop():null,[S,w]=a.useState(U),[Z,z]=a.useState(!1),[T,A]=a.useState(1),[N,o]=a.useState(!1),[t,p]=a.useState(""),[R,E]=a.useState(!1),[W,ze]=a.useState(!1),[Ae,ee]=a.useState(!1),[G,u]=a.useState(!1),[je,We]=a.useState(""),[_e,c]=a.useState(i=="/recruiters"?1:i=="/talents"?0:-1),[Ge,ve]=a.useState(180),[be,ye]=a.useState(!1),[Je,de]=a.useState(null),[Ke,ue]=a.useState(null),[He,me]=a.useState(null),[Qe,pe]=a.useState(null),se=a.useRef(),k=a.useRef(),f=a.useRef(),$=a.useRef(),[h,C]=a.useState(""),Se=()=>{w(!1),M(!1),p(""),C(null),ze(null),c(-1),b(null),Y(!1)};a.useEffect(()=>{q==="recruiter"?c(1):q==="Talent"&&c(0)},[q]),a.useEffect(()=>{w(U),i=="/"&&c(-1),i=="/recruiters"&&c(1),i==="/talents"&&c(0),i==="/find-talents"&&c(1),i.includes("/talent/")&&c(1),i.includes("/recruiter/")&&c(-1),i.includes("/talent/")&&c(1),i.includes("/jobs/")&&c(0),i==="/find-jobs"&&c(0)},[U]);const F=()=>{M(!1),w(!1),z(!1)},g=s=>s.target.value.replace(/[^0-9.]/g,"").replace(/(\..*?)\..*/g,"$1"),we=()=>{C(null),E(!0),D.VerifyUserWithNum(t).then(s=>{var d;if(console.log("-------numeere---------->",s),s.data.httpCode==500){C((d=s==null?void 0:s.data)==null?void 0:d.message);return}s.data.httpCode==200?(r(s.data.message),o(!0),u(!1)):ee(!0)}).catch(s=>{var x,j,_,v,J,K;s.response.data.httpCode===404&&We((j=(x=s==null?void 0:s.response)==null?void 0:x.data)==null?void 0:j.message);const d=((v=(_=s==null?void 0:s.response)==null?void 0:_.data)==null?void 0:v.message)||"Something went wrong";((K=(J=s==null?void 0:s.response)==null?void 0:J.data)==null?void 0:K.httpCode)===429&&r(d,"error"),console.log("----------errorr-------->",s)}).finally(()=>{E(!1)})},Ne=()=>{E(!0),D.VerifyUserWithNumOtp(t,`${Je+Ke+He+Qe}`).then(s=>{var d,B,x,j,_,v,J,K,Ie,Te,Re,Ee,$e;if(s.data.httpCode===400)u(!0);else{H(s.data.user),ne((d=s==null?void 0:s.data)==null?void 0:d.token),Q(),re(),localStorage.setItem("hasValidUserSession","true"),(B=s.data.user)!=null&&B.isFreezed?P(s.data.user.isFreezed):P(!1),ie===!0||I||(s.data.user.user_type==1?(j=(x=s.data.user)==null?void 0:x.talenter)!=null&&j.is_profile_creation_completed?s.data.user.profile_status===1?m("/app/openings/my-applications"):m(`/talent/${(_=s.data.user)==null?void 0:_.userUniqueId}`):m("/app/dashboard"):s.data.user.user_type==2&&((J=(v=s.data.user)==null?void 0:v.recruiter)!=null&&J.is_profile_creation_completed?m("/app/my-projects"):m(`/app/recruiter-form/${s.data.user.userUniqueId}`))),F(),le(!0),o(!1),p(""),de(null),ue(null),me(null),pe(null),u(!1);let Ye=s.data.user.user_type==1?"Talent":"Recruiter",Ze=s.data.user.user_type==1?`href="${ae.admin_url}/app/talent-management/profile/${(K=s.data.user)==null?void 0:K.user_id}"`:`href="${ae.admin_url}/app/recruiter/details/${(Ie=s.data.user)==null?void 0:Ie.user_id}"`;const es={user_id:`${(Te=s.data.user)==null?void 0:Te.user_id}`,message:`<p><a class="talent_name" ${Ze}>${(Re=s.data.user)==null?void 0:Re.first_name} (${Ye} ${(Ee=s.data.user)==null?void 0:Ee.user_id})</a> signed in using MobileOTP</p>`};X(($e=s.data.user)==null?void 0:$e.user_id),D.createLog(es)}}).catch(s=>{var x,j,_,v;const d=((j=(x=s==null?void 0:s.response)==null?void 0:x.data)==null?void 0:j.message)||"Something went wrong",B=(v=(_=s==null?void 0:s.response)==null?void 0:_.data)==null?void 0:v.httpCode;B===400||B===429?(u(!0),r(d,"error")):(u(!1),setOtpErrorMessage(""),r(d,"error"))}).finally(()=>{E(!1)})},Xe=()=>{de(null),ue(null),me(null),pe(null),se.current.value="",k.current.value="",f.current.value="",$.current.value="",u(!1),ve(10),ye(!1),D.VerifyUserWithNum(t).then(s=>{})},te=()=>{L(!1),V(!1),m("/about/contact-us")};return e.jsxs(e.Fragment,{children:[e.jsx(as,{open:Z,onClose:F,back:()=>{w(!0),z(!1)}}),e.jsx("div",{className:S?"overlay block":"hidden",onClick:Se}),e.jsx("div",{className:S?"singup__screen signup_open":"singup__screen",children:N?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"signup__header flex justify-between items-center",children:[e.jsxs("div",{className:"flex justify-center items-center gap-4",children:[e.jsx(rs,{size:"20px",sx:{color:"#979797"},onClick:()=>o(!1),className:"cursor-pointer"}),e.jsx("h4",{className:"font-semibold text-gray-700 signup__title",children:"Verification"})]}),e.jsx(Be,{className:"close_icon",onClick:()=>o(!1)})]}),e.jsxs("div",{style:{marginTop:"20px"},children:[" ",e.jsxs("label",{children:["Enter ",e.jsx("b",{children:"OTP"})," sent as ",e.jsx("b",{children:"SMS"})," to ",e.jsx("span",{style:{fontWeight:"600",color:"#9B26B6"},children:t})]}),e.jsx("form",{children:e.jsxs("div",{className:"top_heading_content",children:[e.jsxs("div",{className:"sign_opt_inner",children:[e.jsx("div",{className:`opt_left ${G&&"otp_error_value"}`,children:e.jsx(O,{autoFocus:!0,id:"standard-basic",variant:"standard",inputRef:se,inputProps:{autocomplete:"new-password",form:{autocomplete:"off"}},onChange:s=>{u(!1),s.target.value.length<=1&&k.current&&g(s)!=""?g(s)!=""&&(de(s.target.value),k.current.focus()):(s.preventDefault(),se.current.value="")},name:"otp_screen"})}),e.jsx("div",{className:`opt_left ${G&&"otp_error_value"}`,children:e.jsx(O,{id:"standard-basic",inputRef:k,onKeyDown:s=>{s.keyCode===8&&(s.preventDefault(),k.current.value="",se.current.focus())},onChange:s=>{u(!1),s.target.value.length<=1&&f.current&&g(s)!=""?g(s)!=""&&(ue(s.target.value),f.current.focus()):(s.preventDefault(),k.current.value="")},variant:"standard",name:"otp_screen"})}),e.jsx("div",{className:`opt_left ${G&&"otp_error_value"}`,children:e.jsx(O,{id:"standard-basic",inputRef:f,onKeyDown:s=>{s.keyCode===8&&(s.preventDefault(),f.current.value="",k.current.focus())},onChange:s=>{u(!1),s.target.value.length<=1&&f.current&&g(s)!=""?g(s)!=""&&(me(s.target.value),$.current.focus()):(s.preventDefault(),f.current.value="")},variant:"standard",name:"otp_screen"})}),e.jsx("div",{className:`opt_left ${G&&"otp_error_value"}`,children:e.jsx(O,{id:"standard-basic",variant:"standard",inputRef:$,onKeyDown:s=>{u(!1),(s.target.value.length==1&&s.key==="Enter"||s.key==="Tab")&&Ne(),s.keyCode===8&&(s.preventDefault(),$.current.value="",f.current.focus())},onChange:s=>{s.target.value.length<=1&&$.current&&g(s)!=""?g(s)!=""&&pe(s.target.value):(s.preventDefault(),$.current.value="")},name:"otp_screen"})})]}),e.jsx("p",{className:"errText mt-2 text-left ml-1",children:G&&"Incorrect OTP, please re-enter."}),e.jsx("div",{className:"relode_the_buttons",style:{minHeight:"25px"},children:e.jsxs(he.Row,{children:[e.jsx(he.Col,{sm:6,children:be?e.jsx("div",{className:"resend_but",onClick:()=>{Xe()},children:e.jsx(ts,{children:"Resend the code "})}):e.jsx("span",{})}),e.jsx(he.Col,{sm:6,children:e.jsx("div",{className:"time_count",children:e.jsxs("labe",{children:[be?null:e.jsx(ls,{durations:Ge,updateTimer:s=>{ve(0),ye(s)}})," "]})})})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(ge,{text:"Continue",onClick:Ne,isLoading:R,disabled:R,style:{width:"100%",padding:"8px 0"}})})]})})]})]}):e.jsxs(e.Fragment,{children:[" ",e.jsxs("div",{className:"signup__header flex justify-between items-center",children:[e.jsx("h4",{className:"font-semibold text-gray-700 signup__title",children:y?"Forgot Password":oe||n?"Reset Password":_e>=0?`Sign In as a ${_e==1?"Recruiter":"Talent"}`:"Sign In"}),e.jsx(Be,{className:"close_icon",onClick:Se})]}),y?null:e.jsxs("div",{className:"role_selecter flex",children:[e.jsx("span",{className:T===1?"text-center role_btn role_active":"text-center role_btn",onClick:()=>{A(1),C(null)},children:"with Mobile & OTP"}),e.jsx("span",{className:T===0?"text-center role_btn role_active":"text-center role_btn",onClick:()=>{A(0),C(null)},children:"with Username"})]}),W===!0?e.jsxs("div",{className:"errMsgcontainer p-4 mb-3",children:[" ",e.jsxs("p",{className:"emailErrText ",style:{marginBottom:25},children:["Oops! We need an email!"," "]}),e.jsxs("p",{className:"fontStyl",style:{marginBottom:25},children:["Sorry, we could not find the email address linked to your Sign-up choice."," "]}),e.jsxs("p",{className:"fontStyl",children:["Please ",e.jsx("b",{children:"use another Sign-up"})," option."]})]}):null,h==="Deleted"&&e.jsxs("div",{className:"errMsgcontainer p-4 mb-3",children:[" ",e.jsx("p",{className:"emailErrText ",style:{marginBottom:10},children:"Profile Deleted"}),e.jsxs("p",{className:"fontStyl",children:["Sorry, this profile no longer exists. Please"," ",e.jsx("span",{onClick:te,className:"linkText",children:"contact"})," ","the admin for more information."]})]}),h==="Banned"?e.jsxs("div",{className:"errMsgcontainer p-4 mb-3",children:[" ",e.jsx("p",{className:"emailErrText ",style:{marginBottom:10},children:"Profile Banned"}),e.jsxs("p",{className:"fontStyl",children:["Sorry, your profile is banned and you wonât be able to login or create another profile using the same credentials. Please"," ",e.jsx("span",{onClick:te,className:"linkText",children:"contact"})," ","the admin for more information."," "]})]}):h==="Locked"?e.jsxs("div",{className:"errMsgcontainer p-4 mb-3",children:[" ",e.jsx("p",{className:"emailErrText ",style:{marginBottom:10},children:"Profile Locked"}),e.jsxs("p",{className:"fontStyl",children:["Sorry, your profile is locked and you will not be able login. Please"," ",e.jsx("span",{onClick:te,className:"linkText",children:"contact"})," ","the admin for more information."," "]})]}):h==="Freeze"?e.jsxs("div",{className:"errMsgcontainer p-4 mb-3",children:[" ",e.jsx("p",{className:"emailErrText ",style:{marginBottom:10},children:"Profile Freeze"}),e.jsxs("p",{className:"fontStyl",children:["Sorry, your profile is under freeze and
1you will not be able to apply to new jobs or make any changes to the profile. Please"," ",e.jsx("span",{onClick:te,className:"linkText",children:"contact"})," ","the admin for more information."]})]}):(h==null?void 0:h.length)>7&&e.jsxs("div",{className:"errMsgcontainer p-4 mb-3",children:[e.jsxs("p",{className:"emailErrText ",style:{marginBottom:10},children:["Error"," "]}),e.jsx("p",{className:"fontStyl",children:h})]}),e.jsx("div",{className:"form__container",children:T===0&&!y?e.jsxs(e.Fragment,{children:[e.jsx(fs,{closemodel:F}),e.jsx(Oe,{closemodel:F,name:"Sign in with Google",setAccountStatus:C,isLogin:!0}),e.jsxs("h6",{className:"footer_text text-center mt-5 mr-10",children:["Don't have an account?"," ",e.jsx("span",{className:"link",onClick:()=>{V(!1),L(!0)},children:e.jsx("b",{children:"Sign up"})})]})]}):y?e.jsx(ns,{}):e.jsxs("div",{className:"overflow-auto",children:[e.jsxs("div",{className:"input_container",children:[e.jsx("label",{children:"Enter your 10-digit registered mobile number"}),e.jsx("input",{className:"casting_input",name:"first_name",autoComplete:"off",onChange:s=>{s.target.value.length<=10&&(p(s.target.value),s.target.value.length===10&&!s.target.value.match(fe)?ee(!0):s.target.value.length===10&&s.target.value.match(fe)&&ee(!1))},onKeyDown:s=>{s.target.value.length==10&&s.key==="Enter"&&we()},value:t}),e.jsxs("span",{className:"text-xs text-red-600 dark:text-red-400",children:[je?`${je}`:null,Ae?t.length==0?"Please enter your registered 10-digit Whatsapp number":"Please enter a vaild mobile number":null]})]}),e.jsx("div",{className:"flex justify-center mt-4 mb-4 custom_wd",children:e.jsx("div",{className:"top_title w-full",children:e.jsx(ge,{text:"Sign in",style:{width:"100%",padding:"8px 0"},disabled:R,onClick:()=>{t.match(fe)?we():ee(!0)},isLoading:R})})}),e.jsx(Oe,{closemodel:F,name:"Sign in with Google",setAccountStatus:C,isLogin:!0}),e.jsxs("h6",{className:"footer_text text-center mt-5 mr-10",children:["Don't have an account?"," ",e.jsx("span",{className:"link",onClick:()=>{V(!1),L(!0)},children:e.jsx("b",{children:"Sign up"})})]})]})})]})})]})}export{Ss 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.