@apptimate/core-lib 1.0.0 → 1.2.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/CHANGELOG.md +7 -7
- package/package.json +16 -16
- package/src/client.ts +10 -0
- package/src/common/interfaces/ICommon.ts +6 -6
- package/src/constants/iconRegistry.ts +189 -0
- package/src/constants/menus.ts +576 -0
- package/src/constants/storageKeys.ts +14 -9
- package/src/index.ts +3 -8
- package/src/server.ts +12 -0
- package/src/utils/apiProxy.ts +155 -0
- package/src/utils/bem.ts +13 -13
- package/src/utils/bootstrapConfig.ts +80 -0
- package/src/utils/cn.ts +9 -9
- package/src/utils/commonService.ts +46 -26
- package/src/utils/cookiesHandler.ts +64 -64
- package/src/utils/httpClient.ts +192 -161
- package/src/utils/localStorageHandler.ts +59 -49
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
export interface SubMenuItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
path: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface SubMenuGroup {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
items: SubMenuItem[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface MainMenuItem {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
iconName: string;
|
|
17
|
+
groups: SubMenuGroup[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A secondary item in a saved menu config.
|
|
22
|
+
* Can be a plain registry key (backward compat) or an enriched object
|
|
23
|
+
* with optional label/group overrides.
|
|
24
|
+
*/
|
|
25
|
+
export type SecondaryItemConfig = string | {
|
|
26
|
+
key: string;
|
|
27
|
+
/** Override the default label from the registry */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** Override the default group from the registry */
|
|
30
|
+
group?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** Normalize a SecondaryItemConfig to its key string. */
|
|
34
|
+
export function secondaryItemKey(item: SecondaryItemConfig): string {
|
|
35
|
+
return typeof item === 'string' ? item : item.key;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Normalize a SecondaryItemConfig to the enriched shape. */
|
|
39
|
+
export function normalizeSecondaryItem(item: SecondaryItemConfig): { key: string; label?: string; group?: string } {
|
|
40
|
+
return typeof item === 'string' ? { key: item } : item;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ─── MASTER REGISTRY ─────────────────────────────────────────────
|
|
44
|
+
// Every possible secondary menu item across all modules.
|
|
45
|
+
// These are the building blocks that can be assembled into custom menus.
|
|
46
|
+
|
|
47
|
+
export interface RegistryItem {
|
|
48
|
+
/** Unique key used for selection, e.g. "core__users" */
|
|
49
|
+
key: string;
|
|
50
|
+
/** Human-readable label */
|
|
51
|
+
label: string;
|
|
52
|
+
/** URL path */
|
|
53
|
+
path: string;
|
|
54
|
+
/** Which module this belongs to */
|
|
55
|
+
module: string;
|
|
56
|
+
/** Default group label when added to a menu */
|
|
57
|
+
defaultGroup: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const MENU_ITEM_REGISTRY: RegistryItem[] = [
|
|
61
|
+
// ── Core Module ──
|
|
62
|
+
{ key: 'core__users', label: 'Users', path: '/users', module: 'Core', defaultGroup: 'User Management' },
|
|
63
|
+
{ key: 'core__roles', label: 'Roles', path: '/roles', module: 'Core', defaultGroup: 'User Management' },
|
|
64
|
+
{ key: 'core__organizations', label: 'Organizations', path: '/organizations', module: 'Core', defaultGroup: 'User Management' },
|
|
65
|
+
{ key: 'core__parties', label: 'Parties', path: '/parties', module: 'Core', defaultGroup: 'User Management' },
|
|
66
|
+
{ key: 'core__activity_logs', label: 'Activity Logs', path: '/activity-logs', module: 'Core', defaultGroup: 'System Auditing' },
|
|
67
|
+
{ key: 'core__api_requests', label: 'API Requests', path: '/system/api-requests', module: 'Core', defaultGroup: 'System Auditing' },
|
|
68
|
+
{ key: 'core__feature_access_logs', label: 'Feature Access Logs', path: '/system/feature-access-logs', module: 'Core', defaultGroup: 'System Auditing' },
|
|
69
|
+
{ key: 'core__issue_logs', label: 'Issue Logs', path: '/system/issue-logs', module: 'Core', defaultGroup: 'System Auditing' },
|
|
70
|
+
{ key: 'core__feature_registry', label: 'Feature Registry', path: '/system/features', module: 'Core', defaultGroup: 'System Auditing' },
|
|
71
|
+
{ key: 'core__menu_config', label: 'Menu Configuration', path: '/menu-config', module: 'Core', defaultGroup: 'System' },
|
|
72
|
+
{ key: 'core__printables', label: 'Printable Templates', path: '/system/printables', module: 'Core', defaultGroup: 'System' },
|
|
73
|
+
{ key: 'core__warehouses', label: 'Warehouses', path: '/warehouses', module: 'Core', defaultGroup: 'Resources' },
|
|
74
|
+
{ key: 'core__terminals', label: 'Terminals', path: '/terminals', module: 'Core', defaultGroup: 'Resources' },
|
|
75
|
+
|
|
76
|
+
// ── Inventory Module ──
|
|
77
|
+
{ key: 'inventory__items', label: 'Items', path: '/inventory/items', module: 'Inventory', defaultGroup: 'Catalog' },
|
|
78
|
+
{ key: 'inventory__categories', label: 'Categories', path: '/inventory/categories', module: 'Inventory', defaultGroup: 'Catalog' },
|
|
79
|
+
{ key: 'inventory__brands', label: 'Brands', path: '/inventory/brands', module: 'Inventory', defaultGroup: 'Catalog' },
|
|
80
|
+
{ key: 'inventory__uom', label: 'Units of Measure', path: '/inventory/uom', module: 'Inventory', defaultGroup: 'Catalog' },
|
|
81
|
+
|
|
82
|
+
{ key: 'inventory__stock', label: 'Stock Overview', path: '/inventory/stock', module: 'Inventory', defaultGroup: 'Stock' },
|
|
83
|
+
{ key: 'inventory__ledger', label: 'Stock Movements', path: '/inventory/ledger', module: 'Inventory', defaultGroup: 'Stock' },
|
|
84
|
+
{ key: 'inventory__adjustments', label: 'Adjustments', path: '/inventory/adjustments', module: 'Inventory', defaultGroup: 'Operations' },
|
|
85
|
+
{ key: 'inventory__transfers', label: 'Transfers', path: '/inventory/transfers', module: 'Inventory', defaultGroup: 'Operations' },
|
|
86
|
+
{ key: 'inventory__serials', label: 'Serial Numbers', path: '/inventory/serials', module: 'Inventory', defaultGroup: 'Operations' },
|
|
87
|
+
|
|
88
|
+
// ── Sales Module ──
|
|
89
|
+
{ key: 'sales__price_lists', label: 'Price Lists', path: '/sales/price-lists', module: 'Sales', defaultGroup: 'Master Data' },
|
|
90
|
+
{ key: 'sales__quotations', label: 'Quotations', path: '/sales/quotations', module: 'Sales', defaultGroup: 'Orders' },
|
|
91
|
+
{ key: 'sales__orders', label: 'Sales Orders', path: '/sales/orders', module: 'Sales', defaultGroup: 'Orders' },
|
|
92
|
+
{ key: 'sales__goods_issue_notes', label: 'Goods Issue Notes', path: '/sales/delivery-notes', module: 'Sales', defaultGroup: 'Fulfillment' },
|
|
93
|
+
{ key: 'sales__returns', label: 'Sales Returns', path: '/sales/returns', module: 'Sales', defaultGroup: 'Post-Sales' },
|
|
94
|
+
{ key: 'sales__credit_notes', label: 'Credit Notes', path: '/sales/credit-notes', module: 'Sales', defaultGroup: 'Post-Sales' },
|
|
95
|
+
{ key: 'sales__pos', label: 'POS Terminal', path: '/sales/pos', module: 'Sales', defaultGroup: 'POS' },
|
|
96
|
+
|
|
97
|
+
{ key: 'sales__pos_sessions', label: 'Terminal Sessions', path: '/sales/pos/sessions', module: 'Sales', defaultGroup: 'POS' },
|
|
98
|
+
{ key: 'sales__reports', label: 'Sales Reports', path: '/sales/reports', module: 'Sales', defaultGroup: 'Analytics' },
|
|
99
|
+
|
|
100
|
+
// ── Procurement Module ──
|
|
101
|
+
{ key: 'procurement__orders', label: 'Purchase Orders', path: '/procurement/orders', module: 'Procurement', defaultGroup: 'Orders' },
|
|
102
|
+
{ key: 'procurement__grn', label: 'Goods Receipt', path: '/procurement/grns', module: 'Procurement', defaultGroup: 'Receiving' },
|
|
103
|
+
{ key: 'procurement__invoices', label: 'Invoices', path: '/finance/invoices', module: 'Procurement', defaultGroup: 'Finance' },
|
|
104
|
+
{ key: 'procurement__payments', label: 'Payments', path: '/finance/payments', module: 'Procurement', defaultGroup: 'Finance' },
|
|
105
|
+
|
|
106
|
+
// ── Finance Module ──
|
|
107
|
+
{ key: 'finance__invoices', label: 'Invoices', path: '/finance/invoices', module: 'Finance', defaultGroup: 'Transactions' },
|
|
108
|
+
{ key: 'finance__payments', label: 'Payments', path: '/finance/payments', module: 'Finance', defaultGroup: 'Transactions' },
|
|
109
|
+
{ key: 'finance__chart_of_accounts', label: 'Chart of Accounts', path: '/finance/chart-of-accounts', module: 'Finance', defaultGroup: 'Accounting' },
|
|
110
|
+
{ key: 'finance__journal_entries', label: 'Journal Entries', path: '/finance/journal-entries', module: 'Finance', defaultGroup: 'Accounting' },
|
|
111
|
+
{ key: 'finance__fiscal_years', label: 'Fiscal Years', path: '/finance/fiscal-years', module: 'Finance', defaultGroup: 'Accounting' },
|
|
112
|
+
{ key: 'finance__trial_balance', label: 'Trial Balance', path: '/finance/reports/trial-balance', module: 'Finance', defaultGroup: 'Reports' },
|
|
113
|
+
{ key: 'finance__profit_loss', label: 'Profit & Loss', path: '/finance/reports/profit-loss', module: 'Finance', defaultGroup: 'Reports' },
|
|
114
|
+
{ key: 'finance__balance_sheet', label: 'Balance Sheet', path: '/finance/reports/balance-sheet', module: 'Finance', defaultGroup: 'Reports' },
|
|
115
|
+
{ key: 'finance__account_ledger', label: 'Account Ledger', path: '/finance/reports/account-ledger', module: 'Finance', defaultGroup: 'Reports' },
|
|
116
|
+
{ key: 'finance__payment_modes', label: 'Payment Modes', path: '/finance/payment-modes', module: 'Finance', defaultGroup: 'Settings' },
|
|
117
|
+
{ key: 'finance__bank_accounts', label: 'Bank Accounts', path: '/finance/bank-accounts', module: 'Finance', defaultGroup: 'Settings' },
|
|
118
|
+
{ key: 'finance__account_mappings', label: 'Account Mappings', path: '/finance/account-mappings', module: 'Finance', defaultGroup: 'Settings' },
|
|
119
|
+
|
|
120
|
+
// ── Jewelry Module ──
|
|
121
|
+
{ key: 'jewelry__items', label: 'Jewelry Items', path: '/jewelry/items', module: 'Jewelry', defaultGroup: 'Catalog' },
|
|
122
|
+
{ key: 'jewelry__categories', label: 'Categories', path: '/jewelry/categories', module: 'Jewelry', defaultGroup: 'Catalog' },
|
|
123
|
+
{ key: 'jewelry__material_types', label: 'Material Types', path: '/jewelry/material-types', module: 'Jewelry', defaultGroup: 'Master Data' },
|
|
124
|
+
{ key: 'jewelry__purities', label: 'Purities', path: '/jewelry/purities', module: 'Jewelry', defaultGroup: 'Master Data' },
|
|
125
|
+
{ key: 'jewelry__metal_rates', label: 'Metal Rates', path: '/jewelry/metal-rates', module: 'Jewelry', defaultGroup: 'Master Data' },
|
|
126
|
+
{ key: 'jewelry__purchase_orders', label: 'Purchase Orders', path: '/jewelry/procurement/orders', module: 'Jewelry', defaultGroup: 'Procurement' },
|
|
127
|
+
{ key: 'jewelry__grn', label: 'Goods Receipt', path: '/jewelry/procurement/grn', module: 'Jewelry', defaultGroup: 'Procurement' },
|
|
128
|
+
{ key: 'jewelry__custom_orders', label: 'Custom Orders', path: '/jewelry/custom-orders', module: 'Jewelry', defaultGroup: 'Procurement' },
|
|
129
|
+
{ key: 'jewelry__transformations', label: 'Transformations', path: '/jewelry/procurement/transformations', module: 'Jewelry', defaultGroup: 'Procurement' },
|
|
130
|
+
{ key: 'jewelry__old_gold_purchases', label: 'Old Material Purchases', path: '/jewelry/old-gold-purchases', module: 'Jewelry', defaultGroup: 'Buying' },
|
|
131
|
+
{ key: 'jewelry__sales', label: 'Sales', path: '/jewelry/sales', module: 'Jewelry', defaultGroup: 'Sales' },
|
|
132
|
+
{ key: 'jewelry__sales_orders', label: 'Sales Orders', path: '/jewelry/sales/orders', module: 'Jewelry', defaultGroup: 'Sales' },
|
|
133
|
+
{ key: 'jewelry__stock_balances', label: 'Stock Balances', path: '/jewelry/stock/balances', module: 'Jewelry', defaultGroup: 'Stock' },
|
|
134
|
+
{ key: 'jewelry__stock_movements', label: 'Stock Movements', path: '/jewelry/stock/movements', module: 'Jewelry', defaultGroup: 'Stock' },
|
|
135
|
+
{ key: 'jewelry__party_transactions', label: 'Party Transactions', path: '/jewelry/party-transactions', module: 'Jewelry', defaultGroup: 'Karigar' },
|
|
136
|
+
{ key: 'jewelry__settings', label: 'Settings', path: '/jewelry/settings', module: 'Jewelry', defaultGroup: 'Configuration' },
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get all unique module names from the registry.
|
|
141
|
+
*/
|
|
142
|
+
export function getRegistryModules(): string[] {
|
|
143
|
+
const modules = new Set(MENU_ITEM_REGISTRY.map(item => item.module));
|
|
144
|
+
return Array.from(modules);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get registry items filtered by module.
|
|
149
|
+
*/
|
|
150
|
+
export function getRegistryItemsByModule(module: string): RegistryItem[] {
|
|
151
|
+
return MENU_ITEM_REGISTRY.filter(item => item.module === module);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Resolve secondary item configs into MainMenuItem groups.
|
|
156
|
+
* Accepts both plain string keys (legacy) and enriched objects with
|
|
157
|
+
* optional label / group overrides.
|
|
158
|
+
*/
|
|
159
|
+
export function resolveRegistryKeys(items: SecondaryItemConfig[]): SubMenuGroup[] {
|
|
160
|
+
const groupMap = new Map<string, SubMenuItem[]>();
|
|
161
|
+
// Track insertion order of groups
|
|
162
|
+
const groupOrder: string[] = [];
|
|
163
|
+
|
|
164
|
+
for (const raw of items) {
|
|
165
|
+
const cfg = normalizeSecondaryItem(raw);
|
|
166
|
+
const reg = MENU_ITEM_REGISTRY.find(r => r.key === cfg.key);
|
|
167
|
+
if (!reg) continue;
|
|
168
|
+
|
|
169
|
+
const groupLabel = cfg.group || reg.defaultGroup;
|
|
170
|
+
|
|
171
|
+
if (!groupMap.has(groupLabel)) {
|
|
172
|
+
groupMap.set(groupLabel, []);
|
|
173
|
+
groupOrder.push(groupLabel);
|
|
174
|
+
}
|
|
175
|
+
groupMap.get(groupLabel)!.push({
|
|
176
|
+
id: cfg.key,
|
|
177
|
+
label: cfg.label || reg.label,
|
|
178
|
+
path: reg.path,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return groupOrder.map(label => ({
|
|
183
|
+
id: label.toLowerCase().replace(/[^a-z0-9]+/g, '_'),
|
|
184
|
+
label,
|
|
185
|
+
items: groupMap.get(label)!,
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// ─── PRESET MENU CONFIGURATIONS ──────────────────────────────────
|
|
191
|
+
// These are the default/example configs for different business types.
|
|
192
|
+
|
|
193
|
+
export interface MenuPreset {
|
|
194
|
+
id: string;
|
|
195
|
+
label: string;
|
|
196
|
+
description: string;
|
|
197
|
+
primaryMenus: {
|
|
198
|
+
id: string;
|
|
199
|
+
label: string;
|
|
200
|
+
iconName: string;
|
|
201
|
+
secondaryItems: string[]; // registry keys
|
|
202
|
+
}[];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export const MENU_PRESETS: MenuPreset[] = [
|
|
206
|
+
{
|
|
207
|
+
id: 'default_full',
|
|
208
|
+
label: 'Core Only',
|
|
209
|
+
description: 'System modules only',
|
|
210
|
+
primaryMenus: [
|
|
211
|
+
{
|
|
212
|
+
id: 'core',
|
|
213
|
+
label: 'Core',
|
|
214
|
+
iconName: 'Settings',
|
|
215
|
+
secondaryItems: [
|
|
216
|
+
'core__users', 'core__roles', 'core__organizations', 'core__parties',
|
|
217
|
+
'core__warehouses', 'core__terminals',
|
|
218
|
+
'core__activity_logs', 'core__api_requests', 'core__feature_access_logs',
|
|
219
|
+
'core__issue_logs', 'core__feature_registry', 'core__menu_config',
|
|
220
|
+
'core__printables',
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: 'inventory',
|
|
225
|
+
label: 'Inventory',
|
|
226
|
+
iconName: 'Package',
|
|
227
|
+
secondaryItems: [
|
|
228
|
+
'inventory__items', 'inventory__categories', 'inventory__brands', 'inventory__uom',
|
|
229
|
+
'inventory__stock', 'inventory__ledger',
|
|
230
|
+
'inventory__adjustments', 'inventory__transfers', 'inventory__serials',
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: 'sales',
|
|
235
|
+
label: 'Sales',
|
|
236
|
+
iconName: 'ShoppingCart',
|
|
237
|
+
secondaryItems: [
|
|
238
|
+
'sales__price_lists',
|
|
239
|
+
'sales__quotations', 'sales__orders', 'sales__goods_issue_notes',
|
|
240
|
+
'sales__returns', 'sales__credit_notes',
|
|
241
|
+
'sales__pos', 'sales__pos_sessions', 'sales__reports',
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: 'procurement',
|
|
246
|
+
label: 'Procurement',
|
|
247
|
+
iconName: 'Truck',
|
|
248
|
+
secondaryItems: [
|
|
249
|
+
'procurement__orders', 'procurement__grn',
|
|
250
|
+
'procurement__invoices', 'procurement__payments',
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: 'finance',
|
|
255
|
+
label: 'Finance',
|
|
256
|
+
iconName: 'Wallet',
|
|
257
|
+
secondaryItems: [
|
|
258
|
+
'finance__invoices', 'finance__payments',
|
|
259
|
+
'finance__chart_of_accounts', 'finance__journal_entries', 'finance__fiscal_years',
|
|
260
|
+
'finance__trial_balance', 'finance__profit_loss', 'finance__balance_sheet', 'finance__account_ledger',
|
|
261
|
+
'finance__payment_modes', 'finance__bank_accounts', 'finance__account_mappings',
|
|
262
|
+
],
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: 'jewelry',
|
|
266
|
+
label: 'Jewelry',
|
|
267
|
+
iconName: 'Gem',
|
|
268
|
+
secondaryItems: [
|
|
269
|
+
'jewelry__items', 'jewelry__categories',
|
|
270
|
+
'jewelry__material_types', 'jewelry__purities', 'jewelry__metal_rates',
|
|
271
|
+
'jewelry__purchase_orders', 'jewelry__grn', 'jewelry__custom_orders', 'jewelry__transformations',
|
|
272
|
+
'jewelry__old_gold_purchases',
|
|
273
|
+
'jewelry__sales', 'jewelry__sales_orders',
|
|
274
|
+
'jewelry__stock_balances', 'jewelry__stock_movements',
|
|
275
|
+
'jewelry__party_transactions',
|
|
276
|
+
'jewelry__settings',
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
// ─── DEFAULT APP MENUS (legacy / fallback) ───────────────────────
|
|
285
|
+
// This is the current static config, used when no custom config exists.
|
|
286
|
+
|
|
287
|
+
export const APP_MENUS: MainMenuItem[] = [
|
|
288
|
+
{
|
|
289
|
+
id: "core",
|
|
290
|
+
label: "Core",
|
|
291
|
+
iconName: "Settings",
|
|
292
|
+
groups: [
|
|
293
|
+
{
|
|
294
|
+
id: "core_users",
|
|
295
|
+
label: "User Management",
|
|
296
|
+
items: [
|
|
297
|
+
{ id: "users", label: "Users", path: "/users" },
|
|
298
|
+
{ id: "roles", label: "Roles", path: "/roles" },
|
|
299
|
+
{ id: "organizations", label: "Organizations", path: "/organizations" },
|
|
300
|
+
{ id: "parties", label: "Parties", path: "/parties" },
|
|
301
|
+
],
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "core_system",
|
|
305
|
+
label: "System",
|
|
306
|
+
items: [
|
|
307
|
+
{ id: "menu_config", label: "Menu Configuration", path: "/menu-config" },
|
|
308
|
+
{ id: "printables", label: "Printable Templates", path: "/system/printables" },
|
|
309
|
+
],
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: "core_resources",
|
|
313
|
+
label: "Resources",
|
|
314
|
+
items: [
|
|
315
|
+
{ id: "warehouses", label: "Warehouses", path: "/warehouses" },
|
|
316
|
+
{ id: "terminals", label: "Terminals", path: "/terminals" },
|
|
317
|
+
],
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: "core_audit",
|
|
321
|
+
label: "System Auditing",
|
|
322
|
+
items: [
|
|
323
|
+
{ id: "activity_logs", label: "Activity Logs", path: "/activity-logs" },
|
|
324
|
+
{ id: "api_requests", label: "API Requests", path: "/system/api-requests" },
|
|
325
|
+
{ id: "feature_access_logs", label: "Feature Access Logs", path: "/system/feature-access-logs" },
|
|
326
|
+
{ id: "issue_logs", label: "Issue Logs", path: "/system/issue-logs" },
|
|
327
|
+
{ id: "feature_registry", label: "Feature Registry", path: "/system/features" },
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: "inventory",
|
|
334
|
+
label: "Inventory",
|
|
335
|
+
iconName: "Package",
|
|
336
|
+
groups: [
|
|
337
|
+
{
|
|
338
|
+
id: "inventory_catalog",
|
|
339
|
+
label: "Catalog",
|
|
340
|
+
items: [
|
|
341
|
+
{ id: "items", label: "Items", path: "/inventory/items" },
|
|
342
|
+
{ id: "categories", label: "Categories", path: "/inventory/categories" },
|
|
343
|
+
{ id: "brands", label: "Brands", path: "/inventory/brands" },
|
|
344
|
+
{ id: "uom", label: "Units of Measure", path: "/inventory/uom" },
|
|
345
|
+
],
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: "inventory_stock",
|
|
349
|
+
label: "Stock",
|
|
350
|
+
items: [
|
|
351
|
+
{ id: "stock", label: "Stock Overview", path: "/inventory/stock" },
|
|
352
|
+
{ id: "ledger", label: "Stock Movements", path: "/inventory/ledger" },
|
|
353
|
+
],
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
id: "inventory_operations",
|
|
357
|
+
label: "Operations",
|
|
358
|
+
items: [
|
|
359
|
+
{ id: "adjustments", label: "Adjustments", path: "/inventory/adjustments" },
|
|
360
|
+
{ id: "transfers", label: "Transfers", path: "/inventory/transfers" },
|
|
361
|
+
{ id: "serials", label: "Serial Numbers", path: "/inventory/serials" },
|
|
362
|
+
],
|
|
363
|
+
},
|
|
364
|
+
],
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
id: "sales",
|
|
368
|
+
label: "Sales",
|
|
369
|
+
iconName: "ShoppingCart",
|
|
370
|
+
groups: [
|
|
371
|
+
{
|
|
372
|
+
id: "sales_master_data",
|
|
373
|
+
label: "Master Data",
|
|
374
|
+
items: [
|
|
375
|
+
{ id: "price_lists", label: "Price Lists", path: "/sales/price-lists" },
|
|
376
|
+
],
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
id: "sales_orders",
|
|
380
|
+
label: "Orders",
|
|
381
|
+
items: [
|
|
382
|
+
{ id: "quotations", label: "Quotations", path: "/sales/quotations" },
|
|
383
|
+
{ id: "sales_orders", label: "Sales Orders", path: "/sales/orders" },
|
|
384
|
+
],
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: "sales_fulfillment",
|
|
388
|
+
label: "Fulfillment",
|
|
389
|
+
items: [
|
|
390
|
+
{ id: "goods_issue_notes", label: "Goods Issue Notes", path: "/sales/delivery-notes" },
|
|
391
|
+
],
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: "sales_post_sales",
|
|
395
|
+
label: "Post-Sales",
|
|
396
|
+
items: [
|
|
397
|
+
{ id: "returns", label: "Sales Returns", path: "/sales/returns" },
|
|
398
|
+
{ id: "credit_notes", label: "Credit Notes", path: "/sales/credit-notes" },
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: "sales_pos",
|
|
403
|
+
label: "POS",
|
|
404
|
+
items: [
|
|
405
|
+
{ id: "pos_terminal", label: "POS Terminal", path: "/sales/pos" },
|
|
406
|
+
{ id: "pos_sessions", label: "Terminal Sessions", path: "/sales/pos/sessions" },
|
|
407
|
+
],
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
id: "sales_analytics",
|
|
411
|
+
label: "Analytics",
|
|
412
|
+
items: [
|
|
413
|
+
{ id: "sales_reports", label: "Sales Reports", path: "/sales/reports" },
|
|
414
|
+
],
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
id: "procurement",
|
|
420
|
+
label: "Procurement",
|
|
421
|
+
iconName: "Truck",
|
|
422
|
+
groups: [
|
|
423
|
+
{
|
|
424
|
+
id: "procurement_orders",
|
|
425
|
+
label: "Orders",
|
|
426
|
+
items: [
|
|
427
|
+
{ id: "purchase_orders", label: "Purchase Orders", path: "/procurement/orders" },
|
|
428
|
+
],
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
id: "procurement_receiving",
|
|
432
|
+
label: "Receiving",
|
|
433
|
+
items: [
|
|
434
|
+
{ id: "goods_receipt", label: "Goods Receipt", path: "/procurement/grns" },
|
|
435
|
+
],
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
id: "procurement_finance",
|
|
439
|
+
label: "Finance",
|
|
440
|
+
items: [
|
|
441
|
+
{ id: "ap_invoices", label: "Invoices", path: "/finance/invoices" },
|
|
442
|
+
{ id: "outgoing_payments", label: "Payments", path: "/finance/payments" },
|
|
443
|
+
],
|
|
444
|
+
},
|
|
445
|
+
],
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
id: "finance",
|
|
449
|
+
label: "Finance",
|
|
450
|
+
iconName: "Wallet",
|
|
451
|
+
groups: [
|
|
452
|
+
{
|
|
453
|
+
id: "finance_transactions",
|
|
454
|
+
label: "Transactions",
|
|
455
|
+
items: [
|
|
456
|
+
{ id: "invoices", label: "Invoices", path: "/finance/invoices" },
|
|
457
|
+
{ id: "payments", label: "Payments", path: "/finance/payments" },
|
|
458
|
+
],
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
id: "finance_accounting",
|
|
462
|
+
label: "Accounting",
|
|
463
|
+
items: [
|
|
464
|
+
{ id: "chart_of_accounts", label: "Chart of Accounts", path: "/finance/chart-of-accounts" },
|
|
465
|
+
{ id: "journal_entries", label: "Journal Entries", path: "/finance/journal-entries" },
|
|
466
|
+
{ id: "fiscal_years", label: "Fiscal Years", path: "/finance/fiscal-years" },
|
|
467
|
+
],
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
id: "finance_reports",
|
|
471
|
+
label: "Reports",
|
|
472
|
+
items: [
|
|
473
|
+
{ id: "trial_balance", label: "Trial Balance", path: "/finance/reports/trial-balance" },
|
|
474
|
+
{ id: "profit_loss", label: "Profit & Loss", path: "/finance/reports/profit-loss" },
|
|
475
|
+
{ id: "balance_sheet", label: "Balance Sheet", path: "/finance/reports/balance-sheet" },
|
|
476
|
+
{ id: "account_ledger", label: "Account Ledger", path: "/finance/reports/account-ledger" },
|
|
477
|
+
],
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
id: "finance_settings",
|
|
481
|
+
label: "Settings",
|
|
482
|
+
items: [
|
|
483
|
+
{ id: "payment_modes", label: "Payment Modes", path: "/finance/payment-modes" },
|
|
484
|
+
{ id: "bank_accounts", label: "Bank Accounts", path: "/finance/bank-accounts" },
|
|
485
|
+
{ id: "account_mappings", label: "Account Mappings", path: "/finance/account-mappings" },
|
|
486
|
+
],
|
|
487
|
+
},
|
|
488
|
+
],
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
id: "jewelry",
|
|
492
|
+
label: "Jewelry",
|
|
493
|
+
iconName: "Gem",
|
|
494
|
+
groups: [
|
|
495
|
+
{
|
|
496
|
+
id: "jewelry_catalog",
|
|
497
|
+
label: "Catalog",
|
|
498
|
+
items: [
|
|
499
|
+
{ id: "jewelry_items", label: "Jewelry Items", path: "/jewelry/items" },
|
|
500
|
+
{ id: "jewelry_categories", label: "Categories", path: "/jewelry/categories" },
|
|
501
|
+
],
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
id: "jewelry_master_data",
|
|
505
|
+
label: "Master Data",
|
|
506
|
+
items: [
|
|
507
|
+
{ id: "material_types", label: "Material Types", path: "/jewelry/material-types" },
|
|
508
|
+
{ id: "purities", label: "Purities", path: "/jewelry/purities" },
|
|
509
|
+
{ id: "metal_rates", label: "Metal Rates", path: "/jewelry/metal-rates" },
|
|
510
|
+
],
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
id: "jewelry_procurement",
|
|
514
|
+
label: "Procurement",
|
|
515
|
+
items: [
|
|
516
|
+
{ id: "purchase_orders", label: "Purchase Orders", path: "/jewelry/procurement/orders" },
|
|
517
|
+
{ id: "goods_receipt", label: "Goods Receipt", path: "/jewelry/procurement/grn" },
|
|
518
|
+
{ id: "custom_orders", label: "Custom Orders", path: "/jewelry/custom-orders" },
|
|
519
|
+
{ id: "transformations", label: "Transformations", path: "/jewelry/procurement/transformations" },
|
|
520
|
+
],
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
id: "jewelry_buying",
|
|
524
|
+
label: "Buying",
|
|
525
|
+
items: [
|
|
526
|
+
{ id: "old_gold_purchases", label: "Old Material Purchases", path: "/jewelry/old-gold-purchases" },
|
|
527
|
+
],
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
id: "jewelry_sales",
|
|
531
|
+
label: "Sales",
|
|
532
|
+
items: [
|
|
533
|
+
{ id: "jewelry_sales_main", label: "Sales", path: "/jewelry/sales" },
|
|
534
|
+
{ id: "sales_orders", label: "Sales Orders", path: "/jewelry/sales/orders" },
|
|
535
|
+
],
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
id: "jewelry_stock",
|
|
539
|
+
label: "Stock",
|
|
540
|
+
items: [
|
|
541
|
+
{ id: "stock_balances", label: "Stock Balances", path: "/jewelry/stock/balances" },
|
|
542
|
+
{ id: "stock_movements", label: "Stock Movements", path: "/jewelry/stock/movements" },
|
|
543
|
+
],
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
id: "jewelry_karigar",
|
|
547
|
+
label: "Karigar",
|
|
548
|
+
items: [
|
|
549
|
+
{ id: "party_transactions", label: "Party Transactions", path: "/jewelry/party-transactions" },
|
|
550
|
+
],
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
id: "jewelry_configuration",
|
|
554
|
+
label: "Configuration",
|
|
555
|
+
items: [
|
|
556
|
+
{ id: "jewelry_settings", label: "Settings", path: "/jewelry/settings" },
|
|
557
|
+
],
|
|
558
|
+
},
|
|
559
|
+
],
|
|
560
|
+
},
|
|
561
|
+
];
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Builds MainMenuItem[] from a saved menu config (from the API).
|
|
565
|
+
* Supports both legacy string[] and enriched SecondaryItemConfig[] formats.
|
|
566
|
+
*/
|
|
567
|
+
export function buildMenusFromConfig(config: {
|
|
568
|
+
primaryMenus: { id: string; label: string; iconName: string; secondaryItems: SecondaryItemConfig[] }[];
|
|
569
|
+
}): MainMenuItem[] {
|
|
570
|
+
return config.primaryMenus.map(pm => ({
|
|
571
|
+
id: pm.id,
|
|
572
|
+
label: pm.label,
|
|
573
|
+
iconName: pm.iconName,
|
|
574
|
+
groups: resolveRegistryKeys(pm.secondaryItems),
|
|
575
|
+
}));
|
|
576
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
export interface IStorageOptions {
|
|
2
|
-
name: string;
|
|
3
|
-
secretName: string;
|
|
4
|
-
encrypted: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const cookie = {
|
|
8
|
-
access_token: { name: 'access_token', secretName: 'PATKXFGLSIZXZBXEEFK', encrypted:
|
|
9
|
-
};
|
|
1
|
+
export interface IStorageOptions {
|
|
2
|
+
name: string;
|
|
3
|
+
secretName: string;
|
|
4
|
+
encrypted: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const cookie = {
|
|
8
|
+
access_token: { name: 'access_token', secretName: 'PATKXFGLSIZXZBXEEFK', encrypted: false } as IStorageOptions
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const local_storage = {
|
|
12
|
+
user_info: { name: 'user_info', secretName: 'USER_INFO_SECRET', encrypted: false } as IStorageOptions,
|
|
13
|
+
selected_organization: { name: 'selected_organization', secretName: 'SELECTED_ORG', encrypted: false } as IStorageOptions
|
|
14
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './utils/localStorageHandler';
|
|
5
|
-
export * from './utils/bem';
|
|
6
|
-
export * from './utils/cn';
|
|
7
|
-
export * from './common/interfaces/ICommon';
|
|
8
|
-
export * from './constants/storageKeys';
|
|
1
|
+
// Default entry point — client-safe (no 'use server' modules)
|
|
2
|
+
// For server components/actions, import from '@apptimate/core-lib/src/server'
|
|
3
|
+
export * from './client';
|
package/src/server.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Server-safe exports — includes everything including 'use server' modules
|
|
2
|
+
export * from './utils/commonService';
|
|
3
|
+
export * from './utils/cookiesHandler';
|
|
4
|
+
export * from './utils/httpClient';
|
|
5
|
+
export * from './utils/localStorageHandler';
|
|
6
|
+
export * from './utils/bem';
|
|
7
|
+
export * from './utils/cn';
|
|
8
|
+
export * from './common/interfaces/ICommon';
|
|
9
|
+
export * from './constants/storageKeys';
|
|
10
|
+
export * from './constants/menus';
|
|
11
|
+
export * from './constants/iconRegistry';
|
|
12
|
+
export * from './utils/bootstrapConfig';
|