1import{a as me}from"/build/_shared/chunk-SAWZUUUX.js";import{a as ue}from"/build/_shared/chunk-HFUZZOIL.js";import{a as ie}from"/build/_shared/chunk-2G3BUNAD.js";import{b as pe,d as fe}from"/build/_shared/chunk-STZHKSCT.js";import{a as de}from"/build/_shared/chunk-MIWVPMPS.js";import{a as le}from"/build/_shared/chunk-LXYKMAPX.js";import{e as h}from"/build/_shared/chunk-6XX3ATVP.js";import{g as v}from"/build/_shared/chunk-J24524FQ.js";import{D as q,E as ce,F as z,a as re,b as j,z as se}from"/build/_shared/chunk-TQS5E2SK.js";import{e as ne,q as ee,w as H}from"/build/_shared/chunk-RBFCHJWR.js";import{a as $}from"/build/_shared/chunk-JUM7J4TY.js";import{a as E}from"/build/_shared/chunk-RW7BUM27.js";import{e as k}from"/build/_shared/chunk-ADMCF34Z.js";var d=k($());var n=k(E()),Se=C=>{switch(C){case 2:case 3:case 16:return{header:"Set your contact preferences",groupOneText:"How would you like to hear from us?",groupTwoText:"What types of games would you like to hear about?",footerNote:"If you don\u2019t select any games, you\u2019ll only get general marketing updates. This means you could miss out on exclusive offers."};case 1:case 5:case 8:case 10:case 12:case 13:case 14:case 15:case 17:return{header:"Choose how we contact you",groupOneText:"How would you like to hear about our latest offers, deals, and bonuses?",groupTwoText:"Select which products you\u2019d like to hear about:",footerNote:"If no product is chosen, you\u2019ll only get general marketing updates \u2014 this may mean missing out on exclusive offers and bonuses."};default:return{header:null,groupOneText:"",groupTwoText:""}}},be=({config:C})=>{var _,w,F,s;let e=H(),[S,M]=(0,d.useState)({disabled:!1}),[l,T]=(0,d.useState)(!1),[f,I]=(0,d.useState)(!1),[N,x]=(0,d.useState)({}),[g,B]=(0,d.useState)({}),{accountDetailsUpdateMarketingPreferencesTop:U,accountDetailsUpdateMarketingPreferencesBottom:J,accountDetailsUpdateMarketingPreferencesAfterUpdateBottom:G,accountDetailsUpdateMarketingPreferencesButtonText:K,accountDetailsUpdateMarketingPreferencesButtonSize:W,accountDetailsUpdateMarketingPreferencesButtonType:V,accountDetailsUpdateMarketingPreferencesUpdatedMessage:Q,accountDetailsUpdateFormLoadingSVG:D,accountDetailsUpdateMessageIcon:X,productCategories:u,userMarketingPreferences:o,skinId:c}=C||{};if(f||I(!0),o&&Object.keys(g).length==0){let a={};(_=u==null?void 0:u.marketingcategories)==null||_.forEach(i=>{var b;let m=(b=o==null?void 0:o.preferences)==null?void 0:b.find(p=>p.categoryId==i.id);a={...a,[i.name]:!!m}});let t;((w=o==null?void 0:o.preferences)==null?void 0:w.length)>1?t=(F=o==null?void 0:o.preferences)==null?void 0:F.find(i=>i.category!=="Generic"):((s=o==null?void 0:o.preferences)==null?void 0:s.length)==1&&(t=o==null?void 0:o.preferences[0]),B({["Email"]:t==null?void 0:t.emailOptIn,["SMS"]:t==null?void 0:t.smsOptIn,["Phone call"]:t==null?void 0:t.phoneOptIn,["Post"]:t==null?void 0:t.postOptIn,...a})}(0,d.useEffect)(()=>{l&&T(!1)},[N]),(0,d.useEffect)(()=>{o&&l&&h({event:"menu_interaction",event_category:"my_account_menu",event_action:"marketing_preference_updated",event_label:"gar_completed"})},[o,l]);let Y=v().shape({contactPreferences2:v().optional(),contactPreferences:v().when("contactPreferences2",([a],t)=>a&&Object.values(a).some(i=>i)?v().test("atleast-one","Please select the method of communication you want us to use.",i=>{let m=Object.values(i).some(p=>p),b=!m;return M(p=>({...p,disabled:b})),m}):v().test("not-required","Not required",i=>(M(m=>({...m,disabled:!1})),!0)))}),Z=a=>{e.submit({contactPreferences:JSON.stringify(a.contactPreferences),contactPreferences2:JSON.stringify(a.contactPreferences2),productCategories:JSON.stringify(u)},{action:"/actions/marketingpreferences/update",method:"POST"})},te=a=>Object.keys(a).map(t=>a[t]==g[t]).every(t=>t==!0);(0,d.useEffect)(()=>{var a,t,i,m,b,p;e.state==="idle"&&(e==null?void 0:e.data)!==void 0&&(((t=(a=e.data)==null?void 0:a.errors)==null?void 0:t.length)>0?h({event:"errors_count",Form_Location:"Update Marketing Preference",ErrorMessage:((m=(i=e.data)==null?void 0:i.errors[0])==null?void 0:m.detail)||((p=(b=e.data)==null?void 0:b.errors[0])==null?void 0:p.title)}):(T(!0),B({...N})),M(R=>({...R,disabled:!0})))},[e.state,e==null?void 0:e.data]);let A=e.state==="submitting",L=(0,d.useMemo)(()=>fe(u==null?void 0:u.marketingcategories,pe(c),o),[u,o]),O=Se(c);return(0,n.jsx)("div",{className:"p-4 h-full overflow-y-auto",children:(0,n.jsxs)(z,{submitting:A,schema:Y,onSubmit:a=>{Z(a)},children:[l&&(0,n.jsx)("div",{className:"pb-4",children:(0,n.jsx)(q,{icon:X.url,messageText:Q})}),(0,n.jsx)("p",{className:"mb-4 text-sm",children:O.header}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(de,{groupOneItems:[{label:"Email",icon:"/images/marketing/email.svg",checked:g["Email"]},{label:"SMS",icon:"/images/marketing/sms.svg",checked:g["SMS"]},{label:"Post",icon:"/images/marketing/post.svg",checked:g["Post"]},{label:"Phone call",icon:"/images/marketing/phone.svg",checked:g["Phone call"]}],groupOneText:O.groupOneText,groupOneOnChange:a=>{x(t=>({...t,...a}))},groupTwoItems:L,groupTwoOnChange:a=>{x(t=>({...t,...a}))},groupTwoText:O.groupTwoText}),(0,n.jsxs)("div",{className:"text-sm flex items-center gap-x-4 py-4 border-modalHeaderTitleColor",children:[(0,n.jsx)(re,{svgSource:"/images/info-icon.svg"}),(0,n.jsx)("div",{children:O.footerNote})]})]}),(0,n.jsxs)(n.Fragment,{children:[!l&&(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(j,{submittable:!0,className:"mt-4",label:K,size:W,type:V,svgSource:D==null?void 0:D.url,loading:A,disabled:S.disabled},"submit")}),l&&(0,n.jsx)("p",{className:"mt-2 text-sm",children:G})]})]})})};var y=k($());var r=k(E());var ye=({config:C})=>{var O,_,w,F;let e=H(),[S,M]=(0,y.useState)(null),[l,T]=(0,y.useState)(!1),[f,I]=(0,y.useState)(!1),[N,x]=(0,y.useState)(!1),[g,B]=(0,y.useState)({}),[U,J]=(0,y.useState)({}),{accountDetailsUpdateMarketingPreferencesTop:G,accountDetailsUpdateMarketingPreferencesBottom:K,accountDetailsUpdateMarketingPreferencesAfterUpdateBottom:W,accountDetailsUpdateMarketingPreferencesButtonText:V,accountDetailsUpdateMarketingPreferencesButtonSize:Q,accountDetailsUpdateMarketingPreferencesButtonType:D,accountDetailsUpdateMarketingPreferencesUpdatedMessage:X,accountDetailsUpdateFormLoadingSVG:u,accountDetailsUpdateMessageIcon:o,userMarketingPreferences:c}=C||{};N||x(!0),c&&Object.keys(U).length==0&&J({["Email"]:(O=c==null?void 0:c.preferences[0])==null?void 0:O.emailOptIn,["SMS"]:(_=c==null?void 0:c.preferences[0])==null?void 0:_.smsOptIn,["Call"]:(w=c==null?void 0:c.preferences[0])==null?void 0:w.phoneOptIn,["Post"]:(F=c==null?void 0:c.preferences[0])==null?void 0:F.postOptIn});let Y=s=>{f&&I(!1),T(A(s))};(0,y.useEffect)(()=>{c&&f&&h({event:"menu_interaction",event_category:"my_account_menu",event_action:"marketing_preference_updated",event_label:"gar_completed"})},[c,f]);let Z=v().shape({}),te=s=>{let a=s.contactPreferences;e.submit({contactPreferences:JSON.stringify({emailOptIn:a["Email"].toString(),smsOptIn:a["SMS"].toString(),postOptIn:a["Post"].toString(),phoneOptIn:a["Call"].toString()})},{action:"/actions/marketingpreferences/update",method:"POST"})},A=s=>s["Email"]==U["Email"]&&s["SMS"]==U["SMS"]&&s["Call"]==U["Call"]&&s["Post"]==U["Post"];(0,y.useEffect)(()=>{var s,a,t,i,m,b,p,R,ae,oe;e.state==="idle"&&(e==null?void 0:e.data)!==void 0&&(((a=(s=e.data)==null?void 0:s.errors)==null?void 0:a.length)>0?(h({event:"errors_count",Form_Location:"Update Marketing Preference",ErrorMessage:((i=(t=e.data)==null?void 0:t.errors[0])==null?void 0:i.detail)||((b=(m=e.data)==null?void 0:m.errors[0])==null?void 0:b.title)}),M(((R=(p=e.data)==null?void 0:p.errors[0])==null?void 0:R.detail)||((oe=(ae=e.data)==null?void 0:ae.errors[0])==null?void 0:oe.title))):(I(!0),J({...g})),T(!0))},[e.state,e==null?void 0:e.data]);let L=e.state==="submitting";return(0,r.jsx)("div",{className:"p-4 h-full overflow-y-auto",children:(0,r.jsx)(z,{submitting:L,schema:Z,onSubmit:s=>{te(s)},children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{children:f&&(0,r.jsx)("div",{className:"pb-4",children:(0,r.jsx)(q,{icon:o.url,messageText:X})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-4 text-sm",children:G}),(0,r.jsx)(ce,{name:"contactPreferences",noBorders:!0,type:"checkboxgroup",hasSelectAll:!0,hasSelectNone:!1,selectNoneText:"Unsubscribe",canDeselect:!1,defaultValue:U,items:[{label:"Email".valueOf()},{label:"SMS".valueOf()},{label:"Call".valueOf()},{label:"Post".valueOf()}],isRounded:!0,onValueChange:s=>{Y(s),B(s)}}),(0,r.jsx)("p",{className:"mt-4 text-sm",children:K})]})]}),(0,r.jsxs)(r.Fragment,{children:[!f&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(j,{submittable:!0,className:"mt-4",label:V,size:Q,type:D,svgSource:u==null?void 0:u.url,loading:L,disabled:l},"submit")}),f&&(0,r.jsx)("p",{className:"mt-2 text-sm",children:W})]})]})})};var Pe=k($()),P=k(E());function he({isPokerApp:C,onCloseClick:e,config:S,profile:M,onBackClick:l}){let T=ne(),{liveHelpUrl:f,liveHelpEnabled:I,isGarMpEnabledSingle:N,isGarMpEnabledDual:x}=S,g=(0,Pe.useMemo)(()=>N?(0,P.jsx)(ye,{config:S}):x?(0,P.jsx)(be,{config:S}):(0,P.jsx)(me,{config:S}),[S]);return(0,P.jsxs)("div",{className:"flex flex-col h-full",children:[(0,P.jsx)(se,{username:le(M),backIconSrc:"/images/back-icon.svg",accountIconSrc:"/images/account-icon.svg",closeIconSrc:"/images/close-icon.svg",menuTitle:"PREFERENCES",menuUserClasses:"text-marketingPrefAccountMenuHeaderTextTopColor",menuTitleClasses:"text-marketingPrefAccountMenuHeaderTextBottomColor",onBackIconCl
1ick:()=>{h({event:"back_click"}),l||T(ie.menu_accountdetails),l&&l()},onCloseIconClick:C?null:()=>{e()}}),(0,P.jsx)(ue,{leftContent:I&&(0,P.jsx)(ee,{className:"underline px-1 text-marketingPrefLiveHelpLinkColor",to:f,rel:"noopener noreferrer",target:"_blank",children:"Live Help"}),rightContent:(0,P.jsx)(ee,{className:"btn btn-ghost underline text-accountDetailsLogoutLinkColor font-normal",to:"/forms/logout",children:"Logout"})}),g]})}export{he as a};
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.