@open-tender/utils 0.4.29 → 0.4.31
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/useCreditCard.d.ts +1 -1
- package/dist/cjs/hooks/useCreditCard.js +14 -4
- package/dist/cjs/hooks/useMenuItem.d.ts +2 -0
- package/dist/cjs/hooks/useModifier.d.ts +2 -0
- package/dist/cjs/hooks/useOrderItem.d.ts +2 -0
- package/dist/cjs/utils/cards.js +3 -1
- package/dist/cjs/utils/cart.d.ts +4 -0
- package/dist/cjs/utils/cart.js +4 -0
- package/dist/cjs/utils/checkout.d.ts +2 -0
- package/dist/cjs/utils/menu.d.ts +4 -0
- package/dist/esm/hooks/useCreditCard.d.ts +1 -1
- package/dist/esm/hooks/useCreditCard.js +14 -4
- package/dist/esm/hooks/useMenuItem.d.ts +2 -0
- package/dist/esm/hooks/useModifier.d.ts +2 -0
- package/dist/esm/hooks/useOrderItem.d.ts +2 -0
- package/dist/esm/utils/cards.js +3 -1
- package/dist/esm/utils/cart.d.ts +4 -0
- package/dist/esm/utils/cart.js +4 -0
- package/dist/esm/utils/checkout.d.ts +2 -0
- package/dist/esm/utils/menu.d.ts +4 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CreditCardData, CreditCardErrors } from '@open-tender/types';
|
|
3
|
-
export declare const useCreditCard: (initState: CreditCardData | null, cardErrors?: CreditCardErrors, disabled?: boolean) => {
|
|
3
|
+
export declare const useCreditCard: (initState: CreditCardData | null, cardErrors?: CreditCardErrors, disabled?: boolean, includeAddress?: boolean) => {
|
|
4
4
|
submitRef: import("react").MutableRefObject<null>;
|
|
5
5
|
data: CreditCardData;
|
|
6
6
|
cardType: "VISA" | "MC" | "DISC" | "AMEX" | "OTHER";
|
|
@@ -10,14 +10,24 @@ const defaultState = {
|
|
|
10
10
|
zip: '',
|
|
11
11
|
is_default: false
|
|
12
12
|
};
|
|
13
|
-
const
|
|
13
|
+
const defaulStateAddress = {
|
|
14
|
+
acct: '',
|
|
15
|
+
addr: '',
|
|
16
|
+
exp: '',
|
|
17
|
+
cvv: '',
|
|
18
|
+
zip: '',
|
|
19
|
+
is_default: false
|
|
20
|
+
};
|
|
21
|
+
const useCreditCard = (initState, cardErrors = {}, disabled = false, includeAddress = false) => {
|
|
14
22
|
const [initCard, initCardType] = (0, __1.formatCard)(initState);
|
|
15
23
|
const submitRef = (0, react_1.useRef)(null);
|
|
16
|
-
const
|
|
24
|
+
const defaultCard = includeAddress ? defaulStateAddress : defaultState;
|
|
25
|
+
const [data, setData] = (0, react_1.useState)(initCard || defaultCard);
|
|
17
26
|
const [cardType, setCardType] = (0, react_1.useState)(initCardType || 'OTHER');
|
|
18
27
|
const [errors, setErrors] = (0, react_1.useState)(cardErrors);
|
|
19
|
-
const { acct, exp, cvv, zip } = data;
|
|
20
|
-
const
|
|
28
|
+
const { acct, addr, exp, cvv, zip } = data;
|
|
29
|
+
const addrComplete = includeAddress ? addr : true;
|
|
30
|
+
const isComplete = acct && exp && cvv && zip && addrComplete && (0, __1.isEmpty)(errors) ? true : false;
|
|
21
31
|
const handleChange = (name, value) => {
|
|
22
32
|
if (name === 'acct') {
|
|
23
33
|
const currentType = (0, __1.getCardType)(value.replace(/\s/g, ''));
|
|
@@ -32,6 +32,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
32
32
|
signature?: string | undefined;
|
|
33
33
|
similarItems: number[];
|
|
34
34
|
upsellItems: number[];
|
|
35
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
35
36
|
cals: number | null;
|
|
36
37
|
groups: import("@open-tender/types").CartItemGroups;
|
|
37
38
|
id: number;
|
|
@@ -50,6 +51,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
50
51
|
shortDescription: string | null;
|
|
51
52
|
shortName: string;
|
|
52
53
|
slug: string;
|
|
54
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
53
55
|
totalCals: number | null;
|
|
54
56
|
totalPrice: number | null;
|
|
55
57
|
};
|
|
@@ -27,6 +27,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
27
27
|
optionAtMax: boolean;
|
|
28
28
|
groupAtMax: boolean;
|
|
29
29
|
oneOnly: boolean;
|
|
30
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
30
31
|
description: string | null;
|
|
31
32
|
groups: import("@open-tender/types").CartItemGroups;
|
|
32
33
|
id: number;
|
|
@@ -44,6 +45,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
44
45
|
shortDescription: string | null;
|
|
45
46
|
shortName: string;
|
|
46
47
|
slug: string;
|
|
48
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
47
49
|
totalAllergens: string[];
|
|
48
50
|
totalCals: number | null;
|
|
49
51
|
totalPoints: number | null;
|
|
@@ -20,6 +20,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
20
20
|
similarItems: number[];
|
|
21
21
|
upsellItems: number[];
|
|
22
22
|
allergens: string[];
|
|
23
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
23
24
|
cals: number | null;
|
|
24
25
|
description: string | null;
|
|
25
26
|
groups: import("@open-tender/types").CartItemGroups;
|
|
@@ -39,6 +40,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
39
40
|
shortName: string;
|
|
40
41
|
slug: string;
|
|
41
42
|
tags: string[];
|
|
43
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
42
44
|
totalAllergens: string[];
|
|
43
45
|
totalCals: number | null;
|
|
44
46
|
totalPoints: number | null;
|
package/dist/cjs/utils/cards.js
CHANGED
|
@@ -70,7 +70,7 @@ const makeAcctNumber = (str, cardType) => {
|
|
|
70
70
|
};
|
|
71
71
|
exports.makeAcctNumber = makeAcctNumber;
|
|
72
72
|
const formatCardField = (field, value) => {
|
|
73
|
-
const cleanValue = (0, exports.makeNumeric)(value);
|
|
73
|
+
const cleanValue = field === 'addr' ? value : (0, exports.makeNumeric)(value);
|
|
74
74
|
switch (field) {
|
|
75
75
|
case 'acct': {
|
|
76
76
|
const currentType = (0, exports.getCardType)(value.replace(/\s/g, ''));
|
|
@@ -103,6 +103,8 @@ const formatCard = (card) => {
|
|
|
103
103
|
zip: (0, exports.formatCardField)('zip', card.zip),
|
|
104
104
|
save: card.save || true
|
|
105
105
|
};
|
|
106
|
+
if ('addr' in card)
|
|
107
|
+
creditCard.addr = card.addr;
|
|
106
108
|
return [creditCard, creditCardType];
|
|
107
109
|
};
|
|
108
110
|
exports.formatCard = formatCard;
|
package/dist/cjs/utils/cart.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
25
25
|
similarItems: number[];
|
|
26
26
|
upsellItems: number[];
|
|
27
27
|
allergens: string[];
|
|
28
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
28
29
|
cals: number | null;
|
|
29
30
|
description: string | null;
|
|
30
31
|
groups: CartItemGroups;
|
|
@@ -45,6 +46,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
45
46
|
shortName: string;
|
|
46
47
|
slug: string;
|
|
47
48
|
tags: string[];
|
|
49
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
48
50
|
totalAllergens: string[];
|
|
49
51
|
totalCals: number | null;
|
|
50
52
|
totalPoints: number | null;
|
|
@@ -113,6 +115,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
113
115
|
similarItems: number[];
|
|
114
116
|
upsellItems: number[];
|
|
115
117
|
allergens: string[];
|
|
118
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
116
119
|
cals: number | null;
|
|
117
120
|
description: string | null;
|
|
118
121
|
groups: CartItemGroups;
|
|
@@ -133,6 +136,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
133
136
|
shortName: string;
|
|
134
137
|
slug: string;
|
|
135
138
|
tags: string[];
|
|
139
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
136
140
|
totalAllergens: string[];
|
|
137
141
|
totalCals: number | null;
|
|
138
142
|
totalPoints: number | null;
|
package/dist/cjs/utils/cart.js
CHANGED
|
@@ -213,6 +213,7 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
|
|
|
213
213
|
const groups = makeOrderItemGroups(o.option_groups, isEdit, soldOut);
|
|
214
214
|
const option = {
|
|
215
215
|
allergens: (0, helpers_1.convertStringToArray)(o.allergens),
|
|
216
|
+
allergens_list: o.allergens_list || [],
|
|
216
217
|
cals: cals,
|
|
217
218
|
description: o.description,
|
|
218
219
|
groups: groups,
|
|
@@ -234,6 +235,7 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
|
|
|
234
235
|
shortName: o.short_name,
|
|
235
236
|
slug: o.slug,
|
|
236
237
|
tags: (0, helpers_1.convertStringToArray)(o.tags),
|
|
238
|
+
tags_list: o.tags_list || [],
|
|
237
239
|
totalAllergens: [],
|
|
238
240
|
totalCals: null,
|
|
239
241
|
totalPoints: null,
|
|
@@ -267,6 +269,7 @@ const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false
|
|
|
267
269
|
const isSoldOut = (0, exports.checkSoldOut)(item.id, item.suspend_until, soldOut);
|
|
268
270
|
const orderItem = {
|
|
269
271
|
allergens: (0, helpers_1.convertStringToArray)(item.allergens),
|
|
272
|
+
allergens_list: item.allergens_list || [],
|
|
270
273
|
cals: cals,
|
|
271
274
|
cartGuestId: simpleItem ? simpleItem.cart_guest_id || null : null,
|
|
272
275
|
customerId: simpleItem ? simpleItem.customer_id || null : null,
|
|
@@ -293,6 +296,7 @@ const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false
|
|
|
293
296
|
similarItems: item.similar_items,
|
|
294
297
|
slug: item.slug,
|
|
295
298
|
tags: (0, helpers_1.convertStringToArray)(item.tags),
|
|
299
|
+
tags_list: item.tags_list || [],
|
|
296
300
|
totalAllergens: [],
|
|
297
301
|
totalCals: null,
|
|
298
302
|
totalPoints: null,
|
|
@@ -5,6 +5,7 @@ export declare const adjustTenders: (tenders: CheckoutTenders, isPaid: boolean,
|
|
|
5
5
|
export declare const updateTenders: (tenders: CheckoutTenders, total: Money) => ({
|
|
6
6
|
amount: string;
|
|
7
7
|
acct: string;
|
|
8
|
+
addr?: string | undefined;
|
|
8
9
|
card_type_name: import("@open-tender/types").CardTypeName;
|
|
9
10
|
cvv: string;
|
|
10
11
|
exp: string;
|
|
@@ -28,6 +29,7 @@ export declare const updateTenders: (tenders: CheckoutTenders, total: Money) =>
|
|
|
28
29
|
amount: string;
|
|
29
30
|
balance?: `${number}.${number}` | undefined;
|
|
30
31
|
card_number: string;
|
|
32
|
+
pin?: string | undefined;
|
|
31
33
|
tender_status?: import("@open-tender/types").TenderStatus | undefined;
|
|
32
34
|
tender_type: import("@open-tender/types").TenderType;
|
|
33
35
|
} | {
|
package/dist/cjs/utils/menu.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
13
13
|
data: {
|
|
14
14
|
key: string;
|
|
15
15
|
allergens: string | null;
|
|
16
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
16
17
|
app_image_url: string | null;
|
|
17
18
|
calories: number | null;
|
|
18
19
|
description: string | null;
|
|
@@ -44,6 +45,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
44
45
|
small_image_url: string | null;
|
|
45
46
|
suspend_until: number | null;
|
|
46
47
|
tags: string | null;
|
|
48
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
47
49
|
taxes: import("@open-tender/types").MenuItemTaxes;
|
|
48
50
|
temperature: import("@open-tender/types").Temperature;
|
|
49
51
|
upsell_items: number[];
|
|
@@ -54,6 +56,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
54
56
|
data: {
|
|
55
57
|
key: string;
|
|
56
58
|
allergens: string | null;
|
|
59
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
57
60
|
app_image_url: string | null;
|
|
58
61
|
calories: number | null;
|
|
59
62
|
description: string | null;
|
|
@@ -85,6 +88,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
85
88
|
small_image_url: string | null;
|
|
86
89
|
suspend_until: number | null;
|
|
87
90
|
tags: string | null;
|
|
91
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
88
92
|
taxes: import("@open-tender/types").MenuItemTaxes;
|
|
89
93
|
temperature: import("@open-tender/types").Temperature;
|
|
90
94
|
upsell_items: number[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CreditCardData, CreditCardErrors } from '@open-tender/types';
|
|
3
|
-
export declare const useCreditCard: (initState: CreditCardData | null, cardErrors?: CreditCardErrors, disabled?: boolean) => {
|
|
3
|
+
export declare const useCreditCard: (initState: CreditCardData | null, cardErrors?: CreditCardErrors, disabled?: boolean, includeAddress?: boolean) => {
|
|
4
4
|
submitRef: import("react").MutableRefObject<null>;
|
|
5
5
|
data: CreditCardData;
|
|
6
6
|
cardType: "VISA" | "MC" | "DISC" | "AMEX" | "OTHER";
|
|
@@ -7,14 +7,24 @@ const defaultState = {
|
|
|
7
7
|
zip: '',
|
|
8
8
|
is_default: false
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
const defaulStateAddress = {
|
|
11
|
+
acct: '',
|
|
12
|
+
addr: '',
|
|
13
|
+
exp: '',
|
|
14
|
+
cvv: '',
|
|
15
|
+
zip: '',
|
|
16
|
+
is_default: false
|
|
17
|
+
};
|
|
18
|
+
export const useCreditCard = (initState, cardErrors = {}, disabled = false, includeAddress = false) => {
|
|
11
19
|
const [initCard, initCardType] = formatCard(initState);
|
|
12
20
|
const submitRef = useRef(null);
|
|
13
|
-
const
|
|
21
|
+
const defaultCard = includeAddress ? defaulStateAddress : defaultState;
|
|
22
|
+
const [data, setData] = useState(initCard || defaultCard);
|
|
14
23
|
const [cardType, setCardType] = useState(initCardType || 'OTHER');
|
|
15
24
|
const [errors, setErrors] = useState(cardErrors);
|
|
16
|
-
const { acct, exp, cvv, zip } = data;
|
|
17
|
-
const
|
|
25
|
+
const { acct, addr, exp, cvv, zip } = data;
|
|
26
|
+
const addrComplete = includeAddress ? addr : true;
|
|
27
|
+
const isComplete = acct && exp && cvv && zip && addrComplete && isEmpty(errors) ? true : false;
|
|
18
28
|
const handleChange = (name, value) => {
|
|
19
29
|
if (name === 'acct') {
|
|
20
30
|
const currentType = getCardType(value.replace(/\s/g, ''));
|
|
@@ -32,6 +32,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
32
32
|
signature?: string | undefined;
|
|
33
33
|
similarItems: number[];
|
|
34
34
|
upsellItems: number[];
|
|
35
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
35
36
|
cals: number | null;
|
|
36
37
|
groups: import("@open-tender/types").CartItemGroups;
|
|
37
38
|
id: number;
|
|
@@ -50,6 +51,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
|
|
|
50
51
|
shortDescription: string | null;
|
|
51
52
|
shortName: string;
|
|
52
53
|
slug: string;
|
|
54
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
53
55
|
totalCals: number | null;
|
|
54
56
|
totalPrice: number | null;
|
|
55
57
|
};
|
|
@@ -27,6 +27,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
27
27
|
optionAtMax: boolean;
|
|
28
28
|
groupAtMax: boolean;
|
|
29
29
|
oneOnly: boolean;
|
|
30
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
30
31
|
description: string | null;
|
|
31
32
|
groups: import("@open-tender/types").CartItemGroups;
|
|
32
33
|
id: number;
|
|
@@ -44,6 +45,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
|
|
|
44
45
|
shortDescription: string | null;
|
|
45
46
|
shortName: string;
|
|
46
47
|
slug: string;
|
|
48
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
47
49
|
totalAllergens: string[];
|
|
48
50
|
totalCals: number | null;
|
|
49
51
|
totalPoints: number | null;
|
|
@@ -20,6 +20,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
20
20
|
similarItems: number[];
|
|
21
21
|
upsellItems: number[];
|
|
22
22
|
allergens: string[];
|
|
23
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
23
24
|
cals: number | null;
|
|
24
25
|
description: string | null;
|
|
25
26
|
groups: import("@open-tender/types").CartItemGroups;
|
|
@@ -39,6 +40,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
|
|
|
39
40
|
shortName: string;
|
|
40
41
|
slug: string;
|
|
41
42
|
tags: string[];
|
|
43
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
42
44
|
totalAllergens: string[];
|
|
43
45
|
totalCals: number | null;
|
|
44
46
|
totalPoints: number | null;
|
package/dist/esm/utils/cards.js
CHANGED
|
@@ -64,7 +64,7 @@ export const makeAcctNumber = (str, cardType) => {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
export const formatCardField = (field, value) => {
|
|
67
|
-
const cleanValue = makeNumeric(value);
|
|
67
|
+
const cleanValue = field === 'addr' ? value : makeNumeric(value);
|
|
68
68
|
switch (field) {
|
|
69
69
|
case 'acct': {
|
|
70
70
|
const currentType = getCardType(value.replace(/\s/g, ''));
|
|
@@ -96,6 +96,8 @@ export const formatCard = (card) => {
|
|
|
96
96
|
zip: formatCardField('zip', card.zip),
|
|
97
97
|
save: card.save || true
|
|
98
98
|
};
|
|
99
|
+
if ('addr' in card)
|
|
100
|
+
creditCard.addr = card.addr;
|
|
99
101
|
return [creditCard, creditCardType];
|
|
100
102
|
};
|
|
101
103
|
export const validateCreditCard = (card, cardType) => {
|
package/dist/esm/utils/cart.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
25
25
|
similarItems: number[];
|
|
26
26
|
upsellItems: number[];
|
|
27
27
|
allergens: string[];
|
|
28
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
28
29
|
cals: number | null;
|
|
29
30
|
description: string | null;
|
|
30
31
|
groups: CartItemGroups;
|
|
@@ -45,6 +46,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
|
|
|
45
46
|
shortName: string;
|
|
46
47
|
slug: string;
|
|
47
48
|
tags: string[];
|
|
49
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
48
50
|
totalAllergens: string[];
|
|
49
51
|
totalCals: number | null;
|
|
50
52
|
totalPoints: number | null;
|
|
@@ -113,6 +115,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
113
115
|
similarItems: number[];
|
|
114
116
|
upsellItems: number[];
|
|
115
117
|
allergens: string[];
|
|
118
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
116
119
|
cals: number | null;
|
|
117
120
|
description: string | null;
|
|
118
121
|
groups: CartItemGroups;
|
|
@@ -133,6 +136,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
|
|
|
133
136
|
shortName: string;
|
|
134
137
|
slug: string;
|
|
135
138
|
tags: string[];
|
|
139
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
136
140
|
totalAllergens: string[];
|
|
137
141
|
totalCals: number | null;
|
|
138
142
|
totalPoints: number | null;
|
package/dist/esm/utils/cart.js
CHANGED
|
@@ -198,6 +198,7 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
|
|
|
198
198
|
const groups = makeOrderItemGroups(o.option_groups, isEdit, soldOut);
|
|
199
199
|
const option = {
|
|
200
200
|
allergens: convertStringToArray(o.allergens),
|
|
201
|
+
allergens_list: o.allergens_list || [],
|
|
201
202
|
cals: cals,
|
|
202
203
|
description: o.description,
|
|
203
204
|
groups: groups,
|
|
@@ -219,6 +220,7 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
|
|
|
219
220
|
shortName: o.short_name,
|
|
220
221
|
slug: o.slug,
|
|
221
222
|
tags: convertStringToArray(o.tags),
|
|
223
|
+
tags_list: o.tags_list || [],
|
|
222
224
|
totalAllergens: [],
|
|
223
225
|
totalCals: null,
|
|
224
226
|
totalPoints: null,
|
|
@@ -252,6 +254,7 @@ export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints
|
|
|
252
254
|
const isSoldOut = checkSoldOut(item.id, item.suspend_until, soldOut);
|
|
253
255
|
const orderItem = {
|
|
254
256
|
allergens: convertStringToArray(item.allergens),
|
|
257
|
+
allergens_list: item.allergens_list || [],
|
|
255
258
|
cals: cals,
|
|
256
259
|
cartGuestId: simpleItem ? simpleItem.cart_guest_id || null : null,
|
|
257
260
|
customerId: simpleItem ? simpleItem.customer_id || null : null,
|
|
@@ -278,6 +281,7 @@ export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints
|
|
|
278
281
|
similarItems: item.similar_items,
|
|
279
282
|
slug: item.slug,
|
|
280
283
|
tags: convertStringToArray(item.tags),
|
|
284
|
+
tags_list: item.tags_list || [],
|
|
281
285
|
totalAllergens: [],
|
|
282
286
|
totalCals: null,
|
|
283
287
|
totalPoints: null,
|
|
@@ -5,6 +5,7 @@ export declare const adjustTenders: (tenders: CheckoutTenders, isPaid: boolean,
|
|
|
5
5
|
export declare const updateTenders: (tenders: CheckoutTenders, total: Money) => ({
|
|
6
6
|
amount: string;
|
|
7
7
|
acct: string;
|
|
8
|
+
addr?: string | undefined;
|
|
8
9
|
card_type_name: import("@open-tender/types").CardTypeName;
|
|
9
10
|
cvv: string;
|
|
10
11
|
exp: string;
|
|
@@ -28,6 +29,7 @@ export declare const updateTenders: (tenders: CheckoutTenders, total: Money) =>
|
|
|
28
29
|
amount: string;
|
|
29
30
|
balance?: `${number}.${number}` | undefined;
|
|
30
31
|
card_number: string;
|
|
32
|
+
pin?: string | undefined;
|
|
31
33
|
tender_status?: import("@open-tender/types").TenderStatus | undefined;
|
|
32
34
|
tender_type: import("@open-tender/types").TenderType;
|
|
33
35
|
} | {
|
package/dist/esm/utils/menu.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
13
13
|
data: {
|
|
14
14
|
key: string;
|
|
15
15
|
allergens: string | null;
|
|
16
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
16
17
|
app_image_url: string | null;
|
|
17
18
|
calories: number | null;
|
|
18
19
|
description: string | null;
|
|
@@ -44,6 +45,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
|
|
|
44
45
|
small_image_url: string | null;
|
|
45
46
|
suspend_until: number | null;
|
|
46
47
|
tags: string | null;
|
|
48
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
47
49
|
taxes: import("@open-tender/types").MenuItemTaxes;
|
|
48
50
|
temperature: import("@open-tender/types").Temperature;
|
|
49
51
|
upsell_items: number[];
|
|
@@ -54,6 +56,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
54
56
|
data: {
|
|
55
57
|
key: string;
|
|
56
58
|
allergens: string | null;
|
|
59
|
+
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
|
|
57
60
|
app_image_url: string | null;
|
|
58
61
|
calories: number | null;
|
|
59
62
|
description: string | null;
|
|
@@ -85,6 +88,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
|
|
|
85
88
|
small_image_url: string | null;
|
|
86
89
|
suspend_until: number | null;
|
|
87
90
|
tags: string | null;
|
|
91
|
+
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
|
|
88
92
|
taxes: import("@open-tender/types").MenuItemTaxes;
|
|
89
93
|
temperature: import("@open-tender/types").Temperature;
|
|
90
94
|
upsell_items: number[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/utils",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.31",
|
|
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.57",
|
|
61
61
|
"@reduxjs/toolkit": "^1.8.5",
|
|
62
62
|
"react": "^18.2.0"
|
|
63
63
|
},
|