@managesome/eposmatic-toolkit 0.2.490 → 0.2.491

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.
@@ -23,9 +23,8 @@ export declare function getSelectedVendorCatalogs(menus: {
23
23
  }[], selectedVendorId: string | null, mappedCatalog: Record<string, IWarehouseCatalog>): IWarehouseCatalog[];
24
24
  /**
25
25
  * Group inventory items by category_id for O(1) lookup.
26
- * Mirrors the warehouse's mappedCatalog: uses item.category_id directly
27
- * as the key. Items with a null/undefined category_id are skipped —
28
- * uncategorized handling belongs in the UI layer.
26
+ * Mirrors the warehouse's mappedCatalog. Items with a null/undefined
27
+ * category_id are stored under the key '' (empty string).
29
28
  */
30
29
  export declare function getInventoryMappedItems(inventory: IKitchenInventory[]): Record<string, IKitchenInventory[]>;
31
30
  /**
@@ -224,19 +224,17 @@ function getSelectedVendorCatalogs(menus, selectedVendorId, mappedCatalog) {
224
224
  // ============================================================================
225
225
  /**
226
226
  * Group inventory items by category_id for O(1) lookup.
227
- * Mirrors the warehouse's mappedCatalog: uses item.category_id directly
228
- * as the key. Items with a null/undefined category_id are skipped —
229
- * uncategorized handling belongs in the UI layer.
227
+ * Mirrors the warehouse's mappedCatalog. Items with a null/undefined
228
+ * category_id are stored under the key '' (empty string).
230
229
  */
231
230
  function getInventoryMappedItems(inventory) {
232
231
  const map = {};
233
232
  for (let i = 0; i < inventory.length; i++) {
234
233
  const item = inventory[i];
235
- if (!item.category_id)
236
- continue;
237
- if (!map[item.category_id])
238
- map[item.category_id] = [];
239
- map[item.category_id].push(item);
234
+ const key = item.category_id ?? '';
235
+ if (!map[key])
236
+ map[key] = [];
237
+ map[key].push(item);
240
238
  }
241
239
  return map;
242
240
  }
@@ -263,9 +261,7 @@ function getSelectedVendorInventoryItems(mappedInventory, includedCategories) {
263
261
  const result = [];
264
262
  for (let i = 0; i < includedCategories.length; i++) {
265
263
  const { category_id, excluded_items } = includedCategories[i];
266
- if (!category_id)
267
- continue;
268
- const items = mappedInventory[category_id];
264
+ const items = mappedInventory[category_id ?? ''];
269
265
  if (!items)
270
266
  continue;
271
267
  if (excluded_items.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.490",
3
+ "version": "0.2.491",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",