PageSourceSearch

https://sorareinside.com/assets/UserAccountView-DcKqssgI.js

js sorareinside.com collected 2026-09-24 14:18:55 UTC 32,872 bytes, 12 lines download raw bytes

1import{n as Re,e as y,U as Q,y as W,u as fe,f as F,j as e,S as l,G as C,T as N,a as m,H as Ne,c as K,k as j,m as f,z,al as U,aa as re,ac as ye,F as D,b1 as Be,g as B,aG as Te,K as ve,B as Le,I as ie,b as De,q as Se,a5 as Ke,an as Qe,aq as we,p as Oe,v as oe,aN as _e,J as ce,aB as Y,A as He,a3 as We,aS as Ue,aT as Ge,aU as $e,a4 as Ye,d as ne,i as le,aW as je,D as qe,l as Ve,cu as Xe,cv as Je,w as Ze,h as es,cw as ss,cx as rs,as as ze,a2 as ts}from"./index-6kkfZ8eQ.js";import{A as as}from"./AiCreditsPurchaseButton-CgE51bO_.js";import{L as de}from"./LoadingOverlay-C45edYBu.js";import{S as ns}from"./Select-DmzXqFWa.js";import{P as Me}from"./PushNotificationDeviceCard-B19kdIbE.js";import{F as is}from"./Flex-BbpkoMgR.js";import{I as os,a as cs}from"./IconHeartFilled-BRB3_gLr.js";import{R as ge}from"./Radio-DDsmF1AW.js";import{P as ls}from"./PaymentStatusBadge-CFdpL8sZ.js";import{C as ds}from"./utils-CjUEt4vh.js";import{C as Ae}from"./CopyButton-CnC7JkLn.js";import{I as Ie}from"./IconCopy-iFBR_y9L.js";import{N as xe}from"./NumberInput-92q8JWU2.js";import{I as us}from"./IconTestPipe2Filled-BWvKkGZ9.js";import{P as O}from"./Progress-D9Ktuc_6.js";import{T}from"./Tabs-i94DF75v.js";import"./IconDeviceMobile-C4yMxRWL.js";import"./with-selector-CBbEXJpv.js";import"./clamp-DE0vwPH8.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"b499a2f8754325c9a6c3728ee5938895c8edcd80"};var o=new s.Error().stack;o&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[o]="4385e878-f3b7-4dc6-b825-d053c65822c6",s._sentryDebugIdIdentifier="sentry-dbid-4385e878-f3b7-4dc6-b825-d053c65822c6")}catch{}})();/**
2 * @license @tabler/icons-react v3.46.0 - MIT
3 *
4 * This source code is licensed under the MIT license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ms=[["path",{d:"M6 5h12l3 5l-8.5 9.5a.7 .7 0 0 1 -1 0l-8.5 -9.5l3 -5",key:"svg-0"}],["path",{d:"M10 12l-2 -2.2l.6 -1",key:"svg-1"}]],hs=Re("outline","diamond","Diamond",ms);/**
7 * @license @tabler/icons-react v3.46.0 - MIT
8 *
9 * This source code is licensed under the MIT license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const gs=[["path",{d:"M12 3c7.2 0 9 1.8 9 9c0 7.2 -1.8 9 -9 9c-7.2 0 -9 -1.8 -9 -9c0 -7.2 1.8 -9 9 -9",key:"svg-0"}],["path",{d:"M9 15.075l6 -6",key:"svg-1"}],["path",{d:"M9 9.105v.015",key:"svg-2"}],["path",{d:"M15 15.12v.015",key:"svg-3"}]],xs=Re("outline","square-rounded-percentage","SquareRoundedPercentage",gs),H=s=>new Intl.NumberFormat("en",{maximumFractionDigits:2}).format(s),ps=()=>{const{currentUserEmail:s}=y.useContext(Q),o=W(),[r,c]=fe(),d=r.toString(),x=F({queryKey:["aiCreditsBalance"],queryFn:async()=>(await j().get(f.AI_CREDITS_BALANCE)).data,enabled:!!s,refetchOnWindowFocus:"always"});y.useEffect(()=>{const h=new URLSearchParams(d),S=h.get("checkoutStatus"),n=h.get("checkoutProduct");if(S!=="success"||n!=="ai-credits")return;const w=[0,2e3,5e3].map(b=>window.setTimeout(()=>{o.invalidateQueries({queryKey:["aiCreditsBalance"]}),o.invalidateQueries({queryKey:["userPayments"]})},b)),g=new URLSearchParams(h);return g.delete("checkoutStatus"),g.delete("checkoutProduct"),g.delete("session_id"),c(g,{replace:!0}),()=>{w.forEach(b=>window.clearTimeout(b))}},[o,d,c]);const t=x.data,a=!!(t&&t.allowanceTier!=="none");return e.jsxs(l,{p:"sm",gap:"lg",pos:"relative",children:[e.jsx(de,{visible:!s||x.isLoading,loaderProps:{size:"sm"}}),e.jsxs(C,{justify:"space-between",align:"flex-start",gap:"md",children:[e.jsxs(l,{gap:4,children:[e.jsx(N,{order:3,ff:"Urbanist",children:"AI Credits"}),e.jsx(m,{size:"sm",c:"dimmed",children:"Monthly credits reset each month. Purchased credits roll over until used."})]}),a?e.jsx(as,{}):e.jsx(m,{size:"sm",c:"dimmed",ta:"right",children:"Top-ups are available with an active subscription or trial."})]}),e.jsxs(Ne,{cols:{base:1,sm:2,md:4},spacing:"sm",children:[e.jsx(te,{label:"Available",value:H((t==null?void 0:t.balanceCredits)??0),strong:!0}),e.jsx(te,{label:"Monthly used",value:`${H((t==null?void 0:t.monthlyUsedCredits)??0)} / ${H((t==null?void 0:t.monthlyAllowanceCredits)??0)}`}),e.jsx(te,{label:"Paid rollover",value:H((t==null?void 0:t.paidBalanceCredits)??0)}),e.jsx(te,{label:"Lifetime used",value:H((t==null?void 0:t.lifetimeUsedCredits)??0)})]}),e.jsxs(C,{gap:"xs",children:[e.jsxs(K,{variant:"light",color:"green",children:["Tier: ",(t==null?void 0:t.allowanceTier)??"none"]}),e.jsxs(K,{variant:"light",color:"gray",children:["Period: ",(t==null?void 0:t.monthlyPeriod)??"-"]}
11),e.jsxs(K,{variant:"light",color:"blue",children:["Purchased: ",H((t==null?void 0:t.lifetimePurchasedCredits)??0)]}),e.jsxs(K,{variant:"light",color:"gray",children:["Granted: ",H((t==null?void 0:t.lifetimeGrantedCredits)??0)]})]})]})},te=({label:s,value:o,strong:r=!1})=>e.jsxs(l,{gap:2,children:[e.jsx(m,{size:"xs",tt:"uppercase",fw:800,c:"dimmed",children:s}),e.jsx(m,{size:r?"xl":"lg",fw:r?900:800,children:o})]}),ys=()=>{const s=W(),[o,r]=y.useState(""),c=F({queryKey:["chatSettings"],queryFn:async()=>(await j().get(`${f.CHAT}/settings`)).data}),d=F({queryKey:["chatBlockedUsers"],queryFn:async()=>(await j().get(`${f.CHAT}/blocks`)).data.data}),x=F({queryKey:["chatSettingsUserSearch",o.trim()],queryFn:async()=>(await j().get(`${f.CHAT}/users/search`,{params:{q:o.trim()}})).data.data,enabled:o.trim().length>=2}),t=z({mutationFn:async n=>(await j().put(`${f.CHAT}/settings`,n)).data.data,onSuccess:n=>{s.setQueryData(["chatSettings"],n),U({message:"Chat settings saved",color:"green"})},onError:()=>U({message:"Failed to save chat settings",color:"red"})}),a=z({mutationFn:async n=>j().post(`${f.CHAT}/blocks/${n}`),onSuccess:()=>{r(""),s.invalidateQueries({queryKey:["chatBlockedUsers"]})},onError:n=>{var i,w;U({message:((w=(i=n.response)==null?void 0:i.data)==null?void 0:w.message)??"Failed to block user",color:"red"})}}),h=z({mutationFn:async n=>j().delete(`${f.CHAT}/blocks/${n}`),onSuccess:()=>s.invalidateQueries({queryKey:["chatBlockedUsers"]}),onError:()=>U({message:"Failed to unblock user",color:"red"})}),S=c.data;return c.isLoading||d.isLoading?e.jsxs(l,{mt:"md",gap:"md",children:[e.jsx(re,{h:118,radius:"md"}),e.jsx(re,{h:180,radius:"md"})]}):e.jsxs(l,{mt:"md",gap:"md",children:[e.jsx(ye,{withBorder:!0,radius:"md",p:"md",children:e.jsxs(l,{gap:"md",children:[e.jsx(N,{order:4,ff:"Urbanist",children:"Chat Preferences"}),e.jsx(ns,{label:"Who can DM me",value:(S==null?void 0:S.allowDmFrom)??"everyone",data:[{value:"everyone",label:"Everyone"},{value:"privileged",label:"Sysadmins and ambassadors"},{value:"none",label:"No one"}],onChange:n=>{!S||!n||t.mutate({...S,allowDmFrom:n})}})]})}),e.jsx(ye,{withBorder:!0,radius:"md",p:"md",children:e.jsxs(l,{gap:"sm",children:[e.jsx(N,{order:4,ff:"Urbanist",children:"Blocked Users"}),e.jsx(D,{leftSection:e.jsx(Be,{size:16}),placeholder:"Search username to block",value:o,onChange:n=>r(n.currentTarget.value)}),x.isLoading?e.jsxs(l,{gap:"xs",children:[e.jsx(re,{h:38}),e.jsx(re,{h:38})]}):(x.data??[]).map(n=>e.jsxs(B,{variant:"subtle",justify:"flex-start",leftSection:e.jsx(Te,{src:n.avatarUrl,size:"sm"}),onClick:()=>a.mutate(n.id),disabled:a.isPending,children:["Block @",n.username]},n.id)),e.jsx(l,{gap:"xs",mt:"sm",children:(d.data??[]).length?(d.data??[]).map(n=>e.jsxs(C,{justify:"space-between",children:[e.jsxs(C,{gap:"sm",children:[e.jsx(Te,{src:n.avatarUrl,size:"sm"}),e.jsxs(m,{size:"sm",children:["@",n.username]})]}),e.jsx(B,{size:"xs",variant:"subtle",leftSection:e.jsx(ve,{size:14}),onClick:()=>h.mutate(n.id),disabled:h.isPending,children:"Unblock"})]},n.id)):e.jsx(m,{size:"sm",c:"dimmed",children:"No blocked users."})})]})})]})},ae=20,ke=({name:s,pictureUrl:o})=>e.jsxs(C,{gap:"xs",wrap:"nowrap",children:[e.jsx(Le,{w:ae,h:ae,children:e.jsx(ie,{w:ae,h:ae,fit:"contain",src:o||De,style:{filter:"drop-shadow(0 0 1px rgba(0, 0, 0, 0.5))"}})}),e.jsx(m,{size:"sm",lineClamp:1,children:s})]}),js=()=>{var q,I;const{currentUserAccessRemainingDays:s,currentUserIsAmbassador:o,currentUserIsExpert:r,currentUserIsFriendsAndFamily:c,currentUserIsSysAdmin:d}=y.useContext(Q),{trackEvent:x}=Se(),[t,a]=y.useState(""),[h]=Ke(t,300),S=Qe(),{colorScheme:n}=we(),i=Oe("(max-width: 50em)"),g=F({queryKey:["userFavoriteTeams"],queryFn:async()=>await j().get(f.USER_FAVORITE_TEAMS)}),P=F({queryKey:["searchTeamsToAddToFavorites",h],queryFn:async()=>(await j().get(f.GET_TEAMS,{params:{searchText:h.trim()||""}})).data.data}),A=z({mutationFn:async v=>(x("teamAddedToFavorites",{teamSlug:v}),await j().post(f.USER_FAVORITE_TEAMS,{teamSlug:v})),onError:()=>{U({message:"Something went wrong while adding the team to favourites",autoClose:!1,color:"red"})},onSettled:()=>g.refetch()}),k=z({mutationFn:async v=>(x("teamRemovedFromFavorites",{teamSlug:v}),await j().delete(f.USER_FAVORITE_TEAMS,{params:{teamSlug:v}})),onError:()=>{U({message:"Something went wrong while removing the team from favourites",autoClose:!1,color:"red"})},onSettled:()=>g.refetch()}),M=((q=g.data)==null?void 0:q.data.favoriteTeams)??[],u=M.length>
110,_=!!(d||o||c||r||s&&s>0);return e.jsx(l,{p:"sm",children:g.isLoading?e.jsx(oe,{size:"sm",p:"sm"}):e.jsxs(l,{children:[u?e.jsxs(l,{mb:"lg",children:[e.jsxs(m,{fw:500,size:"sm",children:["You have ",M.length," favourite teams"]}),e.jsx(_e.Autosize,{mah:120,children:e.jsx(is,{direction:i?"column":"row",gap:i?"xs":"sm",wrap:"wrap",children:M.map(v=>e.jsxs(C,{gap:"xs",wrap:"nowrap",style:{flexShrink:0,backgroundColor:n==="dark"?S.colors.dark[6]:S.colors.gray[2],borderRadius:"8px",padding:"4px 12px 4px 4px"},children:[e.jsx(ce,{size:"sm",color:"gray",variant:"light",onClick:()=>k.mutate(v.slug),children:e.jsx(ve,{})}),e.jsx(ke,{name:v.name,pictureUrl:v.pictureUrl})]},v.id))})}),e.jsx(Me,{canActivate:_,compact:!0,surface:"favorite_teams"})]}):null,e.jsxs(l,{gap:"sm",pos:"relative",maw:"340",children:[e.jsx(de,{visible:A.isPending||k.isPending||g.isLoading,loaderProps:{size:"sm"},zIndex:1e3,overlayProps:{radius:"sm",blur:2}}),e.jsx(D,{label:"Add teams to your favourites",value:t,onChange:v=>a(v.currentTarget.value),placeholder:"Ex: Real Madrid"}),P.isLoading&&e.jsx(oe,{size:"xs",p:"sm"}),P.isSuccess&&P.data.length===0&&e.jsx(m,{size:"xs",c:"dimmed",ml:"xs",children:"No teams found"}),e.jsx(_e,{h:240,type:"always",children:e.jsx(l,{gap:"sm",px:"xs",children:(I=P.data)==null?void 0:I.map(v=>{const G=M.some(J=>J.slug===v.slug);return e.jsxs(C,{gap:"sm",wrap:"nowrap",children:[e.jsx(ce,{size:"md",variant:"light",color:"red",radius:100,onClick:()=>G?k.mutate(v.slug):A.mutate(v.slug),children:G?e.jsx(os,{size:18}):e.jsx(cs,{size:18})}),e.jsx(ke,{name:v.name,pictureUrl:v.pictureUrl})]},v.slug)})})})]})]})})},fs=()=>{const{currentUserIsSysAdmin:s,currentUserIsAmbassador:o,currentUserIsFriendsAndFamily:r,currentUserIsExpert:c,currentUserAccessRemainingDays:d}=y.useContext(Q),x=W(),t=s||o||r||c||d&&d>0,[a,h]=y.useState(null),[S,n]=y.useState(null),i=async()=>(await j().get(f.NOTIFICATIONS_SETTINGS)).data,{data:w,isLoading:g}=F({queryKey:["userNotificationSettings"],queryFn:i,retry:!1,refetchOnWindowFocus:!1}),{data:b,isLoading:P}=F({queryKey:["chatSettings"],queryFn:async()=>(await j().get(`${f.CHAT}/settings`)).data,retry:!1,refetchOnWindowFocus:!1});y.useEffect(()=>{w&&h(w)},[w]),y.useEffect(()=>{b&&n(b.chatNotifications)},[b]);const L=u=>{var _;return(_=a==null?void 0:a.scarcities_to_notify_about)==null?void 0:_.includes(u)},A=u=>{if(!a)return;const _=a.scarcities_to_notify_about??[],q=_.includes(u)?_.filter(I=>I!==u):[..._,u];h({...a,scarcities_to_notify_about:q,notify_about_all_players:q.length===4})},k=z({mutationFn:async()=>{const u=[j().post(f.NOTIFICATIONS_SETTINGS,{...a})];return b&&S!==null&&S!==b.chatNotifications&&u.push(j().put(`${f.CHAT}/settings`,{...b,chatNotifications:S})),await Promise.all(u)},onSuccess:()=>{U({message:"Settings saved successfully",color:"green"})},onError:()=>{U({message:"Something went wrong. Settings not saved",color:"red"})},onSettled:()=>{x.invalidateQueries({queryKey:["userNotificationSettings"]}),x.invalidateQueries({queryKey:["chatSettings"]})}}),M=!a||k.isPending||g||P;return e.jsxs(C,{justify:"space-between",mt:"sm",align:"baseline",wrap:"wrap-reverse",children:[e.jsxs(l,{gap:"xs",children:[e.jsx(N,{order:5,children:"Players Notifications"}),e.jsxs(l,{ml:"sm",gap:"xs",children:[e.jsx(N,{order:6,children:"Which Players to Be Notified About"}),e.jsx(Y,{checked:a==null?void 0:a.notify_about_active_common_players,label:"All my active common players",disabled:g,onChange:u=>h({...a,notify_about_active_common_players:u.currentTarget.checked})}),e.jsx(Y,{checked:a==null?void 0:a.notify_about_all_players,label:"All my pro players",disabled:g,onChange:u=>h({...a,notify_about_all_players:u.currentTarget.checked,scarcities_to_notify_about:u.currentTarget.checked?["limited","rare","super_rare","unique"]:[]})}),e.jsx(l,{pl:"lg",gap:4,children:["limited","rare","super_rare","unique"].map(u=>e.jsx(Y,{label:u.charAt(0).toUpperCase()+u.slice(1).replace("_"," "),checked:L(u),onChange:()=>A(u),disabled:g||(a==null?void 0:a.notify_about_all_players)},u))}),e.jsx(N,{order:6,mt:"sm",children:"When to Be Notified"}),e.jsx(ge.Group,{value:(a==null?void 0:a.notify_on)||"PERCENT_CHANGE",onChange:u=>h({...a,notify_on:u}),children:e.jsxs(l,{gap:"xs",children:[e.jsx(ge,{disabled:g,value:"STATUS_CHANGE",label:"Only when status changes (DNP, Bench, Alternate, Starter)"}),e.jsx(ge,{disabled:g,value:"PERCENT_CHANGE",label:"Any % change"})]})})]}),e.jsx(N,{order:5,mt:"lg",children:"Lineups Notifications"}),e.jsx(Y,{label:e.jsxs(m,{size:"sm",children:["Let me know when my ",e.jsx(He,{href:"?activeTab=favorite-teams",children:"favourite teams"})," lineups are updated"]}),checked:a==null?void 0:a.favorite_teams_lineup_notifications,disabled:g,onChange:u=>h({...a,favorite_teams_lineup_notifications:u.currentTarget.checked})}),e.jsx(N,{order:5,mt:"lg",children:"Squad Notifications"}),e.jsx(Y,{label:"Let me know when my Squad has new chat messages",checked:a==null?void 0:a.squad_chat_notifications,disabled:g,onChange:u=>h({...a,squad_chat_notifications:u.currentTarget.checked})}),e.jsx(N,{order:5,mt:"lg",children:"Chat Notifications"}),e.jsx(Y,{label:"Let me know when I receive direct messages, private room messages, or chat mentions",checked:S??!0,disabled:P,onChange:u=>n(u.currentTarget.checked)}),e.jsx(B,{mt:"lg",disabled:M,loading:k.isPending,onClick:()=>k.mutate(),children:"Save settings"})]}),e.jsx(l,{p:"sm",maw:380,miw:280,children:e.jsx(Me,{canActivate:!!t,surface:"notification_settings"})})]})},vs=()=>{const{currentUserIsConnectedWithSorare:s}=y.useContext(Q),{colorScheme:o}=we(),[r,c]=We({key:"only-my-players",defaultValue:"false"}),x=z({mutationFn:async()=>await j().delete(f.CONNECT_SORARE_USER_BY_AUTH_CODE),onError:()=>{U({message:"Something went wrong disconnecting your Sorare account",autoClose:!1,color:"red"})},onSuccess:()=>{c("false"),location.reload()}});return e.jsxs(l,{p:"sm",maw:340,children:[e.jsxs(m,{size:"sm",fw:"500",children:[s?"Connected! You're getting":"Get"," the most out of Sorare Inside"]}),s?e.jsxs(l,{children:[e.jsx(B,{color:"black",variant:o==="dark"?"filled":"outline",loading:x.isPending,leftSection:e.jsx(ie,{src:Ue,h:16,w:16,fit:"contain",style:{filter:o==="dark"?"invert(1)":void 0}}),onClick:()=>x.mutate(),children:"Disconnect from Sorare"}),e.jsx(m,{size:"xs",ta:"center",c:"dimmed",children:"Need fresher cards? Use the “Request sync” action inside your Gallery to enqueue an update."})]}):e.jsx(B,{color:"black",leftSection:e.jsx(ie,{src:Ue,h:16,w:16,fit:"contain",style:{filter:"invert(1)"}}),component:"a",href:$e,onClick:Ge,children:"Connect with Sorare"})]})},Fe=({email:s})=>e.jsx(B,{w:"fit-content",size:"xs",component:"a",target:"_blank",rel:"noopener noreferrer",href:`https://billing.stripe.com/p/login/cN24iBegf9FicNi7ss${s?`?prefilled_email=${encodeURIComponent(s)}`:""}`,variant:"light",rightSection:e.jsx(Ye,{size:14}),children:"Manage subscription"});ne.extend(Ve);const Ss=()=>{const s=async()=>{const{data:r}=await j().get(f.USER_PAYMENTS);return r},{data:o}=F({queryKey:["userPayments"],queryFn:s,refetchOnWindowFocus:"always"});return e.jsx(l,{children:o&&o.length>0?e.jsxs(l,{mb:"lg",children:[e.jsx(m,{fw:500,children:"Payments"}),o.map(r=>e.jsx(ye,{p:"sm",px:"lg",shadow:"xs",maw:280,children:e.jsxs(l,{children:[e.jsxs(C,{justify:"space-between",children:[e.jsxs(m,{size:"xs",c:"dimmed",children:["ID: ",r.id.split("-")[0]]}),e.jsx(m,{size:"xs",children:ne(r.created_at).format("lll")})]}),e.jsxs(m,{children:[r.months_quantity," month",r.months_quantity>1?"s":""," access"]}),e.jsxs(C,{justify:"space-between",wrap:"nowrap",children:[e.jsx(ls,{status:r.status}),e.jsxs(C,{gap:4,wrap:"nowrap",children:[r.status==="SUCCEEDED"?null:e.jsx(Ae,{value:r.amount.toString(),timeout:2e3,children:({copied:c,copy:d})=>e.jsx(le,{label:c?"Copied":"Copy payment amount",withArrow:!0,position:"right",children:e.jsx(ce,{color:c?"teal":"gray",variant:"subtle",onClick:d,children:c?e.jsx(je,{size:14}):e.jsx(Ie,{size:14})})})}),e.jsxs(m,{fw:500,size:"sm",ta:"right",children:[ds[r.currency_code.toLowerCase()],r.amount]})]})]}),r.destination_wallet_address?e.jsxs(e.Fragment,{children:[e.jsx(qe,{}),e.jsx(l,{gap:"xs",children:r.status==="INIT"&&ne(r.created_at).isBefore(ne().subtract(72,"hour"))?e.jsx(m,{size:"xs",c:"dimmed",children:"⚠️ Payment started more than 72 hours ago. Please create a new one."}):e.jsxs(e.Fragment,{children:[e.jsx(m,{size:r.status==="INIT"?"sm":"xs",children:r.status==="INIT"?`Complete your payment by sending Ξ${r.amount} to this mainnet address:`:"🎉 Your payment has been received here:"}),e.jsxs(C,{wrap:"nowrap",gap:4,children:[e.jsx(m,{size:"xs",c:"dimmed",style:{overflow:"hidden",textOverflow:"ellipsis"},children:r.destination_wallet_address}),e.jsx(Ae,{value:r.destination_wallet_address,timeout:2e3,children:({copied:c,copy:d})=>e.jsx(le,{label:c?"Copied":"Copy destination wallet address",withArrow:!0,position:"right",children:e.jsx(ce,{color:c?"teal":"gray",variant:"subtle",onClick:d,children:c?e.jsx(je,{size:14}):e.jsx(Ie,{size:14})})})})]})]})})]}):null]})},r.id))]}):null})},ws=({currentUserAccessRemainingDays:s,currentUserPFYSubscriptionIsLongest:o})=>{const{colorScheme:r}=we(),c=Math.max(s*24*60,0),d=Math.floor(c/(24*60)),x=Math.floor(c%(24*60)/60),t=Math.floor(c%60),a=o&&s>0;return e.jsxs(l,{gap:"xs",my:"sm",children:[a&&e.jsxs(C,{gap:8,wrap:"nowrap",children:[e.jsx(ie,{src:"/predictorfy_logo.png",h:18,w:18,fit:"contain",style:{filter:r==="dark"?"invert(1)":void 0}}),e.jsx(m,{size:"sm",fw:500,children:"from Predictorfy"})]}),e.jsxs(K,{size:"lg",color:s>0?"green":"orange",children:[Math.floor(s)>0?`${d} days`:null,s<2&&s>=1?", ":null,s<2&&s>0?`${x} hours, and ${t}
11 minutes`:null,s<=0?"Not subscribed":" remaining"]}),a&&e.jsxs(m,{size:"xs",children:["In ",d," days, you can ",e.jsx("b",{children:"also"})," claim a 1 month ",e.jsx("b",{children:"Free Trial"}),' for "Sorare Inside".']}),!o&&s>0?e.jsx(m,{size:"xs",children:"Make sure your next payment goes through by then to keep enjoying everything Sorare Inside has to offer."}):null]})},bs=()=>{var Ce,Pe,Ee;const{currentUserAccessRemainingDays:s,currentUserId:o,currentUserEmail:r,currentUserIsAmbassador:c,currentUserIsExpert:d,currentUserIsFriendsAndFamily:x,currentUserIsSysAdmin:t,currentUserPFYSubscriptionIsLongest:a,currentUserSISubscriptionHasWorldCupPromo:h,currentUserSISubscriptionDurationInMonths:S}=y.useContext(Q),{trackEvent:n}=Se(),i=W(),[w,g]=fe(),b=w.toString(),P=["stripeSubscriptionStatus",o],L=F({queryKey:P,queryFn:async()=>{const{data:p}=await j().get(f.USER_STRIPE_SUBSCRIPTION_STATUS);return p},enabled:!!o,refetchOnWindowFocus:"always"}),A=((Ce=L.data)==null?void 0:Ce.hasExistingSubscription)===!0,k=F({queryKey:["conversion-rates"],queryFn:async()=>await j().get(f.CRYPTO_EUR_TO_ETH,{params:{eurAmount:"1"}}),refetchInterval:6e4}),M=async()=>{const{data:p}=await j().get(f.USER_PAYMENTS);return p},{data:u}=F({queryKey:["userPayments"],queryFn:M,refetchOnWindowFocus:"always"}),_=Array.isArray(u)?u:[],q=_[0],I=_.some(p=>p.status==="SUCCEEDED"&&p.currency_code==="eur"&&p.amount===0),v=_.some(p=>p.status==="SUCCEEDED"&&p.months_quantity>0&&(p.currency_code==="eth"||p.currency_code==="eur")),G=q&&q.status==="SUCCEEDED"&&q.currency_code==="eur"&&q.created_at&&q.created_at>"2024-08-16 14:17:18",Z=!(t||d||c||x)&&s!==void 0&&s<=0,ee=Xe()&&Z,R=s!==void 0&&s>0,X=z({mutationFn:async({planId:p,durationInMonths:E})=>(n("getPlanAccessClicked",{durationInMonths:E}),await j().put(f.USER_PAYMENTS,{selectedPlanId:p,selectedPlanDurationInMonths:E})),onError:()=>{U({message:"Setting your subscription plan failed. Please try again later.",color:"red"})},onSettled:()=>{scrollTo({top:0,behavior:"smooth"}),i.invalidateQueries({queryKey:["userProfile"]}),i.invalidateQueries({queryKey:["userAccessRemainingDays"]}),i.invalidateQueries({queryKey:["userPayments"]})}}),ue=z({mutationFn:async({planId:p,durationInMonths:E})=>{const{data:$}=await j().post(f.USER_STRIPE_CHECKOUT_SESSION,{selectedPlanId:p,selectedPlanDurationInMonths:E});return $},onSuccess:({url:p})=>{p&&(location.href=p)},onError:p=>{var se;const E=Je(p)&&((se=p.response)==null?void 0:se.status)===409?p.response.data:void 0,$=(E==null?void 0:E.code)==="SUBSCRIPTION_ALREADY_EXISTS"||(E==null?void 0:E.message)==="You already have a subscription. Use Manage subscription to update it or resolve its payment.";$&&i.setQueryData(P,{hasExistingSubscription:!0}),U({message:$?e.jsxs(l,{gap:"xs",children:[e.jsx(m,{size:"sm",children:E==null?void 0:E.message}),e.jsx(Fe,{email:r})]}):(E==null?void 0:E.message)||"Creating your checkout session failed. Please try again later.",autoClose:$?!1:void 0,color:"red"})}});return y.useEffect(()=>{const p=new URLSearchParams(b);if(p.get("checkoutStatus")!=="success")return;const se=[0,2e3,5e3].map(he=>window.setTimeout(()=>{i.invalidateQueries({queryKey:["userProfile"]}),i.invalidateQueries({queryKey:["userAccessRemainingDays"]}),i.invalidateQueries({queryKey:["userPayments"]}),i.invalidateQueries({queryKey:["stripeSubscriptionStatus"]})},he)),me=new URLSearchParams(p);return me.delete("checkoutStatus"),me.delete("session_id"),g(me,{replace:!0}),()=>{se.forEach(he=>window.clearTimeout(he))}},[i,b,g]),y.useEffect(()=>{v&&i.invalidateQueries({queryKey:["userAccessRemainingDays"]})},[v,i]),e.jsxs(l,{p:"sm",gap:"sm",pos:"relative",children:[e.jsx(de,{visible:!r||X.isPending||ue.isPending||i.isFetching({queryKey:["userProfile"]})>0,loaderProps:{size:"sm"}}),s!=null?e.jsx(ws,{currentUserPFYSubscriptionIsLongest:a,currentUserAccessRemainingDays:s}):null,A?e.jsxs(l,{gap:4,children:[e.jsx(Fe,{email:r}),e.jsx(m,{size:"xs",c:"dimmed",children:"Manage card payments and subscriptions in Stripe, even if your access has expired. Your Stripe subscription email may differ from your Sorare Inside account email."})]}):null,L.isError?e.jsx(m,{size:"xs",c:"dimmed",children:"We couldn’t check your Str
11ipe subscription. Refresh this page to try again."}):null,e.jsx(Ss,{}),e.jsx(m,{size:"md",children:R?e.jsx(e.Fragment,{children:"Your Sorare Inside subscription is active."}):I?e.jsx(e.Fragment,{children:"Subscribe to Sorare Inside. Cancel anytime, no commitment required."}):e.jsxs(e.Fragment,{children:["Try Sorare Inside ",e.jsx("b",{children:"for free"}),". Cancel anytime, no commitment required."]})}),e.jsxs(m,{size:"sm",children:["Get all the experts knowledge covering teams from more than"," ",e.jsx(Ze,{to:es.EXPERT_COVERAGE,style:{textDecoration:"none",color:"green"},children:e.jsx("b",{children:"100 countries"})})," ","around the world."]}),e.jsxs(C,{align:"flex-start",children:[e.jsx(ss,{disableButtons:A||s!=null&&s>0||ue.isPending,showWorldCupPromo:ee,currentPlanDurationInMonths:s!==void 0&&s>0?S:null,currentPlanHasWorldCupPromo:h,subscribeButtonText:G||I?"Subscribe":"Free Trial",onButtonClick:p=>{ue.mutate({planId:"PLAN_PRO_EUR",durationInMonths:p})}}),e.jsx(rs,{disableButtons:s!=null&&s>0,eurToEthConversionRate:((Ee=(Pe=k.data)==null?void 0:Pe.data)==null?void 0:Ee.eurToEthConversionRate)||0,onButtonClick:p=>X.mutate({planId:"PLAN_PRO_ETH",durationInMonths:p})})]})]})},Cs=async()=>j().get(f.EXPERT_REWARD_PREFERENCES),Ps=async s=>j().put(f.EXPERT_REWARD_PREFERENCES,s),pe=s=>typeof s=="number"?s:0,Es=({preferences:s})=>{const o=W(),[r,c]=y.useState((s==null?void 0:s.gemsPercent)??0),[d,x]=y.useState((s==null?void 0:s.essencePercent)??100),[t,a]=y.useState((s==null?void 0:s.marketCreditPercent)??0),h=r+d+t,S=h===100,n=z({mutationFn:w=>Ps(w),onSuccess:()=>{U({message:"Sorare reward preferences saved",color:"green"})},onError:w=>{var g,b;U({message:((b=(g=w.response)==null?void 0:g.data)==null?void 0:b.message)||"Something went wrong. Reward preferences not saved",autoClose:!1,color:"red"})},onSettled:()=>{o.invalidateQueries({queryKey:["expertRewardPreferences"]}),o.invalidateQueries({queryKey:["expertsRankingView"]})}}),i=()=>{n.mutate({gemsPercent:r,essencePercent:d,marketCreditPercent:t})};return e.jsxs(l,{gap:"md",children:[e.jsx(m,{size:"sm",children:"Choose how you would like your monthly Sorare in-game rewards to be split."}),e.jsxs(l,{gap:"sm",children:[e.jsxs(C,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(C,{gap:"xs",wrap:"nowrap",children:[e.jsx(hs,{size:20,color:"var(--mantine-color-green-6)"}),e.jsx(m,{size:"sm",fw:500,children:"Gems"})]}),e.jsx(xe,{"aria-label":"Gems percentage",value:r,onChange:w=>c(pe(w)),min:0,max:100,clampBehavior:"strict",allowDecimal:!1,suffix:"%",w:130,disabled:n.isPending})]}),e.jsxs(C,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(C,{gap:"xs",wrap:"nowrap",children:[e.jsx(us,{size:20,color:"var(--mantine-color-yellow-6)"}),e.jsx(m,{size:"sm",fw:500,children:"Essence"})]}),e.jsx(xe,{"aria-label":"Essence percentage",value:d,onChange:w=>x(pe(w)),min:0,max:100,clampBehavior:"strict",allowDecimal:!1,suffix:"%",w:130,disabled:n.isPending})]}),e.jsxs(C,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(C,{gap:"xs",wrap:"nowrap",children:[e.jsx(xs,{size:20,color:"var(--mantine-color-blue-6)"}),e.jsx(m,{size:"sm",fw:500,children:"Market credits"})]}),e.jsx(xe,{"aria-label":"Market credits percentage",value:t,onChange:w=>a(pe(w)),min:0,max:100,clampBehavior:"strict",allowDecimal:!1,suffix:"%",w:130,disabled:n.isPending})]})]}),e.jsxs(l,{gap:4,children:[e.jsxs(O.Root,{size:"xl","aria-label":"Sorare reward split",children:[e.jsx(O.Section,{value:r,color:"green",children:r>=12?e.jsxs(O.Label,{children:[r,"%"]}):null}),e.jsx(O.Section,{value:d,color:"yellow",children:d>=12?e.jsxs(O.Label,{children:[d,"%"]}):null}),e.jsx(O.Section,{value:t,color:"blue",children:t>=12?e.jsxs(O.Label,{children:[t,"%"]}):null})]}),e.jsx(m,{size:"xs",c:h===100?"dimmed":h>100?"red":"orange",children:h===100?"Total 100%":h>100?`${h-100}% over the required total`:`${100-h}% remaining`})]}),e.jsx(B,{loading:n.isPending,disabled:!S,onClick:i,maw:180,children:"Save preferences"})]})},Ts=()=>{var h;const s=W(),{currentUserIsExpert:o,currentUserPayoutEthWalletAddress:r}=y.useContext(Q),[c,d]=y.useState(r||""),x=F({queryKey:["expertRewardPreferences"],queryFn:Cs,enabled:o}),t=z({mutationFn:async()=>j().post(f.USER_PROFILE,{payout_eth_wallet_address:c.trim()||null}),onSuccess:()=>{U({message:"Payout wallet saved",color:"green"})},onError:S=>{var n,i;U({message:((i=(n=S.response)==null?void 0:n.data)==null?void 0:i.message)||"Something went wrong. Payout wallet not saved",autoClose:!1,color:"red"})},onSettled:()=>{s.invalidateQueries({queryKey:["userProfile"]})}});if(!o)return null;const a=((h=x.data)==null?void 0:h.data.data)??null;return e.jsxs(l,{p:"sm",gap:"lg",maw:560,children:[e.jsxs(l,{gap:"sm",children:[e.jsx(m,{size:"sm",children:"If you choose to receive your cash compensation in ETH, payouts will be sent to this wallet:"}),e.jsx(D,{label:"ETH payout wallet",placeholder:"0x...",value:c,onChange:S=>d(S.currentTarget.value),disabled:t.isPending}),e.jsx(B,{loading:t.isPending,onClick:()=>t.mutate(),maw:180,children:"Save wallet"})]}),e.jsx(qe,{}),e.jsxs(l,{gap:"xs",children:[e.jsx(N,{order:4,children:"Preferred Sorare reward split"}),x.isLoading?e.jsx(oe,{size:"sm"}):x.isError?e.jsx(ze,{color:"red",children:"Unable to load your Sorare reward preferences."}):e.jsx(Es,{preferences:a},(a==null?void 0:a.updatedAt)??"unset")]})]})},_s=()=>{var Z,ee;const{trackEvent:s}=Se(),o=W(),{currentUserEmail:r,currentUserUsername:c,currentUserFirstName:d,currentUserLastName:x,currentUserXUsername:t,currentUserDiscordUsername:a,currentUserIsExpert:h,currentUserIsAmbassad
11or:S,currentUserIsFriendsAndFamily:n}=y.useContext(Q),[i,w]=y.useState(c||""),[g,b]=y.useState(d||""),[P,L]=y.useState(x||""),[A,V]=y.useState(t||""),[k,M]=y.useState(a||"");y.useEffect(()=>{w(c||""),b(d||""),L(x||""),V(t||""),M(a||"")},[c,d,x,t,a]);const u=async()=>await j().get(f.IS_USERNAME_AVAILABLE,{params:{username:i.trim()}}),_=F({queryKey:["isUsernameAvailable",i.trim()],queryFn:u,enabled:i.trim().length>0,retry:!1}),I=z({mutationFn:async()=>{if(v)throw new Error("Can't save an empty profile");return s("ownUserProfileModified"),await j().post(f.USER_PROFILE,{username:(i==null?void 0:i.trim())||null,first_name:(g==null?void 0:g.trim())||null,last_name:(P==null?void 0:P.trim())||null,x_username:(A==null?void 0:A.trim())||null,discord_username:(k==null?void 0:k.trim())||null})},onError:R=>{var X;const be=(X=R.response)==null?void 0:X.data.statusCode;U({message:be===409?"Username already taken":"Something went wrong. Pending changes unsaved",autoClose:!1,color:"red"})},onSettled:()=>{o.invalidateQueries({queryKey:["userProfile"]}),o.refetchQueries({queryKey:["userProfile"]})}}),v=!(i!=null&&i.trim().length)&&!(g!=null&&g.trim().length)&&!(P!=null&&P.trim().length)&&!(A!=null&&A.trim().length),G=!r||v||i.trim().length<6,J=!!c&&c!==i.trim()&&i.trim().length>0;return e.jsxs(l,{p:"sm",gap:"sm",pos:"relative",maw:320,children:[e.jsx(de,{visible:!r,loaderProps:{size:"sm"}}),h?e.jsx(K,{variant:"light",size:"sm",children:"Expert"}):S?e.jsx(K,{variant:"light",size:"sm",children:"Affiliate"}):n?e.jsx(K,{variant:"light",size:"sm",children:"Friends & Family"}):null,e.jsx(D,{required:!0,description:"Min. 6 characters",disabled:!r||I.isPending,value:i,onChange:R=>w(R.currentTarget.value),rightSection:i.trim().length===0||c===i.trim()?null:_.isLoading?e.jsx(oe,{size:"xs"}):(Z=_.data)!=null&&Z.data.isUsernameAvailable?e.jsx(le,{label:"Username is available",withArrow:!0,children:e.jsx(je,{size:16,color:"green"})}):e.jsx(le,{label:"Username is already taken",withArrow:!0,children:e.jsx(ve,{size:16,color:"red"})}),label:"Username",error:c!==i.trim()&&((ee=_.data)==null?void 0:ee.data.isUsernameAvailable)===!1?"Username is already taken":null}),J?e.jsx(ze,{color:"yellow",variant:"light",children:"During the Xmas referrals promo, your username doubles as your referral code. Changing it now may cause pending referrals to stop tracking. Make sure you haven't shared the code before changing."}):null,e.jsx(D,{disabled:!r||I.isPending,value:g,onChange:R=>b(R.currentTarget.value),label:"First name"}),e.jsx(D,{disabled:!r||I.isPending,value:P,onChange:R=>L(R.currentTarget.value),label:"Last name"}),e.jsx(D,{disabled:!r||I.isPending,value:A,onChange:R=>V(R.currentTarget.value),label:"𝕏 username"}),e.jsx(D,{disabled:!r||I.isPending,value:k,onChange:R=>M(R.currentTarget.value),label:"Discord username"}),e.jsx(B,{disabled:G,loading:I.isPending,onClick:()=>I.mutate(),mt:"lg",children:"Save"})]})},Ys=()=>{ts("ownUserAccountView");const{currentUserIsExpert:s}=y.useContext(Q),[o,r]=fe(),c=o.get("activeTab")||"subscription",d=x=>{x&&r({activeTab:x})};return e.jsxs(l,{children:[e.jsx(N,{order:2,ff:"Urbanist",children:"Account"}),e.jsxs(T,{defaultValue:c,onChange:d,children:[e.jsxs(T.List,{style:{flexWrap:"nowrap",overflow:"auto"},children:[e.jsx(T.Tab,{value:"subscription",children:"Subscription"}),e.jsx(T.Tab,{value:"ai-credits",children:"AI Credits"}),e.jsx(T.Tab,{value:"profile",children:"Profile"}),s?e.jsx(T.Tab,{value:"payouts",children:"Payouts"}):null,e.jsx(T.Tab,{value:"favorite-teams",children:"Favourite Teams"}),e.jsx(T.Tab,{value:"notifications",children:"Notifications"}),e.jsx(T.Tab,{value:"chat",children:"Chat"}),e.jsx(T.Tab,{value:"sorare-connect",children:"Sorare Connect"})]}),e.jsx(T.Panel,{value:"subscription",children:e.jsx(bs,{})}),e.jsx(T.Panel,{value:"ai-credits",children:e.jsx(ps,{})}),e.jsx(T.Panel,{value:"profile",children:e.jsx(_s,{})}),s?e.jsx(T.Panel,{value:"payouts",children:e.jsx(Ts,{})}):null,e.jsx(T.Panel,{value:"favorite-teams",children:e.jsx(js,{})}),e.jsx(T.Panel,{value:"notifications",children:e.jsx(fs,{})}),e.jsx(T.Panel,{value:"chat",children:e.jsx(ys,{})}),e.jsx(T.Panel,{value:"sorare-connect",children:e.jsx(vs,{})})]})]})};export{Ys as default};
12//# sourceMappingURL=UserAccountView-DcKqssgI.js.map

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.