@campxdev/shared 0.5.21 → 0.5.22
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/.eslintignore +4 -0
- package/.eslintrc.js +34 -0
- package/.prettierrc +10 -0
- package/exports.ts +7 -6
- package/package.json +64 -50
- package/publish.sh +2 -0
- package/src/assets/images/index.ts +8 -8
- package/src/components/Breadcrumbs.tsx +3 -3
- package/src/components/ChangePassword.tsx +147 -147
- package/src/components/DropDownButton.tsx +167 -163
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +22 -22
- package/src/components/ErrorBoundary/ErrorFallback.tsx +215 -215
- package/src/components/ErrorBoundary/GlobalNetworkLoadingIndicator.tsx +6 -6
- package/src/components/ErrorBoundary/index.tsx +1 -1
- package/src/components/FullScreenLoader.tsx +15 -15
- package/src/components/HookForm/AutoCompleteSearch.tsx +0 -30
- package/src/components/HookForm/RadioGroup.tsx +1 -1
- package/src/components/IconButtons/Icons.tsx +1 -2
- package/src/components/Input/AutoCompleteSearch.tsx +0 -30
- package/src/components/Input/SingleSelect.tsx +0 -15
- package/src/components/Layout/Header/AppHeader.tsx +89 -89
- package/src/components/Layout/Header/AppsMenu.tsx +79 -79
- package/src/components/Layout/Header/CogWheelMenu.tsx +27 -27
- package/src/components/Layout/Header/UserBox.tsx +25 -25
- package/src/components/Layout/Header/applications.ts +79 -79
- package/src/components/Layout/Header/assets/index.ts +10 -10
- package/src/components/Layout/Header/styles.tsx +72 -72
- package/src/components/LayoutWrapper.tsx +6 -6
- package/src/components/LinearProgress.tsx +14 -14
- package/src/components/ListItemButton.tsx +79 -79
- package/src/components/LoginForm.tsx +86 -86
- package/src/components/MenuButton.tsx +88 -88
- package/src/components/ModalButtons/DialogButton.tsx +66 -66
- package/src/components/PageContent.tsx +10 -10
- package/src/components/PageNotFound.tsx +12 -12
- package/src/components/PopupConfirm/ConfirmContextProvider.tsx +28 -28
- package/src/components/PopupConfirm/PopupConfirm.tsx +27 -27
- package/src/components/PopupConfirm/useConfirm.ts +41 -41
- package/src/components/SideMenuHeader.tsx +15 -15
- package/src/components/SideNav.tsx +119 -119
- package/src/components/Spinner.tsx +14 -14
- package/src/components/TableComponent/ReactTable.tsx +256 -256
- package/src/components/TableComponent/RenderTableBody.tsx +56 -56
- package/src/components/TableComponent/index.tsx +171 -171
- package/src/components/TableComponent/react-table-config.d.ts +2 -3
- package/src/components/index.ts +54 -54
- package/src/config/axios.ts +50 -50
- package/src/config/axiosXTenant.ts +57 -0
- package/src/constants/isDevelopment.ts +2 -2
- package/src/contexts/LoginFormProvider.tsx +28 -28
- package/src/contexts/Providers.tsx +40 -40
- package/src/contexts/QueryClientProvider.tsx +15 -15
- package/src/hooks/index.ts +2 -2
- package/src/hooks/useAppInit.ts +23 -23
- package/src/hooks/useAuth.ts +78 -77
- package/src/layouts/Components/DashBoardMenu.tsx +77 -77
- package/src/layouts/Components/icons/index.tsx +32 -32
- package/src/layouts/Components/styles.tsx +23 -23
- package/src/permissions/PageWithPermission.tsx +9 -9
- package/src/permissions/PermissionDeniedPage.tsx +13 -13
- package/src/permissions/PermissionsStore.ts +303 -303
- package/src/shared-state/index.ts +3 -3
- package/src/theme/MuiThemeProvider.tsx +9 -9
- package/src/theme/theme.d.ts +72 -72
- package/src/utils/index.ts +7 -7
- package/src/utils/logout.ts +19 -19
- package/src/utils/withLocalization.tsx +8 -8
- package/src/utils/withRouteWrapper.tsx +20 -20
- package/src/utils/withSuspense.tsx +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {AssetsStore} from './AssetsStore'
|
|
2
|
-
import {UserStore} from './UserStore'
|
|
3
|
-
export {AssetsStore, UserStore}
|
|
1
|
+
import { AssetsStore } from './AssetsStore'
|
|
2
|
+
import { UserStore } from './UserStore'
|
|
3
|
+
export { AssetsStore, UserStore }
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {CssBaseline, ThemeProvider} from '@mui/material'
|
|
1
|
+
import { CssBaseline, ThemeProvider } from '@mui/material'
|
|
2
2
|
import GlobalNetworkLoadingIndicator from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
|
|
3
3
|
import muiTheme from './muiTheme'
|
|
4
4
|
|
|
5
|
-
export default function MuiThemeProvider({children}) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
export default function MuiThemeProvider({ children }) {
|
|
6
|
+
return (
|
|
7
|
+
<ThemeProvider theme={muiTheme}>
|
|
8
|
+
{children}
|
|
9
|
+
<CssBaseline />
|
|
10
|
+
<GlobalNetworkLoadingIndicator />
|
|
11
|
+
</ThemeProvider>
|
|
12
|
+
)
|
|
13
13
|
}
|
package/src/theme/theme.d.ts
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import {ThemeOptions as MuiThemeOptions} from '@mui/material/styles'
|
|
1
|
+
import { ThemeOptions as MuiThemeOptions } from '@mui/material/styles'
|
|
2
2
|
|
|
3
3
|
declare module '@mui/material/styles' {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
4
|
+
interface Theme {
|
|
5
|
+
borders: {
|
|
6
|
+
grayLight: string
|
|
7
|
+
primary: string
|
|
8
|
+
}
|
|
9
|
+
palette: {
|
|
10
|
+
primary: {
|
|
11
|
+
dark: string
|
|
12
|
+
main: string
|
|
13
|
+
light: string
|
|
14
|
+
lighter: string
|
|
15
|
+
}
|
|
16
|
+
secondary: {
|
|
17
|
+
main: string
|
|
18
|
+
light: string
|
|
19
|
+
dark: string
|
|
20
|
+
lighter: string
|
|
21
|
+
}
|
|
22
|
+
common: {
|
|
23
|
+
black: string
|
|
24
|
+
white: string
|
|
25
|
+
green: string
|
|
26
|
+
yellow: string
|
|
27
|
+
blue: string
|
|
28
|
+
}
|
|
29
|
+
error: {
|
|
30
|
+
main: string
|
|
31
|
+
}
|
|
32
|
+
text: {
|
|
33
|
+
primary: string
|
|
34
|
+
secondary: string
|
|
35
|
+
disabled: string
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// allow configuration using `createTheme`
|
|
40
|
+
interface CustomThemeOptions extends MuiThemeOptions {
|
|
41
|
+
borders?: {
|
|
42
|
+
grayLight?: string
|
|
43
|
+
}
|
|
44
|
+
palette: {
|
|
45
|
+
secondary?: {
|
|
46
|
+
main?: string
|
|
47
|
+
light?: string
|
|
48
|
+
dark?: string
|
|
49
|
+
lighter?: string
|
|
50
|
+
}
|
|
51
|
+
primary?: {
|
|
52
|
+
dark?: string
|
|
53
|
+
main?: string
|
|
54
|
+
light?: string
|
|
55
|
+
lighter?: string
|
|
56
|
+
}
|
|
57
|
+
common?: {
|
|
58
|
+
black?: string
|
|
59
|
+
white?: string
|
|
60
|
+
green?: string
|
|
61
|
+
yellow?: string
|
|
62
|
+
blue?: string
|
|
63
|
+
}
|
|
64
|
+
error?: {
|
|
65
|
+
main?: string
|
|
66
|
+
}
|
|
67
|
+
text?: {
|
|
68
|
+
primary?: string
|
|
69
|
+
secondary?: string
|
|
70
|
+
disabled?: string
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function createTheme(options?: CustomThemeOptions): CustomTheme
|
|
75
75
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {default as getUrlParams} from './getUrlParams'
|
|
2
|
-
export {default as arrayPadEnd} from './arrayPadEnd'
|
|
3
|
-
export {default as romanize} from './romanize'
|
|
1
|
+
export { default as getUrlParams } from './getUrlParams'
|
|
2
|
+
export { default as arrayPadEnd } from './arrayPadEnd'
|
|
3
|
+
export { default as romanize } from './romanize'
|
|
4
4
|
|
|
5
|
-
export {default as withRouteWrapper} from './withRouteWrapper'
|
|
6
|
-
export {default as withSuspense} from './withSuspense'
|
|
7
|
-
export {default as withLocalization} from './withLocalization'
|
|
8
|
-
export {default as onLogout} from './logout'
|
|
5
|
+
export { default as withRouteWrapper } from './withRouteWrapper'
|
|
6
|
+
export { default as withSuspense } from './withSuspense'
|
|
7
|
+
export { default as withLocalization } from './withLocalization'
|
|
8
|
+
export { default as onLogout } from './logout'
|
package/src/utils/logout.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import Cookies from 'js-cookie'
|
|
2
|
-
import axios, {axiosErrorToast} from '../config/axios'
|
|
3
|
-
import {isDevelopment} from '../constants'
|
|
2
|
+
import axios, { axiosErrorToast } from '../config/axios'
|
|
3
|
+
import { isDevelopment } from '../constants'
|
|
4
4
|
|
|
5
5
|
export default function logout() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
if (isDevelopment) {
|
|
7
|
+
Cookies.remove('campx_session_key')
|
|
8
|
+
window.location.href = window.location.origin + '/campx_dev'
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
axios({
|
|
13
|
+
method: 'POST',
|
|
14
|
+
baseURL: 'https://auth-api.campx.in',
|
|
15
|
+
url: '/auth/logout',
|
|
16
|
+
})
|
|
17
|
+
.then((res) => {
|
|
18
|
+
Cookies.remove('campx_tenant')
|
|
19
|
+
window.location.href = 'https://id.campx.in'
|
|
20
|
+
})
|
|
21
|
+
.catch((err) => {
|
|
22
|
+
axiosErrorToast('Unable To Logout.')
|
|
23
|
+
})
|
|
24
24
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {LocalizationProvider} from '@mui/x-date-pickers'
|
|
2
|
-
import {AdapterMoment} from '@mui/x-date-pickers/AdapterMoment'
|
|
3
|
-
import {ReactNode} from 'react'
|
|
1
|
+
import { LocalizationProvider } from '@mui/x-date-pickers'
|
|
2
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'
|
|
3
|
+
import { ReactNode } from 'react'
|
|
4
4
|
|
|
5
5
|
export default function withLocalization(component: ReactNode) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
return (
|
|
7
|
+
<LocalizationProvider dateAdapter={AdapterMoment}>
|
|
8
|
+
{component}
|
|
9
|
+
</LocalizationProvider>
|
|
10
|
+
)
|
|
11
11
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {Suspense} from 'react'
|
|
1
|
+
import { Suspense } from 'react'
|
|
2
2
|
import PageWithPermission from '../permissions/PageWithPermission'
|
|
3
|
-
import {LinearProgress} from '../components/LinearProgress'
|
|
3
|
+
import { LinearProgress } from '../components/LinearProgress'
|
|
4
4
|
|
|
5
5
|
const withRouteWrapper = (routes) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
return routes?.map((item, index) => {
|
|
7
|
+
if (item?.children) {
|
|
8
|
+
return {
|
|
9
|
+
...item,
|
|
10
|
+
children: withRouteWrapper(item.children),
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
...item,
|
|
15
|
+
element: item?.element ? (
|
|
16
|
+
<Suspense fallback={<LinearProgress />} key={index}>
|
|
17
|
+
<PageWithPermission permissionKey={item?.permissionKey}>
|
|
18
|
+
{item.element}
|
|
19
|
+
</PageWithPermission>
|
|
20
|
+
</Suspense>
|
|
21
|
+
) : undefined,
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
24
|
}
|
|
25
25
|
export default withRouteWrapper
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {LinearProgress, Spinner} from '../components'
|
|
2
|
-
import {ReactNode, Suspense} from 'react'
|
|
1
|
+
import { LinearProgress, Spinner } from '../components'
|
|
2
|
+
import { ReactNode, Suspense } from 'react'
|
|
3
3
|
|
|
4
4
|
export default function withSuspense(component: ReactNode) {
|
|
5
|
-
|
|
5
|
+
return <Suspense fallback={<LinearProgress />}>{component}</Suspense>
|
|
6
6
|
}
|