@campxdev/shared 3.0.8 → 3.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "3.0.8",
3
+ "version": "3.1.0",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -1,8 +1,52 @@
1
1
  import { ReactNode } from 'react'
2
2
 
3
- export const batchOptions = Array.from({ length: 12 }, (_, i) => {
4
- return `${new Date().getFullYear() - i} - ${new Date().getFullYear() - i + 1}`
5
- })
3
+ // Configuration for tenant-specific batch suffixes
4
+ const tenantBatchConfig = {
5
+ upes: {
6
+ // Configure suffixes for specific batches
7
+ batchConfigs: {
8
+ '2025 - 2026': ['_JUL', '_OCT'],
9
+ // Add more specific year configurations as needed
10
+ },
11
+ },
12
+ // Add other tenant configurations here as needed
13
+ }
14
+
15
+ export const batchOptions = (() => {
16
+ const baseBatches = Array.from({ length: 12 }, (_, i) => {
17
+ return `${new Date().getFullYear() - i} - ${
18
+ new Date().getFullYear() - i + 1
19
+ }`
20
+ })
21
+
22
+ // Check if current tenant has specific batch configuration
23
+ const tenantConfig = tenantBatchConfig[window.location.hostname.split('.')[0]]
24
+
25
+ if (tenantConfig) {
26
+ const { batchConfigs } = tenantConfig
27
+ const batchesWithSuffixes = []
28
+
29
+ baseBatches.forEach((batch) => {
30
+ // Check if this batch has specific configuration
31
+ const suffixes = batchConfigs[batch]
32
+
33
+ if (suffixes) {
34
+ // Add batch with each suffix
35
+ suffixes.forEach((suffix) => {
36
+ batchesWithSuffixes.push(`${batch}${suffix}`)
37
+ })
38
+ } else {
39
+ // Add batch without suffix
40
+ batchesWithSuffixes.push(batch)
41
+ }
42
+ })
43
+ console.log(batchesWithSuffixes, 'suffix')
44
+ return batchesWithSuffixes
45
+ }
46
+
47
+ // Return standard batches for other tenants
48
+ return baseBatches
49
+ })()
6
50
 
7
51
  export const getYears = () => {
8
52
  const start = 2019