(self.webpackChunkapp=self.webpackChunkapp||[]).push([[4776],{64776:(V,y,c)=>{c.r(y),c.d(y,{IdentityValidatorCodeCompanyPageModule:()=>W});var C=c(61380),v=c(15861),A=c(59584),h=c(24006),m=c(24889),t=c(45449),n=c(47898),p=c(90603),S=c(37763),P=c(45944),L=c(90944),x=c(33159),H=c(99826);const B=function(l){return{"min-height":l,position:"relative"}},w=[{path:"",component:(()=>{class l{constructor(s,f,E,I,T,M,O,b,F,D,$,k,z,X,J,Q,q,tt,et,it){var i=this;this.formBuilder=s,this.activatedRoute=f,this.navigationService=E,this.loadingService=I,this.deviceInfoService=T,this.ngZoneService=M,this.api=O,this.notificatorService=b,this.warnConflictModalService=F,this.sendVerificationEmailModalService=D,this.logService=$,this.commonService=k,this.storageService=z,this.keyboardService=X,this.translateConfigService=J,this.modalCtrl=Q,this.focusService=q,this.authService=tt,this.showToastModalErroCodeZero=et,this.initRegisterHasCompanyStorageService=it,this.timeoutDefatultToastnotification=5e3,this.onSendVerificationEmailModalStateChange=function(){var a=(0,v.Z)(function*(e){yield i.ngZoneService.run(()=>{i.showSendVerificationEmailModal=e.show,i.emailSendVerificationEmailModal=e.email})});return function(e){return a.apply(this,arguments)}}(),this.onWarnConflictModalStateChange=function(){var a=(0,v.Z)(function*(e){yield i.ngZoneService.run(()=>{i.showWarnConflictModal=e.show,i.emailWarnConflictModal=e.email})});return function(e){return a.apply(this,arguments)}}(),this.onSubmit=()=>{const a=this.companyCodeForm.get("code").errors,e=this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_INVALID_CODE_TITLE"),o=this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_INVALID_CODE_MESSAGE");if(a)this.notificatorService.notify({title:e,message:o,type:"error"});else{this.submitted=!0;let r=null;const d=()=>{r&&r.unsubscribe(),this.loadingService.show(this.translateConfigService.translate("LOADING_PROCESSING_DATA"),"identity-validator-company-code");const u=this.commonService.clearString(this.companyCodeForm.controls.code.value),g=this.uuid,_=this.document,G=this.firstName,Y=this.lastName,j=this.activated,R=this.foreign;this.conflict&&"found"===this.conflict?this.handleFoundConflictType(u,g,_,R):this.conflict&&"notFound"===this.conflict?this.handleNotFoundConflictType(u,g,_,G,Y,R):j?this.handleResetFinish(u,g,_,R):this.handleRegister(u,g,_,G,Y,R)};r=this.keyboardService.onHideObservable?.subscribe(d),this.keyboardService.isVisible()?this.keyboardService.hide():d()}},this.handleFoundConflictType=(a,e,o,r=!1)=>{this.handleResetFinish(a,e,o,r)},this.handleNotFoundConflictType=(a,e,o,r,d,u=!1)=>{this.handleRegister(a,e,o,r,d,u)},this.handleRegister=(a,e,o,r,d,u=!1)=>{let g=this.translateConfigService.getCurrentLang()?this.translateConfigService.getCurrentLang():"en";"pt"===g&&(g="pt-br"),this.api.accountRegister(e,o,r,d,null,g,a,u).subscribe(_=>this.onAccountRegisterSuccessResponse(_,a,e,o,u),this.onAccountRegisterErrorResponse)},this.onAccountRegisterSuccessResponse=(a,e,o,r,d=!1)=>{this.api.accountActivate(e,o,r,d).subscribe(this.accountActivateSuccessResponse,this.accountActivateErrorResponse)},this.onAccountRegisterErrorResponse=a=>{if(console.log("onSubmitErrorResponse"),console.log(a),this.submitted=!1,this.logService.logError("http::onAccountRegisterErrorResponse","",a),this.loadingService.hide(null,"identity-validator-company-code").then(),a){if(400===a.status&&"nomatch"===a.error.errorKey){const r={title:this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCH_TITTLE"),message:this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCH_MESSAGE"),type:"error",timeout:1e4,action:{label:this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCH_MESSAGE_ACTION_LABEL"),customAction:this.openModalNoMatchName.bind(this)}};return this.notificatorService.notify(r)}if(400===a.status){const e=this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_USED_OR_INVALID_CODE_TITLE"),o=this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_USED_OR_INVALID_CODE_MESSAGE");this.toastNotificationError(e,o,this.timeoutDefatultToastnotification)}else if(a.status){const{title:e,message:o}=this.getTitleAndMessage(a);return this.toastNotificationError(e,o,1e4)}}else{const e=this.translateConfigService.translate("TOAST_TITLE_ERROR"),o=`${this.translateConfigService.translate("TOAST_SERVICE_TEMPORARILY_UNAVAILABLE_MESSAGE")} (cod. NoCoDeTyPe)`;this.toastNotificationError(e,o,1e4)}},this.handleResetFinish=(a,e,o,r=!1)=>{this.api.accountDeviceMailessResetInit(e,o,r).subscribe(()=>{this.api.accountDeviceResetFinish(a,e,o,r).subscribe(this.accountActivateSuccessResponse,this.accountActivateErrorResponse)},()=>{this.submitted=!1,this.loadingService.hide(null,"identity-validator-company-code")})},this.accountActivateSuccessResponse=function(){var a=(0,v.Z)(function*(e){if(i.submitted=!1,yield i.loadingService.hide(null,"identity-validator-company-code"),e)if("email-validation"===e.codeType)i.goToEmailValidationNextStep();else if("company-invite"===e.codeType)i.storageService.set("company-invitation-data",{locator:e.locator,invitationKey:e.invitationKey}),i.goToEmailValidationNextStep();else{const{title:o,message:r}=i.getTitleAndMessage(e);i.toastNotificationError(o,r,1e4)}else{const{title:o,message:r}=i.getTitleAndMessage(e);i.toastNotificationError(o,r,1e4)}});return function(e){return a.apply(this,arguments)}}(),this.accountActivateErrorResponse=function(){var a=(0,v.Z)(function*(e){if(console.log("accountActivateErrorResponse"),console.log(e),i.submitted=!1,yield i.loadingService.hide(null,"identity-validator-company-code"),0===e?.status)return i.showToastModalErroCodeZero.showToast(),void i.logService.logError("http::accountActivateErrorResponse","Unknown error",e);if(e&&e.error&&400===e.error.status){let o;if("error.nomatch"===e.error.message)i.logService.logError("http::accountActivateErrorResponseNoMatch","",e),o={title:i.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCH_TITTLE"),message:i.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCH_MESSAGE"),type:"error",timeout:1e4,action:{label:i.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCH_MESSAGE_ACTION_LABEL"),customAction:i.openModalNoMatchName.bind(i)}};else if("error.nomatchforeignflag"===e.error.message){const r=i.foreign?"PG_IDENTIFY_COMPANY_CODE_TOAST_NOT_ENABLED_FOREINGFLAG_MESSAGE":"PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCHFOREINGFLAG_MESSAGE";i.logService.logError("http::accountActivateErrorResponseNoMatch","",e),o={title:i.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCHFOREINGFLAG_TITLE"),message:i.translateConfigService.translate(r),type:"error",timeout:1e4}}else i.logService.logError("http::accountActivateErrorResponseOther","",e),o={title:i.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_INVALID_DATA_TITLE"),message:i.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_INVALID_DATA_MESSAGE"),type:"error",timeout:5e3};i.notificatorService.notify(o)}else if(i.logService.logError("http::accountActivateErrorResponse","",e),e instanceof A.HttpErrorResponse){const{title:o,message:r}=i.getTitleAndMessage(e);i.toastNotificationError(o,r,1e4)}});return function(e){return a.apply(this,arguments)}}(),this.goToEmailValidationNextStep=()=>{this.navigationService.forward(["/identity-insert-password"],{queryParams:{uuid:this.uuid,document:this.document,foreign:this.foreign}})},this.stepBack=()=>{const g={queryParams:{document:this.document,uuid:this.uuid,firstName:this.firstName,lastName:this.lastName,email:this.email,foreign:this.foreign}};console.log(g),this.navigationService.back(["/identity-validator-full-name"],g)},this.dontHaveCode=()=>{this.conflict&&"found"===this.conflict?this.warnConflictModalService.showModal(this.email):this.conflict&&"notFound"===this.conflict?this.goToEmailInsertEmailStep():this.activated?this.sendVerificationEmailModalService.showModal(this.email):this.goToEmailInsertEmailStep()},this.goToEmailInsertEmailStep=()=>{this.navigationService.forward(["/identity-validator-email"],{queryParams:{uuid:this.uuid,document:this.document,firstName:this.firstName,lastName:this.lastName,foreign:this.foreign}})},this.onSendVerificationEmail=()=>{const a=this.uuid,e=this.document,o=this.foreign;this.loadingService.show(this.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_LOADING_SEND_MAIL"),"send-email-verification"),this.api.accountDeviceResetInit(a,e,o,null).subscribe(this.accountDeviceResetInitSuccessResponse,this.accountDeviceResetInitErrorResponse)},this.onSendVerificationEmailModalBack=()=>{this.sendVerificationEmailModalService.hideModal()},this.accountDeviceResetInitSuccessResponse=(0,v.Z)(function*(){yield i.loadingService.hide(null,"send-email-verification");const g={queryParams:{uuid:i.uuid,document:i.document,firstName:i.firstName,lastName:i.lastName,email:i.email,foreign:i.foreign,context:"change-device-identifier"}};i.sendVerificationEmailModalService.hideModal(),i.navigationService.forward(["/identity-validator-code"],g)}),this.accountDeviceResetInitErrorResponse=function(){var a=(0,v.Z)(function*(e){if(console.log("accountCheckErrorResponse"),console.log("response:",e),i.logService.logError("http::account-device-reset-init","",e),yield i.loadingService.hide(null,"send-email-verification"),0===e?.status)return i.showToastModalErroCodeZero.showToast(),void i.logService.logError("http::account-device-reset-init","Unknown error",e);const{title:o,message:r}=i.getTitleAndMessage(e);i.toastNotificationError(o,r,1e4)});return function(e){return a.apply(this,arguments)}}(),this.onWarnConflictModalBack=()=>{this.warnConflictModalService.hideModal()},this.onWarnConflictModalAccept=()=>{const a=this.email;this.warnConflictModalService.hideModal(),this.sendVerificationEmailModalService.showModal(a)},this.activatedRoute.queryParams.subscribe(function(){var a=(0,v.Z)(function*(e){console.log(e);let o=null;(yield i.storageService.ready())&&(o=yield i.authService.getUUID()),i.uuid=o||(e.uuid?e.uuid:""),i.activated="true"===e.activated});return function(e){return a.apply(this,arguments)}}()),this.submitted=!1}ionViewWillEnter(){this.focusService.applyFocusQuerySelector("companyCodeLabel",100);const s=this.initRegisterHasCompanyStorageService.get();s&&(this.document=s?.document??"",this.activated="true"===s?.activated,this.foreign="true"===s?.foreign||!0===s?.foreign,this.uuid=s?.uuid??null,this.firstName=s?.firstName??"",this.lastName=s?.lastName??"",this.email=s?.email??"",this.conflict=s?.conflict??"",console.log("onViewWillEnter app-identity-validator-code-company hascompany",s))}ngOnInit(){this.companyCodeForm=this.formBuilder.group({code:["",[h.Validators.required,h.Validators.minLength(6),h.Validators.maxLength(6)]]}),this.sendVerificationEmailModalService.observable.subscribe(this.onSendVerificationEmailModalStateChange),this.warnConflictModalService.observable.subscribe(this.onWarnConflictModalStateChange)}openModalNoMatchName(){var s=this;return(0,v.Z)(function*(){const f=s.foreign?"PG_IDENTIFY_COMPANY_CODE_NOMATCH_MESSAGE_FOREING":"PG_IDENTIFY_COMPANY_CODE_NOMATCH_MESSAGE",E=s.deviceInfoService.isSmallScreen(),I=s.deviceInfoService.isMediumSmallScreen(),b=(s.deviceInfoService.getDeviceHeight(),E?"modal-generic-component-invalidName -small":I?"modal-generic-component-invalidName -medium":"modal-generic-component-invalidName class-default"),F={title:null,description:`${s.translateConfigService.translate(f)}`,type:"error",typename:m.sX.nomatchInvalidName,img:null,actionsButton:[{label:s.translateConfigService.translate("BTN_CLOSE"),enabled:!0,action:()=>s.modalCtrl.dismiss()}]},D=yield s.modalCtrl.create({component:m.rD,cssClass:b,componentProps:{props:F}});D.style.setProperty("--height","calc(100% - 32%)"),yield D.present()})()}back(){this.navigationService.back(["has-company/identity-email-confirmation"],{queryParams:{document:this.document,uuid:this.uuid,firstName:this.firstName,lastName:this.lastName,email:this.email,foreign:this.foreign}})}getTitleAndMessage(s){let f="",E="";const I=s?.status?`(cod. ${s.status})`:"";return f=this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_SERVICE_ERROR_TITLE"),E=`${this.translateConfigService.translate("TOAST_SERVICE_TEMPORARILY_UNAVAILABLE_MESSAGE")} ${I}`,{title:f,message:E}}toastNotificationError(s,f,E){this.notificatorService.notify({title:s,message:f,type:"error",timeout:E})}}return l.\u0275fac=function(s){return new(s||l)(t.\u0275\u0275directiveInject(h.UntypedFormBuilder),t.\u0275\u0275directiveInject(C.ActivatedRoute),t.\u0275\u0275directiveInject(n.f5),t.\u0275\u0275directiveInject(n.bz),t.\u0275\u0275directiveInject(n.Hc),t.\u0275\u0275directiveInject(n.zf),t.\u0275\u0275directiveInject(n.sM),t.\u0275\u0275directiveInject(n.V6),t.\u0275\u0275directiveInject(n.fj),t.\u0275\u0275directiveInject(n.H0),t.\u0275\u0275directiveInject(n.$V),t.\u0275\u0275directiveInject(n.v_),t.\u0275\u0275directiveInject(n.V1),t.\u0275\u0275directiveInject(n.i8),t.\u0275\u0275directiveInject(n.wK),t.\u0275\u0275directiveInject(p.ModalController),t.\u0275\u0275directiveInject(S.i),t.\u0275\u0275directiveInject(n.e8),t.\u0275\u0275directiveInject(n.ME),t.\u0275\u0275directiveInject(P.K))},l.\u0275cmp=t.\u0275\u0275defineComponent({type:l,selectors:[["app-identity-validator-code-company"]],decls:29,vars:20,consts:[[1,"ion-no-border",2,"height","0"],[3,"ngStyle"],[1,"ion-margin-vertical"],["id","companyCodeLabel"],[1,"flex-auto"],[3,"formGroup","ngSubmit"],["for","companyCode",1,"companyCode"],["tabindex","1"],[1,"input-holder"],["tabindex","2","id","companyCode","type","code","formControlName","code",3,"placeholder"],[1,"textsub"],[1,"button-holder"],["type","button",1,"back",3,"click"],["tabindex","5"],["type","submit",3,"disabled"],["tabindex","3"]],template:function(s,f){1&s&&(t.\u0275\u0275element(0,"ion-header",0),t.\u0275\u0275elementStart(1,"ion-content")(2,"ion-grid",1)(3,"ion-row")(4,"ion-col",2),t.\u0275\u0275element(5,"app-full-logo",3),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(6,"ion-row",4)(7,"ion-col",2)(8,"form",5),t.\u0275\u0275listener("ngSubmit",function(){return f.onSubmit()}),t.\u0275\u0275elementStart(9,"div",6)(10,"p",7),t.\u0275\u0275text(11),t.\u0275\u0275pipe(12,"translate"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(13,"div",8),t.\u0275\u0275element(14,"input",9),t.\u0275\u0275pipe(15,"translate"),t.\u0275\u0275elementEnd(),t.\u0275\u0275elementStart(16,"div",10)(17,"p"),t.\u0275\u0275text(18),t.\u0275\u0275pipe(19,"translate"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(20,"div",11)(21,"button",12),t.\u0275\u0275listener("click",function(){return f.back()}),t.\u0275\u0275elementStart(22,"span",13),t.\u0275\u0275text(23),t.\u0275\u0275pipe(24,"translate"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(25,"button",14)(26,"span",15),t.\u0275\u0275text(27),t.\u0275\u0275pipe(28,"translate"),t.\u0275\u0275elementEnd()()()()()()()()),2&s&&(t.\u0275\u0275advance(2),t.\u0275\u0275property("ngStyle",t.\u0275\u0275pureFunction1(18,B,f.deviceInfoService.getDeviceHeight()+"px")),t.\u0275\u0275advance(6),t.\u0275\u0275property("formGroup",f.companyCodeForm),t.\u0275\u0275advance(3),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(12,8,"HAS_COMPANY_REGISTER.CODE_COMPANY_PAGE.VERIFY_YOUR_REGISTERED_EMAIL")," "),t.\u0275\u0275advance(3),t.\u0275\u0275property("placeholder",t.\u0275\u0275pipeBind1(15,10,"HAS_COMPANY_REGISTER.CODE_COMPANY_PAGE.PLACEHOLDER")),t.\u0275\u0275advance(4),t.\u0275\u0275textInterpolate(t.\u0275\u0275pipeBind1(19,12,"HAS_COMPANY_REGISTER.CODE_COMPANY_PAGE.IF_YOU_DONT_FIND")),t.\u0275\u0275advance(5),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(24,14,"BTN_BACK"),""),t.\u0275\u0275advance(2),t.\u0275\u0275property("disabled",f.submitted),t.\u0275\u0275advance(2),t.\u0275\u0275textInterpolate(t.\u0275\u0275pipeBind1(28,16,"BTN_NEXT")))},dependencies:[L.NgStyle,p.IonCol,p.IonContent,p.IonGrid,p.IonHeader,p.IonRow,h.\u0275NgNoValidate,h.DefaultValueAccessor,h.NgControlStatus,h.NgControlStatusGroup,h.FormGroupDirective,h.FormControlName,x.R,H.X$],styles:[".button-holder.center[_ngcontent-%COMP%]{position:absolute;bottom:24px;text-align:center;width:100vw;left:0;font-size:.9em;color:#656768;padding:1em 0;display:flex;align-items:center;justify-content:center}input[_ngcontent-%COMP%]{text-align:center}.dontHaveCode[_ngcontent-%COMP%]{bottom:calc(20px + env(safe-area-inset-bottom))!important}ion-label[_ngcontent-%COMP%]{color:#656768;font-weight:500}.companyCode[_ngcontent-%COMP%]{margin:1em 2em 2em;font-size:1em;color:#656768;display:flex;text-align:justify}.textsub[_ngcontent-%COMP%]{margin:2em;font-size:1em;color:#656768;display:flex;text-align:justify}"]}),l})()}];let K=(()=>{class l{}return l.\u0275fac=function(s){return new(s||l)},l.\u0275mod=t.\u0275\u0275defineNgModule({type:l}),l.\u0275inj=t.\u0275\u0275defineInjector({imports:[C.RouterModule.forChild(w),C.RouterModule]}),l})();var U=c(15626),Z=c(69270);let W=(()=>{class l{}return l.\u0275fac=function(s){return new(s||l)},l.\u0275mod=t.\u0275\u0275defineNgModule({type:l}),l.\u0275inj=t.\u0275\u0275defineInjector({imports:[Z.I,U.K,K]}),l})()},37763:(V,y,c)=>{c.d(y,{i:()=>t});var C=c(61380),A=c(92198),h=c(45449);let t=(()=>{class n{constructor(S){this.router=S}focusInRouterNavigate(){this.router.events.pipe((0,A.h)(S=>S instanceof C.NavigationEnd)).subscribe(()=>{const S=document.querySelector("#focusHeader");S&&S?.focus()})}applyFocusQuerySelector(S,P){setTimeout(()=>{document.querySelector(`#${S}`)?.focus()},P)}}return n.\u0275fac=function(S){return new(S||n)(h.\u0275\u0275inject(C.Router))},n.\u0275prov=h.\u0275\u0275defineInjectable({token:n,factory:n.\u0275fac,providedIn:"root"}),n})()},45944:(V,y,c)=>{c.d(y,{K:()=>h});var C=c(15861),v=c(45449);let A=(()=>{class m{constructor(){}set(n,p){localStorage.setItem(n,JSON.stringify(p))}get(n){return JSON.parse(localStorage.getItem(n))??null}remove(n){localStorage.removeItem(n)}clear(){localStorage.clear()}}return m.\u0275fac=function(n){return new(n||m)},m.\u0275prov=v.\u0275\u0275defineInjectable({token:m,factory:m.\u0275fac,providedIn:"root"}),m})(),h=(()=>{class m{constructor(n){this.simpleStorageService=n,this.KEY="REGISTER_HAS_COMPANY",this.cache=null}set(n){this.simpleStorageService.set(this.KEY,n),this.cache=n}get(){const n=this.simpleStorageService.get(this.KEY);return this.cache=n,n}remove(){var n=this;return(0,C.Z)(function*(){n.simpleStorageService.remove(n.KEY),n.cache=null})()}}return m.\u0275fac=function(n){return new(n||m)(v.\u0275\u0275inject(A))},m.\u0275prov=v.\u0275\u0275defineInjectable({token:m,factory:m.\u0275fac,providedIn:"root"}),m})()}}]);