@wso2/am-core-ui 0.0.12 → 0.0.14

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 (32) hide show
  1. package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/LeftNavigation.d.ts +1 -3
  2. package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/path-map.d.ts +0 -1
  3. package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/userMenuItems.d.ts +7 -2
  4. package/dist/{pages → core-ui/src/pages}/index.d.ts +12 -4
  5. package/dist/{types → core-ui/src/types}/mountPoints.d.ts +4 -1
  6. package/dist/index-BQlJRlEI.js +236 -0
  7. package/dist/index-BV8vICwZ.js +263 -0
  8. package/dist/index-BXsGzHi8.js +3037 -0
  9. package/dist/{index-C5miD1SI.js → index-BpKdCFaM.js} +21986 -20114
  10. package/dist/{index-D2KjwhE9.js → index-WAarK3dI.js} +48316 -36956
  11. package/dist/index.js +429 -293
  12. package/package.json +1 -1
  13. package/dist/index-Cdg2qecR.js +0 -189
  14. package/dist/index-MipkxZ31.js +0 -2227
  15. /package/dist/{CoreUI.d.ts → core-ui/src/CoreUI.d.ts} +0 -0
  16. /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/OxygenLayout.d.ts +0 -0
  17. /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/TopNavigation.d.ts +0 -0
  18. /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/index.d.ts +0 -0
  19. /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/navigationItems.d.ts +0 -0
  20. /package/dist/{Layouts → core-ui/src/Layouts}/index.d.ts +0 -0
  21. /package/dist/{Providers → core-ui/src/Providers}/GlobalProviders/GlobalProviders.d.ts +0 -0
  22. /package/dist/{Providers → core-ui/src/Providers}/GlobalProviders/index.d.ts +0 -0
  23. /package/dist/{Providers → core-ui/src/Providers}/Protected/Protected.d.ts +0 -0
  24. /package/dist/{Providers → core-ui/src/Providers}/Protected/index.d.ts +0 -0
  25. /package/dist/{Providers → core-ui/src/Providers}/index.d.ts +0 -0
  26. /package/dist/{Route → core-ui/src/Route}/Route.d.ts +0 -0
  27. /package/dist/{Route → core-ui/src/Route}/index.d.ts +0 -0
  28. /package/dist/{components → core-ui/src/components}/LoadingFallback.d.ts +0 -0
  29. /package/dist/{index.d.ts → core-ui/src/index.d.ts} +0 -0
  30. /package/dist/{pages → core-ui/src/pages}/Login/Login.d.ts +0 -0
  31. /package/dist/{pages → core-ui/src/pages}/Login/index.d.ts +0 -0
  32. /package/dist/{types → core-ui/src/types}/index.d.ts +0 -0
@@ -2,7 +2,6 @@ import { ReactNode } from 'react';
2
2
  export interface NavigationItem {
3
3
  label: string;
4
4
  icon?: ReactNode;
5
- onClick?: () => void;
6
5
  href?: string;
7
6
  isActive?: boolean;
8
7
  type: 'item';
@@ -18,7 +17,6 @@ interface LeftNavigationProps {
18
17
  activeItem: string;
19
18
  mainItems: NavigationItem[];
20
19
  groupedItems: NavigationSection[];
21
- onNavigationClick: (itemKey: string) => void;
22
20
  }
23
- export declare function LeftNavigation({ collapsed, activeItem, mainItems, groupedItems, onNavigationClick, }: LeftNavigationProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function LeftNavigation({ collapsed, activeItem, mainItems, groupedItems, }: LeftNavigationProps): import("react/jsx-runtime").JSX.Element;
24
22
  export {};
@@ -1,6 +1,5 @@
1
1
  export declare function usePagePath(path: string): {
2
2
  page: string | null;
3
- subPage: string | null;
4
3
  };
5
4
  export declare function useActiveOrgPage(): string | null;
6
5
  export declare function useActiveProjectPage(): string | null;
@@ -17,9 +17,14 @@
17
17
  */
18
18
  export declare const createUserMenuItems: ({ logout }: {
19
19
  logout: () => Promise<void>;
20
- }) => {
20
+ }) => ({
21
+ label: string;
22
+ href: string;
23
+ icon: import("react/jsx-runtime").JSX.Element;
24
+ onClick?: undefined;
25
+ } | {
21
26
  label: string;
22
27
  onClick: () => Promise<void>;
23
28
  icon: import("react/jsx-runtime").JSX.Element;
24
29
  href: string;
25
- }[];
30
+ })[];
@@ -8,25 +8,33 @@ export declare const LazySecurityComponent: FC;
8
8
  export declare const LazyConfigureComponent: FC;
