@campxdev/shared 3.0.6 → 3.0.8

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": "3.0.6",
3
+ "version": "3.0.8",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -55,8 +55,8 @@
55
55
  "react-toastify": "^9.0.1",
56
56
  "styled-components": "^5.3.5",
57
57
  "swiper": "^8.1.5",
58
- "use-immer": "^0.11.0",
59
- "yup": "^1.4.0"
58
+ "use-immer": "^0.8.1",
59
+ "yup": "^0.32.11"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@storybook/addon-actions": "^6.5.14",
@@ -1,55 +1,8 @@
1
1
  import { ReactNode } from 'react'
2
- import { campxTenantKey } from '../contexts/Providers'
3
-
4
- // Configuration for tenant-specific batch suffixes
5
- const tenantBatchConfig = {
6
- upes: {
7
- // Configure suffixes for specific batches
8
- batchConfigs: {
9
- '2025 - 2026': ['_JUL', '_OCT'],
10
- // Add more specific year configurations as needed
11
- },
12
- },
13
- // Add other tenant configurations here as needed
14
- }
15
-
16
- export const batchOptions = (() => {
17
- const baseBatches = Array.from({ length: 12 }, (_, i) => {
18
- return `${new Date().getFullYear() - i} - ${
19
- new Date().getFullYear() - i + 1
20
- }`
21
- })
22
-
23
- // Check if current tenant has specific batch configuration
24
- const tenantConfig = tenantBatchConfig[campxTenantKey]
25
-
26
- if (tenantConfig) {
27
- const { batchConfigs } = tenantConfig
28
- const batchesWithSuffixes = []
29
-
30
- baseBatches.forEach((batch) => {
31
- // Check if this batch has specific configuration
32
- const suffixes = batchConfigs[batch]
33
-
34
- if (suffixes) {
35
- // Add batch with each suffix
36
- suffixes.forEach((suffix) => {
37
- batchesWithSuffixes.push(`${batch}${suffix}`)
38
- })
39
- } else {
40
- // Add batch without suffix
41
- batchesWithSuffixes.push(batch)
42
- }
43
- })
44
- console.log(batchesWithSuffixes, 'suffix')
45
- return batchesWithSuffixes
46
- }
47
-
48
- console.log(baseBatches, 'baseBatches')
49
2
 
50
- // Return standard batches for other tenants
51
- return baseBatches
52
- })()
3
+ export const batchOptions = Array.from({ length: 12 }, (_, i) => {
4
+ return `${new Date().getFullYear() - i} - ${new Date().getFullYear() - i + 1}`
5
+ })
53
6
 
54
7
  export const getYears = () => {
55
8
  const start = 2019
@@ -11,15 +11,18 @@ import GlobalNetworkLoadingIndicator from '../components/ErrorBoundary/GlobalNet
11
11
  import ErrorModalProvider from '../components/ErrorModalWrapper/ErrorModalWrapper'
12
12
  import RootModal from './RootModal'
13
13
 
14
- export const isDevelopment = window.location.hostname.includes('localhost')
14
+ const isDevelopment = process.env.NODE_ENV == 'development'
15
15
 
16
- export const campxTenantKey = window.location.hostname.split('.')[0]
17
-
18
- export const urlTenantKey = window.location.hostname.split('.')[0]
19
-
20
- export const instituitionKey = window.location.pathname.split('/')[1]
21
-
22
- export const workspace = window.location.pathname.split('/')[2]
16
+ export const campxTenantKey = isDevelopment
17
+ ? Cookies.get('campx_tenant')
18
+ : window.location.hostname.split('.')[0]
19
+ export const urlTenantKey = isDevelopment
20
+ ? Cookies.get('campx_tenant')
21
+ : window.location.hostname.split('.')[0]
22
+ export const instituitionKey =
23
+ window.location.pathname.split('/')[1] != ''
24
+ ? window.location.pathname.split('/')[1]
25
+ : Cookies.get('campx_institution')
23
26
 
24
27
  export default function Providers({ children }: { children: ReactNode }) {
25
28
  var baseName = '/'