PageSourceSearch

https://app.hightouch.com/assets/charts-1rlWgAhq.js

js hightouch.com collected 2026-09-24 07:25:03 UTC 6,100 bytes, 2 lines download raw bytes

1import{af as e,aw as s,bZ as B,r as f,bO as Q}from"./vendor-B2oIjyY4.js";import{va as W,cN as w,C as k,c8 as C,b9 as X,aj as b,y as S,BZ as Y,b as q,d9 as G,gh as H,ji as J,B_ as V,jm as K,w as ee,j as te,dk as ae,cr as v,R as x,T as re,I as se,dl as ne,dm as ie,l as oe,e5 as ce,n as le,o as A,bR as O,is as he,ae as de,b8 as ue,N as ge,gl as m}from"./main-CJK8sxkW.js";import{L as pe}from"./last-updated-Cvo02YKE.js";import{u as me}from"./use-row-select-BPlnPrQL.js";import{c as ye,a as ve}from"./saved-charts-drawer-BjfFDm8T.js";import{a as N}from"./goals-D8-c9H1L.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-BqgCVUWx.js";import"./drawer-uoKBN2zN.js";import"./common-DtlkiB79.js";const xe=({isOpen:n,selectedRows:t,onSuccess:l,onClose:h})=>{const{toast:i}=S(),u=W(),g=async()=>{try{await u.mutateAsync({ids:t}),X("Bulk Deleted Saved Analytics Charts"),i({id:"delete-chart",title:`Deleted ${s("chart",t.length,!0)}`,variant:"success"}),l()}catch(d){b(d),i({id:"delete-chart",title:`Failed to delete ${s("chart",t.length,!0)}`,message:d.message,variant:"error"})}};return e.jsx(w,{confirmButtonText:"Delete",isOpen:n,title:`Delete ${s("chart",t.length)}`,variant:"danger",onClose:h,onConfirm:g,children:e.jsxs(k,{gap:4,children:[e.jsxs(C,{children:["Are you sure you want to delete"," ",s("this",t.length)," ",s("chart",t.length,t.length>1),"?"]}),e.jsxs(C,{children:["Deletion of a chart is not reversible, you will not be able to restore"," ",t.length>1?"these":"it"," afterwards."]})]})})},Ce=({isOpen:n,selectedRows:t,onSuccess:l,onClose:h})=>{const{toast:i}=S(),u=Y(),g=async()=>{try{await u.mutateAsync({ids:t}),i({id:"archive-chart",title:`Archived ${s("chart",t.length,!0)}`,variant:"success"}),l()}catch(d){b(d),i({id:"archive-chart",title:`Failed to archive ${s("chart",t.length,!0)}`,message:d.message,variant:"error"})}};return e.jsx(w,{confirmButtonText:"Archive",isOpen:n,title:`Archive ${s("chart",t.length)}`,variant:"danger",onClose:h,onConfirm:g,children:e.jsxs(k,{gap:2,children:[e.jsxs(C,{children:["Are you sure you want to archive"," ",s("this",t.length)," ",s("chart",t.length,t.length>1),"?"]}),e.jsx(C,{children:"You may restore it from the archived tab."})]})})};var I=(n=>(n.Name="name",n.ChartType="chart_type",n.UpdatedAt="updated_at",n))(I||{});const L={key:"updated_at",direction:m.Desc,label:"Recently updated"},je=[{key:"name",direction:m.Asc,label:"Name A → Z"},{key:"name",direction:m.Desc,label:"Name Z → A"},{key:"chart_type",direction:m.Asc,label:"Chart type A → Z"},{key:"chart_type",direction:m.Desc,label:"Chart type Z → A"},L,{key:"updated_at",direction:m.Asc,label:"Least recently updated"}],$=[{title:"Active",path:"active",variant:"table"},{title:"Archived",path:"archived",variant:"table"}],fe={active:{title:"No active charts",image:N,body:"Create a chart to get started"},archived:{title:"No archived charts",image:N,body:""}},$e=()=>Q().pathname.split("/").pop()==="analytics"?e.jsx(ge,{to:"active",replace:!0}):e.jsx(Ae,{}),Ae=()=>{var M,P,_;const n=q(),{toast:t}=S(),l=B(),h=B(),[i,u]=f.useState(""),{limit:g,offset:d,page:F,setPage:T}=G({defaultSortKey:"updated_at",sortOptions:Object.values(I)}),Z=H(L,je),{selectedRows:o,onRowSelect:p}=me(),{activeTab:r}=J($,3),E=f.useMemo(()=>{const a={archived_at:{_is_null:(r==null?void 0:r.path)!=="archived"}};return i&&(a.name={_ilike:`%${i}%`}),a},[i,r==null?void 0:r.path]),R=V(),U=async()=>{try{await R.mutateAsync({ids:o}),t({id:"restore-chart",title:`Restored ${s("chart",o.length,!0)}`,variant:"success"}),p([])}catch(a){b(a),t({id:"restore-chart",title:`Failed to restore ${s("chart",o.length,!0)}`,message:a.message,variant:"error"})}},j=K({limit:g,filters:E,orderBy:Z,offset:d},{notifyOnChangeProps:"tracked",keepPreviousData:!0}),z=((M=j.data)==null?void 0:M.saved_analytics_charts)??[],D=((_=(P=j.data)==null?void 0:P.saved_analytics_charts_aggregate.aggregate)==null?void 0:_.count)??0;return f.useEffect(()=>{p([]),u("")},[r==null?void 0:r.path]),e.jsxs(ee,{heading:"Charts",tabDepth:3,tabs:$,actions:e.jsxs(e.Fragment,{children:[o.length>0&&e.jsxs(oe,{children:[e.jsx(ce,{isDisabled:o.length===0,children:"Actions"}),e.jsxs(le,{children:[(r==null?void 0:r.path)==="active"&&e.jsxs(A,{icon:O,variant:"danger",onClick:h.onOpen,children:["Archive ",s("chart",o.length)]}),(r==null?void 0:r.path)==="archived"&&e.jsxs(e.Fragment,{children:[e.jsxs(A,{icon:he,onClick:U,children:["Restore ",s("chart",o.length)]}),e.jsxs(A,{icon:O,variant:"danger",onClick:l.onOpen,children:["Delete ",s("chart",o.length)]})]})]})]}),!i&&D===0?null:e.jsx(de,{value:i,onChange:a=>{p([]),u(a.target.value)},placeholder:"Search charts…"}),e.jsx(ue,{variant:"primary",href:"/analytics/new",children:"Create chart"})]}),children:[e.jsx(te,{loading:j.isLoading,columns:[{name:"Name",cell:({name:a,description:c})=>e.jsxs(k,{overflow:"hidden",children:[e.jsx(v,{fontWeight:"medium",children:a}),c&&e.jsx(v,{size:"sm",color:"text.secondary",children:c})]})},{name:"Chart type",cell:({chart_type:a})=>{const c=ye(a),y=ve(a);return e.jsxs(x,{align:"center",gap:2,children:[e.jsx(x,{align:"center",color:"text.secondary",fontSize:"20px",justify:"center",children:c}),e.jsx(v,{message:y,children:y})]})}},{name:"Parent model",cell:({parent_model:a})=>{var c,y;return a?e.jsxs(x,{gap:2,align:"center",overflow:"hidden",children:[e.jsx(se,{name:(c=a.connection)==null?void 0:c.definition.name,src:(y=a.connection)==null?void 0:y.definition.icon}),e.jsx(v,{children:a.name})]}):e.jsx(re,{color:"text.secondary",children:"Unknown parent model"})}},{...pe}],data:z,onSelect:p,selectedRows:o,onRowClick:({id:a},c)=>ae(`/analytics/${a}`,n,c),placeholder:fe[(r==null?void 0:r.path)??"active"]}),e.jsx(x,{px:ne.X,py:4,children:e.jsx(ie,{label:"charts",count:D,page:F,setPage:T,rowsPerPage:g})}),e.jsx(Ce,{isOpen:h.isOpen,onClose:h.onClose,onSuccess:()=>{h.onClose(),p([])},selectedRows:o.map(String)}),e.jsx(xe,{isOpen:l.isOpen,onClose:l.onClose,onSuccess:()=>{l.onClose(),p([])},selectedRows:o.map(String)})]})};export{Ae as ChartsPage,$e as ChartsRoot};
2//# sourceMappingURL=charts-1rlWgAhq.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.