@campxdev/campx-web-utils 0.2.19 → 0.3.0

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/craco.config.js CHANGED
@@ -2,13 +2,17 @@ const path = require('path');
2
2
  const { getLoader, loaderByName } = require('@craco/craco');
3
3
  const packages = [];
4
4
  packages.push(path.dirname(require.resolve('@campxdev/react-blueprint')));
5
- packages.push(path.dirname(require.resolve('@campxdev/campx-web-utils')));
6
5
  module.exports = {
7
6
  webpack: {
8
7
  configure: (webpackConfig) => {
9
- const { isFound, match } = getLoader(webpackConfig, loaderByName('babel-loader'));
8
+ const { isFound, match } = getLoader(
9
+ webpackConfig,
10
+ loaderByName('babel-loader'),
11
+ );
10
12
  if (isFound) {
11
- const include = Array.isArray(match.loader.include) ? match.loader.include : [match.loader.include];
13
+ const include = Array.isArray(match.loader.include)
14
+ ? match.loader.include
15
+ : [match.loader.include];
12
16
  match.loader.include = include.concat(packages);
13
17
  }
14
18
 
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "@campxdev/campx-web-utils",
3
- "version": "0.2.19",
3
+ "version": "0.3.0",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
+ "peerDependencies": {
7
+ "@campxdev/react-blueprint": ">=1.5.0",
8
+ "@emotion/react": ">=11.11.4",
9
+ "@emotion/styled": ">=11.11.5",
10
+ "@mui/icons-material": ">=6.1.5",
11
+ "@mui/material": ">=6.1.5",
12
+ "@mui/x-data-grid": ">=7.22.1",
13
+ "@mui/x-date-pickers": ">=7.22.1"
14
+ },
6
15
  "dependencies": {
7
- "@campxdev/react-blueprint": "1.4.2",
16
+ "@campxdev/react-blueprint": "1.5.0",
8
17
  "@hookform/resolvers": "^3.9.0",
9
18
  "@mui/x-date-pickers": "^7.22.1",
10
- "@testing-library/jest-dom": "^5.14.1",
11
- "@testing-library/react": "^13.0.0",
12
- "@testing-library/user-event": "^13.2.1",
13
- "@types/jest": "^27.0.1",
14
- "@types/node": "^16.7.13",
15
- "@types/react": "^18.0.0",
16
- "@types/react-dom": "^18.0.0",
17
19
  "axios": "^1.7.2",
18
20
  "cookie-js": "^0.0.1",
19
21
  "date-fns": "^3.6.0",
@@ -45,7 +47,12 @@
45
47
  "@types/react": "^18.3.3",
46
48
  "@types/react-dom": "^18.3.0",
47
49
  "@types/react-query": "^1.2.9",
48
- "@types/react-router-dom": "^5.3.3"
50
+ "@types/react-router-dom": "^5.3.3",
51
+ "@testing-library/jest-dom": "^5.14.1",
52
+ "@testing-library/react": "^13.0.0",
53
+ "@testing-library/user-event": "^13.2.1",
54
+ "@types/jest": "^27.0.1",
55
+ "@types/node": "^16.7.13"
49
56
  },
50
57
  "scripts": {
51
58
  "start": "craco start",
@@ -1,4 +1,3 @@
1
- import { axios } from '@campxdev/campx-web-utils';
2
1
  import { Button, Icons, TextField } from '@campxdev/react-blueprint';
3
2
  import { yupResolver } from '@hookform/resolvers/yup';
4
3
  import { Box, Stack } from '@mui/material';
@@ -9,6 +8,7 @@ import { Controller, useForm } from 'react-hook-form';
9
8
  import { useMutation } from 'react-query';
10
9
 
11
10
  import * as Yup from 'yup';
11
+ import { axios } from '../../config/axios';
12
12
 
13
13
  type DeviceInformation = {
14
14
  deviceType: string;
@@ -18,6 +18,15 @@ export type ApplicationStoreType = {
18
18
  confirmButtonText?: string;
19
19
  cancelButtonText?: string;
20
20
  };
21
+ user?: {
22
+ fullName: string;
23
+ employeeId?: string;
24
+ departmentIds?: string[];
25
+ designationId?: string;
26
+ institutionIds: number[];
27
+ isAdminUser?: boolean;
28
+ isSuperUser?: boolean;
29
+ };
21
30
  };
22
31
 
23
32
  export const initialApplicationState: ApplicationStoreType = {
@@ -35,6 +44,7 @@ export const initialApplicationState: ApplicationStoreType = {
35
44
  onCancel: () => {},
36
45
  type: 'confirm',
37
46
  },
47
+ user: undefined,
38
48
  };
39
49
  export const ApplicationStore = new Store<ApplicationStoreType>(
40
50
  initialApplicationState,
@@ -1,4 +1,5 @@
1
1
  import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
2
+ import { axios } from '../config/axios';
2
3
 
3
4
  export const CourseSelector = (props: SingleSelectProps) => {
4
5
  return (
@@ -8,6 +9,7 @@ export const CourseSelector = (props: SingleSelectProps) => {
8
9
  subLabelKey: 'level',
9
10
  }}
10
11
  {...props}
12
+ externalAxios={axios}
11
13
  optionsApiEndPoint="/dropdowns/courses"
12
14
  />
13
15
  );
@@ -1,4 +1,5 @@
1
1
  import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
2
+ import { axios } from '../config/axios';
2
3
 
3
4
  export const DepartmentSelector = (props: SingleSelectProps) => {
4
5
  return (
@@ -11,6 +12,7 @@ export const DepartmentSelector = (props: SingleSelectProps) => {
11
12
  isObjectId: true,
12
13
  }}
13
14
  {...props}
15
+ externalAxios={axios}
14
16
  optionsApiEndPoint="/dropdowns/departments"
15
17
  />
16
18
  );
@@ -1,4 +1,5 @@
1
1
  import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
2
+ import { axios } from '../config/axios';
2
3
 
3
4
  export const EmployeesSelector = (props: SingleSelectProps) => {
4
5
  return (
@@ -12,6 +13,7 @@ export const EmployeesSelector = (props: SingleSelectProps) => {
12
13
  subLabelKey: 'employeeId',
13
14
  }}
14
15
  {...props}
16
+ externalAxios={axios}
15
17
  optionsApiEndPoint="/dropdowns/employees"
16
18
  />
17
19
  );
@@ -1,5 +1,5 @@
1
1
  import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
2
- import { years } from './utils';
2
+ import { axios } from '../config/axios';
3
3
 
4
4
  export const HostelFloorSelector = (props: SingleSelectProps) => {
5
5
  return (
@@ -11,8 +11,9 @@ export const HostelFloorSelector = (props: SingleSelectProps) => {
11
11
  dbLabelProps={{
12
12
  labelKey: 'floor',
13
13
  }}
14
- optionsApiEndPoint="dropdowns/floors"
15
14
  {...props}
15
+ externalAxios={axios}
16
+ optionsApiEndPoint="dropdowns/floors"
16
17
  />
17
18
  );
18
19
  };
@@ -1,5 +1,5 @@
1
1
  import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
2
- import { years } from './utils';
2
+ import { axios } from '../config/axios';
3
3
 
4
4
  export const HostelRoomSelector = (props: SingleSelectProps) => {
5
5
  return (
@@ -12,8 +12,9 @@ export const HostelRoomSelector = (props: SingleSelectProps) => {
12
12
  labelKey: 'room_number',
13
13
  subLabelKey: 'floor',
14
14
  }}
15
- optionsApiEndPoint="dropdowns/hostel-rooms"
16
15
  {...props}
16
+ optionsApiEndPoint="dropdowns/hostel-rooms"
17
+ externalAxios={axios}
17
18
  />
18
19
  );
19
20
  };
@@ -1,4 +1,5 @@
1
1
  import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
2
+ import { axios } from '../config/axios';
2
3
 
3
4
  export const SemesterSelector = (props: SingleSelectProps) => {
4
5
  return (
@@ -9,6 +10,7 @@ export const SemesterSelector = (props: SingleSelectProps) => {
9
10
  }}
10
11
  {...props}
11
12
  optionsApiEndPoint="/dropdowns/semesters"
13
+ externalAxios={axios}
12
14
  />
13
15
  );
14
16
  };
@@ -1,4 +1,4 @@
1
1
  export * from './breadcrumbs';
2
2
  export const isDevelopment =
3
- process.env.NODE_ENV == 'development' ||
3
+ process.env.NODE_ENV === 'development' ||
4
4
  window.location.hostname === 'localhost';