@objectstack/console 17.0.0-rc.3 → 17.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -1
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-Bur-uZKZ.js → AdapterProvider-BJ47DW1h.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-CJwQWg1W.js → AiPendingActionsPage-UIynjb20.js} +1 -1
- package/dist/assets/{ApiConsolePage-D0rZy0lx.js → ApiConsolePage-B7CzUZnr.js} +1 -1
- package/dist/assets/{AppDocsIndex-CQo6tZPY.js → AppDocsIndex-DUsMqAwN.js} +1 -1
- package/dist/assets/{AppManagementPage-jLhhl_WS.js → AppManagementPage-DJ6118-F.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-CTVm3l-x.js +1 -0
- package/dist/assets/AuditLogPage-Riqi0U7P.js +1 -0
- package/dist/assets/{ComponentNavView-4vcZh2oX.js → ComponentNavView-B2otfGZ7.js} +1 -1
- package/dist/assets/CreateViewDialog-z6h6V9xj.js +1 -0
- package/dist/assets/{DashboardView-S5Fshq0v.js → DashboardView-6_sxqUcT.js} +1 -1
- package/dist/assets/{DeveloperHubPage-yTPx0th5.js → DeveloperHubPage-NbNGfp6j.js} +1 -1
- package/dist/assets/{DocShell-BhkelvR8.js → DocShell-DvmmtwpW.js} +1 -1
- package/dist/assets/{ExpressionProvider-BQFSoabd.js → ExpressionProvider-_qLpGaJS.js} +1 -1
- package/dist/assets/FlowRunsPage-ZTpe0n1O.js +1 -0
- package/dist/assets/{IntegrationsPage-BWBfrCWI.js → IntegrationsPage-DMuzWjMr.js} +2 -2
- package/dist/assets/{InterfaceListPage-DcFmVgXg.js → InterfaceListPage-BHcPP_6g.js} +1 -1
- package/dist/assets/{ManagedByBadge-pdWk_Jcc.js → ManagedByBadge-DNLmY8V4.js} +1 -1
- package/dist/assets/{MarketplaceAccessDenied-DDTfnIA8.js → MarketplaceAccessDenied-Drlrrrd9.js} +1 -1
- package/dist/assets/{MarketplaceInstalledPage-Byn6Undk.js → MarketplaceInstalledPage-CYP2CaJz.js} +1 -1
- package/dist/assets/MarketplacePackagePage-DZwFKOQv.js +4 -0
- package/dist/assets/MarketplacePage-XU0PQLAW.js +1 -0
- package/dist/assets/{MetadataInspector-B7LigfJm.js → MetadataInspector-CoxLxxKN.js} +1 -1
- package/dist/assets/{MetadataProvider-D9fSVVZp.js → MetadataProvider-DJXxy8nz.js} +1 -1
- package/dist/assets/ObjectDataPage-CHRZduUP.js +1 -0
- package/dist/assets/PageView-D27Yy4W9.js +1 -0
- package/dist/assets/ProfilePage-09XXYshY.js +1 -0
- package/dist/assets/{PublicFormsPage-C3z0TH0k.js → PublicFormsPage-O8fm4eBn.js} +1 -1
- package/dist/assets/RecordDetailView-aOOCQH95.js +9 -0
- package/dist/assets/RecordFormPage-oqNb9asS.js +1 -0
- package/dist/assets/ReportDefaultInspector-Bo94YiWL.js +3 -0
- package/dist/assets/ReportView-CwCw4i27.js +2 -0
- package/dist/assets/{SearchResultsPage-Ct2q9Lrf.js → SearchResultsPage-I8ngrVdn.js} +1 -1
- package/dist/assets/SettingsHub-BY_utblN.js +1 -0
- package/dist/assets/SettingsView-DNKEl-i-.js +1 -0
- package/dist/assets/{SystemHubPage-BSunYA-X.js → SystemHubPage-WWns1vXN.js} +1 -1
- package/dist/assets/{createDerive-CGF05Hgy.js → createDerive-CsNhKPNT.js} +1 -1
- package/dist/assets/data-adapter-Bh8GerYu.js +32 -0
- package/dist/assets/{drillUrlFilters-BL8PeMrH.js → drillUrlFilters-DHAQHZbx.js} +1 -1
- package/dist/assets/framework-s0wcPYfi.js +8 -0
- package/dist/assets/{getIcon-D3yCrAri.js → getIcon-CQlbi2Hn.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-DrPiUj_V.js → highlighted-body-OFNGDK62-0kvj_GdK.js} +1 -1
- package/dist/assets/{i18n-DBmEJ9U1.js → i18n-BFepWCa9.js} +1 -1
- package/dist/assets/index-CB0grcA9.js +2 -0
- package/dist/assets/index-DwcytixP.css +2 -0
- package/dist/assets/{infrastructure-PXm1h5tB.js → infrastructure-BKCMsWnH.js} +2 -2
- package/dist/assets/maplibre-gl-shared.mjs +6 -0
- package/dist/assets/maplibre-gl-worker.mjs +6 -0
- package/dist/assets/mermaid-GHXKKRXX-CI_uxHoC.js +1 -0
- package/dist/assets/metadata-admin-CApOhXis.js +25 -0
- package/dist/assets/plugin-calendar-BOjBc2zc.js +1 -0
- package/dist/assets/plugin-charts-Bk48oCaW.js +7 -0
- package/dist/assets/{plugin-chatbot-DmEp7ZGx.js → plugin-chatbot-CEj8h-9I.js} +7 -7
- package/dist/assets/plugin-dashboard-B0k1x0iX.js +6 -0
- package/dist/assets/plugin-form-B_6Tki5r.js +1 -0
- package/dist/assets/plugin-gantt-va3r2kNG.js +63 -0
- package/dist/assets/plugin-grid-C0rE_dCh.js +8 -0
- package/dist/assets/plugin-kanban-BhzMbWNL.js +1 -0
- package/dist/assets/{plugin-map-D0SLy13S.js → plugin-map-zu5SGrw4.js} +1 -1
- package/dist/assets/{plugin-markdown-D7iZb8hK.js → plugin-markdown-BqKwZink.js} +1 -1
- package/dist/assets/plugin-report-DOylY2iS.js +59 -0
- package/dist/assets/{plugin-timeline-C_svagQ1.js → plugin-timeline-sB_LQnGB.js} +1 -1
- package/dist/assets/plugin-tree-CHZ2Wjl4.js +1 -0
- package/dist/assets/plugin-view-DoxfBkwY.js +1 -0
- package/dist/assets/plugins-views-DoZ6BQOM.js +4 -0
- package/dist/assets/{runtime-metadata-persistence-BjYxldgR.js → runtime-metadata-persistence-TwDeIZza.js} +1 -1
- package/dist/assets/{skeletons-C8REUFE6.js → skeletons-BZIrujxl.js} +1 -1
- package/dist/assets/src--uGAhLxY.js +19 -0
- package/dist/assets/{src-E-Ibo9NH.js → src-Boqr2A0h.js} +1 -1
- package/dist/assets/src-t-RiW1Dw.js +1 -0
- package/dist/assets/ui-components-BFOT5Gog.js +72 -0
- package/dist/assets/ui-layout-D4KJD2jH.js +1 -0
- package/dist/assets/{use-book-data-D8LHn21q.js → use-book-data-BIflvfeG.js} +1 -1
- package/dist/assets/useOpenRecordList-CptPt5Mv.js +1 -0
- package/dist/assets/useSettingsLabel-CeykvoQ_.js +1 -0
- package/dist/assets/vendor-objectstack-Dm5CaPeY.js +184 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ApprovalsInboxPage-COyyj1KQ.js +0 -1
- package/dist/assets/AuditLogPage-CxGLPqlB.js +0 -1
- package/dist/assets/CreateViewDialog-C6sZGaIB.js +0 -1
- package/dist/assets/FlowRunsPage-DGyj2PBP.js +0 -1
- package/dist/assets/MarketplacePackagePage-DZkqNaao.js +0 -4
- package/dist/assets/MarketplacePage-Dt4ldkBx.js +0 -1
- package/dist/assets/ObjectDataPage-BZ4pf0ji.js +0 -1
- package/dist/assets/PageView-B8qkF17f.js +0 -1
- package/dist/assets/ProfilePage-Do9aTArT.js +0 -1
- package/dist/assets/RecordDetailView-CP1b5rdr.js +0 -9
- package/dist/assets/RecordFormPage-CyAjEE1O.js +0 -1
- package/dist/assets/ReportDefaultInspector-BqgFtk2E.js +0 -3
- package/dist/assets/ReportView-CfQ-Z9TJ.js +0 -2
- package/dist/assets/SettingsHub-C-7kyHtx.js +0 -1
- package/dist/assets/SettingsView-HmY6cAH1.js +0 -1
- package/dist/assets/data-adapter-rnhaIuyx.js +0 -32
- package/dist/assets/framework-UESyszCj.js +0 -8
- package/dist/assets/index-AHnJRZYu.css +0 -2
- package/dist/assets/index-U6sSlA28.js +0 -2
- package/dist/assets/mermaid-GHXKKRXX-DicGABpj.js +0 -1
- package/dist/assets/metadata-admin-Ci8bBNxq.js +0 -25
- package/dist/assets/plugin-calendar-WGoi_n7i.js +0 -1
- package/dist/assets/plugin-charts-CK8c0x6J.js +0 -7
- package/dist/assets/plugin-dashboard-Cz2sTF7I.js +0 -6
- package/dist/assets/plugin-form-D_JAwPGr.js +0 -1
- package/dist/assets/plugin-gantt-BQGs0Vpj.js +0 -63
- package/dist/assets/plugin-grid-CKEYn10A.js +0 -8
- package/dist/assets/plugin-kanban-TdXxukPA.js +0 -1
- package/dist/assets/plugin-report-CPE7yyd4.js +0 -59
- package/dist/assets/plugin-tree-ieUxQVUL.js +0 -1
- package/dist/assets/plugin-view-Dy9ZzWYn.js +0 -1
- package/dist/assets/plugins-views-CJKuyDvq.js +0 -4
- package/dist/assets/src-CSrGzA_t.js +0 -19
- package/dist/assets/src-DzTCerTm.js +0 -1
- package/dist/assets/ui-components-BbC0qTrK.js +0 -72
- package/dist/assets/ui-layout-C3eKqnNJ.js +0 -1
- package/dist/assets/useOpenRecordList-aRVznRXU.js +0 -1
- package/dist/assets/useSettingsLabel-By0A6m6P.js +0 -1
- package/dist/assets/vendor-objectstack-CWf5hLam.js +0 -180
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,79 @@
|
|
|
1
1
|
# @objectstack/console
|
|
2
2
|
|
|
3
|
-
## 17.0.0-rc.
|
|
3
|
+
## 17.0.0-rc.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ce1155c: Console (objectui) refreshed to `f995a452d2ca`. Frontend changes in this range:
|
|
8
|
+
|
|
9
|
+
Derived from the changesets objectui declared over the range — 64 releasing of 65 changesets added across 98 non-merge commits; omitted: 1 release-nothing changeset, 33 commits carrying no changeset (they ship no package code).
|
|
10
|
+
|
|
11
|
+
- **minor** — The record detail page now shows a read-gated approval panel (#3461). A record in approval used to expose NOTHING about the running approval to anyone but the current pending appr… (objectui `5af285210`)
|
|
12
|
+
- **minor** — `DrillDownConfig` now declares only keys a renderer reads, and `target: 'navigate'` is honoured on charts too (#3354). (objectui `9e9e9a92f`)
|
|
13
|
+
- **minor** — Console chrome i18n gaps (objectstack#5407). (objectui `3889ffb4c`)
|
|
14
|
+
- **minor** — The console language choice now survives a reload. `I18nProvider` writes every language change to `localStorage` (`objectui-locale`, exported as `LOCALE_STORAGE_KEY`) and boots th… (objectui `0554e889c`)
|
|
15
|
+
- **minor** — `<ObjectChart>` declares `drillDown` as a registry input, so the SDUI save gate treats the segment drill as a contract prop instead of an unknown one (framework#5022). (objectui `524a6357b`)
|
|
16
|
+
- **minor** — The environment entitlement dialog now reads its context from `error.details.*` — the single declared location — and the flat dual-dialect tolerance is deleted (objectui#3329, the… (objectui `8ec406728`)
|
|
17
|
+
- **minor** — `@object-ui/core` now ships the server-action dispatcher factory — `createServerActionHandler({ fetch, baseUrl, resolveObject, ... })` — so any consumer of the runner (standalone… (objectui `5781fb15a`)
|
|
18
|
+
- **minor** — `AppSchemaRenderer` now derives area visibility from the items inside the area, closing the visible-but-empty regression the spec 17.0.0 area-key retirement left behind (objectui#… (objectui `608669eb5`)
|
|
19
|
+
- **minor** — Track `@objectstack/spec` 17.0.0-rc.2 (objectui#3235, #3208, #3287, #3264). (objectui `d22ae31ce`)
|
|
20
|
+
- **minor** — Field widgets no longer spread renderer-only props — or arbitrary keys from a field config — onto the DOM element they render (objectui#3291). (objectui `19b8c9be3`)
|
|
21
|
+
- **minor** — `RichTextField` honours `mobile_fullscreen`, so `mobile.fullscreenLongText` is finally true of rich text too (objectui#3301). (objectui `30ae33a77`)
|
|
22
|
+
- **minor** — `mobile.fullscreenLongText` finally reaches auto-generated long-text fields, and `mobile_fullscreen` gets one declared carrier (objectui#3245). (objectui `f44d8727f`)
|
|
23
|
+
- **minor** — **BREAKING (v17)** — The flow designer writes node geometry as the spec's `FlowNode.position`, not its own `ui: { x, y }` (objectui#3172). (objectui `6e794a19e`)
|
|
24
|
+
- **minor** — **BREAKING (v17)** — field widgets receive their metadata on ONE key, `field`. `schema` is removed from the widget contract (objectui#3233). (objectui `042e09d77`)
|
|
25
|
+
- **patch** — `UserFilters` no longer carries its own operator table when it lowers a `ViewTab.filter` preset into an ObjectQL AST node. The private `specOperatorToAst` was the second hand-kept… (objectui `d7f350a89`)
|
|
26
|
+
- **patch** — Name `CommentThread`'s three emoji-only buttons, and follow the session language past the 7-day mark (objectui#3441) (objectui `65516ba4a`)
|
|
27
|
+
- **patch** — `toFilterNode` now lowers a spec `ViewFilterRule[]` into ObjectQL AST nodes instead of returning the array verbatim, so a saved view's stored filter reaches `$filter` as something… (objectui `2a9513d81`)
|
|
28
|
+
- **patch** — Localize the create / edit / view form title `ObjectView` builds itself (objectui#3462) (objectui `28b2e6571`)
|
|
29
|
+
- **patch** — Localize the record-detail headings that `ObjectKanban`, `ObjectTree` and `ObjectView` build themselves (objectui#3459) (objectui `aa36e6073`)
|
|
30
|
+
- **patch** — Localize the record-detail overlay heading that `ListView` and `ObjectGrid` build themselves (objectui#3426) (objectui `61958416e`)
|
|
31
|
+
- **patch** — The close button that the `Sheet` and `Dialog` primitives auto-render now announces itself in the session locale instead of always in English. Both buttons are icon-only (a lucide… (objectui `71be40696`)
|
|
32
|
+
- **patch** — Localize `PresenceAvatars` — the avatar stack's accessible name and tooltips follow the session language (objectui#3440) (objectui `ca0fa8fab`)
|
|
33
|
+
- **patch** — `PageRenderer` no longer renders its own `<h1>` when the page authors a titled `page:header`, so a page has exactly one level-1 heading. Every non-record page used to render the p… (objectui `06632e9d1`)
|
|
34
|
+
- **patch** — Localize `@object-ui/collaboration` — `CommentThread` no longer hardcodes English (objectstack#5506) (objectui `94c5b7c4e`)
|
|
35
|
+
- **patch** — `TextAreaField`'s fullscreen edit dialog now gives screen reader users the character count it has always shown sighted ones. The dialog's footer counter was a bare `{n}/{max}` spa… (objectui `f789c3b3a`)
|
|
36
|
+
- **patch** — `ObjectDataPage`'s "Save as view" now folds the active URL drill conditions into `@objectstack/spec` `ViewFilterRule`s before persisting them, instead of writing the runtime filte… (objectui `875c5fafb`)
|
|
37
|
+
- **patch** — Localize `RecordDetailDrawer`'s drag-resize handle (objectstack#5733) (objectui `5a24ad9cb`)
|
|
38
|
+
- **patch** — The record picker's filter panel now sends the AUTHORED value of a picked `select` filter option instead of the control's stringified form. Radix `Select` speaks strings — options… (objectui `34d9169f6`)
|
|
39
|
+
- **patch** — Localize the record-overlay and tab-badge chrome that #5430's sweep left behind (objectstack#5506) (objectui `5dd012776`)
|
|
40
|
+
- **patch** — The lookup "Browse all records" Record Picker's filter panel now offers the options a `select` field declares in its schema (objectui#3336). `LookupField` turns each typed picker… (objectui `5881a2cc4`)
|
|
41
|
+
- **patch** — `TextAreaField`'s character counter no longer re-announces itself on every keystroke. Measured on `main` in a zh session with `maxLength: 500`, typing a 52-character sentence one… (objectui `789fe3ee2`)
|
|
42
|
+
- **patch** — Fix matrix report cells showing another bucket's numbers when dimension values run together. (objectui `509104a1b`)
|
|
43
|
+
- **patch** — Fix dataset pivot cells showing another row's numbers when a dimension value contains a space. (objectui `ce7cbe5af`)
|
|
44
|
+
- **patch** — Give `InlineCreateRelated`'s card-header close button an accessible name (objectui#3411 — the neighbouring defect found while implementing #3381/PR #3410, in the same file and lef… (objectui `58a00f0b4`)
|
|
45
|
+
- **patch** — Give `InlineCreateRelated`'s "Link Existing" search box a real accessible name (objectui#3381 — the neighbouring defect found while implementing #3341/PR #3380, and left out of th… (objectui `b17ce4c25`)
|
|
46
|
+
- **patch** — `TextAreaField`'s character counter now announces itself in the session locale. The counter block — rendered only when the field declares `maxLength` — carried the accessible name… (objectui `2409e1d04`)
|
|
47
|
+
- **patch** — fix(fields): translate the registered path's fullscreen long-text dialog (objectui#3404) (objectui `6fe485bf2`)
|
|
48
|
+
- **patch** — `TextAreaField` / `RichTextField` now honour `disabled` on their fullscreen editing path. `disabled` used to reach the inline control only: `showFullscreenButton` never consulted… (objectui `7d08c3feb`)
|
|
49
|
+
- **patch** — The form renderer's built-in `textarea` branch now honours `readonly` / `disabled` on its fullscreen exit, which previously bypassed both (objectui#3400). `renderFieldComponent` d… (objectui `fd54c3e7a`)
|
|
50
|
+
- **patch** — 表单内置 `textarea` 的全屏编辑对话框现在能拿到字段自己的 label:对话框标题显示字段名而不是恒定的通用词「编辑文本」,同一张表单上多个长文本字段的展开按钮也终于有了互不相同的无障碍名(objectui#3393)。 (objectui `85c4c9ce0`)
|
|
51
|
+
- **patch** — The form renderer's built-in `textarea` branch reads the fullscreen long-text flag on one spelling (objectui#3303). (objectui `9cbcbf478`)
|
|
52
|
+
- **patch** — The form renderer's last user-visible English literals now go through i18n (#3272). The fullscreen long-text editor (`mobile_fullscreen`) was an entire untranslated dialog — title… (objectui `4eeb932aa`)
|
|
53
|
+
- **patch** — Localize the last untranslated console-chrome accessible names (objectstack#5430) (objectui `b71fc92f3`)
|
|
54
|
+
- **patch** — `ObjectGantt`'s quick-filter bar is now localized instead of pinned to Chinese. The four `QuickFilterBar` labels (`all`, `clear`, `empty`, `resultSummary`) were hardcoded as Chine… (objectui `5c856ecb5`)
|
|
55
|
+
- **patch** — Associate the label with its control at the two form surfaces where the two were never programmatically connected (objectui#3341 — found while implementing #3299/PR #3340, and del… (objectui `53811d179`)
|
|
56
|
+
- **patch** — `ActionEngine.getActionsForLocation` now evaluates a `{ dialect: 'cel', source }` action `visible` predicate on the canonical `@objectstack/formula` engine instead of the legacy J… (objectui `18cd43289`)
|
|
57
|
+
- **patch** — Settings pages read the declared `{ success, data }` response envelope, so the whole Setup → Configuration section works again against a framework#3843 server (objectui#3366). (objectui `7d0c6de39`)
|
|
58
|
+
- **patch** — The flow designer no longer seeds new `wait` nodes with the retired `waitEventConfig.onTimeout` (objectui#3316). (objectui `35da149c5`)
|
|
59
|
+
- **patch** — Gallery covers now resolve the `coverField` value through its **file value shape** instead of assuming the field value _is_ a URL string, so an ADR-0104-conforming `image` value r… (objectui `978705c8f`)
|
|
60
|
+
- **patch** — The list toolbar's "Filter" now saves. Saving a filter from the runtime toolbar PUT the FilterBuilder's whole group object (`{ id, logic, conditions }`) into the view's `filter`,… (objectui `68b6a2855`)
|
|
61
|
+
- **patch** — The lookup "Browse all records" Record Picker now formats its columns with the same field metadata the list view uses (objectui#3333). Previously the dialog handed cell renderers… (objectui `9bc3709b9`)
|
|
62
|
+
- **patch** — Behavior change — **an authored display `type` can NARROW inline editability, but never WIDEN it** (objectui#3355). (objectui `bbbde1207`)
|
|
63
|
+
- **patch** — `record:highlights` now honours a `readonly: true` on an authored field entry, so a header chip for a platform-owned column no longer offers inline edit. `HeaderHighlight`'s edita… (objectui `23018cc03`)
|
|
64
|
+
- **patch** — Deliver the required state to the control in the five renderers outside the object form that still painted it as an asterisk only (objectui#3299 — the same defect #3290/#3298 fixe… (objectui `532cf8b9e`)
|
|
65
|
+
- **patch** — The Combobox trigger now declares `type="button"` explicitly, so it can never submit an enclosing `<form>` (objectui#3344). The current Radix `PopoverTrigger` happens to supply `t… (objectui `34595eb45`)
|
|
66
|
+
- **patch** — `TagsField` no longer ships a hardcoded Chinese input placeholder (objectui#3342, AGENTS.md Commandment #-1). The placeholder now resolves through the pinned chain: the author-dec… (objectui `c7ed4c366`)
|
|
67
|
+
- **patch** — AddressField / GeolocationField sub-inputs now derive their DOM ids from a `useId()` prefix + sub-field name (the RadioField / CheckboxesField `groupId` paradigm) instead of hardc… (objectui `b7165ce47`)
|
|
68
|
+
- **patch** — 20 more registered field widgets now announce a failed validation to assistive tech: `multiselect`, `radio`, `checkboxes`, `tags`, `lookup`, `master_detail`, `user`, `owner`, `fil… (objectui `8d8094a7c`)
|
|
69
|
+
- **patch** — `field:permission-facet-link` now registers through `withFieldCarrier` — the repo's only raw `field:` registration bypassed the single-metadata-carrier seam (objectui#3233), so un… (objectui `c7fba276e`)
|
|
70
|
+
- **patch** — The console server-action wrapper's `opensInNewTab` choreography no longer ships hard-coded bilingual Chinese/English copy (objectui#3321, AGENTS.md Commandment #-1): the pre-open… (objectui `a41568462`)
|
|
71
|
+
- **patch** — `AppSidebar` and `UnifiedSidebar` area switchers now adopt the derived area visibility introduced for `AppSchemaRenderer` in objectui#3311, closing the same visible-but-empty gap… (objectui `8d9984c2e`)
|
|
72
|
+
- **patch** — RecordDetailView's `type:'modal'` dispatch no longer falls back to the server-side action handler when the target resolves to neither a page nor an object. That fallthrough could… (objectui `94755bb88`)
|
|
73
|
+
- **patch** — `field:select` now announces its validation state to assistive tech: the widget's DOM pass-through lands on the Radix `SelectTrigger` — the focusable `<button role="combobox">` a… (objectui `49f7449f9`)
|
|
74
|
+
- **patch** — The required state now reaches the input control as `aria-required`, instead of existing only as part of the control's accessible name (objectui#3290). (objectui `680080ada`)
|
|
75
|
+
|
|
76
|
+
objectui range: `f5bc4c78be76...f995a452d2ca`
|
|
4
77
|
|
|
5
78
|
## 17.0.0-rc.2
|
|
6
79
|
|
package/dist/.objectui-sha
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f995a452d2ca97fcc4b92ec6d004ee5571f3d6b7
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{y as r}from"./infrastructure-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{y as r}from"./infrastructure-BKCMsWnH.js";import{j as i}from"./framework-s0wcPYfi.js";import{ol as a}from"./ui-components-BFOT5Gog.js";import{r as o}from"./vendor-ui-utils-CnzHPXVC.js";import{t as s}from"./data-adapter-Bh8GerYu.js";var c=e(n(),1),l=0,u=new Set,d=[];function f(){for(let e of u)try{e(l)}catch{}if(l===0&&d.length>0){let e=d;d=[];for(let t of e)try{t()}catch{}}}function p(){l+=1,f()}function m(){l=Math.max(0,l-1),f()}function h(){return l}function g(){return l===0}function _(e){return u.add(e),()=>{u.delete(e)}}function v(e=1e4){return l===0?Promise.resolve():new Promise(t=>{let n=!1,r=()=>{n||(n=!0,t())};d.push(r),e>0&&typeof setTimeout<`u`&&setTimeout(r,e)})}function y(e){return(async(...t)=>{p();try{return await e(...t)}finally{m()}})}function b(){if(typeof window>`u`)return;let e=window,t=e.__objectui??={};Object.defineProperty(t,"pendingRequests",{get:h,configurable:!0}),Object.defineProperty(t,"idle",{get:g,configurable:!0}),t.whenIdle=v,t.subscribe=_}var x=t();function S(e,t){let n=new Map;for(let t of e.droppedFields){let e=n.get(t.reason)??[];for(let n of t.fields)e.includes(n)||e.push(n);n.set(t.reason,e)}let r=[];for(let[e,i]of n){if(i.length===0)continue;let n=i.join(`, `);r.push(e===`readonly_when`?t(`detail.writeStrippedByState`,{fields:n,defaultValue:`Not editable in this record's current state, so it was not saved: {{fields}}`}):t(`detail.writeStrippedReadonly`,{fields:n,defaultValue:`Read-only, so it was not saved: {{fields}}`}))}r.length!==0&&o.warning(t(`detail.writeStrippedTitle`,{defaultValue:`Some fields were not saved`}),{description:r.join(`
|
|
2
2
|
`)})}function C({children:e,adapter:t}){let[n,o]=(0,c.useState)(t??null),{t:l}=a(),u=(0,c.useRef)(l);return u.current=l,(0,c.useEffect)(()=>{if(t){o(t);return}let e=!1,n;b();async function i(){try{let t=new s({baseUrl:``,fetch:y(r()),autoReconnect:!0,maxReconnectAttempts:5,reconnectDelay:1e3,cache:{maxSize:50,ttl:3e5}});n=t.onWriteWarning(e=>S(e,u.current)),await t.connect(),e||o(t)}catch(t){e||console.error(`[Console] Failed to initialize:`,t)}}return i(),()=>{e=!0,n?.()}},[t]),(0,x.jsx)(i.Provider,{value:n,children:e})}export{y as n,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{n as r}from"./plugin-chatbot-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{n as r}from"./plugin-chatbot-CEj8h-9I.js";var i=e(n(),1),a=t();function o(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SENTRY_DSN:`https://1373a588ceb9da150b11e64bf85f583d@o4510356161757184.ingest.us.sentry.io/4511439670673408`,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_SEND_DEFAULT_PII:`true`,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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{N as r,g as i}from"./framework-UESyszCj.js";import{Cr as a,Ji as o,Kr as s,Ms as c,Ro as l,_a as u,ac as d,di as f,ha as p,hr as m,ic as h,mr as g,nc as _,oa as v,oo as y,pr as b,ws as ee}from"./ui-components-BbC0qTrK.js";import"./src-CSrGzA_t.js";var x=e(n(),1),S=[`plugin`,`plugins`,`kind`,`package`];function C(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 w={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)`}]},workflow:{group:`Workflow`,defaultRoute:`/api/v1/workflow`,endpoints:[{method:`GET`,path:`/:object/config`,desc:`Get workflow configuration`},{method:`GET`,path:`/:object/:recordId/state`,desc:`Get workflow state`},{method:`POST`,path:`/:object/:recordId/transition`,desc:`Execute workflow transition`,bodyTemplate:{targetState:``}},{method:`POST`,path:`/:object/:recordId/approve`,desc:`Approve workflow step`,bodyTemplate:{comment:``}},{method:`POST`,path:`/:object/:recordId/reject`,desc:`Reject workflow step`,bodyTemplate:{comment:``}}]},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`}]},feed:{group:`Feed`,defaultRoute:`/api/v1/feed`,endpoints:[{method:`GET`,path:`/:object/:recordId`,desc:`Get feed items`},{method:`POST`,path:`/:object/:recordId`,desc:`Post feed item`,bodyTemplate:{body:``}}]},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`}]}};function T(e,t){let n=w[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 te(){let e=r(),[t,n]=(0,x.useState)([]),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(!0),[l,u]=(0,x.useState)(null),d=(0,x.useCallback)(async()=>{c(!0),u(null);let t=`/api/v1`,r=`${t}/discovery`,a=[{method:`GET`,path:r,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(r);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(w)){let n=c[e],r=n?i(n):!1,a=n?.route??l[e]??t.defaultRoute;r&&u.push(...T(e,a))}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=>!S.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,...C(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,x.useEffect)(()=>{d()},[d]),{groups:t,allEndpoints:a,loading:s,error:l,refresh:d}}var E=t(),D={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`},ne={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`},re=[{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`}],O=1;function k(){let e=r()?.getClient?.(),{groups:t,loading:n,refresh:i}=te(),[S,C]=(0,x.useState)(``),[w,T]=(0,x.useState)(new Set),[k,A]=(0,x.useState)(null),[ie,j]=(0,x.useState)(``),[ae,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(``),[F,I]=(0,x.useState)([]),[L,R]=(0,x.useState)(!1),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)([]),[U,oe]=(0,x.useState)(null),[W,G]=(0,x.useState)(!1),K=(0,x.useMemo)(()=>{if(!S)return t;let e=S.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,S]),se=(0,x.useCallback)(e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),ce=(0,x.useCallback)(e=>{A(e),j(e.method),M(e.path),P(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),I([]),B(null)},[]),q=ie||k?.method||`GET`,J=ae||k?.path||``,Y=(0,x.useMemo)(()=>{let e=F.filter(e=>e.enabled&&e.key.trim());if(e.length===0)return J;let t=e.map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join(`&`);return`${J}?${t}`},[J,F]),X=(0,x.useCallback)((e=``,t=``)=>{I(n=>[...n,{id:O++,key:e,value:t,enabled:!0}])},[]),le=(0,x.useCallback)(e=>{I(t=>t.filter(t=>t.id!==e))},[]),Z=(0,x.useCallback)((e,t,n)=>{I(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),ue=(0,x.useCallback)(e=>{I(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t))},[]),Q=(0,x.useCallback)(async()=>{if(L||!Y)return;let t=`${e?.baseUrl??``}${Y}`;R(!0);let n=performance.now();try{let e={method:q,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`,`PUT`].includes(q)&&N.trim()&&(e.body=N);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};B(o),H(e=>[{id:Date.now(),method:q,url:Y,body:N||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);B({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{R(!1)}},[e,Y,q,N,L]),de=(0,x.useCallback)(e=>{j(e.method);let[t,n]=e.url.split(`?`);if(M(t),P(e.body||``),n){let e=new URLSearchParams(n),t=[];e.forEach((e,n)=>{t.push({id:O++,key:n,value:e,enabled:!0})}),I(t)}else I([]);B(null),A(null)},[]),fe=(0,x.useCallback)(()=>{z?.body&&(navigator.clipboard.writeText(z.body),G(!0),setTimeout(()=>G(!1),1500))},[z]),$=e=>ne[String(e)[0]]??`text-muted-foreground`;return(0,E.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,E.jsx)(`button`,{onClick:i,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,E.jsx)(v,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(o,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,E.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(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,E.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,E.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(y,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):K.length===0?(0,E.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(l,{className:`h-6 w-6 opacity-30 mb-2`}),(0,E.jsx)(`span`,{children:S?`No matching endpoints`:`No endpoints found`})]}):K.map(e=>{let t=w.has(e.key)||!!S;return(0,E.jsxs)(b,{open:t,onOpenChange:()=>se(e.key),children:[(0,E.jsx)(m,{asChild:!0,children:(0,E.jsxs)(`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,E.jsx)(_,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,E.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,E.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,E.jsx)(g,{children:(0,E.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,E.jsxs)(`button`,{onClick:()=>ce(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${k===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,E.jsx)(a,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${D[e.method]||``}`,children:e.method}),(0,E.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,E.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,E.jsxs)(`button`,{onClick:()=>X(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,E.jsx)(p,{className:`h-3 w-3`}),`Add`]})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:re.map(e=>(0,E.jsx)(`button`,{onClick:()=>X(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))}),F.length>0&&(0,E.jsx)(`div`,{className:`space-y-1`,children:F.map(e=>(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>ue(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,E.jsx)(`input`,{type:`text`,value:e.key,onChange:t=>Z(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,E.jsx)(`input`,{type:`text`,value:e.value,onChange:t=>Z(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,E.jsx)(`button`,{onClick:()=>le(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,E.jsx)(s,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`select`,{value:q,onChange:e=>j(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 ${D[q]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))}),(0,E.jsx)(`input`,{type:`text`,value:J,onChange:e=>M(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`&&Q()}}),(0,E.jsxs)(`button`,{onClick:Q,disabled:L||!Y,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:[L?(0,E.jsx)(y,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(u,{className:`h-3.5 w-3.5`}),`Send`]})]}),F.some(e=>e.enabled&&e.key.trim())&&(0,E.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,Y]})]}),(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(q)&&(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,E.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,E.jsx)(`textarea`,{value:N,onChange:e=>P(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" }`})]}),L&&(0,E.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(y,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),z&&!L&&(0,E.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,E.jsx)(`span`,{className:`font-mono font-semibold ${$(z.status)}`,children:z.status||`ERR`}),(0,E.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,E.jsx)(c,{className:`h-3 w-3`}),z.duration,`ms`]})]}),(0,E.jsxs)(`button`,{onClick:fe,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[W?(0,E.jsx)(d,{className:`h-3 w-3`}):(0,E.jsx)(ee,{className:`h-3 w-3`}),W?`Copied`:`Copy`]})]}),(0,E.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:z.body})]}),!z&&!L&&(0,E.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,E.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,E.jsx)(l,{className:`h-10 w-10 mx-auto opacity-20`}),(0,E.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,E.jsx)(`strong`,{children:`Send`})]}),(0,E.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),V.length>0&&(0,E.jsxs)(`div`,{className:`border-t`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,E.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,V.length,`)`]}),(0,E.jsxs)(`button`,{onClick:()=>H([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,E.jsx)(f,{className:`h-3 w-3`}),`Clear`]})]}),(0,E.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:V.map(e=>(0,E.jsxs)(`div`,{className:`rounded border`,children:[(0,E.jsxs)(`button`,{onClick:()=>oe(U===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:[U===e.id?(0,E.jsx)(h,{className:`h-3 w-3 shrink-0`}):(0,E.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(a,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${D[e.method]||``}`,children:e.method}),(0,E.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${$(e.status)}`,children:e.status}),(0,E.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,E.jsx)(`button`,{onClick:t=>{t.stopPropagation(),de(e)},className:`shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,title:`Replay request`,children:(0,E.jsx)(u,{className:`h-2.5 w-2.5`})})]}),U===e.id&&(0,E.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{k as ApiConsolePage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{N as r,g as i}from"./framework-s0wcPYfi.js";import{Er as a,Ho as o,Is as s,Os as c,Qi as l,Yr as u,_r as d,cc as f,gr as p,lc as m,mi as h,oc as g,ua as _,uo as v,vr as y,xa as b,ya as ee}from"./ui-components-BFOT5Gog.js";import"./src--uGAhLxY.js";var x=e(n(),1),S=[`plugin`,`plugins`,`kind`,`package`];function C(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 w={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)`}]},workflow:{group:`Workflow`,defaultRoute:`/api/v1/workflow`,endpoints:[{method:`GET`,path:`/:object/config`,desc:`Get workflow configuration`},{method:`GET`,path:`/:object/:recordId/state`,desc:`Get workflow state`},{method:`POST`,path:`/:object/:recordId/transition`,desc:`Execute workflow transition`,bodyTemplate:{targetState:``}},{method:`POST`,path:`/:object/:recordId/approve`,desc:`Approve workflow step`,bodyTemplate:{comment:``}},{method:`POST`,path:`/:object/:recordId/reject`,desc:`Reject workflow step`,bodyTemplate:{comment:``}}]},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`}]},feed:{group:`Feed`,defaultRoute:`/api/v1/feed`,endpoints:[{method:`GET`,path:`/:object/:recordId`,desc:`Get feed items`},{method:`POST`,path:`/:object/:recordId`,desc:`Post feed item`,bodyTemplate:{body:``}}]},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`}]}};function T(e,t){let n=w[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 te(){let e=r(),[t,n]=(0,x.useState)([]),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(!0),[l,u]=(0,x.useState)(null),d=(0,x.useCallback)(async()=>{c(!0),u(null);let t=`/api/v1`,r=`${t}/discovery`,a=[{method:`GET`,path:r,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(r);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(w)){let n=c[e],r=n?i(n):!1,a=n?.route??l[e]??t.defaultRoute;r&&u.push(...T(e,a))}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=>!S.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,...C(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,x.useEffect)(()=>{d()},[d]),{groups:t,allEndpoints:a,loading:s,error:l,refresh:d}}var E=t(),D={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`},ne={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`},re=[{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`}],O=1;function k(){let e=r()?.getClient?.(),{groups:t,loading:n,refresh:i}=te(),[S,C]=(0,x.useState)(``),[w,T]=(0,x.useState)(new Set),[k,A]=(0,x.useState)(null),[ie,j]=(0,x.useState)(``),[ae,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(``),[F,I]=(0,x.useState)([]),[L,R]=(0,x.useState)(!1),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)([]),[U,oe]=(0,x.useState)(null),[W,G]=(0,x.useState)(!1),K=(0,x.useMemo)(()=>{if(!S)return t;let e=S.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,S]),se=(0,x.useCallback)(e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),ce=(0,x.useCallback)(e=>{A(e),j(e.method),M(e.path),P(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),I([]),B(null)},[]),q=ie||k?.method||`GET`,J=ae||k?.path||``,Y=(0,x.useMemo)(()=>{let e=F.filter(e=>e.enabled&&e.key.trim());if(e.length===0)return J;let t=e.map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join(`&`);return`${J}?${t}`},[J,F]),X=(0,x.useCallback)((e=``,t=``)=>{I(n=>[...n,{id:O++,key:e,value:t,enabled:!0}])},[]),le=(0,x.useCallback)(e=>{I(t=>t.filter(t=>t.id!==e))},[]),Z=(0,x.useCallback)((e,t,n)=>{I(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),ue=(0,x.useCallback)(e=>{I(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t))},[]),Q=(0,x.useCallback)(async()=>{if(L||!Y)return;let t=`${e?.baseUrl??``}${Y}`;R(!0);let n=performance.now();try{let e={method:q,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`,`PUT`].includes(q)&&N.trim()&&(e.body=N);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};B(o),H(e=>[{id:Date.now(),method:q,url:Y,body:N||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);B({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{R(!1)}},[e,Y,q,N,L]),de=(0,x.useCallback)(e=>{j(e.method);let[t,n]=e.url.split(`?`);if(M(t),P(e.body||``),n){let e=new URLSearchParams(n),t=[];e.forEach((e,n)=>{t.push({id:O++,key:n,value:e,enabled:!0})}),I(t)}else I([]);B(null),A(null)},[]),fe=(0,x.useCallback)(()=>{z?.body&&(navigator.clipboard.writeText(z.body),G(!0),setTimeout(()=>G(!1),1500))},[z]),$=e=>ne[String(e)[0]]??`text-muted-foreground`;return(0,E.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,E.jsx)(`button`,{onClick:i,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,E.jsx)(_,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(l,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,E.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(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,E.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,E.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(v,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):K.length===0?(0,E.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(o,{className:`h-6 w-6 opacity-30 mb-2`}),(0,E.jsx)(`span`,{children:S?`No matching endpoints`:`No endpoints found`})]}):K.map(e=>{let t=w.has(e.key)||!!S;return(0,E.jsxs)(p,{open:t,onOpenChange:()=>se(e.key),children:[(0,E.jsx)(y,{asChild:!0,children:(0,E.jsxs)(`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,E.jsx)(g,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,E.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,E.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,E.jsx)(d,{children:(0,E.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,E.jsxs)(`button`,{onClick:()=>ce(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${k===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,E.jsx)(a,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${D[e.method]||``}`,children:e.method}),(0,E.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,E.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,E.jsxs)(`button`,{onClick:()=>X(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,E.jsx)(ee,{className:`h-3 w-3`}),`Add`]})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:re.map(e=>(0,E.jsx)(`button`,{onClick:()=>X(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))}),F.length>0&&(0,E.jsx)(`div`,{className:`space-y-1`,children:F.map(e=>(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>ue(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,E.jsx)(`input`,{type:`text`,value:e.key,onChange:t=>Z(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,E.jsx)(`input`,{type:`text`,value:e.value,onChange:t=>Z(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,E.jsx)(`button`,{onClick:()=>le(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,E.jsx)(u,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`select`,{value:q,onChange:e=>j(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 ${D[q]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))}),(0,E.jsx)(`input`,{type:`text`,value:J,onChange:e=>M(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`&&Q()}}),(0,E.jsxs)(`button`,{onClick:Q,disabled:L||!Y,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:[L?(0,E.jsx)(v,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(b,{className:`h-3.5 w-3.5`}),`Send`]})]}),F.some(e=>e.enabled&&e.key.trim())&&(0,E.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,Y]})]}),(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(q)&&(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,E.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,E.jsx)(`textarea`,{value:N,onChange:e=>P(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" }`})]}),L&&(0,E.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(v,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),z&&!L&&(0,E.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,E.jsx)(`span`,{className:`font-mono font-semibold ${$(z.status)}`,children:z.status||`ERR`}),(0,E.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,E.jsx)(s,{className:`h-3 w-3`}),z.duration,`ms`]})]}),(0,E.jsxs)(`button`,{onClick:fe,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[W?(0,E.jsx)(m,{className:`h-3 w-3`}):(0,E.jsx)(c,{className:`h-3 w-3`}),W?`Copied`:`Copy`]})]}),(0,E.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:z.body})]}),!z&&!L&&(0,E.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,E.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,E.jsx)(o,{className:`h-10 w-10 mx-auto opacity-20`}),(0,E.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,E.jsx)(`strong`,{children:`Send`})]}),(0,E.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),V.length>0&&(0,E.jsxs)(`div`,{className:`border-t`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,E.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,V.length,`)`]}),(0,E.jsxs)(`button`,{onClick:()=>H([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,E.jsx)(h,{className:`h-3 w-3`}),`Clear`]})]}),(0,E.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:V.map(e=>(0,E.jsxs)(`div`,{className:`rounded border`,children:[(0,E.jsxs)(`button`,{onClick:()=>oe(U===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:[U===e.id?(0,E.jsx)(f,{className:`h-3 w-3 shrink-0`}):(0,E.jsx)(g,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(a,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${D[e.method]||``}`,children:e.method}),(0,E.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${$(e.status)}`,children:e.status}),(0,E.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,E.jsx)(`button`,{onClick:t=>{t.stopPropagation(),de(e)},className:`shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,title:`Replay request`,children:(0,E.jsx)(b,{className:`h-2.5 w-2.5`})})]}),U===e.id&&(0,E.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{k as ApiConsolePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,m as n,r,s as i,y as a}from"./vendor-react-DpRf6e0g.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,m as n,r,s as i,y as a}from"./vendor-react-DpRf6e0g.js";import{Ac as o,uo as s}from"./ui-components-BFOT5Gog.js";import{t as c}from"./DocShell-DvmmtwpW.js";import{a as l,c as u,n as d}from"./use-book-data-BIflvfeG.js";var f=e(a(),1),p=r();function m(){let{appName:e}=n(),{books:r,docs:a,state:m}=d(),h=(0,f.useMemo)(()=>r.filter(t=>u(t)===e),[r,e]),g=(0,f.useMemo)(()=>l(h,a),[h,a]);return m===`loading`?(0,p.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,p.jsx)(s,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):g.length===1?(0,p.jsx)(i,{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)(o,{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)(o,{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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{f as t,m as n,r,y as i}from"./vendor-react-DpRf6e0g.js";import{P as a}from"./framework-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{f as t,m as n,r,y as i}from"./vendor-react-DpRf6e0g.js";import{P as a}from"./framework-s0wcPYfi.js";import{Ai as o,Ea as s,Er as c,Hr as l,On as u,Qi as d,Ri as f,_s as p,bo as m,br as h,gi as g,hi as _,mi as v,xr as y,ya as b,yr as x}from"./ui-components-BFOT5Gog.js";import{r as S}from"./vendor-ui-utils-CnzHPXVC.js";import"./src--uGAhLxY.js";var C=e(i(),1);function w(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 T=r();function E(){let e=t(),{appName:r}=n(),i=r?`/apps/${r}`:``,{apps:E,refresh:D}=a(),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(new Set),[M,N]=(0,C.useState)(null),[P,F]=(0,C.useState)(!1),I=(E||[]).filter(e=>{if(!O)return!0;let t=O.toLowerCase();return(e.name||``).toLowerCase().includes(t)||(e.label||``).toLowerCase().includes(t)||(e.description||``).toLowerCase().includes(t)}),L=(0,C.useCallback)(e=>{j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),R=(0,C.useCallback)(()=>{A.size===I.length?j(new Set):j(new Set(I.map(e=>e.name)))},[A.size,I]),z=(0,C.useCallback)(async e=>{F(!0);try{let t=e.active===!1;S.success(`${e.label||e.name} ${t?`enabled`:`disabled`}`),await D()}catch{S.error(`Failed to toggle app status`)}finally{F(!1)}},[D]),B=(0,C.useCallback)(async e=>{F(!0);try{S.success(`${e.label||e.name} set as default`),await D()}catch{S.error(`Failed to set default app`)}finally{F(!1)}},[D]),V=(0,C.useCallback)(async e=>{if(M!==e.name){N(e.name);return}F(!0);try{S.success(`${e.label||e.name} deleted`),N(null),await D()}catch{S.error(`Failed to delete app`)}finally{F(!1)}},[M,D]),H=(0,C.useCallback)(async e=>{F(!0);try{S.success(`${A.size} apps ${e?`enabled`:`disabled`}`),j(new Set),await D()}catch{S.error(`Bulk operation failed`)}finally{F(!1)}},[A,D]);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Applications`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage all configured applications`})]}),(0,T.jsxs)(l,{onClick:()=>e(`${i}/create-app`),"data-testid":`create-app-btn`,children:[(0,T.jsx)(b,{className:`h-4 w-4 mr-2`}),`New App`]})]}),(0,T.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[(0,T.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,T.jsx)(`label`,{htmlFor:`app-search`,className:`sr-only`,children:`Search apps`}),(0,T.jsx)(d,{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,T.jsx)(u,{id:`app-search`,placeholder:`Search apps...`,value:O,onChange:e=>k(e.target.value),className:`pl-8`,"data-testid":`app-search-input`})]}),A.size>0&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(c,{variant:`secondary`,children:[A.size,` selected`]}),(0,T.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>H(!0),disabled:P,children:`Enable`}),(0,T.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>H(!1),disabled:P,children:`Disable`})]})]}),I.length>0&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,T.jsx)(x,{id:`select-all-apps`,checked:A.size===I.length&&I.length>0,onCheckedChange:()=>R()}),(0,T.jsxs)(`label`,{htmlFor:`select-all-apps`,className:`cursor-pointer`,children:[`Select all (`,I.length,`)`]})]}),I.length===0?(0,T.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,"data-testid":`no-apps-message`,children:[(0,T.jsx)(m,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,T.jsx)(`p`,{children:`No apps found.`})]}):(0,T.jsx)(`div`,{className:`grid gap-3`,children:I.map(t=>{let n=t.active!==!1,r=t.isDefault===!0,a=M===t.name;return(0,T.jsx)(h,{className:n?``:`opacity-60`,"data-testid":`app-card-${t.name}`,children:(0,T.jsxs)(y,{className:`flex items-center gap-3 py-3 px-4`,children:[(0,T.jsx)(x,{id:`select-app-${t.name}`,checked:A.has(t.name),onCheckedChange:()=>L(t.name),"aria-label":`Select ${t.label||t.name}`,className:`shrink-0`}),(0,T.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,T.jsx)(m,{className:`h-4 w-4`})}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-medium truncate`,children:w(t.label)||t.name}),r&&(0,T.jsx)(c,{variant:`default`,className:`text-xs`,children:`Default`}),(0,T.jsx)(c,{variant:n?`secondary`:`outline`,className:`text-xs`,children:n?`Active`:`Inactive`})]}),t.description&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:w(t.description)})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,T.jsx)(l,{variant:`ghost`,size:`icon`,title:`Open app`,"aria-label":`Open ${t.label||t.name}`,onClick:()=>e(`/apps/${t._packageId??t.name}`),children:(0,T.jsx)(p,{className:`h-4 w-4`})}),(0,T.jsx)(l,{variant:`ghost`,size:`icon`,title:`Edit app`,"aria-label":`Edit ${t.label||t.name}`,onClick:()=>e(`${i}/edit-app/${t.name}`),children:(0,T.jsx)(s,{className:`h-4 w-4`})}),t._packageId?(0,T.jsx)(l,{variant:`ghost`,size:`icon`,title:`Edit with AI`,"aria-label":`Edit ${t.label||t.name} with AI`,onClick:()=>e(`/ai/build?package=${encodeURIComponent(t._packageId)}&new=1`),children:(0,T.jsx)(f,{className:`h-4 w-4`})}):null,(0,T.jsx)(l,{variant:`ghost`,size:`icon`,title:n?`Disable app`:`Enable app`,"aria-label":n?`Disable ${t.label||t.name}`:`Enable ${t.label||t.name}`,onClick:()=>z(t),disabled:P,children:n?(0,T.jsx)(_,{className:`h-4 w-4`}):(0,T.jsx)(g,{className:`h-4 w-4`})}),(0,T.jsx)(l,{variant:`ghost`,size:`icon`,title:`Set as default`,"aria-label":`Set ${t.label||t.name} as default`,onClick:()=>B(t),disabled:P||r,children:(0,T.jsx)(o,{className:`h-4 w-4 ${r?`fill-current text-yellow-500`:``}`})}),(0,T.jsx)(l,{variant:`ghost`,size:`icon`,title:a?`Click again to confirm delete`:`Delete app`,"aria-label":a?`Confirm delete ${t.label||t.name}`:`Delete ${t.label||t.name}`,onClick:()=>V(t),disabled:P,className:a?`text-destructive`:``,children:(0,T.jsx)(v,{className:`h-4 w-4`})})]})]})},t.name)})})]})}export{E as AppManagementPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,h as n,m as r,r as i,y as a}from"./vendor-react-DpRf6e0g.js";import{_ as o,b as s,y as ee}from"./infrastructure-BKCMsWnH.js";import{Ar as te,Bc as ne,Br as re,Bt as ie,Er as c,Fr as ae,Ft as oe,Hr as l,Hs as se,Ii as ce,Ir as le,Is as ue,It as de,Lr as fe,Lt as pe,Mt as me,Nr as he,Nt as ge,Oa as _e,On as ve,Os as ye,Pr as be,Pt as xe,Qi as Se,Rr as Ce,Rt as u,Vr as we,Vs as Te,Vt as Ee,Yc as d,Yr as De,Zi as Oe,Zr as ke,Zs as Ae,_n as je,_s as Me,bn as Ne,br as Pe,cn as f,dn as Fe,dt as Ie,ec as Le,fn as Re,gn as ze,hn as Be,ii as Ve,jr as He,lc as Ue,mn as We,mt as Ge,oc as Ke,ol as qe,pn as Je,sc as Ye,ua as Xe,un as Ze,ut as Qe,vn as p,xr as $e,yn as et,yr as tt,zr as nt,zt as m}from"./ui-components-BFOT5Gog.js";import{r as h}from"./vendor-ui-utils-CnzHPXVC.js";import{p as rt}from"./src--uGAhLxY.js";var g=e(a(),1),it=`${``.replace(/\/$/,``)}/api/v1`;async function _(e,t){let n=s.get(),r=await fetch(`${it}${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 at(e){if(!e)return[];let t=new Set;e.id&&t.add(e.id),e.email&&t.add(e.email);let n=[...e.roles||[],...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)}var y=i(),ot=50,b={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 st({status:e,label:t}){return(0,y.jsx)(c,{variant:`outline`,className:d(`font-medium`,b[e]??``),children:t})}function ct(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function x(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 S(e){return e&&String(e).replace(/^flow:/,``).trim().split(/[_\-\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||`—`}function C(e){return e.process_label||S(e.process_name)}function lt(e){return e.step_label?e.step_label:e.current_step?S(e.current_step):null}function ut(e){return e.submitter_name||x(e.submitter_id)}function dt(e,t){return t.pending_approver_names?.[e]||x(e)}function w(e,t){let n=t.pending_approver_groups?.[e];return n&&n.length?n.join(` / `):void 0}function ft(e){let t=[],n=new Map;for(let r of e.pending_approvers||[]){let i=dt(r,e),a=w(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 pt(e){if(e.submitter_name)return!1;let t=(e.submitter_id||``).trim();return!t||t.startsWith(`flow:`)||t.startsWith(`system:`)}function mt(e){return e.object_label||e.object_name}function T(e){return e.submitted_at||e.created_at||void 0}function ht(e,t){let n=T(e);if(!n)return null;let r=Date.parse(n);return Number.isNaN(r)?null:(t-r)/36e5}function gt(e,t){if(e.status!==`pending`)return`text-muted-foreground`;let n=ht(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 _t(e){let t=Math.max(1,Math.round(Math.abs(e)/36e5));return t<48?`${t}h`:`${Math.round(t/24)}d`}function vt(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 E=new Set([`id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`organization_id`]);function D(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 O(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 yt=/^[A-Za-z0-9_-]{15,}$/;function bt(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(E.has(o)||i&&o===i||s==null||typeof s==`object`||String(s).trim()===``)continue;let e=t?.[o];if(!(!e&&typeof s==`string`&&yt.test(s.trim())&&!/^\d+$/.test(s.trim()))&&(a.push([n?.[o]??D(o),e??O(o,s)]),a.length>=r))break}return a}var xt=/(amount|total|price|value|cost|sum|budget|salary|fee|revenue|balance|金额|总额|价格|费用|预算|金额)/i;function St(e){let t=e.payload;if(!t||typeof t!=`object`||Array.isArray(t))return null;for(let[n,r]of Object.entries(t)){if(E.has(n)||!xt.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]??D(n),value:t,display:e.payload_display?.[n]??t.toLocaleString()}}return null}function k(){let{t:e,language:i}=qe(),{user:a}=o(),{appName:s}=r(),[it,_]=n(),b=(0,g.useMemo)(()=>at(a),[a]),S=(0,g.useCallback)((t,n,r)=>String(e(`approvalsInbox.${t}`,{defaultValue:n,...r})),[e]),[w,ht]=(0,g.useState)(()=>Date.now());(0,g.useEffect)(()=>{let e=setInterval(()=>ht(Date.now()),6e4);return()=>clearInterval(e)},[]);let E=(0,g.useCallback)(e=>{if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Math.round((w-t)/1e3);if(n<45)return S(`justNow`,`just now`);let r=Math.round(n/60);if(r<60)return S(`minutesAgo`,`{{count}}m ago`,{count:r});let a=Math.round(r/60);if(a<24)return S(`hoursAgo`,`{{count}}h ago`,{count:a});let o=Math.round(a/24);if(o<30)return S(`daysAgo`,`{{count}}d ago`,{count:o});try{return new Date(e).toLocaleDateString(i)}catch{return e}},[S,i,w]),D=(0,g.useCallback)(e=>{switch(e){case`pending`:return S(`statusPending`,`Pending`);case`approved`:return S(`statusApproved`,`Approved`);case`rejected`:return S(`statusRejected`,`Rejected`);case`recalled`:return S(`statusRecalled`,`Recalled`);case`returned`:return S(`statusReturned`,`Returned for revision`);default:return e}},[S]),O=(0,g.useCallback)((e,t)=>{let n=e?.code??``,r=e?.status??0;return n===`NOT_IMPLEMENTED`||r===501?S(`recallUnavailable`,`Recall is not available on this deployment.`):n===`THROTTLED`||r===429?S(`remindThrottled`,`A reminder was sent recently — try again later.`):r===404?S(`requestGone`,`This request no longer exists. Refresh the list.`):n===`FORBIDDEN`||r===403?S(`notAllowed`,`You are not allowed to perform this action.`):n===`INVALID_STATE`||r===409?S(`alreadyDecided`,`This request was already decided. Refresh the list.`):e?.message||t},[S]),yt=(0,g.useCallback)(e=>e.overdue?S(`slaOverdue`,`SLA overdue {{dur}}`,{dur:_t(e.ms)}):S(`slaRemaining`,`SLA {{dur}} left`,{dur:_t(e.ms)}),[S]),xt=(0,g.useCallback)(e=>`/apps/${s||`setup`}/${encodeURIComponent(e.object_name)}/record/${encodeURIComponent(e.record_id)}`,[s]),[k,Ct]=(0,g.useState)(`pending`),[A,wt]=(0,g.useState)([]),[Tt,Et]=(0,g.useState)(!1),[Dt,Ot]=(0,g.useState)(!1),[kt,j]=(0,g.useState)(null),[At,jt]=(0,g.useState)(null),[Mt,Nt]=(0,g.useState)(0),[M,Pt]=(0,g.useState)(null),[N,P]=(0,g.useState)(null),[Ft,F]=(0,g.useState)([]),[It,Lt]=(0,g.useState)(!1),Rt=(0,g.useMemo)(()=>ee(),[]),zt=(0,g.useCallback)(async e=>{let t=window.open(``,`_blank`,`noopener`);try{let n=``.replace(/\/$/,``),r=await Rt(`${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(S(`attachmentOpenFailed`,`Could not open the attachment — please try again`))}},[Rt,S]),[I,Bt]=(0,g.useState)(``),[L,Vt]=(0,g.useState)(``),[R,Ht]=(0,g.useState)(`all`),[z,Ut]=(0,g.useState)(`all`),[B,Wt]=(0,g.useState)(`all`),[Gt,Kt]=(0,g.useState)(`recent`),[V,H]=(0,g.useState)(new Set),[qt,Jt]=(0,g.useState)(!1),[U,W]=(0,g.useState)(null),[G,Yt]=(0,g.useState)(null),[Xt,Zt]=(0,g.useState)(null),[K,Qt]=(0,g.useState)(``),[$t,en]=(0,g.useState)(!1),[tn,nn]=(0,g.useState)(-1);(0,g.useEffect)(()=>{if(k===`pending`)return;let e=window.setTimeout(()=>Vt(I),350);return()=>window.clearTimeout(e)},[I,k]);let q=(0,g.useCallback)(async()=>{Et(!0),jt(null);try{let e=[];if(k===`pending`)e=b.length?(await v.listRequests({status:`pending`,approverId:b})).data:[],Nt(e.length),j(null);else{let t={q:L||void 0,status:B===`all`?void 0:B,limit:ot,offset:0};if(k===`submitted`){let n=a?.id;if(n){let r=await v.listRequests({submitterId:n,...t});e=r.data,j(r.total??r.data.length)}else e=[],j(0)}else{let n=await v.listRequests(t);e=n.data,j(n.total??n.data.length)}b.length&&v.listRequests({status:`pending`,approverId:b}).then(e=>Nt(e.data.length)).catch(()=>{})}e.sort((e,t)=>(T(t)||``).localeCompare(T(e)||``)),wt(e)}catch(e){jt(e?.message||String(e)),wt([])}finally{Et(!1)}},[k,b,a?.id,L,B]);(0,g.useEffect)(()=>{q()},[q]);let rn=(0,g.useCallback)(async()=>{if(!(k===`pending`||Dt)){Ot(!0);try{let e=await v.listRequests({submitterId:k===`submitted`?a?.id??void 0:void 0,q:L||void 0,status:B===`all`?void 0:B,limit:ot,offset:A.length});wt(t=>{let n=new Set(t.map(e=>e.id));return[...t,...e.data.filter(e=>!n.has(e.id))]}),e.total!=null&&j(e.total)}catch(e){h.error(O(e,S(`loadFailed`,`Failed to load request`)))}finally{Ot(!1)}}},[k,Dt,a?.id,L,B,A.length,O,S]),J=(0,g.useCallback)(async e=>{Pt(e),Lt(!0);try{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);P(t.data),F(n.data)}catch(e){h.error(O(e,S(`loadFailed`,`Failed to load request`))),P(null),F([])}finally{Lt(!1)}},[O,S]),an=()=>{Pt(null),P(null),F([])};(0,g.useEffect)(()=>{let e=it.get(`request`);e&&(_(e=>{let t=new URLSearchParams(e);return t.delete(`request`),t},{replace:!0}),J(e))},[it]);let Y=(0,g.useCallback)(()=>{b.length&&v.listRequests({status:`pending`,approverId:b}).then(e=>Nt(e.data.length)).catch(()=>{})},[b]),on=(0,g.useCallback)(async e=>{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);P(t.data),F(n.data),q()},[q]),sn=(0,g.useCallback)(async()=>{if(!N)return;let e=N.id;try{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);P(t.data),F(n.data),q();let r=new Set(t.data.pending_approvers||[]),i=t.data.status===`pending`&&b.some(e=>r.has(e));if(k===`pending`&&!i){let t=Cn.current,n=t.findIndex(t=>t.id===e),r=t[n+1]??t[n-1];if(r&&r.id!==e){J(r.id);return}an()}}catch{on(e)}},[N,b,k,q,J,an,on]),cn=(0,g.useCallback)(async()=>{if(!(!N||!K.trim())){en(!0);try{await v.comment(N.id,{actor_id:a?.id,comment:K.trim()}),Qt(``),await on(N.id)}catch(e){h.error(O(e,S(`actionFailed`,`Action failed`)))}finally{en(!1)}}},[N,K,a?.id,on,O,S]),ln=(0,g.useMemo)(()=>{if(!N||N.status!==`pending`)return!1;if(N.viewer)return N.viewer.can_act||!!N.viewer.can_override;let e=new Set(N.pending_approvers||[]);return b.some(t=>e.has(t))},[N,b]),un=(0,g.useMemo)(()=>!N||N.status!==`pending`?!1:N.viewer?N.viewer.is_submitter:N.submitter_id===a?.id,[N,a?.id]),dn=(0,g.useMemo)(()=>!N||N.status!==`returned`?!1:N.viewer?N.viewer.is_submitter:N.submitter_id===a?.id,[N,a?.id]),fn=(0,g.useMemo)(()=>{let e=new Set;for(let t of A)e.add(C(t));return Array.from(e).sort()},[A]),pn=(0,g.useMemo)(()=>{let e=new Set;for(let t of A)t.object_name&&e.add(t.object_name);return Array.from(e).sort()},[A]),X=(0,g.useMemo)(()=>{let e=I.trim().toLowerCase(),t=A.filter(t=>R!==`all`&&C(t)!==R||z!==`all`&&t.object_name!==z||B!==`all`&&t.status!==B?!1:k!==`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(Gt===`recent`)return t;let n=[...t];return Gt===`amount`?n.sort((e,t)=>{let n=St(e)?.value,r=St(t)?.value;return n==null&&r==null?0:n==null?1:r==null?-1:r-n}):n.sort((e,t)=>(T(e)||``).localeCompare(T(t)||``)),n},[A,I,R,z,B,k,Gt]),Z=(0,g.useMemo)(()=>M?X.findIndex(e=>e.id===M):-1,[X,M]);(0,g.useEffect)(()=>{if(V.size===0)return;let e=new Set(X.map(e=>e.id)),t=!1,n=new Set;for(let r of V)e.has(r)?n.add(r):t=!0;t&&H(n)},[X,V]),(0,g.useEffect)(()=>{tn>=X.length&&nn(X.length-1)},[X.length,tn]);let mn=(0,g.useCallback)(e=>{if(e.status!==`pending`)return!1;let t=new Set(b);return(e.pending_approvers||[]).some(e=>t.has(e))},[b]),Q=(0,g.useCallback)(e=>Array.isArray(e.decision_outputs)&&e.decision_outputs.length>0,[]),hn=(0,g.useCallback)(e=>mn(e)&&!Q(e),[mn,Q]),$=(0,g.useMemo)(()=>X.filter(e=>V.has(e.id)&&hn(e)),[X,V,hn]),gn=X.filter(e=>e.status===`pending`),_n=gn.length>0&&gn.every(e=>V.has(e.id)),vn=(0,g.useCallback)(()=>{H(e=>{if(_n)return new Set;let t=new Set(e);for(let e of gn)t.add(e.id);return t})},[_n,gn]),yn=(0,g.useCallback)(e=>{H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),bn=(0,g.useCallback)(async e=>{let t=$;if(t.length===0)return;Jt(!0);let n=0,r=[];for(let i of t){let t=new Set(i.pending_approvers||[]),o=b.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||x(i.record_id))}}if(Jt(!1),H(new Set),r.length===0)h.success(e===`approve`?S(`bulkApproved`,`Approved {{count}} requests`,{count:n}):S(`bulkRejected`,`Rejected {{count}} requests`,{count:n}));else{let e=r.slice(0,3).join(`, `);h.error(S(`bulkPartial`,`{{ok}} succeeded, {{fail}} failed: {{which}}`,{ok:n,fail:r.length,which:e+(r.length>3?`…`:``)}))}q(),Y()},[$,b,a?.id,q,Y,S]),xn=(0,g.useCallback)(async()=>{let e=U;if(!e)return;let t=new Set(e.pending_approvers||[]),n=b.find(e=>t.has(e))||a?.id||``;Zt(e.id),W(null);try{let t=await v.approve(e.id,{actor_id:n});h.success(t.finalized?S(`inlineApproved`,`Approved "{{title}}"`,{title:e.record_title||x(e.record_id)}):S(`approvedWaiting`,`Approved — waiting on the remaining approvers`)),q(),Y()}catch(e){h.error(O(e,S(`actionFailed`,`Action failed`)))}finally{Zt(null)}},[U,b,a?.id,q,Y,O,S]),Sn=(0,g.useCallback)(async()=>{let e=G;if(!e)return;let t=new Set(e.pending_approvers||[]),n=b.find(e=>t.has(e))||a?.id||``;Zt(e.id),Yt(null);try{await v.reject(e.id,{actor_id:n}),h.success(S(`inlineRejected`,`Rejected "{{title}}"`,{title:e.record_title||x(e.record_id)})),q(),Y()}catch(e){h.error(O(e,S(`actionFailed`,`Action failed`)))}finally{Zt(null)}},[G,b,a?.id,q,Y,O,S]),Cn=(0,g.useRef)(X);Cn.current=X;let wn=(0,g.useRef)(tn);wn.current=tn,(0,g.useEffect)(()=>{let e=e=>{if(M||U||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=Cn.current;if(!r.length)return;let i=wn.current;e.key===`j`||e.key===`ArrowDown`?(e.preventDefault(),nn(Math.min(i+1,r.length-1))):e.key===`k`||e.key===`ArrowUp`?(e.preventDefault(),nn(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]&&k===`pending`?(e.preventDefault(),yn(r[i].id)):e.key===`a`&&i>=0&&r[i]&&hn(r[i])?(e.preventDefault(),W(r[i])):e.key===`r`&&i>=0&&r[i]&&hn(r[i])&&(e.preventDefault(),Yt(r[i]))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M,U,G,k,J,yn,hn]),(0,g.useEffect)(()=>{if(!M)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=Cn.current,i=r.findIndex(e=>e.id===M);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)},[M,J]);let Tn=!!I||R!==`all`||z!==`all`||B!==`all`,En=e=>{Ct(e),Wt(`all`),Ht(`all`),Ut(`all`),Bt(``),Kt(`recent`),nn(-1)};function Dn({r:e}){return(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`div`,{className:`font-medium truncate`,children:C(e)}),(0,y.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[lt(e)||`—`,(e.round??1)>1&&(0,y.jsx)(`span`,{className:`ml-1.5 text-violet-600 dark:text-violet-400`,children:S(`roundChip`,`Round {{n}}`,{n:e.round})})]})]})}function On({r:e}){let n=St(e);return(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsxs)(t,{to:xt(e),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,y.jsx)(`span`,{className:`truncate`,children:e.record_title||x(e.record_id)}),(0,y.jsx)(Me,{className:`h-3 w-3 shrink-0 text-muted-foreground`})]}),(0,y.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[mt(e),n&&(0,y.jsxs)(`span`,{className:`ml-1.5 font-medium text-foreground`,title:`${n.label}: ${n.display}`,children:[`· `,n.display]})]})]})}function kn({r:e}){if(!mn(e))return null;let t=Xt===e.id,n=Q(e),r=S(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`);return(0,y.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:n?r:void 0,children:[(0,y.jsx)(l,{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:t||n,onClick:()=>W(e),"aria-label":n?r:S(`approve`,`Approve`),children:(0,y.jsx)(Ae,{className:`h-4 w-4`})}),(0,y.jsx)(l,{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:t||n,onClick:()=>Yt(e),"aria-label":n?r:S(`reject`,`Reject`),children:(0,y.jsx)(se,{className:`h-4 w-4`})})]})}return(0,y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-6xl`,children:[(0,y.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`h1`,{className:`text-2xl font-semibold flex items-center gap-2`,children:[(0,y.jsx)(ce,{className:`h-6 w-6`}),S(`title`,`Approvals Inbox`)]}),(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S(`subtitle`,`Review and act on approval requests.`)})]}),(0,y.jsxs)(l,{variant:`outline`,size:`sm`,onClick:q,disabled:Tt,className:`self-start sm:self-auto`,children:[(0,y.jsx)(Xe,{className:`h-4 w-4 mr-2 ${Tt?`animate-spin`:``}`}),S(`refresh`,`Refresh`)]})]}),At&&(0,y.jsxs)(te,{variant:`destructive`,children:[(0,y.jsx)(Le,{className:`h-4 w-4`}),(0,y.jsx)(He,{children:At})]}),(0,y.jsxs)(me,{value:k,onValueChange:En,children:[(0,y.jsxs)(xe,{children:[(0,y.jsxs)(oe,{value:`pending`,children:[S(`tabMyPending`,`My Pending`),Mt>0&&(0,y.jsx)(c,{variant:`secondary`,className:`ml-2`,children:Mt})]}),(0,y.jsx)(oe,{value:`submitted`,children:S(`tabSubmitted`,`Submitted by me`)}),(0,y.jsx)(oe,{value:`all`,children:S(`tabAll`,`All`)})]}),(0,y.jsxs)(ge,{value:k,className:`mt-4 space-y-3`,children:[!Tt&&(A.length>0||k!==`pending`&&(L||B!==`all`))&&(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-sm`,children:[(0,y.jsx)(Se,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,y.jsx)(ve,{value:I,onChange:e=>Bt(e.target.value),placeholder:S(`searchPlaceholder`,`Search record, process, requester…`),className:`pl-8 h-8 text-sm`}),I&&(0,y.jsx)(`button`,{type:`button`,onClick:()=>Bt(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":S(`clearSearch`,`Clear search`),children:(0,y.jsx)(De,{className:`h-3.5 w-3.5`})})]}),k!==`pending`&&(0,y.jsxs)(ze,{value:B,onValueChange:Wt,children:[(0,y.jsx)(et,{className:`h-8 w-auto min-w-[130px] text-sm`,children:(0,y.jsx)(Ne,{placeholder:S(`statusFilter`,`Status`)})}),(0,y.jsxs)(je,{children:[(0,y.jsx)(p,{value:`all`,children:S(`allStatuses`,`All statuses`)}),(0,y.jsx)(p,{value:`pending`,children:D(`pending`)}),(0,y.jsx)(p,{value:`approved`,children:D(`approved`)}),(0,y.jsx)(p,{value:`rejected`,children:D(`rejected`)}),(0,y.jsx)(p,{value:`recalled`,children:D(`recalled`)}),(0,y.jsx)(p,{value:`returned`,children:D(`returned`)})]})]}),fn.length>1&&(0,y.jsxs)(ze,{value:R,onValueChange:Ht,children:[(0,y.jsx)(et,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,y.jsx)(Ne,{placeholder:S(`processFilter`,`Process`)})}),(0,y.jsxs)(je,{children:[(0,y.jsx)(p,{value:`all`,children:S(`allProcesses`,`All processes`)}),fn.map(e=>(0,y.jsx)(p,{value:e,children:e},e))]})]}),pn.length>1&&(0,y.jsxs)(ze,{value:z,onValueChange:Ut,children:[(0,y.jsx)(et,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,y.jsx)(Ne,{placeholder:S(`objectFilter`,`Object`)})}),(0,y.jsxs)(je,{children:[(0,y.jsx)(p,{value:`all`,children:S(`allObjects`,`All objects`)}),pn.map(e=>(0,y.jsx)(p,{value:e,children:e},e))]})]}),(0,y.jsxs)(ze,{value:Gt,onValueChange:e=>Kt(e),children:[(0,y.jsxs)(et,{className:`h-8 w-auto min-w-[120px] text-sm`,children:[(0,y.jsx)(ne,{className:`h-3.5 w-3.5 mr-1 text-muted-foreground`}),(0,y.jsx)(Ne,{placeholder:S(`sortBy`,`Sort`)})]}),(0,y.jsxs)(je,{children:[(0,y.jsx)(p,{value:`recent`,children:S(`sortRecent`,`Newest first`)}),(0,y.jsx)(p,{value:`oldest`,children:S(`sortOldest`,`Oldest first`)}),(0,y.jsx)(p,{value:`amount`,children:S(`sortAmount`,`Amount (high→low)`)})]})]}),Tn&&(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S(`filterCount`,`{{shown}} of {{total}}`,{shown:X.length,total:A.length})})]}),k===`pending`&&V.size>0&&(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 rounded-md border bg-accent/30 text-sm`,children:[(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:V.size}),` `,S(`selected`,`selected`),$.length!==V.size&&(0,y.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:S(`actionableCount`,`({{count}} actionable)`,{count:$.length})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsxs)(he,{children:[(0,y.jsx)(we,{asChild:!0,children:(0,y.jsxs)(l,{size:`sm`,disabled:qt||$.length===0,children:[(0,y.jsx)(Ae,{className:`h-3.5 w-3.5 mr-1`}),S(`approveN`,`Approve {{count}}`,{count:$.length||``})]})}),(0,y.jsxs)(le,{children:[(0,y.jsxs)(nt,{children:[(0,y.jsx)(re,{children:S(`bulkApproveTitle`,`Approve {{count}} requests?`,{count:$.length})}),(0,y.jsx)(fe,{children:S(`bulkApproveBody`,`Each request is approved with your identity and its flow continues down the approve branch.`)})]}),(0,y.jsxs)(Ce,{children:[(0,y.jsx)(ae,{children:S(`cancel`,`Cancel`)}),(0,y.jsx)(be,{onClick:()=>bn(`approve`),children:S(`approveN`,`Approve {{count}}`,{count:$.length})})]})]})]}),(0,y.jsxs)(he,{children:[(0,y.jsx)(we,{asChild:!0,children:(0,y.jsxs)(l,{size:`sm`,variant:`outline`,disabled:qt||$.length===0,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,y.jsx)(se,{className:`h-3.5 w-3.5 mr-1`}),S(`rejectN`,`Reject {{count}}`,{count:$.length||``})]})}),(0,y.jsxs)(le,{children:[(0,y.jsxs)(nt,{children:[(0,y.jsx)(re,{children:S(`bulkRejectTitle`,`Reject {{count}} requests?`,{count:$.length})}),(0,y.jsx)(fe,{children:S(`bulkRejectBody`,`This rejects the selected requests and notifies their submitters.`)})]}),(0,y.jsxs)(Ce,{children:[(0,y.jsx)(ae,{children:S(`cancel`,`Cancel`)}),(0,y.jsx)(be,{onClick:()=>bn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:S(`rejectN`,`Reject {{count}}`,{count:$.length})})]})]})]}),(0,y.jsx)(l,{size:`sm`,variant:`ghost`,onClick:()=>H(new Set),disabled:qt,children:S(`clear`,`Clear`)})]})]}),Tt?(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(f,{className:`h-10 w-full`}),(0,y.jsx)(f,{className:`h-10 w-full`}),(0,y.jsx)(f,{className:`h-10 w-full`})]}):A.length===0?(0,y.jsx)(`div`,{className:`flex items-center justify-center min-h-[240px] rounded-md border border-dashed`,children:(0,y.jsxs)(Qe,{children:[(0,y.jsx)(Ge,{children:S(`emptyTitle`,`No requests`)}),(0,y.jsx)(Ie,{children:k===`pending`?S(`emptyPending`,`You're all caught up — nothing is waiting on you.`):S(`emptyOther`,`Nothing here yet.`)}),k===`pending`&&(0,y.jsx)(l,{variant:`link`,size:`sm`,className:`mt-1`,onClick:()=>En(`all`),children:S(`emptyViewAll`,`Browse all requests`)})]})}):X.length===0?(0,y.jsx)(`div`,{className:`flex items-center justify-center min-h-[160px] rounded-md border border-dashed text-sm text-muted-foreground`,children:S(`noMatches`,`No matches for current filters.`)}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Pe,{className:`hidden md:block`,children:(0,y.jsx)($e,{className:`p-0`,children:(0,y.jsxs)(de,{children:[(0,y.jsx)(ie,{children:(0,y.jsxs)(Ee,{children:[k===`pending`&&(0,y.jsx)(m,{className:`w-10`,children:(0,y.jsx)(tt,{checked:_n,onCheckedChange:vn,"aria-label":S(`selectAll`,`Select all`),disabled:gn.length===0})}),(0,y.jsx)(m,{className:`w-[22%]`,children:S(`colRequest`,`Request`)}),(0,y.jsx)(m,{className:`w-[30%]`,children:S(`colRecord`,`Record`)}),(0,y.jsx)(m,{className:`w-[16%]`,children:S(`colRequester`,`Requester`)}),(0,y.jsx)(m,{className:`w-[110px] min-w-[96px] whitespace-nowrap`,children:S(`colStatus`,`Status`)}),(0,y.jsx)(m,{className:`w-[132px]`,children:S(`colWaiting`,`Submitted`)}),(0,y.jsx)(m,{className:`w-20`,"aria-label":S(`colActions`,`Actions`)})]})}),(0,y.jsx)(pe,{children:X.map((e,t)=>(0,y.jsxs)(Ee,{className:d(`group cursor-pointer hover:bg-accent/50`,tn===t&&`ring-2 ring-inset ring-ring bg-accent/30`),onClick:()=>{nn(t),J(e.id)},children:[k===`pending`&&(0,y.jsx)(u,{className:`w-10`,onClick:e=>e.stopPropagation(),children:(0,y.jsx)(tt,{checked:V.has(e.id),onCheckedChange:()=>yn(e.id),disabled:e.status!==`pending`,"aria-label":S(`selectRow`,`Select request`)})}),(0,y.jsx)(u,{children:(0,y.jsx)(Dn,{r:e})}),(0,y.jsx)(u,{children:(0,y.jsx)(On,{r:e})}),(0,y.jsx)(u,{children:pt(e)?(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground`,children:[(0,y.jsx)(ke,{className:`h-3.5 w-3.5 shrink-0`}),(0,y.jsx)(`span`,{className:`truncate italic`,children:S(`flowOrigin`,`Flow-initiated`)})]}):(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,y.jsx)(Ve,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,y.jsx)(`span`,{className:`truncate`,title:e.submitter_id||``,children:ut(e)})]})}),(0,y.jsx)(u,{children:(0,y.jsx)(st,{status:e.status,label:D(e.status)})}),(0,y.jsxs)(u,{className:d(`text-xs whitespace-nowrap`,gt(e,w)),title:ct(T(e)),children:[(0,y.jsx)(ue,{className:`h-3 w-3 inline mr-1`}),E(T(e)),e.status===`pending`&&(()=>{let t=vt(e.sla_due_at,w);return t?(0,y.jsx)(`div`,{className:d(`mt-0.5 text-[10px] font-medium`,t.overdue?`text-red-600 dark:text-red-400`:`text-muted-foreground`),children:yt(t)}):null})()]}),(0,y.jsx)(u,{className:`w-20`,children:(0,y.jsx)(kn,{r:e})})]},e.id))})]})})}),(0,y.jsx)(`div`,{className:`md:hidden space-y-2`,children:X.map(e=>(0,y.jsx)(Pe,{className:`cursor-pointer active:bg-accent/50`,onClick:()=>void J(e.id),children:(0,y.jsxs)($e,{className:`p-3 space-y-1.5`,children:[(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,y.jsx)(`div`,{className:`font-medium text-sm truncate`,children:C(e)}),(0,y.jsx)(st,{status:e.status,label:D(e.status)})]}),(0,y.jsxs)(`div`,{className:`text-sm truncate`,children:[e.record_title||x(e.record_id),(0,y.jsx)(`span`,{className:`text-muted-foreground text-xs ml-1.5`,children:mt(e)}),(()=>{let t=St(e);return t?(0,y.jsxs)(`span`,{className:`text-xs ml-1.5 font-medium`,title:t.label,children:[`· `,t.display]}):null})()]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[pt(e)?(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate italic`,children:[(0,y.jsx)(ke,{className:`h-3 w-3`}),S(`flowOrigin`,`Flow-initiated`)]}):(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,y.jsx)(Ve,{className:`h-3 w-3`}),ut(e)]}),(0,y.jsxs)(`span`,{className:d(`inline-flex items-center gap-1 whitespace-nowrap`,gt(e,w)),children:[(0,y.jsx)(ue,{className:`h-3 w-3`}),E(T(e))]})]}),mn(e)&&(0,y.jsxs)(`div`,{className:`flex gap-2 pt-1`,onClick:e=>e.stopPropagation(),title:Q(e)?S(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`):void 0,children:[(0,y.jsxs)(l,{size:`sm`,className:`h-7 flex-1`,disabled:Xt===e.id||Q(e),onClick:()=>W(e),children:[(0,y.jsx)(Ae,{className:`h-3.5 w-3.5 mr-1`}),S(`approve`,`Approve`)]}),(0,y.jsxs)(l,{size:`sm`,variant:`outline`,className:`h-7 flex-1 border-destructive text-destructive`,disabled:Xt===e.id||Q(e),onClick:()=>Yt(e),children:[(0,y.jsx)(se,{className:`h-3.5 w-3.5 mr-1`}),S(`reject`,`Reject`)]})]})]})},e.id))}),k!==`pending`&&kt!=null&&(0,y.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-1`,children:[(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S(`loadedOf`,`Loaded {{loaded}} of {{total}}`,{loaded:A.length,total:kt})}),A.length<kt&&(0,y.jsx)(l,{size:`sm`,variant:`outline`,disabled:Dt,onClick:()=>void rn(),children:Dt?S(`loadingMore`,`Loading…`):S(`loadMore`,`Load more`)})]}),(0,y.jsx)(`div`,{className:`hidden md:block text-[11px] text-muted-foreground`,children:S(`keyboardHint`,`Keyboard: j/k move · Enter open · x select · a approve · r reject`)})]})]})]}),(0,y.jsx)(he,{open:!!U,onOpenChange:e=>!e&&W(null),children:(0,y.jsxs)(le,{children:[(0,y.jsxs)(nt,{children:[(0,y.jsx)(re,{children:S(`approveOneTitle`,`Approve "{{title}}"?`,{title:U?U.record_title||x(U.record_id):``})}),(0,y.jsx)(fe,{children:S(`approveOneBody`,`This approves the request with your identity. To add a comment or attachment, open the request instead.`)})]}),(0,y.jsxs)(Ce,{children:[(0,y.jsx)(ae,{children:S(`cancel`,`Cancel`)}),(0,y.jsx)(be,{onClick:()=>void xn(),children:S(`approve`,`Approve`)})]})]})}),(0,y.jsx)(he,{open:!!G,onOpenChange:e=>!e&&Yt(null),children:(0,y.jsxs)(le,{children:[(0,y.jsxs)(nt,{children:[(0,y.jsx)(re,{children:S(`rejectOneTitle`,`Reject "{{title}}"?`,{title:G?G.record_title||x(G.record_id):``})}),(0,y.jsx)(fe,{children:S(`rejectOneBody`,`This rejects the request and notifies the submitter.`)})]}),(0,y.jsxs)(Ce,{children:[(0,y.jsx)(ae,{children:S(`cancel`,`Cancel`)}),(0,y.jsx)(be,{onClick:()=>void Sn(),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:S(`reject`,`Reject`)})]})]})}),(0,y.jsx)(Ze,{open:!!M,onOpenChange:e=>!e&&an(),children:(0,y.jsxs)(Fe,{className:`w-full sm:max-w-xl overflow-y-auto`,children:[(0,y.jsxs)(Je,{children:[(0,y.jsx)(We,{children:N?C(N):S(`drawerTitle`,`Approval Request`)}),(0,y.jsx)(Re,{children:N?lt(N)||mt(N):``})]}),N&&Z>=0&&X.length>1&&(0,y.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-xs text-muted-foreground`,children:[(0,y.jsxs)(l,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:Z<=0,onClick:()=>{let e=X[Z-1];e&&J(e.id)},children:[(0,y.jsx)(Ye,{className:`h-4 w-4 mr-0.5`}),S(`prevRequest`,`Previous`)]}),(0,y.jsx)(`span`,{children:S(`positionOf`,`Request {{index}} of {{total}}`,{index:Z+1,total:X.length})}),(0,y.jsxs)(l,{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:[S(`nextRequest`,`Next`),(0,y.jsx)(Ke,{className:`h-4 w-4 ml-0.5`})]})]}),It?(0,y.jsxs)(`div`,{className:`space-y-2 mt-6`,children:[(0,y.jsx)(f,{className:`h-6 w-3/4`}),(0,y.jsx)(f,{className:`h-6 w-1/2`}),(0,y.jsx)(f,{className:`h-20 w-full`})]}):N?(0,y.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,y.jsx)(st,{status:N.status,label:D(N.status)}),(N.round??1)>1&&(0,y.jsx)(c,{variant:`outline`,className:`text-[10px] border-violet-200 text-violet-700 dark:border-violet-500/30 dark:text-violet-400`,children:S(`roundChip`,`Round {{n}}`,{n:N.round})}),(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:ct(T(N)),children:[(0,y.jsx)(ue,{className:`h-3 w-3`}),S(`submittedAgo`,`Submitted {{when}}`,{when:E(T(N))})]}),N.completed_at&&(0,y.jsxs)(`span`,{children:[`· `,S(`completedAt`,`Completed {{when}}`,{when:E(N.completed_at)})]}),N.status===`pending`&&(()=>{let e=vt(N.sla_due_at,w);return e?(0,y.jsx)(c,{variant:`outline`,className:d(`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:yt(e)}):null})()]}),(()=>{let e=St(N),n=bt(N.payload,N.payload_display,N.payload_labels,6,e?.key);return(0,y.jsx)(Pe,{children:(0,y.jsxs)($e,{className:`p-4 space-y-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsxs)(t,{to:xt(N),className:`text-base font-semibold hover:underline inline-flex items-center gap-1.5`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:N.record_title||x(N.record_id)}),(0,y.jsx)(Me,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:mt(N)})]}),(0,y.jsx)(`div`,{className:`text-right text-xs text-muted-foreground shrink-0`,children:(0,y.jsx)(`div`,{className:`inline-flex items-center gap-1`,children:pt(N)?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(ke,{className:`h-3 w-3`}),(0,y.jsx)(`span`,{className:`italic`,children:S(`flowOrigin`,`Flow-initiated`)})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ve,{className:`h-3 w-3`}),(0,y.jsx)(`span`,{title:N.submitter_id||``,children:ut(N)})]})})})]}),e&&(0,y.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,y.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e.label}),(0,y.jsx)(`div`,{className:`text-xl font-semibold tabular-nums`,title:e.display,children:e.display})]}),n.length>0&&(0,y.jsx)(`div`,{className:d(`grid grid-cols-2 gap-x-4 gap-y-2 text-sm`,!e&&`border-t pt-3`),children:n.map(([e,t])=>(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,y.jsx)(`div`,{className:`truncate`,title:t,children:t})]},e))}),N.decision_progress&&(()=>{let e=N.decision_progress,t=(N.pending_approvers||[]).length;return(0,y.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1.5`,children:[(0,y.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.behavior===`per_group`?S(`progressGroups`,`Sign-off progress — {{got}} of {{need}} groups`,{got:e.got,need:e.need}):S(`progressApprovals`,`Approvals — {{got}} of {{need}}`,{got:e.got,need:e.need})}),e.behavior!==`per_group`&&N.status===`pending`&&t>0&&(0,y.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:S(`progressEligible`,`{{count}} eligible approver(s)`,{count:t})})]}),(0,y.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":e.need,"aria-valuenow":Math.min(e.got,e.need),"aria-label":S(`progressBar`,`Decision progress`),className:`flex gap-1`,children:e.need>0&&e.need<=12?Array.from({length:e.need}).map((t,n)=>(0,y.jsx)(`div`,{className:d(`h-1.5 flex-1 rounded-full`,n<e.got?`bg-emerald-500`:`bg-muted`)},n)):(0,y.jsx)(`div`,{className:`h-1.5 flex-1 rounded-full bg-muted overflow-hidden`,children:(0,y.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,y.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.groups.map(e=>(0,y.jsxs)(c,{variant:`outline`,className:d(`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,y.jsx)(Ue,{className:`h-3 w-3`}):(0,y.jsx)(Te,{className:`h-2.5 w-2.5`}),e.group,` `,e.got,`/`,e.need]},e.group))})]})})(),N.status===`pending`&&(N.pending_approvers||[]).length>0&&(0,y.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,y.jsx)(`div`,{className:`text-[11px] text-muted-foreground mb-1`,children:S(`waitingOn`,`Waiting on`)}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:ft(N).map((e,t)=>(0,y.jsxs)(c,{variant:`outline`,className:`text-[11px]`,title:e.title,children:[e.label,e.group&&(0,y.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`· `,e.group]}),e.count>1&&(0,y.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`×`,e.count]})]},`${e.label}-${e.group??``}-${t}`))})]})]})})})(),(N.flow_steps?.length??0)>1&&(0,y.jsx)(`div`,{className:`flex items-center px-1`,"aria-label":S(`stepProgress`,`Approval steps`),children:N.flow_steps.map((e,t)=>(0,y.jsxs)(g.Fragment,{children:[t>0&&(0,y.jsx)(`div`,{className:d(`h-px flex-1 mx-2`,e.state===`done`||e.state===`current`?`bg-emerald-300 dark:bg-emerald-700`:`bg-border`)}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,y.jsx)(`span`,{className:d(`flex items-center justify-center h-5 w-5 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,y.jsx)(Ue,{className:`h-3 w-3`}):t+1}),(0,y.jsx)(`span`,{className:d(`text-xs`,e.state===`current`?`font-medium`:`text-muted-foreground`),children:e.label})]})]},e.id))}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-3`,children:S(`history`,`Activity`)}),Ft.length===0?(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:S(`noActions`,`No actions yet.`)}):(0,y.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:Ft.map(e=>{let t=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`,n=e.actor_id===`system:sla`?S(`systemSlaActor`,`System (SLA)`):e.actor_name??(e.actor_id&&e.actor_id===N.submitter_id?ut(N):x(e.actor_id)),r=e.action===`submit`?S(`actSubmit`,`Submitted`):e.action===`approve`?S(`actApprove`,`Approved`):e.action===`reject`?S(`actReject`,`Rejected`):e.action===`recall`?S(`actRecall`,`Recalled`):e.action===`reassign`?S(`actReassign`,`Reassigned`):e.action===`remind`?S(`actRemind`,`Reminder sent`):e.action===`request_info`?S(`actRequestInfo`,`Requested more info`):e.action===`comment`?S(`actComment`,`Commented`):e.action===`escalate`?S(`actEscalate`,`SLA escalated`):e.action===`revise`?S(`actRevise`,`Sent back for revision`):e.action===`resubmit`?S(`actResubmit`,`Resubmitted`):e.action;return(0,y.jsxs)(`li`,{className:`relative text-xs`,children:[(0,y.jsx)(`span`,{className:`absolute -left-[18px] top-1 h-3 w-3 rounded-full ring-2 ring-background ${t}`,"aria-hidden":!0}),(0,y.jsxs)(`div`,{className:`flex items-baseline gap-1.5 flex-wrap`,children:[(0,y.jsx)(`span`,{className:`font-medium`,children:r}),(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,y.jsx)(`span`,{title:e.actor_id||``,children:n}),(0,y.jsx)(`span`,{className:`ml-auto text-muted-foreground text-[10px]`,title:ct(e.created_at),children:E(e.created_at)})]}),(()=>{let t=e;return e.action!==`reassign`||!t.reassign_from&&!t.reassign_to?null:(0,y.jsx)(`div`,{className:`text-muted-foreground mt-0.5`,children:S(`reassignFromTo`,`from {{from}} to {{to}}`,{from:t.reassign_from_name??x(t.reassign_from),to:t.reassign_to_name??x(t.reassign_to)})})})(),e.comment&&(0,y.jsxs)(`div`,{className:`text-muted-foreground italic mt-0.5`,children:[`"`,e.comment,`"`]}),Array.isArray(e.attachments)&&e.attachments.length>0&&(0,y.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:e.attachments.map((t,n)=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>void zt(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,y.jsx)(_e,{className:`h-3 w-3`}),t.name||`${S(`attachmentChip`,`Attachment`)}${e.attachments.length>1?` ${n+1}`:``}`]},t.id||n))})]},e.id)})}),N.status===`pending`&&(ln||un)&&(0,y.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,y.jsx)(ve,{value:K,onChange:e=>Qt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&K.trim()&&(e.preventDefault(),cn())},placeholder:S(`replyPlaceholder`,`Reply on this request…`),className:`h-8 text-sm`}),(0,y.jsx)(l,{size:`sm`,variant:`outline`,className:`h-8 px-2 shrink-0`,disabled:!K.trim()||$t,onClick:()=>void cn(),children:(0,y.jsx)(Oe,{className:`h-3.5 w-3.5`})})]})]}),N.payload!=null&&(0,y.jsxs)(`details`,{className:`group`,children:[(0,y.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:S(`rawData`,`Raw data (JSON)`)}),(0,y.jsxs)(`div`,{className:`mt-2`,children:[(0,y.jsx)(`div`,{className:`flex justify-end`,children:(0,y.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(N.payload,null,2)),h.success(S(`copied`,`Copied`))}catch{h.error(S(`copyFailed`,`Copy failed`))}},className:`text-[10px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,y.jsx)(ye,{className:`h-3 w-3`}),S(`copy`,`Copy`)]})}),(0,y.jsx)(`pre`,{className:`text-[11px] bg-muted/50 rounded p-2 overflow-auto max-h-48 mt-1`,children:JSON.stringify(N.payload,null,2)})]})]}),N.status===`pending`&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Be,{}),(0,y.jsxs)(`div`,{className:`space-y-3`,children:[(0,y.jsx)(rt,{objectName:`sys_approval_request`,record:N,location:`record_section`,label:S(`declaredActions`,`Actions`),onDone:()=>{sn()}}),!ln&&(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:un?S(`whyDisabledSubmitter`,`You submitted this request, so you can recall it — but only the assigned approvers can approve or reject.`):S(`whyDisabled`,`Only the assigned approvers can act on this request. It is waiting on: {{who}}.`,{who:(N.pending_approvers||[]).map(e=>dt(e,N)).join(`, `)||`—`})})]})]}),dn&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Be,{}),(0,y.jsxs)(`div`,{className:`space-y-3`,children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:S(`returnedHint`,`An approver sent this back to you. The record is unlocked — fix the data, then resubmit to start a new approval round.`)}),(0,y.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,y.jsx)(l,{asChild:!0,size:`sm`,variant:`outline`,children:(0,y.jsxs)(t,{to:xt(N),children:[(0,y.jsx)(Me,{className:`h-4 w-4 mr-1`}),S(`editRecordBtn`,`Edit record`)]})}),(0,y.jsx)(rt,{objectName:`sys_approval_request`,record:N,location:`record_section`,onDone:()=>{on(N.id),q()}})]})]})]})]}):null]})})]})}export{k as ApprovalsInboxPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{$i as r,Ar as i,Bt as a,Er as o,Hr as s,It as c,Lt as l,Mn as u,On as d,Qi as f,Rt as p,Vt as m,Yr as ee,_n as te,bn as h,br as g,cn as _,dn as v,dt as ne,ec as re,fn as ie,gn as ae,hn as y,jr as oe,mn as se,mt as b,pn as ce,ua as le,un as x,ut as ue,vn as S,xr as C,yn as w,zt as T}from"./ui-components-BFOT5Gog.js";var E=e(n(),1),D=t(),de=`${``.replace(/\/$/,``)}/api/v1`,fe=[`create`,`update`,`delete`,`restore`,`login`,`logout`,`permission_change`,`config_change`,`export`,`import`],O={create:`default`,update:`secondary`,delete:`destructive`,restore:`outline`,login:`outline`,logout:`outline`,permission_change:`secondary`,config_change:`secondary`,export:`outline`,import:`outline`},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(`${de}/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,D.jsxs)(`div`,{className:`p-6 space-y-4 max-w-screen-2xl mx-auto`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(r,{className:`h-6 w-6 text-muted-foreground`}),(0,D.jsxs)(`div`,{className:`flex-1`,children:[(0,D.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Audit Log`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Read-only system activity and record changes. Newest first.`})]}),(0,D.jsxs)(s,{variant:`outline`,size:`sm`,onClick:Q,disabled:n,children:[(0,D.jsx)(le,{className:`h-4 w-4 mr-1 ${n?`animate-spin`:``}`}),`Refresh`]})]}),(0,D.jsx)(g,{children:(0,D.jsxs)(C,{className:`p-4 grid grid-cols-1 md:grid-cols-5 gap-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,D.jsx)(u,{className:`text-xs`,children:`Action`}),(0,D.jsxs)(ae,{value:I,onValueChange:e=>{L(e),q(0)},children:[(0,D.jsx)(w,{className:`h-9`,children:(0,D.jsx)(h,{})}),(0,D.jsxs)(te,{children:[(0,D.jsx)(S,{value:`all`,children:`All actions`}),fe.map(e=>(0,D.jsx)(S,{value:e,children:e},e))]})]})]}),(0,D.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,D.jsx)(u,{className:`text-xs`,children:`Object`}),(0,D.jsx)(d,{placeholder:`e.g. account`,value:R,onChange:e=>{z(e.target.value),q(0)},className:`h-9`})]}),(0,D.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,D.jsx)(u,{className:`text-xs`,children:`Actor (user id)`}),(0,D.jsx)(d,{placeholder:`user id`,value:B,onChange:e=>{V(e.target.value),q(0)},className:`h-9`})]}),(0,D.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,D.jsx)(u,{className:`text-xs`,children:`From`}),(0,D.jsx)(d,{type:`date`,value:H,onChange:e=>{U(e.target.value),q(0)},className:`h-9`})]}),(0,D.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,D.jsx)(u,{className:`text-xs`,children:`To`}),(0,D.jsx)(d,{type:`date`,value:W,onChange:e=>{G(e.target.value),q(0)},className:`h-9`})]}),$>0&&(0,D.jsx)(`div`,{className:`md:col-span-5 flex justify-end`,children:(0,D.jsxs)(s,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,D.jsx)(ee,{className:`h-4 w-4 mr-1`}),`Clear filters (`,$,`)`]})})]})}),P&&(0,D.jsxs)(i,{variant:`destructive`,children:[(0,D.jsx)(re,{className:`h-4 w-4`}),(0,D.jsx)(oe,{children:P})]}),(0,D.jsx)(g,{children:(0,D.jsx)(C,{className:`p-0`,children:n&&e.length===0?(0,D.jsx)(`div`,{className:`p-6 space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,D.jsx)(_,{className:`h-9 w-full`},t))}):e.length===0?(0,D.jsx)(`div`,{className:`p-12`,children:(0,D.jsxs)(ue,{children:[(0,D.jsx)(f,{className:`h-8 w-8 text-muted-foreground mb-3`}),(0,D.jsx)(b,{children:`No audit entries`}),(0,D.jsx)(ne,{children:$>0?`Try clearing filters or widening the date range.`:`Events will appear here once tracked objects are modified.`})]})}):(0,D.jsxs)(c,{children:[(0,D.jsx)(a,{children:(0,D.jsxs)(m,{children:[(0,D.jsx)(T,{className:`w-[180px]`,children:`Timestamp`}),(0,D.jsx)(T,{className:`w-[130px]`,children:`Action`}),(0,D.jsx)(T,{children:`Object`}),(0,D.jsx)(T,{children:`Record`}),(0,D.jsx)(T,{children:`Actor`}),(0,D.jsx)(T,{className:`w-[130px]`,children:`IP`})]})}),(0,D.jsx)(l,{children:e.map(e=>{let t=O[e.action||``]||`outline`;return(0,D.jsxs)(m,{className:`cursor-pointer`,onClick:()=>Z(e),children:[(0,D.jsx)(p,{className:`font-mono text-xs`,children:A(e.created_at)}),(0,D.jsx)(p,{children:(0,D.jsx)(o,{variant:t,children:e.action||`—`})}),(0,D.jsx)(p,{children:e.object_name||`—`}),(0,D.jsx)(p,{className:`font-mono text-xs`,children:j(e.record_id,18)}),(0,D.jsx)(p,{className:`font-mono text-xs`,children:j(e.user_id,18)}),(0,D.jsx)(p,{className:`font-mono text-xs`,children:e.ip_address||`—`})]},e.id)})})]})})}),(e.length>0||K>0)&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between text-sm text-muted-foreground`,children:[(0,D.jsxs)(`span`,{children:[`Page `,K+1,J?``:` · end`]}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(s,{variant:`outline`,size:`sm`,disabled:K===0||n,onClick:()=>q(e=>Math.max(0,e-1)),children:`Previous`}),(0,D.jsx)(s,{variant:`outline`,size:`sm`,disabled:!J||n,onClick:()=>q(e=>e+1),children:`Next`})]})]}),(0,D.jsx)(x,{open:!!X,onOpenChange:e=>!e&&Z(null),children:(0,D.jsxs)(v,{side:`right`,className:`sm:max-w-2xl w-full overflow-y-auto`,children:[(0,D.jsxs)(ce,{children:[(0,D.jsxs)(se,{className:`flex items-center gap-2`,children:[(0,D.jsx)(o,{variant:X&&O[X.action||``]||`outline`,children:X?.action||`—`}),X?.object_name||`Audit Event`]}),(0,D.jsx)(ie,{children:X?.id?(0,D.jsx)(`span`,{className:`font-mono text-xs`,children:X.id}):null})]}),X&&(0,D.jsxs)(`div`,{className:`mt-6 space-y-5`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Timestamp`}),(0,D.jsx)(`div`,{className:`font-mono`,children:A(X.created_at)})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`IP Address`}),(0,D.jsx)(`div`,{className:`font-mono`,children:X.ip_address||`—`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Actor (user_id)`}),(0,D.jsx)(`div`,{className:`font-mono break-all`,children:X.user_id||`—`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Tenant`}),(0,D.jsx)(`div`,{className:`font-mono break-all`,children:X.tenant_id||`—`})]}),(0,D.jsxs)(`div`,{className:`col-span-2`,children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Target record`}),(0,D.jsxs)(`div`,{className:`font-mono text-sm break-all`,children:[X.object_name||`—`,` / `,X.record_id||`—`]})]}),X.user_agent&&(0,D.jsxs)(`div`,{className:`col-span-2`,children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`User Agent`}),(0,D.jsx)(`div`,{className:`font-mono text-xs break-all`,children:X.user_agent})]})]}),(X.old_value||X.new_value)&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{}),(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`div`,{className:`text-sm font-medium`,children:`Change payload`}),X.old_value&&(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Before`}),(0,D.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,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`After`}),(0,D.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,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Metadata`}),(0,D.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{h as e,m as t,r as n,y as r}from"./vendor-react-DpRf6e0g.js";import{
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{h as e,m as t,r as n,y as r}from"./vendor-react-DpRf6e0g.js";import{dt as i,mt as a,ut as o}from"./ui-components-BFOT5Gog.js";import{t as s}from"./componentRegistry-ByxoJqMW.js";r();var c=n();function l({extraProps:n}={}){let r=t(),[l]=e(),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)(o,{children:[(0,c.jsx)(a,{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,...n??{}})}export{l as ComponentNavView,l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{Fi as r,Hr as i,Is as a,Li as o,Mo as s,On as c,Yc as l,_c as u,bo as d,dr as f,ec as p,fo as m,fr as h,hr as g,io as _,mr as ee,ol as v,pr as y,ur as te,yc as b}from"./ui-components-BFOT5Gog.js";import{n as x}from"./createDerive-CsNhKPNT.js";import{a as S,i as C,n as w,o as T,r as E,s as ne,t as D}from"./plugin-view-DoxfBkwY.js";var O=e(n(),1),k=t();function A({title:e,description:t,icon:n,actions:r,accentColor:i,sticky:a=!1,className:o,"data-testid":s}){return(0,k.jsxs)(`div`,{style:{"--page-header-accent":i||`hsl(var(--primary))`},className:l(`relative shrink-0 border-b bg-background z-10`,a&&`sticky top-0 bg-background/85 backdrop-blur supports-[backdrop-filter]:bg-background/75`,o),"data-testid":s??`page-header`,children:[(0,k.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-[2px] opacity-80`,style:{background:`linear-gradient(90deg, transparent, var(--page-header-accent), transparent)`}}),(0,k.jsxs)(`div`,{className:`flex justify-between items-center gap-3 py-2.5 sm:py-3 px-4 sm:px-6`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[n&&(0,k.jsx)(`div`,{className:l(`shrink-0 inline-flex items-center justify-center rounded-lg`,`h-9 w-9 sm:h-10 sm:w-10`,`[&_svg]:h-[18px] [&_svg]:w-[18px] sm:[&_svg]:h-5 sm:[&_svg]:w-5`),style:{color:`var(--page-header-accent)`,background:`linear-gradient(135deg, color-mix(in srgb, var(--page-header-accent) 18%, transparent), color-mix(in srgb, var(--page-header-accent) 6%, transparent))`,boxShadow:`inset 0 0 0 1px color-mix(in srgb, var(--page-header-accent) 22%, transparent)`},children:n}),(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`h1`,{className:`text-base sm:text-lg lg:text-xl font-semibold tracking-tight text-foreground truncate leading-tight`,children:e}),t&&(0,k.jsx)(`p`,{className:`text-xs sm:text-sm text-muted-foreground truncate hidden sm:block max-w-xl mt-0.5`,children:t})]})]}),r&&(0,k.jsx)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0`,children:r})]})]})}function j(e){return[{type:`grid`,icon:d,label:e(`console.objectView.viewTypeGrid`),description:e(`console.objectView.viewTypeGridDesc`)},{type:`kanban`,icon:r,label:e(`console.objectView.viewTypeKanban`),description:e(`console.objectView.viewTypeKanbanDesc`)},{type:`calendar`,icon:b,label:e(`console.objectView.viewTypeCalendar`),description:e(`console.objectView.viewTypeCalendarDesc`)},{type:`gallery`,icon:s,label:e(`console.objectView.viewTypeGallery`),description:e(`console.objectView.viewTypeGalleryDesc`)},{type:`timeline`,icon:a,label:e(`console.objectView.viewTypeTimeline`),description:e(`console.objectView.viewTypeTimelineDesc`)},{type:`gantt`,icon:o,label:e(`console.objectView.viewTypeGantt`),description:e(`console.objectView.viewTypeGanttDesc`)},{type:`map`,icon:_,label:e(`console.objectView.viewTypeMap`),description:e(`console.objectView.viewTypeMapDesc`)},{type:`chart`,icon:u,label:e(`console.objectView.viewTypeChart`),description:e(`console.objectView.viewTypeChartDesc`)},{type:`tree`,icon:m,label:e(`console.objectView.viewTypeTree`),description:e(`console.objectView.viewTypeTreeDesc`)}]}function M(e,t){for(let n=1;n<1e3;n++){let r=`${e} ${n}`;if(!t.has(r))return r}return e}var N={kanban:[{key:`groupByField`,i18nKey:`console.objectView.groupByField`,helpI18nKey:`console.objectView.groupByFieldHelp`,filter:e=>e.type===`select`||e.type===`boolean`,preferred:w}],calendar:[{key:`startDateField`,i18nKey:`console.objectView.startDateField`,helpI18nKey:`console.objectView.startDateFieldHelp`,filter:e=>e.type===`date`,preferred:E},{key:`titleField`,i18nKey:`console.objectView.titleField`,helpI18nKey:`console.objectView.titleFieldHelp`,filter:e=>e.type===`text`}],timeline:[{key:`startDateField`,i18nKey:`console.objectView.startDateField`,helpI18nKey:`console.objectView.timelineDateFieldHelp`,filter:e=>e.type===`date`,preferred:E},{key:`titleField`,i18nKey:`console.objectView.titleField`,helpI18nKey:`console.objectView.titleFieldHelp`,filter:e=>e.type===`text`}],gantt:[{key:`startDateField`,i18nKey:`console.objectView.startDateField`,helpI18nKey:`console.objectView.ganttStartDateFieldHelp`,filter:e=>e.type===`date`,preferred:E},{key:`endDateField`,i18nKey:`console.objectView.endDateField`,helpI18nKey:`console.objectView.ganttEndDateFieldHelp`,filter:e=>e.type===`date`,preferred:D},{key:`titleField`,i18nKey:`console.objectView.titleField`,helpI18nKey:`console.objectView.titleFieldHelp`,filter:e=>e.type===`text`}],gallery:[{key:`coverField`,i18nKey:`console.objectView.imageField`,helpI18nKey:`console.objectView.imageFieldHelp`,filter:e=>T(e)}],map:[{key:`latitudeField`,i18nKey:`console.objectView.latitudeField`,helpI18nKey:`console.objectView.latitudeFieldHelp`,filter:e=>e.type===`number`&&S(e,`latitude`)},{key:`longitudeField`,i18nKey:`console.objectView.longitudeField`,helpI18nKey:`console.objectView.longitudeFieldHelp`,filter:e=>e.type===`number`&&S(e,`longitude`)}],chart:[{key:`chartType`,i18nKey:`console.objectView.chartType`,helpI18nKey:`console.objectView.chartTypeHelp`,kind:`enum`,enumOptions:[{value:`bar`,i18nKey:`console.objectView.chartTypeBar`},{value:`line`,i18nKey:`console.objectView.chartTypeLine`},{value:`pie`,i18nKey:`console.objectView.chartTypePie`},{value:`area`,i18nKey:`console.objectView.chartTypeArea`},{value:`scatter`,i18nKey:`console.objectView.chartTypeScatter`}],defaultValue:`bar`},{key:`xAxisField`,i18nKey:`console.objectView.xAxisField`,helpI18nKey:`console.objectView.xAxisFieldHelp`,filter:e=>e.type===`select`||e.type===`boolean`||e.type===`date`||e.type===`text`,preferred:w},{key:`yAxisFields`,i18nKey:`console.objectView.yAxisField`,helpI18nKey:`console.objectView.yAxisFieldHelp`,filter:e=>e.type===`number`}],tree:[{key:`parentField`,i18nKey:`console.objectView.parentField`,helpI18nKey:`console.objectView.parentFieldHelp`,filter:e=>e.rawType===`tree`||e.rawType===`lookup`||e.rawType===`master_detail`}]};function P({open:e,onOpenChange:t,onCreate:n,existingLabels:r,availableTypes:a,objectDef:o}){let{t:s}=v(),u=(0,O.useMemo)(()=>j(s),[s]),d=(0,O.useMemo)(()=>a&&a.length>0?u.filter(e=>a.includes(e.type)):u,[u,a]),m=(r??[]).join(`\0`),_=(0,O.useMemo)(()=>new Set(r??[]),[m]),b=(0,O.useMemo)(()=>o?C(o):[],[o]),[S,w]=(0,O.useState)(d[0]?.type??`grid`),[T,E]=(0,O.useState)(``),[D,A]=(0,O.useState)(!1),[P,F]=(0,O.useState)(``),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)({});(0,O.useEffect)(()=>{e&&(w(d[0]?.type??`grid`),A(!1),L(!1),z({}))},[e,d]),(0,O.useEffect)(()=>{if(!D){let e=d.find(e=>e.type===S);E(M(e?.label??`View`,_))}},[S,D,d,_]),(0,O.useEffect)(()=>{I||F(x(T))},[T,I]);let B=N[S]??[],V=e=>e.kind===`enum`?(e.enumOptions?.length??0)>0:!o||(e.filter?b.filter(e.filter):b).length>0,H=(0,O.useMemo)(()=>{let e={};return d.forEach(t=>{let n=(N[t.type]??[]).find(e=>!V(e));e[t.type]=n??null}),e},[d,b,o]),U=e=>R[`${S}.${e}`]??``,W=(e,t)=>z(n=>({...n,[`${S}.${e}`]:t})),G=T.trim(),K=G.length>0&&_.has(G),q=B.every(e=>U(e.key).length>0),J=/^[a-z_][a-z0-9_]*$/,Y=P.trim(),X=Y.length===0,Z=Y.length>0&&!J.test(Y),Q=G.length>0&&!K&&q&&!X&&!Z;(0,O.useEffect)(()=>{B.length!==0&&B.forEach(e=>{if(U(e.key).length>0)return;if(e.kind===`enum`){e.defaultValue&&W(e.key,e.defaultValue);return}let t=e.filter?b.filter(e.filter):b;if(t.length===0)return;if(t.length===1){W(e.key,t[0].value);return}let n=ne(t,e.preferred??[]);n&&W(e.key,n)})},[S,b]);let $=()=>{if(!Q)return;let e={};B.forEach(t=>{let n=U(t.key);n&&(e[t.key]=t.key===`yAxisFields`?[n]:n)});let r={type:S,label:G,name:Y};Object.keys(e).length>0&&(r[S]=e),n(r),t(!1)};return(0,k.jsx)(te,{open:e,onOpenChange:t,children:(0,k.jsxs)(f,{className:`sm:max-w-[560px]`,"data-testid":`create-view-dialog`,children:[(0,k.jsxs)(ee,{children:[(0,k.jsx)(g,{children:s(`console.objectView.createView`)}),(0,k.jsx)(h,{children:s(`console.objectView.createViewDesc`)})]}),(0,k.jsx)(`div`,{className:`grid grid-cols-4 gap-2 py-2`,"data-testid":`create-view-type-grid`,children:d.map(({type:e,label:t,description:n,icon:r})=>{let i=e===S,a=H[e],o=!!a,c=o?s(`console.objectView.viewTypeUnavailable`,{field:s(a.i18nKey)}):void 0;return(0,k.jsxs)(`button`,{type:`button`,"data-testid":`create-view-type-${e}`,"aria-pressed":i,"aria-disabled":o,disabled:o,title:c,onClick:()=>{o||w(e)},className:l(`group flex flex-col items-start gap-1 rounded-lg border bg-background p-3 text-left transition-colors`,!o&&`hover:border-primary/60 hover:bg-accent/40`,i&&!o?`border-primary ring-2 ring-primary/30 bg-accent/40`:`border-border`,o&&`opacity-50 cursor-not-allowed`),children:[(0,k.jsx)(r,{className:l(`h-5 w-5`,i&&!o?`text-primary`:`text-muted-foreground group-hover:text-foreground`)}),(0,k.jsx)(`div`,{className:`text-xs font-medium leading-tight`,children:t}),(0,k.jsx)(`div`,{className:`text-[10px] leading-tight text-muted-foreground line-clamp-2`,children:o?s(`console.objectView.viewTypeUnavailableShort`):n})]},e)})}),B.length>0&&(0,k.jsx)(`div`,{className:`space-y-3 rounded-md border border-dashed bg-muted/30 p-3`,"data-testid":`create-view-required-fields`,children:B.map(e=>{let t=U(e.key),n=e.kind===`enum`,r=n?[]:e.filter?b.filter(e.filter):b,i=!n&&b.length>0&&r.length===0;return(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsxs)(`label`,{htmlFor:`create-view-required-${e.key}`,className:`text-xs font-medium`,children:[s(e.i18nKey),(0,k.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,k.jsxs)(`select`,{id:`create-view-required-${e.key}`,"aria-required":`true`,"data-testid":`create-view-required-${e.key}`,value:t,onChange:t=>W(e.key,t.target.value),disabled:i,className:l(`h-9 w-full rounded-md border bg-background px-2 text-xs`,`border-input`),children:[(0,k.jsx)(`option`,{value:``,children:s(n?`console.objectView.selectOption`:`console.objectView.selectField`)}),n?e.enumOptions.map(e=>(0,k.jsx)(`option`,{value:e.value,children:s(e.i18nKey)},e.value)):r.map(e=>(0,k.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),e.helpI18nKey&&!i&&(0,k.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:s(e.helpI18nKey)}),i&&(0,k.jsxs)(`p`,{className:`flex items-center gap-1 text-[11px] text-destructive`,"data-testid":`create-view-error-no-field-${e.key}`,children:[(0,k.jsx)(p,{className:`h-3 w-3`}),s(`console.objectView.noEligibleFieldForType`)]})]},e.key)})}),(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsxs)(`label`,{htmlFor:`create-view-name-input`,className:`text-xs font-medium`,children:[s(`console.objectView.title`),(0,k.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,k.jsx)(c,{id:`create-view-name-input`,"aria-required":`true`,"data-testid":`create-view-name-input`,autoFocus:!0,value:T,onChange:e=>{E(e.target.value),A(!0)},onKeyDown:e=>{e.key===`Enter`&&Q&&$()},placeholder:s(`console.objectView.newView`),className:`h-9`}),K&&(0,k.jsx)(`p`,{className:`text-[11px] text-destructive`,"data-testid":`create-view-error-duplicate`,children:s(`console.objectView.duplicateViewName`)})]}),(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsxs)(`label`,{htmlFor:`create-view-machine-name-input`,className:`text-xs font-medium`,children:[s(`console.objectView.viewName`),(0,k.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,k.jsx)(c,{id:`create-view-machine-name-input`,"aria-required":`true`,"data-testid":`create-view-machine-name-input`,value:P,onChange:e=>{F(e.target.value),L(!0)},onKeyDown:e=>{e.key===`Enter`&&Q&&$()},placeholder:`grid_1`,className:`h-9 font-mono`}),X?(0,k.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,"data-testid":`create-view-machine-name-help`,children:s(`console.objectView.viewNameRequired`)}):Z?(0,k.jsx)(`p`,{className:`text-[11px] text-destructive`,"data-testid":`create-view-error-machine-name`,children:s(`console.objectView.viewNameInvalid`)}):(0,k.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,"data-testid":`create-view-machine-name-help`,children:s(`console.objectView.viewNameHelp`)})]}),(0,k.jsxs)(y,{className:`mt-2`,children:[(0,k.jsx)(i,{type:`button`,variant:`outline`,onClick:()=>t(!1),"data-testid":`create-view-cancel`,children:s(`console.objectView.cancel`)}),(0,k.jsx)(i,{type:`button`,disabled:!Q,onClick:$,"data-testid":`create-view-submit`,children:s(`console.objectView.create`)})]})]})})}export{A as n,P as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{m as n,r,y as i}from"./vendor-react-DpRf6e0g.js";import{N as a,P as o,b as s}from"./framework-
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{m as n,r,y as i}from"./vendor-react-DpRf6e0g.js";import{N as a,P as o,b as s}from"./framework-s0wcPYfi.js";import{Hr as c,dr as l,dt as u,fr as d,hr as f,mr as p,mt as m,ol as h,pr as g,tl as _,ur as v,ut as y,xo as b}from"./ui-components-BFOT5Gog.js";import{r as x}from"./vendor-ui-utils-CnzHPXVC.js";import"./AdapterProvider-BJ47DW1h.js";import{n as S}from"./plugin-form-B_6Tki5r.js";import"./MetadataProvider-DJXxy8nz.js";import{r as C}from"./ExpressionProvider-_qLpGaJS.js";import{t as w}from"./preferLocal-CKqyhTP9.js";import{t as T}from"./utils-CFdPTF34.js";import{n as E,t as D}from"./MetadataInspector-CoxLxxKN.js";import{n as O}from"./skeletons-BZIrujxl.js";import{n as k}from"./plugin-dashboard-B0k1x0iX.js";import{t as A}from"./useOpenRecordList-CptPt5Mv.js";var j=t({DashboardView:()=>P}),M=e(i(),1),N=r();function P({dataSource:e}){let t=A(),{dashboardName:r}=n(),{showDebug:i}=E(),j=a(),{t:P}=h(),{dashboardLabel:F,dashboardDescription:I}=_(),[L,R]=(0,M.useState)(!0),[z,B]=(0,M.useState)(null),V=(0,M.useCallback)(e=>{B(t=>(t&&t.resolve(e),null))},[]),H=(0,M.useCallback)(e=>new Promise(t=>{let n;if(typeof e==`string`){let t=e.match(/^(create|new|add|edit|update)_(.+)$/);if(t){let e=t[1];n={objectName:t[2],mode:e===`edit`||e===`update`?`edit`:`create`}}else n={objectName:e,mode:`create`}}else n=e;B({schema:n,resolve:t})}),[]),U=(0,M.useMemo)(()=>({export_dashboard_pdf:async()=>{x.info(P(`dashboardActions.pdfPreparing`));try{return window.print(),{success:!0}}catch(e){return x.error(P(`dashboardActions.exportFailed`,{message:e?.message||String(e)})),{success:!1,error:e?.message||String(e)}}},forecast_dashboard:async()=>(x.info(P(`dashboardActions.forecastSoon`)),{success:!0})}),[P]);(0,M.useEffect)(()=>{R(!0),queueMicrotask(()=>R(!1))},[r]);let{dashboards:W,objects:G}=o(),{app:K}=C(),q=w(W,r,K?._packageId),J=(0,M.useMemo)(()=>new Set((G||[]).map(e=>e?.name).filter(Boolean)),[G]),Y=(0,M.useMemo)(()=>{if(!q||J.size===0)return q;let e=q.widgets;if(!Array.isArray(e)||e.length===0)return q;let t=e.filter(e=>{let t=e?.requiresObject??e?.object;return!t||J.has(t)});return t.length===e.length?q:{...q,widgets:t}},[q,J]);return L?(0,N.jsx)(O,{}):q?(0,N.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,N.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,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(()=>{let e=T((Y||q).title,P),t=T(q.label,P),n=F({name:q.name,label:t}),r=e||n||q.name;return(0,N.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:r})})(),(()=>{let e=(Y||q).description??q.description,t=I({name:q.name,description:T(e,P)});return t?(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:t}):null})()]})}),(0,N.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,N.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-2 sm:p-4 md:p-6`,children:(0,N.jsx)(s,{value:{openRecordList:t},children:(0,N.jsx)(k,{schema:Y,dataSource:e,modalHandler:H,scriptHandlers:U,hideHeaderText:!0})})}),(0,N.jsx)(D,{open:i,sections:[{title:`Dashboard Configuration`,data:Y}]})]}),z&&z.schema?.objectName?(0,N.jsx)(S,{schema:{type:`object-form`,formType:`modal`,objectName:z.schema.objectName,mode:z.schema.mode||`create`,recordId:z.schema.recordId,title:z.schema.title,description:z.schema.description,fields:z.schema.fields,open:!0,onOpenChange:e=>{e||V({success:!1})},onSuccess:e=>{V({success:!0,reload:!0,data:e})},onCancel:()=>{V({success:!1})},showSubmit:!0,showCancel:!0},dataSource:j}):z?(0,N.jsx)(v,{open:!0,onOpenChange:e=>{e||V({success:!1})},children:(0,N.jsxs)(l,{children:[(0,N.jsxs)(p,{children:[(0,N.jsx)(f,{children:z.schema?.title||P(`actionDialog.defaultActionTitle`)}),z.schema?.description&&(0,N.jsx)(d,{children:z.schema.description})]}),(0,N.jsxs)(g,{children:[(0,N.jsx)(c,{variant:`outline`,onClick:()=>V({success:!1}),children:P(`actionDialog.cancel`)}),(0,N.jsx)(c,{onClick:()=>V({success:!0}),children:P(`actionDialog.ok`)})]})]})}):null]}):(0,N.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,N.jsxs)(y,{children:[(0,N.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,N.jsx)(b,{className:`h-6 w-6 text-muted-foreground`})}),(0,N.jsx)(m,{children:P(`empty.dashboardNotFound`)}),(0,N.jsx)(u,{children:P(`empty.dashboardNotFoundDescription`,{name:r})})]})})}export{j as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,m as t,r as n}from"./vendor-react-DpRf6e0g.js";import{
|
|
1
|
+
import{f as e,m as t,r as n}from"./vendor-react-DpRf6e0g.js";import{Cr as r,Sr as i,Zr as a,ba as o,br as s,is as c,wr as l,xi as u,xr as d}from"./ui-components-BFOT5Gog.js";var f=n();function p(){let n=e(),{appName:p}=t(),m=p?`/apps/${p}`:``,h=[{title:`Integrations & APIs`,description:`Your app as a REST API — base URL, endpoints, and connect samples`,icon:o,href:`${m}/developer/integrations`},{title:`API Console`,description:`Inspect and exercise REST endpoints with auto-discovered services`,icon:u,href:`${m}/developer/api-console`},{title:`Flow Runs`,description:`Trigger flows with sample inputs and inspect recent run history`,icon:a,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)(s,{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)(r,{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)(l,{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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./vendor-react-DpRf6e0g.js";import{
|
|
1
|
+
import{a as e,r as t}from"./vendor-react-DpRf6e0g.js";import{Ac as n}from"./ui-components-BFOT5Gog.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{Dn as r,at as i}from"./framework-s0wcPYfi.js";var a=e(n(),1),o=t(),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{r as t,y as n}from"./vendor-react-DpRf6e0g.js";import{y as r}from"./infrastructure-BKCMsWnH.js";import{N as i,P as a}from"./framework-s0wcPYfi.js";import{Bt as o,Cr as s,Er as c,Hr as l,Hs as u,Ht as d,Is as f,It as p,Lt as m,Mn as h,On as g,Rt as _,Sr as v,Vt as y,Zr as b,Zs as x,br as S,cn as C,dn as w,ec as T,fn as E,jt as D,mn as O,pn as k,ua as A,un as j,uo as M,wr as N,xa as P,xn as F,xr as I,zt as L}from"./ui-components-BFOT5Gog.js";import"./src--uGAhLxY.js";import{E as R}from"./RecordDetailView-aOOCQH95.js";var z=e(n(),1),B=t();function V({status:e}){let t={success:{icon:x,cls:`text-emerald-600 border-emerald-300`},completed:{icon:x,cls:`text-emerald-600 border-emerald-300`},failed:{icon:u,cls:`text-red-600 border-red-300`},error:{icon:u,cls:`text-red-600 border-red-300`},running:{icon:M,cls:`text-blue-600 border-blue-300 animate-pulse`},pending:{icon:f,cls:`text-amber-600 border-amber-300`},paused:{icon:f,cls:`text-amber-600 border-amber-300`},skipped:{icon:T,cls:`text-muted-foreground`}}[e]??{icon:T,cls:`text-muted-foreground`},n=t.icon;return(0,B.jsxs)(c,{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),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(0),m=(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),!u&&r.length>0&&d(r[0].name)}catch(e){c(e?.message??String(e))}finally{a(!1)}},[e,u]);(0,z.useEffect)(()=>{m()},[m]);let h=(0,z.useMemo)(()=>t.find(e=>e.name===u)??null,[t,u]);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)(b,{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)(S,{children:[(0,B.jsx)(s,{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)(N,{className:`text-base`,children:`Flow`}),(0,B.jsx)(v,{children:`Select a flow definition to test`})]}),(0,B.jsxs)(l,{variant:`outline`,size:`sm`,onClick:m,disabled:r,children:[(0,B.jsx)(A,{className:`h-3.5 w-3.5 mr-2 ${r?`animate-spin`:``}`}),`Refresh`]})]})}),(0,B.jsxs)(I,{children:[r&&(0,B.jsx)(C,{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:u,onChange:e=>d(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))})]})]}),h&&(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsx)(K,{client:e,flow:h.spec,onExecuted:()=>p(e=>e+1)}),(0,B.jsx)(q,{client:e,flowName:h.name,refreshKey:f})]})]})}function K({client:e,flow:t,onExecuted:n}){let o=(0,z.useMemo)(()=>(t?.variables??[]).filter(e=>e?.isInput),[t]),p=i(),{objects:m}=a(),_=(0,z.useMemo)(()=>r(),[]),[y,b]=(0,z.useState)({}),[C,w]=(0,z.useState)(!1),[T,E]=(0,z.useState)(null),[O,k]=(0,z.useState)(null),[A,j]=(0,z.useState)(null);(0,z.useEffect)(()=>{b({}),E(null),k(null),j(null)},[t?.name]);let F=(e,t)=>b(n=>({...n,[e]:t}));return(0,B.jsxs)(S,{children:[(0,B.jsxs)(s,{className:`pb-3`,children:[(0,B.jsx)(N,{className:`text-base`,children:`Test Run`}),(0,B.jsx)(v,{children:`Provide input values and invoke the flow`})]}),(0,B.jsxs)(I,{className:`space-y-3`,children:[o.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.`}),o.map(e=>(0,B.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,B.jsxs)(h,{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)(c,{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)(d,{id:`var-${e.name}`,checked:y[e.name]===`true`,onCheckedChange:t=>F(e.name,t?`true`:`false`)}),(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y[e.name]===`true`?`true`:`false`})]}):e.type===`object`||e.type===`list`||e.type===`array`?(0,B.jsx)(D,{id:`var-${e.name}`,placeholder:`JSON ${e.type}`,value:y[e.name]??``,onChange:t=>F(e.name,t.target.value),className:`font-mono text-xs min-h-[80px]`}):(0,B.jsx)(g,{id:`var-${e.name}`,type:e.type===`number`?`number`:`text`,value:y[e.name]??``,onChange:t=>F(e.name,t.target.value)})]},e.name)),(0,B.jsx)(`div`,{className:`pt-1`,children:(0,B.jsxs)(l,{onClick:async()=>{if(!e?.automation?.execute){k(`automation.execute is not available on this client`);return}w(!0),k(null),E(null),j(null);try{let r={};for(let e of o){let t=y[e.name];t!==void 0&&(r[e.name]=U(t,e.type))}let i=await e.automation.execute(t.name,{params:r});E(i),i?.status===`paused`&&i?.screen&&i?.runId&&j({flowName:t.name,runId:i.runId,screen:i.screen}),n?.()}catch(e){k(e?.message??String(e))}finally{w(!1)}},disabled:C,size:`sm`,children:[C?(0,B.jsx)(M,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,B.jsx)(P,{className:`h-3.5 w-3.5 mr-2`}),C?`Running…`:`Run Flow`]})}),(T||O)&&(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:[O||T?.success===!1?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u,{className:`h-4 w-4 text-red-500`}),` Failed`]}):T?.status===`paused`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(f,{className:`h-4 w-4 text-amber-500`}),` Waiting for input`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(x,{className:`h-4 w-4 text-emerald-500`}),` Result`]}),typeof T?.durationMs==`number`&&(0,B.jsxs)(c,{variant:`secondary`,className:`text-[10px] font-mono`,children:[T.durationMs,` ms`]})]}),O&&(0,B.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:O}),T?.status===`paused`&&T?.screen&&T?.runId&&!A&&(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:T.screen.nodeId}),`.`]}),(0,B.jsx)(l,{size:`sm`,variant:`outline`,onClick:()=>j({flowName:t.name,runId:T.runId,screen:T.screen}),children:`Continue run`})]}),T&&(0,B.jsx)(W,{data:T})]})]}),(0,B.jsx)(R,{state:A,authFetch:_,baseUrl:``,dataSource:p,objects:m,onClose:()=>{j(null),n?.()},onComplete:()=>{j(null),n?.()}})]})}function q({client:e,flowName:t,refreshKey:n}){let[r,i]=(0,z.useState)([]),[a,u]=(0,z.useState)(!0),[d,f]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),[b,x]=(0,z.useState)(null),[T,D]=(0,z.useState)(!1),[P,R]=(0,z.useState)(null),U=(0,z.useCallback)(async()=>{if(!e?.automation?.listRuns){f(`automation.listRuns is not available on this client`),u(!1);return}u(!0),f(null);try{let n=await e.automation.listRuns(t,{limit:20}),r=Array.isArray(n)?n:n?.items??n?.runs??[];i(r)}catch(e){f(e?.message??String(e))}finally{u(!1)}},[e,t]);(0,z.useEffect)(()=>{U()},[U,n]);let G=async n=>{g(n),x(null),R(null),D(!0);try{let r=await e.automation.getRun(t,n);x(r?.run??r)}catch(e){R(e?.message??String(e))}finally{D(!1)}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(S,{children:[(0,B.jsx)(s,{className:`pb-3`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(N,{className:`text-base`,children:`Recent Runs`}),(0,B.jsx)(v,{className:`font-mono text-xs`,children:t})]}),(0,B.jsxs)(l,{variant:`outline`,size:`sm`,onClick:U,disabled:a,children:[a?(0,B.jsx)(M,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,B.jsx)(A,{className:`h-3.5 w-3.5 mr-2`}),`Refresh`]})]})}),(0,B.jsxs)(I,{children:[a&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(C,{className:`h-8 w-full`}),(0,B.jsx)(C,{className:`h-8 w-full`}),(0,B.jsx)(C,{className:`h-8 w-full`})]}),!a&&d&&(0,B.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:d}),!a&&!d&&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&&!d&&r.length>0&&(0,B.jsxs)(p,{children:[(0,B.jsx)(o,{children:(0,B.jsxs)(y,{children:[(0,B.jsx)(L,{children:`Run`}),(0,B.jsx)(L,{children:`Status`}),(0,B.jsx)(L,{children:`Started`}),(0,B.jsx)(L,{className:`text-right`,children:`Duration`})]})}),(0,B.jsx)(m,{children:r.map(e=>(0,B.jsxs)(y,{className:`cursor-pointer`,onClick:()=>G(e.id),children:[(0,B.jsxs)(_,{className:`font-mono text-xs`,children:[e.id.slice(0,12),`…`]}),(0,B.jsx)(_,{children:(0,B.jsx)(V,{status:e.status})}),(0,B.jsx)(_,{className:`text-xs text-muted-foreground`,children:H(e.startedAt)}),(0,B.jsx)(_,{className:`text-right font-mono text-xs`,children:typeof e.durationMs==`number`?`${e.durationMs} ms`:`—`})]},e.id))})]})]})]}),(0,B.jsx)(j,{open:!!h,onOpenChange:e=>{e||(g(null),x(null))},children:(0,B.jsxs)(w,{side:`right`,className:`w-full sm:max-w-2xl p-0 flex flex-col`,children:[(0,B.jsxs)(k,{className:`p-4 border-b`,children:[(0,B.jsxs)(O,{className:`font-mono text-sm break-all`,children:[`Run `,h]}),(0,B.jsx)(E,{children:b&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(V,{status:b.status}),typeof b.durationMs==`number`&&(0,B.jsxs)(c,{variant:`secondary`,className:`text-[10px] font-mono`,children:[b.durationMs,` ms`]}),(0,B.jsx)(`span`,{className:`text-xs`,children:H(b.startedAt)})]})})]}),(0,B.jsxs)(F,{className:`flex-1 p-4`,children:[T&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(C,{className:`h-16 w-full`}),(0,B.jsx)(C,{className:`h-16 w-full`}),(0,B.jsx)(C,{className:`h-16 w-full`})]}),P&&(0,B.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:P}),!T&&b&&(0,B.jsx)(`div`,{className:`space-y-3`,children:Array.isArray(b.steps)&&b.steps.length>0?b.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)(c,{variant:`outline`,className:`text-[10px] font-mono`,children:e.nodeType}),(0,B.jsx)(V,{status:e.status}),typeof e.durationMs==`number`&&(0,B.jsxs)(c,{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:b})]})})]})]})})]})}export{G as FlowRunsPage};
|