@datatechsolutions/ui 2.11.83 → 2.11.84

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.
Files changed (101) hide show
  1. package/dist/astrlabe/index.d.mts +3 -52
  2. package/dist/astrlabe/index.d.ts +3 -52
  3. package/dist/astrlabe/index.js +107 -107
  4. package/dist/astrlabe/index.mjs +4 -4
  5. package/dist/astrlabe/workflow-canvas.js +4 -4
  6. package/dist/astrlabe/workflow-canvas.mjs +3 -3
  7. package/dist/chunk-3T2WGL47.js +44 -0
  8. package/dist/chunk-3T2WGL47.js.map +1 -0
  9. package/dist/{chunk-UVGMKHWH.mjs → chunk-63AL2RN5.mjs} +4 -4
  10. package/dist/{chunk-UVGMKHWH.mjs.map → chunk-63AL2RN5.mjs.map} +1 -1
  11. package/dist/chunk-64G2HBRQ.mjs +481 -0
  12. package/dist/chunk-64G2HBRQ.mjs.map +1 -0
  13. package/dist/{chunk-J3OYJ44D.mjs → chunk-BH2AU3LG.mjs} +3 -3
  14. package/dist/{chunk-J3OYJ44D.mjs.map → chunk-BH2AU3LG.mjs.map} +1 -1
  15. package/dist/chunk-CCRBT7TA.mjs +941 -0
  16. package/dist/chunk-CCRBT7TA.mjs.map +1 -0
  17. package/dist/chunk-CHLJUSXX.mjs +128 -0
  18. package/dist/chunk-CHLJUSXX.mjs.map +1 -0
  19. package/dist/chunk-CXIQWPBH.js +214 -0
  20. package/dist/chunk-CXIQWPBH.js.map +1 -0
  21. package/dist/chunk-EDE36MKE.mjs +412 -0
  22. package/dist/chunk-EDE36MKE.mjs.map +1 -0
  23. package/dist/{chunk-M7P2TQ6X.js → chunk-EFREXNZB.js} +64 -64
  24. package/dist/{chunk-M7P2TQ6X.js.map → chunk-EFREXNZB.js.map} +1 -1
  25. package/dist/chunk-FAGDZEKM.js +23 -0
  26. package/dist/chunk-FAGDZEKM.js.map +1 -0
  27. package/dist/{chunk-TUEYBNWL.js → chunk-GV6WJCEB.js} +3 -3
  28. package/dist/{chunk-TUEYBNWL.js.map → chunk-GV6WJCEB.js.map} +1 -1
  29. package/dist/chunk-HU3EAHFO.mjs +20 -0
  30. package/dist/chunk-HU3EAHFO.mjs.map +1 -0
  31. package/dist/{chunk-LLFU42KC.mjs → chunk-I6WYV2AN.mjs} +3 -3
  32. package/dist/{chunk-LLFU42KC.mjs.map → chunk-I6WYV2AN.mjs.map} +1 -1
  33. package/dist/chunk-JJWFMKZY.js +132 -0
  34. package/dist/chunk-JJWFMKZY.js.map +1 -0
  35. package/dist/{chunk-JFWZHROG.js → chunk-L6FVIWAJ.js} +128 -128
  36. package/dist/{chunk-JFWZHROG.js.map → chunk-L6FVIWAJ.js.map} +1 -1
  37. package/dist/chunk-MNQEZL7B.mjs +210 -0
  38. package/dist/chunk-MNQEZL7B.mjs.map +1 -0
  39. package/dist/chunk-SGJ24J2Q.js +943 -0
  40. package/dist/chunk-SGJ24J2Q.js.map +1 -0
  41. package/dist/chunk-SW6TVAIJ.js +418 -0
  42. package/dist/chunk-SW6TVAIJ.js.map +1 -0
  43. package/dist/chunk-SYNVNTLJ.mjs +20 -0
  44. package/dist/chunk-SYNVNTLJ.mjs.map +1 -0
  45. package/dist/chunk-UQXVCVAN.mjs +41 -0
  46. package/dist/chunk-UQXVCVAN.mjs.map +1 -0
  47. package/dist/chunk-WGELLCOZ.js +22 -0
  48. package/dist/chunk-WGELLCOZ.js.map +1 -0
  49. package/dist/chunk-YXPHJ2BQ.js +541 -0
  50. package/dist/chunk-YXPHJ2BQ.js.map +1 -0
  51. package/dist/index.d.mts +3 -47
  52. package/dist/index.d.ts +3 -47
  53. package/dist/index.js +765 -765
  54. package/dist/index.mjs +2 -2
  55. package/dist/navigation-BiWVffAN.d.mts +49 -0
  56. package/dist/navigation-BiWVffAN.d.ts +49 -0
  57. package/dist/platform/agents-workspace.d.mts +19 -0
  58. package/dist/platform/agents-workspace.d.ts +19 -0
  59. package/dist/platform/agents-workspace.js +26 -0
  60. package/dist/platform/agents-workspace.js.map +1 -0
  61. package/dist/platform/agents-workspace.mjs +17 -0
  62. package/dist/platform/agents-workspace.mjs.map +1 -0
  63. package/dist/platform/app-shell.d.mts +58 -0
  64. package/dist/platform/app-shell.d.ts +58 -0
  65. package/dist/platform/app-shell.js +17 -0
  66. package/dist/platform/app-shell.js.map +1 -0
  67. package/dist/platform/app-shell.mjs +8 -0
  68. package/dist/platform/app-shell.mjs.map +1 -0
  69. package/dist/platform/index.d.mts +100 -3
  70. package/dist/platform/index.d.ts +100 -3
  71. package/dist/platform/index.js +499 -28
  72. package/dist/platform/index.js.map +1 -1
  73. package/dist/platform/index.mjs +472 -27
  74. package/dist/platform/index.mjs.map +1 -1
  75. package/dist/platform/pages/index.d.mts +243 -82
  76. package/dist/platform/pages/index.d.ts +243 -82
  77. package/dist/platform/pages/index.js +886 -614
  78. package/dist/platform/pages/index.js.map +1 -1
  79. package/dist/platform/pages/index.mjs +756 -511
  80. package/dist/platform/pages/index.mjs.map +1 -1
  81. package/dist/platform/utils/index.js +18 -56
  82. package/dist/platform/utils/index.js.map +1 -1
  83. package/dist/platform/utils/index.mjs +3 -53
  84. package/dist/platform/utils/index.mjs.map +1 -1
  85. package/dist/platform/workflow-api-client.d.mts +6 -0
  86. package/dist/platform/workflow-api-client.d.ts +6 -0
  87. package/dist/platform/workflow-api-client.js +246 -0
  88. package/dist/platform/workflow-api-client.js.map +1 -0
  89. package/dist/platform/workflow-api-client.mjs +5 -0
  90. package/dist/platform/workflow-api-client.mjs.map +1 -0
  91. package/dist/platform/workflow-canvas-shell.d.mts +18 -0
  92. package/dist/platform/workflow-canvas-shell.d.ts +18 -0
  93. package/dist/platform/workflow-canvas-shell.js +20 -0
  94. package/dist/platform/workflow-canvas-shell.js.map +1 -0
  95. package/dist/platform/workflow-canvas-shell.mjs +11 -0
  96. package/dist/platform/workflow-canvas-shell.mjs.map +1 -0
  97. package/dist/{rule-form-F5jBOeqk.d.mts → rule-form-BYJzyork.d.mts} +50 -1
  98. package/dist/{rule-form-F5jBOeqk.d.ts → rule-form-BYJzyork.d.ts} +50 -1
  99. package/dist/workflow-api-client-C8gPn_D1.d.mts +386 -0
  100. package/dist/workflow-api-client-Dy1Ph8W-.d.ts +386 -0
  101. package/package.json +21 -1
