PageSourceSearch

https://app.hightouch.com/assets/event-detail-C9qPSRUU.js

js hightouch.com collected 2026-09-24 07:24:33 UTC 7,045 bytes, 2 lines download raw bytes

1import{r as g,af as e,aw as B,as as _,aJ as A}from"./vendor-B2oIjyY4.js";import{IN as P,R as m,dH as f,a$ as w,T as u,e as C,b as I,C as j,H as N,j as k,L as z,I as S,c4 as V,IO as M,kJ as $,w as U,i as R,ad as F}from"./main-CJK8sxkW.js";import{c as H,d as W}from"./utils-Cex3K4B7.js";import{E as Y}from"./event-type-badge-CeXOx8N9.js";import{u as J,n as O}from"./urls-CchGUaiy.js";import{D as X}from"./divider-jVHnrtnN.js";import{A as q}from"./add-to-domain-modal-Bcu4Lke9.js";import{D as Q}from"./domain-badges-B5OO_79w.js";import{u as y,f as G,E as K}from"./event-volume-summary-display-xWJtN2JI.js";import{e as Z}from"./types-WJ9Oe6Nf.js";import"./index-tMcD_ZuD.js";import"./types-3TI9bhGX.js";import"./property-suggestions-BI-lsJWT.js";import{e as E}from"./utils-DnDWukUz.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-BqgCVUWx.js";import"./use-collected-event-observations-B3GfDdxR.js";import"./use-domains-DiBI2RIt.js";import"./use-event-library-CgrcTVYz.js";import"./icon-stack-Bc-6S09d.js";import"./types-ypUuiJby.js";const ee=({domainIds:i,eventName:o,eventType:l})=>{const{data:s,isLoading:a,isFetching:n}=P({domain_ids:i,name:o,event_type:l},{enabled:i.length>0,select:c=>c.event_schemas,keepPreviousData:!0});return{latestVersionByDomainId:g.useMemo(()=>{const c=new Map;for(const p of s??[])c.set(p.event_plan_id,p.event_version);return c},[s]),isLoading:i.length>0&&(a||n)}},D="--",T=({label:i,value:o,isLoading:l=!1,delta:s,subtext:a})=>e.jsxs(w,{flex:1,gap:1,p:4,children:[e.jsx(u,{size:"sm",fontWeight:"medium",color:"text.secondary",children:i}),e.jsx(C,{isLoading:l,children:e.jsxs(m,{align:"baseline",gap:2,children:[e.jsx(u,{size:"lg",fontWeight:"semibold",children:o}),s&&e.jsx(u,{size:"sm",fontWeight:"medium",color:"text.secondary",children:s})]})}),a&&e.jsx(u,{size:"sm",color:"text.secondary",children:a})]}),ne=({eventName:i,eventType:o,sourceIds:l,uncontractedSources:s})=>{const a=y({sourceIds:l,eventName:i,eventType:o}),n=y({sourceIds:s.map(d=>d.id),eventName:i,eventType:o});return e.jsxs(m,{gap:4,children:[e.jsx(T,{label:"Total volume 24hr",isLoading:a.isLoading,value:a.volume===null?D:f(a.volume),delta:a.deltaPercent===null?null:G(a.deltaPercent)}),e.jsx(T,{label:"Uncontracted volume 24hr",isLoading:n.isLoading,value:s.length===0?"0":n.volume===null?D:f(n.volume),subtext:s.length>0?`${B("source",s.length,!0)} without contract`:"All sources are under contract"})]})},b="--",L=(i,o)=>{var l,s,a,n;return(((l=i.source)==null?void 0:l.name)??"").localeCompare(((s=o.source)==null?void 0:s.name)??"")||(((a=i.domain)==null?void 0:a.name)??"").localeCompare(((n=o.domain)==null?void 0:n.name)??"")},te=(i,o)=>{const l=i.map(n=>({id:`uncontracted:${n.id}`,source:n,domain:null})),s=[],a=[];for(const n of o){const d={id:n.id,name:n.name};if(n.sources.length===0){a.push({id:`domain:${n.id}`,source:null,domain:d});continue}for(const c of n.sources)s.push({id:`contracted:${n.id}:${c.id}`,source:c,domain:d})}return[...l.sort(L),...s.sort(L),...a.sort((n,d)=>{var c,p;return(((c=n.domain)==null?void 0:c.name)??"").localeCompare(((p=d.domain)==null?void 0:p.name)??"")})]},se=({eventName:i,eventType:o,uncontractedSources:l,contractedDomains:s,onAddToDomain:a})=>{const n=I(),d=g.useMemo(()=>te(l,s),[l,s]),c=g.useMemo(()=>s.map(t=>t.id),[s]),{latestVersionByDomainId:p,isLoading:h}=ee({domainIds:c,eventName:i,eventType:o});return e.jsxs(j,{gap:4,children:[e.jsx(N,{size:"md",children:"Sources & domains"}),e.jsx(w,{p:0,overflow:"hidden",children:e.jsx(k,{columns:[{name:"Source",cell:({source:t})=>{if(!t)return e.jsx(u,{color:"text.secondary",children:"No source connected"});const r=Z[t.type];return e.jsx(m,{overflow:"hidden",onClick:x=>x.stopPropagation(),children:e.jsx(z,{href:`/events/sources/${t.id}`,children:e.jsxs(m,{align:"center",gap:2,children:[e.jsx(S,{size:6,name:(r==null?void 0:r.name)??t.type,src:r==null?void 0:r.icon}),e.jsx(u,{children:t.name})]})})})}},{name:"Domain contract",cell:({domain:t})=>t?e.jsxs(m,{align:"center",gap:2,overflow:"hidden",children:[e.jsx(V,{shape:"square",size:"sm",name:t.name,hideTooltip:!0}),e.jsx(u,{children:t.name})]}):e.jsx(m,{align:"center",gap:2,overflow:"hidden",onClick:r=>{r.stopPropagation(),a()},children:e.jsx(M,{variant:"subtle",children:"No contract"})})},{name:"Version",max:"max-content",cell:({domain:t})=>{if(!t)return e.jsx(u,{color:"text.secondary",children:b});if(h)return e.jsx(C,{isLoading:!0,children:e.jsx(u,{children:"0"})});const r=p.get(t.id);return e.jsx(u,{color:r?void 0:"text.secondary",children:r??b})}},{name:"24hr volume",max:"auto",cellSx:{justifyContent:"right"},headerSx:{justifyContent:"right"},cell:({source:t})=>e.jsx(K,{sourceIds:t?[t.id]:[],eventName:i,eventType:o})}],data:d,placeholder:{title:"No sources or domains",body:"No source is sending this event and no domain contract declares it."},onRowClick:({source:t,domain:r})=>{const x=r?p.get(r.id):null;r?h||n(`/events/domains/${r.id}/${H({eventName:i,eventType:o,eventVersion:x??void 0})}`):t&&n(`/events/sources/${t.id}`)}})})]})},Le=()=>{const{event_type_and_name:i}=_(),{eventType:o,eventName:l}=W(i),s=I(),{isLoading:a,event:n,uncontractedSources:d,contractedDomains:c}=J({eventName:l??null,eventType:o??""}),[p,h]=g.useState(!1);if(!a&&!n)return e.jsx($,{});const t=n==null?void 0:n.domains,r=(n==null?void 0:n.updatedByUserName)??(n==null?void 0:n.createdByUserName),x=E[o]??E.track;return e.jsxs(U,{title:l??"Event",crumbs:[{label:"Event library",link:"/events/library"}],variant:"card",header:e.jsxs(j,{flex:1,gap:2,children:[e.jsxs(m,{flex:1,justify:"space-between",align:"center",pt:1,gap:4,children:[e.jsxs(m,{gap:2,align:"center",children:[e.jsx(N,{size:"lg",children:l??e.jsxs(m,{align:"center",gap:2,children:[e.jsx(x,{}),A(o??void 0)]})}),!!o&&!!l&&e.jsx(Y,{eventType:o})]}),e.jsx(R,{variant:"primary",onClick:()=>h(!0),children:"Add to domain"})]}),e.jsx(m,{children:e.jsx(u,{color:"text.secondary",children:"Every source and domain contract collecting this event across your workspace."})}),e.jsxs(m,{align:"center",gap:3,children:[(n==null?void 0:n.updatedAt)&&e.jsxs(e.Fragment,{children:[e.jsxs(m,{align:"center",gap:2,children:[e.jsxs(u,{color:"text.secondary",children:["Last updated: ",F(n.updatedAt)," ",r&&"by"]}),r&&e.jsx(V,{size:"sm",name:r})]}),!!(t!=null&&t.length)&&e.jsx(X,{direction:"vertical"})]}),!!(t!=null&&t.length)&&e.jsx(Q,{domains:t})]})]}),children:[n&&e.jsxs(j,{gap:6,children:[e.jsx(ne,{eventName:n.eventName,eventType:n.eventType,sourceIds:n.sourceIds,uncontractedSources:d}),e.jsx(se,{eventName:n.eventName,eventType:n.eventType,uncontractedSources:d,contractedDomains:c,onAddToDomain:()=>h(!0)})]}),e.jsx(q,{isOpen:p,onClose:()=>h(!1),title:"Add to domain",description:"Choose the domain that should declare this event. You'll define its schema on the next page.",excludedDomainIds:c.map(v
1=>v.id),emptyText:"Every domain already declares this event.",onContinue:v=>s(O({domainId:v,eventType:o,eventName:l}))})]})};export{Le as EventDetail};
2//# sourceMappingURL=event-detail-C9qPSRUU.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.