1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
(self.webpackChunkapp=self.webpackChunkapp||[]).push([[1100],{31100:(B,N,r)=>{r.r(N),r.d(N,{IdentityValidatorCompanyCodePageModule:()=>Z});var _=r(90944),h=r(24006),T=r(61380),v=r(90603),G=r(69270),S=r(15861),E=r(59584),y=r(24889),t=r(45449),u=r(47898),L=r(37763),j=r(33159),H=r(202),w=r(97842),x=r(99826);const U=function(m){return{"min-height":m,position:"relative"}},W=[{path:"",component:(()=>{class m{constructor(s,c,g,C,O,D,P,R,b,M,K,k,$,X,z,Q,J,q,tt){var i=this;this.formBuilder=s,this.activatedRoute=c,this.navigationService=g,this.loadingService=C,this.deviceInfoService=O,this.ngZoneService=D,this.api=P,this.notificatorService=R,this.warnConflictModalService=b,this.sendVerificationEmailModalService=M,this.logService=K,this.commonService=k,this.storageService=$,this.keyboardService=X,this.translateConfigService=z,this.modalCtrl=Q,this.focusService=J,this.authService=q,this.showToastModalErroCodeZero=tt,this.timeoutDefatultToastnotification=5e3,this.onSendVerificationEmailModalStateChange=function(){var n=(0,S.Z)(function*(e){yield i.ngZoneService.run(()=>{i.showSendVerificationEmailModal=e.show,i.emailSendVerificationEmailModal=e.email})});return function(e){return n.apply(this,arguments)}}(),this.onWarnConflictModalStateChange=function(){var n=(0,S.Z)(function*(e){yield i.ngZoneService.run(()=>{i.showWarnConflictModal=e.show,i.emailWarnConflictModal=e.email})});return function(e){return n.apply(this,arguments)}}(),this.onSubmit=()=>{const n=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(n)this.notificatorService.notify({title:e,message:o,type:"error"});else{this.submitted=!0;let a=null;const l=()=>{a&&a.unsubscribe(),this.loadingService.show(this.translateConfigService.translate("LOADING_PROCESSING_DATA"),"identity-validator-company-code");const d=this.commonService.clearString(this.companyCodeForm.controls.code.value),f=this.uuid,p=this.document,F=this.firstName,V=this.lastName,Y=this.activated,I=this.foreign;this.conflict&&"found"===this.conflict?this.handleFoundConflictType(d,f,p,I):this.conflict&&"notFound"===this.conflict?this.handleNotFoundConflictType(d,f,p,F,V,I):Y?this.handleResetFinish(d,f,p,I):this.handleRegister(d,f,p,F,V,I)};a=this.keyboardService.onHideObservable?.subscribe(l),this.keyboardService.isVisible()?this.keyboardService.hide():l()}},this.handleFoundConflictType=(n,e,o,a=!1)=>{this.handleResetFinish(n,e,o,a)},this.handleNotFoundConflictType=(n,e,o,a,l,d=!1)=>{this.handleRegister(n,e,o,a,l,d)},this.handleRegister=(n,e,o,a,l,d=!1)=>{let f=this.translateConfigService.getCurrentLang()?this.translateConfigService.getCurrentLang():"en";"pt"===f&&(f="pt-br"),this.api.accountRegister(e,o,a,l,null,f,n,d).subscribe(p=>this.onAccountRegisterSuccessResponse(p,n,e,o,d),this.onAccountRegisterErrorResponse)},this.onAccountRegisterSuccessResponse=(n,e,o,a,l=!1)=>{this.api.accountActivate(e,o,a,l).subscribe(this.accountActivateSuccessResponse,this.accountActivateErrorResponse)},this.onAccountRegisterErrorResponse=n=>{if(console.log("onSubmitErrorResponse"),console.log(n),this.submitted=!1,this.logService.logError("http::onAccountRegisterErrorResponse","",n),this.loadingService.hide(null,"identity-validator-company-code").then(),n){if(400===n.status&&"nomatch"===n.error.errorKey){const a={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(a)}if(400===n.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(n.status){const{title:e,message:o}=this.getTitleAndMessage(n);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=(n,e,o,a=!1)=>{this.api.accountDeviceMailessResetInit(e,o,a).subscribe(()=>{this.api.accountDeviceResetFinish(n,e,o,a).subscribe(this.accountActivateSuccessResponse,this.accountActivateErrorResponse)},()=>{this.submitted=!1,this.loadingService.hide(null,"identity-validator-company-code")})},this.accountActivateSuccessResponse=function(){var n=(0,S.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:a}=i.getTitleAndMessage(e);i.toastNotificationError(o,a,1e4)}else{const{title:o,message:a}=i.getTitleAndMessage(e);i.toastNotificationError(o,a,1e4)}});return function(e){return n.apply(this,arguments)}}(),this.accountActivateErrorResponse=function(){var n=(0,S.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 a=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(a),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 E.HttpErrorResponse){const{title:o,message:a}=i.getTitleAndMessage(e);i.toastNotificationError(o,a,1e4)}});return function(e){return n.apply(this,arguments)}}(),this.goToEmailValidationNextStep=()=>{this.navigationService.forward(["/identity-insert-password"],{queryParams:{uuid:this.uuid,document:this.document,foreign:this.foreign}})},this.stepBack=()=>{this.navigationService.back(["/identity-validator-full-name"],{queryParams:{document:this.document,uuid:this.uuid,firstName:this.firstName,lastName:this.lastName,email:this.email,foreign:this.foreign}})},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 n=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(n,e,o,null).subscribe(this.accountDeviceResetInitSuccessResponse,this.accountDeviceResetInitErrorResponse)},this.onSendVerificationEmailModalBack=()=>{this.sendVerificationEmailModalService.hideModal()},this.accountDeviceResetInitSuccessResponse=(0,S.Z)(function*(){yield i.loadingService.hide(null,"send-email-verification");const f={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"],f)}),this.accountDeviceResetInitErrorResponse=function(){var n=(0,S.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:a}=i.getTitleAndMessage(e);i.toastNotificationError(o,a,1e4)});return function(e){return n.apply(this,arguments)}}(),this.onWarnConflictModalBack=()=>{this.warnConflictModalService.hideModal()},this.onWarnConflictModalAccept=()=>{const n=this.email;this.warnConflictModalService.hideModal(),this.sendVerificationEmailModalService.showModal(n)},this.activatedRoute.queryParams.subscribe(function(){var n=(0,S.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.document=e.document?e.document:"",i.firstName=e.firstName?e.firstName:"",i.lastName=e.lastName?e.lastName:"",i.email=e.email?e.email:"",i.conflict=e.conflict?e.conflict:"",i.activated="true"===e.activated,i.foreign="true"===e.foreign});return function(e){return n.apply(this,arguments)}}()),this.submitted=!1}ionViewWillEnter(){this.focusService.applyFocusQuerySelector("companyCodeLabel",100)}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,S.Z)(function*(){const c=s.foreign?"PG_IDENTIFY_COMPANY_CODE_NOMATCH_MESSAGE_FOREING":"PG_IDENTIFY_COMPANY_CODE_NOMATCH_MESSAGE",g=s.deviceInfoService.isSmallScreen(),C=s.deviceInfoService.isMediumSmallScreen(),R=(s.deviceInfoService.getDeviceHeight(),g?"modal-generic-component-invalidName -small":C?"modal-generic-component-invalidName -medium":"modal-generic-component-invalidName class-default"),b={title:null,description:`${s.translateConfigService.translate(c)}`,type:"error",typename:y.sX.nomatchInvalidName,img:null,actionsButton:[{label:s.translateConfigService.translate("BTN_CLOSE"),enabled:!0,action:()=>s.modalCtrl.dismiss()}]},M=yield s.modalCtrl.create({component:y.rD,cssClass:R,componentProps:{props:b}});M.style.setProperty("--height","calc(100% - 32%)"),yield M.present()})()}getTitleAndMessage(s){let c="",g="";const C=s?.status?`(cod. ${s.status})`:"";return c=this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_SERVICE_ERROR_TITLE"),g=`${this.translateConfigService.translate("TOAST_SERVICE_TEMPORARILY_UNAVAILABLE_MESSAGE")} ${C}`,{title:c,message:g}}toastNotificationError(s,c,g){this.notificatorService.notify({title:s,message:c,type:"error",timeout:g})}}return m.\u0275fac=function(s){return new(s||m)(t.\u0275\u0275directiveInject(h.UntypedFormBuilder),t.\u0275\u0275directiveInject(T.ActivatedRoute),t.\u0275\u0275directiveInject(u.f5),t.\u0275\u0275directiveInject(u.bz),t.\u0275\u0275directiveInject(u.Hc),t.\u0275\u0275directiveInject(u.zf),t.\u0275\u0275directiveInject(u.sM),t.\u0275\u0275directiveInject(u.V6),t.\u0275\u0275directiveInject(u.fj),t.\u0275\u0275directiveInject(u.H0),t.\u0275\u0275directiveInject(u.$V),t.\u0275\u0275directiveInject(u.v_),t.\u0275\u0275directiveInject(u.V1),t.\u0275\u0275directiveInject(u.i8),t.\u0275\u0275directiveInject(u.wK),t.\u0275\u0275directiveInject(v.ModalController),t.\u0275\u0275directiveInject(L.i),t.\u0275\u0275directiveInject(u.e8),t.\u0275\u0275directiveInject(u.ME))},m.\u0275cmp=t.\u0275\u0275defineComponent({type:m,selectors:[["app-identity-validator-company-code"]],decls:32,vars:28,consts:[[1,"ion-no-border",2,"height","0"],[3,"ngStyle"],[1,"ion-margin-vertical"],["id","companyCodeLabel"],[1,"flex-auto"],[3,"formGroup","ngSubmit"],[1,"input-holder"],["for","companyCode"],["tabindex","1"],["tabindex","2","id","companyCode","type","code","formControlName","code",3,"placeholder"],[1,"button-holder"],["type","button",1,"back",3,"click"],["tabindex","5"],["type","submit",3,"disabled"],["tabindex","3"],[1,"button-holder","center","dontHaveCode"],["type","button",3,"click"],["tabindex","4"],[3,"show","email","onBack","onSend"],[3,"show","email","onBack","onAccept"]],template:function(s,c){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 c.onSubmit()}),t.\u0275\u0275elementStart(9,"div",6)(10,"ion-label",7)(11,"span",8),t.\u0275\u0275text(12),t.\u0275\u0275pipe(13,"translate"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275element(14,"input",9),t.\u0275\u0275pipe(15,"translate"),t.\u0275\u0275elementEnd(),t.\u0275\u0275elementStart(16,"div",10)(17,"button",11),t.\u0275\u0275listener("click",function(){return c.stepBack()}),t.\u0275\u0275elementStart(18,"span",12),t.\u0275\u0275text(19),t.\u0275\u0275pipe(20,"translate"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(21,"button",13)(22,"span",14),t.\u0275\u0275text(23),t.\u0275\u0275pipe(24,"translate"),t.\u0275\u0275elementEnd()()()()()(),t.\u0275\u0275elementStart(25,"div",15)(26,"button",16),t.\u0275\u0275listener("click",function(){return c.dontHaveCode()}),t.\u0275\u0275elementStart(27,"span",17),t.\u0275\u0275text(28),t.\u0275\u0275pipe(29,"translate"),t.\u0275\u0275elementEnd()()()(),t.\u0275\u0275element(30,"app-send-verification-email-modal",18)(31,"app-warn-conflict-modal",19),t.\u0275\u0275elementEnd()),2&s&&(t.\u0275\u0275advance(2),t.\u0275\u0275property("ngStyle",t.\u0275\u0275pureFunction1(26,U,c.deviceInfoService.getDeviceHeight()+"px")),t.\u0275\u0275advance(6),t.\u0275\u0275property("formGroup",c.companyCodeForm),t.\u0275\u0275advance(4),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(13,16,"PG_IDENTIFY_COMPANY_CODE_TEXT")," "),t.\u0275\u0275advance(2),t.\u0275\u0275property("placeholder",t.\u0275\u0275pipeBind1(15,18,"PG_IDENTIFY_COMPANY_CODE_INPUT")),t.\u0275\u0275advance(5),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(20,20,"BTN_BACK"),""),t.\u0275\u0275advance(2),t.\u0275\u0275property("disabled",c.submitted),t.\u0275\u0275advance(2),t.\u0275\u0275textInterpolate(t.\u0275\u0275pipeBind1(24,22,"BTN_NEXT")),t.\u0275\u0275advance(5),t.\u0275\u0275textInterpolate(t.\u0275\u0275pipeBind1(29,24,"PG_IDENTIFY_COMPANY_CODE_BTN_DONTHAVECODE")),t.\u0275\u0275advance(2),t.\u0275\u0275property("show",c.showSendVerificationEmailModal)("email",c.emailSendVerificationEmailModal)("onBack",c.onSendVerificationEmailModalBack)("onSend",c.onSendVerificationEmail),t.\u0275\u0275advance(1),t.\u0275\u0275property("show",c.showWarnConflictModal)("email",c.emailWarnConflictModal)("onBack",c.onWarnConflictModalBack)("onAccept",c.onWarnConflictModalAccept))},dependencies:[_.NgStyle,v.IonCol,v.IonContent,v.IonGrid,v.IonHeader,v.IonLabel,v.IonRow,h.\u0275NgNoValidate,h.DefaultValueAccessor,h.NgControlStatus,h.NgControlStatusGroup,h.FormGroupDirective,h.FormControlName,j.R,H._,w.p,x.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-transform:uppercase;text-align:center}.dontHaveCode[_ngcontent-%COMP%]{bottom:calc(20px + env(safe-area-inset-bottom))!important}ion-label[_ngcontent-%COMP%]{color:#656768;font-weight:500}"]}),m})()}];let Z=(()=>{class m{}return m.\u0275fac=function(s){return new(s||m)},m.\u0275mod=t.\u0275\u0275defineNgModule({type:m}),m.\u0275inj=t.\u0275\u0275defineInjector({imports:[G.I,_.CommonModule,h.FormsModule,h.ReactiveFormsModule,v.IonicModule,T.RouterModule.forChild(W)]}),m})()},37763:(B,N,r)=>{r.d(N,{i:()=>S});var _=r(61380),T=r(92198),v=r(45449);let S=(()=>{class E{constructor(t){this.router=t}focusInRouterNavigate(){this.router.events.pipe((0,T.h)(t=>t instanceof _.NavigationEnd)).subscribe(()=>{const t=document.querySelector("#focusHeader");t&&t?.focus()})}applyFocusQuerySelector(t,u){setTimeout(()=>{document.querySelector(`#${t}`)?.focus()},u)}}return E.\u0275fac=function(t){return new(t||E)(v.\u0275\u0275inject(_.Router))},E.\u0275prov=v.\u0275\u0275defineInjectable({token:E,factory:E.\u0275fac,providedIn:"root"}),E})()}}]); |