@hotmeshio/long-tail 0.9.5 → 0.9.6
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/dashboard/dist/assets/{AdminDashboard-PvD1IObg.js → AdminDashboard-DXFIKXO3.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-PvD1IObg.js.map → AdminDashboard-DXFIKXO3.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-BB9NCIiK.js → AgentConfigPage-CQE1mfjk.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-BB9NCIiK.js.map → AgentConfigPage-CQE1mfjk.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-B570UVLx.js → AgentDetailPage-DM59ozP_.js} +2 -2
- package/dashboard/dist/assets/{AgentDetailPage-B570UVLx.js.map → AgentDetailPage-DM59ozP_.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-CgUucHar.js → AgentsPage-DSK2uXI5.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-CgUucHar.js.map → AgentsPage-DSK2uXI5.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-BVgMtftp.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-BVgMtftp.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-CYw4ZeAh.js → BotPicker-DJ0YYKZA.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-CYw4ZeAh.js.map → BotPicker-DJ0YYKZA.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-C8DL3cDA.js → CapabilitiesPage-DFQryGBj.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-C8DL3cDA.js.map → CapabilitiesPage-DFQryGBj.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-CDdlmdb6.js → CollapsibleSection-B7-d5O_x.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-CDdlmdb6.js.map → CollapsibleSection-B7-d5O_x.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-BTJmh4Xw.js +2 -0
- package/dashboard/dist/assets/CountdownTimer-BTJmh4Xw.js.map +1 -0
- package/dashboard/dist/assets/{CredentialsPage-Bt7tQHlp.js → CredentialsPage-BWVgxRpZ.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-Bt7tQHlp.js.map → CredentialsPage-BWVgxRpZ.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DbwuLMO0.js → CronLabel-DNnyNqXH.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DbwuLMO0.js.map → CronLabel-DNnyNqXH.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-CKfgf650.js → CustomDurationPicker-SNsQZL_U.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-CKfgf650.js.map → CustomDurationPicker-SNsQZL_U.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CgpTWk8N.js → ElapsedCell-C4r0IvUt.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CgpTWk8N.js.map → ElapsedCell-C4r0IvUt.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-CxFxPz4C.js → EscalationListSchemaPage-D8Ec8Zhj.js} +2 -2
- package/dashboard/dist/assets/{EscalationListSchemaPage-CxFxPz4C.js.map → EscalationListSchemaPage-D8Ec8Zhj.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-CXvjwJ_I.js → EscalationSchemaPage-BmEv7qU2.js} +2 -2
- package/dashboard/dist/assets/{EscalationSchemaPage-CXvjwJ_I.js.map → EscalationSchemaPage-BmEv7qU2.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-BY4dLou7.js → EscalationsOverview-DkIy025e.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-BY4dLou7.js.map → EscalationsOverview-DkIy025e.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-MFAHeFTY.js → EventTable-Co4RYeKO.js} +2 -2
- package/dashboard/dist/assets/{EventTable-MFAHeFTY.js.map → EventTable-Co4RYeKO.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-7T-6qC2N.js → GraphInvokePage-b7ukMy0z.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-7T-6qC2N.js.map → GraphInvokePage-b7ukMy0z.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-1PI7E3sw.js → HomePage-K0U3yMdU.js} +2 -2
- package/dashboard/dist/assets/{HomePage-1PI7E3sw.js.map → HomePage-K0U3yMdU.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-DmRE3_dX.js → ListToolbar-DDG6DXVF.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-DmRE3_dX.js.map → ListToolbar-DDG6DXVF.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-BukcrbtX.js → McpOverview-P2o3b3mi.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-BukcrbtX.js.map → McpOverview-P2o3b3mi.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-BVx-cGFZ.js → McpQueryDetailPage-C2CeBLb0.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-BVx-cGFZ.js.map → McpQueryDetailPage-C2CeBLb0.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-DPXnA6Wa.js → McpQueryPage-D_N-3lp0.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-DPXnA6Wa.js.map → McpQueryPage-D_N-3lp0.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-D3dcICPJ.js → McpRunDetailPage-uDw3MWR_.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-D3dcICPJ.js.map → McpRunDetailPage-uDw3MWR_.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-CzISyj7e.js → McpRunsPage-CDTUxghb.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-CzISyj7e.js.map → McpRunsPage-CDTUxghb.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-BYth5Dxg.js → OperationsPage-Daah4pNk.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-BYth5Dxg.js.map → OperationsPage-Daah4pNk.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-C_bMBGyy.js → OperatorDashboard-CVRD8nQH.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-C_bMBGyy.js.map → OperatorDashboard-CVRD8nQH.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-BVR41sYI.js → ProcessDetailPage-Dt6PAK04.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-BVR41sYI.js.map → ProcessDetailPage-Dt6PAK04.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-DAgFK_ln.js → ProcessesListPage-CMkjASgs.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-DAgFK_ln.js.map → ProcessesListPage-CMkjASgs.js.map} +1 -1
- package/dashboard/dist/assets/{RoleDetailPage-NxT8GaWV.js → RoleDetailPage-6H1AY6sK.js} +2 -2
- package/dashboard/dist/assets/{RoleDetailPage-NxT8GaWV.js.map → RoleDetailPage-6H1AY6sK.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-dRSC725H.js → RolesPage-DtHIjDss.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-dRSC725H.js.map → RolesPage-DtHIjDss.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-C36xqdKj.js → RunAsSelector-C198CpFs.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-C36xqdKj.js.map → RunAsSelector-C198CpFs.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-D_HhyJ5V.js → StickyPagination-eZ6WhMrL.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-D_HhyJ5V.js.map → StickyPagination-eZ6WhMrL.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-C39lLYKC.js → StreamMessageDetail-7xq_dddO.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-C39lLYKC.js.map → StreamMessageDetail-7xq_dddO.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-dlaJS-DC.js → SwimlaneTimeline-Yg5QT0nI.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-dlaJS-DC.js.map → SwimlaneTimeline-Yg5QT0nI.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-DAnT9c0v.js → TaskDetailPage-Wc3AFnqs.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-DAnT9c0v.js.map → TaskDetailPage-Wc3AFnqs.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-CkbK3vdj.js → TasksListPage-V-1J_B_L.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-CkbK3vdj.js.map → TasksListPage-V-1J_B_L.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-drImakaN.js → TimeAgo-XdHghs5F.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-drImakaN.js.map → TimeAgo-XdHghs5F.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-CpWhUW0W.js → TimestampCell-BrzctPWT.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-CpWhUW0W.js.map → TimestampCell-BrzctPWT.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-PvMw4dIw.js → ToolTestPanel-CGfGUsaq.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-PvMw4dIw.js.map → ToolTestPanel-CGfGUsaq.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-DQa0EuM9.js → TopicDetailPage-CcAgD2k5.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-DQa0EuM9.js.map → TopicDetailPage-CcAgD2k5.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-OzE8IWZf.js → TopicsPage-BOQG7s4P.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-OzE8IWZf.js.map → TopicsPage-BOQG7s4P.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-B-5Cnap4.js → UserName-BzxR0Ihp.js} +2 -2
- package/dashboard/dist/assets/{UserName-B-5Cnap4.js.map → UserName-BzxR0Ihp.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-s4H5TnRv.js → WorkflowExecutionPage-hRsDMByj.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-s4H5TnRv.js.map → WorkflowExecutionPage-hRsDMByj.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-BqMJDhpp.js → WorkflowsDashboard-ky0ulsUe.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-BqMJDhpp.js.map → WorkflowsDashboard-ky0ulsUe.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-CVd-TybI.js → WorkflowsOverview-CzRJUV58.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CVd-TybI.js.map → WorkflowsOverview-CzRJUV58.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-BshuXnvM.js → YamlWorkflowDetailPage-Beqzy9Ph.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-BshuXnvM.js.map → YamlWorkflowDetailPage-Beqzy9Ph.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-D2LRoAki.js → YamlWorkflowsPage-BzBUU2ug.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-D2LRoAki.js.map → YamlWorkflowsPage-BzBUU2ug.js.map} +1 -1
- package/dashboard/dist/assets/{agents-CqeRO052.js → agents-Dlu4m6jy.js} +2 -2
- package/dashboard/dist/assets/{agents-CqeRO052.js.map → agents-Dlu4m6jy.js.map} +1 -1
- package/dashboard/dist/assets/{bots-yo56kQZI.js → bots-C4G5U-6Q.js} +2 -2
- package/dashboard/dist/assets/{bots-yo56kQZI.js.map → bots-C4G5U-6Q.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-C-LyQnOQ.js → capabilities-BSFP_boq.js} +2 -2
- package/dashboard/dist/assets/{capabilities-C-LyQnOQ.js.map → capabilities-BSFP_boq.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-cpRK9tBf.js → controlplane-qCqoP2ZV.js} +2 -2
- package/dashboard/dist/assets/{controlplane-cpRK9tBf.js.map → controlplane-qCqoP2ZV.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-Ck7ZOd7Z.js +2 -0
- package/dashboard/dist/assets/escalation-columns-Ck7ZOd7Z.js.map +1 -0
- package/dashboard/dist/assets/{index-D_FpjN49.js → index-BObWYPxd.js} +2 -2
- package/dashboard/dist/assets/{index-D_FpjN49.js.map → index-BObWYPxd.js.map} +1 -1
- package/dashboard/dist/assets/{index-CvyZWk2N.js → index-BtEWQNcP.js} +2 -2
- package/dashboard/dist/assets/{index-CvyZWk2N.js.map → index-BtEWQNcP.js.map} +1 -1
- package/dashboard/dist/assets/{index-JMRKuqah.js → index-C0KklOM4.js} +2 -2
- package/dashboard/dist/assets/{index-JMRKuqah.js.map → index-C0KklOM4.js.map} +1 -1
- package/dashboard/dist/assets/{index-DQgRu4cd.js → index-CGVqW6MI.js} +2 -2
- package/dashboard/dist/assets/{index-DQgRu4cd.js.map → index-CGVqW6MI.js.map} +1 -1
- package/dashboard/dist/assets/index-CY3hpJR-.js +5 -0
- package/dashboard/dist/assets/index-CY3hpJR-.js.map +1 -0
- package/dashboard/dist/assets/{index-C15QKc-V.js → index-CuC_mNNA.js} +2 -2
- package/dashboard/dist/assets/{index-C15QKc-V.js.map → index-CuC_mNNA.js.map} +1 -1
- package/dashboard/dist/assets/{index-B9YOp7_Z.js → index-DCTWUswT.js} +2 -2
- package/dashboard/dist/assets/{index-B9YOp7_Z.js.map → index-DCTWUswT.js.map} +1 -1
- package/dashboard/dist/assets/{index-DNKzmRA3.js → index-DUhettdV.js} +2 -2
- package/dashboard/dist/assets/{index-DNKzmRA3.js.map → index-DUhettdV.js.map} +1 -1
- package/dashboard/dist/assets/{index-DpYsAAsj.js → index-DWSNtg28.js} +2 -2
- package/dashboard/dist/assets/{index-DpYsAAsj.js.map → index-DWSNtg28.js.map} +1 -1
- package/dashboard/dist/assets/{index-D9GgDI2q.js → index-D_FNaSoe.js} +2 -2
- package/dashboard/dist/assets/{index-D9GgDI2q.js.map → index-D_FNaSoe.js.map} +1 -1
- package/dashboard/dist/assets/{index-BJwHI2aX.js → index-DcQiD6OF.js} +3 -3
- package/dashboard/dist/assets/{index-BJwHI2aX.js.map → index-DcQiD6OF.js.map} +1 -1
- package/dashboard/dist/assets/{index-d8dDpRIs.js → index-Dzhn5MDY.js} +2 -2
- package/dashboard/dist/assets/{index-d8dDpRIs.js.map → index-Dzhn5MDY.js.map} +1 -1
- package/dashboard/dist/assets/{index-D3_Kc337.js → index-QL26JxBF.js} +2 -2
- package/dashboard/dist/assets/{index-D3_Kc337.js.map → index-QL26JxBF.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-DSTPZRsM.js → knowledge-CTdgLX5j.js} +2 -2
- package/dashboard/dist/assets/{knowledge-DSTPZRsM.js.map → knowledge-CTdgLX5j.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-DPzcauBf.js → mcp-BEsMr678.js} +2 -2
- package/dashboard/dist/assets/{mcp-DPzcauBf.js.map → mcp-BEsMr678.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CYLlRjwY.js → mcp-query-CmamHKIR.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CYLlRjwY.js.map → mcp-query-CmamHKIR.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-BtfaUf7f.js → pipelines-taOXA2-y.js} +2 -2
- package/dashboard/dist/assets/{pipelines-BtfaUf7f.js.map → pipelines-taOXA2-y.js.map} +1 -1
- package/dashboard/dist/assets/{roles-CDi58HW9.js → roles-BiUJAsVM.js} +2 -2
- package/dashboard/dist/assets/{roles-CDi58HW9.js.map → roles-BiUJAsVM.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-bMka9A7P.js → tasks-DEaDdyBh.js} +2 -2
- package/dashboard/dist/assets/{tasks-bMka9A7P.js.map → tasks-DEaDdyBh.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CFcuDwn2.js → topics-2qRx68Ft.js} +2 -2
- package/dashboard/dist/assets/{topics-CFcuDwn2.js.map → topics-2qRx68Ft.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-DrtLEQzK.js → useEventHooks-oXjfKrbI.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-DrtLEQzK.js.map → useEventHooks-oXjfKrbI.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-BUb0LZ9l.js → useNamespace-YdT1Zouk.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-BUb0LZ9l.js.map → useNamespace-YdT1Zouk.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-6DPlPdg0.js → useYamlActivityEvents-Bt-RZ7Zl.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-6DPlPdg0.js.map → useYamlActivityEvents-Bt-RZ7Zl.js.map} +1 -1
- package/dashboard/dist/assets/{users-FTnxEv_t.js → users-DbX5JZ_w.js} +2 -2
- package/dashboard/dist/assets/{users-FTnxEv_t.js.map → users-DbX5JZ_w.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-DgeQWLWK.js → workflows-acMcPTC5.js} +2 -2
- package/dashboard/dist/assets/{workflows-DgeQWLWK.js.map → workflows-acMcPTC5.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-BjatB1t-.js → yaml-workflows-D6kzrMYx.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-BjatB1t-.js.map → yaml-workflows-D6kzrMYx.js.map} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/docs/hitl-guide.md +242 -70
- package/package.json +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-B1cCs4jO.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-B1cCs4jO.js.map +0 -1
- package/dashboard/dist/assets/CountdownTimer-BrQl3JWm.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BrQl3JWm.js.map +0 -1
- package/dashboard/dist/assets/escalation-columns-CSG3LG3F.js +0 -2
- package/dashboard/dist/assets/escalation-columns-CSG3LG3F.js.map +0 -1
- package/dashboard/dist/assets/index-D9I9XhrD.js +0 -5
- package/dashboard/dist/assets/index-D9I9XhrD.js.map +0 -1
package/dashboard/dist/assets/{yaml-workflows-BjatB1t-.js.map → yaml-workflows-D6kzrMYx.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-workflows-BjatB1t-.js","sources":["../../src/api/yaml-workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTYamlWorkflowRecord, LTYamlWorkflowStatus, LTYamlWorkflowVersion } from './types';\n\ninterface YamlWorkflowListResponse {\n workflows: LTYamlWorkflowRecord[];\n total: number;\n}\n\ninterface YamlWorkflowFilters {\n status?: LTYamlWorkflowStatus;\n graph_topic?: string;\n app_id?: string;\n search?: string;\n set_id?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useYamlWorkflows(filters: YamlWorkflowFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.graph_topic) params.set('graph_topic', filters.graph_topic);\n if (filters.app_id) params.set('app_id', filters.app_id);\n if (filters.search) params.set('search', filters.search);\n if (filters.set_id) params.set('set_id', filters.set_id);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', filters],\n queryFn: () => apiFetch(`/yaml-workflows?${params}`),\n });\n}\n\nexport function useYamlWorkflowAppIds() {\n return useQuery<{ app_ids: string[] }>({\n queryKey: ['yamlWorkflowAppIds'],\n queryFn: () => apiFetch('/yaml-workflows/app-ids'),\n });\n}\n\nexport function useYamlWorkflowByTopic(graphTopic: string | undefined, appId?: string) {\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', 'byTopic', graphTopic, appId],\n queryFn: () => {\n const params = new URLSearchParams({ graph_topic: graphTopic!, limit: '1' });\n if (appId) params.set('app_id', appId);\n return apiFetch(`/yaml-workflows?${params}`);\n },\n enabled: !!graphTopic,\n });\n}\n\nexport function useYamlWorkflow(id: string) {\n return useQuery<LTYamlWorkflowRecord>({\n queryKey: ['yamlWorkflows', id],\n queryFn: () => apiFetch(`/yaml-workflows/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: {\n workflow_id: string;\n task_queue: string;\n workflow_name: string;\n name: string;\n description?: string;\n app_id?: string;\n subscribes?: string;\n tags?: string[];\n compilation_feedback?: string;\n }) =>\n apiFetch<LTYamlWorkflowRecord>('/yaml-workflows', {\n method: 'POST',\n body: JSON.stringify(input),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeployYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/deploy`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useActivateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/activate`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, data, sync, execute_as }: { id: string; data: Record<string, unknown>; sync?: boolean; execute_as?: string }) =>\n apiFetch<{ result?: unknown; job_id?: string }>(`/yaml-workflows/${id}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, sync, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRegenerateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, task_queue, compilation_feedback }: { id: string; task_queue?: string; compilation_feedback?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/regenerate`, {\n method: 'POST',\n body: JSON.stringify({ task_queue, compilation_feedback }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useArchiveYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/archive`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRestoreYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/restore`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflow'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpdateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, ...updates }: { id: string; yaml_content?: string; name?: string; description?: string; input_schema?: Record<string, unknown>; output_schema?: Record<string, unknown>; tags?: string[]; app_id?: string; graph_topic?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify(updates),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<{ deleted: boolean }>(`/yaml-workflows/${id}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Cron scheduling ─────────────────────────────────────────────\n\nexport function useSetYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, cron_schedule, cron_envelope, execute_as }: {\n id: string;\n cron_schedule: string;\n cron_envelope?: Record<string, unknown> | null;\n execute_as?: string | null;\n }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'PUT',\n body: JSON.stringify({ cron_schedule, cron_envelope, execute_as }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useClearYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Version history ─────────────────────────────────────────────\n\nexport function useYamlWorkflowVersions(id: string) {\n return useQuery<{ versions: LTYamlWorkflowVersion[]; total: number }>({\n queryKey: ['yamlWorkflows', id, 'versions'],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions`),\n enabled: !!id,\n });\n}\n\nexport function useYamlWorkflowVersion(id: string, version: number | null) {\n return useQuery<LTYamlWorkflowVersion>({\n queryKey: ['yamlWorkflows', id, 'versions', version],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions/${version}`),\n enabled: !!id && version !== null,\n });\n}\n"],"names":["useYamlWorkflows","filters","params","useQuery","apiFetch","useYamlWorkflowAppIds","useYamlWorkflow","id","useCreateYamlWorkflow","queryClient","useQueryClient","useMutation","input","useDeployYamlWorkflow","useActivateYamlWorkflow","useInvokeYamlWorkflow","data","sync","execute_as","useRegenerateYamlWorkflow","task_queue","compilation_feedback","useArchiveYamlWorkflow","useRestoreYamlWorkflow","useUpdateYamlWorkflow","updates","useDeleteYamlWorkflow","useYamlWorkflowVersions","useYamlWorkflowVersion","version"],"mappings":"qGAmBO,SAASA,EAAiBC,EAA+B,GAAI,CAClE,MAAMC,EAAS,IAAI,gBACnB,OAAID,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,aAAaC,EAAO,IAAI,cAAeD,EAAQ,WAAW,EAClEA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,OAAOC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EACxDA,EAAQ,SAAW,QAAWC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EAEtEE,EAAmC,CACxC,SAAU,CAAC,gBAAiBF,CAAO,EACnC,QAAS,IAAMG,EAAS,mBAAmBF,CAAM,EAAE,CAAA,CACpD,CACH,CAEO,SAASG,GAAwB,CACtC,OAAOF,EAAgC,CACrC,SAAU,CAAC,oBAAoB,EAC/B,QAAS,IAAMC,EAAS,yBAAyB,CAAA,CAClD,CACH,CAcO,SAASE,EAAgBC,EAAY,CAC1C,OAAOJ,EAA+B,CACpC,SAAU,CAAC,gBAAiBI,CAAE,EAC9B,QAAS,IAAMH,EAAS,mBAAmBG,CAAE,EAAE,EAC/C,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAwB,CACtC,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaC,GAWXR,EAA+B,kBAAmB,CAChD,OAAQ,OACR,KAAM,KAAK,UAAUQ,CAAK,CAAA,CAC3B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASI,GAAwB,CACtC,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,UAAW,CAC7D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASK,GAA0B,CACxC,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,YAAa,CAC/D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASM,GAAwB,CACtC,MAAMN,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,GAAAJ,EAAI,KAAAS,EAAM,KAAAC,EAAM,WAAAC,KAC7Bd,EAAgD,mBAAmBG,CAAE,UAAW,CAC9E,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAS,EAAM,KAAAC,EAAM,GAAIC,EAAa,CAAE,WAAAA,CAAA,EAAe,GAAK,CAAA,CAC3E,EACH,UAAW,IAAM,CACfT,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASU,GAA4B,CAC1C,MAAMV,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,GAAAJ,EAAI,WAAAa,EAAY,qBAAAC,KAC7BjB,EAA+B,mBAAmBG,CAAE,cAAe,CACjE,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,WAAAa,EAAY,qBAAAC,EAAsB,CAAA,CAC1D,EACH,UAAW,IAAM,CACfZ,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASa,GAAyB,CACvC,MAAMb,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,WAAY,CAC9D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASc,GAAyB,CACvC,MAAMd,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,WAAY,CAC9D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,EACjFA,EAAY,kBAAkB,CAAE,SAAU,CAAC,cAAc,EAAG,YAAa,MAAO,CAClF,CAAA,CACD,CACH,CAEO,SAASe,GAAwB,CACtC,MAAMf,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,GAAAJ,EAAI,GAAGkB,KACpBrB,EAA+B,mBAAmBG,CAAE,GAAI,CACtD,OAAQ,MACR,KAAM,KAAK,UAAUkB,CAAO,CAAA,CAC7B,EACH,UAAW,IAAM,CACfhB,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASiB,GAAwB,CACtC,MAAMjB,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,GAAI,CACtD,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAsCO,SAASkB,EAAwBpB,EAAY,CAClD,OAAOJ,EAA+D,CACpE,SAAU,CAAC,gBAAiBI,EAAI,UAAU,EAC1C,QAAS,IAAMH,EAAS,mBAAmBG,CAAE,WAAW,EACxD,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASqB,EAAuBrB,EAAYsB,EAAwB,CACzE,OAAO1B,EAAgC,CACrC,SAAU,CAAC,gBAAiBI,EAAI,WAAYsB,CAAO,EACnD,QAAS,IAAMzB,EAAS,mBAAmBG,CAAE,aAAasB,CAAO,EAAE,EACnE,QAAS,CAAC,CAACtB,GAAMsB,IAAY,IAAA,CAC9B,CACH"}
|
|
1
|
+
{"version":3,"file":"yaml-workflows-D6kzrMYx.js","sources":["../../src/api/yaml-workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTYamlWorkflowRecord, LTYamlWorkflowStatus, LTYamlWorkflowVersion } from './types';\n\ninterface YamlWorkflowListResponse {\n workflows: LTYamlWorkflowRecord[];\n total: number;\n}\n\ninterface YamlWorkflowFilters {\n status?: LTYamlWorkflowStatus;\n graph_topic?: string;\n app_id?: string;\n search?: string;\n set_id?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useYamlWorkflows(filters: YamlWorkflowFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.graph_topic) params.set('graph_topic', filters.graph_topic);\n if (filters.app_id) params.set('app_id', filters.app_id);\n if (filters.search) params.set('search', filters.search);\n if (filters.set_id) params.set('set_id', filters.set_id);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', filters],\n queryFn: () => apiFetch(`/yaml-workflows?${params}`),\n });\n}\n\nexport function useYamlWorkflowAppIds() {\n return useQuery<{ app_ids: string[] }>({\n queryKey: ['yamlWorkflowAppIds'],\n queryFn: () => apiFetch('/yaml-workflows/app-ids'),\n });\n}\n\nexport function useYamlWorkflowByTopic(graphTopic: string | undefined, appId?: string) {\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', 'byTopic', graphTopic, appId],\n queryFn: () => {\n const params = new URLSearchParams({ graph_topic: graphTopic!, limit: '1' });\n if (appId) params.set('app_id', appId);\n return apiFetch(`/yaml-workflows?${params}`);\n },\n enabled: !!graphTopic,\n });\n}\n\nexport function useYamlWorkflow(id: string) {\n return useQuery<LTYamlWorkflowRecord>({\n queryKey: ['yamlWorkflows', id],\n queryFn: () => apiFetch(`/yaml-workflows/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: {\n workflow_id: string;\n task_queue: string;\n workflow_name: string;\n name: string;\n description?: string;\n app_id?: string;\n subscribes?: string;\n tags?: string[];\n compilation_feedback?: string;\n }) =>\n apiFetch<LTYamlWorkflowRecord>('/yaml-workflows', {\n method: 'POST',\n body: JSON.stringify(input),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeployYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/deploy`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useActivateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/activate`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, data, sync, execute_as }: { id: string; data: Record<string, unknown>; sync?: boolean; execute_as?: string }) =>\n apiFetch<{ result?: unknown; job_id?: string }>(`/yaml-workflows/${id}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, sync, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRegenerateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, task_queue, compilation_feedback }: { id: string; task_queue?: string; compilation_feedback?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/regenerate`, {\n method: 'POST',\n body: JSON.stringify({ task_queue, compilation_feedback }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useArchiveYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/archive`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRestoreYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/restore`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflow'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpdateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, ...updates }: { id: string; yaml_content?: string; name?: string; description?: string; input_schema?: Record<string, unknown>; output_schema?: Record<string, unknown>; tags?: string[]; app_id?: string; graph_topic?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify(updates),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<{ deleted: boolean }>(`/yaml-workflows/${id}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Cron scheduling ─────────────────────────────────────────────\n\nexport function useSetYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, cron_schedule, cron_envelope, execute_as }: {\n id: string;\n cron_schedule: string;\n cron_envelope?: Record<string, unknown> | null;\n execute_as?: string | null;\n }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'PUT',\n body: JSON.stringify({ cron_schedule, cron_envelope, execute_as }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useClearYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Version history ─────────────────────────────────────────────\n\nexport function useYamlWorkflowVersions(id: string) {\n return useQuery<{ versions: LTYamlWorkflowVersion[]; total: number }>({\n queryKey: ['yamlWorkflows', id, 'versions'],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions`),\n enabled: !!id,\n });\n}\n\nexport function useYamlWorkflowVersion(id: string, version: number | null) {\n return useQuery<LTYamlWorkflowVersion>({\n queryKey: ['yamlWorkflows', id, 'versions', version],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions/${version}`),\n enabled: !!id && version !== null,\n });\n}\n"],"names":["useYamlWorkflows","filters","params","useQuery","apiFetch","useYamlWorkflowAppIds","useYamlWorkflow","id","useCreateYamlWorkflow","queryClient","useQueryClient","useMutation","input","useDeployYamlWorkflow","useActivateYamlWorkflow","useInvokeYamlWorkflow","data","sync","execute_as","useRegenerateYamlWorkflow","task_queue","compilation_feedback","useArchiveYamlWorkflow","useRestoreYamlWorkflow","useUpdateYamlWorkflow","updates","useDeleteYamlWorkflow","useYamlWorkflowVersions","useYamlWorkflowVersion","version"],"mappings":"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"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-DcQiD6OF.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="./assets/vendor-query-B2UbickB.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="./assets/vendor-react-CXumBFUA.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="./assets/vendor-icons-DPmIjhZB.js">
|
package/docs/hitl-guide.md
CHANGED
|
@@ -181,7 +181,7 @@ The resolver form resolves in order, most specific first:
|
|
|
181
181
|
|
|
182
182
|
1. **`metadata.form_schema`** — a full JSON Schema embedded on the escalation row. Use when different escalation points in the same workflow need different forms.
|
|
183
183
|
2. **The role's `form_schema`** — the versioned form every role provides. When the row carries a `metadata.schema_version` pin (set via `schemaVersion` in the `conditionLT` config), the form renders exactly that snapshot even after the role's schema changes; without a pin, the role's latest applies.
|
|
184
|
-
3. **Workflow config `resolver_schema`** —
|
|
184
|
+
3. **Workflow config `resolver_schema`** — lowest-priority fallback, used only when no role `form_schema` is available.
|
|
185
185
|
|
|
186
186
|
### Versioned Role Schemas
|
|
187
187
|
|
|
@@ -245,7 +245,8 @@ The full custom vocabulary at a glance — every `x-lt-*` keyword and extension
|
|
|
245
245
|
|
|
246
246
|
| Keyword | Level | Purpose |
|
|
247
247
|
|---------|-------|---------|
|
|
248
|
-
| `x-lt-widget` | field | Rich control: `file-upload`, `code-editor`, `signature`, `rich-text`, `markdown` |
|
|
248
|
+
| `x-lt-widget` | field | Rich control: `file-upload`, `code-editor`, `signature`, `rich-text`, `markdown`, `checklist` |
|
|
249
|
+
| `x-lt-source` | field | Data path for context-driven widgets: `"domain.path"` (e.g. `"envelope.checklist_items"`) |
|
|
249
250
|
| `x-lt-language` | field | Syntax hint shown by the `code-editor` widget |
|
|
250
251
|
| `accept` | field | File-type filter for the `file-upload` widget (e.g. `".pdf,.png"`) |
|
|
251
252
|
| `x-lt-bind` | field | Path this field's value occupies in the resolver payload (e.g. `"customer.email"`) |
|
|
@@ -264,11 +265,10 @@ The full custom vocabulary at a glance — every `x-lt-*` keyword and extension
|
|
|
264
265
|
| `required` | schema | Fields that must be filled before submit |
|
|
265
266
|
| `title` / `description` | both | Section header / helper text |
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
upload, spans, required fields, and `x-lt-bind` mapping into a nested payload.
|
|
268
|
+
Two working references ship as example workflows:
|
|
269
|
+
|
|
270
|
+
- `examples/workflows/rich-form/` — the `intake-reviewer` role exercises the whole vocabulary: side-panel help, two-column layout, ordering, date and email formats, enum, file upload, spans, required fields, and `x-lt-bind`.
|
|
271
|
+
- `examples/workflows/checklist-confirmation/` — the `checklist-operator` role demonstrates the `checklist` widget with `x-lt-source` driving a dynamic list of checkboxes from `envelope.checklist_items`.
|
|
272
272
|
|
|
273
273
|
### Supported Field Types
|
|
274
274
|
|
|
@@ -316,6 +316,7 @@ For rich inputs beyond standard HTML types:
|
|
|
316
316
|
| `"signature"` | HTML5 Canvas drawing pad. Outputs PNG data URL. |
|
|
317
317
|
| `"rich-text"` | Tall textarea for formatted text input. |
|
|
318
318
|
| `"markdown"` | Markdown source, rendered with the same engine as the docs drawer (headings, tables, lists, code blocks, callouts). Editable fields get a Write/Preview toggle; with `readOnly: true` the field is a pure content block — see below. |
|
|
319
|
+
| `"checklist"` | Dynamic list of labeled checkboxes. Item definitions come from any context domain at runtime via `x-lt-source`. Stores `Record<string, boolean>` keyed by item id. |
|
|
319
320
|
|
|
320
321
|
```json
|
|
321
322
|
{
|
|
@@ -366,6 +367,57 @@ source rides along in the resolver payload like any read-only field.
|
|
|
366
367
|
Without `readOnly`, the field is a markdown *editor* — the resolver writes source in
|
|
367
368
|
a Write/Preview toggle and the submitted value is the markdown text.
|
|
368
369
|
|
|
370
|
+
#### Checklist widget (`x-lt-widget: "checklist"`)
|
|
371
|
+
|
|
372
|
+
A dynamic list of labeled checkboxes driven by runtime data in the escalation context. The item definitions come from a domain path declared in `x-lt-source` — the form schema itself never changes as item count or labels vary across escalations.
|
|
373
|
+
|
|
374
|
+
The field type must be `"object"`. The submitted value is `Record<string, boolean>` keyed by item id (e.g. `{ "item_0": true, "item_1": false }`).
|
|
375
|
+
|
|
376
|
+
```json
|
|
377
|
+
{
|
|
378
|
+
"properties": {
|
|
379
|
+
"items": {
|
|
380
|
+
"type": "object",
|
|
381
|
+
"description": "Work through each step and check it off.",
|
|
382
|
+
"x-lt-widget": "checklist",
|
|
383
|
+
"x-lt-source": "envelope.checklist_items"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"required": ["items"]
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
The `x-lt-source` value is `"domain.path"` — the same domain/path convention used by `x-lt-showIf` and `x-lt-help` tokens. The dashboard resolves the path at render time and expects an array of `{ id: string; label: string }` objects.
|
|
391
|
+
|
|
392
|
+
**Domain choice:**
|
|
393
|
+
- `envelope` — for item definitions that are render data only (no query cost). The workflow puts them in `conditionLT`'s `envelope` parameter.
|
|
394
|
+
- `metadata` — only when items need to be GIN-indexed and searchable as facets. Adds index cost.
|
|
395
|
+
|
|
396
|
+
**Workflow side:**
|
|
397
|
+
|
|
398
|
+
```typescript
|
|
399
|
+
const checklistItems = [
|
|
400
|
+
{ id: 'item_0', label: 'Step 1: Verify patient ID' },
|
|
401
|
+
{ id: 'item_1', label: 'Step 2: Confirm dosage' },
|
|
402
|
+
];
|
|
403
|
+
|
|
404
|
+
const decision = await conditionLT<{ items: Record<string, boolean> }>(signalId, {
|
|
405
|
+
role: 'checklist-operator',
|
|
406
|
+
envelope: {
|
|
407
|
+
checklist_items: checklistItems,
|
|
408
|
+
formDefaults: {
|
|
409
|
+
items: Object.fromEntries(checklistItems.map((i) => [i.id, false])),
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
const allConfirmed = Object.values(decision.items).every(Boolean);
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Pre-populating `formDefaults.items` with `false` for each id opens the form with every checkbox unchecked rather than indeterminate.
|
|
418
|
+
|
|
419
|
+
The `examples/workflows/checklist-confirmation/` workflow is the reference: it accepts a `count` input (1–20), generates that many items, suspends for a human to check them off, and returns a summary including `confirmed`, `unconfirmed`, and `allConfirmed`.
|
|
420
|
+
|
|
369
421
|
### Help Panel (`x-lt-help`)
|
|
370
422
|
|
|
371
423
|
Schema-level `x-lt-help` carries the form's guidance — checklists, tier tables,
|
|
@@ -966,75 +1018,167 @@ if (result.confidence < 0.8) {
|
|
|
966
1018
|
|
|
967
1019
|
## Worked Examples
|
|
968
1020
|
|
|
1021
|
+
Each example is a complete `conditionLT` call. The form schema lives in `metadata.form_schema` inside the config; the signal key is the first argument and is never duplicated in metadata.
|
|
1022
|
+
|
|
969
1023
|
### Simple Approval
|
|
970
1024
|
|
|
971
|
-
A workflow
|
|
1025
|
+
A workflow pauses for a yes/no decision. The resolver's payload shape is declared as the generic type parameter so the workflow is fully typed after resume.
|
|
972
1026
|
|
|
973
1027
|
```typescript
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1028
|
+
import { conditionLT } from '@hotmeshio/long-tail';
|
|
1029
|
+
|
|
1030
|
+
export async function approveSpendWorkflow(envelope: LTEnvelope) {
|
|
1031
|
+
const ctx = Durable.workflow.workflowInfo();
|
|
1032
|
+
|
|
1033
|
+
const decision = await conditionLT<{ approved: boolean; notes?: string }>(
|
|
1034
|
+
`spend-approval-${ctx.workflowId}`,
|
|
1035
|
+
{
|
|
1036
|
+
role: 'finance-reviewer',
|
|
1037
|
+
type: 'approval',
|
|
1038
|
+
description: `Approve spend of $${envelope.data.amount} for ${envelope.data.vendor}`,
|
|
1039
|
+
priority: 2,
|
|
1040
|
+
metadata: {
|
|
1041
|
+
form_schema: {
|
|
1042
|
+
title: 'Spend Approval',
|
|
1043
|
+
description: 'Review and approve or reject this spend request.',
|
|
1044
|
+
required: ['approved'],
|
|
1045
|
+
properties: {
|
|
1046
|
+
approved: { type: 'boolean', description: 'Check to approve' },
|
|
1047
|
+
notes: { type: 'string', format: 'textarea', description: 'Optional comments' },
|
|
1048
|
+
},
|
|
1049
|
+
},
|
|
1050
|
+
},
|
|
1051
|
+
timeout: '48h',
|
|
983
1052
|
},
|
|
984
|
-
|
|
1053
|
+
);
|
|
1054
|
+
|
|
1055
|
+
if (decision === null) return { type: 'return' as const, data: { cancelled: true } };
|
|
1056
|
+
if (decision === false) return { type: 'return' as const, data: { timedOut: true } };
|
|
1057
|
+
|
|
1058
|
+
if (decision.approved) {
|
|
1059
|
+
await releasePayment(envelope.data);
|
|
1060
|
+
} else {
|
|
1061
|
+
await notifyRejection(envelope.data, decision.notes);
|
|
1062
|
+
}
|
|
985
1063
|
}
|
|
986
1064
|
```
|
|
987
1065
|
|
|
988
|
-
###
|
|
1066
|
+
### Multi-Field Intake with Layout
|
|
989
1067
|
|
|
990
|
-
|
|
1068
|
+
A structured intake form — two-column layout, ordered fields, required validation, and `x-lt-help` guidance in the side panel.
|
|
991
1069
|
|
|
992
1070
|
```typescript
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1071
|
+
import { conditionLT } from '@hotmeshio/long-tail';
|
|
1072
|
+
|
|
1073
|
+
export async function customerIntakeWorkflow(envelope: LTEnvelope) {
|
|
1074
|
+
const ctx = Durable.workflow.workflowInfo();
|
|
1075
|
+
|
|
1076
|
+
const intake = await conditionLT<{
|
|
1077
|
+
first_name: string;
|
|
1078
|
+
last_name: string;
|
|
1079
|
+
email: string;
|
|
1080
|
+
tier: 'free' | 'pro' | 'enterprise';
|
|
1081
|
+
notes?: string;
|
|
1082
|
+
}>(
|
|
1083
|
+
`intake-${ctx.workflowId}`,
|
|
1084
|
+
{
|
|
1085
|
+
role: 'intake-reviewer',
|
|
1086
|
+
type: 'intake',
|
|
1087
|
+
description: 'New customer intake',
|
|
1088
|
+
priority: 2,
|
|
1089
|
+
envelope: { data: envelope.data },
|
|
1090
|
+
metadata: {
|
|
1091
|
+
form_schema: {
|
|
1092
|
+
title: 'Customer Intake',
|
|
1093
|
+
description: 'Complete all required fields then submit.',
|
|
1094
|
+
'x-lt-layout': 'two-column',
|
|
1095
|
+
'x-lt-order': ['first_name', 'last_name', 'email', 'phone', 'tier', 'notes'],
|
|
1096
|
+
'x-lt-help': '### Intake checklist\n\n1. Confirm the **legal name** matches the ID on file.\n2. Verify the email is reachable — send a test message.\n3. Select tier based on the sales order.\n\n> Escalate non-standard contract language to legal.',
|
|
1097
|
+
required: ['first_name', 'last_name', 'email', 'tier'],
|
|
1098
|
+
properties: {
|
|
1099
|
+
first_name: { type: 'string' },
|
|
1100
|
+
last_name: { type: 'string' },
|
|
1101
|
+
email: { type: 'string', format: 'email' },
|
|
1102
|
+
phone: { type: 'string' },
|
|
1103
|
+
tier: {
|
|
1104
|
+
type: 'string',
|
|
1105
|
+
enum: ['free', 'pro', 'enterprise'],
|
|
1106
|
+
description: 'Select the customer tier',
|
|
1107
|
+
},
|
|
1108
|
+
notes: {
|
|
1109
|
+
type: 'string',
|
|
1110
|
+
format: 'textarea',
|
|
1111
|
+
'x-lt-span': 2,
|
|
1112
|
+
description: 'Additional notes',
|
|
1113
|
+
},
|
|
1114
|
+
},
|
|
1115
|
+
},
|
|
1116
|
+
},
|
|
1000
1117
|
},
|
|
1001
|
-
|
|
1118
|
+
);
|
|
1119
|
+
|
|
1120
|
+
if (!intake) return { type: 'return' as const, data: { cancelled: true } };
|
|
1121
|
+
|
|
1122
|
+
await provisionAccount({ ...intake });
|
|
1002
1123
|
}
|
|
1003
1124
|
```
|
|
1004
1125
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
### Multi-Field Data Entry
|
|
1126
|
+
### Checklist Confirmation
|
|
1008
1127
|
|
|
1009
|
-
A
|
|
1128
|
+
A dynamic checklist where item labels come from the workflow's envelope, not the static schema. Item count and wording can vary per escalation without ever touching the form schema.
|
|
1010
1129
|
|
|
1011
1130
|
```typescript
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1131
|
+
import { conditionLT } from '@hotmeshio/long-tail';
|
|
1132
|
+
|
|
1133
|
+
export async function stationCheckWorkflow(envelope: LTEnvelope) {
|
|
1134
|
+
const ctx = Durable.workflow.workflowInfo();
|
|
1135
|
+
|
|
1136
|
+
const steps = [
|
|
1137
|
+
{ id: 'step_0', label: 'Verify patient ID matches the order' },
|
|
1138
|
+
{ id: 'step_1', label: 'Confirm dosage and route of administration' },
|
|
1139
|
+
{ id: 'step_2', label: 'Sign the dispensing log' },
|
|
1140
|
+
];
|
|
1141
|
+
|
|
1142
|
+
const result = await conditionLT<{ checks: Record<string, boolean> }>(
|
|
1143
|
+
`station-check-${ctx.workflowId}`,
|
|
1144
|
+
{
|
|
1145
|
+
role: 'station-operator',
|
|
1146
|
+
type: 'station-check',
|
|
1147
|
+
description: 'Complete all station checks before releasing',
|
|
1148
|
+
priority: 1,
|
|
1149
|
+
envelope: {
|
|
1150
|
+
checklist_items: steps,
|
|
1151
|
+
formDefaults: {
|
|
1152
|
+
// Pre-populate all checkboxes as unchecked
|
|
1153
|
+
checks: Object.fromEntries(steps.map((s) => [s.id, false])),
|
|
1154
|
+
},
|
|
1029
1155
|
},
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1156
|
+
metadata: {
|
|
1157
|
+
form_schema: {
|
|
1158
|
+
title: 'Station Check',
|
|
1159
|
+
description: 'Work through each step and confirm completion.',
|
|
1160
|
+
required: ['checks'],
|
|
1161
|
+
properties: {
|
|
1162
|
+
checks: {
|
|
1163
|
+
type: 'object',
|
|
1164
|
+
'x-lt-widget': 'checklist',
|
|
1165
|
+
'x-lt-source': 'envelope.checklist_items',
|
|
1166
|
+
description: 'Check each step when complete',
|
|
1167
|
+
},
|
|
1168
|
+
},
|
|
1169
|
+
},
|
|
1035
1170
|
},
|
|
1036
1171
|
},
|
|
1037
|
-
|
|
1172
|
+
);
|
|
1173
|
+
|
|
1174
|
+
if (!result) return { type: 'return' as const, data: { cancelled: true } };
|
|
1175
|
+
|
|
1176
|
+
const allClear = Object.values(result.checks).every(Boolean);
|
|
1177
|
+
const failed = steps.filter((s) => !result.checks[s.id]).map((s) => s.label);
|
|
1178
|
+
|
|
1179
|
+
if (!allClear) {
|
|
1180
|
+
await flagIncomplete({ failed });
|
|
1181
|
+
}
|
|
1038
1182
|
}
|
|
1039
1183
|
```
|
|
1040
1184
|
|
|
@@ -1043,22 +1187,50 @@ metadata: {
|
|
|
1043
1187
|
Password fields are automatically redacted and replaced with ephemeral tokens (15-min TTL) before being sent back to the workflow.
|
|
1044
1188
|
|
|
1045
1189
|
```typescript
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1190
|
+
import { conditionLT } from '@hotmeshio/long-tail';
|
|
1191
|
+
|
|
1192
|
+
export async function credentialProvisionWorkflow(envelope: LTEnvelope) {
|
|
1193
|
+
const ctx = Durable.workflow.workflowInfo();
|
|
1194
|
+
|
|
1195
|
+
const creds = await conditionLT<{
|
|
1196
|
+
api_key: string;
|
|
1197
|
+
api_secret: string; // arrives as eph:v1:* token, never plain text
|
|
1198
|
+
environment: 'sandbox' | 'production';
|
|
1199
|
+
}>(
|
|
1200
|
+
`creds-${ctx.workflowId}`,
|
|
1201
|
+
{
|
|
1202
|
+
role: 'integration-admin',
|
|
1203
|
+
type: 'credential-provision',
|
|
1204
|
+
description: `Provide API credentials for ${envelope.data.integration}`,
|
|
1205
|
+
priority: 1,
|
|
1206
|
+
metadata: {
|
|
1207
|
+
form_schema: {
|
|
1208
|
+
title: 'Provide Credentials',
|
|
1209
|
+
description: 'Enter the API credentials. Secrets are encrypted in transit and stored as ephemeral tokens.',
|
|
1210
|
+
required: ['api_key', 'api_secret', 'environment'],
|
|
1211
|
+
properties: {
|
|
1212
|
+
api_key: { type: 'string', description: 'API Key' },
|
|
1213
|
+
api_secret: {
|
|
1214
|
+
type: 'string',
|
|
1215
|
+
format: 'password',
|
|
1216
|
+
description: 'API Secret — redacted before storage, returned as an ephemeral token',
|
|
1217
|
+
},
|
|
1218
|
+
environment: {
|
|
1219
|
+
type: 'string',
|
|
1220
|
+
enum: ['sandbox', 'production'],
|
|
1221
|
+
description: 'Target environment',
|
|
1222
|
+
},
|
|
1223
|
+
},
|
|
1224
|
+
},
|
|
1059
1225
|
},
|
|
1226
|
+
timeout: '24h',
|
|
1060
1227
|
},
|
|
1061
|
-
|
|
1228
|
+
);
|
|
1229
|
+
|
|
1230
|
+
if (!creds) return { type: 'return' as const, data: { cancelled: true } };
|
|
1231
|
+
|
|
1232
|
+
// creds.api_secret is an eph:v1:* token — pass it to the integration layer for redemption
|
|
1233
|
+
await configureIntegration(envelope.data.integration, creds);
|
|
1062
1234
|
}
|
|
1063
1235
|
```
|
|
1064
1236
|
|
|
@@ -1079,7 +1251,7 @@ const result = await lt.escalations.resolve({
|
|
|
1079
1251
|
});
|
|
1080
1252
|
```
|
|
1081
1253
|
|
|
1082
|
-
This routes through the full resolution path and works for all escalation types — atomic `conditionLT` (signal_key),
|
|
1254
|
+
This routes through the full resolution path and works for all escalation types — atomic `conditionLT` (signal_key), two-step `conditionLT` (signal_id), and re-run-style escalations.
|
|
1083
1255
|
|
|
1084
1256
|
### By metadata key-value pair
|
|
1085
1257
|
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,a as y}from"./vendor-query-B2UbickB.js";import{c as Ct,f as kt,a as St}from"./vendor-react-CXumBFUA.js";import{M as de,j as He,b as qe,u as wt,k as Pt,l as Mt,m as At,n as Tt,g as Et,o as Ot,p as _t,q as Bt,r as $t,s as Ft,t as Lt,v as zt,w as Dt}from"./index-BJwHI2aX.js";import{f as It}from"./useEventHooks-DrtLEQzK.js";import{i as _,u as ue,C as Ge,a as Rt}from"./CustomDurationPicker-CKfgf650.js";import{u as Ut,a as Ht}from"./roles-CDi58HW9.js";import{a as Je}from"./StatusBadge-CEQMRmSQ.js";import{S as Ve}from"./StickyPagination-D_HhyJ5V.js";import{i as qt}from"./CountdownTimer-BrQl3JWm.js";import{a5 as Gt,o as Jt,p as Vt,a6 as Qt,a7 as Kt,k as Wt,j as Xt,a8 as Yt,a9 as Zt,aa as es,ab as ts,ac as _e,ad as ss,S as as,X as Be}from"./vendor-icons-DPmIjhZB.js";import{u as ns}from"./useFilterParams-x-Dg0Vgz.js";import{u as Qe}from"./useDebouncedValue-BA5S7V54.js";import{b as ls}from"./api-path-u2Jf9QXS.js";import{D as rs}from"./DataTable-Byn3oyT9.js";import{P as is}from"./PageHeader-CiFhzGc0.js";import{P as os}from"./constants-BHkpVaqx.js";import{M as me}from"./Modal-CSrxpXeM.js";import{u as cs}from"./users-FTnxEv_t.js";import{m as ds,E as xs}from"./escalation-columns-CSG3LG3F.js";import{R as us,a as ms}from"./RowActions-BA9L9djf.js";import{L as hs}from"./ListToolbar-DmRE3_dX.js";import"./EmptyState-BcsfPq9T.js";import"./FilterBar-DDIn8TOs.js";import"./PriorityBadge-B4ykBH7f.js";import"./RolePill-CUIJSgRq.js";import"./WorkflowPill-S6VV2Eax.js";const U=t=>{if(t)try{return JSON.parse(t)}catch{return}},z=t=>t==null||Array.isArray(t)&&t.length===0||typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0;function ps(t){const s={},l=U(t.get("facets"));z(l)||(s.facets=l);const a=U(t.get("block"));z(a)||(s.block=a);const x=U(t.get("range"));z(x)||(s.range=x);const o=U(t.get("exists"));z(o)||(s.exists=o);const u=U(t.get("roles"));z(u)||(s.roles=u);const p=U(t.get("orderBy"));return z(p)||(s.orderBy=p),t.get("available")!=null&&(s.available=t.get("available")==="true"),s}function fs(t,s){const l=(a,x)=>z(x)?t.delete(a):t.set(a,JSON.stringify(x));l("facets",s.facets),l("block",s.block),l("range",s.range),l("exists",s.exists),l("roles",s.roles),l("orderBy",s.orderBy),s.available==null?t.delete("available"):t.set("available",String(s.available))}function gs(t){var s,l,a,x;return Object.keys(t.facets??{}).length+(((s=t.block)==null?void 0:s.length)??0)+(((l=t.range)==null?void 0:l.length)??0)+(((a=t.exists)==null?void 0:a.length)??0)+(((x=t.orderBy)==null?void 0:x.length)??0)+(t.available!=null?1:0)}const bs=["<","<=",">",">=","="],js=["priority","created_at","updated_at","status","role"],F="h-7 rounded border border-surface-border bg-surface px-2 text-xs text-text-primary focus:border-accent focus:outline-none",Z="text-text-tertiary hover:text-text-primary transition-colors";function $e(t){return t==="true"?!0:t==="false"?!1:t.trim()!==""&&!Number.isNaN(Number(t))?Number(t):t}const ys=t=>Object.entries(t??{}).map(([s,l])=>({key:s,value:String(l)})),vs=t=>(t??[]).map(s=>{const[l,a]=Object.entries(s)[0]??["",""];return{key:l,value:String(a)}});function H({title:t,hint:s,children:l}){return e.jsxs("div",{className:"border-t border-surface-border/50 py-3 first:border-t-0 first:pt-1",children:[e.jsxs("div",{className:"mb-1.5 flex items-baseline justify-between",children:[e.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-text-tertiary",children:t}),s&&e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary/70",children:s})]}),l]})}function ee({value:t,onChange:s,placeholder:l}){return e.jsx("input",{list:"lt-facet-keys",className:`${F} w-40`,placeholder:l,value:t,onChange:a=>s(a.target.value)})}function Ns({value:t,onChange:s,facetKeys:l=[],search:a="",onSearchChange:x}){const o=ys(t.facets),u=vs(t.block),p=t.range??[],r=t.exists??[],v=t.orderBy??[],f=n=>{const d={};for(const m of n)m.key&&(d[m.key]=$e(m.value));s({...t,facets:Object.keys(d).length?d:void 0})},g=n=>{const d=n.filter(m=>m.key).map(m=>({[m.key]:$e(m.value)}));s({...t,block:d.length?d:void 0})},b=n=>s({...t,range:n.length?n:void 0}),w=n=>s({...t,exists:n.length?n:void 0}),N=n=>s({...t,orderBy:n.length?n:void 0});return e.jsxs("div",{className:"text-xs",children:[e.jsx("datalist",{id:"lt-facet-keys",children:l.map(n=>e.jsx("option",{value:n},n))}),e.jsxs("datalist",{id:"lt-sort-fields",children:[js.map(n=>e.jsx("option",{value:n},n)),l.map(n=>e.jsx("option",{value:`metadata.${n}`},n))]}),x&&e.jsx(H,{title:"Match id",hint:"id · workflow · origin",children:e.jsx("input",{className:`${F} w-full`,placeholder:"Exact escalation, workflow, or origin id…",value:a,onChange:n=>x(n.target.value)})}),e.jsx(H,{title:"Has facet",hint:"metadata @>",children:[...o,{key:"",value:""}].map((n,d)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(ee,{value:n.key,placeholder:"key",onChange:m=>{const h=[...o];h[d]={...n,key:m},f(h)}}),e.jsx("span",{className:"text-text-tertiary",children:"="}),e.jsx("input",{className:`${F} w-40`,placeholder:"value",value:n.value,onChange:m=>{const h=[...o];h[d]={...n,value:m.target.value},f(h)}}),d<o.length&&e.jsx("button",{className:Z,onClick:()=>f(o.filter((m,h)=>h!==d)),children:"×"})]},d))}),e.jsx(H,{title:"Range",hint:"numeric",children:[...p,{facet:"",op:"<=",value:0}].map((n,d)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(ee,{value:n.facet,placeholder:"numeric facet",onChange:m=>{const h=[...p];h[d]={...n,facet:m},b(h.filter(S=>S.facet))}}),e.jsx("select",{className:F,value:n.op,onChange:m=>{const h=[...p];h[d]={...n,op:m.target.value},b(h.filter(S=>S.facet))},children:bs.map(m=>e.jsx("option",{value:m,children:m},m))}),e.jsx("input",{type:"number",className:`${F} w-24`,value:n.value,onChange:m=>{const h=[...p];h[d]={...n,value:Number(m.target.value)},b(h.filter(S=>S.facet))}}),d<p.length&&e.jsx("button",{className:Z,onClick:()=>b(p.filter((m,h)=>h!==d)),children:"×"})]},d))}),e.jsx(H,{title:"Has key",hint:"metadata ? key",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[r.map(n=>e.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent/15 px-1.5 py-0.5 text-accent",children:[n,e.jsx("button",{className:"text-accent/70 hover:text-accent",onClick:()=>w(r.filter(d=>d!==n)),children:"×"})]},n)),e.jsx(ee,{value:"",placeholder:"+ key",onChange:n=>{n&&!r.includes(n)&&w([...r,n])}})]})}),e.jsx(H,{title:"Exclude",hint:"NOT @>",children:[...u,{key:"",value:""}].map((n,d)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(ee,{value:n.key,placeholder:"key",onChange:m=>{const h=[...u];h[d]={...n,key:m},g(h)}}),e.jsx("span",{className:"text-text-tertiary",children:"="}),e.jsx("input",{className:`${F} w-40`,placeholder:"value",value:n.value,onChange:m=>{const h=[...u];h[d]={...n,value:m.target.value},g(h)}}),d<u.length&&e.jsx("button",{className:Z,onClick:()=>g(u.filter((m,h)=>h!==d)),children:"×"})]},d))}),e.jsx(H,{title:"Sort by",children:[...v,{field:"",direction:"asc"}].map((n,d)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx("input",{list:"lt-sort-fields",className:`${F} w-44`,placeholder:"column or metadata.key",value:n.field,onChange:m=>{const h=[...v];h[d]={...n,field:m.target.value},N(h.filter(S=>S.field))}}),e.jsxs("select",{className:F,value:n.direction??"asc",onChange:m=>{const h=[...v];h[d]={...n,direction:m.target.value},N(h.filter(S=>S.field))},children:[e.jsx("option",{value:"asc",children:"asc"}),e.jsx("option",{value:"desc",children:"desc"})]}),e.jsxs("label",{className:"flex items-center gap-1 text-text-tertiary",children:[e.jsx("input",{type:"checkbox",checked:!!n.numeric,onChange:m=>{const h=[...v];h[d]={...n,numeric:m.target.checked},N(h.filter(S=>S.field))}}),"num"]}),d<v.length&&e.jsx("button",{className:Z,onClick:()=>N(v.filter((m,h)=>h!==d)),children:"×"})]},d))})]})}function te(t){const s=l=>{if(!l)return null;try{const a=JSON.parse(l);return a&&typeof a=="object"?a:null}catch{return null}};return{escalation:t,metadata:t.metadata??null,envelope:s(t.envelope),payload:s(t.escalation_payload),resolver:s(t.resolver_payload)}}const Cs=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/,Fe="—";function Ke({raw:t}){return!t||t===Fe?e.jsx("span",{className:"text-text-quaternary",children:Fe}):Cs.test(t)?e.jsx(qe,{date:t,format:"datetime",className:"text-text-primary"}):e.jsx(e.Fragment,{children:t})}function ks({esc:t,card:s,onOpen:l}){const a=te(t),x=s.title?_(s.title,a):t.type,o=t.status==="pending"&&!qt(t);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start justify-between gap-6",children:[e.jsxs("button",{onClick:l,className:"text-left group min-w-0",children:[e.jsx("h3",{className:"text-2xl font-light text-text-primary group-hover:text-accent transition-colors leading-tight",children:x}),s.subtitle&&e.jsx("p",{className:"text-xs text-text-tertiary mt-1.5",children:_(s.subtitle,a)})]}),o&&e.jsxs("button",{onClick:l,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-md bg-accent text-text-inverse text-xs font-medium hover:bg-accent-hover transition-colors shrink-0",children:["Claim",e.jsx(Gt,{className:"w-3.5 h-3.5"})]})]}),s.fields&&s.fields.length>0&&e.jsx("dl",{className:"flex flex-wrap gap-x-10 gap-y-4 mt-6",children:s.fields.map((u,p)=>e.jsxs("div",{children:[e.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:u.label}),e.jsx("dd",{className:"text-xs text-text-primary mt-1",children:e.jsx(Ke,{raw:_(u.value,a)})})]},p))}),s.body&&e.jsx("div",{className:"mt-7 pt-6 border-t border-surface-border/50",children:e.jsx(de,{content:_(s.body,a)})})]})}function Ss({role:t,def:s,onRowClick:l}){var v,f;const[a,x]=y.useState(!1),o=He({role:t,status:s.status??"resolved",sort_by:"resolved_at",order:"desc",limit:s.limit??25,enabled:a}),u=((v=o.data)==null?void 0:v.escalations)??[],p=((f=o.data)==null?void 0:f.total)??0,r=s.row??{};return a?o.isLoading?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"Loading history…"}):u.length===0?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No past revisions."}):e.jsxs("div",{children:[e.jsx("div",{className:"divide-y divide-surface-border/40",children:u.map(g=>{const b=te(g);return e.jsxs("button",{onClick:()=>l==null?void 0:l(g),className:"w-full text-left py-2.5 group flex items-center gap-3",children:[e.jsx("span",{className:`w-1.5 h-1.5 shrink-0 rounded-full dot-ring ${Je[g.status]??"bg-status-pending"}`,title:g.status}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-xs text-text-primary group-hover:text-accent transition-colors truncate",children:r.title?_(r.title,b):g.type}),r.subtitle&&e.jsx("span",{className:"block text-[10px] text-text-tertiary truncate",children:_(r.subtitle,b)})]}),r.meta?e.jsx("span",{className:"text-[10px] text-text-tertiary shrink-0",children:_(r.meta,b)}):g.resolved_at&&e.jsx(qe,{date:g.resolved_at,format:"relative",className:"text-[10px] text-text-tertiary shrink-0 whitespace-nowrap"})]},g.id)})}),p>u.length&&e.jsxs("p",{className:"text-[10px] text-text-quaternary mt-3",children:["Showing ",u.length," of ",p,"."]})]}):e.jsx("button",{onClick:()=>x(!0),className:"text-xs text-accent hover:underline","data-testid":"load-history",children:"Load full history →"})}function ws({schema:t,rows:s,onRowClick:l}){const a=t["x-lt-columns"]??[];return s.length===0?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No pending items."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-surface-border/60",children:[e.jsx("th",{className:"w-4 pb-2 pr-3","aria-label":"Status"}),a.map((x,o)=>e.jsx("th",{className:"text-left pb-2 pr-8 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary whitespace-nowrap",children:x.label},o))]})}),e.jsx("tbody",{className:"divide-y divide-surface-border/30",children:s.map(x=>{const o=te(x);return e.jsxs("tr",{onClick:()=>l==null?void 0:l(x),className:l?"group cursor-pointer hover:bg-surface-hover":"group","data-testid":"facet-table-row",children:[e.jsx("td",{className:"py-2.5 pr-3",children:e.jsx("span",{className:`w-1.5 h-1.5 inline-block rounded-full dot-ring ${Je[x.status]??"bg-status-pending"}`,title:x.status})}),a.map((u,p)=>e.jsx("td",{className:"py-2.5 pr-8 text-text-secondary group-hover:text-text-primary transition-colors",children:e.jsx(Ke,{raw:_(u.value,o)})},p))]},x.id)})})]})})}function Le({children:t}){return e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:t})}function Ps({role:t,listSchema:s,activeEscalations:l,onRowClick:a,total:x,page:o,totalPages:u,pageSize:p,onPageChange:r,onPageSizeChange:v}){const f=s["x-lt-layout"],g=s["x-lt-active"]??{},b=l[0],w=s["x-lt-help"],N=b?e.jsx(ks,{esc:b,card:g,onOpen:()=>a==null?void 0:a(b)}):e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No active item right now."}),n=w&&b?e.jsx("div",{className:"mb-8",children:e.jsx(de,{content:_(w,te(b))})}):w?e.jsx("div",{className:"mb-8",children:e.jsx(de,{content:w})}):null;if(f==="facet-table"){const d=x??l.length;return e.jsxs("div",{children:[n,d>0&&e.jsxs("p",{className:"text-[11px] text-text-tertiary mb-3 tabular-nums",children:[d.toLocaleString()," result",d!==1?"s":""]}),e.jsx(ws,{schema:s,rows:l,onRowClick:a}),o!==void 0&&u!==void 0&&r&&e.jsx(Ve,{page:o,totalPages:u,onPageChange:r,total:d,pageSize:p??25,onPageSizeChange:v})]})}return f==="active-history"?e.jsxs("div",{children:[n,e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1.6fr_1fr] gap-12 items-start",children:[e.jsxs("div",{children:[e.jsx(Le,{children:"Active"}),N]}),e.jsxs("div",{children:[e.jsx(Le,{children:"History"}),e.jsx(Ss,{role:t,def:s["x-lt-history"]??{},onRowClick:a})]})]})]}):e.jsxs("div",{children:[n,N]})}const Ms=t=>t.isPriorityPending||t.isClaimPending||t.isAssignPending||t.isEscalatePending||t.isTriagePending||t.isCancelPending,xe="inline-flex items-center h-7 px-2.5 text-[11px] font-medium text-text-secondary bg-surface border border-surface-border rounded-[4px] hover:border-accent/50 hover:text-text-primary transition-colors disabled:opacity-50 disabled:hover:border-surface-border",ce=`${xe} appearance-none cursor-pointer`,As="inline-flex items-center h-7 px-2.5 text-[11px] font-medium text-status-error bg-surface border border-status-error/30 rounded-[4px] hover:border-status-error hover:bg-status-error/5 transition-colors disabled:opacity-50";function Ts(t){var p;const s=Ms(t),l=ue(),{data:a}=wt(),x=Pt(),o=x!==null?x:((p=a==null?void 0:a.ai)==null?void 0:p.enabled)===!0,u=t.selectedCount>0;return e.jsx("div",{className:`grid transition-all duration-200 ease-in-out ${u?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0 pointer-events-none"}`,children:e.jsx("div",{className:"overflow-hidden",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-2.5 pl-3 pr-2 mt-4 mb-3 bg-surface-sunken/60 border-l-2 border-l-accent",children:[e.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-accent tabular-nums",children:[t.selectedCount," selected"]}),e.jsx("div",{className:"mx-1 h-4 w-px bg-surface-border"}),e.jsxs("select",{onChange:r=>{r.target.value&&(t.onSetPriority(parseInt(r.target.value)),r.target.value="")},disabled:s,className:ce,defaultValue:"",children:[e.jsx("option",{value:"",disabled:!0,children:"Priority…"}),os.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))]}),e.jsxs("select",{onChange:r=>{r.target.value&&(t.onClaim(parseInt(r.target.value)),r.target.value="")},disabled:s,className:ce,defaultValue:"",children:[e.jsx("option",{value:"",disabled:!0,children:"Claim for…"}),l.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))]}),e.jsx("button",{onClick:t.onAssign,disabled:s,className:xe,children:t.isAssignPending?"Assigning…":"Assign to…"}),t.availableRoles.length>0&&e.jsxs("select",{onChange:r=>{r.target.value&&(t.onEscalate(r.target.value),r.target.value="")},disabled:s,className:ce,defaultValue:"",children:[e.jsx("option",{value:"",disabled:!0,children:"Escalate to…"}),t.availableRoles.map(r=>e.jsx("option",{value:r,children:r},r))]}),o&&e.jsx("button",{onClick:t.onTriage,disabled:s,className:xe,children:t.isTriagePending?"Triaging…":"Triage"}),e.jsx("button",{onClick:t.onCancel,disabled:s,className:As,children:t.isCancelPending?"Cancelling…":"Cancel"}),e.jsx("div",{className:"flex-1"}),s&&e.jsx("span",{className:"text-[11px] text-text-tertiary animate-pulse",children:"Processing…"}),e.jsx("button",{onClick:t.onClearSelection,className:"px-1 text-[11px] font-medium text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"})]})})})}function Es({open:t,onClose:s,selectedCount:l,selectedRoles:a,onSubmit:x,isPending:o}){const{isSuperAdmin:u}=Mt(),p=ue(),[r,v]=y.useState("user"),[f,g]=y.useState(null),[b,w]=y.useState(""),[N,n]=y.useState("30"),[d,m]=y.useState(0),h=y.useCallback(j=>m(j),[]),S=!u&&a.length===1?a[0]:void 0,L=Qe(b,250),{data:i,isLoading:C}=cs({role:S,status:"active",search:L.trim()||void 0,limit:200}),P=(i==null?void 0:i.users)??[],M=()=>{v("user"),g(null),w(""),n("30"),m(0),s()},B=j=>{g(j),v("duration")},A=()=>{v("user")},E=()=>{if(!f)return;const j=N==="custom"?d:parseInt(N);!j||j<=0||x(f.id,j)};return e.jsx(me,{open:t,onClose:M,title:"Assign Escalations",children:e.jsxs("div",{className:"space-y-4",children:[r==="user"&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Select a user to assign"," ",e.jsx("span",{className:"font-medium text-text-primary",children:l})," ","escalation(s) to:"]}),e.jsx("input",{type:"text",value:b,onChange:j=>w(j.target.value),placeholder:"Search by name or email...",className:"input text-xs w-full",autoFocus:!0}),e.jsxs("div",{className:"max-h-60 overflow-y-auto border border-surface-border rounded-lg divide-y divide-surface-border",children:[C&&e.jsx("p",{className:"text-xs text-text-tertiary p-3",children:"Loading users..."}),!C&&P.length===0&&e.jsx("p",{className:"text-xs text-text-tertiary p-3",children:"No users found"}),P.map(j=>e.jsxs("button",{onClick:()=>B(j),className:"w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors",children:[e.jsx("p",{className:"text-xs font-medium text-text-primary",children:j.display_name||j.external_id}),j.email&&e.jsx("p",{className:"text-[10px] text-text-tertiary",children:j.email})]},j.id))]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{onClick:M,className:"btn-secondary text-xs",children:"Cancel"})})]}),r==="duration"&&f&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Assign to"," ",e.jsx("span",{className:"font-medium text-text-primary",children:f.display_name||f.external_id})," ","for:"]}),e.jsxs("select",{value:N,onChange:j=>{n(j.target.value),m(0)},className:"select w-full text-sm",children:[p.map(j=>e.jsx("option",{value:j.value,children:j.label},j.value)),e.jsx("option",{value:"custom",children:"Other..."})]}),N==="custom"&&e.jsx(Ge,{onChange:h,autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:A,className:"btn-secondary text-xs",children:"Back"}),e.jsx("button",{onClick:E,disabled:o,className:"btn-primary text-xs",children:o?"Assigning...":"Assign"})]})]})]})})}function Os({open:t,onClose:s,selectedCount:l,onSubmit:a,isPending:x}){const[o,u]=y.useState(""),p=()=>{a(o||void 0)};return e.jsx(me,{open:t,onClose:s,title:"Submit for AI Triage",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Submit ",e.jsx("span",{className:"font-medium text-text-primary",children:l})," escalation(s) for AI triage? The triage orchestrator will take over resolution."]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium text-text-secondary block mb-1",children:["Triage hint ",e.jsx("span",{className:"text-text-tertiary",children:"(optional)"})]}),e.jsx("input",{type:"text",value:o,onChange:r=>u(r.target.value),placeholder:"e.g., image_orientation",className:"input text-xs font-mono w-full"}),e.jsx("p",{className:"text-[10px] text-text-tertiary mt-1",children:"Guides the triage workflow on what remediation to apply"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:s,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:p,disabled:x,className:"btn-primary text-xs",children:x?"Submitting...":"Submit for Triage"})]})]})})}function q(t,s,l){return a=>{t.mutate(a,{onSuccess:()=>{s(),l==null||l()}})}}function _s(t){const s=()=>[...t.selectedIds];return{handleSetPriority:r=>{q(t.setPriority,t.clearSelection)({ids:s(),priority:r})},handleBulkClaim:r=>{q(t.bulkClaim,t.clearSelection)({ids:s(),durationMinutes:r})},handleBulkEscalate:r=>{q(t.bulkEscalate,t.clearSelection)({ids:s(),targetRole:r})},handleBulkTriage:r=>{q(t.bulkTriage,t.clearSelection,t.closeTriageModal)({ids:s(),hint:r})},handleBulkAssign:(r,v)=>{q(t.bulkAssign,t.clearSelection,t.closeAssignModal)({ids:s(),targetUserId:r,durationMinutes:v})},handleBulkCancel:()=>{q(t.bulkCancel,t.clearSelection,t.closeCancelModal)({ids:s()})}}}function Bs({claimTarget:t,onClose:s,claimDuration:l,onDurationChange:a,claimDurations:x,onCustomClaimChange:o,onClaim:u,isPending:p}){return e.jsx(me,{open:!!t,onClose:s,title:"Claim Escalation",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claim ",e.jsx("span",{className:"font-medium text-text-primary",children:t==null?void 0:t.type})," for:"]}),e.jsxs("select",{value:l,onChange:r=>{a(r.target.value)},className:"select w-full text-sm",children:[x.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value)),e.jsx("option",{value:"custom",children:"Other..."})]}),l==="custom"&&e.jsx(Ge,{onChange:o,autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:s,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:u,className:"btn-primary text-xs",disabled:p,children:p?"Claiming...":"Claim"})]})]})})}const G={pending:"#0ea5e9",claimed:"#f97316",resolved:"#16a34a",cancelled:"#94a3b8",expired:"#64748b"},ze=40,$s=64,Fs=24,De=3;function We(t){return t<6e4?`${Math.round(t/1e3)}s`:t<36e5?`${Math.round(t/6e4)}m`:t<864e5?`${(t/36e5).toFixed(1)}h`:`${(t/864e5).toFixed(1)}d`}function Ie(t){const s=Date.now()-t;return s<6e4?"just now":s<36e5?`${Math.round(s/6e4)}m ago`:s<864e5?`${Math.round(s/36e5)}h ago`:`${Math.round(s/864e5)}d ago`}function Re(t){return t.replace(/-/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Ls(t,s){return t?[...s.filter(a=>a in t),...Object.keys(t).filter(a=>!s.includes(a))].map(a=>[a,t[a]]):[]}function zs({e:t}){const s=t.endMs-t.startMs;if(s<=0)return null;const l=G.pending,a=G.claimed,x=t.status==="cancelled"||t.status==="expired"?G.cancelled:G.resolved;let o=100,u=0,p=0;return t.claimedMs!==null?(o=Math.max(0,Math.min(100,(t.claimedMs-t.startMs)/s*100)),t.isOpen?u=100-o:(u=Math.max(0,Math.min(100-o,(t.endMs-t.claimedMs)/s*100)),p=Math.max(0,100-o-u))):t.isOpen||(p=100,o=0),e.jsxs("div",{className:"mt-2 h-0.5 rounded-full overflow-hidden flex bg-slate-100",children:[o>0&&e.jsx("div",{style:{width:`${o}%`,backgroundColor:l,opacity:.6}}),u>0&&e.jsx("div",{style:{width:`${u}%`,backgroundColor:a,opacity:.6}}),p>0&&e.jsx("div",{style:{width:`${p}%`,backgroundColor:x,opacity:.6}})]})}function Ds({gapMs:t,heightPx:s}){return e.jsx("div",{className:"relative flex items-center justify-center",style:{height:s},children:t>=6e4&&e.jsx("span",{className:"text-[9px] text-slate-300 font-mono bg-white px-2 relative z-10",children:We(t)})})}function Ue({e:t,highlightKeys:s,onRowClick:l,onMetaFacet:a}){const[x,o]=y.useState(!1),u=G[t.displayStatus]??"#94a3b8",p=Ls(t.metadata,s),r=x?p:p.slice(0,De),v=p.length-De;return e.jsxs("div",{className:"cursor-pointer max-w-[460px] min-w-[260px] w-full bg-white rounded-lg shadow-sm border border-slate-200/60 px-3.5 pt-2.5 pb-2 hover:shadow-md hover:border-slate-300/60 transition-all duration-150",style:{borderTopWidth:"3px",borderTopColor:u},onClick:()=>l==null?void 0:l(t),children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-1.5",children:[e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-widest text-slate-400 shrink-0",children:Re(t.role)}),e.jsxs("span",{className:"text-[12px] font-semibold text-slate-800 truncate",title:t.type,children:[t.type,t.subtype&&t.subtype!==t.type&&t.subtype!==""&&e.jsxs("span",{className:"font-normal text-slate-500",children:[" · ",t.subtype]})]})]}),r.length>0&&e.jsxs("div",{className:"border-t border-slate-100 pt-1 space-y-px",children:[r.map(([f,g])=>{const b=String(g),w=s.includes(f);return e.jsxs("div",{className:"group/row flex items-center gap-1.5 -mx-1 px-1 py-[2px] rounded",children:[e.jsx("span",{className:`shrink-0 w-[60px] text-[9px] font-mono uppercase tracking-wide truncate ${w?"text-accent":"text-slate-400"}`,title:f,children:f}),e.jsx("span",{className:`flex-1 min-w-0 text-[11px] font-medium truncate ${w?"text-slate-800":"text-slate-600"}`,title:b,children:b}),e.jsxs("span",{className:"flex items-center gap-px shrink-0 opacity-0 group-hover/row:opacity-100 transition-opacity",children:[e.jsx("button",{className:"p-0.5 rounded text-slate-300 hover:text-accent transition-colors",title:`Filter ${Re(t.role)}: ${f} = ${b}`,onClick:N=>{N.stopPropagation(),a==null||a(f,b,N.shiftKey,t.role)},children:e.jsx(Qt,{className:"w-2.5 h-2.5"})}),e.jsx("button",{className:"p-0.5 rounded text-slate-300 hover:text-accent transition-colors",title:`Search all: ${f} = ${b}`,onClick:N=>{N.stopPropagation(),a==null||a(f,b,N.shiftKey,null)},children:e.jsx(Kt,{className:"w-2.5 h-2.5"})})]})]},f)}),v>0&&e.jsx("button",{className:"flex items-center gap-0.5 text-[9px] text-slate-400 hover:text-accent transition-colors mt-0.5 -mx-1 px-1 py-px",onClick:f=>{f.stopPropagation(),o(g=>!g)},children:x?e.jsxs(e.Fragment,{children:[e.jsx(Wt,{className:"w-2.5 h-2.5"})," less"]}):e.jsxs(e.Fragment,{children:[e.jsx(Xt,{className:"w-2.5 h-2.5"})," ",v," more"]})})]}),e.jsx(zs,{e:t})]})}function Is({escalations:t,highlightKeys:s=[],onRowClick:l,onMetaFacet:a,total:x,page:o,totalPages:u,onPageChange:p,sortAsc:r=!1}){var S,L;const v=Date.now(),f=t.map(i=>{const C=new Date(i.created_at).getTime(),P=i.resolved_at?new Date(i.resolved_at).getTime():null,M=i.claimed_at?new Date(i.claimed_at).getTime():null,B=!P&&i.status!=="cancelled"&&i.status!=="expired",A=P??(B?v:C+3e4),E=i.status==="pending"&&M!==null?"claimed":i.status;return{...i,startMs:C,claimedMs:M,endMs:A,isOpen:B,displayStatus:E}}),g=r?[...f].reverse():f;if(g.length===0)return e.jsx("p",{className:"mt-12 text-center text-sm text-text-tertiary",children:"No escalations matched."});const b=g.length,N=Math.max(Math.abs((((S=g[b-1])==null?void 0:S.startMs)??0)-(((L=g[0])==null?void 0:L.startMs)??0)),1)/Math.max(b-1,1),n=$s/Math.max(N,1),m=new Set(g.map(i=>new Date(i.startMs).toDateString())).size>1;function h(i){const C=new Date(i),P=C.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return m?C.toLocaleDateString([],{month:"short",day:"numeric"})+" "+P:P}return e.jsxs("div",{className:"mt-4 pb-24",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-1/2 -translate-x-px inset-y-0 w-px bg-slate-200/80"}),g.map((i,C)=>{const P=g[C-1],M=P?Math.abs(i.startMs-P.startMs):null,B=M!==null?Math.max(Fs,Math.round(M*n)):0,A=C%2===0,E=G[i.displayStatus]??"#94a3b8",j=i.endMs-i.startMs,Q=i.isOpen?Ie(i.startMs):`${Ie(i.startMs)} · ${We(j)}`;return e.jsxs("div",{children:[C>0&&e.jsx(Ds,{gapMs:M,heightPx:B}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-1 flex justify-end items-center",children:A?e.jsxs("div",{className:"flex items-center",children:[e.jsx(Ue,{e:i,highlightKeys:s,onRowClick:l,onMetaFacet:a}),e.jsx("div",{className:"flex-shrink-0 h-px bg-slate-200/70",style:{width:ze}})]}):e.jsx("span",{className:"text-[10px] text-slate-400 font-mono tabular-nums pr-3",children:Q})}),e.jsx("div",{className:"relative z-10 flex-shrink-0 w-3.5 h-3.5 rounded-full border-2 border-white cursor-pointer transition-all duration-150 hover:scale-[1.5]",style:{backgroundColor:E,boxShadow:`0 0 0 3px ${E}28, 0 1px 3px ${E}30`},onClick:()=>l==null?void 0:l(i)}),e.jsx("div",{className:"flex-1 flex justify-start items-center",children:A?e.jsx("span",{className:"text-[10px] text-slate-400 font-mono tabular-nums pl-3",children:Q}):e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 h-px bg-slate-200/70",style:{width:ze}}),e.jsx(Ue,{e:i,highlightKeys:s,onRowClick:l,onMetaFacet:a})]})})]}),e.jsx("div",{className:"flex justify-center relative z-10 mt-0.5",children:e.jsx("span",{className:"text-[9px] text-slate-400 font-mono tabular-nums bg-white px-1.5",children:h(i.startMs)})})]},i.id)})]}),u>1&&e.jsxs("div",{className:"sticky bottom-0 z-20 bg-surface/95 backdrop-blur-sm border-t border-surface-border -mx-10 px-10 pt-2 pb-4 flex items-center justify-between mt-10",children:[e.jsxs("span",{className:"text-[11px] text-text-tertiary",children:["Page ",e.jsx("span",{className:"font-medium text-text-secondary",children:o})," ","of ",e.jsx("span",{className:"font-medium text-text-secondary",children:u})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>p(o-1),disabled:o<=1,className:"p-1.5 rounded hover:bg-surface-hover disabled:opacity-30 text-text-tertiary hover:text-text-primary transition-colors disabled:cursor-not-allowed",children:e.jsx(Jt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>p(o+1),disabled:o>=u,className:"p-1.5 rounded hover:bg-surface-hover disabled:opacity-30 text-text-tertiary hover:text-text-primary transition-colors disabled:cursor-not-allowed",children:e.jsx(Vt,{className:"w-4 h-4"})})]})]})]})}function ha(){var Se,we,Pe,Me,Ae,Te,Ee;It();const t=Ct(),{filters:s,setFilter:l,pagination:a,sort:x,setSort:o}=ns({filters:{role:"",type:"",priority:"",status:"available",search:""}}),u=Qe(s.search,300),p=ue(),[r,v]=y.useState(null),[f,g]=y.useState("30"),[b,w]=y.useState(0),N=y.useCallback(c=>w(c),[]),[n,d]=y.useState(new Set),[m,h]=y.useState(!1),[S,L]=kt(),i=y.useMemo(()=>ps(S),[S]),C=y.useCallback(c=>{L(k=>{const $=new URLSearchParams(k);return fs($,c),$.delete("page"),$})},[L]),{data:P}=At(m),M=gs(i)+(s.search?1:0),[B,A]=y.useState(!1),[E,j]=y.useState(!1),[Q,se]=y.useState(!1),[ae,he]=y.useState(!1),{canBulk:Xe}=Tt(),[Ye,Ze]=y.useState("auto"),D=Ye!=="off"&&M>0,pe=i.facets?Object.keys(i.facets):[],et=y.useCallback(c=>{const{[c]:k,...$}=i.facets??{};C({...i,facets:Object.keys($).length>0?$:void 0})},[i,C]),fe=y.useCallback((c,k,$,Oe)=>{if(Oe){const Nt=encodeURIComponent(JSON.stringify({[c]:k}));t(`/escalations/available?role=${encodeURIComponent(Oe)}&facets=${Nt}&status=all`)}else C($?{...i,facets:{...i.facets,[c]:k}}:{facets:{[c]:k}})},[i,C,t]),ge=Et(),be=Ot(),je=_t(),ne=Bt(),ye=$t(),le=Ft(),K=Lt(),{data:I}=Ut(),{data:re}=zt();y.useEffect(()=>{d(new Set)},[s.role,s.type,s.priority,s.status,u,a.page,a.pageSize]);const J=s.status||"",V=J==="available",ie=J==="claimed",ve=ie?"pending":J==="resolved"?"resolved":J==="cancelled"?"cancelled":J==="expired"?"expired":void 0,Ne=100,Ce={role:s.role||void 0,type:s.type||void 0,priority:s.priority?parseInt(s.priority):void 0,limit:D?Ne:a.pageSize,offset:a.offset,sort_by:x.sort_by||"created_at",order:x.order||"desc",search:u||void 0,...i},tt=Dt({...Ce,enabled:V}),st=He({status:ve,claimed:ie||void 0,...Ce,enabled:!V}),at=V?tt:st,{data:R,isLoading:nt,error:W,refetch:lt,isFetching:rt}=at,it=ls(`/escalations${V?"/available":""}`,{status:ve,claimed:ie||void 0,role:s.role||void 0,type:s.type||void 0,priority:s.priority||void 0,search:u||void 0,sort_by:x.sort_by||"created_at",order:x.order||"desc",limit:a.pageSize,offset:a.offset,facets:i.facets&&Object.keys(i.facets).length?JSON.stringify(i.facets):void 0,block:(Se=i.block)!=null&&Se.length?JSON.stringify(i.block):void 0,range:(we=i.range)!=null&&we.length?JSON.stringify(i.range):void 0,exists:(Pe=i.exists)!=null&&Pe.length?JSON.stringify(i.exists):void 0,roles:(Me=i.roles)!=null&&Me.length?JSON.stringify(i.roles):void 0,orderBy:(Ae=i.orderBy)!=null&&Ae.length?JSON.stringify(i.orderBy):void 0,available:i.available!=null?String(i.available):void 0}),O=(R==null?void 0:R.escalations)??[],T=(R==null?void 0:R.total)??0,X=s.role||(((Te=i.roles)==null?void 0:Te.length)===1?i.roles[0]:null),[oe,ot]=y.useState(!1),Y=((Ee=Ht(X??"",void 0,!!X).data)==null?void 0:Ee.list_schema)??null,ke=!!X&&!!Y&&!!Y["x-lt-layout"]&&Y["x-lt-layout"]!=="table",ct=ke&&!oe,dt=y.useMemo(()=>{const c=new Set;for(const k of O)n.has(k.id)&&c.add(k.role);return[...c]},[O,n]),xt=y.useCallback(()=>d(new Set),[]),ut=()=>{if(!r)return;const c=f==="custom"?b:parseInt(f);!c||c<=0||ge.mutate({id:r.id,durationMinutes:c},{onSuccess:()=>{v(null),t(`/escalations/detail/${r.id}`)}})},{handleSetPriority:mt,handleBulkClaim:ht,handleBulkEscalate:pt,handleBulkTriage:ft,handleBulkAssign:gt,handleBulkCancel:bt}=_s({selectedIds:n,clearSelection:xt,setPriority:be,bulkClaim:je,bulkEscalate:ye,bulkTriage:le,bulkAssign:ne,bulkCancel:K,closeTriageModal:()=>A(!1),closeAssignModal:()=>j(!1),closeCancelModal:()=>se(!1)}),jt=c=>{const k=new Set(n);k.has(c)?k.delete(c):k.add(c),d(k)},yt=()=>{n.size===O.length?d(new Set):d(new Set(O.map(c=>c.id)))},vt=[Xe?{key:"select",label:e.jsx("input",{type:"checkbox",checked:O.length>0&&n.size===O.length,onChange:yt,className:"rounded"}),render:c=>e.jsx("input",{type:"checkbox",checked:n.has(c.id),onChange:k=>{k.stopPropagation(),jt(c.id)},onClick:k=>k.stopPropagation(),className:"rounded"}),className:"w-10"}:{key:"spacer",label:"",render:()=>null,className:"w-10"},...ds({onMetaFacet:fe,highlightKeys:pe}),{key:"actions",label:"",render:c=>e.jsx(us,{children:e.jsx(ms,{icon:Yt,title:"Claim escalation",onClick:()=>v(c),colorClass:"text-accent/75 hover:text-accent",size:"sm"})}),className:"w-10 text-right"}];return e.jsxs("div",{children:[e.jsx(is,{title:"All Escalations",docsHash:"#docs:dashboard.md:all-escalations"}),e.jsx(xs,{filters:s,setFilter:l,roles:(I==null?void 0:I.roles)??[],types:(re==null?void 0:re.types)??[],showStatus:!0,showSearch:!1,actions:e.jsxs(e.Fragment,{children:[D&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[11px] text-text-tertiary whitespace-nowrap",children:[T>100&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"font-medium text-text-secondary",children:[(a.page-1)*100+1,"–",Math.min(a.page*100,T)]})," of "]}),e.jsx("span",{className:"font-medium text-text-secondary",children:T})," ",T===1?"escalation":"escalations"]}),e.jsxs("div",{className:"flex items-center rounded overflow-hidden border border-slate-200",children:[e.jsx("button",{onClick:()=>he(!1),className:`px-1.5 py-1 transition-colors ${ae?"text-text-tertiary hover:bg-surface-hover":"bg-accent text-white"}`,title:"Newest first",children:e.jsx(Zt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>he(!0),className:`px-1.5 py-1 border-l border-slate-200 transition-colors ${ae?"bg-accent text-white":"text-text-tertiary hover:bg-surface-hover"}`,title:"Oldest first",children:e.jsx(es,{className:"w-3.5 h-3.5"})})]}),e.jsx("span",{className:"h-3.5 w-px bg-surface-border shrink-0"})]}),e.jsx(hs,{onRefresh:()=>lt(),isFetching:rt,apiPath:it}),ke&&!D&&e.jsx("button",{onClick:()=>ot(c=>!c),className:"ml-2 inline-flex h-7 w-7 items-center justify-center rounded text-text-tertiary hover:bg-surface-hover hover:text-text-primary transition-colors",title:oe?"Rich view":"Table view",children:oe?e.jsx(ts,{className:"w-4 h-4"}):e.jsx(_e,{className:"w-4 h-4"})}),M>0&&e.jsx("button",{onClick:()=>Ze(c=>c==="off"?"auto":"off"),className:"ml-2 inline-flex h-7 w-7 items-center justify-center rounded text-text-tertiary hover:bg-surface-hover hover:text-text-primary transition-colors",title:D?"Table view":"Timeline view",children:D?e.jsx(_e,{className:"w-4 h-4"}):e.jsx(ss,{className:"w-4 h-4"})}),e.jsxs("button",{onClick:()=>h(c=>!c),className:"relative ml-2 inline-flex h-7 w-7 items-center justify-center rounded text-text-tertiary hover:bg-surface-hover hover:text-text-primary transition-colors",title:"Faceted query",children:[e.jsx(as,{className:"w-4 h-4"}),M>0&&e.jsx("span",{className:"absolute -right-1 -top-1 flex h-3.5 min-w-[14px] items-center justify-center rounded-full bg-accent px-0.5 text-[9px] font-medium text-white",children:M})]})]})}),St.createPortal(e.jsxs("div",{className:`fixed right-0 bottom-0 w-[420px] z-40 border-l border-surface-border bg-surface overflow-y-auto shadow-lg transition-transform duration-200 ease-out ${m?"translate-x-0":"pointer-events-none translate-x-full"}`,style:{top:"3.5rem"},"aria-hidden":!m,children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-4 py-3 bg-surface border-b border-surface-border/50",children:[e.jsx("span",{className:"text-xs font-medium text-text-primary",children:"Faceted query"}),e.jsxs("div",{className:"flex items-center gap-2",children:[M>0&&e.jsx("button",{onClick:()=>{C({}),l("search","")},className:"text-[11px] text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"}),e.jsx("button",{onClick:()=>h(!1),className:"p-1 rounded hover:bg-surface-hover text-text-tertiary hover:text-text-primary transition-colors",title:"Close",children:e.jsx(Be,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"px-4 py-2",children:[e.jsxs("p",{className:"mb-2 text-[11px] leading-snug text-text-tertiary",children:["Precise metadata facets plus exact correlation-id lookup — they compose in one SQL query. Facet keys are the ones that actually exist in your visible escalations. Set status to ",e.jsx("span",{className:"font-medium",children:"All"})," to find an order across every status; the whole query is shareable via the URL."]}),e.jsx(Ns,{value:i,onChange:C,facetKeys:(P==null?void 0:P.keys)??[],search:s.search??"",onSearchChange:c=>l("search",c)})]})]}),document.body),e.jsx(Ts,{selectedCount:n.size,onClearSelection:()=>d(new Set),onSetPriority:mt,onClaim:ht,onAssign:()=>j(!0),onEscalate:pt,onTriage:()=>A(!0),onCancel:()=>se(!0),isPriorityPending:be.isPending,isClaimPending:je.isPending,isAssignPending:ne.isPending,isEscalatePending:ye.isPending,isTriagePending:le.isPending,isCancelPending:K.isPending,availableRoles:(I==null?void 0:I.roles)??[]}),i.facets&&Object.keys(i.facets).length>0&&e.jsxs("div",{className:"sticky top-14 z-30 bg-surface/98 backdrop-blur-sm border-b border-surface-border/30 -mx-10 px-10 py-2 flex items-center gap-1.5 flex-wrap",children:[Object.entries(i.facets).map(([c,k])=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-accent/25 bg-accent/8 px-2.5 py-0.5 text-[10px] font-medium text-accent/90",children:[e.jsx("span",{className:"font-mono text-text-tertiary",children:c}),e.jsx("span",{className:"text-text-quaternary",children:"="}),e.jsx("span",{className:"font-mono max-w-[160px] truncate",title:String(k),children:String(k)}),e.jsx("button",{onClick:()=>et(c),className:"ml-0.5 -mr-0.5 flex items-center text-text-quaternary hover:text-status-error transition-colors","aria-label":`Remove ${c} filter`,children:e.jsx(Be,{className:"w-2.5 h-2.5"})})]},c)),Object.keys(i.facets).length>1&&e.jsx("button",{onClick:()=>C({...i,facets:void 0}),className:"text-[10px] text-text-quaternary hover:text-text-secondary transition-colors px-1",children:"clear all"})]}),W&&e.jsx("div",{className:"mb-4 px-4 py-3 rounded-md bg-status-error/10 border border-status-error/20 text-xs text-status-error",children:W.message==="Session expired"?"Your session has expired. Please log in again.":`Failed to load escalations: ${W.message}`}),D?e.jsx(Is,{escalations:O,highlightKeys:pe,onRowClick:c=>t(`/escalations/detail/${c.id}`,{state:{from:"/escalations/available"}}),onMetaFacet:fe,total:T,page:a.page,totalPages:Math.ceil(T/Ne),onPageChange:a.setPage,sortAsc:ae}):ct?e.jsx(Ps,{role:X,listSchema:Y,activeEscalations:O,onRowClick:c=>t(`/escalations/detail/${c.id}`,{state:{from:"/escalations/available"}}),total:T,page:a.page,totalPages:a.totalPages(T),pageSize:a.pageSize,onPageChange:a.setPage,onPageSizeChange:a.setPageSize}):e.jsxs(e.Fragment,{children:[e.jsx(rs,{columns:vt,data:O,keyFn:c=>c.id,onRowClick:c=>t(`/escalations/detail/${c.id}`,{state:{from:"/escalations/available"}}),isLoading:nt,emptyMessage:W?"Unable to load data":"No escalations",sort:x,onSort:o}),e.jsx(Ve,{page:a.page,totalPages:a.totalPages(T),onPageChange:a.setPage,total:T,pageSize:a.pageSize,onPageSizeChange:a.setPageSize})]}),e.jsx(Bs,{claimTarget:r,onClose:()=>v(null),claimDuration:f,onDurationChange:c=>{g(c),w(0)},claimDurations:p,customClaimMinutes:b,onCustomClaimChange:N,onClaim:ut,isPending:ge.isPending}),e.jsx(Os,{open:B,onClose:()=>A(!1),selectedCount:n.size,onSubmit:ft,isPending:le.isPending}),e.jsx(Es,{open:E,onClose:()=>j(!1),selectedCount:n.size,selectedRoles:dt,onSubmit:gt,isPending:ne.isPending}),e.jsx(Rt,{open:Q,onClose:()=>se(!1),onConfirm:bt,selectedCount:n.size,isPending:K.isPending,error:K.error})]})}export{ha as AvailableEscalationsPage};
|
|
2
|
-
//# sourceMappingURL=AvailableEscalationsPage-B1cCs4jO.js.map
|