@open-tender/utils 0.4.16 → 0.4.18
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/dist/cjs/utils/cart.js
CHANGED
|
@@ -96,7 +96,7 @@ const makeUpsellItemIds = (item, cartIds, soldOut) => {
|
|
|
96
96
|
exports.makeUpsellItemIds = makeUpsellItemIds;
|
|
97
97
|
const makeUpsellItemsForCart = (categories, cartIds, soldOut) => {
|
|
98
98
|
const itemLookup = (0, favorites_1.makeMenuItemLookup)(categories);
|
|
99
|
-
const menuItems = cartIds.map(id => itemLookup[id]);
|
|
99
|
+
const menuItems = cartIds.map(id => itemLookup[id]).filter(Boolean);
|
|
100
100
|
const upsellItemIds = menuItems.reduce((arr, i) => [...arr, ...i.upsell_items], []);
|
|
101
101
|
const uniqueIds = Array.from(new Set(upsellItemIds));
|
|
102
102
|
const itemIds = uniqueIds.filter(id => !cartIds.includes(id) && !soldOut.includes(id));
|
|
@@ -82,11 +82,11 @@ const makeLimitations = (item) => {
|
|
|
82
82
|
const dash = (serviceType || orderType) && channelType ? ' - ' : '';
|
|
83
83
|
if (serviceType || orderType || channelType) {
|
|
84
84
|
return `
|
|
85
|
-
${serviceType}
|
|
85
|
+
${serviceType || ''}
|
|
86
86
|
${comma}
|
|
87
|
-
${orderType}
|
|
87
|
+
${orderType || ''}
|
|
88
88
|
${dash}
|
|
89
|
-
${channelType}
|
|
89
|
+
${channelType || ''}
|
|
90
90
|
`;
|
|
91
91
|
}
|
|
92
92
|
return 'Valid on all online & app orders';
|
package/dist/esm/utils/cart.js
CHANGED
|
@@ -86,7 +86,7 @@ export const makeUpsellItemIds = (item, cartIds, soldOut) => {
|
|
|
86
86
|
};
|
|
87
87
|
export const makeUpsellItemsForCart = (categories, cartIds, soldOut) => {
|
|
88
88
|
const itemLookup = makeMenuItemLookup(categories);
|
|
89
|
-
const menuItems = cartIds.map(id => itemLookup[id]);
|
|
89
|
+
const menuItems = cartIds.map(id => itemLookup[id]).filter(Boolean);
|
|
90
90
|
const upsellItemIds = menuItems.reduce((arr, i) => [...arr, ...i.upsell_items], []);
|
|
91
91
|
const uniqueIds = Array.from(new Set(upsellItemIds));
|
|
92
92
|
const itemIds = uniqueIds.filter(id => !cartIds.includes(id) && !soldOut.includes(id));
|
|
@@ -78,11 +78,11 @@ export const makeLimitations = (item) => {
|
|
|
78
78
|
const dash = (serviceType || orderType) && channelType ? ' - ' : '';
|
|
79
79
|
if (serviceType || orderType || channelType) {
|
|
80
80
|
return `
|
|
81
|
-
${serviceType}
|
|
81
|
+
${serviceType || ''}
|
|
82
82
|
${comma}
|
|
83
|
-
${orderType}
|
|
83
|
+
${orderType || ''}
|
|
84
84
|
${dash}
|
|
85
|
-
${channelType}
|
|
85
|
+
${channelType || ''}
|
|
86
86
|
`;
|
|
87
87
|
}
|
|
88
88
|
return 'Valid on all online & app orders';
|
package/package.json
CHANGED