PageSourceSearch

https://app.hightouch.com/assets/sources-DNjpi5Mh.js

js hightouch.com collected 2026-10-01 07:47:29 UTC 4,473 bytes, 2 lines download raw bytes

1import{b3 as N,r as u,af as s,ba as U,bb as z,bI as F,ay as G,az as $,aG as K}from"./vendor-BgWhiDrf.js";import{rU as q,p as X,rW as Y,rM as J,sC as V,sD as Z,C as E,j as ee,R as o,I as T,cr as se,L as ne,T as j,l as te,f9 as ae,n as oe,fa as re,bS as ce,G as _,d3 as ie,H as de,X as le,Y as ue,S as me,fj as ye,cb as he,i as pe,cP as xe,sE as Se,rN as je,y as ge}from"./main-COyT_q74.js";import{e as g}from"./types-DyceCyeS.js";import{E as k}from"./types-ypUuiJby.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-34qQJjVh.js";const ve=({resource:t,syncId:a})=>({v2:{resource:t,grant:"can_update",id:a}}),Ee=()=>{var I,M;const t=q(),{workspace:a,user:m}=X(),{toast:v}=ge(),f=N(),[P,r]=u.useState(!1),[y,C]=u.useState([]),[c,h]=u.useState(null),b=t.type==="warehouse",p=t.sync,A=b?"event_warehouse_sync":"event_forwarding_sync",d=Y(t)?t.sync.event_warehouse_sync_sources.map(({event_source:e})=>e):t.sync.event_forwarding_sync_sources.map(({event_source:e})=>e),l=d.map(e=>e.id),R=u.useMemo(()=>new Set(l),[l]),W=(m==null?void 0:m.can_impersonate)===!0,x=J(void 0,{select:e=>e.event_sources.filter(n=>!R.has(n.id)&&n.type!==k.CEP&&(W||n.type!==k.ONSITE))}),Q=V(),B=Z(),S=ve({resource:A,syncId:p.id}),D=async()=>{await Promise.all([a!=null&&a.id?f.invalidateQueries(Se.getKey({id:p.id,workspaceId:a.id})):Promise.resolve(),f.invalidateQueries(je.getKey())])},w=async e=>{const n=b?Q:B;try{return await n.mutateAsync({id:p.id,event_source_ids:e}),await D(),v({id:"update-event-sync-sources",title:"Sources updated",variant:"success"}),!0}catch(i){return v({id:"update-event-sync-sources",title:"There was a problem updating your sources.",message:i.message,variant:"error"}),!1}},O=async e=>w(l.filter(n=>n!==e)),H=async()=>{await w([...l,...y])&&(C([]),r(!1))},L=e=>{C(n=>n.includes(e)?n.filter(i=>i!==e):[...n,e])};return s.jsxs(E,{flex:1,minWidth:0,children:[s.jsx(ee,{data:d,columns:[{name:"Source",cell:e=>{const n=g[e.type];return s.jsxs(o,{align:"center",gap:2,overflow:"hidden",width:"100%",children:[s.jsx(T,{size:6,name:(n==null?void 0:n.name)??e.type,src:n==null?void 0:n.icon}),s.jsx(se,{isTruncated:!0,fontWeight:"medium",message:e.name,children:s.jsx(ne,{href:`/events/sources/${e.id}`,children:e.name})})]})}},{name:"Type",cell:e=>{var n;return s.jsx(j,{color:"text.secondary",children:((n=g[e.type])==null?void 0:n.name)??e.type})}},{max:"max-content",cell:e=>s.jsx(o,{justify:"flex-end",children:s.jsxs(te,{children:[s.jsx(ae,{"aria-label":`Actions for ${e.name}`,onClick:n=>n.stopPropagation()}),s.jsx(oe,{children:s.jsx(re,{permission:S,variant:"danger",icon:ce,isDisabled:d.length<=1,tooltip:d.length<=1?"A sync must have at least one source.":!1,onClick:n=>{n.stopPropagation(),h(e)},children:"Remove"})})]})})}],placeholder:{title:"No sources",body:"This sync is not connected to any sources."}}),s.jsx(o,{p:4,justify:"flex-end",children:s.jsx(_,{permission:S,icon:ie,onClick:()=>r(!0),children:"Add sources"})}),s.jsxs(U,{isCentered:!0,isOpen:P,onClose:()=>r(!1),children:[s.jsx(z,{}),s.jsxs(F,{p:0,maxHeight:"85%",my:"auto",children:[s.jsx(G,{p:4,children:s.jsxs(o,{align:"center",justify:"space-between",width:"100%",children:[s.jsx(de,{children:"Add sources"}),s.jsx(le,{"aria-label":"Close modal.",icon:ue,onClick:()=>r(!1)})]})}),s.jsx($,{p:4,mt:0,children:x.isLoading?s.jsx(me,{}):((I=x.data)==null?void 0:I.length)===0?s.jsx(j,{color:"text.secondary",children:"No sources available to add."}):s.jsx(ye,{children:s.jsx(E,{gap:3,children:(M=x.data)==null?void 0:M.map(e=>{const n=g[e.type],i=y.includes(e.id);return s.jsxs(o,{align:"center",gap:2,as:"label",htmlFor:e.id,children:[s.jsx(he,{id:e.id,"aria-label":e.name,isChecked:i,onChange:()=>L(e.id)}),s.jsx(T,{size:5,name:(n==null?void 0:n.name)??e.type,src:n==null?void 0:n.icon}),s.jsx(j,{fontWeight:"medium",children:e.name})]},e.id)})})})}),s.jsx(K,{p:4,borderTopWidth:"hairline",borderTopStyle:"solid",borderColor:"base.border",children:s.jsxs(o,{gap:2,justify:"flex-end",width:"100%",children:[s.jsx(pe,{variant:"secondary",onClick:()=>r(!1),children:"Cancel"}),s.jsx(_,{permission:S,isDisabled:y.length===0,onClick:H,children:"Add sources"})]})})]})]}),s.jsx(xe,{isOpen:c!==null,title:"Remove source?",onConfirm:async()=>{c&&!await O(c.id)||h(null)},onClose:()=>h(null),confirmButtonText:"Remove",variant:"danger",children:c?`"${c.name}" will no longer send events to this sync.`:null})]})};export{Ee as EventSyncSources};
2//# sourceMappingURL=sources-DNjpi5Mh.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.