@objectstack/console 17.0.0 → 17.2.0
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/CHANGELOG.md +452 -0
- package/dist/.objectstack-injection.json +13 -0
- package/dist/.objectui-sha +1 -1
- package/dist/assets/AdapterProvider-gULVLpjV.js +3 -0
- package/dist/assets/AiPendingActionsPage-CyG11hX9.js +1 -0
- package/dist/assets/ApiConsolePage-DYuOp_W4.js +1 -0
- package/dist/assets/AppDocsIndex-BXkNskk1.js +1 -0
- package/dist/assets/AppManagementPage-BvSxDdA_.js +1 -0
- package/dist/assets/ApprovalsInboxPage-oep3a-Ek.js +1 -0
- package/dist/assets/AuditLogPage-BZZ6tzHu.js +1 -0
- package/dist/assets/ComponentNavView-Cq4wkNUa.js +1 -0
- package/dist/assets/DashboardView-C23ZCS2S.js +1 -0
- package/dist/assets/{DeveloperHubPage-DVKVm5k0.js → DeveloperHubPage-KEpKc45V.js} +1 -1
- package/dist/assets/DocPage-Y4rWCZ3E.js +1 -0
- package/dist/assets/{DocShell-C1VQpTIJ.js → DocShell-DMJHUgE5.js} +1 -1
- package/dist/assets/DocsIndex-Bb5OtPb3.js +1 -0
- package/dist/assets/DocsLayout-CoIVTMH_.js +1 -0
- package/dist/assets/DocsSlug-BARWHmXg.js +1 -0
- package/dist/assets/{ExpressionProvider-qmd0nVCn.js → ExpressionProvider-vGLngw8h.js} +1 -1
- package/dist/assets/FlowRunsPage-BeGa9_ge.js +1 -0
- package/dist/assets/{IntegrationsPage-Cq4mWRFh.js → IntegrationsPage-DTXA-Nne.js} +2 -2
- package/dist/assets/InterfaceListPage-BMvedZyV.js +1 -0
- package/dist/assets/{ManagedByBadge-DgsrLolr.js → ManagedByBadge-mKmG0hP7.js} +1 -1
- package/dist/assets/MarketplaceAccessDenied-BBMyNu2w.js +1 -0
- package/dist/assets/{MarketplaceInstalledPage-CRe2BiM2.js → MarketplaceInstalledPage-B4qrvb7w.js} +1 -1
- package/dist/assets/MarketplacePackagePage-BuVfVeBj.js +4 -0
- package/dist/assets/MarketplacePage-Cmltk5nG.js +1 -0
- package/dist/assets/{MetadataInspector-qQ85bFun.js → MetadataInspector-kVAu8vlh.js} +1 -1
- package/dist/assets/MetadataProvider-DyFZSNqq.js +1 -0
- package/dist/assets/{MonacoImpl-DStuouLX.js → MonacoImpl-Cu_-ISwm.js} +1 -1
- package/dist/assets/ObjectDataPage-BKHEYwXA.js +1 -0
- package/dist/assets/PageView-CTqS-VD9.js +1 -0
- package/dist/assets/ProfilePage-CBUxXn5a.js +1 -0
- package/dist/assets/PublicFormsPage-B8Dk8fky.js +1 -0
- package/dist/assets/RecordDetailView-BBNqsNy9.js +11 -0
- package/dist/assets/RecordFormPage-CeUmmc_n.js +1 -0
- package/dist/assets/ReportDefaultInspector-CRjDi2Er.js +3 -0
- package/dist/assets/ReportView-Cwi_Po4H.js +2 -0
- package/dist/assets/SearchResultsPage-Cg0oq2by.js +1 -0
- package/dist/assets/SettingsHub-B5_S9YgI.js +1 -0
- package/dist/assets/SettingsView-Csi1awf-.js +1 -0
- package/dist/assets/SystemHubPage-CnDri9oU.js +1 -0
- package/dist/assets/{abnfDiagram-N423BO3Z-Ck9FUrgJ.js → abnfDiagram-N423BO3Z-DfpQlDUF.js} +1 -1
- package/dist/assets/{architectureDiagram-T3A2C74G-DJbnVK1q.js → architectureDiagram-T3A2C74G-Ej_4n3NG.js} +1 -1
- package/dist/assets/{assistantBus-DNogw1P-.js → assistantBus-DNH-fDWN.js} +1 -1
- package/dist/assets/{blockDiagram-VBNYF7ZC-Qtci47Jq.js → blockDiagram-VBNYF7ZC-l_P_W7_Y.js} +1 -1
- package/dist/assets/{c4Diagram-5PPSVZJV-DC9Uk9FW.js → c4Diagram-5PPSVZJV-CE82HAlO.js} +1 -1
- package/dist/assets/channel-DowAYf9b.js +1 -0
- package/dist/assets/{chunk-2GRJ4B5K-C6KsYuNR.js → chunk-2GRJ4B5K-D1if-ThW.js} +1 -1
- package/dist/assets/chunk-3NCLNEKW-Z5ckM4mG.js +1 -0
- package/dist/assets/{chunk-4I5QYGJK-CPsvNPUx.js → chunk-4I5QYGJK-DlrWrdEa.js} +1 -1
- package/dist/assets/{chunk-5RXB4S5H-CU_v2umt.js → chunk-5RXB4S5H-JwFhdddt.js} +1 -1
- package/dist/assets/{chunk-6Q2QTUOP-C_q0JPmG.js → chunk-6Q2QTUOP-C2vvuHlO.js} +1 -1
- package/dist/assets/{chunk-7Z6QIM7H-jM3JGv9o.js → chunk-7Z6QIM7H-m6s_oalL.js} +1 -1
- package/dist/assets/{chunk-GF5L2VYU-Dp_0e4Vj.js → chunk-GF5L2VYU-Dgjjn2FR.js} +1 -1
- package/dist/assets/{chunk-I66GZJ75-CLtbCU_E.js → chunk-I66GZJ75-BsY3mBMx.js} +1 -1
- package/dist/assets/{chunk-J7OUQ5F2-C4uAdkrD.js → chunk-J7OUQ5F2-Cl4FNR_k.js} +1 -1
- package/dist/assets/{chunk-JQJVKLGR-BlTMFaN6.js → chunk-JQJVKLGR-BApWxqMA.js} +1 -1
- package/dist/assets/{chunk-KBJHAD2P-BJzwVqKy.js → chunk-KBJHAD2P-DI4-lUt-.js} +1 -1
- package/dist/assets/{chunk-NSK5VX7P-B7tNpEbR.js → chunk-NSK5VX7P-BBTxIP6Z.js} +1 -1
- package/dist/assets/{chunk-QR6OTTB3-B3mQWEI2.js → chunk-QR6OTTB3-DJcD7xr-.js} +1 -1
- package/dist/assets/{chunk-RYQCIY6F-B3DAS_Q-.js → chunk-RYQCIY6F-CnMsR_qh.js} +1 -1
- package/dist/assets/{chunk-UBXNYLIW-Cqb7MpFH.js → chunk-UBXNYLIW-B7z1tp3V.js} +1 -1
- package/dist/assets/{chunk-W5SLKNZC-DWOVkEVc.js → chunk-W5SLKNZC-BnMc5i0B.js} +1 -1
- package/dist/assets/{chunk-WRU74C26-DR5g8owc.js → chunk-WRU74C26-MrzCPX2E.js} +1 -1
- package/dist/assets/chunk-XXDRQBXY-NKBlW2Dm.js +1 -0
- package/dist/assets/classDiagram-JCYQIIEL-C4ADaKBz.js +1 -0
- package/dist/assets/classDiagram-v2-OCEON4UE-C4ADaKBz.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-CcXrYRrs.js → cose-bilkent-JH36ORCC-XP-DnSP5.js} +1 -1
- package/dist/assets/{createDerive-C1PaRnFZ.js → createDerive-B3AGnDaY.js} +1 -1
- package/dist/assets/{cynefinDiagram-MW4NZA55-DuPIOMPB.js → cynefinDiagram-MW4NZA55-B8MvpqXe.js} +1 -1
- package/dist/assets/{dagre-VZM6K2ZE-CHbs07zF.js → dagre-VZM6K2ZE-B5E8-xuM.js} +1 -1
- package/dist/assets/{diagram-7IWD3JNH-sPS-Y-CP.js → diagram-7IWD3JNH-Xj62y5BF.js} +1 -1
- package/dist/assets/{diagram-B4RE2ZJO-C4Essr7L.js → diagram-B4RE2ZJO-mI-iOCGl.js} +1 -1
- package/dist/assets/{diagram-LBJQPF4R-CluEJ_Yg.js → diagram-LBJQPF4R-BMTSoZch.js} +1 -1
- package/dist/assets/{diagram-Q27KOJAE-D4lem9jQ.js → diagram-Q27KOJAE-B98Knrnh.js} +1 -1
- package/dist/assets/{diagram-UB23O5K3-Bfj6mHJD.js → diagram-UB23O5K3-bseKIzhv.js} +1 -1
- package/dist/assets/{dist-D3VfqzjO.js → dist-BK-OswHQ.js} +1 -1
- package/dist/assets/dist-Ck19TqqJ.js +5 -0
- package/dist/assets/{ebnfDiagram-BXEA7PRR-BKXyHLd_.js → ebnfDiagram-BXEA7PRR-Bgo10FP1.js} +1 -1
- package/dist/assets/{erDiagram-JOGREHBK-B6_uGYAF.js → erDiagram-JOGREHBK-BU4b8mUv.js} +1 -1
- package/dist/assets/flowDiagram-UKHOOZJN-BDHHPApJ.js +1 -0
- package/dist/assets/framework-BwfIhdyz.js +55 -0
- package/dist/assets/{ganttDiagram-PKOTCBZU-Cip5kKH4.js → ganttDiagram-PKOTCBZU-CrmKcYGt.js} +1 -1
- package/dist/assets/{getIcon-QmYxLBSb.js → getIcon-1ZXs1v-a.js} +1 -1
- package/dist/assets/{gitGraphDiagram-DS77QQ5N-CF75OjHf.js → gitGraphDiagram-DS77QQ5N-COu0mOui.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BPV_Giyg.js → highlighted-body-OFNGDK62-CnGKNo0r.js} +1 -1
- package/dist/assets/i18n-rra-09wp.js +9 -0
- package/dist/assets/index-BLepsDd_.js +19 -0
- package/dist/assets/index-D26gl3rg.css +2 -0
- package/dist/assets/{infoDiagram-6WML65LV-IbyJxsv4.js → infoDiagram-6WML65LV-BT0Q6MIs.js} +1 -1
- package/dist/assets/infrastructure-BCTDJsqi.js +3 -0
- package/dist/assets/{ishikawaDiagram-WSZJBQD7-D8FhFMwb.js → ishikawaDiagram-WSZJBQD7-kvPjMvBP.js} +1 -1
- package/dist/assets/{journeyDiagram-NVQOT4AX-C1y_DqRe.js → journeyDiagram-NVQOT4AX-DhXy7wxt.js} +1 -1
- package/dist/assets/{kanban-definition-27J2QSJJ-DIUOavva.js → kanban-definition-27J2QSJJ-CFDavpZY.js} +1 -1
- package/dist/assets/maplibre-gl-CrDadnl3.js +801 -0
- package/dist/assets/maplibre-gl-shared.mjs +2 -2
- package/dist/assets/maplibre-gl-worker.mjs +2 -2
- package/dist/assets/mermaid-GHXKKRXX-CR9PcY0X.js +1 -0
- package/dist/assets/{mermaid-parser.core-BbBeSajF.js → mermaid-parser.core-Dd2B8Ckv.js} +1 -1
- package/dist/assets/{mermaid.core-Dc9p2r4P.js → mermaid.core-BwiBFu_S.js} +2 -2
- package/dist/assets/metadata-admin-BE9_-F_f.js +25 -0
- package/dist/assets/{mindmap-definition-FAOFIHXS-TIsZfgu-.js → mindmap-definition-FAOFIHXS-ITGoV4nW.js} +1 -1
- package/dist/assets/{pegDiagram-VL7TDLO6-BrUvPfjL.js → pegDiagram-VL7TDLO6-BoRu9yvl.js} +1 -1
- package/dist/assets/{pieDiagram-7S7Q4E2Y-BNPIri0N.js → pieDiagram-7S7Q4E2Y-DVsM9krU.js} +1 -1
- package/dist/assets/plugin-calendar-BfY9ZunQ.js +1 -0
- package/dist/assets/plugin-charts-CmWL7Og-.js +7 -0
- package/dist/assets/plugin-chatbot-mxoQfkdx.js +120 -0
- package/dist/assets/plugin-dashboard-CzbAW1Rz.js +6 -0
- package/dist/assets/plugin-form-ItAwTFz-.js +1 -0
- package/dist/assets/plugin-gantt-DF5W5xkN.js +64 -0
- package/dist/assets/plugin-grid-B42Photo.js +9 -0
- package/dist/assets/plugin-kanban-Dh3HIJIm.js +1 -0
- package/dist/assets/plugin-map-C1wSLqlB.js +1 -0
- package/dist/assets/plugin-map-DSnsEFKn.css +1 -0
- package/dist/assets/{plugin-markdown-CbQeAjXv.js → plugin-markdown-DNllWgPM.js} +1 -1
- package/dist/assets/plugin-report-yfOfZPQg.js +59 -0
- package/dist/assets/plugin-timeline-BpuaaqBd.js +1 -0
- package/dist/assets/plugin-tree-BrXE50se.js +1 -0
- package/dist/assets/plugin-view-Jc0rkk7A.js +1 -0
- package/dist/assets/plugins-views-cOiN-mPq.js +4 -0
- package/dist/assets/{quadrantDiagram-CIZ2JOQS-BpL1Kl6d.js → quadrantDiagram-CIZ2JOQS-C4VzXHnp.js} +1 -1
- package/dist/assets/{railroadDiagram-AXF67PYL-CY1JovP6.js → railroadDiagram-AXF67PYL-DqZ3yKWv.js} +1 -1
- package/dist/assets/{requirementDiagram-LRYGKXZP-TRTGy9-6.js → requirementDiagram-LRYGKXZP-BeH0P3vD.js} +1 -1
- package/dist/assets/{runtime-metadata-persistence-DDZN-tZg.js → runtime-metadata-persistence-DTOJpVmd.js} +1 -1
- package/dist/assets/{sankeyDiagram-W5VNT64P-Hj-Un0bp.js → sankeyDiagram-W5VNT64P-Bu_tPh-A.js} +1 -1
- package/dist/assets/{sequenceDiagram-SI44F4Z6-iGYyf5AF.js → sequenceDiagram-SI44F4Z6-BWEuLn1a.js} +1 -1
- package/dist/assets/{skeletons-BWrJAbfN.js → skeletons-BwA1TSR2.js} +1 -1
- package/dist/assets/src-BLbFBP_B.js +1 -0
- package/dist/assets/{src-DwpgXgLE.js → src-CY2xhbXR.js} +1 -1
- package/dist/assets/{src-0qbDl74X.js → src-CvicUdp3.js} +1 -1
- package/dist/assets/src-DhAd4aY4.js +2 -0
- package/dist/assets/{stateDiagram-OKZ733FA-B-kn5M6g.js → stateDiagram-OKZ733FA-Cp7aDYsZ.js} +1 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-DaTg8C5m.js +1 -0
- package/dist/assets/{swimlanes-SLNWSIFB-sV1QkjXA.js → swimlanes-SLNWSIFB-wrx1JN6o.js} +1 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-Bqz9GVuM.js +8 -0
- package/dist/assets/{timeline-definition-Z64GVDOM-DMClsS2j.js → timeline-definition-Z64GVDOM-BcUiJfLU.js} +1 -1
- package/dist/assets/ui-components-Dwq5utCl.js +42 -0
- package/dist/assets/ui-layout-DPFlQaQp.js +1 -0
- package/dist/assets/use-book-data-CZc8MJsb.js +1 -0
- package/dist/assets/useActionModal-DYiSBx1G.js +1 -0
- package/dist/assets/useOpenRecordList-DOZu_JZX.js +1 -0
- package/dist/assets/usePackageL10n-D91-102Q.js +1 -0
- package/dist/assets/{useSettingsLabel-Bl5L3RqQ.js → useSettingsLabel-CeZ36S4g.js} +1 -1
- package/dist/assets/{utils-L-_x2yPF.js → utils-CJ4UwXMF.js} +1 -1
- package/dist/assets/{vendor-charts-DAI87uet.js → vendor-charts-BEGSmcjR.js} +3 -3
- package/dist/assets/{vendor-dndkit-CQdzTF9d.js → vendor-dndkit-CkJ59XFL.js} +1 -1
- package/dist/assets/{vendor-i18n-DeMInx63.js → vendor-i18n-Cpia2wlg.js} +1 -1
- package/dist/assets/{vendor-icons-core-B25E_7o5.js → vendor-icons-core-Bi9GWsvI.js} +1 -1
- package/dist/assets/{vendor-markdown-DjBjpmKk.js → vendor-markdown-C_Ip9E_I.js} +2 -2
- package/dist/assets/vendor-objectstack-B1R3ym-9.js +264 -0
- package/dist/assets/{vendor-radix-D1dussIM.js → vendor-radix-DFmVRiEf.js} +1 -1
- package/dist/assets/{vendor-react-BgOXCBVK.js → vendor-react-CsWFRkED.js} +1 -1
- package/dist/assets/vendor-sentry-B2ojA7qm.js +501 -0
- package/dist/assets/vendor-ui-utils-BFw4cGI6.js +1 -0
- package/dist/assets/vendor-zod-r9lyeyrU.js +64 -0
- package/dist/assets/{vennDiagram-T6HMQDX7-CrP23lgd.js → vennDiagram-T6HMQDX7-BKJsL5fS.js} +1 -1
- package/dist/assets/{wardleyDiagram-T6FBY63Y-DSw6poZ6.js → wardleyDiagram-T6FBY63Y-CZ0aMbYX.js} +1 -1
- package/dist/assets/{xychartDiagram-ELKLHX3M-BVUFqBDL.js → xychartDiagram-ELKLHX3M-BpK2RmQ_.js} +1 -1
- package/dist/eager-closure.json +277 -0
- package/dist/index.html +56 -16
- package/package.json +1 -1
- package/dist/assets/AdapterProvider-BpWMSLQH.js +0 -3
- package/dist/assets/AiPendingActionsPage-DAJUEqyC.js +0 -1
- package/dist/assets/ApiConsolePage-CgXbOsFC.js +0 -1
- package/dist/assets/AppDocsIndex-BgaIthca.js +0 -1
- package/dist/assets/AppManagementPage-BvGPskyf.js +0 -1
- package/dist/assets/ApprovalsInboxPage-CxmrNrwP.js +0 -1
- package/dist/assets/AuditLogPage-JahfQFnX.js +0 -1
- package/dist/assets/ComponentNavView-DjiNAGys.js +0 -1
- package/dist/assets/CreateViewDialog-CUvjCA1o.js +0 -1
- package/dist/assets/DashboardView-Cr-Q-16_.js +0 -1
- package/dist/assets/FlowRunsPage-DL7MhL_U.js +0 -1
- package/dist/assets/InterfaceListPage-CfhSyYAw.js +0 -1
- package/dist/assets/MarketplaceAccessDenied-t8A0k9OX.js +0 -1
- package/dist/assets/MarketplacePackagePage-XSdk80Dd.js +0 -4
- package/dist/assets/MarketplacePage-CZjDbg5G.js +0 -1
- package/dist/assets/MetadataProvider-CnYsadFP.js +0 -1
- package/dist/assets/ObjectDataPage-D9kCSxvN.js +0 -1
- package/dist/assets/PageView-q1XSwpVo.js +0 -1
- package/dist/assets/ProfilePage-DeDhni58.js +0 -1
- package/dist/assets/PublicFormsPage-BX6YXY8w.js +0 -1
- package/dist/assets/RecordDetailView-DrVbrbaN.js +0 -9
- package/dist/assets/RecordFormPage-Bs9wX-M6.js +0 -1
- package/dist/assets/ReportDefaultInspector-BbbhDn34.js +0 -3
- package/dist/assets/ReportView-D_soBKL6.js +0 -2
- package/dist/assets/SearchResultsPage--Beqyte8.js +0 -1
- package/dist/assets/SettingsHub-BozLt7dt.js +0 -1
- package/dist/assets/SettingsView-CC3o9IGe.js +0 -1
- package/dist/assets/SystemHubPage-CBdrX4bx.js +0 -1
- package/dist/assets/channel-dlPH8oK4.js +0 -1
- package/dist/assets/chunk-3NCLNEKW-CHvXlKAW.js +0 -1
- package/dist/assets/chunk-XXDRQBXY-BLRqgrvV.js +0 -1
- package/dist/assets/classDiagram-JCYQIIEL-ghx-FrtR.js +0 -1
- package/dist/assets/classDiagram-v2-OCEON4UE-ghx-FrtR.js +0 -1
- package/dist/assets/componentRegistry-ByxoJqMW.js +0 -1
- package/dist/assets/data-adapter-yS4exRPT.js +0 -24
- package/dist/assets/flowDiagram-UKHOOZJN-6YBsanbO.js +0 -1
- package/dist/assets/framework-B8ndNKrd.js +0 -38
- package/dist/assets/i18n-DLOdKEiB.js +0 -9
- package/dist/assets/index-DaeqUnH6.js +0 -2
- package/dist/assets/index-gaeYmjTV.css +0 -2
- package/dist/assets/infrastructure-ChmEYj6c.js +0 -3
- package/dist/assets/maplibre-gl-DPzMTNDD.js +0 -801
- package/dist/assets/mermaid-GHXKKRXX-BrwYiPsC.js +0 -1
- package/dist/assets/metadata-admin-DqAvOmNf.js +0 -25
- package/dist/assets/plugin-calendar-CQVTjox_.js +0 -1
- package/dist/assets/plugin-charts-CBUIhVeW.js +0 -7
- package/dist/assets/plugin-chatbot-DsLGdfGx.js +0 -120
- package/dist/assets/plugin-dashboard-fdM1jm2j.js +0 -6
- package/dist/assets/plugin-form-Bv0Hi0E6.js +0 -1
- package/dist/assets/plugin-gantt-CRJpVrrP.js +0 -63
- package/dist/assets/plugin-grid-gHcTrjs3.js +0 -8
- package/dist/assets/plugin-kanban-CNm7DssD.js +0 -1
- package/dist/assets/plugin-map-5lRITB8H.css +0 -1
- package/dist/assets/plugin-map-TrYBEx8q.js +0 -1
- package/dist/assets/plugin-report-Bg1oh9SG.js +0 -59
- package/dist/assets/plugin-timeline-B30kCAGi.js +0 -1
- package/dist/assets/plugin-tree-Br5XanqO.js +0 -1
- package/dist/assets/plugin-view-CgDs-8T5.js +0 -1
- package/dist/assets/plugins-views-BxwTmeut.js +0 -4
- package/dist/assets/src-BBKXMp-o.js +0 -19
- package/dist/assets/src-CVuJHohL.js +0 -1
- package/dist/assets/src-leh_hyM1.js +0 -2
- package/dist/assets/stateDiagram-v2-UEYNNEHI-CHYANMPw.js +0 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-CBFvMN71.js +0 -8
- package/dist/assets/ui-components-mPgY5chB.js +0 -42
- package/dist/assets/ui-layout-CRcyxP_X.js +0 -1
- package/dist/assets/use-book-data-B2KPEJjv.js +0 -1
- package/dist/assets/useOpenRecordList-ovuRzPa2.js +0 -1
- package/dist/assets/usePackageL10n-9fP2GgDK.js +0 -1
- package/dist/assets/vendor-objectstack-DneBps14.js +0 -155
- package/dist/assets/vendor-sentry-DlmtNsBO.js +0 -501
- package/dist/assets/vendor-ui-utils-BGw4RtYu.js +0 -1
- package/dist/assets/vendor-zod-CBDIIwrA.js +0 -65
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{V as r,nt as i}from"./framework-BwfIhdyz.js";import{Aa as a,Ci as o,Er as s,Is as c,Oa as l,Pr as u,Tr as d,Ws as f,Yo as p,_c as m,gc as h,mc as g,oa as _,ri as v,wr as y,ya as b,yo as x}from"./ui-components-Dwq5utCl.js";import"./index-BLepsDd_.js";var S=e(t(),1),C=[`plugin`,`plugins`,`kind`,`package`];function w(e){return[{method:`POST`,path:`${e}/sign-in/email`,desc:`Sign in (email)`,group:`Auth`,bodyTemplate:{email:`user@example.com`,password:``}},{method:`POST`,path:`${e}/sign-up/email`,desc:`Sign up (email)`,group:`Auth`,bodyTemplate:{email:``,password:``,name:``}},{method:`POST`,path:`${e}/sign-out`,desc:`Sign out`,group:`Auth`},{method:`GET`,path:`${e}/get-session`,desc:`Get session`,group:`Auth`}]}var T={ai:{group:`AI`,defaultRoute:`/api/v1/ai`,endpoints:[{method:`POST`,path:`/chat`,desc:`Chat completion (JSON)`,bodyTemplate:{messages:[{role:`user`,content:``}],stream:!1}},{method:`POST`,path:`/chat/stream`,desc:`Streaming chat (SSE)`,bodyTemplate:{messages:[{role:`user`,content:``}]}},{method:`POST`,path:`/complete`,desc:`Text completion`,bodyTemplate:{prompt:``}},{method:`GET`,path:`/models`,desc:`List available models`},{method:`GET`,path:`/status`,desc:`Active LLM adapter provenance`},{method:`GET`,path:`/effective-model`,desc:`Effective model ids and where they came from`},{method:`POST`,path:`/conversations`,desc:`Create conversation`,bodyTemplate:{}},{method:`GET`,path:`/conversations`,desc:`List conversations`},{method:`GET`,path:`/conversations/:id`,desc:`Get conversation with message history`},{method:`PATCH`,path:`/conversations/:id`,desc:`Update conversation (title, metadata)`,bodyTemplate:{title:``}},{method:`DELETE`,path:`/conversations/:id`,desc:`Delete conversation`},{method:`POST`,path:`/conversations/:id/messages`,desc:`Add message to conversation`,bodyTemplate:{role:`user`,content:``}},{method:`GET`,path:`/conversations/:id/debug`,desc:`Reconcile a build conversation: agent-claimed vs live metadata`},{method:`GET`,path:`/agents`,desc:`List active agents`},{method:`POST`,path:`/agents/:agentName/chat`,desc:`Chat with a named agent (JSON)`,bodyTemplate:{messages:[{role:`user`,content:``}],stream:!1}},{method:`GET`,path:`/assistant`,desc:`Resolve the default assistant and its active skills`},{method:`GET`,path:`/assistant/skills`,desc:`List active skills for a context`},{method:`POST`,path:`/assistant/chat`,desc:`Ambient chat — auto-resolves agent and skills (JSON)`,bodyTemplate:{messages:[{role:`user`,content:``}],stream:!1}},{method:`GET`,path:`/tools`,desc:`List registered AI tools`},{method:`POST`,path:`/tools/:toolName/execute`,desc:`Execute one tool directly (playground)`,bodyTemplate:{parameters:{}}},{method:`GET`,path:`/pending-actions`,desc:`List pending actions awaiting approval`},{method:`GET`,path:`/pending-actions/:id`,desc:`Get one pending action`},{method:`POST`,path:`/pending-actions/:id/approve`,desc:`Approve a pending action and execute it`,bodyTemplate:{}},{method:`POST`,path:`/pending-actions/:id/reject`,desc:`Reject a pending action`,bodyTemplate:{reason:``}},{method:`POST`,path:`/evals/runs`,desc:`Run an eval case — ai:admin, makes paid LLM calls`,bodyTemplate:{caseId:``}},{method:`GET`,path:`/usage`,desc:`AI quota headroom per meter (console usage indicator)`}]},realtime:{group:`Realtime`,defaultRoute:`/api/v1/realtime`,endpoints:[{method:`POST`,path:`/connect`,desc:`Establish realtime connection`,bodyTemplate:{transport:`websocket`}},{method:`POST`,path:`/disconnect`,desc:`Close realtime connection`,bodyTemplate:{connectionId:``}},{method:`POST`,path:`/subscribe`,desc:`Subscribe to channel`,bodyTemplate:{channel:``}},{method:`POST`,path:`/unsubscribe`,desc:`Unsubscribe from channel`,bodyTemplate:{channel:``}},{method:`PUT`,path:`/presence/:channel`,desc:`Set presence state`,bodyTemplate:{status:`online`}},{method:`GET`,path:`/presence/:channel`,desc:`Get channel presence`}]},notification:{group:`Notifications`,defaultRoute:`/api/v1/notifications`,endpoints:[{method:`GET`,path:``,desc:`List notifications`},{method:`POST`,path:`/devices`,desc:`Register device for push`,bodyTemplate:{token:``,platform:`web`}},{method:`DELETE`,path:`/devices/:deviceId`,desc:`Unregister device`},{method:`GET`,path:`/preferences`,desc:`Get notification preferences`},{method:`PATCH`,path:`/preferences`,desc:`Update notification preferences`,bodyTemplate:{email:!0,push:!0}},{method:`POST`,path:`/read`,desc:`Mark notifications as read`,bodyTemplate:{ids:[]}},{method:`POST`,path:`/read/all`,desc:`Mark all as read`}]},analytics:{group:`Analytics`,defaultRoute:`/api/v1/analytics`,endpoints:[{method:`POST`,path:`/query`,desc:`Execute analytics query`,bodyTemplate:{measures:[],dimensions:[]}},{method:`GET`,path:`/meta`,desc:`Get analytics metadata`}]},automation:{group:`Automation`,defaultRoute:`/api/v1/automation`,endpoints:[{method:`POST`,path:`/trigger`,desc:`Trigger automation`,bodyTemplate:{name:``,params:{}}}]},i18n:{group:`i18n`,defaultRoute:`/api/v1/i18n`,endpoints:[{method:`GET`,path:`/locales`,desc:`Get available locales`},{method:`GET`,path:`/translations/:locale`,desc:`Get translations for locale`},{method:`GET`,path:`/labels/:object/:locale`,desc:`Get translated field labels`}]},ui:{group:`UI`,defaultRoute:`/api/v1/ui`,endpoints:[{method:`GET`,path:`/views`,desc:`List views`},{method:`GET`,path:`/views/:id`,desc:`Get view by ID`},{method:`POST`,path:`/views`,desc:`Create view`,bodyTemplate:{name:``,object:``,type:`list`}},{method:`PATCH`,path:`/views/:id`,desc:`Update view`,bodyTemplate:{name:``}},{method:`DELETE`,path:`/views/:id`,desc:`Delete view`}]},"file-storage":{group:`Storage`,defaultRoute:`/api/v1/storage`,endpoints:[{method:`POST`,path:`/upload`,desc:`Upload file (multipart/form-data)`},{method:`GET`,path:`/:fileId`,desc:`Download file`},{method:`DELETE`,path:`/:fileId`,desc:`Delete file`}]}},E={"file-storage":`storage`};function D(e,t){let n=T[e];return n?n.endpoints.map(e=>({method:e.method,path:`${t}${e.path}`,desc:e.desc,group:n.group,...e.bodyTemplate?{bodyTemplate:e.bodyTemplate}:{}})):[]}function ee(){let e=i(),[t,n]=(0,S.useState)([]),[a,o]=(0,S.useState)([]),[s,c]=(0,S.useState)(!0),[l,u]=(0,S.useState)(null),d=(0,S.useCallback)(async()=>{c(!0),u(null);let t=`/api/v1`,i=`${t}/discovery`,a=[{method:`GET`,path:i,desc:`API Discovery`,group:`System`},{method:`GET`,path:`${t}/meta/types`,desc:`List metadata types`,group:`Metadata`},{method:`GET`,path:`${t}/packages`,desc:`List packages`,group:`System`},{method:`GET`,path:`/api/v1/health`,desc:`Health check`,group:`System`}];try{let s=`/api/v1/auth`,c={},l={};try{let e=await fetch(i);if(e.ok){let t=await e.json(),n=t?.data??t;l=n?.routes??{},c=n?.services??{},l.auth&&(s=l.auth)}}catch{}let u=[];for(let[e,t]of Object.entries(T)){let n=E[e],i=(n?c[n]:void 0)??c[e],a=i?r(i):!1,o=i?.route??l[e]??t.defaultRoute;a&&u.push(...D(e,o))}let d=e?.getClient?.(),f=[];try{let e=await d?.meta?.getTypes?.();e&&Array.isArray(e.types)?f=e.types:Array.isArray(e)&&(f=e)}catch{}let p=[];try{let e=f.includes(`object`)?`object`:null;if(e&&d?.meta?.getItems){let t=await d.meta.getItems(e),n=[];Array.isArray(t)?n=t:t&&Array.isArray(t.items)?n=t.items:t&&Array.isArray(t.value)&&(n=t.value),p=n.map(e=>e.name||e.id).filter(Boolean)}}catch{}let m=p.flatMap(e=>{let n=e.startsWith(`sys_`)?`Data: system tables`:`Data: ${e}`;return[{method:`GET`,path:`${t}/data/${e}`,desc:`List ${e}`,group:n},{method:`POST`,path:`${t}/data/${e}`,desc:`Create ${e}`,group:n,bodyTemplate:{name:`example`}},{method:`GET`,path:`${t}/data/${e}/:id`,desc:`Get ${e} by ID`,group:n},{method:`PATCH`,path:`${t}/data/${e}/:id`,desc:`Update ${e}`,group:n,bodyTemplate:{name:`updated`}},{method:`DELETE`,path:`${t}/data/${e}/:id`,desc:`Delete ${e}`,group:n}]}),h=f.filter(e=>!C.includes(e)).map(e=>({method:`GET`,path:`${t}/meta/${e}`,desc:`List ${e} metadata`,group:`Metadata`})),g=p.map(e=>({method:`GET`,path:`${t}/meta/object/${e}`,desc:`${e} schema`,group:`Metadata`})),_=[...a,...w(s),...u,...h,...g,...m],v=new Map;for(let e of _){let t=v.get(e.group)||[];t.push(e),v.set(e.group,t)}let y=[`System`,`Auth`,`AI`,`Workflow`,`Realtime`,`Notifications`,`Analytics`,`Automation`,`i18n`,`UI`,`Feed`,`Storage`,`Metadata`],b=Array.from(v.entries()).sort(([e],[t])=>{let n=y.indexOf(e),r=y.indexOf(t);return n!==-1&&r!==-1?n-r:n===-1?r===-1?e.localeCompare(t):1:-1}).map(([e,t])=>({key:e,label:e,endpoints:t}));n(b),o(_)}catch(e){u(e.message||`Failed to discover APIs`)}finally{c(!1)}},[e]);return(0,S.useEffect)(()=>{d()},[d]),{groups:t,allEndpoints:a,loading:s,error:l,refresh:d}}var O=n(),k={GET:`text-emerald-600 bg-emerald-50 border-emerald-200 dark:text-emerald-400 dark:bg-emerald-950/50`,POST:`text-blue-600 bg-blue-50 border-blue-200 dark:text-blue-400 dark:bg-blue-950/50`,PATCH:`text-amber-600 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950/50`,PUT:`text-amber-600 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950/50`,DELETE:`text-red-600 bg-red-50 border-red-200 dark:text-red-400 dark:bg-red-950/50`},te={2:`text-emerald-600 dark:text-emerald-400`,3:`text-blue-600 dark:text-blue-400`,4:`text-amber-600 dark:text-amber-400`,5:`text-red-600 dark:text-red-400`},ne=[{key:`$top`,placeholder:`10`,hint:`limit`},{key:`$skip`,placeholder:`0`,hint:`offset`},{key:`$sort`,placeholder:`name`,hint:`sort field`},{key:`$select`,placeholder:`name,email`,hint:`fields`},{key:`$count`,placeholder:`true`,hint:`total count`},{key:`$filter`,placeholder:`status eq 'active'`,hint:`OData filter`}],A=1;function j(){let e=i()?.getClient?.(),{groups:t,loading:n,refresh:r}=ee(),[C,w]=(0,S.useState)(``),[T,E]=(0,S.useState)(new Set),[D,j]=(0,S.useState)(null),[re,M]=(0,S.useState)(``),[ie,N]=(0,S.useState)(``),[P,F]=(0,S.useState)(``),[I,L]=(0,S.useState)([]),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(null),[H,U]=(0,S.useState)([]),[W,ae]=(0,S.useState)(null),[G,K]=(0,S.useState)(!1),q=(0,S.useMemo)(()=>{if(!C)return t;let e=C.toLowerCase();return t.map(t=>({...t,endpoints:t.endpoints.filter(t=>t.desc.toLowerCase().includes(e)||t.path.toLowerCase().includes(e)||t.method.toLowerCase().includes(e))})).filter(e=>e.endpoints.length>0)},[t,C]),oe=(0,S.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),se=(0,S.useCallback)(e=>{j(e),M(e.method),N(e.path),F(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),L([]),V(null)},[]),J=re||D?.method||`GET`,Y=ie||D?.path||``,X=(0,S.useMemo)(()=>{let e=I.filter(e=>e.enabled&&e.key.trim());if(e.length===0)return Y;let t=e.map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join(`&`);return`${Y}?${t}`},[Y,I]),Z=(0,S.useCallback)((e=``,t=``)=>{L(n=>[...n,{id:A++,key:e,value:t,enabled:!0}])},[]),ce=(0,S.useCallback)(e=>{L(t=>t.filter(t=>t.id!==e))},[]),Q=(0,S.useCallback)((e,t,n)=>{L(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),le=(0,S.useCallback)(e=>{L(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t))},[]),$=(0,S.useCallback)(async()=>{if(R||!X)return;let t=`${e?.baseUrl??``}${X}`;z(!0);let n=performance.now();try{let e={method:J,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`,`PUT`].includes(J)&&P.trim()&&(e.body=P);let r=await fetch(t,e),i=Math.round(performance.now()-n),a;if((r.headers.get(`content-type`)??``).includes(`json`)){let e=await r.json();a=JSON.stringify(e,null,2)}else a=await r.text();let o={status:r.status,body:a,duration:i};V(o),U(e=>[{id:Date.now(),method:J,url:X,body:P||void 0,status:r.status,duration:i,response:a,timestamp:new Date},...e].slice(0,50))}catch(e){let t=Math.round(performance.now()-n);V({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{z(!1)}},[e,X,J,P,R]),ue=(0,S.useCallback)(e=>{M(e.method);let[t,n]=e.url.split(`?`);if(N(t),F(e.body||``),n){let e=new URLSearchParams(n),t=[];e.forEach((e,n)=>{t.push({id:A++,key:n,value:e,enabled:!0})}),L(t)}else L([]);V(null),j(null)},[]),de=(0,S.useCallback)(()=>{B?.body&&(navigator.clipboard.writeText(B.body),K(!0),setTimeout(()=>K(!1),1500))},[B]),fe=e=>te[String(e)[0]]??`text-muted-foreground`;return(0,O.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,O.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,O.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,O.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,O.jsx)(b,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,O.jsxs)(`div`,{className:`relative`,children:[(0,O.jsx)(_,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,O.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`Search endpoints...`,className:`w-full rounded-md border bg-background pl-8 pr-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-ring`})]})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,O.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,O.jsx)(x,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):q.length===0?(0,O.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,O.jsx)(p,{className:`h-6 w-6 opacity-30 mb-2`}),(0,O.jsx)(`span`,{children:C?`No matching endpoints`:`No endpoints found`})]}):q.map(e=>{let t=T.has(e.key)||!!C;return(0,O.jsxs)(y,{open:t,onOpenChange:()=>oe(e.key),children:[(0,O.jsx)(s,{asChild:!0,children:(0,O.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-1.5 px-2 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground transition-colors`,children:[(0,O.jsx)(g,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,O.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,O.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,O.jsx)(d,{children:(0,O.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>se(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${D===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,O.jsx)(u,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${k[e.method]||``}`,children:e.method}),(0,O.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,O.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,O.jsxs)(`button`,{type:`button`,onClick:()=>Z(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,O.jsx)(l,{className:`h-3 w-3`}),`Add`]})]}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:ne.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>Z(e.key,``),className:`text-[10px] px-1.5 py-0.5 rounded border bg-muted/30 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors font-mono`,title:e.hint,children:e.key},e.key))}),I.length>0&&(0,O.jsx)(`div`,{className:`space-y-1`,children:I.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>le(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,O.jsx)(`input`,{type:`text`,value:e.key,onChange:t=>Q(e.id,`key`,t.target.value),placeholder:`key`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,O.jsx)(`input`,{type:`text`,value:e.value,onChange:t=>Q(e.id,`value`,t.target.value),placeholder:`value`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>ce(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,O.jsx)(v,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,O.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,O.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`select`,{value:J,onChange:e=>M(e.target.value),className:`rounded-md border bg-background px-2 py-1.5 font-mono text-xs font-semibold focus:outline-none focus:ring-1 focus:ring-ring ${k[J]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,O.jsx)(`option`,{value:e,children:e},e))}),(0,O.jsx)(`input`,{type:`text`,value:Y,onChange:e=>N(e.target.value),className:`flex-1 rounded-md border bg-background px-3 py-1.5 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-ring`,placeholder:`/api/v1/...`,onKeyDown:e=>{e.key===`Enter`&&$()}}),(0,O.jsxs)(`button`,{type:`button`,onClick:$,disabled:R||!X,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors`,children:[R?(0,O.jsx)(x,{className:`h-3.5 w-3.5 animate-spin`}):(0,O.jsx)(a,{className:`h-3.5 w-3.5`}),`Send`]})]}),I.some(e=>e.enabled&&e.key.trim())&&(0,O.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,X]})]}),(0,O.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(J)&&(0,O.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,O.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,O.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),rows:5,className:`w-full rounded-md border bg-background px-3 py-2 font-mono text-xs focus:outline-none focus:ring-1 focus:ring-ring resize-y`,placeholder:`{ "key": "value" }`})]}),R&&(0,O.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,O.jsx)(x,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),B&&!R&&(0,O.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,O.jsx)(`span`,{className:`font-mono font-semibold ${fe(B.status)}`,children:B.status||`ERR`}),(0,O.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,O.jsx)(f,{className:`h-3 w-3`}),B.duration,`ms`]})]}),(0,O.jsxs)(`button`,{type:`button`,onClick:de,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[G?(0,O.jsx)(m,{className:`h-3 w-3`}):(0,O.jsx)(c,{className:`h-3 w-3`}),G?`Copied`:`Copy`]})]}),(0,O.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:B.body})]}),!B&&!R&&(0,O.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,O.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,O.jsx)(p,{className:`h-10 w-10 mx-auto opacity-20`}),(0,O.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,O.jsx)(`strong`,{children:`Send`})]}),(0,O.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),H.length>0&&(0,O.jsxs)(`div`,{className:`border-t`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,O.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,H.length,`)`]}),(0,O.jsxs)(`button`,{type:`button`,onClick:()=>U([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,O.jsx)(o,{className:`h-3 w-3`}),`Clear`]})]}),(0,O.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:H.map(e=>(0,O.jsxs)(`div`,{className:`rounded border`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>ae(W===e.id?null:e.id),className:`w-full flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors`,children:[W===e.id?(0,O.jsx)(h,{className:`h-3 w-3 shrink-0`}):(0,O.jsx)(g,{className:`h-3 w-3 shrink-0`}),(0,O.jsx)(u,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${k[e.method]||``}`,children:e.method}),(0,O.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,O.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${fe(e.status)}`,children:e.status}),(0,O.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,O.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),ue(e)},className:`shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,title:`Replay request`,children:(0,O.jsx)(a,{className:`h-2.5 w-2.5`})})]}),W===e.id&&(0,O.jsx)(`pre`,{className:`px-3 py-2 text-xs font-mono bg-muted/10 border-t overflow-auto max-h-40 whitespace-pre-wrap break-all`,children:e.response})]},e.id))})]})]})]})]})}export{j as ApiConsolePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,h as r,r as i,s as a}from"./vendor-react-CsWFRkED.js";import{yo as o,zc as s}from"./ui-components-Dwq5utCl.js";import{t as c}from"./DocShell-DMJHUgE5.js";import{a as l,c as u,n as d}from"./use-book-data-CZc8MJsb.js";var f=e(n(),1),p=i();function m(){let{appName:e}=r(),{books:n,docs:i,state:m}=d(),h=(0,f.useMemo)(()=>n.filter(t=>u(t)===e),[n,e]),g=(0,f.useMemo)(()=>l(h,i),[h,i]);return m===`loading`?(0,p.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,p.jsx)(o,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):g.length===1?(0,p.jsx)(a,{to:`/apps/${e}/docs/${g[0].slug}`,replace:!0}):(0,p.jsx)(c,{children:(0,p.jsx)(`div`,{className:`mx-auto max-w-3xl p-4 sm:p-6`,children:g.length===0?(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-16 text-center text-muted-foreground`,children:[(0,p.jsx)(s,{className:`h-10 w-10`}),(0,p.jsx)(`p`,{className:`text-sm`,children:`This app does not ship any documentation yet.`}),(0,p.jsx)(t,{to:`/docs`,className:`text-sm font-medium text-primary hover:underline`,children:`Browse all documentation`})]}):(0,p.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2`,children:g.map(n=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(t,{to:`/apps/${e}/docs/${n.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,p.jsx)(s,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsx)(`div`,{className:`text-sm font-semibold`,children:n.label}),n.description?(0,p.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n.description}):n.subtitle?(0,p.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:n.subtitle}):null,(0,p.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[n.docCount,` `,n.docCount===1?`article`:`articles`]})]})]})},n.name))})})})}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,p as r,r as i}from"./vendor-react-CsWFRkED.js";import{N as a,nt as o,rt as s}from"./framework-BwfIhdyz.js";import{Ci as c,Dr as l,Fa as u,In as d,Oa as f,Oo as p,Or as m,Pr as h,Ti as g,Ts as _,Xr as v,kr as y,oa as b,qi as x,wi as S,zi as C}from"./ui-components-Dwq5utCl.js";import{r as w}from"./vendor-ui-utils-BFw4cGI6.js";import"./index-BLepsDd_.js";var T=e(t(),1);function E(e,t){if(e!=null){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}}var D=i();function O(e,t){return(e instanceof Error?e.message:String(e??``))||t}function k(){let{t:e}=a(),t=r(),{appName:i}=n(),k=i?`/apps/${i}`:``,{apps:A,refresh:j}=s(),M=o(),N=(0,T.useCallback)(()=>M?.getClient?.()?.meta??null,[M]),P=e(`appManagement.toast.unknownError`,{defaultValue:`unknown error`}),F=(0,T.useCallback)(t=>E(t?.label,e)||t?.name||``,[e]),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(new Set),[B,V]=(0,T.useState)(null),[H,U]=(0,T.useState)(!1),W=(A||[]).filter(t=>{if(!I)return!0;let n=I.toLowerCase();return(t.name||``).toLowerCase().includes(n)||F(t).toLowerCase().includes(n)||(E(t.description,e)||``).toLowerCase().includes(n)}),G=(0,T.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),K=(0,T.useCallback)(()=>{R.size===W.length?z(new Set):z(new Set(W.map(e=>e.name)))},[R.size,W]),q=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{let r=t.active===!1;await n.saveItem(`app`,t.name,{...t,active:r}),w.success(r?e(`appManagement.toast.appEnabled`,{defaultValue:`{{name}} enabled`,name:F(t)}):e(`appManagement.toast.appDisabled`,{defaultValue:`{{name}} disabled`,name:F(t)})),await j()}catch(t){w.error(e(`appManagement.toast.toggleFailed`,{defaultValue:`Failed to toggle app status: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[j,N,e,F,P]),J=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{let r=(A||[]).filter(e=>e?.isDefault===!0&&e.name!==t.name);for(let e of r)await n.saveItem(`app`,e.name,{...e,isDefault:!1});await n.saveItem(`app`,t.name,{...t,isDefault:!0}),w.success(e(`appManagement.toast.setDefaultDone`,{defaultValue:`{{name}} set as default`,name:F(t)})),await j()}catch(t){w.error(e(`appManagement.toast.setDefaultFailed`,{defaultValue:`Failed to set default app: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[A,j,N,e,F,P]),Y=(0,T.useCallback)(async t=>{if(B!==t.name){V(t.name);return}let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{await n.deleteItem(`app`,t.name),w.success(e(`appManagement.toast.appDeleted`,{defaultValue:`{{name}} deleted`,name:F(t)})),V(null),await j()}catch(t){w.error(e(`appManagement.toast.deleteFailed`,{defaultValue:`Failed to delete app: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[B,j,N,e,F,P]),X=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);let r=0,i=[];try{let a=new Map((A||[]).map(e=>[e?.name,e]));for(let o of R){let s=a.get(o);if(s)try{await n.saveItem(`app`,o,{...s,active:t}),r+=1}catch(t){i.push(e(`appManagement.toast.bulkFailureEntry`,{defaultValue:`{{name}} ({{reason}})`,name:F(s),reason:O(t,P)}))}}if(r>0&&(w.success(t?e(`appManagement.toast.bulkEnabled`,{defaultValue:`{{n}} apps enabled`,n:r}):e(`appManagement.toast.bulkDisabled`,{defaultValue:`{{n}} apps disabled`,n:r})),z(new Set)),i.length>0){let t=e(`appManagement.toast.bulkFailureJoiner`,{defaultValue:`; `});w.error(e(`appManagement.toast.bulkFailed`,{defaultValue:`Failed for {{n}}: {{details}}`,n:i.length,details:i.join(t)}))}await j()}catch(t){w.error(e(`appManagement.toast.bulkOperationFailed`,{defaultValue:`Bulk operation failed: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[A,R,j,N,e,F,P]);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:e(`appManagement.title`,{defaultValue:`Applications`})}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e(`appManagement.subtitle`,{defaultValue:`Manage all configured applications`})})]}),(0,D.jsxs)(v,{onClick:()=>t(`${k}/create-app`),"data-testid":`create-app-btn`,children:[(0,D.jsx)(f,{className:`h-4 w-4 mr-2`}),e(`appManagement.newApp`,{defaultValue:`New App`})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,D.jsx)(`label`,{htmlFor:`app-search`,className:`sr-only`,children:e(`appManagement.searchLabel`,{defaultValue:`Search apps`})}),(0,D.jsx)(b,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,D.jsx)(d,{id:`app-search`,placeholder:e(`appManagement.searchPlaceholder`,{defaultValue:`Search apps…`}),value:I,onChange:e=>L(e.target.value),className:`pl-8`,"data-testid":`app-search-input`})]}),R.size>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(h,{variant:`secondary`,children:e(`appManagement.selectedCount`,{defaultValue:`{{n}} selected`,n:R.size})}),(0,D.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>X(!0),disabled:H,children:e(`appManagement.bulkEnable`,{defaultValue:`Enable`})}),(0,D.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>X(!1),disabled:H,children:e(`appManagement.bulkDisable`,{defaultValue:`Disable`})})]})]}),W.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,D.jsx)(l,{id:`select-all-apps`,checked:R.size===W.length&&W.length>0,onCheckedChange:()=>K()}),(0,D.jsx)(`label`,{htmlFor:`select-all-apps`,className:`cursor-pointer`,children:e(`appManagement.selectAll`,{defaultValue:`Select all ({{n}})`,n:W.length})})]}),W.length===0?(0,D.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,"data-testid":`no-apps-message`,children:[(0,D.jsx)(p,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,D.jsx)(`p`,{children:e(`appManagement.empty`,{defaultValue:`No apps found.`})})]}):(0,D.jsx)(`div`,{className:`grid gap-3`,children:W.map(n=>{let r=n.active!==!1,i=n.isDefault===!0,a=B===n.name,o=F(n);return(0,D.jsx)(m,{className:r?``:`opacity-60`,"data-testid":`app-card-${n.name}`,children:(0,D.jsxs)(y,{className:`flex items-center gap-3 py-3 px-4`,children:[(0,D.jsx)(l,{id:`select-app-${n.name}`,checked:R.has(n.name),onCheckedChange:()=>G(n.name),"aria-label":e(`appManagement.selectApp`,{defaultValue:`Select {{name}}`,name:o}),className:`shrink-0`}),(0,D.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,D.jsx)(p,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`font-medium truncate`,children:o}),i&&(0,D.jsx)(h,{variant:`default`,className:`text-xs`,children:e(`appManagement.defaultBadge`,{defaultValue:`Default`})}),(0,D.jsx)(h,{variant:r?`secondary`:`outline`,className:`text-xs`,children:r?e(`appManagement.active`,{defaultValue:`Active`}):e(`appManagement.inactive`,{defaultValue:`Inactive`})})]}),n.description&&(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:E(n.description,e)})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,D.jsx)(v,{variant:`ghost`,size:`icon`,title:e(`appManagement.openApp`,{defaultValue:`Open app`}),"aria-label":e(`appManagement.openAppNamed`,{defaultValue:`Open {{name}}`,name:o}),onClick:()=>t(`/apps/${n._packageId??n.name}`),children:(0,D.jsx)(_,{className:`h-4 w-4`})}),(0,D.jsx)(v,{variant:`ghost`,size:`icon`,title:e(`appManagement.editApp`,{defaultValue:`Edit app`}),"aria-label":e(`appManagement.editAppNamed`,{defaultValue:`Edit {{name}}`,name:o}),onClick:()=>t(`${k}/edit-app/${n.name}`),children:(0,D.jsx)(u,{className:`h-4 w-4`})}),n._packageId?(0,D.jsx)(v,{variant:`ghost`,size:`icon`,title:e(`appManagement.editWithAi`,{defaultValue:`Edit with AI`}),"aria-label":e(`appManagement.editWithAiNamed`,{defaultValue:`Edit {{name}} with AI`,name:o}),onClick:()=>t(`/ai/build?package=${encodeURIComponent(n._packageId)}&new=1`),children:(0,D.jsx)(x,{className:`h-4 w-4`})}):null,(0,D.jsx)(v,{variant:`ghost`,size:`icon`,title:r?e(`appManagement.disableApp`,{defaultValue:`Disable app`}):e(`appManagement.enableApp`,{defaultValue:`Enable app`}),"aria-label":r?e(`appManagement.disableAppNamed`,{defaultValue:`Disable {{name}}`,name:o}):e(`appManagement.enableAppNamed`,{defaultValue:`Enable {{name}}`,name:o}),onClick:()=>q(n),disabled:H,children:r?(0,D.jsx)(S,{className:`h-4 w-4`}):(0,D.jsx)(g,{className:`h-4 w-4`})}),(0,D.jsx)(v,{variant:`ghost`,size:`icon`,title:e(`appManagement.setDefault`,{defaultValue:`Set as default`}),"aria-label":e(`appManagement.setDefaultNamed`,{defaultValue:`Set {{name}} as default`,name:o}),onClick:()=>J(n),disabled:H||i,children:(0,D.jsx)(C,{className:`h-4 w-4 ${i?`fill-current text-yellow-500`:``}`})}),(0,D.jsx)(v,{variant:`ghost`,size:`icon`,title:a?e(`appManagement.confirmDelete`,{defaultValue:`Click again to confirm delete`}):e(`appManagement.deleteApp`,{defaultValue:`Delete app`}),"aria-label":a?e(`appManagement.confirmDeleteNamed`,{defaultValue:`Confirm delete {{name}}`,name:o}):e(`appManagement.deleteAppNamed`,{defaultValue:`Delete {{name}}`,name:o}),onClick:()=>Y(n),disabled:H,className:a?`text-destructive`:``,children:(0,D.jsx)(c,{className:`h-4 w-4`})})]})]})},n.name)})})]})}export{k as AppManagementPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,g as r,h as i,r as a}from"./vendor-react-CsWFRkED.js";import{S as o,n as s,v as ee,x as te}from"./infrastructure-BCTDJsqi.js";import{N as ne,nt as re}from"./framework-BwfIhdyz.js";import{Bt as ie,Cn as ae,Dn as oe,Dr as se,En as c,Gi as ce,Gr as le,Gt as l,Hr as ue,Ht as de,In as fe,Is as pe,Jr as me,Jt as he,Kr as ge,Kt as u,La as _e,On as ve,Or as ye,Pr as d,Rr as be,Sn as xe,Tn as Se,Ts as Ce,Ur as we,Ut as Te,Vr as Ee,Vt as De,Wr as Oe,Ws as ke,Wt as Ae,Xc as je,Xr as f,Xs as Me,Yr as Ne,Ys as Pe,_c as Fe,aa as Ie,ac as Le,ai as Re,al as p,bn as ze,cc as Be,fi as Ve,gn as m,gt as He,hc as Ue,ht as We,kr as Ge,mc as Ke,oa as qe,qr as Je,qt as Ye,ri as Xe,ta as Ze,vn as Qe,wn as $e,xn as et,ya as tt,yn as nt,yt as rt,zr as it,zt as at}from"./ui-components-Dwq5utCl.js";import{r as h}from"./vendor-ui-utils-BFw4cGI6.js";import{r as ot,y as st}from"./RecordDetailView-BBNqsNy9.js";import{n as ct}from"./index-BLepsDd_.js";var g=e(n(),1),lt=`${``.replace(/\/$/,``)}/api/v1`;async function _(e,t){let n=o.get(),r=await fetch(`${lt}${e}`,{credentials:`include`,headers:{"Content-Type":`application/json`,...n?{Authorization:`Bearer ${n}`}:{},...t?.headers||{}},...t}),i=null;try{i=await r.json()}catch{}if(!r.ok){let e=i?.code??`HTTP_${r.status}`,t=i?.message??i?.error??r.statusText,n=Error(`${e}: ${t}`);throw n.code=e,n.status=r.status,n.details=i,n}return i}var v={listProcesses(e={}){let t=new URLSearchParams;e.object&&t.set(`object`,e.object),e.activeOnly&&t.set(`activeOnly`,`true`);let n=t.toString();return _(`/approvals/processes${n?`?${n}`:``}`)},listRequests(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.object&&t.set(`object`,e.object),e.recordId&&t.set(`recordId`,e.recordId);let n=Array.isArray(e.approverId)?e.approverId.filter(Boolean).join(`,`):e.approverId;n&&t.set(`approverId`,n),e.submitterId&&t.set(`submitterId`,e.submitterId),e.q?.trim()&&t.set(`q`,e.q.trim()),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let r=t.toString();return _(`/approvals/requests${r?`?${r}`:``}`)},async getRequest(e){return{data:await _(`/approvals/requests/${encodeURIComponent(e)}`)}},listActions(e){return _(`/approvals/requests/${encodeURIComponent(e)}/actions`)},async approve(e,t){let n=await _(`/approvals/requests/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async reject(e,t){let n=await _(`/approvals/requests/${encodeURIComponent(e)}/reject`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async recall(e,t){return{data:(await _(`/approvals/requests/${encodeURIComponent(e)}/recall`,{method:`POST`,body:JSON.stringify(t)})).request,finalized:!0}},async reassign(e,t){return{data:(await _(`/approvals/requests/${encodeURIComponent(e)}/reassign`,{method:`POST`,body:JSON.stringify(t)})).request}},async remind(e,t={}){let n=await _(`/approvals/requests/${encodeURIComponent(e)}/remind`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,notified:n.notified}},async requestInfo(e,t){return{data:(await _(`/approvals/requests/${encodeURIComponent(e)}/request-info`,{method:`POST`,body:JSON.stringify(t)})).request}},async sendBack(e,t){let n=await _(`/approvals/requests/${encodeURIComponent(e)}/revise`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,autoRejected:n.autoRejected===!0}},async resubmit(e,t={}){let n=await _(`/approvals/requests/${encodeURIComponent(e)}/resubmit`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,resumed:n.resumed===!0}},async comment(e,t){return{data:(await _(`/approvals/requests/${encodeURIComponent(e)}/comment`,{method:`POST`,body:JSON.stringify(t)})).request}},async submit(e){return _(`/approvals/requests`,{method:`POST`,body:JSON.stringify(e)})}};function ut(e){if(!e)return[];let t=new Set;e.id&&t.add(e.id),e.email&&t.add(e.email);let n=[...e.positions||[],...typeof e.role==`string`?e.role.split(`,`):[]];for(let e of n){let n=String(e).trim();n&&t.add(`role:${n}`)}return Array.from(t)}function y(e,t){return`${e}::${t}`}function b(e){return typeof e.object_name==`string`&&e.object_name!==``&&typeof e.record_id==`string`&&e.record_id!==``}function x(e){let t=new Map,n=new Set;for(let r of e){if(!b(r))continue;let e=y(r.object_name,r.record_id);if(n.has(e))continue;n.add(e);let i=t.get(r.object_name);i?i.push(r.record_id):t.set(r.object_name,[r.record_id])}let r=[];for(let[e,n]of t)for(let t=0;t<n.length;t+=100)r.push({objectName:e,ids:n.slice(t,t+100)});return r}function S(e){if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]}async function dt(e,t){let n=new Map,r=x(t);return await Promise.all(r.map(async({objectName:t,ids:r})=>{let i;try{let n=await e.find(t,{$filter:{id:{$in:r}},$select:[`id`],$top:r.length});i=new Set(S(n).map(e=>e?.id).filter(e=>typeof e==`string`&&e!==``))}catch{return}for(let e of r)n.set(y(t,e),i.has(e))})),n}function ft(e){let t=re(),[n,r]=(0,g.useState)(()=>new Map),i=(0,g.useRef)(new Set),a=(0,g.useRef)(e);a.current=e;let o=(0,g.useMemo)(()=>e.filter(b).map(e=>y(e.object_name,e.record_id)).join(`|`),[e]);return(0,g.useEffect)(()=>{if(!t)return;let e=a.current.filter(e=>b(e)&&!i.current.has(y(e.object_name,e.record_id)));if(e.length===0)return;for(let t of e)b(t)&&i.current.add(y(t.object_name,t.record_id));let n=!1;return dt(t,e).then(e=>{n||e.size===0||r(t=>{let n=new Map(t);for(let[t,r]of e)n.set(t,r);return n})}),()=>{n=!0}},[t,o]),(0,g.useMemo)(()=>({isUnreadable:e=>b(e)&&n.get(y(e.object_name,e.record_id))===!1}),[n])}var C=a(),pt=50,w={pending:`border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-400`,approved:`border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400`,rejected:`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`,recalled:`border-border bg-muted text-muted-foreground`,returned:`border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-400`};function mt({status:e,label:t}){return(0,C.jsx)(d,{variant:`outline`,className:p(`font-medium`,w[e]??``),children:t})}function ht(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function T(e){return e?e.includes(`@`)?e:e.startsWith(`role:`)?`Role: ${e.slice(5)}`:e.length>14?`${e.slice(0,6)}…${e.slice(-4)}`:e:`—`}function E(e){return e&&String(e).replace(/^flow:/,``).trim().split(/[_\-\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||`—`}function gt(e){return e.process_label||E(e.process_name)}function _t(e){return e.step_label?e.step_label:e.current_step?E(e.current_step):null}function vt(e){return e.submitter_name||T(e.submitter_id)}function yt(e,t){return t.pending_approver_names?.[e]||T(e)}function D(e,t){let n=t.pending_approver_groups?.[e];return n&&n.length?n.join(` / `):void 0}function bt(e){let t=[],n=new Map;for(let r of e.pending_approvers||[]){let i=yt(r,e),a=D(r,e),o=a?`${i} ${a}`:i,s=n.get(o);s?(s.count+=1,r&&!s.title.split(`, `).includes(r)&&(s.title+=`, ${r}`)):(n.set(o,{label:i,group:a,count:1,title:r||i}),t.push(o))}return t.map(e=>n.get(e))}function xt(e){if(e.submitter_name)return!1;let t=(e.submitter_id||``).trim();return!t||t.startsWith(`flow:`)||t.startsWith(`system:`)}function St(e){return e.object_label||e.object_name}function O(e){return e.submitted_at||e.created_at||void 0}function Ct(e,t){let n=O(e);if(!n)return null;let r=Date.parse(n);return Number.isNaN(r)?null:(t-r)/36e5}function wt(e,t){if(e.status!==`pending`)return`text-muted-foreground`;let n=Ct(e,t);return n==null?`text-muted-foreground`:n>72?`text-red-600 dark:text-red-400 font-medium`:n>24?`text-amber-600 dark:text-amber-400`:`text-muted-foreground`}function Tt(e){let t=Math.max(1,Math.round(Math.abs(e)/36e5));return t<48?`${t}h`:`${Math.round(t/24)}d`}function Et(e,t){if(!e)return null;let n=Date.parse(e);return Number.isNaN(n)?null:{overdue:n<t,ms:Math.abs(t-n)}}var k=new Set([`id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`organization_id`]);function A(e){let t=e.split(`_`).filter(Boolean);return t.length>1&&t[t.length-1].toLowerCase()===`id`&&t.pop(),t.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Dt(e,t){if(typeof t==`boolean`)return t?`✓`:`—`;if(typeof t==`number`){if(t>0xe8d4a51000&&/(_at$|_date$|^date_|_time$)/.test(e))try{return new Date(t).toLocaleDateString()}catch{}return t.toLocaleString()}let n=String(t);if(/^\d{4}-\d{2}-\d{2}T\d{2}/.test(n))try{return new Date(n).toLocaleString()}catch{}return n}var j=/^[A-Za-z0-9_-]{15,}$/;function Ot(e,t,n,r=6,i){if(!e||typeof e!=`object`||Array.isArray(e))return[];let a=[];for(let[o,s]of Object.entries(e)){if(k.has(o)||i&&o===i||s==null||typeof s==`object`||String(s).trim()===``)continue;let e=t?.[o];if(!(!e&&typeof s==`string`&&j.test(s.trim())&&!/^\d+$/.test(s.trim()))&&(a.push([n?.[o]??A(o),e??Dt(o,s)]),a.length>=r))break}return a}var kt=/(amount|total|price|value|cost|sum|budget|salary|fee|revenue|balance|金额|总额|价格|费用|预算|金额)/i;function M(e){let t=e.payload;if(!t||typeof t!=`object`||Array.isArray(t))return null;for(let[n,r]of Object.entries(t)){if(k.has(n)||!kt.test(n))continue;let t=typeof r==`number`?r:typeof r==`string`&&r.trim()!==``&&Number.isFinite(Number(r))?Number(r):null;if(!(t==null||!Number.isFinite(t)))return{key:n,label:e.payload_labels?.[n]??A(n),value:t,display:e.payload_display?.[n]??t.toLocaleString()}}return null}function At({r:e,tr:t}){return(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`font-medium truncate`,children:gt(e)}),(0,C.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[_t(e)||`—`,(e.round??1)>1&&(0,C.jsx)(`span`,{className:`ml-1.5 text-violet-600 dark:text-violet-400`,children:t(`roundChip`,`Round {{n}}`,{n:e.round})})]})]})}function jt({r:e,href:n}){let r=M(e),i=e.record_title||T(e.record_id);return(0,C.jsxs)(`div`,{className:`min-w-0`,children:[n===null?(0,C.jsx)(`div`,{className:`text-sm truncate max-w-full`,title:e.record_id,children:i}):(0,C.jsxs)(t,{to:n,onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1 text-sm hover:underline truncate max-w-full`,title:e.record_id,children:[(0,C.jsx)(`span`,{className:`truncate`,children:i}),(0,C.jsx)(Ce,{className:`h-3 w-3 shrink-0 text-muted-foreground`})]}),(0,C.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[St(e),r&&(0,C.jsxs)(`span`,{className:`ml-1.5 font-medium text-foreground`,title:`${r.label}: ${r.display}`,children:[`· `,r.display]})]})]})}function Mt({r:e,actionable:t,busy:n,needsInputs:r,tr:i,onApprove:a,onReject:o}){if(!t)return null;let s=i(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`);return(0,C.jsxs)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),title:r?s:void 0,children:[(0,C.jsx)(f,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-emerald-700 hover:text-emerald-800 hover:bg-emerald-50 dark:text-emerald-400`,disabled:n||r,onClick:()=>a(e),"aria-label":r?s:i(`approve`,`Approve`),children:(0,C.jsx)(Le,{className:`h-4 w-4`})}),(0,C.jsx)(f,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400`,disabled:n||r,onClick:()=>o(e),"aria-label":r?s:i(`reject`,`Reject`),children:(0,C.jsx)(Me,{className:`h-4 w-4`})})]})}function N(){let{t:e,language:n}=ne(),{user:a}=ee(),{appName:o}=i(),[re,lt]=r(),_=(0,g.useMemo)(()=>ut(a),[a]),{systemPermissions:y}=s(),b=ct(y),x=(0,g.useCallback)((t,n,r)=>String(e(`approvalsInbox.${t}`,{defaultValue:n,...r})),[e]),[S,dt]=(0,g.useState)(()=>Date.now());(0,g.useEffect)(()=>{let e=setInterval(()=>dt(Date.now()),6e4);return()=>clearInterval(e)},[]);let w=(0,g.useCallback)(e=>{if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let r=Math.round((S-t)/1e3);if(r<45)return x(`justNow`,`just now`);let i=Math.round(r/60);if(i<60)return x(`minutesAgo`,`{{count}}m ago`,{count:i});let a=Math.round(i/60);if(a<24)return x(`hoursAgo`,`{{count}}h ago`,{count:a});let o=Math.round(a/24);if(o<30)return x(`daysAgo`,`{{count}}d ago`,{count:o});try{return new Date(e).toLocaleDateString(n)}catch{return e}},[x,n,S]),E=(0,g.useCallback)(e=>{switch(e){case`pending`:return x(`statusPending`,`Pending`);case`approved`:return x(`statusApproved`,`Approved`);case`rejected`:return x(`statusRejected`,`Rejected`);case`recalled`:return x(`statusRecalled`,`Recalled`);case`returned`:return x(`statusReturned`,`Returned for revision`);default:return e}},[x]),D=(0,g.useCallback)((e,t)=>{let n=e?.code??``,r=e?.status??0;return n===`NOT_IMPLEMENTED`||r===501?x(`recallUnavailable`,`Recall is not available on this deployment.`):n===`THROTTLED`||r===429?x(`remindThrottled`,`A reminder was sent recently — try again later.`):r===404?x(`requestGone`,`This request no longer exists. Refresh the list.`):n===`FORBIDDEN`||r===403?x(`notAllowed`,`You are not allowed to perform this action.`):n===`INVALID_STATE`||r===409?x(`alreadyDecided`,`This request was already decided. Refresh the list.`):e?.message||t},[x]),Ct=(0,g.useCallback)(e=>e.overdue?x(`slaOverdue`,`SLA overdue {{dur}}`,{dur:Tt(e.ms)}):x(`slaRemaining`,`SLA {{dur}} left`,{dur:Tt(e.ms)}),[x]),k=(0,g.useCallback)(e=>`/apps/${o||`setup`}/${encodeURIComponent(e.object_name)}/record/${encodeURIComponent(e.record_id)}`,[o]),[A,Dt]=(0,g.useState)(`pending`),[j,kt]=(0,g.useState)([]),[N,Nt]=(0,g.useState)(!1),[Pt,Ft]=(0,g.useState)(!1),[It,P]=(0,g.useState)(null),[Lt,Rt]=(0,g.useState)(null),[zt,Bt]=(0,g.useState)(0),[F,Vt]=(0,g.useState)(null),[I,L]=(0,g.useState)(null),[Ht,R]=(0,g.useState)([]),[Ut,Wt]=(0,g.useState)(!1),Gt=ft((0,g.useMemo)(()=>I?[...j,I]:j,[j,I])),Kt=(0,g.useMemo)(()=>te(),[]),qt=(0,g.useCallback)(async e=>{let t=window.open(``,`_blank`,`noopener`);try{let n=``.replace(/\/$/,``),r=await Kt(`${n}/api/v1/storage/files/${encodeURIComponent(e.id)}/url`);if(!r.ok)throw Error(`HTTP_${r.status}`);let i=await r.json().catch(()=>null),a=i?.data?.url??i?.url;if(!a)throw Error(`NO_URL`);let o=/^https?:\/\//i.test(a)?a:`${n}${a}`;t?t.location.href=o:window.open(o,`_blank`,`noopener`)}catch{t?.close(),h.error(x(`attachmentOpenFailed`,`Could not open the attachment — please try again`))}},[Kt,x]),[z,Jt]=(0,g.useState)(``),[B,Yt]=(0,g.useState)(``),[V,Xt]=(0,g.useState)(`all`),[Zt,Qt]=(0,g.useState)(`all`),[H,$t]=(0,g.useState)(`all`),[en,tn]=(0,g.useState)(`recent`),[U,nn]=(0,g.useState)(new Set),[rn,an]=(0,g.useState)(!1),[W,on]=(0,g.useState)(null),[G,sn]=(0,g.useState)(null),[cn,ln]=(0,g.useState)(null),[K,un]=(0,g.useState)(``),[dn,fn]=(0,g.useState)(!1),[pn,mn]=(0,g.useState)(-1);(0,g.useEffect)(()=>{if(A===`pending`)return;let e=window.setTimeout(()=>Yt(z),350);return()=>window.clearTimeout(e)},[z,A]);let q=(0,g.useCallback)(async()=>{Nt(!0),Rt(null);try{let e=[];if(A===`pending`)e=_.length?(await v.listRequests({status:`pending`,approverId:_})).data:[],Bt(e.length),P(null);else{let t={q:B||void 0,status:H===`all`?void 0:H,limit:pt,offset:0};if(A===`submitted`){let n=a?.id;if(n){let r=await v.listRequests({submitterId:n,...t});e=r.data,P(r.total??r.data.length)}else e=[],P(0)}else{let n=await v.listRequests(t);e=n.data,P(n.total??n.data.length)}_.length&&v.listRequests({status:`pending`,approverId:_}).then(e=>Bt(e.data.length)).catch(()=>{})}e.sort((e,t)=>(O(t)||``).localeCompare(O(e)||``)),kt(e)}catch(e){Rt(e?.message||String(e)),kt([])}finally{Nt(!1)}},[A,_,a?.id,B,H]);(0,g.useEffect)(()=>{q()},[q]);let hn=(0,g.useCallback)(async()=>{if(!(A===`pending`||Pt)){Ft(!0);try{let e=await v.listRequests({submitterId:A===`submitted`?a?.id??void 0:void 0,q:B||void 0,status:H===`all`?void 0:H,limit:pt,offset:j.length});kt(t=>{let n=new Set(t.map(e=>e.id));return[...t,...e.data.filter(e=>!n.has(e.id))]}),e.total!=null&&P(e.total)}catch(e){h.error(D(e,x(`loadFailed`,`Failed to load request`)))}finally{Ft(!1)}}},[A,Pt,a?.id,B,H,j.length,D,x]),J=(0,g.useCallback)(async e=>{Vt(e),Wt(!0);try{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);L(t.data),R(n.data)}catch(e){h.error(D(e,x(`loadFailed`,`Failed to load request`))),L(null),R([])}finally{Wt(!1)}},[D,x]),gn=()=>{Vt(null),L(null),R([])};(0,g.useEffect)(()=>{let e=re.get(`request`);e&&(lt(e=>{let t=new URLSearchParams(e);return t.delete(`request`),t},{replace:!0}),J(e))},[re]);let Y=(0,g.useCallback)(()=>{_.length&&v.listRequests({status:`pending`,approverId:_}).then(e=>Bt(e.data.length)).catch(()=>{})},[_]),_n=(0,g.useCallback)(async e=>{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);L(t.data),R(n.data),q()},[q]),vn=(0,g.useCallback)(async()=>{if(!I)return;let e=I.id;try{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);L(t.data),R(n.data),q();let r=new Set(t.data.pending_approvers||[]),i=t.data.status===`pending`&&_.some(e=>r.has(e));if(A===`pending`&&!i){let t=Pn.current,n=t.findIndex(t=>t.id===e),r=t[n+1]??t[n-1];if(r&&r.id!==e){J(r.id);return}gn()}}catch{_n(e)}},[I,_,A,q,J,gn,_n]),yn=(0,g.useCallback)(async()=>{if(!(!I||!K.trim())){fn(!0);try{await v.comment(I.id,{actor_id:a?.id,comment:K.trim()}),un(``),await _n(I.id)}catch(e){h.error(D(e,x(`actionFailed`,`Action failed`)))}finally{fn(!1)}}},[I,K,a?.id,_n,D,x]),bn=(0,g.useMemo)(()=>{if(!I||I.status!==`pending`)return!1;if(I.viewer)return I.viewer.can_act||!!I.viewer.can_override;let e=new Set(I.pending_approvers||[]);return _.some(t=>e.has(t))},[I,_]),xn=(0,g.useMemo)(()=>!I||I.status!==`pending`?!1:I.viewer?I.viewer.is_submitter:I.submitter_id===a?.id,[I,a?.id]),Sn=(0,g.useMemo)(()=>!I||I.status!==`returned`?!1:I.viewer?I.viewer.is_submitter:I.submitter_id===a?.id,[I,a?.id]),Cn=(0,g.useMemo)(()=>{let e=new Set;for(let t of j)e.add(gt(t));return Array.from(e).sort()},[j]),wn=(0,g.useMemo)(()=>{let e=new Set;for(let t of j)t.object_name&&e.add(t.object_name);return Array.from(e).sort()},[j]),X=(0,g.useMemo)(()=>{let e=z.trim().toLowerCase(),t=j.filter(t=>V!==`all`&>(t)!==V||Zt!==`all`&&t.object_name!==Zt||H!==`all`&&t.status!==H?!1:A!==`pending`||!e||[t.process_name,t.process_label,t.step_label,t.object_name,t.record_id,t.record_title,t.submitter_id,t.submitter_name,...t.pending_approvers||[]].filter(Boolean).join(` `).toLowerCase().includes(e));if(en===`recent`)return t;let n=[...t];return en===`amount`?n.sort((e,t)=>{let n=M(e)?.value,r=M(t)?.value;return n==null&&r==null?0:n==null?1:r==null?-1:r-n}):n.sort((e,t)=>(O(e)||``).localeCompare(O(t)||``)),n},[j,z,V,Zt,H,A,en]),Z=(0,g.useMemo)(()=>F?X.findIndex(e=>e.id===F):-1,[X,F]);(0,g.useEffect)(()=>{if(U.size===0)return;let e=new Set(X.map(e=>e.id)),t=!1,n=new Set;for(let r of U)e.has(r)?n.add(r):t=!0;t&&nn(n)},[X,U]),(0,g.useEffect)(()=>{pn>=X.length&&mn(X.length-1)},[X.length,pn]);let Tn=(0,g.useCallback)(e=>{if(e.status!==`pending`)return!1;let t=new Set(_);return(e.pending_approvers||[]).some(e=>t.has(e))},[_]),Q=(0,g.useCallback)(e=>Array.isArray(e.decision_outputs)&&e.decision_outputs.length>0,[]),En=(0,g.useCallback)(e=>Tn(e)&&!Q(e),[Tn,Q]),$=(0,g.useMemo)(()=>X.filter(e=>U.has(e.id)&&En(e)),[X,U,En]),Dn=X.filter(e=>e.status===`pending`),On=Dn.length>0&&Dn.every(e=>U.has(e.id)),kn=(0,g.useCallback)(()=>{nn(e=>{if(On)return new Set;let t=new Set(e);for(let e of Dn)t.add(e.id);return t})},[On,Dn]),An=(0,g.useCallback)(e=>{nn(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),jn=(0,g.useCallback)(async e=>{let t=$;if(t.length===0)return;an(!0);let n=0,r=[];for(let i of t){let t=new Set(i.pending_approvers||[]),o=_.find(e=>t.has(e))||a?.id||``;try{await(e===`approve`?v.approve:v.reject)(i.id,{actor_id:o}),n++}catch{r.push(i.record_title||T(i.record_id))}}if(an(!1),nn(new Set),r.length===0)h.success(e===`approve`?x(`bulkApproved`,`Approved {{count}} requests`,{count:n}):x(`bulkRejected`,`Rejected {{count}} requests`,{count:n}));else{let e=r.slice(0,3).join(`, `);h.error(x(`bulkPartial`,`{{ok}} succeeded, {{fail}} failed: {{which}}`,{ok:n,fail:r.length,which:e+(r.length>3?`…`:``)}))}q(),Y()},[$,_,a?.id,q,Y,x]),Mn=(0,g.useCallback)(async()=>{let e=W;if(!e)return;let t=new Set(e.pending_approvers||[]),n=_.find(e=>t.has(e))||a?.id||``;ln(e.id),on(null);try{let t=await v.approve(e.id,{actor_id:n});h.success(t.finalized?x(`inlineApproved`,`Approved "{{title}}"`,{title:e.record_title||T(e.record_id)}):x(`approvedWaiting`,`Approved — waiting on the remaining approvers`)),q(),Y()}catch(e){h.error(D(e,x(`actionFailed`,`Action failed`)))}finally{ln(null)}},[W,_,a?.id,q,Y,D,x]),Nn=(0,g.useCallback)(async()=>{let e=G;if(!e)return;let t=new Set(e.pending_approvers||[]),n=_.find(e=>t.has(e))||a?.id||``;ln(e.id),sn(null);try{await v.reject(e.id,{actor_id:n}),h.success(x(`inlineRejected`,`Rejected "{{title}}"`,{title:e.record_title||T(e.record_id)})),q(),Y()}catch(e){h.error(D(e,x(`actionFailed`,`Action failed`)))}finally{ln(null)}},[G,_,a?.id,q,Y,D,x]),Pn=(0,g.useRef)(X);Pn.current=X;let Fn=(0,g.useRef)(pn);Fn.current=pn,(0,g.useEffect)(()=>{let e=e=>{if(F||W||G)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Pn.current;if(!r.length)return;let i=Fn.current;e.key===`j`||e.key===`ArrowDown`?(e.preventDefault(),mn(Math.min(i+1,r.length-1))):e.key===`k`||e.key===`ArrowUp`?(e.preventDefault(),mn(Math.max(i-1,0))):e.key===`Enter`&&i>=0&&r[i]?(e.preventDefault(),J(r[i].id)):(e.key===`x`||e.key===` `)&&i>=0&&r[i]&&A===`pending`?(e.preventDefault(),An(r[i].id)):e.key===`a`&&i>=0&&r[i]&&En(r[i])?(e.preventDefault(),on(r[i])):e.key===`r`&&i>=0&&r[i]&&En(r[i])&&(e.preventDefault(),sn(r[i]))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[F,W,G,A,J,An,En]),(0,g.useEffect)(()=>{if(!F)return;let e=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Pn.current,i=r.findIndex(e=>e.id===F);if(i<0)return;let a=e.key===`ArrowLeft`?r[i-1]:r[i+1];a&&(e.preventDefault(),J(a.id))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[F,J]);let In=!!z||V!==`all`||Zt!==`all`||H!==`all`,Ln=e=>{Dt(e),$t(`all`),Xt(`all`),Qt(`all`),Jt(``),tn(`recent`),mn(-1)};return(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-6xl`,children:[(0,C.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`h1`,{className:`text-2xl font-semibold flex items-center gap-2`,children:[(0,C.jsx)(ce,{className:`h-6 w-6`}),x(`title`,`Approvals Inbox`)]}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:x(`subtitle`,`Review and act on approval requests.`)})]}),(0,C.jsxs)(f,{variant:`outline`,size:`sm`,onClick:q,disabled:N,className:`self-start sm:self-auto`,children:[(0,C.jsx)(tt,{className:`h-4 w-4 mr-2 ${N?`animate-spin`:``}`}),x(`refresh`,`Refresh`)]})]}),Lt&&(0,C.jsxs)(be,{variant:`destructive`,children:[(0,C.jsx)(Be,{className:`h-4 w-4`}),(0,C.jsx)(it,{children:Lt})]}),(0,C.jsxs)(at,{value:A,onValueChange:Ln,children:[(0,C.jsxs)(De,{children:[(0,C.jsxs)(de,{value:`pending`,children:[x(`tabMyPending`,`My Pending`),zt>0&&(0,C.jsx)(d,{variant:`secondary`,className:`ml-2`,children:zt})]}),(0,C.jsx)(de,{value:`submitted`,children:x(`tabSubmitted`,`Submitted by me`)}),(0,C.jsx)(de,{value:`all`,children:x(`tabAll`,`All`)})]}),(0,C.jsxs)(ie,{value:A,className:`mt-4 space-y-3`,children:[!N&&(j.length>0||A!==`pending`&&(B||H!==`all`))&&(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-sm`,children:[(0,C.jsx)(qe,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,C.jsx)(fe,{value:z,onChange:e=>Jt(e.target.value),placeholder:x(`searchPlaceholder`,`Search record, process, requester…`),className:`pl-8 h-8 text-sm`}),z&&(0,C.jsx)(`button`,{type:`button`,onClick:()=>Jt(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":x(`clearSearch`,`Clear search`),children:(0,C.jsx)(Xe,{className:`h-3.5 w-3.5`})})]}),A!==`pending`&&(0,C.jsxs)($e,{value:H,onValueChange:$t,children:[(0,C.jsx)(oe,{className:`h-8 w-auto min-w-[130px] text-sm`,children:(0,C.jsx)(ve,{placeholder:x(`statusFilter`,`Status`)})}),(0,C.jsxs)(Se,{children:[(0,C.jsx)(c,{value:`all`,children:x(`allStatuses`,`All statuses`)}),(0,C.jsx)(c,{value:`pending`,children:E(`pending`)}),(0,C.jsx)(c,{value:`approved`,children:E(`approved`)}),(0,C.jsx)(c,{value:`rejected`,children:E(`rejected`)}),(0,C.jsx)(c,{value:`recalled`,children:E(`recalled`)}),(0,C.jsx)(c,{value:`returned`,children:E(`returned`)})]})]}),Cn.length>1&&(0,C.jsxs)($e,{value:V,onValueChange:Xt,children:[(0,C.jsx)(oe,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,C.jsx)(ve,{placeholder:x(`processFilter`,`Process`)})}),(0,C.jsxs)(Se,{children:[(0,C.jsx)(c,{value:`all`,children:x(`allProcesses`,`All processes`)}),Cn.map(e=>(0,C.jsx)(c,{value:e,children:e},e))]})]}),wn.length>1&&(0,C.jsxs)($e,{value:Zt,onValueChange:Qt,children:[(0,C.jsx)(oe,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,C.jsx)(ve,{placeholder:x(`objectFilter`,`Object`)})}),(0,C.jsxs)(Se,{children:[(0,C.jsx)(c,{value:`all`,children:x(`allObjects`,`All objects`)}),wn.map(e=>(0,C.jsx)(c,{value:e,children:e},e))]})]}),(0,C.jsxs)($e,{value:en,onValueChange:e=>tn(e),children:[(0,C.jsxs)(oe,{className:`h-8 w-auto min-w-[120px] text-sm`,children:[(0,C.jsx)(je,{className:`h-3.5 w-3.5 mr-1 text-muted-foreground`}),(0,C.jsx)(ve,{placeholder:x(`sortBy`,`Sort`)})]}),(0,C.jsxs)(Se,{children:[(0,C.jsx)(c,{value:`recent`,children:x(`sortRecent`,`Newest first`)}),(0,C.jsx)(c,{value:`oldest`,children:x(`sortOldest`,`Oldest first`)}),(0,C.jsx)(c,{value:`amount`,children:x(`sortAmount`,`Amount (high→low)`)})]})]}),In&&(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:x(`filterCount`,`{{shown}} of {{total}}`,{shown:X.length,total:j.length})})]}),A===`pending`&&U.size>0&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 rounded-md border bg-accent/30 text-sm`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`strong`,{children:U.size}),` `,x(`selected`,`selected`),$.length!==U.size&&(0,C.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:x(`actionableCount`,`({{count}} actionable)`,{count:$.length})})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(Ee,{children:[(0,C.jsx)(Ne,{asChild:!0,children:(0,C.jsxs)(f,{size:`sm`,disabled:rn||$.length===0,children:[(0,C.jsx)(Le,{className:`h-3.5 w-3.5 mr-1`}),x(`approveN`,`Approve {{count}}`,{count:$.length||``})]})}),(0,C.jsxs)(Oe,{children:[(0,C.jsxs)(Je,{children:[(0,C.jsx)(me,{children:x(`bulkApproveTitle`,`Approve {{count}} requests?`,{count:$.length})}),(0,C.jsx)(le,{children:x(`bulkApproveBody`,`Each request is approved with your identity and its flow continues down the approve branch.`)})]}),(0,C.jsxs)(ge,{children:[(0,C.jsx)(we,{children:x(`cancel`,`Cancel`)}),(0,C.jsx)(ue,{onClick:()=>jn(`approve`),children:x(`approveN`,`Approve {{count}}`,{count:$.length})})]})]})]}),(0,C.jsxs)(Ee,{children:[(0,C.jsx)(Ne,{asChild:!0,children:(0,C.jsxs)(f,{size:`sm`,variant:`outline`,disabled:rn||$.length===0,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,C.jsx)(Me,{className:`h-3.5 w-3.5 mr-1`}),x(`rejectN`,`Reject {{count}}`,{count:$.length||``})]})}),(0,C.jsxs)(Oe,{children:[(0,C.jsxs)(Je,{children:[(0,C.jsx)(me,{children:x(`bulkRejectTitle`,`Reject {{count}} requests?`,{count:$.length})}),(0,C.jsx)(le,{children:x(`bulkRejectBody`,`This rejects the selected requests and notifies their submitters.`)})]}),(0,C.jsxs)(ge,{children:[(0,C.jsx)(we,{children:x(`cancel`,`Cancel`)}),(0,C.jsx)(ue,{onClick:()=>jn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:x(`rejectN`,`Reject {{count}}`,{count:$.length})})]})]})]}),(0,C.jsx)(f,{size:`sm`,variant:`ghost`,onClick:()=>nn(new Set),disabled:rn,children:x(`clear`,`Clear`)})]})]}),N?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(m,{className:`h-10 w-full`}),(0,C.jsx)(m,{className:`h-10 w-full`}),(0,C.jsx)(m,{className:`h-10 w-full`})]}):j.length===0?(0,C.jsx)(`div`,{className:`flex items-center justify-center min-h-[240px] rounded-md border border-dashed`,children:(0,C.jsxs)(We,{children:[(0,C.jsx)(rt,{children:x(`emptyTitle`,`No requests`)}),(0,C.jsx)(He,{children:A===`pending`?x(`emptyPending`,`You're all caught up — nothing is waiting on you.`):x(`emptyOther`,`Nothing here yet.`)}),A===`pending`&&(0,C.jsx)(f,{variant:`link`,size:`sm`,className:`mt-1`,onClick:()=>Ln(`all`),children:x(`emptyViewAll`,`Browse all requests`)})]})}):X.length===0?(0,C.jsx)(`div`,{className:`flex items-center justify-center min-h-[160px] rounded-md border border-dashed text-sm text-muted-foreground`,children:x(`noMatches`,`No matches for current filters.`)}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(ye,{className:`hidden md:block`,children:(0,C.jsx)(Ge,{className:`p-0`,children:(0,C.jsxs)(Te,{children:[(0,C.jsx)(Ye,{children:(0,C.jsxs)(he,{children:[A===`pending`&&(0,C.jsx)(u,{className:`w-10`,children:(0,C.jsx)(se,{checked:On,onCheckedChange:kn,"aria-label":x(`selectAll`,`Select all`),disabled:Dn.length===0})}),(0,C.jsx)(u,{className:`w-[22%]`,children:x(`colRequest`,`Request`)}),(0,C.jsx)(u,{className:`w-[30%]`,children:x(`colRecord`,`Record`)}),(0,C.jsx)(u,{className:`w-[16%]`,children:x(`colRequester`,`Requester`)}),(0,C.jsx)(u,{className:`w-[110px] min-w-[96px] whitespace-nowrap`,children:x(`colStatus`,`Status`)}),(0,C.jsx)(u,{className:`w-[132px]`,children:x(`colWaiting`,`Submitted`)}),(0,C.jsx)(u,{className:`w-20`,"aria-label":x(`colActions`,`Actions`)})]})}),(0,C.jsx)(Ae,{children:X.map((e,t)=>(0,C.jsxs)(he,{className:p(`group cursor-pointer hover:bg-accent/50`,pn===t&&`ring-2 ring-inset ring-ring bg-accent/30`),onClick:()=>{mn(t),J(e.id)},children:[A===`pending`&&(0,C.jsx)(l,{className:`w-10`,onClick:e=>e.stopPropagation(),children:(0,C.jsx)(se,{checked:U.has(e.id),onCheckedChange:()=>An(e.id),disabled:e.status!==`pending`,"aria-label":x(`selectRow`,`Select request`)})}),(0,C.jsx)(l,{children:(0,C.jsx)(At,{r:e,tr:x})}),(0,C.jsx)(l,{children:(0,C.jsx)(jt,{r:e,href:Gt.isUnreadable(e)?null:k(e)})}),(0,C.jsx)(l,{children:xt(e)?(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground`,children:[(0,C.jsx)(Re,{className:`h-3.5 w-3.5 shrink-0`}),(0,C.jsx)(`span`,{className:`truncate italic`,children:x(`flowOrigin`,`Flow-initiated`)})]}):(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,C.jsx)(Ve,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,C.jsx)(`span`,{className:`truncate`,title:e.submitter_id||``,children:vt(e)})]})}),(0,C.jsx)(l,{children:(0,C.jsx)(mt,{status:e.status,label:E(e.status)})}),(0,C.jsxs)(l,{className:p(`text-xs whitespace-nowrap`,wt(e,S)),title:ht(O(e)),children:[(0,C.jsx)(ke,{className:`h-3 w-3 inline mr-1`}),w(O(e)),e.status===`pending`&&(()=>{let t=Et(e.sla_due_at,S);return t?(0,C.jsx)(`div`,{className:p(`mt-0.5 text-[10px] font-medium`,t.overdue?`text-red-600 dark:text-red-400`:`text-muted-foreground`),children:Ct(t)}):null})()]}),(0,C.jsx)(l,{className:`w-20`,children:(0,C.jsx)(Mt,{r:e,actionable:Tn(e),busy:cn===e.id,needsInputs:Q(e),tr:x,onApprove:on,onReject:sn})})]},e.id))})]})})}),(0,C.jsx)(`div`,{className:`md:hidden space-y-2`,children:X.map(e=>(0,C.jsx)(ye,{className:`cursor-pointer active:bg-accent/50`,onClick:()=>void J(e.id),children:(0,C.jsxs)(Ge,{className:`p-3 space-y-1.5`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsx)(`div`,{className:`font-medium text-sm truncate`,children:gt(e)}),(0,C.jsx)(mt,{status:e.status,label:E(e.status)})]}),(0,C.jsxs)(`div`,{className:`text-sm truncate`,children:[e.record_title||T(e.record_id),(0,C.jsx)(`span`,{className:`text-muted-foreground text-xs ml-1.5`,children:St(e)}),(()=>{let t=M(e);return t?(0,C.jsxs)(`span`,{className:`text-xs ml-1.5 font-medium`,title:t.label,children:[`· `,t.display]}):null})()]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[xt(e)?(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate italic`,children:[(0,C.jsx)(Re,{className:`h-3 w-3`}),x(`flowOrigin`,`Flow-initiated`)]}):(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,C.jsx)(Ve,{className:`h-3 w-3`}),vt(e)]}),(0,C.jsxs)(`span`,{className:p(`inline-flex items-center gap-1 whitespace-nowrap`,wt(e,S)),children:[(0,C.jsx)(ke,{className:`h-3 w-3`}),w(O(e))]})]}),Tn(e)&&(0,C.jsxs)(`div`,{className:`flex gap-2 pt-1`,onClick:e=>e.stopPropagation(),title:Q(e)?x(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`):void 0,children:[(0,C.jsxs)(f,{size:`sm`,className:`h-7 flex-1`,disabled:cn===e.id||Q(e),onClick:()=>on(e),children:[(0,C.jsx)(Le,{className:`h-3.5 w-3.5 mr-1`}),x(`approve`,`Approve`)]}),(0,C.jsxs)(f,{size:`sm`,variant:`outline`,className:`h-7 flex-1 border-destructive text-destructive`,disabled:cn===e.id||Q(e),onClick:()=>sn(e),children:[(0,C.jsx)(Me,{className:`h-3.5 w-3.5 mr-1`}),x(`reject`,`Reject`)]})]})]})},e.id))}),A!==`pending`&&It!=null&&(0,C.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-1`,children:[(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:x(`loadedOf`,`Loaded {{loaded}} of {{total}}`,{loaded:j.length,total:It})}),j.length<It&&(0,C.jsx)(f,{size:`sm`,variant:`outline`,disabled:Pt,onClick:()=>void hn(),children:Pt?x(`loadingMore`,`Loading…`):x(`loadMore`,`Load more`)})]}),(0,C.jsx)(`div`,{className:`hidden md:block text-[11px] text-muted-foreground`,children:x(`keyboardHint`,`Keyboard: j/k move · Enter open · x select · a approve · r reject`)})]})]})]}),(0,C.jsx)(Ee,{open:!!W,onOpenChange:e=>!e&&on(null),children:(0,C.jsxs)(Oe,{children:[(0,C.jsxs)(Je,{children:[(0,C.jsx)(me,{children:x(`approveOneTitle`,`Approve "{{title}}"?`,{title:W?W.record_title||T(W.record_id):``})}),(0,C.jsx)(le,{children:x(`approveOneBody`,`This approves the request with your identity. To add a comment or attachment, open the request instead.`)})]}),(0,C.jsxs)(ge,{children:[(0,C.jsx)(we,{children:x(`cancel`,`Cancel`)}),(0,C.jsx)(ue,{onClick:()=>void Mn(),children:x(`approve`,`Approve`)})]})]})}),(0,C.jsx)(Ee,{open:!!G,onOpenChange:e=>!e&&sn(null),children:(0,C.jsxs)(Oe,{children:[(0,C.jsxs)(Je,{children:[(0,C.jsx)(me,{children:x(`rejectOneTitle`,`Reject "{{title}}"?`,{title:G?G.record_title||T(G.record_id):``})}),(0,C.jsx)(le,{children:x(`rejectOneBody`,`This rejects the request and notifies the submitter.`)})]}),(0,C.jsxs)(ge,{children:[(0,C.jsx)(we,{children:x(`cancel`,`Cancel`)}),(0,C.jsx)(ue,{onClick:()=>void Nn(),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:x(`reject`,`Reject`)})]})]})}),(0,C.jsx)(Qe,{open:!!F,onOpenChange:e=>!e&&gn(),children:(0,C.jsxs)(nt,{className:`w-full sm:max-w-xl overflow-y-auto`,children:[(0,C.jsxs)(et,{children:[(0,C.jsx)(xe,{children:I?gt(I):x(`drawerTitle`,`Approval Request`)}),(0,C.jsx)(ze,{children:I?_t(I)||St(I):``})]}),I&&Z>=0&&X.length>1&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-xs text-muted-foreground`,children:[(0,C.jsxs)(f,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:Z<=0,onClick:()=>{let e=X[Z-1];e&&J(e.id)},children:[(0,C.jsx)(Ue,{className:`h-4 w-4 mr-0.5`}),x(`prevRequest`,`Previous`)]}),(0,C.jsx)(`span`,{children:x(`positionOf`,`Request {{index}} of {{total}}`,{index:Z+1,total:X.length})}),(0,C.jsxs)(f,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:Z>=X.length-1,onClick:()=>{let e=X[Z+1];e&&J(e.id)},children:[x(`nextRequest`,`Next`),(0,C.jsx)(Ke,{className:`h-4 w-4 ml-0.5`})]})]}),Ut?(0,C.jsxs)(`div`,{className:`space-y-2 mt-6`,children:[(0,C.jsx)(m,{className:`h-6 w-3/4`}),(0,C.jsx)(m,{className:`h-6 w-1/2`}),(0,C.jsx)(m,{className:`h-20 w-full`})]}):I?(0,C.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,C.jsx)(mt,{status:I.status,label:E(I.status)}),(I.round??1)>1&&(0,C.jsx)(d,{variant:`outline`,className:`text-[10px] border-violet-200 text-violet-700 dark:border-violet-500/30 dark:text-violet-400`,children:x(`roundChip`,`Round {{n}}`,{n:I.round})}),(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:ht(O(I)),children:[(0,C.jsx)(ke,{className:`h-3 w-3`}),x(`submittedAgo`,`Submitted {{when}}`,{when:w(O(I))})]}),I.completed_at&&(0,C.jsxs)(`span`,{children:[`· `,x(`completedAt`,`Completed {{when}}`,{when:w(I.completed_at)})]}),I.status===`pending`&&(()=>{let e=Et(I.sla_due_at,S);return e?(0,C.jsx)(d,{variant:`outline`,className:p(`text-[10px]`,e.overdue?`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`:`border-border text-muted-foreground`),children:Ct(e)}):null})()]}),(()=>{let e=M(I),n=Ot(I.payload,I.payload_display,I.payload_labels,6,e?.key);return(0,C.jsx)(ye,{children:(0,C.jsxs)(Ge,{className:`p-4 space-y-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[Gt.isUnreadable(I)?(0,C.jsx)(`div`,{className:`text-base font-semibold truncate`,children:I.record_title||T(I.record_id)}):(0,C.jsxs)(t,{to:k(I),className:`text-base font-semibold hover:underline inline-flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:I.record_title||T(I.record_id)}),(0,C.jsx)(Ce,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:St(I)})]}),(0,C.jsx)(`div`,{className:`text-right text-xs text-muted-foreground shrink-0`,children:(0,C.jsx)(`div`,{className:`inline-flex items-center gap-1`,children:xt(I)?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Re,{className:`h-3 w-3`}),(0,C.jsx)(`span`,{className:`italic`,children:x(`flowOrigin`,`Flow-initiated`)})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Ve,{className:`h-3 w-3`}),(0,C.jsx)(`span`,{title:I.submitter_id||``,children:vt(I)})]})})})]}),e&&(0,C.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e.label}),(0,C.jsx)(`div`,{className:`text-xl font-semibold tabular-nums`,title:e.display,children:e.display})]}),n.length>0&&(0,C.jsx)(`div`,{className:p(`grid grid-cols-2 gap-x-4 gap-y-2 text-sm`,!e&&`border-t pt-3`),children:n.map(([e,t])=>(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,C.jsx)(`div`,{className:`truncate`,title:t,children:t})]},e))}),I.decision_progress&&(()=>{let e=I.decision_progress,t=(I.pending_approvers||[]).length;return(0,C.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1.5`,children:[(0,C.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.behavior===`per_group`?x(`progressGroups`,`Sign-off progress — {{got}} of {{need}} groups`,{got:e.got,need:e.need}):x(`progressApprovals`,`Approvals — {{got}} of {{need}}`,{got:e.got,need:e.need})}),e.behavior!==`per_group`&&I.status===`pending`&&t>0&&(0,C.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:x(`progressEligible`,`{{count}} eligible approver(s)`,{count:t})})]}),(0,C.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":e.need,"aria-valuenow":Math.min(e.got,e.need),"aria-label":x(`progressBar`,`Decision progress`),className:`flex gap-1`,children:e.need>0&&e.need<=12?Array.from({length:e.need}).map((t,n)=>(0,C.jsx)(`div`,{className:p(`h-1.5 flex-1 rounded-full`,n<e.got?`bg-emerald-500`:`bg-muted`)},n)):(0,C.jsx)(`div`,{className:`h-1.5 flex-1 rounded-full bg-muted overflow-hidden`,children:(0,C.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500`,style:{width:`${e.need>0?Math.min(100,e.got/e.need*100):0}%`}})})}),e.groups&&(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.groups.map(e=>(0,C.jsxs)(d,{variant:`outline`,className:p(`text-[11px] gap-1`,e.satisfied?`border-emerald-300 text-emerald-700 dark:border-emerald-700 dark:text-emerald-400`:`text-muted-foreground`),title:`${e.got}/${e.need}`,children:[e.satisfied?(0,C.jsx)(Fe,{className:`h-3 w-3`}):(0,C.jsx)(Pe,{className:`h-2.5 w-2.5`}),e.group,` `,e.got,`/`,e.need]},e.group))})]})})(),I.status===`pending`&&(I.pending_approvers||[]).length>0&&(0,C.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground mb-1`,children:x(`waitingOn`,`Waiting on`)}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:bt(I).map((e,t)=>(0,C.jsxs)(d,{variant:`outline`,className:`text-[11px]`,title:e.title,children:[e.label,e.group&&(0,C.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`· `,e.group]}),e.count>1&&(0,C.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`×`,e.count]})]},`${e.label}-${e.group??``}-${t}`))})]})]})})})(),(I.flow_steps?.length??0)>1&&(0,C.jsx)(`ol`,{className:`flex flex-col px-1`,"aria-label":x(`stepProgress`,`Approval steps`),children:I.flow_steps.map((e,t,n)=>{let r=n[t+1];return(0,C.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col items-center self-stretch`,children:[(0,C.jsx)(`span`,{className:p(`flex items-center justify-center h-5 w-5 shrink-0 rounded-full text-[10px] font-semibold`,e.state===`done`&&`bg-emerald-500 text-white`,e.state===`current`&&`bg-amber-500 text-white ring-2 ring-amber-200 dark:ring-amber-500/30`,e.state===`upcoming`&&`bg-muted text-muted-foreground border`),children:e.state===`done`?(0,C.jsx)(Fe,{className:`h-3 w-3`}):t+1}),r&&(0,C.jsx)(`div`,{className:p(`w-px flex-1 min-h-3 my-1`,r.state===`done`||r.state===`current`?`bg-emerald-300 dark:bg-emerald-700`:`bg-border`)})]}),(0,C.jsx)(`span`,{className:p(`min-w-0 flex-1 pt-0.5 text-xs break-words`,e.state===`current`?`font-medium`:`text-muted-foreground`),children:e.label})]},e.id)})}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{className:`text-sm font-semibold mb-3`,children:x(`history`,`Activity`)}),Ht.length===0?(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:x(`noActions`,`No actions yet.`)}):(0,C.jsx)(`ol`,{className:`relative space-y-3 pl-5 before:absolute before:left-[7px] before:top-1 before:bottom-1 before:w-px before:bg-border`,children:Ht.map(e=>{let t=st(e),n=t?`bg-amber-500`:e.action===`approve`?`bg-emerald-500`:e.action===`reject`?`bg-destructive`:e.action===`submit`?`bg-blue-500`:e.action===`reassign`?`bg-indigo-500`:e.action===`remind`||e.action===`request_info`?`bg-amber-500`:e.action===`comment`?`bg-slate-400`:e.action===`escalate`?`bg-red-500`:e.action===`revise`?`bg-violet-500`:e.action===`resubmit`?`bg-blue-500`:`bg-muted-foreground`,r=e.actor_id===`system:sla`?x(`systemSlaActor`,`System (SLA)`):e.actor_name??(e.actor_id&&e.actor_id===I.submitter_id?vt(I):T(e.actor_id)),i=e.action===`submit`?x(`actSubmit`,`Submitted`):e.action===`approve`?x(`actApprove`,`Approved`):e.action===`reject`?x(`actReject`,`Rejected`):e.action===`recall`?x(`actRecall`,`Recalled`):e.action===`reassign`?x(`actReassign`,`Reassigned`):e.action===`remind`?x(`actRemind`,`Reminder sent`):e.action===`request_info`?x(`actRequestInfo`,`Requested more info`):e.action===`comment`?x(`actComment`,`Commented`):e.action===`escalate`?x(`actEscalate`,`SLA escalated`):e.action===`revise`?x(`actRevise`,`Sent back for revision`):e.action===`resubmit`?x(`actResubmit`,`Resubmitted`):e.action;return(0,C.jsxs)(`li`,{className:`relative text-xs`,children:[(0,C.jsx)(`span`,{className:`absolute -left-[18px] top-1 h-3 w-3 rounded-full ring-2 ring-background ${n}`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{className:`flex items-baseline gap-1.5 flex-wrap`,children:[(0,C.jsx)(`span`,{className:`font-medium`,children:i}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,C.jsx)(`span`,{title:e.actor_id||``,children:r}),t&&(0,C.jsxs)(d,{variant:`outline`,className:`gap-1 border-amber-500/60 px-1.5 py-0 text-[10px] font-medium text-amber-700 dark:text-amber-400`,title:x(`viaOverrideHint`,`The actor held no approver slot on this step — admitted by the admin-override path.`),"data-testid":`via-override-chip`,children:[(0,C.jsx)(Ze,{className:`h-3 w-3`,"aria-hidden":!0}),x(`viaOverrideChip`,`Admin override`)]}),(0,C.jsx)(`span`,{className:`ml-auto text-muted-foreground text-[10px]`,title:ht(e.created_at),children:w(e.created_at)})]}),(()=>{let t=e;return e.action!==`reassign`||!t.reassign_from&&!t.reassign_to?null:(0,C.jsx)(`div`,{className:`text-muted-foreground mt-0.5`,children:x(`reassignFromTo`,`from {{from}} to {{to}}`,{from:t.reassign_from_name??T(t.reassign_from),to:t.reassign_to_name??T(t.reassign_to)})})})(),e.comment&&(0,C.jsxs)(`div`,{className:`text-muted-foreground italic mt-0.5`,children:[`"`,e.comment,`"`]}),Array.isArray(e.attachments)&&e.attachments.length>0&&(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:e.attachments.map((t,n)=>(0,C.jsxs)(`button`,{type:`button`,onClick:()=>void qt(t),className:`inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded-full border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,title:t.name||t.id,children:[(0,C.jsx)(_e,{className:`h-3 w-3`}),t.name||`${x(`attachmentChip`,`Attachment`)}${e.attachments.length>1?` ${n+1}`:``}`]},t.id||n))})]},e.id)})}),I.status===`pending`&&(bn||xn)&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,C.jsx)(fe,{value:K,onChange:e=>un(e.target.value),onKeyDown:e=>{e.key===`Enter`&&K.trim()&&(e.preventDefault(),yn())},placeholder:x(`replyPlaceholder`,`Reply on this request…`),className:`h-8 text-sm`}),(0,C.jsx)(f,{size:`sm`,variant:`outline`,className:`h-8 px-2 shrink-0`,disabled:!K.trim()||dn,onClick:()=>void yn(),children:(0,C.jsx)(Ie,{className:`h-3.5 w-3.5`})})]})]}),b&&I.payload!=null&&(0,C.jsxs)(`details`,{className:`group`,children:[(0,C.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:x(`rawData`,`Raw data (JSON)`)}),(0,C.jsxs)(`div`,{className:`mt-2`,children:[(0,C.jsx)(`div`,{className:`flex justify-end`,children:(0,C.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(I.payload,null,2)),h.success(x(`copied`,`Copied`))}catch{h.error(x(`copyFailed`,`Copy failed`))}},className:`text-[10px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,C.jsx)(pe,{className:`h-3 w-3`}),x(`copy`,`Copy`)]})}),(0,C.jsx)(`pre`,{className:`text-[11px] bg-muted/50 rounded p-2 overflow-auto max-h-48 mt-1`,children:JSON.stringify(I.payload,null,2)})]})]}),I.status===`pending`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(ae,{}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(ot,{objectName:`sys_approval_request`,record:I,location:`record_section`,label:x(`declaredActions`,`Actions`),onDone:()=>{vn()}}),!bn&&(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:xn?x(`whyDisabledSubmitter`,`You submitted this request, so you can recall it — but only the assigned approvers can approve or reject.`):x(`whyDisabled`,`Only the assigned approvers can act on this request. It is waiting on: {{who}}.`,{who:(I.pending_approvers||[]).map(e=>yt(e,I)).join(`, `)||`—`})})]})]}),Sn&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(ae,{}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:x(`returnedHint`,`An approver sent this back to you. The record is unlocked — fix the data, then resubmit to start a new approval round.`)}),(0,C.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,C.jsx)(f,{asChild:!0,size:`sm`,variant:`outline`,children:(0,C.jsxs)(t,{to:k(I),children:[(0,C.jsx)(Ce,{className:`h-4 w-4 mr-1`}),x(`editRecordBtn`,`Edit record`)]})}),(0,C.jsx)(ot,{objectName:`sys_approval_request`,record:I,location:`record_section`,onDone:()=>{_n(I.id),q()}})]})]})]})]}):null]})})]})}export{N as ApprovalsInboxPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{Bn as r,Cn as i,Dn as a,En as o,Gt as s,In as c,Jt as l,Kt as u,On as d,Or as f,Pr as p,Rr as m,Sn as h,Tn as g,Ut as _,Wt as ee,Xr as v,bn as te,cc as ne,gn as re,gt as ie,ht as ae,kr as y,oa as b,qt as x,ri as oe,sa as se,vn as ce,wn as le,xn as ue,ya as S,yn as C,yt as w,zr as T}from"./ui-components-Dwq5utCl.js";var E=e(t(),1),de=[`create`,`update`,`delete`,`login`,`logout`,`config_change`,`import`],D={create:`default`,update:`secondary`,delete:`destructive`,login:`outline`,logout:`outline`,config_change:`secondary`,import:`outline`},O=n(),fe=`${``.replace(/\/$/,``)}/api/v1`,k=50;function A(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function j(e,t=24){return e?e.length>t?`${e.slice(0,t-1)}…`:e:`—`}function M(e){if(!e)return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function N(){let[e,t]=(0,E.useState)([]),[n,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[I,L]=(0,E.useState)(`all`),[R,z]=(0,E.useState)(``),[B,V]=(0,E.useState)(``),[H,U]=(0,E.useState)(``),[W,G]=(0,E.useState)(``),[K,q]=(0,E.useState)(0),[J,Y]=(0,E.useState)(!1),[X,Z]=(0,E.useState)(null),Q=(0,E.useCallback)(async()=>{N(!0),F(null);try{let e={};I&&I!==`all`&&(e.action=I),R.trim()&&(e.object_name=R.trim()),B.trim()&&(e.user_id=B.trim()),H&&(e.created_at={...e.created_at||{},$gte:H}),W&&(e.created_at={...e.created_at||{},$lte:`${W}T23:59:59`});let n=new URLSearchParams;Object.keys(e).length>0&&n.set(`$filter`,JSON.stringify(e)),n.set(`$orderby`,`created_at desc`),n.set(`$top`,`51`),n.set(`$skip`,String(K*k));let r=await fetch(`${fe}/data/sys_audit_log?${n.toString()}`,{credentials:`include`});if(!r.ok){let e=await r.text().catch(()=>``);throw Error(`HTTP ${r.status}: ${e.slice(0,200)||r.statusText}`)}let i=await r.json(),a=Array.isArray(i)?i:Array.isArray(i?.records)?i.records:Array.isArray(i?.data)?i.data:[];Y(a.length>k),t(a.slice(0,k))}catch(e){console.warn(`[AuditLogPage] load failed:`,e),F(e?.message||`Failed to load audit log`),t([]),Y(!1)}finally{N(!1)}},[I,R,B,H,W,K]);(0,E.useEffect)(()=>{Q()},[Q]);let pe=(0,E.useCallback)(()=>{L(`all`),z(``),V(``),U(``),G(``),q(0)},[]),$=(0,E.useMemo)(()=>{let e=0;return I!==`all`&&(e+=1),R.trim()&&(e+=1),B.trim()&&(e+=1),H&&(e+=1),W&&(e+=1),e},[I,R,B,H,W]);return(0,O.jsxs)(`div`,{className:`p-6 space-y-4 max-w-screen-2xl mx-auto`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(se,{className:`h-6 w-6 text-muted-foreground`}),(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Audit Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Read-only system activity and record changes. Newest first.`})]}),(0,O.jsxs)(v,{variant:`outline`,size:`sm`,onClick:Q,disabled:n,children:[(0,O.jsx)(S,{className:`h-4 w-4 mr-1 ${n?`animate-spin`:``}`}),`Refresh`]})]}),(0,O.jsx)(f,{children:(0,O.jsxs)(y,{className:`p-4 grid grid-cols-1 md:grid-cols-5 gap-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Action`}),(0,O.jsxs)(le,{value:I,onValueChange:e=>{L(e),q(0)},children:[(0,O.jsx)(a,{className:`h-9`,children:(0,O.jsx)(d,{})}),(0,O.jsxs)(g,{children:[(0,O.jsx)(o,{value:`all`,children:`All actions`}),de.map(e=>(0,O.jsx)(o,{value:e,children:e},e))]})]})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Object`}),(0,O.jsx)(c,{placeholder:`e.g. account`,value:R,onChange:e=>{z(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Actor (user id)`}),(0,O.jsx)(c,{placeholder:`user id`,value:B,onChange:e=>{V(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`From`}),(0,O.jsx)(c,{type:`date`,value:H,onChange:e=>{U(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`To`}),(0,O.jsx)(c,{type:`date`,value:W,onChange:e=>{G(e.target.value),q(0)},className:`h-9`})]}),$>0&&(0,O.jsx)(`div`,{className:`md:col-span-5 flex justify-end`,children:(0,O.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,O.jsx)(oe,{className:`h-4 w-4 mr-1`}),`Clear filters (`,$,`)`]})})]})}),P&&(0,O.jsxs)(m,{variant:`destructive`,children:[(0,O.jsx)(ne,{className:`h-4 w-4`}),(0,O.jsx)(T,{children:P})]}),(0,O.jsx)(f,{children:(0,O.jsx)(y,{className:`p-0`,children:n&&e.length===0?(0,O.jsx)(`div`,{className:`p-6 space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,O.jsx)(re,{className:`h-9 w-full`},t))}):e.length===0?(0,O.jsx)(`div`,{className:`p-12`,children:(0,O.jsxs)(ae,{children:[(0,O.jsx)(b,{className:`h-8 w-8 text-muted-foreground mb-3`}),(0,O.jsx)(w,{children:`No audit entries`}),(0,O.jsx)(ie,{children:$>0?`Try clearing filters or widening the date range.`:`Events will appear here once tracked objects are modified.`})]})}):(0,O.jsxs)(_,{children:[(0,O.jsx)(x,{children:(0,O.jsxs)(l,{children:[(0,O.jsx)(u,{className:`w-[180px]`,children:`Timestamp`}),(0,O.jsx)(u,{className:`w-[130px]`,children:`Action`}),(0,O.jsx)(u,{children:`Object`}),(0,O.jsx)(u,{children:`Record`}),(0,O.jsx)(u,{children:`Actor`}),(0,O.jsx)(u,{className:`w-[130px]`,children:`IP`})]})}),(0,O.jsx)(ee,{children:e.map(e=>{let t=D[e.action||``]||`outline`;return(0,O.jsxs)(l,{className:`cursor-pointer`,onClick:()=>Z(e),children:[(0,O.jsx)(s,{className:`font-mono text-xs`,children:A(e.created_at)}),(0,O.jsx)(s,{children:(0,O.jsx)(p,{variant:t,children:e.action||`—`})}),(0,O.jsx)(s,{children:e.object_name||`—`}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:j(e.record_id,18)}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:j(e.user_id,18)}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:e.ip_address||`—`})]},e.id)})})]})})}),(e.length>0||K>0)&&(0,O.jsxs)(`div`,{className:`flex items-center justify-between text-sm text-muted-foreground`,children:[(0,O.jsxs)(`span`,{children:[`Page `,K+1,J?``:` · end`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(v,{variant:`outline`,size:`sm`,disabled:K===0||n,onClick:()=>q(e=>Math.max(0,e-1)),children:`Previous`}),(0,O.jsx)(v,{variant:`outline`,size:`sm`,disabled:!J||n,onClick:()=>q(e=>e+1),children:`Next`})]})]}),(0,O.jsx)(ce,{open:!!X,onOpenChange:e=>!e&&Z(null),children:(0,O.jsxs)(C,{side:`right`,className:`sm:max-w-2xl w-full overflow-y-auto`,children:[(0,O.jsxs)(ue,{children:[(0,O.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,O.jsx)(p,{variant:X&&D[X.action||``]||`outline`,children:X?.action||`—`}),X?.object_name||`Audit Event`]}),(0,O.jsx)(te,{children:X?.id?(0,O.jsx)(`span`,{className:`font-mono text-xs`,children:X.id}):null})]}),X&&(0,O.jsxs)(`div`,{className:`mt-6 space-y-5`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Timestamp`}),(0,O.jsx)(`div`,{className:`font-mono`,children:A(X.created_at)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`IP Address`}),(0,O.jsx)(`div`,{className:`font-mono`,children:X.ip_address||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Actor (user_id)`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.user_id||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Tenant`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.tenant_id||`—`})]}),(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Target record`}),(0,O.jsxs)(`div`,{className:`font-mono text-sm break-all`,children:[X.object_name||`—`,` / `,X.record_id||`—`]})]}),X.user_agent&&(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`User Agent`}),(0,O.jsx)(`div`,{className:`font-mono text-xs break-all`,children:X.user_agent})]})]}),(X.old_value||X.new_value)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:`Change payload`}),X.old_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Before`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.old_value)})]}),X.new_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`After`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.new_value)})]})]})]}),X.metadata&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Metadata`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-48 overflow-auto`,children:M(X.metadata)})]})]})]})]})})]})}export{N as AuditLogPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{b as e,g as t,h as n,r}from"./vendor-react-CsWFRkED.js";import{gt as i,ht as a,yt as o}from"./ui-components-Dwq5utCl.js";import{r as s}from"./index-BLepsDd_.js";e();var c=r();function l({extraProps:e}={}){let r=n(),[l]=t(),u=r.ns,d=r.name,f=u&&d?`${u}:${d}`:u??``,p=s(f);if(!p)return(0,c.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,c.jsxs)(a,{children:[(0,c.jsx)(o,{children:`Component not registered`}),(0,c.jsxs)(i,{children:[`No component is registered for `,(0,c.jsx)(`code`,{className:`font-mono`,children:f||`(empty)`}),`. Ensure the plugin that provides this surface is installed and has called`,(0,c.jsx)(`code`,{className:`font-mono`,children:` registerAppComponent()`}),`.`]})]})});let m={};for(let[e,t]of l.entries())m[e]=t;let h=p.component;return(0,c.jsx)(h,{...m,...e??{}})}export{l as ComponentNavView,l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{b as n,h as r,r as i}from"./vendor-react-CsWFRkED.js";import{D as a,J as o,N as s,nt as c,rt as l}from"./framework-BwfIhdyz.js";import{gt as u,ht as d,ko as f,yt as p}from"./ui-components-Dwq5utCl.js";import{r as m}from"./vendor-ui-utils-BFw4cGI6.js";import"./AdapterProvider-gULVLpjV.js";import"./MetadataProvider-DyFZSNqq.js";import{r as h}from"./ExpressionProvider-vGLngw8h.js";import{t as g}from"./useActionModal-DYiSBx1G.js";import{t as _}from"./utils-CJ4UwXMF.js";import{t as v}from"./preferLocal-CKqyhTP9.js";import{n as y,t as b}from"./MetadataInspector-kVAu8vlh.js";import{n as x}from"./skeletons-BwA1TSR2.js";import{n as S}from"./plugin-dashboard-CzbAW1Rz.js";import{t as C}from"./useOpenRecordList-DOZu_JZX.js";var w=t({DashboardView:()=>D}),T=e(n(),1),E=i();function D({dataSource:e}){let t=C(),{dashboardName:n}=r(),{showDebug:i}=y(),w=c(),{t:D}=s(),{dashboardLabel:O,dashboardDescription:k}=a(),[A,j]=(0,T.useState)(!0),{modalHandler:M,modalElement:N}=g(w),P=(0,T.useMemo)(()=>({export_dashboard_pdf:async()=>{m.info(D(`dashboardActions.printDialogOpening`));try{return window.print(),{success:!0}}catch(e){return m.error(D(`dashboardActions.exportFailed`,{message:e?.message||String(e)})),{success:!1,error:e?.message||String(e)}}},forecast_dashboard:async()=>(m.info(D(`dashboardActions.forecastSoon`)),{success:!0})}),[D]);(0,T.useEffect)(()=>{j(!0),queueMicrotask(()=>j(!1))},[n]);let{dashboards:F,objects:I}=l(),{app:L}=h(),R=v(F,n,L?._packageId),z=(0,T.useMemo)(()=>new Set((I||[]).map(e=>e?.name).filter(Boolean)),[I]),B=(0,T.useMemo)(()=>{if(!R||z.size===0)return R;let e=R.widgets;if(!Array.isArray(e)||e.length===0)return R;let t=e.filter(e=>{let t=e?.requiresObject??e?.object;return!t||z.has(t)});return t.length===e.length?R:{...R,widgets:t}},[R,z]);return A?(0,E.jsx)(x,{}):R?(0,E.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,E.jsx)(`div`,{className:`flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0`,children:(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(()=>{let e=_((B||R).title,D),t=_(R.label,D),n=O({name:R.name,label:t}),r=e||n||R.name;return(0,E.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:r})})(),(()=>{let e=(B||R).description??R.description,t=k({name:R.name,description:_(e,D)});return t?(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:t}):null})()]})}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,E.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-2 sm:p-4 md:p-6`,children:(0,E.jsx)(o,{value:{openRecordList:t},children:(0,E.jsx)(S,{schema:B,dataSource:e,modalHandler:M,scriptHandlers:P,hideHeaderText:!0})})}),(0,E.jsx)(b,{open:i,sections:[{title:`Dashboard Configuration`,data:B}]})]}),N]}):(0,E.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,E.jsxs)(d,{children:[(0,E.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,E.jsx)(f,{className:`h-6 w-6 text-muted-foreground`})}),(0,E.jsx)(p,{children:D(`empty.dashboardNotFound`)}),(0,E.jsx)(u,{children:D(`empty.dashboardNotFoundDescription`,{name:n})})]})})}export{w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as e,p as t,r as n}from"./vendor-react-CsWFRkED.js";import{Ai as r,Ar as i,Mr as a,Or as o,ai as s,ds as c,jr as l,ka as u,kr as d}from"./ui-components-Dwq5utCl.js";var f=n();function p(){let n=t(),{appName:p}=e(),m=p?`/apps/${p}`:``,h=[{title:`Integrations & APIs`,description:`Your app as a REST API — base URL, endpoints, and connect samples`,icon:u,href:`${m}/developer/integrations`},{title:`API Console`,description:`Inspect and exercise REST endpoints with auto-discovered services`,icon:r,href:`${m}/developer/api-console`},{title:`Flow Runs`,description:`Trigger flows with sample inputs and inspect recent run history`,icon:s,href:`${m}/developer/flow-runs`},{title:`Public Forms`,description:`Publish, share, and embed FormViews available to anonymous users`,icon:c,href:`${m}/developer/public-forms`}];return(0,f.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Developer`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Tools for building, debugging, and sharing ObjectStack apps`})]}),(0,f.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:h.map(e=>{let t=e.icon;return(0,f.jsxs)(o,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>n(e.href),"data-testid":`hub-card-${e.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${e.title}: ${e.description}`,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.href))},children:[(0,f.jsxs)(l,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,f.jsx)(t,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(a,{className:`text-base`,children:e.title}),(0,f.jsx)(i,{className:`text-xs`,children:e.description})]})]}),(0,f.jsx)(d,{className:`pt-0`})]},e.title)})})]})}export{p as DeveloperHubPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,h as r,p as i,r as a}from"./vendor-react-CsWFRkED.js";import{N as o,nt as s}from"./framework-BwfIhdyz.js";import{Ts as c,cc as l,do as u,gc as d,ms as f,yo as p}from"./ui-components-Dwq5utCl.js";import"./index-BLepsDd_.js";import{t as m}from"./DocShell-DMJHUgE5.js";import{i as h,l as g,n as _,u as v}from"./use-book-data-CZc8MJsb.js";import{r as y,t as b}from"./plugin-markdown-DNllWgPM.js";var x=e(n(),1),S=/(^```[^\n]*\n[\s\S]*?\n```[ \t]*$|^~~~[^\n]*\n[\s\S]*?\n~~~[ \t]*$)/m,C=/(`[^`\n]+`)/,w=/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(#[^)\s]*)?\)/g;function T(e){return e.split(C).map((e,t)=>t%2==1?e:e.replace(w,`](/docs/$1$2)`)).join(``)}function E(e){let t=[],n=e;for(;;){let e=S.exec(n);if(!e||e.index===void 0)return t.push(T(n)),t.join(``);t.push(T(n.slice(0,e.index)),e[0]),n=n.slice(e.index+e[0].length)}}var D=a();function O({book:e,activeDoc:n,docHref:r}){return(0,D.jsxs)(`nav`,{"aria-label":e.label??e.name,className:`text-sm`,children:[e.label?(0,D.jsx)(`div`,{className:`mb-3 px-2 text-sm font-semibold text-foreground`,children:e.label}):null,(0,D.jsx)(`div`,{className:`space-y-5`,children:e.groups.map(e=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`mb-1 px-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,D.jsx)(`ul`,{className:`space-y-0.5`,children:e.entries.map((e,i)=>{if(e.separator)return(0,D.jsx)(`li`,{className:`my-1.5 border-t border-border/60`,"aria-hidden":!0},`sep-${i}`);if(e.href)return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1.5 rounded px-2 py-1 text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e.label??e.href}),(0,D.jsx)(c,{className:`h-3 w-3 shrink-0 opacity-60`})]})},`ext-${i}`);if(!e.doc)return null;let a=e.doc===n;return(0,D.jsx)(`li`,{children:(0,D.jsx)(t,{to:r(e.doc),"aria-current":a?`page`:void 0,className:`block truncate rounded px-2 py-1 transition ${a?`bg-primary/10 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:e.label??e.doc})},e.doc)})})]},e.key))})]})}function k(){let{slug:e,name:t,appName:n}=r(),a=i(),c=s(),{t:S}=o(),[C,w]=(0,x.useState)(null),[T,k]=(0,x.useState)(`loading`),[A,j]=(0,x.useState)(``);(0,x.useEffect)(()=>{let e=!1;async function r(){if(!(!t||!c)){k(`loading`);try{let r=await c.getClient().meta.getItem(`doc`,t,n?{packageId:n}:void 0),i=r?.item??r?.data??r;if(e)return;i&&typeof i.content==`string`?(w({name:t,label:i.label,content:i.content}),k(`ready`)):k(`missing`)}catch(t){if(e)return;(t?.status??t?.response?.status)===404||/not found/i.test(t?.message??``)?k(`missing`):(j(t?.message??`Failed to load documentation`),k(`error`))}}}return r(),()=>{e=!0}},[t,n,c]);let M=(0,x.useCallback)(e=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}#${e}`)},[]),N=(0,x.useCallback)(e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;let t=e.target.closest(`a`)?.getAttribute(`href`);t&&(t.startsWith(`/docs/`)?(e.preventDefault(),a(t)):t.startsWith(`#`)&&(e.preventDefault(),M(decodeURIComponent(t.slice(1)))))},[a,M]),P=(0,x.useCallback)((e,t)=>{e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),M(t))},[M]),F=(0,x.useMemo)(()=>y(C?.content??``),[C?.content]),I=S(`help.onThisPage`,{defaultValue:`On this page`}),{books:L,docs:R}=_(),z=n?`/apps/${n}/docs`:`/docs`,B=(0,x.useMemo)(()=>{let t=L.find(t=>h(t)===e);return t?g(t,v(t,R)):null},[L,R,e]),V=(0,x.useCallback)(t=>`${z}/${e}/${t}`,[z,e]);return T===`loading`?(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,D.jsx)(p,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):T===`missing`?(0,D.jsx)(m,{breadcrumb:t,children:(0,D.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,D.jsx)(f,{className:`h-10 w-10 text-muted-foreground`}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,D.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No document named `,(0,D.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:t}),` is installed. It may belong to a package that is not installed, or it was removed in a newer version.`]})]})}):T===`error`?(0,D.jsx)(m,{breadcrumb:t,children:(0,D.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,D.jsx)(l,{className:`h-10 w-10 text-destructive`}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:A})]})}):(0,D.jsxs)(m,{breadcrumb:C?.label??t,children:[B?(0,D.jsxs)(`details`,{className:`group mx-auto max-w-6xl px-4 pt-4 sm:px-6 lg:hidden`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm font-medium [&::-webkit-details-marker]:hidden`,children:[(0,D.jsx)(u,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`span`,{className:`truncate`,children:B.label??`Contents`}),(0,D.jsx)(d,{className:`ml-auto h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,D.jsx)(`div`,{className:`mt-2 rounded-md border p-3`,children:(0,D.jsx)(O,{book:B,activeDoc:t,docHref:V})})]}):null,(0,D.jsxs)(`div`,{className:`mx-auto flex gap-8 p-4 sm:p-6 ${B?`max-w-6xl`:`max-w-5xl`}`,children:[B?(0,D.jsx)(`aside`,{className:`hidden w-56 shrink-0 lg:block`,children:(0,D.jsx)(`nav`,{className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto pr-1`,children:(0,D.jsx)(O,{book:B,activeDoc:t,docHref:V})})}):null,(0,D.jsx)(`article`,{className:`min-w-0 max-w-3xl flex-1 [&_h1]:scroll-mt-24 [&_h2]:scroll-mt-24 [&_h3]:scroll-mt-24`,onClick:N,children:(0,D.jsx)(b,{schema:{type:`markdown`,content:E(C?.content??``)}})}),F.length>=3?(0,D.jsx)(`aside`,{className:`hidden xl:block w-56 shrink-0`,children:(0,D.jsxs)(`nav`,{"aria-label":I,className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto`,children:[(0,D.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:I}),(0,D.jsx)(`ul`,{className:`border-l border-border text-sm`,children:F.map(e=>(0,D.jsx)(`li`,{style:{paddingLeft:(e.depth-2)*12},children:(0,D.jsx)(`a`,{href:`#${e.id}`,onClick:t=>P(t,e.id),className:`-ml-px block border-l border-transparent py-0.5 pl-3 text-muted-foreground hover:border-primary hover:text-foreground`,children:e.text})},e.id))})]})}):null]})]})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./vendor-react-
|
|
1
|
+
import{a as e,r as t}from"./vendor-react-CsWFRkED.js";import{zc as n}from"./ui-components-Dwq5utCl.js";var r=t();function i({breadcrumb:t,children:i}){return(0,r.jsxs)(`div`,{className:`min-h-full`,children:[(0,r.jsx)(`header`,{className:`sticky top-0 z-10 border-b border-border bg-background/80 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,r.jsxs)(`div`,{className:`mx-auto flex max-w-3xl items-center gap-2 px-4 py-3 sm:px-6`,children:[(0,r.jsxs)(e,{to:`/docs`,className:`flex items-center gap-2 text-sm font-semibold hover:opacity-80`,children:[(0,r.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}),(0,r.jsx)(`span`,{children:`Documentation`})]}),t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`span`,{className:`text-muted-foreground/60`,"aria-hidden":!0,children:`/`}),(0,r.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:t})]}):null]})}),i]})}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,r}from"./vendor-react-CsWFRkED.js";import{cc as i,yo as a,zc as o}from"./ui-components-Dwq5utCl.js";import{t as s}from"./DocShell-DMJHUgE5.js";import{a as c,n as l}from"./use-book-data-CZc8MJsb.js";var u=e(n(),1),d=r();function f(){let{books:e,docs:n,state:r,error:f}=l(),p=(0,u.useMemo)(()=>c(e,n),[e,n]);return r===`loading`?(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,d.jsx)(a,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):r===`error`?(0,d.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,d.jsx)(i,{className:`h-10 w-10 text-destructive`}),(0,d.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f})]}):(0,d.jsx)(s,{children:(0,d.jsxs)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:[(0,d.jsxs)(`header`,{className:`mb-6`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Documentation`}),(0,d.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Books and guides from your installed packages.`})]}),p.length===0?(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-16 text-center text-muted-foreground`,children:[(0,d.jsx)(o,{className:`h-10 w-10`}),(0,d.jsxs)(`p`,{className:`text-sm`,children:[`No documentation is installed. Packages ship docs as flat`,(0,d.jsx)(`code`,{className:`mx-1 rounded bg-muted px-1 py-0.5`,children:`src/docs/*.md`}),`files, organised by a `,(0,d.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`book`}),` (ADR-0046).`]})]}):(0,d.jsx)(`ul`,{className:`grid items-stretch gap-3 sm:grid-cols-2`,children:p.map(e=>(0,d.jsx)(`li`,{className:`h-full`,children:(0,d.jsxs)(t,{to:`/docs/${e.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,d.jsx)(o,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`div`,{className:`text-sm font-semibold`,children:e.label}),e.description?(0,d.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):e.subtitle?(0,d.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:e.subtitle}):null,(0,d.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[e.docCount,` `,e.docCount===1?`article`:`articles`]})]})]})},e.name))})]})})}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,r as t}from"./vendor-react-CsWFRkED.js";import{r as n,t as r}from"./use-book-data-CZc8MJsb.js";var i=t();function a(){let t=n();return(0,i.jsx)(r.Provider,{value:t,children:(0,i.jsx)(e,{})})}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,r,s as i}from"./vendor-react-CsWFRkED.js";import{ms as a,yo as o,zc as s}from"./ui-components-Dwq5utCl.js";import{t as c}from"./DocShell-DMJHUgE5.js";import{i as l,l as u,n as d,o as f,s as p,u as m}from"./use-book-data-CZc8MJsb.js";var h=e(t(),1),g=r();function _(){let{slug:e,appName:t}=n(),{books:r,docs:p,state:_}=d(),v=(0,h.useMemo)(()=>r.find(t=>l(t)===e),[r,e]),y=(0,h.useMemo)(()=>v?f(u(v,m(v,p))):void 0,[v,p]);if(_===`loading`)return(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,g.jsx)(o,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(v&&y){let n=t?`/apps/${t}/docs`:`/docs`;return(0,g.jsx)(i,{to:`${n}/${e}/${y}`,replace:!0})}return(0,g.jsx)(c,{breadcrumb:v?v.label??e:e,children:(0,g.jsx)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:v?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:v.label??e}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This book has no documents yet.`})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Book not found`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book named `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})})}function v(){let{slug:e,appName:t}=n(),{books:r,docs:s,state:u}=d();if(u===`loading`)return(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,g.jsx)(o,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(e&&r.some(t=>l(t)===e))return(0,g.jsx)(_,{});let f=t?`/apps/${t}/docs`:`/docs`,m=e?p(e,r,s):null;return m&&e?(0,g.jsx)(i,{to:`${f}/${l(m)}/${e}`,replace:!0}):(0,g.jsx)(c,{breadcrumb:e,children:(0,g.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,g.jsx)(a,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book or document named `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{Tr as r,kt as i}from"./framework-BwfIhdyz.js";var a=e(t(),1),o=n(),s=(0,a.createContext)(null);function c({children:e,user:t={},app:n={},data:c={},features:l={}}){let u=(0,a.useMemo)(()=>({user:t,app:n,data:c,features:l,evaluator:new r({current_user:t,user:t,ctx:{user:t},os:{user:t},app:n,data:c,features:l})}),[t,n,c,l]),d=(0,a.useMemo)(()=>({current_user:t,user:t,ctx:{user:t},os:{user:t},app:n,data:c,features:l}),[t,n,c,l]);return(0,o.jsx)(s.Provider,{value:u,children:(0,o.jsx)(i,{scope:d,children:e})})}function l(){let e=(0,a.useContext)(s);if(!e){let e={user:{},app:{},data:{},features:{}},t={current_user:{},ctx:{user:{}},os:{user:{}},...e};return{...e,evaluator:new r(t)}}return e}function u(e,t){if(e==null||e===!0||e===`true`)return!0;if(e===!1||e===`false`)return!1;try{return t.evaluateCondition(e)}catch{return!0}}export{u as n,l as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{x as r}from"./infrastructure-BCTDJsqi.js";import{nt as i,rt as a}from"./framework-BwfIhdyz.js";import{Aa as o,Ar as s,Bn as c,Gt as l,In as u,Jt as d,Kt as f,Mr as p,Or as m,Pr as h,Rt as g,Sn as _,Ut as v,Ws as y,Wt as b,Xr as x,Xs as S,Yt as C,ac as w,ai as T,bn as E,cc as D,gn as O,jr as k,kn as A,kr as j,qt as M,vn as N,xn as P,ya as F,yn as I,yo as L}from"./ui-components-Dwq5utCl.js";import{k as R}from"./RecordDetailView-BBNqsNy9.js";import"./index-BLepsDd_.js";var z=e(t(),1),B=n();function V({status:e}){let t={success:{icon:w,cls:`text-emerald-600 border-emerald-300`},completed:{icon:w,cls:`text-emerald-600 border-emerald-300`},failed:{icon:S,cls:`text-red-600 border-red-300`},error:{icon:S,cls:`text-red-600 border-red-300`},running:{icon:L,cls:`text-blue-600 border-blue-300 animate-pulse`},pending:{icon:y,cls:`text-amber-600 border-amber-300`},paused:{icon:y,cls:`text-amber-600 border-amber-300`},skipped:{icon:D,cls:`text-muted-foreground`}}[e]??{icon:D,cls:`text-muted-foreground`},n=t.icon;return(0,B.jsxs)(h,{variant:`outline`,className:`text-[10px] font-mono inline-flex items-center gap-1 ${t.cls}`,children:[(0,B.jsx)(n,{className:`h-3 w-3`}),e]})}function H(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function U(e,t){switch(t){case`number`:{if(e===``)return;let t=Number(e);return Number.isNaN(t)?e:t}case`boolean`:return e===`true`;case`object`:case`list`:case`array`:if(e.trim()===``)return;try{return JSON.parse(e)}catch{return e}default:return e}}function W({data:e}){return(0,B.jsx)(`pre`,{className:`rounded border bg-muted/30 p-2 text-xs font-mono overflow-auto whitespace-pre-wrap break-all max-h-96`,children:JSON.stringify(e,null,2)})}function G(){let e=i()?.getClient?.(),[t,n]=(0,z.useState)([]),[r,a]=(0,z.useState)(!0),[o,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(0),h=(0,z.useCallback)(async()=>{if(!e?.meta?.getItems){c(`meta.getItems is not available on this client`),a(!1);return}a(!0),c(null);try{let t=await e.meta.getItems(`flow`),r=(Array.isArray(t)?t:Array.isArray(t?.items)?t.items:Array.isArray(t?.value)?t.value:[]).map(e=>({name:e?.spec?.name??e?.name,label:e?.spec?.label,spec:e?.spec??e,updatedAt:e?.updatedAt??e?.updated_at})).filter(e=>e.name);n(r),!l&&r.length>0&&u(r[0].name)}catch(e){c(e?.message??String(e))}finally{a(!1)}},[e,l]);(0,z.useEffect)(()=>{h()},[h]);let g=(0,z.useMemo)(()=>t.find(e=>e.name===l)??null,[t,l]);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,B.jsx)(T,{className:`h-5 w-5`}),`Flow Runs`]}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Pick a flow, trigger a test run with sample inputs, and inspect recent run history`})]}),(0,B.jsxs)(m,{children:[(0,B.jsx)(k,{className:`pb-3`,children:(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(p,{className:`text-base`,children:`Flow`}),(0,B.jsx)(s,{children:`Select a flow definition to test`})]}),(0,B.jsxs)(x,{variant:`outline`,size:`sm`,onClick:h,disabled:r,children:[(0,B.jsx)(F,{className:`h-3.5 w-3.5 mr-2 ${r?`animate-spin`:``}`}),`Refresh`]})]})}),(0,B.jsxs)(j,{children:[r&&(0,B.jsx)(O,{className:`h-9 w-72`}),o&&(0,B.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:o}),!r&&!o&&t.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No flow definitions found.`}),!r&&!o&&t.length>0&&(0,B.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),className:`flex h-9 w-full max-w-md rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring`,children:t.map(e=>(0,B.jsx)(`option`,{value:e.name,children:e.label?`${e.label} (${e.name})`:e.name},e.name))})]})]}),g&&(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsx)(K,{client:e,flow:g.spec,onExecuted:()=>f(e=>e+1)}),(0,B.jsx)(q,{client:e,flowName:g.name,refreshKey:d})]})]})}function K({client:e,flow:t,onExecuted:n}){let l=(0,z.useMemo)(()=>(t?.variables??[]).filter(e=>e?.isInput),[t]),d=i(),{objects:f}=a(),_=(0,z.useMemo)(()=>r(),[]),[v,b]=(0,z.useState)({}),[T,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(null),[A,M]=(0,z.useState)(null),[N,P]=(0,z.useState)(null);(0,z.useEffect)(()=>{b({}),O(null),M(null),P(null)},[t?.name]);let F=(e,t)=>b(n=>({...n,[e]:t}));return(0,B.jsxs)(m,{children:[(0,B.jsxs)(k,{className:`pb-3`,children:[(0,B.jsx)(p,{className:`text-base`,children:`Test Run`}),(0,B.jsx)(s,{children:`Provide input values and invoke the flow`})]}),(0,B.jsxs)(j,{className:`space-y-3`,children:[l.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This flow declares no input variables. Click Run to invoke with no parameters.`}),l.map(e=>(0,B.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,B.jsxs)(c,{htmlFor:`var-${e.name}`,className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`font-mono text-xs`,children:e.name}),(0,B.jsx)(h,{variant:`outline`,className:`text-[10px] font-mono`,children:e.type})]}),e.type===`boolean`?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(C,{id:`var-${e.name}`,checked:v[e.name]===`true`,onCheckedChange:t=>F(e.name,t?`true`:`false`)}),(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:v[e.name]===`true`?`true`:`false`})]}):e.type===`object`||e.type===`list`||e.type===`array`?(0,B.jsx)(g,{id:`var-${e.name}`,placeholder:`JSON ${e.type}`,value:v[e.name]??``,onChange:t=>F(e.name,t.target.value),className:`font-mono text-xs min-h-[80px]`}):(0,B.jsx)(u,{id:`var-${e.name}`,type:e.type===`number`?`number`:`text`,value:v[e.name]??``,onChange:t=>F(e.name,t.target.value)})]},e.name)),(0,B.jsx)(`div`,{className:`pt-1`,children:(0,B.jsxs)(x,{onClick:async()=>{if(!e?.automation?.execute){M(`automation.execute is not available on this client`);return}E(!0),M(null),O(null),P(null);try{let r={};for(let e of l){let t=v[e.name];t!==void 0&&(r[e.name]=U(t,e.type))}let i=await e.automation.execute(t.name,{params:r});O(i),i?.status===`paused`&&i?.screen&&i?.runId&&P({flowName:t.name,runId:i.runId,screen:i.screen}),n?.()}catch(e){M(e?.message??String(e))}finally{E(!1)}},disabled:T,size:`sm`,children:[T?(0,B.jsx)(L,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,B.jsx)(o,{className:`h-3.5 w-3.5 mr-2`}),T?`Running…`:`Run Flow`]})}),(D||A)&&(0,B.jsxs)(`div`,{className:`pt-2 border-t mt-2 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[A||D?.success===!1?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S,{className:`h-4 w-4 text-red-500`}),` Failed`]}):D?.status===`paused`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(y,{className:`h-4 w-4 text-amber-500`}),` Waiting for input`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(w,{className:`h-4 w-4 text-emerald-500`}),` Result`]}),typeof D?.durationMs==`number`&&(0,B.jsxs)(h,{variant:`secondary`,className:`text-[10px] font-mono`,children:[D.durationMs,` ms`]})]}),A&&(0,B.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:A}),D?.status===`paused`&&D?.screen&&D?.runId&&!N&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This run is paused at screen `,(0,B.jsx)(`span`,{className:`font-mono`,children:D.screen.nodeId}),`.`]}),(0,B.jsx)(x,{size:`sm`,variant:`outline`,onClick:()=>P({flowName:t.name,runId:D.runId,screen:D.screen}),children:`Continue run`})]}),D&&(0,B.jsx)(W,{data:D})]})]}),(0,B.jsx)(R,{state:N,authFetch:_,baseUrl:``,dataSource:d,objects:f,onClose:()=>{P(null),n?.()},onComplete:()=>{P(null),n?.()}})]})}function q({client:e,flowName:t,refreshKey:n}){let[r,i]=(0,z.useState)([]),[a,o]=(0,z.useState)(!0),[c,u]=(0,z.useState)(null),[g,y]=(0,z.useState)(null),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(!1),[D,R]=(0,z.useState)(null),U=(0,z.useCallback)(async()=>{if(!e?.automation?.listRuns){u(`automation.listRuns is not available on this client`),o(!1);return}o(!0),u(null);try{let n=await e.automation.listRuns(t,{limit:20}),r=Array.isArray(n)?n:n?.items??n?.runs??[];i(r)}catch(e){u(e?.message??String(e))}finally{o(!1)}},[e,t]);(0,z.useEffect)(()=>{U()},[U,n]);let G=async n=>{y(n),C(null),R(null),T(!0);try{let r=await e.automation.getRun(t,n);C(r?.run??r)}catch(e){R(e?.message??String(e))}finally{T(!1)}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(m,{children:[(0,B.jsx)(k,{className:`pb-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(p,{className:`text-base`,children:`Recent Runs`}),(0,B.jsx)(s,{className:`font-mono text-xs`,children:t})]}),(0,B.jsxs)(x,{variant:`outline`,size:`sm`,onClick:U,disabled:a,children:[a?(0,B.jsx)(L,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,B.jsx)(F,{className:`h-3.5 w-3.5 mr-2`}),`Refresh`]})]})}),(0,B.jsxs)(j,{children:[a&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(O,{className:`h-8 w-full`}),(0,B.jsx)(O,{className:`h-8 w-full`}),(0,B.jsx)(O,{className:`h-8 w-full`})]}),!a&&c&&(0,B.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:c}),!a&&!c&&r.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground py-6 text-center`,children:`No runs yet. Use the Test Run panel to invoke this flow.`}),!a&&!c&&r.length>0&&(0,B.jsxs)(v,{children:[(0,B.jsx)(M,{children:(0,B.jsxs)(d,{children:[(0,B.jsx)(f,{children:`Run`}),(0,B.jsx)(f,{children:`Status`}),(0,B.jsx)(f,{children:`Started`}),(0,B.jsx)(f,{className:`text-right`,children:`Duration`})]})}),(0,B.jsx)(b,{children:r.map(e=>(0,B.jsxs)(d,{className:`cursor-pointer`,onClick:()=>G(e.id),children:[(0,B.jsxs)(l,{className:`font-mono text-xs`,children:[e.id.slice(0,12),`…`]}),(0,B.jsx)(l,{children:(0,B.jsx)(V,{status:e.status})}),(0,B.jsx)(l,{className:`text-xs text-muted-foreground`,children:H(e.startedAt)}),(0,B.jsx)(l,{className:`text-right font-mono text-xs`,children:typeof e.durationMs==`number`?`${e.durationMs} ms`:`—`})]},e.id))})]})]})]}),(0,B.jsx)(N,{open:!!g,onOpenChange:e=>{e||(y(null),C(null))},children:(0,B.jsxs)(I,{side:`right`,className:`w-full sm:max-w-2xl p-0 flex flex-col`,children:[(0,B.jsxs)(P,{className:`p-4 border-b`,children:[(0,B.jsxs)(_,{className:`font-mono text-sm break-all`,children:[`Run `,g]}),(0,B.jsx)(E,{children:S&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(V,{status:S.status}),typeof S.durationMs==`number`&&(0,B.jsxs)(h,{variant:`secondary`,className:`text-[10px] font-mono`,children:[S.durationMs,` ms`]}),(0,B.jsx)(`span`,{className:`text-xs`,children:H(S.startedAt)})]})})]}),(0,B.jsxs)(A,{className:`flex-1 p-4`,children:[w&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(O,{className:`h-16 w-full`}),(0,B.jsx)(O,{className:`h-16 w-full`}),(0,B.jsx)(O,{className:`h-16 w-full`})]}),D&&(0,B.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:D}),!w&&S&&(0,B.jsx)(`div`,{className:`space-y-3`,children:Array.isArray(S.steps)&&S.steps.length>0?S.steps.map((e,t)=>(0,B.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[`#`,t+1]}),(0,B.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.nodeLabel||e.nodeId}),e.nodeType&&(0,B.jsx)(h,{variant:`outline`,className:`text-[10px] font-mono`,children:e.nodeType}),(0,B.jsx)(V,{status:e.status}),typeof e.durationMs==`number`&&(0,B.jsxs)(h,{variant:`secondary`,className:`text-[10px] font-mono ml-auto`,children:[e.durationMs,` ms`]})]}),e.input!==void 0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Input`}),(0,B.jsx)(W,{data:e.input})]}),e.output!==void 0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Output`}),(0,B.jsx)(W,{data:e.output})]}),e.error&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[10px] uppercase text-red-500 mb-1`,children:`Error`}),(0,B.jsx)(W,{data:e.error})]})]},`${e.nodeId}-${t}`)):(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Run`}),(0,B.jsx)(W,{data:S})]})})]})]})})]})}export{G as FlowRunsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,p as r,r as i}from"./vendor-react-CsWFRkED.js";import{Ai as a,Ar as o,Br as s,Cr as c,In as l,Is as u,Lc as d,Mr as f,Ns as p,Or as m,Po as h,Pr as g,Rr as _,Sr as v,Xr as y,_c as b,br as x,jr as S,ka as C,kr as w,ks as T,ta as E,vr as D,xr as O,yr as k,zr as A}from"./ui-components-Dwq5utCl.js";var j=e(t(),1),M=`objectstack`,N=`Query and modify data in an ObjectStack app over MCP — discover objects, read and filter records, and create/update/delete under your own permissions and row-level security. Use when the user wants to inspect or change data in their ObjectStack environment.`,P=`<YOUR_ENV_MCP_URL>`;function F(e={}){let t=e.mcpUrl?.trim()||P,n=e.envName?.trim();return`---
|
|
2
2
|
name: ${M}
|
|
3
3
|
description: ${N}
|
|
4
4
|
---
|
|
@@ -79,4 +79,4 @@ create/update payload.
|
|
|
79
79
|
3. \`query_records\` to read / verify current state.
|
|
80
80
|
4. \`create_record\` / \`update_record\` / \`delete_record\` to make changes,
|
|
81
81
|
confirming destructive steps with the user.
|
|
82
|
-
`}var I=r();function L(){let[e,t]=(0,j.useState)(!1);return[e,e=>{navigator.clipboard?.writeText(e),t(!0),setTimeout(()=>t(!1),1500)}]}function R({value:e,label:t}){let[n,r]=L();return(0,I.jsxs)(O,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:()=>r(e),"aria-label":`Copy ${t??`value`}`,children:[n?(0,I.jsx)(D,{className:`size-3.5`}):(0,I.jsx)(_,{className:`size-3.5`}),n?`Copied`:`Copy`]})}function z(){let e=typeof window<`u`?window.location.origin:``,[t,n]=(0,j.useState)(null),[r,i]=(0,j.useState)(null),[o,s]=(0,j.useState)(`Agent key`),[w,T]=(0,j.useState)(!1),[M,N]=(0,j.useState)(null),[P,z]=(0,j.useState)(null),[B,V]=(0,j.useState)(!1),[H,U]=L();(0,j.useEffect)(()=>{let t=!1;return(async()=>{try{let r=await(await fetch(`/api/v1/discovery`,{credentials:`include`})).json().catch(()=>({})),a=r?.data?.routes?.mcp??r?.routes?.mcp;if(t)return;a?(n(a.startsWith(`http`)?a:`${e}${a}`),i(!0)):i(!1)}catch{t||i(!1)}})(),()=>{t=!0}},[e]);let W=async()=>{T(!0),N(null);try{let e=await fetch(`/api/v1/keys`,{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify({name:o.trim()||`Agent key`})}),t=await e.json().catch(()=>({})),n=t?.data;if(!e.ok||!n?.key)throw Error(t?.error?.message||`Request failed (${e.status})`);z(n),V(!0)}catch(e){N(e?.message??`Failed to generate key`)}finally{T(!1)}},G=()=>{let e=F({mcpUrl:t??void 0}),n=new Blob([e],{type:`text/markdown;charset=utf-8`}),r=document.createElement(`a`);r.href=URL.createObjectURL(n),r.download=`SKILL.md`,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)},K=t??`${e}/api/v1/mcp`;return(0,I.jsxs)(y,{children:[(0,I.jsxs)(v,{className:`pb-2`,children:[(0,I.jsxs)(E,{className:`text-base flex items-center gap-2`,children:[(0,I.jsx)(h,{className:`size-4`}),` Connect an AI agent (MCP)`]}),(0,I.jsx)(c,{className:`text-xs`,children:`Every app in this environment is an agent-ready toolset. Connect Claude, Cursor, Codex or any MCP client — one connection covers all your apps (new ones appear automatically).`})]}),(0,I.jsxs)(l,{className:`flex flex-col gap-4`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`MCP endpoint`}),r===!1?(0,I.jsxs)(d,{children:[(0,I.jsx)(a,{className:`size-4`}),(0,I.jsx)(p,{children:`MCP is not enabled for this environment`}),(0,I.jsxs)(f,{className:`text-xs`,children:[`Connecting agents is opt-in. An admin can enable it by setting`,` `,(0,I.jsx)(`code`,{className:`font-mono`,children:`OS_MCP_SERVER_ENABLED=true`}),`. You can still generate a key and download the skill below.`]})]}):(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-2 py-1.5 font-mono text-xs`,children:K}),(0,I.jsx)(R,{value:K,label:`MCP URL`})]})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,I.jsx)(m,{className:`size-3.5`}),` API key`]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(g,{value:o,onChange:e=>s(e.target.value),placeholder:`Key name (e.g. Claude desktop)`,className:`h-8 max-w-xs text-sm`}),(0,I.jsx)(O,{type:`button`,size:`sm`,onClick:W,disabled:w,children:w?`Generating…`:`Generate key`})]}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`The key acts as you (your permissions + row-level security). Shown once — copy it immediately. Revoke anytime from the API Keys list.`}),M&&(0,I.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:M})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Agent skill (portable)`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(O,{type:`button`,variant:`outline`,size:`sm`,className:`gap-1.5`,onClick:G,children:[(0,I.jsx)(u,{className:`size-4`}),` Download SKILL.md`]}),(0,I.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Works with any skills-capable agent (Claude, Codex, Gemini, Cursor…).`})]})]}),(0,I.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed`,children:[(0,I.jsx)(`div`,{className:`mb-1 font-medium`,children:`Connect in 3 steps`}),(0,I.jsxs)(`ol`,{className:`list-decimal space-y-0.5 pl-4 text-muted-foreground`,children:[(0,I.jsx)(`li`,{children:`Add a remote MCP server pointing at the endpoint above.`}),(0,I.jsxs)(`li`,{children:[`Set the header `,(0,I.jsx)(`code`,{className:`font-mono`,children:`x-api-key: <your key>`}),` (a session Bearer is `,(0,I.jsx)(`em`,{children:`not`}),` an API key).`]}),(0,I.jsxs)(`li`,{children:[`Drop in `,(0,I.jsx)(`code`,{className:`font-mono`,children:`SKILL.md`}),` so the agent knows how to drive your data.`]})]})]})]}),(0,I.jsx)(C,{open:B,onOpenChange:V,children:(0,I.jsxs)(S,{children:[(0,I.jsxs)(A,{children:[(0,I.jsxs)(x,{className:`flex items-center gap-2`,children:[(0,I.jsx)(m,{className:`size-4`}),` Your new API key`]}),(0,I.jsxs)(b,{children:[`Copy this now — for your security it will `,(0,I.jsx)(`strong`,{children:`not be shown again`}),`.`]})]}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`code`,{className:`flex-1 break-all rounded bg-muted px-2 py-2 font-mono text-xs`,children:P?.key}),(0,I.jsxs)(O,{type:`button`,variant:`secondary`,size:`sm`,className:`gap-1.5`,onClick:()=>P&&U(P.key),children:[H?(0,I.jsx)(D,{className:`size-3.5`}):(0,I.jsx)(_,{className:`size-3.5`}),H?`Copied`:`Copy`]})]}),(0,I.jsxs)(d,{children:[(0,I.jsx)(a,{className:`size-4`}),(0,I.jsxs)(f,{className:`text-xs`,children:[`Send it as `,(0,I.jsx)(`code`,{className:`font-mono`,children:`x-api-key`}),`. It carries your permissions — store it like a password and revoke it if leaked.`]})]})]}),(0,I.jsx)(k,{children:(0,I.jsx)(O,{type:`button`,onClick:()=>V(!1),children:`Done`})})]})})]})}var B={GET:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`,POST:`bg-blue-500/10 text-blue-700 dark:text-blue-400`,PATCH:`bg-amber-500/10 text-amber-700 dark:text-amber-400`,DELETE:`bg-red-500/10 text-red-700 dark:text-red-400`};function V({value:e,label:t}){let[n,r]=(0,j.useState)(!1);return(0,I.jsxs)(O,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:()=>{navigator.clipboard?.writeText(e),r(!0),setTimeout(()=>r(!1),1500)},"aria-label":`Copy ${t??`value`}`,children:[n?(0,I.jsx)(D,{className:`size-3.5`}):(0,I.jsx)(_,{className:`size-3.5`}),n?`Copied`:`Copy`]})}function H(){let e=t(),{appName:r}=n(),i=r?`/apps/${r}`:``,a=typeof window<`u`?window.location.origin:``,[u,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!0),[h,g]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`/api/v1/meta/object`,{credentials:`include`});if(!t.ok)throw Error(`meta/object ${t.status}`);let n=await t.json(),r=n?.data??n?.items??n??[],i=(Array.isArray(r)?r:[]).map(e=>({name:String(e.name??``),label:e.label||void 0})).filter(e=>e.name&&!e.name.startsWith(`sys_`));e||d(i)}catch(t){e||g(t?.message??`failed to load objects`)}finally{e||p(!1)}})(),()=>{e=!0}},[]);let _=u[0]?.name??`your_object`,b=(0,j.useMemo)(()=>`# List ${_} records\ncurl "${a}/api/v1/data/${_}?$top=10" \\\n -H "x-api-key: <YOUR_API_KEY>"`,[a,_]),x=e=>[{method:`GET`,path:`/api/v1/data/${e}`,desc:`List / query`},{method:`POST`,path:`/api/v1/data/${e}`,desc:`Create`},{method:`GET`,path:`/api/v1/data/${e}/:id`,desc:`Read one`},{method:`PATCH`,path:`/api/v1/data/${e}/:id`,desc:`Update`},{method:`DELETE`,path:`/api/v1/data/${e}/:id`,desc:`Delete`}];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,I.jsx)(o,{className:`size-5 text-primary`}),` Integrations & APIs`]}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Every object you build is instantly a REST API. Drive your app from code or an agent.`})]}),(0,I.jsxs)(y,{children:[(0,I.jsxs)(v,{className:`pb-2`,children:[(0,I.jsx)(E,{className:`text-base`,children:`Base URL`}),(0,I.jsx)(c,{className:`text-xs`,children:`This environment's API root.`})]}),(0,I.jsxs)(l,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`code`,{className:`flex-1 truncate rounded bg-muted px-2 py-1.5 font-mono text-xs`,children:[a,`/api/v1`]}),(0,I.jsx)(V,{value:`${a}/api/v1`,label:`base URL`})]})]}),(0,I.jsx)(z,{}),(0,I.jsxs)(y,{children:[(0,I.jsxs)(v,{className:`pb-2 flex flex-row items-center justify-between`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(E,{className:`text-base flex items-center gap-2`,children:[(0,I.jsx)(T,{className:`size-4`}),` REST endpoints`]}),(0,I.jsx)(c,{className:`text-xs`,children:`Auto-generated CRUD for every published object (OData query params on list).`})]}),(0,I.jsxs)(O,{type:`button`,variant:`outline`,size:`sm`,className:`gap-1.5`,onClick:()=>e(`${i}/developer/api-console`),children:[(0,I.jsx)(s,{className:`size-4`}),` Open API Console`]})]}),(0,I.jsxs)(l,{className:`flex flex-col gap-4`,children:[f&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading objects…`}),h&&(0,I.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Couldn't load objects: `,h]}),!f&&!h&&u.length===0&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No business objects yet — build one with the AI assistant, publish it, and it appears here as an API.`}),u.map(e=>(0,I.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`font-medium text-sm`,children:e.label||e.name}),(0,I.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground`,children:e.name})]}),(0,I.jsx)(`div`,{className:`divide-y`,children:x(e.name).map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5`,children:[(0,I.jsx)(w,{className:`w-16 justify-center font-mono text-[10px] ${B[e.method]??``}`,children:e.method}),(0,I.jsx)(`code`,{className:`flex-1 truncate font-mono text-xs`,children:e.path}),(0,I.jsx)(`span`,{className:`hidden shrink-0 text-xs text-muted-foreground sm:inline`,children:e.desc})]},e.method+e.path))})]},e.name))]})]}),(0,I.jsxs)(y,{children:[(0,I.jsx)(v,{className:`pb-2`,children:(0,I.jsxs)(E,{className:`text-base flex items-center gap-2`,children:[(0,I.jsx)(m,{className:`size-4`}),` Authentication`]})}),(0,I.jsxs)(l,{className:`flex flex-col gap-2 text-sm text-muted-foreground`,children:[(0,I.jsxs)(`p`,{children:[`In the console you're already authenticated — use `,(0,I.jsx)(`strong`,{children:`Open API Console`}),` above to call these endpoints now.`]}),(0,I.jsxs)(`p`,{children:[`For external programs and AI agents, generate a `,(0,I.jsx)(`strong`,{children:`self-serve API key`}),` in the `,(0,I.jsx)(`strong`,{children:`Connect an AI agent`}),` section above. Send it as the`,` `,(0,I.jsx)(`code`,{className:`font-mono text-xs`,children:`x-api-key`}),` header; it runs under your permissions and row-level security, and is revocable.`]})]})]}),(0,I.jsxs)(y,{children:[(0,I.jsxs)(v,{className:`pb-2 flex flex-row items-center justify-between`,children:[(0,I.jsx)(E,{className:`text-base`,children:`Sample (cURL)`}),(0,I.jsx)(V,{value:b,label:`cURL sample`})]}),(0,I.jsx)(l,{children:(0,I.jsx)(`pre`,{className:`overflow-x-auto rounded bg-muted p-3 font-mono text-xs leading-relaxed`,children:b})})]})]})}export{H as IntegrationsPage};
|
|
82
|
+
`}var I=i();function L(){let[e,t]=(0,j.useState)(!1);return[e,e=>{navigator.clipboard?.writeText(e),t(!0),setTimeout(()=>t(!1),1500)}]}function R({value:e,label:t}){let[n,r]=L();return(0,I.jsxs)(y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:()=>r(e),"aria-label":`Copy ${t??`value`}`,children:[n?(0,I.jsx)(b,{className:`size-3.5`}):(0,I.jsx)(u,{className:`size-3.5`}),n?`Copied`:`Copy`]})}function z(){let e=typeof window<`u`?window.location.origin:``,[t,n]=(0,j.useState)(null),[r,i]=(0,j.useState)(null),[a,p]=(0,j.useState)(`Agent key`),[g,C]=(0,j.useState)(!1),[M,N]=(0,j.useState)(null),[P,z]=(0,j.useState)(null),[B,V]=(0,j.useState)(!1),[H,U]=L();(0,j.useEffect)(()=>{let t=!1;return(async()=>{try{let r=await(await fetch(`/api/v1/discovery`,{credentials:`include`})).json().catch(()=>({})),a=r?.data?.routes?.mcp??r?.routes?.mcp;if(t)return;a?(n(a.startsWith(`http`)?a:`${e}${a}`),i(!0)):i(!1)}catch{t||i(!1)}})(),()=>{t=!0}},[e]);let W=async()=>{C(!0),N(null);try{let e=await fetch(`/api/v1/keys`,{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify({name:a.trim()||`Agent key`})}),t=await e.json().catch(()=>({})),n=t?.data;if(!e.ok||!n?.key)throw Error(t?.error?.message||`Request failed (${e.status})`);z(n),V(!0)}catch(e){N(e?.message??`Failed to generate key`)}finally{C(!1)}},G=()=>{let e=F({mcpUrl:t??void 0}),n=new Blob([e],{type:`text/markdown;charset=utf-8`}),r=document.createElement(`a`);r.href=URL.createObjectURL(n),r.download=`SKILL.md`,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)},K=t??`${e}/api/v1/mcp`;return(0,I.jsxs)(m,{children:[(0,I.jsxs)(S,{className:`pb-2`,children:[(0,I.jsxs)(f,{className:`text-base flex items-center gap-2`,children:[(0,I.jsx)(d,{className:`size-4`}),` Connect an AI agent (MCP)`]}),(0,I.jsx)(o,{className:`text-xs`,children:`Every app in this environment is an agent-ready toolset. Connect Claude, Cursor, Codex or any MCP client — one connection covers all your apps (new ones appear automatically).`})]}),(0,I.jsxs)(w,{className:`flex flex-col gap-4`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`MCP endpoint`}),r===!1?(0,I.jsxs)(_,{children:[(0,I.jsx)(E,{className:`size-4`}),(0,I.jsx)(s,{children:`MCP is not enabled for this environment`}),(0,I.jsxs)(A,{className:`text-xs`,children:[`Connecting agents is opt-in. An admin can enable it by setting`,` `,(0,I.jsx)(`code`,{className:`font-mono`,children:`OS_MCP_SERVER_ENABLED=true`}),`. You can still generate a key and download the skill below.`]})]}):(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-2 py-1.5 font-mono text-xs`,children:K}),(0,I.jsx)(R,{value:K,label:`MCP URL`})]})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,I.jsx)(h,{className:`size-3.5`}),` API key`]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(l,{value:a,onChange:e=>p(e.target.value),placeholder:`Key name (e.g. Claude desktop)`,className:`h-8 max-w-xs text-sm`}),(0,I.jsx)(y,{type:`button`,size:`sm`,onClick:W,disabled:g,children:g?`Generating…`:`Generate key`})]}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`The key acts as you (your permissions + row-level security). Shown once — copy it immediately. Revoke anytime from the API Keys list.`}),M&&(0,I.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:M})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Agent skill (portable)`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(y,{type:`button`,variant:`outline`,size:`sm`,className:`gap-1.5`,onClick:G,children:[(0,I.jsx)(T,{className:`size-4`}),` Download SKILL.md`]}),(0,I.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Works with any skills-capable agent (Claude, Codex, Gemini, Cursor…).`})]})]}),(0,I.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed`,children:[(0,I.jsx)(`div`,{className:`mb-1 font-medium`,children:`Connect in 3 steps`}),(0,I.jsxs)(`ol`,{className:`list-decimal space-y-0.5 pl-4 text-muted-foreground`,children:[(0,I.jsx)(`li`,{children:`Add a remote MCP server pointing at the endpoint above.`}),(0,I.jsxs)(`li`,{children:[`Set the header `,(0,I.jsx)(`code`,{className:`font-mono`,children:`x-api-key: <your key>`}),` (a session Bearer is `,(0,I.jsx)(`em`,{children:`not`}),` an API key).`]}),(0,I.jsxs)(`li`,{children:[`Drop in `,(0,I.jsx)(`code`,{className:`font-mono`,children:`SKILL.md`}),` so the agent knows how to drive your data.`]})]})]})]}),(0,I.jsx)(D,{open:B,onOpenChange:V,children:(0,I.jsxs)(k,{children:[(0,I.jsxs)(v,{children:[(0,I.jsxs)(c,{className:`flex items-center gap-2`,children:[(0,I.jsx)(h,{className:`size-4`}),` Your new API key`]}),(0,I.jsxs)(x,{children:[`Copy this now — for your security it will `,(0,I.jsx)(`strong`,{children:`not be shown again`}),`.`]})]}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`code`,{className:`flex-1 break-all rounded bg-muted px-2 py-2 font-mono text-xs`,children:P?.key}),(0,I.jsxs)(y,{type:`button`,variant:`secondary`,size:`sm`,className:`gap-1.5`,onClick:()=>P&&U(P.key),children:[H?(0,I.jsx)(b,{className:`size-3.5`}):(0,I.jsx)(u,{className:`size-3.5`}),H?`Copied`:`Copy`]})]}),(0,I.jsxs)(_,{children:[(0,I.jsx)(E,{className:`size-4`}),(0,I.jsxs)(A,{className:`text-xs`,children:[`Send it as `,(0,I.jsx)(`code`,{className:`font-mono`,children:`x-api-key`}),`. It carries your permissions — store it like a password and revoke it if leaked.`]})]})]}),(0,I.jsx)(O,{children:(0,I.jsx)(y,{type:`button`,onClick:()=>V(!1),children:`Done`})})]})})]})}var B={GET:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`,POST:`bg-blue-500/10 text-blue-700 dark:text-blue-400`,PATCH:`bg-amber-500/10 text-amber-700 dark:text-amber-400`,DELETE:`bg-red-500/10 text-red-700 dark:text-red-400`};function V({value:e,label:t}){let[n,r]=(0,j.useState)(!1);return(0,I.jsxs)(y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2 text-xs`,onClick:()=>{navigator.clipboard?.writeText(e),r(!0),setTimeout(()=>r(!1),1500)},"aria-label":`Copy ${t??`value`}`,children:[n?(0,I.jsx)(b,{className:`size-3.5`}):(0,I.jsx)(u,{className:`size-3.5`}),n?`Copied`:`Copy`]})}function H(){let e=r(),{appName:t}=n(),i=t?`/apps/${t}`:``,s=typeof window<`u`?window.location.origin:``,[c,l]=(0,j.useState)([]),[u,d]=(0,j.useState)(!0),[_,v]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`/api/v1/meta/object`,{credentials:`include`});if(!t.ok)throw Error(`meta/object ${t.status}`);let n=await t.json(),r=n?.data??n?.items??n??[],i=(Array.isArray(r)?r:[]).map(e=>({name:String(e.name??``),label:e.label||void 0})).filter(e=>e.name&&!e.name.startsWith(`sys_`));e||l(i)}catch(t){e||v(t?.message??`failed to load objects`)}finally{e||d(!1)}})(),()=>{e=!0}},[]);let b=c[0]?.name??`your_object`,x=(0,j.useMemo)(()=>`# List ${b} records\ncurl "${s}/api/v1/data/${b}?$top=10" \\\n -H "x-api-key: <YOUR_API_KEY>"`,[s,b]),T=e=>[{method:`GET`,path:`/api/v1/data/${e}`,desc:`List / query`},{method:`POST`,path:`/api/v1/data/${e}`,desc:`Create`},{method:`GET`,path:`/api/v1/data/${e}/:id`,desc:`Read one`},{method:`PATCH`,path:`/api/v1/data/${e}/:id`,desc:`Update`},{method:`DELETE`,path:`/api/v1/data/${e}/:id`,desc:`Delete`}];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,I.jsx)(C,{className:`size-5 text-primary`}),` Integrations & APIs`]}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Every object you build is instantly a REST API. Drive your app from code or an agent.`})]}),(0,I.jsxs)(m,{children:[(0,I.jsxs)(S,{className:`pb-2`,children:[(0,I.jsx)(f,{className:`text-base`,children:`Base URL`}),(0,I.jsx)(o,{className:`text-xs`,children:`This environment's API root.`})]}),(0,I.jsxs)(w,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`code`,{className:`flex-1 truncate rounded bg-muted px-2 py-1.5 font-mono text-xs`,children:[s,`/api/v1`]}),(0,I.jsx)(V,{value:`${s}/api/v1`,label:`base URL`})]})]}),(0,I.jsx)(z,{}),(0,I.jsxs)(m,{children:[(0,I.jsxs)(S,{className:`pb-2 flex flex-row items-center justify-between`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(f,{className:`text-base flex items-center gap-2`,children:[(0,I.jsx)(p,{className:`size-4`}),` REST endpoints`]}),(0,I.jsx)(o,{className:`text-xs`,children:`Auto-generated CRUD for every published object (OData query params on list).`})]}),(0,I.jsxs)(y,{type:`button`,variant:`outline`,size:`sm`,className:`gap-1.5`,onClick:()=>e(`${i}/developer/api-console`),children:[(0,I.jsx)(a,{className:`size-4`}),` Open API Console`]})]}),(0,I.jsxs)(w,{className:`flex flex-col gap-4`,children:[u&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading objects…`}),_&&(0,I.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Couldn't load objects: `,_]}),!u&&!_&&c.length===0&&(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No business objects yet — build one with the AI assistant, publish it, and it appears here as an API.`}),c.map(e=>(0,I.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`font-medium text-sm`,children:e.label||e.name}),(0,I.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground`,children:e.name})]}),(0,I.jsx)(`div`,{className:`divide-y`,children:T(e.name).map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5`,children:[(0,I.jsx)(g,{className:`w-16 justify-center font-mono text-[10px] ${B[e.method]??``}`,children:e.method}),(0,I.jsx)(`code`,{className:`flex-1 truncate font-mono text-xs`,children:e.path}),(0,I.jsx)(`span`,{className:`hidden shrink-0 text-xs text-muted-foreground sm:inline`,children:e.desc})]},e.method+e.path))})]},e.name))]})]}),(0,I.jsxs)(m,{children:[(0,I.jsx)(S,{className:`pb-2`,children:(0,I.jsxs)(f,{className:`text-base flex items-center gap-2`,children:[(0,I.jsx)(h,{className:`size-4`}),` Authentication`]})}),(0,I.jsxs)(w,{className:`flex flex-col gap-2 text-sm text-muted-foreground`,children:[(0,I.jsxs)(`p`,{children:[`In the console you're already authenticated — use `,(0,I.jsx)(`strong`,{children:`Open API Console`}),` above to call these endpoints now.`]}),(0,I.jsxs)(`p`,{children:[`For external programs and AI agents, generate a `,(0,I.jsx)(`strong`,{children:`self-serve API key`}),` in the `,(0,I.jsx)(`strong`,{children:`Connect an AI agent`}),` section above. Send it as the`,` `,(0,I.jsx)(`code`,{className:`font-mono text-xs`,children:`x-api-key`}),` header; it runs under your permissions and row-level security, and is revocable.`]})]})]}),(0,I.jsxs)(m,{children:[(0,I.jsxs)(S,{className:`pb-2 flex flex-row items-center justify-between`,children:[(0,I.jsx)(f,{className:`text-base`,children:`Sample (cURL)`}),(0,I.jsx)(V,{value:x,label:`cURL sample`})]}),(0,I.jsx)(w,{children:(0,I.jsx)(`pre`,{className:`overflow-x-auto rounded bg-muted p-3 font-mono text-xs leading-relaxed`,children:x})})]})]})}export{H as IntegrationsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,g as n,p as r,r as i}from"./vendor-react-CsWFRkED.js";import{v as a}from"./infrastructure-BCTDJsqi.js";import{N as o,nt as s,rt as c,ur as l,wt as u,yt as d}from"./framework-BwfIhdyz.js";import{Ns as f,ft as p,gt as m,ht as h,yt as g}from"./ui-components-Dwq5utCl.js";import"./MetadataProvider-DyFZSNqq.js";import{t as _}from"./RecordDetailView-BBNqsNy9.js";import{d as v}from"./plugins-views-cOiN-mPq.js";var y=e(t(),1),b=[`single`,`group`,`isolated`];function x(e){return e===`group`||e===`isolated`}function S(){let{getAuthConfig:e}=a(),[t,n]=(0,y.useState)(void 0);return(0,y.useEffect)(()=>{let t=!1;return e?.().then(e=>{if(t)return;let r=e?.features?.tenancyPosture;r&&b.includes(r)&&n(r)}).catch(()=>{}),()=>{t=!0}},[e]),t}var C=`uf_`;function w(e){let t={};return e.forEach((e,n)=>{if(n.startsWith(C)&&e!==``){let r=n.slice(3);t[r]=e.split(`,`).map(e=>{try{return decodeURIComponent(e)}catch{return e}})}}),Object.keys(t).length>0?t:void 0}function T(e,t){let n=new URLSearchParams(e);for(let[e,r]of Object.entries(t)){let t=C+e;r&&r.length>0?n.set(t,r.map(e=>encodeURIComponent(String(e))).join(`,`)):n.delete(t)}return n}var E=i();function D(e){return Array.isArray(e?.columns)&&e.columns.length>0}function ee(e,t){let n=e?.listViews||e?.list_views||{},r=(t?[n[`${e?.name}.${t}`],n[t],...t==="default"||t===`list`?[e?.list]:[]]:[e?.list,...Object.values(n)]).filter(Boolean);return r.find(D)??r[0]}function O(e,t){let n=n=>t?.orgAttribution&&e?.fields?.organization_id&&!n.includes(`organization_id`)?[...n,`organization_id`]:n,r=e?.highlightFields;if(Array.isArray(r)&&r.length>0)return n(r.filter(t=>e.fields?.[t]));let i=e?.fields;return i&&typeof i==`object`?n(Object.entries(i).filter(([e,t])=>t&&!t.hidden&&!l(e,t)).map(([e])=>e).slice(0,6)):[]}function k(e,t){let n=e?.fields;if(!(!n||typeof n!=`object`))return Object.entries(n).find(([e,n])=>n&&!n.hidden&&!l(e,n)&&t(e,n))?.[0]}var A=new Set([`select`,`multiselect`,`radio`,`enum`,`boolean`]),j=new Set([`date`,`datetime`,`time`]),M=new Set([`image`,`file`,`attachment`,`avatar`,`photo`]);function N(e){let t=k(e,(e,t)=>A.has(t.type))??k(e,e=>/status|stage|state|priority|category|kind/i.test(e));return t?{groupByField:t}:void 0}function P(e){return k(e,(e,t)=>j.has(t.type))??k(e,e=>/date|due|start|end|deadline|schedule/i.test(e))}function F(e){let t=P(e);return t?{startDateField:t}:void 0}function I(e){let t=k(e,(e,t)=>M.has(t.type));return t?{coverField:t}:void 0}var L=new Set([`location`,`geo`,`geolocation`,`geopoint`,`point`]);function R(e){let t=k(e,(e,t)=>j.has(t.type)&&/start|begin|kickoff/i.test(e))??k(e,(e,t)=>j.has(t.type));if(!t)return;let n=k(e,(e,n)=>j.has(n.type)&&e!==t&&/end|due|finish|deadline|close/i.test(e))??k(e,(e,n)=>j.has(n.type)&&e!==t);if(!n)return;let r=k(e,(e,t)=>(t.type===`number`||t.type===`percent`)&&/progress|percent|complete/i.test(e));return{startDateField:t,endDateField:n,...r?{progressField:r}:{}}}function z(e){let t=k(e,(e,t)=>L.has(t.type))??k(e,e=>/location|address|geo|coords?|place|venue/i.test(e));return t?{locationField:t}:void 0}function B({page:e,className:t,onConfigChange:i,reserveEditAffordance:a}){let{t:l}=o(),{objects:b}=c(),x=s(),C=r(),[k,A]=n(),j=S()===`group`,[M]=y.useState(()=>w(new URLSearchParams(window.location.search))),P=y.useCallback(e=>{A(t=>T(t,e),{replace:!0})},[A]),L=e?.interfaceConfig||{},B=y.useMemo(()=>(b||[]).find(e=>e.name===L.source),[b,L.source]),V=y.useMemo(()=>ee(B,L.sourceView),[B,L.sourceView]),H=L.recordAction===`page`||L.recordAction===`modal`||L.recordAction===`none`?L.recordAction:`drawer`,U=y.useCallback(e=>`/apps/${window.location.pathname.split(`/`)[2]||``}/${L.source}/record/${encodeURIComponent(String(e))}`,[L.source]),W=d({navigation:{mode:H===`none`?`none`:H},objectName:L.source,onNavigate:e=>C(U(e))}),G=k.get(`recordId`),te=y.useCallback((e,t)=>{if(H===`none`)return;let n=e?.id??e?._id;if(t&&(t.metaKey||t.ctrlKey||t.button===1)&&n!=null){window.open(U(n),`_blank`);return}if((H===`drawer`||H===`modal`)&&n!=null){A(e=>{let t=new URLSearchParams(e);return t.set(`recordId`,String(n)),t});return}W.handleClick(e,t)},[H,U,W,A]),ne=y.useCallback(()=>{A(e=>{let t=new URLSearchParams(e);return t.delete(`recordId`),t})},[A]);y.useEffect(()=>{G&&!W.isOpen?W.open({id:G}):!G&&W.isOpen&&W.close()},[G]);let K=B?.name,q=!!V&&!D(V),J=V?.name??(L.sourceView?`${L.source}.${L.sourceView}`:void 0),[Y,X]=y.useState(null);y.useEffect(()=>{let e=!1;if(X(null),!(!K||!L.source||!q||!J))return(async()=>{try{let t=x,n=null;if(typeof t?.listViewOverrides==`function`)try{n=(await t.listViewOverrides(L.source))?.[J]??null}catch{}!D(n)&&typeof t?.getView==`function`&&(n=await t.getView(L.source,J)),!e&&n&&typeof n==`object`&&X(n)}catch{}})(),()=>{e=!0}},[K,L.source,L.sourceView,q,J,x]);let Z=y.useMemo(()=>Y?{...V,...Y}:V,[V,Y]),re=JSON.stringify(Z??null),Q=y.useMemo(()=>{if(!B)return;let e=Z||{},t=L.appearance??e.appearance,n=t?.allowedVisualizations||[],r=new Set(n),i=L.userActions||{},a=e.kanban??(r.has(`kanban`)?N(B):void 0),o=e.calendar??(r.has(`calendar`)?F(B):void 0),s=e.timeline??(r.has(`timeline`)?F(B):void 0),c=e.gallery??(r.has(`gallery`)?I(B):void 0),l=e.gantt??(r.has(`gantt`)?R(B):void 0),u=e.options?.map??(r.has(`map`)?z(B):void 0),d=[...Array.isArray(e.filter)?e.filter:[],...Array.isArray(L.filterBy)?L.filterBy:[]],f=D(L)?L.columns:D(e)?e.columns:O(B,{orgAttribution:j}),p=Array.isArray(L.sort)&&L.sort.length?L.sort:e.sort;return{type:`list-view`,objectName:B.name,viewType:n[0]??e.type??`grid`,columns:f,...d.length?{filter:d}:{},...p?.length?{sort:p}:{},grouping:e.grouping,rowColor:e.rowColor,pagination:e.pagination,searchableFields:e.searchableFields,emptyState:e.emptyState,kanban:a,calendar:o,gallery:c,timeline:s,gantt:l,...u||e.options?{options:{...e.options??{},...u?{map:u}:{}}}:{},userFilters:L.userFilters??e.userFilters,appearance:t,showViewSwitcher:n.length>1,showRecordCount:L.showRecordCount,addRecord:L.addRecord,userActions:{search:i.search!==!1,sort:i.sort!==!1,filter:i.filter===!0,rowHeight:i.rowHeight===!0,group:i.group===!0,hideFields:i.hideFields===!0,rowColor:i.rowColor===!0},allowExport:!1,inlineEdit:i.editInline===!0}},[K,re,L,j]);if(!B||!Q)return(0,E.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,E.jsxs)(h,{children:[(0,E.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,E.jsx)(f,{className:`h-6 w-6 text-muted-foreground`})}),(0,E.jsx)(g,{children:l(`empty.objectNotFound`,{defaultValue:`Object Not Found`})}),(0,E.jsx)(m,{children:l(`empty.interfacePageSourceMissing`,{defaultValue:`This interface page references "{{name}}", which is not available.`,name:L.source||`?`})})]})});let $=Array.isArray(L.buttons)&&L.buttons.length?L.buttons.map(e=>(B.actions||[]).find(t=>t?.name===e)).filter(Boolean).map(e=>({...e,locations:[`list_toolbar`]})):[];return(0,E.jsxs)(`div`,{className:t??`h-full flex flex-col`,"data-testid":`interface-list-page`,children:[(0,E.jsxs)(`div`,{className:`pl-4 pt-4 pb-2 shrink-0 flex items-start justify-between gap-3 ${a?`pr-12`:`pr-4`}`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`h1`,{className:`text-lg font-semibold leading-tight`,children:typeof e.label==`string`?e.label:e.name}),typeof e.description==`string`&&e.description&&(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:e.description})]}),$.length>0&&(0,E.jsx)(`div`,{className:`shrink-0`,"data-testid":`interface-page-buttons`,children:(0,E.jsx)(u,{schema:{type:`action:bar`,location:`list_toolbar`,actions:$,size:`sm`,variant:`outline`}})})]}),(0,E.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:(0,E.jsx)(v,{schema:Q,dataSource:x,userFilterSelections:M,onUserFilterSelectionsChange:P,onSortChange:i?e=>i({sort:e}):void 0,onColumnStateChange:i?e=>{e?.order?.length&&i({columns:e.order})}:void 0,onRowClick:H===`none`?void 0:te})}),W.isOverlay&&(0,E.jsx)(p,{...W,setIsOpen:e=>{e||ne()},title:typeof e.label==`string`?e.label:L.source||`Record`,children:e=>(0,E.jsx)(_,{objectNameOverride:L.source,recordIdOverride:String(e?.id??e?._id??G??``),embedded:!0,dataSource:x,objects:b,onEdit:()=>{}})})]})}export{N as a,x as c,I as i,S as l,F as n,T as o,O as r,w as s,B as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-
|
|
1
|
+
import{r as e}from"./vendor-react-CsWFRkED.js";import{N as t}from"./framework-BwfIhdyz.js";import{Pr as n,al as r,fn as i,hn as a,ia as o,mn as s,pn as c,ta as l,tl as u,vo as d}from"./ui-components-Dwq5utCl.js";var f=e(),p={config:{icon:o,i18nKey:`config`,short:`Admin config`,title:`Administrator configuration`,body:()=>`These rows define how the platform behaves at runtime. Author them here; the runtime data they produce lives in a separate table.`,tone:`border-sky-300/60 bg-sky-50 text-sky-900 hover:bg-sky-100 dark:border-sky-500/40 dark:bg-sky-950/40 dark:text-sky-100`},"engine-owned":{icon:d,i18nKey:`system`,short:`System-managed`,title:`Managed by the platform`,body:()=>`Rows here are created automatically when actions run on the source record. The list below is a read-only monitoring surface — row-level actions (Approve, Recall, Resend, …) live on each row.`,tone:`border-slate-300/60 bg-slate-50 text-slate-900 hover:bg-slate-100 dark:border-slate-500/40 dark:bg-slate-950/40 dark:text-slate-100`},"system-data":{icon:o,i18nKey:`systemWritable`,short:`Platform schema`,title:`Platform-defined, admin-writable`,body:()=>`This object's schema is defined by the platform, but its rows are yours to create and edit here. Who may write is governed by delegated administration and record-level security, not by this badge.`,tone:`border-slate-300/60 bg-slate-50 text-slate-900 hover:bg-slate-100 dark:border-slate-500/40 dark:bg-slate-950/40 dark:text-slate-100`},"append-only":{icon:u,i18nKey:`appendOnly`,short:`Read-only · Audit log`,title:`Read-only historical record`,body:()=>`Immutable audit log. Rows cannot be created, edited, or deleted from the UI — they're written by the platform when events occur. Use Export to download for compliance review.`,tone:`border-zinc-300/60 bg-zinc-50 text-zinc-900 hover:bg-zinc-100 dark:border-zinc-500/40 dark:bg-zinc-950/40 dark:text-zinc-100`},"better-auth":{icon:l,i18nKey:`betterAuth`,short:`Identity`,title:`Managed by the identity provider`,body:e=>`This object's schema is owned by ${e}. Direct edits bypass password hashing, session validation, two-factor checks, and audit hooks. Manage these records through your authentication provider's sign-in, invitation, and security flows instead.`,tone:`border-amber-300/60 bg-amber-50 text-amber-900 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-amber-950/40 dark:text-amber-100`}};function m({managedBy:e,label:o,className:l}){let{t:u}=t();if(!e||e===`platform`)return null;let d=p[e];if(!d)return null;let m=d.icon,h=o??`better-auth`,g=u(`managedByBadge.${d.i18nKey}.short`,{defaultValue:d.short}),_=u(`managedByBadge.${d.i18nKey}.title`,{defaultValue:d.title}),v=u(`managedByBadge.${d.i18nKey}.body`,{defaultValue:d.body(h),provider:h});return(0,f.jsx)(s,{delayDuration:200,children:(0,f.jsxs)(i,{children:[(0,f.jsx)(a,{asChild:!0,children:(0,f.jsxs)(n,{variant:`outline`,"data-testid":`managed-by-badge`,"data-bucket":e,className:r(`gap-1 font-normal text-[11px] leading-none py-0.5 px-1.5 cursor-help`,d.tone,l),children:[(0,f.jsx)(m,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{children:g})]})}),(0,f.jsxs)(c,{side:`bottom`,align:`start`,className:`max-w-xs text-xs leading-relaxed`,children:[(0,f.jsx)(`p`,{className:`font-semibold mb-1`,children:_}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:v})]})]})})}export{m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,p as t,r as n}from"./vendor-react-CsWFRkED.js";import{S as r}from"./infrastructure-BCTDJsqi.js";import{N as i,Yn as a}from"./framework-BwfIhdyz.js";import{Or as o,Xr as s,kr as c,vo as l}from"./ui-components-Dwq5utCl.js";var u={cloudUrl:``,singleEnvironment:!1,defaultOrgId:null,defaultEnvironmentId:null,features:{installLocal:!1,marketplace:!0,aiStudio:!0,autoPublishAiBuilds:!0,customDomain:!1,sso:!1},branding:{productName:`ObjectOS`,productShortName:`ObjectOS`,stage:`preview`,brandColor:`#4F46E5`,pwaThemeColor:`#4f46e5`}},d=[`preview`,`beta`,`ga`];function f(e){return typeof e==`string`&&d.includes(e)}var p={...u};function m(e){p={...p,...e,features:{...p.features,...e.features??{}},branding:{...p.branding,...e.branding??{}}}}async function h(e=``){let t=(e||``).replace(/\/+$/,``);try{let e=await a(`${t}/api/v1/runtime/config`,{credentials:`include`,headers:{Accept:`application/json`}});if(!e||typeof e!=`object`)return;m({cloudUrl:typeof e.cloudUrl==`string`?e.cloudUrl.replace(/\/+$/,``):p.cloudUrl,singleEnvironment:!!e.singleEnvironment,defaultOrgId:e.defaultOrgId??p.defaultOrgId??null,defaultEnvironmentId:e.defaultEnvironmentId??p.defaultEnvironmentId??null,features:e.features?{installLocal:!!e.features.installLocal,marketplace:e.features.marketplace!==!1,aiStudio:e.features.aiStudio!==!1,autoPublishAiBuilds:e.features.autoPublishAiBuilds!==!1,customDomain:e.features.customDomain===!0,sso:e.features.sso===!0}:p.features,branding:e.branding?{productName:typeof e.branding.productName==`string`&&e.branding.productName.trim()?e.branding.productName.trim():p.branding.productName,productShortName:typeof e.branding.productShortName==`string`&&e.branding.productShortName.trim()?e.branding.productShortName.trim():p.branding.productShortName,stage:f(e.branding.stage)?e.branding.stage:p.branding.stage,logoUrl:typeof e.branding.logoUrl==`string`&&e.branding.logoUrl.trim()?e.branding.logoUrl.trim():p.branding.logoUrl,faviconUrl:typeof e.branding.faviconUrl==`string`&&e.branding.faviconUrl.trim()?e.branding.faviconUrl.trim():p.branding.faviconUrl,brandColor:typeof e.branding.brandColor==`string`&&e.branding.brandColor.trim()?e.branding.brandColor.trim():p.branding.brandColor,pwaDescription:typeof e.branding.pwaDescription==`string`&&e.branding.pwaDescription.trim()?e.branding.pwaDescription.trim():p.branding.pwaDescription,pwaThemeColor:typeof e.branding.pwaThemeColor==`string`&&e.branding.pwaThemeColor.trim()?e.branding.pwaThemeColor.trim():p.branding.pwaThemeColor}:p.branding})}catch{}}function g(){return p}function _(){return p.branding?.productName||`ObjectOS`}function v(){return p.branding?.productShortName||_()}function y(){return p.branding?.stage??`preview`}function b(){return p.branding?.brandColor||`#4F46E5`}function x(){return p.branding?.logoUrl}function S(){return p.branding?.faviconUrl}function C(){return p.branding?.pwaDescription||`${_()} — runtime console`}function w(){return p.branding?.pwaThemeColor||b()}function T(){return p.cloudUrl??``}function E(){return p.features?.marketplace!==!1}function D(){return p.features?.aiStudio!==!1}var O=``.replace(/\/$/,``),k=`${O}/api/v1/marketplace`;function A(e){let t=r.get();return t?{...e,Authorization:`Bearer ${t}`}:e}function j(e,t){let n=e?.error?.code??e?.code??`HTTP_${t.status}`,r=e?.error?.message??e?.error??e?.message??t.statusText;return{code:String(n),message:typeof r==`string`?r:String(n)}}async function M(e,t){let n=await fetch(`${k}${e}`,{credentials:`omit`,headers:{Accept:`application/json`,...t?.headers||{}},...t}),r=null;try{r=await n.json()}catch{}if(!n.ok){let{code:e,message:t}=j(r,n),i=Error(typeof t==`string`?t:`${e}`);throw i.code=e,i.status=n.status,i}return r?.data??r}async function N(e={}){let t=new URLSearchParams;e.q&&t.set(`q`,e.q),e.category&&t.set(`category`,e.category),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return M(`/packages${n?`?${n}`:``}`)}async function P(e){return M(`/packages/${encodeURIComponent(e)}`)}async function F(e){if(T()){let t=await fetch(`/api/v1/cloud-connection/install`,{method:`POST`,credentials:`include`,headers:A({Accept:`application/json`,"Content-Type":`application/json`}),body:JSON.stringify({package_id:e.packageId,seed_sample_data:!!e.seedSampleData})}),n=null;try{n=await t.json()}catch{}if(!t.ok||n?.success===!1){let{code:e,message:r}=j(n,t),i=Error(typeof r==`string`?r:`${e}`);throw i.code=e,i.status=t.status,i}return n?.data??n}let t=await fetch(`${O}/api/v1/actions/sys_package/install_package`,{method:`POST`,credentials:`include`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({recordId:e.packageId,params:{environment_id:e.environmentId,seed_sample_data:!!e.seedSampleData}})}),n=null;try{n=await t.json()}catch{}let r=n?.data,i=!!r&&typeof r==`object`&&r.success===!1;if(!t.ok||i){let e=j(n,t),a=n?.code??e.code,o=i?r.error??t.statusText:e.message,s=Error(typeof o==`string`?o:`${a}`);throw s.code=a,s.status=t.status,s}return n?.data??n}async function I(){let e=T()||O,t=await fetch(`${e}/api/v1/data/sys_environment?limit=200`,{credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok){let e=Error(`HTTP_${t.status}`);throw e.status=t.status,e}let n=await t.json().catch(()=>({})),r=n?.records??n?.data??n?.items??n??[];return Array.isArray(r)?r:[]}async function L(){let e=T()||O,t=null;try{let n=await fetch(`${e}/api/v1/auth/get-session`,{credentials:`include`,headers:{Accept:`application/json`}});n.ok&&(t=(await n.json().catch(()=>({})))?.user?.id??null)}catch{}if(!t)return new Set;let n=`${e}/api/v1/data/sys_member?limit=200`,r;try{let e=await fetch(n,{credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return new Set;r=await e.json().catch(()=>({}))}catch{return new Set}let i=r?.records??r?.data??r?.items??r??[];if(!Array.isArray(i))return new Set;let a=new Set;for(let e of i){if(String(e?.user_id??e?.userId??``)!==t)continue;let n=String(e?.role??``).toLowerCase(),r=e?.organization_id??e?.organizationId;r&&(n===`owner`||n===`admin`)&&a.add(String(r))}return a}function R(e){return`${T()||`https://cloud.objectos.app`}/apps/cloud-control/sys_package/${encodeURIComponent(e)}`}function z(){return`${T()||`https://cloud.objectos.app`}/apps/cloud-control/sys_environment`}async function B(e,t){if(!e)return null;if(T())try{let t=await fetch(`/api/v1/cloud-connection/installation?package_id=${encodeURIComponent(e)}`,{credentials:`include`,headers:A({Accept:`application/json`})});if(!t.ok)return null;let n=await t.json().catch(()=>({})),r=n?.data??n??{};return r.installed?{installationId:String(r.installationId??``),version:String(r.version??`installed`),withSampleData:r.withSampleData===!0}:null}catch{return null}if(!t)return null;let n=O;try{let r=await fetch(`${n}/api/v1/cloud/environments/${encodeURIComponent(t)}/installations/${encodeURIComponent(e)}`,{credentials:`include`,headers:{Accept:`application/json`}});if(!r.ok)return null;let i=await r.json().catch(()=>({})),a=i?.data??i??{};return a.installed?{installationId:String(a.installationId??``),version:String(a.version??`installed`),withSampleData:a.withSampleData===!0}:null}catch{return null}}async function V(e){if(!e)return{ok:!1,error:`installation id required`};let t=T()||O;try{let n=await fetch(`${t}/api/v1/cloud/installations/${encodeURIComponent(e)}/reseed-sample-data`,{method:`POST`,credentials:`include`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:`{}`}),r=await n.json().catch(()=>({}));return!n.ok||r?.success===!1?{ok:!1,error:j(r,n).message}:{ok:!0}}catch(e){return{ok:!1,error:e?.message||`Network error`}}}async function H(e){if(!e)return{ok:!1,error:`installation id required`};let t=T()||O;try{let n=await fetch(`${t}/api/v1/cloud/installations/${encodeURIComponent(e)}/purge-sample-data`,{method:`POST`,credentials:`include`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:`{}`}),r=await n.json().catch(()=>({}));return!n.ok||r?.success===!1?{ok:!1,error:j(r,n).message}:{ok:!0,deleted:Number(r?.data?.deleted??0)}}catch(e){return{ok:!1,error:e?.message||`Network error`}}}async function U(){try{let e=await fetch(`${O}/api/v1/cloud-connection/org-packages`,{credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return{connected:!1,items:[]};let t=(await e.json().catch(()=>({})))?.data??{},n=Array.isArray(t.items)?t.items:[];return{connected:t.connected===!0,items:n}}catch{return{connected:!1,items:[]}}}async function W(e){let t=await fetch(`${k}/install-local`,{method:`POST`,credentials:`include`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({packageId:e.packageId,...e.versionId?{versionId:e.versionId}:{}})}),n=null;try{n=await t.json()}catch{}if(!t.ok){let{code:e,message:r}=j(n,t),i=Error(typeof r==`string`?r:`${e}`);throw i.code=e,i.status=t.status,i}return n?.data??n}async function G(){try{let e=await fetch(`${k}/install-local`,{credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return[];let t=await e.json().catch(()=>({})),n=t?.data?.items??t?.items??[];return Array.isArray(n)?n:[]}catch{return[]}}async function K(){try{let e=await fetch(`${O}/api/v1/cloud-connection/installed`,{credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return{connected:!1,items:[]};let t=(await e.json().catch(()=>({})))?.data??{},n=(Array.isArray(t.packages)?t.packages:[]).map(e=>{let t=String(e.packageId??e.package_id??``);return{packageId:t,versionId:String(e.package_version_id??``),manifestId:t,version:String(e.version??`installed`),installedAt:String(e.installed_at??e.installedAt??``),installedBy:e.installed_by??e.installedBy??null,withSampleData:e.with_sample_data===!0||e.withSampleData===!0}});return{connected:t.connected===!0,items:n}}catch{return{connected:!1,items:[]}}}async function q(e){let t=await fetch(`${k}/install-local/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(j(e,t).message)}}async function J(e,t){let n=await fetch(`${k}/install-local/${encodeURIComponent(e)}/${t===`reseed`?`reseed-sample-data`:`purge-sample-data`}`,{method:`POST`,credentials:`include`,headers:{Accept:`application/json`}}),r=await n.json().catch(()=>({}));if(!n.ok){let e=r?.error?.message??n.statusText,t=Error(typeof e==`string`?e:`HTTP_${n.status}`);throw t.code=r?.error?.code??`HTTP_${n.status}`,t}return r?.data??r}function Y(e){return J(e,`reseed`)}function X(e){return J(e,`purge`)}var Z=n();function Q(){let n=t(),{appName:r}=e(),{t:a}=i(),u=r?`/apps/${r}`:`/`;return(0,Z.jsx)(`div`,{className:`container mx-auto max-w-2xl px-6 py-16`,children:(0,Z.jsx)(o,{children:(0,Z.jsxs)(c,{className:`flex flex-col items-center gap-4 py-12 text-center`,children:[(0,Z.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,Z.jsx)(l,{className:`h-6 w-6 text-muted-foreground`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-lg font-semibold`,children:a(`marketplace.accessDenied.title`)}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:a(`marketplace.accessDenied.description`)})]}),(0,Z.jsx)(s,{variant:`outline`,onClick:()=>n(u),children:a(`marketplace.action.backHome`)})]})})})}export{E as A,_ as C,g as D,w as E,h as O,y as S,C as T,V as _,P as a,S as b,I as c,G as d,N as f,Y as g,H as h,B as i,D as k,L as l,X as m,R as n,W as o,U as p,z as r,F as s,Q as t,K as u,q as v,v as w,x,T as y};
|
package/dist/assets/{MarketplaceInstalledPage-CRe2BiM2.js → MarketplaceInstalledPage-B4qrvb7w.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{b as n,h as r,p as i,r as a}from"./vendor-react-CsWFRkED.js";import{_ as o}from"./infrastructure-BCTDJsqi.js";import{N as s,ti as c}from"./framework-BwfIhdyz.js";import{$c as l,Ci as u,Ii as d,Mr as f,Or as p,Pr as m,Ts as h,Xr as g,ba as _,cc as v,gn as y,jr as b,kr as x}from"./ui-components-Dwq5utCl.js";import{d as S,t as C,u as w,v as T}from"./MarketplaceAccessDenied-BBMyNu2w.js";var E=e(n(),1),D=a();function O(){let e=i(),{appName:t}=r(),n=o(),{t:a,language:c}=s(),l=t?`/apps/${t}`:``,[d,O]=(0,E.useState)([]),[k,A]=(0,E.useState)(`local`),[j,M]=(0,E.useState)(!0),[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(null),L=async()=>{M(!0);try{let e=await w();e.connected?(A(`cloud`),O(e.items)):(A(`local`),O(await S()))}finally{M(!1)}};(0,E.useEffect)(()=>{L()},[]);let R=async e=>{if(confirm(a(`marketplace.uninstall.confirm`,{manifestId:e.manifestId,version:e.version}))){P(e.manifestId),I(null);try{await T(e.manifestId),I({ok:!0,message:a(`marketplace.uninstall.successInList`,{manifestId:e.manifestId})}),await L()}catch(e){I({ok:!1,message:e?.message??String(e)})}finally{P(null)}}};return n?(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(g,{variant:`outline`,size:`sm`,onClick:()=>void L(),disabled:j,children:[(0,D.jsx)(_,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),a(`marketplace.refresh`)]})}),F&&(0,D.jsx)(`div`,{className:`rounded-md border p-3 text-sm ${F.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,D.jsx)(v,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,D.jsx)(`div`,{children:F.message})]})}),j&&d.length===0?(0,D.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:3}).map((e,t)=>(0,D.jsx)(y,{className:`h-20 w-full`},t))}):d.length===0?(0,D.jsxs)(`div`,{className:`text-center py-12 text-sm text-muted-foreground border rounded-md`,children:[(0,D.jsx)(`p`,{children:a(`marketplace.installedEmpty`)}),(0,D.jsx)(g,{variant:`link`,className:`mt-2`,onClick:()=>e(`${l}/system/marketplace`),children:a(`marketplace.browseLink`)})]}):(0,D.jsx)(`div`,{className:`grid gap-3`,children:d.map(t=>(0,D.jsxs)(p,{children:[(0,D.jsxs)(b,{className:`flex flex-row items-start justify-between gap-3 pb-2`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(f,{className:`text-base truncate flex items-center gap-2`,children:[t.manifestId,(0,D.jsx)(m,{variant:`outline`,children:a(`marketplace.versionBadge`,{version:t.version})})]}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1 flex flex-wrap gap-x-3 gap-y-1`,children:[(0,D.jsx)(`span`,{children:a(`marketplace.installedAt`,{when:new Date(t.installedAt).toLocaleString(c||void 0)})}),t.installedBy&&(0,D.jsx)(`span`,{children:a(`marketplace.installedBy`,{user:t.installedBy})}),(0,D.jsxs)(`span`,{children:[a(`marketplace.installedPackageId`),` `,(0,D.jsx)(`code`,{className:`font-mono`,children:t.packageId})]})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,D.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:()=>e(`${l}/system/marketplace/${t.packageId}`),children:[(0,D.jsx)(h,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),a(`marketplace.action.details`)]}),k===`local`&&(0,D.jsxs)(g,{variant:`outline`,size:`sm`,onClick:()=>void R(t),disabled:N===t.manifestId,children:[(0,D.jsx)(u,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),N===t.manifestId?a(`marketplace.action.uninstalling`):a(`marketplace.action.uninstall`)]})]})]}),k===`local`&&(0,D.jsx)(x,{className:`pt-0 text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:a(`marketplace.cachedAs`,{path:`.objectstack/installed-packages/${t.manifestId.replace(/[^a-zA-Z0-9._-]/g,`_`)}.json`})}})]},t.manifestId))}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground border-t pt-4`,dangerouslySetInnerHTML:{__html:a(`marketplace.installedAdditiveNote`)}})]}):(0,D.jsx)(C,{})}c.register(`marketplace:installed-list`,()=>(0,D.jsx)(O,{}),{namespace:`app-shell`,label:`Installed Marketplace Packages`,category:`plugin`,inputs:[]});var k=t({MarketplaceInstalledPage:()=>A});function A(){let e=i(),{appName:t}=r(),{t:n}=s(),a=t?`/apps/${t}`:``;return(0,D.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-5xl`,children:[(0,D.jsxs)(g,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>e(`${a}/system/marketplace`),children:[(0,D.jsx)(l,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),n(`marketplace.back`)]}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(d,{className:`h-6 w-6 text-primary`,"aria-hidden":`true`}),(0,D.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:n(`marketplace.installedTitle`)})]}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,dangerouslySetInnerHTML:{__html:n(`marketplace.installedSubtitle`)}})]}),(0,D.jsx)(O,{})]})}export{k as t};
|