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

1 line
11 KiB
JavaScript

(self.webpackChunkapp=self.webpackChunkapp||[]).push([[5189],{25189:(Y,p,a)=>{a.r(p),a.d(p,{InsertCompanyInviteCodePageModule:()=>M});var m=a(61380),f=a(15861),e=a(45449),l=a(24006),c=a(47898),h=a(80698),E=a(90944),C=a(90603),T=a(36290),O=a(99826);function S(i,d){if(1&i&&(e.\u0275\u0275elementStart(0,"div",14),e.\u0275\u0275text(1),e.\u0275\u0275elementEnd()),2&i){const r=d.$implicit;e.\u0275\u0275advance(1),e.\u0275\u0275textInterpolate(r.message)}}function u(i,d){if(1&i&&(e.\u0275\u0275elementStart(0,"div",12),e.\u0275\u0275template(1,S,2,1,"div",13),e.\u0275\u0275elementEnd()),2&i){const r=e.\u0275\u0275nextContext();e.\u0275\u0275advance(1),e.\u0275\u0275property("ngForOf",r.codeFormErrors)}}let N=(()=>{class i{constructor(r,_,I,y,V,D,G,R,x,F,L){var o=this;this.formBuilder=r,this.notificatorService=_,this.navigationService=I,this.loadingService=y,this.commonService=V,this.apiService=D,this.authService=G,this.pendingRelease=R,this.logService=x,this.translateConfigService=F,this.sessionAddFlowService=L,this.existPendings=!1,this.navigateToQRCode=()=>{this.navigationService.forward(["/home"])},this.onSubmit=()=>{this.cleanValidationErrors();const n={code:this.commonService.clearString(this.codeForm.controls.code.value)},s=this.validateInput(n);if(s.length){this.setValidationErrors(s);const g={title:this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_DATA_TITLE"),message:this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_DATA_MESSAGE"),type:"error"};this.notificatorService.notify(g)}else this.authService.getToken().then(g=>{this.loadingService.show(this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_LOADING_VALIDATING"),"code-validation"),this.apiService.validateCompanyInviteCode(n.code,g).subscribe(this.processValidateCompanyInviteCodeSuccessResponse,this.processValidateCompanyInviteCodeErrorResponse)})},this.processValidateCompanyInviteCodeSuccessResponse=t=>{console.log("processValidateCompanyInviteCodeSuccessResponse");const{locator:n,invitationKey:s}=t;this.locator=n,this.invitationKey=s,this.validateLink()},this.processValidateCompanyInviteCodeErrorResponse=t=>{console.log("processValidateCompanyInviteCodeErrorResponse"),console.log("error:",t),this.logService.logError("http::processValidateCompanyInviteCodeErrorResponse","",t),this.loadingService.hide(null,"code-validation");const n={title:this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_CODE_TITLE"),message:this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_CODE_MESSAGE"),type:"error",timeout:5e3};this.notificatorService.notify(n)},this.validateLink=()=>{let t="";this.authService.getToken().then(n=>(t=n,this.authService.getForeigner())).then(n=>{this.apiService.validateInvite(this.locator,this.invitationKey,t,n).subscribe(this.processValidateInviteSuccessResponse,this.processValidateInviteErrorResponse)})},this.processValidateInviteSuccessResponse=()=>{this.loadingService.hide(null,"code-validation").then(()=>{const t={title:this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_RATE_INVITE_TITLE"),message:this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_RATE_INVITE_MESSAGE"),type:"success",timeout:6e3};this.notificatorService.notify(t),this.goToDeepPage(this.locator,this.invitationKey)})},this.processValidateInviteErrorResponse=t=>{console.log("processValidateInviteErrorResponse"),console.log("response:",JSON.stringify(t)),this.loadingService.hide(null,"code-validation").then((0,f.Z)(function*(){if(t&&t.status){if(400===t.status&&t.error&&"error.invitenotvalid"===t.error.message){const n={title:o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_INVITE_TITLE"),message:o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_INVITE_MESSAGE"),type:"error",timeout:5e3};return o.notificatorService.notify(n)}if(400===t.status&&t.error&&"error.accountnotfound"===t.error.message){const n={title:o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_ACCOUNT_NOTFOUND_TITLE"),message:o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_ACCOUNT_NOTFOUND_MESSAGE"),type:"error",timeout:5e3};return o.notificatorService.notify(n)}if(400===t.status&&t.error&&"error.invitenotmatched"===t.error.message){const n=o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_NAME_MESSAGE_TEXT_FOREIGN"),g=`${o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_NAME_MESSAGE")} ${o.foreign?n:"CPF"}.`,v={title:o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_INVALID_NAME_TITLE"),message:g,type:"error",timeout:12e3};return o.notificatorService.notify(v)}if(400===t.status&&"nomatchforeignflag"===t.error.errorKey){const n=o.foreign?"PG_IDENTIFY_COMPANY_CODE_TOAST_NOT_ENABLED_FOREINGFLAG_MESSAGE":"PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCHFOREINGFLAG_MESSAGE";o.logService.logError("http::accountActivateErrorResponseNoMatch","",t);const s=o.translateConfigService.translate("PG_IDENTIFY_COMPANY_CODE_TOAST_NOMATCHFOREINGFLAG_TITLE"),g=o.translateConfigService.translate(n);return o.notificatorService.notify({title:s,message:g,type:"error",timeout:1e4})}{o.logService.logError("http::processValidateInviteErrorResponseWithStatusElseCase","",t);const n={title:o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_SERVICE_ERROR_TITLE"),message:`${o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_SERVICE_ERROR_TITLE")} (cod. ${t.status})`,type:"error",timeout:5e3};return o.notificatorService.notify(n)}}{o.logService.logError("http::processValidateInviteErrorResponseWithoutStatusElseCase","",t);const n={title:o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_SERVICE_ERROR_TITLE"),message:`${o.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TOAST_SERVICE_ERROR_TITLE")} (cod. NKNwN)`,type:"error",timeout:5e3};return o.notificatorService.notify(n)}}))},this.validateInput=t=>{const n=[],s=this.validateCodeInput(t);return s&&n.push(s),n},this.validateCodeInput=t=>!t.code||t.code.length<1?{message:this.translateConfigService.translate("PG_INVITE_COMPANY_CODE_TEXT_CODE_REQUIRED"),field:"code"}:null,this.setValidationErrors=t=>{console.log("setValidationErrors:",t),this.codeFormErrors=t},this.cleanValidationErrors=()=>{this.codeFormErrors=[]},this.goToHome=()=>{this.cleanValidationErrors(),this.navigationService.back(["/home"])},this.goToDeepPage=(t,n)=>{this.navigationService.forward(["/deep"],{queryParams:{l:t,k:n,origin:"CODE"}})},this.codeForm=this.formBuilder.group({code:[""]}),this.sessionAddFlowService.clearAndGenerateSessionId()}ionViewDidEnter(){this.authService.getForeigner().then(r=>{this.foreign=r})}ionViewDidLeave(){}}return i.\u0275fac=function(r){return new(r||i)(e.\u0275\u0275directiveInject(l.UntypedFormBuilder),e.\u0275\u0275directiveInject(c.V6),e.\u0275\u0275directiveInject(c.f5),e.\u0275\u0275directiveInject(c.bz),e.\u0275\u0275directiveInject(c.v_),e.\u0275\u0275directiveInject(c.sM),e.\u0275\u0275directiveInject(c.e8),e.\u0275\u0275directiveInject(c.xJ),e.\u0275\u0275directiveInject(c.$V),e.\u0275\u0275directiveInject(c.wK),e.\u0275\u0275directiveInject(h.t))},i.\u0275cmp=e.\u0275\u0275defineComponent({type:i,selectors:[["app-insert-company-invite-code"]],decls:23,vars:19,consts:[[3,"title","showBadge","refresh"],[1,"centralized-content"],[1,"page-title"],[1,"title"],[1,"ion-margin-vertical"],[3,"formGroup","ngSubmit"],[1,"input-holder"],["type","text","formControlName","code",3,"placeholder"],["class","errors",4,"ngIf"],[1,"button-holder"],["type","button",1,"back",3,"click"],["type","submit"],[1,"errors"],["class","error",4,"ngFor","ngForOf"],[1,"error"]],template:function(r,_){1&r&&(e.\u0275\u0275element(0,"app-header",0),e.\u0275\u0275pipe(1,"translate"),e.\u0275\u0275elementStart(2,"ion-content")(3,"div",1)(4,"div",2)(5,"div",3)(6,"h1"),e.\u0275\u0275text(7),e.\u0275\u0275pipe(8,"translate"),e.\u0275\u0275elementEnd()()(),e.\u0275\u0275elementStart(9,"ion-row")(10,"ion-col",4)(11,"form",5),e.\u0275\u0275listener("ngSubmit",function(){return _.onSubmit()}),e.\u0275\u0275elementStart(12,"div",6),e.\u0275\u0275element(13,"input",7),e.\u0275\u0275pipe(14,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275template(15,u,2,1,"div",8),e.\u0275\u0275elementStart(16,"div",9)(17,"button",10),e.\u0275\u0275listener("click",function(){return _.goToHome()}),e.\u0275\u0275text(18),e.\u0275\u0275pipe(19,"translate"),e.\u0275\u0275elementEnd(),e.\u0275\u0275elementStart(20,"button",11),e.\u0275\u0275text(21),e.\u0275\u0275pipe(22,"translate"),e.\u0275\u0275elementEnd()()()()()()()),2&r&&(e.\u0275\u0275property("title",e.\u0275\u0275pipeBind1(1,9,"PG_INVITE_COMPANY_CODE_HEADER_TITLE"))("showBadge",!0)("refresh",!1),e.\u0275\u0275advance(7),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(8,11,"PG_INVITE_COMPANY_CODE_TEXT")),e.\u0275\u0275advance(4),e.\u0275\u0275property("formGroup",_.codeForm),e.\u0275\u0275advance(2),e.\u0275\u0275property("placeholder",e.\u0275\u0275pipeBind1(14,13,"PG_INVITE_COMPANY_CODE_INPUT")),e.\u0275\u0275advance(2),e.\u0275\u0275property("ngIf",_.codeFormErrors),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate1(" ",e.\u0275\u0275pipeBind1(19,15,"BTN_BACK")," "),e.\u0275\u0275advance(3),e.\u0275\u0275textInterpolate(e.\u0275\u0275pipeBind1(22,17,"BTN_NEXT")))},dependencies:[E.NgForOf,E.NgIf,C.IonCol,C.IonContent,C.IonRow,l.\u0275NgNoValidate,l.DefaultValueAccessor,l.NgControlStatus,l.NgControlStatusGroup,l.FormGroupDirective,l.FormControlName,T.G,O.X$],styles:["ion-content[_ngcontent-%COMP%]{--background: #f1f1f1}ion-toolbar[_ngcontent-%COMP%]{font-family:Nunito,sans-serif;--border-style: none}ion-toolbar[_ngcontent-%COMP%] ion-img[_ngcontent-%COMP%]{height:25px;width:25px}ion-toolbar[_ngcontent-%COMP%] ion-title[_ngcontent-%COMP%]{letter-spacing:1px}ion-toolbar[_ngcontent-%COMP%] ion-button[_ngcontent-%COMP%] fa-icon[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;height:24px;padding:0;width:24px;margin:0;font-size:19px;color:#656768}ion-toolbar[_ngcontent-%COMP%] ion-button.hover[_ngcontent-%COMP%]{background:#fff}.centralized-content[_ngcontent-%COMP%]{height:calc(100vh - 56px);display:flex;justify-content:flex-start;flex-direction:column}.centralized-content[_ngcontent-%COMP%] .input-holder[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{text-align:center;text-transform:uppercase;letter-spacing:12px}.centralized-content[_ngcontent-%COMP%] .errors[_ngcontent-%COMP%]{width:80%;margin:12px 10% 0;color:#f0181b;text-align:center}.centralized-content[_ngcontent-%COMP%] .page-title[_ngcontent-%COMP%]{margin-top:32px;margin-bottom:32px}.centralized-content[_ngcontent-%COMP%] .page-title[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-size:initial!important;font-weight:700;text-align:center}.centralized-content[_ngcontent-%COMP%] .page-title[_ngcontent-%COMP%] .title[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-size:1.1rem!important;padding-inline:16px}.centralized-content[_ngcontent-%COMP%] .page-title[_ngcontent-%COMP%] .sub-title[_ngcontent-%COMP%]{text-align:center;color:#656768;font-size:.9em;margin-top:4px}.pulsate-fwd[_ngcontent-%COMP%]{animation:pulsate-fwd .5s ease-in-out infinite both;outline:none}@keyframes pulsate-fwd{0%{transform:scale(1)}50%{transform:scale(1.5)}to{transform:scale(1)}}"]}),i})();var P=a(69270);const A=[{path:"",component:N}];let M=(()=>{class i{}return i.\u0275fac=function(r){return new(r||i)},i.\u0275mod=e.\u0275\u0275defineNgModule({type:i}),i.\u0275inj=e.\u0275\u0275defineInjector({imports:[P.I,m.RouterModule.forChild(A)]}),i})()}}]);