@campxdev/shared 1.11.7-0.alpha.36 → 1.11.7-0.alpha.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "1.11.7-0.alpha.36",
3
+ "version": "1.11.7-0.alpha.38",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -31,34 +31,33 @@
31
31
  "@emotion/react": "^11.11.1",
32
32
  "@emotion/styled": "^11.11.0",
33
33
  "@hookform/resolvers": "^2.9.10",
34
- "@mui/icons-material": "^5.15.18",
34
+ "@mongodb-js/charts-embed-dom": "3.2.1",
35
+ "@mui/icons-material": "^5.15.20",
35
36
  "@mui/lab": "^5.0.0-alpha.146",
36
- "@mui/material": "^5.15.18",
37
+ "@mui/material": "^5.15.20",
37
38
  "@mui/x-date-pickers": "^6.16.0",
38
- "axios": "^0.27.2",
39
+ "axios": "^1.7.2",
39
40
  "date-fns": "^2.28.0",
40
41
  "date-fns-tz": "^2.0.0",
41
42
  "device-detector-js": "^3.0.3",
42
43
  "fuse.js": "^6.6.2",
43
- "js-cookie": "^3.0.1",
44
+ "js-cookie": "^3.0.5",
44
45
  "moment": "^2.29.4",
45
46
  "pullstate": "^1.24.0",
46
- "react": "^18.2.0",
47
+ "react": "^18.3.1",
47
48
  "react-arrows": "^1.2.0",
48
- "react-dom": "^18.2.0",
49
+ "react-dom": "^18.3.1",
49
50
  "react-error-boundary": "^3.1.4",
50
51
  "react-flatpickr": "^3.10.13",
51
52
  "react-helmet": "^6.1.0",
52
53
  "react-hook-form": "^7.40.0",
53
54
  "react-joyride": "^2.5.5",
54
- "react-query": "^3.39.0",
55
- "react-router-dom": "^6.4.2",
55
+ "react-query": "^3.39.3",
56
+ "react-router-dom": "^6.23.1",
56
57
  "react-table": "^7.8.0",
57
58
  "react-toastify": "^9.0.1",
58
59
  "styled-components": "^5.3.5",
59
- "@mongodb-js/charts-embed-dom": "3.2.1",
60
60
  "swiper": "^8.1.5",
61
- "typescript": "^5.2.2",
62
61
  "use-immer": "^0.8.1",
63
62
  "yup": "^0.32.11"
64
63
  },
@@ -73,9 +72,9 @@
73
72
  "@storybook/preset-create-react-app": "^4.0.0",
74
73
  "@storybook/react": "^6.5.14",
75
74
  "@storybook/testing-library": "^0.0.13",
76
- "@types/js-cookie": "^3.0.2",
75
+ "@types/js-cookie": "^3.0.6",
77
76
  "@types/node": "^18.11.8",
78
- "@types/react": "^18.0.25",
77
+ "@types/react": "^18.3.3",
79
78
  "@types/react-flatpickr": "^3.8.8",
80
79
  "@types/react-helmet": "^6.1.6",
81
80
  "@typescript-eslint/eslint-plugin": "^6.7.4",
@@ -89,7 +88,8 @@
89
88
  "eslint-plugin-storybook": "^0.6.8",
90
89
  "prettier": "^2.5.0",
91
90
  "react-scripts": "^5.0.1",
92
- "storybook-addon-react-router-v6": "^0.2.1"
91
+ "storybook-addon-react-router-v6": "^0.2.1",
92
+ "typescript": "^5.5.2"
93
93
  },
94
94
  "resolutions": {
95
95
  "react-dev-utils/fork-ts-checker-webpack-plugin": "^6.5.3",
@@ -1,4 +1,4 @@
1
- import Axios, { AxiosRequestConfig } from 'axios'
1
+ import Axios, { InternalAxiosRequestConfig } from 'axios'
2
2
  import Cookies from 'js-cookie'
3
3
  import { toast } from 'react-toastify'
4
4
  import { NetworkStore } from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
@@ -34,7 +34,7 @@ let axios = Axios.create({
34
34
  })
35
35
 
36
36
  axios.interceptors.request.use(
37
- function (config: AxiosRequestConfig) {
37
+ function (config: InternalAxiosRequestConfig) {
38
38
  const params = formatParams(config?.params)
39
39
  NetworkStore.update((s) => {
40
40
  s.loading = true
@@ -1,5 +1,4 @@
1
1
  import { AxiosError } from 'axios'
2
- import Cookies from 'js-cookie'
3
2
  import { useEffect, useState } from 'react'
4
3
  import { toast } from 'react-toastify'
5
4
  import axios from '../config/axios'
@@ -193,14 +192,23 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
193
192
  window.location.hostname.split('.').includes('setup') && isAdmin
194
193
  const isMasterSlave = res.data?.institutionType === 'MASTER_CHILD'
195
194
 
196
- setData(res.data)
195
+ // eslint-disable-next-line no-console
197
196
 
198
- InstitutionsStore.update((s) => {
199
- s.institutions = res.data?.institutions
200
- s.current = res.data?.institutions.find(
201
- (item) => item.code === Cookies.get('campx_institution'),
202
- )
203
- })
197
+ if (isDevelopment == false && isStaging == false && !isSetup) {
198
+ if (
199
+ !res.data.applications.includes(ApplicationObj[originSubdomain])
200
+ ) {
201
+ window.location.replace(
202
+ `https://www.id.campx.in/apps?redirect_to=${url}`,
203
+ )
204
+ }
205
+ }
206
+
207
+ if (res.data?.institutions) {
208
+ handleInstitutions(res.data?.institutions)
209
+ }
210
+
211
+ setData(res.data)
204
212
  UserStore.update((s) => {
205
213
  s.username = res.data?.user?.username
206
214
  s.user = res.data?.user