@open-tender/utils 0.5.66 → 0.5.68
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/hooks/useMenuItem.d.ts +1 -0
- package/dist/cjs/hooks/useOrderItem.d.ts +1 -0
- package/dist/cjs/utils/cart.d.ts +2 -0
- package/dist/cjs/utils/cart.js +2 -1
- package/dist/cjs/utils/menu.d.ts +2 -0
- package/dist/cjs/utils/rewards.js +3 -2
- package/dist/esm/hooks/useMenuItem.d.ts +1 -0
- package/dist/esm/hooks/useOrderItem.d.ts +1 -0
- package/dist/esm/utils/cart.d.ts +2 -0
- package/dist/esm/utils/cart.js +2 -1
- package/dist/esm/utils/menu.d.ts +2 -0
- package/dist/esm/utils/rewards.js +3 -2
- package/package.json +2 -2
|
@@ -36,6 +36,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
36
36
|
list_name: string | null;
|
|
37
37
|
list_id: string | null;
|
|
38
38
|
menu_position: number | null;
|
|
39
|
+
related_meal_item: number | null;
|
|
39
40
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
40
41
|
cals: number | null;
|
|
41
42
|
groups: import("@open-tender/types").CartItemGroups;
|
|
@@ -23,6 +23,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
23
23
|
list_name: string | null;
|
|
24
24
|
list_id: string | null;
|
|
25
25
|
menu_position: number | null;
|
|
26
|
+
related_meal_item: number | null;
|
|
26
27
|
allergens: string[];
|
|
27
28
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
28
29
|
cals: number | null;
|
package/dist/cjs/utils/cart.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
27
27
|
list_name: string | null;
|
|
28
28
|
list_id: string | null;
|
|
29
29
|
menu_position: number | null;
|
|
30
|
+
related_meal_item: number | null;
|
|
30
31
|
allergens: string[];
|
|
31
32
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
32
33
|
cals: number | null;
|
|
@@ -125,6 +126,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
125
126
|
list_name: string | null;
|
|
126
127
|
list_id: string | null;
|
|
127
128
|
menu_position: number | null;
|
|
129
|
+
related_meal_item: number | null;
|
|
128
130
|
allergens: string[];
|
|
129
131
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
130
132
|
cals: number | null;
|
package/dist/cjs/utils/cart.js
CHANGED
|
@@ -326,7 +326,8 @@ const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false
|
|
|
326
326
|
excludeFromBuilder: (_c = item.exclude_from_builder) !== null && _c !== void 0 ? _c : false,
|
|
327
327
|
list_id: item.list_id,
|
|
328
328
|
list_name: item.list_name,
|
|
329
|
-
menu_position: item.menu_position
|
|
329
|
+
menu_position: item.menu_position,
|
|
330
|
+
related_meal_item: item.related_meal_item
|
|
330
331
|
};
|
|
331
332
|
const pricedItem = (0, exports.calcPrices)(orderItem);
|
|
332
333
|
return pricedItem;
|
package/dist/cjs/utils/menu.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
55
55
|
list_name: string | null;
|
|
56
56
|
list_id: string | null;
|
|
57
57
|
index?: number | undefined;
|
|
58
|
+
related_meal_item: number | null;
|
|
58
59
|
}[];
|
|
59
60
|
}[];
|
|
60
61
|
export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
@@ -104,6 +105,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
104
105
|
list_name: string | null;
|
|
105
106
|
list_id: string | null;
|
|
106
107
|
index?: number | undefined;
|
|
108
|
+
related_meal_item: number | null;
|
|
107
109
|
}[];
|
|
108
110
|
app_image_url: string | null;
|
|
109
111
|
appearance: import("@open-tender/types").MenuCategoryAppearance;
|
|
@@ -105,8 +105,9 @@ const makeDiscountEnhanced = (item) => {
|
|
|
105
105
|
};
|
|
106
106
|
exports.makeDiscountEnhanced = makeDiscountEnhanced;
|
|
107
107
|
const getIsDealExpired = (item) => {
|
|
108
|
-
const { end_date } = item;
|
|
109
|
-
|
|
108
|
+
const { end_at, end_date } = item;
|
|
109
|
+
const expiry = end_at || end_date;
|
|
110
|
+
return expiry ? (0, datetimes_1.dateStrToDate)(expiry) < new Date() : false;
|
|
110
111
|
};
|
|
111
112
|
exports.getIsDealExpired = getIsDealExpired;
|
|
112
113
|
const getIsRewardExpired = (item) => {
|
|
@@ -36,6 +36,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
36
36
|
list_name: string | null;
|
|
37
37
|
list_id: string | null;
|
|
38
38
|
menu_position: number | null;
|
|
39
|
+
related_meal_item: number | null;
|
|
39
40
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
40
41
|
cals: number | null;
|
|
41
42
|
groups: import("@open-tender/types").CartItemGroups;
|
|
@@ -23,6 +23,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
23
23
|
list_name: string | null;
|
|
24
24
|
list_id: string | null;
|
|
25
25
|
menu_position: number | null;
|
|
26
|
+
related_meal_item: number | null;
|
|
26
27
|
allergens: string[];
|
|
27
28
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
28
29
|
cals: number | null;
|
package/dist/esm/utils/cart.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
27
27
|
list_name: string | null;
|
|
28
28
|
list_id: string | null;
|
|
29
29
|
menu_position: number | null;
|
|
30
|
+
related_meal_item: number | null;
|
|
30
31
|
allergens: string[];
|
|
31
32
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
32
33
|
cals: number | null;
|
|
@@ -125,6 +126,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
125
126
|
list_name: string | null;
|
|
126
127
|
list_id: string | null;
|
|
127
128
|
menu_position: number | null;
|
|
129
|
+
related_meal_item: number | null;
|
|
128
130
|
allergens: string[];
|
|
129
131
|
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
130
132
|
cals: number | null;
|
package/dist/esm/utils/cart.js
CHANGED
|
@@ -311,7 +311,8 @@ export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints
|
|
|
311
311
|
excludeFromBuilder: (_c = item.exclude_from_builder) !== null && _c !== void 0 ? _c : false,
|
|
312
312
|
list_id: item.list_id,
|
|
313
313
|
list_name: item.list_name,
|
|
314
|
-
menu_position: item.menu_position
|
|
314
|
+
menu_position: item.menu_position,
|
|
315
|
+
related_meal_item: item.related_meal_item
|
|
315
316
|
};
|
|
316
317
|
const pricedItem = calcPrices(orderItem);
|
|
317
318
|
return pricedItem;
|
package/dist/esm/utils/menu.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
55
55
|
list_name: string | null;
|
|
56
56
|
list_id: string | null;
|
|
57
57
|
index?: number | undefined;
|
|
58
|
+
related_meal_item: number | null;
|
|
58
59
|
}[];
|
|
59
60
|
}[];
|
|
60
61
|
export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
@@ -104,6 +105,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
104
105
|
list_name: string | null;
|
|
105
106
|
list_id: string | null;
|
|
106
107
|
index?: number | undefined;
|
|
108
|
+
related_meal_item: number | null;
|
|
107
109
|
}[];
|
|
108
110
|
app_image_url: string | null;
|
|
109
111
|
appearance: import("@open-tender/types").MenuCategoryAppearance;
|
|
@@ -99,8 +99,9 @@ export const makeDiscountEnhanced = (item) => {
|
|
|
99
99
|
return Object.assign(Object.assign({}, item), { imageUrl, expiration, todayOnly, limitations });
|
|
100
100
|
};
|
|
101
101
|
export const getIsDealExpired = (item) => {
|
|
102
|
-
const { end_date } = item;
|
|
103
|
-
|
|
102
|
+
const { end_at, end_date } = item;
|
|
103
|
+
const expiry = end_at || end_date;
|
|
104
|
+
return expiry ? dateStrToDate(expiry) < new Date() : false;
|
|
104
105
|
};
|
|
105
106
|
export const getIsRewardExpired = (item) => {
|
|
106
107
|
const { end_at } = item;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/utils",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.68",
|
|
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",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"typescript": "^4.8.2"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@open-tender/types": "^0.4.
|
|
60
|
+
"@open-tender/types": "^0.4.176",
|
|
61
61
|
"@reduxjs/toolkit": "^1.8.5",
|
|
62
62
|
"react": "^18.2.0"
|
|
63
63
|
},
|