@objectstack/console 17.1.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 +120 -0
- package/dist/.objectstack-injection.json +2 -2
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-3zTVoQKF.js → AdapterProvider-gULVLpjV.js} +1 -1
- package/dist/assets/AiPendingActionsPage-CyG11hX9.js +1 -0
- package/dist/assets/ApiConsolePage-DYuOp_W4.js +1 -0
- package/dist/assets/{AppDocsIndex-DVrJTsbv.js → AppDocsIndex-BXkNskk1.js} +1 -1
- 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-CTBV4_tx.js → DashboardView-C23ZCS2S.js} +1 -1
- package/dist/assets/{DeveloperHubPage-CWq2uYpr.js → DeveloperHubPage-KEpKc45V.js} +1 -1
- package/dist/assets/DocPage-Y4rWCZ3E.js +1 -0
- package/dist/assets/{DocShell-UFsFTSr-.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-X1OAB_O-.js → ExpressionProvider-vGLngw8h.js} +1 -1
- package/dist/assets/FlowRunsPage-BeGa9_ge.js +1 -0
- package/dist/assets/{IntegrationsPage-DdKbqwGE.js → IntegrationsPage-DTXA-Nne.js} +2 -2
- package/dist/assets/{InterfaceListPage-FCdy-_Q-.js → InterfaceListPage-BMvedZyV.js} +1 -1
- package/dist/assets/{ManagedByBadge-Bap9_dqR.js → ManagedByBadge-mKmG0hP7.js} +1 -1
- package/dist/assets/MarketplaceAccessDenied-BBMyNu2w.js +1 -0
- package/dist/assets/{MarketplaceInstalledPage-Cv-qDRNA.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-CNeJqkLQ.js → MetadataInspector-kVAu8vlh.js} +1 -1
- package/dist/assets/{MetadataProvider-DwMR1SMR.js → MetadataProvider-DyFZSNqq.js} +1 -1
- package/dist/assets/ObjectDataPage-BKHEYwXA.js +1 -0
- package/dist/assets/{PageView-XUBdr6tb.js → PageView-CTqS-VD9.js} +1 -1
- 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-CLZcT8Z0.js → RecordFormPage-CeUmmc_n.js} +1 -1
- package/dist/assets/ReportDefaultInspector-CRjDi2Er.js +3 -0
- package/dist/assets/ReportView-Cwi_Po4H.js +2 -0
- package/dist/assets/{SearchResultsPage-lgNcs7l7.js → SearchResultsPage-Cg0oq2by.js} +1 -1
- package/dist/assets/{SettingsHub-TQOc7wH3.js → SettingsHub-B5_S9YgI.js} +1 -1
- package/dist/assets/{SettingsView-DAje5pDB.js → SettingsView-Csi1awf-.js} +1 -1
- package/dist/assets/SystemHubPage-CnDri9oU.js +1 -0
- package/dist/assets/{createDerive-xZXxMz1g.js → createDerive-B3AGnDaY.js} +1 -1
- package/dist/assets/dist-Ck19TqqJ.js +5 -0
- package/dist/assets/framework-BwfIhdyz.js +55 -0
- package/dist/assets/getIcon-1ZXs1v-a.js +1 -0
- package/dist/assets/{highlighted-body-OFNGDK62-DUQut-ZU.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/{infrastructure-CerjT_c2.js → infrastructure-BCTDJsqi.js} +2 -2
- package/dist/assets/mermaid-GHXKKRXX-CR9PcY0X.js +1 -0
- package/dist/assets/metadata-admin-BE9_-F_f.js +25 -0
- 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-CQAe4Yh6.js → plugin-map-C1wSLqlB.js} +1 -1
- package/dist/assets/{plugin-markdown-7fyNN0UM.js → plugin-markdown-DNllWgPM.js} +1 -1
- package/dist/assets/{plugin-report-01bEGHuR.js → plugin-report-yfOfZPQg.js} +3 -3
- package/dist/assets/plugin-timeline-BpuaaqBd.js +1 -0
- package/dist/assets/{plugin-tree-DW0XC55y.js → plugin-tree-BrXE50se.js} +1 -1
- package/dist/assets/plugin-view-Jc0rkk7A.js +1 -0
- package/dist/assets/plugins-views-cOiN-mPq.js +4 -0
- package/dist/assets/{runtime-metadata-persistence-DpS5GXuQ.js → runtime-metadata-persistence-DTOJpVmd.js} +1 -1
- package/dist/assets/{skeletons-DVwGbFUS.js → skeletons-BwA1TSR2.js} +1 -1
- package/dist/assets/src-BLbFBP_B.js +1 -0
- package/dist/assets/{src-ClOOPIkS.js → src-DhAd4aY4.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-Z2yDiihK.js → useActionModal-DYiSBx1G.js} +1 -1
- package/dist/assets/usePackageL10n-D91-102Q.js +1 -0
- package/dist/assets/{useSettingsLabel-CvZKl8CQ.js → useSettingsLabel-CeZ36S4g.js} +1 -1
- package/dist/assets/vendor-objectstack-B1R3ym-9.js +264 -0
- package/dist/eager-closure.json +277 -0
- package/dist/index.html +54 -14
- package/package.json +1 -1
- package/dist/assets/AiPendingActionsPage-DD5DLXIK.js +0 -1
- package/dist/assets/ApiConsolePage-CSQNdOPN.js +0 -1
- package/dist/assets/AppManagementPage-vRCBT69X.js +0 -1
- package/dist/assets/ApprovalsInboxPage-Bft5QF0I.js +0 -1
- package/dist/assets/AuditLogPage-B-2e1YhN.js +0 -1
- package/dist/assets/ComponentNavView-BVbkfJfE.js +0 -1
- package/dist/assets/CreateViewDialog-CW0w7Nxc.js +0 -1
- package/dist/assets/FlowRunsPage-CUhBLwm-.js +0 -1
- package/dist/assets/MarketplaceAccessDenied-CrK7hygV.js +0 -1
- package/dist/assets/MarketplacePackagePage-CMS--SE2.js +0 -4
- package/dist/assets/MarketplacePage-njErv-tN.js +0 -1
- package/dist/assets/ObjectDataPage-BVV4yksz.js +0 -1
- package/dist/assets/ProfilePage-ClU0WVRr.js +0 -1
- package/dist/assets/PublicFormsPage-a_MNzdQw.js +0 -1
- package/dist/assets/RecordDetailView-uf81gH3J.js +0 -11
- package/dist/assets/ReportDefaultInspector-DU2azDYd.js +0 -3
- package/dist/assets/ReportView-oFhBKNBE.js +0 -2
- package/dist/assets/SystemHubPage-DUE-2-vc.js +0 -1
- package/dist/assets/componentRegistry-ByxoJqMW.js +0 -1
- package/dist/assets/dist-jor1XT9f.js +0 -5
- package/dist/assets/framework-LCCQTTcs.js +0 -47
- package/dist/assets/getIcon-Bnm_i39L.js +0 -1
- package/dist/assets/i18n-DGSduXFT.js +0 -9
- package/dist/assets/index-ZtYnn1PE.css +0 -2
- package/dist/assets/index-mpVXni3j.js +0 -2
- package/dist/assets/mermaid-GHXKKRXX-DQTMu5TJ.js +0 -1
- package/dist/assets/metadata-admin-C_DEFfDE.js +0 -25
- package/dist/assets/plugin-calendar-ClpbcK3u.js +0 -1
- package/dist/assets/plugin-charts-Cq0LpABN.js +0 -7
- package/dist/assets/plugin-chatbot-Cq7rZtnW.js +0 -120
- package/dist/assets/plugin-dashboard-C8Ohdrxi.js +0 -6
- package/dist/assets/plugin-form-B7CBtYvZ.js +0 -1
- package/dist/assets/plugin-gantt-ChkG9_UG.js +0 -64
- package/dist/assets/plugin-grid-D49BBhCX.js +0 -8
- package/dist/assets/plugin-kanban-BsTsRjoP.js +0 -1
- package/dist/assets/plugin-timeline-Dw4Lj2Rz.js +0 -1
- package/dist/assets/plugin-view-B9yCVdSX.js +0 -1
- package/dist/assets/plugins-views-BaBStVok.js +0 -4
- package/dist/assets/src-BA9h8a8o.js +0 -1
- package/dist/assets/src-Ctj_ivDh.js +0 -19
- package/dist/assets/ui-components-3mb69z8L.js +0 -42
- package/dist/assets/ui-layout-DpuFph25.js +0 -1
- package/dist/assets/use-book-data-BZg_051K.js +0 -1
- package/dist/assets/usePackageL10n-Cy-u65Zo.js +0 -1
- package/dist/assets/vendor-objectstack-DGpW4oR-.js +0 -158
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,125 @@
|
|
|
1
1
|
# @objectstack/console
|
|
2
2
|
|
|
3
|
+
## 17.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 208bd22: Console (objectui) refreshed to `190fbd01d061`. Frontend changes in this range:
|
|
8
|
+
|
|
9
|
+
Derived from the changesets objectui declared over the range — 113 releasing of 141 changesets added across 141 non-merge commits; omitted: 28 release-nothing changesets, 1 commit carrying no changeset (they ship no package code).
|
|
10
|
+
|
|
11
|
+
- **minor** — Remove the six retired `@objectstack/spec/ui` theme-schema re-exports from `@object-ui/types/zod` — `ColorPaletteSchema`, `TypographySchema`, `BorderRadiusSchema`, `ShadowSchema`,… (objectui `920165d18`)
|
|
12
|
+
- **minor** — AI build surface gains a standing 「未发布改动」 bar (#5694): while the conversation's bound package has pending drafts, a bar floats above the composer — surviving scrolling — counting… (objectui `8e32da7d8`)
|
|
13
|
+
- **minor** — `stack` now reads its spacing from `gap` and nothing else — the undeclared `spacing` key it also accepted is gone (objectui#4890). (objectui `dd194635d`)
|
|
14
|
+
- **minor** — **Breaking (published surface):** remove `options.actor` from `MetadataClient`'s `save`, `reset`, `publish` and `rollback`, and stop emitting the `X-Actor` request header. (objectui `8e00bfd28`)
|
|
15
|
+
- **minor** — `record:alert` binds the row through `usePredicateRecordContext`, so an author-declared `properties.visible` is actually consulted. (objectui `8a4439081`)
|
|
16
|
+
- **minor** — Create forms pre-fill the `current_user` defaultValue token with the acting user (#5683). `PermissionContextValue` gains `userId` (from `/me/permissions`; `null` = unknown), and t… (objectui `3c9fca3dc`)
|
|
17
|
+
- **minor** — The zod `BaseSchema` mirror now accepts everything its TypeScript declaration declares — five keys had drifted narrower (objectui#4605). (objectui `4d73b0788`)
|
|
18
|
+
- **minor** — `ComponentRendererProps` is now declared once and re-exported, instead of hand-declared a second time in `@object-ui/core` (objectui#4594). (objectui `bf3edfe13`)
|
|
19
|
+
- **minor** — `ComponentInput` is now declared once and re-exported, instead of restated in three places (objectui#4972). (objectui `d7573b3f4`)
|
|
20
|
+
- **minor** — The register-meta key `defaultChildren` is retired (objectui#5051). (objectui `fa429cf6f`)
|
|
21
|
+
- **minor** — Retire `ThemeComponentSchema` (`type: 'theme'`) — a component kind no renderer implemented (objectui#5489). (objectui `78cbdb530`)
|
|
22
|
+
- **minor** — Pins `@objectstack/spec`, `@objectstack/client`, `@objectstack/formula` and `@objectstack/lint` to `17.1.0`, and adapts the two consumer surfaces the new build moves. (objectui `2d36552d2`)
|
|
23
|
+
- **minor** — Console Home stops offering the metadata-authoring front door on a deployment whose own runtime config says authoring is not offered there (objectui#5521). (objectui `f4becce90`)
|
|
24
|
+
- **minor** — **API addition (public-surface widening):** `FileCell` — the compact upload control `@object-ui/fields` exports for line-item grid cells — gains the published optional `error?: st… (objectui `9a1fb4124`)
|
|
25
|
+
- **minor** — Marketplace-less runtimes now say so instead of erroring: `OS_CLOUD_URL=off` is a first-class disabled state, and the load-failure hint describes the control plane the runtime was… (objectui `20e317cd5`)
|
|
26
|
+
- **minor** — Bind `record` into the node-level visibility evaluator, and stop a hoisted `properties.visible` swallowing a declared `visibleWhen`. (objectui `c86185eb5`)
|
|
27
|
+
- **minor** — Dashboard chart widgets no longer render as a blank area when their height class resolves to `auto`. (objectui `6f017e99c`)
|
|
28
|
+
- **minor** — `ReportView` reads a report's data binding through the one key the contract declares — `dataSource.object`. (objectui `60d452ee0`)
|
|
29
|
+
- **minor** — Studio's `新建对象` asks for the record-sharing baseline, and an unauthored one is reported before Publish rather than by it. (objectui `7a90afdf9`)
|
|
30
|
+
- **minor** — `data-table` reads the declared `header`; the producers translate `label` into it. (objectui `e719ebdd9`)
|
|
31
|
+
- **minor** — The static `table` renderer reads only the declared `TableColumn` contract, and its published reference page teaches that spelling. (objectui `490f48240`)
|
|
32
|
+
- **minor** — The approval panel identifies the pending approver by name, not by a truncated raw id. (objectui `77f846a8b`)
|
|
33
|
+
- **minor** — A screen flow's resume result reaches the user — on both outcomes (objectui#5417). (objectui `c40f3b8ca`)
|
|
34
|
+
- **minor** — Three more secret-field spellings no longer render a secret in clear text on the form's unregistered-widget branch. (objectui `91783c47b`)
|
|
35
|
+
- **minor** — `object-grid` / `object-form` / `detail-view` resolve their data source the same way, and a block that resolves none says so (objectui `ebce5a367`)
|
|
36
|
+
- **minor** — `WidgetConfigPanel` reads an inline-locale-map title, and a save no longer destroys the other locales. (objectui `fb96ecb3d`)
|
|
37
|
+
- **minor** — `objectui check` judges a file's `type` only when the file is recognisable as an ObjectUI schema, and reports how many it declined to judge. (objectui `94021ddba`)
|
|
38
|
+
- **patch** — `element:record_picker`'s `label` and `placeholder` now resolve the inline per-locale map their contract admits, and their published declarations say so (objectui#5637). (objectui `190fbd01d`)
|
|
39
|
+
- **patch** — The dev-mode unknown-key warning stops flagging `overrideNotice`, the console's privileged-override safety copy (objectui#5611). (objectui `7138bc129`)
|
|
40
|
+
- **patch** — Documentation no longer teaches the "JSX/HTML + Tailwind" framing for a page's `source`, which ADR-0080's own 2026-06-30 header amendment (under ADR-0065, Accepted) retracted. obj… (objectui `0b1326d8a`)
|
|
41
|
+
- **patch** — The form renderer now keeps a `defaultValues` reset off `onChange` and off the `form_change` `onAction` for **every** caller — including one that memoizes the callback (objectui#5… (objectui `485f09669`)
|
|
42
|
+
- **patch** — Document the `X-Tenant-ID` edge contract that `createAuthenticatedFetch` stamps, and the unstamped-first-request window in which it is not sent (objectui#5279). Documentation only… (objectui `934a53201`)
|
|
43
|
+
- **patch** — `console.ai.pendingDrafts` — the standing unpublished-changes bar's five strings — now exists in all ten locale packs. It previously existed only in `en` and `zh`, so `ar`, `ru`,… (objectui `1e66879d9`)
|
|
44
|
+
- **patch** — `README.md`'s "Not a `FormField` key" table said a field-level `className` is "read on exactly one pseudo-field, `type: 'section-divider'`". That quantifier holds only for the ren… (objectui `83ec61881`)
|
|
45
|
+
- **patch** — Follow-up to #5696: the pending-drafts bar's strings live at `console.ai.pendingDrafts.*` with en+zh locale entries — the i18n call-site key gate and ratchet flagged the original… (objectui `c5200f041`)
|
|
46
|
+
- **patch** — A RETIRED field-type spelling is now refused — out loud, once — by every field-type predicate in the renderer, not just by the widget road (objectui#4914, maintainer ruling B of 2… (objectui `6c6cee704`)
|
|
47
|
+
- **patch** — `ActionParamDialog` (the `custom` barrel's published dialog) now resolves each `select` param's options through `@object-ui/core`'s shared option evaluator, so a per-option `visib… (objectui `3b147a367`)
|
|
48
|
+
- **patch** — The console's `<PageHeader>` spells its secondary line `subtitle`, the same key the other `PageHeader` in this repo uses (objectui#4761). (objectui `029e2fb72`)
|
|
49
|
+
- **patch** — `AiChatPage`'s public share-link base now resolves through the one console-mount resolver instead of a private copy of it (objectui#4482). (objectui `169f6d29f`)
|
|
50
|
+
- **patch** — The metadata lock banner can no longer render an amber, padlocked box with no title, and the ADR-0010 §3.6 lock vocabulary is declared once instead of three times (objectui#5024). (objectui `8d37efb44`)
|
|
51
|
+
- **patch** — `DashboardComponentSchema.dateRange.defaultRange` is now bound to `DateRangeDefaultRange` from `@objectstack/spec/ui` instead of restating it as a hand-written 14-member union (ob… (objectui `f9e4f9139`)
|
|
52
|
+
- **patch** — `README.md`'s "Schema API / CalendarView" block described a `CalendarViewSchema` that does not exist. Measured against the interface itself (`packages/types/src/complex.ts`) and i… (objectui `76ae7291b`)
|
|
53
|
+
- **patch** — A cloud-connection bind failure now reads in the user's language whichever clock noticed it (objectui#5054). (objectui `3a58149d8`)
|
|
54
|
+
- **patch** — The console's cold load no longer asks `/api/v1/runtime/config` or `/auth/me/localization` twice (objectui#5544). (objectui `0e05aac68`)
|
|
55
|
+
- **patch** — `sanitizeViewOverride` now strips a half-filled `between` from a stored view overlay, instead of handing it back to the merge (objectui#5025, objectstack#8815). (objectui `26ff2d6ac`)
|
|
56
|
+
- **patch** — `ActionParamDialog`'s "this param carries a reference target" rule now derives from the shared reference-field family instead of the last private copy of it. (objectui `7e811687a`)
|
|
57
|
+
- **patch** — The two form CONTAINER contracts now have ONE declaration each, derived from `@objectstack/spec`, and the console reads them instead of its own copies. (objectui `71ee4959e`)
|
|
58
|
+
- **patch** — Both `evaluateExpression` references in the `ExpressionEvaluator.registerFunction` JSDoc are now qualified, so each resolves to the entity it means (objectui#5580). (objectui `8ebd57fc5`)
|
|
59
|
+
- **patch** — `features.aiStudio` is now read through one `isAiStudioEnabled()` accessor instead of being spelled inline at two call sites (objectui#5577). (objectui `aa3b81062`)
|
|
60
|
+
- **patch** — `setLocalized`'s published docblock states the single-locale write rule that is actually in force, instead of deferring the multi-locale-authoring question to a closed card (objec… (objectui `b2437a79a`)
|
|
61
|
+
- **patch** — Dashboard record fields: percent columns now render through the one percent scaling decision instead of a second, drifted copy of it. (objectui `f1c27f037`)
|
|
62
|
+
- **patch** — Repair five retired lucide icon spellings that reach a record-reading resolver, and pin the names against the runtime `icons` record so the next lucide bump goes red instead of si… (objectui `42887e0e1`)
|
|
63
|
+
- **patch** — `element:record_picker`'s `emptyText` now resolves the inline per-locale map its contract has admitted since rc.6, and its published declaration says so (objectui#5590). (objectui `fa140b892`)
|
|
64
|
+
- **patch** — `buildSections` now honours a FormView field's `maxLength` override instead of always taking the object's ceiling (objectui#5595). (objectui `cdda37ae3`)
|
|
65
|
+
- **patch** — The `I18nLabel` "inverted pin" now watches the premise it claims to watch, and `ui-action.ts` no longer imports a symbol it never uses (objectui#5612, objectui#5613). (objectui `dffd752d8`)
|
|
66
|
+
- **patch** — `ObjectChart` now depends on the `fieldOptionLabel` resolver directly instead of holding it behind a ref, so a chart re-resolves its groupBy option labels when the resolver genuin… (objectui `6c5ee71c5`)
|
|
67
|
+
- **patch** — `ViewSwitcher` draws an icon for `chart` and `gantt` views again, and both icon maps in the package now name only spellings lucide still resolves (objectui#5586). (objectui `6b348d278`)
|
|
68
|
+
- **patch** — The console's standalone form renderer now evaluates conditional field visibility. (objectui `b63a9a332`)
|
|
69
|
+
- **patch** — The marketplace package detail page decides "you are not an admin" before it fetches, instead of after the load has already failed. (objectui `13413f3ae`)
|
|
70
|
+
- **patch** — `RecordDetailView`'s param-collection dialog now titles itself from `action.label` alone — the unreachable `|| action?.title` fallback beside it is removed (objectui#5610). (objectui `8c87f0583`)
|
|
71
|
+
- **patch** — `ActionParam`'s doc block no longer claims that spec 17 narrowed `I18nLabel` to a plain string (objectui#4611). (objectui `4e8622b7b`)
|
|
72
|
+
- **patch** — Two comment corrections in `ListView.tsx` (objectui#4559, objectui#4966). No runtime behaviour changes and the emitted bundle is byte-identical; the published `.d.ts` does change,… (objectui `d6613a28d`)
|
|
73
|
+
- **patch** — Corrects the `@deprecated` prescription on `UniquenessValidation` in `packages/types/src/data-protocol.ts`, which pointed authors at spellings the platform no longer accepts (obje… (objectui `3c73d99ed`)
|
|
74
|
+
- **patch** — `toRenderableSchema`'s header now says the bridge is permanent, instead of instructing callers to remove it (objectui#4622). (objectui `f90b8fb5d`)
|
|
75
|
+
- **patch** — The console's param-collection dialog now titles itself from `action.label` alone — the unreachable `|| action?.title` fallback beside it is removed (objectui#4282). (objectui `76ceb1e05`)
|
|
76
|
+
- **patch** — `useObjectChat` no longer rebuilds its `DefaultChatTransport` on every render (objectui#4187). (objectui `a31adc611`)
|
|
77
|
+
- **patch** — `DashboardRenderer` drops the unreachable `DatasetWidget` fork from its self-contained (card-less) branch, leaving that branch to render `SchemaRenderer` unconditionally (objectui… (objectui `84d2e987f`)
|
|
78
|
+
- **patch** — Studio's pre-publish security block can now take you to the object it names. (objectui `d15a92d21`)
|
|
79
|
+
- **patch** — A lookup's inline dropdown renders its columns through the same cell renderer the browse-all picker uses, so one `lookup_columns` declaration cannot produce two answers. (objectui `7a28e1e3f`)
|
|
80
|
+
- **patch** — The form-field authoring contract now has ONE declaration, and the console reads it instead of its own copy. (objectui `cebdfe7e1`)
|
|
81
|
+
- **patch** — The `[page:header]` sparse-predicate warning no longer blames `hidden: true` — it states what it actually measured (objectui#5399). (objectui `5a07e67d9`)
|
|
82
|
+
- **patch** — A host-composed `tree` view is now labelled with the tree icon in `ObjectView`'s view switcher instead of the grid one, and the `tree` / `chart` view types are recorded as host-co… (objectui `cad512fe1`)
|
|
83
|
+
- **patch** — A widget title stored as an inline per-locale map is editable again in both dashboard authoring surfaces, and a save writes back only the active locale's entry (objectui#5428). (objectui `4db5989ac`)
|
|
84
|
+
- **patch** — `useObjectLabel` now keeps a stable identity when no i18next instance is bound, so the memoization it advertises holds on the no-provider path too (objectui#5564). (objectui `38a956877`)
|
|
85
|
+
- **patch** — `PivotTable` no longer re-runs its cross-tabulation memo on every render when it has no rows (objectui#5562). (objectui `0ccbdc1c2`)
|
|
86
|
+
- **patch** — The marketplace **catalog** page now tells a non-admin that the runtime has no marketplace, instead of telling them they lack permission (objectui#5557). (objectui `d524bde29`)
|
|
87
|
+
- **patch** — `ExpressionEvaluator.registerFunction` now documents the case-fold it has always performed: the name is stored — and must be called — in UPPER CASE (objectui#5363). (objectui `f2158ec86`)
|
|
88
|
+
- **patch** — `ObjectSettingsPanel` now calls `isExternalWider` from `owd-sharing.ts` instead of re-declaring `OWD_WIDTH` and the ADR-0090 D11 width comparison inline (objectui#5477). (objectui `3211397b0`)
|
|
89
|
+
- **patch** — The `ui:grid` renderer now forwards to the DOM by whitelist, so schema keys no longer land on the rendered `<div>` as invalid HTML attributes (objectui#4787). (objectui `b655a9de1`)
|
|
90
|
+
- **patch** — `record:alert`'s renderer-local `RecordAlertProps` CTA slot (`action.label`) is widened to `string | I18nLabel` in both copies (`properties.*` and the flat compat mirror) in `pack… (objectui `006834856`)
|
|
91
|
+
- **patch** — The approval step progress bar is a vertical stepper, so long flows stop clipping their tail steps. (objectui `ac73c24b0`)
|
|
92
|
+
- **patch** — `ObjectDataTable` and `ObjectPivotTable` now use a module-scope frozen empty for "no rows yet" instead of a fresh array literal per render (objectui#4629). (objectui `f24195aeb`)
|
|
93
|
+
- **patch** — The Approvals Inbox no longer shows a business approver the submitted record's raw row JSON. (objectui `7c0e417b5`)
|
|
94
|
+
- **patch** — Console builds no longer carry a live Sentry DSN, and `sendDefaultPii` is now opt-in (objectui#5522). (objectui `0935a43be`)
|
|
95
|
+
- **patch** — `navigateOnSuccess` now honours a mounted host, and says so when its destination is refused (objectui `26a223863`)
|
|
96
|
+
- **patch** — The marketplace **package detail** page now states that the marketplace is turned off, instead of red-erroring, on a runtime that has none (objectui#5533). (objectui `2573ff434`)
|
|
97
|
+
- **patch** — fix(approvals): derive approver identities from `positions`, not the retired `user.roles` (objectui#5424) (objectui `7e898368a`)
|
|
98
|
+
- **patch** — The Console now gates the `/studio/*` routes on the `studio.access` ENTRY capability, not just on the backend's refusal of the writes behind them (objectui#5519). (objectui `7d0143c35`)
|
|
99
|
+
- **patch** — `registerStudioComponents.tsx` no longer claims a code split it never had: `studio:builder` imports `BuilderLanding` directly instead of through a `lazy()` that deferred nothing. (objectui `7493bff63`)
|
|
100
|
+
- **patch** — metadata-admin: `FormFieldSpec` declares `dependsOn`, and the widget half reads the same declaration instead of its own copy of it (objectui#5040) (objectui `eba3a6eaa`)
|
|
101
|
+
- **patch** — A readonly `markdown` / `html` / `richtext` form field now renders its content FORMATTED instead of showing the user its markup source (objectui#5498). (objectui `4bb940b6e`)
|
|
102
|
+
- **patch** — `ObjectGrid` lowers the deprecated `defaultFilters` through `toFilterNode` instead of byte-copying it onto `$filter` (objectui#4082). (objectui `9e2208544`)
|
|
103
|
+
- **patch** — Studio's form designer canvas now emits the namespaced `FormField.type` spelling instead of passing `objectDef.fields[x].type` through raw (objectui#4838). (objectui `ca2b4096e`)
|
|
104
|
+
- **patch** — `objectui validate` now refuses a form field whose widget id names a namespace other than `field:`, matching the verdict `@object-ui/core`'s `validateSchema` has given since objec… (objectui `100547e36`)
|
|
105
|
+
- **patch** — Studio Interfaces: the nav-leaf binding reads the canonical target key only (objectui `6cc62e225`)
|
|
106
|
+
- **patch** — `ListView` now resolves the nested `aria.ariaLabel` against the audience's locale instead of casting it to a string (objectui#5134). (objectui `ec9fdaaa5`)
|
|
107
|
+
- **patch** — The value-fallback label prettifier `humanizeLabel` has one implementation instead of two byte-identical copies. (objectui `cef27e2b1`)
|
|
108
|
+
- **patch** — `ObjectMapProps.clusterRadius`'s JSDoc said "in pixels"; `clusterMarkers` has always used it as a coordinate-degree grid cell edge (`radius / 2 ** zoom`, divided into the marker's… (objectui `ff7543c5d`)
|
|
109
|
+
- **patch** — The Approvals Inbox stops remounting every row on every render. (objectui `9b9af8dbb`)
|
|
110
|
+
- **patch** — Studio's metadata authoring path stops greeting the author with errors they did not cause, English help text in a Chinese console, and a toast on top of the publish button. (objectui `add10d8f9`)
|
|
111
|
+
- …and 13 more releasing changesets in this range (list capped at 100; see the objectui range below).
|
|
112
|
+
|
|
113
|
+
⚠️ 1 of these carries a breaking change: 1 by the author's own breaking annotation in the changeset body — objectui declares no `major` inside a launch window (`scripts/check-changeset-no-major.mjs`). Each is marked **BREAKING** in the list above — read them before compiling the release record.
|
|
114
|
+
|
|
115
|
+
**In this console build, declared nowhere** — objectui merged 1 commit in this range with no `.changeset/*.md`. The code is inside the pin above and ships here, but nothing upstream declared it, so it appears in no objectui CHANGELOG and in no entry above. Listed by subject rather than counted, because a count cannot tell a dependency bump from a form-behaviour change (objectstack#6174); the upstream gate that would prevent this is objectui#3387.
|
|
116
|
+
|
|
117
|
+
- _(no changeset)_ chore: release packages (#4655) (objectui `59f61cfb8`)
|
|
118
|
+
|
|
119
|
+
<!-- adr-0087: not-required (no-migration-prescription) The range carries exactly ONE declared-breaking entry, judged on its own upstream changeset rather than as a batch: objectui `8e00bfd28` (objectui#5689) removes `options.actor` from `@object-ui/data-objectstack`'s `MetadataClient` (`save` / `reset` / `publish` / `rollback`) and stops emitting the `X-Actor` request header. It is objectui CATCHING UP to a decision this repo already took and already shipped: objectstack#7941 removed the header limb from the `/meta` write actor resolver, so the recorded actor is the identity the request was authorized as — re-measured at this HEAD in `packages/rest/src/rest-server.ts` (the single `resolveExecCtx`-based producer for every `/meta` route that stamps an `actor`) and pinned by `packages/rest/src/meta-write-actor-identity.test.ts`, whose cases 3 and 4 assert an explicit `X-Actor` does NOT outrank the authenticated identity and is inert on the machine-write path. The retired option was therefore a false affordance that typed cleanly, sent a header this server already ignored, and could not influence the audit or history row — dropping it changes no shipped behaviour and rewrites no stored metadata. Nothing in it is reachable through `@objectstack/console` either, re-measured against `packages/console/package.json` at this HEAD: `files` is `["dist","README.md","CHANGELOG.md"]` and the sole `exports` entry is `./package.json`, so it forwards no `@object-ui/*` module entry point and re-exports none of these types. This diff is `.objectui-sha` plus this changeset and nothing else (the regenerated `packages/console/dist/sdui.manifest.json` is gitignored and the ADR-0082 D4 ratchet reported no new divergence, so neither it nor its baseline is in the diff) — no `packages/spec` schema, authorable metadata key or protocol surface changes in it — so there is no stored-metadata rewrite for `objectstack migrate meta` to prescribe and therefore no ADR-0087 ledger entry to write or to name from THIS bump. This bump adds no ledger entry and claims none. -->
|
|
120
|
+
|
|
121
|
+
objectui range: `9a3daf8d37ad...190fbd01d061`
|
|
122
|
+
|
|
3
123
|
## 17.1.0
|
|
4
124
|
|
|
5
125
|
### Minor Changes
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"name": "@objectstack/spec",
|
|
7
7
|
"injectedFrom": "/home/runner/work/objectstack/objectstack/packages/spec",
|
|
8
8
|
"skew": true,
|
|
9
|
-
"freshWitness": "
|
|
10
|
-
"staleDetector": "
|
|
9
|
+
"freshWitness": "Dotted config path inside the submitted seed set (`seeds.0.mode`), so an author can jump to the offending key. May be empty for a whole-request finding.",
|
|
10
|
+
"staleDetector": "2X large border radius (e.g., 1rem)"
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
}
|
package/dist/.objectui-sha
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
190fbd01d0615e2e168faf9e08b8ad7844bc039d
|
|
@@ -1,3 +1,3 @@
|
|
|
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-
|
|
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{N as i,O as a,et as o,o as s}from"./framework-BwfIhdyz.js";import{r as c}from"./vendor-ui-utils-BFw4cGI6.js";var l=e(t(),1),u=0,d=new Set,f=[];function p(){for(let e of d)try{e(u)}catch{}if(u===0&&f.length>0){let e=f;f=[];for(let t of e)try{t()}catch{}}}function m(){u+=1,p()}function h(){u=Math.max(0,u-1),p()}function g(){return u}function _(){return u===0}function v(e){return d.add(e),()=>{d.delete(e)}}function y(e=1e4){return u===0?Promise.resolve():new Promise(t=>{let n=!1,r=()=>{n||(n=!0,t())};f.push(r),e>0&&typeof setTimeout<`u`&&setTimeout(r,e)})}function b(e){return(async(...t)=>{m();try{return await e(...t)}finally{h()}})}function x(){if(typeof window>`u`)return;let e=window,t=e.__objectui??={};Object.defineProperty(t,"pendingRequests",{get:g,configurable:!0}),Object.defineProperty(t,"idle",{get:_,configurable:!0}),t.whenIdle=y,t.subscribe=v}async function S(e,t,n){let r;try{r=(await e.getObjectSchema(t))?.fields}catch{}return e=>n(t,e,r?.[e]?.label||e)}var C={readonly:(e,t)=>e(`detail.writeStrippedReadonly`,{fields:t,defaultValue:`Read-only, so it did not take effect: {{fields}}`}),readonly_when:(e,t)=>e(`detail.writeStrippedByState`,{fields:t,defaultValue:`Not editable in this record's current state, so it did not take effect: {{fields}}`}),primary_key:(e,t)=>e(`detail.writeStrippedPrimaryKey`,{fields:t,defaultValue:`The record's identifier cannot be changed by a save, so it did not take effect: {{fields}}`})},w=(e,t)=>e(`detail.writeStrippedUnknownReason`,{fields:t,defaultValue:`Not applied by the server: {{fields}}`});function T(e){return C[e]??w}async function E(e,t,n,r,i){let a=new Map;for(let t of e.droppedFields){let e=a.get(t.reason)??[];for(let n of t.fields)e.includes(n)||e.push(n);a.set(t.reason,e)}if(a.size===0)return;let o=n&&e.resource?await S(n,e.resource,r):e=>e,s=[];for(let[e,n]of a){if(n.length===0)continue;let r=n.map(o).join(`, `);s.push(T(e)(t,r))}s.length!==0&&i.warning(t(`detail.writeStrippedTitle`,{defaultValue:`Saved — but some fields did not take effect`}),{description:s.join(`
|
|
2
2
|
`)})}var D=1e4;function O(e){let t=e.where?`[${e.rule}] ${e.where}`:`[${e.rule}]`,n=e.hint?` ${e.hint}`:``;return`${t} — ${e.message}${n}`}function k(e,t,n){!e.advisories||e.advisories.length===0||n.warning(t(`console.saveAdvisoryTitle`,{count:e.advisories.length,defaultValue:`Saved — the authoring check raised {{count}} advisory finding(s)`}),{description:e.advisories.map(O).join(`
|
|
3
3
|
`),duration:D})}var A=n();function j({children:e,adapter:t}){let[n,u]=(0,l.useState)(t??null),{t:d}=i(),f=(0,l.useRef)(d);f.current=d;let{fieldLabel:p}=a(),m=(0,l.useRef)(p);return m.current=p,(0,l.useEffect)(()=>{if(t){u(t);return}let e=!1,n,i;x();async function a(){try{let t=new s({baseUrl:``,fetch:b(r()),autoReconnect:!0,maxReconnectAttempts:5,reconnectDelay:1e3,cache:{maxSize:50,ttl:3e5}});n=t.onWriteWarning(e=>{E(e,f.current,t,m.current,c)}),i=t.onSaveAdvisory(e=>{k(e,f.current,c)}),await t.connect(),e||u(t)}catch(t){e||console.error(`[Console] Failed to initialize:`,t)}}return a(),()=>{e=!0,n?.(),i?.()}},[t]),(0,A.jsx)(o.Provider,{value:n,children:e})}export{k as n,b as r,j 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{n as r}from"./plugin-chatbot-mxoQfkdx.js";var i=e(t(),1),a=n();function o(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`},t=e.VITE_AI_BASE_URL;return t?t.replace(/\/$/,``):`${(e.VITE_SERVER_URL??``).replace(/\/$/,``)}/api/v1/ai`}function s(){let e=(0,i.useMemo)(()=>o(),[]);return(0,a.jsxs)(`div`,{className:`p-6 max-w-6xl mx-auto`,children:[(0,a.jsxs)(`div`,{className:`mb-4`,children:[(0,a.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`AI Approvals`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Review actions an AI agent proposed. Approve to execute them server-side; reject to send a reason back to the model so it can revise the next turn.`})]}),(0,a.jsx)(r,{apiBase:e,variant:`card`,title:`Queue`,description:`Polled every 5 seconds. Decisions are recorded under your identity.`})]})}export{s as AiPendingActionsPage,s as default};
|
|
@@ -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};
|
|
@@ -1 +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{
|
|
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};
|
|
@@ -1 +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{
|
|
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{h as e,p as t,r as n}from"./vendor-react-CsWFRkED.js";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-CsWFRkED.js";import{
|
|
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{b as t,r as n}from"./vendor-react-CsWFRkED.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};
|