1import{_ as N}from"./tBgH3_Vh.js";import{_ as C}from"./dx5ZZYSq.js";import{v as L}from"./BNkS3Q89.js";import{u as v}from"./Ir36ud9L.js";import{_ as M,I as E,c as o,b as r,f as k,a as _,d as y,t as g,C as x,n as O,J as R,F as T,M as w,o as a}from"./CZF76UNZ.js";import{_ as P}from"./DcogfWDr.js";import{_ as D}from"./CnlltbzD.js";import{_ as S}from"./DwA9FvSR.js";import{_ as F}from"./CR2TWIk9.js";import"./D6Okewqq.js";const A={mixins:[L],data(){return{isLoading:!1,otp:"",isOtpComplete:!1,isOtpError:!1,errorMessage:"",resendCountdown:0,isResendDisabled:!1,resendTimer:null,mobileNumber:"",userSlug:"",token:"",panNumber:"",legalName:"",isEditNavigation:!1,verified:!1,isKycAlreadyDone:!1,redirectCountdown:5,redirectTimer:null,externalRedirectLink:"",isError:!1,errorCode:"",errorShortMessage:"",errorLongMessage:""}},async beforeRouteLeave(e,i,c){!this.verified&&e.path.includes("/kyc/")&&(this.isEditNavigation||(await this.cancelOtp(),sessionStorage.setItem("kyc-verification-state",JSON.stringify({mobile:this.mobileNumber,panNumber:this.panNumber,legalName:this.legalName,focusMobile:!0})))),c()},mounted(){if(this.initFromRouteState(),!this.mobileNumber){this.$router.go(-1);return}this.verified&&!this.isKycAlreadyDone?this.startRedirectCountdown():this.startResendCountdown()},beforeUnmount(){this.resendTimer&&clearInterval(this.resendTimer),this.redirectTimer&&clearInterval(this.redirectTimer)},methods:{initFromRouteState(){const e=history==null?void 0:history.state;e&&(this.mobileNumber=(e==null?void 0:e.mobile)||"",this.userSlug=(e==null?void 0:e.userSlug)||"",this.token=(e==null?void 0:e.token)||"",this.panNumber=(e==null?void 0:e.panNumber)||"",this.legalName=(e==null?void 0:e.legalName)||"")},handleOtpInput(e){this.otp=e,this.isOtpComplete=e.length===6,this.isOtpError&&(this.isOtpError=!1,this.errorMessage="")},handleOtpComplete(e){this.otp=e,this.isOtpComplete=!0},async verifyOtp(){var e,i,c,f,t,n,u,h,d,m,p,b;if(!(!this.isOtpComplete||this.isLoading)){this.isLoading=!0,this.isOtpError=!1,this.errorMessage="";try{const s=await v()(`/lakshmi/v1.0/auth/kyc/verify-otp/${this.userSlug}`,{method:"POST",body:JSON.stringify({otp:this.otp,token:this.token}),credentials:"include"});(e=s==null?void 0:s.data)!=null&&e.verified&&((c=(i=s==null?void 0:s.data)==null?void 0:i.kycData)!=null&&c.isKycAlreadyDone)&&(this.verified=!0,this.isKycAlreadyDone=!0),(f=s==null?void 0:s.data)!=null&&f.verified&&!((n=(t=s==null?void 0:s.data)==null?void 0:t.kycData)!=null&&n.isKycAlreadyDone)&&(this.verified=!0,this.isKycAlreadyDone=!1,this.externalRedirectLink=((h=(u=s==null?void 0:s.data)==null?void 0:u.kycData)==null?void 0:h.externalLink)||"",this.startRedirectCountdown()),(d=s==null?void 0:s.data)!=null&&d.isError&&(this.isOtpError=!0,this.errorLongMessage=((b=(p=(m=s==null?void 0:s.data)==null?void 0:m.error)==null?void 0:p.reason)==null?void 0:b.long)||"Invalid OTP. Please try again.")}catch{this.isOtpError=!0}finally{this.isLoading=!1}}},async resendOtp(){var e,i,c,f,t,n,u,h,d,m,p,b;if(!(!this.isOtpError&&(this.isResendDisabled||this.isLoading))&&!this.isLoading){this.isLoading=!0,this.isOtpError=!1,this.errorMessage="";try{const s=await v()(`/lakshmi/v1.0/auth/kyc/resend-otp/${this.userSlug}`,{method:"POST",body:JSON.stringify({token:this.token}),credentials:"include"});(e=s==null?void 0:s.data)!=null&&e.isError?(this.isOtpError=!0,this.errorLongMessage=((f=(c=(i=s==null?void 0:s.data)==null?void 0:i.error)==null?void 0:c.reason)==null?void 0:f.long)||"Failed to Resend OTP"):this.startResendCountdown()}catch(l){this.isError=!0,this.errorCode=((n=(t=l==null?void 0:l.data)==null?void 0:t.error)==null?void 0:n.code)||"",this.errorShortMessage=((d=(h=(u=l==null?void 0:l.data)==null?void 0:u.error)==null?void 0:h.reason)==null?void 0:d.short)||"Failed to Resend OTP",this.errorLongMessage=((b=(p=(m=l==null?void 0:l.data)==null?void 0:m.error)==null?void 0:p.reason)==null?void 0:b.long)||"An error occurred while resending OTP. Please try again."}finally{this.isLoading=!1}}},startResendCountdown(){this.resendCountdown=120,this.isResendDisabled=!0,this.resendTimer=w(()=>{this.resendCountdown--,this.resendCountdown<=0&&(this.isResendDisabled=!1,clearInterval(this.resendTimer),this.resendTimer=null)},1e3)},startRedirectCountdown(){this.redirectTimer=w(()=>{this.redirectCountdown--,this.redirectCountdown<=0&&(clearInterval(this.redirectTimer),this.redirectTimer=null,this.externalRedirectLink&&(window.location.href=this.externalRedirectLink))},1e3)},async handleEditMobileNumber(){this.isLoading=!0,this.isEditNavigation=!0;try{await v()(`/lakshmi/v1.0/auth/kyc/cancel-otp/${this.userSlug}`,{method:"POST",body:JSON.stringify({token:this.token}),credentials:"include"})}catch{this.isError=!0}finally{this.isLoading=!1,this.$router.push({path:`/kyc/${this.userSlug}`,state:{fromVerification:!0,mobile:this.mobileNumber,panNumber:this.panNumber,legalName:this.legalName,focusMobile:!0}})}},async cancelOtp(){try{await v()(`/lakshmi/v1.0/auth/kyc/cancel-otp/${this.userSlug}`,{method:"POST",body:JSON.stringify({token:this.token}),credentials:"include"})}catch(e){console.error("Failed to cancel OTP:",e)}}}},I={key:0,class:"flex items-center justify-center mt-20","data-atid":"kyc-otp-error-state"},V={key:1,class:"text-center mt-20"},K={class:"text-2xl text-slate-900 font-semibold flex items-center justify-center gap-x-4","data-atid":"kyc-otp-title"},J={class:"flex items-start","data-atid":"kyc-otp-edit-mobile-button"},j={class:"border border-gray-200 p-6 w-fit mx-auto mt-8 rounded-lg","data-atid":"kyc-otp-form"},B={key:0,class:"text-sm text-red-600 text-left mt-4 w-[360px] leading-[1.5]","data-atid":"kyc-otp-error"},U=["disabled"],z={key:1,class:"text-sm text-slate-700 text-left mt-4","data-atid":"kyc-otp-resend-row"},W=["disabled"],G={key:0},H={class:"font-medium"},Y={key:1,class:"text-emerald-600 font-semibold underline"},q=["disabled"],Q={key:0},X={key:1}
1,Z={key:2,class:"text-center mt-20 bg-green-50 p-8 rounded-lg mx-20","data-atid":"kyc-otp-verified-already-done"},$={key:3,class:"text-center mt-20","data-atid":"kyc-otp-redirecting"},ee={class:"font-light text-slate-600 mt-4"};function te(e,i,c,f,t,n){const u=N,h=C,d=E("debounce-click");return a(),o(T,null,[i[12]||(i[12]=r("div",{class:"py-8 px-20 border-b border-gray-200"},[r("img",{src:P,alt:"Pazy",class:"h-5 w-auto"})],-1)),t.isError?(a(),o("div",I,[_(u,{errorCode:t.errorCode,errorShortMessage:t.errorShortMessage,errorLongMessage:t.errorLongMessage},null,8,["errorCode","errorShortMessage","errorLongMessage"])])):!t.verified&&!t.isKycAlreadyDone?(a(),o("div",V,[r("h1",K,[y(" We sent an OTP to Mobile No +91-"+g(t.mobileNumber)+" ",1),r("button",J,[r("img",{src:D,alt:"Edit Mobile Number",class:"inline-block h-6 w-6 mb-1",onClick:i[0]||(i[0]=(...m)=>n.handleEditMobileNumber&&n.handleEditMobileNumber(...m))})])]),i[7]||(i[7]=r("p",{class:"font-light text-slate-600 mt-1"},"Please enter it below to verify.",-1)),r("div",j,[i[6]||(i[6]=r("p",{class:"text-sm text-slate-700 text-left mb-2"},"Verification code",-1)),_(h,{"data-atid":"kyc-otp-input",verificationFailed:t.isOtpError,onVerifyOtpPin:n.handleOtpComplete,onOtpInput:n.handleOtpInput},null,8,["verificationFailed","onVerifyOtpPin","onOtpInput"]),t.isOtpError?(a(),o("p",B,[y(g(t.errorLongMessage)+" ",1),i[3]||(i[3]=r("br",null,null,-1)),x((a(),o("button",{class:O(["text-red-600 font-semibold underline",{"cursor-not-allowed":t.isLoading}]),disabled:t.isLoading,"data-atid":"kyc-otp-resend-button"},[...i[2]||(i[2]=[y(" Resend OTP",-1)])],10,U)),[[d,()=>n.resendOtp()]])])):(a(),o("p",z,[i[5]||(i[5]=y(" Didn't get a code? ",-1)),x((a(),o("button",{class:O(["text-slate-600",{"cursor-not-allowed":t.isResendDisabled||t.isLoading}]),disabled:t.isResendDisabled||t.isLoading,"data-atid":"kyc-otp-resend-button"},[t.isResendDisabled?(a(),o("span",G,[i[4]||(i[4]=y("Resend in ",-1)),r("span",H,g(Math.floor(t.resendCountdown/60))+":"+g(String(t.resendCountdown%60).padStart(2,"0"))+" Mins",1)])):(a(),o("span",Y,"Click to Resend"))],10,W)),[[d,()=>n.resendOtp()]])])),x((a(),o("button",{class:O(["button-primary mt-6 !py-[10px] w-full",{"opacity-50 cursor-not-allowed":!t.isOtpComplete||t.isLoading}]),disabled:!t.isOtpComplete||t.isLoading,"data-atid":"kyc-otp-verify-button"},[t.isLoading?(a(),o("span",Q,"Verifying OTP")):(a(),o("span",X,"Verify OTP"))],10,q)),[[d,()=>n.verifyOtp()]])])])):k("",!0),t.verified&&t.isKycAlreadyDone?(a(),o("div",Z,[i[8]||(i[8]=r("img",{src:S,alt:"Mobile Verified",class:"mx-auto h-12"},null,-1)),i[9]||(i[9]=r("h1",{class:"text-2xl text-slate-900 font-semibold mt-6"}," Mobile Number is verified from the external provider end. ",-1)),i[10]||(i[10]=r("p",{class:"font-light text-slate-600 mt-1"},"A card will be soon assigned to you!",-1)),r("button",{class:"button-primary mx-auto mt-6","data-atid":"kyc-otp-go-home-button",onClick:i[1]||(i[1]=m=>e.$router.push("/home"))}," Go to Home ")])):k("",!0),t.verified&&!t.isKycAlreadyDone?(a(),o("div",$,[i[11]||(i[11]=R('<div><img src="'+F+'" alt="Mobile Verified" class="mx-auto h-12"></div><h1 class="text-2xl mt-8 text-slate-900 font-semibold">Your mobile number and PAN have been verified.</h1><h1 class="text-md mt-8 text-slate-900 font-normal">We are redirecting you to Pine Labs for video kyc.</h1><div class="flex justify-center mt-8"><div class="relative w-10 h-10 animate-spin"><div class="absolute top-0 left-1/2 w-2 h-2 bg-emerald-500 rounded-full transform -translate-x-1/2"></div><div class="absolute top-1 right-1 w-2 h-2 bg-emerald-500 opacity-80 rounded-full"></div><div class="absolute top-1/2 right-0 w-2 h-2 bg-emerald-500 opacity-60 rounded-full transform -translate-y-1/2"></div><div class="absolute bottom-1 right-1 w-2 h-2 bg-emerald-500 opacity-40 rounded-full"></div><div class="absolute bottom-0 left-1/2 w-2 h-2 bg-emerald-500 opacity-20 rounded-full transform -translate-x-1/2"></div><div class="absolute bottom-1 left-1 w-2 h-2 bg-emerald-500 opacity-10 rounded-full"></div><div class="absolute top-1/2 left-0 w-2 h-2 bg-emerald-500 opacity-5 rounded-full transform -translate-y-1/2"></div><div class="absolute top-1 left-1 w-2 h-2 bg-emerald-500 opacity-5 rounded-full"></div></div></div>',4)),r("p",ee,"Redirecting in "+g(t.redirectCountdown)+" seconds",1)])):k("",!0)],64)}const ue=M(A,[["render",te]]);export{ue 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.