Files
kapp/144.9730ec3a9b50a876.js
T
2026-05-21 11:19:10 -03:00

1 line
11 KiB
JavaScript

(self.webpackChunkapp=self.webpackChunkapp||[]).push([[144],{40144:(C,p,n)=>{n.r(p),n.d(p,{IdentityValidatorPageModule:()=>M});var S=n(61380),f=n(69270),E=n(15861),t=n(45449),i=n(24006),c=n(47898),e=n(37763),I=n(45944),d=n(90944),g=n(90603),P=n(33159),N=n(2569),O=n(99826);function x(a,T){if(1&a){const r=t.\u0275\u0275getCurrentView();t.\u0275\u0275elementStart(0,"div",16)(1,"ion-button",17),t.\u0275\u0275listener("click",function(){t.\u0275\u0275restoreView(r);const u=t.\u0275\u0275nextContext();return t.\u0275\u0275resetView(u.goToForeignDocument())}),t.\u0275\u0275elementStart(2,"span",18)(3,"span",14),t.\u0275\u0275text(4),t.\u0275\u0275pipe(5,"translate"),t.\u0275\u0275elementEnd()()()()}2&a&&(t.\u0275\u0275advance(4),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(5,1,"PG_IDENTIFY_CPF_BTN_FOREIGN"),""))}const D=function(a){return{"min-height":a,position:"relative"}},A=[{path:"",component:(()=>{class a{constructor(r,s,u,v,R,V,j,G,B,H,K,L,Y){var b=this;this.formBuilder=r,this.api=s,this.notificatorService=u,this.loadingService=v,this.keyboardService=R,this.deviceInfoService=V,this.navigationService=j,this.logService=G,this.translateConfigService=B,this.focusService=H,this.saveFlowStorageResetKeyService=K,this.showToastModalErroCodeZero=L,this.initRegisterHasCompanyStorageService=Y,this.onSubmit=()=>{const o=this.clearInput(this.documentForm.controls.document.value);if(this.validateInput(o)){let l=null;const m=()=>{l&&l.unsubscribe(),this.loadingService.show(this.translateConfigService.translate("LOADING_PROCESSING_DATA"),"identity-validator-document"),this.api.verifyDocument(o).subscribe(this.onSubmitSuccessResponse,this.onSubmitErrorResponse)};l=this.keyboardService.onHideObservable?.subscribe(m),this.keyboardService.isVisible()?this.keyboardService.hide():m()}else{this.logService.logError("user::register-document");const l=this.translateConfigService.translate("PG_IDENTIFY_CPF_TOAST_INVALID_DATA_TITLE"),m=this.translateConfigService.translate("PG_IDENTIFY_CPF_TOAST_INVALID_DATA_MESSAGE");this.notificatorService.notify({title:l,message:m,type:"error"})}},this.clearInput=o=>(o=o.replace(/\D/g,"")).slice(0,11),this.validateInput=o=>(l=>{if(11!==(l=l.replace(/\D/g,"")).toString().length||/^(\d)\1{10}$/.test(l))return!1;let m=!0;return[9,10].forEach(y=>{let _,F=0;l.split(/(?=)/).splice(0,y).forEach((k,U)=>{F+=parseInt(k,10)*(y+2-(U+1))}),_=F%11,_=_<2?0:11-_,_!==parseInt(l.substring(y,y+1),10)&&(m=!1)}),m})(o),this.onSubmitSuccessResponse=()=>{this.loadingService.hide(null,"identity-validator-document").then(this.goToNextStep)},this.onSubmitErrorResponse=o=>{console.log("onSubmitErrorResponse:",JSON.stringify(o)),this.logService.logError("http::register-document",`${o?.error?.detail??""}`,JSON.stringify(o)),this.loadingService.hide(null,"identity-validator-document").then(()=>{if(0===o?.status)return this.showToastModalErroCodeZero.showToast(),void this.logService.logError("http::onSubmitErrorResponse:register-document","Unknown error",o);if(400===o.status){this.logService.logError("http::register-document");const h=this.translateConfigService.translate("PG_IDENTIFY_CPF_TOAST_ERROR_REQUEST_TITLE"),l=`${this.translateConfigService.translate("PG_IDENTIFY_CPF_TOAST_ERROR_REQUEST_MESSAGE")} (cod. 400)`;return this.notificatorService.notify({title:h,message:l,type:"error"})}if(404===o.status)return this.goToNextStep();{this.logService.logError("http::register-document","Unknown error",o);const{title:h,message:l}=this.getTitleAndMessage(o);this.toastNotificationError(h,l,0===o?.status?1e4:5e3)}})},this.goToNextStep=()=>{const o=this.context,h=this.clearInput(this.documentForm.controls.document.value);this.navigationService.forward(["/identity-validator-full-name"]),this.initRegisterHasCompanyStorageService.set({document:h,context:o})},this.goOneStepBack=(0,E.Z)(function*(){if("forgot-pin"===b.context)try{yield b.saveFlowStorageResetKeyService.clearInitForgot(),b.navigationService.root(["/identity-check"])}catch{b.navigationService.root(["/identity-check"])}else b.navigationService.back(["/start"])}),this.goToForeignDocument=()=>{this.navigationService.forward(["/foreign-document"])}}ionViewDidEnter(){const r=this.initRegisterHasCompanyStorageService.get();r&&(this.document=r?.document,this.context=r?.context,this.document&&setTimeout(()=>{this.documentForm.setValue({document:this.document})},450)),this.focusService.applyFocusQuerySelector("identity",200)}ngOnInit(){this.documentForm=this.formBuilder.group({document:[""]})}changeInput(r){const s=r?.target?.value;11===s.replace(/\D/g,"").length&&this.validateInput(s)&&(r?.target.blur(),this.focusService.applyFocusQuerySelector("next-button",100))}getTitleAndMessage(r){let s="",u="";const v=r?.status?`(cod. ${r.status})`:"";return s=this.translateConfigService.translate("PG_IDENTIFY_CPF_TOAST_SERVICE_ERROR_TITLE"),u=`${this.translateConfigService.translate("TOAST_SERVICE_TEMPORARILY_UNAVAILABLE_MESSAGE")} ${v}`,{title:s,message:u}}toastNotificationError(r,s,u){this.notificatorService.notify({title:r,message:s,type:"error",timeout:u})}}return a.\u0275fac=function(r){return new(r||a)(t.\u0275\u0275directiveInject(i.UntypedFormBuilder),t.\u0275\u0275directiveInject(c.sM),t.\u0275\u0275directiveInject(c.V6),t.\u0275\u0275directiveInject(c.bz),t.\u0275\u0275directiveInject(c.i8),t.\u0275\u0275directiveInject(c.Hc),t.\u0275\u0275directiveInject(c.f5),t.\u0275\u0275directiveInject(c.$V),t.\u0275\u0275directiveInject(c.wK),t.\u0275\u0275directiveInject(e.i),t.\u0275\u0275directiveInject(c.RQ),t.\u0275\u0275directiveInject(c.ME),t.\u0275\u0275directiveInject(I.K))},a.\u0275cmp=t.\u0275\u0275defineComponent({type:a,selectors:[["app-identity-validator"]],decls:28,vars:17,consts:[[1,"ion-no-border",2,"height","0"],[3,"ngStyle"],["tabindex","-1",1,"ion-margin-vertical"],[1,"flex-auto"],[1,"ion-margin-vertical"],[3,"formGroup","ngSubmit"],[1,"input-holder"],["for","document"],["tabindex","1","id","identity"],["tabindex","2","id","document","type","tel","pattern","\\d*","formControlName","document","appDocumentMask","",3,"placeholder","input"],[1,"button-holder"],["type","button",1,"back",3,"click"],["tabindex","3"],["id","next-button","type","submit"],["tabindex","4"],["class","button-holder bottom",4,"ngIf"],[1,"button-holder","bottom"],["type","button","mode","ios","shape","round",3,"click"],["tabindex","5"]],template:function(r,s){1&r&&(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"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(6,"ion-row",3)(7,"ion-col",4)(8,"form",5),t.\u0275\u0275listener("ngSubmit",function(){return s.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\u0275elementStart(14,"input",9),t.\u0275\u0275listener("input",function(v){return s.changeInput(v)}),t.\u0275\u0275pipe(15,"translate"),t.\u0275\u0275elementEnd()(),t.\u0275\u0275elementStart(16,"div",10)(17,"button",11),t.\u0275\u0275listener("click",function(){return s.goOneStepBack()}),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,"ion-row"),t.\u0275\u0275element(26,"ion-col"),t.\u0275\u0275elementEnd(),t.\u0275\u0275template(27,x,6,3,"div",15),t.\u0275\u0275elementEnd()()),2&r&&(t.\u0275\u0275advance(2),t.\u0275\u0275property("ngStyle",t.\u0275\u0275pureFunction1(15,D,s.deviceInfoService.getDeviceHeight()+"px")),t.\u0275\u0275advance(6),t.\u0275\u0275property("formGroup",s.documentForm),t.\u0275\u0275advance(4),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(13,7,"PG_IDENTIFY_CPF_TEXT"),""),t.\u0275\u0275advance(2),t.\u0275\u0275property("placeholder",t.\u0275\u0275pipeBind1(15,9,"PG_IDENTIFY_CPF_INPUT")),t.\u0275\u0275advance(5),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(20,11,"BTN_BACK"),""),t.\u0275\u0275advance(4),t.\u0275\u0275textInterpolate1(" ",t.\u0275\u0275pipeBind1(24,13,"BTN_NEXT")," "),t.\u0275\u0275advance(4),t.\u0275\u0275property("ngIf","forgot-pin"!==s.context))},dependencies:[d.NgIf,d.NgStyle,g.IonButton,g.IonCol,g.IonContent,g.IonGrid,g.IonHeader,g.IonLabel,g.IonRow,i.\u0275NgNoValidate,i.DefaultValueAccessor,i.NgControlStatus,i.NgControlStatusGroup,i.PatternValidator,i.FormGroupDirective,i.FormControlName,P.R,N.Hc,O.X$],styles:[".button-holder.bottom[_ngcontent-%COMP%]{position:absolute;bottom:calc(24px + env(safe-area-inset-bottom))!important;bottom:24px;text-align:center;width:100vw;left:0;font-size:.9em;color:#656768;padding:1em 0;display:flex;justify-content:center;align-items:center}ion-label[_ngcontent-%COMP%]{color:#656768;font-weight:500}ion-button[_ngcontent-%COMP%]{font-size:1em;--color: #0ec254;background:#e7e6e6;--background: #e7e6e6;--box-shadow: none;border-radius:32px;height:36px;transition:background-color .1s ease-out;--background-activated: #0ec254;--color-activated: #fff}"]}),a})()}];let M=(()=>{class a{}return a.\u0275fac=function(r){return new(r||a)},a.\u0275mod=t.\u0275\u0275defineNgModule({type:a}),a.\u0275inj=t.\u0275\u0275defineInjector({imports:[f.I,S.RouterModule.forChild(A)]}),a})()},37763:(C,p,n)=>{n.d(p,{i:()=>c});var S=n(61380),E=n(92198),t=n(45449);let c=(()=>{class e{constructor(d){this.router=d}focusInRouterNavigate(){this.router.events.pipe((0,E.h)(d=>d instanceof S.NavigationEnd)).subscribe(()=>{const d=document.querySelector("#focusHeader");d&&d?.focus()})}applyFocusQuerySelector(d,g){setTimeout(()=>{document.querySelector(`#${d}`)?.focus()},g)}}return e.\u0275fac=function(d){return new(d||e)(t.\u0275\u0275inject(S.Router))},e.\u0275prov=t.\u0275\u0275defineInjectable({token:e,factory:e.\u0275fac,providedIn:"root"}),e})()},45944:(C,p,n)=>{n.d(p,{K:()=>t});var S=n(15861),f=n(45449);let E=(()=>{class i{constructor(){}set(e,I){localStorage.setItem(e,JSON.stringify(I))}get(e){return JSON.parse(localStorage.getItem(e))??null}remove(e){localStorage.removeItem(e)}clear(){localStorage.clear()}}return i.\u0275fac=function(e){return new(e||i)},i.\u0275prov=f.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac,providedIn:"root"}),i})(),t=(()=>{class i{constructor(e){this.simpleStorageService=e,this.KEY="REGISTER_HAS_COMPANY",this.cache=null}set(e){this.simpleStorageService.set(this.KEY,e),this.cache=e}get(){const e=this.simpleStorageService.get(this.KEY);return this.cache=e,e}remove(){var e=this;return(0,S.Z)(function*(){e.simpleStorageService.remove(e.KEY),e.cache=null})()}}return i.\u0275fac=function(e){return new(e||i)(f.\u0275\u0275inject(E))},i.\u0275prov=f.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac,providedIn:"root"}),i})()}}]);