@wso2/am-core-ui 0.0.1

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.
@@ -0,0 +1,5 @@
1
+ import { ExternalModule } from '../../libs/views/src';
2
+ declare function CoreUI(props: {
3
+ externalPageModules?: ExternalModule[];
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ export default CoreUI;
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ export interface NavigationItem {
3
+ label: string;
4
+ icon?: ReactNode;
5
+ onClick?: () => void;
6
+ href?: string;
7
+ isActive?: boolean;
8
+ type: 'item';
9
+ }
10
+ export interface NavigationSection {
11
+ title: string;
12
+ items: Array<NavigationItem>;
13
+ icon?: ReactNode;
14
+ type: 'section';
15
+ }
16
+ interface LeftNavigationProps {
17
+ collapsed: boolean;
18
+ activeItem: string;
19
+ mainItems: NavigationItem[];
20
+ groupedItems: NavigationSection[];
21
+ onNavigationClick: (itemKey: string) => void;
22
+ }
23
+ export declare function LeftNavigation({ collapsed, activeItem, mainItems, groupedItems, onNavigationClick, }: LeftNavigationProps): import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export declare function OxygenLayout(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function TopNavigation(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export * from './OxygenLayout';
@@ -0,0 +1,5 @@
1
+ import { NavigationItem, NavigationSection } from './LeftNavigation';
2
+ /**
3
+ * TODO: Use nav bar instead of navigate to the items.
4
+ */
5
+ export declare function useNavigationItems(): Array<NavigationSection | NavigationItem>;
@@ -0,0 +1,7 @@
1
+ export declare function usePagePath(path: string): {
2
+ page: string | null;
3
+ subPage: string | null;
4
+ };
5
+ export declare function useActiveOrgPage(): string | null;
6
+ export declare function useActiveProjectPage(): string | null;
7
+ export declare function useActiveAgentPage(): string | null;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export declare const createUserMenuItems: ({ logout }: {
19
+ logout: () => Promise<void>;
20
+ }) => {
21
+ label: string;
22
+ onClick: () => Promise<void>;
23
+ icon: import("react/jsx-runtime").JSX.Element;
24
+ href: string;
25
+ }[];
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export * from './OxygenLayout';
@@ -0,0 +1,5 @@
1
+ import { ExternalModule } from '../../../../libs/views/src';
2
+ export declare const GlobalProviders: ({ children, externalPageModules, }: {
3
+ children: React.ReactNode;
4
+ externalPageModules?: ExternalModule[];
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export * from './GlobalProviders';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export declare const Protected: ({ children }: {
19
+ children: React.ReactNode;
20
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export * from './Protected';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export * from './GlobalProviders';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export declare function RootRouter(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export * from './Route';
19
+ export { relativeRouteMap, absoluteRouteMap } from '../../../libs/types/src';
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const LoadingFallback: FC;
@@ -0,0 +1,189 @@
1
+ import { jsx as r, jsxs as j } from "react/jsx-runtime";
2
+ import { useCallback as z, useMemo as R, useEffect as F, useState as W } from "react";
3
+ import { Alert as T, Box as S, Collapse as B, Button as A, Form as y, TextField as L, Stack as M, CircularProgress as G, Typography as O, Select as q, MenuItem as D } from "@wso2/oxygen-ui";
4
+ import { useParams as V, useNavigate as _, generatePath as k } from "react-router-dom";
5
+ import { o as H, s as w, t as $, v as J, f as K, x as Q, y as U, g as I, P as X } from "./index-DXT-m_eH.js";
6
+ import { c as Y } from "react/compiler-runtime";
7
+ import "@tanstack/react-query";
8
+ import { Link as Z, PackagePlus as ee, FolderPlus as te } from "@wso2/oxygen-ui-icons-react";
9
+ const re = H({
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
+ }), ne = (i) => {
15
+ const e = Y(22), {
16
+ lastSubmittedValidationErrors: n,
17
+ isPending: N,
18
+ onCancel: s,
19
+ onSubmit: c,
20
+ mode: g,
21
+ isNameEmpty: d
22
+ } = i, P = g === void 0 ? "deploy" : g, C = d === void 0 ? !1 : d, l = P === "connect";
23
+ let t;
24
+ e[0] !== n ? (t = Object.values(n), e[0] = n, e[1] = t) : t = e[1];
25
+ const o = t, m = o.length > 0;
26
+ let a;
27
+ e[2] !== o ? (a = /* @__PURE__ */ r(T, { severity: "error", children: o.map(ie) }), e[2] = o, e[3] = a) : a = e[3];
28
+ let u;
29
+ e[4] !== m || e[5] !== a ? (u = /* @__PURE__ */ r(B, { in: m, timeout: "auto", unmountOnExit: !0, children: a }), e[4] = m, e[5] = a, e[6] = u) : u = e[6];
30
+ let h;
31
+ e[7] !== s ? (h = /* @__PURE__ */ r(A, { variant: "outlined", color: "primary", size: "medium", onClick: s, children: "Cancel" }), e[7] = s, e[8] = h) : h = e[8];
32
+ let p;
33
+ e[9] !== l ? (p = l ? /* @__PURE__ */ r(Z, { size: 16 }) : /* @__PURE__ */ r(ee, { size: 16 }), e[9] = l, e[10] = p) : p = e[10];
34
+ const x = N || C, v = l ? "Register" : "Create";
35
+ let f;
36
+ e[11] !== c || e[12] !== p || e[13] !== x || e[14] !== v ? (f = /* @__PURE__ */ r(A, { variant: "contained", color: "primary", size: "medium", startIcon: p, onClick: c, disabled: x, children: v }), e[11] = c, e[12] = p, e[13] = x, e[14] = v, e[15] = f) : f = e[15];
37
+ let b;
38
+ e[16] !== f || e[17] !== h ? (b = /* @__PURE__ */ j(S, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
39
+ h,
40
+ f
41
+ ] }), e[16] = f, e[17] = h, e[18] = b) : b = e[18];
42
+ let E;
43
+ return e[19] !== b || e[20] !== u ? (E = /* @__PURE__ */ j(S, { display: "flex", flexDirection: "column", gap: 3, children: [
44
+ u,
45
+ b
46
+ ] }), e[19] = b, e[20] = u, e[21] = E) : E = e[21], E;
47
+ };
48
+ function ie(i, e) {
49
+ return /* @__PURE__ */ r(S, { children: i }, e);
50
+ }
51
+ const ae = ({
52
+ formData: i,
53
+ setFormData: e,
54
+ errors: n,
55
+ validateField: N,
56
+ setFieldError: s,
57
+ checkDirty: c
58
+ }) => {
59
+ const {
60
+ orgId: g
61
+ } = V(), d = z((t, o) => {
62
+ const m = {
63
+ ...i,
64
+ [t]: o
65
+ };
66
+ e(m), c(m);
67
+ const a = N(t, o);
68
+ s(t, a);
69
+ }, [i, e, c, N, s]), {
70
+ mutate: P,
71
+ isPending: C
72
+ } = $({
73
+ orgName: g
74
+ }), l = R(
75
+ () => J.debounce((t) => {
76
+ if (t.length < 3) {
77
+ d("name", "");
78
+ return;
79
+ }
80
+ P({
81
+ displayName: t,
82
+ resourceType: "project"
83
+ }, {
84
+ onSuccess: (o) => {
85
+ e((m) => {
86
+ const a = {
87
+ ...m,
88
+ name: o.name
89
+ };
90
+ return c(a), a;
91
+ });
92
+ },
93
+ onError: (o) => {
94
+ console.error("Failed to generate name:", o);
95
+ }
96
+ });
97
+ }, 500),
98
+ // 500ms delay
99
+ [P, e, c]
100
+ );
101
+ return F(() => () => {
102
+ l.cancel();
103
+ }, [l]), F(() => {
104
+ i.displayName && i.displayName.length >= 3 ? l(i.displayName) : (l.cancel(), e((t) => ({
105
+ ...t,
106
+ name: ""
107
+ })));
108
+ }, [i.displayName, e, l]), /* @__PURE__ */ r(y.Stack, { spacing: 3, children: /* @__PURE__ */ j(y.Section, { children: [
109
+ /* @__PURE__ */ r(y.Subheader, { children: "Project Details" }),
110
+ /* @__PURE__ */ j(y.Stack, { spacing: 2, children: [
111
+ /* @__PURE__ */ r(y.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ r(L, { id: "displayName", value: i.displayName, onChange: (t) => d("displayName", t.target.value), placeholder: "e.g., Customer Support Platform", error: !!n.displayName, helperText: C ? /* @__PURE__ */ j(M, { direction: "row", alignItems: "center", gap: 1, children: [
112
+ /* @__PURE__ */ r(G, { size: 12 }),
113
+ /* @__PURE__ */ r(O, { variant: "caption", children: "Validating name..." })
114
+ ] }) : n.displayName, fullWidth: !0 }) }),
115
+ /* @__PURE__ */ r(y.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ r(L, { id: "description", value: i.description, onChange: (t) => d("description", t.target.value), placeholder: "Short description of this project", multiline: !0, minRows: 2, maxRows: 6, error: !!n.description, helperText: n.description, fullWidth: !0 }) }),
116
+ /* @__PURE__ */ r(S, { display: "none", children: /* @__PURE__ */ r(y.ElementWrapper, { label: "Deployment Pipeline", name: "deploymentPipeline", children: /* @__PURE__ */ r(q, { id: "deploymentPipeline", value: i.deploymentPipeline, onChange: (t) => d("deploymentPipeline", t.target.value), error: !!n.deploymentPipeline, fullWidth: !0, children: /* @__PURE__ */ r(D, { value: "default", children: "default" }) }) }) })
117
+ ] })
118
+ ] }) });
119
+ }, oe = () => {
120
+ const i = _(), {
121
+ orgId: e
122
+ } = V(), [n, N] = W({
123
+ name: "",
124
+ displayName: "",
125
+ description: "",
126
+ deploymentPipeline: "default"
127
+ }), {
128
+ errors: s,
129
+ validateField: c,
130
+ validateForm: g,
131
+ clearErrors: d,
132
+ setFieldError: P
133
+ } = K(re), {
134
+ checkDirty: C,
135
+ resetDirty: l
136
+ } = Q(n), t = R(() => ({
137
+ orgName: e ?? "default"
138
+ }), [e]), {
139
+ mutate: o,
140
+ isPending: m,
141
+ error: a
142
+ } = U(t), u = z(() => {
143
+ i(k(I.children.org.path, {
144
+ orgId: e ?? ""
145
+ }));
146
+ }, [i, e]), [h, p] = W({}), x = z(() => {
147
+ if (g(n))
148
+ p({});
149
+ else {
150
+ p(s);
151
+ return;
152
+ }
153
+ o({
154
+ name: n.name,
155
+ displayName: n.displayName,
156
+ description: n.description?.trim() || void 0,
157
+ deploymentPipeline: n.deploymentPipeline
158
+ }, {
159
+ onSuccess: () => {
160
+ l(), d(), i(k(I.children.org.children.projects.path, {
161
+ orgId: t.orgName ?? "",
162
+ projectId: n.name
163
+ }));
164
+ },
165
+ onError: (v) => {
166
+ console.error("Failed to create project:", v);
167
+ }
168
+ });
169
+ }, [n, g, o, i, t.orgName, l, d, s]);
170
+ return /* @__PURE__ */ r(X, { title: "Create a New Project", description: "Create a new project to organize and manage your agents.", disableIcon: !0, backHref: k(I.children.org.path, {
171
+ orgId: e ?? ""
172
+ }), backLabel: "Back to Organization", children: /* @__PURE__ */ j(S, { display: "flex", flexDirection: "column", gap: 2, children: [
173
+ /* @__PURE__ */ r(ae, { formData: n, setFormData: N, errors: s, validateField: c, setFieldError: P, checkDirty: C }),
174
+ !!a && /* @__PURE__ */ r(T, { severity: "error", sx: {
175
+ mt: 2
176
+ }, children: a instanceof Error ? a.message : "Failed to create project" }),
177
+ /* @__PURE__ */ r(ne, { lastSubmittedValidationErrors: h, isPending: m, onCancel: u, onSubmit: x, isNameEmpty: !n.name.trim(), mode: "deploy" })
178
+ ] }) });
179
+ }, ge = {
180
+ title: "Add New Project",
181
+ description: "A page component for Add New Project",
182
+ icon: te,
183
+ path: I.children.org.children.newProject.path,
184
+ component: oe
185
+ };
186
+ export {
187
+ oe as AddNewProject,
188
+ ge as metaData
189
+ };