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 V,e as T}from"./chunk-XZELSHJP.js";import{k as K}from"./chunk-UWZSUJ2E.js";import{c as q,h as x,i as z,k as G,m as L,n as $,o as H,t as O,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 N,m as D,o as P,p as B}from"./chunk-STBSUBIU.js";import{Ac as E,Ba as _,Ca as A,Cb as I,Fd as M,Hb as S,Jc as f,Kc as g,Ob as R,Tb as d,Ub as m,Vb as p,Zb as U,_ as b,ac as w,kb as a,lb as n,oc as j,qa as C,qc as h,rc as y,sc as k,xb as F}from"./chunk-NW2U37DI.js";import"./chunk-TWZW5B45.js";function ne(s,oe){s&1&&p(0,"i",18)}var Ce=(()=>{class s extends B{constructor(u,t,e,o,c,v,ee,te){super(c),this.customerService=u,this.sanitizer=t,this.router=e,this.cookieService=o,this.toastr=v,this.translate=ee,this.activatedRoute=te,this.hideAlertsUntil={},this.sendingResponse={},this.redireurl=this.activatedRoute.snapshot.queryParams.returnUrl,this.activatedRoute.paramMap.pipe(b(this.unSubscribe$)).subscribe({next:ie=>{this.email=ie.get("id"),this.customerService.google2faauth(this.email).subscribe(l=>{if(l){if(this.data=l,l.success){let i=this.redireurl?this.redireurl:"/customer/dashboard";this.router.navigate([i])}l.announcement?.forEach(i=>{let r=this.cookieService.get("anct"+i.id);r&&(this.hideAlertsUntil["anct"+i.id]=parseInt(r,10))}),l.announcements?.forEach(i=>{let r=this.cookieService.get("anct"+i.id);r&&(this.hideAlertsUntil["anct"+i.id]=parseInt(r,10))}),l.holidays?.forEach(i=>{let r=this.cookieService.get("holiday"+i.id);r&&(this.hideAlertsUntil["holiday"+i.id]=parseInt(r,10))})}})}})}customergoogle2FaFn(u,t){let e={email:this.email,one_time_password:u.value.one_time_password};this.sendingResponse[t]=!0,this.customerService.google2faauthlogin(e).pipe(b(this.unSubscribe$)).subscribe({next:o=>{if(this.sendingResponse[t]=!1,o?.success){this.toastr.success(this.translate.transform(o.success));let c=this.redireurl?this.redireurl:"/customer/dashboard";this.router.navigate([c])}o?.error&&this.toastr.error(this.translate.transform(o.error))},error:()=>{this.sendingResponse[t]=!1}})}static{this.\u0275fac=function(t){return new(t||s)(n(Z),n(N),n(T),n(X),n(P),n(D),n(Q),n(V))}}static{this.\u0275cmp=C({type:s,selectors:[["app-customergoogle2fa"]],standalone:!0,features:[F,E],decls:25,vars:17,consts:[["customergoogle2Fa","ngForm"],[1,"uhelp-announcement-alertgroup"],[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,"text-center"],[1,"form-label"],["id","one_time_password","ngModel","","type","number","name","one_time_password","required","","autofocus","",1,"form-control"],[1,"submit"],["type","submit",1,"btn","btn-secondary","btn-block",3,"disabled"],[1,"fa","fa-spinner","fa-spin","mx-1"]],template:function(t,e){if(t&1){let o=U();d(0,"div",1),p(1,"app-announcement-holiday-banner",2),m(),d(2,"div",3)(3,"div",4)(4,"div",5)(5,"div",6)(6,"div",7)(7,"div",8)(8,"div",9)(9,"h3",10),h(10),f(11,"translate"),m()(),d(12,"form",11,0),w("ngSubmit",function(){_(o);let v=j(13);return A(e.customergoogle2FaFn(v,"customergoogle2Fa"))}),d(14,"div",12)(15,"div",13)(16,"label",14),h(17),f(18,"translate"),m()(),p(19,"input",15),m(),d(20,"div",16)(21,"button",17),h(22),f(23,"translate"),I(24,ne,1,0,"i",18),m()()()()()()()()()}t&2&&(a(),S("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),a(9),y(g(11,11,"2 - Step Verification")),a(7),y(g(18,13,"Please enter the OTP generated on your Google Authenticator App.")),a(4),S("disabled",e.sendingResponse.customertwofactor),a(),k(" ",g(23,15,"Submit"),""),a(2),R(e.sendingResponse.customertwofactor?24:-1))},dependencies:[M,W,J,$,q,H,x,z,O,L,G,Y,K]})}}return s})();export{Ce as Customergoogle2faComponent};