@@ -1,15 +1,30 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
+ var chunkCXIQWPBH_js = require('../chunk-CXIQWPBH.js');
5
+ var chunkSGJ24J2Q_js = require('../chunk-SGJ24J2Q.js');
6
+ require('../chunk-SW6TVAIJ.js');
7
+ var chunkJJWFMKZY_js = require('../chunk-JJWFMKZY.js');
4
8
  var chunkHZ4LOVHM_js = require('../chunk-HZ4LOVHM.js');
5
9
  var chunk6PBTB5ZX_js = require('../chunk-6PBTB5ZX.js');
6
- var chunkTUEYBNWL_js = require('../chunk-TUEYBNWL.js');
7
- var chunkYXN2K77G_js = require('../chunk-YXN2K77G.js');
8
- require('../chunk-S7KHTUHA.js');
10
+ var chunkYXPHJ2BQ_js = require('../chunk-YXPHJ2BQ.js');
11
+ require('../chunk-FAGDZEKM.js');
12
+ var chunkWGELLCOZ_js = require('../chunk-WGELLCOZ.js');
13
+ require('../chunk-L6FVIWAJ.js');
14
+ require('../chunk-55H6WZQP.js');
15
+ require('../chunk-5UU3RQRB.js');
16
+ require('../chunk-EFREXNZB.js');
17
+ var chunkGV6WJCEB_js = require('../chunk-GV6WJCEB.js');
18
+ var chunkS7KHTUHA_js = require('../chunk-S7KHTUHA.js');
9
19
  require('../chunk-UZ3CMNUJ.js');
