nexus-shared 1.1.18 → 1.1.20
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/package.json +1 -1
- package/src/api-services/authentication-service.tsx +23 -0
- package/src/api-services/system-service.tsx +28 -315
- package/src/client.ts +2 -2
- package/src/components/documents/button.tsx +17 -11
- package/src/components/documents/icon-box.tsx +1 -1
- package/src/components/documents/tab-button.tsx +2 -2
- package/src/components/documents/tag.tsx +30 -0
- package/src/components/inputs/input-box.tsx +4 -2
- package/src/components/inputs/input-element.tsx +1 -1
- package/src/components/inputs/input-form.tsx +126 -14
- package/src/components/layouts/global-dialogbox.tsx +5 -9
- package/src/components/layouts/global-layout.tsx +3 -0
- package/src/components/layouts/layout-helpers.tsx +1 -4
- package/src/components/layouts/panels/user-panel.tsx +112 -0
- package/src/components/layouts/utility-menu.tsx +9 -29
- package/src/components/panels/theme-panel.tsx +2 -2
- package/src/helpers/browser-helpers.tsx +88 -3
- package/src/helpers/input-helpers.tsx +34 -4
- package/src/helpers/validation-helpers.tsx +302 -0
- package/src/index.ts +2 -18
- package/src/interface.ts +5 -1
- package/src/interfaces/auth-token-interfaces.tsx +6 -0
- package/src/interfaces/browser-interfaces.tsx +13 -0
- package/src/interfaces/button-interfaces.tsx +2 -2
- package/src/interfaces/http-interfaces.tsx +86 -8
- package/src/interfaces/icon-interfaces.tsx +3 -0
- package/src/interfaces/input-interfaces.tsx +61 -11
- package/src/interfaces/menu-interfaces.tsx +13 -0
- package/src/interfaces/message-interfaces.tsx +32 -0
- package/src/interfaces/storage-interfaces.tsx +2 -0
- package/src/interfaces/theme-interfaces.tsx +43 -129
- package/src/interfaces/type-interfaces.tsx +8 -2
- package/src/interfaces/user-interfaces.tsx +47 -0
- package/src/nexus.environments.tsx +41 -24
- package/src/proxy-api/proxy-backend.tsx +60 -0
- package/src/proxy-api/proxy-constants.tsx +28 -0
- package/src/proxy-api/proxy-helpers.tsx +91 -0
- package/src/proxy-api-client.tsx +1 -0
- package/src/proxy-api-server.tsx +2 -0
- package/src/services/http-client-services.tsx +26 -11
- package/src/services/http-services.tsx +42 -27
- package/src/services/loader-service.tsx +34 -17
- package/src/services/localstorage-service.tsx +81 -5
- package/src/services/message-services.tsx +383 -0
- package/src/services/theme-service.tsx +30 -16
- package/src/services/user-services.tsx +10 -0
- package/src/sso-config/auth-token-validation.ts +16 -0
- package/src/sso-config/callback-route.tsx +35 -0
- package/src/sso-config/cookie-encryption.ts +51 -0
- package/src/sso-config/cookie-helpers.tsx +102 -0
- package/src/sso-config/forgot-password-route.tsx +36 -0
- package/src/sso-config/oauth-callback-state.ts +61 -0
- package/src/sso-config/pkce-helpers.ts +9 -0
- package/src/sso-config/provider-complete-route.tsx +18 -0
- package/src/sso-config/redirect-context-actions.tsx +45 -0
- package/src/sso-config/redirect-context-helpers.tsx +159 -0
- package/src/sso-config/redirect-context-persist.tsx +18 -0
- package/src/sso-config/redirect-context-route.tsx +45 -0
- package/src/sso-config/refresh-route.tsx +23 -0
- package/src/sso-config/sign-in-route.tsx +74 -0
- package/src/sso-config/sign-out-route.tsx +57 -0
- package/src/sso-config/sign-up-route.tsx +57 -0
- package/src/sso-config/sso-backend-flow.ts +38 -0
- package/src/sso-config/sso-complete-route.tsx +50 -0
- package/src/sso-config/sso-config.ts +59 -0
- package/src/sso-config/sso-interfaces.tsx +99 -0
- package/src/sso-config/sso-response-helpers.tsx +20 -0
- package/src/sso-server.tsx +21 -1
- package/src/styles/nexus.dialog.css +3 -0
- package/src/styles/nexus.icon.css +1 -0
- package/src/styles/nexus.logic.css +34 -5
- package/src/interfaces/sso-interfaces.tsx +0 -52
- package/src/load-env.ts +0 -2
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GetSignOutPageURL } from "../helpers/browser-helpers";
|
|
2
|
+
import { BuildProxyApiUrl, EModules, ICurrentUser, IErrorRespose, ISuccessResponse } from "../interface";
|
|
3
|
+
import { HttpGet, HttpPost } from "../services/http-services";
|
|
4
|
+
import { ShowLoader } from "../services/loader-service";
|
|
5
|
+
|
|
6
|
+
export const GetProfileDetails = async (autoRefresh?: boolean): Promise<ICurrentUser | null> => {
|
|
7
|
+
//Profile/Details
|
|
8
|
+
const response = await HttpGet(BuildProxyApiUrl(EModules.Authentication, "Profile/Details"), null, 0);
|
|
9
|
+
if (response?.isSuccess) return response.result as ICurrentUser;
|
|
10
|
+
|
|
11
|
+
if (response?.code === 401 && autoRefresh) {
|
|
12
|
+
const refreshResponse = await RefreshAuthToken();
|
|
13
|
+
if (refreshResponse?.isSuccess) return GetProfileDetails(false);
|
|
14
|
+
else {
|
|
15
|
+
ShowLoader();
|
|
16
|
+
window.location.href = GetSignOutPageURL();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const RefreshAuthToken = async (): Promise<ISuccessResponse | IErrorRespose> => HttpPost("/api/auth/refresh", null, null, null, 0);
|
|
@@ -1,321 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import { EMenuVisibility, IClientMenu, IPanelMenu, IUtilityMenu } from "../interfaces/menu-interfaces";
|
|
1
|
+
"use server";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
id: 2,
|
|
20
|
-
menuCode: "about-me",
|
|
21
|
-
menuIcon: EIcons.PERSON,
|
|
22
|
-
menuName: "About Me",
|
|
23
|
-
menuUrl: "/about-me",
|
|
24
|
-
documentTitle: "About Me",
|
|
25
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
26
|
-
displayOrder: 2,
|
|
27
|
-
pageTitle: "About Me",
|
|
28
|
-
breadcrumbTitle: "About Me",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: 3,
|
|
32
|
-
menuCode: "about-us",
|
|
33
|
-
menuIcon: EIcons.PERSON,
|
|
34
|
-
menuName: "About Us",
|
|
35
|
-
menuUrl: "/about-us",
|
|
36
|
-
documentTitle: "About Us",
|
|
37
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
38
|
-
displayOrder: 2,
|
|
39
|
-
pageTitle: "About Us",
|
|
40
|
-
breadcrumbTitle: "About Us",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: 4,
|
|
44
|
-
menuCode: "my-projects",
|
|
45
|
-
menuIcon: EIcons.BRIEFCASE,
|
|
46
|
-
menuName: "My Projects",
|
|
47
|
-
menuUrl: "/my-projects",
|
|
48
|
-
documentTitle: "My Projects",
|
|
49
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
50
|
-
displayOrder: 3,
|
|
51
|
-
pageTitle: "My Projects",
|
|
52
|
-
breadcrumbTitle: "My Projects",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: 5,
|
|
56
|
-
menuCode: "products",
|
|
57
|
-
menuIcon: EIcons.CUBE,
|
|
58
|
-
menuName: "My Products",
|
|
59
|
-
menuUrl: "/products",
|
|
60
|
-
documentTitle: "My Products",
|
|
61
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
62
|
-
displayOrder: 4,
|
|
63
|
-
pageTitle: "My Products",
|
|
64
|
-
breadcrumbTitle: "My Products",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: 6,
|
|
68
|
-
menuCode: "products",
|
|
69
|
-
menuIcon: EIcons.CUBE,
|
|
70
|
-
menuName: "Our Products",
|
|
71
|
-
menuUrl: "/our-products",
|
|
72
|
-
documentTitle: "Our Products",
|
|
73
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
74
|
-
displayOrder: 4,
|
|
75
|
-
pageTitle: "Our Products",
|
|
76
|
-
breadcrumbTitle: "Our Products",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: 7,
|
|
80
|
-
menuCode: "blog",
|
|
81
|
-
menuIcon: EIcons.NEWSPAPER,
|
|
82
|
-
menuName: "Blog",
|
|
83
|
-
menuUrl: "/blog",
|
|
84
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
85
|
-
displayOrder: 5,
|
|
86
|
-
pageTitle: "Blog",
|
|
87
|
-
breadcrumbTitle: "Blog",
|
|
88
|
-
documentTitle: "Blog",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: 8,
|
|
92
|
-
menuCode: "portfolio-gallery",
|
|
93
|
-
menuIcon: EIcons.IMAGES,
|
|
94
|
-
menuName: "Portfolio Gallery",
|
|
95
|
-
menuUrl: "/portfolio-gallery",
|
|
96
|
-
documentTitle: "Portfolio Gallery",
|
|
97
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
98
|
-
displayOrder: 6,
|
|
99
|
-
pageTitle: "Portfolio Gallery",
|
|
100
|
-
breadcrumbTitle: "Portfolio Gallery",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: 9,
|
|
104
|
-
menuCode: "our-gallery",
|
|
105
|
-
menuIcon: EIcons.IMAGES,
|
|
106
|
-
menuName: "Our Gallery",
|
|
107
|
-
menuUrl: "/our-gallery",
|
|
108
|
-
documentTitle: "Our Gallery",
|
|
109
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
110
|
-
displayOrder: 6,
|
|
111
|
-
pageTitle: "Our Gallery",
|
|
112
|
-
breadcrumbTitle: "Our Gallery",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: 10,
|
|
116
|
-
menuCode: "services",
|
|
117
|
-
menuIcon: EIcons.CONSTRUCT,
|
|
118
|
-
menuName: "Services",
|
|
119
|
-
menuUrl: "/services",
|
|
120
|
-
documentTitle: "Services",
|
|
121
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
122
|
-
displayOrder: 7,
|
|
123
|
-
pageTitle: "Services",
|
|
124
|
-
breadcrumbTitle: "Services",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
id: 11,
|
|
128
|
-
menuCode: "faq",
|
|
129
|
-
menuIcon: EIcons.HELP_CIRCLE,
|
|
130
|
-
menuName: "FAQ",
|
|
131
|
-
menuUrl: "/faq",
|
|
132
|
-
documentTitle: "FAQ",
|
|
133
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
134
|
-
displayOrder: 8,
|
|
135
|
-
pageTitle: "FAQ",
|
|
136
|
-
breadcrumbTitle: "FAQ",
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
id: 12,
|
|
140
|
-
menuCode: "contact-me",
|
|
141
|
-
menuIcon: EIcons.CALL,
|
|
142
|
-
menuName: "Contact Me",
|
|
143
|
-
menuUrl: "/contact-me",
|
|
144
|
-
documentTitle: "Contact Me",
|
|
145
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
146
|
-
displayOrder: 9,
|
|
147
|
-
pageTitle: "Contact Me",
|
|
148
|
-
breadcrumbTitle: "Contact Me",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: 13,
|
|
152
|
-
menuCode: "contact-us",
|
|
153
|
-
menuIcon: EIcons.CALL,
|
|
154
|
-
menuName: "Contact Us",
|
|
155
|
-
menuUrl: "/contact-us",
|
|
156
|
-
documentTitle: "Contact Us",
|
|
157
|
-
menuVisibilities: EMenuVisibility.GuestOnly | EMenuVisibility.AuthenticatedOnly,
|
|
158
|
-
displayOrder: 9,
|
|
159
|
-
pageTitle: "Contact Us",
|
|
160
|
-
breadcrumbTitle: "Contact Us",
|
|
161
|
-
},
|
|
162
|
-
];
|
|
3
|
+
import { IThemeInformation } from "../interface";
|
|
4
|
+
import { EMenuTargets, IClientMenu, IPanelMenu, IUtilityMenu } from "../interfaces/menu-interfaces";
|
|
5
|
+
import { APIS, NEXUS_CONFIG, NEXUS_INFO } from "../nexus.environments";
|
|
6
|
+
import { HttpGet } from "../services/http-services";
|
|
7
|
+
|
|
8
|
+
const TOKEN_GLOBAL_CLIENT_MENU = "DJ3FKL4_IOR4U5_I4O5J4KDLJ_U_IO";
|
|
9
|
+
const TOKEN_GLOBAL_UTILITY_MENU = "DJ3FKL4_IOR4U5_I4O5J4KDLJ_dfj45k_d";
|
|
10
|
+
const TOKEN_GLOBAL_PANEL_MENU = "dj_dfjk3453IOR4U5_I4O5J4KDLJ_dfj45k_d";
|
|
11
|
+
const TOKEN_GLOBAL_THEMES = "DJWJR_GJDK_65GKD54ZJD_00";
|
|
12
|
+
|
|
13
|
+
export const GetClientMenusAsync = async (): Promise<IClientMenu[]> => {
|
|
14
|
+
const response = await HttpGet(`${APIS.CONFIGURATION}/Resources/GlobalMenus/${NEXUS_INFO.CURRENT_MODULE}/${NEXUS_INFO.IS_ADMIN_MODULE ? EMenuTargets.AdminModule : EMenuTargets.ClientModule}/${TOKEN_GLOBAL_CLIENT_MENU}`, null, NEXUS_CONFIG.DEFAULT_REVALIDATE_TIME_ONE_DAY);
|
|
15
|
+
if (!response.isSuccess) return [];
|
|
16
|
+
return response.result as IClientMenu[];
|
|
163
17
|
};
|
|
164
18
|
|
|
165
|
-
export const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
menuCode: "root-search",
|
|
170
|
-
menuIcon: EIcons.SEARCH,
|
|
171
|
-
menuName: "Search",
|
|
172
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
173
|
-
displayOrder: 1,
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
id: 2,
|
|
177
|
-
menuCode: "favorite-menu",
|
|
178
|
-
menuIcon: EIcons.HEART,
|
|
179
|
-
menuName: "Favorite",
|
|
180
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
181
|
-
displayOrder: 2,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
id: 3,
|
|
185
|
-
menuCode: "cart-menu",
|
|
186
|
-
menuIcon: EIcons.CART,
|
|
187
|
-
menuName: "Cart",
|
|
188
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
189
|
-
displayOrder: 3,
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
id: 4,
|
|
193
|
-
menuCode: "switch-theme",
|
|
194
|
-
menuIcon: EIcons.COLOR_PALETTE,
|
|
195
|
-
menuName: "Theme",
|
|
196
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
197
|
-
displayOrder: 4,
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
id: 5,
|
|
201
|
-
menuCode: "mega-menu",
|
|
202
|
-
menuIcon: EIcons.GRID,
|
|
203
|
-
menuName: "Mega Menu",
|
|
204
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
205
|
-
displayOrder: 5,
|
|
206
|
-
},
|
|
207
|
-
];
|
|
19
|
+
export const GetUtilityMenusAsync = async (): Promise<IUtilityMenu[]> => {
|
|
20
|
+
const response = await HttpGet(`${APIS.CONFIGURATION}/Resources/UtilityMenus/${NEXUS_INFO.CURRENT_MODULE}/${NEXUS_INFO.IS_ADMIN_MODULE ? EMenuTargets.AdminModule : EMenuTargets.ClientModule}/${TOKEN_GLOBAL_UTILITY_MENU}`, null, NEXUS_CONFIG.DEFAULT_REVALIDATE_TIME_ONE_DAY);
|
|
21
|
+
if (!response.isSuccess) return [];
|
|
22
|
+
return response.result as IUtilityMenu[];
|
|
208
23
|
};
|
|
209
24
|
|
|
210
|
-
export const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
groupOrder: 1,
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
id: 2,
|
|
223
|
-
menuCode: "notification-menu",
|
|
224
|
-
menuIcon: EIcons.NOTIFICATIONS,
|
|
225
|
-
menuName: "Notifications",
|
|
226
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
227
|
-
displayOrder: 2,
|
|
228
|
-
groupOrder: 1,
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
id: 3,
|
|
232
|
-
menuCode: "switch-theme",
|
|
233
|
-
menuIcon: EIcons.COLOR_PALETTE,
|
|
234
|
-
menuName: "Theme Mode",
|
|
235
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
236
|
-
displayOrder: 2,
|
|
237
|
-
groupOrder: 2,
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
id: 4,
|
|
241
|
-
menuCode: "language",
|
|
242
|
-
menuIcon: EIcons.LANGUAGE,
|
|
243
|
-
menuName: "Language",
|
|
244
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
245
|
-
displayOrder: 2,
|
|
246
|
-
groupOrder: 2,
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
id: 5,
|
|
250
|
-
menuCode: "currency",
|
|
251
|
-
menuIcon: EIcons.CASH,
|
|
252
|
-
menuName: "Currency Format",
|
|
253
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
254
|
-
displayOrder: 2,
|
|
255
|
-
groupOrder: 2,
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
id: 6,
|
|
259
|
-
menuCode: "calendar-date",
|
|
260
|
-
menuIcon: EIcons.CALENDAR,
|
|
261
|
-
menuName: "Calendar Date",
|
|
262
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
263
|
-
displayOrder: 2,
|
|
264
|
-
groupOrder: 2,
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
id: 7,
|
|
268
|
-
menuCode: "help-support",
|
|
269
|
-
menuIcon: EIcons.HELP_CIRCLE,
|
|
270
|
-
menuName: "Help & Support",
|
|
271
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly | EMenuVisibility.GuestOnly,
|
|
272
|
-
displayOrder: 2,
|
|
273
|
-
groupOrder: 2,
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
id: 8,
|
|
277
|
-
menuCode: "settings",
|
|
278
|
-
menuIcon: EIcons.SETTINGS,
|
|
279
|
-
menuName: "Account Settings",
|
|
280
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
281
|
-
displayOrder: 3,
|
|
282
|
-
groupOrder: 3,
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: 9,
|
|
286
|
-
menuCode: "switch-branch",
|
|
287
|
-
menuIcon: EIcons.REPEAT,
|
|
288
|
-
menuName: "Switch Branch",
|
|
289
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
290
|
-
displayOrder: 3,
|
|
291
|
-
groupOrder: 3,
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
id: 10,
|
|
295
|
-
menuCode: "switch-fiscal-year",
|
|
296
|
-
menuIcon: EIcons.CALENDAR,
|
|
297
|
-
menuName: "Switch Fiscal Year",
|
|
298
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
299
|
-
displayOrder: 3,
|
|
300
|
-
groupOrder: 3,
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
id: 11,
|
|
304
|
-
menuCode: "sign-out",
|
|
305
|
-
menuIcon: EIcons.EXIT,
|
|
306
|
-
menuName: "Sign Out",
|
|
307
|
-
menuVisibilities: EMenuVisibility.AuthenticatedOnly,
|
|
308
|
-
displayOrder: 3,
|
|
309
|
-
groupOrder: 3,
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
id: 12,
|
|
313
|
-
menuCode: "sign-in",
|
|
314
|
-
menuIcon: EIcons.LOGIN,
|
|
315
|
-
menuName: "Sign In",
|
|
316
|
-
menuVisibilities: EMenuVisibility.GuestOnly,
|
|
317
|
-
displayOrder: 3,
|
|
318
|
-
groupOrder: 3,
|
|
319
|
-
},
|
|
320
|
-
];
|
|
25
|
+
export const GetUserPanelsAsync = async (): Promise<IPanelMenu[]> => {
|
|
26
|
+
const response = await HttpGet(`${APIS.CONFIGURATION}/Resources/PanelMenus/${NEXUS_INFO.CURRENT_MODULE}/${NEXUS_INFO.IS_ADMIN_MODULE ? EMenuTargets.AdminModule : EMenuTargets.ClientModule}/${TOKEN_GLOBAL_PANEL_MENU}`, null, NEXUS_CONFIG.DEFAULT_REVALIDATE_TIME_ONE_DAY);
|
|
27
|
+
if (!response.isSuccess) return [];
|
|
28
|
+
return response.result as IPanelMenu[];
|
|
29
|
+
};
|
|
30
|
+
export const GetSystemThemesAsync = async (): Promise<IThemeInformation[]> => {
|
|
31
|
+
const response = await HttpGet(`${APIS.CONFIGURATION}/Resources/Themes/${TOKEN_GLOBAL_THEMES}`, null, NEXUS_CONFIG.DEFAULT_REVALIDATE_TIME_ONE_DAY);
|
|
32
|
+
if (!response.isSuccess) return [];
|
|
33
|
+
return response.result as IThemeInformation[];
|
|
321
34
|
};
|
package/src/client.ts
CHANGED
|
@@ -24,8 +24,8 @@ export * from "./helpers/browser-helpers";
|
|
|
24
24
|
export * from "./services/http-client-services";
|
|
25
25
|
export * from "./services/loader-service";
|
|
26
26
|
export * from "./services/localstorage-service";
|
|
27
|
+
export * from "./services/user-services";
|
|
28
|
+
export * from "./services/message-services";
|
|
27
29
|
export * from "./services/theme-service";
|
|
28
30
|
// Core
|
|
29
31
|
export * from "./nexus-client";
|
|
30
|
-
export * from "./sso-client";
|
|
31
|
-
|
|
@@ -3,31 +3,33 @@ import React from "react";
|
|
|
3
3
|
import { IsValidURL } from "../../helpers/browser-helpers";
|
|
4
4
|
import { SetElementStyles } from "../../helpers/element-helpers";
|
|
5
5
|
import { DEFAULT_BUTTON_CLASS, DEFAULT_LINK_BUTTON_STYLE, EButtonTypes, ETargets, IButton } from "../../interfaces/button-interfaces";
|
|
6
|
-
import { EIconTypes } from "../../interfaces/icon-interfaces";
|
|
7
|
-
import { COLUMN_SIZE_ATTRIBUTE_KEY, EFlexPositions, EOpacity
|
|
6
|
+
import { DEFAULT_ICON_SIZE, EIconTypes } from "../../interfaces/icon-interfaces";
|
|
7
|
+
import { COLUMN_SIZE_ATTRIBUTE_KEY, EFlexPositions, EOpacity } from "../../interfaces/layout-interfaces";
|
|
8
8
|
import { EBackgroundColors, EBackgrounds } from "../../interfaces/theme-interfaces";
|
|
9
9
|
import { ClickHandler, UN } from "../../interfaces/type-interfaces";
|
|
10
10
|
import { NEXUS_CONFIG } from "../../nexus.environments";
|
|
11
11
|
import { CreateIcon, Icon } from "./icon-box";
|
|
12
12
|
|
|
13
|
-
export const SET_BUTTON_ACTIVE_CLASS = (isActive: boolean, element: HTMLElement,
|
|
13
|
+
export const SET_BUTTON_ACTIVE_CLASS = (isActive: boolean, element: HTMLElement, overrideBackgroundColor?: EBackgroundColors | UN, overrideBorderColor?: EBackgroundColors | UN, overrideTextColor?: EBackgroundColors | UN, overrideActiveClass?: string | UN) => {
|
|
14
14
|
if (!element) return;
|
|
15
15
|
|
|
16
|
-
if (
|
|
16
|
+
if (isActive && overrideBackgroundColor) element.style.setProperty("--ACTIVE_BACKGROUND_COLOR", overrideBackgroundColor);
|
|
17
|
+
if (isActive && overrideBorderColor) element.style.setProperty("--ACTIVE_BORDER_COLOR", overrideBorderColor);
|
|
18
|
+
if (isActive && overrideTextColor) element.style.setProperty("--ACTIVE_TEXT_COLOR", overrideTextColor);
|
|
17
19
|
|
|
18
|
-
if (isActive) element.classList.add(
|
|
19
|
-
else element.classList.remove(
|
|
20
|
+
if (isActive) element.classList.add(overrideActiveClass ?? "active");
|
|
21
|
+
else element.classList.remove(overrideActiveClass ?? "active");
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export const Button = ({ button, buttonType, styles, needColumnSize }: { button: IButton; buttonType?: EButtonTypes; styles?: React.CSSProperties | UN; needColumnSize?: boolean | UN }) => {
|
|
23
25
|
return IsValidURL(button.url) ? (
|
|
24
26
|
<Link href={button.url ?? "#"} style={styles ?? undefined} className={DEFAULT_BUTTON_CLASS(button.columnSize, undefined, button.borderSize, button.background, button.defaultClass, needColumnSize)} key={button.displayOrder ?? 0} type={buttonType ?? EButtonTypes.BUTTON} onClick={(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => button.onClick?.(event, event.currentTarget as HTMLElement, button.data, button.displayOrder)}>
|
|
25
|
-
{button.icon && <Icon icon={button.icon} type={button.iconType ?? EIconTypes.
|
|
27
|
+
{button.icon && <Icon icon={button.icon} type={button.iconType ?? EIconTypes.OUTLINED} opacity={EOpacity.O08} size={button.iconSize ?? DEFAULT_ICON_SIZE} defaultClass="mr4" />}
|
|
26
28
|
<span>{button.label instanceof Function ? button.label(button.data) : button.label}</span>
|
|
27
29
|
</Link>
|
|
28
30
|
) : (
|
|
29
|
-
<button style={styles ??
|
|
30
|
-
{button.icon && <Icon icon={button.icon} type={button.iconType ?? EIconTypes.
|
|
31
|
+
<button style={styles ?? { minHeight: "var(--IH)" }} className={DEFAULT_BUTTON_CLASS(button.columnSize, undefined, button.borderSize, button.background, button.defaultClass, needColumnSize)} key={button.displayOrder} type={buttonType ?? EButtonTypes.BUTTON} onClick={(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => button.onClick?.(event, event.currentTarget as HTMLElement, button.data, button.displayOrder)}>
|
|
32
|
+
{button.icon && <Icon icon={button.icon} type={button.iconType ?? EIconTypes.OUTLINED} opacity={EOpacity.O08} size={button.iconSize ?? DEFAULT_ICON_SIZE} defaultClass="mr4" />}
|
|
31
33
|
<span>{button.label instanceof Function ? button.label(button.data) : button.label}</span>
|
|
32
34
|
</button>
|
|
33
35
|
);
|
|
@@ -36,17 +38,21 @@ export const CreateButton = (param: IButton, parent?: HTMLElement | UN, styles?:
|
|
|
36
38
|
const button = document.createElement(param.url ? "a" : "button");
|
|
37
39
|
button.setAttribute(COLUMN_SIZE_ATTRIBUTE_KEY, (param.columnSize ?? 12).toString());
|
|
38
40
|
if (param.icon) {
|
|
39
|
-
const icon = CreateIcon(param.icon, button, param.iconType, param.iconSize ??
|
|
41
|
+
const icon = CreateIcon(param.icon, button, param.iconType ?? EIconTypes.OUTLINED, param.iconSize ?? DEFAULT_ICON_SIZE, null, null);
|
|
40
42
|
icon.classList.add("mr4");
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
SetElementStyles(button, styles);
|
|
44
46
|
|
|
45
|
-
button.className = DEFAULT_BUTTON_CLASS(param.columnSize,
|
|
47
|
+
button.className = DEFAULT_BUTTON_CLASS(param.columnSize ?? 0, 0, param.borderSize, param.background ?? NEXUS_CONFIG.DEFAULT_BACKGROUND, param.defaultClass, needColumnSize);
|
|
46
48
|
const span = document.createElement("span");
|
|
47
49
|
span.textContent = param.label instanceof Function ? (param.label(param.data) ?? null) : (param.label ?? null);
|
|
48
50
|
button.appendChild(span);
|
|
49
51
|
button.onclick = (e) => param.onClick?.(e, button, param.data, param.displayOrder);
|
|
52
|
+
button.style.height = "var(--IH)";
|
|
53
|
+
|
|
54
|
+
button.classList.add("df", "ac", "pl5", "pr5");
|
|
55
|
+
|
|
50
56
|
if (param.url) {
|
|
51
57
|
(button as HTMLAnchorElement).href = param.url;
|
|
52
58
|
(button as HTMLAnchorElement).target = param.target ?? ETargets.Blank;
|
|
@@ -90,4 +90,4 @@ export const CreateIconBox = (icon: EIcons, parent?: HTMLElement | UN, children?
|
|
|
90
90
|
return iconBox;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
export const CreateToggleButton = (parentElement?: HTMLElement | null, children?: HTMLElement | UN, id?: string, boxSize?: ESizes | null, iconSize?: ESizes | null, opacity?: EOpacity | UN, iconType?: EIconTypes | null, boxBackground?: EBackgrounds) => CreateIconBox(EIcons.ELLIPSIS_HORIZONTAL, parentElement, children, id, iconType, boxBackground, boxSize, iconSize, `h ${boxBackground ?? NEXUS_CONFIG.DEFAULT_BACKGROUND} ml5`, "r90");
|
|
93
|
+
export const CreateToggleButton = (parentElement?: HTMLElement | null, children?: HTMLElement | UN, id?: string | UN, boxSize?: ESizes | null, iconSize?: ESizes | null, opacity?: EOpacity | UN, iconType?: EIconTypes | null, boxBackground?: EBackgrounds) => CreateIconBox(EIcons.ELLIPSIS_HORIZONTAL, parentElement, children, id, iconType, boxBackground, boxSize, iconSize, `h ${boxBackground ?? NEXUS_CONFIG.DEFAULT_BACKGROUND} ml5`, "r90");
|
|
@@ -123,7 +123,7 @@ export const TabButtons = ({ buttons, activeButton, onClicked }: { buttons: IBut
|
|
|
123
123
|
|
|
124
124
|
for (const btn of visibleItems) {
|
|
125
125
|
if (active && active.id && btn.id === active.id) {
|
|
126
|
-
btn.iconType = EIconTypes.
|
|
126
|
+
btn.iconType = EIconTypes.OUTLINED;
|
|
127
127
|
btn.defaultClass = "btn active jc r";
|
|
128
128
|
} else btn.defaultClass = `jc r ${NEXUS_CONFIG.DEFAULT_BACKGROUND}`;
|
|
129
129
|
}
|
|
@@ -157,7 +157,7 @@ export const TabButtons = ({ buttons, activeButton, onClicked }: { buttons: IBut
|
|
|
157
157
|
))}
|
|
158
158
|
|
|
159
159
|
{tabButtons.hiddenButtons && (
|
|
160
|
-
<Iconbox defaultClass="ml5" icon={EIcons.ELLIPSIS_HORIZONTAL} iconType={EIconTypes.
|
|
160
|
+
<Iconbox defaultClass="ml5" icon={EIcons.ELLIPSIS_HORIZONTAL} iconType={EIconTypes.OUTLINED} iconDefaultClass="r90" id={THEME_MENU_ELIPSE_BTN_ID}>
|
|
161
161
|
<GlobalDialogbox defaultPadding={0} iggnoreChildClick={false} buttonIdentity={THEME_MENU_ELIPSE_BTN_ID} position={EPositions.Right}>
|
|
162
162
|
<Buttons buttons={tabButtons.hiddenButtons} />
|
|
163
163
|
</GlobalDialogbox>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
import { EBackgrounds, EOpacity, EUserRoles, UN } from "../../interface";
|
|
3
|
+
|
|
4
|
+
export const GlobalTag = ({ value, background, isSmall, defaultClass, fontOpacity }: { value: string; background?: EBackgrounds; isSmall?: boolean; defaultClass?: string; fontOpacity?: EOpacity }) => {
|
|
5
|
+
isSmall = isSmall ?? true;
|
|
6
|
+
const style = { width: "fit-content" } as CSSProperties;
|
|
7
|
+
if (isSmall) style.minHeight = "1.2rem";
|
|
8
|
+
return (
|
|
9
|
+
<small style={style} className={`pr3 pl3 r pr item nw ${fontOpacity ?? EOpacity.O08} ${isSmall ? "fs-07" : "p1"} ${defaultClass ?? ""} df ac jc ${background ?? EBackgrounds.ThemeColor600}`}>
|
|
10
|
+
{value}
|
|
11
|
+
</small>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
export function GetUserRoleTag(role: string | EUserRoles | UN, isShort?: boolean, defaultClass?: string): React.JSX.Element {
|
|
15
|
+
const status = role?.toString();
|
|
16
|
+
|
|
17
|
+
switch (status) {
|
|
18
|
+
case "3":
|
|
19
|
+
case "SuperAdmin":
|
|
20
|
+
return <GlobalTag isSmall={true} value={isShort ? "SA" : "Super"} defaultClass={defaultClass} />;
|
|
21
|
+
case "2":
|
|
22
|
+
case "Admin":
|
|
23
|
+
return <GlobalTag isSmall={true} value={isShort ? "A" : "Admin"} defaultClass={defaultClass} />;
|
|
24
|
+
case "1":
|
|
25
|
+
case "User":
|
|
26
|
+
return <GlobalTag isSmall={true} value={isShort ? "U" : "User"} defaultClass={defaultClass} />;
|
|
27
|
+
default:
|
|
28
|
+
return <GlobalTag isSmall={true} value={isShort ? "G" : "Guest"} defaultClass={defaultClass} />;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { INPUT_ICON_BOX_CLASS } from "../../helpers/input-helpers";
|
|
1
2
|
import { DEFAULT_INPUT_BORDER_SIZE, IInputRootParameters, REQUIRED_TEXT1 } from "../../interfaces/input-interfaces";
|
|
2
3
|
import { EBackgrounds } from "../../interfaces/theme-interfaces";
|
|
3
4
|
import { NEXUS_CONFIG } from "../../nexus.environments";
|
|
@@ -16,7 +17,7 @@ export const CreateInputBox = (param: IInputRootParameters<any>, child: HTMLElem
|
|
|
16
17
|
if (param.label && !isTabular) {
|
|
17
18
|
const label = document.createElement("label");
|
|
18
19
|
label.className = "pa t50 ty50 left ilb en anim ml2";
|
|
19
|
-
label.innerHTML = param.label + ((param as any).isRequired ? `<span class="
|
|
20
|
+
label.innerHTML = param.label + ((param as any).isRequired ? `<span style="color: var(--B13)" class="fs-08 ml1">${REQUIRED_TEXT1}</span>` : "");
|
|
20
21
|
label.htmlFor = param.id;
|
|
21
22
|
box.appendChild(label);
|
|
22
23
|
}
|
|
@@ -24,7 +25,8 @@ export const CreateInputBox = (param: IInputRootParameters<any>, child: HTMLElem
|
|
|
24
25
|
if (param.icon) {
|
|
25
26
|
box.classList.add("df", "ac");
|
|
26
27
|
const I = param.icon;
|
|
27
|
-
CreateIconBox(I.icon, box, null, null, I.type, I.background ?? param.background ?? EBackgrounds.None, I.boxSize, I.iconSize, null, null, null, null, I.opacity, null, null, null, null, I.onClicked, I.onMouseEnter, (I.onClicked || I.onMouseEnter) !== undefined);
|
|
28
|
+
const iconBox = CreateIconBox(I.icon, box, null, null, I.type, I.background ?? param.background ?? EBackgrounds.None, I.boxSize, I.iconSize, null, null, null, null, I.opacity, null, null, null, null, I.onClicked, I.onMouseEnter, (I.onClicked || I.onMouseEnter) !== undefined);
|
|
29
|
+
iconBox.classList.add(INPUT_ICON_BOX_CLASS);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
if (parent) parent.appendChild(box);
|
|
@@ -56,7 +56,7 @@ export const CreateInputButton = (param: ISubmitbutton, parentElement: HTMLEleme
|
|
|
56
56
|
const span = document.createElement("span");
|
|
57
57
|
span.textContent = value;
|
|
58
58
|
span.classList.add("nw", "toh", "fs-10", "fw-600");
|
|
59
|
-
const icon = CreateIconBox(iconParam.icon, button, null, null, iconParam.type ?? EIconTypes.
|
|
59
|
+
const icon = CreateIconBox(iconParam.icon, button, null, null, iconParam.type ?? EIconTypes.OUTLINED, iconParam.background ?? param.background ?? EBackgrounds.None, iconParam.boxSize, iconParam.iconSize, null, null, null, null, iconParam.opacity, null, null, null, null, iconParam.onClicked, iconParam.onMouseEnter);
|
|
60
60
|
icon.classList.add("mr3");
|
|
61
61
|
button.appendChild(span);
|
|
62
62
|
} else button.innerText = value;
|