1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
(self.webpackChunkapp=self.webpackChunkapp||[]).push([[3493],{23493:(H,R,f)=>{f.r(R),f.d(R,{IdentityEmailConfirmationPageModule:()=>$});var A=f(90944),N=f(61380),S=f(15861),T=f(24006),i=f(45449),d=f(47898),c=f(90603),M=f(45944),k=f(33159),Y=f(99826);const K=function(u){return{"min-height":u,position:"relative"}},Z=[{path:"",component:(()=>{class u{constructor(r,a,m,v,_,F,U,L,D,b,O,w,G,P,z,X,Q,J,q,ee,te){var t=this;this.formBuilder=r,this.api=a,this.activatedRoute=m,this.notificatorService=v,this.loadingService=_,this.keyboardService=F,this.sendVerificationEmailModalService=U,this.warnConflictModalService=L,this.ngZoneService=D,this.deviceInfoService=b,this.navigationService=O,this.logService=w,this.translateConfigService=G,this.authService=P,this.storageService=z,this.deviceUuidService=X,this.platform=Q,this.saveFlowStorageResetKeyService=J,this.utilsService=q,this.showToastModalErroCodeZero=ee,this.initRegisterHasCompanyStorageService=te,this.obfuscatedEmail=void 0,this.fullDataParans={},this.onSendVerificationEmailModalStateChange=function(){var e=(0,S.Z)(function*(n){yield t.ngZoneService.run(()=>{t.showSendVerificationEmailModal=n.show,t.emailSendVerificationEmailModal=n.email})});return function(n){return e.apply(this,arguments)}}(),this.onWarnConflictModalStateChange=function(){var e=(0,S.Z)(function*(n){yield t.ngZoneService.run(()=>{t.showWarnConflictModal=n.show,t.emailWarnConflictModal=n.email})});return function(n){return e.apply(this,arguments)}}(),this.onSubmit=(0,S.Z)(function*(){let e=null;if(e=yield t.getUniqueDeviceId(),t.uuid=e??"",!t.uuid||null==t.uuid||t.uuid.length<=0)t.logService.logEvent("UUIID::in_Submit","Null UUID - Methodo Submit");else if(t.validateForm(t.fullNameForm)){let o=null;const s=()=>{o&&o.unsubscribe(),t.loadingService.show(t.translateConfigService.translate("LOADING_PROCESSING_DATA"),"identity-validator-full-name");const l=t.getFirstName(),h=t.getLastName();if(t.foreign){const g=t.utilsService.convertToUppercase(t.document);t.api.verifyForeignFullName(g,l,h,t.foreign).subscribe(t.verifyFullNameSuccessResponse,t.verifyFullNameErrorResponse)}else t.api.verifyFullName(t.document,l,h,t.foreign).subscribe(t.verifyFullNameSuccessResponse,t.verifyFullNameErrorResponse)};o=t.keyboardService.onHideObservable?.subscribe(s),t.keyboardService.isVisible()?t.keyboardService.hide():s()}else{t.logService.logError("user::register-full-name");const o={title:t.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_INVALID_DATA_TITLE"),message:t.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_INVALID_DATA_MESSAGE"),type:"error"};t.notificatorService.notify(o)}}),this.getFirstName=()=>{let e=this.fullNameForm.controls.fullName.value;return e=e.trim(),e=e.split(" "),e[0]?e[0]:""},this.getLastName=()=>{let e=this.fullNameForm.controls.fullName.value;return e=e.trim(),e=e.split(" "),e=e.filter((n,o)=>0!==o),e.join(" ")},this.validateForm=e=>{const n=this.getFirstName(),o=this.getLastName();if(n&&o){const s=n.length,l=o.length;return s+l>2&&s+l<255}return!1},this.verifyFullNameForeignSuccessResponse=e=>{this.checkAccount()},this.verifyFullNameSuccessResponse=e=>{this.verifyIfMatch(e)?this.checkAccount():(this.logService.logEvent("user::register-full-name-no-match"),this.showErroNoMatchNameDocument(e))},this.verifyFullNameErrorResponse=e=>{if(this.logService.logError("http::register-full-name","",e),e&&e?.error&&e?.error?.errorKey&&400===e?.error.status){if(!this.verifyIfMatch({matched:"notmatched"!==e?.error?.errorKey}))return void this.showErroNoMatchNameDocument(e);this.checkAccount()}this.loadingService.hide(null,"identity-validator-full-name").then(()=>{if(0===e?.status)return this.showToastModalErroCodeZero.showToast(),void this.logService.logError("http::register-full-name","Unknown error",e);if(400===e.status){const n={title:this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_ERROR_REQUEST_TITLE"),message:`${this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_ERROR_REQUEST_MESSAGE")} (cod. 400)`,type:"error"};return this.notificatorService.notify(n)}if(404===e.status)this.checkAccount();else{let n;this.foreign&&(n=this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_NOT_FOUND_MESSAGE"));const o={title:this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_SERVICE_ERROR_TITLE"),message:n,type:"error"};this.notificatorService.notify(o)}})},this.checkAccount=()=>{const e=this.uuid,n=this.document,o=this.foreign,s=o?this.utilsService.convertToUppercase(n):n;this.api.accountCheck(e,s,o).subscribe(this.accountCheckSuccessResponse,this.accountCheckErrorResponse)},this.accountCheckSuccessResponse=e=>{const s=e&&e.obfuscatedEmail?e.obfuscatedEmail:"";!this.context&&e&&e.hasAnyCompany&&e&&e.activated&&(this.context="has-company"),this.loadingService.hide(null,"identity-validator-full-name").then(()=>{"forgot-pin"===this.context||"has-company"===this.context?this.onSendVerificationEmail(s,e):this.goToCompanyCodeStep(e)})},this.goToCompanyCodeStep=e=>{const n=!!e.activated&&e.activated,o=e.obfuscatedEmail?e.obfuscatedEmail:"",s=this.uuid,l=this.document,h=this.getFirstName(),g=this.getLastName(),y=this.foreign,I=y?this.utilsService.convertToUppercase(l):l;this.navigationService.forward(["/identity-validator-company-code"],{queryParams:{uuid:s,document:I,firstName:h,lastName:g,email:o,conflict:!1,activated:n,foreign:y}})},this.accountCheckErrorResponse=e=>{this.loadingService.hide(null,"identity-validator-full-name").then(()=>{if(404===e.status){const n=this.uuid,o=this.document,s=this.getFirstName(),l=this.getLastName();this.navigationService.forward(["/identity-validator-company-code"],{queryParams:{uuid:n,document:o,firstName:s,lastName:l,foreign:this.foreign}})}else if(409===e.status){if("notFound"===e.error.conflictType){const n=this.uuid,o=this.document,s=this.getFirstName(),l=this.getLastName();this.navigationService.forward(["/identity-validator-company-code"],{queryParams:{uuid:n,document:o,firstName:s,lastName:l,conflict:"notFound",foreign:this.foreign}})}else if("found"===e.error.conflictType){const n=e&&e.error.hasAnyCompany,o=e&&e.error.activated;if(!this.context&&n&&o&&(this.context="has-company"),"has-company"===this.context)this.onSendVerificationEmail(e.error.params||null);else{const s=e.error.params,l=this.uuid,h=this.document,g=this.getFirstName(),E=this.getLastName();this.navigationService.forward(["/identity-validator-company-code"],{queryParams:{uuid:l,document:h,firstName:g,lastName:E,email:s,conflict:"found",foreign:this.foreign}})}}}else{this.logService.logError("http::account-check","",e);const n={title:this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_SERVICE_ERROR_TITLE"),message:`${this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_CHECKING_DATA_ERROR_MESSAGE")} (cod. ${e.status})`,type:"error"};this.notificatorService.notify(n)}})},this.stepBack=()=>{const e=this.document,n=this.uuid,o=this.foreign,s=this.context;if(o){const h={queryParams:{document:this.utilsService.convertToUppercase(e),uuid:n,foreign:o,context:s}};this.navigationService.back(["/foreign-document"],h)}else this.navigationService.back(["/identity-validator"],{queryParams:{document:e,uuid:n,foreign:o,context:s}})},this.onSendVerificationEmailModalBack=()=>{this.sendVerificationEmailModalService.hideModal()},this.onSendVerificationEmail=(0,S.Z)(function*(e=null,n){const o=t.uuid,s=t.document,l=t.foreign,h=t.firstName,E=l?t.utilsService.convertToUppercase(s):s;t.loadingService.show(t.translateConfigService.translate("PG_IDENTIFY_FULLNAME_LOADING_SEND_MAIL"),"send-email-verification");const y=yield t.saveFlowStorageResetKeyService.getInitForgot();if(n&&y&&y?.isInitiatedForgotten||"forgot-pin"===t.context){const I="pt"===t.translateConfigService.getCurrentLang()?"pt-Br":t.translateConfigService.getCurrentLang(),p=n?.email??"",j=I,V=(yield t.authService.getRefId())??null,x="";t.saveFlowStorageResetKeyService.setDataResetKeyInit({refId:V,firstName:h,email:p,obfuscatedEmail:e,langKey:j,document:s,resetKey:x});const ie=l?t.utilsService.convertToUppercase(s):s;t.api.accountDeviceResetInit(o,ie,l,{refId:V,firstName:h,email:p,langKey:j,resetKey:x}).subscribe(()=>t.accountDeviceResetInitSuccessResponse(e),ne=>t.accountDeviceResetInitErrorResponse(ne))}else t.api.accountDeviceResetInit(o,E,l,null).subscribe(()=>t.accountDeviceResetInitSuccessResponse(e),I=>t.accountDeviceResetInitErrorResponse(I))}),this.onWarnConflictModalBack=()=>{this.warnConflictModalService.hideModal()},this.onWarnConflictModalAccept=()=>{const e=this.email;this.warnConflictModalService.hideModal(),this.sendVerificationEmailModalService.showModal(e)},this.accountDeviceResetInitSuccessResponse=(0,S.Z)(function*(e=null){yield t.loadingService.hide(null,"send-email-verification");const o=t.document,s=t.firstName,l=t.lastName,h=t.email,g=t.context,E=t.foreign,I={queryParams:{uuid:t.uuid,document:E?t.utilsService.convertToUppercase(o):o,firstName:s,lastName:l,email:h,context:g,foreign:E,obfuscatedEmail:e}};if(t.sendVerificationEmailModalService.hideModal(),"forgot-pin"===t.context)t.navigationService.forward(["/identity-insert-password"],I);else{const p=t.initRegisterHasCompanyStorageService.get();p&&console.log("data",p),t.navigationService.forward(["has-company/identity-validator-code"])}}),this.accountDeviceResetInitErrorResponse=function(){var e=(0,S.Z)(function*(n){if(console.log("accountCheckErrorResponse"),console.log("response:",n),t.logService.logError("http::account-device-reset-init","",n),yield t.loadingService.hide(null,"send-email-verification"),0===n?.status)return t.showToastModalErroCodeZero.showToast(),void t.logService.logError("http::account-device-reset-init","Unknown error",n);const{title:o,message:s}=t.getTitleAndMessage(n);t.toastNotificationError(o,s,1e3)});return function(n){return e.apply(this,arguments)}}(),this.getUniqueDeviceId=(0,S.Z)(function*(){let e="";return(yield t.storageService.ready())&&(e=yield t.authService.getUUID()),e&&null!=e?(t.uuid=e,t.uuid):t.deviceUuidService.getUUID().then(t.onGetUniqueDeviceIdSuccessResponse).catch(t.onGetUniqueDeviceIdErrorResponse)}),this.onGetUniqueDeviceIdSuccessResponse=function(){var e=(0,S.Z)(function*(n){try{const o=yield t.saveUUIDStorage(n);return t.uuid=o.uuid,o.uuid}catch(o){return o}});return function(n){return e.apply(this,arguments)}}(),this.onGetUniqueDeviceIdErrorResponse=e=>{const n=this.translateConfigService.translate("PG_START_TOAST_AUTHORIZE"),s={title:this.translateConfigService.translate("PG_START_TOAST_NOTICE_TITLE"),message:n,type:"error"};this.notificatorService.notify(s)}}ionViewWillEnter(){const r=this.getDataRegisterHasCompanyStorageService();r&&(this.document=r?.document??"",this.context=r?.context??"",this.obfuscatedEmail=r?.obfuscatedEmail??"",this.foreign="true"===r?.foreign||!0===r?.foreign,this.uuid=r?.uuid??null,this.firstName=r?.firstName??"",this.lastName=r?.lastName??"",this.email=r?.email??"",this.conflict=r?.conflict??"",console.log("onViewWillEnter page-main-confirmation",r))}ngOnInit(){console.log("onInit"),this.fullNameForm=this.formBuilder.group({fullName:["",[T.Validators.required,T.Validators.minLength(3),T.Validators.maxLength(5)]]}),this.sendVerificationEmailModalService.observable.subscribe(this.onSendVerificationEmailModalStateChange),this.warnConflictModalService.observable.subscribe(this.onWarnConflictModalStateChange)}getDataRegisterHasCompanyStorageService(){return this.initRegisterHasCompanyStorageService.get()}verifyIfMatch(r){return r.matched}onHasEmailAccess(r){this.onSendVerificationEmail(r)}notHasEmailAccess(r){const a=this.initRegisterHasCompanyStorageService.get();if(a){const _=a?.uuid,F=a?.document,U=a?.foreign,L=a?.firstName,D=a?.lastName,b=a?.context,O=a?.conflict,P={queryParams:{document:this.utilsService.convertToUppercase(F),uuid:_,foreign:U,firstName:L,lastName:D,conflict:O,context:b}};this.initRegisterHasCompanyStorageService.set({...a}),"forgot-pin"===this.context&&this.navigationService.forward(["/identity-insert-password"],P),this.navigationService.forward(["has-company/identity-validator-code-company"])}}back(){this.navigationService.back(["/identity-validator-full-name"])}getTitleAndMessage(r){return{title:this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_SERVICE_ERROR_TITLE"),message:`${this.translateConfigService.translate("TOAST_SERVICE_TEMPORARILY_UNAVAILABLE_MESSAGE")} (cod. ${r.status})`}}toastNotificationError(r,a,m){this.notificatorService.notify({title:r,message:a,type:"error",timeout:m})}saveUUIDStorage(r){var a=this;return(0,S.Z)(function*(){let m={uuid:"",success:!1};try{yield a.platform.ready();try{if(yield a.storageService.ready())try{return yield a.authService.setUUID(r),m={uuid:r,success:!0},a.logService.logEvent("setUUIDIdentityValidadeFullName::","Success save UUID in storage",m),m}catch(_){throw m={..._,uuid:null,success:!1},a.logService.logError("ErrorSetUUIDIdentityValidadeFullName::","erro save UUID in storage",m),m}}catch(v){throw a.logService.logError("ErrorstorageIdentityValidadeFullName::","not avaliable storage ready",v),v}}catch(v){a.logService.logError("platformReadyStartPage::","not avaliable platform ready",v)}})()}showErroNoMatchNameDocument(r){this.logService.logError("NoMatchNameDocument","",{data:r}),this.loadingService.hide(null,"identity-validator-full-name").then(()=>{let a,m;this.foreign?(m=this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_NO_MATCH_FOREIGN_TITLE"),a=this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_NO_MATCH_FOREIGN_MESSAGE")):(m=this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_NO_MATCH_TITLE"),a=this.translateConfigService.translate("PG_IDENTIFY_FULLNAME_TOAST_NO_MATCH_MESSAGE")),this.notificatorService.notify({title:m,message:a,type:"error",timeout:8e3})})}}return u.\u0275fac=function(r){return new(r||u)(i.\u0275\u0275directiveInject(T.UntypedFormBuilder),i.\u0275\u0275directiveInject(d.sM),i.\u0275\u0275directiveInject(N.ActivatedRoute),i.\u0275\u0275directiveInject(d.V6),i.\u0275\u0275directiveInject(d.bz),i.\u0275\u0275directiveInject(d.i8),i.\u0275\u0275directiveInject(d.H0),i.\u0275\u0275directiveInject(d.fj),i.\u0275\u0275directiveInject(d.zf),i.\u0275\u0275directiveInject(d.Hc),i.\u0275\u0275directiveInject(d.f5),i.\u0275\u0275directiveInject(d.$V),i.\u0275\u0275directiveInject(d.wK),i.\u0275\u0275directiveInject(d.e8),i.\u0275\u0275directiveInject(d.V1),i.\u0275\u0275directiveInject(d.hX),i.\u0275\u0275directiveInject(c.Platform),i.\u0275\u0275directiveInject(d.RQ),i.\u0275\u0275directiveInject(d.FW),i.\u0275\u0275directiveInject(d.ME),i.\u0275\u0275directiveInject(M.K))},u.\u0275cmp=i.\u0275\u0275defineComponent({type:u,selectors:[["app-identity-email-confirmation"]],decls:24,vars:16,consts:[[1,"ion-no-border",2,"height","0"],[3,"ngStyle"],[1,"ion-margin-vertical"],[1,"flex-auto"],["size","12"],[1,"hasEmail"],[1,"button-holder","btns"],[1,"btn_default",3,"click"],[1,"button-holder","footer"],[1,"back",3,"click"]],template:function(r,a){1&r&&(i.\u0275\u0275element(0,"ion-header",0),i.\u0275\u0275elementStart(1,"ion-content")(2,"ion-grid",1)(3,"ion-row")(4,"ion-col",2),i.\u0275\u0275element(5,"app-full-logo"),i.\u0275\u0275elementEnd()(),i.\u0275\u0275elementStart(6,"ion-row",3)(7,"ion-col",4)(8,"div",5),i.\u0275\u0275text(9),i.\u0275\u0275pipe(10,"translate"),i.\u0275\u0275element(11,"br"),i.\u0275\u0275text(12),i.\u0275\u0275elementEnd(),i.\u0275\u0275elementStart(13,"div",6)(14,"button",7),i.\u0275\u0275listener("click",function(){return a.onHasEmailAccess(a.obfuscatedEmail)}),i.\u0275\u0275text(15),i.\u0275\u0275pipe(16,"translate"),i.\u0275\u0275elementEnd(),i.\u0275\u0275elementStart(17,"button",7),i.\u0275\u0275listener("click",function(){return a.notHasEmailAccess(a.obfuscatedEmail)}),i.\u0275\u0275text(18),i.\u0275\u0275pipe(19,"translate"),i.\u0275\u0275elementEnd()()()(),i.\u0275\u0275elementStart(20,"div",8)(21,"button",9),i.\u0275\u0275listener("click",function(){return a.back()}),i.\u0275\u0275text(22),i.\u0275\u0275pipe(23,"translate"),i.\u0275\u0275elementEnd()()()()),2&r&&(i.\u0275\u0275advance(2),i.\u0275\u0275property("ngStyle",i.\u0275\u0275pureFunction1(14,K,a.deviceInfoService.getDeviceHeight()+"px")),i.\u0275\u0275advance(7),i.\u0275\u0275textInterpolate1(" ",i.\u0275\u0275pipeBind1(10,6,"HAS_COMPANY_REGISTER.EMAIL_CONFIRMATION_EMAIL.DO_YOU_STILL_HAVE_ACCESS_TO_THE_EMAIL")," "),i.\u0275\u0275advance(3),i.\u0275\u0275textInterpolate1(" ",a.obfuscatedEmail,"? "),i.\u0275\u0275advance(3),i.\u0275\u0275textInterpolate1(" ",i.\u0275\u0275pipeBind1(16,8,"TEXT_YES")," "),i.\u0275\u0275advance(3),i.\u0275\u0275textInterpolate1(" ",i.\u0275\u0275pipeBind1(19,10,"TEXT_NOT")," "),i.\u0275\u0275advance(4),i.\u0275\u0275textInterpolate(i.\u0275\u0275pipeBind1(23,12,"BTN_BACK")))},dependencies:[A.NgStyle,c.IonCol,c.IonContent,c.IonGrid,c.IonHeader,c.IonRow,k.R,Y.X$],styles:[".hasEmail[_ngcontent-%COMP%]{display:flex;position:relative;justify-content:space-around;align-items:center;text-align:center;margin:3em 0 6em;font-size:1.1em;width:100%}.button-holder.footer[_ngcontent-%COMP%]{display:flex;justify-content:center;margin:0 auto;padding-bottom:2em}.btn_default[_ngcontent-%COMP%]{width:40%;font-weight:800}"]}),u})()}];let B=(()=>{class u{}return u.\u0275fac=function(r){return new(r||u)},u.\u0275mod=i.\u0275\u0275defineNgModule({type:u}),u.\u0275inj=i.\u0275\u0275defineInjector({imports:[N.RouterModule.forChild(Z),N.RouterModule]}),u})();var W=f(69270);let $=(()=>{class u{}return u.\u0275fac=function(r){return new(r||u)},u.\u0275mod=i.\u0275\u0275defineNgModule({type:u}),u.\u0275inj=i.\u0275\u0275defineInjector({imports:[W.I,A.CommonModule,B]}),u})()},45944:(H,R,f)=>{f.d(R,{K:()=>T});var A=f(15861),N=f(45449);let S=(()=>{class i{constructor(){}set(c,M){localStorage.setItem(c,JSON.stringify(M))}get(c){return JSON.parse(localStorage.getItem(c))??null}remove(c){localStorage.removeItem(c)}clear(){localStorage.clear()}}return i.\u0275fac=function(c){return new(c||i)},i.\u0275prov=N.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac,providedIn:"root"}),i})(),T=(()=>{class i{constructor(c){this.simpleStorageService=c,this.KEY="REGISTER_HAS_COMPANY",this.cache=null}set(c){this.simpleStorageService.set(this.KEY,c),this.cache=c}get(){const c=this.simpleStorageService.get(this.KEY);return this.cache=c,c}remove(){var c=this;return(0,A.Z)(function*(){c.simpleStorageService.remove(c.KEY),c.cache=null})()}}return i.\u0275fac=function(c){return new(c||i)(N.\u0275\u0275inject(S))},i.\u0275prov=N.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac,providedIn:"root"}),i})()}}]); |