9
9
  export declare const LazyAddLLMProvidersComponent: FC;
10
10
  export declare const LazyViewLLMProviderComponent: FC;
11
+ export declare const LazyAddMCPServerComponent: FC;
12
+ export declare const LazyViewMCPServerComponent: FC;
11
13
  export declare const LazyDeploymentComponent: FC;
12
14
  export declare const LazyTestComponent: FC;
13
15
  export declare const LazyTracesComponent: FC;
14
16
  export declare const LazyLogsComponent: FC;
15
17
  export declare const LazyMetricsComponent: FC;
16
- export declare const LazyEvalEvaluatorsComponent: FC;
17
- export declare const LazyCreateEvaluatorComponent: FC;
18
- export declare const LazyViewEvaluatorComponent: FC;
19
- export declare const LazyEditEvaluatorComponent: FC;
18
+ export declare const LazyEvalEvaluatorsOrg: FC;
19
+ export declare const LazyCreateEvaluatorOrg: FC;
20
+ export declare const LazyViewEvaluatorOrg: FC;
21
+ export declare const LazyEditEvaluatorOrg: FC;
20
22
  export declare const LazyEvalMonitorsComponent: FC;
21
23
  export declare const LazyCreateMonitorComponent: FC;
22
24
  export declare const LazyEditMonitorComponent: FC;
23
25
  export declare const LazyViewMonitorComponent: FC;
26
+ export declare const LazyCompareMonitorComponent: FC;
24
27
  export declare const LazyLLMProvidersOrg: FC;
25
28
  export declare const LazyLLMProvidersComponent: FC;
26
29
  export declare const LazyAddLLMProvidersOrg: FC;
30
+ export declare const LazyMCPProxiesOrg: FC;
27
31
  export declare const LazyGatewaysOrg: FC;
32
+ export declare const LazyIdentitiesOrg: FC;
33
+ export declare const LazyDeploymentPipelinesOrg: FC;
34
+ export declare const LazyEnvironmentsOrg: FC;
28
35
  export declare const LazyCatalogOrg: FC;
29
36
  export declare const LazyPublishComponent: FC;
30
37
  export declare const LazyPublishOrg: FC;
31
38
  export declare const LazyAddNewAgent: import('react').LazyExoticComponent<ComponentType>;
32
39
  export declare const LazyAddNewProject: import('react').LazyExoticComponent<ComponentType>;
40
+ export declare const LazyProfilePage: import('react').LazyExoticComponent<ComponentType>;
@@ -25,5 +25,8 @@ export declare enum MountPoints {
25
25
  BottomLeftPanel = "bottom-left-panel",
26
26
  BottomRightPanel = "bottom-right-panel",
27
27
  LeftNavItem = "left-nav-item",
28
- PrivateRepoSupport = "private-repo-support"
28
+ PrivateRepoSupport = "private-repo-support",
29
+ IdentityProviderMode = "identity-provider-mode",
30
+ EnvironmentCreateDrawer = "environment-create-drawer",
31
+ EnvironmentDeleteDrawer = "environment-delete-drawer"
29
32
  }
