1import{a as ue}from"/build/_shared/chunk-CRGNNFKS.js";import{a as P}from"/build/_shared/chunk-HFUZZOIL.js";import{a as se}from"/build/_shared/chunk-2G3BUNAD.js";import{b as ce,c as de,e as a}from"/build/_shared/chunk-MA6AGVSE.js";import"/build/_shared/chunk-S2I5YMHW.js";import"/build/_shared/chunk-Q6UE3OVN.js";import{a as ae}from"/build/_shared/chunk-LXYKMAPX.js";import"/build/_shared/chunk-ELXM45ZL.js";import{e as b}from"/build/_shared/chunk-6XX3ATVP.js";import"/build/_shared/chunk-H5UJJ74Q.js";import{e as ie,g as le}from"/build/_shared/chunk-J24524FQ.js";import{B as re,E as i,F as ne,b as ee,j as te,z as oe}from"/build/_shared/chunk-TQS5E2SK.js";import{e as Y,q as v,u as Z,w as $}from"/build/_shared/chunk-RBFCHJWR.js";import"/build/_shared/chunk-GZJBGZQO.js";import{a as at}from"/build/_shared/chunk-JUM7J4TY.js";import{a as A}from"/build/_shared/chunk-RW7BUM27.js";import{e as h}from"/build/_shared/chunk-ADMCF34Z.js";var c=h(at());var e=h(A()),pe=({config:k})=>{var S,B,U,V;let o=$(),[g,x]=(0,c.useState)(null),[d,L]=(0,c.useState)(null),[u,p]=(0,c.useState)(!0),[r,C]=(0,c.useState)(),[N,me]=(0,c.useState)(!1),{accountDetailsEditEmailErrors:fe,accountDetailsEditEmailInfo:ye,accountDetailsEditEmailPlaceholder:ge,accountDetailsEditPasswordErrors:he,accountDetailsEditPasswordInfo:Ce,accountDetailsEditPasswordPlaceholder:T,accountDetailsEditPhoneNumberErrors:Ee,accountDetailsEditPhoneNumberInfo:Ae,accountDetailsEditPhoneNumberDropdownItems:m,accountDetailsEditPhoneNumberPlaceholder:be,accountDetailsEditUpdateButtonSize:Pe,accountDetailsEditUpdateButtonText:ke,accountDetailsEditUpdateButtonType:xe,registerFieldShow:Le,registerFieldHide:De,accountDetailsEditAddressLine1Placeholder:Ie,accountDetailsEditAddressLine2Placeholder:ve,accountDetailsEditTownCityPlaceholder:Ne,accountDetailsEditCountyPlaceholder:Te,accountDetailsEditPostcodePlaceholder:we,accountDetailsUpdateFormLoadingSVG:E,accountDetailsFieldErrorIcon:Fe,accountDetailsFieldAlertIcon:Se,accountDetailsFieldSuccessIcon:Be,accountDetailsFieldShow:ct,accountDetailsFieldHide:dt,registerAddressCityErrors:Ue,registerAddressCityInfo:Ve,registerAddressCityLabel:He,registerAddressCountyErrors:Me,registerAddressCountyInfo:Re,registerAddressCountyLabel:Oe,registerAddressDropDownLimit:w,registerAddressErrors:_e,registerAddressIcon:We,registerAddressInfo:ze,registerAddressLine1Errors:qe,registerAddressLine1Info:Ge,registerAddressLine1Label:Ke,registerAddressLine2Errors:je,registerAddressLine2Info:Je,registerAddressLine2Label:Qe,registerAddressPlaceholder:Xe,registerAddressPostalCodeErrors:Ye,registerAddressPostalCodeInfo:Ze,registerAddressPostalCodeLabel:$e,registerCountryCodeErrors:et,useLoqateAddressVerificationAPI:D}=k||{};(0,c.useEffect)(()=>{o.load("/actions/getPlayerDetails")},[]);let F={line1:a(qe,"text"),line2:a(je,"text"),city:a(Ue,"text"),county:a(Me,"text"),postalcode:a(Ye,"text")};D&&(F.address=u?ie().notRequired():a(_e,"address",{addresslimit:w}));let s=(B=(S=d==null?void 0:d.message)==null?void 0:S.player)==null?void 0:B.profile,tt=t=>{let n=ue(t.phoneNumber);o.submit({Telephone:n,Email:t.email,Line1:t.line1,Line2:t.line2,Town:t.city,County:t.county,PostCode:t.postalcode,optInEmail:s.marketing.marketingOptInEmail,optInSms:s.marketing.marketingOptInSms,optInPush:s.marketing.marketingOptInPush,optInTelephone:s.marketing.marketingOptInTelephone,optInPost:s.marketing.marketingOptInPost,From:"Account Details",Password:t.password},{action:"/forms/updateProfile",method:"patch"})},ot=le().shape({email:a(fe,"email"),phoneNumber:a(Ee,"phone",{phoneType:"phone"}),password:a(he,"password"),countryCode:a(et,"text"),...F}),rt=t=>{if(!t)return[m[0],""];let n=t.startsWith("+")?t:"+"+t;for(let f of m)if(n.startsWith(f))return[f,n.substring(f.length).trim()];return[m[0],n]},[nt,st]=rt((U=s==null?void 0:s.personal)==null?void 0:U.telephone);return(0,c.useEffect)(()=>{var t,n,f,H,M,R,O,_,W,z,q,G,K,j,J,Q,X;if(o.state==="idle"&&(o==null?void 0:o.data)!==void 0){if(((n=(t=o.data)==null?void 0:t.errors)==null?void 0:n.length)>0)b({event:"errors_count",Form_Location:"Update Profile",ErrorMessage:((H=(f=o.data)==null?void 0:f.errors[0])==null?void 0:H.detail)||((R=(M=o.data)==null?void 0:M.errors[0])==null?void 0:R.title)}),x(((_=(O=o.data)==null?void 0:O.errors[0])==null?void 0:_.detail)||((z=(W=o.data)==null?void 0:W.errors[0])==null?void 0:z.title));else if((K=(G=(q=o.data)==null?void 0:q.message)==null?void 0:G.player)!=null&&K.profile){let I=(X=(Q=(J=(j=o.data)==null?void 0:j.message)==null?void 0:J.player)==null?void 0:Q.profile)==null?void 0:X.personal;L(o.data);let y=I==null?void 0:I.address;p(!1),C({line1:y.line1,line2:y.line2,city:y.town,county:y.county,postcode:y.postCode}),p(!0),y.countryCode!=="GBR"&&me(!0)}}},[o.state,o==null?void 0:o.data]),(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"p-4",children:d&&(0,e.jsx)(ne,{submitting:o.state==="submitting",schema:ot,onSubmit:t=>{tt(t)},icons:{success:Be.url,error:Fe.url,warning:Se.url,spinner:E.url,show:Le.url,hide:De.url},children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{name:"email",type:"text",placeholder:ge,info:ye,defaultValue:s.personal.email},"email"),(0,e.jsx)(i,{name:"phoneNumber",type:"phone",dropdown:{name:"countryCode",type:"select",defaultValue:nt,options:m==null?void 0:m.map(t=>({value:t,label:t}))},textbox:{name:"number",type:"text",defaultValue:st,placeholder:be},info:Ae,defaultValue:(V=s==null?void 0:s.personal)==null?void 0:V.telep
1hone},"phoneNumber"),D&&!N&&(0,e.jsx)(P,{rightContent:(0,e.jsx)("div",{className:"btn btn-ghost underline text-primaryDark hover:cursor-pointer",onClick:()=>p(!1),children:"Clear"})},"accountLinks"),(0,e.jsxs)(e.Fragment,{children:[u&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{name:"line1",type:"text",placeholder:Ie,defaultValue:r==null?void 0:r.line1,info:Ge,label:Ke}),(0,e.jsx)(i,{name:"line2",type:"text",placeholder:ve,defaultValue:r==null?void 0:r.line2,info:Je,label:Qe}),(0,e.jsx)(i,{name:"city",type:"text",placeholder:Ne,defaultValue:r==null?void 0:r.city,info:Ve,label:He}),(0,e.jsx)(i,{name:"county",type:"text",placeholder:Te,defaultValue:r==null?void 0:r.county,info:Re,label:Oe}),(0,e.jsx)(i,{name:"postalcode",type:"text",placeholder:we,defaultValue:r==null?void 0:r.postcode,info:Ze,maxLength:10,label:$e})]}),D&&!N&&(0,e.jsx)("div",{className:u?"hidden":"",children:(0,e.jsx)(i,{svgSource:We.url,placeholder:Xe,info:ze,infoAlwaysVisible:!0,name:"address",type:"address",search:t=>ce(t,w),onValueChange:t=>{de(t).then(n=>{C({line1:n.Line1,line2:n.Line2,city:n.City,postcode:n.PostalCode,county:n.AdminAreaName}),p(!0)})}},"address")})]}),(0,e.jsx)(te,{className:"text-primaryDark text-[16px] font-textFontWeight",text:"Enter your password to update"}),(0,e.jsx)(i,{name:"password",type:"password",placeholder:T,info:Ce,label:T},"password"),(0,e.jsx)(e.Fragment,{children:g&&(0,e.jsx)("div",{className:"text-red-500 text-xs pb-4",children:(0,e.jsx)("span",{children:g})})}),(0,e.jsx)(ee,{submittable:!0,label:ke,size:Pe,type:xe,svgSource:E==null?void 0:E.url,loading:o.state==="submitting"},"submit")]})})})})};var l=h(A());function lt({onCloseClick:k,profile:o,config:g}){let{liveHelpUrl:x,liveHelpEnabled:d}=g,{playerProfileData:L}=Z(),u=L.message.player.profile,p={Name:[u.personal.firstName,u.personal.lastName].filter(Boolean).join(" ")},r=Y(),C=()=>{b({event:"back_click"}),r(se.menu_accountdetails)};return(0,l.jsxs)("div",{className:"flex flex-col h-full",children:[(0,l.jsx)(oe,{username:ae(o),backIconSrc:"/images/back-icon.svg",accountIconSrc:"/images/account-icon.svg",closeIconSrc:"/images/close-icon.svg",menuTitle:"EDIT DETAILS",menuUserClasses:"text-accountDetailsAccountMenuHeaderTextTopColor",menuTitleClasses:"text-accountDetailsAccountMenuHeaderTextBottomColor",onBackIconClick:()=>{C()},onCloseIconClick:()=>{k()}}),(0,l.jsx)(P,{leftContent:d&&(0,l.jsx)(v,{className:"underline px-1 text-accountDetailsLiveHelpLinkColor",to:x,rel:"noopener noreferrer",target:"_blank",children:"Live Help"}),rightContent:(0,l.jsx)(v,{className:"btn btn-ghost underline text-accountDetailsLogoutLinkColor font-normal",to:"/forms/logout",children:"Logout"})}),(0,l.jsxs)("div",{className:"overflow-scroll",children:[(0,l.jsx)(re,{playerProfile:p}),(0,l.jsx)(pe,{config:g})]})]})}export{lt as default};
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.