sevago-sso-fe 1.0.9 → 1.0.10

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.esm.js CHANGED
@@ -2,7 +2,7 @@ import { persistReducer, FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER, pers
2
2
  import { createAsyncThunk, createSlice, configureStore, combineReducers } from "@reduxjs/toolkit";
3
3
  import { useDispatch, useSelector } from "react-redux";
4
4
  import * as React from "react";
5
- import React__default, { useMemo, createContext, useContext, useState, useEffect, useCallback, forwardRef, useImperativeHandle, createElement, Children, useRef, useLayoutEffect, Fragment as Fragment$1, useId, useInsertionEffect, Component as Component$1 } from "react";
5
+ import React__default, { useMemo, useState, createContext, useContext, useEffect, useCallback, forwardRef, useImperativeHandle, createElement, Children, useRef, useLayoutEffect, Fragment as Fragment$1, useId, useInsertionEffect, Component as Component$1 } from "react";
6
6
  import { useLocation, useNavigate, Outlet, Route, Navigate } from "react-router-dom";
7
7
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
8
8
  import { Stack as Stack$1, styled as styled$2, TableCell, tableCellClasses, LinearProgress, linearProgressClasses, useTheme as useTheme$2, Skeleton, Box, Icon, Tooltip, tooltipClasses, Avatar, Typography, ClickAwayListener, Fade, Badge, List, ListItem, FormControl, InputLabel, RadioGroup, FormControlLabel, Radio, Menu, Divider, MenuItem, Button, IconButton, TextField, InputAdornment } from "@mui/material";
@@ -12788,8 +12788,10 @@ const truncateText = (text, maxLength = 27) => {
12788
12788
  return `${text.substring(0, maxLength)}...`;
12789
12789
  };
12790
12790
  const timeUtils = timeUtilsMethods;
12791
- const useApps = (tab) => {
12792
- const userType = useSelector((state) => state.account.user?.type);
12791
+ const useApps = (tab = AppCategory.ALL) => {
12792
+ const userType = useSelector(
12793
+ (state) => state.account.user?.type
12794
+ );
12793
12795
  const listApp = useMemo(() => {
12794
12796
  let filteredApps = SYSTEM_MODULES.filter((app2) => {
12795
12797
  return app2.allowUserTypes.includes(userType);
@@ -12806,8 +12808,21 @@ const useIsSystemMonitor = () => {
12806
12808
  const normalize = (p) => p.replace(/\/+$/, "");
12807
12809
  return normalize(location2.pathname) === normalize(PAGE.DASHBOARD.path);
12808
12810
  };
12811
+ const useAllApps = () => {
12812
+ const userType = useSelector(
12813
+ (state) => state.account.user?.type
12814
+ );
12815
+ const allApps = useMemo(() => {
12816
+ return SYSTEM_MODULES.filter((app2) => {
12817
+ return app2.allowUserTypes.includes(userType);
12818
+ });
12819
+ }, [userType]);
12820
+ return allApps;
12821
+ };
12809
12822
  const useActiveSidebar = () => {
12810
- const { user, current_access } = useSelector((state) => state.account);
12823
+ const { user, current_access } = useSelector(
12824
+ (state) => state.account
12825
+ );
12811
12826
  const activeSidebar = useMemo(() => {
12812
12827
  return SYSTEM_MODULES.find(
12813
12828
  (it) => it.key === current_access && user && (it.allowUserTypes ? it.allowUserTypes.includes(user?.type) : true)
@@ -12815,6 +12830,18 @@ const useActiveSidebar = () => {
12815
12830
  }, [current_access, user]);
12816
12831
  return activeSidebar;
12817
12832
  };
12833
+ const useSidebarState = () => {
12834
+ const [isSidebarOpen, setIsSidebarOpen] = useState(false);
12835
+ const openSidebar = () => setIsSidebarOpen(true);
12836
+ const closeSidebar = () => setIsSidebarOpen(false);
12837
+ const toggleSidebar = () => setIsSidebarOpen((prev) => !prev);
12838
+ return {
12839
+ isSidebarOpen,
12840
+ openSidebar,
12841
+ closeSidebar,
12842
+ toggleSidebar
12843
+ };
12844
+ };
12818
12845
  var propTypes = { exports: {} };
12819
12846
  var reactIs$2 = { exports: {} };
12820
12847
  var reactIs_production_min$1 = {};
@@ -19145,7 +19172,9 @@ const MonitorPart = ({
19145
19172
  }
19146
19173
  );
19147
19174
  };
19148
- const DashboardLayout = ({ children }) => {
19175
+ const DashboardLayout = ({
19176
+ children
19177
+ }) => {
19149
19178
  useUpdateCurrentAccess();
19150
19179
  return /* @__PURE__ */ jsx(MonitorPart, { children });
19151
19180
  };
@@ -31753,6 +31782,217 @@ const routes = [
31753
31782
  ]
31754
31783
  }
31755
31784
  ];
31785
+ const SidebarContext = createContext(
31786
+ void 0
31787
+ );
31788
+ const useSidebar = () => {
31789
+ const context = useContext(SidebarContext);
31790
+ if (context === void 0) {
31791
+ throw new Error("useSidebar must be used within a SidebarProvider");
31792
+ }
31793
+ return context;
31794
+ };
31795
+ const AppsSidebar = ({
31796
+ isOpen,
31797
+ onClose
31798
+ }) => {
31799
+ const theme = useTheme();
31800
+ const navigate = useNavigate();
31801
+ const allApps = useApps();
31802
+ const dispatch = useAppDispatch();
31803
+ const currentApp = useActiveSidebar();
31804
+ const { setActiveExpandMenu } = useSidebar();
31805
+ const { palette } = useTheme();
31806
+ if (!isOpen) return null;
31807
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
31808
+ /* @__PURE__ */ jsx(
31809
+ Box,
31810
+ {
31811
+ onClick: onClose,
31812
+ sx: {
31813
+ position: "fixed",
31814
+ top: 0,
31815
+ left: 0,
31816
+ right: 0,
31817
+ bottom: 0,
31818
+ backgroundColor: palette.action.selected,
31819
+ zIndex: 100
31820
+ }
31821
+ }
31822
+ ),
31823
+ /* @__PURE__ */ jsxs(
31824
+ MotionBox,
31825
+ {
31826
+ preset: "fadeInLeft",
31827
+ sx: {
31828
+ position: "fixed",
31829
+ top: 0,
31830
+ left: 0,
31831
+ height: "100vh",
31832
+ backgroundColor: theme.palette.common.white,
31833
+ zIndex: 100,
31834
+ padding: PADDING_GAP_LAYOUT,
31835
+ gap: PADDING_GAP_ITEM,
31836
+ display: "flex",
31837
+ flexDirection: "column"
31838
+ },
31839
+ children: [
31840
+ /* @__PURE__ */ jsxs(
31841
+ Box,
31842
+ {
31843
+ sx: {
31844
+ display: "flex",
31845
+ justifyContent: "space-between",
31846
+ alignItems: "center"
31847
+ },
31848
+ children: [
31849
+ /* @__PURE__ */ jsx(
31850
+ IconButton,
31851
+ {
31852
+ onClick: onClose,
31853
+ sx: {
31854
+ color: theme.palette.grey[600],
31855
+ "&:hover": { backgroundColor: theme.palette.grey[100] }
31856
+ },
31857
+ children: /* @__PURE__ */ jsx(IconElement, { icon: "close" })
31858
+ }
31859
+ ),
31860
+ /* @__PURE__ */ jsx(
31861
+ IconButton,
31862
+ {
31863
+ sx: {
31864
+ color: theme.palette.grey[600],
31865
+ "&:hover": { backgroundColor: theme.palette.grey[100] }
31866
+ },
31867
+ children: /* @__PURE__ */ jsx(
31868
+ IconElement,
31869
+ {
31870
+ icon: "home",
31871
+ onClick: () => {
31872
+ onClose();
31873
+ navigate(PAGE.DASHBOARD.path);
31874
+ }
31875
+ }
31876
+ )
31877
+ }
31878
+ )
31879
+ ]
31880
+ }
31881
+ ),
31882
+ /* @__PURE__ */ jsxs(
31883
+ Box,
31884
+ {
31885
+ sx: {
31886
+ gap: PADDING_GAP_ITEM,
31887
+ display: "flex",
31888
+ flexDirection: "column"
31889
+ },
31890
+ children: [
31891
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Workflow Engine" }),
31892
+ /* @__PURE__ */ jsx(
31893
+ AppGrid,
31894
+ {
31895
+ apps: allApps.filter(
31896
+ (app2) => app2.category === AppCategory.WORKFLOW
31897
+ ),
31898
+ columns: 4,
31899
+ iconSize: 60,
31900
+ iconRadius: 5.5,
31901
+ gap: PADDING_GAP_ITEM,
31902
+ titleVariant: "body1",
31903
+ captionVariant: "caption",
31904
+ titleColor: theme.palette.grey[800],
31905
+ captionColor: theme.palette.grey[600],
31906
+ selectedAppId: currentApp?.key,
31907
+ onClickItem: async (app2) => {
31908
+ await dispatch(
31909
+ ACTION_ACCOUNT.updateCurrentAccess(app2.key)
31910
+ ).unwrap();
31911
+ setActiveExpandMenu(null);
31912
+ onClose();
31913
+ }
31914
+ }
31915
+ )
31916
+ ]
31917
+ }
31918
+ ),
31919
+ /* @__PURE__ */ jsxs(
31920
+ Box,
31921
+ {
31922
+ sx: {
31923
+ gap: PADDING_GAP_ITEM,
31924
+ display: "flex",
31925
+ flexDirection: "column"
31926
+ },
31927
+ children: [
31928
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "HRM" }),
31929
+ /* @__PURE__ */ jsx(
31930
+ AppGrid,
31931
+ {
31932
+ apps: allApps.filter((app2) => app2.category === AppCategory.HRM),
31933
+ columns: 4,
31934
+ iconSize: 60,
31935
+ iconRadius: 5.5,
31936
+ gap: PADDING_GAP_ITEM,
31937
+ titleVariant: "body1",
31938
+ captionVariant: "caption",
31939
+ titleColor: theme.palette.grey[800],
31940
+ captionColor: theme.palette.grey[600],
31941
+ selectedAppId: currentApp?.key,
31942
+ onClickItem: async (app2) => {
31943
+ await dispatch(
31944
+ ACTION_ACCOUNT.updateCurrentAccess(app2.key)
31945
+ ).unwrap();
31946
+ setActiveExpandMenu(null);
31947
+ onClose();
31948
+ }
31949
+ }
31950
+ )
31951
+ ]
31952
+ }
31953
+ ),
31954
+ /* @__PURE__ */ jsxs(
31955
+ Box,
31956
+ {
31957
+ sx: {
31958
+ gap: PADDING_GAP_ITEM,
31959
+ display: "flex",
31960
+ flexDirection: "column"
31961
+ },
31962
+ children: [
31963
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Platform Info" }),
31964
+ /* @__PURE__ */ jsx(
31965
+ AppGrid,
31966
+ {
31967
+ apps: allApps.filter(
31968
+ (app2) => app2.category === AppCategory.PLATFORM_INFO
31969
+ ),
31970
+ columns: 4,
31971
+ iconSize: 60,
31972
+ iconRadius: 5.5,
31973
+ gap: PADDING_GAP_ITEM,
31974
+ titleVariant: "body1",
31975
+ captionVariant: "caption",
31976
+ titleColor: theme.palette.grey[800],
31977
+ captionColor: theme.palette.grey[600],
31978
+ selectedAppId: currentApp?.key,
31979
+ onClickItem: async (app2) => {
31980
+ await dispatch(
31981
+ ACTION_ACCOUNT.updateCurrentAccess(app2.key)
31982
+ ).unwrap();
31983
+ setActiveExpandMenu(null);
31984
+ onClose();
31985
+ }
31986
+ }
31987
+ )
31988
+ ]
31989
+ }
31990
+ )
31991
+ ]
31992
+ }
31993
+ )
31994
+ ] });
31995
+ };
31756
31996
  const TypographyContentCaption = ({
31757
31997
  content,
31758
31998
  caption,
@@ -31800,6 +32040,7 @@ export {
31800
32040
  AppCategory,
31801
32041
  AppGrid,
31802
32042
  AppType,
32043
+ AppsSidebar,
31803
32044
  AuthLayout,
31804
32045
  AuthPage,
31805
32046
  AuthProcess,
@@ -32003,7 +32244,11 @@ export {
32003
32244
  updateNotification,
32004
32245
  updateNotificationSetting,
32005
32246
  updateUser,
32247
+ useActiveSidebar,
32248
+ useAllApps,
32006
32249
  useApps,
32250
+ useIsSystemMonitor,
32251
+ useSidebarState,
32007
32252
  useSnackbar,
32008
32253
  useTagSelector,
32009
32254
  useUpdateCurrentAccess,