@bikdotai/bik-component-library 0.0.850-beta.3 → 0.0.850-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/cjs/components/agent-listing/AiAgentsEmptyState.js +2 -0
- package/dist/cjs/components/agent-listing/AiAgentsEmptyState.js.map +1 -0
- package/dist/esm/components/agent-listing/AgentListing.js +68 -74
- package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/esm/components/agent-listing/AiAgentsEmptyState.d.ts +22 -0
- package/dist/esm/components/agent-listing/AiAgentsEmptyState.js +22 -0
- package/dist/esm/components/agent-listing/AiAgentsEmptyState.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),n=require("react"),U=require("../TablePagination/TablePagination.js"),A=require("./AgentListing.styled.js"),W=require("./AgentListingFilters.js"),X=require("./AgentListingHeader.js"),Y=require("./AgentTable.js"),Z=require("./AgentTableShimmer.js"),ee=require("./AiAgentsEmptyState.js"),te=require("./DeleteAgentModal.js"),ne=require("../dropdown/utils.js"),q=({config:x,onSearchChange:b,onSearchSubmit:r,onFilterChange:g,onSortChange:c,onNewAgent:m,onBrowseTemplates:d,onRunAgent:p,onEditAgent:C,onDeleteAgent:l,onRowClick:u,...L})=>{const[i,h]=n.useState(null),[S,j]=n.useState(!1),{agents:k,isLoading:w,triggerCountsLoading:N,searchValue:f,searchPlaceholder:R="Search",filterOptions:D,filterPlaceholder:T="Filters",sortOptions:z,selectedSort:v,title:E="AI Agents",headerActions:F,pagination:s,emptyState:O,debugLog:y}=x,M=!w&&k.length===0,t=n.useCallback((e,...o)=>{y&&console.log(`[AgentListing] ${e}`,...o)},[y]),H=n.useCallback(e=>{t("onSearchChange",e),b(e)},[t,b]),B=n.useCallback(e=>{t("onSearchSubmit",e),r?.(e)},[t,r]),I=n.useCallback(e=>{t("onFilterChange",e),g?.(e)},[t,g]),V=n.useCallback(e=>{t("onSortChange",e),c?.(e)},[t,c]),P=n.useCallback(()=>{t("onNewAgent"),m()},[t,m]),_=n.useCallback(()=>{t("onBrowseTemplates"),d?.()},[t,d]),$=n.useCallback(e=>{t("onRunAgent",e.id),p(e)},[t,p]),G=n.useCallback(e=>{t("onEditAgent",e.id),C(e)},[t,C]),J=n.useCallback(e=>{t("onRowClick",e.id),u?.(e)},[t,u]),K=n.useCallback(e=>{t("onDeleteAgent",e.id),h(e)},[t]),Q=n.useCallback(async()=>{if(!(!i||!l)){j(!0);try{await l(i),h(null)}finally{j(!1)}}},[i,l]);return a.jsxs(A.Page,{"data-test":L["data-test"]??"agent-listing",children:[a.jsx(X.AgentListingHeader,{title:E,onNewAgent:P,onBrowseTemplates:d?_:void 0,headerActions:F}),a.jsx(W.AgentListingFilters,{searchValue:f,onSearchChange:H,onSearchSubmit:r?B:void 0,searchPlaceholder:R,filterOptions:D,onFilterChange:g?I:void 0,filterPlaceholder:T,sortOptions:z,selectedSort:v,onSortChange:c?V:void 0}),a.jsx(A.Body,{children:w?a.jsx(Z.AgentTableShimmer,{rows:Math.min(s?.pageSize??5,10)}):M?a.jsx(A.EmptyHolder,{children:a.jsx(ee.AiAgentsEmptyState,{emptyState:O,onNewAgent:P})}):a.jsxs(a.Fragment,{children:[a.jsx(Y.AgentTable,{agents:k,triggerCountsLoading:N,onRunAgent:$,onEditAgent:G,onDeleteAgent:l?K:void 0,onRowClick:u?J:void 0}),s&&s.totalRows>0&&a.jsx(U.TablePagination,{pageNumber:s.pageNumber,pageSize:s.pageSize,totalRows:s.totalRows,hidePageSizeOptions:s.hidePageSizeOptions,updatePageNumber:s.onPageChange,updatePageSize:e=>{const o=Number(ne.unwrapDropdownValue(e));Number.isNaN(o)||s.onPageSizeChange(o)}})]})}),i&&a.jsx(te.DeleteAgentModal,{agentName:i.name,isDeleting:S,onClose:()=>S?void 0:h(null),onConfirm:Q})]})};q.displayName="AgentListing";exports.AgentListing=q;
|
|
2
2
|
//# sourceMappingURL=AgentListing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentListing.js","sources":["../../../../src/components/agent-listing/AgentListing.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownOption } from '@src/components/dropdown/type';\nimport { TablePagination } from '@src/components/TablePagination/TablePagination';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\nimport { AgentListingProps, AgentListItem } from './AgentListing.model';\nimport { Body, EmptyHolder, Page } from './AgentListing.styled';\nimport { AgentListingFilters } from './AgentListingFilters';\nimport { AgentListingHeader } from './AgentListingHeader';\nimport { AgentTable } from './AgentTable';\nimport { AgentTableShimmer } from './AgentTableShimmer';\nimport { DeleteAgentModal } from './DeleteAgentModal';\n\n/**\n * Full body of the \"AI Agents\" listing screen (header + filters + table).\n * Presentational and fully controlled — the consumer owns data, search, sort,\n * pagination and routing. Render it inside your app shell (next to the sidebar).\n *\n * @example\n * <AgentListing\n * agents={rows}\n * searchValue={search}\n * onSearchChange={setSearch}\n * onNewAgent={() => router.push('/agents/new')}\n * onRunAgent={runAgent}\n * onEditAgent={(a) => router.push(`/agents/${a.id}`)}\n * />\n */\nexport const AgentListing: React.FC<AgentListingProps> = ({\n\tconfig,\n\tonSearchChange,\n\tonSearchSubmit,\n\tonFilterChange,\n\tonSortChange,\n\tonNewAgent,\n\tonBrowseTemplates,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\t...rest\n}) => {\n\t// Agent pending delete-confirmation (null = dialog closed).\n\tconst [pendingDelete, setPendingDelete] = useState<AgentListItem | null>(\n\t\tnull,\n\t);\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst {\n\t\tagents,\n\t\tisLoading,\n\t\ttriggerCountsLoading,\n\t\tsearchValue,\n\t\tsearchPlaceholder = 'Search',\n\t\tfilterOptions,\n\t\tfilterPlaceholder = 'Filters',\n\t\tsortOptions,\n\t\tselectedSort,\n\t\ttitle = 'AI Agents',\n\t\theaderActions,\n\t\tpagination,\n\t\temptyState,\n\t\tdebugLog,\n\t} = config;\n\n\tconst showEmpty = !isLoading && agents.length === 0;\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentListing] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleSearchChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchChange', v);\n\t\t\tonSearchChange(v);\n\t\t},\n\t\t[logAction, onSearchChange],\n\t);\n\tconst handleSearchSubmit = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchSubmit', v);\n\t\t\tonSearchSubmit?.(v);\n\t\t},\n\t\t[logAction, onSearchSubmit],\n\t);\n\tconst handleFilterChange = useCallback(\n\t\t(selected: DropdownOption | DropdownOption[]) => {\n\t\t\tlogAction('onFilterChange', selected);\n\t\t\tonFilterChange?.(selected);\n\t\t},\n\t\t[logAction, onFilterChange],\n\t);\n\tconst handleSortChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSortChange', v);\n\t\t\tonSortChange?.(v);\n\t\t},\n\t\t[logAction, onSortChange],\n\t);\n\tconst handleNewAgent = useCallback(() => {\n\t\tlogAction('onNewAgent');\n\t\tonNewAgent();\n\t}, [logAction, onNewAgent]);\n\tconst handleBrowseTemplates = useCallback(() => {\n\t\tlogAction('onBrowseTemplates');\n\t\tonBrowseTemplates?.();\n\t}, [logAction, onBrowseTemplates]);\n\tconst handleRunAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRunAgent', agent.id);\n\t\t\tonRunAgent(agent);\n\t\t},\n\t\t[logAction, onRunAgent],\n\t);\n\tconst handleEditAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onEditAgent', agent.id);\n\t\t\tonEditAgent(agent);\n\t\t},\n\t\t[logAction, onEditAgent],\n\t);\n\tconst handleRowClick = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRowClick', agent.id);\n\t\t\tonRowClick?.(agent);\n\t\t},\n\t\t[logAction, onRowClick],\n\t);\n\t// Row delete just opens the confirm dialog; the actual delete runs on confirm.\n\tconst handleDeleteRequest = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onDeleteAgent', agent.id);\n\t\t\tsetPendingDelete(agent);\n\t\t},\n\t\t[logAction],\n\t);\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tif (!pendingDelete || !onDeleteAgent) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsDeleting(true);\n\t\ttry {\n\t\t\tawait onDeleteAgent(pendingDelete);\n\t\t\tsetPendingDelete(null);\n\t\t} finally {\n\t\t\tsetIsDeleting(false);\n\t\t}\n\t}, [pendingDelete, onDeleteAgent]);\n\n\treturn (\n\t\t<Page data-test={rest['data-test'] ?? 'agent-listing'}>\n\t\t\t<AgentListingHeader\n\t\t\t\ttitle={title}\n\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\tonBrowseTemplates={\n\t\t\t\t\tonBrowseTemplates ? handleBrowseTemplates : undefined\n\t\t\t\t}\n\t\t\t\theaderActions={headerActions}\n\t\t\t/>\n\n\t\t\t<AgentListingFilters\n\t\t\t\tsearchValue={searchValue}\n\t\t\t\tonSearchChange={handleSearchChange}\n\t\t\t\tonSearchSubmit={onSearchSubmit ? handleSearchSubmit : undefined}\n\t\t\t\tsearchPlaceholder={searchPlaceholder}\n\t\t\t\tfilterOptions={filterOptions}\n\t\t\t\tonFilterChange={onFilterChange ? handleFilterChange : undefined}\n\t\t\t\tfilterPlaceholder={filterPlaceholder}\n\t\t\t\tsortOptions={sortOptions}\n\t\t\t\tselectedSort={selectedSort}\n\t\t\t\tonSortChange={onSortChange ? handleSortChange : undefined}\n\t\t\t/>\n\n\t\t\t<Body>\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<AgentTableShimmer rows={Math.min(pagination?.pageSize ?? 5, 10)} />\n\t\t\t\t) : showEmpty ? (\n\t\t\t\t\t<EmptyHolder>\n\t\t\t\t\t\t<ZeroState\n\t\t\t\t\t\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\t\t\t\t\t\tsubTitle={\n\t\t\t\t\t\t\t\temptyState?.subTitle ??\n\t\t\t\t\t\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactionButton={\n\t\t\t\t\t\t\t\temptyState?.actionButton ?? {\n\t\t\t\t\t\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\t\t\t\t\t\tbuttonType: 'primary',\n\t\t\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t\t\t\tonClick: handleNewAgent,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EmptyHolder>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AgentTable\n\t\t\t\t\t\t\tagents={agents}\n\t\t\t\t\t\t\ttriggerCountsLoading={triggerCountsLoading}\n\t\t\t\t\t\t\tonRunAgent={handleRunAgent}\n\t\t\t\t\t\t\tonEditAgent={handleEditAgent}\n\t\t\t\t\t\t\tonDeleteAgent={onDeleteAgent ? handleDeleteRequest : undefined}\n\t\t\t\t\t\t\tonRowClick={onRowClick ? handleRowClick : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{pagination && pagination.totalRows > 0 && (\n\t\t\t\t\t\t\t<TablePagination\n\t\t\t\t\t\t\t\tpageNumber={pagination.pageNumber}\n\t\t\t\t\t\t\t\tpageSize={pagination.pageSize}\n\t\t\t\t\t\t\t\ttotalRows={pagination.totalRows}\n\t\t\t\t\t\t\t\thidePageSizeOptions={pagination.hidePageSizeOptions}\n\t\t\t\t\t\t\t\tupdatePageNumber={pagination.onPageChange}\n\t\t\t\t\t\t\t\tupdatePageSize={(opt) => {\n\t\t\t\t\t\t\t\t\tconst value = Number(unwrapDropdownValue(opt));\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(value)) {\n\t\t\t\t\t\t\t\t\t\tpagination.onPageSizeChange(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Body>\n\n\t\t\t{pendingDelete && (\n\t\t\t\t<DeleteAgentModal\n\t\t\t\t\tagentName={pendingDelete.name}\n\t\t\t\t\tisDeleting={isDeleting}\n\t\t\t\t\tonClose={() => (isDeleting ? undefined : setPendingDelete(null))}\n\t\t\t\t\tonConfirm={handleConfirmDelete}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Page>\n\t);\n};\n\nAgentListing.displayName = 'AgentListing';\n"],"names":["AgentListing","config","onSearchChange","onSearchSubmit","onFilterChange","onSortChange","onNewAgent","onBrowseTemplates","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","rest","pendingDelete","setPendingDelete","useState","isDeleting","setIsDeleting","agents","isLoading","triggerCountsLoading","searchValue","searchPlaceholder","filterOptions","filterPlaceholder","sortOptions","selectedSort","title","headerActions","pagination","emptyState","debugLog","showEmpty","logAction","useCallback","action","args","handleSearchChange","v","handleSearchSubmit","handleFilterChange","selected","handleSortChange","handleNewAgent","handleBrowseTemplates","handleRunAgent","agent","handleEditAgent","handleRowClick","handleDeleteRequest","handleConfirmDelete","Page","jsx","AgentListingHeader","AgentListingFilters","Body","AgentTableShimmer","EmptyHolder","ZeroState","jsxs","Fragment","AgentTable","TablePagination","opt","value","unwrapDropdownValue","DeleteAgentModal"],"mappings":"4dA4BaA,EAA4C,CAAC,CACzD,OAAAC,EACA,eAAAC,EACA,eAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,WAAAC,EACA,GAAGC,CACJ,IAAM,CAEL,KAAM,CAACC,EAAeC,CAAgB,EAAIC,EAAAA,SACzC,IAAA,EAEK,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAC5C,CACL,OAAAG,EACA,UAAAC,EACA,qBAAAC,EACA,YAAAC,EACA,kBAAAC,EAAoB,SACpB,cAAAC,EACA,kBAAAC,EAAoB,UACpB,YAAAC,EACA,aAAAC,EACA,MAAAC,EAAQ,YACR,cAAAC,EACA,WAAAC,EACA,WAAAC,EACA,SAAAC,CAAA,EACG9B,EAEE+B,EAAY,CAACb,GAAaD,EAAO,SAAW,EAG5Ce,EAAYC,EAAAA,YACjB,CAACC,KAAmBC,IAAoB,CACnCL,GAEH,QAAQ,IAAI,kBAAkBI,CAAM,GAAI,GAAGC,CAAI,CAEjD,EACA,CAACL,CAAQ,CAAA,EAGJM,EAAqBH,EAAAA,YACzBI,GAAc,CACdL,EAAU,iBAAkBK,CAAC,EAC7BpC,EAAeoC,CAAC,CACjB,EACA,CAACL,EAAW/B,CAAc,CAAA,EAErBqC,EAAqBL,EAAAA,YACzBI,GAAc,CACdL,EAAU,iBAAkBK,CAAC,EAC7BnC,IAAiBmC,CAAC,CACnB,EACA,CAACL,EAAW9B,CAAc,CAAA,EAErBqC,EAAqBN,EAAAA,YACzBO,GAAgD,CAChDR,EAAU,iBAAkBQ,CAAQ,EACpCrC,IAAiBqC,CAAQ,CAC1B,EACA,CAACR,EAAW7B,CAAc,CAAA,EAErBsC,EAAmBR,EAAAA,YACvBI,GAAc,CACdL,EAAU,eA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EAAa,OAAYF,EAAiB,IAAI,EAC9D,UAAWoC,CAAA,CAAA,CACZ,EAEF,CAEF,EAEAlD,EAAa,YAAc"}
|
|
1
|
+
{"version":3,"file":"AgentListing.js","sources":["../../../../src/components/agent-listing/AgentListing.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownOption } from '@src/components/dropdown/type';\nimport { TablePagination } from '@src/components/TablePagination/TablePagination';\nimport { AgentListingProps, AgentListItem } from './AgentListing.model';\nimport { Body, EmptyHolder, Page } from './AgentListing.styled';\nimport { AgentListingFilters } from './AgentListingFilters';\nimport { AgentListingHeader } from './AgentListingHeader';\nimport { AgentTable } from './AgentTable';\nimport { AgentTableShimmer } from './AgentTableShimmer';\nimport { AiAgentsEmptyState } from './AiAgentsEmptyState';\nimport { DeleteAgentModal } from './DeleteAgentModal';\n\n/**\n * Full body of the \"AI Agents\" listing screen (header + filters + table).\n * Presentational and fully controlled — the consumer owns data, search, sort,\n * pagination and routing. Render it inside your app shell (next to the sidebar).\n *\n * @example\n * <AgentListing\n * agents={rows}\n * searchValue={search}\n * onSearchChange={setSearch}\n * onNewAgent={() => router.push('/agents/new')}\n * onRunAgent={runAgent}\n * onEditAgent={(a) => router.push(`/agents/${a.id}`)}\n * />\n */\nexport const AgentListing: React.FC<AgentListingProps> = ({\n\tconfig,\n\tonSearchChange,\n\tonSearchSubmit,\n\tonFilterChange,\n\tonSortChange,\n\tonNewAgent,\n\tonBrowseTemplates,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\t...rest\n}) => {\n\t// Agent pending delete-confirmation (null = dialog closed).\n\tconst [pendingDelete, setPendingDelete] = useState<AgentListItem | null>(\n\t\tnull,\n\t);\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst {\n\t\tagents,\n\t\tisLoading,\n\t\ttriggerCountsLoading,\n\t\tsearchValue,\n\t\tsearchPlaceholder = 'Search',\n\t\tfilterOptions,\n\t\tfilterPlaceholder = 'Filters',\n\t\tsortOptions,\n\t\tselectedSort,\n\t\ttitle = 'AI Agents',\n\t\theaderActions,\n\t\tpagination,\n\t\temptyState,\n\t\tdebugLog,\n\t} = config;\n\n\tconst showEmpty = !isLoading && agents.length === 0;\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentListing] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleSearchChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchChange', v);\n\t\t\tonSearchChange(v);\n\t\t},\n\t\t[logAction, onSearchChange],\n\t);\n\tconst handleSearchSubmit = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchSubmit', v);\n\t\t\tonSearchSubmit?.(v);\n\t\t},\n\t\t[logAction, onSearchSubmit],\n\t);\n\tconst handleFilterChange = useCallback(\n\t\t(selected: DropdownOption | DropdownOption[]) => {\n\t\t\tlogAction('onFilterChange', selected);\n\t\t\tonFilterChange?.(selected);\n\t\t},\n\t\t[logAction, onFilterChange],\n\t);\n\tconst handleSortChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSortChange', v);\n\t\t\tonSortChange?.(v);\n\t\t},\n\t\t[logAction, onSortChange],\n\t);\n\tconst handleNewAgent = useCallback(() => {\n\t\tlogAction('onNewAgent');\n\t\tonNewAgent();\n\t}, [logAction, onNewAgent]);\n\tconst handleBrowseTemplates = useCallback(() => {\n\t\tlogAction('onBrowseTemplates');\n\t\tonBrowseTemplates?.();\n\t}, [logAction, onBrowseTemplates]);\n\tconst handleRunAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRunAgent', agent.id);\n\t\t\tonRunAgent(agent);\n\t\t},\n\t\t[logAction, onRunAgent],\n\t);\n\tconst handleEditAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onEditAgent', agent.id);\n\t\t\tonEditAgent(agent);\n\t\t},\n\t\t[logAction, onEditAgent],\n\t);\n\tconst handleRowClick = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRowClick', agent.id);\n\t\t\tonRowClick?.(agent);\n\t\t},\n\t\t[logAction, onRowClick],\n\t);\n\t// Row delete just opens the confirm dialog; the actual delete runs on confirm.\n\tconst handleDeleteRequest = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onDeleteAgent', agent.id);\n\t\t\tsetPendingDelete(agent);\n\t\t},\n\t\t[logAction],\n\t);\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tif (!pendingDelete || !onDeleteAgent) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsDeleting(true);\n\t\ttry {\n\t\t\tawait onDeleteAgent(pendingDelete);\n\t\t\tsetPendingDelete(null);\n\t\t} finally {\n\t\t\tsetIsDeleting(false);\n\t\t}\n\t}, [pendingDelete, onDeleteAgent]);\n\n\treturn (\n\t\t<Page data-test={rest['data-test'] ?? 'agent-listing'}>\n\t\t\t<AgentListingHeader\n\t\t\t\ttitle={title}\n\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\tonBrowseTemplates={\n\t\t\t\t\tonBrowseTemplates ? handleBrowseTemplates : undefined\n\t\t\t\t}\n\t\t\t\theaderActions={headerActions}\n\t\t\t/>\n\n\t\t\t<AgentListingFilters\n\t\t\t\tsearchValue={searchValue}\n\t\t\t\tonSearchChange={handleSearchChange}\n\t\t\t\tonSearchSubmit={onSearchSubmit ? handleSearchSubmit : undefined}\n\t\t\t\tsearchPlaceholder={searchPlaceholder}\n\t\t\t\tfilterOptions={filterOptions}\n\t\t\t\tonFilterChange={onFilterChange ? handleFilterChange : undefined}\n\t\t\t\tfilterPlaceholder={filterPlaceholder}\n\t\t\t\tsortOptions={sortOptions}\n\t\t\t\tselectedSort={selectedSort}\n\t\t\t\tonSortChange={onSortChange ? handleSortChange : undefined}\n\t\t\t/>\n\n\t\t\t<Body>\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<AgentTableShimmer rows={Math.min(pagination?.pageSize ?? 5, 10)} />\n\t\t\t\t) : showEmpty ? (\n\t\t\t\t\t<EmptyHolder>\n\t\t\t\t\t\t<AiAgentsEmptyState\n\t\t\t\t\t\t\temptyState={emptyState}\n\t\t\t\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EmptyHolder>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AgentTable\n\t\t\t\t\t\t\tagents={agents}\n\t\t\t\t\t\t\ttriggerCountsLoading={triggerCountsLoading}\n\t\t\t\t\t\t\tonRunAgent={handleRunAgent}\n\t\t\t\t\t\t\tonEditAgent={handleEditAgent}\n\t\t\t\t\t\t\tonDeleteAgent={onDeleteAgent ? handleDeleteRequest : undefined}\n\t\t\t\t\t\t\tonRowClick={onRowClick ? handleRowClick : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{pagination && pagination.totalRows > 0 && (\n\t\t\t\t\t\t\t<TablePagination\n\t\t\t\t\t\t\t\tpageNumber={pagination.pageNumber}\n\t\t\t\t\t\t\t\tpageSize={pagination.pageSize}\n\t\t\t\t\t\t\t\ttotalRows={pagination.totalRows}\n\t\t\t\t\t\t\t\thidePageSizeOptions={pagination.hidePageSizeOptions}\n\t\t\t\t\t\t\t\tupdatePageNumber={pagination.onPageChange}\n\t\t\t\t\t\t\t\tupdatePageSize={(opt) => {\n\t\t\t\t\t\t\t\t\tconst value = Number(unwrapDropdownValue(opt));\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(value)) {\n\t\t\t\t\t\t\t\t\t\tpagination.onPageSizeChange(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Body>\n\n\t\t\t{pendingDelete && (\n\t\t\t\t<DeleteAgentModal\n\t\t\t\t\tagentName={pendingDelete.name}\n\t\t\t\t\tisDeleting={isDeleting}\n\t\t\t\t\tonClose={() => (isDeleting ? undefined : setPendingDelete(null))}\n\t\t\t\t\tonConfirm={handleConfirmDelete}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Page>\n\t);\n};\n\nAgentListing.displayName = 'AgentListing';\n"],"names":["AgentListing","config","onSearchChange","onSearchSubmit","onFilterChange","onSortChange","onNewAgent","onBrowseTemplates","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","rest","pendingDelete","setPendingDelete","useState","isDeleting","setIsDeleting","agents","isLoading","triggerCountsLoading","searchValue","searchPlaceholder","filterOptions","filterPlaceholder","sortOptions","selectedSort","title","headerActions","pagination","emptyState","debugLog","showEmpty","logAction","useCallback","action","args","handleSearchChange","v","handleSearchSubmit","handleFilterChange","selected","handleSortChange","handleNewAgent","handleBrowseTemplates","handleRunAgent","agent","handleEditAgent","handleRowClick","handleDeleteRequest","handleConfirmDelete","Page","jsx","AgentListingHeader","AgentListingFilters","Body","AgentTableShimmer","EmptyHolder","AiAgentsEmptyState","jsxs","Fragment","AgentTable","TablePagination","opt","value","unwrapDropdownValue","DeleteAgentModal"],"mappings":"0dA4BaA,EAA4C,CAAC,CACzD,OAAAC,EACA,eAAAC,EACA,eAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,WAAAC,EACA,GAAGC,CACJ,IAAM,CAEL,KAAM,CAACC,EAAeC,CAAgB,EAAIC,EAAAA,SACzC,IAAA,EAEK,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAC5C,CACL,OAAAG,EACA,UAAAC,EACA,qBAAAC,EACA,YAAAC,EACA,kBAAAC,EAAoB,SACpB,cAAAC,EACA,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AAA,KAAAC,EAAAA,SAAA,CACC,SAAA,CAAAR,EAAAA,IAACS,EAAAA,WAAA,CACA,OAAA3C,EACA,qBAAAE,EACA,WAAYyB,EACZ,YAAaE,EACb,cAAerC,EAAgBuC,EAAsB,OACrD,WAAYtC,EAAaqC,EAAiB,MAAA,CAAA,EAE1CnB,GAAcA,EAAW,UAAY,GACrCuB,EAAAA,IAACU,EAAAA,gBAAA,CACA,WAAYjC,EAAW,WACvB,SAAUA,EAAW,SACrB,UAAWA,EAAW,UACtB,oBAAqBA,EAAW,oBAChC,iBAAkBA,EAAW,aAC7B,eAAiBkC,GAAQ,CACxB,MAAMC,EAAQ,OAAOC,GAAAA,oBAAoBF,CAAG,CAAC,EACxC,OAAO,MAAMC,CAAK,GACtBnC,EAAW,iBAAiBmC,CAAK,CAEnC,CAAA,CAAA,CACD,CAAA,CAEF,CAAA,CAEF,EAECnD,GACAuC,EAAAA,IAACc,GAAAA,iBAAA,CACA,UAAWrD,EAAc,KACzB,WAAAG,EACA,QAAS,IAAOA,EAAa,OAAYF,EAAiB,IAAI,EAC9D,UAAWoC,CAAA,CAAA,CACZ,EAEF,CAEF,EAEAlD,EAAa,YAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("../zeroState/ZeroState.js"),i=({emptyState:t,onNewAgent:e})=>o.jsx(n.ZeroState,{title:t?.title??"No agents yet",subTitle:t?.subTitle??"Create your first AI agent to start automating conversations.",actionButton:t?.actionButton??{buttonText:"New AI agent",buttonType:"primary",size:"small",onClick:e}});exports.AiAgentsEmptyState=i;
|
|
2
|
+
//# sourceMappingURL=AiAgentsEmptyState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiAgentsEmptyState.js","sources":["../../../../src/components/agent-listing/AiAgentsEmptyState.tsx"],"sourcesContent":["import React from 'react';\nimport { ButtonProps } from '@src/components/button/model';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\n\nexport interface AiAgentsEmptyStateProps {\n\t/**\n\t * Overrides for the default copy / CTA — e.g. the search-miss variant passes\n\t * \"No results found …\". Any omitted field falls back to the \"no agents yet\"\n\t * defaults below.\n\t */\n\temptyState?: {\n\t\ttitle?: string;\n\t\tsubTitle?: string;\n\t\tactionButton?: ButtonProps;\n\t};\n\t/** Runs the default \"New AI agent\" CTA when no override button is supplied. */\n\tonNewAgent: () => void;\n}\n\n/**\n * Zero state for the AI Agents listing — shown when there are no agents yet or a\n * search returns no hits. Renders the shared {@link ZeroState} with AI-agents\n * defaults; a consumer-supplied `emptyState` overrides any of the copy / CTA.\n */\nexport const AiAgentsEmptyState: React.FC<AiAgentsEmptyStateProps> = ({\n\temptyState,\n\tonNewAgent,\n}) => (\n\t<ZeroState\n\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\tsubTitle={\n\t\t\temptyState?.subTitle ??\n\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t}\n\t\tactionButton={\n\t\t\temptyState?.actionButton ?? {\n\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onNewAgent,\n\t\t\t}\n\t\t}\n\t/>\n);\n"],"names":["AiAgentsEmptyState","emptyState","onNewAgent","jsx","ZeroState"],"mappings":"4JAwBaA,EAAwD,CAAC,CACrE,WAAAC,EACA,WAAAC,CACD,IACCC,EAAAA,IAACC,EAAAA,UAAA,CACA,MAAOH,GAAY,OAAS,gBAC5B,SACCA,GAAY,UACZ,gEAED,aACCA,GAAY,cAAgB,CAC3B,WAAY,eACZ,WAAY,UACZ,KAAM,QACN,QAASC,CAAA,CACV,CAEF"}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as y, jsx as i, Fragment as W } from "react/jsx-runtime";
|
|
2
2
|
import { useState as L, useCallback as n } from "react";
|
|
3
|
-
import { TablePagination as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { TablePagination as X } from "../TablePagination/TablePagination.js";
|
|
4
|
+
import { Page as Y, Body as Z, EmptyHolder as _ } from "./AgentListing.styled.js";
|
|
5
|
+
import { AgentListingFilters as ee } from "./AgentListingFilters.js";
|
|
6
|
+
import { AgentListingHeader as te } from "./AgentListingHeader.js";
|
|
7
|
+
import { AgentTable as ne } from "./AgentTable.js";
|
|
8
|
+
import { AgentTableShimmer as oe } from "./AgentTableShimmer.js";
|
|
9
|
+
import { AiAgentsEmptyState as ie } from "./AiAgentsEmptyState.js";
|
|
10
10
|
import { DeleteAgentModal as ae } from "./DeleteAgentModal.js";
|
|
11
11
|
import { unwrapDropdownValue as re } from "../dropdown/utils.js";
|
|
12
12
|
const se = ({
|
|
13
|
-
config:
|
|
14
|
-
onSearchChange:
|
|
13
|
+
config: z,
|
|
14
|
+
onSearchChange: p,
|
|
15
15
|
onSearchSubmit: l,
|
|
16
16
|
onFilterChange: g,
|
|
17
17
|
onSortChange: d,
|
|
18
|
-
onNewAgent:
|
|
18
|
+
onNewAgent: u,
|
|
19
19
|
onBrowseTemplates: m,
|
|
20
|
-
onRunAgent:
|
|
21
|
-
onEditAgent:
|
|
20
|
+
onRunAgent: f,
|
|
21
|
+
onEditAgent: A,
|
|
22
22
|
onDeleteAgent: r,
|
|
23
23
|
onRowClick: c,
|
|
24
24
|
...D
|
|
25
25
|
}) => {
|
|
26
26
|
const [a, h] = L(
|
|
27
27
|
null
|
|
28
|
-
), [
|
|
29
|
-
agents:
|
|
28
|
+
), [S, w] = L(!1), {
|
|
29
|
+
agents: C,
|
|
30
30
|
isLoading: N,
|
|
31
31
|
triggerCountsLoading: R,
|
|
32
32
|
searchValue: v,
|
|
33
|
-
searchPlaceholder:
|
|
34
|
-
filterOptions:
|
|
35
|
-
filterPlaceholder:
|
|
36
|
-
sortOptions:
|
|
37
|
-
selectedSort:
|
|
38
|
-
title:
|
|
33
|
+
searchPlaceholder: E = "Search",
|
|
34
|
+
filterOptions: F,
|
|
35
|
+
filterPlaceholder: O = "Filters",
|
|
36
|
+
sortOptions: T,
|
|
37
|
+
selectedSort: x,
|
|
38
|
+
title: j = "AI Agents",
|
|
39
39
|
headerActions: k,
|
|
40
40
|
pagination: o,
|
|
41
|
-
emptyState:
|
|
42
|
-
debugLog:
|
|
43
|
-
} =
|
|
41
|
+
emptyState: B,
|
|
42
|
+
debugLog: b
|
|
43
|
+
} = z, H = !N && C.length === 0, t = n(
|
|
44
44
|
(e, ...s) => {
|
|
45
|
-
|
|
45
|
+
b && console.log(`[AgentListing] ${e}`, ...s);
|
|
46
46
|
},
|
|
47
|
-
[
|
|
48
|
-
),
|
|
47
|
+
[b]
|
|
48
|
+
), I = n(
|
|
49
49
|
(e) => {
|
|
50
|
-
t("onSearchChange", e),
|
|
50
|
+
t("onSearchChange", e), p(e);
|
|
51
51
|
},
|
|
52
|
-
[t,
|
|
52
|
+
[t, p]
|
|
53
53
|
), M = n(
|
|
54
54
|
(e) => {
|
|
55
55
|
t("onSearchSubmit", e), l?.(e);
|
|
@@ -66,90 +66,84 @@ const se = ({
|
|
|
66
66
|
},
|
|
67
67
|
[t, d]
|
|
68
68
|
), P = n(() => {
|
|
69
|
-
t("onNewAgent"),
|
|
70
|
-
}, [t,
|
|
69
|
+
t("onNewAgent"), u();
|
|
70
|
+
}, [t, u]), $ = n(() => {
|
|
71
71
|
t("onBrowseTemplates"), m?.();
|
|
72
|
-
}, [t, m]),
|
|
72
|
+
}, [t, m]), G = n(
|
|
73
73
|
(e) => {
|
|
74
|
-
t("onRunAgent", e.id),
|
|
74
|
+
t("onRunAgent", e.id), f(e);
|
|
75
75
|
},
|
|
76
|
-
[t,
|
|
77
|
-
),
|
|
76
|
+
[t, f]
|
|
77
|
+
), J = n(
|
|
78
78
|
(e) => {
|
|
79
|
-
t("onEditAgent", e.id),
|
|
79
|
+
t("onEditAgent", e.id), A(e);
|
|
80
80
|
},
|
|
81
|
-
[t,
|
|
82
|
-
),
|
|
81
|
+
[t, A]
|
|
82
|
+
), K = n(
|
|
83
83
|
(e) => {
|
|
84
84
|
t("onRowClick", e.id), c?.(e);
|
|
85
85
|
},
|
|
86
86
|
[t, c]
|
|
87
|
-
),
|
|
87
|
+
), Q = n(
|
|
88
88
|
(e) => {
|
|
89
89
|
t("onDeleteAgent", e.id), h(e);
|
|
90
90
|
},
|
|
91
91
|
[t]
|
|
92
|
-
),
|
|
92
|
+
), U = n(async () => {
|
|
93
93
|
if (!(!a || !r)) {
|
|
94
|
-
|
|
94
|
+
w(!0);
|
|
95
95
|
try {
|
|
96
96
|
await r(a), h(null);
|
|
97
97
|
} finally {
|
|
98
|
-
|
|
98
|
+
w(!1);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}, [a, r]);
|
|
102
|
-
return /* @__PURE__ */
|
|
102
|
+
return /* @__PURE__ */ y(Y, { "data-test": D["data-test"] ?? "agent-listing", children: [
|
|
103
103
|
/* @__PURE__ */ i(
|
|
104
|
-
|
|
104
|
+
te,
|
|
105
105
|
{
|
|
106
|
-
title:
|
|
106
|
+
title: j,
|
|
107
107
|
onNewAgent: P,
|
|
108
|
-
onBrowseTemplates: m ?
|
|
108
|
+
onBrowseTemplates: m ? $ : void 0,
|
|
109
109
|
headerActions: k
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
112
|
/* @__PURE__ */ i(
|
|
113
|
-
|
|
113
|
+
ee,
|
|
114
114
|
{
|
|
115
115
|
searchValue: v,
|
|
116
|
-
onSearchChange:
|
|
116
|
+
onSearchChange: I,
|
|
117
117
|
onSearchSubmit: l ? M : void 0,
|
|
118
|
-
searchPlaceholder:
|
|
119
|
-
filterOptions:
|
|
118
|
+
searchPlaceholder: E,
|
|
119
|
+
filterOptions: F,
|
|
120
120
|
onFilterChange: g ? V : void 0,
|
|
121
|
-
filterPlaceholder:
|
|
122
|
-
sortOptions:
|
|
123
|
-
selectedSort:
|
|
121
|
+
filterPlaceholder: O,
|
|
122
|
+
sortOptions: T,
|
|
123
|
+
selectedSort: x,
|
|
124
124
|
onSortChange: d ? q : void 0
|
|
125
125
|
}
|
|
126
126
|
),
|
|
127
|
-
/* @__PURE__ */ i(
|
|
128
|
-
|
|
127
|
+
/* @__PURE__ */ i(Z, { children: N ? /* @__PURE__ */ i(oe, { rows: Math.min(o?.pageSize ?? 5, 10) }) : H ? /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
128
|
+
ie,
|
|
129
129
|
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
actionButton: p?.actionButton ?? {
|
|
133
|
-
buttonText: "New AI agent",
|
|
134
|
-
buttonType: "primary",
|
|
135
|
-
size: "small",
|
|
136
|
-
onClick: P
|
|
137
|
-
}
|
|
130
|
+
emptyState: B,
|
|
131
|
+
onNewAgent: P
|
|
138
132
|
}
|
|
139
|
-
) }) : /* @__PURE__ */
|
|
133
|
+
) }) : /* @__PURE__ */ y(W, { children: [
|
|
140
134
|
/* @__PURE__ */ i(
|
|
141
|
-
|
|
135
|
+
ne,
|
|
142
136
|
{
|
|
143
|
-
agents:
|
|
137
|
+
agents: C,
|
|
144
138
|
triggerCountsLoading: R,
|
|
145
|
-
onRunAgent:
|
|
146
|
-
onEditAgent:
|
|
147
|
-
onDeleteAgent: r ?
|
|
148
|
-
onRowClick: c ?
|
|
139
|
+
onRunAgent: G,
|
|
140
|
+
onEditAgent: J,
|
|
141
|
+
onDeleteAgent: r ? Q : void 0,
|
|
142
|
+
onRowClick: c ? K : void 0
|
|
149
143
|
}
|
|
150
144
|
),
|
|
151
145
|
o && o.totalRows > 0 && /* @__PURE__ */ i(
|
|
152
|
-
|
|
146
|
+
X,
|
|
153
147
|
{
|
|
154
148
|
pageNumber: o.pageNumber,
|
|
155
149
|
pageSize: o.pageSize,
|
|
@@ -167,9 +161,9 @@ const se = ({
|
|
|
167
161
|
ae,
|
|
168
162
|
{
|
|
169
163
|
agentName: a.name,
|
|
170
|
-
isDeleting:
|
|
171
|
-
onClose: () =>
|
|
172
|
-
onConfirm:
|
|
164
|
+
isDeleting: S,
|
|
165
|
+
onClose: () => S ? void 0 : h(null),
|
|
166
|
+
onConfirm: U
|
|
173
167
|
}
|
|
174
168
|
)
|
|
175
169
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentListing.js","sources":["../../../../src/components/agent-listing/AgentListing.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownOption } from '@src/components/dropdown/type';\nimport { TablePagination } from '@src/components/TablePagination/TablePagination';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\nimport { AgentListingProps, AgentListItem } from './AgentListing.model';\nimport { Body, EmptyHolder, Page } from './AgentListing.styled';\nimport { AgentListingFilters } from './AgentListingFilters';\nimport { AgentListingHeader } from './AgentListingHeader';\nimport { AgentTable } from './AgentTable';\nimport { AgentTableShimmer } from './AgentTableShimmer';\nimport { DeleteAgentModal } from './DeleteAgentModal';\n\n/**\n * Full body of the \"AI Agents\" listing screen (header + filters + table).\n * Presentational and fully controlled — the consumer owns data, search, sort,\n * pagination and routing. Render it inside your app shell (next to the sidebar).\n *\n * @example\n * <AgentListing\n * agents={rows}\n * searchValue={search}\n * onSearchChange={setSearch}\n * onNewAgent={() => router.push('/agents/new')}\n * onRunAgent={runAgent}\n * onEditAgent={(a) => router.push(`/agents/${a.id}`)}\n * />\n */\nexport const AgentListing: React.FC<AgentListingProps> = ({\n\tconfig,\n\tonSearchChange,\n\tonSearchSubmit,\n\tonFilterChange,\n\tonSortChange,\n\tonNewAgent,\n\tonBrowseTemplates,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\t...rest\n}) => {\n\t// Agent pending delete-confirmation (null = dialog closed).\n\tconst [pendingDelete, setPendingDelete] = useState<AgentListItem | null>(\n\t\tnull,\n\t);\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst {\n\t\tagents,\n\t\tisLoading,\n\t\ttriggerCountsLoading,\n\t\tsearchValue,\n\t\tsearchPlaceholder = 'Search',\n\t\tfilterOptions,\n\t\tfilterPlaceholder = 'Filters',\n\t\tsortOptions,\n\t\tselectedSort,\n\t\ttitle = 'AI Agents',\n\t\theaderActions,\n\t\tpagination,\n\t\temptyState,\n\t\tdebugLog,\n\t} = config;\n\n\tconst showEmpty = !isLoading && agents.length === 0;\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentListing] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleSearchChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchChange', v);\n\t\t\tonSearchChange(v);\n\t\t},\n\t\t[logAction, onSearchChange],\n\t);\n\tconst handleSearchSubmit = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchSubmit', v);\n\t\t\tonSearchSubmit?.(v);\n\t\t},\n\t\t[logAction, onSearchSubmit],\n\t);\n\tconst handleFilterChange = useCallback(\n\t\t(selected: DropdownOption | DropdownOption[]) => {\n\t\t\tlogAction('onFilterChange', selected);\n\t\t\tonFilterChange?.(selected);\n\t\t},\n\t\t[logAction, onFilterChange],\n\t);\n\tconst handleSortChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSortChange', v);\n\t\t\tonSortChange?.(v);\n\t\t},\n\t\t[logAction, onSortChange],\n\t);\n\tconst handleNewAgent = useCallback(() => {\n\t\tlogAction('onNewAgent');\n\t\tonNewAgent();\n\t}, [logAction, onNewAgent]);\n\tconst handleBrowseTemplates = useCallback(() => {\n\t\tlogAction('onBrowseTemplates');\n\t\tonBrowseTemplates?.();\n\t}, [logAction, onBrowseTemplates]);\n\tconst handleRunAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRunAgent', agent.id);\n\t\t\tonRunAgent(agent);\n\t\t},\n\t\t[logAction, onRunAgent],\n\t);\n\tconst handleEditAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onEditAgent', agent.id);\n\t\t\tonEditAgent(agent);\n\t\t},\n\t\t[logAction, onEditAgent],\n\t);\n\tconst handleRowClick = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRowClick', agent.id);\n\t\t\tonRowClick?.(agent);\n\t\t},\n\t\t[logAction, onRowClick],\n\t);\n\t// Row delete just opens the confirm dialog; the actual delete runs on confirm.\n\tconst handleDeleteRequest = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onDeleteAgent', agent.id);\n\t\t\tsetPendingDelete(agent);\n\t\t},\n\t\t[logAction],\n\t);\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tif (!pendingDelete || !onDeleteAgent) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsDeleting(true);\n\t\ttry {\n\t\t\tawait onDeleteAgent(pendingDelete);\n\t\t\tsetPendingDelete(null);\n\t\t} finally {\n\t\t\tsetIsDeleting(false);\n\t\t}\n\t}, [pendingDelete, onDeleteAgent]);\n\n\treturn (\n\t\t<Page data-test={rest['data-test'] ?? 'agent-listing'}>\n\t\t\t<AgentListingHeader\n\t\t\t\ttitle={title}\n\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\tonBrowseTemplates={\n\t\t\t\t\tonBrowseTemplates ? handleBrowseTemplates : undefined\n\t\t\t\t}\n\t\t\t\theaderActions={headerActions}\n\t\t\t/>\n\n\t\t\t<AgentListingFilters\n\t\t\t\tsearchValue={searchValue}\n\t\t\t\tonSearchChange={handleSearchChange}\n\t\t\t\tonSearchSubmit={onSearchSubmit ? handleSearchSubmit : undefined}\n\t\t\t\tsearchPlaceholder={searchPlaceholder}\n\t\t\t\tfilterOptions={filterOptions}\n\t\t\t\tonFilterChange={onFilterChange ? handleFilterChange : undefined}\n\t\t\t\tfilterPlaceholder={filterPlaceholder}\n\t\t\t\tsortOptions={sortOptions}\n\t\t\t\tselectedSort={selectedSort}\n\t\t\t\tonSortChange={onSortChange ? handleSortChange : undefined}\n\t\t\t/>\n\n\t\t\t<Body>\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<AgentTableShimmer rows={Math.min(pagination?.pageSize ?? 5, 10)} />\n\t\t\t\t) : showEmpty ? (\n\t\t\t\t\t<EmptyHolder>\n\t\t\t\t\t\t<ZeroState\n\t\t\t\t\t\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\t\t\t\t\t\tsubTitle={\n\t\t\t\t\t\t\t\temptyState?.subTitle ??\n\t\t\t\t\t\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactionButton={\n\t\t\t\t\t\t\t\temptyState?.actionButton ?? {\n\t\t\t\t\t\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\t\t\t\t\t\tbuttonType: 'primary',\n\t\t\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t\t\t\tonClick: handleNewAgent,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EmptyHolder>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AgentTable\n\t\t\t\t\t\t\tagents={agents}\n\t\t\t\t\t\t\ttriggerCountsLoading={triggerCountsLoading}\n\t\t\t\t\t\t\tonRunAgent={handleRunAgent}\n\t\t\t\t\t\t\tonEditAgent={handleEditAgent}\n\t\t\t\t\t\t\tonDeleteAgent={onDeleteAgent ? handleDeleteRequest : undefined}\n\t\t\t\t\t\t\tonRowClick={onRowClick ? handleRowClick : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{pagination && pagination.totalRows > 0 && (\n\t\t\t\t\t\t\t<TablePagination\n\t\t\t\t\t\t\t\tpageNumber={pagination.pageNumber}\n\t\t\t\t\t\t\t\tpageSize={pagination.pageSize}\n\t\t\t\t\t\t\t\ttotalRows={pagination.totalRows}\n\t\t\t\t\t\t\t\thidePageSizeOptions={pagination.hidePageSizeOptions}\n\t\t\t\t\t\t\t\tupdatePageNumber={pagination.onPageChange}\n\t\t\t\t\t\t\t\tupdatePageSize={(opt) => {\n\t\t\t\t\t\t\t\t\tconst value = Number(unwrapDropdownValue(opt));\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(value)) {\n\t\t\t\t\t\t\t\t\t\tpagination.onPageSizeChange(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Body>\n\n\t\t\t{pendingDelete && (\n\t\t\t\t<DeleteAgentModal\n\t\t\t\t\tagentName={pendingDelete.name}\n\t\t\t\t\tisDeleting={isDeleting}\n\t\t\t\t\tonClose={() => (isDeleting ? undefined : setPendingDelete(null))}\n\t\t\t\t\tonConfirm={handleConfirmDelete}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Page>\n\t);\n};\n\nAgentListing.displayName = 'AgentListing';\n"],"names":["AgentListing","config","onSearchChange","onSearchSubmit","onFilterChange","onSortChange","onNewAgent","onBrowseTemplates","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","rest","pendingDelete","setPendingDelete","useState","isDeleting","setIsDeleting","agents","isLoading","triggerCountsLoading","searchValue","searchPlaceholder","filterOptions","filterPlaceholder","sortOptions","selectedSort","title","headerActions","pagination","emptyState","debugLog","showEmpty","logAction","useCallback","action","args","handleSearchChange","v","handleSearchSubmit","handleFilterChange","selected","handleSortChange","handleNewAgent","handleBrowseTemplates","handleRunAgent","agent","handleEditAgent","handleRowClick","handleDeleteRequest","handleConfirmDelete","Page","jsx","AgentListingHeader","AgentListingFilters","Body","AgentTableShimmer","EmptyHolder","ZeroState","jsxs","Fragment","AgentTable","TablePagination","opt","value","unwrapDropdownValue","DeleteAgentModal"],"mappings":";;;;;;;;;;;AA4BO,MAAMA,KAA4C,CAAC;AAAA,EACzD,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AAEL,QAAM,CAACC,GAAeC,CAAgB,IAAIC;AAAA,IACzC;AAAA,EAAA,GAEK,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5C;AAAA,IACL,QAAAG;AAAA,IACA,WAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,eAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,EAAA,IACG9B,GAEE+B,IAAY,CAACb,KAAaD,EAAO,WAAW,GAG5Ce,IAAYC;AAAA,IACjB,CAACC,MAAmBC,MAAoB;AACvC,MAAIL,KAEH,QAAQ,IAAI,kBAAkBI,CAAM,IAAI,GAAGC,CAAI;AAAA,IAEjD;AAAA,IACA,CAACL,CAAQ;AAAA,EAAA,GAGJM,IAAqBH;AAAA,IAC1B,CAACI,MAAc;AACd,MAAAL,EAAU,kBAAkBK,CAAC,GAC7BpC,EAAeoC,CAAC;AAAA,IACjB;AAAA,IACA,CAACL,GAAW/B,CAAc;AAAA,EAAA,GAErBqC,IAAqBL;AAAA,IAC1B,CAACI,MAAc;AACd,MAAAL,EAAU,kBAAkBK,CAA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F,CACD,IAEA,gBAAAgB,EAAAC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR;AAAA,QAACS;AAAA,QAAA;AAAA,UACA,QAAA3C;AAAA,UACA,sBAAAE;AAAA,UACA,YAAYyB;AAAA,UACZ,aAAaE;AAAA,UACb,eAAerC,IAAgBuC,IAAsB;AAAA,UACrD,YAAYtC,IAAaqC,IAAiB;AAAA,QAAA;AAAA,MAAA;AAAA,MAE1CnB,KAAcA,EAAW,YAAY,KACrC,gBAAAuB;AAAA,QAACU;AAAA,QAAA;AAAA,UACA,YAAYjC,EAAW;AAAA,UACvB,UAAUA,EAAW;AAAA,UACrB,WAAWA,EAAW;AAAA,UACtB,qBAAqBA,EAAW;AAAA,UAChC,kBAAkBA,EAAW;AAAA,UAC7B,gBAAgB,CAACkC,MAAQ;AACxB,kBAAMC,IAAQ,OAAOC,GAAoBF,CAAG,CAAC;AAC7C,YAAK,OAAO,MAAMC,CAAK,KACtBnC,EAAW,iBAAiBmC,CAAK;AAAA,UAEnC;AAAA,QAAA;AAAA,MAAA;AAAA,IACD,EAAA,CAEF,EAAA,CAEF;AAAA,IAECnD,KACA,gBAAAuC;AAAA,MAACc;AAAA,MAAA;AAAA,QACA,WAAWrD,EAAc;AAAA,QACzB,YAAAG;AAAA,QACA,SAAS,MAAOA,IAAa,SAAYF,EAAiB,IAAI;AAAA,QAC9D,WAAWoC;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GAEF;AAEF;AAEAlD,GAAa,cAAc;"}
|
|
1
|
+
{"version":3,"file":"AgentListing.js","sources":["../../../../src/components/agent-listing/AgentListing.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownOption } from '@src/components/dropdown/type';\nimport { TablePagination } from '@src/components/TablePagination/TablePagination';\nimport { AgentListingProps, AgentListItem } from './AgentListing.model';\nimport { Body, EmptyHolder, Page } from './AgentListing.styled';\nimport { AgentListingFilters } from './AgentListingFilters';\nimport { AgentListingHeader } from './AgentListingHeader';\nimport { AgentTable } from './AgentTable';\nimport { AgentTableShimmer } from './AgentTableShimmer';\nimport { AiAgentsEmptyState } from './AiAgentsEmptyState';\nimport { DeleteAgentModal } from './DeleteAgentModal';\n\n/**\n * Full body of the \"AI Agents\" listing screen (header + filters + table).\n * Presentational and fully controlled — the consumer owns data, search, sort,\n * pagination and routing. Render it inside your app shell (next to the sidebar).\n *\n * @example\n * <AgentListing\n * agents={rows}\n * searchValue={search}\n * onSearchChange={setSearch}\n * onNewAgent={() => router.push('/agents/new')}\n * onRunAgent={runAgent}\n * onEditAgent={(a) => router.push(`/agents/${a.id}`)}\n * />\n */\nexport const AgentListing: React.FC<AgentListingProps> = ({\n\tconfig,\n\tonSearchChange,\n\tonSearchSubmit,\n\tonFilterChange,\n\tonSortChange,\n\tonNewAgent,\n\tonBrowseTemplates,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\t...rest\n}) => {\n\t// Agent pending delete-confirmation (null = dialog closed).\n\tconst [pendingDelete, setPendingDelete] = useState<AgentListItem | null>(\n\t\tnull,\n\t);\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst {\n\t\tagents,\n\t\tisLoading,\n\t\ttriggerCountsLoading,\n\t\tsearchValue,\n\t\tsearchPlaceholder = 'Search',\n\t\tfilterOptions,\n\t\tfilterPlaceholder = 'Filters',\n\t\tsortOptions,\n\t\tselectedSort,\n\t\ttitle = 'AI Agents',\n\t\theaderActions,\n\t\tpagination,\n\t\temptyState,\n\t\tdebugLog,\n\t} = config;\n\n\tconst showEmpty = !isLoading && agents.length === 0;\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentListing] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleSearchChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchChange', v);\n\t\t\tonSearchChange(v);\n\t\t},\n\t\t[logAction, onSearchChange],\n\t);\n\tconst handleSearchSubmit = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchSubmit', v);\n\t\t\tonSearchSubmit?.(v);\n\t\t},\n\t\t[logAction, onSearchSubmit],\n\t);\n\tconst handleFilterChange = useCallback(\n\t\t(selected: DropdownOption | DropdownOption[]) => {\n\t\t\tlogAction('onFilterChange', selected);\n\t\t\tonFilterChange?.(selected);\n\t\t},\n\t\t[logAction, onFilterChange],\n\t);\n\tconst handleSortChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSortChange', v);\n\t\t\tonSortChange?.(v);\n\t\t},\n\t\t[logAction, onSortChange],\n\t);\n\tconst handleNewAgent = useCallback(() => {\n\t\tlogAction('onNewAgent');\n\t\tonNewAgent();\n\t}, [logAction, onNewAgent]);\n\tconst handleBrowseTemplates = useCallback(() => {\n\t\tlogAction('onBrowseTemplates');\n\t\tonBrowseTemplates?.();\n\t}, [logAction, onBrowseTemplates]);\n\tconst handleRunAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRunAgent', agent.id);\n\t\t\tonRunAgent(agent);\n\t\t},\n\t\t[logAction, onRunAgent],\n\t);\n\tconst handleEditAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onEditAgent', agent.id);\n\t\t\tonEditAgent(agent);\n\t\t},\n\t\t[logAction, onEditAgent],\n\t);\n\tconst handleRowClick = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRowClick', agent.id);\n\t\t\tonRowClick?.(agent);\n\t\t},\n\t\t[logAction, onRowClick],\n\t);\n\t// Row delete just opens the confirm dialog; the actual delete runs on confirm.\n\tconst handleDeleteRequest = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onDeleteAgent', agent.id);\n\t\t\tsetPendingDelete(agent);\n\t\t},\n\t\t[logAction],\n\t);\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tif (!pendingDelete || !onDeleteAgent) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsDeleting(true);\n\t\ttry {\n\t\t\tawait onDeleteAgent(pendingDelete);\n\t\t\tsetPendingDelete(null);\n\t\t} finally {\n\t\t\tsetIsDeleting(false);\n\t\t}\n\t}, [pendingDelete, onDeleteAgent]);\n\n\treturn (\n\t\t<Page data-test={rest['data-test'] ?? 'agent-listing'}>\n\t\t\t<AgentListingHeader\n\t\t\t\ttitle={title}\n\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\tonBrowseTemplates={\n\t\t\t\t\tonBrowseTemplates ? handleBrowseTemplates : undefined\n\t\t\t\t}\n\t\t\t\theaderActions={headerActions}\n\t\t\t/>\n\n\t\t\t<AgentListingFilters\n\t\t\t\tsearchValue={searchValue}\n\t\t\t\tonSearchChange={handleSearchChange}\n\t\t\t\tonSearchSubmit={onSearchSubmit ? handleSearchSubmit : undefined}\n\t\t\t\tsearchPlaceholder={searchPlaceholder}\n\t\t\t\tfilterOptions={filterOptions}\n\t\t\t\tonFilterChange={onFilterChange ? handleFilterChange : undefined}\n\t\t\t\tfilterPlaceholder={filterPlaceholder}\n\t\t\t\tsortOptions={sortOptions}\n\t\t\t\tselectedSort={selectedSort}\n\t\t\t\tonSortChange={onSortChange ? handleSortChange : undefined}\n\t\t\t/>\n\n\t\t\t<Body>\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<AgentTableShimmer rows={Math.min(pagination?.pageSize ?? 5, 10)} />\n\t\t\t\t) : showEmpty ? (\n\t\t\t\t\t<EmptyHolder>\n\t\t\t\t\t\t<AiAgentsEmptyState\n\t\t\t\t\t\t\temptyState={emptyState}\n\t\t\t\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EmptyHolder>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AgentTable\n\t\t\t\t\t\t\tagents={agents}\n\t\t\t\t\t\t\ttriggerCountsLoading={triggerCountsLoading}\n\t\t\t\t\t\t\tonRunAgent={handleRunAgent}\n\t\t\t\t\t\t\tonEditAgent={handleEditAgent}\n\t\t\t\t\t\t\tonDeleteAgent={onDeleteAgent ? handleDeleteRequest : undefined}\n\t\t\t\t\t\t\tonRowClick={onRowClick ? handleRowClick : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{pagination && pagination.totalRows > 0 && (\n\t\t\t\t\t\t\t<TablePagination\n\t\t\t\t\t\t\t\tpageNumber={pagination.pageNumber}\n\t\t\t\t\t\t\t\tpageSize={pagination.pageSize}\n\t\t\t\t\t\t\t\ttotalRows={pagination.totalRows}\n\t\t\t\t\t\t\t\thidePageSizeOptions={pagination.hidePageSizeOptions}\n\t\t\t\t\t\t\t\tupdatePageNumber={pagination.onPageChange}\n\t\t\t\t\t\t\t\tupdatePageSize={(opt) => {\n\t\t\t\t\t\t\t\t\tconst value = Number(unwrapDropdownValue(opt));\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(value)) {\n\t\t\t\t\t\t\t\t\t\tpagination.onPageSizeChange(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Body>\n\n\t\t\t{pendingDelete && (\n\t\t\t\t<DeleteAgentModal\n\t\t\t\t\tagentName={pendingDelete.name}\n\t\t\t\t\tisDeleting={isDeleting}\n\t\t\t\t\tonClose={() => (isDeleting ? undefined : setPendingDelete(null))}\n\t\t\t\t\tonConfirm={handleConfirmDelete}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Page>\n\t);\n};\n\nAgentListing.displayName = 'AgentListing';\n"],"names":["AgentListing","config","onSearchChange","onSearchSubmit","onFilterChange","onSortChange","onNewAgent","onBrowseTemplates","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","rest","pendingDelete","setPendingDelete","useState","isDeleting","setIsDeleting","agents","isLoading","triggerCountsLoading","searchValue","searchPlaceholder","filterOptions","filterPlaceholder","sortOptions","selectedSort","title","headerActions","pagination","emptyState","debugLog","showEmpty","logAction","useCallback","action","args","handleSearchChange","v","handleSearchSubmit","handleFilterChange","selected","handleSortChange","handleNewAgent","handleBrowseTemplates","handleRunAgent","agent","handleEditAgent","handleRowClick","handleDeleteRequest","handleConfirmDelete","Page","jsx","AgentListingHeader","AgentListingFilters","Body","AgentTableShimmer","EmptyHolder","AiAgentsEmptyState","jsxs","Fragment","AgentTable","TablePagination","opt","value","unwrapDropdownValue","DeleteAgentModal"],"mappings":";;;;;;;;;;;AA4BO,MAAMA,KAA4C,CAAC;AAAA,EACzD,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AAEL,QAAM,CAACC,GAAeC,CAAgB,IAAIC;AAAA,IACzC;AAAA,EAAA,GAEK,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5C;AAAA,IACL,QAAAG;AAAA,IACA,WAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,eAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,EAAA,IACG9B,GAEE+B,IAAY,CAACb,KAAaD,EAAO,WAAW,GAG5Ce,IAAYC;AAAA,IACjB,CAACC,MAAmBC,MAAoB;AACv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EAACI,IAAA,EAAkB,MAAM,KAAK,IAAI3B,GAAY,YAAY,GAAG,EAAE,GAAG,IAC/DG,sBACFyB,GAAA,EACA,UAAA,gBAAAL;AAAA,MAACM;AAAA,MAAA;AAAA,QACA,YAAA5B;AAAA,QACA,YAAYa;AAAA,MAAA;AAAA,IAAA,EACb,CACD,IAEA,gBAAAgB,EAAAC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR;AAAA,QAACS;AAAA,QAAA;AAAA,UACA,QAAA3C;AAAA,UACA,sBAAAE;AAAA,UACA,YAAYyB;AAAA,UACZ,aAAaE;AAAA,UACb,eAAerC,IAAgBuC,IAAsB;AAAA,UACrD,YAAYtC,IAAaqC,IAAiB;AAAA,QAAA;AAAA,MAAA;AAAA,MAE1CnB,KAAcA,EAAW,YAAY,KACrC,gBAAAuB;AAAA,QAACU;AAAA,QAAA;AAAA,UACA,YAAYjC,EAAW;AAAA,UACvB,UAAUA,EAAW;AAAA,UACrB,WAAWA,EAAW;AAAA,UACtB,qBAAqBA,EAAW;AAAA,UAChC,kBAAkBA,EAAW;AAAA,UAC7B,gBAAgB,CAACkC,MAAQ;AACxB,kBAAMC,IAAQ,OAAOC,GAAoBF,CAAG,CAAC;AAC7C,YAAK,OAAO,MAAMC,CAAK,KACtBnC,EAAW,iBAAiBmC,CAAK;AAAA,UAEnC;AAAA,QAAA;AAAA,MAAA;AAAA,IACD,EAAA,CAEF,EAAA,CAEF;AAAA,IAECnD,KACA,gBAAAuC;AAAA,MAACc;AAAA,MAAA;AAAA,QACA,WAAWrD,EAAc;AAAA,QACzB,YAAAG;AAAA,QACA,SAAS,MAAOA,IAAa,SAAYF,EAAiB,IAAI;AAAA,QAC9D,WAAWoC;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GAEF;AAEF;AAEAlD,GAAa,cAAc;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonProps } from '../button/model';
|
|
3
|
+
export interface AiAgentsEmptyStateProps {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides for the default copy / CTA — e.g. the search-miss variant passes
|
|
6
|
+
* "No results found …". Any omitted field falls back to the "no agents yet"
|
|
7
|
+
* defaults below.
|
|
8
|
+
*/
|
|
9
|
+
emptyState?: {
|
|
10
|
+
title?: string;
|
|
11
|
+
subTitle?: string;
|
|
12
|
+
actionButton?: ButtonProps;
|
|
13
|
+
};
|
|
14
|
+
/** Runs the default "New AI agent" CTA when no override button is supplied. */
|
|
15
|
+
onNewAgent: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Zero state for the AI Agents listing — shown when there are no agents yet or a
|
|
19
|
+
* search returns no hits. Renders the shared {@link ZeroState} with AI-agents
|
|
20
|
+
* defaults; a consumer-supplied `emptyState` overrides any of the copy / CTA.
|
|
21
|
+
*/
|
|
22
|
+
export declare const AiAgentsEmptyState: React.FC<AiAgentsEmptyStateProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { ZeroState as i } from "../zeroState/ZeroState.js";
|
|
3
|
+
const a = ({
|
|
4
|
+
emptyState: t,
|
|
5
|
+
onNewAgent: o
|
|
6
|
+
}) => /* @__PURE__ */ e(
|
|
7
|
+
i,
|
|
8
|
+
{
|
|
9
|
+
title: t?.title ?? "No agents yet",
|
|
10
|
+
subTitle: t?.subTitle ?? "Create your first AI agent to start automating conversations.",
|
|
11
|
+
actionButton: t?.actionButton ?? {
|
|
12
|
+
buttonText: "New AI agent",
|
|
13
|
+
buttonType: "primary",
|
|
14
|
+
size: "small",
|
|
15
|
+
onClick: o
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
export {
|
|
20
|
+
a as AiAgentsEmptyState
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=AiAgentsEmptyState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiAgentsEmptyState.js","sources":["../../../../src/components/agent-listing/AiAgentsEmptyState.tsx"],"sourcesContent":["import React from 'react';\nimport { ButtonProps } from '@src/components/button/model';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\n\nexport interface AiAgentsEmptyStateProps {\n\t/**\n\t * Overrides for the default copy / CTA — e.g. the search-miss variant passes\n\t * \"No results found …\". Any omitted field falls back to the \"no agents yet\"\n\t * defaults below.\n\t */\n\temptyState?: {\n\t\ttitle?: string;\n\t\tsubTitle?: string;\n\t\tactionButton?: ButtonProps;\n\t};\n\t/** Runs the default \"New AI agent\" CTA when no override button is supplied. */\n\tonNewAgent: () => void;\n}\n\n/**\n * Zero state for the AI Agents listing — shown when there are no agents yet or a\n * search returns no hits. Renders the shared {@link ZeroState} with AI-agents\n * defaults; a consumer-supplied `emptyState` overrides any of the copy / CTA.\n */\nexport const AiAgentsEmptyState: React.FC<AiAgentsEmptyStateProps> = ({\n\temptyState,\n\tonNewAgent,\n}) => (\n\t<ZeroState\n\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\tsubTitle={\n\t\t\temptyState?.subTitle ??\n\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t}\n\t\tactionButton={\n\t\t\temptyState?.actionButton ?? {\n\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onNewAgent,\n\t\t\t}\n\t\t}\n\t/>\n);\n"],"names":["AiAgentsEmptyState","emptyState","onNewAgent","jsx","ZeroState"],"mappings":";;AAwBO,MAAMA,IAAwD,CAAC;AAAA,EACrE,YAAAC;AAAA,EACA,YAAAC;AACD,MACC,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,OAAOH,GAAY,SAAS;AAAA,IAC5B,UACCA,GAAY,YACZ;AAAA,IAED,cACCA,GAAY,gBAAgB;AAAA,MAC3B,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,SAASC;AAAA,IAAA;AAAA,EACV;AAEF;"}
|