@@ -0,0 +1,236 @@
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { c as we } from "react/compiler-runtime";
3
+ import { useState as _, useEffect as ne } from "react";
4
+ import { useParams as ge } from "react-router-dom";
5
+ import { useTheme as Pe, Alert as ie, Stack as S, Form as d, Box as he, Button as oe, Typography as pe, Tab as le, Tabs as ye } from "@wso2/oxygen-ui";
6
+ import { Q as be, R as ve, S as _e, T as C, P as Ce } from "./index-WAarK3dI.js";
7
+ import "@tanstack/react-query";
8
+ const je = () => {
9
+ const e = we(72), me = Pe(), {
10
+ userInfo: r
11
+ } = be(), {
12
+ orgId: m
13
+ } = ge(), [c, ce] = _("profile"), J = r?.username || "", K = r?.givenName || "", V = r?.familyName || "", W = r?.email || "";
14
+ let x;
15
+ e[0] !== J || e[1] !== K || e[2] !== V || e[3] !== W ? (x = {
16
+ username: J,
17
+ given_name: K,
18
+ family_name: V,
19
+ email: W
20
+ }, e[0] = J, e[1] = K, e[2] = V, e[3] = W, e[4] = x) : x = e[4];
21
+ const [a, w] = _(x);
22
+ let T;
23
+ e[5] === Symbol.for("react.memo_cache_sentinel") ? (T = {}, e[5] = T) : T = e[5];
24
+ const [i, N] = _(T), {
25
+ mutateAsync: g,
26
+ isPending: u,
27
+ error: I
28
+ } = ve();
29
+ let E;
30
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (E = {
31
+ currentPassword: "",
32
+ newPassword: "",
33
+ confirmPassword: ""
34
+ }, e[6] = E) : E = e[6];
35
+ const [n, X] = _(E);
36
+ let k;
37
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? (k = {}, e[7] = k) : k = e[7];
38
+ const [o, U] = _(k), [j, q] = _(""), de = Se, Y = m || "default", Z = r?.sub || "";
39
+ let B;
40
+ e[8] !== Y || e[9] !== Z ? (B = {
41
+ orgName: Y,
42
+ userId: Z
43
+ }, e[8] = Y, e[9] = Z, e[10] = B) : B = e[10];
44
+ const {
45
+ data: f
46
+ } = _e(B);
47
+ let A, D;
48
+ e[11] !== f ? (A = () => {
49
+ f?.attributes && w({
50
+ username: f.attributes.username || "",
51
+ given_name: f.attributes.given_name || "",
52
+ family_name: f.attributes.family_name || "",
53
+ email: f.attributes.email || ""
54
+ });
55
+ }, D = [f], e[11] = f, e[12] = A, e[13] = D) : (A = e[12], D = e[13]), ne(A, D);
56
+ let H;
57
+ e[14] !== r?.email || e[15] !== r?.familyName || e[16] !== r?.givenName || e[17] !== r?.username ? (H = () => {
58
+ w({
59
+ username: r?.username || "",
60
+ given_name: r?.givenName || "",
61
+ family_name: r?.familyName || "",
62
+ email: r?.email || ""
63
+ });
64
+ }, e[14] = r?.email, e[15] = r?.familyName, e[16] = r?.givenName, e[17] = r?.username, e[18] = H) : H = e[18];
65
+ let M;
66
+ e[19] !== r ? (M = [r], e[19] = r, e[20] = M) : M = e[20], ne(H, M);
67
+ let $;
68
+ e[21] === Symbol.for("react.memo_cache_sentinel") ? ($ = (s, fe) => {
69
+ ce(fe), q("");
70
+ }, e[21] = $) : $ = e[21];
71
+ const ue = $;
72
+ let F;
73
+ e[22] !== a.email || e[23] !== a.username ? (F = () => {
74
+ const s = {};
75
+ return a.username.trim() || (s.username = "Username is required"), a.email.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a.email) || (s.email = "Invalid email format") : s.email = "Email is required", N(s), Object.keys(s).length === 0;
76
+ }, e[22] = a.email, e[23] = a.username, e[24] = F) : F = e[24];
77
+ const ee = F;
78
+ let L;
79
+ e[25] !== n.confirmPassword || e[26] !== n.newPassword ? (L = () => {
80
+ const s = {};
81
+ return n.newPassword.trim() ? n.newPassword.length < 8 && (s.newPassword = "Password must be at least 8 characters") : s.newPassword = "New password is required", n.newPassword !== n.confirmPassword && (s.confirmPassword = "Passwords do not match"), U(s), Object.keys(s).length === 0;
82
+ }, e[25] = n.confirmPassword, e[26] = n.newPassword, e[27] = L) : L = e[27];
83
+ const ae = L;
84
+ let O;
85
+ e[28] !== m || e[29] !== a.email || e[30] !== a.family_name || e[31] !== a.given_name || e[32] !== a.username || e[33] !== g || e[34] !== r || e[35] !== ee ? (O = async () => {
86
+ if (!(!ee() || !m || !r?.sub))
87
+ try {
88
+ await g({
89
+ params: {
90
+ orgName: m,
91
+ userId: r.sub
92
+ },
93
+ body: {
94
+ attributes: {
95
+ username: a.username.trim(),
96
+ given_name: a.given_name.trim(),
97
+ family_name: a.family_name.trim(),
98
+ email: a.email.trim()
99
+ }
100
+ }
101
+ }), q("Profile updated successfully"), N({});
102
+ } catch {
103
+ }
104
+ }, e[28] = m, e[29] = a.email, e[30] = a.family_name, e[31] = a.given_name, e[32] = a.username, e[33] = g, e[34] = r, e[35] = ee, e[36] = O) : O = e[36];
105
+ const re = O;
106
+ let G;
107
+ e[37] !== n.newPassword || e[38] !== m || e[39] !== g || e[40] !== r || e[41] !== ae ? (G = async () => {
108
+ if (!(!ae() || !m || !r?.sub))
109
+ try {
110
+ await g({
111
+ params: {
112
+ orgName: m,
113
+ userId: r.sub
114
+ },
115
+ body: {
116
+ attributes: {
117
+ password: n.newPassword
118
+ }
119
+ }
120
+ }), q("Password updated successfully"), X({
121
+ currentPassword: "",
122
+ newPassword: "",
123
+ confirmPassword: ""
124
+ }), U({});
125
+ } catch {
126
+ }
127
+ }, e[37] = n.newPassword, e[38] = m, e[39] = g, e[40] = r, e[41] = ae, e[42] = G) : G = e[42];
128
+ const se = G;
129
+ let P;
130
+ e[43] !== j ? (P = j && /* @__PURE__ */ t(ie, { severity: "success", onClose: () => q(""), children: j }), e[43] = j, e[44] = P) : P = e[44];
131
+ let h;
132
+ e[45] !== I ? (h = !!I && /* @__PURE__ */ t(ie, { severity: "error", children: de(I) }), e[45] = I, e[46] = h) : h = e[46];
133
+ const te = `1px solid ${me.palette.divider}`;
134
+ let p;
135
+ e[47] !== te ? (p = {
136
+ borderBottom: te
137
+ }, e[47] = te, e[48] = p) : p = e[48];
138
+ let Q, R;
139
+ e[49] === Symbol.for("react.memo_cache_sentinel") ? (Q = /* @__PURE__ */ t(le, { label: "Profile Information", value: "profile" }), R = /* @__PURE__ */ t(le, { label: "Change Password", value: "password" }), e[49] = Q, e[50] = R) : (Q = e[49], R = e[50]);
140
+ let y;
141
+ e[51] !== c || e[52] !== p ? (y = /* @__PURE__ */ l(ye, { value: c, onChange: ue, sx: p, children: [
142
+ Q,
143
+ R
144
+ ] }), e[51] = c, e[52] = p, e[53] = y) : y = e[53];
145
+ let b;
146
+ e[54] !== c || e[55] !== re || e[56] !== u || e[57] !== a || e[58] !== i ? (b = c === "profile" && /* @__PURE__ */ l(S, { spacing: 3, children: [
147
+ /* @__PURE__ */ l(d.Section, { children: [
148
+ /* @__PURE__ */ t(d.Header, { children: "Account Information" }),
149
+ /* @__PURE__ */ l(d.Stack, { spacing: 2, children: [
150
+ /* @__PURE__ */ t(C, { label: "Username", required: !0, value: a.username, onChange: (s) => {
151
+ w({
152
+ ...a,
153
+ username: s.target.value
154
+ }), i.username && N({
155
+ ...i,
156
+ username: ""
157
+ });
158
+ }, error: !!i.username, helperText: i.username }),
159
+ /* @__PURE__ */ t(C, { label: "Email", type: "email", required: !0, value: a.email, onChange: (s) => {
160
+ w({
161
+ ...a,
162
+ email: s.target.value
163
+ }), i.email && N({
164
+ ...i,
165
+ email: ""
166
+ });
167
+ }, error: !!i.email, helperText: i.email })
168
+ ] })
169
+ ] }),
170
+ /* @__PURE__ */ l(d.Section, { children: [
171
+ /* @__PURE__ */ t(d.Header, { children: "Personal Information" }),
172
+ /* @__PURE__ */ t(d.Stack, { spacing: 2, children: /* @__PURE__ */ l(he, { sx: {
173
+ display: "grid",
174
+ gap: 2,
175
+ gridTemplateColumns: {
176
+ xs: "1fr",
177
+ sm: "1fr 1fr"
178
+ }
179
+ }, children: [
180
+ /* @__PURE__ */ t(C, { label: "First Name", value: a.given_name, onChange: (s) => w({
181
+ ...a,
182
+ given_name: s.target.value
183
+ }) }),
184
+ /* @__PURE__ */ t(C, { label: "Last Name", value: a.family_name, onChange: (s) => w({
185
+ ...a,
186
+ family_name: s.target.value
187
+ }) })
188
+ ] }) })
189
+ ] }),
190
+ /* @__PURE__ */ t(S, { direction: "row", spacing: 1, justifyContent: "flex-end", children: /* @__PURE__ */ t(oe, { variant: "contained", onClick: re, disabled: u, children: u ? "Saving..." : "Save Changes" }) })
191
+ ] }), e[54] = c, e[55] = re, e[56] = u, e[57] = a, e[58] = i, e[59] = b) : b = e[59];
192
+ let v;
193
+ e[60] !== c || e[61] !== n || e[62] !== o || e[63] !== se || e[64] !== u ? (v = c === "password" && /* @__PURE__ */ l(S, { spacing: 3, children: [
194
+ /* @__PURE__ */ l(d.Section, { children: [
195
+ /* @__PURE__ */ t(d.Header, { children: "Update Password" }),
196
+ /* @__PURE__ */ t(pe, { variant: "body2", color: "text.secondary", sx: {
197
+ mb: 2
198
+ }, children: "Enter a new password to update your account security." }),
199
+ /* @__PURE__ */ l(d.Stack, { spacing: 2, children: [
200
+ /* @__PURE__ */ t(C, { label: "New Password", type: "password", showPasswordToggle: !0, required: !0, value: n.newPassword, onChange: (s) => {
201
+ X({
202
+ ...n,
203
+ newPassword: s.target.value
204
+ }), o.newPassword && U({
205
+ ...o,
206
+ newPassword: ""
207
+ });
208
+ }, error: !!o.newPassword, helperText: o.newPassword || "Minimum 8 characters" }),
209
+ /* @__PURE__ */ t(C, { label: "Confirm Password", type: "password", showPasswordToggle: !0, required: !0, value: n.confirmPassword, onChange: (s) => {
210
+ X({
211
+ ...n,
212
+ confirmPassword: s.target.value
213
+ }), o.confirmPassword && U({
214
+ ...o,
215
+ confirmPassword: ""
216
+ });
217
+ }, error: !!o.confirmPassword, helperText: o.confirmPassword })
218
+ ] })
219
+ ] }),
220
+ /* @__PURE__ */ t(S, { direction: "row", spacing: 1, justifyContent: "flex-end", children: /* @__PURE__ */ t(oe, { variant: "contained", onClick: se, disabled: u || !n.newPassword, children: u ? "Updating..." : "Update Password" }) })
221
+ ] }), e[60] = c, e[61] = n, e[62] = o, e[63] = se, e[64] = u, e[65] = v) : v = e[65];
222
+ let z;
223
+ return e[66] !== P || e[67] !== h || e[68] !== y || e[69] !== b || e[70] !== v ? (z = /* @__PURE__ */ t(Ce, { title: "Profile Settings", disableIcon: !0, children: /* @__PURE__ */ l(S, { spacing: 3, children: [
224
+ P,
225
+ h,
226
+ y,
227
+ b,
228
+ v
229
+ ] }) }), e[66] = P, e[67] = h, e[68] = y, e[69] = b, e[70] = v, e[71] = z) : z = e[71], z;
230
+ };
231
+ function Se(e) {
232
+ return e && typeof e == "object" && "message" in e ? e.message : "An error occurred";
233
+ }
234
+ export {
235
+ je as ProfilePage
236
+ };
@@ -0,0 +1,263 @@
1
+ import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
+ import { useCallback as V, useMemo as A, useEffect as z, useState as B } from "react";
3
+ import { Alert as G, Box as L, Collapse as D, Button as T, Form as b, TextField as F, Stack as M, CircularProgress as O, Typography as C, Select as H, MenuItem as k } from "@wso2/oxygen-ui";
4
+ import { useParams as $, useNavigate as J, generatePath as R } from "react-router-dom";
5
+ import { o as K, s as w, y as Q, M as U, j as X, A as Y, f as Z, N as _, O as ee, g as I, P as te } from "./index-WAarK3dI.js";
6
+ import { c as W } from "react/compiler-runtime";
7
+ import "@tanstack/react-query";
8
+ import { Link as ne, PackagePlus as ie, FolderPlus as ae } from "@wso2/oxygen-ui-icons-react";
9
+ const re = K({
10
+ displayName: w().trim().min(1, "Display name is required").min(3, "Display name must be at least 3 characters").max(100, "Display name must be at most 100 characters"),
11
+ name: w().trim().max(50, "Name must be at most 50 characters"),
12
+ description: w().trim().optional(),
13
+ deploymentPipeline: w().trim().min(1, "Deployment pipeline is required")
14
+ }), oe = (a) => {
15
+ const e = W(22), {
16
+ lastSubmittedValidationErrors: t,
17
+ isPending: d,
18
+ onCancel: c,
19
+ onSubmit: s,
20
+ mode: l,
21
+ isNameEmpty: o
22
+ } = a, p = l === void 0 ? "deploy" : l, E = o === void 0 ? !1 : o, P = p === "connect";
23
+ let y;
24
+ e[0] !== t ? (y = Object.values(t), e[0] = t, e[1] = y) : y = e[1];
25
+ const u = y, v = u.length > 0;
26
+ let g;
27
+ e[2] !== u ? (g = /* @__PURE__ */ i(G, { severity: "error", children: u.map(le) }), e[2] = u, e[3] = g) : g = e[3];
28
+ let h;
29
+ e[4] !== v || e[5] !== g ? (h = /* @__PURE__ */ i(D, { in: v, timeout: "auto", unmountOnExit: !0, children: g }), e[4] = v, e[5] = g, e[6] = h) : h = e[6];
30
+ let n;
31
+ e[7] !== c ? (n = /* @__PURE__ */ i(T, { variant: "outlined", color: "primary", size: "medium", onClick: c, children: "Cancel" }), e[7] = c, e[8] = n) : n = e[8];
32
+ let r;
33
+ e[9] !== P ? (r = P ? /* @__PURE__ */ i(ne, { size: 16 }) : /* @__PURE__ */ i(ie, { size: 16 }), e[9] = P, e[10] = r) : r = e[10];
34
+ const m = d || E, f = P ? "Register" : "Create";
35
+ let j;
36
+ e[11] !== s || e[12] !== r || e[13] !== m || e[14] !== f ? (j = /* @__PURE__ */ i(T, { variant: "contained", color: "primary", size: "medium", startIcon: r, onClick: s, disabled: m, children: f }), e[11] = s, e[12] = r, e[13] = m, e[14] = f, e[15] = j) : j = e[15];
37
+ let x;
38
+ e[16] !== j || e[17] !== n ? (x = /* @__PURE__ */ N(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
39
+ n,
40
+ j
41
+ ] }), e[16] = j, e[17] = n, e[18] = x) : x = e[18];
42
+ let S;
43
+ return e[19] !== x || e[20] !== h ? (S = /* @__PURE__ */ N(L, { display: "flex", flexDirection: "column", gap: 3, children: [
44
+ h,
45
+ x
46
+ ] }), e[19] = x, e[20] = h, e[21] = S) : S = e[21], S;
47
+ };
48
+ function le(a, e) {
49
+ return /* @__PURE__ */ i(L, { children: a }, e);
50
+ }
51
+ function q(a, e) {
52
+ return a.promotionPaths.length === 0 ? null : [...a.promotionPaths.map((d) => d.sourceEnvironmentRef), a.promotionPaths[a.promotionPaths.length - 1]?.targetEnvironmentRefs[0]?.name].filter(Boolean).map((d) => e.get(d) ?? d).join(" → ");
53
+ }
54
+ function se(a) {
55
+ const e = W(10), {
56
+ pipeline: t,
57
+ envDisplayNameMap: d
58
+ } = a;
59
+ let c;
60
+ e[0] !== d || e[1] !== t ? (c = q(t, d), e[0] = d, e[1] = t, e[2] = c) : c = e[2];
61
+ const s = c;
62
+ let l;
63
+ e[3] !== t.displayName ? (l = /* @__PURE__ */ i(C, { variant: "body2", children: t.displayName }), e[3] = t.displayName, e[4] = l) : l = e[4];
64
+ let o;
65
+ e[5] !== s ? (o = s && /* @__PURE__ */ i(C, { variant: "caption", color: "text.disabled", children: s }), e[5] = s, e[6] = o) : o = e[6];
66
+ let p;
67
+ return e[7] !== l || e[8] !== o ? (p = /* @__PURE__ */ N(M, { direction: "row", alignItems: "center", spacing: 1, children: [
68
+ l,
69
+ o
70
+ ] }), e[7] = l, e[8] = o, e[9] = p) : p = e[9], p;
71
+ }
72
+ function ce(a) {
73
+ const e = W(10), {
74
+ pipeline: t,
75
+ envDisplayNameMap: d
76
+ } = a;
77
+ let c;
78
+ e[0] !== d || e[1] !== t ? (c = q(t, d), e[0] = d, e[1] = t, e[2] = c) : c = e[2];
79
+ const s = c;
80
+ let l;
81
+ e[3] !== t.displayName ? (l = /* @__PURE__ */ i(C, { variant: "body2", children: t.displayName }), e[3] = t.displayName, e[4] = l) : l = e[4];
82
+ let o;
83
+ e[5] !== s ? (o = s && /* @__PURE__ */ i(C, { variant: "caption", color: "text.disbaled", children: s }), e[5] = s, e[6] = o) : o = e[6];
84
+ let p;
85
+ return e[7] !== l || e[8] !== o ? (p = /* @__PURE__ */ N(M, { children: [
86
+ l,
87
+ o
88
+ ] }), e[7] = l, e[8] = o, e[9] = p) : p = e[9], p;
89
+ }
90
+ const de = ({
91
+ formData: a,
92
+ setFormData: e,
93
+ errors: t,
94
+ validateField: d,
95
+ setFieldError: c,
96
+ checkDirty: s
97
+ }) => {
98
+ const {
99
+ orgId: l
100
+ } = $(), o = V((n, r) => {
101
+ const m = {
102
+ ...a,
103
+ [n]: r
104
+ };
105
+ e(m), s(m);
106
+ const f = d(n, r);
107
+ c(n, f);
108
+ }, [a, e, s, d, c]), {
109
+ mutate: p,
110
+ isPending: E
111
+ } = Q({
112
+ orgName: l
113
+ }), {
114
+ data: P,
115
+ isLoading: y
116
+ } = U({
117
+ orgName: l
118
+ }), u = P?.deploymentPipelines ?? [], {
119
+ data: v
120
+ } = X({
121
+ orgName: l
122
+ }), g = A(() => {
123
+ const n = /* @__PURE__ */ new Map();
124
+ return (v ?? []).forEach((r) => n.set(r.name, r.displayName ?? r.name)), n;
125
+ }, [v]);
126
+ z(() => {
127
+ if (!a.deploymentPipeline && u.length > 0) {
128
+ const n = u[0].name;
129
+ e((r) => {
130
+ const m = {
131
+ ...r,
132
+ deploymentPipeline: n
133
+ };
134
+ return s(m), m;
135
+ });
136
+ }
137
+ }, [u, a.deploymentPipeline, e, s]);
138
+ const h = A(
139
+ () => Y.debounce((n) => {
140
+ if (n.length < 3) {
141
+ o("name", "");
142
+ return;
143
+ }
144
+ p({
145
+ displayName: n,
146
+ resourceType: "project"
147
+ }, {
148
+ onSuccess: (r) => {
149
+ e((m) => {
150
+ const f = {
151
+ ...m,
152
+ name: r.name
153
+ };
154
+ return s(f), f;
155
+ });
156
+ },
157
+ onError: (r) => {
158
+ console.error("Failed to generate name:", r);
159
+ }
160
+ });
161
+ }, 500),
162
+ // 500ms delay
163
+ [p, e, s]
164
+ );
165
+ return z(() => () => {
166
+ h.cancel();
167
+ }, [h]), z(() => {
168
+ a.displayName && a.displayName.length >= 3 ? h(a.displayName) : (h.cancel(), e((n) => ({
169
+ ...n,
170
+ name: ""
171
+ })));
172
+ }, [a.displayName, e, h]), /* @__PURE__ */ i(b.Stack, { spacing: 3, children: /* @__PURE__ */ N(b.Section, { children: [
173
+ /* @__PURE__ */ i(b.Subheader, { children: "Project Details" }),
174
+ /* @__PURE__ */ N(b.Stack, { spacing: 2, children: [
175
+ /* @__PURE__ */ i(b.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ i(F, { id: "displayName", value: a.displayName, onChange: (n) => o("displayName", n.target.value), placeholder: "e.g., Customer Support Platform", error: !!t.displayName, helperText: E ? /* @__PURE__ */ N(M, { direction: "row", alignItems: "center", gap: 1, children: [
176
+ /* @__PURE__ */ i(O, { size: 12 }),
177
+ /* @__PURE__ */ i(C, { variant: "caption", children: "Validating name..." })
178
+ ] }) : t.displayName, fullWidth: !0 }) }),
179
+ /* @__PURE__ */ i(b.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ i(F, { id: "description", value: a.description, onChange: (n) => o("description", n.target.value), placeholder: "Short description of this project", multiline: !0, minRows: 2, maxRows: 6, error: !!t.description, helperText: t.description, fullWidth: !0 }) }),
180
+ /* @__PURE__ */ i(b.ElementWrapper, { label: "Deployment Pipeline", name: "deploymentPipeline", children: /* @__PURE__ */ N(H, { id: "deploymentPipeline", value: a.deploymentPipeline, onChange: (n) => o("deploymentPipeline", n.target.value), error: !!t.deploymentPipeline, disabled: y, displayEmpty: !0, renderValue: (n) => {
181
+ const r = u.find((m) => m.name === n);
182
+ return r ? /* @__PURE__ */ i(se, { pipeline: r, envDisplayNameMap: g }) : n;
183
+ }, fullWidth: !0, children: [
184
+ y && /* @__PURE__ */ i(k, { value: "", disabled: !0, children: /* @__PURE__ */ N(M, { direction: "row", alignItems: "center", gap: 1, children: [
185
+ /* @__PURE__ */ i(O, { size: 12 }),
186
+ /* @__PURE__ */ i(C, { variant: "caption", children: "Loading pipelines..." })
187
+ ] }) }),
188
+ !y && u.length === 0 && /* @__PURE__ */ i(k, { value: "", disabled: !0, children: "No deployment pipelines available" }),
189
+ u.map((n) => /* @__PURE__ */ i(k, { value: n.name, children: /* @__PURE__ */ i(ce, { pipeline: n, envDisplayNameMap: g }) }, n.name))
190
+ ] }) })
191
+ ] })
192
+ ] }) });
193
+ }, pe = () => {
194
+ const a = J(), {
195
+ orgId: e
196
+ } = $(), [t, d] = B({
197
+ name: "",
198
+ displayName: "",
199
+ description: "",
200
+ deploymentPipeline: "default"
201
+ }), {
202
+ errors: c,
203
+ validateField: s,
204
+ validateForm: l,
205
+ clearErrors: o,
206
+ setFieldError: p
207
+ } = Z(re), {
208
+ checkDirty: E,
209
+ resetDirty: P
210
+ } = _(t), y = A(() => ({
211
+ orgName: e ?? "default"
212
+ }), [e]), {
213
+ mutate: u,
214
+ isPending: v,
215
+ error: g
216
+ } = ee(y), h = V(() => {
217
+ a(R(I.children.org.path, {
218
+ orgId: e ?? ""
219
+ }));
220
+ }, [a, e]), [n, r] = B({}), m = V(() => {
221
+ if (l(t))
222
+ r({});
223
+ else {
224
+ r(c);
225
+ return;
226
+ }
227
+ u({
228
+ name: t.name,
229
+ displayName: t.displayName,
230
+ description: t.description?.trim() || void 0,
231
+ deploymentPipeline: t.deploymentPipeline
232
+ }, {
233
+ onSuccess: () => {
234
+ P(), o(), a(R(I.children.org.children.projects.path, {
235
+ orgId: y.orgName ?? "",
236
+ projectId: t.name
237
+ }));
238
+ },
239
+ onError: (f) => {
240
+ console.error("Failed to create project:", f);
241
+ }
242
+ });
243
+ }, [t, l, u, a, y.orgName, P, o, c]);
244
+ return /* @__PURE__ */ i(te, { title: "Create a New Project", description: "Create a new project to organize and manage your agents.", disableIcon: !0, backHref: R(I.children.org.path, {
245
+ orgId: e ?? ""
246
+ }), backLabel: "Back to Organization", children: /* @__PURE__ */ N(L, { display: "flex", flexDirection: "column", gap: 2, children: [
247
+ /* @__PURE__ */ i(de, { formData: t, setFormData: d, errors: c, validateField: s, setFieldError: p, checkDirty: E }),
248
+ !!g && /* @__PURE__ */ i(G, { severity: "error", sx: {
249
+ mt: 2
250
+ }, children: g instanceof Error ? g.message : "Failed to create project" }),
251
+ /* @__PURE__ */ i(oe, { lastSubmittedValidationErrors: n, isPending: v, onCancel: h, onSubmit: m, isNameEmpty: !t.name.trim(), mode: "deploy" })
252
+ ] }) });
253
+ }, ve = {
254
+ title: "Add New Project",
255
+ description: "A page component for Add New Project",
256
+ icon: ae,
257
+ path: I.children.org.children.newProject.path,
258
+ component: pe
259
+ };
260
+ export {
261
+ pe as AddNewProject,
262
+ ve as metaData
263
+ };