@asaleh37/ui-base 1.1.7 → 1.1.9

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 CHANGED
@@ -1,113 +1,113 @@
1
- {
2
- "name": "@asaleh37/ui-base",
3
- "version": "1.1.7",
4
- "description": "",
5
- "license": "ISC",
6
- "author": "Ahmed Saleh Mohamed",
7
- "type": "commonjs",
8
- "main": "dist/index.js",
9
- "module": "dist/index.mjs",
10
- "types": "dist/index.d.ts",
11
- "scripts": {
12
- "build": "rollup -c --bundleConfigAsCjs",
13
- "dev": "vite"
14
- },
15
- "devDependencies": {
16
- "@emotion/cache": "^11.14.0",
17
- "@emotion/react": "^11.14.0",
18
- "@emotion/styled": "^11.14.0",
19
- "@eslint/js": "^9.19.0",
20
- "@fortawesome/fontawesome-svg-core": "^6.7.2",
21
- "@fortawesome/free-brands-svg-icons": "^6.7.2",
22
- "@fortawesome/free-regular-svg-icons": "^6.7.2",
23
- "@fortawesome/free-solid-svg-icons": "^6.7.2",
24
- "@fortawesome/react-fontawesome": "^0.2.2",
25
- "@hookform/resolvers": "^4.1.0",
26
- "@mui/icons-material": "^6.4.8",
27
- "@mui/material": "^6.4.4",
28
- "@mui/x-charts": "^7.27.0",
29
- "@mui/x-data-grid-premium": "^8.3.0",
30
- "@mui/x-date-pickers": "^7.27.0",
31
- "@mui/x-license": "^8.3.0",
32
- "@mui/x-tree-view": "^7.26.0",
33
- "@react-spring/web": "^9.7.5",
34
- "@reduxjs/toolkit": "^2.5.1",
35
- "@rollup/plugin-commonjs": "^28.0.3",
36
- "@rollup/plugin-node-resolve": "^16.0.1",
37
- "@rollup/plugin-terser": "^0.4.4",
38
- "@rollup/plugin-typescript": "^12.1.2",
39
- "@types/react": "^19.1.6",
40
- "@types/react-dom": "^19.0.3",
41
- "@types/react-i18next": "^7.8.3",
42
- "@vitejs/plugin-react": "^4.3.4",
43
- "axios": "^1.8.1",
44
- "eslint": "^9.19.0",
45
- "eslint-plugin-react-hooks": "^5.0.0",
46
- "eslint-plugin-react-refresh": "^0.4.18",
47
- "globals": "^15.14.0",
48
- "i18next": "^24.2.2",
49
- "i18next-browser-languagedetector": "^8.0.3",
50
- "i18next-http-backend": "^3.0.2",
51
- "moment": "^2.30.1",
52
- "oidc-client-ts": "^3.1.0",
53
- "react": "^19.1.0",
54
- "react-dom": "^19.0.0",
55
- "react-hook-form": "^7.54.2",
56
- "react-i18next": "^15.4.0",
57
- "react-redux": "^9.2.0",
58
- "react-router-dom": "^7.1.5",
59
- "react-toastify": "^11.0.5",
60
- "rollup": "^4.41.1",
61
- "rollup-plugin-dts": "^6.2.1",
62
- "rollup-plugin-peer-deps-external": "^2.2.4",
63
- "rollup-plugin-postcss": "^4.0.2",
64
- "stylis": "^4.3.6",
65
- "stylis-plugin-rtl": "^2.1.1",
66
- "tslib": "^2.8.1",
67
- "typescript": "~5.7.2",
68
- "typescript-eslint": "^8.22.0",
69
- "vite": "^6.1.0",
70
- "zod": "^3.24.2"
71
- },
72
- "peerDependencies": {
73
- "@emotion/cache": "^11.14.0",
74
- "@emotion/react": "^11.14.0",
75
- "@emotion/styled": "^11.14.0",
76
- "@fortawesome/fontawesome-svg-core": "^6.7.2",
77
- "@fortawesome/free-brands-svg-icons": "^6.7.2",
78
- "@fortawesome/free-regular-svg-icons": "^6.7.2",
79
- "@fortawesome/free-solid-svg-icons": "^6.7.2",
80
- "@fortawesome/react-fontawesome": "^0.2.2",
81
- "@hookform/resolvers": "^4.1.0",
82
- "@mui/icons-material": "^6.4.8",
83
- "@mui/material": "^6.4.4",
84
- "@mui/x-charts": "^7.27.0",
85
- "@mui/x-data-grid-premium": "^8.3.0",
86
- "@mui/x-date-pickers": "^7.27.0",
87
- "@mui/x-license": "^8.3.0",
88
- "@mui/x-tree-view": "^7.26.0",
89
- "@react-spring/web": "^9.7.5",
90
- "@reduxjs/toolkit": "^2.5.1",
91
- "axios": "^1.8.1",
92
- "i18next": "^24.2.2",
93
- "i18next-browser-languagedetector": "^8.0.3",
94
- "i18next-http-backend": "^3.0.2",
95
- "moment": "^2.30.1",
96
- "oidc-client-ts": "^3.1.0",
97
- "react": "^19.0.0",
98
- "react-dom": "^19.0.0",
99
- "react-hook-form": "^7.54.2",
100
- "react-i18next": "^15.4.0",
101
- "react-redux": "^9.2.0",
102
- "react-router-dom": "^7.1.5",
103
- "react-toastify": "^11.0.5",
104
- "rollup": "^4.41.1",
105
- "rollup-plugin-postcss": "^4.0.2",
106
- "stylis": "^4.3.6",
107
- "stylis-plugin-rtl": "^2.1.1",
108
- "zod": "^3.24.2"
109
- },
110
- "dependencies": {
111
- "@rollup/plugin-json": "^6.1.0"
112
- }
113
- }
1
+ {
2
+ "name": "@asaleh37/ui-base",
3
+ "version": "1.1.9",
4
+ "description": "",
5
+ "license": "ISC",
6
+ "author": "Ahmed Saleh Mohamed",
7
+ "type": "commonjs",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.mjs",
10
+ "types": "dist/index.d.ts",
11
+ "scripts": {
12
+ "build": "rollup -c --bundleConfigAsCjs",
13
+ "dev": "vite"
14
+ },
15
+ "devDependencies": {
16
+ "@emotion/cache": "^11.14.0",
17
+ "@emotion/react": "^11.14.0",
18
+ "@emotion/styled": "^11.14.0",
19
+ "@eslint/js": "^9.19.0",
20
+ "@fortawesome/fontawesome-svg-core": "^6.7.2",
21
+ "@fortawesome/free-brands-svg-icons": "^6.7.2",
22
+ "@fortawesome/free-regular-svg-icons": "^6.7.2",
23
+ "@fortawesome/free-solid-svg-icons": "^6.7.2",
24
+ "@fortawesome/react-fontawesome": "^0.2.2",
25
+ "@hookform/resolvers": "^4.1.0",
26
+ "@mui/icons-material": "^6.4.8",
27
+ "@mui/material": "^6.4.4",
28
+ "@mui/x-charts": "^7.27.0",
29
+ "@mui/x-data-grid-premium": "^8.3.0",
30
+ "@mui/x-date-pickers": "^7.27.0",
31
+ "@mui/x-license": "^8.3.0",
32
+ "@mui/x-tree-view": "^7.26.0",
33
+ "@react-spring/web": "^9.7.5",
34
+ "@reduxjs/toolkit": "^2.5.1",
35
+ "@rollup/plugin-commonjs": "^28.0.3",
36
+ "@rollup/plugin-node-resolve": "^16.0.1",
37
+ "@rollup/plugin-terser": "^0.4.4",
38
+ "@rollup/plugin-typescript": "^12.1.2",
39
+ "@types/react": "^19.1.6",
40
+ "@types/react-dom": "^19.0.3",
41
+ "@types/react-i18next": "^7.8.3",
42
+ "@vitejs/plugin-react": "^4.3.4",
43
+ "axios": "^1.8.1",
44
+ "eslint": "^9.19.0",
45
+ "eslint-plugin-react-hooks": "^5.0.0",
46
+ "eslint-plugin-react-refresh": "^0.4.18",
47
+ "globals": "^15.14.0",
48
+ "i18next": "^24.2.2",
49
+ "i18next-browser-languagedetector": "^8.0.3",
50
+ "i18next-http-backend": "^3.0.2",
51
+ "moment": "^2.30.1",
52
+ "oidc-client-ts": "^3.1.0",
53
+ "react": "^19.1.0",
54
+ "react-dom": "^19.0.0",
55
+ "react-hook-form": "^7.54.2",
56
+ "react-i18next": "^15.4.0",
57
+ "react-redux": "^9.2.0",
58
+ "react-router-dom": "^7.1.5",
59
+ "react-toastify": "^11.0.5",
60
+ "rollup": "^4.41.1",
61
+ "rollup-plugin-dts": "^6.2.1",
62
+ "rollup-plugin-peer-deps-external": "^2.2.4",
63
+ "rollup-plugin-postcss": "^4.0.2",
64
+ "stylis": "^4.3.6",
65
+ "stylis-plugin-rtl": "^2.1.1",
66
+ "tslib": "^2.8.1",
67
+ "typescript": "~5.7.2",
68
+ "typescript-eslint": "^8.22.0",
69
+ "vite": "^6.1.0",
70
+ "zod": "^3.24.2"
71
+ },
72
+ "peerDependencies": {
73
+ "@emotion/cache": "^11.14.0",
74
+ "@emotion/react": "^11.14.0",
75
+ "@emotion/styled": "^11.14.0",
76
+ "@fortawesome/fontawesome-svg-core": "^6.7.2",
77
+ "@fortawesome/free-brands-svg-icons": "^6.7.2",
78
+ "@fortawesome/free-regular-svg-icons": "^6.7.2",
79
+ "@fortawesome/free-solid-svg-icons": "^6.7.2",
80
+ "@fortawesome/react-fontawesome": "^0.2.2",
81
+ "@hookform/resolvers": "^4.1.0",
82
+ "@mui/icons-material": "^6.4.8",
83
+ "@mui/material": "^6.4.4",
84
+ "@mui/x-charts": "^7.27.0",
85
+ "@mui/x-data-grid-premium": "^8.3.0",
86
+ "@mui/x-date-pickers": "^7.27.0",
87
+ "@mui/x-license": "^8.3.0",
88
+ "@mui/x-tree-view": "^7.26.0",
89
+ "@react-spring/web": "^9.7.5",
90
+ "@reduxjs/toolkit": "^2.5.1",
91
+ "axios": "^1.8.1",
92
+ "i18next": "^24.2.2",
93
+ "i18next-browser-languagedetector": "^8.0.3",
94
+ "i18next-http-backend": "^3.0.2",
95
+ "moment": "^2.30.1",
96
+ "oidc-client-ts": "^3.1.0",
97
+ "react": "^19.0.0",
98
+ "react-dom": "^19.0.0",
99
+ "react-hook-form": "^7.54.2",
100
+ "react-i18next": "^15.4.0",
101
+ "react-redux": "^9.2.0",
102
+ "react-router-dom": "^7.1.5",
103
+ "react-toastify": "^11.0.5",
104
+ "rollup": "^4.41.1",
105
+ "rollup-plugin-postcss": "^4.0.2",
106
+ "stylis": "^4.3.6",
107
+ "stylis-plugin-rtl": "^2.1.1",
108
+ "zod": "^3.24.2"
109
+ },
110
+ "dependencies": {
111
+ "@rollup/plugin-json": "^6.1.0"
112
+ }
113
+ }
@@ -1,16 +1,16 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var resolve = require('@rollup/plugin-node-resolve');
6
- var commonjs = require('@rollup/plugin-commonjs');
7
- var typescript = require('@rollup/plugin-typescript');
8
- var dts = require('rollup-plugin-dts');
9
- var terser = require('@rollup/plugin-terser');
10
- var json = require('@rollup/plugin-json');
11
- var peerDepsExternal = require('rollup-plugin-peer-deps-external');
12
- var postcss = require('rollup-plugin-postcss');
13
-
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var resolve = require('@rollup/plugin-node-resolve');
6
+ var commonjs = require('@rollup/plugin-commonjs');
7
+ var typescript = require('@rollup/plugin-typescript');
8
+ var dts = require('rollup-plugin-dts');
9
+ var terser = require('@rollup/plugin-terser');
10
+ var json = require('@rollup/plugin-json');
11
+ var peerDepsExternal = require('rollup-plugin-peer-deps-external');
12
+ var postcss = require('rollup-plugin-postcss');
13
+
14
14
  const packageJson = require("./package.json");
