Files
dotfiles/.config/spicetify/Extracted/Themed/xpui/xpui-routes-buddy-feed.js
T
2024-05-05 19:02:45 +02:00

2 lines
15 KiB
JavaScript
Executable File

"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[4338],{67731:(e,s,a)=>{a.r(s),a.d(s,{default:()=>Ls});var i=a(50959),t=a(74979),n=a(15880),l=a(85648),r=a(55842),d=a(12618),c=a(13481),o=a(58800),u=a(83335),m=a(54941),x=a(13734),f=a(2800),g=a(80626),h=(a(86277),a(80199)),j=a(82187),b=a.n(j),y=a(69736),p=a(11317),N=a(87608),v=a(82579),k=a(16972),C=a(27838),L=a(33981),I=a(75463),E=a(86696),S=a(41736),w=a(60046),O=a(43316),T=a(17053),U=a(33598),A=a(45438),D=a(22527),M=a(82857),B=a(64169),_=a(70488),F=a(11527);const P=e=>{const{timestamp:s,isNowPlaying:a}=e;return a?(0,F.jsx)(d.ws,{label:l.ag.get("time.now"),children:(0,F.jsx)(B.h,{"aria-label":l.ag.get("time.now"),size:"small"})}):(0,F.jsx)("span",{children:(0,_.l)(s)})},z="main-buddyFeed-friendActivity",J="VLKqDIGaQn2bILzJKSZ0",Y="main-buddyFeed-friendsFeedContainer",K="main-buddyFeed-avatarContainer",Z="main-buddyFeed-overlay",q="main-buddyFeed-playIcon",H="main-buddyFeed-activityMetadata",R="main-buddyFeed-usernameAndTimestamp",W="main-buddyFeed-username",V="main-buddyFeed-timestamp",Q="main-buddyFeed-artistAndTrackName",G="main-buddyFeed-playbackContextIcon",X="main-buddyFeed-playbackContext",$="main-buddyFeed-playbackContextLink",ee="main-buddyFeed-addFriendPlaceholder",se="main-buddyFeed-addFriendPlaceholderBtn",ae="main-buddyFeed-emptyBuddyFeed",ie="main-buddyFeed-addFriendPlaceholderText",te="PjDcsgAPmXlcTBJRGpIu",ne="IRpPQFA57qgQ5jicWWaD",le="Hm3nIbegLclY1uCAmnx_",re="bhRoVUHjWdo9mgUkU6fe",de="BliqfY7vu_qE2C9zs5Ou",ce="qdYWuHZd4HdSWfd4pSQB",oe="DhvYWKjDc7uyF3HfkDJJ",ue="ralK8s_OmE8a8zWcfNKM",me=e=>Date.now()-e<9e5,xe=(e,s)=>{const a=(0,p.EC)(e)?.type;switch(a){case p.JM.PLAYLIST:case p.JM.PLAYLIST_V2:return(0,F.jsx)(L.X,{uri:e});case p.JM.EPISODE:case p.JM.SHOW:return(0,F.jsx)(I.M,{uri:e});case p.JM.ALBUM:return(0,F.jsx)(k.Y,{uri:e,artistUri:s});case p.JM.ARTIST:return(0,F.jsx)(C.m,{uri:e});default:return null}},fe=e=>{switch(e){case p.JM.ALBUM:return M.p.ALBUM;case p.JM.ARTIST:return M.p.ARTIST;case p.JM.SHOW:return M.p.SHOW;case p.JM.EPISODE:return M.p.EPISODE;case p.JM.PLAYLIST:case p.JM.PLAYLIST_V2:return M.p.PLAYLIST;default:return}},ge=e=>{const{show:s=!0,spec:a,friend:t}=e,n=(0,i.useMemo)((()=>t.user.imageUrl?[{url:t.user.imageUrl,width:0,height:0}]:[]),[t.user.imageUrl]),r=(0,x.o)(),d=(0,g.$P)(),c=t.track,o=c.uri,{togglePlay:u,isPlaying:m,isActive:f}=(0,D.n)({uri:o},{featureIdentifier:"buddy_feed",referrerIdentifier:"buddy_feed"}),h=(0,p.EC)(c.context?.uri),j=h?.type,k=(0,i.useCallback)((()=>{u(),r({intent:m?"pause":"play",type:"click",itemIdSuffix:"buddyfeed_play",targetUri:o});const e=a.friendRowFactory().playButtonFactory();f?m?d.logInteraction(e.hitPause({itemToBePaused:o})):d.logInteraction(e.hitResume({itemToBeResumed:o})):d.logInteraction(e.hitPlay({itemToBePlayed:o}))}),[r,m,o,a,f,u,d]),L=(0,i.useCallback)(((e,s)=>{d.logInteraction(a.friendRowFactory().friendRowLinkFactory({identifier:e}).hitUiNavigate({destination:s}))}),[d,a]),I=(0,T.O)({itemUris:[o],dragLabelText:c.name}),M=(0,T.O)({itemUris:[c.artist?.uri],dragLabelText:c.artist?.name}),B=(0,T.O)({itemUris:[c.context?.uri],dragLabelText:c.context?.name});return s?(0,F.jsxs)("div",{className:b()(z),children:[(0,F.jsx)(v._,{menu:xe(c.context?.uri,c.artist?.uri),children:(0,F.jsxs)("div",{className:K,children:[(0,F.jsx)(N.q,{label:t.user.name,width:40,userIconSize:"small",images:n,withBadge:me(t.timestamp)}),(0,F.jsx)(O.I,{className:Z,iconClassName:q,isPlaying:m,isLocked:!1,onClick:k,playAriaLabel:m?l.ag.get("pause"):`${l.ag.get("play")} ${c.artist.name} ${c.name}`})]})}),(0,F.jsxs)("div",{className:b()(H),children:[(0,F.jsxs)("div",{className:R,children:[(0,F.jsx)(y.x,{as:"p",variant:"bodySmallBold",className:b()(W,"ellipsis-one-line"),children:(0,F.jsx)(A.JL,{value:"/buddyfeed_user_profile",children:(0,F.jsx)(v._,{menu:(0,F.jsx)(S.I,{uri:t.user.uri}),children:(0,F.jsx)(w.Link,{title:t.user.name,to:t.user.uri,dir:"auto",onClick:()=>L("profile_link",t.user.uri),children:t.user.name})})})}),(0,F.jsx)(y.x,{as:"p",variant:"marginal",className:b()(V),children:(0,F.jsx)(P,{timestamp:t.timestamp,isNowPlaying:me(t.timestamp)})})]}),(0,F.jsxs)(y.x,{as:"p",variant:"marginal",className:Q,children:[(0,F.jsx)(A.JL,{value:"/buddyfeed_track",children:(0,F.jsx)(v._,{menu:(0,F.jsx)(E.$,{uri:c.uri,contextUri:c.context?.uri,albumUri:c.album?.uri,artists:[c.artist]}),children:(0,F.jsx)(w.Link,{title:c.name,to:o,className:"ellipsis-one-line",dir:"auto",draggable:!0,onDragStart:I,onClick:()=>L("track_link",o),children:c.name})})}),(0,F.jsx)("span",{"aria-hidden":!0,children:" • "}),(0,F.jsx)(A.JL,{value:"/buddyfeed_artist",children:(0,F.jsx)(v._,{menu:c.artist?(0,F.jsx)(C.m,{uri:c.artist.uri}):null,children:(0,F.jsx)(w.Link,{title:c.artist?.name,to:c.artist?.uri,className:"ellipsis-one-line",dir:"auto",draggable:!0,onDragStart:M,onClick:()=>L("artist_link",c.artist?.uri),children:c.artist?.name})})})]}),(0,F.jsx)(y.x,{as:"p",variant:"marginal",className:b()("ellipsis-one-line",X),children:(0,F.jsx)(A.JL,{value:"/buddyfeed_context",children:(0,F.jsx)(v._,{menu:xe(c.context?.uri,c.artist?.uri),children:(0,F.jsxs)(w.Link,{title:c.context?.name,to:c.context?.uri,className:$,draggable:!0,onDragStart:B,onClick:()=>L("context_link",c.context?.uri),children:[(0,F.jsx)(U.t,{type:fe(j),iconSize:16,className:G}),(0,F.jsx)("span",{dir:"auto",className:"ellipsis-one-line",children:c.context?.name})]})})})})]})]},t.user.uri):null};function he({friends:e,spec:s}){return(0,F.jsx)(h.U5,{flipKey:e.map((e=>e.user.uri)).join(""),children:(0,F.jsx)("ol",{children:e.map(((e,a)=>(0,F.jsx)(h.$3,{flipId:e.user.uri,children:(0,F.jsx)("li",{children:(0,F.jsx)(ge,{friend:e,show:a<100,spec:s},e.user.uri)})},e.user.uri)))})})}var je=a(92075),be=a(3533),ye=a(29380),pe=a(97154),Ne=a(39505),ve=(a(46758),a(53321),a(49857)),ke=a(45540),Ce=a(7863),Le=a(61408),Ie=a(394),Ee=a(60637);const Se="w5nHQ74JGTytKwWanjvB",we="u11kJflcqt7CSXo9qL_T",Oe="MmENkh6tW0MyjTtTtPHZ",Te="Gl0dkNQbAyNjVZ1IpghI",Ue=({name:e,following:s,imageUrl:a,uri:n})=>{const d=(0,Ie.q)(),c=(0,x.o)(),o=i.createRef(),[u,m]=(0,i.useState)(s);(0,Ee.d)(Le.rA.OPERATION_COMPLETE,(e=>{if(e.data.uris.includes(n))switch(e.data.operation){case Le.BM.FOLLOW_USER:m(!0);break;case Le.BM.UNFOLLOW_USER:m(!1)}}));const f=(0,i.useCallback)((()=>{u?d.unfollowUsers([n]):(d.followUsers([n]),c({intent:"follow",type:"click",itemIdSuffix:"buddyfeed"})),o.current&&o.current.blur()}),[u,o,n,d,c]);return(0,i.useEffect)((()=>{m(s)}),[s]),(0,F.jsxs)("div",{className:Se,children:[(0,F.jsx)(N.q,{label:e,width:40,userIconSize:"small",images:(0,i.useMemo)((()=>[{width:40,height:40,url:a}]),[a])}),(0,F.jsxs)("div",{className:b()(we,"ellipsis-one-line"),children:[(0,F.jsx)(y.x,{as:"p",variant:"bodySmallBold",className:"ellipsis-one-line",children:e}),u&&(0,F.jsx)(y.x,{as:"p",variant:"marginal",className:"ellipsis-one-line",children:l.ag.get("following")})]}),(0,F.jsx)("div",{className:Oe,children:(0,F.jsx)(r.E,{className:Te,size:"sm",ref:o,onClick:f,ariaLabel:u?l.ag.get("buddy-feed.button.remove-friend"):l.ag.get("buddy-feed.button.add-friend"),icon:u?Ce.k:t.t})})]})},Ae="main-buddyFeed-friendsList";function De({facebookFriends:e}){return(0,F.jsx)("div",{className:Ae,children:e.map((({uri:e,following:s,title:a,image:i})=>(0,F.jsx)(Ue,{uri:e,name:a,imageUrl:i,following:s},`fb-friend-${e}`)))})}var Me=a(56839);const Be="main-buddyFeed-loadingFriends";function _e(){return(0,F.jsx)("div",{className:Be,children:Array(20).fill(0).map(((e,s)=>(0,F.jsx)(Me.C,{isLoading:!0,charCount:100,as:"p",variant:"titleSmall"},s)))})}var Fe=a(41194),Pe=a(1494);const ze="pZFwflwH1vXVCmAO5vbz",Je="yPL55nV5rC97vJhAf7ke",Ye="qpgo9DQ9rVZbO5pLJog5",Ke="A3hvkJOGkBNa6zWj6oZa",Ze="pIyez6N1SF3jW0U5VUx4",qe="lIxuZR4lYTrEKkMYedty",He="VEmC3OHK3uAasHvO5OuA",Re="wzGPtuvvLpOpY1PDu4Qv",We="YoJTUV4hazVCFNbfKoNq",Ve=({onBackButtonClick:e})=>{const[s,a]=(0,i.useState)(""),{isLoading:t,friends:n}=(e=>{const s=(0,Pe.I)(),a=e.trim().toLowerCase(),{data:i,isLoading:t}=(0,Fe.a)({queryKey:["useFacebookFriends"],queryFn:async()=>(await s.fetchFacebookFriends()).sort(((e,s)=>e.title>s.title?1:-1))});return{isLoading:t,friends:i?.filter((({title:e})=>-1!==e.trim().toLowerCase().indexOf(a)))??[]}})(s),d=(0,ve.y1)((e=>{a(e.target.value)}),100),c=(0,i.useCallback)((e=>{null!==e&&e.focus()}),[]);return(0,F.jsxs)("div",{className:ze,children:[(0,F.jsx)(r.E,{ariaLabel:l.ag.get("buddy-feed.button.back"),onClick:e,ref:c,className:Je,icon:je.e,size:"sm",testId:"back-to-friends"}),(0,F.jsxs)("div",{className:Ye,children:[(0,F.jsx)("div",{className:Ke,children:(0,F.jsx)(ye.z,{className:Ze,size:"large"})}),(0,F.jsx)("div",{className:qe,children:t?(0,F.jsx)(Me.C,{isLoading:!0,charCount:25,as:"p",variant:"bodySmall"}):(0,F.jsx)(y.x,{as:"p",variant:"bodySmall",children:l.ag.get("buddy-feed.number-of-friends",n.length)})})]}),t?(0,F.jsx)(_e,{}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:He,children:[(0,F.jsx)(ke.j,{className:We,size:"small",role:"presentation"}),(0,F.jsx)("input",{onChange:d,className:Re,placeholder:l.ag.get("buddy-feed.find-in-playlists")})]}),(0,F.jsx)(De,{facebookFriends:n})]})]})};var Qe=a(29608);function Ge({isOpen:e,onClose:s,onConfirm:a}){return(0,F.jsx)(Qe.Q,{onClose:s,"aria-label":l.ag.get("web-player.buddy-feed.connect-with-facebook-title"),onConfirm:a,titleText:l.ag.get("web-player.buddy-feed.connect-with-facebook-title"),descriptionText:l.ag.get("web-player.buddy-feed.connect-with-facebook-description"),cancelText:l.ag.get("queue.cancel-button"),confirmText:l.ag.get("web-player.buddy-feed.connect-button"),isOpen:e})}let Xe=function(e){return e[e.LOADING=0]="LOADING",e[e.CONNECTED=1]="CONNECTED",e[e.DISCONNECTED=2]="DISCONNECTED",e}({});const $e="EmZCbU1_B_J9RAHebolL",es="Ym6Yyx83U7mNKOMw9dxw",ss="NXcZaSipzomJ6d4_nM94",as="b9rqRkvRvhrSY4FYHQVC",is="xHc_2FQr3NxfCgfDSVhY",ts="QAJYN0xWh3h2A5d8_C1g",ns="PKhH1CknobkjJdVITsb4",ls="HgRmCE3NxfiYNtv6pF3H",rs="HnA5mipUMkheAlbxqCn_",ds="mvp0xhvZTo0xv0TIwi9u",cs=e=>{const s=(0,x.o)(),{onBackButtonClick:a,feedIsEmpty:t,goToAddFriends:n=!1}=e,d=function(){const e=(0,Pe.I)(),[s,a]=(0,i.useState)(Xe.LOADING);return(0,i.useEffect)((()=>e.subscribeToFacebookConnectionState((e=>{a(e.connection?Xe.CONNECTED:Xe.DISCONNECTED)})).cancel),[e]),s}(),c=(0,Pe.I)(),[o,u]=(0,i.useState)(!1),[m,f]=(0,i.useState)(!1),[g,h]=(0,i.useState)(!1),j=(0,i.useCallback)((e=>{null!==e&&e.focus()}),[]),b=(0,i.useCallback)((()=>{location.reload()}),[]);if(m)return(0,F.jsxs)("div",{className:rs,children:[(0,F.jsx)(r.E,{onClick:a,ref:j,className:ss,ariaLabel:l.ag.get("buddy-feed.button.back"),icon:je.e,size:"sm"}),(0,F.jsxs)("div",{className:ds,children:[(0,F.jsx)(y.x,{as:"h1",variant:"bodyMediumBold",className:es,children:l.ag.get("error-dialog.generic.header")}),(0,F.jsx)(y.x,{as:"p",variant:"bodySmall",className:as,children:l.ag.get("error-dialog.generic.body")}),(0,F.jsx)(be.D,{colorSet:"invertedLight",onClick:b,children:l.ag.get("error.reload")})]})]});const p=(n||g)&&d===Xe.CONNECTED;return(0,F.jsxs)("div",{className:$e,children:[p&&(0,F.jsx)(Ve,{onBackButtonClick:()=>{t&&h(!1),a()}}),!p&&(0,F.jsxs)("div",{className:ts,children:[(0,F.jsx)(r.E,{ariaLabel:l.ag.get("buddy-feed.button.back"),onClick:a,className:ss,ref:j,icon:je.e,size:"sm"}),(0,F.jsx)(y.x,{as:"h1",variant:"bodyMediumBold",className:es,children:l.ag.get("buddy-feed.friend-activity")}),(0,F.jsx)(y.x,{as:"p",variant:"bodySmall",className:as,children:l.ag.get("buddy-feed.facebook.connect-with-friends-default")}),(0,F.jsx)("div",{className:ns,children:(0,F.jsx)(be.D,{className:ls,size:"small",iconLeading:ye.z,UNSAFE_colorSet:(0,pe.Ev)("#2374E1",Ne.ixZ),onClick:()=>{s({intent:"connect-to-facebook",type:"click",itemIdSuffix:"buddyfeed"}),d!==Xe.CONNECTED?u(!0):h(!0)},children:l.ag.get("buddy-feed.facebook.button")})}),(0,F.jsx)(y.x,{as:"p",variant:"marginal",className:is,children:l.ag.get("buddy-feed.facebook.disclaimer")}),(0,F.jsx)(Ge,{isOpen:o,onClose:()=>{u(!1)},onConfirm:()=>{c.connectToFacebook().then((()=>{h(!0),u(!1)})).catch((()=>{f(!0)}))}})]})]})};var os=a(36275),us=a(80956);const ms=({showOnlineIndicator:e})=>(0,F.jsxs)("div",{className:te,children:[(0,F.jsxs)("div",{className:ne,children:[(0,F.jsx)(us.f,{size:"medium"}),e?(0,F.jsx)("div",{className:le}):null]}),(0,F.jsxs)("div",{className:re,children:[(0,F.jsx)("div",{className:b()(de,ce)}),(0,F.jsx)("div",{className:de}),(0,F.jsx)("div",{className:de})]})]}),xs=()=>(0,F.jsxs)("div",{"data-testid":"buddy-feed-empty-state",className:ae,children:[(0,F.jsx)(y.x,{as:"p",className:ie,children:l.ag.get("buddy-feed.let-followers-see-your-listening")}),(0,F.jsx)(ms,{showOnlineIndicator:!0}),(0,F.jsx)(ms,{showOnlineIndicator:!0}),(0,F.jsx)(ms,{}),(0,F.jsx)(y.x,{as:"p",className:ie,children:l.ag.get("buddy-feed.enable-share-listening-activity")}),(0,F.jsx)(os.rU,{to:"/preferences",className:oe,children:(0,F.jsx)(be.D,{colorSet:"invertedLight",className:ue,children:l.ag.get("desktop.settings.settings")})})]});var fs=a(35260),gs=a(81558);const hs="jUF2eKgYMm64aYykubct",js="zhL_lhJqzKfJVy7L5VuY",bs="XqquM_o2eODcnD8Y4QhS",ys="UGtycHBJ4egymBSmD_lX",ps="ND2ydDPzwQZB7HyaGCN8",Ns="D9YN554UFGJle2CPP1TA",vs="v7Zcy9UKVUTDZIMKB6ZF",ks="RX3U6eAasqazEkuFdnj0",Cs=({children:e,page:s})=>{const a=0===s,i=e.filter(((e,a)=>a!==s));return(0,F.jsx)(fs.Z,{component:null,children:i.map((e=>(0,F.jsx)(gs.Z,{in:a,timeout:500,classNames:{enter:a?hs:ps,enterActive:a?js:Ns,exit:a?bs:vs,exitActive:a?ys:ks},children:e},a?"first-page":"second-page")))})},Ls=({friends:e})=>{const s=(0,x.o)(),a=(0,g.$P)(),{spec:h}=(0,g.fU)(n.J,{});(0,i.useEffect)((()=>{s({intent:"view",type:"impression",itemIdSuffix:"buddyfeed"})}),[s]),(0,i.useEffect)((()=>{a.logImpression(h.impression())}),[a,h]);const[j,b]=(0,i.useState)(!1),y=()=>{j||a.logInteraction(h.addFriendButtonFactory().hitUiReveal()),b(!j)},p=0===e.length,N=(0,i.useCallback)((()=>{a.logInteraction(h.closeButtonFactory().hitUiHide())}),[a,h]);return(0,F.jsx)(f.DJ.Provider,{value:"buddy_feed",children:(0,F.jsx)(c.l,{label:l.ag.get("buddy-feed.friend-activity"),children:(0,F.jsxs)(Cs,{page:j?1:0,children:[(0,F.jsx)("div",{className:J,children:(0,F.jsx)(cs,{onBackButtonClick:y,feedIsEmpty:p,goToAddFriends:j})}),(0,F.jsx)("div",{className:Y,children:(0,F.jsxs)(o.K,{children:[(0,F.jsx)(u.V,{title:l.ag.get("buddy-feed.friend-activity"),panel:m.s.BuddyFeed,onClose:N,actions:(0,F.jsx)(d.ws,{label:l.ag.get("buddy-feed.add-friends"),children:(0,F.jsx)(r.E,{ariaLabel:l.ag.get("buddy-feed.add-friends"),testId:"add-friends-button",size:"sm",onClick:y,icon:t.t})})}),(0,F.jsx)("div",{className:ee,children:(0,F.jsx)(r.E,{ariaLabel:l.ag.get("buddy-feed.add-friends"),className:se,size:"sm",onClick:y,icon:t.t})}),p?(0,F.jsx)(xs,{}):(0,F.jsx)(he,{friends:e,spec:h})]})})]})})})}}}]);
//# sourceMappingURL=xpui-routes-buddy-feed.js.map