1import{j as e,r as P,v as Y,x as G}from"./vendor-mantine-BR5daWbi.js";import{B as N,p as K,r as L,c as W,T as A,l as M,m as B,u as $,y as J,N as Q}from"./index-Bo80QBJz.js";import{E as X,a as Z,b as ee,c as se,d as te,e as ae}from"./empty-state-card-BTiaNSWM.js";import{u as ne,t as re}from"./integration-DTerdtU7.js";import{S as C}from"./skeleton-DCJ2U9rU.js";import{T as ie,a as oe,b as le,c as I,d as de,e as ce,f as v}from"./table-BTWCedQG.js";import{T as me}from"./table-placeholder-BThowTm8.js";import{C as pe}from"./customization-badge-DjhVq30c.js";import{D as ue,a as ge,b as xe,d as D,e as E,c as T,f as je}from"./dropdown-menu-eEVxwbFP.js";import{f as fe,g as he,r as be}from"./integration-types-Bt3tiieh.js";import{L as z,u as ye,b as Ie,N as Te}from"./vendor-react-CvsrXiTQ.js";import{I as Ce,a as Ne,D as _e,r as we}from"./delete-integration-modal-CXugp1BZ.js";import{p as Se,aV as Pe,a0 as ve,ap as De,ao as Ee,H as ke,aC as Le}from"./vendor-icons-ywK6O-a8.js";import{I as Ae}from"./integration-type-ornament-DmkssjFV.js";import{I as Me}from"./integration-type-icon-8HXjIKJc.js";import{u as Be,T as ze}from"./table-columns-menu-C03UP6-y.js";import{u as Oe,P as Re,a as He,b as Ue}from"./page-layout-D_FYPouV.js";import{u as Ve}from"./use-analytics-CiL_51B4.js";import{P as qe}from"./page-header-help-NbHP697b.js";import{P as Fe}from"./platform-bar-DESVsJ7x.js";import{P as Ye}from"./project-selector-container-BDvuQrkr.js";import{W as Ge}from"./warning-banners-DfIHwpVk.js";import"./vendor-data-BEEH8umM.js";import"./vendor-baseui-uAQgzSok.js";import"./vendor-syntax-BxWJNGeb.js";import"./vendor-markdown-KnfJHi8i.js";import"./vendor-charts-BzGwKu8R.js";import"./zendesk-icon-Bk6_5jzr.js";import"./icon-tile-XhXgePdA.js";import"./use-is-mobile-HBahKhNX.js";import"./combobox-roBEXobY.js";import"./input-CD4K4QyY.js";import"./filter-button-D77GyeLG.js";import"./access-badge-DY7ykNIp.js";import"./project-color-CX0vPodY.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"30ecadcb485edf38c71e62214c8874da90fe716f"}}catch{}})();try{(function(){var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="2c96ffd5-c25c-4a70-9b58-25621ad2e480",s._sentryDebugIdIdentifier="sentry-dbid-2c96ffd5-c25c-4a70-9b58-25621ad2e480")})()}catch{}const O=({integration:s,detailHref:t,canEdit:r,onDelete:n})=>{const i=s.is_setup_complete&&!s.is_enabled?fe(s.integration_type)?.installGuideUrl:void 0;return e.jsx("span",{className:"flex items-center justify-end",children:e.jsxs(ue,{children:[e.jsx(ge,{render:e.jsx(N,{variant:"ghost",size:"icon-sm","aria-label":`Actions for ${s.name}`}),children:e.jsx(Se,{stroke:1.2})}),e.jsxs(xe,{align:"end",className:"w-auto min-w-48",children:[e.jsxs(D,{children:[e.jsx(E,{children:"Actions"}),t?e.jsxs(T,{render:e.jsx(z,{to:t}),children:[e.jsx(Pe,{stroke:1.2}),r?"Configure":"View"]}):null,s.clipboard_button_data?e.jsx(Ce,{label:s.clipboard_button_data.label,value:s.clipboard_button_data.value}):null,i?e.jsxs(T,{render:e.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer"}),children:[e.jsx(ve,{stroke:1.2}),"Learn how"]}):null]}),e.jsx(je,{}),e.jsxs(D,{children:[e.jsx(E,{children:"Danger zone"}),e.jsxs(T,{variant:"destructive",onClick:()=>n(s.id),disabled:!r,children:[e.jsx(De,{stroke:1.2}),"Delete"]})]})]})]})})};O.displayName="IntegrationActionsCell";const R=({name:s,integrationType:t})=>e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(Ae,{size:"md",type:t}),e.jsx("span",{className:"text-foreground text-headline break-words",children:s})]});R.displayName="IntegrationNameCell";const H=({integrationType:s})=>e.jsxs(K,{variant:"secondary",className:"inline-flex items-center gap-1",children:[e.jsx(Me,{type:s}),he(s)]});H.displayName="IntegrationTypeCell";const Ke=6,U=[{id:"name",label:"Name",isPermanent:!0,headClassName:"min-w-40",skeleton:e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(C,{className:"size-8 shrink-0 rounded-md"}),e.jsx(C,{className:"h-4 w-32"})]}),cell:s=>e.jsx(R,{name:s.name,integrationType:s.integration_type})},{id:"type",label:"Type",cell:s=>e.jsx(H,{integrationType:s.integration_type})},{id:"description",label:"Description",headClassName:"min-w-40",cell:s=>s.description?e.jsxs(A,{children:[e.jsx(M,{render:e.jsx("span",{tabIndex:0,className:"line-clamp-2 break-words",children:s.description})}),e.jsx(B,{side:"bottom",align:"start",children:s.description})]}):null},{id:"status",label:"Status",cell:s=>e.jsx(Ne,{isSetupComplete:s.is_setup_complete,isEnabled:s.is_enabled})},{id:"customization",label:"Customization",cell:s=>s.customization_data.name?e.jsx(pe,{name:s.customization_data.name}):null},{id:"actions",label:"Actions",isPermanent:!0,isLabelHidden:!0,cell:(s,t)=>e.jsx(O,{integration:s,detailHref:t.detailHref,canEdit:t.canEdit,onDelete:t.onDelete})}],We=U.filter(s=>!s.isPermanent).map(s=>({id:s.id,label:s.label})),k={title:"Could not load integrations",description:"The request failed before any integrations came back. Trying again usually resolves it."},V=({rows:s,isLoading:t,isError:r,onRetry:n,projectId:i,canEdit:u,columnVisibility:g,onOpenIntegration:x,onDelete:m,className:f})=>{const l=U.filter(a=>a.isPermanent||g[a.id]!==!1),h=!t&&r&&s.length===0;return e.jsx(ie,{className:W("min-h-0 flex-1",f),children:e.jsxs(oe,{"aria-label":"Integrations",children:[e.jsx(le,{children:e.jsx(I,{children:l.map(a=>e.jsx(de,{className:a.headClassName,children:a.isLabelHidden?e.jsx("span",{className:"sr-only",children:a.label}):a.label},a.id))})}),e.jsxs(ce,{children:[t&&Array.from({length:Ke},(a,d)=>e.jsx(I,{children:l.map(o=>e.jsx(v,{children:o.skeleton??e.jsx(C,{className:"h-4 w-3/4 max-w-40"})},o.id))}
1,d)),h&&e.jsx(me,{colSpan:l.length,title:k.title,description:k.description,action:n?e.jsx(N,{variant:"secondary",onClick:n,children:"Try again"}):null}),!t&&s.map(a=>{const d=i?L.integration.build({project:i,id:a.id}):null,o={detailHref:d,canEdit:u,onDelete:m};return e.jsx(I,{onRowClick:d?()=>x(d):void 0,children:l.map(p=>e.jsx(v,{children:p.cell(a,o)},p.id))},a.id)})]})]})})};V.displayName="IntegrationsTable";const $e=({isLoading:s,isError:t,count:r})=>!s&&!t&&r===0,Je={description:!1},Qe=s=>s?null:e.jsxs(e.Fragment,{children:["Only ",e.jsx("b",{children:"Owners"})," can manage integrations"]}),Ls=()=>{const s=$(),{capture:t}=Ve(),r=ye(),n=s.project.selected?.id,[i,u]=P.useState(null),[g]=Ie(),x=be(g.get("addIntegration")),m=s.project.selected?.permissions?.all.includes("edit_project")??!1,f=s.project.selected?.permissions?.all.includes("edit_sources")??!1,{data:l,isLoading:h,isError:a,refetch:d}=ne(n),o=P.useMemo(()=>[...l??[]].sort((c,y)=>c.name.localeCompare(y.name)),[l]),p=Oe(h),j=$e({isLoading:p,isError:a,count:o.length}),{columnVisibility:_,onColumnVisibilityChange:q}=Be("integrations-column-visibility",Je),b=Qe(m),w=n?L.integrationNew.build({project:n}):"",S=e.jsxs(N,{variant:"brand",nativeButton:!1,disabled:b!==null,onClick:()=>t("integration_add_clicked",{origin:"integrations_list"}),render:e.jsx(z,{to:w}),children:[e.jsx(Le,{stroke:1.2,"data-icon":"inline-start"}),"Add integration"]});return x&&n&&m?e.jsx(Te,{to:J(w,{type:x,source:re(g.get("source"))}),replace:!0}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{onClose:()=>u(null),id:i,onDeleted:()=>t("integration_deleted",{integration_type:we(o.find(c=>c.id===i)?.integration_type??"")})}),e.jsx(Re,{slots:{banner:e.jsx(Ge,{}),sidebar:e.jsx(Q,{}),content:e.jsx(He,{hasSelfScrollingBody:!j,slots:{header:e.jsx(Ue,{title:"Integrations"}),help:e.jsx(qe,{label:"About Integrations",children:"Manage your deployments of Kapa"}),actions:b?e.jsxs(A,{children:[e.jsx(M,{render:e.jsx("span",{tabIndex:0,children:S})}),e.jsx(B,{children:e.jsx(G,{size:"xs",children:b})})]}):S,filtersLeft:e.jsx(Ye,{}),filtersRight:j?null:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(ze,{columns:We,columnVisibility:_,onToggleColumn:(c,y)=>q(F=>({...F,[c]:y}))})}),info:f||j?void 0:e.jsx(Y,{icon:e.jsx(ke,{size:"1rem"}),title:"Permissions Required",color:"gray",children:"You do not have permissions to manage integrations. Please contact your project administrator."}),body:j?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs(X,{align:"center",className:"gap-6",children:[e.jsx(Z,{children:e.jsx(Ee,{size:40,stroke:1.5,className:"text-foreground-tertiary"})}),e.jsx(ee,{children:e.jsxs(se,{children:[e.jsx(te,{children:"No integrations"}),e.jsx(ae,{children:"Integrations are where Kapa answers your users: in a widget on your docs, in Slack or Discord, or through the API."})]})})]})}):e.jsx(V,{rows:o,isLoading:p,isError:a,onRetry:()=>{d()},projectId:n,canEdit:m,columnVisibility:_,onOpenIntegration:c=>{r(c)},onDelete:u})}}),footer:e.jsx(Fe,{})}})]})};export{Ls as default}; 2//# sourceMappingURL=index-DwZcEBkk.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.