@asaleh37/ui-base 25.8.10-4 → 25.8.10-7
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/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/common/NoLicenseComponent.tsx +79 -0
- package/src/layout/Layout.tsx +12 -47
- package/src/main.tsx +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asaleh37/ui-base",
|
|
3
|
-
"version": "25.8.10-
|
|
3
|
+
"version": "25.8.10-7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Ahmed Saleh Mohamed",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"stylis-plugin-rtl": "^2.1.1",
|
|
114
114
|
"zod": "^3.24.2"
|
|
115
115
|
},
|
|
116
|
-
"dependencies": {
|
|
116
|
+
"dependencies": {
|
|
117
117
|
"@rollup/plugin-json": "^6.1.0",
|
|
118
118
|
"rollup-plugin-terser": "^7.0.2"
|
|
119
119
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Box, Typography } from "@mui/material";
|
|
2
|
+
import {
|
|
3
|
+
AppInfo,
|
|
4
|
+
LicenseCheckObject,
|
|
5
|
+
} from "../../redux/features/common/AppInfoSlice";
|
|
6
|
+
import { useSelector } from "react-redux";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { useAxios } from "../../hooks";
|
|
9
|
+
|
|
10
|
+
const NoLicenseComponent: React.FC = () => {
|
|
11
|
+
const [licenseCheckObj, setLicenseCheckObject] = useState<LicenseCheckObject>(
|
|
12
|
+
{ isLicensed: true, lastLicenseCheckMessage: "", lastLicenseCheckTime: "" }
|
|
13
|
+
);
|
|
14
|
+
const { handleGetRequest } = useAxios();
|
|
15
|
+
const appInfo: AppInfo = useSelector((state: any) => state.AppInfo.value);
|
|
16
|
+
const checkSystemLicense = async () => {
|
|
17
|
+
if (appInfo?.checkLicense?.endpoint) {
|
|
18
|
+
await handleGetRequest({
|
|
19
|
+
endPointURI: appInfo.checkLicense?.endpoint,
|
|
20
|
+
successCallBkFn: (response) => {
|
|
21
|
+
setLicenseCheckObject(response.data);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (appInfo?.checkLicense?.endpoint) {
|
|
29
|
+
const interval = appInfo?.checkLicense?.interval || 60000;
|
|
30
|
+
const intervalId = setInterval(() => {
|
|
31
|
+
checkSystemLicense();
|
|
32
|
+
}, interval);
|
|
33
|
+
return () => {
|
|
34
|
+
clearInterval(intervalId);
|
|
35
|
+
console.log("Interval cleared");
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}, [appInfo]);
|
|
39
|
+
return !licenseCheckObj.isLicensed ? (
|
|
40
|
+
<Box
|
|
41
|
+
sx={{
|
|
42
|
+
flex: 1,
|
|
43
|
+
width: "100%",
|
|
44
|
+
height: "100%",
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
position: "fixed",
|
|
50
|
+
top: 0,
|
|
51
|
+
background: "rgba(235, 235, 235, 0.8)",
|
|
52
|
+
left: 0,
|
|
53
|
+
zIndex: 9999,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<img src={appInfo.appLogo} />
|
|
57
|
+
<Typography variant="h5">
|
|
58
|
+
{appInfo.appName} - {appInfo.appVersion}
|
|
59
|
+
</Typography>
|
|
60
|
+
<Typography variant="h6" color="error">
|
|
61
|
+
Your license is missing or has expired.
|
|
62
|
+
</Typography>
|
|
63
|
+
<Typography variant="h6" color="error">
|
|
64
|
+
Please reach out to your vendor for assistance.
|
|
65
|
+
</Typography>
|
|
66
|
+
<Typography>
|
|
67
|
+
License Check @{licenseCheckObj?.lastLicenseCheckTime || "--------"}
|
|
68
|
+
</Typography>
|
|
69
|
+
<Typography>
|
|
70
|
+
License Check Result :{" "}
|
|
71
|
+
{licenseCheckObj?.lastLicenseCheckMessage || "--------"}
|
|
72
|
+
</Typography>
|
|
73
|
+
</Box>
|
|
74
|
+
) : (
|
|
75
|
+
<></>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default NoLicenseComponent;
|
package/src/layout/Layout.tsx
CHANGED
|
@@ -8,17 +8,12 @@ import MainContent from "./MainContent";
|
|
|
8
8
|
import { BrowserRouter } from "react-router-dom";
|
|
9
9
|
import MobileDrawer from "./MobileDrawer";
|
|
10
10
|
import { ToastContainer } from "react-toastify";
|
|
11
|
-
import { useEffect, useState } from "react";
|
|
12
11
|
import { useIsMobile } from "../hooks/UseMobile";
|
|
13
|
-
import useAxios from "../hooks/useAxios";
|
|
14
12
|
import { DRAWER_WIDTH } from "../redux/features/common/AppLayoutSlice";
|
|
15
13
|
import { UserSessionProps } from "../redux/features/common/UserSessionSlice";
|
|
16
14
|
import LoadingMask from "../components/common/LoadingMask";
|
|
17
15
|
import Login from "../components/common/Login";
|
|
18
|
-
import
|
|
19
|
-
AppInfo,
|
|
20
|
-
LicenseCheckObject,
|
|
21
|
-
} from "../redux/features/common/AppInfoSlice";
|
|
16
|
+
import NoLicenseComponent from "../components/common/NoLicenseComponent";
|
|
22
17
|
|
|
23
18
|
const Main = styled("main", {
|
|
24
19
|
shouldForwardProp: (prop) => prop !== "open",
|
|
@@ -60,40 +55,12 @@ const Main = styled("main", {
|
|
|
60
55
|
|
|
61
56
|
export default function Layout() {
|
|
62
57
|
const SideBarState = useSelector((state: any) => state.SideBar);
|
|
63
|
-
|
|
64
|
-
{ isLicensed: true, lastLicenseCheckMessage: "", lastLicenseCheckTime: "" }
|
|
65
|
-
);
|
|
58
|
+
|
|
66
59
|
const isMobile = useIsMobile();
|
|
67
|
-
const { handleGetRequest } = useAxios();
|
|
68
60
|
const UserSession: UserSessionProps = useSelector(
|
|
69
61
|
(state: any) => state.UserSession
|
|
70
62
|
);
|
|
71
|
-
const appInfo: AppInfo = useSelector((state: any) => state.AppInfo.value);
|
|
72
63
|
const AppLayout = useSelector((state: any) => state.AppLayout);
|
|
73
|
-
const checkSystemLicense = async () => {
|
|
74
|
-
if (appInfo?.checkLicense?.endpoint) {
|
|
75
|
-
await handleGetRequest({
|
|
76
|
-
endPointURI: appInfo.checkLicense?.endpoint,
|
|
77
|
-
successCallBkFn: (response) => {
|
|
78
|
-
setLicenseCheckObject(response.data);
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (appInfo?.checkLicense?.endpoint) {
|
|
86
|
-
const interval = appInfo?.checkLicense?.interval || 60000;
|
|
87
|
-
const intervalId = setInterval(() => {
|
|
88
|
-
checkSystemLicense();
|
|
89
|
-
}, interval);
|
|
90
|
-
return () => {
|
|
91
|
-
clearInterval(intervalId);
|
|
92
|
-
console.log("Interval cleared");
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}, []);
|
|
96
|
-
|
|
97
64
|
return (
|
|
98
65
|
<BrowserRouter>
|
|
99
66
|
<ToastContainer
|
|
@@ -103,18 +70,16 @@ export default function Layout() {
|
|
|
103
70
|
/>
|
|
104
71
|
<LoadingMask />
|
|
105
72
|
{UserSession.value.isAuthenticated === true ? (
|
|
106
|
-
licenseCheckObj?.isLicensed ? (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<>Your licsense has been expired</>
|
|
117
|
-
)
|
|
73
|
+
// licenseCheckObj?.isLicensed ? (
|
|
74
|
+
<Main open={SideBarState.isOpened}>
|
|
75
|
+
<CssBaseline />
|
|
76
|
+
<TopBar />
|
|
77
|
+
{!isMobile ? <SideBar /> : null}
|
|
78
|
+
{isMobile ? <MobileDrawer /> : null}
|
|
79
|
+
<DrawerHeader />
|
|
80
|
+
<MainContent />
|
|
81
|
+
<NoLicenseComponent />
|
|
82
|
+
</Main>
|
|
118
83
|
) : (
|
|
119
84
|
<Login />
|
|
120
85
|
)}
|