1import{ae as me,r as i,af as t,ao as pe,aw as _}from"./vendor-B2oIjyY4.js";import{b as ge,dO as he,eu as be,ev as fe,d9 as xe,ew as je,ex as ve,ey as ye,ez as De,eA as we,eB as Se,eC as ke,v as Ce,dk as Te,eD as Me,eE as E,cr as _e,R as F,I as Fe,T as P,H as A,bM as Pe,l as Le,e5 as Ee,n as Ae,o as L,cX as Re,eF as Be,bR as Ve,an as Ie,b8 as ze,b9 as He,eG as Oe,ae as $e,p as Ne,e6 as Ue,eH as Ge,y as Qe,eI as We,aj as Ke}from"./main-CJK8sxkW.js";import{d as Xe}from"./destination-BvUTRLv7.js";import{S as Ye}from"./search-CVbYxP5X.js";import{E as qe}from"./edit-label-modal-CsT9qBwO.js";import{L as Je}from"./labels-CElxcmDz.js";import{R as Ze}from"./label-form-BwQlS3dY.js";import{P as et}from"./page-sidebar-G_JmoCRW.js";import{B as tt}from"./bulk-delete-confirmation-modal-DqFzHg7i.js";import{P as st}from"./page-table-C4zCAIoK.js";import{L as at}from"./last-updated-Cvo02YKE.js";import{u as nt}from"./use-row-select-BPlnPrQL.js";import"./types-WJ9Oe6Nf.js";import{E as it}from"./types-ypUuiJby.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-BqgCVUWx.js";import"./constants-B2IlNFDy.js";import"./use-is-large-screen-DsZTTpYS.js";import"./constants-N3epm-gR.js";import"./page-sidebar-container-DumuwXR6.js";import"./sidebar-toggle-button-C7zP6_E7.js";var R=(a=>(a.Name="name",a.Type="definition.name",a.UpdatedAt="updated_at",a))(R||{});const rt=()=>{const{toast:a}=Qe(),j=ge(),[l,v]=me(),[p,B]=he("search"),y=l.get("oauthFailed"),D=l.get("errorMessage");i.useEffect(()=>{y==="true"&&(a({id:"oauth-failed",title:"Authorization failed",message:D??void 0,variant:"error"}),l.delete("oauthFailed"),l.delete("errorMessage"),v(l,{replace:!0}))},[y,D,a,l,v]);const[V,w]=i.useState(!1),{selectedRows:n,onRowSelect:h}=nt(),[I,S]=i.useState(!1),{mutateAsync:z}=be(),{mutateAsync:H}=fe(),{sortKey:k,sortDirection:C,columnSortState:b}=xe({defaultSortKey:"updated_at",sortOptions:Object.values(R)}),O=()=>{var s,r,c,u;const e={_and:[{type:(s=d.destination)!=null&&s.isAllSelected?{}:{_in:(r=d.destination)==null?void 0:r.selected.map(m=>m.id)}},We(d.label),(c=d.created)!=null&&c.isAllSelected?{}:{_or:[{created_by:{_in:(u=d.created)==null?void 0:u.selected.map(m=>m.id)}},{created_by:{_is_null:!0}}]}]};return p&&e._and.push({name:{_ilike:`%${p}%`}}),e},{data:g,isLoading:f}=je(void 0,{select:e=>e.destinations}),$=i.useMemo(()=>({viewKey:"destination",loading:f,filters:{destination:{options:De(g||[]),title:"Type"},created:{options:ye(g||[]),title:"Created by"},label:{options:ve(g||[]),title:"Labels"}}}),[g]),{result:{state:d,data:N},state:{creatingView:U,selectedView:G,viewNotSaved:Q,views:W,updatingView:K},actions:{createView:X,deleteView:Y,selectView:q,updateCurrentView:J,resetViewFilters:Z,clearFilters:ee}}=we($),te=i.useMemo(()=>O(),[p,d]),{data:o,error:se,isLoading:ae}=Se({filters:te},{enabled:!f,select:e=>e.destinations}),x=i.useMemo(()=>({name:e=>{var s;return e.name??((s=e.definition)==null?void 0:s.name)??"Private destination"}}),[]),ne=i.useMemo(()=>o&&ke(o,k,C,x),[o,k,C,x]),ie=async()=>{const e=n.length,s=_("destination",e);try{await H({ids:n.map(String),stringIds:n.map(String)}),a({id:"bulk-delete-destinations",title:`Deleted ${e} ${s}`,variant:"success"}),h([])}catch(r){a({id:"bulk-delete-destinations",title:`Failed to delete ${s}`,variant:"error"}),Ke(r)}},re=i.useMemo(()=>({image:Ye,title:"No destinations found",error:"Destinations failed to load, please try again."}),[]),{data:oe}=Ce(!0),{overageLockout:T,destinationOverageText:le}=oe.overage,de=le+" To create a destination, upgrade your plan.",ce=i.useMemo(()=>n.some(e=>{var r;const s=o==null?void 0:o.find(c=>c.id===e);return(r=s==null?void 0:s.event_forwarding_syncs)==null?void 0:r.some(c=>{var u;return(u=c.event_forwarding_sync_sources)==null?void 0:u.some(m=>{var M;return((M=m.event_source)==null?void 0:M.type)===it.CEP})})}),[n,o]),ue=i.useCallback(({id:e},s)=>Te(`/destinations/${e}/configuration`,j,s),[j]);return t.jsx(Me,{permission:{v2:{resource:"destination",grant:"can_create"}},children:t.jsxs(E,{contentFlush:!0,sidebar:t.jsx(et,{hideRightBorder:!0,header:t.jsx($e,{width:"100%",placeholder:"Search all destinationsâ¦",value:p??"",onChange:e=>{B(e.target.value)}}),children:t.jsx(Oe,{clearFilters:ee,createView:X,creatingView:U,deleteView:Y,f
1ilters:N,resetFilters:Z,resource:"destination",selectView:q,selectedView:G,updateCurrentView:J,updatingView:K,viewNotSaved:Q,views:W})}),title:"Destinations",children:[t.jsx(st,{header:t.jsxs(t.Fragment,{children:[t.jsx(A,{isTruncated:!0,size:"xl",children:"Destinations"}),t.jsxs(Pe,{size:"lg",children:[n.length>0&&t.jsxs(F,{align:"center",gap:4,children:[t.jsx(P,{children:`${_("destination",n.length,!0)} selected`}),t.jsxs(Le,{children:[t.jsx(Ee,{children:"Actions"}),t.jsxs(Ae,{children:[t.jsx(L,{icon:Re,onClick:()=>{S(!0)},children:"Add labels"}),!ce&&t.jsxs(t.Fragment,{children:[t.jsx(Be,{}),t.jsx(L,{icon:Ve,variant:"danger",onClick:()=>{w(!0)},children:"Delete"})]})]})]})]}),t.jsx(Ie,{isDisabled:!T,message:de,children:t.jsx(ze,{href:"/destinations/new",isDisabled:T,variant:"primary",onClick:()=>{He("Add Destination Clicked")},children:"Add destination"})})]})]}),columns:[{name:"Name",...b("name"),cell:e=>t.jsx(_e,{isTruncated:!0,fontWeight:"medium",children:x.name(e)})},{name:"Type",...b("definition.name"),cell:({definition:e})=>t.jsxs(F,{align:"center",gap:2,overflow:"hidden",children:[t.jsx(Fe,{name:e==null?void 0:e.name,src:e==null?void 0:e.icon}),t.jsx(P,{isTruncated:!0,fontWeight:"medium",children:(e==null?void 0:e.name)??"Private destination"})]})},{...at,...b("updated_at"),breakpoint:"md"},{name:"Labels",cell:({tags:e})=>pe.isEmpty(e)?"--":t.jsx(Je,{labels:e}),breakpoint:"md"}],data:ne,error:!!se,loading:ae||f,placeholder:re,selectedRows:n,onRowClick:ue,onSelect:h}),t.jsx(tt,{count:n.length,isOpen:V,label:"destination",onClose:()=>w(!1),onDelete:ie}),t.jsx(qe,{rows:n.length,isOpen:I,resourceType:Ze.Destination,onClose:()=>S(!1),onSubmit:async e=>{const s=n.map(r=>z({id:String(r),append:{tags:e}}));await Promise.all(s),h([])}})]})})},Mt=()=>{const{resources:a}=Ne();return a!=null&&a.destination?t.jsx(rt,{}):t.jsxs(E,{title:"Destinations",children:[t.jsx(A,{mb:8,size:"xl",children:"Destinations"}),t.jsx(Ue,{content:{image:Xe,title:"No destinations in this workspace",body:"A destination is where your data will be sent. Hightouch supports 250+ popular destinations, including CRMs like Salesforce, marketing automation tools like HubSpot, and ad platforms like Google. You can also build your own destination.",button:t.jsx(Ge,{href:"/destinations/new",permission:{v2:{resource:"destination",grant:"can_create"}},variant:"primary",children:"Add destination"})}})]})};export{rt as Destinations,Mt as Element}; 2//# sourceMappingURL=destinations-BEGxL0DL.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.