1import{a as q,b as J,c as X,d as te,e as ne}from"./chunk-YJWZFTNN.js";import{a as P}from"./chunk-FYXAD4ZU.js";import{a as ie}from"./chunk-IV6OTNUV.js";import{a as Q}from"./chunk-XH4TTN3P.js";import{a as R}from"./chunk-KHYVXGF3.js";import{b as A}from"./chunk-66K5QW4R.js";import{a as se}from"./chunk-FLBRMJST.js";import{a as ae,b as re}from"./chunk-N6IKBRUZ.js";import{a as $}from"./chunk-2TBFUXK2.js";import{a as ce}from"./chunk-EJNKA74Z.js";import{a as oe}from"./chunk-EIPRD53Z.js";import"./chunk-NJJZW2GO.js";import{a as ee}from"./chunk-USJMRUC4.js";import{a as x}from"./chunk-QUL2GZSN.js";import{f as E,p as u}from"./chunk-WUST5ATB.js";import{a as Y}from"./chunk-MVLFF5M4.js";import{f as H,h as K,k as Z}from"./chunk-OVX7EWVG.js";import{a as D}from"./chunk-FQL535RB.js";import{a as p,b as d,g as h}from"./chunk-GAL4ENT6.js";import{computed as je,inject as z}from"@angular/core";import{toSignal as He}from"@angular/core/rxjs-interop";import{ActivatedRoute as Ke,NavigationEnd as Ze,Router as Ye,RouterOutlet as qe}from"@angular/router";import{filter as Je}from"rxjs";import{TranslocoDirective as Qe}from"@jsverse/transloco";import"@angular/core";import{ComponentStore as Ie}from"@ngrx/component-store";import*as me from"@angular/core";var le={data:void 0,isLoading:!1,error:null,request:null,verificationCode:null},I=(()=>{class i extends Ie{constructor(){super(p({},le)),this.setVerificationData=this.updater((e,t)=>d(p({},e),{request:t.requestData,verificationCode:t.verificationCode})),this.setFormData=this.updater((e,t)=>d(p({},e),{data:t,isLoading:!1})),this.#e=this.updater(e=>d(p({},e),{isLoading:!0})),this.#t=this.updater((e,t)=>d(p({},e),{isLoading:!1,error:t}))}resetState(){this.setState(p({},le))}#e;#t;static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=me.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac})}}return i})();import{CommonModule as Ne}from"@angular/common";import{computed as Le,effect as ke,inject as pe,signal as Te}from"@angular/core";import{NavigationEnd as Oe,Router as Pe}from"@angular/router";import{TranslocoDirective as Re}from"@jsverse/transloco";import{StepsComponent as Ve}from"ezus-design-system";import{Store as Ue}from"@ngrx/store";import{toSignal as ze}from"@angular/core/rxjs-interop";import{translocoSignal as V}from"ezus-common";import*as s from"@angular/core";function Me(i,c){if(i&1&&s.\u0275\u0275element(0,"eds-steps",2),i&2){let e=s.\u0275\u0275nextContext(2);s.\u0275\u0275property("stepItems",e.steps)("activeStep",e.activeStepSig())}}function Be(i,c){if(i&1&&(s.\u0275\u0275elementContainerStart(0),s.\u0275\u0275elementStart(1,"h1",1),s.\u0275\u0275text(2),s.\u0275\u0275elementEnd(),s.\u0275\u0275template(3,Me,1,2,"eds-steps",2),s.\u0275\u0275elementContainerEnd()),i&2){let e=c.$implicit,t=s.\u0275\u0275nextContext();s.\u0275\u0275advance(2),s.\u0275\u0275textInterpolate(e("ezus.uzupelnienieDanych.tytul")),s.\u0275\u0275advance(),s.\u0275\u0275conditional(t.isVerificationDataNeeded()?3:-1)}}var ue=(()=>{class i{constructor(){this.router=pe(Pe),this.userDataSig=pe(Ue).selectSignal(H),this.isVerificationDataNeeded=Le(()=>this.userDataSig()?.wymaganeAkcje?.includes?.("WYMAGANA_WERYFIKACJA_DANYCH_KONTAKTOWYCH")),this.activeStepSig=Te(1),this.routeChangeSig=ze(this.router.events),this.routeChangeEffect=ke(()=>{if(this.routeChangeSig()instanceof Oe){let e=this.steps.findIndex(({routeUrl:t})=>t&&this.router.url.includes(t))+1;this.activeStepSig.set(e)}},{allowSignalWrites:!0}),this.steps=[{label:V("ezus.uzupelnienieDanych.pierwszyEtap.tytul"),routeUrl:u.UZUPELNIENIE_DANYCH_PIERWSZY_KROK},{label:V("ezus.uzupelnienieDanych.drugiEtap.tytul"),routeUrl:u.UZUPELNIENIE_DANYCH_DRUGI_KROK},{label:V("ezus.uzupelnienieDanych.trzeciEtap.tytul"),routeUrl:u.LOGOWANIE}]}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=s.\u0275\u0275defineComponent({type:i,selectors:[["ezus-main-top-section"]],standalone:!0,features:[s.\u0275\u0275StandaloneFeature],decls:1,vars:0,consts:[[4,"transloco"],[1,"primary-text","complete-data-title"],[3,"stepItems","activeStep"]],template:function(t,a){t&1&&s.\u0275\u0275template(0,Be,4,2,"ng-container",0)},dependencies:[Ne,Ve,Re],styles:["[_nghost-%COMP%]{display:block;margin-bottom:24px}
1.complete-data-title[_ngcontent-%COMP%]{margin:0 0 38px}@media (min-width: 1023.5px){[_nghost-%COMP%]{width:480px}.complete-data-title[_ngcontent-%COMP%]{margin-bottom:32px}}"],changeDetection:0})}}return i})();import{inject as We}from"@angular/core";import{SessionStorageService as Ge,EssentialSessionStorageKeys as U}from"ezus-common";import*as de from"@angular/core";var v=(()=>{class i{constructor(){this.sessionStorageService=We(Ge),this.setCompleteDataInSessionStorage=e=>{this.sessionStorageService.setEssentialData(U.PROVIDED_COMPLETED_DATA,e)},this.getCompleteDataFromSessionStorage=()=>this.sessionStorageService.get(U.PROVIDED_COMPLETED_DATA),this.removeCompleteDataFromSessionStorage=()=>{this.sessionStorageService.removeItem(U.PROVIDED_COMPLETED_DATA)}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=de.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac})}}return i})();import{CodeVerificationService as $e}from"ezus-common";import*as l from"@angular/core";function Xe(i,c){i&1&&l.\u0275\u0275element(0,"ezus-main-top-section")}function et(i,c){if(i&1&&(l.\u0275\u0275elementContainerStart(0),l.\u0275\u0275elementStart(1,"div",1),l.\u0275\u0275template(2,Xe,1,0,"ezus-main-top-section"),l.\u0275\u0275element(3,"router-outlet"),l.\u0275\u0275elementEnd(),l.\u0275\u0275elementContainerEnd()),i&2){let e=l.\u0275\u0275nextContext();l.\u0275\u0275advance(2),l.\u0275\u0275conditional(e.hideTopSectionSig()===!1?2:-1)}}var Se=(()=>{class i{constructor(){this.router=z(Ye),this.route=z(Ke),this.sessionStorageService=z(v),this.routerNavigationEndEventsSig=He(this.router.events.pipe(Je(e=>e instanceof Ze))),this.hideTopSectionSig=je(()=>this.routerNavigationEndEventsSig()?this.route.snapshot.firstChild?.data.hideTopSection??!1:!1)}ngOnDestroy(){this.sessionStorageService.removeCompleteDataFromSessionStorage()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=l.\u0275\u0275defineComponent({type:i,selectors:[["ezus-main-complete-data"]],standalone:!0,features:[l.\u0275\u0275ProvidersFeature([$e,I,v]),l.\u0275\u0275StandaloneFeature],decls:1,vars:0,consts:[[4,"transloco"],[1,"main-container"]],template:function(t,a){t&1&&l.\u0275\u0275template(0,et,4,1,"ng-container",0)},dependencies:[ue,qe,Qe],styles:["[_nghost-%COMP%]{display:flex;justify-content:center;background-color:#f0f5fa}.main-container[_ngcontent-%COMP%]{display:block;padding:25px 16px 100px;min-width:63%}@media (min-width: 1023.5px){.main-container[_ngcontent-%COMP%]{padding-top:40px}}"]})}}return i})();import{inject as k}from"@angular/core";import{TranslocoDirective as Et}from"@jsverse/transloco";import{inject as tt}from"@angular/core";import{HttpClient as ot}from"@angular/common/http";import*as he from"@angular/core";var fe=(()=>{class i{constructor(){this.httpClient=tt(ot)}sendNewCode(e){return this.httpClient.post("api/profil/uzupelnij-dane/wyslij-nowy-kod",e)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=he.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();import{inject as ft,signal as Ct}from"@angular/core";import{LocalStorageService as gt,commonAuthStoreActions as Dt,EssentialLocalStorageKeys as _t}from"ezus-common";import{inject as S,signal as lt}from"@angular/core";import{Store as mt}from"@ngrx/store";import{Router as pt}from"@angular/router";import{commonAuthStoreActions as N,TranslocoToastService as ut}from"ezus-common";import{inject as y,Injector as it,runInInjectionContext as at}from"@angular/core";import{HttpClient as rt}from"@angular/common/http";import{Store as nt}from"@ngrx/store";import{catchError as st,tap as ct}from"rxjs";function Ce(i,c,e){let t=/ /gm;return JSON.parse(JSON.stringify(i,(a,n)=>{let m=n;return m&&typeof m=="object"&&!Array.isArray(m)&&(Object.values(m).every(F=>F==null||F===""||Number.isNaN(F))||Object.keys(m).length===0)?null:e?.includes(a)?n===""||Number.isNaN(n)?null:n:n===""||Number.isNaN(n)?null:typeof m=="string"?(c?.includes(a)&&(m=n.replace(t,"")),m.trim()):m}))}import*as ge from"@angular/core";var De=(()=>{class i{constructor(){this.store=y(nt),this.http=y(rt),this.injector=y(it),this.authSrv=y(x),this.userRegulationsAcceptanceStatusSrv=y(se)}sendCompletedData(e){let t="api/profil/uzupelnij-dane",a=this.addRegulationsAcceptanceStatus(e);return this.http.post(t,Ce(a),{observe:"response"})}fetchUserData(){return this.authSrv.getCurrentUser(!0).pipe(ct(e=>{at(this.injector,()=>ne(e)),this.store.dispatch(D.getCurrentUserSuccess({currentUser:e}))}),st(e=>{throw this.store.dispatch(D.getCurrentUserFailure({logoutParams:null})),e}))}addRegulationsAcceptanceStatus(e){let t=e.regulamin,a=t&&this.userRegulationsAcceptanceStatusSrv.addAcceptanceStatusToRegulationsPayload(t);return d(p({},e),{regulamin:a})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=ge.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();import{firstValueFrom as _e}from"rxjs";import{AuditService as dt,isCorrectArrayErrorResponse as St,isCorrectSingleErrorResponse as ht}from"ezus-common";var _=class{constructor(){this.store=S(mt),this.translocoToastServ=S(ut),this.completeDataServ=S(De),this.logoutConfirmationService=S(ee),this.broadcastChannelSrv=S(Y),this.auditSrv=S(dt),this.shouldShowAccessDataWarning=this.store.selectSignal(Z),this.accessDataError=lt(""),this.completeDataFormStore=S(I),this.router=S(pt),this.sessionStorageCompleteDataService=S(v)}logoutWithDialog(c){this.logoutConfirmationService.open({auditLogoutConfirmationFn:()=>this.auditSrv.log(c)})}logoutAction(){let c={queryParams:{"logout-manually":!0}};this.store.dispatch(N.logout({logoutParams:c,navigatePath:u.LOGOWANIE})),this.broadcastChannelSrv.postMessage("ACTIVE_USER","MANUAL_LOGOUT")}saveData(c){return h(this,null,function*(){try{this.store.dispatch(N.displayLoader({displayLoader:!0}));let e=yield _e(this.completeDataServ.sendCompletedData(c));this.nextSendCompletedDataCallback(e,c),c.kodWeryfikacyjny&&(yield _e(this.completeDataServ.fetchUserData())),this.store.dispatch(N.displayLoader({displayLoader:!1}))}catch(e){this.store.dispatch(N.displayLoader({displayLoader:!1})),this.handleErrors(e)}})}handleErrors(c){let e=c.error;St(e)?e.bledy.forEach(t=>{if(t.includes("ezus.blad.uzupelnienieDanych.emailJestJuzUzywany")||t.includes("ezus.blad.uzupelnienieDanych.nrTelefonuJestJuzUzywany")){this.accessDataError.
1set(t);return}t.includes("ezus.blad.haslo")?this.translocoToastServ.open("error",{key:`${t}.toast`}):this.translocoToastServ.open("error",{key:t})}):ht(e)?this.translocoToastServ.open("error",{key:e.kod}):this.translocoToastServ.open("error",{key:"ezus.uzupelnienieDanych.drugiEtap.blad"}),console.error("Cannot save data: "+c.status)}};import*as L from"@angular/core";var M=(()=>{class i extends _{constructor(){super(...arguments),this.localStorageSrv=ft(gt),this.verificationCodeSig=this.completeDataFormStore.selectSignal(({verificationCode:e})=>e),this.requestSig=this.completeDataFormStore.selectSignal(({request:e})=>e),this.firstVerificationCode=Ct(this.verificationCodeSig())}nextSendCompletedDataCallback(e){e.status===204&&(this.completeDataFormStore.resetState(),this.store.dispatch(Dt.clearStore()),this.shouldShowAccessDataWarning()&&this.store.dispatch(D.clearIsContactMethodDeleted()),this.localStorageSrv.setEssentialData(_t.IS_SUCCESS_COMPLETE_DATA,!0),this.router.navigate([u.UZUPELNIENIE_DANYCH_SUKCES]))}logoutIfNoStoredRequestData(){if(!this.requestSig())try{this.getRequestFromSessionStorage()}catch{console.error("No stored data")}this.requestSig()&&this.requestSig()?.kanalOdzyskiwania||this.logoutAction()}auditExpiredCode(e){let t={daneDodatkowe:[{nazwaPola:"NUMER_KODU",wartoscPola:e.toString()}]},a={additionalData:{i:p({},t)}};this.auditSrv.logWithData("WYGASNIECIE_KODU_PODCZAS_UZUPELNIENIA_DANYCH",a)}getRequestFromSessionStorage(){let e=this.sessionStorageCompleteDataService.getCompleteDataFromSessionStorage();if(!e)return;let{kanalOdzyskiwania:t,zmianaHasla:a,regulamin:n,kodWeryfikacyjny:m,initVerificationCodeResponse:g}=e,j={kanalOdzyskiwania:t,zmianaHasla:a,regulamin:n,kodWeryfikacyjny:m};this.completeDataFormStore.setVerificationData({requestData:j,verificationCode:g}),this.firstVerificationCode.set(g)}static{this.\u0275fac=(()=>{let e;return function(a){return(e||(e=L.\u0275\u0275getInheritedFactory(i)))(a||i)}})()}static{this.\u0275prov=L.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac})}}return i})();import{Router as At}from"@angular/router";import{toCodeConfirmationRequestWithOneTimeAccess as vt,CodeVerificationComponent as yt,DeviceNameService as bt}from"ezus-common";import*as r from"@angular/core";var wt=()=>({key:"ezus.bladPonownejWysylkiKodu"});function Ft(i,c){if(i&1){let e=r.\u0275\u0275getCurrentView();r.\u0275\u0275elementStart(0,"ec-code-verification",2),r.\u0275\u0275listener("onCodeExpired",function(a){r.\u0275\u0275restoreView(e);let n=r.\u0275\u0275nextContext(2);return r.\u0275\u0275resetView(n.auditExpiredCode(a))})("onGoBack",function(){r.\u0275\u0275restoreView(e);let a=r.\u0275\u0275nextContext(2);return r.\u0275\u0275resetView(a.onGoBack())})("onCancel",function(){r.\u0275\u0275restoreView(e);let a=r.\u0275\u0275nextContext(2);return r.\u0275\u0275resetView(a.onLogout())})("onSubmit",function(a){r.\u0275\u0275restoreView(e);let n=r.\u0275\u0275nextContext(2);return r.\u0275\u0275resetView(n.onSubmit(a))}),r.\u0275\u0275elementEnd()}if(i&2){let e=r.\u0275\u0275nextContext().$implicit,t=r.\u0275\u0275nextContext();r.\u0275\u0275property("firstVerificationCode",c)("headerText",e("ezus.logowanie.drugiEtap.tytul"))("cancelButtonLabel",e("ezus.logowanie.drugiEtap.wyloguj"))("submitButtonLabel",e("ezus.logowanie.drugiEtap.dalej"))("goBackButtonLabel",e("ezus.cofnij"))("hideGoBackButton",!1)("submitButtonDisabled",!1)("resendVerificationCodeSrv",t.codeVerificationHttpService)("errorNotification",r.\u0275\u0275pureFunction0(9,wt))}}function xt(i,c){if(i&1&&(r.\u0275\u0275elementContainerStart(0),r.\u0275\u0275template(1,Ft,1,10,"ec-code-verification",1),r.\u0275\u0275elementContainerEnd()),i&2){let e,t=r.\u0275\u0275nextContext();r.\u0275\u0275advance(),r.\u0275\u0275conditional((e=t.firstVerificationCode())?1:-1,e)}}var Ee=(()=>{class i{constructor(){this.secondStepCompleteDataFacade=k(M),this.requestSig=this.secondStepCompleteDataFacade.requestSig,this.router=k(At),this.deviceSrv=k(bt),this.firstVerificationCode=this.secondStepCompleteDataFacade.firstVerificationCode,this.codeVerificationHttpService=k(fe)}ngOnInit(){this.secondStepCompleteDataFacade.logoutIfNoStoredRequestData()}onGoBack(){this.router.navigateByUrl(u.UZUPELNIENIE_DANYCH_PIERWSZY_KROK)}onLogout(){this.secondStepCompleteDataFacade.logoutWithDialog("WYLOGOWANIE_Z_PROCESU_UZUPELNIENIA_DANYCH_KROK_WERYFIKACJA_KODEM")}onSubmit(e){let t=this.requestSig();if(!t)return;let a=this.deviceSrv.getOneTimeDeviceInfo(),n=d(p({},t),{kodWeryfikacyjny:vt(e,a)});this.secondStepCompleteDataFacade.saveData(n)}auditExpiredCode(e){this.secondStepCompleteDataFacade.auditExpiredCode(e)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=r.\u0275\u0275defineComponent({type:i,selectors:[["ezus-main-second-step-complete-data"]],standalone:!0,features:[r.\u0275\u0275ProvidersFeature([M]),r.\u0275\u0275StandaloneFeature],decls:1,vars:0,consts:[[4,"transloco"],["previousButtonAuditEvent","COFNIECIE_Z_KROKU_WERYFIKACJI_KODEM_UZUPELNIENIA_DANYCH_PODCZAS_LOGOWANIA",3,"firstVerificationCode","headerText","cancelButtonLabel","submitButtonLabel","goBackButtonLabel","hideGoBackButton","submitButtonDisabled","resendVerificationCodeSrv","errorNotification"],["previousButtonAuditEvent","COFNIECIE_Z_KROKU_WERYFIKACJI_KODEM_UZUPELNIENIA_DANYCH_PODCZAS_LOGOWANIA",3,"onCodeExpired","onGoBack","onCancel","onSubmit","firstVerificationCode","headerText","cancelButtonLabel","submitButtonLabel","goBackButtonLabel","hideGoBackButton","submitButtonDisabled","resendVerificationCodeSrv","errorNotification"]],template:function(t,a){t&1&&r.\u0275\u0275template(0,xt,2,1,"ng-container",0)},dependencies:[yt,Et],styles:["@media (min-width: 1023.5px){ezus-main-code-verification[_ngcontent-%COMP%]{width:809px}}@media (min-width: 1920px){ezus-main-code-verification[_ngcontent-%COMP%]{width:1177px}}"]})}}return i})();import{inject as W,effect as Rt}from"@angular/core";import{FormBuilder as Vt,ReactiveFormsModule as Ut}from"@angular/forms";import{takeUntilDestroyed as zt}from"@angular/core/rxjs-interop";import{EMPTY as Mt,filter as Bt,map as Ae,switchMap as Wt,take as G,tap as ve}from"rxjs";import{TranslocoDirective as Gt}from"@jsverse/transloco";import{ButtonComponent as jt,ContentBoxComponent as Ht}from"ezus-design-system";import{PasswordComponent as ye}from"ezus-common";import{AccessDataComponent as be}from"ezus-common";import{toCompleteDataRequest as Kt}from"ezus-common";import{DestroyRef as It,inject as f,signal as b}from"@angular/core";import{commonAuthStoreActions as Nt,LocalStorageService as Lt,ToastOnBackendErrorService as kt,toICompleteDataForm as Tt,translocoSignal as T}from"ezus-common";import{firstValueFrom as Ot}from"rxjs";import{EssentialLocalStorageKeys as Pt}from"ezus-common";import*as O from"@angular/core";var B=(()=>{class i extends _{constructor(){super(...arguments),this.userIdentificationHttpSrv=f(X),this.browserHistoryBack=f(ae),this.localStorageSrv=f(Lt),this.passwordSrv=f(Q),this.toastOnBackendErrorService=f(kt),this.agreementsService=f(A),this.cancelProcessConfirmationSrv=f($),this.personalDataForPasswordValidatorSig=b({}),this.destroyRef=f(It),this.passwordFormStoreValue=this.completeDataFormStore.selectSignal(({data:e})=>e?.password),this.termsFormStoreValue=this.completeDataFormStore.selectSignal(({data:e})=>e?.terms),this.accessDataFormStoreValue=this.completeDataFormStore.selectSignal(({data:e})=>e?.accessData),this.blockSubmitSig=b(!1),this.displayAccessDataSectionSig=b(!1),this.displayPasswordSectionSig=b(!1),this.displayTermsSectionSig=b(!1),this.cancelDialogTranslation={headerLabel:T("ezus.zmianaHasla.anulowanie.naglowek"),content:T("ezus.zmianaHasla.anulowanie.komunikat"),ariaLabelledBy:"cancel-password-change-dialog",confirmButtonLabel:T("ezus.anulowanieProcesu.przycisk.tak"),cancelButtonLabel:T("ezus.anulowanieProcesu.przycisk.nie")}}setDisplayedRequiredActions(){return h(this,null,function*(){this.blockSubmitSig.set(!0);try{let e=yield Ot(this.store.select(K));this.assertHasActions(e),this.setDisplayedSections(e),e.includes("WYMAGANE_USTAWIENIE_HASLA")||e.includes("WYMAGANA_ZMIANA_HASLA")?yield this.setUserDataForValidator():this.blockSubmitSig.set(!1)}catch(e){console.error(e),this.logoutAction()}this.passwordFormStoreValue()||this.accessDataFormStoreValue()||this.termsFormStoreValue()||this.fetchInitialValuesFromLocalStore()})}nextSendCompletedDataCallback({status:e,body:t}
1,a){if(e===200){if(!t)throw new Error("Missing body data in response");let n=t;this.completeDataFormStore.setVerificationData({requestData:a,verificationCode:n});let m=d(p({},a),{initVerificationCodeResponse:n});this.sessionStorageCompleteDataService.setCompleteDataInSessionStorage(m),this.router.navigateByUrl(u.UZUPELNIENIE_DANYCH_DRUGI_KROK)}else e===204&&(this.localStorageSrv.setEssentialData(Pt.IS_SUCCESS_COMPLETE_DATA,!0),this.router.navigate([u.UZUPELNIENIE_DANYCH_SUKCES]))}fetchInitialValuesFromLocalStore(){let e=this.sessionStorageCompleteDataService.getCompleteDataFromSessionStorage();if(!e){this.completeDataFormStore.resetState();return}let{kanalOdzyskiwania:t,zmianaHasla:a,regulamin:n}=e,m=Tt({kanalOdzyskiwania:t,zmianaHasla:a,regulamin:n,kodWeryfikacyjny:null});this.completeDataFormStore.setFormData(m)}preventBackButton(){this.browserHistoryBack.preventBackButton(()=>this.logoutWithDialogOnFirstStepCompletedData()).subscribe()}updateFormStore(e,t,a){this.completeDataFormStore.patchState(({data:n})=>({data:d(p({},n),{accessData:e,password:t,terms:a})}))}auditInvalidFormValidation(){this.auditSrv.log("NIEUDANA_WALIDACJA_UZUPELNIONYCH_DANYCH_PODCZAS_LOGOWANIA_KROK_1")}cancelProcess(){this.cancelProcessConfirmationSrv.openCancelDialog(()=>h(this,null,function*(){try{yield this.passwordSrv.cancelPasswordChangeProcess(),this.auditSrv.log("ANULOWANIE_PROCESU_ZMIANY_HASLA"),this.translocoToastServ.open("success",{key:"ezus.zmianaHasla.anulowanie.sukces"})}catch(e){this.toastOnBackendErrorService.show(e,"ezus.zmianaHasla.anulowanie.error")}this.store.dispatch(Nt.logout({logoutParams:null,navigatePath:u.LOGOWANIE}))}),()=>{},this.cancelDialogTranslation)}logoutWithDialogOnFirstStepCompletedData(){let e=this.agreementsService.regulationIdSig();if(!e){this.logoutWithDialog("WYLOGOWANIE_Z_PROCESU_UZUPELNIENIA_DANYCH_KROK_1");return}let a={additionalData:{i:p({},{daneDodatkowe:[{nazwaPola:"ID_REGULAMINU",wartoscPola:e}]})}};this.logoutConfirmationService.open({auditLogoutConfirmationFn:()=>this.auditSrv.logWithData("WYLOGOWANIE_Z_PROCESU_UZUPELNIENIA_DANYCH_KROK_1_Z_REGULAMINEM",a)})}assertHasActions(e){if(!e||!Array.isArray(e)||!e.length)throw new Error("No required actions found.")}setDisplayedSections(e){e.forEach(t=>{t==="WYMAGANA_WERYFIKACJA_DANYCH_KONTAKTOWYCH"&&this.displayAccessDataSectionSig.set(!0),(t==="WYMAGANE_USTAWIENIE_HASLA"||t==="WYMAGANA_ZMIANA_HASLA")&&this.displayPasswordSectionSig.set(!0),t==="WYMAGANA_AKCEPTACJA_REGULAMINU"&&this.displayTermsSectionSig.set(!0)})}setUserDataForValidator(){return h(this,null,function*(){try{let{imie:e,nazwisko:t,dataUrodzenia:a,pesel:n,nip:m,dokumentTozsamosci:g}=yield this.userIdentificationHttpSrv.fetchUserIdentification();this.personalDataForPasswordValidatorSig.set({name:e,surname:t,dateOfBirth:a,pesel:n,nip:m,id:g?.numer}),this.blockSubmitSig.set(!1)}catch{throw new Error("No user data found.")}})}static{this.\u0275fac=(()=>{let e;return function(a){return(e||(e=O.\u0275\u0275getInheritedFactory(i)))(a||i)}})()}static{this.\u0275prov=O.\u0275\u0275defineInjectable({token:i,factory:i.\u0275fac})}}return i})();import*as o from"@angular/core";import*as C from"@angular/forms";function Zt(i,c){if(i&1&&(o.\u0275\u0275elementStart(0,"eds-content-box",2),o.\u0275\u0275element(1,"ec-access-data",9),o.\u0275\u0275elementEnd()),i&2){let e,t=o.\u0275\u0275nextContext().$implicit,a=o.\u0275\u0275nextContext();o.\u0275\u0275property("divider",!0)("headerLabel",t("ezus.rejestracja.wizyta.pierwszyKrok.sekcja.daneDostepuDoEZUS")),o.\u0275\u0275advance(),o.\u0275\u0275property("repeatInput",!0)("alert",!0)("alertInfoMessage","ezus.uzupelnienieDanych.alert.komunikat")("errorAlertBoxCode",a.accessDataErrorSig())("warning",(e=a.shouldShowAccessDataWarning())!==null&&e!==void 0?e:!1)("warningMessageCode",a.accessDataWarningMessageCode)("shouldShowValidationErrors",a.hasSubmitBeenClicked)("inFormGroup",!0)("customValidationMsg",a.accessDataCustomValidationMsg)("emailLabel",t("ezus.daneDostepuDoEZUS.emailLabel"))("emailAriaLabel",t("ezus.daneDostepuDoEZUS.emailAriaLabel"))("emailConfirmLabel",t("ezus.daneDostepuDoEZUS.emailConfirmLabel"))("emailConfirmAriaLabel",t("ezus.daneDostepuDoEZUS.emailConfirmAriaLabel"))("phoneNumberLabel",t("ezus.daneDostepuDoEZUS.phoneNumberLabel"))("phoneNumberAriaLabel",t("ezus.daneDostepuDoEZUS.phoneNumberAriaLabel"))("phoneNumberConfirmLabel",t("ezus.daneDostepuDoEZUS.phoneNumberConfirmLabel"))("phoneNumberConfirmAriaLabel",t("ezus.daneDostepuDoEZUS.phoneNumberConfirmAriaLabel"))("phoneNumberInfoTextLabel",t("ezus.daneDostepuDoEZUS.numerTelefonu.opisNumerTelefonu"))}}function Yt(i,c){if(i&1&&(o.\u0275\u0275elementStart(0,"eds-content-box",3),o.\u0275\u0275element(1,"ec-password",10),o.\u0275\u0275elementEnd()),i&2){let e=o.\u0275\u0275nextContext().$implicit,t=o.\u0275\u0275nextContext();o.\u0275\u0275property("divider",!0)("headerLabel",e("ezus.rejestracja.wizyta.pierwszyKrok.sekcja.hasloDoEZUS")),o.\u
10275\u0275advance(),o.\u0275\u0275property("value",t.passwordFormStoreValue())("personalData",t.personalDataForPasswordValidatorSig())("passwordErrorDetectorConfig",t.passwordErrorDetectorConfig)("shouldShowValidationErrors",t.hasSubmitBeenClicked)("inFormGroup",!0)("passwordLabel",e("ezus.hasloDoEZUS.labelHaslo"))("confirmPasswordLabel",e("ezus.hasloDoEZUS.labelPowtorzHaslo"))("customTranslations",t.passwordCustomTranslations)}}function qt(i,c){if(i&1&&(o.\u0275\u0275elementStart(0,"eds-content-box",3),o.\u0275\u0275element(1,"ezus-main-terms",11),o.\u0275\u0275elementEnd()),i&2){let e=o.\u0275\u0275nextContext().$implicit,t=o.\u0275\u0275nextContext();o.\u0275\u0275property("divider",!0)("headerLabel",e("ezus.rejestracja.wizyta.pierwszyKrok.sekcja.zgody")),o.\u0275\u0275advance(),o.\u0275\u0275property("value",t.termsFormStoreValue())("shouldShowValidationErrors",t.hasSubmitBeenClicked)("inFormGroup",!0)}}function Jt(i,c){if(i&1){let e=o.\u0275\u0275getCurrentView();o.\u0275\u0275elementStart(0,"eds-button",8),o.\u0275\u0275listener("onClick",function(){o.\u0275\u0275restoreView(e);let a=o.\u0275\u0275nextContext(2);return o.\u0275\u0275resetView(a.onCancel())}),o.\u0275\u0275elementEnd()}if(i&2){let e=o.\u0275\u0275nextContext().$implicit;o.\u0275\u0275property("label",e("ezus.zmianaHasla.anuluj"))}}function Qt(i,c){if(i&1){let e=o.\u0275\u0275getCurrentView();o.\u0275\u0275elementContainerStart(0),o.\u0275\u0275elementStart(1,"form",1),o.\u0275\u0275listener("ngSubmit",function(){o.\u0275\u0275restoreView(e);let a=o.\u0275\u0275nextContext();return o.\u0275\u0275resetView(a.onSubmit())}),o.\u0275\u0275template(2,Zt,2,20,"eds-content-box",2)(3,Yt,2,10,"eds-content-box",3)(4,qt,2,5,"eds-content-box",3),o.\u0275\u0275elementStart(5,"div",4)(6,"div",5),o.\u0275\u0275element(7,"eds-button",6),o.\u0275\u0275template(8,Jt,1,1,"eds-button",7),o.\u0275\u0275elementEnd(),o.\u0275\u0275elementStart(9,"eds-button",8),o.\u0275\u0275listener("onClick",function(){o.\u0275\u0275restoreView(e);let a=o.\u0275\u0275nextContext();return o.\u0275\u0275resetView(a.onLogout())}),o.\u0275\u0275elementEnd()()(),o.\u0275\u0275elementContainerEnd()}if(i&2){let e=c.$implicit,t=o.\u0275\u0275nextContext();o.\u0275\u0275advance(),o.\u0275\u0275property("formGroup",t.form),o.\u0275\u0275advance(),o.\u0275\u0275conditional(t.displayAccessDataSectionSig()?2:-1),o.\u0275\u0275advance(),o.\u0275\u0275conditional(t.displayPasswordSectionSig()?3:-1),o.\u0275\u0275advance(),o.\u0275\u0275conditional(t.displayTermsSectionSig()?4:-1),o.\u0275\u0275advance(3),o.\u0275\u0275property("label",e("ezus.uzupelnienieDanych.dalej"))("disabled",t.blockSubmitSig()),o.\u0275\u0275advance(),o.\u0275\u0275conditional(t.displayPasswordSectionSig()?8:-1),o.\u0275\u0275advance(),o.\u0275\u0275property("label",e("ezus.uzupelnienieDanych.wyloguj"))}}var we=(()=>{class i{constructor(){this.nnfb=W(Vt).nonNullable,this.form=this.nnfb.group({accessData:{}}),this.firstStepCompleteDataFacade=W(B),this.personalDataForPasswordValidatorSig=this.firstStepCompleteDataFacade.personalDataForPasswordValidatorSig,this.blockSubmitSig=this.firstStepCompleteDataFacade.blockSubmitSig,this.displayAccessDataSectionSig=this.firstStepCompleteDataFacade.displayAccessDataSectionSig,this.displayPasswordSectionSig=this.firstStepCompleteDataFacade.displayPasswordSectionSig,this.displayTermsSectionSig=this.firstStepCompleteDataFacade.displayTermsSectionSig,this.passwordFormStoreValue=this.firstStepCompleteDataFacade.passwordFormStoreValue,this.termsFormStoreValue=this.firstStepCompleteDataFacade.termsFormStoreValue,this.shouldShowAccessDataWarning=this.firstStepCompleteDataFacade.shouldShowAccessDataWarning,this.accessDataWarningMessageCode="ezus.uzupelnienieDanych.toast.otrzymalismyZgloszenie",this.accessDataErrorSig=this.firstStepCompleteDataFacade.accessDataError,this.destroyRef=this.firstStepCompleteDataFacade.destroyRef,this.agreementsSrv=W(A),this.hasSubmitBeenClicked=!1,this.passwordErrorDetectorConfig={syncValidators:{DIGIT:!0,LOWERCASE:!0,MORE_THAN_TWO_SAME_CHARACTERS_IN_SEQUENCE:!0,MAX_LENGTH:!0,MIN_LENGTH:!0,SPECIAL_CHARACTER:!0,UPPERCASE:!0,POLISH_DIACRITICS:!1},asyncValidators:{ID:!0,NAME:!0,SURNAME:!0,DATE_OF_BIRTH:!0,PESEL:!0,NIP:!0}},this.passwordCustomTranslations=re,this.accessDataCustomValidationMsg=ce,this.errorCodeEff=Rt(()=>{this.accessDataErrorSig()!==""&&(this.accessDataErrorSig().includes("emailJestJuzUzywany")?(this.accessDataComponentRef?.formGroup.controls.email.setErrors({taken:!0}),this.accessDataComponentRef?.setEmailError({taken:!0})):(this.accessDataComponentRef?.formGroup.controls.phoneNumber.setErrors({taken:!0}),this.accessDataComponentRef?.setPhoneNumberError({taken:!0})),this.scrollToAccessData())}),this.firstStepCompleteDataFacade.preventBackButton()}ngOnInit(){return h(this,null,function*(){yield this.firstStepCompleteDataFacade.setDisplayedRequiredActions(),this.restoreAccessData()})}restoreAccessData(){this.firstStepCompleteDataFacade.accessDataFormStoreValue()&&this.form.get("accessData")?.patchValue(this.firstStepCompleteDataFacade.accessDataFormStoreValue())}onSubmit(){if(this.accessDataComponentRef?.formGroup.controls.email.hasError("taken")||this.accessDataComponentRef?.formGroup.controls.phoneNumber.hasError("taken")){this.scrollToAccessData();return}else this.accessDataErrorSig.set("");this.hasSubmitBeenClicked=!0,!this.blockSubmitSig()&&(this.blockSubmitSig.set(!0),this.displayPasswordSectionSig()?this.handleSubmitWithPassword():this.handleSubmitWithoutPassword(),this.startFormValidation())}onCancel(){this.firstStepCompleteDataFacade.cancelProcess()}
1onLogout(){this.firstStepCompleteDataFacade.logoutWithDialogOnFirstStepCompletedData()}handleSubmitWithPassword(){this.passwordComponentRef?.formGroup.statusChanges.pipe(Bt(e=>e!=="PENDING"),G(1),Wt(e=>e!=="VALID"?(this.firstStepCompleteDataFacade.auditInvalidFormValidation(),Mt):this.form.statusChanges.pipe(G(1),Ae(t=>t==="VALID"),ve(t=>{t||this.firstStepCompleteDataFacade.auditInvalidFormValidation()}))),zt(this.destroyRef)).subscribe({next:e=>this.handleFormSubmissionNext(e),error:e=>this.handleFormSubmissionError(e),complete:()=>this.handleFormSubmissionComplete()})}handleSubmitWithoutPassword(){this.form.statusChanges.pipe(G(1),Ae(e=>e==="VALID"),ve(e=>{e||this.firstStepCompleteDataFacade.auditInvalidFormValidation()})).subscribe({next:e=>this.handleFormSubmissionNext(e),error:e=>this.handleFormSubmissionError(e),complete:()=>this.handleFormSubmissionComplete()})}handleFormSubmissionNext(e){this.blockSubmitSig.set(!1),e&&this.handleValidForm()}handleFormSubmissionError(e){console.error("Result checking error: ",e),this.blockSubmitSig.set(!1);let t=e?.error?.kod;t&&this.handleFailedDataCheck(t)}handleFormSubmissionComplete(){this.blockSubmitSig.set(!1)}startFormValidation(){ie(this.form),this.markSectionsForCheck()}markSectionsForCheck(){this.accessDataComponentRef?.markAsDirtyAndTouched(),this.passwordComponentRef?.cdr.markForCheck(),this.termsComponentRef?.markAllTermsForCheck()}handleValidForm(){this.updateStoreBeforeSecondStep(),this.saveData()}updateStoreBeforeSecondStep(){let{accessData:e,password:t,terms:a}=this.getControls();this.firstStepCompleteDataFacade.updateFormStore(e?.value,t?.value,a?.value)}handleFailedDataCheck(e){let t=e.toLowerCase(),a=null,n;t.includes("email")?(a=document.querySelector("#email"),this.accessDataComponentRef?.setEmailError({taken:!0}),this.accessDataComponentRef?.cdr.markForCheck()):t.includes("telefon")&&(a=document.querySelector("#phoneNumber"),this.accessDataComponentRef?.setPhoneNumberError({taken:!0}),this.accessDataComponentRef?.cdr.markForCheck()),n?.setErrors({taken:!0}),n?.markAsTouched(),a?.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}saveData(){let{accessData:e,password:t,terms:a}=this.getControls(),n={accessData:e?.value,password:t?.value,terms:a?.value},m=this.agreementsSrv.getAgreementList(a?.value?.agreements??[]),g=Kt(n,this.agreementsSrv.regulationIdSig(),m);this.firstStepCompleteDataFacade.saveData(g)}getControls(){return this.form.controls}scrollToAccessData(){document.querySelector("#accessDataContentBox")?.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=o.\u0275\u0275defineComponent({type:i,selectors:[["ng-component"]],viewQuery:function(t,a){if(t&1&&(o.\u0275\u0275viewQuery(be,5),o.\u
10275\u0275viewQuery(ye,5),o.\u0275\u0275viewQuery(R,5)),t&2){let n;o.\u0275\u0275queryRefresh(n=o.\u0275\u0275loadQuery())&&(a.accessDataComponentRef=n.first),o.\u0275\u0275queryRefresh(n=o.\u0275\u0275loadQuery())&&(a.passwordComponentRef=n.first),o.\u0275\u0275queryRefresh(n=o.\u0275\u0275loadQuery())&&(a.termsComponentRef=n.first)}},standalone:!0,features:[o.\u0275\u0275ProvidersFeature([B,A]),o.\u0275\u0275StandaloneFeature],decls:1,vars:0,consts:[[4,"transloco"],["autoFocusInvalid","","autocomplete","off",3,"ngSubmit","formGroup"],["id","accessDataContentBox",3,"divider","headerLabel"],[3,"divider","headerLabel"],[1,"actions"],[1,"main-buttons-container"],["type","submit",3,"label","disabled"],["styleClass","eds-button-quaternary",3,"label"],["styleClass","eds-button-quaternary",3,"onClick","label"],["formGroupName","accessData",3,"repeatInput","alert","alertInfoMessage","errorAlertBoxCode","warning","warningMessageCode","shouldShowValidationErrors","inFormGroup","customValidationMsg","emailLabel","emailAriaLabel","emailConfirmLabel","emailConfirmAriaLabel","phoneNumberLabel","phoneNumberAriaLabel","phoneNumberConfirmLabel","phoneNumberConfirmAriaLabel","phoneNumberInfoTextLabel"],["formGroupName","password","showPasswordAuditEvent","PODGLAD_HASLA_W_PROCESIE_UZUPELNIJ_DANE",3,"value","personalData","passwordErrorDetectorConfig","shouldShowValidationErrors","inFormGroup","passwordLabel","confirmPasswordLabel","customTranslations"],["formGroupName","terms","regulationSource","user",3,"value","shouldShowValidationErrors","inFormGroup"]],template:function(t,a){t&1&&o.\u0275\u0275template(0,Qt,10,8,"
1ng-container",0)},dependencies:[Ut,C.\u0275NgNoValidate,C.NgControlStatusGroup,C.FormGroupDirective,C.FormGroupName,Gt,be,ye,R,jt,Ht,oe],styles:["[_nghost-%COMP%] eds-content-box .eds-content-box-container{margin-bottom:20px}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-top:20px;gap:16px}.actions[_ngcontent-%COMP%] > eds-button[_ngcontent-%COMP%]:nth-child(1){margin-bottom:16px}.actions[_ngcontent-%COMP%] .main-buttons-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}@media (min-width: 1023.5px){.actions[_ngcontent-%COMP%]{display:flex;flex-direction:row-reverse;justify-content:space-between;margin-top:30px}.actions[_ngcontent-%COMP%] .main-buttons-container[_ngcontent-%COMP%]{display:flex;flex-direction:row-reverse;gap:16px}.actions[_ngcontent-%COMP%] > eds-button[_ngcontent-%COMP%]:nth-child(1){margin-bottom:16px}}"],changeDetection:0})}}return i})();import{inject as w}from"@angular/core";import{Router as $t}from"@angular/router";import{switchMap as Xt,of as eo,tap as to}from"rxjs";import{commonAuthStoreActions as Fe,LocalStorageService as oo,EssentialLocalStorageKeys as io,SessionValidityHttpService as ao}from"ezus-common";import{Store as ro}from"@ngrx/store";var xe=()=>{let i=w(ro),c=w($t),e=w(x),t=w(ao),a=w(oo);return i.dispatch(Fe.displayLoader({displayLoader:!0})),t.getSessionDuration().pipe(to(n=>{i.dispatch(D.getSessionDataSuccess({sessionData:n})),i.dispatch(Fe.displayLoader({displayLoader:!1}))}),Xt(n=>{let m=n.wymaganeAkcje;return m.length?J(c,m):a.get(io.IS_SUCCESS_COMPLETE_DATA)?eo(!0):q(e,i,c)}))};var Pa=[{path:"",component:Se,children:[{path:"",redirectTo:E.PIERWSZY_KROK,pathMatch:"full"},{path:E.PIERWSZY_KROK,component:we,canActivate:[P]},{path:E.DRUGI_KROK,component:Ee,canActivate:[P]},te(E.SUKCES,"SAVE_DATA",[xe])]}];export{Pa as COMPLETE_DATA_ROUTES};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.