1import"./chunk-BYXBJQAS.js";import{a as Fe}from"./chunk-33Q3BJCX.js";import{a as Oe}from"./chunk-3IUPZ5L5.js";import"./chunk-7EQYCGJX.js";import"./chunk-JF343G3F.js";import{e as Ie}from"./chunk-OFHCQT4H.js";import{b as g}from"./chunk-MYMWODBV.js";import{a as b,g as we}from"./chunk-CUI557SW.js";import{a as ke,c as Ue}from"./chunk-235QDCGX.js";import"./chunk-OTT57Z3E.js";import{C as me,Ca as A,Da as T,Mc as I,Oa as R,Qc as F,Ta as Ee,X as de,Y as pe,Z as fe,_ as ue,ba as ve,ha as Se,ta as Pe,z as se}from"./chunk-SGC6HXLW.js";import"./chunk-OHHVNHCS.js";import{m as le}from"./chunk-IYDUTT2D.js";import"./chunk-DF3QZ7OU.js";import"./chunk-UOIUVBVY.js";import{d as re,f as ae}from"./chunk-UUSQJ7Q5.js";import"./chunk-H6MGNC5U.js";import{a as De}from"./chunk-R5KFWIN2.js";import{f as O,p as ce}from"./chunk-SKFQDKFC.js";import"./chunk-W4IQKP4F.js";import"./chunk-F7S7KAFY.js";import{A as Me,c as he,e as E,g as xe,h as ge,k as Ce,m as h,p as ye,w as be,x as _e}from"./chunk-QJMOOZCW.js";import{a as oe,b as V}from"./chunk-QQOGNU3M.js";import{s as ne}from"./chunk-H7M2PRSC.js";import{A as P,Ad as ee,Bc as S,Ea as w,Gc as D,Hb as K,Hc as i,I as y,Ic as o,Id as m,J as G,Ja as k,Jc as u,Jd as c,Ka as p,Kd as te,Lb as n,Qa as U,Qc as Z,Ra as B,T as f,Vc as N,Xc as x,_ as W,_b as Q,a as _,aa as q,b as L,d as $,da as Y,de as ie,kd as r,ld as a,ra as v,ua as J,w as X,x as z,zc as M}from"./chunk-HRJCVJIG.js";var j=(()=>{class s{constructor(e,t){this.store=e,this.actions=t,this.everyMatrixUser$=this.store.select(Ee.getEveryMatrixUser),this.loadEveryMatrixUserData()}loadEveryMatrixUserData(){let e=new A("getProfile",null);this.store.dispatch(e).pipe(T(this.actions,e),f(t=>t.status==="success")).subscribe(t=>this.store.dispatch(new R(t.data)))}updateProfile(e){let t=new A("updateProfile",e.fields);return this.store.dispatch(t).pipe(T(this.actions,t),f(d=>d.status==="success"),J(()=>this.store.dispatch(new R(e))))}static{this.\u0275fac=function(t){return new(t||s)(k(me),k(se))}}static{this.\u0275prov=w({token:s,factory:s.\u0275fac})}}return s})();var Ne=(()=>{class s{constructor(){this.dialogService=p(F),this.userService=p(I)}startPhoneChangeFlow(e){return this.openConfirmDialog$(e).pipe(f(t=>t.command===g.success),v(t=>this.openEmailOtpDialog$().pipe(y(d=>({emailResult:d,phone:t.phone})))),f(({emailResult:t})=>t===g.success),v(({phone:t})=>this.openSmsOtpDialog$(t)),f(t=>t.command===g.success),y(()=>(this.userService.checkUserData(),!0)))}openConfirmDialog$(e){return P(import("./chunk-A33L3NDC.js")).pipe(v(({PhoneChangeConfirmDialogComponent:t})=>this.dialogService.openDialog(t,{panelClass:"margins-dialog",data:{phone:e}}).afterClosed().pipe(y(C=>C??{command:g.fail}))))}openEmailOtpDialog$(){return P(import("./chunk-LZYFMJ2C.js")).pipe(v(({PhoneChangeEmailOtpDialogComponent:e})=>this.dialogService.openDialog(e,{panelClass:"margins-dialog",data:{email:this.userService.user?.email??""}}).afterClosed().pipe(y(d=>d??g.fail))))}openSmsOtpDialog$(e){return P(import("./chunk-RYCIU5NT.js")).pipe(v(({PhoneChangeSmsOtpDialogComponent:t})=>this.dialogService.openDialog(t,{panelClass:"margins-dialog",data:{phone:e}}).afterClosed().pipe(y(C=>C??{command:g.fail}))))}static{this.\u0275fac=function(t){return new(t||s)}}static{this.\u0275prov=w({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})();function je(s,l){if(s&1&&(i(0,"div",4)(1,"div",5)(2,"div"),r(3),m(4,"translate"),o(),i(5,"div"),r(6),o()(),i(7,"div",5)(8,"div"),r(9),m(10,"translate"),o(),i(11,"div"),r(12),o()()()),s&2){let e=x(2);n(3),a(c(4,4,"common.country")),n(3),a(e.everyMatrixUser.fields.country),n(3),a(c(10,6,"common.currency")),n(3),a(e.everyMatrixUser.fields.currency)}}function He(s,l){if(s&1&&(i(0,"div",4)(1,"div",5)(2,"div"),r(3),m(4,"translate"),o(),i(5,"div"),r(6),o()(),i(7,"div",5)(8,"div"),r(9),m(10,"translate"),o(),i(11,"div"),r(12),o()()(),i(13,"div",4)(14,"div",5)(15,"div"),r(16),m(17,"translate"),o(),i(18,"div"),r(19),o()()()),s&2){let e=x(2);n(3),a(c(4,6,"common.city/town")),n(3),a(e.everyMatrixUser.fields.city),n(3),a(c(10,8,"common.country")),n(3),a(e.everyMatrixUser.fields.country),n(4),a(c(17,10,"common.currency")),n(3),a(e.everyMatrixUser.fields.currency)}}function Le(s,l){if(s&1&&(i(0,"div",4)(1,"div",5)(2,"div"),r(3),m(4,"translate"),o(),i(5,"div"),r(6),o()()()),s&2){let e=x(2);n(3),a(c(4,2,"common.address")),n(3),a(e.everyMatrixUser.fields.address1)}}function $e(s,l){s&1&&(u(0,"mb-city-autocomplete",18),i(1,"mb-form-control-field")(2,"label"),r(3),m(4,"translate"),o(),u(5,"input",19),o()),s&2&&(D("showValidationIcon",!1),n(3),a(c(4,2,"common.address")))}function Xe(s,l){if(s&1){let e=Z();i(0,"form",2)(1,"section",3)(2,"div",4)(3,"div",5)(4,"div"),r(5),m(6,"translate"),o(),i(7,"div"),r(8),o()(),i(9,"div",5)(10,"div"),r(11),m(12,"translate"),o(),i(13,"div"),r(14),o()()(),i(15,"div",4)(16,"div",5)(17,"div"),r(18),m(19,"translate"),o(),i(20,"div"),r(21),o()()(),i(22,"div",4)(23,"div",5)(24,"div"),r(25),m(26,"translate"),o(),i(27,"div"),r(28),m(29,"date"),o()(),i(30,"div",5)(31,"div"),r(32),m(33,"translate"),o(),i(34,"div"),r(35),o()()(),M(36,je,13,8,"div",4)(37,He,20,12),i(38,"div",4)(39,"div",5)(40,"div"),r(41),m(42,"translate"),o(),i(43,"div"),r(44),o()()(),M(45,Le,7,4,"div",4),o(),i(46,"section"),M(47,$e,6,4),i(48,"mb-form-control-field",6)(49,"label"),r(50),m(51,"translate"),o(),u(52,"input",7),o()(),i(53,"section",8)(54,"div",9),u(55,"mb-switch",10),i(56,"span",11),m(57,"translate"),N("click",function(d){U(e);let C=x();return B(C.onTextClick(d))}),o()(),i(58,"div",9),u(59,"mb-switch",12),i(60,"span",13),r(61),m(62,"translate"),o()(),i(63,"div",9),u(64,"mb-switch",14),i(65,"span",13),r(66),m(67,"translate"),o()(),i(68,"div",9),u(69,"mb-switch",15),i(70,"span",13),r(71),m(72,"translate"),o()()(),i(73,"section",16)(74,"button",17),N("throttleClick",function(){U(e);let d=x();
1return B(d.onUpdateProfile())}),r(75),m(76,"translate"),o()()()}if(s&2){let e=x();D("formGroup",e.personalDetailsForm),n(5),a(c(6,23,"common.firstname")),n(3),a(e.everyMatrixUser.fields.firstname),n(3),a(c(12,25,"common.lastname")),n(3),a(e.everyMatrixUser.fields.surname),n(4),a(c(19,27,"common.email")),n(3),a(e.everyMatrixUser.fields.email),n(4),a(c(26,29,"common.dateOfBirth")),n(3),a(te(29,31,e.everyMatrixUser.fields.birthDate,"dd/MM/yyyy")),n(4),a(c(33,34,"common.nationalIDNumber")),n(3),a(e.everyMatrixUser.fields.personalID),n(),S(e.editableAddress?36:37),n(5),a(c(42,36,"common.username")),n(3),a(e.everyMatrixUser.fields.username),n(),S(e.editableAddress?-1:45),n(2),S(e.editableAddress?47:-1),n(3),a(c(51,38,"common.mobile")),n(6),D("innerHtml",c(57,40,"profile.userDetails.allowTerms"),K),n(5),a(c(62,42,"profile.userDetails.allowEmail")),n(5),a(c(67,44,"profile.userDetails.allowSMS")),n(5),a(c(72,46,"profile.userDetails.allowPhone")),n(3),D("mbButtonDisabled",!e.isFormChanged),n(),a(c(76,48,"profile.userDetails.update"))}}var Ve=class H{get isFormChanged(){return this.personalDetailsForm.valid&&Object.entries(this.initialFormValue).some(([l,e])=>e!==this.personalDetailsForm.value[l])}constructor(){this.router=p(le),this.cdr=p(ie),this.userService=p(I),this.fullStory=p(ce),this.dialogService=p(F),this.profileService=p(j),this.asyncValidationService=p(we),this.phoneChangeHelper=p(Ne),this.personalDetailsForm=new Ce({address1:new h("",{nonNullable:!0,validators:[E.required,b.noOnlySpaces,b.noCyrillic]}),county:new h(null,{validators:[E.required]}),mobile:new h("",{nonNullable:!0,validators:[E.required,b.mobilePrefixPattern,b.mobilePattern,b.fixedLength(10)]}),allow_email:new h(!1,{nonNullable:!0}),allow_sms:new h(!1,{nonNullable:!0}),allow_phone:new h(!1,{nonNullable:!0}),allow_terms:new h({value:!0,disabled:!0},{nonNullable:!0})}),this.editableAddress=!1,this.fullStory.setPage("Profile/Details")}ngOnInit(){this.getUserData(),this.followMobileNumberChange()}getUserData(){G([this.profileService.everyMatrixUser$,this.userService.userData$]).pipe(f(l=>!!l[0]&&Object.keys(l[0]).length>0&&l[1].isAuthenticated)).subscribe(l=>{this.everyMatrixUser=l[0],this.personalDetailsForm.patchValue(l[0].fields,{emitEvent:!1}),this.personalDetailsForm.controls.county.setValue({city:l[0].fields.city}),this.initialFormValue=this.personalDetailsForm.value,this.makeAddressDisabledBasedOnRoles(l[1].roles),this.cdr.markForCheck()})}makeAddressDisabledBasedOnRoles(l){let e=[O.poaApproved,O.newCompleteVerifiedIdentity,O.oldCompleteVerifiedIdentity];this.editableAddress=!e.some(t=>l.includes(t))}followMobileNumberChange(){this.personalDetailsForm.controls.mobile.valueChanges.pipe(f(()=>this.personalDetailsForm.controls.mobile.valid&&this.initialFormValue?.mobile!==this.personalDetailsForm.controls.mobile.value),W(1e3),Y(),v(l=>this.asyncValidationService.checkPhoneNumberAvailability(l,this.everyMatrixUser.fields.userID)),V(this)).subscribe(l=>{l.available?this.personalDetailsForm.controls.mobile.setErrors(null):this.personalDetailsForm.controls.mobile.setErrors({serverError:"serverError.mobileExists_no_login"})})}onTextClick(l){let e=l.target;if(e.localName==="a"){let t;e?.classList?.contains("terms")?t="/profile/legal/termsconditions":e?.classList?.contains("privacy")?t="/profile/legal/privacypolicy":t="/cookiepolicy",this.router.navigate([t])}}onUpdateProfile(){if(this.personalDetailsForm.valid&&this.personalDetailsForm.dirty){let l=this.personalDetailsForm.value,{county:e,mobile:t}=l,d=$(l,["county","mobile"]);t!==this.initialFormValue.mobile?this.phoneChangeHelper.startPhoneChangeFlow(t).pipe(V(this)).subscribe(Ae=>{Ae&&(this.personalDetailsForm.controls.mobile.setErrors(null),this.personalDetailsForm.controls.mobile.markAsPristine(),Object.entries(d).some(([Te,Re])=>Re!==this.initialFormValue[Te])?this.updateProfileWithoutMobile(e,d,!0):(this.profileService.loadEveryMatrixUserData(),this.dialogService.openDefaultSuccessDialog({text:"profile.userDetails.updateSuccessText",displayCloseBtn:!0})))}):this.updateProfileWithoutMobile(e,d,!1)}}updateProfileWithoutMobile(l,e,t){let d=L(_({},this.everyMatrixUser),{fields:_(_(_({},this.everyMatrixUser.fields),e),l?.county_code?l:null)});this.profileService.updateProfile(d).pipe(q(1)).subscribe(()=>{t&&this.profileService.loadEveryMatrixUserData(),this.userService.updateUserData({allow_email:e.allow_email,allow_sms:e.allow_sms,allow_phone:e.allow_phone}),this.initialFormValue=this.personalDetailsForm.value,this.dialogService.openDefaultSuccessDialog({text:"profile.userDetails.updateSuccessText",displayCloseBtn:!0})})}static{this.\u0275fac=function(e){return new(e||H)}}static{this.\u0275cmp=Q({type:H,selectors:[["mb-my-details"]],features:[ee([j,ke()])],decls:8,vars:4,consts:[["context","profile","mobileHeaderFixed",""],["mbHideOnScreenSize","desktop"],[3,"formGroup"],[1,"readonly-section"],[1,"block"],[1,"block-item"],["insideElementPosition","prefix"],["id","mobile1","type","text","formControlName","mobile","placeholder","07XX XXX XXX","mask","0000 000 000"],[1,"switches-section"],[1,"switch-container"],["formControlName","allow_terms"],[1,"text",3,"click","innerHtml"],["formControlName","allow_email"],[1,"text"],["formControlName","allow_sms"],["formControlName","allow_phone"],[1,"button-section"],["mbButton","primary","mbButtonSize","lg",3,"throttleClick","mbButtonDisabled"],["formControlName","county",3,"showValidationIcon"],["id","address","type","text","formControlName","address1"]],template:function(e,t){e&1&&(i(0,"mb-content-layout",0)(1,"mb-content-layout-header",1)(2,"mb-page-title"),r(3),m(4,"translate"),o(),i(5,"mb-content-layout-actions"),u(6,"mb-close-icon-link"),o()(),M(7,Xe,77,50,"form",2),o()),e&2&&(n(3),a(c(4,2,"profile.menu.myDetails")),n(4),S(t.everyMatrixUser?7:-1))},dependencies:[Me,ye,he,xe,ge,_e,be,Ie,De,ae,Se,Ue,Fe,Oe,de,pe,fe,ue,Pe,ve,ne,re],styles:["@keyframes _ngcontent-%COMP%_appear{0%{opacity:0}
1to{opacity:1}}@keyframes _ngcontent-%COMP%_grow{0%{transform:scale(.1)}to{transform:none}}[_nghost-%COMP%]{display:block}form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:24px}form[_ngcontent-%COMP%] .readonly-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:24px;padding:16px;border-radius:8px;background-color:#242432}form[_ngcontent-%COMP%] .readonly-section[_ngcontent-%COMP%] .block[_ngcontent-%COMP%]{display:flex}form[_ngcontent-%COMP%] .readonly-section[_ngcontent-%COMP%] .block[_ngcontent-%COMP%] .block-item[_ngcontent-%COMP%]{flex:1}form[_ngcontent-%COMP%] .readonly-section[_ngcontent-%COMP%] .block[_ngcontent-%COMP%] .block-item[_ngcontent-%COMP%] div[_ngcontent-%COMP%]:first-child{font-size:14px;font-weight:400;line-height:22px;color:#98a2b3}form[_ngcontent-%COMP%] .readonly-section[_ngcontent-%COMP%] .block[_ngcontent-%COMP%] .block-item[_ngcontent-%COMP%] div[_ngcontent-%COMP%]:last-child{min-height:24px;font-size:16px;font-weight:500;line-height:24px;color:#fff}form[_ngcontent-%COMP%] .inside-content[_ngcontent-%COMP%]{color:#98a2b3;font-weight:600}form[_ngcontent-%COMP%] .switches-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}form[_ngcontent-%COMP%] .switches-section[_ngcontent-%COMP%] .switch-container[_ngcontent-%COMP%]{display:flex;gap:12px}form[_ngcontent-%COMP%] .switches-section[_ngcontent-%COMP%] .switch-container[_ngcontent-%COMP%] .text[_ngcontent-%COMP%]{font-weight:400;font-size:11px;line-height:15px;color:#d0d5dd}form[_ngcontent-%COMP%] .switches-section[_ngcontent-%COMP%] .switch-container[_ngcontent-%COMP%] .text[_ngcontent-%COMP%] a{color:#d80010;cursor:pointer}form[_ngcontent-%COMP%] .button-section[_ngcontent-%COMP%]{padding-top:8px}form[_ngcontent-%COMP%] mb-city-autocomplete .city-autocomplete{margin-bottom:0}form[_ngcontent-%COMP%] mb-form-control-field{margin-bottom:8px}form[_ngcontent-%COMP%] mb-form-control-field .input-container label{color:#d0d5dd;font-weight:400;margin-bottom:6px!important}form[_ngcontent-%COMP%] mb-form-control-field[_ngcontent-%COMP%]:last-child{margin-bottom:0}@media screen and (max-width:992px){.button-section[_ngcontent-%COMP%], button[_ngcontent-%COMP%]{width:100%}}@media screen and (min-width:993px){.button-section[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:220px}}"],changeDetection:0})}};Ve=X([oe(),z("design:paramtypes",[])],Ve);export{Ve as MyDetailsComponent};
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.