@objectstack/console 17.1.0 → 17.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +120 -0
- package/dist/.objectstack-injection.json +2 -2
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-3zTVoQKF.js → AdapterProvider-gULVLpjV.js} +1 -1
- package/dist/assets/AiPendingActionsPage-CyG11hX9.js +1 -0
- package/dist/assets/ApiConsolePage-DYuOp_W4.js +1 -0
- package/dist/assets/{AppDocsIndex-DVrJTsbv.js → AppDocsIndex-BXkNskk1.js} +1 -1
- package/dist/assets/AppManagementPage-BvSxDdA_.js +1 -0
- package/dist/assets/ApprovalsInboxPage-oep3a-Ek.js +1 -0
- package/dist/assets/AuditLogPage-BZZ6tzHu.js +1 -0
- package/dist/assets/ComponentNavView-Cq4wkNUa.js +1 -0
- package/dist/assets/{DashboardView-CTBV4_tx.js → DashboardView-C23ZCS2S.js} +1 -1
- package/dist/assets/{DeveloperHubPage-CWq2uYpr.js → DeveloperHubPage-KEpKc45V.js} +1 -1
- package/dist/assets/DocPage-Y4rWCZ3E.js +1 -0
- package/dist/assets/{DocShell-UFsFTSr-.js → DocShell-DMJHUgE5.js} +1 -1
- package/dist/assets/DocsIndex-Bb5OtPb3.js +1 -0
- package/dist/assets/DocsLayout-CoIVTMH_.js +1 -0
- package/dist/assets/DocsSlug-BARWHmXg.js +1 -0
- package/dist/assets/{ExpressionProvider-X1OAB_O-.js → ExpressionProvider-vGLngw8h.js} +1 -1
- package/dist/assets/FlowRunsPage-BeGa9_ge.js +1 -0
- package/dist/assets/{IntegrationsPage-DdKbqwGE.js → IntegrationsPage-DTXA-Nne.js} +2 -2
- package/dist/assets/{InterfaceListPage-FCdy-_Q-.js → InterfaceListPage-BMvedZyV.js} +1 -1
- package/dist/assets/{ManagedByBadge-Bap9_dqR.js → ManagedByBadge-mKmG0hP7.js} +1 -1
- package/dist/assets/MarketplaceAccessDenied-BBMyNu2w.js +1 -0
- package/dist/assets/{MarketplaceInstalledPage-Cv-qDRNA.js → MarketplaceInstalledPage-B4qrvb7w.js} +1 -1
- package/dist/assets/MarketplacePackagePage-BuVfVeBj.js +4 -0
- package/dist/assets/MarketplacePage-Cmltk5nG.js +1 -0
- package/dist/assets/{MetadataInspector-CNeJqkLQ.js → MetadataInspector-kVAu8vlh.js} +1 -1
- package/dist/assets/{MetadataProvider-DwMR1SMR.js → MetadataProvider-DyFZSNqq.js} +1 -1
- package/dist/assets/ObjectDataPage-BKHEYwXA.js +1 -0
- package/dist/assets/{PageView-XUBdr6tb.js → PageView-CTqS-VD9.js} +1 -1
- package/dist/assets/ProfilePage-CBUxXn5a.js +1 -0
- package/dist/assets/PublicFormsPage-B8Dk8fky.js +1 -0
- package/dist/assets/RecordDetailView-BBNqsNy9.js +11 -0
- package/dist/assets/{RecordFormPage-CLZcT8Z0.js → RecordFormPage-CeUmmc_n.js} +1 -1
- package/dist/assets/ReportDefaultInspector-CRjDi2Er.js +3 -0
- package/dist/assets/ReportView-Cwi_Po4H.js +2 -0
- package/dist/assets/{SearchResultsPage-lgNcs7l7.js → SearchResultsPage-Cg0oq2by.js} +1 -1
- package/dist/assets/{SettingsHub-TQOc7wH3.js → SettingsHub-B5_S9YgI.js} +1 -1
- package/dist/assets/{SettingsView-DAje5pDB.js → SettingsView-Csi1awf-.js} +1 -1
- package/dist/assets/SystemHubPage-CnDri9oU.js +1 -0
- package/dist/assets/{createDerive-xZXxMz1g.js → createDerive-B3AGnDaY.js} +1 -1
- package/dist/assets/dist-Ck19TqqJ.js +5 -0
- package/dist/assets/framework-BwfIhdyz.js +55 -0
- package/dist/assets/getIcon-1ZXs1v-a.js +1 -0
- package/dist/assets/{highlighted-body-OFNGDK62-DUQut-ZU.js → highlighted-body-OFNGDK62-CnGKNo0r.js} +1 -1
- package/dist/assets/i18n-rra-09wp.js +9 -0
- package/dist/assets/index-BLepsDd_.js +19 -0
- package/dist/assets/index-D26gl3rg.css +2 -0
- package/dist/assets/{infrastructure-CerjT_c2.js → infrastructure-BCTDJsqi.js} +2 -2
- package/dist/assets/mermaid-GHXKKRXX-CR9PcY0X.js +1 -0
- package/dist/assets/metadata-admin-BE9_-F_f.js +25 -0
- package/dist/assets/plugin-calendar-BfY9ZunQ.js +1 -0
- package/dist/assets/plugin-charts-CmWL7Og-.js +7 -0
- package/dist/assets/plugin-chatbot-mxoQfkdx.js +120 -0
- package/dist/assets/plugin-dashboard-CzbAW1Rz.js +6 -0
- package/dist/assets/plugin-form-ItAwTFz-.js +1 -0
- package/dist/assets/plugin-gantt-DF5W5xkN.js +64 -0
- package/dist/assets/plugin-grid-B42Photo.js +9 -0
- package/dist/assets/plugin-kanban-Dh3HIJIm.js +1 -0
- package/dist/assets/{plugin-map-CQAe4Yh6.js → plugin-map-C1wSLqlB.js} +1 -1
- package/dist/assets/{plugin-markdown-7fyNN0UM.js → plugin-markdown-DNllWgPM.js} +1 -1
- package/dist/assets/{plugin-report-01bEGHuR.js → plugin-report-yfOfZPQg.js} +3 -3
- package/dist/assets/plugin-timeline-BpuaaqBd.js +1 -0
- package/dist/assets/{plugin-tree-DW0XC55y.js → plugin-tree-BrXE50se.js} +1 -1
- package/dist/assets/plugin-view-Jc0rkk7A.js +1 -0
- package/dist/assets/plugins-views-cOiN-mPq.js +4 -0
- package/dist/assets/{runtime-metadata-persistence-DpS5GXuQ.js → runtime-metadata-persistence-DTOJpVmd.js} +1 -1
- package/dist/assets/{skeletons-DVwGbFUS.js → skeletons-BwA1TSR2.js} +1 -1
- package/dist/assets/src-BLbFBP_B.js +1 -0
- package/dist/assets/{src-ClOOPIkS.js → src-DhAd4aY4.js} +1 -1
- package/dist/assets/ui-components-Dwq5utCl.js +42 -0
- package/dist/assets/ui-layout-DPFlQaQp.js +1 -0
- package/dist/assets/use-book-data-CZc8MJsb.js +1 -0
- package/dist/assets/{useActionModal-Z2yDiihK.js → useActionModal-DYiSBx1G.js} +1 -1
- package/dist/assets/usePackageL10n-D91-102Q.js +1 -0
- package/dist/assets/{useSettingsLabel-CvZKl8CQ.js → useSettingsLabel-CeZ36S4g.js} +1 -1
- package/dist/assets/vendor-objectstack-B1R3ym-9.js +264 -0
- package/dist/eager-closure.json +277 -0
- package/dist/index.html +54 -14
- package/package.json +1 -1
- package/dist/assets/AiPendingActionsPage-DD5DLXIK.js +0 -1
- package/dist/assets/ApiConsolePage-CSQNdOPN.js +0 -1
- package/dist/assets/AppManagementPage-vRCBT69X.js +0 -1
- package/dist/assets/ApprovalsInboxPage-Bft5QF0I.js +0 -1
- package/dist/assets/AuditLogPage-B-2e1YhN.js +0 -1
- package/dist/assets/ComponentNavView-BVbkfJfE.js +0 -1
- package/dist/assets/CreateViewDialog-CW0w7Nxc.js +0 -1
- package/dist/assets/FlowRunsPage-CUhBLwm-.js +0 -1
- package/dist/assets/MarketplaceAccessDenied-CrK7hygV.js +0 -1
- package/dist/assets/MarketplacePackagePage-CMS--SE2.js +0 -4
- package/dist/assets/MarketplacePage-njErv-tN.js +0 -1
- package/dist/assets/ObjectDataPage-BVV4yksz.js +0 -1
- package/dist/assets/ProfilePage-ClU0WVRr.js +0 -1
- package/dist/assets/PublicFormsPage-a_MNzdQw.js +0 -1
- package/dist/assets/RecordDetailView-uf81gH3J.js +0 -11
- package/dist/assets/ReportDefaultInspector-DU2azDYd.js +0 -3
- package/dist/assets/ReportView-oFhBKNBE.js +0 -2
- package/dist/assets/SystemHubPage-DUE-2-vc.js +0 -1
- package/dist/assets/componentRegistry-ByxoJqMW.js +0 -1
- package/dist/assets/dist-jor1XT9f.js +0 -5
- package/dist/assets/framework-LCCQTTcs.js +0 -47
- package/dist/assets/getIcon-Bnm_i39L.js +0 -1
- package/dist/assets/i18n-DGSduXFT.js +0 -9
- package/dist/assets/index-ZtYnn1PE.css +0 -2
- package/dist/assets/index-mpVXni3j.js +0 -2
- package/dist/assets/mermaid-GHXKKRXX-DQTMu5TJ.js +0 -1
- package/dist/assets/metadata-admin-C_DEFfDE.js +0 -25
- package/dist/assets/plugin-calendar-ClpbcK3u.js +0 -1
- package/dist/assets/plugin-charts-Cq0LpABN.js +0 -7
- package/dist/assets/plugin-chatbot-Cq7rZtnW.js +0 -120
- package/dist/assets/plugin-dashboard-C8Ohdrxi.js +0 -6
- package/dist/assets/plugin-form-B7CBtYvZ.js +0 -1
- package/dist/assets/plugin-gantt-ChkG9_UG.js +0 -64
- package/dist/assets/plugin-grid-D49BBhCX.js +0 -8
- package/dist/assets/plugin-kanban-BsTsRjoP.js +0 -1
- package/dist/assets/plugin-timeline-Dw4Lj2Rz.js +0 -1
- package/dist/assets/plugin-view-B9yCVdSX.js +0 -1
- package/dist/assets/plugins-views-BaBStVok.js +0 -4
- package/dist/assets/src-BA9h8a8o.js +0 -1
- package/dist/assets/src-Ctj_ivDh.js +0 -19
- package/dist/assets/ui-components-3mb69z8L.js +0 -42
- package/dist/assets/ui-layout-DpuFph25.js +0 -1
- package/dist/assets/use-book-data-BZg_051K.js +0 -1
- package/dist/assets/usePackageL10n-Cy-u65Zo.js +0 -1
- package/dist/assets/vendor-objectstack-DGpW4oR-.js +0 -158
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
{
|
|
2
|
+
"reportVersion": 1,
|
|
3
|
+
"entryChunks": [
|
|
4
|
+
"assets/index-BLepsDd_.js"
|
|
5
|
+
],
|
|
6
|
+
"eagerChunkCount": 53,
|
|
7
|
+
"totalChunkCount": 509,
|
|
8
|
+
"eagerGzipBytes": 3446165,
|
|
9
|
+
"eagerRawBytes": 11867076,
|
|
10
|
+
"files": [
|
|
11
|
+
{
|
|
12
|
+
"fileName": "assets/AdapterProvider-gULVLpjV.js",
|
|
13
|
+
"bytes": 3296,
|
|
14
|
+
"gzipBytes": 1620
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"fileName": "assets/DashboardView-C23ZCS2S.js",
|
|
18
|
+
"bytes": 3383,
|
|
19
|
+
"gzipBytes": 1567
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"fileName": "assets/ExpressionProvider-vGLngw8h.js",
|
|
23
|
+
"bytes": 971,
|
|
24
|
+
"gzipBytes": 483
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"fileName": "assets/InterfaceListPage-BMvedZyV.js",
|
|
28
|
+
"bytes": 8319,
|
|
29
|
+
"gzipBytes": 3627
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"fileName": "assets/ManagedByBadge-mKmG0hP7.js",
|
|
33
|
+
"bytes": 3385,
|
|
34
|
+
"gzipBytes": 1509
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"fileName": "assets/MarketplaceAccessDenied-BBMyNu2w.js",
|
|
38
|
+
"bytes": 11579,
|
|
39
|
+
"gzipBytes": 3252
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"fileName": "assets/MarketplaceInstalledPage-B4qrvb7w.js",
|
|
43
|
+
"bytes": 5121,
|
|
44
|
+
"gzipBytes": 1832
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"fileName": "assets/MarketplacePackagePage-BuVfVeBj.js",
|
|
48
|
+
"bytes": 28285,
|
|
49
|
+
"gzipBytes": 7652
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"fileName": "assets/MarketplacePage-Cmltk5nG.js",
|
|
53
|
+
"bytes": 10217,
|
|
54
|
+
"gzipBytes": 3100
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"fileName": "assets/MetadataInspector-kVAu8vlh.js",
|
|
58
|
+
"bytes": 2548,
|
|
59
|
+
"gzipBytes": 1087
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"fileName": "assets/MetadataProvider-DyFZSNqq.js",
|
|
63
|
+
"bytes": 9164,
|
|
64
|
+
"gzipBytes": 3656
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"fileName": "assets/PageView-CTqS-VD9.js",
|
|
68
|
+
"bytes": 2691,
|
|
69
|
+
"gzipBytes": 1315
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"fileName": "assets/RecordDetailView-BBNqsNy9.js",
|
|
73
|
+
"bytes": 142174,
|
|
74
|
+
"gzipBytes": 47218
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"fileName": "assets/RecordFormPage-CeUmmc_n.js",
|
|
78
|
+
"bytes": 5024,
|
|
79
|
+
"gzipBytes": 2280
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"fileName": "assets/ReportDefaultInspector-CRjDi2Er.js",
|
|
83
|
+
"bytes": 120950,
|
|
84
|
+
"gzipBytes": 33134
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"fileName": "assets/ReportView-Cwi_Po4H.js",
|
|
88
|
+
"bytes": 11576,
|
|
89
|
+
"gzipBytes": 4115
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"fileName": "assets/SearchResultsPage-Cg0oq2by.js",
|
|
93
|
+
"bytes": 6910,
|
|
94
|
+
"gzipBytes": 2414
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"fileName": "assets/assistantBus-DNH-fDWN.js",
|
|
98
|
+
"bytes": 937,
|
|
99
|
+
"gzipBytes": 477
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"fileName": "assets/createDerive-B3AGnDaY.js",
|
|
103
|
+
"bytes": 4465,
|
|
104
|
+
"gzipBytes": 1839
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"fileName": "assets/dist-BK-OswHQ.js",
|
|
108
|
+
"bytes": 14262,
|
|
109
|
+
"gzipBytes": 4851
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"fileName": "assets/drillUrlFilters-DHAQHZbx.js",
|
|
113
|
+
"bytes": 1089,
|
|
114
|
+
"gzipBytes": 607
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"fileName": "assets/framework-BwfIhdyz.js",
|
|
118
|
+
"bytes": 1717850,
|
|
119
|
+
"gzipBytes": 514756
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"fileName": "assets/getIcon-1ZXs1v-a.js",
|
|
123
|
+
"bytes": 576,
|
|
124
|
+
"gzipBytes": 380
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"fileName": "assets/i18n-rra-09wp.js",
|
|
128
|
+
"bytes": 215367,
|
|
129
|
+
"gzipBytes": 59417
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"fileName": "assets/index-BLepsDd_.js",
|
|
133
|
+
"bytes": 617691,
|
|
134
|
+
"gzipBytes": 156313
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"fileName": "assets/infrastructure-BCTDJsqi.js",
|
|
138
|
+
"bytes": 101065,
|
|
139
|
+
"gzipBytes": 29460
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"fileName": "assets/metadata-admin-BE9_-F_f.js",
|
|
143
|
+
"bytes": 711899,
|
|
144
|
+
"gzipBytes": 180055
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"fileName": "assets/plugin-chatbot-mxoQfkdx.js",
|
|
148
|
+
"bytes": 565657,
|
|
149
|
+
"gzipBytes": 162344
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"fileName": "assets/plugin-dashboard-CzbAW1Rz.js",
|
|
153
|
+
"bytes": 166327,
|
|
154
|
+
"gzipBytes": 47661
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"fileName": "assets/plugin-form-ItAwTFz-.js",
|
|
158
|
+
"bytes": 97813,
|
|
159
|
+
"gzipBytes": 26474
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"fileName": "assets/plugin-grid-B42Photo.js",
|
|
163
|
+
"bytes": 171114,
|
|
164
|
+
"gzipBytes": 51862
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"fileName": "assets/plugin-view-Jc0rkk7A.js",
|
|
168
|
+
"bytes": 61234,
|
|
169
|
+
"gzipBytes": 16838
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"fileName": "assets/plugins-views-cOiN-mPq.js",
|
|
173
|
+
"bytes": 245077,
|
|
174
|
+
"gzipBytes": 68430
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"fileName": "assets/preferLocal-CKqyhTP9.js",
|
|
178
|
+
"bytes": 148,
|
|
179
|
+
"gzipBytes": 131
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"fileName": "assets/rolldown-runtime-C0FnF6B9.js",
|
|
183
|
+
"bytes": 1291,
|
|
184
|
+
"gzipBytes": 710
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"fileName": "assets/runtime-metadata-persistence-DTOJpVmd.js",
|
|
188
|
+
"bytes": 1589,
|
|
189
|
+
"gzipBytes": 780
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"fileName": "assets/skeletons-BwA1TSR2.js",
|
|
193
|
+
"bytes": 2541,
|
|
194
|
+
"gzipBytes": 600
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"fileName": "assets/ui-components-Dwq5utCl.js",
|
|
198
|
+
"bytes": 1515083,
|
|
199
|
+
"gzipBytes": 389378
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"fileName": "assets/ui-layout-DPFlQaQp.js",
|
|
203
|
+
"bytes": 26593,
|
|
204
|
+
"gzipBytes": 8641
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"fileName": "assets/useActionModal-DYiSBx1G.js",
|
|
208
|
+
"bytes": 5207,
|
|
209
|
+
"gzipBytes": 2111
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"fileName": "assets/useOpenRecordList-DOZu_JZX.js",
|
|
213
|
+
"bytes": 348,
|
|
214
|
+
"gzipBytes": 275
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"fileName": "assets/usePackageL10n-D91-102Q.js",
|
|
218
|
+
"bytes": 2629,
|
|
219
|
+
"gzipBytes": 1222
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"fileName": "assets/utils-CJ4UwXMF.js",
|
|
223
|
+
"bytes": 1570,
|
|
224
|
+
"gzipBytes": 724
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"fileName": "assets/vendor-charts-BEGSmcjR.js",
|
|
228
|
+
"bytes": 585391,
|
|
229
|
+
"gzipBytes": 160450
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"fileName": "assets/vendor-dndkit-CkJ59XFL.js",
|
|
233
|
+
"bytes": 49342,
|
|
234
|
+
"gzipBytes": 15947
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"fileName": "assets/vendor-i18n-Cpia2wlg.js",
|
|
238
|
+
"bytes": 47684,
|
|
239
|
+
"gzipBytes": 15489
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"fileName": "assets/vendor-icons-core-Bi9GWsvI.js",
|
|
243
|
+
"bytes": 1437,
|
|
244
|
+
"gzipBytes": 809
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"fileName": "assets/vendor-markdown-C_Ip9E_I.js",
|
|
248
|
+
"bytes": 529445,
|
|
249
|
+
"gzipBytes": 164708
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"fileName": "assets/vendor-objectstack-B1R3ym-9.js",
|
|
253
|
+
"bytes": 3420490,
|
|
254
|
+
"gzipBytes": 1061191
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"fileName": "assets/vendor-radix-DFmVRiEf.js",
|
|
258
|
+
"bytes": 206697,
|
|
259
|
+
"gzipBytes": 60419
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"fileName": "assets/vendor-react-CsWFRkED.js",
|
|
263
|
+
"bytes": 260973,
|
|
264
|
+
"gzipBytes": 82137
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"fileName": "assets/vendor-ui-utils-BFw4cGI6.js",
|
|
268
|
+
"bytes": 61909,
|
|
269
|
+
"gzipBytes": 18123
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"fileName": "assets/vendor-zod-r9lyeyrU.js",
|
|
273
|
+
"bytes": 78693,
|
|
274
|
+
"gzipBytes": 20695
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
}
|
package/dist/index.html
CHANGED
|
@@ -15,19 +15,59 @@
|
|
|
15
15
|
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
|
16
16
|
<link rel="manifest" href="./manifest.json" />
|
|
17
17
|
<title></title>
|
|
18
|
+
<!--
|
|
19
|
+
Pre-React branding, and the page's ONE `GET /api/v1/runtime/config`
|
|
20
|
+
(objectui#5544).
|
|
21
|
+
|
|
22
|
+
This script runs during parse so the title and favicon are the operator's
|
|
23
|
+
before the bundle is even fetched. `initRuntimeConfig()` in
|
|
24
|
+
`@object-ui/app-shell` then needs the same payload — and used to fetch it a
|
|
25
|
+
second time, which is the `runtime/config ×2` the card measured on both
|
|
26
|
+
prod and staging. It is the expensive kind of duplicate: the console
|
|
27
|
+
`await`s that second call before `createRoot().render()`, so it sits on the
|
|
28
|
+
critical path to first paint.
|
|
29
|
+
|
|
30
|
+
The fix is in-flight SHARING, not caching. We publish this request's parsed
|
|
31
|
+
-body promise into the registry `@object-ui/types` keeps on `globalThis`
|
|
32
|
+
(`Symbol.for('objectui.inflightGet')`), and delete the entry the moment it
|
|
33
|
+
settles. `sharedGetJson()` finds it and joins, so app-shell inherits a
|
|
34
|
+
request that started hundreds of ms earlier instead of starting its own; if
|
|
35
|
+
it ever arrives after settle it simply fetches, exactly as before.
|
|
36
|
+
|
|
37
|
+
Why the key is spelled out by hand here: a classic inline script cannot
|
|
38
|
+
import, and it must stay classic (see the crypto shim's comment below for
|
|
39
|
+
the measurement that rules out `type="module"` ordering). The format is
|
|
40
|
+
owned by `inflightGetKey()` in `packages/types/src/http-inflight.ts`, and
|
|
41
|
+
`src/__tests__/runtimeConfigBootDedup.test.ts` executes THIS script's text
|
|
42
|
+
against that function — so a drift between the two spellings fails a test
|
|
43
|
+
rather than silently restoring the duplicate.
|
|
44
|
+
|
|
45
|
+
Falls back gracefully on any error (non-blocking).
|
|
46
|
+
-->
|
|
18
47
|
<script>
|
|
19
|
-
// Pre-React branding — fetch runtime config as early as possible so the
|
|
20
|
-
// browser title and favicon reflect the operator's branding BEFORE React
|
|
21
|
-
// mounts. Falls back gracefully on any error (non-blocking).
|
|
22
48
|
(async function applyEarlyBranding() {
|
|
49
|
+
const base = (window.__CONSOLE_SERVER_URL || '').replace(/\/+$/, '');
|
|
50
|
+
const url = base + '/api/v1/runtime/config';
|
|
51
|
+
const init = { credentials: 'include', headers: { Accept: 'application/json' } };
|
|
52
|
+
// Must equal inflightGetKey(url, init) — see the comment above.
|
|
53
|
+
const key = 'GET\ninclude\n' + url + '\naccept=application/json';
|
|
54
|
+
|
|
55
|
+
const registryKey = Symbol.for('objectui.inflightGet');
|
|
56
|
+
const registry = globalThis[registryKey] || (globalThis[registryKey] = new Map());
|
|
57
|
+
|
|
58
|
+
const pending = (async function () {
|
|
59
|
+
const res = await fetch(url, init);
|
|
60
|
+
if (!res.ok) throw new Error('runtime/config ' + res.status);
|
|
61
|
+
return res.json();
|
|
62
|
+
})();
|
|
63
|
+
registry.set(key, pending);
|
|
64
|
+
const drop = function () {
|
|
65
|
+
if (registry.get(key) === pending) registry.delete(key);
|
|
66
|
+
};
|
|
67
|
+
pending.then(drop, drop);
|
|
68
|
+
|
|
23
69
|
try {
|
|
24
|
-
const
|
|
25
|
-
const res = await fetch(base + '/api/v1/runtime/config', {
|
|
26
|
-
credentials: 'include',
|
|
27
|
-
headers: { Accept: 'application/json' },
|
|
28
|
-
});
|
|
29
|
-
if (!res.ok) return;
|
|
30
|
-
const body = await res.json();
|
|
70
|
+
const body = await pending;
|
|
31
71
|
if (body?.branding) {
|
|
32
72
|
if (body.branding.productName) {
|
|
33
73
|
document.title = body.branding.productName;
|
|
@@ -118,12 +158,12 @@
|
|
|
118
158
|
}
|
|
119
159
|
})();
|
|
120
160
|
</script>
|
|
121
|
-
<script type="module" crossorigin src="./assets/index-
|
|
161
|
+
<script type="module" crossorigin src="./assets/index-BLepsDd_.js"></script>
|
|
122
162
|
<link rel="stylesheet" crossorigin href="./assets/ui-components-BL3SEdAz.css">
|
|
123
163
|
<link rel="stylesheet" crossorigin href="./assets/plugin-dashboard-DnNKJB60.css">
|
|
124
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
125
|
-
<link rel="modulepreload" href="./assets/framework-
|
|
126
|
-
<link rel="modulepreload" href="./assets/ui-components-
|
|
164
|
+
<link rel="stylesheet" crossorigin href="./assets/index-D26gl3rg.css">
|
|
165
|
+
<link rel="modulepreload" href="./assets/framework-BwfIhdyz.js" />
|
|
166
|
+
<link rel="modulepreload" href="./assets/ui-components-Dwq5utCl.js" />
|
|
127
167
|
<link rel="modulepreload" href="./assets/vendor-radix-DFmVRiEf.js" />
|
|
128
168
|
<link rel="modulepreload" href="./assets/vendor-react-CsWFRkED.js" />
|
|
129
169
|
</head>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/console",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.2.0",
|
|
4
4
|
"description": "Prebuilt Console SPA pinned to this @objectstack/framework release. Source of truth: @object-ui/console (https://github.com/objectstack-ai/objectui).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/objectstack-ai/objectstack/tree/main/packages/console",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{n as r}from"./plugin-chatbot-Cq7rZtnW.js";var i=e(t(),1),a=n();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 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{R as r,it as i}from"./framework-LCCQTTcs.js";import{Aa as a,Dr as o,Er as s,Ir as c,Ks as l,Ma as u,Or as d,Rs as f,Ti as p,Zo as m,ai as h,ca as g,gc as _,vc as v,xa as y,xo as b,yc as ee}from"./ui-components-3mb69z8L.js";import"./src-Ctj_ivDh.js";var x=e(t(),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)`}]},realtime:{group:`Realtime`,defaultRoute:`/api/v1/realtime`,endpoints:[{method:`POST`,path:`/connect`,desc:`Establish realtime connection`,bodyTemplate:{transport:`websocket`}},{method:`POST`,path:`/disconnect`,desc:`Close realtime connection`,bodyTemplate:{connectionId:``}},{method:`POST`,path:`/subscribe`,desc:`Subscribe to channel`,bodyTemplate:{channel:``}},{method:`POST`,path:`/unsubscribe`,desc:`Unsubscribe from channel`,bodyTemplate:{channel:``}},{method:`PUT`,path:`/presence/:channel`,desc:`Set presence state`,bodyTemplate:{status:`online`}},{method:`GET`,path:`/presence/:channel`,desc:`Get channel presence`}]},notification:{group:`Notifications`,defaultRoute:`/api/v1/notifications`,endpoints:[{method:`GET`,path:``,desc:`List notifications`},{method:`POST`,path:`/devices`,desc:`Register device for push`,bodyTemplate:{token:``,platform:`web`}},{method:`DELETE`,path:`/devices/:deviceId`,desc:`Unregister device`},{method:`GET`,path:`/preferences`,desc:`Get notification preferences`},{method:`PATCH`,path:`/preferences`,desc:`Update notification preferences`,bodyTemplate:{email:!0,push:!0}},{method:`POST`,path:`/read`,desc:`Mark notifications as read`,bodyTemplate:{ids:[]}},{method:`POST`,path:`/read/all`,desc:`Mark all as read`}]},analytics:{group:`Analytics`,defaultRoute:`/api/v1/analytics`,endpoints:[{method:`POST`,path:`/query`,desc:`Execute analytics query`,bodyTemplate:{measures:[],dimensions:[]}},{method:`GET`,path:`/meta`,desc:`Get analytics metadata`}]},automation:{group:`Automation`,defaultRoute:`/api/v1/automation`,endpoints:[{method:`POST`,path:`/trigger`,desc:`Trigger automation`,bodyTemplate:{name:``,params:{}}}]},i18n:{group:`i18n`,defaultRoute:`/api/v1/i18n`,endpoints:[{method:`GET`,path:`/locales`,desc:`Get available locales`},{method:`GET`,path:`/translations/:locale`,desc:`Get translations for locale`},{method:`GET`,path:`/labels/:object/:locale`,desc:`Get translated field labels`}]},ui:{group:`UI`,defaultRoute:`/api/v1/ui`,endpoints:[{method:`GET`,path:`/views`,desc:`List views`},{method:`GET`,path:`/views/:id`,desc:`Get view by ID`},{method:`POST`,path:`/views`,desc:`Create view`,bodyTemplate:{name:``,object:``,type:`list`}},{method:`PATCH`,path:`/views/:id`,desc:`Update view`,bodyTemplate:{name:``}},{method:`DELETE`,path:`/views/:id`,desc:`Delete view`}]},"file-storage":{group:`Storage`,defaultRoute:`/api/v1/storage`,endpoints:[{method:`POST`,path:`/upload`,desc:`Upload file (multipart/form-data)`},{method:`GET`,path:`/:fileId`,desc:`Download file`},{method:`DELETE`,path:`/:fileId`,desc:`Delete file`}]}},T={"file-storage":`storage`};function E(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=i(),[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`,i=`${t}/discovery`,a=[{method:`GET`,path:i,desc:`API Discovery`,group:`System`},{method:`GET`,path:`${t}/meta/types`,desc:`List metadata types`,group:`Metadata`},{method:`GET`,path:`${t}/packages`,desc:`List packages`,group:`System`},{method:`GET`,path:`/api/v1/health`,desc:`Health check`,group:`System`}];try{let s=`/api/v1/auth`,c={},l={};try{let e=await fetch(i);if(e.ok){let t=await e.json(),n=t?.data??t;l=n?.routes??{},c=n?.services??{},l.auth&&(s=l.auth)}}catch{}let u=[];for(let[e,t]of Object.entries(w)){let n=T[e],i=(n?c[n]:void 0)??c[e],a=i?r(i):!1,o=i?.route??l[e]??t.defaultRoute;a&&u.push(...E(e,o))}let d=e?.getClient?.(),f=[];try{let e=await d?.meta?.getTypes?.();e&&Array.isArray(e.types)?f=e.types:Array.isArray(e)&&(f=e)}catch{}let p=[];try{let e=f.includes(`object`)?`object`:null;if(e&&d?.meta?.getItems){let t=await d.meta.getItems(e),n=[];Array.isArray(t)?n=t:t&&Array.isArray(t.items)?n=t.items:t&&Array.isArray(t.value)&&(n=t.value),p=n.map(e=>e.name||e.id).filter(Boolean)}}catch{}let m=p.flatMap(e=>{let n=e.startsWith(`sys_`)?`Data: system tables`:`Data: ${e}`;return[{method:`GET`,path:`${t}/data/${e}`,desc:`List ${e}`,group:n},{method:`POST`,path:`${t}/data/${e}`,desc:`Create ${e}`,group:n,bodyTemplate:{name:`example`}},{method:`GET`,path:`${t}/data/${e}/:id`,desc:`Get ${e} by ID`,group:n},{method:`PATCH`,path:`${t}/data/${e}/:id`,desc:`Update ${e}`,group:n,bodyTemplate:{name:`updated`}},{method:`DELETE`,path:`${t}/data/${e}/:id`,desc:`Delete ${e}`,group:n}]}),h=f.filter(e=>!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 D=n(),O={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`}],k=1;function A(){let e=i()?.getClient?.(),{groups:t,loading:n,refresh:r}=te(),[S,C]=(0,x.useState)(``),[w,T]=(0,x.useState)(new Set),[E,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||E?.method||`GET`,J=ae||E?.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:k++,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:k++,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,D.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,D.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,D.jsx)(y,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(g,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,D.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,D.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,D.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,D.jsx)(b,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):K.length===0?(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,D.jsx)(m,{className:`h-6 w-6 opacity-30 mb-2`}),(0,D.jsx)(`span`,{children:S?`No matching endpoints`:`No endpoints found`})]}):K.map(e=>{let t=w.has(e.key)||!!S;return(0,D.jsxs)(s,{open:t,onOpenChange:()=>se(e.key),children:[(0,D.jsx)(d,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-1.5 px-2 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground transition-colors`,children:[(0,D.jsx)(_,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,D.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,D.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,D.jsx)(o,{children:(0,D.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,D.jsxs)(`button`,{type:`button`,onClick:()=>ce(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${E===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,D.jsx)(c,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${O[e.method]||``}`,children:e.method}),(0,D.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,D.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>X(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,D.jsx)(a,{className:`h-3 w-3`}),`Add`]})]}),(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:re.map(e=>(0,D.jsx)(`button`,{type:`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,D.jsx)(`div`,{className:`space-y-1`,children:F.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>ue(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,D.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,D.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,D.jsx)(`button`,{type:`button`,onClick:()=>le(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,D.jsx)(h,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.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 ${O[q]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,D.jsx)(`option`,{value:e,children:e},e))}),(0,D.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,D.jsxs)(`button`,{type:`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,D.jsx)(b,{className:`h-3.5 w-3.5 animate-spin`}):(0,D.jsx)(u,{className:`h-3.5 w-3.5`}),`Send`]})]}),F.some(e=>e.enabled&&e.key.trim())&&(0,D.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,Y]})]}),(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(q)&&(0,D.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,D.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,D.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,D.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,D.jsx)(b,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),z&&!L&&(0,D.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-mono font-semibold ${$(z.status)}`,children:z.status||`ERR`}),(0,D.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,D.jsx)(l,{className:`h-3 w-3`}),z.duration,`ms`]})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:fe,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[W?(0,D.jsx)(ee,{className:`h-3 w-3`}):(0,D.jsx)(f,{className:`h-3 w-3`}),W?`Copied`:`Copy`]})]}),(0,D.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,D.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,D.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,D.jsx)(m,{className:`h-10 w-10 mx-auto opacity-20`}),(0,D.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,D.jsx)(`strong`,{children:`Send`})]}),(0,D.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),V.length>0&&(0,D.jsxs)(`div`,{className:`border-t`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,D.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,V.length,`)`]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>H([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,D.jsx)(p,{className:`h-3 w-3`}),`Clear`]})]}),(0,D.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:V.map(e=>(0,D.jsxs)(`div`,{className:`rounded border`,children:[(0,D.jsxs)(`button`,{type:`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,D.jsx)(v,{className:`h-3 w-3 shrink-0`}):(0,D.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,D.jsx)(c,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${O[e.method]||``}`,children:e.method}),(0,D.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,D.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${$(e.status)}`,children:e.status}),(0,D.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,D.jsx)(`button`,{type:`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,D.jsx)(u,{className:`h-2.5 w-2.5`})})]}),U===e.id&&(0,D.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{A as ApiConsolePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,p as r,r as i}from"./vendor-react-CsWFRkED.js";import{A as a,at as o,it as s}from"./framework-LCCQTTcs.js";import{Aa as c,Ao as l,Ar as u,Di as d,Ds as f,Ei as p,Ir as m,La as h,Qr as g,Rn as _,Ti as v,Vi as y,Yi as b,ca as x,jr as S,kr as C}from"./ui-components-3mb69z8L.js";import{r as w}from"./vendor-ui-utils-BFw4cGI6.js";import"./src-Ctj_ivDh.js";var T=e(t(),1);function E(e,t){if(e!=null){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}}var D=i();function O(e,t){return(e instanceof Error?e.message:String(e??``))||t}function k(){let{t:e}=a(),t=r(),{appName:i}=n(),k=i?`/apps/${i}`:``,{apps:A,refresh:j}=o(),M=s(),N=(0,T.useCallback)(()=>M?.getClient?.()?.meta??null,[M]),P=e(`appManagement.toast.unknownError`,{defaultValue:`unknown error`}),F=(0,T.useCallback)(t=>E(t?.label,e)||t?.name||``,[e]),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(new Set),[B,V]=(0,T.useState)(null),[H,U]=(0,T.useState)(!1),W=(A||[]).filter(t=>{if(!I)return!0;let n=I.toLowerCase();return(t.name||``).toLowerCase().includes(n)||F(t).toLowerCase().includes(n)||(E(t.description,e)||``).toLowerCase().includes(n)}),G=(0,T.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),K=(0,T.useCallback)(()=>{R.size===W.length?z(new Set):z(new Set(W.map(e=>e.name)))},[R.size,W]),q=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{let r=t.active===!1;await n.saveItem(`app`,t.name,{...t,active:r}),w.success(r?e(`appManagement.toast.appEnabled`,{defaultValue:`{{name}} enabled`,name:F(t)}):e(`appManagement.toast.appDisabled`,{defaultValue:`{{name}} disabled`,name:F(t)})),await j()}catch(t){w.error(e(`appManagement.toast.toggleFailed`,{defaultValue:`Failed to toggle app status: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[j,N,e,F,P]),J=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{let r=(A||[]).filter(e=>e?.isDefault===!0&&e.name!==t.name);for(let e of r)await n.saveItem(`app`,e.name,{...e,isDefault:!1});await n.saveItem(`app`,t.name,{...t,isDefault:!0}),w.success(e(`appManagement.toast.setDefaultDone`,{defaultValue:`{{name}} set as default`,name:F(t)})),await j()}catch(t){w.error(e(`appManagement.toast.setDefaultFailed`,{defaultValue:`Failed to set default app: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[A,j,N,e,F,P]),Y=(0,T.useCallback)(async t=>{if(B!==t.name){V(t.name);return}let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{await n.deleteItem(`app`,t.name),w.success(e(`appManagement.toast.appDeleted`,{defaultValue:`{{name}} deleted`,name:F(t)})),V(null),await j()}catch(t){w.error(e(`appManagement.toast.deleteFailed`,{defaultValue:`Failed to delete app: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[B,j,N,e,F,P]),X=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);let r=0,i=[];try{let a=new Map((A||[]).map(e=>[e?.name,e]));for(let o of R){let s=a.get(o);if(s)try{await n.saveItem(`app`,o,{...s,active:t}),r+=1}catch(t){i.push(e(`appManagement.toast.bulkFailureEntry`,{defaultValue:`{{name}} ({{reason}})`,name:F(s),reason:O(t,P)}))}}if(r>0&&(w.success(t?e(`appManagement.toast.bulkEnabled`,{defaultValue:`{{n}} apps enabled`,n:r}):e(`appManagement.toast.bulkDisabled`,{defaultValue:`{{n}} apps disabled`,n:r})),z(new Set)),i.length>0){let t=e(`appManagement.toast.bulkFailureJoiner`,{defaultValue:`; `});w.error(e(`appManagement.toast.bulkFailed`,{defaultValue:`Failed for {{n}}: {{details}}`,n:i.length,details:i.join(t)}))}await j()}catch(t){w.error(e(`appManagement.toast.bulkOperationFailed`,{defaultValue:`Bulk operation failed: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[A,R,j,N,e,F,P]);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:e(`appManagement.title`,{defaultValue:`Applications`})}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e(`appManagement.subtitle`,{defaultValue:`Manage all configured applications`})})]}),(0,D.jsxs)(g,{onClick:()=>t(`${k}/create-app`),"data-testid":`create-app-btn`,children:[(0,D.jsx)(c,{className:`h-4 w-4 mr-2`}),e(`appManagement.newApp`,{defaultValue:`New App`})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,D.jsx)(`label`,{htmlFor:`app-search`,className:`sr-only`,children:e(`appManagement.searchLabel`,{defaultValue:`Search apps`})}),(0,D.jsx)(x,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,D.jsx)(_,{id:`app-search`,placeholder:e(`appManagement.searchPlaceholder`,{defaultValue:`Search apps…`}),value:I,onChange:e=>L(e.target.value),className:`pl-8`,"data-testid":`app-search-input`})]}),R.size>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(m,{variant:`secondary`,children:e(`appManagement.selectedCount`,{defaultValue:`{{n}} selected`,n:R.size})}),(0,D.jsx)(g,{variant:`outline`,size:`sm`,onClick:()=>X(!0),disabled:H,children:e(`appManagement.bulkEnable`,{defaultValue:`Enable`})}),(0,D.jsx)(g,{variant:`outline`,size:`sm`,onClick:()=>X(!1),disabled:H,children:e(`appManagement.bulkDisable`,{defaultValue:`Disable`})})]})]}),W.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,D.jsx)(C,{id:`select-all-apps`,checked:R.size===W.length&&W.length>0,onCheckedChange:()=>K()}),(0,D.jsx)(`label`,{htmlFor:`select-all-apps`,className:`cursor-pointer`,children:e(`appManagement.selectAll`,{defaultValue:`Select all ({{n}})`,n:W.length})})]}),W.length===0?(0,D.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,"data-testid":`no-apps-message`,children:[(0,D.jsx)(l,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,D.jsx)(`p`,{children:e(`appManagement.empty`,{defaultValue:`No apps found.`})})]}):(0,D.jsx)(`div`,{className:`grid gap-3`,children:W.map(n=>{let r=n.active!==!1,i=n.isDefault===!0,a=B===n.name,o=F(n);return(0,D.jsx)(u,{className:r?``:`opacity-60`,"data-testid":`app-card-${n.name}`,children:(0,D.jsxs)(S,{className:`flex items-center gap-3 py-3 px-4`,children:[(0,D.jsx)(C,{id:`select-app-${n.name}`,checked:R.has(n.name),onCheckedChange:()=>G(n.name),"aria-label":e(`appManagement.selectApp`,{defaultValue:`Select {{name}}`,name:o}),className:`shrink-0`}),(0,D.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,D.jsx)(l,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`font-medium truncate`,children:o}),i&&(0,D.jsx)(m,{variant:`default`,className:`text-xs`,children:e(`appManagement.defaultBadge`,{defaultValue:`Default`})}),(0,D.jsx)(m,{variant:r?`secondary`:`outline`,className:`text-xs`,children:r?e(`appManagement.active`,{defaultValue:`Active`}):e(`appManagement.inactive`,{defaultValue:`Inactive`})})]}),n.description&&(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:E(n.description,e)})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,D.jsx)(g,{variant:`ghost`,size:`icon`,title:e(`appManagement.openApp`,{defaultValue:`Open app`}),"aria-label":e(`appManagement.openAppNamed`,{defaultValue:`Open {{name}}`,name:o}),onClick:()=>t(`/apps/${n._packageId??n.name}`),children:(0,D.jsx)(f,{className:`h-4 w-4`})}),(0,D.jsx)(g,{variant:`ghost`,size:`icon`,title:e(`appManagement.editApp`,{defaultValue:`Edit app`}),"aria-label":e(`appManagement.editAppNamed`,{defaultValue:`Edit {{name}}`,name:o}),onClick:()=>t(`${k}/edit-app/${n.name}`),children:(0,D.jsx)(h,{className:`h-4 w-4`})}),n._packageId?(0,D.jsx)(g,{variant:`ghost`,size:`icon`,title:e(`appManagement.editWithAi`,{defaultValue:`Edit with AI`}),"aria-label":e(`appManagement.editWithAiNamed`,{defaultValue:`Edit {{name}} with AI`,name:o}),onClick:()=>t(`/ai/build?package=${encodeURIComponent(n._packageId)}&new=1`),children:(0,D.jsx)(b,{className:`h-4 w-4`})}):null,(0,D.jsx)(g,{variant:`ghost`,size:`icon`,title:r?e(`appManagement.disableApp`,{defaultValue:`Disable app`}):e(`appManagement.enableApp`,{defaultValue:`Enable app`}),"aria-label":r?e(`appManagement.disableAppNamed`,{defaultValue:`Disable {{name}}`,name:o}):e(`appManagement.enableAppNamed`,{defaultValue:`Enable {{name}}`,name:o}),onClick:()=>q(n),disabled:H,children:r?(0,D.jsx)(p,{className:`h-4 w-4`}):(0,D.jsx)(d,{className:`h-4 w-4`})}),(0,D.jsx)(g,{variant:`ghost`,size:`icon`,title:e(`appManagement.setDefault`,{defaultValue:`Set as default`}),"aria-label":e(`appManagement.setDefaultNamed`,{defaultValue:`Set {{name}} as default`,name:o}),onClick:()=>J(n),disabled:H||i,children:(0,D.jsx)(y,{className:`h-4 w-4 ${i?`fill-current text-yellow-500`:``}`})}),(0,D.jsx)(g,{variant:`ghost`,size:`icon`,title:a?e(`appManagement.confirmDelete`,{defaultValue:`Click again to confirm delete`}):e(`appManagement.deleteApp`,{defaultValue:`Delete app`}),"aria-label":a?e(`appManagement.confirmDeleteNamed`,{defaultValue:`Confirm delete {{name}}`,name:o}):e(`appManagement.deleteAppNamed`,{defaultValue:`Delete {{name}}`,name:o}),onClick:()=>Y(n),disabled:H,className:a?`text-destructive`:``,children:(0,D.jsx)(v,{className:`h-4 w-4`})})]})]})},n.name)})})]})}export{k as AppManagementPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,g as r,h as i,r as a}from"./vendor-react-CsWFRkED.js";import{S as o,v as s,x as ee}from"./infrastructure-CerjT_c2.js";import{A as te,it as ne}from"./framework-LCCQTTcs.js";import{An as re,Ar as ie,Br as ae,Cn as oe,Dn as se,Ds as ce,En as le,Gr as ue,Gt as de,Ht as fe,Ir as c,Jr as pe,Jt as l,Kr as me,Ks as he,Kt as ge,On as u,Qr as d,Qs as _e,Rn as ve,Rs as ye,Sn as be,Tn as xe,Ur as Se,Ut as Ce,Vr as we,Vt as Te,Wr as Ee,Wt as De,Xr as Oe,Xt as ke,Yr as Ae,Yt as je,Zc as Me,Zr as Ne,Zs as Pe,_c as Fe,_t as Ie,ai as Le,bn as Re,ca as ze,gc as Be,jr as Ve,kn as He,kr as Ue,mi as We,ol as f,qi as Ge,qr as Ke,qt as p,ra as qe,sa as Je,sc as Ye,si as Xe,uc as Ze,vn as m,vt as Qe,wn as $e,xa as et,xn as tt,xt as nt,yc as rt,za as it}from"./ui-components-3mb69z8L.js";import{r as h}from"./vendor-ui-utils-BFw4cGI6.js";import"./src-Ctj_ivDh.js";import{r as at,y as ot}from"./RecordDetailView-uf81gH3J.js";var g=e(n(),1),st=`${``.replace(/\/$/,``)}/api/v1`;async function _(e,t){let n=o.get(),r=await fetch(`${st}${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 ct(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)}function y(e,t){return`${e}::${t}`}function b(e){return typeof e.object_name==`string`&&e.object_name!==``&&typeof e.record_id==`string`&&e.record_id!==``}function lt(e){let t=new Map,n=new Set;for(let r of e){if(!b(r))continue;let e=y(r.object_name,r.record_id);if(n.has(e))continue;n.add(e);let i=t.get(r.object_name);i?i.push(r.record_id):t.set(r.object_name,[r.record_id])}let r=[];for(let[e,n]of t)for(let t=0;t<n.length;t+=100)r.push({objectName:e,ids:n.slice(t,t+100)});return r}function x(e){if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]}async function S(e,t){let n=new Map,r=lt(t);return await Promise.all(r.map(async({objectName:t,ids:r})=>{let i;try{let n=await e.find(t,{$filter:{id:{$in:r}},$select:[`id`],$top:r.length});i=new Set(x(n).map(e=>e?.id).filter(e=>typeof e==`string`&&e!==``))}catch{return}for(let e of r)n.set(y(t,e),i.has(e))})),n}function ut(e){let t=ne(),[n,r]=(0,g.useState)(()=>new Map),i=(0,g.useRef)(new Set),a=(0,g.useRef)(e);a.current=e;let o=(0,g.useMemo)(()=>e.filter(b).map(e=>y(e.object_name,e.record_id)).join(`|`),[e]);return(0,g.useEffect)(()=>{if(!t)return;let e=a.current.filter(e=>b(e)&&!i.current.has(y(e.object_name,e.record_id)));if(e.length===0)return;for(let t of e)b(t)&&i.current.add(y(t.object_name,t.record_id));let n=!1;return S(t,e).then(e=>{n||e.size===0||r(t=>{let n=new Map(t);for(let[t,r]of e)n.set(t,r);return n})}),()=>{n=!0}},[t,o]),(0,g.useMemo)(()=>({isUnreadable:e=>b(e)&&n.get(y(e.object_name,e.record_id))===!1}),[n])}var C=a(),dt=50,w={pending:`border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-400`,approved:`border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400`,rejected:`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`,recalled:`border-border bg-muted text-muted-foreground`,returned:`border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-400`};function ft({status:e,label:t}){return(0,C.jsx)(c,{variant:`outline`,className:f(`font-medium`,w[e]??``),children:t})}function pt(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function T(e){return e?e.includes(`@`)?e:e.startsWith(`role:`)?`Role: ${e.slice(5)}`:e.length>14?`${e.slice(0,6)}…${e.slice(-4)}`:e:`—`}function mt(e){return e&&String(e).replace(/^flow:/,``).trim().split(/[_\-\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||`—`}function ht(e){return e.process_label||mt(e.process_name)}function gt(e){return e.step_label?e.step_label:e.current_step?mt(e.current_step):null}function _t(e){return e.submitter_name||T(e.submitter_id)}function vt(e,t){return t.pending_approver_names?.[e]||T(e)}function yt(e,t){let n=t.pending_approver_groups?.[e];return n&&n.length?n.join(` / `):void 0}function bt(e){let t=[],n=new Map;for(let r of e.pending_approvers||[]){let i=vt(r,e),a=yt(r,e),o=a?`${i} ${a}`:i,s=n.get(o);s?(s.count+=1,r&&!s.title.split(`, `).includes(r)&&(s.title+=`, ${r}`)):(n.set(o,{label:i,group:a,count:1,title:r||i}),t.push(o))}return t.map(e=>n.get(e))}function xt(e){if(e.submitter_name)return!1;let t=(e.submitter_id||``).trim();return!t||t.startsWith(`flow:`)||t.startsWith(`system:`)}function St(e){return e.object_label||e.object_name}function E(e){return e.submitted_at||e.created_at||void 0}function D(e,t){let n=E(e);if(!n)return null;let r=Date.parse(n);return Number.isNaN(r)?null:(t-r)/36e5}function Ct(e,t){if(e.status!==`pending`)return`text-muted-foreground`;let n=D(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 wt(e){let t=Math.max(1,Math.round(Math.abs(e)/36e5));return t<48?`${t}h`:`${Math.round(t/24)}d`}function Tt(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 Et=new Set([`id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`organization_id`]);function O(e){let t=e.split(`_`).filter(Boolean);return t.length>1&&t[t.length-1].toLowerCase()===`id`&&t.pop(),t.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Dt(e,t){if(typeof t==`boolean`)return t?`✓`:`—`;if(typeof t==`number`){if(t>0xe8d4a51000&&/(_at$|_date$|^date_|_time$)/.test(e))try{return new Date(t).toLocaleDateString()}catch{}return t.toLocaleString()}let n=String(t);if(/^\d{4}-\d{2}-\d{2}T\d{2}/.test(n))try{return new Date(n).toLocaleString()}catch{}return n}var k=/^[A-Za-z0-9_-]{15,}$/;function Ot(e,t,n,r=6,i){if(!e||typeof e!=`object`||Array.isArray(e))return[];let a=[];for(let[o,s]of Object.entries(e)){if(Et.has(o)||i&&o===i||s==null||typeof s==`object`||String(s).trim()===``)continue;let e=t?.[o];if(!(!e&&typeof s==`string`&&k.test(s.trim())&&!/^\d+$/.test(s.trim()))&&(a.push([n?.[o]??O(o),e??Dt(o,s)]),a.length>=r))break}return a}var kt=/(amount|total|price|value|cost|sum|budget|salary|fee|revenue|balance|金额|总额|价格|费用|预算|金额)/i;function A(e){let t=e.payload;if(!t||typeof t!=`object`||Array.isArray(t))return null;for(let[n,r]of Object.entries(t)){if(Et.has(n)||!kt.test(n))continue;let t=typeof r==`number`?r:typeof r==`string`&&r.trim()!==``&&Number.isFinite(Number(r))?Number(r):null;if(!(t==null||!Number.isFinite(t)))return{key:n,label:e.payload_labels?.[n]??O(n),value:t,display:e.payload_display?.[n]??t.toLocaleString()}}return null}function j(){let{t:e,language:n}=te(),{user:a}=s(),{appName:o}=i(),[ne,st]=r(),_=(0,g.useMemo)(()=>ct(a),[a]),y=(0,g.useCallback)((t,n,r)=>String(e(`approvalsInbox.${t}`,{defaultValue:n,...r})),[e]),[b,lt]=(0,g.useState)(()=>Date.now());(0,g.useEffect)(()=>{let e=setInterval(()=>lt(Date.now()),6e4);return()=>clearInterval(e)},[]);let x=(0,g.useCallback)(e=>{if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let r=Math.round((b-t)/1e3);if(r<45)return y(`justNow`,`just now`);let i=Math.round(r/60);if(i<60)return y(`minutesAgo`,`{{count}}m ago`,{count:i});let a=Math.round(i/60);if(a<24)return y(`hoursAgo`,`{{count}}h ago`,{count:a});let o=Math.round(a/24);if(o<30)return y(`daysAgo`,`{{count}}d ago`,{count:o});try{return new Date(e).toLocaleDateString(n)}catch{return e}},[y,n,b]),S=(0,g.useCallback)(e=>{switch(e){case`pending`:return y(`statusPending`,`Pending`);case`approved`:return y(`statusApproved`,`Approved`);case`rejected`:return y(`statusRejected`,`Rejected`);case`recalled`:return y(`statusRecalled`,`Recalled`);case`returned`:return y(`statusReturned`,`Returned for revision`);default:return e}},[y]),w=(0,g.useCallback)((e,t)=>{let n=e?.code??``,r=e?.status??0;return n===`NOT_IMPLEMENTED`||r===501?y(`recallUnavailable`,`Recall is not available on this deployment.`):n===`THROTTLED`||r===429?y(`remindThrottled`,`A reminder was sent recently — try again later.`):r===404?y(`requestGone`,`This request no longer exists. Refresh the list.`):n===`FORBIDDEN`||r===403?y(`notAllowed`,`You are not allowed to perform this action.`):n===`INVALID_STATE`||r===409?y(`alreadyDecided`,`This request was already decided. Refresh the list.`):e?.message||t},[y]),mt=(0,g.useCallback)(e=>e.overdue?y(`slaOverdue`,`SLA overdue {{dur}}`,{dur:wt(e.ms)}):y(`slaRemaining`,`SLA {{dur}} left`,{dur:wt(e.ms)}),[y]),yt=(0,g.useCallback)(e=>`/apps/${o||`setup`}/${encodeURIComponent(e.object_name)}/record/${encodeURIComponent(e.record_id)}`,[o]),[D,Et]=(0,g.useState)(`pending`),[O,Dt]=(0,g.useState)([]),[k,kt]=(0,g.useState)(!1),[j,At]=(0,g.useState)(!1),[jt,M]=(0,g.useState)(null),[Mt,Nt]=(0,g.useState)(null),[Pt,Ft]=(0,g.useState)(0),[N,It]=(0,g.useState)(null),[P,F]=(0,g.useState)(null),[Lt,I]=(0,g.useState)([]),[Rt,zt]=(0,g.useState)(!1),Bt=ut((0,g.useMemo)(()=>P?[...O,P]:O,[O,P])),Vt=(0,g.useMemo)(()=>ee(),[]),Ht=(0,g.useCallback)(async e=>{let t=window.open(``,`_blank`,`noopener`);try{let n=``.replace(/\/$/,``),r=await Vt(`${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(y(`attachmentOpenFailed`,`Could not open the attachment — please try again`))}},[Vt,y]),[L,Ut]=(0,g.useState)(``),[R,Wt]=(0,g.useState)(``),[z,Gt]=(0,g.useState)(`all`),[Kt,qt]=(0,g.useState)(`all`),[B,Jt]=(0,g.useState)(`all`),[Yt,Xt]=(0,g.useState)(`recent`),[V,Zt]=(0,g.useState)(new Set),[Qt,$t]=(0,g.useState)(!1),[H,en]=(0,g.useState)(null),[U,tn]=(0,g.useState)(null),[nn,rn]=(0,g.useState)(null),[W,an]=(0,g.useState)(``),[on,sn]=(0,g.useState)(!1),[cn,G]=(0,g.useState)(-1);(0,g.useEffect)(()=>{if(D===`pending`)return;let e=window.setTimeout(()=>Wt(L),350);return()=>window.clearTimeout(e)},[L,D]);let K=(0,g.useCallback)(async()=>{kt(!0),Nt(null);try{let e=[];if(D===`pending`)e=_.length?(await v.listRequests({status:`pending`,approverId:_})).data:[],Ft(e.length),M(null);else{let t={q:R||void 0,status:B===`all`?void 0:B,limit:dt,offset:0};if(D===`submitted`){let n=a?.id;if(n){let r=await v.listRequests({submitterId:n,...t});e=r.data,M(r.total??r.data.length)}else e=[],M(0)}else{let n=await v.listRequests(t);e=n.data,M(n.total??n.data.length)}_.length&&v.listRequests({status:`pending`,approverId:_}).then(e=>Ft(e.data.length)).catch(()=>{})}e.sort((e,t)=>(E(t)||``).localeCompare(E(e)||``)),Dt(e)}catch(e){Nt(e?.message||String(e)),Dt([])}finally{kt(!1)}},[D,_,a?.id,R,B]);(0,g.useEffect)(()=>{K()},[K]);let ln=(0,g.useCallback)(async()=>{if(!(D===`pending`||j)){At(!0);try{let e=await v.listRequests({submitterId:D===`submitted`?a?.id??void 0:void 0,q:R||void 0,status:B===`all`?void 0:B,limit:dt,offset:O.length});Dt(t=>{let n=new Set(t.map(e=>e.id));return[...t,...e.data.filter(e=>!n.has(e.id))]}),e.total!=null&&M(e.total)}catch(e){h.error(w(e,y(`loadFailed`,`Failed to load request`)))}finally{At(!1)}}},[D,j,a?.id,R,B,O.length,w,y]),q=(0,g.useCallback)(async e=>{It(e),zt(!0);try{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);F(t.data),I(n.data)}catch(e){h.error(w(e,y(`loadFailed`,`Failed to load request`))),F(null),I([])}finally{zt(!1)}},[w,y]),un=()=>{It(null),F(null),I([])};(0,g.useEffect)(()=>{let e=ne.get(`request`);e&&(st(e=>{let t=new URLSearchParams(e);return t.delete(`request`),t},{replace:!0}),q(e))},[ne]);let J=(0,g.useCallback)(()=>{_.length&&v.listRequests({status:`pending`,approverId:_}).then(e=>Ft(e.data.length)).catch(()=>{})},[_]),dn=(0,g.useCallback)(async e=>{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);F(t.data),I(n.data),K()},[K]),fn=(0,g.useCallback)(async()=>{if(!P)return;let e=P.id;try{let[t,n]=await Promise.all([v.getRequest(e),v.listActions(e)]);F(t.data),I(n.data),K();let r=new Set(t.data.pending_approvers||[]),i=t.data.status===`pending`&&_.some(e=>r.has(e));if(D===`pending`&&!i){let t=Dn.current,n=t.findIndex(t=>t.id===e),r=t[n+1]??t[n-1];if(r&&r.id!==e){q(r.id);return}un()}}catch{dn(e)}},[P,_,D,K,q,un,dn]),pn=(0,g.useCallback)(async()=>{if(!(!P||!W.trim())){sn(!0);try{await v.comment(P.id,{actor_id:a?.id,comment:W.trim()}),an(``),await dn(P.id)}catch(e){h.error(w(e,y(`actionFailed`,`Action failed`)))}finally{sn(!1)}}},[P,W,a?.id,dn,w,y]),mn=(0,g.useMemo)(()=>{if(!P||P.status!==`pending`)return!1;if(P.viewer)return P.viewer.can_act||!!P.viewer.can_override;let e=new Set(P.pending_approvers||[]);return _.some(t=>e.has(t))},[P,_]),hn=(0,g.useMemo)(()=>!P||P.status!==`pending`?!1:P.viewer?P.viewer.is_submitter:P.submitter_id===a?.id,[P,a?.id]),gn=(0,g.useMemo)(()=>!P||P.status!==`returned`?!1:P.viewer?P.viewer.is_submitter:P.submitter_id===a?.id,[P,a?.id]),_n=(0,g.useMemo)(()=>{let e=new Set;for(let t of O)e.add(ht(t));return Array.from(e).sort()},[O]),vn=(0,g.useMemo)(()=>{let e=new Set;for(let t of O)t.object_name&&e.add(t.object_name);return Array.from(e).sort()},[O]),Y=(0,g.useMemo)(()=>{let e=L.trim().toLowerCase(),t=O.filter(t=>z!==`all`&&ht(t)!==z||Kt!==`all`&&t.object_name!==Kt||B!==`all`&&t.status!==B?!1:D!==`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(Yt===`recent`)return t;let n=[...t];return Yt===`amount`?n.sort((e,t)=>{let n=A(e)?.value,r=A(t)?.value;return n==null&&r==null?0:n==null?1:r==null?-1:r-n}):n.sort((e,t)=>(E(e)||``).localeCompare(E(t)||``)),n},[O,L,z,Kt,B,D,Yt]),X=(0,g.useMemo)(()=>N?Y.findIndex(e=>e.id===N):-1,[Y,N]);(0,g.useEffect)(()=>{if(V.size===0)return;let e=new Set(Y.map(e=>e.id)),t=!1,n=new Set;for(let r of V)e.has(r)?n.add(r):t=!0;t&&Zt(n)},[Y,V]),(0,g.useEffect)(()=>{cn>=Y.length&&G(Y.length-1)},[Y.length,cn]);let yn=(0,g.useCallback)(e=>{if(e.status!==`pending`)return!1;let t=new Set(_);return(e.pending_approvers||[]).some(e=>t.has(e))},[_]),Z=(0,g.useCallback)(e=>Array.isArray(e.decision_outputs)&&e.decision_outputs.length>0,[]),bn=(0,g.useCallback)(e=>yn(e)&&!Z(e),[yn,Z]),Q=(0,g.useMemo)(()=>Y.filter(e=>V.has(e.id)&&bn(e)),[Y,V,bn]),$=Y.filter(e=>e.status===`pending`),xn=$.length>0&&$.every(e=>V.has(e.id)),Sn=(0,g.useCallback)(()=>{Zt(e=>{if(xn)return new Set;let t=new Set(e);for(let e of $)t.add(e.id);return t})},[xn,$]),Cn=(0,g.useCallback)(e=>{Zt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),wn=(0,g.useCallback)(async e=>{let t=Q;if(t.length===0)return;$t(!0);let n=0,r=[];for(let i of t){let t=new Set(i.pending_approvers||[]),o=_.find(e=>t.has(e))||a?.id||``;try{await(e===`approve`?v.approve:v.reject)(i.id,{actor_id:o}),n++}catch{r.push(i.record_title||T(i.record_id))}}if($t(!1),Zt(new Set),r.length===0)h.success(e===`approve`?y(`bulkApproved`,`Approved {{count}} requests`,{count:n}):y(`bulkRejected`,`Rejected {{count}} requests`,{count:n}));else{let e=r.slice(0,3).join(`, `);h.error(y(`bulkPartial`,`{{ok}} succeeded, {{fail}} failed: {{which}}`,{ok:n,fail:r.length,which:e+(r.length>3?`…`:``)}))}K(),J()},[Q,_,a?.id,K,J,y]),Tn=(0,g.useCallback)(async()=>{let e=H;if(!e)return;let t=new Set(e.pending_approvers||[]),n=_.find(e=>t.has(e))||a?.id||``;rn(e.id),en(null);try{let t=await v.approve(e.id,{actor_id:n});h.success(t.finalized?y(`inlineApproved`,`Approved "{{title}}"`,{title:e.record_title||T(e.record_id)}):y(`approvedWaiting`,`Approved — waiting on the remaining approvers`)),K(),J()}catch(e){h.error(w(e,y(`actionFailed`,`Action failed`)))}finally{rn(null)}},[H,_,a?.id,K,J,w,y]),En=(0,g.useCallback)(async()=>{let e=U;if(!e)return;let t=new Set(e.pending_approvers||[]),n=_.find(e=>t.has(e))||a?.id||``;rn(e.id),tn(null);try{await v.reject(e.id,{actor_id:n}),h.success(y(`inlineRejected`,`Rejected "{{title}}"`,{title:e.record_title||T(e.record_id)})),K(),J()}catch(e){h.error(w(e,y(`actionFailed`,`Action failed`)))}finally{rn(null)}},[U,_,a?.id,K,J,w,y]),Dn=(0,g.useRef)(Y);Dn.current=Y;let On=(0,g.useRef)(cn);On.current=cn,(0,g.useEffect)(()=>{let e=e=>{if(N||H||U)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Dn.current;if(!r.length)return;let i=On.current;e.key===`j`||e.key===`ArrowDown`?(e.preventDefault(),G(Math.min(i+1,r.length-1))):e.key===`k`||e.key===`ArrowUp`?(e.preventDefault(),G(Math.max(i-1,0))):e.key===`Enter`&&i>=0&&r[i]?(e.preventDefault(),q(r[i].id)):(e.key===`x`||e.key===` `)&&i>=0&&r[i]&&D===`pending`?(e.preventDefault(),Cn(r[i].id)):e.key===`a`&&i>=0&&r[i]&&bn(r[i])?(e.preventDefault(),en(r[i])):e.key===`r`&&i>=0&&r[i]&&bn(r[i])&&(e.preventDefault(),tn(r[i]))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[N,H,U,D,q,Cn,bn]),(0,g.useEffect)(()=>{if(!N)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=Dn.current,i=r.findIndex(e=>e.id===N);if(i<0)return;let a=e.key===`ArrowLeft`?r[i-1]:r[i+1];a&&(e.preventDefault(),q(a.id))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[N,q]);let kn=!!L||z!==`all`||Kt!==`all`||B!==`all`,An=e=>{Et(e),Jt(`all`),Gt(`all`),qt(`all`),Ut(``),Xt(`recent`),G(-1)};function jn({r:e}){return(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`font-medium truncate`,children:ht(e)}),(0,C.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[gt(e)||`—`,(e.round??1)>1&&(0,C.jsx)(`span`,{className:`ml-1.5 text-violet-600 dark:text-violet-400`,children:y(`roundChip`,`Round {{n}}`,{n:e.round})})]})]})}function Mn({r:e}){let n=A(e),r=e.record_title||T(e.record_id);return(0,C.jsxs)(`div`,{className:`min-w-0`,children:[Bt.isUnreadable(e)?(0,C.jsx)(`div`,{className:`text-sm truncate max-w-full`,title:e.record_id,children:r}):(0,C.jsxs)(t,{to:yt(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,C.jsx)(`span`,{className:`truncate`,children:r}),(0,C.jsx)(ce,{className:`h-3 w-3 shrink-0 text-muted-foreground`})]}),(0,C.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[St(e),n&&(0,C.jsxs)(`span`,{className:`ml-1.5 font-medium text-foreground`,title:`${n.label}: ${n.display}`,children:[`· `,n.display]})]})]})}function Nn({r:e}){if(!yn(e))return null;let t=nn===e.id,n=Z(e),r=y(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`);return(0,C.jsxs)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),title:n?r:void 0,children:[(0,C.jsx)(d,{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:()=>en(e),"aria-label":n?r:y(`approve`,`Approve`),children:(0,C.jsx)(Ye,{className:`h-4 w-4`})}),(0,C.jsx)(d,{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:()=>tn(e),"aria-label":n?r:y(`reject`,`Reject`),children:(0,C.jsx)(_e,{className:`h-4 w-4`})})]})}return(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-6xl`,children:[(0,C.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`h1`,{className:`text-2xl font-semibold flex items-center gap-2`,children:[(0,C.jsx)(Ge,{className:`h-6 w-6`}),y(`title`,`Approvals Inbox`)]}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y(`subtitle`,`Review and act on approval requests.`)})]}),(0,C.jsxs)(d,{variant:`outline`,size:`sm`,onClick:K,disabled:k,className:`self-start sm:self-auto`,children:[(0,C.jsx)(et,{className:`h-4 w-4 mr-2 ${k?`animate-spin`:``}`}),y(`refresh`,`Refresh`)]})]}),Mt&&(0,C.jsxs)(ae,{variant:`destructive`,children:[(0,C.jsx)(Ze,{className:`h-4 w-4`}),(0,C.jsx)(we,{children:Mt})]}),(0,C.jsxs)(Te,{value:D,onValueChange:An,children:[(0,C.jsxs)(Ce,{children:[(0,C.jsxs)(De,{value:`pending`,children:[y(`tabMyPending`,`My Pending`),Pt>0&&(0,C.jsx)(c,{variant:`secondary`,className:`ml-2`,children:Pt})]}),(0,C.jsx)(De,{value:`submitted`,children:y(`tabSubmitted`,`Submitted by me`)}),(0,C.jsx)(De,{value:`all`,children:y(`tabAll`,`All`)})]}),(0,C.jsxs)(fe,{value:D,className:`mt-4 space-y-3`,children:[!k&&(O.length>0||D!==`pending`&&(R||B!==`all`))&&(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-sm`,children:[(0,C.jsx)(ze,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,C.jsx)(ve,{value:L,onChange:e=>Ut(e.target.value),placeholder:y(`searchPlaceholder`,`Search record, process, requester…`),className:`pl-8 h-8 text-sm`}),L&&(0,C.jsx)(`button`,{type:`button`,onClick:()=>Ut(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":y(`clearSearch`,`Clear search`),children:(0,C.jsx)(Le,{className:`h-3.5 w-3.5`})})]}),D!==`pending`&&(0,C.jsxs)(le,{value:B,onValueChange:Jt,children:[(0,C.jsx)(He,{className:`h-8 w-auto min-w-[130px] text-sm`,children:(0,C.jsx)(re,{placeholder:y(`statusFilter`,`Status`)})}),(0,C.jsxs)(se,{children:[(0,C.jsx)(u,{value:`all`,children:y(`allStatuses`,`All statuses`)}),(0,C.jsx)(u,{value:`pending`,children:S(`pending`)}),(0,C.jsx)(u,{value:`approved`,children:S(`approved`)}),(0,C.jsx)(u,{value:`rejected`,children:S(`rejected`)}),(0,C.jsx)(u,{value:`recalled`,children:S(`recalled`)}),(0,C.jsx)(u,{value:`returned`,children:S(`returned`)})]})]}),_n.length>1&&(0,C.jsxs)(le,{value:z,onValueChange:Gt,children:[(0,C.jsx)(He,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,C.jsx)(re,{placeholder:y(`processFilter`,`Process`)})}),(0,C.jsxs)(se,{children:[(0,C.jsx)(u,{value:`all`,children:y(`allProcesses`,`All processes`)}),_n.map(e=>(0,C.jsx)(u,{value:e,children:e},e))]})]}),vn.length>1&&(0,C.jsxs)(le,{value:Kt,onValueChange:qt,children:[(0,C.jsx)(He,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,C.jsx)(re,{placeholder:y(`objectFilter`,`Object`)})}),(0,C.jsxs)(se,{children:[(0,C.jsx)(u,{value:`all`,children:y(`allObjects`,`All objects`)}),vn.map(e=>(0,C.jsx)(u,{value:e,children:e},e))]})]}),(0,C.jsxs)(le,{value:Yt,onValueChange:e=>Xt(e),children:[(0,C.jsxs)(He,{className:`h-8 w-auto min-w-[120px] text-sm`,children:[(0,C.jsx)(Me,{className:`h-3.5 w-3.5 mr-1 text-muted-foreground`}),(0,C.jsx)(re,{placeholder:y(`sortBy`,`Sort`)})]}),(0,C.jsxs)(se,{children:[(0,C.jsx)(u,{value:`recent`,children:y(`sortRecent`,`Newest first`)}),(0,C.jsx)(u,{value:`oldest`,children:y(`sortOldest`,`Oldest first`)}),(0,C.jsx)(u,{value:`amount`,children:y(`sortAmount`,`Amount (high→low)`)})]})]}),kn&&(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y(`filterCount`,`{{shown}} of {{total}}`,{shown:Y.length,total:O.length})})]}),D===`pending`&&V.size>0&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 rounded-md border bg-accent/30 text-sm`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`strong`,{children:V.size}),` `,y(`selected`,`selected`),Q.length!==V.size&&(0,C.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:y(`actionableCount`,`({{count}} actionable)`,{count:Q.length})})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(Se,{children:[(0,C.jsx)(Ne,{asChild:!0,children:(0,C.jsxs)(d,{size:`sm`,disabled:Qt||Q.length===0,children:[(0,C.jsx)(Ye,{className:`h-3.5 w-3.5 mr-1`}),y(`approveN`,`Approve {{count}}`,{count:Q.length||``})]})}),(0,C.jsxs)(me,{children:[(0,C.jsxs)(Ae,{children:[(0,C.jsx)(Oe,{children:y(`bulkApproveTitle`,`Approve {{count}} requests?`,{count:Q.length})}),(0,C.jsx)(Ke,{children:y(`bulkApproveBody`,`Each request is approved with your identity and its flow continues down the approve branch.`)})]}),(0,C.jsxs)(pe,{children:[(0,C.jsx)(ue,{children:y(`cancel`,`Cancel`)}),(0,C.jsx)(Ee,{onClick:()=>wn(`approve`),children:y(`approveN`,`Approve {{count}}`,{count:Q.length})})]})]})]}),(0,C.jsxs)(Se,{children:[(0,C.jsx)(Ne,{asChild:!0,children:(0,C.jsxs)(d,{size:`sm`,variant:`outline`,disabled:Qt||Q.length===0,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,C.jsx)(_e,{className:`h-3.5 w-3.5 mr-1`}),y(`rejectN`,`Reject {{count}}`,{count:Q.length||``})]})}),(0,C.jsxs)(me,{children:[(0,C.jsxs)(Ae,{children:[(0,C.jsx)(Oe,{children:y(`bulkRejectTitle`,`Reject {{count}} requests?`,{count:Q.length})}),(0,C.jsx)(Ke,{children:y(`bulkRejectBody`,`This rejects the selected requests and notifies their submitters.`)})]}),(0,C.jsxs)(pe,{children:[(0,C.jsx)(ue,{children:y(`cancel`,`Cancel`)}),(0,C.jsx)(Ee,{onClick:()=>wn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:y(`rejectN`,`Reject {{count}}`,{count:Q.length})})]})]})]}),(0,C.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>Zt(new Set),disabled:Qt,children:y(`clear`,`Clear`)})]})]}),k?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(m,{className:`h-10 w-full`}),(0,C.jsx)(m,{className:`h-10 w-full`}),(0,C.jsx)(m,{className:`h-10 w-full`})]}):O.length===0?(0,C.jsx)(`div`,{className:`flex items-center justify-center min-h-[240px] rounded-md border border-dashed`,children:(0,C.jsxs)(Ie,{children:[(0,C.jsx)(nt,{children:y(`emptyTitle`,`No requests`)}),(0,C.jsx)(Qe,{children:D===`pending`?y(`emptyPending`,`You're all caught up — nothing is waiting on you.`):y(`emptyOther`,`Nothing here yet.`)}),D===`pending`&&(0,C.jsx)(d,{variant:`link`,size:`sm`,className:`mt-1`,onClick:()=>An(`all`),children:y(`emptyViewAll`,`Browse all requests`)})]})}):Y.length===0?(0,C.jsx)(`div`,{className:`flex items-center justify-center min-h-[160px] rounded-md border border-dashed text-sm text-muted-foreground`,children:y(`noMatches`,`No matches for current filters.`)}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(ie,{className:`hidden md:block`,children:(0,C.jsx)(Ve,{className:`p-0`,children:(0,C.jsxs)(de,{children:[(0,C.jsx)(je,{children:(0,C.jsxs)(ke,{children:[D===`pending`&&(0,C.jsx)(l,{className:`w-10`,children:(0,C.jsx)(Ue,{checked:xn,onCheckedChange:Sn,"aria-label":y(`selectAll`,`Select all`),disabled:$.length===0})}),(0,C.jsx)(l,{className:`w-[22%]`,children:y(`colRequest`,`Request`)}),(0,C.jsx)(l,{className:`w-[30%]`,children:y(`colRecord`,`Record`)}),(0,C.jsx)(l,{className:`w-[16%]`,children:y(`colRequester`,`Requester`)}),(0,C.jsx)(l,{className:`w-[110px] min-w-[96px] whitespace-nowrap`,children:y(`colStatus`,`Status`)}),(0,C.jsx)(l,{className:`w-[132px]`,children:y(`colWaiting`,`Submitted`)}),(0,C.jsx)(l,{className:`w-20`,"aria-label":y(`colActions`,`Actions`)})]})}),(0,C.jsx)(ge,{children:Y.map((e,t)=>(0,C.jsxs)(ke,{className:f(`group cursor-pointer hover:bg-accent/50`,cn===t&&`ring-2 ring-inset ring-ring bg-accent/30`),onClick:()=>{G(t),q(e.id)},children:[D===`pending`&&(0,C.jsx)(p,{className:`w-10`,onClick:e=>e.stopPropagation(),children:(0,C.jsx)(Ue,{checked:V.has(e.id),onCheckedChange:()=>Cn(e.id),disabled:e.status!==`pending`,"aria-label":y(`selectRow`,`Select request`)})}),(0,C.jsx)(p,{children:(0,C.jsx)(jn,{r:e})}),(0,C.jsx)(p,{children:(0,C.jsx)(Mn,{r:e})}),(0,C.jsx)(p,{children:xt(e)?(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground`,children:[(0,C.jsx)(Xe,{className:`h-3.5 w-3.5 shrink-0`}),(0,C.jsx)(`span`,{className:`truncate italic`,children:y(`flowOrigin`,`Flow-initiated`)})]}):(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,C.jsx)(We,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,C.jsx)(`span`,{className:`truncate`,title:e.submitter_id||``,children:_t(e)})]})}),(0,C.jsx)(p,{children:(0,C.jsx)(ft,{status:e.status,label:S(e.status)})}),(0,C.jsxs)(p,{className:f(`text-xs whitespace-nowrap`,Ct(e,b)),title:pt(E(e)),children:[(0,C.jsx)(he,{className:`h-3 w-3 inline mr-1`}),x(E(e)),e.status===`pending`&&(()=>{let t=Tt(e.sla_due_at,b);return t?(0,C.jsx)(`div`,{className:f(`mt-0.5 text-[10px] font-medium`,t.overdue?`text-red-600 dark:text-red-400`:`text-muted-foreground`),children:mt(t)}):null})()]}),(0,C.jsx)(p,{className:`w-20`,children:(0,C.jsx)(Nn,{r:e})})]},e.id))})]})})}),(0,C.jsx)(`div`,{className:`md:hidden space-y-2`,children:Y.map(e=>(0,C.jsx)(ie,{className:`cursor-pointer active:bg-accent/50`,onClick:()=>void q(e.id),children:(0,C.jsxs)(Ve,{className:`p-3 space-y-1.5`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsx)(`div`,{className:`font-medium text-sm truncate`,children:ht(e)}),(0,C.jsx)(ft,{status:e.status,label:S(e.status)})]}),(0,C.jsxs)(`div`,{className:`text-sm truncate`,children:[e.record_title||T(e.record_id),(0,C.jsx)(`span`,{className:`text-muted-foreground text-xs ml-1.5`,children:St(e)}),(()=>{let t=A(e);return t?(0,C.jsxs)(`span`,{className:`text-xs ml-1.5 font-medium`,title:t.label,children:[`· `,t.display]}):null})()]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[xt(e)?(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate italic`,children:[(0,C.jsx)(Xe,{className:`h-3 w-3`}),y(`flowOrigin`,`Flow-initiated`)]}):(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,C.jsx)(We,{className:`h-3 w-3`}),_t(e)]}),(0,C.jsxs)(`span`,{className:f(`inline-flex items-center gap-1 whitespace-nowrap`,Ct(e,b)),children:[(0,C.jsx)(he,{className:`h-3 w-3`}),x(E(e))]})]}),yn(e)&&(0,C.jsxs)(`div`,{className:`flex gap-2 pt-1`,onClick:e=>e.stopPropagation(),title:Z(e)?y(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`):void 0,children:[(0,C.jsxs)(d,{size:`sm`,className:`h-7 flex-1`,disabled:nn===e.id||Z(e),onClick:()=>en(e),children:[(0,C.jsx)(Ye,{className:`h-3.5 w-3.5 mr-1`}),y(`approve`,`Approve`)]}),(0,C.jsxs)(d,{size:`sm`,variant:`outline`,className:`h-7 flex-1 border-destructive text-destructive`,disabled:nn===e.id||Z(e),onClick:()=>tn(e),children:[(0,C.jsx)(_e,{className:`h-3.5 w-3.5 mr-1`}),y(`reject`,`Reject`)]})]})]})},e.id))}),D!==`pending`&&jt!=null&&(0,C.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-1`,children:[(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y(`loadedOf`,`Loaded {{loaded}} of {{total}}`,{loaded:O.length,total:jt})}),O.length<jt&&(0,C.jsx)(d,{size:`sm`,variant:`outline`,disabled:j,onClick:()=>void ln(),children:j?y(`loadingMore`,`Loading…`):y(`loadMore`,`Load more`)})]}),(0,C.jsx)(`div`,{className:`hidden md:block text-[11px] text-muted-foreground`,children:y(`keyboardHint`,`Keyboard: j/k move · Enter open · x select · a approve · r reject`)})]})]})]}),(0,C.jsx)(Se,{open:!!H,onOpenChange:e=>!e&&en(null),children:(0,C.jsxs)(me,{children:[(0,C.jsxs)(Ae,{children:[(0,C.jsx)(Oe,{children:y(`approveOneTitle`,`Approve "{{title}}"?`,{title:H?H.record_title||T(H.record_id):``})}),(0,C.jsx)(Ke,{children:y(`approveOneBody`,`This approves the request with your identity. To add a comment or attachment, open the request instead.`)})]}),(0,C.jsxs)(pe,{children:[(0,C.jsx)(ue,{children:y(`cancel`,`Cancel`)}),(0,C.jsx)(Ee,{onClick:()=>void Tn(),children:y(`approve`,`Approve`)})]})]})}),(0,C.jsx)(Se,{open:!!U,onOpenChange:e=>!e&&tn(null),children:(0,C.jsxs)(me,{children:[(0,C.jsxs)(Ae,{children:[(0,C.jsx)(Oe,{children:y(`rejectOneTitle`,`Reject "{{title}}"?`,{title:U?U.record_title||T(U.record_id):``})}),(0,C.jsx)(Ke,{children:y(`rejectOneBody`,`This rejects the request and notifies the submitter.`)})]}),(0,C.jsxs)(pe,{children:[(0,C.jsx)(ue,{children:y(`cancel`,`Cancel`)}),(0,C.jsx)(Ee,{onClick:()=>void En(),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:y(`reject`,`Reject`)})]})]})}),(0,C.jsx)(Re,{open:!!N,onOpenChange:e=>!e&&un(),children:(0,C.jsxs)(tt,{className:`w-full sm:max-w-xl overflow-y-auto`,children:[(0,C.jsxs)(oe,{children:[(0,C.jsx)($e,{children:P?ht(P):y(`drawerTitle`,`Approval Request`)}),(0,C.jsx)(be,{children:P?gt(P)||St(P):``})]}),P&&X>=0&&Y.length>1&&(0,C.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-xs text-muted-foreground`,children:[(0,C.jsxs)(d,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:X<=0,onClick:()=>{let e=Y[X-1];e&&q(e.id)},children:[(0,C.jsx)(Fe,{className:`h-4 w-4 mr-0.5`}),y(`prevRequest`,`Previous`)]}),(0,C.jsx)(`span`,{children:y(`positionOf`,`Request {{index}} of {{total}}`,{index:X+1,total:Y.length})}),(0,C.jsxs)(d,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:X>=Y.length-1,onClick:()=>{let e=Y[X+1];e&&q(e.id)},children:[y(`nextRequest`,`Next`),(0,C.jsx)(Be,{className:`h-4 w-4 ml-0.5`})]})]}),Rt?(0,C.jsxs)(`div`,{className:`space-y-2 mt-6`,children:[(0,C.jsx)(m,{className:`h-6 w-3/4`}),(0,C.jsx)(m,{className:`h-6 w-1/2`}),(0,C.jsx)(m,{className:`h-20 w-full`})]}):P?(0,C.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,C.jsx)(ft,{status:P.status,label:S(P.status)}),(P.round??1)>1&&(0,C.jsx)(c,{variant:`outline`,className:`text-[10px] border-violet-200 text-violet-700 dark:border-violet-500/30 dark:text-violet-400`,children:y(`roundChip`,`Round {{n}}`,{n:P.round})}),(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:pt(E(P)),children:[(0,C.jsx)(he,{className:`h-3 w-3`}),y(`submittedAgo`,`Submitted {{when}}`,{when:x(E(P))})]}),P.completed_at&&(0,C.jsxs)(`span`,{children:[`· `,y(`completedAt`,`Completed {{when}}`,{when:x(P.completed_at)})]}),P.status===`pending`&&(()=>{let e=Tt(P.sla_due_at,b);return e?(0,C.jsx)(c,{variant:`outline`,className:f(`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:mt(e)}):null})()]}),(()=>{let e=A(P),n=Ot(P.payload,P.payload_display,P.payload_labels,6,e?.key);return(0,C.jsx)(ie,{children:(0,C.jsxs)(Ve,{className:`p-4 space-y-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[Bt.isUnreadable(P)?(0,C.jsx)(`div`,{className:`text-base font-semibold truncate`,children:P.record_title||T(P.record_id)}):(0,C.jsxs)(t,{to:yt(P),className:`text-base font-semibold hover:underline inline-flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:P.record_title||T(P.record_id)}),(0,C.jsx)(ce,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:St(P)})]}),(0,C.jsx)(`div`,{className:`text-right text-xs text-muted-foreground shrink-0`,children:(0,C.jsx)(`div`,{className:`inline-flex items-center gap-1`,children:xt(P)?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Xe,{className:`h-3 w-3`}),(0,C.jsx)(`span`,{className:`italic`,children:y(`flowOrigin`,`Flow-initiated`)})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(We,{className:`h-3 w-3`}),(0,C.jsx)(`span`,{title:P.submitter_id||``,children:_t(P)})]})})})]}),e&&(0,C.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e.label}),(0,C.jsx)(`div`,{className:`text-xl font-semibold tabular-nums`,title:e.display,children:e.display})]}),n.length>0&&(0,C.jsx)(`div`,{className:f(`grid grid-cols-2 gap-x-4 gap-y-2 text-sm`,!e&&`border-t pt-3`),children:n.map(([e,t])=>(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,C.jsx)(`div`,{className:`truncate`,title:t,children:t})]},e))}),P.decision_progress&&(()=>{let e=P.decision_progress,t=(P.pending_approvers||[]).length;return(0,C.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1.5`,children:[(0,C.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.behavior===`per_group`?y(`progressGroups`,`Sign-off progress — {{got}} of {{need}} groups`,{got:e.got,need:e.need}):y(`progressApprovals`,`Approvals — {{got}} of {{need}}`,{got:e.got,need:e.need})}),e.behavior!==`per_group`&&P.status===`pending`&&t>0&&(0,C.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:y(`progressEligible`,`{{count}} eligible approver(s)`,{count:t})})]}),(0,C.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":e.need,"aria-valuenow":Math.min(e.got,e.need),"aria-label":y(`progressBar`,`Decision progress`),className:`flex gap-1`,children:e.need>0&&e.need<=12?Array.from({length:e.need}).map((t,n)=>(0,C.jsx)(`div`,{className:f(`h-1.5 flex-1 rounded-full`,n<e.got?`bg-emerald-500`:`bg-muted`)},n)):(0,C.jsx)(`div`,{className:`h-1.5 flex-1 rounded-full bg-muted overflow-hidden`,children:(0,C.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500`,style:{width:`${e.need>0?Math.min(100,e.got/e.need*100):0}%`}})})}),e.groups&&(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.groups.map(e=>(0,C.jsxs)(c,{variant:`outline`,className:f(`text-[11px] gap-1`,e.satisfied?`border-emerald-300 text-emerald-700 dark:border-emerald-700 dark:text-emerald-400`:`text-muted-foreground`),title:`${e.got}/${e.need}`,children:[e.satisfied?(0,C.jsx)(rt,{className:`h-3 w-3`}):(0,C.jsx)(Pe,{className:`h-2.5 w-2.5`}),e.group,` `,e.got,`/`,e.need]},e.group))})]})})(),P.status===`pending`&&(P.pending_approvers||[]).length>0&&(0,C.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,C.jsx)(`div`,{className:`text-[11px] text-muted-foreground mb-1`,children:y(`waitingOn`,`Waiting on`)}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:bt(P).map((e,t)=>(0,C.jsxs)(c,{variant:`outline`,className:`text-[11px]`,title:e.title,children:[e.label,e.group&&(0,C.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`· `,e.group]}),e.count>1&&(0,C.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`×`,e.count]})]},`${e.label}-${e.group??``}-${t}`))})]})]})})})(),(P.flow_steps?.length??0)>1&&(0,C.jsx)(`div`,{className:`flex items-center px-1`,"aria-label":y(`stepProgress`,`Approval steps`),children:P.flow_steps.map((e,t)=>(0,C.jsxs)(g.Fragment,{children:[t>0&&(0,C.jsx)(`div`,{className:f(`h-px flex-1 mx-2`,e.state===`done`||e.state===`current`?`bg-emerald-300 dark:bg-emerald-700`:`bg-border`)}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,C.jsx)(`span`,{className:f(`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,C.jsx)(rt,{className:`h-3 w-3`}):t+1}),(0,C.jsx)(`span`,{className:f(`text-xs`,e.state===`current`?`font-medium`:`text-muted-foreground`),children:e.label})]})]},e.id))}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{className:`text-sm font-semibold mb-3`,children:y(`history`,`Activity`)}),Lt.length===0?(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:y(`noActions`,`No actions yet.`)}):(0,C.jsx)(`ol`,{className:`relative space-y-3 pl-5 before:absolute before:left-[7px] before:top-1 before:bottom-1 before:w-px before:bg-border`,children:Lt.map(e=>{let t=ot(e),n=t?`bg-amber-500`:e.action===`approve`?`bg-emerald-500`:e.action===`reject`?`bg-destructive`:e.action===`submit`?`bg-blue-500`:e.action===`reassign`?`bg-indigo-500`:e.action===`remind`||e.action===`request_info`?`bg-amber-500`:e.action===`comment`?`bg-slate-400`:e.action===`escalate`?`bg-red-500`:e.action===`revise`?`bg-violet-500`:e.action===`resubmit`?`bg-blue-500`:`bg-muted-foreground`,r=e.actor_id===`system:sla`?y(`systemSlaActor`,`System (SLA)`):e.actor_name??(e.actor_id&&e.actor_id===P.submitter_id?_t(P):T(e.actor_id)),i=e.action===`submit`?y(`actSubmit`,`Submitted`):e.action===`approve`?y(`actApprove`,`Approved`):e.action===`reject`?y(`actReject`,`Rejected`):e.action===`recall`?y(`actRecall`,`Recalled`):e.action===`reassign`?y(`actReassign`,`Reassigned`):e.action===`remind`?y(`actRemind`,`Reminder sent`):e.action===`request_info`?y(`actRequestInfo`,`Requested more info`):e.action===`comment`?y(`actComment`,`Commented`):e.action===`escalate`?y(`actEscalate`,`SLA escalated`):e.action===`revise`?y(`actRevise`,`Sent back for revision`):e.action===`resubmit`?y(`actResubmit`,`Resubmitted`):e.action;return(0,C.jsxs)(`li`,{className:`relative text-xs`,children:[(0,C.jsx)(`span`,{className:`absolute -left-[18px] top-1 h-3 w-3 rounded-full ring-2 ring-background ${n}`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{className:`flex items-baseline gap-1.5 flex-wrap`,children:[(0,C.jsx)(`span`,{className:`font-medium`,children:i}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,C.jsx)(`span`,{title:e.actor_id||``,children:r}),t&&(0,C.jsxs)(c,{variant:`outline`,className:`gap-1 border-amber-500/60 px-1.5 py-0 text-[10px] font-medium text-amber-700 dark:text-amber-400`,title:y(`viaOverrideHint`,`The actor held no approver slot on this step — admitted by the admin-override path.`),"data-testid":`via-override-chip`,children:[(0,C.jsx)(qe,{className:`h-3 w-3`,"aria-hidden":!0}),y(`viaOverrideChip`,`Admin override`)]}),(0,C.jsx)(`span`,{className:`ml-auto text-muted-foreground text-[10px]`,title:pt(e.created_at),children:x(e.created_at)})]}),(()=>{let t=e;return e.action!==`reassign`||!t.reassign_from&&!t.reassign_to?null:(0,C.jsx)(`div`,{className:`text-muted-foreground mt-0.5`,children:y(`reassignFromTo`,`from {{from}} to {{to}}`,{from:t.reassign_from_name??T(t.reassign_from),to:t.reassign_to_name??T(t.reassign_to)})})})(),e.comment&&(0,C.jsxs)(`div`,{className:`text-muted-foreground italic mt-0.5`,children:[`"`,e.comment,`"`]}),Array.isArray(e.attachments)&&e.attachments.length>0&&(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:e.attachments.map((t,n)=>(0,C.jsxs)(`button`,{type:`button`,onClick:()=>void Ht(t),className:`inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded-full border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,title:t.name||t.id,children:[(0,C.jsx)(it,{className:`h-3 w-3`}),t.name||`${y(`attachmentChip`,`Attachment`)}${e.attachments.length>1?` ${n+1}`:``}`]},t.id||n))})]},e.id)})}),P.status===`pending`&&(mn||hn)&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,C.jsx)(ve,{value:W,onChange:e=>an(e.target.value),onKeyDown:e=>{e.key===`Enter`&&W.trim()&&(e.preventDefault(),pn())},placeholder:y(`replyPlaceholder`,`Reply on this request…`),className:`h-8 text-sm`}),(0,C.jsx)(d,{size:`sm`,variant:`outline`,className:`h-8 px-2 shrink-0`,disabled:!W.trim()||on,onClick:()=>void pn(),children:(0,C.jsx)(Je,{className:`h-3.5 w-3.5`})})]})]}),P.payload!=null&&(0,C.jsxs)(`details`,{className:`group`,children:[(0,C.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:y(`rawData`,`Raw data (JSON)`)}),(0,C.jsxs)(`div`,{className:`mt-2`,children:[(0,C.jsx)(`div`,{className:`flex justify-end`,children:(0,C.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(P.payload,null,2)),h.success(y(`copied`,`Copied`))}catch{h.error(y(`copyFailed`,`Copy failed`))}},className:`text-[10px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,C.jsx)(ye,{className:`h-3 w-3`}),y(`copy`,`Copy`)]})}),(0,C.jsx)(`pre`,{className:`text-[11px] bg-muted/50 rounded p-2 overflow-auto max-h-48 mt-1`,children:JSON.stringify(P.payload,null,2)})]})]}),P.status===`pending`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xe,{}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(at,{objectName:`sys_approval_request`,record:P,location:`record_section`,label:y(`declaredActions`,`Actions`),onDone:()=>{fn()}}),!mn&&(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:hn?y(`whyDisabledSubmitter`,`You submitted this request, so you can recall it — but only the assigned approvers can approve or reject.`):y(`whyDisabled`,`Only the assigned approvers can act on this request. It is waiting on: {{who}}.`,{who:(P.pending_approvers||[]).map(e=>vt(e,P)).join(`, `)||`—`})})]})]}),gn&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(xe,{}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:y(`returnedHint`,`An approver sent this back to you. The record is unlocked — fix the data, then resubmit to start a new approval round.`)}),(0,C.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,C.jsx)(d,{asChild:!0,size:`sm`,variant:`outline`,children:(0,C.jsxs)(t,{to:yt(P),children:[(0,C.jsx)(ce,{className:`h-4 w-4 mr-1`}),y(`editRecordBtn`,`Edit record`)]})}),(0,C.jsx)(at,{objectName:`sys_approval_request`,record:P,location:`record_section`,onDone:()=>{dn(P.id),K()}})]})]})]})]}):null]})})]})}export{j as ApprovalsInboxPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{An as r,Ar as i,Br as a,Cn as ee,Dn as te,En as o,Gt as ne,Hn as s,Ir as c,Jt as l,Kt as u,On as d,Qr as f,Rn as p,Sn as re,Tn as m,Vr as h,Xt as g,Yt as ie,_t as ae,ai as oe,bn as se,ca as ce,jr as _,kn as v,la as y,qt as b,uc as x,vn as S,vt as C,wn as w,xa as le,xn as ue,xt as de}from"./ui-components-3mb69z8L.js";var T=e(t(),1),E=[`create`,`update`,`delete`,`login`,`logout`,`config_change`,`import`],D={create:`default`,update:`secondary`,delete:`destructive`,login:`outline`,logout:`outline`,config_change:`secondary`,import:`outline`},O=n(),fe=`${``.replace(/\/$/,``)}/api/v1`,k=50;function A(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function j(e,t=24){return e?e.length>t?`${e.slice(0,t-1)}…`:e:`—`}function M(e){if(!e)return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function N(){let[e,t]=(0,T.useState)([]),[n,N]=(0,T.useState)(!1),[P,F]=(0,T.useState)(null),[I,L]=(0,T.useState)(`all`),[R,z]=(0,T.useState)(``),[B,V]=(0,T.useState)(``),[H,U]=(0,T.useState)(``),[W,G]=(0,T.useState)(``),[K,q]=(0,T.useState)(0),[J,Y]=(0,T.useState)(!1),[X,Z]=(0,T.useState)(null),Q=(0,T.useCallback)(async()=>{N(!0),F(null);try{let e={};I&&I!==`all`&&(e.action=I),R.trim()&&(e.object_name=R.trim()),B.trim()&&(e.user_id=B.trim()),H&&(e.created_at={...e.created_at||{},$gte:H}),W&&(e.created_at={...e.created_at||{},$lte:`${W}T23:59:59`});let n=new URLSearchParams;Object.keys(e).length>0&&n.set(`$filter`,JSON.stringify(e)),n.set(`$orderby`,`created_at desc`),n.set(`$top`,`51`),n.set(`$skip`,String(K*k));let r=await fetch(`${fe}/data/sys_audit_log?${n.toString()}`,{credentials:`include`});if(!r.ok){let e=await r.text().catch(()=>``);throw Error(`HTTP ${r.status}: ${e.slice(0,200)||r.statusText}`)}let i=await r.json(),a=Array.isArray(i)?i:Array.isArray(i?.records)?i.records:Array.isArray(i?.data)?i.data:[];Y(a.length>k),t(a.slice(0,k))}catch(e){console.warn(`[AuditLogPage] load failed:`,e),F(e?.message||`Failed to load audit log`),t([]),Y(!1)}finally{N(!1)}},[I,R,B,H,W,K]);(0,T.useEffect)(()=>{Q()},[Q]);let pe=(0,T.useCallback)(()=>{L(`all`),z(``),V(``),U(``),G(``),q(0)},[]),$=(0,T.useMemo)(()=>{let e=0;return I!==`all`&&(e+=1),R.trim()&&(e+=1),B.trim()&&(e+=1),H&&(e+=1),W&&(e+=1),e},[I,R,B,H,W]);return(0,O.jsxs)(`div`,{className:`p-6 space-y-4 max-w-screen-2xl mx-auto`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(y,{className:`h-6 w-6 text-muted-foreground`}),(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Audit Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Read-only system activity and record changes. Newest first.`})]}),(0,O.jsxs)(f,{variant:`outline`,size:`sm`,onClick:Q,disabled:n,children:[(0,O.jsx)(le,{className:`h-4 w-4 mr-1 ${n?`animate-spin`:``}`}),`Refresh`]})]}),(0,O.jsx)(i,{children:(0,O.jsxs)(_,{className:`p-4 grid grid-cols-1 md:grid-cols-5 gap-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(s,{className:`text-xs`,children:`Action`}),(0,O.jsxs)(o,{value:I,onValueChange:e=>{L(e),q(0)},children:[(0,O.jsx)(v,{className:`h-9`,children:(0,O.jsx)(r,{})}),(0,O.jsxs)(te,{children:[(0,O.jsx)(d,{value:`all`,children:`All actions`}),E.map(e=>(0,O.jsx)(d,{value:e,children:e},e))]})]})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(s,{className:`text-xs`,children:`Object`}),(0,O.jsx)(p,{placeholder:`e.g. account`,value:R,onChange:e=>{z(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(s,{className:`text-xs`,children:`Actor (user id)`}),(0,O.jsx)(p,{placeholder:`user id`,value:B,onChange:e=>{V(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(s,{className:`text-xs`,children:`From`}),(0,O.jsx)(p,{type:`date`,value:H,onChange:e=>{U(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(s,{className:`text-xs`,children:`To`}),(0,O.jsx)(p,{type:`date`,value:W,onChange:e=>{G(e.target.value),q(0)},className:`h-9`})]}),$>0&&(0,O.jsx)(`div`,{className:`md:col-span-5 flex justify-end`,children:(0,O.jsxs)(f,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,O.jsx)(oe,{className:`h-4 w-4 mr-1`}),`Clear filters (`,$,`)`]})})]})}),P&&(0,O.jsxs)(a,{variant:`destructive`,children:[(0,O.jsx)(x,{className:`h-4 w-4`}),(0,O.jsx)(h,{children:P})]}),(0,O.jsx)(i,{children:(0,O.jsx)(_,{className:`p-0`,children:n&&e.length===0?(0,O.jsx)(`div`,{className:`p-6 space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,O.jsx)(S,{className:`h-9 w-full`},t))}):e.length===0?(0,O.jsx)(`div`,{className:`p-12`,children:(0,O.jsxs)(ae,{children:[(0,O.jsx)(ce,{className:`h-8 w-8 text-muted-foreground mb-3`}),(0,O.jsx)(de,{children:`No audit entries`}),(0,O.jsx)(C,{children:$>0?`Try clearing filters or widening the date range.`:`Events will appear here once tracked objects are modified.`})]})}):(0,O.jsxs)(ne,{children:[(0,O.jsx)(ie,{children:(0,O.jsxs)(g,{children:[(0,O.jsx)(l,{className:`w-[180px]`,children:`Timestamp`}),(0,O.jsx)(l,{className:`w-[130px]`,children:`Action`}),(0,O.jsx)(l,{children:`Object`}),(0,O.jsx)(l,{children:`Record`}),(0,O.jsx)(l,{children:`Actor`}),(0,O.jsx)(l,{className:`w-[130px]`,children:`IP`})]})}),(0,O.jsx)(u,{children:e.map(e=>{let t=D[e.action||``]||`outline`;return(0,O.jsxs)(g,{className:`cursor-pointer`,onClick:()=>Z(e),children:[(0,O.jsx)(b,{className:`font-mono text-xs`,children:A(e.created_at)}),(0,O.jsx)(b,{children:(0,O.jsx)(c,{variant:t,children:e.action||`—`})}),(0,O.jsx)(b,{children:e.object_name||`—`}),(0,O.jsx)(b,{className:`font-mono text-xs`,children:j(e.record_id,18)}),(0,O.jsx)(b,{className:`font-mono text-xs`,children:j(e.user_id,18)}),(0,O.jsx)(b,{className:`font-mono text-xs`,children:e.ip_address||`—`})]},e.id)})})]})})}),(e.length>0||K>0)&&(0,O.jsxs)(`div`,{className:`flex items-center justify-between text-sm text-muted-foreground`,children:[(0,O.jsxs)(`span`,{children:[`Page `,K+1,J?``:` · end`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(f,{variant:`outline`,size:`sm`,disabled:K===0||n,onClick:()=>q(e=>Math.max(0,e-1)),children:`Previous`}),(0,O.jsx)(f,{variant:`outline`,size:`sm`,disabled:!J||n,onClick:()=>q(e=>e+1),children:`Next`})]})]}),(0,O.jsx)(se,{open:!!X,onOpenChange:e=>!e&&Z(null),children:(0,O.jsxs)(ue,{side:`right`,className:`sm:max-w-2xl w-full overflow-y-auto`,children:[(0,O.jsxs)(ee,{children:[(0,O.jsxs)(w,{className:`flex items-center gap-2`,children:[(0,O.jsx)(c,{variant:X&&D[X.action||``]||`outline`,children:X?.action||`—`}),X?.object_name||`Audit Event`]}),(0,O.jsx)(re,{children:X?.id?(0,O.jsx)(`span`,{className:`font-mono text-xs`,children:X.id}):null})]}),X&&(0,O.jsxs)(`div`,{className:`mt-6 space-y-5`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Timestamp`}),(0,O.jsx)(`div`,{className:`font-mono`,children:A(X.created_at)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`IP Address`}),(0,O.jsx)(`div`,{className:`font-mono`,children:X.ip_address||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Actor (user_id)`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.user_id||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Tenant`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.tenant_id||`—`})]}),(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Target record`}),(0,O.jsxs)(`div`,{className:`font-mono text-sm break-all`,children:[X.object_name||`—`,` / `,X.record_id||`—`]})]}),X.user_agent&&(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`User Agent`}),(0,O.jsx)(`div`,{className:`font-mono text-xs break-all`,children:X.user_agent})]})]}),(X.old_value||X.new_value)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(m,{}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:`Change payload`}),X.old_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Before`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.old_value)})]}),X.new_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`After`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.new_value)})]})]})]}),X.metadata&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(m,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Metadata`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-48 overflow-auto`,children:M(X.metadata)})]})]})]})]})})]})}export{N as AuditLogPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{b as e,g as t,h as n,r}from"./vendor-react-CsWFRkED.js";import{_t as i,vt as a,xt as o}from"./ui-components-3mb69z8L.js";import{t as s}from"./componentRegistry-ByxoJqMW.js";e();var c=r();function l({extraProps:e}={}){let r=n(),[l]=t(),u=r.ns,d=r.name,f=u&&d?`${u}:${d}`:u??``,p=s(f);if(!p)return(0,c.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,c.jsxs)(i,{children:[(0,c.jsx)(o,{children:`Component not registered`}),(0,c.jsxs)(a,{children:[`No component is registered for `,(0,c.jsx)(`code`,{className:`font-mono`,children:f||`(empty)`}),`. Ensure the plugin that provides this surface is installed and has called`,(0,c.jsx)(`code`,{className:`font-mono`,children:` registerAppComponent()`}),`.`]})]})});let m={};for(let[e,t]of l.entries())m[e]=t;let h=p.component;return(0,c.jsx)(h,{...m,...e??{}})}export{l as ComponentNavView,l as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{A as r}from"./framework-LCCQTTcs.js";import{Ao as i,Co as a,Cr as o,Dc as s,Ho as c,Ji as l,Ki as u,Ks as d,Qr as f,Rn as p,Sr as m,Tr as h,br as g,ho as _,kc as v,ol as y,uc as ee,wr as b,xr as x}from"./ui-components-3mb69z8L.js";import{n as S}from"./createDerive-xZXxMz1g.js";import{a as C,i as te,n as w,o as T,r as E,s as D,t as O}from"./plugin-view-B9yCVdSX.js";var k=e(t(),1),A=n();function j({title:e,description:t,icon:n,actions:r,accentColor:i,sticky:a=!1,className:o,"data-testid":s}){return(0,A.jsxs)(`div`,{style:{"--page-header-accent":i||`hsl(var(--primary))`},className:y(`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,A.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,A.jsxs)(`div`,{className:`flex justify-between items-center gap-3 py-2.5 sm:py-3 px-4 sm:px-6`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[n&&(0,A.jsx)(`div`,{className:y(`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,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`h1`,{className:`text-base sm:text-lg lg:text-xl font-semibold tracking-tight text-foreground truncate leading-tight`,children:e}),t&&(0,A.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,A.jsx)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0`,children:r})]})]})}function M(e){return[{type:`grid`,icon:i,label:e(`console.objectView.viewTypeGrid`),description:e(`console.objectView.viewTypeGridDesc`)},{type:`kanban`,icon:u,label:e(`console.objectView.viewTypeKanban`),description:e(`console.objectView.viewTypeKanbanDesc`)},{type:`calendar`,icon:v,label:e(`console.objectView.viewTypeCalendar`),description:e(`console.objectView.viewTypeCalendarDesc`)},{type:`gallery`,icon:c,label:e(`console.objectView.viewTypeGallery`),description:e(`console.objectView.viewTypeGalleryDesc`)},{type:`timeline`,icon:d,label:e(`console.objectView.viewTypeTimeline`),description:e(`console.objectView.viewTypeTimelineDesc`)},{type:`gantt`,icon:l,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:s,label:e(`console.objectView.viewTypeChart`),description:e(`console.objectView.viewTypeChartDesc`)},{type:`tree`,icon:a,label:e(`console.objectView.viewTypeTree`),description:e(`console.objectView.viewTypeTreeDesc`)}]}function N(e,t){for(let n=1;n<1e3;n++){let r=`${e} ${n}`;if(!t.has(r))return r}return e}var P={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:O},{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`&&C(e,`latitude`)},{key:`longitudeField`,i18nKey:`console.objectView.longitudeField`,helpI18nKey:`console.objectView.longitudeFieldHelp`,filter:e=>e.type===`number`&&C(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 F({open:e,onOpenChange:t,onCreate:n,existingLabels:i,availableTypes:a,objectDef:s}){let{t:c}=r(),l=(0,k.useMemo)(()=>M(c),[c]),u=(0,k.useMemo)(()=>a&&a.length>0?l.filter(e=>a.includes(e.type)):l,[l,a]),d=(i??[]).join(`\0`),_=(0,k.useMemo)(()=>new Set(i??[]),[d]),v=(0,k.useMemo)(()=>s?te(s):[],[s]),[C,w]=(0,k.useState)(u[0]?.type??`grid`),[T,E]=(0,k.useState)(``),[O,j]=(0,k.useState)(!1),[F,I]=(0,k.useState)(``),[L,R]=(0,k.useState)(!1),[ne,z]=(0,k.useState)({});(0,k.useEffect)(()=>{e&&(w(u[0]?.type??`grid`),j(!1),R(!1),z({}))},[e,u]),(0,k.useEffect)(()=>{if(!O){let e=u.find(e=>e.type===C);E(N(e?.label??`View`,_))}},[C,O,u,_]),(0,k.useEffect)(()=>{L||I(S(T))},[T,L]);let B=P[C]??[],V=e=>e.kind===`enum`?(e.enumOptions?.length??0)>0:!s||(e.filter?v.filter(e.filter):v).length>0,H=(0,k.useMemo)(()=>{let e={};return u.forEach(t=>{let n=(P[t.type]??[]).find(e=>!V(e));e[t.type]=n??null}),e},[u,v,s]),U=e=>ne[`${C}.${e}`]??``,W=(e,t)=>z(n=>({...n,[`${C}.${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=F.trim(),X=Y.length===0,Z=Y.length>0&&!J.test(Y),Q=G.length>0&&!K&&q&&!X&&!Z;(0,k.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?v.filter(e.filter):v;if(t.length===0)return;if(t.length===1){W(e.key,t[0].value);return}let n=D(t,e.preferred??[]);n&&W(e.key,n)})},[C,v]);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:C,label:G,name:Y};Object.keys(e).length>0&&(r[C]=e),n(r),t(!1)};return(0,A.jsx)(g,{open:e,onOpenChange:t,children:(0,A.jsxs)(x,{className:`sm:max-w-[560px]`,"data-testid":`create-view-dialog`,children:[(0,A.jsxs)(b,{children:[(0,A.jsx)(h,{children:c(`console.objectView.createView`)}),(0,A.jsx)(m,{children:c(`console.objectView.createViewDesc`)})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-4 gap-2 py-2`,"data-testid":`create-view-type-grid`,children:u.map(({type:e,label:t,description:n,icon:r})=>{let i=e===C,a=H[e],o=!!a,s=o?c(`console.objectView.viewTypeUnavailable`,{field:c(a.i18nKey)}):void 0;return(0,A.jsxs)(`button`,{type:`button`,"data-testid":`create-view-type-${e}`,"aria-pressed":i,"aria-disabled":o,disabled:o,title:s,onClick:()=>{o||w(e)},className:y(`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,A.jsx)(r,{className:y(`h-5 w-5`,i&&!o?`text-primary`:`text-muted-foreground group-hover:text-foreground`)}),(0,A.jsx)(`div`,{className:`text-xs font-medium leading-tight`,children:t}),(0,A.jsx)(`div`,{className:`text-[10px] leading-tight text-muted-foreground line-clamp-2`,children:o?c(`console.objectView.viewTypeUnavailableShort`):n})]},e)})}),B.length>0&&(0,A.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?v.filter(e.filter):v,i=!n&&v.length>0&&r.length===0;return(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsxs)(`label`,{htmlFor:`create-view-required-${e.key}`,className:`text-xs font-medium`,children:[c(e.i18nKey),(0,A.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,A.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:y(`h-9 w-full rounded-md border bg-background px-2 text-xs`,`border-input`),children:[(0,A.jsx)(`option`,{value:``,children:c(n?`console.objectView.selectOption`:`console.objectView.selectField`)}),n?e.enumOptions.map(e=>(0,A.jsx)(`option`,{value:e.value,children:c(e.i18nKey)},e.value)):r.map(e=>(0,A.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),e.helpI18nKey&&!i&&(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(e.helpI18nKey)}),i&&(0,A.jsxs)(`p`,{className:`flex items-center gap-1 text-[11px] text-destructive`,"data-testid":`create-view-error-no-field-${e.key}`,children:[(0,A.jsx)(ee,{className:`h-3 w-3`}),c(`console.objectView.noEligibleFieldForType`)]})]},e.key)})}),(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsxs)(`label`,{htmlFor:`create-view-name-input`,className:`text-xs font-medium`,children:[c(`console.objectView.title`),(0,A.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,A.jsx)(p,{id:`create-view-name-input`,"aria-required":`true`,"data-testid":`create-view-name-input`,autoFocus:!0,value:T,onChange:e=>{E(e.target.value),j(!0)},onKeyDown:e=>{e.key===`Enter`&&Q&&$()},placeholder:c(`console.objectView.newView`),className:`h-9`}),K&&(0,A.jsx)(`p`,{className:`text-[11px] text-destructive`,"data-testid":`create-view-error-duplicate`,children:c(`console.objectView.duplicateViewName`)})]}),(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsxs)(`label`,{htmlFor:`create-view-machine-name-input`,className:`text-xs font-medium`,children:[c(`console.objectView.viewName`),(0,A.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,A.jsx)(p,{id:`create-view-machine-name-input`,"aria-required":`true`,"data-testid":`create-view-machine-name-input`,value:F,onChange:e=>{I(e.target.value),R(!0)},onKeyDown:e=>{e.key===`Enter`&&Q&&$()},placeholder:`grid_1`,className:`h-9 font-mono`}),X?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,"data-testid":`create-view-machine-name-help`,children:c(`console.objectView.viewNameRequired`)}):Z?(0,A.jsx)(`p`,{className:`text-[11px] text-destructive`,"data-testid":`create-view-error-machine-name`,children:c(`console.objectView.viewNameInvalid`)}):(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,"data-testid":`create-view-machine-name-help`,children:c(`console.objectView.viewNameHelp`)})]}),(0,A.jsxs)(o,{className:`mt-2`,children:[(0,A.jsx)(f,{type:`button`,variant:`outline`,onClick:()=>t(!1),"data-testid":`create-view-cancel`,children:c(`console.objectView.cancel`)}),(0,A.jsx)(f,{type:`button`,disabled:!Q,onClick:$,"data-testid":`create-view-submit`,children:c(`console.objectView.create`)})]})]})})}export{j as n,F as t};
|