@open-tender/utils 0.4.20 → 0.4.22
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.
|
@@ -6,6 +6,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
6
6
|
displayPrice: string;
|
|
7
7
|
displayCals: number | null;
|
|
8
8
|
totalPoints: number | null;
|
|
9
|
+
totalAllergens: string[];
|
|
9
10
|
auth: Auth | null;
|
|
10
11
|
favoriteId: number | null;
|
|
11
12
|
isIncomplete: boolean;
|
|
@@ -39,12 +39,17 @@ const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) => {
|
|
|
39
39
|
const hasIngredients = ingredients && ingredients.length > 0;
|
|
40
40
|
const hasCals = displayCals !== null;
|
|
41
41
|
const hasInfo = hasCals || hasIngredients;
|
|
42
|
+
const modifiersAllergens = currentOptions.reduce((t, o) => {
|
|
43
|
+
return [...t, ...o.allergens];
|
|
44
|
+
}, []);
|
|
45
|
+
const totalAllergens = [...new Set(allergens.concat(modifiersAllergens))];
|
|
42
46
|
return Object.assign(Object.assign({}, builtItem), { description,
|
|
43
47
|
tags,
|
|
44
48
|
allergens,
|
|
45
49
|
displayPrice,
|
|
46
50
|
displayCals,
|
|
47
51
|
totalPoints,
|
|
52
|
+
totalAllergens,
|
|
48
53
|
auth,
|
|
49
54
|
favoriteId,
|
|
50
55
|
isIncomplete,
|
|
@@ -6,6 +6,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
6
6
|
displayPrice: string;
|
|
7
7
|
displayCals: number | null;
|
|
8
8
|
totalPoints: number | null;
|
|
9
|
+
totalAllergens: string[];
|
|
9
10
|
auth: Auth | null;
|
|
10
11
|
favoriteId: number | null;
|
|
11
12
|
isIncomplete: boolean;
|
|
@@ -36,12 +36,17 @@ export const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) =>
|
|
|
36
36
|
const hasIngredients = ingredients && ingredients.length > 0;
|
|
37
37
|
const hasCals = displayCals !== null;
|
|
38
38
|
const hasInfo = hasCals || hasIngredients;
|
|
39
|
+
const modifiersAllergens = currentOptions.reduce((t, o) => {
|
|
40
|
+
return [...t, ...o.allergens];
|
|
41
|
+
}, []);
|
|
42
|
+
const totalAllergens = [...new Set(allergens.concat(modifiersAllergens))];
|
|
39
43
|
return Object.assign(Object.assign({}, builtItem), { description,
|
|
40
44
|
tags,
|
|
41
45
|
allergens,
|
|
42
46
|
displayPrice,
|
|
43
47
|
displayCals,
|
|
44
48
|
totalPoints,
|
|
49
|
+
totalAllergens,
|
|
45
50
|
auth,
|
|
46
51
|
favoriteId,
|
|
47
52
|
isIncomplete,
|
package/package.json
CHANGED