Build 533169stable
Module 166393
1,824 characters · in cbd3cdf765d69cec.jsDependencies
Source Raw
function(e,t,a){a.d(t,{A:()=>S});var n=a(627968),i=a(64700),l=a(503698),s=a.n(l),r=a(172218),o=a(724002),c=a(287174),d=a(487899),u=a(239314),m=a(311907),h=a(397927),p=a(111162),_=a(354138),g=a(111042),x=a(412461),A=a(867333),f=a(487953),b=a(111737),C=a(652215),v=a(242552);let j=c.K.APPLICATION_DIRECTORY;function I(e){let{collection:t,index:a,onSelectApplication:l}=e,o=function(e){let{collectionId:t,index:a}=e,[n,l]=i.useState(!1),s=(0,r.K)(e=>{e&&l(!0)});return i.useEffect(()=>{n&&(0,x.TR)(C.HAw.APP_DIRECTORY_COLLECTION_VIEWED,{collection_id:t,collection_position:a})},[n,t,a]),s}({collectionId:t.id,index:a}),c=i.useCallback((e,n)=>{(0,x.TR)(C.HAw.APP_DIRECTORY_COLLECTION_ITEM_CLICKED,{collection_id:t.id,item_position:n,collection_position:a,application_id:e}),l(e)},[t.id,a,l]);return(0,n.jsxs)("div",{ref:o,children:[(0,n.jsx)(h.Heading,{className:s()(v.Gf,{[v.SH]:0===a}),variant:"heading-lg/semibold",color:"text-strong",children:t.title}),(0,n.jsx)("div",{className:v.Qs,children:t.application_directory_collection_items.map((e,t)=>e.type!==d.L.APPLICATION||null==e.application?null:(0,n.jsx)(f.A,{application:e.application,onSelectApplication:()=>c(e.application.id,t),showCategory:!0},e.id))})]})}let S=function(e){let{onSelectApplication:t}=e,a=(0,m.bG)([p.default],()=>p.default.onlyShowPreviewAppCollections)?o.W.PREVIEW:o.W.ACTIVE,l=(0,m.bG)([g.A],()=>g.A.getFetchState({surface:j,activeState:a})),s=(0,m.bG)([g.A],()=>g.A.getCollections({surface:j,activeState:a}));i.useEffect(()=>{_.An({surface:j,activeState:a})},[a]);let r=i.useMemo(()=>s?.filter(e=>e.type!==u.Y.GALLERY),[s]);return l===g.e.ERROR?(0,n.jsx)("div",{className:v.Un,children:(0,n.jsx)(b.A,{className:v.z3})}):(0,n.jsx)(A.A,{loading:l===g.e.FETCHING,children:r?.map((e,a)=>(0,n.jsx)(I,{collection:e,index:a,onSelectApplication:t},a))})}}