PageSourceSearch

https://perkss.co/37.447ce3482d177d9c.js

js perkss.co collected 2026-10-02 00:27:14 UTC 12,508 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkperksweb=self.webpackChunkperksweb||[]).push([[37],{7037:(L,b,o)=>{o.r(b),o.d(b,{UpdateAccountModule:()=>B});var t=o(5e3),c=o(9808),v=o(2444),_=o(383),a=o(2382),s=o(1639),U=o(1426),C=o(1630),m=o(72),y=o(9573),Z=o(9140);function A(n,i){1&n&&(t.TgZ(0,"p",21),t._uU(1," First name is required "),t.qZA())}function F(n,i){1&n&&(t.TgZ(0,"p",21),t._uU(1," Last name is required "),t.qZA())}function N(n,i){1&n&&(t.TgZ(0,"p",21),t._uU(1," Phone number is required "),t.qZA())}function T(n,i){1&n&&(t.TgZ(0,"p",21),t._uU(1," Phone number is invalid "),t.qZA())}function q(n,i){if(1&n&&(t.TgZ(0,"div")(1,"p",27),t._uU(2),t.qZA(),t.TgZ(3,"p",28),t._uU(4," Your birthday is already saved and cannot be changed here. Please contact us if it is wrong. "),t.qZA()()),2&n){const r=t.oxw(2);t.xp6(2),t.Oqu(r.storedBirthdayLabel)}}function w(n,i){if(1&n&&(t.TgZ(0,"option",33),t._uU(1),t.qZA()),2&n){const r=i.$implicit;t.Q6J("ngValue",r.value),t.xp6(1),t.hij(" ",r.label," ")}}function x(n,i){if(1&n&&(t.TgZ(0,"option",33),t._uU(1),t.qZA()),2&n){const r=i.$implicit;t.Q6J("ngValue",r),t.xp6(1),t.hij(" ",r," ")}}function M(n,i){1&n&&(t.TgZ(0,"p",21),t._uU(1," Please choose both a month and a year, or leave them both blank. "),t.qZA())}function O(n,i){1&n&&(t.TgZ(0,"p",28),t._uU(1," Optional. You can only set this once, so please check it before you save. "),t.qZA())}function Y(n,i){if(1&n&&(t.TgZ(0,"div",6)(1,"div",29)(2,"div",30)(3,"label",31),t._uU(4," Birthday month "),t.qZA(),t.TgZ(5,"select",32)(6,"option",33),t._uU(7,"Month"),t.qZA(),t.YNc(8,w,2,2,"option",34),t.qZA()()(),t.TgZ(9,"div",29)(10,"div",30)(11,"label",35),t._uU(12," Year of birth "),t.qZA(),t.TgZ(13,"select",36)(14,"option",33),t._uU(15,"Year"),t.qZA(),t.YNc(16,x,2,2,"option",34),t.qZA()()()(),t.YNc(17,M,2,0,"p",11),t.YNc(18,O,2,0,"p",37)),2&n){const r=t.oxw(2);t.xp6(6),t.Q6J("ngValue",null),t.xp6(2),t.Q6J("ngForOf",r.birthMonthOptions),t.xp6(6),t.Q6J("ngValue",null),t.xp6(2),t.Q6J("ngForOf",r.birthYearOptions),t.xp6(1),t.Q6J("ngIf",r.birthdayIncomplete),t.xp6(1),t.Q6J("ngIf",!r.birthdayIncomplete)}}function I(n,i){if(1&n&&(t.TgZ(0,"div",22)(1,"h2",23),t._uU(2),t.qZA(),t.TgZ(3,"p",24),t._uU(4),t.qZA(),t.YNc(5,q,5,1,"div",25),t.YNc(6,Y,19,6,"ng-template",null,26,t.W1O),t.qZA()),2&n){const r=t.MAs(7),e=t.oxw();
1t.xp6(2),t.Oqu(e.birthdayClubHeading),t.xp6(2),t.Oqu(e.birthdayClubText),t.xp6(1),t.Q6J("ngIf",e.birthdayLocked)("ngIfElse",r)}}function P(n,i){if(1&n&&(t.TgZ(0,"p",38),t._uU(1),t.qZA()),2&n){const r=t.oxw();t.xp6(1),t.hij(" ",r.message," ")}}function J(n,i){if(1&n){const r=t.EpF();t.TgZ(0,"div",39)(1,"div")(2,"b",40),t._uU(3,"Delete account"),t.qZA(),t.TgZ(4,"p",41),t._uU(5," This removes your account and order history. It cannot be undone. "),t.qZA()(),t.TgZ(6,"button",42),t.NdJ("click",function(){return t.CHM(r),t.oxw().deleteAccount()}),t._uU(7," Delete account "),t.qZA()()}}let k=(()=>{class n{constructor(r,e,u,d,E,f,Q){this._requestService=r,this._local=e,this.formBuilder=u,this.spinner=d,this.router=E,this.apiService=f,this.posthog=Q,this.submitted=!1,this.birthdayClubEnabled=!1,this.birthdayClubHeading=s.dV,this.birthdayClubText=s.dX,this.birthMonthOptions=s.Cs,this.birthYearOptions=(0,s.Iq)(),this.storedBirthdayLabel="",this.storedBirthday=null,this.birthdayRequested=!1,this.brandFlavor=window.location.pathname.split("/")[1],this.sub=f.getWebcustomer$.subscribe(p=>{var h,g;if(!p)return;this.allowDeleteAccount=null===(h=p.TemplateData.DeleteAccount)||void 0===h?void 0:h.Enabled;const l=null===(g=p.TemplateData.Login)||void 0===g?void 0:g.BirthdayClub;this.birthdayClubEnabled=!0===(null==l?void 0:l.Enabled),this.birthdayClubHeading=(null==l?void 0:l.Heading)||s.dV,this.birthdayClubText=(null==l?void 0:l.Text)||s.dX,this.birthdayClubEnabled&&!this.birthdayRequested&&(this.birthdayRequested=!0,this.loadStoredBirthday())})}get updateUserForm(){return this.updateForm.controls}ngOnDestroy(){this.sub.unsubscribe()}ngOnInit(){this.initializeForm()}initializeForm(){this.updateForm=this.formBuilder.group({firstName:[this._local.get("CustomerFirstName")||null,a.kI.required],lastName:[this._local.get("CustomerLastName")||null,a.kI.required],contactNo:[this._local.get("CustomerMobile")||null,[a.kI.required,a.kI.pattern]],birthMonth:[null],birthYear:[null]})}get birthdayLocked(){return!!this.storedBirthday}get birthdayIncomplete(){return!(!this.birthdayClubEnabled||this.birthdayLocked||!this.updateForm)&&!!this.updateUserForm.birthMonth.value!=!!this.updateUserForm.birthYear.value}loadStoredBirthday(){const r=this._local.get("username");!r||this._requestService.postRequest(`api/Customer/getCustomer/${r}/0`,{BrandFlavor:this.brandFlavor}).subscribe({next:e=>{var u,d;200===(null===(u=null==e?void 0:e.Info)||void 0===u?void 0:u.Status)&&(this.storedBirthday=(null===(d=e.Data)||void 0===d?void 0:d.CustomerDOB)||null,this.storedBirthdayLabel=(0,s.dH)(this.storedBirthday))}})}matchPass(){if(this.updateForm.controls.password.value!=this.updateForm.controls.confirmpassword.value)return this.updateForm.controls.confirmpassword.setErrors({mustMatch:!0});this.updateForm.controls.confirmpassword.hasError("mustMatch")&&this.updateForm.controls.confirmpassword.setErrors(null)}updateUser(){if(this.submitted=!0,this.showMessage=!1,this.updateForm.invalid||this.birthdayIncomplete)return;this.spinner.show();let r=this._local.get("username"),e=this.updateForm.controls;if(this.updateForm.invalid)return void this.spinner.hide();let u={CustomerFirstName:e.firstName.value,CustomerLastName:e.lastName.value,CustomerMobile:e.contactNo.value,CustomerImageUrl:null,CustomerEmail:r,BrandFlavor:this.brandFlavor,CustomerDOB:this.birthdayClubEnabled&&!this.birthdayLocked?(0,s.Ex)(e.birthMonth.value,e.birthYear.value):null};
1this._requestService.putRequest("api/Customer/update",u).subscribe({next:d=>{if(this.spinner.hide(),200===d.Info.Status)return this._local.set("CustomerFirstName",e.firstName.value),this._local.set("CustomerLastName",e.lastName.value),void window.location.reload();this.message="Update unsuccessfull",this.showMessage=!0},error:()=>{this.spinner.hide(),this.message="Network Error! something went wrong please try again",this.showMessage=!0}})}deleteAccount(){this.posthog.captureEvent("user_delete_account_initiated",{});const r=this._requestService.setUrl("delete-account"),e=`${window.location.protocol}//${window.location.host}`;window.open(`${e}/${r}`,"_newtab")}}return n.\u0275fac=function(r){return new(r||n)(t.Y36(U.s),t.Y36(C.U),t.Y36(a.qu),t.Y36(m.t2),t.Y36(_.F0),t.Y36(y.s),t.Y36(Z.R))},n.\u0275cmp=t.Xpm({type:n,selectors:[["app-update-account"]],decls:33,vars:8,consts:[[1,"ua-page"],[1,"ua-page__inner"],[1,"ua-title"],[1,"ua-sub"],[1,"ui-card","ua-card"],[3,"formGroup","ngSubmit"],[1,"row","g-3"],[1,"col-md-6"],[1,"ui-field"],["for","first_name",1,"ui-field__label"],["type","text","name","first_name","id","first_name","required","","formControlName","firstName",1,"ui-input"],["class","ui-hint ui-hint--danger",4,"ngIf"],["for","last_name",1,"ui-field__label"],["type","text","name","last_name","id","last_name","required","","formControlName","lastName",1,"ui-input"],["for","phone",1,"ui-field__label"],["type","phone","name","phone","id","phone","pattern","((^(\\+44)([1-9]\\d)(\\d{8,8})$)|(^(0)([1-9]\\d)(\\d{8,8})$))","required","","formControlName","contactNo",1,"ui-input"],["class","ua-birthday",4,"ngIf"],["type","submit",1,"ui-btn","ui-btn--block","ua-submit"],["class","ui-alert ui-alert--danger",4,"ngIf"],["class","ua-danger",4,"ngIf"],["bdColor","rgba(51, 51, 51, 0.8)","size","large","color","#dc3545","type","ball-scale-multiple"],[1,"ui-hint","ui-hint--danger"],[1,"ua-birthday"],[1,"ua-birthday__title"],[1,"ua-birthday__text"],[4,"ngIf","ngIfElse"],["birthdayFields",""],[1,"ua-birthday__value"],[1,"ui-hint","ui-hint--muted"],[1,"col-6"],[1,"ui-field","ua-birthday__field"],["for","birthMonth",1,"ui-field__label"],["id","birthMonth","name","birthMonth","formControlName","birthMonth",1,"ui-input"],[3,"ngValue"],[3,"ngValue",4,"ngFor","ngForOf"],["for","birthYear",1,"ui-field__label"],["id","birthYear","name","birthYear","formControlName","birthYear",1,"ui-input"],["class","ui-hint ui-hint--muted",4,"ngIf"],[1,"ui-alert","ui-alert--danger"],[1,"ua-danger"],[1,"ua-danger__title"],[1,"ua-danger__text"],["type","button",1,"ui-btn","ui-btn--ghost","ua-danger__btn",3,"click"]],template:function(r,e){1&r&&(t.TgZ(0,"main",0)(1,"div",1)(2,"h1",2),t._uU(3,"Update account"),t.qZA(),t.TgZ(4,"p",3),t._uU(5,"Change your details and we'll use them on your next order."),t.qZA(),t.TgZ(6,"div",4)(7,"form",5),t.NdJ("ngSubmit",function(){return e.updateUser()}),t.TgZ(8,"div",6)(9,"div",7)(10,"div",8)(11,"label",9),t._uU(12,"First name"),t.qZA(),t._UZ(13,"input",10),t.YNc(14,A,2,0,"p",11),t.qZA()(),t.TgZ(15,"div",7)(16,"div",8)(17,"label",12),t._uU(18,"Last name"),t.qZA(),t._UZ(19,"input",13),t.YNc(20,F,2,0,"p",11),t.qZA()()(),t.TgZ(21,"div",8)(22,"label",14),t._uU(23,"Contact number"),t.qZA(),t._UZ(24,"input",15),t.YNc(25,N,2,0,"p",11),t.YNc(26,T,2,0,"p",11),t.qZA(),t.YNc(27,I,8,4,"div",16),t.TgZ(28,"button",17),t._uU(29," Update account "),t.qZA(),t.YNc(30,P,2,1,"p",18),t.qZA()(),t.YNc(31,J,8,0,"div",19),t.qZA()(),t._UZ(32,"ngx-spinner",20)),2&r&&(t.xp6(7),t.Q6J("formGroup",e.updateForm),t.xp6(7),t.Q6J("ngIf",e.submitted&&(null==e.updateUserForm||null==e.updateUserForm.firstName||null==e.updateUserForm.firstName.errors?null:e.updateUserForm.firstName.errors.required)),t.xp6(6),t.Q6J("ngIf",e.submitted&&(null==e.updateUserForm||null==e.updateUserForm.lastName||null==e.updateUserForm.lastName.errors?null:e.updateUserForm.lastName.errors.required)),t.xp6(5),t.Q6J("ngIf",e.submitted&&(null==e.updateUserForm||null==e.updateUserForm.contactNo||null==e.updateUserForm.contactNo.errors?null:e.updateUserForm.contactNo.errors.required)),t.xp6(1),t.Q6J("ngIf",e.submitted&&(null==e.updateUserForm||null==e.updateUserForm.contactNo||null==e.updateUserForm.contactNo.errors?null:e.updateUserForm.contactNo.errors.pattern)),t.xp6(1),t.Q6J("ngIf",e.birthdayClubEnabled),t.xp6(3),t.Q6J("ngIf",e.showMessage),t.xp6(1),t.Q6J("ngIf",e.allowDeleteAccount))},directives:[a._Y,a.JL,a.sg,a.Fj,a.Q7,a.JJ,a.u,c.O5,a.c5,a.EJ,a.YN,a.Kr,c.sg,m.Ro],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;background:var(--ui-ground);min-height:100vh}.ua-page[_ngcontent-%COMP%]{display:block;padding:2rem 1rem 3rem}.ua-page__inner[_ngcontent-%COMP%]{width:min(100%,640px);margin:0 auto}.ua-title[_ngcontent-%COMP%]{margin:0;font-size:clamp(1.6rem,3vw,2.1rem);font-weight:var(--ui-w-title);color:var(--ui-ink)}.ua-sub[_ngcontent-%COMP%]{margin:.4rem 0 1.5rem;color:var(--ui-ink-muted);font-size:.95rem}.ua-card[_ngcontent-%COMP%]{padding:1.75rem 1.5rem;box-shadow:var(--ui-shadow)}.ua-submit[_ngcontent-%COMP%]{margin-top:1.5rem}.ua-birthday[_ngcontent-%COMP%]{margin-top:1.5rem;padding:1.1rem 1rem 1rem;border:1px solid var(--ui-line);border-radius:var(--ui-r-choice);background:var(--ui-accent-tint)}.ua-birthday__title[_ngcontent-%COMP%]{margin:0 0 .4rem;font-size:1.05rem;font-weight:var(--ui-w-title);color:var(--ui-ink)}.ua-birthday__text[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:.9rem;line-height:1.5;color:var(--ui-ink-2)}.ua-birthday__value[_ngcontent-%COMP%]{margin:0;font-size:1.1rem;font-weight:var(--ui-w-title);color:var(--ui-ink)}.ua-birthday__field[_ngcontent-%COMP%]{margin-bottom:0}.ua-danger[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:1rem;margin-top:1.5rem;padding:1.1rem 1.25rem;border:1px solid var(--ui-danger-tint);border-radius:var(--ui-r-card);background:var(--ui-card)}.ua-danger__title[_ngcontent-%COMP%]{display:block;font-size:1rem;font-weight:var(--ui-w-title);color:var(--ui-ink)}.ua-danger__text[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.88rem;color:var(--ui-ink-muted);max-width:42ch}.ua-danger__btn[_ngcontent-%COMP%]{flex:0 0 auto;border-color:var(--ui-danger);color:var(--ui-danger)}.ua-danger__btn[_ngcontent-%COMP%]:hover{background:var(--ui-danger-tint);border-color:var(--ui-danger)}@media (max-width: 575.98px){.ua-page[_ngcontent-%COMP%]{padding:1.25rem .75rem 2.5rem}.ua-card[_ngcontent-%COMP%]{padding:1.25rem 1rem}.ua-danger__btn[_ngcontent-%COMP%]{width:100%}}']}),n})(),B=(()=>{class n{}return n.\u0275fac=function(r){return new(r||n)},n.\u0275mod=t.oAB({type:n}),n.\u0275inj=t.cJS({providers:[{provide:t.qLn,useClass:v.r}],imports:[[c.ez,m.ef,a.UX,_.Bz.forChild([{path:"",component:k}])]]}),n})()}}]);

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.