@campxdev/shared 3.0.1 → 3.0.3

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.1",
3
+ "version": "3.0.3",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -90,7 +90,7 @@
90
90
  "typescript": "^5.5.2"
91
91
  },
92
92
  "resolutions": {
93
- "react-dev-utils/fork-ts-checker-webpack-plugin": "^6.5.3",
93
+ "fork-ts-checker-webpack-plugin": "^6.5.3",
94
94
  "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0"
95
95
  }
96
96
  }
@@ -1,8 +1,55 @@
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
+ }
2
15
 
3
- export const batchOptions = Array.from({ length: 12 }, (_, i) => {
4
- return `${new Date().getFullYear() - i} - ${new Date().getFullYear() - i + 1}`
5
- })
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
+
50
+ // Return standard batches for other tenants
51
+ return baseBatches
52
+ })()
6
53
 
7
54
  export const getYears = () => {
8
55
  const start = 2019
@@ -11,18 +11,15 @@ import GlobalNetworkLoadingIndicator from '../components/ErrorBoundary/GlobalNet
11
11
  import ErrorModalProvider from '../components/ErrorModalWrapper/ErrorModalWrapper'
12
12
  import RootModal from './RootModal'
13
13
 
14
- const isDevelopment = process.env.NODE_ENV == 'development'
14
+ export const isDevelopment = window.location.hostname.includes('localhost')
15
15
 
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')
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]
26
23
 
27
24
  export default function Providers({ children }: { children: ReactNode }) {
28
25
  var baseName = '/'
@@ -2,7 +2,24 @@ import { Store } from 'pullstate'
2
2
 
3
3
  export interface IUserStore {
4
4
  username: string
5
- user: any
5
+ user: {
6
+ //User Specific Data
7
+ globalUserId: string
8
+ _id: string
9
+ tenantId: string
10
+ userId: number
11
+ fullName: string
12
+ email: string
13
+ institutionIds: number[]
14
+ isAdminUser: boolean
15
+ isSuperUser: boolean
16
+ photoUrl?: string
17
+ //Employee Specific Data
18
+ employeeId?: string
19
+ designationId?: string
20
+ //Academic Specific Data
21
+ departmentIds?: string[]
22
+ }
6
23
  roles: any[]
7
24
  }
8
25