@syzy/apphost 1.0.14 → 1.0.16
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/App.d.ts +2 -2
- package/dist/App.js +6 -69
- package/dist/AppHostRoutes.js +10 -10
- package/dist/api/mapping-api.js +4 -4
- package/dist/components/Home/Home.js +9 -10
- package/dist/components/Login/Login.js +2 -2
- package/dist/components/Mappings/ComponentMapping/ComponentRoleMapping.js +12 -7
- package/dist/components/Mappings/MappingForm/MappingForm.js +0 -1
- package/dist/components/api/settings-api.d.ts +1 -1
- package/dist/components/api/settings-api.js +0 -2
- package/dist/config/EnvConfig.d.ts +6 -4
- package/dist/config/EnvConfig.js +6 -4
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/package.json +1 -1
- package/dist/AppHostProvider.d.ts +0 -6
- package/dist/AppHostProvider.js +0 -4
- package/dist/components/NavBar/Sidebar.d.ts +0 -4
- package/dist/components/NavBar/Sidebar.js +0 -56
- package/dist/components/ProfileForm/ProfileForm.d.ts +0 -3
- package/dist/components/ProfileForm/ProfileForm.js +0 -190
- package/dist/components/ProfileForm/ProfileList.d.ts +0 -3
- package/dist/components/ProfileForm/ProfileList.js +0 -33
- package/dist/components/ProfileForm/profileColumns.d.ts +0 -3
- package/dist/components/ProfileForm/profileColumns.js +0 -67
- package/dist/components/ProfileForm/profileSchema.d.ts +0 -52
- package/dist/components/ProfileForm/profileSchema.js +0 -50
- package/dist/components/SettingsPage/SettingsPage.d.ts +0 -3
- package/dist/components/SettingsPage/SettingsPage.js +0 -240
- package/dist/config/amplifyConfig.d.ts +0 -1
- package/dist/config/amplifyConfig.js +0 -45
- package/dist/configureAppHost.d.ts +0 -6
- package/dist/configureAppHost.js +0 -5
- package/dist/hoc/withSyzyAuth.d.ts +0 -2
- package/dist/hoc/withSyzyAuth.js +0 -87
- package/dist/hooks/useCurrentUser.d.ts +0 -3
- package/dist/hooks/useCurrentUser.js +0 -6
- package/dist/hooks/useDispatch.d.ts +0 -3
- package/dist/hooks/useDispatch.js +0 -7
- package/dist/hooks/usePermission.d.ts +0 -1
- package/dist/hooks/usePermission.js +0 -7
- package/dist/services/navigationMenu.d.ts +0 -1
- package/dist/services/navigationMenu.js +0 -9
- package/dist/store/AppAction.d.ts +0 -11
- package/dist/store/AppAction.js +0 -5
- package/dist/store/AppContext.d.ts +0 -3
- package/dist/store/AppContext.js +0 -3
- package/dist/store/AppContextType.d.ts +0 -12
- package/dist/store/AppContextType.js +0 -6
- package/dist/store/AppProvider.d.ts +0 -7
- package/dist/store/AppProvider.js +0 -32
- package/dist/store/HostedInContainerContext.d.ts +0 -5
- package/dist/store/HostedInContainerContext.js +0 -11
- package/dist/store/SesssionReducer.d.ts +0 -4
- package/dist/store/SesssionReducer.js +0 -16
- package/dist/types.d.ts +0 -26
- package/dist/types.js +0 -14
package/dist/App.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const componentMap: Record<string, React.ComponentType<any>>;
|
|
3
|
-
declare
|
|
4
|
-
export default
|
|
3
|
+
declare function App({ isSessionReady }: any): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default App;
|
package/dist/App.js
CHANGED
|
@@ -1,83 +1,20 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
|
|
3
|
-
import { Route, Routes } from 'react-router-dom';
|
|
4
|
-
import { useCurrentUser } from './hooks/useCurrentUser';
|
|
5
|
-
import { withSyzyAuth } from './hoc/withSyzyAuth';
|
|
6
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
7
3
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import ProfileForm from './components/ProfileForm/ProfileForm';
|
|
4
|
+
import LoadingSpinner from './components/Loader/Loader';
|
|
5
|
+
import Home from './components/Home/Home';
|
|
11
6
|
import BranchMapping from './components/Mappings/BranchMapping/Branch';
|
|
12
7
|
import MappingFormBranchUser from './components/Mappings/BranchMapping/MappingFormBranchUser';
|
|
13
8
|
import ComponentRoleMapping from './components/Mappings/ComponentMapping/ComponentRoleMapping';
|
|
14
9
|
import MappingFormUserRole from './components/Mappings/RoleMapping/MappingFormUserRole';
|
|
15
|
-
import Home from './components/Home/Home';
|
|
16
|
-
import LoadingSpinner from './components/Loader/Loader';
|
|
17
|
-
// import { isHostedInContainer } from "./util/hostedinContainer.ts";
|
|
18
|
-
// configureAmplify();
|
|
19
10
|
export const componentMap = {
|
|
20
11
|
BranchMapping,
|
|
21
|
-
ProfileForm,
|
|
22
12
|
MappingFormBranchUser,
|
|
23
13
|
MappingFormUserRole,
|
|
24
14
|
ComponentRoleMapping,
|
|
25
15
|
Home,
|
|
26
16
|
};
|
|
27
|
-
const flattenRoutes = (items) => {
|
|
28
|
-
const flat = [];
|
|
29
|
-
const walk = (arr) => {
|
|
30
|
-
arr.forEach(item => {
|
|
31
|
-
if (item.path && item.requiredComponent) {
|
|
32
|
-
flat.push(item);
|
|
33
|
-
}
|
|
34
|
-
if (item.children) {
|
|
35
|
-
walk(item.children);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
walk(items);
|
|
40
|
-
return flat;
|
|
41
|
-
};
|
|
42
|
-
const withAccessControl = (Component, props, requiredComponent, allowedComponents) => {
|
|
43
|
-
// Check if the user has access
|
|
44
|
-
const isAllowed = !requiredComponent || (allowedComponents?.includes(requiredComponent));
|
|
45
|
-
if (!isAllowed) {
|
|
46
|
-
return () => (_jsx("div", { className: "text-center mt-5", children: _jsx("h3", { className: "text-danger", children: "You are not allowed to see this page." }) }));
|
|
47
|
-
}
|
|
48
|
-
return () => _jsx(Component, { ...props });
|
|
49
|
-
};
|
|
50
17
|
function App({ isSessionReady }) {
|
|
51
|
-
|
|
52
|
-
const [routes, setRoutes] = useState([]);
|
|
53
|
-
const flatRoutes = flattenRoutes(routes);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
const fetchMenu = async () => {
|
|
56
|
-
const data = await getSidebarMenu();
|
|
57
|
-
setRoutes(data);
|
|
58
|
-
};
|
|
59
|
-
fetchMenu();
|
|
60
|
-
}, []);
|
|
61
|
-
// useEffect(() => {
|
|
62
|
-
// isHostedInContainer();
|
|
63
|
-
// }, []);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
const fetchMenu = async () => {
|
|
66
|
-
const data = await getSidebarMenu();
|
|
67
|
-
setRoutes(data);
|
|
68
|
-
};
|
|
69
|
-
fetchMenu();
|
|
70
|
-
}, []);
|
|
71
|
-
// useEffect(() => {
|
|
72
|
-
// isHostedInContainer();
|
|
73
|
-
// configureAmplify();
|
|
74
|
-
// }, []);
|
|
75
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { display: "flex", width: "100%" }, children: [_jsx(Sidebar, {}), _jsx("div", { style: { flex: 1, padding: "10px" }, children: !isSessionReady ? (_jsx(LoadingSpinner, {})) : (_jsx(React.Fragment, { children: _jsxs(Routes, { children: [flatRoutes.map(({ path, requiredComponent, props }) => {
|
|
76
|
-
const PageComponent = componentMap[requiredComponent];
|
|
77
|
-
if (!PageComponent)
|
|
78
|
-
return null;
|
|
79
|
-
const ProtectedComponent = withAccessControl(PageComponent, props, requiredComponent, user.allowedComponents);
|
|
80
|
-
return _jsx(Route, { path: path, element: _jsx(ProtectedComponent, {}) }, path);
|
|
81
|
-
}), _jsx(Route, { path: "*", element: _jsx("h3", { className: "text-danger", children: "Page Not Found" }) })] }) })) })] }), _jsx(ReactQueryDevtools, { initialIsOpen: false })] }));
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { style: { display: "flex", width: "100%" }, children: _jsx("div", { style: { flex: 1, padding: "10px" }, children: !isSessionReady ? (_jsx(LoadingSpinner, {})) : (_jsx(React.Fragment, {})) }) }), _jsx(ReactQueryDevtools, { initialIsOpen: false })] }));
|
|
82
19
|
}
|
|
83
|
-
export default
|
|
20
|
+
export default App;
|
package/dist/AppHostRoutes.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Routes, Route } from "react-router-dom";
|
|
3
3
|
// import Home from "./components/Home/Home";
|
|
4
|
-
import ProfileForm from "./components/ProfileForm/ProfileForm";
|
|
5
|
-
|
|
4
|
+
// import ProfileForm from "./components/ProfileForm/ProfileForm";
|
|
5
|
+
import LoginForm from "./components/Login/Login";
|
|
6
6
|
// import BranchMapping from "./components/Mappings/BranchMapping/Branch";
|
|
7
7
|
// import MappingFormBranchUser from "./components/Mappings/BranchMapping/MappingFormBranchUser";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import ComponentRoleMapping from "./components/Mappings/ComponentMapping/ComponentRoleMapping";
|
|
9
|
+
import MappingFormUserRole from "./components/Mappings/RoleMapping/MappingFormUserRole";
|
|
10
10
|
export const AppHostRoutes = () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return (
|
|
11
|
+
const handleLogin = (isLoggedIn) => {
|
|
12
|
+
// Handle login logic here
|
|
13
|
+
console.log("User logged in:", isLoggedIn);
|
|
14
|
+
};
|
|
15
|
+
return (_jsxs(Routes, { children: [_jsx(Route, { path: "/apphost/login-form", element: _jsx(LoginForm, { login: handleLogin }) }), _jsx(Route, { path: "/apphost/mapping-user-role", element: _jsx(MappingFormUserRole, {}) }), _jsx(Route, { path: "/apphost/component-role-mapping", element: _jsx(ComponentRoleMapping, {}) })] }));
|
|
16
16
|
};
|
package/dist/api/mapping-api.js
CHANGED
|
@@ -14,7 +14,7 @@ import { Status } from "../domain/type/StatusEnum";
|
|
|
14
14
|
export const MAPPING_RESOURCE = "mapping";
|
|
15
15
|
export const GET_MAPPING_BY_USERID_QUERYKEY = "mappingbyuserid";
|
|
16
16
|
export const LIST_BRANCHES_RESOURCE = "branches";
|
|
17
|
-
const endpoint = EnvConfig.
|
|
17
|
+
const endpoint = EnvConfig.hmsAPi;
|
|
18
18
|
export const transformtoMappingDto = (mappingData) => {
|
|
19
19
|
logger.info("transform to MappingDto:", mappingData);
|
|
20
20
|
const { __typename, createdAt, updatedAt, ...itm } = mappingData;
|
|
@@ -367,7 +367,7 @@ export const useUpdateBranchMutation = () => {
|
|
|
367
367
|
});
|
|
368
368
|
};
|
|
369
369
|
export const fetchBranchUserMappings = async (branchesMap) => {
|
|
370
|
-
const endpoint = EnvConfig.
|
|
370
|
+
const endpoint = EnvConfig.hmsAPi;
|
|
371
371
|
const client = await Client.getCustomGraphqlClient(endpoint);
|
|
372
372
|
const response = await client.request(ListBranchUserMappings);
|
|
373
373
|
return response.listMapping.map((m) => {
|
|
@@ -385,7 +385,7 @@ export const fetchBranchUserMappings = async (branchesMap) => {
|
|
|
385
385
|
});
|
|
386
386
|
};
|
|
387
387
|
export const fetchUserRoleMappings = async () => {
|
|
388
|
-
const endpoint = EnvConfig.
|
|
388
|
+
const endpoint = EnvConfig.hmsAPi;
|
|
389
389
|
const client = await Client.getCustomGraphqlClient(endpoint);
|
|
390
390
|
const response = await client.request(ListUserRoleMapping);
|
|
391
391
|
return response.listMapping.map(m => ({
|
|
@@ -402,7 +402,7 @@ export const useUserRoleMappings = () => {
|
|
|
402
402
|
});
|
|
403
403
|
};
|
|
404
404
|
export const fetchComponentRoleMappings = async () => {
|
|
405
|
-
const client = await Client.getCustomGraphqlClient(EnvConfig.
|
|
405
|
+
const client = await Client.getCustomGraphqlClient(EnvConfig.hmsAPi);
|
|
406
406
|
const response = await client.request(ListComponentRoleMappings);
|
|
407
407
|
return response.listMapping.map((m) => {
|
|
408
408
|
const transformed = transformtoMappingDto(m);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const ReservationCount = React.lazy(() => import("bookingUIApp/ReservationCount"));
|
|
2
|
+
// import { EnvConfig } from "../../config/EnvConfig";
|
|
3
|
+
// import AppContext from "../../store/AppContext";
|
|
4
|
+
// const appName = EnvConfig.applicationName || "Application";
|
|
5
|
+
// const ReservationCount = React.lazy(() => import("bookingUIApp/ReservationCount"));
|
|
7
6
|
const Home = () => {
|
|
8
|
-
const { user } = useContext(AppContext) ?? { user: undefined };
|
|
9
|
-
const rawBranch = user?.branchId ?? "";
|
|
10
|
-
const parts = rawBranch.split("#");
|
|
11
|
-
const branchId = parts[1];
|
|
12
|
-
return (_jsxs("div", { className: "d-fle justify-content-center align-items-center h-100 flex-wrap", children: [_jsx("div", { className: "px-3 w-100 col-12"
|
|
7
|
+
// const { user } = useContext(AppContext) ?? { user: undefined };
|
|
8
|
+
// const rawBranch = user?.branchId ?? "";
|
|
9
|
+
// const parts = rawBranch.split("#");
|
|
10
|
+
// const branchId = parts[1];
|
|
11
|
+
return (_jsxs("div", { className: "d-fle justify-content-center align-items-center h-100 flex-wrap", children: [_jsx("div", { className: "px-3 w-100 col-12" }), _jsx("div", { className: "h-75 d-flex justify-content-center align-items-center", children: _jsxs("div", { className: "text-center", children: [_jsx("h2", { className: "fw-bold", children: " Dash Board" }), _jsx("br", {}), _jsx("h5", { children: "\uD83D\uDC4B Welcome To! \uD83D\uDE42" })] }) })] }));
|
|
13
12
|
};
|
|
14
13
|
export default Home;
|
|
@@ -6,7 +6,7 @@ import { toast } from "react-toastify";
|
|
|
6
6
|
import "react-toastify/dist/ReactToastify.css";
|
|
7
7
|
import { useNavigate } from "react-router-dom";
|
|
8
8
|
import { FaEye, FaEyeSlash } from "react-icons/fa";
|
|
9
|
-
import logo from "../../../src/assets/images/Hotel-Logo.jpg"
|
|
9
|
+
// import logo from "../../../src/assets/images/Hotel-Logo.jpg"
|
|
10
10
|
import { signIn, signUp, confirmSignUp, confirmResetPassword, getCurrentUser, confirmSignIn, resetPassword } from "aws-amplify/auth";
|
|
11
11
|
import { signInSchema, registerSchema, confirmSignUpSchema, resetPasswordSchema, forceResetSchema, forgotPasswordSchema, } from "./loginSchema";
|
|
12
12
|
import { ALL, HIDE_SIGN_UP, HIDE_SIGN_UP_IS_NO } from "../../static/constants";
|
|
@@ -143,7 +143,7 @@ const LoginForm = ({ login }) => {
|
|
|
143
143
|
const isPassword = type === "password";
|
|
144
144
|
return (_jsxs("div", { className: "mb-3 position-relative", children: [_jsxs("div", { className: "input-group", children: [_jsx("input", { type: isPassword ? (showPassword ? "text" : "password") : type, placeholder: label, ...register(name), className: `form-control ${errors[name] ? "is-invalid" : ""}` }), isPassword && (_jsx("span", { className: "input-group-text bg-white", style: { cursor: "pointer" }, onClick: () => setShowPassword((prev) => !prev), children: showPassword ? _jsx(FaEye, { size: 18 }) : _jsx(FaEyeSlash, { size: 18 }) }))] }), errors[name] && (_jsx("div", { className: "invalid-feedback d-block", children: errors[name]?.message }))] }));
|
|
145
145
|
};
|
|
146
|
-
return (_jsx("div", { className: "d-flex justify-content-center align-items-center vh-100 bg-light", children: _jsx("div", { className: "card shadow-sm p-4 p-md-5 w-100", style: { maxWidth: "420px" }, children: _jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [_jsx("div", { className: "d-flex justify-content-center", children: _jsx("img", { className: "w-75 mx-auto mb-4", src: logo }) }), _jsxs("h4", { className: "text-center mb-4 fw-bold", children: [authMode === "signin" && "Sign in to your account", authMode === "register" && "Create a new account", authMode === "confirm" && "Verify your email", authMode === "forgot" && "Forgot Password?", authMode === "reset" && "Reset Password", authMode === "forceReset" && "Set New Password"] }), authMode === "signin" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), renderInput("Password", "password", "password"), _jsx("button", { type: "submit", className: "btn btn-primary w-100 mb-2", children: "Sign In" }), _jsxs("div", { className: "d-flex justify-content-between", children: [(settingsByPkAndSk && settingsByPkAndSk?.value === HIDE_SIGN_UP_IS_NO) &&
|
|
146
|
+
return (_jsx("div", { className: "d-flex justify-content-center align-items-center vh-100 bg-light", children: _jsx("div", { className: "card shadow-sm p-4 p-md-5 w-100", style: { maxWidth: "420px" }, children: _jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [_jsx("div", { className: "d-flex justify-content-center", children: _jsx("img", { className: "w-75 mx-auto mb-4", src: "logo" }) }), _jsxs("h4", { className: "text-center mb-4 fw-bold", children: [authMode === "signin" && "Sign in to your account", authMode === "register" && "Create a new account", authMode === "confirm" && "Verify your email", authMode === "forgot" && "Forgot Password?", authMode === "reset" && "Reset Password", authMode === "forceReset" && "Set New Password"] }), authMode === "signin" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), renderInput("Password", "password", "password"), _jsx("button", { type: "submit", className: "btn btn-primary w-100 mb-2", children: "Sign In" }), _jsxs("div", { className: "d-flex justify-content-between", children: [(settingsByPkAndSk && settingsByPkAndSk?.value === HIDE_SIGN_UP_IS_NO) &&
|
|
147
147
|
_jsx("button", { type: "button", className: "btn btn-link p-0", onClick: () => setAuthMode("register"), children: "Create Account" }), _jsx("button", { type: "button", className: "btn btn-link p-0", onClick: () => setAuthMode("forgot"), children: "Forgot Password?" })] })] })), authMode === "register" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), renderInput("Email", "email", "email"), renderInput("Password", "password", "password"), renderInput("Confirm Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Register" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "confirm" && (_jsxs(_Fragment, { children: [renderInput("Verification Code", "text", "confirmationCode"), _jsx("button", { type: "submit", className: "btn btn-primary w-100 mb-2", children: "Confirm" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "forgot" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), _jsx("button", { type: "submit", className: "btn btn-warning w-100 mb-2", children: "Send Reset Code" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "reset" && (_jsxs(_Fragment, { children: [renderInput("Verification Code", "text", "confirmationCode"), renderInput("New Password", "password", "password"), renderInput("Confirm New Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Reset Password" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "forceReset" && (_jsxs(_Fragment, { children: [renderInput("New Password", "password", "password"), renderInput("Confirm New Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Update Password" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] }))] }) }) }));
|
|
148
148
|
};
|
|
149
149
|
export default LoginForm;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import MappingForm from "../MappingForm/MappingForm";
|
|
4
4
|
import FormModal from "../../common/Modal/Modal";
|
|
5
5
|
import ListTable from "../../common/ListTable/ListTable";
|
|
6
6
|
import { toast } from "react-toastify";
|
|
7
7
|
import { MappingTypes } from "../../../domain/type/MappingTypes";
|
|
8
|
-
import { getCompoMappingByRoleIdAndCompoIdFun, useCreateMappingMutation, useListComponentRoleMappings, useUpdateMappingMutation, } from "../../../api/mapping-api";
|
|
8
|
+
import { getCompoMappingByRoleIdAndCompoIdFun, useCreateMappingMutation, useListComponentRoleMappings, useListProfiles, useUpdateMappingMutation, } from "../../../api/mapping-api";
|
|
9
9
|
import { EntityTypes } from "../../../domain/type/EntityTypes";
|
|
10
10
|
import { Status } from "../../../domain/type/StatusEnum";
|
|
11
11
|
import { SyzyDate } from "../../../util/SyzyDate";
|
|
12
12
|
import { DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM_SS } from "../../../util/dateUtils";
|
|
13
|
-
import AppContext from "../../../store/AppContext";
|
|
14
13
|
import { logger } from "../../../util/Logger";
|
|
15
14
|
import { componentMap } from "../../../App";
|
|
16
15
|
import { roles } from "../RoleMapping/MappingFormUserRole";
|
|
@@ -19,8 +18,7 @@ import ListHeader from "../../common/ListTable/ListHeader";
|
|
|
19
18
|
import { ToastContainer } from "react-toastify";
|
|
20
19
|
/* ---------------- Component Role Mapping ---------------- */
|
|
21
20
|
const ComponentRoleMappingPage = () => {
|
|
22
|
-
const
|
|
23
|
-
const loggedInUserName = user?.userName;
|
|
21
|
+
const [users, setUsers] = useState([]);
|
|
24
22
|
const [showModal, setShowModal] = useState(false);
|
|
25
23
|
const [editingRow, setEditingRow] = useState();
|
|
26
24
|
const currentISODate = new SyzyDate().toDateFormatString(DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM_SS);
|
|
@@ -28,6 +26,12 @@ const ComponentRoleMappingPage = () => {
|
|
|
28
26
|
const createMappingMutation = useCreateMappingMutation();
|
|
29
27
|
const updateMappingMutation = useUpdateMappingMutation();
|
|
30
28
|
const tableLoading = isLoading || createMappingMutation.isPending || updateMappingMutation.isPending;
|
|
29
|
+
const { data: profiles } = useListProfiles();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (profiles) {
|
|
32
|
+
setUsers(profiles.map((p) => ({ id: p.sk, name: p.name })));
|
|
33
|
+
}
|
|
34
|
+
}, [profiles]);
|
|
31
35
|
/* ---------------- Component Options ---------------- */
|
|
32
36
|
const components = useMemo(() => Object.keys(componentMap).map((key, index) => ({
|
|
33
37
|
id: `Component#${String(index + 1).padStart(2, "0")}`,
|
|
@@ -46,9 +50,10 @@ const ComponentRoleMappingPage = () => {
|
|
|
46
50
|
const handleSubmit = async (mappings) => {
|
|
47
51
|
try {
|
|
48
52
|
for (const map of mappings) {
|
|
53
|
+
const user = users.find(u => u.id === map.sourceId);
|
|
49
54
|
const role = roles.find(r => r.id === map.targetId);
|
|
50
55
|
const component = components.find(c => c.id === map.sourceId);
|
|
51
|
-
if (!
|
|
56
|
+
if (!user || !role || !component)
|
|
52
57
|
continue;
|
|
53
58
|
const payload = {
|
|
54
59
|
pk: role.id,
|
|
@@ -62,7 +67,7 @@ const ComponentRoleMappingPage = () => {
|
|
|
62
67
|
componentTitle: component.name,
|
|
63
68
|
status: map.status,
|
|
64
69
|
createdDt: editingRow?.createdDt || currentISODate,
|
|
65
|
-
createdBy:
|
|
70
|
+
createdBy: `${user.id}#${user.name}`,
|
|
66
71
|
disabledDt: map.status === Status.Inactive ? currentISODate : "",
|
|
67
72
|
};
|
|
68
73
|
const existing = await getCompoMappingByRoleIdAndCompoIdFun(payload.pk, payload.sk);
|
|
@@ -6,7 +6,6 @@ import { useForm } from "react-hook-form";
|
|
|
6
6
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
7
7
|
import { statusOptions } from "../../../domain/type/statusOptions";
|
|
8
8
|
import { Status } from "../../../domain/type/StatusEnum";
|
|
9
|
-
// import '../../../styles/button.css';
|
|
10
9
|
import { mappingFormSchema } from "./mappingSchema";
|
|
11
10
|
import FormActionButtons from "../../common/Form/FormActionButtons";
|
|
12
11
|
import FormLabel from "../../common/Form/FormLabel";
|
|
@@ -23,4 +23,4 @@ export declare const useGetSettingsByPkAndSk: (pk: string, sk: string) => {
|
|
|
23
23
|
settingsByPkAndSkFetching: boolean;
|
|
24
24
|
settingsByPkAndSkSuccess: boolean;
|
|
25
25
|
};
|
|
26
|
-
export declare const useUpdateSettingsMutation: () => import("@tanstack/react-query").UseMutationResult<
|
|
26
|
+
export declare const useUpdateSettingsMutation: () => import("@tanstack/react-query").UseMutationResult<any, Error, SettingsDto, unknown>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
-
import { EnvConfig } from "../../config/EnvConfig";
|
|
3
2
|
import { initSettings } from "../../domain/model/SettingsDto";
|
|
4
|
-
import { Client } from "../../services/Client.Service";
|
|
5
3
|
import { transformToData } from "../../util/transformToData";
|
|
6
4
|
import { logger } from "../../util/Logger";
|
|
7
5
|
import { ALL } from "../../static/constants";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export declare const EnvConfig: {
|
|
2
2
|
env: any;
|
|
3
|
-
|
|
3
|
+
bookingAPi: any;
|
|
4
|
+
hmsAPi: any;
|
|
4
5
|
region: any;
|
|
5
6
|
userPoolId: any;
|
|
6
7
|
userPoolClientId: any;
|
|
7
8
|
identityPoolId: any;
|
|
8
9
|
storage: any;
|
|
9
|
-
apiKey: any;
|
|
10
|
-
template: any;
|
|
11
10
|
imageStorageBucketUrl: any;
|
|
12
|
-
|
|
11
|
+
keyId: any;
|
|
12
|
+
recordLimit: any;
|
|
13
|
+
authMode: any;
|
|
14
|
+
apiKey: any;
|
|
13
15
|
};
|
package/dist/config/EnvConfig.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export const EnvConfig = {
|
|
2
2
|
env: import.meta.env.VITE_SERVER_ENV || "local",
|
|
3
|
-
|
|
3
|
+
bookingAPi: import.meta.env.VITE_BOOKING_SERVICE_SERVER_URL || "",
|
|
4
|
+
hmsAPi: import.meta.env.VITE_HMS_SERVICE_SERVER_URL || "",
|
|
4
5
|
region: import.meta.env.VITE_AWS_REGION || "",
|
|
5
6
|
userPoolId: import.meta.env.VITE_USERPOOL_ID || "",
|
|
6
7
|
userPoolClientId: import.meta.env.VITE_USERPOOL_CLIENT_ID || "",
|
|
7
8
|
identityPoolId: import.meta.env.VITE_IDPOOL_ID || "",
|
|
8
9
|
storage: import.meta.env.VITE_STORAGE_NAME || "",
|
|
9
|
-
apiKey: import.meta.env.VITE_API_KEY || undefined,
|
|
10
|
-
template: import.meta.env.VITE_TEMPLATE || undefined,
|
|
11
10
|
imageStorageBucketUrl: import.meta.env.VITE_IMAGE_STORAGE_BUCKET_URL || "",
|
|
12
|
-
|
|
11
|
+
keyId: import.meta.env.VITE_KEY_ID || "",
|
|
12
|
+
recordLimit: import.meta.env.VITE_RECORD_LIMIT || 1000,
|
|
13
|
+
authMode: import.meta.env.VITE_API_AUTHMODE,
|
|
14
|
+
apiKey: import.meta.env.VITE_API_KEY || undefined,
|
|
13
15
|
};
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.btn-primary-global:disabled{pointer-events:none;opacity:.6;cursor:not-allowed}.mapping-form .mapping-sections{display:flex}.mapping-form label,.branch-form label{font-weight:600;margin-bottom:.5rem}.mapping-form .mapping-submit-btn{align-self:flex-start;margin-top:1rem;margin-inline-end:10px;width:100px;background-color:#009e9c;color:#fff;padding:5px 10px;border:none;border-radius:10px;cursor:pointer;transition:background-color .3s ease,transform .2s ease}.mapping-form .mapping-submit-btn:hover{background-color:#009e9c;color:#fff}.mapping-form .mapping-submit-btn:active{background-color:#009e9c;color:#fff;transform:scale(.95)}.mapping-form .mapping-clear-btn{align-self:flex-start;margin-top:1rem;margin-inline-start:10px;width:100px;background:#1d2d52;color:#fff;padding:5px 10px;border:none;border-radius:10px;cursor:pointer;transition:background-color .3s ease,transform .2s ease}.mapping-form .mapping-clear-btn:hover{background:#1d2d52;color:#fff}.mapping-form .mapping-clear-btn:active{background:#1d2d52;color:#fff;transform:scale(.95)}@media (min-width: 320px) and (max-width: 576px){.mapping-select .rs__control,.mapping-select .rs__menu{font-size:12px}.mapping-form .mapping-submit-btn,.mapping-form .mapping-clear-btn{font-size:13px}.mapping-form input,.branch-form input{padding:4px 7px}.branch-form input::placeholder,.mapping-form input::placeholder{font-size:14px}}@media (min-width: 577px) and (max-width: 768px){.mapping-select .rs__control,.mapping-select .rs__menu{font-size:13px}.mapping-form .mapping-submit-btn,.mapping-form .mapping-clear-btn{font-size:14px}.mapping-form,.branch-form{padding:10px}.mapping-form input,.branch-form input{padding:6px 7px}.branch-form input::placeholder,.mapping-form input::placeholder{font-size:14px}}@media (min-width: 769px) and (max-width: 1024px){.mapping-select .rs__control,.mapping-select .rs__menu{font-size:15px}.mapping-form .mapping-submit-btn{font-size:16px}.mapping-form .mapping-clear-btn{font-size:14px}}
|
|
1
|
+
:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.btn-primary-global{color:var(--color-white);background-color:Var(--color-martinique);font-weight:var(--font-weight-500);font-size:var(--font-size-16px);border:none;margin-inline-end:10px;margin-top:20px;padding:6px 22px;border-radius:6px;cursor:pointer;transition:all .2s ease-in-out}.btn-primary-global:hover{color:var(--color-white);background-color:var(--hover-color-martinique)}.btn-primary-global:active{transform:scale(.96);background-color:var(--active-color-martinique)}.btn-secondary-global{color:var(--color-white);background-color:var(--color-black);font-weight:var(--font-weight-500);font-size:var(--font-size-16px);border:none;margin-inline-start:10px;margin-top:20px;padding:6px 22px;border-radius:6px;cursor:pointer;transition:all .2s ease-in-out}.btn-secondary-global:hover{color:var(--color-white);background-color:var(--hover-color-black)}.btn-secondary-global:active{transform:scale(.96);background-color:var(--active-color-black)}@media (max-width: 576px){.btn-primary-global,.btn-secondary-global{font-size:var(--font-size-12px);padding:5px 14px;margin-top:12px}}@media (min-width: 577px) and (max-width: 768px){.btn-primary-global,.btn-secondary-global{font-size:var(--font-size-14px);padding:5px 16px}}@media (min-width: 769px) and (max-width: 992px){.btn-primary-global,.btn-secondary-global{font-size:var(--font-size-14px);padding:6px 20px}}@media (min-width: 993px) and (max-width: 1200px){.btn-primary-global,.btn-secondary-global{font-size:var(--font-size-16px);padding:7px 22px}}@media (min-width: 1201px){.btn-primary-global,.btn-secondary-global{font-size:var(--font-size-18px);padding:8px 24px}}.btn-primary-global:disabled{pointer-events:none;opacity:.6;cursor:not-allowed}.mapping-form .mapping-sections{display:flex}.mapping-form label,.branch-form label{font-weight:600;margin-bottom:.5rem}.mapping-form .mapping-submit-btn{align-self:flex-start;margin-top:1rem;margin-inline-end:10px;width:100px;background-color:#009e9c;color:#fff;padding:5px 10px;border:none;border-radius:10px;cursor:pointer;transition:background-color .3s ease,transform .2s ease}.mapping-form .mapping-submit-btn:hover{background-color:#009e9c;color:#fff}.mapping-form .mapping-submit-btn:active{background-color:#009e9c;color:#fff;transform:scale(.95)}.mapping-form .mapping-clear-btn{align-self:flex-start;margin-top:1rem;margin-inline-start:10px;width:100px;background:#1d2d52;color:#fff;padding:5px 10px;border:none;border-radius:10px;cursor:pointer;transition:background-color .3s ease,transform .2s ease}.mapping-form .mapping-clear-btn:hover{background:#1d2d52;color:#fff}.mapping-form .mapping-clear-btn:active{background:#1d2d52;color:#fff;transform:scale(.95)}@media (min-width: 320px) and (max-width: 576px){.mapping-select .rs__control,.mapping-select .rs__menu{font-size:12px}.mapping-form .mapping-submit-btn,.mapping-form .mapping-clear-btn{font-size:13px}.mapping-form input,.branch-form input{padding:4px 7px}.branch-form input::placeholder,.mapping-form input::placeholder{font-size:14px}}@media (min-width: 577px) and (max-width: 768px){.mapping-select .rs__control,.mapping-select .rs__menu{font-size:13px}.mapping-form .mapping-submit-btn,.mapping-form .mapping-clear-btn{font-size:14px}.mapping-form,.branch-form{padding:10px}.mapping-form input,.branch-form input{padding:6px 7px}.branch-form input::placeholder,.mapping-form input::placeholder{font-size:14px}}@media (min-width: 769px) and (max-width: 1024px){.mapping-select .rs__control,.mapping-select .rs__menu{font-size:15px}.mapping-form .mapping-submit-btn{font-size:16px}.mapping-form .mapping-clear-btn{font-size:14px}}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/dist/AppHostProvider.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
3
|
-
import { NavLink, useNavigate } from "react-router-dom";
|
|
4
|
-
import { getSidebarMenu } from "../../services/navigationMenu";
|
|
5
|
-
import { Link } from "react-router-dom";
|
|
6
|
-
import './sidebar.css';
|
|
7
|
-
import { useDispatch } from "../../hooks/useDispatch";
|
|
8
|
-
import { signOut } from "aws-amplify/auth";
|
|
9
|
-
import { AppActionEnum } from "../../store/AppAction";
|
|
10
|
-
import { RiLogoutBoxLine } from "react-icons/ri";
|
|
11
|
-
import { FaArrowRight } from "react-icons/fa";
|
|
12
|
-
import { FaArrowLeft } from "react-icons/fa";
|
|
13
|
-
import { FaChevronDown, FaChevronUp } from "react-icons/fa";
|
|
14
|
-
import * as FA from "react-icons/fa";
|
|
15
|
-
import * as FA6 from "react-icons/fa6";
|
|
16
|
-
import * as IO from "react-icons/io5";
|
|
17
|
-
import * as IO4 from "react-icons/io";
|
|
18
|
-
import * as RI from "react-icons/ri";
|
|
19
|
-
const iconPacks = { FA, FA6, IO, IO4, RI };
|
|
20
|
-
const Sidebar = () => {
|
|
21
|
-
const navigate = useNavigate();
|
|
22
|
-
const { dispatch } = useDispatch();
|
|
23
|
-
const [menus, setMenus] = useState([]);
|
|
24
|
-
const [activeMenu, setActiveMenu] = useState(null);
|
|
25
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
26
|
-
const handleToggle = () => {
|
|
27
|
-
setIsExpanded(prevState => !prevState);
|
|
28
|
-
};
|
|
29
|
-
const handleMenuClick = (menu) => {
|
|
30
|
-
setActiveMenu(prevMenu => (prevMenu === menu ? null : menu));
|
|
31
|
-
};
|
|
32
|
-
const signOutFn = async () => {
|
|
33
|
-
await signOut({ global: true });
|
|
34
|
-
dispatch({ type: AppActionEnum.SignOut });
|
|
35
|
-
navigate("/");
|
|
36
|
-
};
|
|
37
|
-
const getIcon = (iconName, pack = "FA") => {
|
|
38
|
-
const library = iconPacks[pack] || FA;
|
|
39
|
-
return library[iconName] ? React.createElement(library[iconName]) : null;
|
|
40
|
-
};
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const fetchMenu = async () => {
|
|
43
|
-
const data = await getSidebarMenu();
|
|
44
|
-
setMenus(data);
|
|
45
|
-
};
|
|
46
|
-
fetchMenu();
|
|
47
|
-
}, []);
|
|
48
|
-
return (_jsx(_Fragment, { children: _jsx("div", { className: "wrapper", children: _jsxs("aside", { id: "sidebar", className: isExpanded ? '' : 'expand', children: [_jsxs("div", { children: [_jsx("button", { type: "button", className: "toggle-btn", onClick: handleToggle, children: isExpanded ? _jsx(FaArrowRight, { className: 'icon' }) : _jsx(FaArrowLeft, { className: 'icon' }) }), _jsx("div", { className: "sidebar-logo", children: _jsxs("div", { children: [_jsx(Link, { to: '/', children: "HMS" }), _jsx("br", {}), _jsx("span", { children: "Salem" })] }) })] }), _jsxs("ul", { className: "sidebar-nav", children: [menus.map((menu, index) => (_jsx("li", { className: "sidebar-item", children: menu.children && menu.children.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Link, { to: menu.children[0].path, className: `d-flex justify-content-between sidebar-link has-dropdown ${menu.children.some((child) => location.pathname.startsWith(child.path))
|
|
49
|
-
? "active" : ""}`, onClick: (e) => {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
handleMenuClick(menu.title);
|
|
52
|
-
}, "aria-controls": `menu-${index}`, children: [_jsxs("div", { children: [_jsx("span", { className: "icon", children: getIcon(menu.icon, menu.iconPack) }), _jsx("span", { className: "label", children: menu.title })] }), _jsx("span", { className: "arrow-icon d-flex justify-content-center align-items-center", children: activeMenu === menu.title ? _jsx(FaChevronUp, {}) : _jsx(FaChevronDown, {}) })] }), _jsx("ul", { id: `menu-${index}`, className: `sidebar-dropdown list-unstyled ${activeMenu === menu.title ? "show" : "collapse"}`, children: menu.children.map((child, cIndex) => (_jsx("li", { className: "sidebar-item", children: _jsx(Link, { to: child.path, className: `sidebar-link ${location.pathname === child.path ? "active-child" : ""}`, children: _jsx("span", { className: "label test", children: child.title }) }) }, cIndex))) })] })) : (
|
|
53
|
-
// Normal single-level item
|
|
54
|
-
_jsxs(NavLink, { to: menu.path, className: ({ isActive }) => `sidebar-link d-flex align-items-center ${isActive ? "active-link" : ""}`, children: [_jsx("div", { className: "icon", children: getIcon(menu.icon, menu.iconPack) }), _jsx("div", { className: "label", children: menu.title })] })) }, index))), _jsx("li", { className: "sidebar-item", children: _jsxs(Link, { to: '/', className: "sidebar-link", onClick: signOutFn, children: [_jsx(RiLogoutBoxLine, { className: 'log-icon' }), _jsx("span", { className: "label", children: "Logout" })] }) })] })] }) }) }));
|
|
55
|
-
};
|
|
56
|
-
export default Sidebar;
|