20
+ var chunkYXN2K77G_js = require('../chunk-YXN2K77G.js');
21
+ require('../chunk-P4YYEM4B.js');
22
+ require('../chunk-C7BI5LQ6.js');
10
23
  var jsxRuntime = require('react/jsx-runtime');
11
24
  var react = require('react');
12
25
  var client = require('@datatechsolutions/windsock/client');
26
+ var outline = require('@heroicons/react/24/outline');
27
+ var i18n = require('@datatechsolutions/shared-domain/i18n');
13
28
 
14
29
  function SessionSwitcher({
15
30
  organizations,
@@ -23,7 +38,7 @@ function SessionSwitcher({
23
38
  const tCommon = chunkYXN2K77G_js.useTranslations("common");
24
39
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "session-switcher", children: [
25
40
  /* @__PURE__ */ jsxRuntime.jsx(
26
- chunkTUEYBNWL_js.Select,
41
+ chunkGV6WJCEB_js.Select,
27
42
  {
28
43
  value: organizationId,
29
44
  "aria-label": tSession("organization"),
@@ -35,7 +50,7 @@ function SessionSwitcher({
35
50
  }
36
51
  ),
37
52
  /* @__PURE__ */ jsxRuntime.jsx(
38
- chunkTUEYBNWL_js.Select,
53
+ chunkGV6WJCEB_js.Select,
39
54
  {
40
55
  value: userEmail,
41
56
  "aria-label": tSession("user"),
@@ -46,30 +61,110 @@ function SessionSwitcher({
46
61
  placeholder: tSession("user")
47
62
  }
48
63
  ),
49
- /* @__PURE__ */ jsxRuntime.jsx(chunkTUEYBNWL_js.Button, { outline: true, onClick: () => globalThis.location.reload(), children: tCommon("refresh") })
64
+ /* @__PURE__ */ jsxRuntime.jsx(chunkGV6WJCEB_js.Button, { outline: true, onClick: () => globalThis.location.reload(), children: tCommon("refresh") })
50
65
  ] });
51
66
  }
52
- var PlatformStateContext = react.createContext(null);
53
- function PlatformStateProvider({ children, normalizeRole }) {
54
- const { user } = client.useAuth();
55
- const state = react.useMemo(() => {
56
- const organizationId = user?.organizationId ?? "";
57
- const actor = user ? {
58
- ...user,
59
- role: normalizeRole(user.role),
60
- organizationId
61
- } : null;
62
- return {
63
- currentOrganizationId: organizationId,
64
- actor
65
- };
66
- }, [user, normalizeRole]);
67
- return /* @__PURE__ */ jsxRuntime.jsx(PlatformStateContext.Provider, { value: state, children });
67
+ function PlatformDockContainer({
68
+ actor,
69
+ navigationItems,
70
+ dashboardPath = "/dashboard",
71
+ signOutPath = "/login"
72
+ }) {
73
+ const pathname = chunkS7KHTUHA_js.usePathname();
74
+ const router = chunkS7KHTUHA_js.useRouter();
75
+ const { logout } = client.useAuth();
76
+ const tCommon = chunkYXN2K77G_js.useTranslations("common");
77
+ const {
78
+ dockPosition,
79
+ dockAutoHide,
80
+ dockEnabled
81
+ } = client.usePlatformPreferences();
82
+ const [profileOpen, setProfileOpen] = react.useState(false);
83
+ const filteredItems = react.useMemo(
84
+ () => chunkGV6WJCEB_js.filterByPermission(navigationItems, actor?.permissions ?? []),
85
+ [navigationItems, actor]
86
+ );
87
+ const handleNavigate = react.useCallback((href) => router.push(href), [router]);
88
+ const handleSignOut = react.useCallback(() => {
89
+ void logout(signOutPath);
90
+ }, [logout, signOutPath]);
91
+ if (pathname === dashboardPath) return null;
92
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
93
+ /* @__PURE__ */ jsxRuntime.jsx(
94
+ chunkGV6WJCEB_js.AppNavigation,
95
+ {
96
+ items: filteredItems,
97
+ pathname,
98
+ dockEnabled,
99
+ dockPosition,
100
+ dockAutoHide,
101
+ showLaunchpad: false,
102
+ onNavigate: handleNavigate,
103
+ onOpenProfile: () => setProfileOpen(true),
104
+ onSignOut: handleSignOut,
105
+ labels: {
106
+ home: tCommon("home"),
107
+ profile: tCommon("profile"),
108
+ signOut: tCommon("signOut")
109
+ }
110
+ }
111
+ ),
112
+ /* @__PURE__ */ jsxRuntime.jsx(
113
+ chunkGV6WJCEB_js.GlassModal,
114
+ {
115
+ open: profileOpen,
116
+ onClose: () => setProfileOpen(false),
117
+ title: tCommon("profile"),
118
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", {})
119
+ }
120
+ )
121
+ ] });
122
+ }
123
+ function useLocaleSwitcher() {
124
+ const locale = chunkYXN2K77G_js.useLocale();
125
+ const { client: client$1 } = client.useAuth();
126
+ const setLocale = react.useCallback(
127
+ (newLocale) => {
128
+ const resolved = i18n.applyClientLocale(newLocale);
129
+ client$1.updateLocale(resolved);
130
+ },
131
+ [client$1]
132
+ );
133
+ return {
134
+ locale,
135
+ shortCode: i18n.LOCALE_TO_SHORT[locale] || "pt",
136
+ setLocale,
137
+ locales: i18n.SUPPORTED_LOCALES
138
+ };
68
139
  }
69
- function usePlatformState() {
70
- const context = react.useContext(PlatformStateContext);
71
- if (!context) throw new Error("usePlatformState must be used inside PlatformStateProvider");
72
- return context;
140
+ var LOCALE_OPTIONS = i18n.SUPPORTED_LOCALES.map((code) => ({
141
+ value: code,
142
+ label: i18n.LANGUAGE_META[code].nativeName
143
+ }));
144
+ function PreferencesControls() {
145
+ const { locale, setLocale } = useLocaleSwitcher();
146
+ const { theme, setTheme } = client.usePlatformPreferences();
147
+ const toggleTheme = () => setTheme(theme === "dark" ? "light" : "dark");
148
+ const t = chunkYXN2K77G_js.useTranslations("platform.preferences");
149
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "preferences-controls", children: [
150
+ /* @__PURE__ */ jsxRuntime.jsx(
151
+ chunkGV6WJCEB_js.Select,
152
+ {
153
+ value: locale,
154
+ options: LOCALE_OPTIONS,
155
+ onChange: (event) => setLocale(event.target.value)
156
+ }
157
+ ),
158
+ /* @__PURE__ */ jsxRuntime.jsx(
159
+ chunkGV6WJCEB_js.IconButton,
160
+ {
161
+ label: t("theme"),
162
+ icon: theme === "dark" ? /* @__PURE__ */ jsxRuntime.jsx(outline.SunIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(outline.MoonIcon, {}),
163
+ onClick: toggleTheme,
164
+ variant: "outline"
165
+ }
166
+ )
167
+ ] });
73
168
  }
74
169
 
75
170
  // src/platform/windsock-mappers.ts
@@ -105,7 +200,374 @@ var ORG_ROLE_MAP = {
105
200
  function mapRoleToOrgRole(role) {
106
201
  return ORG_ROLE_MAP[role] ?? "member";
107
202
  }
203
+ function UsersSettingsSection({ normalizeRole }) {
204
+ const t = chunkYXN2K77G_js.useTranslations("platform.users");
205
+ const { currentOrganizationId } = chunkJJWFMKZY_js.usePlatformState();
206
+ const { error: notifyError, success: notifySuccess } = chunkGV6WJCEB_js.useNotifications();
207
+ const [users, setUsers] = react.useState([]);
208
+ const [loading, setLoading] = react.useState(true);
209
+ const reload = async () => {
210
+ try {
211
+ const result = await chunk6PBTB5ZX_js.listUsers({ organizationId: currentOrganizationId });
212
+ setUsers(result.items.map((row) => mapAdminUser(row, normalizeRole)));
213
+ } catch (error) {
214
+ notifyError(error.message);
215
+ } finally {
216
+ setLoading(false);
217
+ }
218
+ };
219
+ react.useEffect(() => {
220
+ void reload();
221
+ }, [currentOrganizationId]);
222
+ return /* @__PURE__ */ jsxRuntime.jsx(
223
+ chunkCXIQWPBH_js.UsersPageView,
224
+ {
225
+ labels: {
226
+ title: t("title"),
227
+ subtitle: t("subtitle"),
228
+ create: t("create"),
229
+ list: t("list"),
230
+ add: t("add"),
231
+ statusActive: t("statusActive"),
232
+ statusInactive: t("statusInactive"),
233
+ name: t("name"),
234
+ email: t("email"),
235
+ role: t("role"),
236
+ status: t("status"),
237
+ save: t("save"),
238
+ userNamePlaceholder: t("userNamePlaceholder"),
239
+ userEmailPlaceholder: t("userEmailPlaceholder")
240
+ },
241
+ users: loading ? [] : users,
242
+ onCreateUser: async ({ name, email, role }) => {
243
+ try {
244
+ await chunk6PBTB5ZX_js.createUser({ name, email, role, organizationId: currentOrganizationId });
245
+ notifySuccess(t("add"));
246
+ await reload();
247
+ } catch (error) {
248
+ notifyError(error.message);
249
+ }
250
+ },
251
+ onUpdateRole: () => {
252
+ notifyError(t("reassignInRolesTab"));
253
+ }
254
+ }
255
+ );
256
+ }
257
+ function RolesSettingsSection({ roleDefinitions, roleOptions, normalizeRole }) {
258
+ const t = chunkYXN2K77G_js.useTranslations("platform.roles");
259
+ const { currentOrganizationId } = chunkJJWFMKZY_js.usePlatformState();
260
+ const { error: notifyError, success: notifySuccess } = chunkGV6WJCEB_js.useNotifications();
261
+ const [users, setUsers] = react.useState([]);
262
+ react.useEffect(() => {
263
+ chunk6PBTB5ZX_js.listUsers({ organizationId: currentOrganizationId }).then((result) => setUsers(result.items.map((row) => mapAdminUser(row, normalizeRole)))).catch((error) => notifyError(error.message));
264
+ }, [currentOrganizationId, notifyError, normalizeRole]);
265
+ return /* @__PURE__ */ jsxRuntime.jsx(
266
+ chunkCXIQWPBH_js.RolesPageView,
267
+ {
268
+ roleDefinitions,
269
+ roleOptions,
270
+ labels: {
271
+ title: t("title"),
272
+ subtitle: t("subtitle"),
273
+ definitions: t("definitions"),
274
+ assign: t("assign"),
275
+ current: t("current"),
276
+ permissionsEnabled: t("permissionsEnabled"),
277
+ apply: t("apply"),
278
+ role: t("role"),
279
+ description: t("description"),
280
+ user: t("user"),
281
+ email: t("email"),
282
+ userEmail: t("userEmail")
283
+ },
284
+ users,
285
+ onAssignRole: async ({ email, role }) => {
286
+ const target = users.find((user) => user.email.toLowerCase() === email.toLowerCase());
287
+ if (!target) {
288
+ notifyError(t("userNotFound"));
289
+ return;
290
+ }
291
+ try {
292
+ await chunk6PBTB5ZX_js.addOrganizationMember(currentOrganizationId, target.id, mapRoleToOrgRole(role));
293
+ notifySuccess(t("apply"));
294
+ } catch (error) {
295
+ notifyError(error.message);
296
+ }
297
+ }
298
+ }
299
+ );
300
+ }
301
+ function AiWorkflowGenerateModal({ open, onClose, onGenerated }) {
302
+ const { error: notifyError, success: notifySuccess } = chunkGV6WJCEB_js.useNotifications();
303
+ const t = chunkYXN2K77G_js.useTranslations("agents.workflow");
304
+ const [connections, setConnections] = react.useState([]);
305
+ const [connectionId, setConnectionId] = react.useState("");
306
+ const [prompt, setPrompt] = react.useState("");
307
+ const [busy, setBusy] = react.useState(false);
308
+ react.useEffect(() => {
309
+ if (!open) return;
310
+ chunkYXPHJ2BQ_js.listModelProviderConnections().then((items) => {
311
+ setConnections(items);
312
+ const firstEnabled = items.find((item) => item.enabled) ?? items[0];
313
+ setConnectionId(firstEnabled?.id ?? "");
314
+ }).catch((error) => notifyError(error.message));
315
+ }, [open, notifyError]);
316
+ async function handleSubmit() {
317
+ if (!connectionId) {
318
+ notifyError(t("aiErrorMissingConnection"));
319
+ return;
320
+ }
321
+ if (prompt.trim().length === 0) {
322
+ notifyError(t("aiErrorMissingPrompt"));
323
+ return;
324
+ }
325
+ setBusy(true);
326
+ try {
327
+ const generation = await chunkYXPHJ2BQ_js.aiGenerateWorkflow({ prompt: prompt.trim(), connectionId });
328
+ const workflow = await chunkYXPHJ2BQ_js.createWorkflow({ name: deriveWorkflowName(prompt) });
329
+ const saved = await chunkYXPHJ2BQ_js.saveWorkflowDraft(workflow.id, generation.graph, { name: workflow.name });
330
+ if (!generation.ok) {
331
+ notifyError(
332
+ t("aiWarnValidation"),
333
+ [...generation.structuralIssues, ...generation.nodeIssues.map((issue) => `${issue.nodeId}: ${issue.message}`)].join("\n")
334
+ );
335
+ } else {
336
+ notifySuccess(t("aiSuccessGenerated"));
337
+ }
338
+ onGenerated(saved);
339
+ onClose();
340
+ setPrompt("");
341
+ } catch (error) {
342
+ notifyError(error.message);
343
+ } finally {
344
+ setBusy(false);
345
+ }
346
+ }
347
+ return /* @__PURE__ */ jsxRuntime.jsx(
348
+ chunkGV6WJCEB_js.GlassModal,
349
+ {
350
+ open,
351
+ onClose,
352
+ title: t("aiTitle"),
353
+ subtitle: t("aiSubtitle"),
354
+ onSubmit: handleSubmit,
355
+ showFormFooter: true,
356
+ submitLabel: busy ? t("aiGenerateBusy") : t("aiGenerate"),
357
+ cancelLabel: t("aiCancel"),
358
+ submitDisabled: busy,
359
+ isLoading: busy,
360
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
361
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block text-sm font-medium text-slate-700 dark:text-slate-200", children: [
362
+ t("aiConnection"),
363
+ /* @__PURE__ */ jsxRuntime.jsxs(
364
+ "select",
365
+ {
366
+ className: "mt-1 w-full rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900 dark:border-white/10 dark:bg-white/5 dark:text-slate-100",
367
+ value: connectionId,
368
+ onChange: (event) => setConnectionId(event.target.value),
369
+ disabled: busy,
370
+ children: [
371
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: t("aiConnectionPlaceholder") }),
372
+ connections.map((connection) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: connection.id, children: [
373
+ connection.name,
374
+ " ",
375
+ connection.enabled ? "" : t("aiDisabledSuffix")
376
+ ] }, connection.id))
377
+ ]
378
+ }
379
+ )
380
+ ] }),
381
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block text-sm font-medium text-slate-700 dark:text-slate-200", children: [
382
+ t("aiPromptLabel"),
383
+ /* @__PURE__ */ jsxRuntime.jsx(
384
+ chunkGV6WJCEB_js.Textarea,
385
+ {
386
+ rows: 6,
387
+ className: "mt-1 w-full",
388
+ placeholder: t("aiPromptPlaceholder"),
389
+ value: prompt,
390
+ onChange: (event) => setPrompt(event.target.value),
391
+ disabled: busy
392
+ }
393
+ )
394
+ ] }),
395
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-slate-500 dark:text-slate-400", children: t("aiFooterNote") })
396
+ ] })
397
+ }
398
+ );
399
+ }
400
+ function deriveWorkflowName(prompt) {
401
+ const trimmed = prompt.trim().replace(/\s+/g, " ");
402
+ if (trimmed.length <= 60) return trimmed;
403
+ return `${trimmed.slice(0, 57)}\u2026`;
404
+ }
405
+ function WorkflowTemplateModal({ open, onClose, onCreated }) {
406
+ const tWorkflow = chunkYXN2K77G_js.useTranslations("agents.workflow");
407
+ const tCommon = chunkYXN2K77G_js.useTranslations("common");
408
+ const { error: notifyError, success: notifySuccess } = chunkGV6WJCEB_js.useNotifications();
409
+ const [templates, setTemplates] = react.useState([]);
410
+ const [connections, setConnections] = react.useState([]);
411
+ const [templateId, setTemplateId] = react.useState("");
412
+ const [connectionId, setConnectionId] = react.useState("");
413
+ const [name, setName] = react.useState("");
414
+ const [isLoading, setIsLoading] = react.useState(false);
415
+ const [isSubmitting, setIsSubmitting] = react.useState(false);
416
+ react.useEffect(() => {
417
+ if (!open) return;
418
+ let cancelled = false;
419
+ setIsLoading(true);
420
+ setTemplateId("");
421
+ setConnectionId("");
422
+ setName("");
423
+ (async () => {
424
+ try {
425
+ const [tpls, conns] = await Promise.all([
426
+ chunkYXPHJ2BQ_js.listWorkflowTemplates(),
427
+ chunkYXPHJ2BQ_js.listModelProviderConnections()
428
+ ]);
429
+ if (cancelled) return;
430
+ setTemplates(tpls);
431
+ setConnections(conns);
432
+ if (tpls.length > 0) {
433
+ const firstTemplate = tpls[0];
434
+ if (firstTemplate) setTemplateId(firstTemplate.id);
435
+ }
436
+ if (conns.length > 0) {
437
+ const firstConnection = conns[0];
438
+ if (firstConnection) setConnectionId(firstConnection.id);
439
+ }
440
+ } catch (error) {
441
+ if (!cancelled) notifyError(error.message);
442
+ } finally {
443
+ if (!cancelled) setIsLoading(false);
444
+ }
445
+ })();
446
+ return () => {
447
+ cancelled = true;
448
+ };
449
+ }, [open, notifyError]);
450
+ const selectedTemplate = react.useMemo(
451
+ () => templates.find((t) => t.id === templateId),
452
+ [templates, templateId]
453
+ );
454
+ const canSubmit = !isLoading && !isSubmitting && templateId.length > 0 && connectionId.length > 0;
455
+ const handleSubmit = react.useCallback(async () => {
456
+ if (!canSubmit) return;
457
+ setIsSubmitting(true);
458
+ try {
459
+ const created = await chunkYXPHJ2BQ_js.createWorkflowFromTemplate(templateId, {
460
+ connectionId,
461
+ name: name.trim().length > 0 ? name.trim() : void 0
462
+ });
463
+ notifySuccess(tWorkflow("templateCreatedSuccess"));
464
+ onCreated(created);
465
+ onClose();
466
+ } catch (error) {
467
+ notifyError(error.message);
468
+ } finally {
469
+ setIsSubmitting(false);
470
+ }
471
+ }, [canSubmit, templateId, connectionId, name, onCreated, onClose, notifySuccess, notifyError, tWorkflow]);
472
+ return /* @__PURE__ */ jsxRuntime.jsx(
473
+ chunkGV6WJCEB_js.GlassModal,
474
+ {
475
+ open,
476
+ onClose,
477
+ title: tWorkflow("createFromTemplate"),
478
+ subtitle: selectedTemplate?.description ?? tWorkflow("createFromTemplateSubtitle"),
479
+ gradient: "from-indigo-500 to-purple-600",
480
+ showFormFooter: true,
481
+ onSubmit: (event) => {
482
+ event.preventDefault();
483
+ void handleSubmit();
484
+ },
485
+ isLoading: isSubmitting,
486
+ submitDisabled: !canSubmit,
487
+ submitLabel: tCommon("create"),
488
+ cancelLabel: tCommon("cancel"),
489
+ maxWidth: "lg",
490
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shimmer h-32 w-full rounded-xl" }) : templates.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: tWorkflow("noTemplatesAvailable") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
491
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block", children: [
492
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300", children: tWorkflow("template") }),
493
+ /* @__PURE__ */ jsxRuntime.jsx(
494
+ "select",
495
+ {
496
+ className: "w-full rounded-lg border border-white/20 bg-white/70 px-3 py-2 text-sm text-gray-900 shadow-sm backdrop-blur dark:bg-gray-800/70 dark:text-gray-100",
497
+ value: templateId,
498
+ onChange: (event) => setTemplateId(event.target.value),
499
+ children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: template.id, children: template.name }, template.id))
500
+ }
501
+ )
502
+ ] }),
503
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block", children: [
504
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300", children: tWorkflow("llmConnection") }),
505
+ connections.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200", children: tWorkflow("noConnectionsHint") }) : /* @__PURE__ */ jsxRuntime.jsx(
506
+ "select",
507
+ {
508
+ className: "w-full rounded-lg border border-white/20 bg-white/70 px-3 py-2 text-sm text-gray-900 shadow-sm backdrop-blur dark:bg-gray-800/70 dark:text-gray-100",
509
+ value: connectionId,
510
+ onChange: (event) => setConnectionId(event.target.value),
511
+ children: connections.map((connection) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: connection.id, children: [
512
+ connection.name,
513
+ connection.providerSlug ? ` \xB7 ${connection.providerSlug}` : ""
514
+ ] }, connection.id))
515
+ }
516
+ )
517
+ ] }),
518
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block", children: [
519
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300", children: [
520
+ tWorkflow("workflowName"),
521
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 text-[10px] text-gray-400", children: [
522
+ "(",
523
+ tCommon("optional"),
524
+ ")"
525
+ ] })
526
+ ] }),
527
+ /* @__PURE__ */ jsxRuntime.jsx(
528
+ "input",
529
+ {
530
+ type: "text",
531
+ value: name,
532
+ placeholder: selectedTemplate?.name ?? "",
533
+ onChange: (event) => setName(event.target.value),
534
+ className: "w-full rounded-lg border border-white/20 bg-white/70 px-3 py-2 text-sm text-gray-900 shadow-sm backdrop-blur dark:bg-gray-800/70 dark:text-gray-100"
535
+ }
536
+ )
537
+ ] }),
538
+ selectedTemplate && selectedTemplate.tags.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1.5", children: selectedTemplate.tags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
539
+ "span",
540
+ {
541
+ className: "rounded-full bg-indigo-500/10 px-2 py-0.5 text-[10px] font-medium text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-300",
542
+ children: tag
543
+ },
544
+ tag
545
+ )) }) : null
546
+ ] }) })
547
+ }
548
+ );
549
+ }
108
550
 
