@apptimate/core-lib 1.7.0 → 1.8.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": "@apptimate/core-lib",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "publishConfig": {
package/src/client.ts CHANGED
@@ -8,3 +8,6 @@ export * from './common/interfaces/ICommon';
8
8
  export * from './constants/storageKeys';
9
9
  export * from './constants/menus';
10
10
  export * from './constants/iconRegistry';
11
+ export * from './constants/currencies';
12
+ export * from './utils/currencyService';
13
+
@@ -0,0 +1,163 @@
1
+ export interface ICurrencyDetails {
2
+ name: string;
3
+ code: string;
4
+ symbol: string;
5
+ }
6
+
7
+ export const CURRENCIES: Record<string, ICurrencyDetails> = {
8
+ AED: { name: 'United Arab Emirates Dirham', code: 'AED', symbol: 'د.إ' },
9
+ AFN: { name: 'Afghan Afghani', code: 'AFN', symbol: '؋' },
10
+ ALL: { name: 'Albanian Lek', code: 'ALL', symbol: 'L' },
11
+ AMD: { name: 'Armenian Dram', code: 'AMD', symbol: '֏' },
12
+ ANG: { name: 'Netherlands Antillean Guilder', code: 'ANG', symbol: 'ƒ' },
13
+ AOA: { name: 'Angolan Kwanza', code: 'AOA', symbol: 'Kz' },
14
+ ARS: { name: 'Argentine Peso', code: 'ARS', symbol: '$' },
15
+ AUD: { name: 'Australian Dollar', code: 'AUD', symbol: '$' },
16
+ AWG: { name: 'Aruban Florin', code: 'AWG', symbol: 'ƒ' },
17
+ AZN: { name: 'Azerbaijani Manat', code: 'AZN', symbol: '₼' },
18
+ BAM: { name: 'Bosnia-Herzegovina Convertible Mark', code: 'BAM', symbol: 'KM' },
19
+ BBD: { name: 'Barbadian Dollar', code: 'BBD', symbol: '$' },
20
+ BDT: { name: 'Bangladeshi Taka', code: 'BDT', symbol: '৳' },
21
+ BGN: { name: 'Bulgarian Lev', code: 'BGN', symbol: 'лв' },
22
+ BHD: { name: 'Bahraini Dinar', code: 'BHD', symbol: '.د.ب' },
23
+ BIF: { name: 'Burundian Franc', code: 'BIF', symbol: 'FBu' },
24
+ BMD: { name: 'Bermudan Dollar', code: 'BMD', symbol: '$' },
25
+ BND: { name: 'Brunei Dollar', code: 'BND', symbol: '$' },
26
+ BOB: { name: 'Bolivian Boliviano', code: 'BOB', symbol: '$b' },
27
+ BRL: { name: 'Brazilian Real', code: 'BRL', symbol: 'R$' },
28
+ BSD: { name: 'Bahamian Dollar', code: 'BSD', symbol: '$' },
29
+ BTN: { name: 'Bhutanese Ngultrum', code: 'BTN', symbol: 'Nu.' },
30
+ BWP: { name: 'Botswanan Pula', code: 'BWP', symbol: 'P' },
31
+ BYN: { name: 'Belarusian Ruble', code: 'BYN', symbol: 'Br' },
32
+ BZD: { name: 'Belize Dollar', code: 'BZD', symbol: 'BZ$' },
33
+ CAD: { name: 'Canadian Dollar', code: 'CAD', symbol: '$' },
34
+ CDF: { name: 'Congolese Franc', code: 'CDF', symbol: 'FC' },
35
+ CHF: { name: 'Swiss Franc', code: 'CHF', symbol: 'CHF' },
36
+ CLP: { name: 'Chilean Peso', code: 'CLP', symbol: '$' },
37
+ CNY: { name: 'Chinese Yuan', code: 'CNY', symbol: '¥' },
38
+ COP: { name: 'Colombian Peso', code: 'COP', symbol: '$' },
39
+ CRC: { name: 'Costa Rican Colón', code: 'CRC', symbol: '₡' },
40
+ CUP: { name: 'Cuban Peso', code: 'CUP', symbol: '₱' },
41
+ CVE: { name: 'Cape Verdean Escudo', code: 'CVE', symbol: '$' },
42
+ CZK: { name: 'Czech Koruna', code: 'CZK', symbol: 'Kč' },
43
+ DJF: { name: 'Djiboutian Franc', code: 'DJF', symbol: 'Fdj' },
44
+ DKK: { name: 'Danish Krone', code: 'DKK', symbol: 'kr' },
45
+ DOP: { name: 'Dominican Peso', code: 'DOP', symbol: 'RD$' },
46
+ DZD: { name: 'Algerian Dinar', code: 'DZD', symbol: 'د.ج' },
47
+ EGP: { name: 'Egyptian Pound', code: 'EGP', symbol: '£' },
48
+ ERN: { name: 'Eritrean Nakfa', code: 'ERN', symbol: 'Nfk' },
49
+ ETB: { name: 'Ethiopian Birr', code: 'ETB', symbol: 'Br' },
50
+ EUR: { name: 'Euro', code: 'EUR', symbol: '€' },
51
+ FJD: { name: 'Fijian Dollar', code: 'FJD', symbol: '$' },
52
+ FKP: { name: 'Falkland Islands Pound', code: 'FKP', symbol: '£' },
53
+ GBP: { name: 'British Pound', code: 'GBP', symbol: '£' },
54
+ GEL: { name: 'Georgian Lari', code: 'GEL', symbol: '₾' },
55
+ GHS: { name: 'Ghanaian Cedi', code: 'GHS', symbol: 'GH₵' },
56
+ GIP: { name: 'Gibraltar Pound', code: 'GIP', symbol: '£' },
57
+ GMD: { name: 'Gambian Dalasi', code: 'GMD', symbol: 'D' },
58
+ GNF: { name: 'Guinean Franc', code: 'GNF', symbol: 'FG' },
59
+ GTQ: { name: 'Guatemalan Quetzal', code: 'GTQ', symbol: 'Q' },
60
+ GYD: { name: 'Guyanaese Dollar', code: 'GYD', symbol: '$' },
61
+ HKD: { name: 'Hong Kong Dollar', code: 'HKD', symbol: '$' },
62
+ HNL: { name: 'Honduran Lempira', code: 'HNL', symbol: 'L' },
63
+ HRK: { name: 'Croatian Kuna', code: 'HRK', symbol: 'kn' },
64
+ HTG: { name: 'Haitian Gourde', code: 'HTG', symbol: 'G' },
65
+ HUF: { name: 'Hungarian Forint', code: 'HUF', symbol: 'Ft' },
66
+ IDR: { name: 'Indonesian Rupiah', code: 'IDR', symbol: 'Rp' },
67
+ ILS: { name: 'Israeli New Shekel', code: 'ILS', symbol: '₪' },
68
+ INR: { name: 'Indian Rupee', code: 'INR', symbol: '₹' },
69
+ IQD: { name: 'Iraqi Dinar', code: 'IQD', symbol: 'ع.د' },
70
+ IRR: { name: 'Iranian Rial', code: 'IRR', symbol: '﷼' },
71
+ ISK: { name: 'Icelandic Króna', code: 'ISK', symbol: 'kr' },
72
+ JMD: { name: 'Jamaican Dollar', code: 'JMD', symbol: 'J$' },
73
+ JOD: { name: 'Jordanian Dinar', code: 'JOD', symbol: 'د.ا' },
74
+ JPY: { name: 'Japanese Yen', code: 'JPY', symbol: '¥' },
75
+ KES: { name: 'Kenyan Shilling', code: 'KES', symbol: 'KSh' },
76
+ KGS: { name: 'Kyrgystani Som', code: 'KGS', symbol: 'лв' },
77
+ KHR: { name: 'Cambodian Riel', code: 'KHR', symbol: '៛' },
78
+ KMF: { name: 'Comorian Franc', code: 'KMF', symbol: 'CF' },
79
+ KPW: { name: 'North Korean Won', code: 'KPW', symbol: '₩' },
80
+ KRW: { name: 'South Korean Won', code: 'KRW', symbol: '₩' },
81
+ KWD: { name: 'Kuwaiti Dinar', code: 'KWD', symbol: 'د.ك' },
82
+ KYD: { name: 'Cayman Islands Dollar', code: 'KYD', symbol: '$' },
83
+ KZT: { name: 'Kazakhstani Tenge', code: 'KZT', symbol: '₸' },
84
+ LAK: { name: 'Laotian Kip', code: 'LAK', symbol: '₭' },
85
+ LBP: { name: 'Lebanese Pound', code: 'LBP', symbol: '£' },
86
+ LKR: { name: 'Sri Lankan Rupee', code: 'LKR', symbol: 'Rs' },
87
+ LRD: { name: 'Liberian Dollar', code: 'LRD', symbol: '$' },
88
+ LSL: { name: 'Lesotho Loti', code: 'LSL', symbol: 'L' },
89
+ LYD: { name: 'Libyan Dinar', code: 'LYD', symbol: 'ل.د' },
90
+ MAD: { name: 'Moroccan Dirham', code: 'MAD', symbol: 'د.م.' },
91
+ MDL: { name: 'Moldovan Leu', code: 'MDL', symbol: 'L' },
92
+ MGA: { name: 'Malagasy Ariary', code: 'MGA', symbol: 'Ar' },
93
+ MKD: { name: 'Macedonian Denar', code: 'MKD', symbol: 'ден' },
94
+ MMK: { name: 'Myanmar Kyat', code: 'MMK', symbol: 'K' },
95
+ MNT: { name: 'Mongolian Tugrik', code: 'MNT', symbol: '₮' },
96
+ MOP: { name: 'Macanese Pataca', code: 'MOP', symbol: 'MOP$' },
97
+ MRU: { name: 'Mauritanian Ouguiya', code: 'MRU', symbol: 'UM' },
98
+ MUR: { name: 'Mauritian Rupee', code: 'MUR', symbol: '₨' },
99
+ MVR: { name: 'Maldivian Rufiyaa', code: 'MVR', symbol: 'Rf' },
100
+ MWK: { name: 'Malawian Kwacha', code: 'MWK', symbol: 'MK' },
101
+ MXN: { name: 'Mexican Peso', code: 'MXN', symbol: '$' },
102
+ MYR: { name: 'Malaysian Ringgit', code: 'MYR', symbol: 'RM' },
103
+ MZN: { name: 'Mozambican Metical', code: 'MZN', symbol: 'MT' },
104
+ NAD: { name: 'Namibian Dollar', code: 'NAD', symbol: '$' },
105
+ NGN: { name: 'Nigerian Naira', code: 'NGN', symbol: '₦' },
106
+ NIO: { name: 'Nicaraguan Córdoba', code: 'NIO', symbol: 'C$' },
107
+ NOK: { name: 'Norwegian Krone', code: 'NOK', symbol: 'kr' },
108
+ NPR: { name: 'Nepalese Rupee', code: 'NPR', symbol: '₨' },
109
+ NZD: { name: 'New Zealand Dollar', code: 'NZD', symbol: '$' },
110
+ OMR: { name: 'Omani Rial', code: 'OMR', symbol: 'ر.ع.' },
111
+ PAB: { name: 'Panamanian Balboa', code: 'PAB', symbol: 'B/.' },
112
+ PEN: { name: 'Peruvian Sol', code: 'PEN', symbol: 'S/.' },
113
+ PGK: { name: 'Papua New Guinean Kina', code: 'PGK', symbol: 'K' },
114
+ PHP: { name: 'Philippine Peso', code: 'PHP', symbol: '₱' },
115
+ PKR: { name: 'Pakistani Rupee', code: 'PKR', symbol: '₨' },
116
+ PLN: { name: 'Polish Zloty', code: 'PLN', symbol: 'zł' },
117
+ PYG: { name: 'Paraguayan Guarani', code: 'PYG', symbol: 'Gs' },
118
+ QAR: { name: 'Qatari Rial', code: 'QAR', symbol: 'ر.ق' },
119
+ RON: { name: 'Romanian Leu', code: 'RON', symbol: 'lei' },
120
+ RSD: { name: 'Serbian Dinar', code: 'RSD', symbol: 'Дин.' },
121
+ RUB: { name: 'Russian Ruble', code: 'RUB', symbol: '₽' },
122
+ RWF: { name: 'Rwandan Franc', code: 'RWF', symbol: 'FRw' },
123
+ SAR: { name: 'Saudi Riyal', code: 'SAR', symbol: 'ر.س' },
124
+ SBD: { name: 'Solomon Islands Dollar', code: 'SBD', symbol: '$' },
125
+ SCR: { name: 'Seychellois Rupee', code: 'SCR', symbol: '₨' },
126
+ SDG: { name: 'Sudanese Pound', code: 'SDG', symbol: 'ج.س.' },
127
+ SEK: { name: 'Swedish Krona', code: 'SEK', symbol: 'kr' },
128
+ SGD: { name: 'Singapore Dollar', code: 'SGD', symbol: 'S$' },
129
+ SHP: { name: 'Saint Helena Pound', code: 'SHP', symbol: '£' },
130
+ SLL: { name: 'Sierra Leonean Leone', code: 'SLL', symbol: 'Le' },
131
+ SOS: { name: 'Somali Shilling', code: 'SOS', symbol: 'S' },
132
+ SRD: { name: 'Surinamese Dollar', code: 'SRD', symbol: '$' },
133
+ SSP: { name: 'South Sudanese Pound', code: 'SSP', symbol: '£' },
134
+ STN: { name: 'São Tomé & Príncipe Dobra', code: 'STN', symbol: 'Db' },
135
+ SYP: { name: 'Syrian Pound', code: 'SYP', symbol: '£' },
136
+ SZL: { name: 'Swazi Lilangeni', code: 'SZL', symbol: 'L' },
137
+ THB: { name: 'Thai Baht', code: 'THB', symbol: '฿' },
138
+ TJS: { name: 'Tajikistani Somoni', code: 'TJS', symbol: 'SM' },
139
+ TMT: { name: 'Turkmenistani Manat', code: 'TMT', symbol: 'T' },
140
+ TND: { name: 'Tunisian Dinar', code: 'TND', symbol: 'د.ت' },
141
+ TOP: { name: 'Tongan Paʻanga', code: 'TOP', symbol: 'T$' },
142
+ TRY: { name: 'Turkish Lira', code: 'TRY', symbol: '₺' },
143
+ TTD: { name: 'Trinidad & Tobago Dollar', code: 'TTD', symbol: 'TT$' },
144
+ TWD: { name: 'New Taiwan Dollar', code: 'TWD', symbol: 'NT$' },
145
+ TZS: { name: 'Tanzanian Shilling', code: 'TZS', symbol: 'TSh' },
146
+ UAH: { name: 'Ukrainian Hryvnia', code: 'UAH', symbol: '₴' },
147
+ UGX: { name: 'Ugandan Shilling', code: 'UGX', symbol: 'USh' },
148
+ USD: { name: 'US Dollar', code: 'USD', symbol: '$' },
149
+ UYU: { name: 'Uruguayan Peso', code: 'UYU', symbol: '$U' },
150
+ UZS: { name: 'Uzbekistani Som', code: 'UZS', symbol: 'лв' },
151
+ VES: { name: 'Venezuelan Bolívar', code: 'VES', symbol: 'Bs.S.' },
152
+ VND: { name: 'Vietnamese Dong', code: 'VND', symbol: '₫' },
153
+ VUV: { name: 'Vanuatu Vatu', code: 'VUV', symbol: 'VT' },
154
+ WST: { name: 'Samoan Tala', code: 'WST', symbol: 'WS$' },
155
+ XAF: { name: 'CFA Franc BEAC', code: 'XAF', symbol: 'FCFA' },
156
+ XCD: { name: 'East Caribbean Dollar', code: 'XCD', symbol: '$' },
157
+ XOF: { name: 'CFA Franc BCEAO', code: 'XOF', symbol: 'CFA' },
158
+ XPF: { name: 'CFP Franc', code: 'XPF', symbol: '₣' },
159
+ YER: { name: 'Yemeni Rial', code: 'YER', symbol: '﷼' },
160
+ ZAR: { name: 'South African Rand', code: 'ZAR', symbol: 'R' },
161
+ ZMW: { name: 'Zambian Kwacha', code: 'ZMW', symbol: 'ZK' },
162
+ ZWL: { name: 'Zimbabwean Dollar', code: 'ZWL', symbol: '$' }
163
+ };
@@ -70,8 +70,10 @@ export const MENU_ITEM_REGISTRY: RegistryItem[] = [
70
70
  { key: 'core__feature_registry', label: 'Feature Registry', path: '/system/features', module: 'Core', defaultGroup: 'System Auditing' },
71
71
  { key: 'core__menu_config', label: 'Menu Configuration', path: '/menu-config', module: 'Core', defaultGroup: 'System' },
72
72
  { key: 'core__printables', label: 'Printable Templates', path: '/system/printables', module: 'Core', defaultGroup: 'System' },
73
+ { key: 'core__template_groups', label: 'Template Groups', path: '/system/template-groups', module: 'Core', defaultGroup: 'System' },
73
74
  { key: 'core__warehouses', label: 'Warehouses', path: '/warehouses', module: 'Core', defaultGroup: 'Resources' },
74
75
  { key: 'core__terminals', label: 'Terminals', path: '/terminals', module: 'Core', defaultGroup: 'Resources' },
76
+ { key: 'core__currencies', label: 'Currencies', path: '/currencies', module: 'Core', defaultGroup: 'Settings' },
75
77
 
76
78
  // ── Inventory Module ──
77
79
  { key: 'inventory__items', label: 'Items', path: '/inventory/items', module: 'Inventory', defaultGroup: 'Catalog' },
@@ -143,6 +145,21 @@ export const MENU_ITEM_REGISTRY: RegistryItem[] = [
143
145
  { key: 'jewelry__settings', label: 'Settings', path: '/jewelry/settings', module: 'Jewelry', defaultGroup: 'Configuration' },
144
146
  { key: 'jewelry__reports', label: 'Reports & Dashboards', path: '/reports/jewelry', module: 'Jewelry', defaultGroup: 'Analytics' },
145
147
 
148
+ // ── HR Module ──
149
+ { key: 'hr__employees', label: 'Employees', path: '/hr/employees', module: 'HR', defaultGroup: 'Core' },
150
+ { key: 'hr__directory', label: 'Directory', path: '/hr/directory', module: 'HR', defaultGroup: 'Core' },
151
+ { key: 'hr__org_chart', label: 'Org Chart', path: '/hr/org-chart', module: 'HR', defaultGroup: 'Core' },
152
+
153
+ { key: 'hr__attendance', label: 'Attendance', path: '/hr/attendance', module: 'HR', defaultGroup: 'Time' },
154
+ { key: 'hr__regularisation', label: 'Regularisation', path: '/hr/regularisation', module: 'HR', defaultGroup: 'Time' },
155
+ { key: 'hr__shift_templates', label: 'Shift Templates', path: '/hr/shift-templates', module: 'HR', defaultGroup: 'Time' },
156
+ { key: 'hr__rosters', label: 'Roster Builder', path: '/hr/rosters', module: 'HR', defaultGroup: 'Time' },
157
+ { key: 'hr__shift_exchanges', label: 'Shift Exchanges', path: '/hr/shift-exchanges', module: 'HR', defaultGroup: 'Time' },
158
+ { key: 'hr__shift_allowances', label: 'Shift Allowances', path: '/hr/shift-allowances', module: 'HR', defaultGroup: 'Time' },
159
+ { key: 'hr__leave_types', label: 'Leave Types', path: '/hr/leave-types', module: 'HR', defaultGroup: 'Time' },
160
+ { key: 'hr__holidays', label: 'Holidays', path: '/hr/holidays', module: 'HR', defaultGroup: 'Time' },
161
+ { key: 'hr__leave', label: 'Leave Management', path: '/hr/leave', module: 'HR', defaultGroup: 'Time' },
162
+ { key: 'hr__designations', label: 'Designations', path: '/hr/designations', module: 'HR', defaultGroup: 'Admin' },
146
163
  // ── Money Exchange Module ──
147
164
  { key: 'money_exchange__dashboard', label: 'Dashboard', path: '/money-exchange', module: 'Money Exchange', defaultGroup: 'Overview' },
148
165
  { key: 'money_exchange__rates', label: 'Rates Management', path: '/money-exchange/rates', module: 'Money Exchange', defaultGroup: 'Overview' },
@@ -155,6 +172,7 @@ export const MENU_ITEM_REGISTRY: RegistryItem[] = [
155
172
  { key: 'money_exchange__remittance_corridors', label: 'Corridors', path: '/money-exchange/corridors', module: 'Money Exchange', defaultGroup: 'Remittances' },
156
173
  { key: 'money_exchange__remittances', label: 'Transactions', path: '/money-exchange/remittances', module: 'Money Exchange', defaultGroup: 'Remittances' },
157
174
  { key: 'money_exchange__remittance_settlements', label: 'Settlements', path: '/money-exchange/settlements', module: 'Money Exchange', defaultGroup: 'Remittances' },
175
+ { key: 'money_exchange__denominations', label: 'Denomination', path: '/money-exchange/denominations', module: 'Money Exchange', defaultGroup: 'Config' },
158
176
  ];
159
177
 
160
178
  /**
@@ -238,7 +256,7 @@ export const MENU_PRESETS: MenuPreset[] = [
238
256
  'core__warehouses', 'core__terminals',
239
257
  'core__activity_logs', 'core__api_requests', 'core__feature_access_logs',
240
258
  'core__issue_logs', 'core__feature_registry', 'core__menu_config',
241
- 'core__printables',
259
+ 'core__printables', 'core__template_groups', 'core__currencies',
242
260
  ],
243
261
  },
244
262
  {
@@ -300,6 +318,14 @@ export const MENU_PRESETS: MenuPreset[] = [
300
318
  'jewelry__settings',
301
319
  ],
302
320
  },
321
+ {
322
+ id: 'hr',
323
+ label: 'HR',
324
+ iconName: 'Users',
325
+ secondaryItems: [
326
+ 'hr__employees', 'hr__directory', 'hr__org_chart', 'hr__attendance', 'hr__regularisation', 'hr__shifts', 'hr__shift_templates', 'hr__rosters', 'hr__shift_exchanges', 'hr__shift_allowances', 'hr__leave_types', 'hr__holidays', 'hr__leave', 'hr__designations'
327
+ ]
328
+ },
303
329
  {
304
330
  id: 'money_exchange',
305
331
  label: 'Money Exchange',
@@ -316,6 +342,7 @@ export const MENU_PRESETS: MenuPreset[] = [
316
342
  'money_exchange__remittance_corridors',
317
343
  'money_exchange__remittances',
318
344
  'money_exchange__remittance_settlements',
345
+ 'money_exchange__denominations',
319
346
  ],
320
347
  },
321
348
  ],
@@ -348,6 +375,7 @@ export const APP_MENUS: MainMenuItem[] = [
348
375
  items: [
349
376
  { id: "menu_config", label: "Menu Configuration", path: "/menu-config" },
350
377
  { id: "printables", label: "Printable Templates", path: "/system/printables" },
378
+ { id: "template_groups", label: "Template Groups", path: "/system/template-groups" },
351
379
  ],
352
380
  },
353
381
  {
@@ -369,6 +397,13 @@ export const APP_MENUS: MainMenuItem[] = [
369
397
  { id: "feature_registry", label: "Feature Registry", path: "/system/features" },
370
398
  ],
371
399
  },
400
+ {
401
+ id: "core_settings",
402
+ label: "Settings",
403
+ items: [
404
+ { id: "currencies", label: "Currencies", path: "/currencies" },
405
+ ],
406
+ },
372
407
  ],
373
408
  },
374
409
  {
@@ -691,6 +726,13 @@ export const APP_MENUS: MainMenuItem[] = [
691
726
  { id: "money_exchange_remittance_settlements", label: "Settlements", path: "/money-exchange/settlements" },
692
727
  ],
693
728
  },
729
+ {
730
+ id: "money_exchange_config",
731
+ label: "Config",
732
+ items: [
733
+ { id: "money_exchange_denominations", label: "Denomination", path: "/money-exchange/denominations" },
734
+ ],
735
+ },
694
736
  ],
695
737
  },
696
738
  ];
@@ -0,0 +1,50 @@
1
+ import { CURRENCIES, type ICurrencyDetails } from '../constants/currencies';
2
+ import { sendRequest } from './httpClient';
3
+
4
+ /**
5
+ * Retrieve the active/used currency based on the backend configuration.
6
+ */
7
+ export async function getUsedCurrency(): Promise<ICurrencyDetails | null> {
8
+ try {
9
+ const response = await sendRequest<any>({
10
+ url: `${process.env.NEXT_PUBLIC_API_URL}/api/core/config/used_currency`,
11
+ method: 'GET',
12
+ });
13
+
14
+ if (response.ok && response.responseData.is_success && response.responseData.result) {
15
+ const currency = response.responseData.result;
16
+
17
+ // Return from database core_currencies row directly
18
+ if (currency && typeof currency === 'object' && currency.code) {
19
+ return {
20
+ name: currency.name || currency.code,
21
+ code: currency.code,
22
+ symbol: currency.symbol || currency.code,
23
+ };
24
+ }
25
+
26
+ return getCurrency(currency as string);
27
+ }
28
+ } catch (error) {
29
+ console.error('Failed to fetch used currency:', error);
30
+ }
31
+
32
+ return null;
33
+ }
34
+
35
+
36
+ /**
37
+ * Retrieve metadata details (name, code, symbol) for a currency by its ISO code.
38
+ */
39
+ export function getCurrency(code: string): ICurrencyDetails | null {
40
+ if (!code) return null;
41
+ return CURRENCIES[code.toUpperCase()] || null;
42
+ }
43
+
44
+ /**
45
+ * Retrieve the symbol for a currency by its ISO code. Falls back to returning the code if not found.
46
+ */
47
+ export function getCurrencySymbol(code: string): string {
48
+ if (!code) return '';
49
+ return CURRENCIES[code.toUpperCase()]?.symbol || code;
50
+ }