@open-tender/utils 0.4.31 → 0.4.32
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/LICENSE.md +21 -21
- package/README.md +2 -2
- package/dist/cjs/__tests__/utils/helpers.test.d.ts +1 -1
- package/dist/cjs/__tests__/utils/helpers.test.js +96 -96
- package/dist/cjs/__tests__/utils/theme.test.d.ts +1 -1
- package/dist/cjs/__tests__/utils/theme.test.js +37 -37
- package/dist/cjs/hooks/index.d.ts +35 -35
- package/dist/cjs/hooks/index.js +38 -38
- package/dist/cjs/hooks/types.d.ts +4 -4
- package/dist/cjs/hooks/types.js +2 -2
- package/dist/cjs/hooks/useAccordion.d.ts +22 -22
- package/dist/cjs/hooks/useAccordion.js +56 -56
- package/dist/cjs/hooks/useAddressForm.d.ts +12 -12
- package/dist/cjs/hooks/useAddressForm.js +83 -83
- package/dist/cjs/hooks/useAllergenForm.d.ts +10 -10
- package/dist/cjs/hooks/useAllergenForm.js +58 -58
- package/dist/cjs/hooks/useBuilder.d.ts +14 -14
- package/dist/cjs/hooks/useBuilder.js +144 -144
- package/dist/cjs/hooks/useCartGuestForm.d.ts +12 -12
- package/dist/cjs/hooks/useCartGuestForm.js +58 -58
- package/dist/cjs/hooks/useCartPoints.d.ts +13 -13
- package/dist/cjs/hooks/useCartPoints.js +74 -74
- package/dist/cjs/hooks/useCommunicationPreferences.js +1 -1
- package/dist/cjs/hooks/useCreditCard.d.ts +13 -13
- package/dist/cjs/hooks/useCreditCard.js +63 -63
- package/dist/cjs/hooks/useCreditCardForm.d.ts +10 -10
- package/dist/cjs/hooks/useCreditCardForm.js +71 -71
- package/dist/cjs/hooks/useCurbside.d.ts +9 -9
- package/dist/cjs/hooks/useCurbside.js +39 -39
- package/dist/cjs/hooks/useDineInForm.d.ts +11 -11
- package/dist/cjs/hooks/useDineInForm.js +56 -56
- package/dist/cjs/hooks/useDonationForm.d.ts +28 -28
- package/dist/cjs/hooks/useDonationForm.js +172 -172
- package/dist/cjs/hooks/useFirstTimes.d.ts +18 -18
- package/dist/cjs/hooks/useFirstTimes.js +81 -81
- package/dist/cjs/hooks/useGiftCardAssignForm.d.ts +14 -14
- package/dist/cjs/hooks/useGiftCardAssignForm.js +57 -57
- package/dist/cjs/hooks/useGiftCardAssignOtherForm.d.ts +14 -14
- package/dist/cjs/hooks/useGiftCardAssignOtherForm.js +50 -50
- package/dist/cjs/hooks/useGiftCardForm.d.ts +12 -12
- package/dist/cjs/hooks/useGiftCardForm.js +74 -74
- package/dist/cjs/hooks/useGiftCardsForm.d.ts +31 -31
- package/dist/cjs/hooks/useGiftCardsForm.js +195 -195
- package/dist/cjs/hooks/useGuestCheckoutForm.d.ts +21 -21
- package/dist/cjs/hooks/useGuestCheckoutForm.js +89 -89
- package/dist/cjs/hooks/useGuestForm.d.ts +12 -12
- package/dist/cjs/hooks/useGuestForm.js +60 -60
- package/dist/cjs/hooks/useImage.d.ts +5 -5
- package/dist/cjs/hooks/useImage.js +33 -33
- package/dist/cjs/hooks/useLoginForm.d.ts +12 -12
- package/dist/cjs/hooks/useLoginForm.js +67 -67
- package/dist/cjs/hooks/useMenuItem.d.ts +57 -57
- package/dist/cjs/hooks/useMenuItem.js +67 -67
- package/dist/cjs/hooks/useModifier.d.ts +53 -53
- package/dist/cjs/hooks/useModifier.js +72 -72
- package/dist/cjs/hooks/useModifierGroup.d.ts +15 -15
- package/dist/cjs/hooks/useModifierGroup.js +17 -17
- package/dist/cjs/hooks/useOneTimePasscodeForm.d.ts +16 -16
- package/dist/cjs/hooks/useOneTimePasscodeForm.js +87 -87
- package/dist/cjs/hooks/useOrderFulfillmentForm.d.ts +11 -11
- package/dist/cjs/hooks/useOrderFulfillmentForm.js +65 -65
- package/dist/cjs/hooks/useOrderItem.d.ts +48 -48
- package/dist/cjs/hooks/useOrderItem.js +54 -54
- package/dist/cjs/hooks/useOrderRating.d.ts +10 -10
- package/dist/cjs/hooks/useOrderRating.js +34 -34
- package/dist/cjs/hooks/useOrderRatingForm.d.ts +11 -11
- package/dist/cjs/hooks/useOrderRatingForm.js +35 -35
- package/dist/cjs/hooks/useProfileForm.d.ts +15 -15
- package/dist/cjs/hooks/useProfileForm.js +116 -116
- package/dist/cjs/hooks/useResetPasswordForm.d.ts +12 -12
- package/dist/cjs/hooks/useResetPasswordForm.js +77 -77
- package/dist/cjs/hooks/useSendResetForm.d.ts +14 -14
- package/dist/cjs/hooks/useSendResetForm.js +57 -57
- package/dist/cjs/hooks/useSignUpForm.d.ts +20 -20
- package/dist/cjs/hooks/useSignUpForm.js +151 -151
- package/dist/cjs/hooks/useSignUpGuestForm.d.ts +23 -23
- package/dist/cjs/hooks/useSignUpGuestForm.js +122 -113
- package/dist/cjs/hooks/useSigninForm.d.ts +12 -12
- package/dist/cjs/hooks/useSigninForm.js +66 -66
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/utils/cards.d.ts +20 -20
- package/dist/cjs/utils/cards.js +155 -155
- package/dist/cjs/utils/cart.d.ts +202 -202
- package/dist/cjs/utils/cart.js +909 -909
- package/dist/cjs/utils/checkout.d.ts +55 -55
- package/dist/cjs/utils/checkout.js +125 -125
- package/dist/cjs/utils/constants.d.ts +43 -43
- package/dist/cjs/utils/constants.js +58 -58
- package/dist/cjs/utils/customer.d.ts +4 -4
- package/dist/cjs/utils/customer.js +34 -34
- package/dist/cjs/utils/datetimes.d.ts +99 -99
- package/dist/cjs/utils/datetimes.js +601 -601
- package/dist/cjs/utils/errors.d.ts +51 -51
- package/dist/cjs/utils/errors.js +191 -191
- package/dist/cjs/utils/favorites.d.ts +10 -10
- package/dist/cjs/utils/favorites.js +119 -119
- package/dist/cjs/utils/googleMaps.d.ts +14 -14
- package/dist/cjs/utils/googleMaps.js +30 -30
- package/dist/cjs/utils/helpers.d.ts +63 -63
- package/dist/cjs/utils/helpers.js +244 -244
- package/dist/cjs/utils/index.d.ts +19 -19
- package/dist/cjs/utils/index.js +23 -23
- package/dist/cjs/utils/keypad.d.ts +9 -9
- package/dist/cjs/utils/keypad.js +105 -105
- package/dist/cjs/utils/maps.d.ts +226 -226
- package/dist/cjs/utils/maps.js +334 -334
- package/dist/cjs/utils/menu.d.ts +117 -117
- package/dist/cjs/utils/menu.js +82 -82
- package/dist/cjs/utils/orders.d.ts +21 -21
- package/dist/cjs/utils/orders.js +202 -202
- package/dist/cjs/utils/pizzaBuilder.d.ts +10 -10
- package/dist/cjs/utils/pizzaBuilder.js +43 -43
- package/dist/cjs/utils/refunds.d.ts +35 -35
- package/dist/cjs/utils/refunds.js +98 -98
- package/dist/cjs/utils/revenueCenters.d.ts +11 -11
- package/dist/cjs/utils/revenueCenters.js +125 -125
- package/dist/cjs/utils/rewards.d.ts +4 -4
- package/dist/cjs/utils/rewards.js +106 -106
- package/dist/cjs/utils/theme.d.ts +27 -27
- package/dist/cjs/utils/theme.js +266 -266
- package/dist/cjs/utils/version.d.ts +4 -4
- package/dist/cjs/utils/version.js +38 -38
- package/dist/esm/__tests__/utils/helpers.test.d.ts +1 -1
- package/dist/esm/__tests__/utils/helpers.test.js +94 -94
- package/dist/esm/__tests__/utils/theme.test.d.ts +1 -1
- package/dist/esm/__tests__/utils/theme.test.js +35 -35
- package/dist/esm/hooks/index.d.ts +35 -35
- package/dist/esm/hooks/index.js +35 -35
- package/dist/esm/hooks/types.d.ts +4 -4
- package/dist/esm/hooks/types.js +1 -1
- package/dist/esm/hooks/useAccordion.d.ts +22 -22
- package/dist/esm/hooks/useAccordion.js +52 -52
- package/dist/esm/hooks/useAddressForm.d.ts +12 -12
- package/dist/esm/hooks/useAddressForm.js +79 -79
- package/dist/esm/hooks/useAllergenForm.d.ts +10 -10
- package/dist/esm/hooks/useAllergenForm.js +54 -54
- package/dist/esm/hooks/useBuilder.d.ts +14 -14
- package/dist/esm/hooks/useBuilder.js +140 -140
- package/dist/esm/hooks/useCartGuestForm.d.ts +12 -12
- package/dist/esm/hooks/useCartGuestForm.js +54 -54
- package/dist/esm/hooks/useCartPoints.d.ts +13 -13
- package/dist/esm/hooks/useCartPoints.js +70 -70
- package/dist/esm/hooks/useCommunicationPreferences.js +1 -1
- package/dist/esm/hooks/useCreditCard.d.ts +13 -13
- package/dist/esm/hooks/useCreditCard.js +59 -59
- package/dist/esm/hooks/useCreditCardForm.d.ts +10 -10
- package/dist/esm/hooks/useCreditCardForm.js +67 -67
- package/dist/esm/hooks/useCurbside.d.ts +9 -9
- package/dist/esm/hooks/useCurbside.js +35 -35
- package/dist/esm/hooks/useDineInForm.d.ts +11 -11
- package/dist/esm/hooks/useDineInForm.js +52 -52
- package/dist/esm/hooks/useDonationForm.d.ts +28 -28
- package/dist/esm/hooks/useDonationForm.js +168 -168
- package/dist/esm/hooks/useFirstTimes.d.ts +18 -18
- package/dist/esm/hooks/useFirstTimes.js +77 -77
- package/dist/esm/hooks/useGiftCardAssignForm.d.ts +14 -14
- package/dist/esm/hooks/useGiftCardAssignForm.js +53 -53
- package/dist/esm/hooks/useGiftCardAssignOtherForm.d.ts +14 -14
- package/dist/esm/hooks/useGiftCardAssignOtherForm.js +46 -46
- package/dist/esm/hooks/useGiftCardForm.d.ts +12 -12
- package/dist/esm/hooks/useGiftCardForm.js +70 -70
- package/dist/esm/hooks/useGiftCardsForm.d.ts +31 -31
- package/dist/esm/hooks/useGiftCardsForm.js +191 -191
- package/dist/esm/hooks/useGuestCheckoutForm.d.ts +21 -21
- package/dist/esm/hooks/useGuestCheckoutForm.js +85 -85
- package/dist/esm/hooks/useGuestForm.d.ts +12 -12
- package/dist/esm/hooks/useGuestForm.js +56 -56
- package/dist/esm/hooks/useImage.d.ts +5 -5
- package/dist/esm/hooks/useImage.js +29 -29
- package/dist/esm/hooks/useLoginForm.d.ts +12 -12
- package/dist/esm/hooks/useLoginForm.js +63 -63
- package/dist/esm/hooks/useMenuItem.d.ts +57 -57
- package/dist/esm/hooks/useMenuItem.js +63 -63
- package/dist/esm/hooks/useModifier.d.ts +53 -53
- package/dist/esm/hooks/useModifier.js +68 -68
- package/dist/esm/hooks/useModifierGroup.d.ts +15 -15
- package/dist/esm/hooks/useModifierGroup.js +13 -13
- package/dist/esm/hooks/useOneTimePasscodeForm.d.ts +16 -16
- package/dist/esm/hooks/useOneTimePasscodeForm.js +83 -83
- package/dist/esm/hooks/useOrderFulfillmentForm.d.ts +11 -11
- package/dist/esm/hooks/useOrderFulfillmentForm.js +61 -61
- package/dist/esm/hooks/useOrderItem.d.ts +48 -48
- package/dist/esm/hooks/useOrderItem.js +50 -50
- package/dist/esm/hooks/useOrderRating.d.ts +10 -10
- package/dist/esm/hooks/useOrderRating.js +30 -30
- package/dist/esm/hooks/useOrderRatingForm.d.ts +11 -11
- package/dist/esm/hooks/useOrderRatingForm.js +31 -31
- package/dist/esm/hooks/useProfileForm.d.ts +15 -15
- package/dist/esm/hooks/useProfileForm.js +112 -112
- package/dist/esm/hooks/useResetPasswordForm.d.ts +12 -12
- package/dist/esm/hooks/useResetPasswordForm.js +73 -73
- package/dist/esm/hooks/useSendResetForm.d.ts +14 -14
- package/dist/esm/hooks/useSendResetForm.js +53 -53
- package/dist/esm/hooks/useSignUpForm.d.ts +20 -20
- package/dist/esm/hooks/useSignUpForm.js +147 -147
- package/dist/esm/hooks/useSignUpGuestForm.d.ts +23 -23
- package/dist/esm/hooks/useSignUpGuestForm.js +118 -109
- package/dist/esm/hooks/useSigninForm.d.ts +12 -12
- package/dist/esm/hooks/useSigninForm.js +62 -62
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/utils/cards.d.ts +20 -20
- package/dist/esm/utils/cards.js +146 -146
- package/dist/esm/utils/cart.d.ts +202 -202
- package/dist/esm/utils/cart.js +868 -868
- package/dist/esm/utils/checkout.d.ts +55 -55
- package/dist/esm/utils/checkout.js +117 -117
- package/dist/esm/utils/constants.d.ts +43 -43
- package/dist/esm/utils/constants.js +55 -55
- package/dist/esm/utils/customer.d.ts +4 -4
- package/dist/esm/utils/customer.js +29 -29
- package/dist/esm/utils/datetimes.d.ts +99 -99
- package/dist/esm/utils/datetimes.js +531 -531
- package/dist/esm/utils/errors.d.ts +51 -51
- package/dist/esm/utils/errors.js +180 -180
- package/dist/esm/utils/favorites.d.ts +10 -10
- package/dist/esm/utils/favorites.js +109 -109
- package/dist/esm/utils/googleMaps.d.ts +14 -14
- package/dist/esm/utils/googleMaps.js +26 -26
- package/dist/esm/utils/helpers.d.ts +63 -63
- package/dist/esm/utils/helpers.js +205 -205
- package/dist/esm/utils/index.d.ts +19 -19
- package/dist/esm/utils/index.js +20 -20
- package/dist/esm/utils/keypad.d.ts +9 -9
- package/dist/esm/utils/keypad.js +97 -97
- package/dist/esm/utils/maps.d.ts +226 -226
- package/dist/esm/utils/maps.js +316 -316
- package/dist/esm/utils/menu.d.ts +117 -117
- package/dist/esm/utils/menu.js +74 -74
- package/dist/esm/utils/orders.d.ts +21 -21
- package/dist/esm/utils/orders.js +185 -185
- package/dist/esm/utils/pizzaBuilder.d.ts +10 -10
- package/dist/esm/utils/pizzaBuilder.js +38 -38
- package/dist/esm/utils/refunds.d.ts +35 -35
- package/dist/esm/utils/refunds.js +90 -90
- package/dist/esm/utils/revenueCenters.d.ts +11 -11
- package/dist/esm/utils/revenueCenters.js +115 -115
- package/dist/esm/utils/rewards.d.ts +4 -4
- package/dist/esm/utils/rewards.js +100 -100
- package/dist/esm/utils/theme.d.ts +27 -27
- package/dist/esm/utils/theme.js +254 -254
- package/dist/esm/utils/version.d.ts +4 -4
- package/dist/esm/utils/version.js +34 -34
- package/package.json +69 -68
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeNetOrder = exports.adjustAmounts = exports.makeRefundLookup = exports.makeAmountsLookup = exports.makeRefundCartLookup = void 0;
|
|
4
|
-
const makeRefundCartLookup = (cart) => {
|
|
5
|
-
const lookup = {};
|
|
6
|
-
cart.forEach(item => {
|
|
7
|
-
var _a;
|
|
8
|
-
const { line_no, quantity, price_total } = item;
|
|
9
|
-
lookup[line_no !== null && line_no !== void 0 ? line_no : 0] = { quantity, price_total };
|
|
10
|
-
(_a = item === null || item === void 0 ? void 0 : item.groups) === null || _a === void 0 ? void 0 : _a.forEach(group => group.options.forEach(option => {
|
|
11
|
-
const { line_no, quantity, price } = option;
|
|
12
|
-
lookup[line_no !== null && line_no !== void 0 ? line_no : 0] = { quantity, price };
|
|
13
|
-
}));
|
|
14
|
-
});
|
|
15
|
-
return lookup;
|
|
16
|
-
};
|
|
17
|
-
exports.makeRefundCartLookup = makeRefundCartLookup;
|
|
18
|
-
const makeAmountsLookup = (items, key = 'id') => {
|
|
19
|
-
return items.reduce((obj, i) => (Object.assign(Object.assign({}, obj), { [i[key]]: i.amount })), {});
|
|
20
|
-
};
|
|
21
|
-
exports.makeAmountsLookup = makeAmountsLookup;
|
|
22
|
-
const makeRefundLookup = (order) => {
|
|
23
|
-
const { cart, gift_cards, surcharges, discounts, taxes, totals, tenders } = order;
|
|
24
|
-
const { subtotal, gift_card, surcharge, discount, tax, tip, shipping, total } = totals;
|
|
25
|
-
return {
|
|
26
|
-
cart: (0, exports.makeRefundCartLookup)(cart),
|
|
27
|
-
gift_cards: gift_cards ? (0, exports.makeAmountsLookup)(gift_cards, 'code') : null,
|
|
28
|
-
surcharges: (0, exports.makeAmountsLookup)(surcharges),
|
|
29
|
-
discounts: (0, exports.makeAmountsLookup)(discounts),
|
|
30
|
-
taxes: (0, exports.makeAmountsLookup)(taxes),
|
|
31
|
-
tenders: (0, exports.makeAmountsLookup)(tenders, 'tender_index'),
|
|
32
|
-
subtotal,
|
|
33
|
-
gift_card,
|
|
34
|
-
surcharge,
|
|
35
|
-
discount,
|
|
36
|
-
tax,
|
|
37
|
-
tip,
|
|
38
|
-
shipping,
|
|
39
|
-
total
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
exports.makeRefundLookup = makeRefundLookup;
|
|
43
|
-
const adjustAmount = (amount, refundAmount) => {
|
|
44
|
-
return (parseFloat(amount) + parseFloat(refundAmount)).toFixed(2);
|
|
45
|
-
};
|
|
46
|
-
const adjustAmounts = (order, lookup, list, key = 'id') => {
|
|
47
|
-
if (!order[list])
|
|
48
|
-
return order;
|
|
49
|
-
order[list].forEach((i) => {
|
|
50
|
-
const amount = lookup[list][i[key]];
|
|
51
|
-
if (amount)
|
|
52
|
-
i.amount = adjustAmount(i.amount, amount);
|
|
53
|
-
});
|
|
54
|
-
return order;
|
|
55
|
-
};
|
|
56
|
-
exports.adjustAmounts = adjustAmounts;
|
|
57
|
-
const amounts = [
|
|
58
|
-
'subtotal',
|
|
59
|
-
'gift_card',
|
|
60
|
-
'surcharge',
|
|
61
|
-
'discount',
|
|
62
|
-
'tax',
|
|
63
|
-
'tip',
|
|
64
|
-
'shipping',
|
|
65
|
-
'total'
|
|
66
|
-
];
|
|
67
|
-
const makeNetOrder = (order, refunds) => {
|
|
68
|
-
if (!refunds || !refunds.length)
|
|
69
|
-
return order;
|
|
70
|
-
let copy = JSON.parse(JSON.stringify(order));
|
|
71
|
-
refunds.forEach(refund => {
|
|
72
|
-
const lookup = (0, exports.makeRefundLookup)(refund);
|
|
73
|
-
copy.cart.forEach((i) => {
|
|
74
|
-
var _a, _b, _c, _d, _e;
|
|
75
|
-
const item = lookup.cart[(_a = i.line_no) !== null && _a !== void 0 ? _a : 0];
|
|
76
|
-
if (item) {
|
|
77
|
-
i.quantity = (_c = ((_b = i.quantity) !== null && _b !== void 0 ? _b : 0) - item.quantity) !== null && _c !== void 0 ? _c : 0;
|
|
78
|
-
i.price_total = adjustAmount(i.price_total, (_d = item.price_total) !== null && _d !== void 0 ? _d : '0.0');
|
|
79
|
-
}
|
|
80
|
-
if (i.quantity === 0) {
|
|
81
|
-
(_e = i.groups) === null || _e === void 0 ? void 0 : _e.forEach(group => group.options.forEach(option => {
|
|
82
|
-
option.quantity = 0;
|
|
83
|
-
option.price_total = '0.00';
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
copy = (0, exports.adjustAmounts)(copy, lookup, 'gift_cards', 'code');
|
|
88
|
-
copy = (0, exports.adjustAmounts)(copy, lookup, 'surcharges');
|
|
89
|
-
copy = (0, exports.adjustAmounts)(copy, lookup, 'discounts');
|
|
90
|
-
copy = (0, exports.adjustAmounts)(copy, lookup, 'taxes');
|
|
91
|
-
copy = (0, exports.adjustAmounts)(copy, lookup, 'tenders', 'tender_index');
|
|
92
|
-
amounts.forEach(i => {
|
|
93
|
-
copy.totals[i] = adjustAmount(copy.totals[i], lookup[i]);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
return copy;
|
|
97
|
-
};
|
|
98
|
-
exports.makeNetOrder = makeNetOrder;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeNetOrder = exports.adjustAmounts = exports.makeRefundLookup = exports.makeAmountsLookup = exports.makeRefundCartLookup = void 0;
|
|
4
|
+
const makeRefundCartLookup = (cart) => {
|
|
5
|
+
const lookup = {};
|
|
6
|
+
cart.forEach(item => {
|
|
7
|
+
var _a;
|
|
8
|
+
const { line_no, quantity, price_total } = item;
|
|
9
|
+
lookup[line_no !== null && line_no !== void 0 ? line_no : 0] = { quantity, price_total };
|
|
10
|
+
(_a = item === null || item === void 0 ? void 0 : item.groups) === null || _a === void 0 ? void 0 : _a.forEach(group => group.options.forEach(option => {
|
|
11
|
+
const { line_no, quantity, price } = option;
|
|
12
|
+
lookup[line_no !== null && line_no !== void 0 ? line_no : 0] = { quantity, price };
|
|
13
|
+
}));
|
|
14
|
+
});
|
|
15
|
+
return lookup;
|
|
16
|
+
};
|
|
17
|
+
exports.makeRefundCartLookup = makeRefundCartLookup;
|
|
18
|
+
const makeAmountsLookup = (items, key = 'id') => {
|
|
19
|
+
return items.reduce((obj, i) => (Object.assign(Object.assign({}, obj), { [i[key]]: i.amount })), {});
|
|
20
|
+
};
|
|
21
|
+
exports.makeAmountsLookup = makeAmountsLookup;
|
|
22
|
+
const makeRefundLookup = (order) => {
|
|
23
|
+
const { cart, gift_cards, surcharges, discounts, taxes, totals, tenders } = order;
|
|
24
|
+
const { subtotal, gift_card, surcharge, discount, tax, tip, shipping, total } = totals;
|
|
25
|
+
return {
|
|
26
|
+
cart: (0, exports.makeRefundCartLookup)(cart),
|
|
27
|
+
gift_cards: gift_cards ? (0, exports.makeAmountsLookup)(gift_cards, 'code') : null,
|
|
28
|
+
surcharges: (0, exports.makeAmountsLookup)(surcharges),
|
|
29
|
+
discounts: (0, exports.makeAmountsLookup)(discounts),
|
|
30
|
+
taxes: (0, exports.makeAmountsLookup)(taxes),
|
|
31
|
+
tenders: (0, exports.makeAmountsLookup)(tenders, 'tender_index'),
|
|
32
|
+
subtotal,
|
|
33
|
+
gift_card,
|
|
34
|
+
surcharge,
|
|
35
|
+
discount,
|
|
36
|
+
tax,
|
|
37
|
+
tip,
|
|
38
|
+
shipping,
|
|
39
|
+
total
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.makeRefundLookup = makeRefundLookup;
|
|
43
|
+
const adjustAmount = (amount, refundAmount) => {
|
|
44
|
+
return (parseFloat(amount) + parseFloat(refundAmount)).toFixed(2);
|
|
45
|
+
};
|
|
46
|
+
const adjustAmounts = (order, lookup, list, key = 'id') => {
|
|
47
|
+
if (!order[list])
|
|
48
|
+
return order;
|
|
49
|
+
order[list].forEach((i) => {
|
|
50
|
+
const amount = lookup[list][i[key]];
|
|
51
|
+
if (amount)
|
|
52
|
+
i.amount = adjustAmount(i.amount, amount);
|
|
53
|
+
});
|
|
54
|
+
return order;
|
|
55
|
+
};
|
|
56
|
+
exports.adjustAmounts = adjustAmounts;
|
|
57
|
+
const amounts = [
|
|
58
|
+
'subtotal',
|
|
59
|
+
'gift_card',
|
|
60
|
+
'surcharge',
|
|
61
|
+
'discount',
|
|
62
|
+
'tax',
|
|
63
|
+
'tip',
|
|
64
|
+
'shipping',
|
|
65
|
+
'total'
|
|
66
|
+
];
|
|
67
|
+
const makeNetOrder = (order, refunds) => {
|
|
68
|
+
if (!refunds || !refunds.length)
|
|
69
|
+
return order;
|
|
70
|
+
let copy = JSON.parse(JSON.stringify(order));
|
|
71
|
+
refunds.forEach(refund => {
|
|
72
|
+
const lookup = (0, exports.makeRefundLookup)(refund);
|
|
73
|
+
copy.cart.forEach((i) => {
|
|
74
|
+
var _a, _b, _c, _d, _e;
|
|
75
|
+
const item = lookup.cart[(_a = i.line_no) !== null && _a !== void 0 ? _a : 0];
|
|
76
|
+
if (item) {
|
|
77
|
+
i.quantity = (_c = ((_b = i.quantity) !== null && _b !== void 0 ? _b : 0) - item.quantity) !== null && _c !== void 0 ? _c : 0;
|
|
78
|
+
i.price_total = adjustAmount(i.price_total, (_d = item.price_total) !== null && _d !== void 0 ? _d : '0.0');
|
|
79
|
+
}
|
|
80
|
+
if (i.quantity === 0) {
|
|
81
|
+
(_e = i.groups) === null || _e === void 0 ? void 0 : _e.forEach(group => group.options.forEach(option => {
|
|
82
|
+
option.quantity = 0;
|
|
83
|
+
option.price_total = '0.00';
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
copy = (0, exports.adjustAmounts)(copy, lookup, 'gift_cards', 'code');
|
|
88
|
+
copy = (0, exports.adjustAmounts)(copy, lookup, 'surcharges');
|
|
89
|
+
copy = (0, exports.adjustAmounts)(copy, lookup, 'discounts');
|
|
90
|
+
copy = (0, exports.adjustAmounts)(copy, lookup, 'taxes');
|
|
91
|
+
copy = (0, exports.adjustAmounts)(copy, lookup, 'tenders', 'tender_index');
|
|
92
|
+
amounts.forEach(i => {
|
|
93
|
+
copy.totals[i] = adjustAmount(copy.totals[i], lookup[i]);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
return copy;
|
|
97
|
+
};
|
|
98
|
+
exports.makeNetOrder = makeNetOrder;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Address, OrderType, RevenueCenter, ServiceType } from '@open-tender/types';
|
|
2
|
-
export declare const makeOrderAddress: (address: Address | null) => string;
|
|
3
|
-
export declare const makeFullAddress: (address: Address) => string;
|
|
4
|
-
export declare const makeOrderTypeFromParam: (param: string) => (string | boolean)[] | null;
|
|
5
|
-
export declare const makeServiceTypeName: (serviceType: ServiceType, isCatering: boolean, isOutpost: boolean, outpostName: string) => string | undefined;
|
|
6
|
-
export declare const makeOrderTypeName: (orderType: OrderType, serviceType: ServiceType) => string | undefined;
|
|
7
|
-
export declare const makeNotAcceptingOrdersMsg: (serviceType: ServiceType) => string;
|
|
8
|
-
export declare const makeRevenueCenterMsg: (revenueCenter: RevenueCenter, serviceType: ServiceType, requestedAt: string, statusMessages: Record<string, string>) => {
|
|
9
|
-
message: any;
|
|
10
|
-
color: string;
|
|
11
|
-
};
|
|
1
|
+
import { Address, OrderType, RevenueCenter, ServiceType } from '@open-tender/types';
|
|
2
|
+
export declare const makeOrderAddress: (address: Address | null) => string;
|
|
3
|
+
export declare const makeFullAddress: (address: Address) => string;
|
|
4
|
+
export declare const makeOrderTypeFromParam: (param: string) => (string | boolean)[] | null;
|
|
5
|
+
export declare const makeServiceTypeName: (serviceType: ServiceType, isCatering: boolean, isOutpost: boolean, outpostName: string) => string | undefined;
|
|
6
|
+
export declare const makeOrderTypeName: (orderType: OrderType, serviceType: ServiceType) => string | undefined;
|
|
7
|
+
export declare const makeNotAcceptingOrdersMsg: (serviceType: ServiceType) => string;
|
|
8
|
+
export declare const makeRevenueCenterMsg: (revenueCenter: RevenueCenter, serviceType: ServiceType, requestedAt: string, statusMessages: Record<string, string>) => {
|
|
9
|
+
message: any;
|
|
10
|
+
color: string;
|
|
11
|
+
};
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeRevenueCenterMsg = exports.makeNotAcceptingOrdersMsg = exports.makeOrderTypeName = exports.makeServiceTypeName = exports.makeOrderTypeFromParam = exports.makeFullAddress = exports.makeOrderAddress = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const datetimes_1 = require("./datetimes");
|
|
6
|
-
const helpers_1 = require("./helpers");
|
|
7
|
-
const makeOrderAddress = (address) => {
|
|
8
|
-
const { street, unit, city, state, postal_code } = address || {};
|
|
9
|
-
return street
|
|
10
|
-
? `${street}${unit ? `, ${unit}` : ''}`
|
|
11
|
-
: postal_code
|
|
12
|
-
? `${postal_code} ${city}, ${state}`
|
|
13
|
-
: 'No address provided';
|
|
14
|
-
};
|
|
15
|
-
exports.makeOrderAddress = makeOrderAddress;
|
|
16
|
-
const makeFullAddress = (address) => {
|
|
17
|
-
const { street, city, state, postal_code } = address || {};
|
|
18
|
-
return `${street ? `${street}, ` : ''}${city}, ${state} ${postal_code}`;
|
|
19
|
-
};
|
|
20
|
-
exports.makeFullAddress = makeFullAddress;
|
|
21
|
-
const makeOrderTypeFromParam = (param) => {
|
|
22
|
-
switch (param) {
|
|
23
|
-
case 'outpost':
|
|
24
|
-
return ['OLO', 'PICKUP', true];
|
|
25
|
-
case 'pickup':
|
|
26
|
-
return ['OLO', 'PICKUP'];
|
|
27
|
-
case 'delivery':
|
|
28
|
-
return ['OLO', 'DELIVERY'];
|
|
29
|
-
case 'catering':
|
|
30
|
-
return ['CATERING', 'DELIVERY'];
|
|
31
|
-
case 'merch':
|
|
32
|
-
return ['MERCH', 'DELIVERY'];
|
|
33
|
-
default:
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
exports.makeOrderTypeFromParam = makeOrderTypeFromParam;
|
|
38
|
-
const makeServiceTypeName = (serviceType, isCatering, isOutpost, outpostName) => {
|
|
39
|
-
let serviceTypeName = constants_1.serviceTypeNamesMap[serviceType];
|
|
40
|
-
if (isCatering) {
|
|
41
|
-
serviceTypeName = `Catering ${serviceTypeName}`;
|
|
42
|
-
}
|
|
43
|
-
else if (isOutpost) {
|
|
44
|
-
serviceTypeName = `${outpostName || 'Outpost'} ${serviceTypeName}`;
|
|
45
|
-
}
|
|
46
|
-
return serviceTypeName;
|
|
47
|
-
};
|
|
48
|
-
exports.makeServiceTypeName = makeServiceTypeName;
|
|
49
|
-
const makeOrderTypeName = (orderType, serviceType) => {
|
|
50
|
-
return orderType === 'OLO'
|
|
51
|
-
? constants_1.serviceTypeNamesMap[serviceType]
|
|
52
|
-
: (0, helpers_1.capitalize)(orderType);
|
|
53
|
-
};
|
|
54
|
-
exports.makeOrderTypeName = makeOrderTypeName;
|
|
55
|
-
const makeOrderMsg = (tz, serviceType, requestedAt, firstTime, orderTime, waitTime) => {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
if (!firstTime && !orderTime)
|
|
58
|
-
return null;
|
|
59
|
-
let readableDate;
|
|
60
|
-
if (firstTime) {
|
|
61
|
-
const seconds = firstTime.utc ? (0, datetimes_1.isoToDate)(firstTime.utc).getSeconds() : 0;
|
|
62
|
-
const estimate = requestedAt !== 'asap' && seconds ? 'at about' : 'at';
|
|
63
|
-
readableDate =
|
|
64
|
-
requestedAt === 'asap' && firstTime.has_asap
|
|
65
|
-
? `in about ${waitTime} minutes`
|
|
66
|
-
: (0, datetimes_1.makeReadableDateStrFromIso)(firstTime.utc, tz, true)
|
|
67
|
-
.replace('Today', 'today')
|
|
68
|
-
.replace('Tomorrow', 'TOMORROW')
|
|
69
|
-
.replace('@', estimate);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
const orderTimes = (0, datetimes_1.makeOrderTimes)([orderTime], tz);
|
|
73
|
-
const { start_time, end_time } = orderTimes[0];
|
|
74
|
-
const startTime = (0, datetimes_1.time24ToDate)(start_time);
|
|
75
|
-
const startTimeStr = (_a = (0, datetimes_1.formatDateStr)(startTime.toISOString(), 'h:mma')) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
76
|
-
const endTime = (0, datetimes_1.time24ToDate)(end_time);
|
|
77
|
-
const endTimeStr = (_b = (0, datetimes_1.formatDateStr)(endTime.toISOString(), 'h:mma')) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
78
|
-
const todayWeekday = (0, datetimes_1.makeWeekday)();
|
|
79
|
-
const weekday = orderTimes[0].weekday === todayWeekday
|
|
80
|
-
? ''
|
|
81
|
-
: `${(0, helpers_1.capitalize)(orderTimes[0].weekday)}, ${(0, datetimes_1.fmtDate)(orderTimes[0].date, 'MMMM d')} @ `;
|
|
82
|
-
readableDate =
|
|
83
|
-
startTimeStr === endTimeStr
|
|
84
|
-
? `${weekday}${startTimeStr}`
|
|
85
|
-
: `${weekday}${startTimeStr} to ${endTimeStr}`;
|
|
86
|
-
}
|
|
87
|
-
const serviceTypeName = constants_1.serviceTypeNamesMap[serviceType];
|
|
88
|
-
const orderMsg = `The first available ${serviceTypeName === null || serviceTypeName === void 0 ? void 0 : serviceTypeName.toLowerCase()} time is ${readableDate}`;
|
|
89
|
-
return orderMsg;
|
|
90
|
-
};
|
|
91
|
-
const makeNotAcceptingOrdersMsg = (serviceType) => {
|
|
92
|
-
const serviceTypeName = constants_1.serviceTypeNamesMap[serviceType];
|
|
93
|
-
if (!serviceTypeName) {
|
|
94
|
-
return 'This location is not currently accepting orders.';
|
|
95
|
-
}
|
|
96
|
-
return `This location is not currently accepting ${serviceTypeName.toLowerCase()} orders. Please try switching to a different order type.`;
|
|
97
|
-
};
|
|
98
|
-
exports.makeNotAcceptingOrdersMsg = makeNotAcceptingOrdersMsg;
|
|
99
|
-
const makeRevenueCenterMsg = (revenueCenter, serviceType, requestedAt, statusMessages) => {
|
|
100
|
-
var _a;
|
|
101
|
-
const settings = revenueCenter;
|
|
102
|
-
const { first_times, order_times, wait_times } = settings;
|
|
103
|
-
const tz = datetimes_1.timezoneMap[(_a = revenueCenter === null || revenueCenter === void 0 ? void 0 : revenueCenter.timezone) !== null && _a !== void 0 ? _a : 'US/Central'];
|
|
104
|
-
const st = serviceType === 'WALKIN' ? 'PICKUP' : serviceType;
|
|
105
|
-
const firstTime = first_times ? first_times[st] : null;
|
|
106
|
-
const orderTime = order_times ? order_times[st] : null;
|
|
107
|
-
const waitTime = wait_times ? wait_times[st] : null;
|
|
108
|
-
const tempClosed = revenueCenter.status === 'CLOSED_TEMPORARILY';
|
|
109
|
-
const statusMsg = !tempClosed
|
|
110
|
-
? statusMessages[revenueCenter.status]
|
|
111
|
-
: null;
|
|
112
|
-
const orderMsg = !statusMsg && (firstTime || (orderTime && orderTime.length))
|
|
113
|
-
? makeOrderMsg(tz, serviceType, requestedAt, firstTime, orderTime ? orderTime[0] : null, waitTime !== null && waitTime !== void 0 ? waitTime : 0)
|
|
114
|
-
: null;
|
|
115
|
-
let message = orderMsg ||
|
|
116
|
-
(statusMsg ? statusMsg.subtitle : (0, exports.makeNotAcceptingOrdersMsg)(serviceType));
|
|
117
|
-
let color = orderMsg ? 'success' : 'alert';
|
|
118
|
-
if (tempClosed) {
|
|
119
|
-
color = 'alert';
|
|
120
|
-
message = message.charAt(0).toLowerCase() + message.substring(1);
|
|
121
|
-
message = `This location is temporarily closed for technical or operational reasons. Please try back later today, otherwise ${message} if you want to place an order now.`;
|
|
122
|
-
}
|
|
123
|
-
return { message, color };
|
|
124
|
-
};
|
|
125
|
-
exports.makeRevenueCenterMsg = makeRevenueCenterMsg;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRevenueCenterMsg = exports.makeNotAcceptingOrdersMsg = exports.makeOrderTypeName = exports.makeServiceTypeName = exports.makeOrderTypeFromParam = exports.makeFullAddress = exports.makeOrderAddress = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const datetimes_1 = require("./datetimes");
|
|
6
|
+
const helpers_1 = require("./helpers");
|
|
7
|
+
const makeOrderAddress = (address) => {
|
|
8
|
+
const { street, unit, city, state, postal_code } = address || {};
|
|
9
|
+
return street
|
|
10
|
+
? `${street}${unit ? `, ${unit}` : ''}`
|
|
11
|
+
: postal_code
|
|
12
|
+
? `${postal_code} ${city}, ${state}`
|
|
13
|
+
: 'No address provided';
|
|
14
|
+
};
|
|
15
|
+
exports.makeOrderAddress = makeOrderAddress;
|
|
16
|
+
const makeFullAddress = (address) => {
|
|
17
|
+
const { street, city, state, postal_code } = address || {};
|
|
18
|
+
return `${street ? `${street}, ` : ''}${city}, ${state} ${postal_code}`;
|
|
19
|
+
};
|
|
20
|
+
exports.makeFullAddress = makeFullAddress;
|
|
21
|
+
const makeOrderTypeFromParam = (param) => {
|
|
22
|
+
switch (param) {
|
|
23
|
+
case 'outpost':
|
|
24
|
+
return ['OLO', 'PICKUP', true];
|
|
25
|
+
case 'pickup':
|
|
26
|
+
return ['OLO', 'PICKUP'];
|
|
27
|
+
case 'delivery':
|
|
28
|
+
return ['OLO', 'DELIVERY'];
|
|
29
|
+
case 'catering':
|
|
30
|
+
return ['CATERING', 'DELIVERY'];
|
|
31
|
+
case 'merch':
|
|
32
|
+
return ['MERCH', 'DELIVERY'];
|
|
33
|
+
default:
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.makeOrderTypeFromParam = makeOrderTypeFromParam;
|
|
38
|
+
const makeServiceTypeName = (serviceType, isCatering, isOutpost, outpostName) => {
|
|
39
|
+
let serviceTypeName = constants_1.serviceTypeNamesMap[serviceType];
|
|
40
|
+
if (isCatering) {
|
|
41
|
+
serviceTypeName = `Catering ${serviceTypeName}`;
|
|
42
|
+
}
|
|
43
|
+
else if (isOutpost) {
|
|
44
|
+
serviceTypeName = `${outpostName || 'Outpost'} ${serviceTypeName}`;
|
|
45
|
+
}
|
|
46
|
+
return serviceTypeName;
|
|
47
|
+
};
|
|
48
|
+
exports.makeServiceTypeName = makeServiceTypeName;
|
|
49
|
+
const makeOrderTypeName = (orderType, serviceType) => {
|
|
50
|
+
return orderType === 'OLO'
|
|
51
|
+
? constants_1.serviceTypeNamesMap[serviceType]
|
|
52
|
+
: (0, helpers_1.capitalize)(orderType);
|
|
53
|
+
};
|
|
54
|
+
exports.makeOrderTypeName = makeOrderTypeName;
|
|
55
|
+
const makeOrderMsg = (tz, serviceType, requestedAt, firstTime, orderTime, waitTime) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
if (!firstTime && !orderTime)
|
|
58
|
+
return null;
|
|
59
|
+
let readableDate;
|
|
60
|
+
if (firstTime) {
|
|
61
|
+
const seconds = firstTime.utc ? (0, datetimes_1.isoToDate)(firstTime.utc).getSeconds() : 0;
|
|
62
|
+
const estimate = requestedAt !== 'asap' && seconds ? 'at about' : 'at';
|
|
63
|
+
readableDate =
|
|
64
|
+
requestedAt === 'asap' && firstTime.has_asap
|
|
65
|
+
? `in about ${waitTime} minutes`
|
|
66
|
+
: (0, datetimes_1.makeReadableDateStrFromIso)(firstTime.utc, tz, true)
|
|
67
|
+
.replace('Today', 'today')
|
|
68
|
+
.replace('Tomorrow', 'TOMORROW')
|
|
69
|
+
.replace('@', estimate);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const orderTimes = (0, datetimes_1.makeOrderTimes)([orderTime], tz);
|
|
73
|
+
const { start_time, end_time } = orderTimes[0];
|
|
74
|
+
const startTime = (0, datetimes_1.time24ToDate)(start_time);
|
|
75
|
+
const startTimeStr = (_a = (0, datetimes_1.formatDateStr)(startTime.toISOString(), 'h:mma')) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
76
|
+
const endTime = (0, datetimes_1.time24ToDate)(end_time);
|
|
77
|
+
const endTimeStr = (_b = (0, datetimes_1.formatDateStr)(endTime.toISOString(), 'h:mma')) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
78
|
+
const todayWeekday = (0, datetimes_1.makeWeekday)();
|
|
79
|
+
const weekday = orderTimes[0].weekday === todayWeekday
|
|
80
|
+
? ''
|
|
81
|
+
: `${(0, helpers_1.capitalize)(orderTimes[0].weekday)}, ${(0, datetimes_1.fmtDate)(orderTimes[0].date, 'MMMM d')} @ `;
|
|
82
|
+
readableDate =
|
|
83
|
+
startTimeStr === endTimeStr
|
|
84
|
+
? `${weekday}${startTimeStr}`
|
|
85
|
+
: `${weekday}${startTimeStr} to ${endTimeStr}`;
|
|
86
|
+
}
|
|
87
|
+
const serviceTypeName = constants_1.serviceTypeNamesMap[serviceType];
|
|
88
|
+
const orderMsg = `The first available ${serviceTypeName === null || serviceTypeName === void 0 ? void 0 : serviceTypeName.toLowerCase()} time is ${readableDate}`;
|
|
89
|
+
return orderMsg;
|
|
90
|
+
};
|
|
91
|
+
const makeNotAcceptingOrdersMsg = (serviceType) => {
|
|
92
|
+
const serviceTypeName = constants_1.serviceTypeNamesMap[serviceType];
|
|
93
|
+
if (!serviceTypeName) {
|
|
94
|
+
return 'This location is not currently accepting orders.';
|
|
95
|
+
}
|
|
96
|
+
return `This location is not currently accepting ${serviceTypeName.toLowerCase()} orders. Please try switching to a different order type.`;
|
|
97
|
+
};
|
|
98
|
+
exports.makeNotAcceptingOrdersMsg = makeNotAcceptingOrdersMsg;
|
|
99
|
+
const makeRevenueCenterMsg = (revenueCenter, serviceType, requestedAt, statusMessages) => {
|
|
100
|
+
var _a;
|
|
101
|
+
const settings = revenueCenter;
|
|
102
|
+
const { first_times, order_times, wait_times } = settings;
|
|
103
|
+
const tz = datetimes_1.timezoneMap[(_a = revenueCenter === null || revenueCenter === void 0 ? void 0 : revenueCenter.timezone) !== null && _a !== void 0 ? _a : 'US/Central'];
|
|
104
|
+
const st = serviceType === 'WALKIN' ? 'PICKUP' : serviceType;
|
|
105
|
+
const firstTime = first_times ? first_times[st] : null;
|
|
106
|
+
const orderTime = order_times ? order_times[st] : null;
|
|
107
|
+
const waitTime = wait_times ? wait_times[st] : null;
|
|
108
|
+
const tempClosed = revenueCenter.status === 'CLOSED_TEMPORARILY';
|
|
109
|
+
const statusMsg = !tempClosed
|
|
110
|
+
? statusMessages[revenueCenter.status]
|
|
111
|
+
: null;
|
|
112
|
+
const orderMsg = !statusMsg && (firstTime || (orderTime && orderTime.length))
|
|
113
|
+
? makeOrderMsg(tz, serviceType, requestedAt, firstTime, orderTime ? orderTime[0] : null, waitTime !== null && waitTime !== void 0 ? waitTime : 0)
|
|
114
|
+
: null;
|
|
115
|
+
let message = orderMsg ||
|
|
116
|
+
(statusMsg ? statusMsg.subtitle : (0, exports.makeNotAcceptingOrdersMsg)(serviceType));
|
|
117
|
+
let color = orderMsg ? 'success' : 'alert';
|
|
118
|
+
if (tempClosed) {
|
|
119
|
+
color = 'alert';
|
|
120
|
+
message = message.charAt(0).toLowerCase() + message.substring(1);
|
|
121
|
+
message = `This location is temporarily closed for technical or operational reasons. Please try back later today, otherwise ${message} if you want to place an order now.`;
|
|
122
|
+
}
|
|
123
|
+
return { message, color };
|
|
124
|
+
};
|
|
125
|
+
exports.makeRevenueCenterMsg = makeRevenueCenterMsg;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@open-tender/types';
|
|
2
|
-
export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
|
|
3
|
-
export declare const makeLimitations: (item: Discount) => string;
|
|
4
|
-
export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
|
|
1
|
+
import { Discount, DiscountEnhanced, Discounts, OrderType, ServiceType } from '@open-tender/types';
|
|
2
|
+
export declare const makeValidDeals: (deals: Discounts | null, orderType?: OrderType | null, serviceType?: ServiceType | null, revenueCenterId?: number | null) => Discounts;
|
|
3
|
+
export declare const makeLimitations: (item: Discount) => string;
|
|
4
|
+
export declare const makeDiscountEnhanced: (item: Discount) => DiscountEnhanced;
|