15
15
 
16
16
  var rollup_config = [
@@ -45,6 +45,6 @@ var rollup_config = [
45
45
  plugins: [dts.default()],
46
46
  external: [/\.css$/],
47
47
  },
48
- ];
49
-
50
- exports.default = rollup_config;
48
+ ];
49
+
50
+ exports.default = rollup_config;
@@ -7,8 +7,10 @@ import { LightThemeOptions } from "../theme/LightThemeOptions";
7
7
  import { DarkThemeOptions } from "../theme/DarkThemeOptions";
8
8
  import Layout from "../layout/Layout";
9
9
  import { AppInfo, AppInfoActions } from "../redux/features/common/AppInfoSlice";
10
+ import { LicenseInfo } from "@mui/x-license";
10
11
 
11
12
  const App: React.FC<AppInfo> = (props: AppInfo) => {
13
+ LicenseInfo.setLicenseKey(props.muiPremiumKey);
12
14
  const dispatch = useDispatch();
13
15
  const AppLayoutState = useSelector((state: RootState) => state.AppLayout);
14
16
  let themeOptions = { ...LightThemeOptions };
@@ -1,24 +1,36 @@
1
1
  import { Provider } from "react-redux";
2
- import { store } from "../redux/store";
2
+ import { addReducer, store } from "../redux/store";
3
3
  import { library } from "@fortawesome/fontawesome-svg-core";
4
4
  import { fab } from "@fortawesome/free-brands-svg-icons";
5
5
  import { far } from "@fortawesome/free-regular-svg-icons";
6
6
  import { fas } from "@fortawesome/free-solid-svg-icons";
7
7
  import "../styles/index.css";
8
- import { LicenseInfo } from "@mui/x-license";
9
-
10
- LicenseInfo.setLicenseKey(
11
- "c2bd611fa642666253500ab9c8e4f78fTz0xMTE4MjEsRT0xNzc2OTg4Nzk5MDAwLFM9cHJlbWl1bSxMTT1zdWJzY3JpcHRpb24sUFY9aW5pdGlhbCxLVj0y"
12
- );
13
8
  import "react-toastify/dist/ReactToastify.css";
14
9
  import App from "./App";
15
10
  import { AppInfo } from "../redux/features/common/AppInfoSlice";
11
+ import { commonStoresInitialState } from "../redux/features/common/CommonStoreSlice";
16
12
 
17
13
  library.add(fab);
18
14
  library.add(far);
19
15
  library.add(fas);
20
16
 
21
17
  export const BaseApp: React.FC<AppInfo> = (props) => {
18
+ if (props?.businessCommonStoresMetaData) {
19
+ for (let businessStoreKey of Object.keys(
20
+ props.businessCommonStoresMetaData
21
+ )) {
22
+ commonStoresInitialState[businessStoreKey] =
23
+ props.businessCommonStoresMetaData[businessStoreKey];
24
+ }
25
+ }
26
+ if (props?.businessReduxReducers) {
27
+ for (let businessReducerKey of Object.keys(props.businessReduxReducers)) {
28
+ addReducer(
29
+ businessReducerKey,
30
+ props.businessReduxReducers[businessReducerKey]
31
+ );
32
+ }
33
+ }
22
34
  return (
23
35
  <Provider store={store}>
24
36
  <App {...props} />
@@ -4,3 +4,4 @@ export * from "zod";
4
4
  export { toast } from "react-toastify";
5
5
  export { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
6
6
  export type { FontAwesomeIconProps } from "@fortawesome/react-fontawesome";
7
+ export * from "./templates";
@@ -1,8 +1,8 @@
1
1
  import { useDispatch, useSelector } from "react-redux";
2
2
  import { RootState } from "../../../redux/store";
3
- import { setStoreData } from "../../../redux/features/business/CommonStoreSlice";
4
3
  import useSession from "../../../hooks/UseSession";
5
4
  import useAxios from "../../../hooks/useAxios";
5
+ import { setStoreData } from "../../../redux/features/common/CommonStoreSlice";
6
6
 
7
7
  export type ApiActionsProps = {
8
8
  findAll?: string;
@@ -23,7 +23,7 @@ function union(a, b) {
23
23
  return [...a, ...not(b, a)];
24
24
  }
25
25
 
26
- type TransferListProps = {
26
+ export type TransferListProps = {
27
27
  valueField: string;
28
28
  displayField: string;
29
29
  options: Array<any>;
@@ -0,0 +1,19 @@
1
+ export { default as TransferList } from "./TransferList";
2
+ export { default as TemplateDashboard } from "./visuals/TemplateDashboard";
3
+ export { default as TemplateBarChart } from "./visuals/charts/TemplateBarChart";
4
+ export { default as TemplateDataCard } from "./visuals/charts/TemplateDataCard";
5
+ export { default as TemplateGauge } from "./visuals/charts/TemplateGauge";
6
+ export { default as TemplateLineChart } from "./visuals/charts/TemplateLineChart";
7
+ export { default as TemplateLineProgress } from "./visuals/charts/TemplateLineProgress";
8
+ export { default as TemplatePieChart } from "./visuals/charts/TemplatePieChart";
9
+ export { default as CheckBox } from "./DataEntryTemplates/TemplateDataForm/FormFields/CheckBox";
10
+ export { default as ComboBox } from "./DataEntryTemplates/TemplateDataForm/FormFields/ComboBox";
11
+ export { default as Datefield } from "./DataEntryTemplates/TemplateDataForm/FormFields/Datefield";
12
+ export { default as DatetimeField } from "./DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField";
13
+ export { default as TemplateTextField } from "./DataEntryTemplates/TemplateDataForm/FormFields/TemplateTextField";
14
+ export { default as TemplateForm } from "./DataEntryTemplates/TemplateDataForm/TemplateForm";
15
+ export { default as TemplateGrid } from "./DataEntryTemplates/TemplateDataGrid/TemplateGrid";
16
+
17
+ export type * from "./DataEntryTemplates/DataEntryTypes";
18
+ export type { DashboardProps } from "./visuals/TemplateDashboard";
19
+ export type { TransferListProps } from "./TransferList";
@@ -27,7 +27,7 @@ export interface SingleRecordWidgetProps {
27
27
  labelField: string;
28
28
  }
29
29
 
30
- interface DashboardProps {
30
+ export interface DashboardProps {
31
31
  dashboardTitle: string;
32
32
  dashboardWidgets: Array<WidgetProps>;
33
33
  }
@@ -0,0 +1,6 @@
1
+ export { default as useAxios } from "./useAxios";
2
+ export { useConfirmationWindow } from "./UseConfirmationWindow";
3
+ export { default as useLoadingMask } from "./useLoadingMask";
4
+ export { useIsMobile } from "./UseMobile";
5
+ export { default as useSession } from "./UseSession";
6
+ export { useWindow } from "./UseWindow";
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- // export { default as MyComponent1 } from "./MyComponent1";
2
- // export type { MyComponent1Props } from "./MyComponent1";
3
1
  export * from "./components";
2
+ export * from "./hooks";
3
+ export * from "./util";
@@ -14,12 +14,11 @@ import useLoadingMask from "../hooks/useLoadingMask";
14
14
  import { useIsMobile } from "../hooks/UseMobile";
15
15
  import useSession from "../hooks/UseSession";
16
16
  import useAxios from "../hooks/useAxios";
17
- import { setStoreData } from "../redux/features/business/CommonStoreSlice";
18
17
  import { DRAWER_WIDTH } from "../redux/features/common/AppLayoutSlice";
19
18
  import { UserSessionProps } from "../redux/features/common/UserSessionSlice";
20
19
  import LoadingMask from "../components/common/LoadingMask";
21
20
  import Login from "../components/common/Login";
22
-
21
+ import { setStoreData } from "../redux/features/common/CommonStoreSlice";
23
22
 
24
23
  const Main = styled("main", {
25
24
  shouldForwardProp: (prop) => prop !== "open",
@@ -104,7 +103,7 @@ export default function Layout() {
104
103
  return (
105
104
  <BrowserRouter>
106
105
  <ToastContainer draggable={true} position="bottom-center" />
107
- <LoadingMask />
106
+ <LoadingMask />
108
107
  {UserSession.value.isAuthenticated === true ? (
109
108
  <Main open={AppLayoutState.sideBarOpened}>
110
109
  <CssBaseline />
@@ -9,6 +9,9 @@ import { SystemRoute } from "../routes/types";
9
9
 
10
10
  const MainContent: React.FC = () => {
11
11
  const AppLayoutState = useSelector((state: RootState) => state.AppLayout);
12
+ const businessRoutes = useSelector(
13
+ (state: RootState) => state.AppInfo.value.businessRoutes
14
+ );
12
15
  return (
13
16
  <CacheProvider
14
17
  value={AppLayoutState.appDirection === "ltr" ? cacheLtr : cacheRtl}
@@ -19,7 +22,7 @@ const MainContent: React.FC = () => {
19
22
  flexDirection: "column",
20
23
  // alignItems: "center",
21
24
  justifyContent: "flex-start",
22
- flex: 1,
25
+ flex: 1,
23
26
  overflow: "hidden",
24
27
  padding: 3,
25
28
  }}
@@ -28,7 +31,16 @@ const MainContent: React.FC = () => {
28
31
  {SYSTEM_ROUTES.map((route: SystemRoute, index) => {
29
32
  return (
30
33
  <Route
31
- key={index}
34
+ key={"adm" + index}
35
+ path={route.path}
36
+ Component={route.component}
37
+ />
38
+ );
39
+ })}
40
+ {businessRoutes.map((route: SystemRoute, index) => {
41
+ return (
42
+ <Route
43
+ key={"bs" + index}
32
44
  path={route.path}
33
45
  Component={route.component}
34
46
  />
@@ -232,6 +232,9 @@ const CustomTreeItem = React.forwardRef(function CustomTreeItem(
232
232
  export default function NavigationTree() {
233
233
  const navigate = useNavigate();
234
234
  const appLayoutState = useSelector((state: RootState) => state.AppLayout);
235
+ const businessNavigationItems = useSelector(
236
+ (state: RootState) => state.AppInfo.value.businessNavigationItems
237
+ );
235
238
  const dispatch = useDispatch();
236
239
  const isMobile = useIsMobile();
237
240
  const { isUserAuthorized } = useSession();
@@ -251,7 +254,12 @@ export default function NavigationTree() {
251
254
  });
252
255
  };
253
256
 
254
- const authoriedNavigationItems = filterData(NavigationItems);
257
+ const mergedNavigationItems = [
258
+ ...NavigationItems,
259
+ ...businessNavigationItems,
260
+ ];
261
+
262
+ const authoriedNavigationItems = filterData(mergedNavigationItems);
255
263
 
256
264
  return (
257
265
  <RichTreeView
@@ -1,4 +1,4 @@
1
- import { CommonStoresInterface } from "../business/CommonStoreSlice";
1
+ import { CommonStoresInterface } from "../common/CommonStoreSlice";
2
2
 
3
3
  export const ADMINISTRATION_STORES: CommonStoresInterface = {
4
4
  SystemDataSourceType: {
@@ -1,4 +1,7 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ import { createSlice, Reducer } from "@reduxjs/toolkit";
2
+ import { SystemRoute } from "../../../routes/types";
3
+ import { ExtendedTreeItemProps } from "../../../navigationItems";
4
+ import { StoreMetaData } from "./CommonStoreSlice";
2
5
 
3
6
  export type AppInfo = {
4
7
  documentTitle: string | null;
@@ -6,6 +9,11 @@ export type AppInfo = {
6
9
  appName: string | null;
7
10
  appVersion: string | null;
8
11
  appLogo: any | null;
12
+ businessRoutes: Array<SystemRoute>;
13
+ businessNavigationItems: Array<ExtendedTreeItemProps>;
14
+ businessReduxReducers: { [key: string]: Reducer<any> };
15
+ businessCommonStoresMetaData: { [key: string]: StoreMetaData };
16
+ muiPremiumKey: string;
9
17
  };
10
18
 
11
19
  export type AppInfoProp = {
@@ -19,6 +27,11 @@ const initialState: AppInfoProp = {
19
27
  appName: null,
20
28
  appVersion: null,
21
29
  appLogo: null,
30
+ muiPremiumKey: null,
31
+ businessRoutes: [],
32
+ businessNavigationItems: [],
33
+ businessReduxReducers: {},
34
+ businessCommonStoresMetaData: {},
22
35
  },
23
36
  };
24
37
 
@@ -1,5 +1,4 @@
1
1
  import { createSlice, PayloadAction } from "@reduxjs/toolkit";
2
- import { BUSINESS_STORES } from "./BusinessStoresMetaData";
3
2
  import { ADMINISTRATION_STORES } from "../administration/AdministrationStoresMetaData";
4
3
 
5
4
  export interface CommonStoresInterface {
@@ -18,14 +17,13 @@ export interface StoreMetaData {
18
17
  authority?: string;
19
18
  }
20
19
 
21
- const initialState: CommonStoresInterface = {
22
- ...BUSINESS_STORES,
20
+ export const commonStoresInitialState: CommonStoresInterface = {
23
21
  ...ADMINISTRATION_STORES,
24
22
  };
25
23
 
26
24
  const commonStoreSlice = createSlice({
27
25
  name: "loadingMask",
28
- initialState,
26
+ initialState: commonStoresInitialState,
29
27
  reducers: {
30
28
  setStoreData(state, action: PayloadAction<setStoreDataProps>) {
31
29
  state[action.payload.storeKey].data = action.payload.data;
@@ -1,18 +1,26 @@
1
- import { configureStore } from "@reduxjs/toolkit";
1
+ import { configureStore, Reducer } from "@reduxjs/toolkit";
2
2
  import AppLayoutReducer from "./features/common/AppLayoutSlice";
3
3
  import UserSessionReducer from "./features/common/UserSessionSlice";
4
4
  import LoadingMaskReducer from "./features/common/LoadingMaskSlice";
5
- import CommonStoreReducer from "./features/business/CommonStoreSlice";
5
+ import CommonStoreReducer from "./features/common/CommonStoreSlice";
6
6
  import AppInfoReducer from "./features/common/AppInfoSlice";
7
7
 
8
+ const reducers = {
9
+ AppLayout: AppLayoutReducer,
10
+ UserSession: UserSessionReducer,
11
+ loadingMask: LoadingMaskReducer,
12
+ commonStores: CommonStoreReducer,
13
+ AppInfo: AppInfoReducer,
14
+ };
15
+
16
+ export function addReducer(key: string, reducer: Reducer<any>) {
17
+ if (!reducers[key]) {
18
+ reducers[key] = reducer;
19
+ }
20
+ }
21
+
8
22
  export const store = configureStore({
9
- reducer: {
10
- AppLayout: AppLayoutReducer,
11
- UserSession: UserSessionReducer,
12
- loadingMask: LoadingMaskReducer,
13
- commonStores: CommonStoreReducer,
14
- AppInfo: AppInfoReducer,
15
- },
23
+ reducer: reducers,
16
24
  });
17
25
 
18
26
  // Infer the `RootState` and `AppDispatch` types from the store itself
@@ -0,0 +1,2 @@
1
+ export * from "./AppUtils";
2
+ export * from "./constants";
@@ -1,3 +0,0 @@
1
- import { CommonStoresInterface } from "./CommonStoreSlice";
2
-
3
- export const BUSINESS_STORES: CommonStoresInterface = {};