@campxdev/campx-web-utils 0.4.2 → 0.4.4
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/export.ts +1 -1
- package/package.json +3 -3
- package/src/AppContent.tsx +3 -0
- package/src/components/ChangePassword.tsx +1 -1
- package/src/config/axios.ts +1 -7
- package/src/context/Providers.tsx +1 -9
- package/src/selectors/ProgramSelector.tsx +16 -0
- package/src/selectors/RegulationSelector.tsx +20 -0
- package/src/selectors/export.ts +2 -0
- package/src/utils/constants.ts +18 -0
- package/src/utils/export.ts +0 -3
package/export.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/campx-web-utils",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"main": "./export.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@campxdev/react-blueprint": ">=1.7.
|
|
7
|
+
"@campxdev/react-blueprint": ">=1.7.4",
|
|
8
8
|
"@emotion/react": ">=^11.13.3",
|
|
9
9
|
"@emotion/styled": ">=^11.13.0",
|
|
10
10
|
"@mui/icons-material": ">=6.1.5",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react-redux": "=>9.1.2"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@campxdev/react-blueprint": "1.7.
|
|
17
|
+
"@campxdev/react-blueprint": "1.7.4",
|
|
18
18
|
"@hookform/resolvers": "^3.9.0",
|
|
19
19
|
"@mui/x-date-pickers": "^7.22.1",
|
|
20
20
|
"axios": "^1.7.2",
|
package/src/AppContent.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Button, TextField } from '@campxdev/react-blueprint';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { EmployeesSelector } from './selectors/EmployeesSelector';
|
|
4
|
+
import { PrintFormatSelector } from './selectors/export';
|
|
4
5
|
|
|
5
6
|
function AppContent() {
|
|
6
7
|
const [value, setValue] = useState('63b810ee995d6d64f4a248de');
|
|
@@ -20,6 +21,8 @@ function AppContent() {
|
|
|
20
21
|
<div style={{ height: '300px' }}></div>
|
|
21
22
|
|
|
22
23
|
<TextField />
|
|
24
|
+
|
|
25
|
+
<PrintFormatSelector onChange={() => {}} />
|
|
23
26
|
</>
|
|
24
27
|
);
|
|
25
28
|
}
|
|
@@ -17,7 +17,7 @@ import { StyledMenuItem } from '@campxdev/react-blueprint/src/components/Navigat
|
|
|
17
17
|
import { Visibility, VisibilityOff } from '@mui/icons-material';
|
|
18
18
|
import { toast } from 'react-toastify';
|
|
19
19
|
import { axios } from '../config/axios';
|
|
20
|
-
import { isDevelopment } from '../utils/
|
|
20
|
+
import { isDevelopment } from '../utils/constants';
|
|
21
21
|
|
|
22
22
|
interface PasswordVisibilityState {
|
|
23
23
|
oldPassword: boolean;
|
package/src/config/axios.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import Axios, { InternalAxiosRequestConfig } from 'axios';
|
|
2
2
|
import Cookies from 'js-cookie';
|
|
3
3
|
import { ApplicationStore } from '../context/application-store';
|
|
4
|
-
import { isDevelopment } from '../utils/
|
|
5
|
-
|
|
6
|
-
const tenantCode =
|
|
7
|
-
window.location.hostname === 'localhost'
|
|
8
|
-
? Cookies.get('campx_tenant')
|
|
9
|
-
: window.location.hostname.split('.')[0];
|
|
10
|
-
const institutionCode = window.location.pathname.split('/')[1];
|
|
4
|
+
import { institutionCode, isDevelopment, tenantCode } from '../utils/constants';
|
|
11
5
|
|
|
12
6
|
export const formatParams = (params: any) => {
|
|
13
7
|
return Object.fromEntries(
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
configureStore,
|
|
7
7
|
ReducersMapObject,
|
|
8
8
|
} from '@reduxjs/toolkit';
|
|
9
|
-
import Cookies from 'js-cookie';
|
|
10
9
|
import { ReactNode, useEffect } from 'react';
|
|
11
10
|
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
12
11
|
import { Provider } from 'react-redux';
|
|
13
12
|
import { BrowserRouter } from 'react-router-dom';
|
|
13
|
+
import { institutionCode, tenantCode } from '../utils/constants';
|
|
14
14
|
import { ConfirmDialogProvider } from './ConfirmDialogProvider';
|
|
15
15
|
import { SnackbarProvider } from './SnackbarProvider';
|
|
16
16
|
|
|
@@ -35,14 +35,6 @@ export const Providers = ({
|
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
var tenantCode =
|
|
39
|
-
window.location.hostname === 'localhost'
|
|
40
|
-
? Cookies.get('campx_tenant')
|
|
41
|
-
: window.location.hostname.split('.')[0];
|
|
42
|
-
var institutionCode =
|
|
43
|
-
window.location.pathname.split('/')[1] !== ''
|
|
44
|
-
? window.location.pathname.split('/')[1]
|
|
45
|
-
: Cookies.get('campx_institution');
|
|
46
38
|
var baseName = tenantCode && institutionCode ? `/${institutionCode}` : '/';
|
|
47
39
|
useEffect(() => {
|
|
48
40
|
if (window.location.pathname === '/' && institutionCode && tenantCode) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
|
|
2
|
+
import { axios } from '../config/axios';
|
|
3
|
+
|
|
4
|
+
export const ProgramSelector = (props: SingleSelectProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<SingleSelect
|
|
7
|
+
dbLabelProps={{
|
|
8
|
+
labelKey: 'branchCode',
|
|
9
|
+
subLabelKey: 'branchDisplay',
|
|
10
|
+
}}
|
|
11
|
+
{...props}
|
|
12
|
+
externalAxios={axios}
|
|
13
|
+
optionsApiEndPoint="/dropdowns/programs"
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
|
|
2
|
+
import { axios } from '../config/axios';
|
|
3
|
+
|
|
4
|
+
export const RegulationSelector = (props: SingleSelectProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<SingleSelect
|
|
7
|
+
label="Regulation"
|
|
8
|
+
dbValueProps={{
|
|
9
|
+
valueKey: 'regulation_id',
|
|
10
|
+
}}
|
|
11
|
+
dbLabelProps={{
|
|
12
|
+
labelKey: 'r.name',
|
|
13
|
+
subLabelKey: 'batch',
|
|
14
|
+
}}
|
|
15
|
+
{...props}
|
|
16
|
+
optionsApiEndPoint="dropdowns/regulations"
|
|
17
|
+
externalAxios={axios}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
package/src/selectors/export.ts
CHANGED
|
@@ -6,5 +6,7 @@ export * from './FeeTypeSelector';
|
|
|
6
6
|
export * from './HostelFloorSelector';
|
|
7
7
|
export * from './HostelRoomSelector';
|
|
8
8
|
export * from './PrintFormatSelector';
|
|
9
|
+
export * from './ProgramSelector';
|
|
10
|
+
export * from './RegulationSelector';
|
|
9
11
|
export * from './SemesterSelector';
|
|
10
12
|
export * from './YearRangeSelector';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Cookies from 'js-cookie';
|
|
2
|
+
|
|
3
|
+
const tenantCookie = Cookies.get('campx_tenant');
|
|
4
|
+
const institutionCookie = Cookies.get('campx_institution');
|
|
5
|
+
|
|
6
|
+
export const isLocal = window.location.hostname === 'localhost';
|
|
7
|
+
|
|
8
|
+
export const isDevelopment = process.env.NODE_ENV === 'development' || isLocal;
|
|
9
|
+
|
|
10
|
+
export const tenantCode = isLocal
|
|
11
|
+
? tenantCookie
|
|
12
|
+
: window.location.hostname.split('.')[0];
|
|
13
|
+
|
|
14
|
+
// if url searched is aupulse.campx.in then redirect to aupulse.campx.in/aupulse
|
|
15
|
+
export const institutionCode =
|
|
16
|
+
window.location.pathname.split('/')[1] !== ''
|
|
17
|
+
? window.location.pathname.split('/')[1]
|
|
18
|
+
: institutionCookie;
|
package/src/utils/export.ts
DELETED