@open-tender/utils 0.4.82 → 0.4.85
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/useModifier.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 -0
- package/dist/cjs/utils/menu.d.ts +2 -0
- package/dist/cjs/utils/rewards.d.ts +1 -0
- package/dist/cjs/utils/rewards.js +5 -1
- package/dist/esm/hooks/useMenuItem.d.ts +1 -0
- package/dist/esm/hooks/useModifier.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 -0
- package/dist/esm/utils/menu.d.ts +2 -0
- package/dist/esm/utils/rewards.d.ts +1 -0
- package/dist/esm/utils/rewards.js +4 -1
- package/package.json +3 -4
|
@@ -48,6 +48,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
48
48
|
name: string;
|
|
49
49
|
nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
|
|
50
50
|
points: number | null;
|
|
51
|
+
pos_ext_id: string | null;
|
|
51
52
|
price: number;
|
|
52
53
|
quantity: number;
|
|
53
54
|
shorthand: string | null;
|
|
@@ -40,6 +40,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
40
40
|
name: string;
|
|
41
41
|
nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
|
|
42
42
|
points: number | null;
|
|
43
|
+
pos_ext_id: string | null;
|
|
43
44
|
quantity: number;
|
|
44
45
|
shorthand: string | null;
|
|
45
46
|
shortDescription: string | null;
|
|
@@ -37,6 +37,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
37
37
|
name: string;
|
|
38
38
|
nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
|
|
39
39
|
points: number | null;
|
|
40
|
+
pos_ext_id: string | null;
|
|
40
41
|
price: number;
|
|
41
42
|
quantity: number;
|
|
42
43
|
shorthand: string | null;
|
package/dist/cjs/utils/cart.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
42
42
|
name: string;
|
|
43
43
|
nutritionalInfo: NutritionalInfo | null;
|
|
44
44
|
points: number | null;
|
|
45
|
+
pos_ext_id: string | null;
|
|
45
46
|
price: number;
|
|
46
47
|
quantity: number;
|
|
47
48
|
shorthand: string | null;
|
|
@@ -137,6 +138,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
137
138
|
name: string;
|
|
138
139
|
nutritionalInfo: NutritionalInfo | null;
|
|
139
140
|
points: number | null;
|
|
141
|
+
pos_ext_id: string | null;
|
|
140
142
|
price: number;
|
|
141
143
|
quantity: number;
|
|
142
144
|
shorthand: string | null;
|
package/dist/cjs/utils/cart.js
CHANGED
|
@@ -229,6 +229,7 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
|
|
|
229
229
|
name: o.name,
|
|
230
230
|
nutritionalInfo: o.nutritional_info,
|
|
231
231
|
points: o.points || 0,
|
|
232
|
+
pos_ext_id: o.pos_ext_id,
|
|
232
233
|
price: parseFloat(o.price),
|
|
233
234
|
quantity: quantity,
|
|
234
235
|
shorthand: o.shorthand,
|
|
@@ -293,6 +294,7 @@ const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false
|
|
|
293
294
|
notes: simpleItem ? simpleItem.notes || null : null,
|
|
294
295
|
nutritionalInfo: item.nutritional_info,
|
|
295
296
|
points: hasPoints ? item.points || null : null,
|
|
297
|
+
pos_ext_id: item.pos_ext_id,
|
|
296
298
|
price: parseFloat(item.price),
|
|
297
299
|
quantity: item.min_quantity || 1 * item.increment,
|
|
298
300
|
shorthand: item.shorthand,
|
package/dist/cjs/utils/menu.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
35
35
|
plu: string | null;
|
|
36
36
|
points: number | null;
|
|
37
37
|
pos_display_color: string | null;
|
|
38
|
+
pos_ext_id: string | null;
|
|
38
39
|
price: string;
|
|
39
40
|
sales_tax_override: `${number}.${number}` | null;
|
|
40
41
|
short_description: string | null;
|
|
@@ -83,6 +84,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
83
84
|
plu: string | null;
|
|
84
85
|
points: number | null;
|
|
85
86
|
pos_display_color: string | null;
|
|
87
|
+
pos_ext_id: string | null;
|
|
86
88
|
price: string;
|
|
87
89
|
sales_tax_override: `${number}.${number}` | null;
|
|
88
90
|
short_description: string | null;
|
|
@@ -2,3 +2,4 @@ import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@
|
|
|
2
2
|
export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
|
|
3
3
|
export declare const makeLimitations: (item: Discount) => string;
|
|
4
4
|
export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
|
|
5
|
+
export declare const getIsRewardExpired: (end_at: string | null) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeDiscountEnhanced = exports.makeLimitations = exports.makeValidDeals = void 0;
|
|
3
|
+
exports.getIsRewardExpired = exports.makeDiscountEnhanced = exports.makeLimitations = exports.makeValidDeals = void 0;
|
|
4
4
|
const datetimes_1 = require("./datetimes");
|
|
5
5
|
const helpers_1 = require("./helpers");
|
|
6
6
|
const makeValidDeals = (deals, orderType, serviceType, revenueCenterId) => {
|
|
@@ -104,3 +104,7 @@ const makeDiscountEnhanced = (item) => {
|
|
|
104
104
|
return Object.assign(Object.assign({}, item), { imageUrl, expiration, todayOnly, limitations });
|
|
105
105
|
};
|
|
106
106
|
exports.makeDiscountEnhanced = makeDiscountEnhanced;
|
|
107
|
+
const getIsRewardExpired = (end_at) => {
|
|
108
|
+
return end_at ? (0, datetimes_1.dateStrToDate)(end_at) < new Date() : false;
|
|
109
|
+
};
|
|
110
|
+
exports.getIsRewardExpired = getIsRewardExpired;
|
|
@@ -48,6 +48,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
48
48
|
name: string;
|
|
49
49
|
nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
|
|
50
50
|
points: number | null;
|
|
51
|
+
pos_ext_id: string | null;
|
|
51
52
|
price: number;
|
|
52
53
|
quantity: number;
|
|
53
54
|
shorthand: string | null;
|
|
@@ -40,6 +40,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
40
40
|
name: string;
|
|
41
41
|
nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
|
|
42
42
|
points: number | null;
|
|
43
|
+
pos_ext_id: string | null;
|
|
43
44
|
quantity: number;
|
|
44
45
|
shorthand: string | null;
|
|
45
46
|
shortDescription: string | null;
|
|
@@ -37,6 +37,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
37
37
|
name: string;
|
|
38
38
|
nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
|
|
39
39
|
points: number | null;
|
|
40
|
+
pos_ext_id: string | null;
|
|
40
41
|
price: number;
|
|
41
42
|
quantity: number;
|
|
42
43
|
shorthand: string | null;
|
package/dist/esm/utils/cart.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
42
42
|
name: string;
|
|
43
43
|
nutritionalInfo: NutritionalInfo | null;
|
|
44
44
|
points: number | null;
|
|
45
|
+
pos_ext_id: string | null;
|
|
45
46
|
price: number;
|
|
46
47
|
quantity: number;
|
|
47
48
|
shorthand: string | null;
|
|
@@ -137,6 +138,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
137
138
|
name: string;
|
|
138
139
|
nutritionalInfo: NutritionalInfo | null;
|
|
139
140
|
points: number | null;
|
|
141
|
+
pos_ext_id: string | null;
|
|
140
142
|
price: number;
|
|
141
143
|
quantity: number;
|
|
142
144
|
shorthand: string | null;
|
package/dist/esm/utils/cart.js
CHANGED
|
@@ -214,6 +214,7 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
|
|
|
214
214
|
name: o.name,
|
|
215
215
|
nutritionalInfo: o.nutritional_info,
|
|
216
216
|
points: o.points || 0,
|
|
217
|
+
pos_ext_id: o.pos_ext_id,
|
|
217
218
|
price: parseFloat(o.price),
|
|
218
219
|
quantity: quantity,
|
|
219
220
|
shorthand: o.shorthand,
|
|
@@ -278,6 +279,7 @@ export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints
|
|
|
278
279
|
notes: simpleItem ? simpleItem.notes || null : null,
|
|
279
280
|
nutritionalInfo: item.nutritional_info,
|
|
280
281
|
points: hasPoints ? item.points || null : null,
|
|
282
|
+
pos_ext_id: item.pos_ext_id,
|
|
281
283
|
price: parseFloat(item.price),
|
|
282
284
|
quantity: item.min_quantity || 1 * item.increment,
|
|
283
285
|
shorthand: item.shorthand,
|
package/dist/esm/utils/menu.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
35
35
|
plu: string | null;
|
|
36
36
|
points: number | null;
|
|
37
37
|
pos_display_color: string | null;
|
|
38
|
+
pos_ext_id: string | null;
|
|
38
39
|
price: string;
|
|
39
40
|
sales_tax_override: `${number}.${number}` | null;
|
|
40
41
|
short_description: string | null;
|
|
@@ -83,6 +84,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
83
84
|
plu: string | null;
|
|
84
85
|
points: number | null;
|
|
85
86
|
pos_display_color: string | null;
|
|
87
|
+
pos_ext_id: string | null;
|
|
86
88
|
price: string;
|
|
87
89
|
sales_tax_override: `${number}.${number}` | null;
|
|
88
90
|
short_description: string | null;
|
|
@@ -2,3 +2,4 @@ import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@
|
|
|
2
2
|
export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
|
|
3
3
|
export declare const makeLimitations: (item: Discount) => string;
|
|
4
4
|
export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
|
|
5
|
+
export declare const getIsRewardExpired: (end_at: string | null) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatDateStr, getMinutesfromDate, makeLocalDateStr, time24ToMinutes } from './datetimes';
|
|
1
|
+
import { dateStrToDate, formatDateStr, getMinutesfromDate, makeLocalDateStr, time24ToMinutes } from './datetimes';
|
|
2
2
|
import { makeImageMap } from './helpers';
|
|
3
3
|
export const makeValidDeals = (deals, orderType, serviceType, revenueCenterId) => {
|
|
4
4
|
if (!deals || !deals.length)
|
|
@@ -98,3 +98,6 @@ export const makeDiscountEnhanced = (item) => {
|
|
|
98
98
|
const limitations = makeLimitations(item);
|
|
99
99
|
return Object.assign(Object.assign({}, item), { imageUrl, expiration, todayOnly, limitations });
|
|
100
100
|
};
|
|
101
|
+
export const getIsRewardExpired = (end_at) => {
|
|
102
|
+
return end_at ? dateStrToDate(end_at) < new Date() : false;
|
|
103
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/utils",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.85",
|
|
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",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"private": false,
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@emotion/react": "^11.10.4",
|
|
39
|
-
"@open-tender/types": "^0.4.113",
|
|
40
39
|
"@reduxjs/toolkit": "^1.8.5",
|
|
41
40
|
"@types/google.maps": "^3.53.5",
|
|
42
41
|
"@types/jest": "^29.5.11",
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
"typescript": "^4.8.2"
|
|
59
58
|
},
|
|
60
59
|
"peerDependencies": {
|
|
61
|
-
"@open-tender/types": "^0.4.
|
|
60
|
+
"@open-tender/types": "^0.4.121",
|
|
62
61
|
"@reduxjs/toolkit": "^1.8.5",
|
|
63
62
|
"react": "^18.2.0"
|
|
64
63
|
},
|
|
@@ -66,5 +65,5 @@
|
|
|
66
65
|
"date-fns": "^2.29.3",
|
|
67
66
|
"date-fns-tz": "^1.3.7"
|
|
68
67
|
},
|
|
69
|
-
"packageManager": "yarn@1.22.22
|
|
68
|
+
"packageManager": "yarn@1.22.22"
|
|
70
69
|
}
|