551
+ Object.defineProperty(exports, "WorkflowWorkspace", {
552
+ enumerable: true,
553
+ get: function () { return chunkCXIQWPBH_js.WorkflowWorkspace; }
554
+ });
555
+ Object.defineProperty(exports, "AgentsWorkspace", {
556
+ enumerable: true,
557
+ get: function () { return chunkSGJ24J2Q_js.AgentsWorkspace; }
558
+ });
559
+ Object.defineProperty(exports, "PlatformAppShell", {
560
+ enumerable: true,
561
+ get: function () { return chunkJJWFMKZY_js.PlatformAppShell; }
562
+ });
563
+ Object.defineProperty(exports, "PlatformStateProvider", {
564
+ enumerable: true,
565
+ get: function () { return chunkJJWFMKZY_js.PlatformStateProvider; }
566
+ });
567
+ Object.defineProperty(exports, "usePlatformState", {
568
+ enumerable: true,
569
+ get: function () { return chunkJJWFMKZY_js.usePlatformState; }
570
+ });
109
571
  Object.defineProperty(exports, "createPlatformRbac", {
110
572
  enumerable: true,
111
573
  get: function () { return chunkHZ4LOVHM_js.createPlatformRbac; }
@@ -226,12 +688,21 @@ Object.defineProperty(exports, "verifyOrganizationDomain", {
226
688
  enumerable: true,
227
689
  get: function () { return chunk6PBTB5ZX_js.verifyOrganizationDomain; }
228
690
  });
691
+ Object.defineProperty(exports, "WorkflowCanvasShell", {
692
+ enumerable: true,
693
+ get: function () { return chunkWGELLCOZ_js.WorkflowCanvasShell; }
694
+ });
695
+ exports.AiWorkflowGenerateModal = AiWorkflowGenerateModal;
229
696
  exports.ORG_ROLE_MAP = ORG_ROLE_MAP;
230
- exports.PlatformStateProvider = PlatformStateProvider;
697
+ exports.PlatformDockContainer = PlatformDockContainer;
698
+ exports.PreferencesControls = PreferencesControls;
699
+ exports.RolesSettingsSection = RolesSettingsSection;
231
700
  exports.SessionSwitcher = SessionSwitcher;
701
+ exports.UsersSettingsSection = UsersSettingsSection;
702
+ exports.WorkflowTemplateModal = WorkflowTemplateModal;
232
703
  exports.mapAdminUser = mapAdminUser;
233
704
  exports.mapAuthOrg = mapAuthOrg;
234
705
  exports.mapRoleToOrgRole = mapRoleToOrgRole;
235
- exports.usePlatformState = usePlatformState;
706
+ exports.useLocaleSwitcher = useLocaleSwitcher;
236
707
  //# sourceMappingURL=index.js.map
237
708
  //# sourceMappingURL=index.js.map