1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1484],{1484:function(e,r,s){s.r(r),s.d(r,{default:function(){return _}});var n=s(85893),t=s(52978),l=s(32737),a=s(25253),i=s(80108),o=s(10230),d=s(18318),u=s(78833),c=s(1637),x=s(67294),p=s(11163),g=s(8663),h=function(e){let{renderTrigger:r}=e,s=(0,g.pm)(),h=(0,p.useRouter)(),[f,v]=(0,x.useState)(),j=(0,x.useCallback)(async e=>{let{formData:r,actions:n}=e,{name:l}=r;n.setSubmitting(!0);try{let{id:e}=await t.wZ({name:l});h.replace("/groups/".concat(e))}catch(e){s({variant:"danger",content:e.message})}finally{n.setSubmitting(!1),v(!1)}},[s,h]);return(0,n.jsx)(a.Z,{title:"Create group",width:"md",renderTrigger:r,open:f,children:(0,n.jsx)(o.Z,{onSubmit:j,children:e=>{let{isValid:r,isSubmitting:s}=e;return(0,n.jsxs)(c.FA,{gap:"16px",children:[(0,n.jsx)(c.FA,{gap:"16px",children:(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(d.Z.Label,{children:"Name"}),(0,n.jsx)(u.Z,{name:"name",placeholder:"Group name",autoFocus:!0,required:!0})]})}),(0,n.jsx)(i.Z,{sx:{mx:"-16px"}}),(0,n.jsxs)(c.sL,{gap:"8px",sx:{justifyContent:"flex-end"},children:[(0,n.jsx)(a.Z.Close,{asChild:!0,children:(0,n.jsx)(l.Z,{type:"button",variant:"secondary",children:"Cancel"})}),(0,n.jsx)(l.Z,{disabled:!r,isLoading:s,children:"Continue"})]})]})}})})},f=s(35157),v=s(39403),j=s(4179),y=s(36309),m=s(88933),b=s(39302),Z=s(11575),C=s(91269),w=s(97270),S=s(59734),G=s(86979),q=s(21239);function F(){var e,r,s,t,a,i,o,d,g;let F=(0,p.useRouter)(),{user:_}=(0,q.Z)(),[A,I]=(0,x.useState)(null===(e=F.query)||void 0===e?void 0:e.query),L=(0,G.Z)(A);(0,x.useEffect)(()=>{var e;F.replace({query:{query:L,orderBy:(null===(e=F.query)||void 0===e?void 0:e.orderBy)||void 0}},null,{shallow:!0,scroll:!1})},[L]);let U=(0,x.useMemo)(()=>({name:L||""}),[null==_?void 0:_.id,L,F.query]),{currentPage:B,pageSize:M,pageArgs:k}=(0,m.h)({currentPage:null===(r=F.query)||void 0===r?void 0:r.page}),D=(0,x.useMemo)(()=>{var e;return{orderBy:[(null===(e=F.query)||void 0===e?void 0:e.orderBy)||"ID_DESC"]}},[F.query]),$=(0,S.ZP)(["\n query ListUserGroups($userGroupFilter: UserGroupFilter, $first: Int, $offset: Int, $orderBy: [UserGroupModelOrder]) {\n listUserGroups(filters: $userGroupFilter, first: $first, offset: $offset, orderBy: $orderBy) {\n id\n name\n }\n _listUserGroupsMeta(filters: $userGroupFilter) {\n count\n }\n }\n",{userGroupFilter:U,...D,...k}]),E=(0,x.useMemo)(()=>{var e,r;return(null===(r=$.data)||void 0===r?void 0:null===(e=r._listUserGroupsMeta)||void 0===e?void 0:e.count)>0},[null===(s=$.data)||void 0===s?void 0:s._listUserGroupsMeta]),W=(0,x.useCallback)(e=>{let r=new URLSearchParams(document.location.search);return r.set("page",e),"?".concat(r.toString())},[]);return(0,n.jsxs)(y.Z,{children:[(0,n.jsx)(c.FA,{gap:"8px",sx:{mb:"24px",flexWrap:"wrap"},children:(0,n.jsxs)(c.sL,{gap:"8px",sx:{alignItems:"center",justifyContent:"space-between",flexWrap:"wrap"},children:[(0,n.jsxs)(c.sL,{gap:"8px",sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)(C.Z,{as:"h1",sx:{fontSize:"24px"},children:"Groups"}),E&&(0,n.jsx)(f.Z,{children:null===(a=$.data)||void 0===a?void 0:null===(t=a._listUserGroupsMeta)||void 0===t?void 0:t.count})]}),(0,n.jsx)(c.sL,{gap:"8px",sx:{flexWrap:"wrap",alignItems:"center"},children:(0,n.jsx)(h,{renderTrigger:()=>(0,n.jsx)(l.Z,{size:"sm",children:"Create group"})})})]})}),(0,n.jsxs)(c.FA,{gap:"12px",sx:{mb:"24px"},children:[(0,n.jsxs)(c.sL,{gap:"8px",sx:{flexWrap:"wrap"},children:[(0,n.jsx)(u.Z,{type:"search",placeholder:"Find a groupâ¦",value:A||"",onChange:e=>I(e.target.value),sx:{flex:1}}),(0,n.jsxs)(b.Z,{onChange:e=>{F.query={...F.query,orderBy:e.target.value},F.push(F)},sx:{width:"200px"},children:[(0,n.jsx)("option",{value:"ID_DESC",children:"Sort by: Newest"}),(0,n.jsx)("option",{value:"UPDATED_AT_DESC",children:"Sort by: Recently updated"}),(0,n.jsx)("option",{value:"NAME_ASC",children:"Sort by: Name"})]})]}),[A||""].some(Boolean)&&(0,n.jsxs)(l.Z,{variant:"secondary",onClick:()=>{I(null),F.replace({query:{}})},sx:{alignSelf:"flex-start",bg:"transparent",border:0,p:0},children:[(0,n.jsx)(w.Z,{fill:"currentColor"}),"Clear current filter"]})]}),$.isLoading?(0,n.jsx)(v.Z,{display:"flex",flex:"1",alignItems:"center",justifyContent:"center",children:(0,n.jsx)(Z.Z,{})}):E?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.FA,{gap:"1px",sx:{bg:"var(--accents-2)",border:"1px solid var(--accents-2)",borderRadius:"8px",overflow:"hidden"},children:null===(o=$.data)||void 0===o?void 0:null===(i=o.listUserGroups)||void 0===i?void 0:i.map(e=>(0,n.jsxs)(c.sL,{as:j.Z,href:"/groups/".concat(null==e?void 0:e.id),gap:"16px",sx:{alignItems:"flex-start",p:"12px",bg:"var(--color-base-2)",flexWrap:"wrap",":hover":{backgroundColor:"var(--accents-1)"}},children:[(0,n.jsx)(v.Z,{borderRadius:"9999px",bg:"var(--accents-2)",size:"32px",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",color:"var(--color-base-1)",sx:{textTransform:"uppercase"},children:"G"}),(0,n.jsx)(c.FA,{gap:"4px",children:(0,n.jsx)(c.sL,{gap:"8px",sx:{alignItems:"center"},children:(0,n.jsx)(C.Z,{pt:"4px",sx:{fontWeight:600,color:"var(--color-base-1)"},children:null==e?void 0:e.name})})})]},null==e?void 0:e.id))}),(0,n.jsx)(m.Z,{count:null===(g=$.data)||void 0===g?void 0:null===(d=g._listUserGroupsMeta)||void 0===d?void 0:d.count,currentPage:B,pageSize:M,hrefBuilder:W,pageAs:j.Z})]}):(0,n.jsx)(v.Z,{sx:{display:"flex",flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"4px"},children:A?(0,n.jsx)(n.Fragment,{children:"No results"}):(0,n.jsx)(v.Z,{sx:{display:"flex",flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"4px",cursor:"pointer"},children:(0,n.jsx)(h,{renderTrigger:()=>(0,n.jsxs)(v.Z,{sx:{borderRadius:"8px",background:"var(--accents-2)",width:["64vw","64vw","420px"],padding:"15px",textAlign:"center",color:"var(--accents-5)",":hover":{color:"var(--accents-8)"}},children:[(0,n.jsx)(C.Z,{as:"h1",fontSize:"14px",fontWeight:"600",children:"Create your first group"}),(0,n.jsx)(C.Z,{as:"p",fontSize:"12px",color:"var(--accents-5)",children:"Groups are a flexible tool for segmenting your partners."})]})})})})]})}F.requireAuth=!0,F.meta={title:"Groups"};var _=F}}]);
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.