ui-soxo-bootstrap-core 2.6.1-dev.17 → 2.6.1-dev.19

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.
@@ -1,7 +1,3 @@
1
-
2
-
3
-
4
-
5
1
  import LandingAPI from './landing-api/landing-api';
6
2
 
7
3
  import ExtraInfoDetail from './extra-info/extra-info-details';
@@ -11,11 +7,6 @@ import RootApplicationAPI from './root-application-api/root-application-api';
11
7
  import { HomePageAPI } from '../modules';
12
8
 
13
9
  import { ExternalWindow } from './external-window/external-window';
10
+ import LicenseAlert from './license-management/license-alert';
14
11
 
15
- export {
16
- LandingAPI,
17
- RootApplicationAPI,
18
- ExtraInfoDetail,
19
- HomePageAPI,
20
- ExternalWindow
21
- }
12
+ export { LandingAPI, RootApplicationAPI, ExtraInfoDetail, HomePageAPI, ExternalWindow, LicenseAlert };
@@ -59,10 +59,12 @@ export default function LandingApi({ history, CustomComponents, CustomModels, ap
59
59
 
60
60
  const [meta, setMeta] = useState({});
61
61
  const [loadingMessage, setLoadingMessage] = useState('');
62
+ // License data state
62
63
 
63
64
  // const [reports, setReports] = useState([]);
64
65
 
65
66
  var config = {};
67
+ //fetch license summary
66
68
 
67
69
  // Variable decides the control of homepage
68
70
  // #TODO This is a temporary fix - Homemage
@@ -138,9 +140,11 @@ export default function LandingApi({ history, CustomComponents, CustomModels, ap
138
140
  */
139
141
  async function initializeUserMenus() {
140
142
  // need to find what implement, with a login who has the respective value ("wug_custreportids")
143
+
141
144
  const report = await loadScripts(user);
142
145
 
143
146
  await loadMenus(report);
147
+ // fetch license summary
144
148
  }
145
149
 
146
150
  // const keyMap = {
@@ -159,7 +163,6 @@ export default function LandingApi({ history, CustomComponents, CustomModels, ap
159
163
  * @param reports
160
164
  */
161
165
  async function loadMenus(reports) {
162
-
163
166
  setLoader(true);
164
167
 
165
168
  // setReports(report)
@@ -169,16 +172,12 @@ export default function LandingApi({ history, CustomComponents, CustomModels, ap
169
172
  // console.log(result);
170
173
 
171
174
  if (result && Array.isArray(result.result) && result.result.length) {
172
-
173
175
  // setModules(result.result);
174
-
175
176
  // result.result.map((ele) => {
176
177
  // let languageString = JSON.parse(ele.attributes)
177
178
  // console.log('language_string', languageString);
178
179
  // if (languageString && languageString.languages) {
179
-
180
180
  // const language = i18n.language;
181
-
182
181
  // i18n.addResourceBundle(language, 'translation', languageString.languages[i18n.language]);
183
182
  // }
184
183
  // })
@@ -189,7 +188,6 @@ export default function LandingApi({ history, CustomComponents, CustomModels, ap
189
188
  dispatch({ type: 'settings', payload: result.result.settings });
190
189
  }
191
190
 
192
-
193
191
  // Reports length
194
192
  if (reports.length) {
195
193
  reportMenus = [
@@ -224,7 +222,6 @@ export default function LandingApi({ history, CustomComponents, CustomModels, ap
224
222
  //If there is no roles assigned to the user
225
223
  setAllModules([...coreModules]);
226
224
  }
227
-
228
225
  } else {
229
226
  // for nura
230
227
  if (result && result.result.menus && reportMenus) {
@@ -233,14 +230,10 @@ export default function LandingApi({ history, CustomComponents, CustomModels, ap
233
230
  //If there is no roles assigned to the user
234
231
  setAllModules([...coreModules]);
235
232
  }
236
-
237
-
238
233
  }
239
234
  setLoader(false);
240
-
241
235
  }
242
236
 
243
-
244
237
  /**
245
238
  * Load the scripts
246
239
  *
@@ -0,0 +1,97 @@
1
+ import { Alert } from 'antd';
2
+ import React, { useState, useEffect } from 'react';
3
+
4
+ export default function LicenseAlert({ data }) {
5
+ // setting visibility of alert based on license status
6
+ const [visible, setVisible] = useState(true);
7
+ // resolve alert configuration based on license data
8
+ const alertConfig = resolveLicenseAlert(data);
9
+ // auto-hide alert after 10 seconds or when data changes
10
+ useEffect(() => {
11
+ if (alertConfig) {
12
+ setVisible(true);
13
+
14
+ const timer = setTimeout(() => {
15
+ setVisible(false);
16
+ }, 10000); // 10 seconds
17
+
18
+ return () => {
19
+ clearTimeout(timer);
20
+ };
21
+ }
22
+ }, [data]);
23
+ // if no alert configuration or not visible, render nothing
24
+ if (!alertConfig || !visible) return null;
25
+
26
+ return (
27
+ // render the alert with appropriate type, message, and description
28
+ <Alert
29
+ type={alertConfig.type}
30
+ message={alertConfig.message}
31
+ description={alertConfig.description}
32
+ showIcon
33
+ closable
34
+ onClose={() => setVisible(false)}
35
+ />
36
+ );
37
+ }
38
+ // function to determine alert configuration based on license data
39
+ function resolveLicenseAlert(data) {
40
+ if (!data) return null;
41
+ // destructure relevant fields from license data
42
+ const { status, expiresInDays, isExpiringSoon, gracePeriod } = data;
43
+
44
+ // ===== NOT INSTALLED =====
45
+ if (status === 'NOT_INSTALLED') {
46
+ return {
47
+ type: 'error',
48
+ message: 'License not found',
49
+ description: 'Please install a valid license to continue.',
50
+ };
51
+ }
52
+
53
+ // ===== GRACE PERIOD =====
54
+ if (gracePeriod) {
55
+ return {
56
+ type: 'warning',
57
+ message: 'Grace period mode',
58
+ description: 'License expired. Running in read-only mode.',
59
+ };
60
+ }
61
+
62
+ // ===== EXPIRING SOON =====
63
+ if (status === 'ACTIVE' && isExpiringSoon) {
64
+ let descriptionText = '';
65
+ // customize message based on how soon the license is expiring
66
+ if (expiresInDays === 1) {
67
+ descriptionText = 'Your license will expire today. Please renew immediately.';
68
+ } else {
69
+ descriptionText = `Your license will expire in ${expiresInDays} days. Please plan for renewal.`;
70
+ }
71
+
72
+ return {
73
+ type: 'warning',
74
+ message: 'License expiring soon',
75
+ description: descriptionText,
76
+ };
77
+ }
78
+
79
+ // ===== NOT INSTALLED =====
80
+ if (status === 'NOT_INSTALLED') {
81
+ return {
82
+ type: 'error',
83
+ message: 'License not found',
84
+ description: 'Please install a valid license to continue.',
85
+ };
86
+ }
87
+ // =====EXPIRED=====
88
+ if (status === 'EXPIRED') {
89
+ return {
90
+ type: 'error',
91
+ message: 'License expired',
92
+ description: 'Your license has expired. Please renew or install a new license.',
93
+ };
94
+ }
95
+
96
+ return null;
97
+ }
@@ -1,18 +1,92 @@
1
1
  export const boxVariants = {
2
- entering: { x: -50, opacity: 0},
2
+ entering: { x: -24, opacity: 0, scale: 0.985 },
3
3
  entered: {
4
4
  x: 0,
5
5
  opacity: 1,
6
+ scale: 1,
6
7
  transition: {
7
8
  x: {
8
- duration: 0.5,
9
+ duration: 0.45,
9
10
  ease: [.62,.28,.23,.99]
10
11
  },
11
12
  opacity: {
12
- duration: 0.5,
13
+ duration: 0.35,
13
14
  ease: [.62,.28,.23,.99]
15
+ },
16
+ scale: {
17
+ duration: 0.45,
18
+ ease: [.22,1,.36,1]
14
19
  }
15
20
  },
16
21
 
17
22
  }
18
- }
23
+ };
24
+
25
+ export const headerShellVariants = {
26
+ hidden: {
27
+ y: -14,
28
+ opacity: 0,
29
+ scale: 0.995,
30
+ filter: 'blur(6px)',
31
+ },
32
+ visible: {
33
+ y: 0,
34
+ opacity: 1,
35
+ scale: 1,
36
+ filter: 'blur(0px)',
37
+ transition: {
38
+ duration: 0.45,
39
+ ease: [.22,1,.36,1],
40
+ when: 'beforeChildren',
41
+ staggerChildren: 0.045,
42
+ },
43
+ },
44
+ };
45
+
46
+ export const headerClusterVariants = {
47
+ hidden: { opacity: 0, x: -12 },
48
+ visible: {
49
+ opacity: 1,
50
+ x: 0,
51
+ transition: {
52
+ duration: 0.32,
53
+ ease: [.22,1,.36,1],
54
+ },
55
+ },
56
+ };
57
+
58
+ export const headerActionsVariants = {
59
+ hidden: {},
60
+ visible: {
61
+ transition: {
62
+ staggerChildren: 0.05,
63
+ delayChildren: 0.08,
64
+ },
65
+ },
66
+ };
67
+
68
+ export const headerActionItemVariants = {
69
+ hidden: { opacity: 0, y: -8, scale: 0.98 },
70
+ visible: {
71
+ opacity: 1,
72
+ y: 0,
73
+ scale: 1,
74
+ transition: {
75
+ duration: 0.28,
76
+ ease: [.22,1,.36,1],
77
+ },
78
+ },
79
+ };
80
+
81
+ export const contentRevealVariants = {
82
+ hidden: { opacity: 0, y: 10 },
83
+ visible: {
84
+ opacity: 1,
85
+ y: 0,
86
+ transition: {
87
+ duration: 0.35,
88
+ ease: [.22,1,.36,1],
89
+ delay: 0.08,
90
+ },
91
+ },
92
+ };