@open-tender/utils 0.1.164 → 0.1.165
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DisplayItems, Favorites, MenuCategories, MenuItem,
|
|
1
|
+
import { DisplayItems, Favorites, MenuCategories, MenuItem, MenuItems, SoldOut } from '@open-tender/types';
|
|
2
2
|
export declare const makeMenuItemLookup: (categories: MenuCategories) => any;
|
|
3
3
|
export declare const makeFeatured: (categories: MenuCategories) => MenuItem[];
|
|
4
4
|
export declare const makeMenuGroupsLookup: (menuItem: MenuItem) => any;
|
|
5
|
-
export declare const makeRecents: (recents: DisplayItems, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) =>
|
|
6
|
-
export declare const makeFavorites: (favorites: Favorites, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) =>
|
|
5
|
+
export declare const makeRecents: (recents: DisplayItems, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) => MenuItems;
|
|
6
|
+
export declare const makeFavorites: (favorites: Favorites, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) => MenuItems;
|
|
@@ -92,7 +92,7 @@ const makeFavorites = (favorites, itemLookup, soldOut) => {
|
|
|
92
92
|
if (!menuItem)
|
|
93
93
|
return arr;
|
|
94
94
|
const isValid = validateFavorite(favorite.item, menuItem, soldOut);
|
|
95
|
-
const favoriteSimple = { item: favorite.item, quantity: 1 };
|
|
95
|
+
const favoriteSimple = { item: Object.assign(Object.assign({}, favorite.item), { quantity: 1 }) };
|
|
96
96
|
return isValid ? [...arr, Object.assign(Object.assign({}, menuItem), { favorite: favoriteSimple })] : arr;
|
|
97
97
|
}
|
|
98
98
|
else {
|
package/dist/cjs/utils/menu.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
17
17
|
calories: number | null;
|
|
18
18
|
description: string | null;
|
|
19
19
|
dimensions: number[] | null;
|
|
20
|
+
favorite?: import("@open-tender/types").MenuItemFavorite | undefined;
|
|
20
21
|
featured_position: number | null;
|
|
21
22
|
id: number;
|
|
22
23
|
increment: number;
|
|
@@ -57,6 +58,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
57
58
|
calories: number | null;
|
|
58
59
|
description: string | null;
|
|
59
60
|
dimensions: number[] | null;
|
|
61
|
+
favorite?: import("@open-tender/types").MenuItemFavorite | undefined;
|
|
60
62
|
featured_position: number | null;
|
|
61
63
|
id: number;
|
|
62
64
|
increment: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DisplayItems, Favorites, MenuCategories, MenuItem,
|
|
1
|
+
import { DisplayItems, Favorites, MenuCategories, MenuItem, MenuItems, SoldOut } from '@open-tender/types';
|
|
2
2
|
export declare const makeMenuItemLookup: (categories: MenuCategories) => any;
|
|
3
3
|
export declare const makeFeatured: (categories: MenuCategories) => MenuItem[];
|
|
4
4
|
export declare const makeMenuGroupsLookup: (menuItem: MenuItem) => any;
|
|
5
|
-
export declare const makeRecents: (recents: DisplayItems, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) =>
|
|
6
|
-
export declare const makeFavorites: (favorites: Favorites, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) =>
|
|
5
|
+
export declare const makeRecents: (recents: DisplayItems, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) => MenuItems;
|
|
6
|
+
export declare const makeFavorites: (favorites: Favorites, itemLookup: Record<string, MenuItem>, soldOut: SoldOut) => MenuItems;
|
|
@@ -85,7 +85,7 @@ export const makeFavorites = (favorites, itemLookup, soldOut) => {
|
|
|
85
85
|
if (!menuItem)
|
|
86
86
|
return arr;
|
|
87
87
|
const isValid = validateFavorite(favorite.item, menuItem, soldOut);
|
|
88
|
-
const favoriteSimple = { item: favorite.item, quantity: 1 };
|
|
88
|
+
const favoriteSimple = { item: Object.assign(Object.assign({}, favorite.item), { quantity: 1 }) };
|
|
89
89
|
return isValid ? [...arr, Object.assign(Object.assign({}, menuItem), { favorite: favoriteSimple })] : arr;
|
|
90
90
|
}
|
|
91
91
|
else {
|
package/dist/esm/utils/menu.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
17
17
|
calories: number | null;
|
|
18
18
|
description: string | null;
|
|
19
19
|
dimensions: number[] | null;
|
|
20
|
+
favorite?: import("@open-tender/types").MenuItemFavorite | undefined;
|
|
20
21
|
featured_position: number | null;
|
|
21
22
|
id: number;
|
|
22
23
|
increment: number;
|
|
@@ -57,6 +58,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
57
58
|
calories: number | null;
|
|
58
59
|
description: string | null;
|
|
59
60
|
dimensions: number[] | null;
|
|
61
|
+
favorite?: import("@open-tender/types").MenuItemFavorite | undefined;
|
|
60
62
|
featured_position: number | null;
|
|
61
63
|
id: number;
|
|
62
64
|
increment: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.165",
|
|
4
4
|
"description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"typescript": "^4.8.2"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@open-tender/types": "^0.2.
|
|
57
|
+
"@open-tender/types": "^0.2.98",
|
|
58
58
|
"@reduxjs/toolkit": "^1.8.5",
|
|
59
59
|
"react": "^18.2.0"
|
|
60
60
|
},
|