import{a as Y}from"./chunk-I335XYV2.js";import{a as X}from"./chunk-BJFVOGCX.js";import{a as Z}from"./chunk-BXXEY6EK.js";import{c as N,e as x}from"./chunk-XZELSHJP.js";import{k as K}from"./chunk-UWZSUJ2E.js";import{c as P,h as z,i as L,k as $,m as q,n as G,o as H,y as J}from"./chunk-AUG6ZMIQ.js";import{c as W}from"./chunk-JQJV7TYV.js";import{c as Q}from"./chunk-YM543BQE.js";import{l as M,m as B,o as O,p as D}from"./chunk-STBSUBIU.js";import{Ac as V,Ba as S,Ca as C,Cb as w,Fd as F,Hb as b,Jc as p,Kc as u,Ob as R,Tb as d,Ub as m,Vb as h,Zb as T,_ as y,ac as _,fc as j,kb as n,lb as s,oc as E,qa as U,qc as v,rc as A,sc as I,xb as k}from"./chunk-NW2U37DI.js";import"./chunk-TWZW5B45.js";function re(a,ee){a&1&&h(0,"i",16)}function oe(a,ee){a&1&&h(0,"i",16)}var we=(()=>{class a extends D{constructor(r,t,e,o,f,g,te,ie){super(f),this.customerService=r,this.sanitizer=t,this.router=e,this.cookieService=o,this.toastr=g,this.translate=te,this.activatedRoute=ie,this.hideAlertsUntil={},this.sendingResponse={},this.redireurl=this.activatedRoute.snapshot.queryParams.returnUrl,this.activatedRoute.paramMap.pipe(y(this.unSubscribe$)).subscribe({next:ne=>{this.email=ne.get("id"),this.customerService.verifytwofactor(this.email).subscribe(c=>{if(c){if(this.data=c,c.success){let i=this.redireurl?this.redireurl:"/customer/dashboard";this.router.navigate([i])}c.announcement?.forEach(i=>{let l=this.cookieService.get("anct"+i.id);l&&(this.hideAlertsUntil["anct"+i.id]=parseInt(l,10))}),c.announcements?.forEach(i=>{let l=this.cookieService.get("anct"+i.id);l&&(this.hideAlertsUntil["anct"+i.id]=parseInt(l,10))}),c.holidays?.forEach(i=>{let l=this.cookieService.get("holiday"+i.id);l&&(this.hideAlertsUntil["holiday"+i.id]=parseInt(l,10))})}})}})}customertwofactorFn(r,t){let e={email:this.email,otp:r.value.otp};this.sendingResponse[t]=!0,this.customerService.otpverify(e).pipe(y(this.unSubscribe$)).subscribe({next:o=>{if(this.sendingResponse[t]=!1,o?.success){this.toastr.success(this.translate.transform(o.success));let f=this.redireurl?this.redireurl:"/customer/dashboard";this.router.navigate([f])}o?.error&&this.toastr.error(this.translate.transform(o.error))},error:()=>{this.sendingResponse[t]=!1}})}resendotp(r){this.sendingResponse[r]=!0,this.customerService.resendotp(this.email).subscribe({next:t=>{this.sendingResponse[r]=!1,t?.success&&this.toastr.success(this.translate.transform(t.success))},error:t=>{this.sendingResponse[r]=!1}})}static{this.\u0275fac=function(t){return new(t||a)(s(Z),s(M),s(x),s(X),s(O),s(B),s(Q),s(N))}}static{this.\u0275cmp=U({type:a,selectors:[["app-customertwofactor"]],standalone:!0,features:[k,V],decls:30,vars:25,consts:[["customertwofactor","ngForm"],[3,"setting","user","announcement","announcements","holidays","hideAlertsUntil"],[1,"page","login-bg1"],[1,"page-single"],[1,"container"],[1,"row","justify-content-center","py-4"],[1,"col-sm-12"],[1,"card","authentication-card","px-3","py-5","mx-auto"],[1,"pb-0","px-5","pt-0","text-center"],[1,"mb-2"],[1,"card-body","pt-3","pb-0",3,"ngSubmit"],[1,"form-group"],[1,"form-label"],["name","otp","ngModel","","type","number",1,"form-control",3,"placeholder"],[1,"submit"],["type","submit",1,"btn","btn-secondary","btn-block",3,"disabled"],[1,"fa","fa-spinner","fa-spin","mx-1"],[1,"text-center","mt-4"],[1,"text-dark","mb-0"],["type","button",1,"text-primary","ms-1","bg-transparent","border-0",3,"click","disabled"]],template:function(t,e){if(t&1){let o=T();h(0,"app-announcement-holiday-banner",1),d(1,"div",2)(2,"div",3)(3,"div",4)(4,"div",5)(5,"div",6)(6,"div",7)(7,"div",8)(8,"h3",9),v(9),p(10,"translate"),m()(),d(11,"form",10,0),_("ngSubmit",function(){S(o);let g=E(12);return C(e.customertwofactorFn(g,"customertwofactor"))}),d(13,"div",11)(14,"label",12),v(15),p(16,"translate"),m(),h(17,"input",13),p(18,"translate"),m(),d(19,"div",14)(20,"button",15),v(21),p(22,"translate"),w(23,re,1,0,"i",16),m()(),d(24,"div",17)(25,"p",18)(26,"button",19),_("click",function(){return S(o),C(e.resendotp("resendOtp"))}),v(27),p(28,"translate"),w(29,oe,1,0,"i",16),m()()()()()()()()()()}t&2&&(b("setting",e.data==null||e.data.setting==null?null:e.data.setting.original)("user",e.data==null?null:e.data.user)("announcement",e.data==null?null:e.data.announcement)("announcements",e.data==null?null:e.data.announcements)("holidays",e.data==null?null:e.data.holidays)("hideAlertsUntil",e.hideAlertsUntil),n(9),A(u(10,15,"2 - Step Verification")),n(6),A(u(16,17,"Enter your Otp")),n(2),j("placeholder",u(18,19,"OTP")),n(3),b("disabled",e.sendingResponse.customertwofactor),n(),I(" ",u(22,21,"Submit"),""),n(2),R(e.sendingResponse.customertwofactor?23:-1),n(3),b("disabled",e.sendingResponse.resendOtp),n(),I("",u(28,23,"Resend OTP")," "),n(2),R(e.sendingResponse.resendOtp?29:-1))},dependencies:[F,Y,W,J,G,P,H,z,L,q,$,K]})}}return a})();export{we as CustomertwofactorComponent};
