@open-tender/utils 0.4.31 → 0.4.33
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 +160 -151
- package/dist/cjs/hooks/useSignUpGuestForm.d.ts +23 -23
- package/dist/cjs/hooks/useSignUpGuestForm.js +124 -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 +156 -147
- package/dist/esm/hooks/useSignUpGuestForm.d.ts +23 -23
- package/dist/esm/hooks/useSignUpGuestForm.js +120 -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
package/dist/cjs/utils/keypad.js
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reduceCheckout = exports.reduceDollars = exports.reduceNumpad = exports.reduceKeypad = exports.buttonsCheckout = exports.buttonsDollars = exports.buttonsNumpad = exports.buttonsKeypad = exports.centsToDollars = void 0;
|
|
4
|
-
const centsToDollars = (cents) => (cents / 100).toFixed(2);
|
|
5
|
-
exports.centsToDollars = centsToDollars;
|
|
6
|
-
exports.buttonsKeypad = [
|
|
7
|
-
'1234567890'.split(''),
|
|
8
|
-
'qwertyuiop'.split(''),
|
|
9
|
-
'asdfghjkl'.split(''),
|
|
10
|
-
['Clr', ...'zxcvbnm'.split(''), 'Del']
|
|
11
|
-
];
|
|
12
|
-
exports.buttonsNumpad = [
|
|
13
|
-
'123'.split(''),
|
|
14
|
-
'456'.split(''),
|
|
15
|
-
'789'.split(''),
|
|
16
|
-
['Clr', '0', 'Del']
|
|
17
|
-
];
|
|
18
|
-
exports.buttonsDollars = [
|
|
19
|
-
'123'.split(''),
|
|
20
|
-
'456'.split(''),
|
|
21
|
-
'789'.split(''),
|
|
22
|
-
['Clr', '0', '00']
|
|
23
|
-
];
|
|
24
|
-
exports.buttonsCheckout = [
|
|
25
|
-
['1', '2', '3', '$5'],
|
|
26
|
-
['4', '5', '6', '$10'],
|
|
27
|
-
['7', '8', '9', '$20'],
|
|
28
|
-
['Clr', '0', '00', 'Next $']
|
|
29
|
-
];
|
|
30
|
-
const reduceKeypad = (value, key) => {
|
|
31
|
-
switch (key) {
|
|
32
|
-
case 'Clear':
|
|
33
|
-
case 'Clr':
|
|
34
|
-
return '';
|
|
35
|
-
case 'Delete':
|
|
36
|
-
case 'Del':
|
|
37
|
-
return value.slice(0, -1);
|
|
38
|
-
case 'Space':
|
|
39
|
-
return value + ' ';
|
|
40
|
-
default:
|
|
41
|
-
return value + key;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
exports.reduceKeypad = reduceKeypad;
|
|
45
|
-
const reduceNumpad = (value, key, clear) => {
|
|
46
|
-
const current = clear ? '' : value;
|
|
47
|
-
switch (key) {
|
|
48
|
-
case 'Clear':
|
|
49
|
-
case 'Clr':
|
|
50
|
-
return '';
|
|
51
|
-
case 'Delete':
|
|
52
|
-
case 'Del':
|
|
53
|
-
return value.slice(0, -1);
|
|
54
|
-
default:
|
|
55
|
-
return current + key;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
exports.reduceNumpad = reduceNumpad;
|
|
59
|
-
const reduceDollars = (value, key, clear) => {
|
|
60
|
-
const current = clear ? '' : value;
|
|
61
|
-
switch (key) {
|
|
62
|
-
case 'Clear':
|
|
63
|
-
case 'Clr':
|
|
64
|
-
return '0.00';
|
|
65
|
-
default: {
|
|
66
|
-
const val = parseInt(current.replace('.', '') + key);
|
|
67
|
-
return (0, exports.centsToDollars)(val);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
exports.reduceDollars = reduceDollars;
|
|
72
|
-
const reduceCheckout = (value, key, clear) => {
|
|
73
|
-
const current = !key.toString().includes('$') && clear ? '' : value;
|
|
74
|
-
switch (key) {
|
|
75
|
-
case 'Clear':
|
|
76
|
-
case 'Clr':
|
|
77
|
-
return '0.00';
|
|
78
|
-
case 'Next $': {
|
|
79
|
-
const [dollars] = current.split('.');
|
|
80
|
-
const val = (parseInt(dollars) + 1) * 100;
|
|
81
|
-
return (0, exports.centsToDollars)(val);
|
|
82
|
-
}
|
|
83
|
-
case '$5':
|
|
84
|
-
case '$10':
|
|
85
|
-
case '$20': {
|
|
86
|
-
const keyValue = parseInt(key.replace('$', '')) * 100;
|
|
87
|
-
const [dollars, cents] = current.split('.').map(n => parseInt(n));
|
|
88
|
-
let val;
|
|
89
|
-
if (cents > 0 || dollars % 10 > 0) {
|
|
90
|
-
val =
|
|
91
|
-
Math.floor(parseInt(current.replace('.', '')) / keyValue) * keyValue +
|
|
92
|
-
keyValue;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
val = dollars * 100 + keyValue;
|
|
96
|
-
}
|
|
97
|
-
return (0, exports.centsToDollars)(val);
|
|
98
|
-
}
|
|
99
|
-
default: {
|
|
100
|
-
const val = parseInt(current.replace('.', '') + key);
|
|
101
|
-
return (0, exports.centsToDollars)(val);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
exports.reduceCheckout = reduceCheckout;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduceCheckout = exports.reduceDollars = exports.reduceNumpad = exports.reduceKeypad = exports.buttonsCheckout = exports.buttonsDollars = exports.buttonsNumpad = exports.buttonsKeypad = exports.centsToDollars = void 0;
|
|
4
|
+
const centsToDollars = (cents) => (cents / 100).toFixed(2);
|
|
5
|
+
exports.centsToDollars = centsToDollars;
|
|
6
|
+
exports.buttonsKeypad = [
|
|
7
|
+
'1234567890'.split(''),
|
|
8
|
+
'qwertyuiop'.split(''),
|
|
9
|
+
'asdfghjkl'.split(''),
|
|
10
|
+
['Clr', ...'zxcvbnm'.split(''), 'Del']
|
|
11
|
+
];
|
|
12
|
+
exports.buttonsNumpad = [
|
|
13
|
+
'123'.split(''),
|
|
14
|
+
'456'.split(''),
|
|
15
|
+
'789'.split(''),
|
|
16
|
+
['Clr', '0', 'Del']
|
|
17
|
+
];
|
|
18
|
+
exports.buttonsDollars = [
|
|
19
|
+
'123'.split(''),
|
|
20
|
+
'456'.split(''),
|
|
21
|
+
'789'.split(''),
|
|
22
|
+
['Clr', '0', '00']
|
|
23
|
+
];
|
|
24
|
+
exports.buttonsCheckout = [
|
|
25
|
+
['1', '2', '3', '$5'],
|
|
26
|
+
['4', '5', '6', '$10'],
|
|
27
|
+
['7', '8', '9', '$20'],
|
|
28
|
+
['Clr', '0', '00', 'Next $']
|
|
29
|
+
];
|
|
30
|
+
const reduceKeypad = (value, key) => {
|
|
31
|
+
switch (key) {
|
|
32
|
+
case 'Clear':
|
|
33
|
+
case 'Clr':
|
|
34
|
+
return '';
|
|
35
|
+
case 'Delete':
|
|
36
|
+
case 'Del':
|
|
37
|
+
return value.slice(0, -1);
|
|
38
|
+
case 'Space':
|
|
39
|
+
return value + ' ';
|
|
40
|
+
default:
|
|
41
|
+
return value + key;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.reduceKeypad = reduceKeypad;
|
|
45
|
+
const reduceNumpad = (value, key, clear) => {
|
|
46
|
+
const current = clear ? '' : value;
|
|
47
|
+
switch (key) {
|
|
48
|
+
case 'Clear':
|
|
49
|
+
case 'Clr':
|
|
50
|
+
return '';
|
|
51
|
+
case 'Delete':
|
|
52
|
+
case 'Del':
|
|
53
|
+
return value.slice(0, -1);
|
|
54
|
+
default:
|
|
55
|
+
return current + key;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.reduceNumpad = reduceNumpad;
|
|
59
|
+
const reduceDollars = (value, key, clear) => {
|
|
60
|
+
const current = clear ? '' : value;
|
|
61
|
+
switch (key) {
|
|
62
|
+
case 'Clear':
|
|
63
|
+
case 'Clr':
|
|
64
|
+
return '0.00';
|
|
65
|
+
default: {
|
|
66
|
+
const val = parseInt(current.replace('.', '') + key);
|
|
67
|
+
return (0, exports.centsToDollars)(val);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.reduceDollars = reduceDollars;
|
|
72
|
+
const reduceCheckout = (value, key, clear) => {
|
|
73
|
+
const current = !key.toString().includes('$') && clear ? '' : value;
|
|
74
|
+
switch (key) {
|
|
75
|
+
case 'Clear':
|
|
76
|
+
case 'Clr':
|
|
77
|
+
return '0.00';
|
|
78
|
+
case 'Next $': {
|
|
79
|
+
const [dollars] = current.split('.');
|
|
80
|
+
const val = (parseInt(dollars) + 1) * 100;
|
|
81
|
+
return (0, exports.centsToDollars)(val);
|
|
82
|
+
}
|
|
83
|
+
case '$5':
|
|
84
|
+
case '$10':
|
|
85
|
+
case '$20': {
|
|
86
|
+
const keyValue = parseInt(key.replace('$', '')) * 100;
|
|
87
|
+
const [dollars, cents] = current.split('.').map(n => parseInt(n));
|
|
88
|
+
let val;
|
|
89
|
+
if (cents > 0 || dollars % 10 > 0) {
|
|
90
|
+
val =
|
|
91
|
+
Math.floor(parseInt(current.replace('.', '')) / keyValue) * keyValue +
|
|
92
|
+
keyValue;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
val = dollars * 100 + keyValue;
|
|
96
|
+
}
|
|
97
|
+
return (0, exports.centsToDollars)(val);
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
100
|
+
const val = parseInt(current.replace('.', '') + key);
|
|
101
|
+
return (0, exports.centsToDollars)(val);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
exports.reduceCheckout = reduceCheckout;
|
package/dist/cjs/utils/maps.d.ts
CHANGED
|
@@ -1,226 +1,226 @@
|
|
|
1
|
-
import { Address, GoogleMapsStyles, LatLng, RevenueCenter, RevenueCenters, ServiceType } from '@open-tender/types';
|
|
2
|
-
export declare const getDistance: (pointA: LatLng, pointB: LatLng, inMiles?: boolean) => number;
|
|
3
|
-
export declare const inZone: (latLng: LatLng, polygon: number[][]) => boolean;
|
|
4
|
-
export declare const addDistance: (revenueCenters: RevenueCenters, latLng: LatLng) => RevenueCenters;
|
|
5
|
-
export declare const sortRevenueCenters: (revenueCenters: RevenueCenters, isDelivery?: boolean) => RevenueCenter[];
|
|
6
|
-
export declare const calcMinDistance: (revenueCenters: RevenueCenters, maxDistance?: number) => number;
|
|
7
|
-
export declare const checkServiceType: (revenueCenter: RevenueCenter, serviceType: ServiceType) => boolean;
|
|
8
|
-
export declare const makePickupRevenueCenters: (revenueCenters: Array<RevenueCenter>, maxDistance?: number) => RevenueCenter[];
|
|
9
|
-
export declare const makeWalkinRevenueCenters: (revenueCenters: Array<RevenueCenter>, maxDistance?: number) => RevenueCenter[];
|
|
10
|
-
export declare const makeDeliveryRevenueCenters: (revenueCenters: Array<RevenueCenter>) => RevenueCenter[];
|
|
11
|
-
export declare const makePickupMesssaging: (address: Address | null, latLng: LatLng | null, count: number, minDistance: number, maxDistance?: number, messages?: {
|
|
12
|
-
PICKUP: {
|
|
13
|
-
default: {
|
|
14
|
-
title: string;
|
|
15
|
-
msg: string;
|
|
16
|
-
};
|
|
17
|
-
address: {
|
|
18
|
-
title: string;
|
|
19
|
-
msg: string;
|
|
20
|
-
};
|
|
21
|
-
addressFar: {
|
|
22
|
-
title: string;
|
|
23
|
-
msg: string;
|
|
24
|
-
};
|
|
25
|
-
geo: {
|
|
26
|
-
title: string;
|
|
27
|
-
msg: string;
|
|
28
|
-
};
|
|
29
|
-
geoFar: {
|
|
30
|
-
title: string;
|
|
31
|
-
msg: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
DELIVERY: {
|
|
35
|
-
default: {
|
|
36
|
-
title: string;
|
|
37
|
-
msg: string;
|
|
38
|
-
error: null;
|
|
39
|
-
};
|
|
40
|
-
noStreet: {
|
|
41
|
-
title: string;
|
|
42
|
-
msg: string;
|
|
43
|
-
error: string;
|
|
44
|
-
};
|
|
45
|
-
hasDelivery: {
|
|
46
|
-
title: string;
|
|
47
|
-
msg: string;
|
|
48
|
-
error: null;
|
|
49
|
-
};
|
|
50
|
-
noDelivery: {
|
|
51
|
-
title: string;
|
|
52
|
-
msg: string;
|
|
53
|
-
error: null;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
}) => {
|
|
57
|
-
title: string;
|
|
58
|
-
msg: string;
|
|
59
|
-
};
|
|
60
|
-
export declare const makeWalkinMessaging: (address: Address | null, latLng: LatLng | null, count: number, minDistance: number, maxDistance?: number, messages?: {
|
|
61
|
-
PICKUP: {
|
|
62
|
-
default: {
|
|
63
|
-
title: string;
|
|
64
|
-
msg: string;
|
|
65
|
-
};
|
|
66
|
-
address: {
|
|
67
|
-
title: string;
|
|
68
|
-
msg: string;
|
|
69
|
-
};
|
|
70
|
-
addressFar: {
|
|
71
|
-
title: string;
|
|
72
|
-
msg: string;
|
|
73
|
-
};
|
|
74
|
-
geo: {
|
|
75
|
-
title: string;
|
|
76
|
-
msg: string;
|
|
77
|
-
};
|
|
78
|
-
geoFar: {
|
|
79
|
-
title: string;
|
|
80
|
-
msg: string;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
DELIVERY: {
|
|
84
|
-
default: {
|
|
85
|
-
title: string;
|
|
86
|
-
msg: string;
|
|
87
|
-
error: null;
|
|
88
|
-
};
|
|
89
|
-
noStreet: {
|
|
90
|
-
title: string;
|
|
91
|
-
msg: string;
|
|
92
|
-
error: string;
|
|
93
|
-
};
|
|
94
|
-
hasDelivery: {
|
|
95
|
-
title: string;
|
|
96
|
-
msg: string;
|
|
97
|
-
error: null;
|
|
98
|
-
};
|
|
99
|
-
noDelivery: {
|
|
100
|
-
title: string;
|
|
101
|
-
msg: string;
|
|
102
|
-
error: null;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
}) => {
|
|
106
|
-
title: string;
|
|
107
|
-
msg: string;
|
|
108
|
-
};
|
|
109
|
-
export declare const makeDeliveryMesssaging: (address: Address | null, count: number, messages?: {
|
|
110
|
-
PICKUP: {
|
|
111
|
-
default: {
|
|
112
|
-
title: string;
|
|
113
|
-
msg: string;
|
|
114
|
-
};
|
|
115
|
-
address: {
|
|
116
|
-
title: string;
|
|
117
|
-
msg: string;
|
|
118
|
-
};
|
|
119
|
-
addressFar: {
|
|
120
|
-
title: string;
|
|
121
|
-
msg: string;
|
|
122
|
-
};
|
|
123
|
-
geo: {
|
|
124
|
-
title: string;
|
|
125
|
-
msg: string;
|
|
126
|
-
};
|
|
127
|
-
geoFar: {
|
|
128
|
-
title: string;
|
|
129
|
-
msg: string;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
DELIVERY: {
|
|
133
|
-
default: {
|
|
134
|
-
title: string;
|
|
135
|
-
msg: string;
|
|
136
|
-
error: null;
|
|
137
|
-
};
|
|
138
|
-
noStreet: {
|
|
139
|
-
title: string;
|
|
140
|
-
msg: string;
|
|
141
|
-
error: string;
|
|
142
|
-
};
|
|
143
|
-
hasDelivery: {
|
|
144
|
-
title: string;
|
|
145
|
-
msg: string;
|
|
146
|
-
error: null;
|
|
147
|
-
};
|
|
148
|
-
noDelivery: {
|
|
149
|
-
title: string;
|
|
150
|
-
msg: string;
|
|
151
|
-
error: null;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
}) => {
|
|
155
|
-
title: string;
|
|
156
|
-
msg: string;
|
|
157
|
-
error: null;
|
|
158
|
-
} | {
|
|
159
|
-
title: string;
|
|
160
|
-
msg: string;
|
|
161
|
-
error: string;
|
|
162
|
-
};
|
|
163
|
-
export declare const makeDisplayedRevenueCenters: (revenueCenters: RevenueCenter[], serviceType: ServiceType | null, address: Address | null, latLng: LatLng | null, maxDistance: number, isGroupOrder: boolean) => {
|
|
164
|
-
title: string;
|
|
165
|
-
msg: string;
|
|
166
|
-
error: string | null;
|
|
167
|
-
displayed: RevenueCenter[];
|
|
168
|
-
};
|
|
169
|
-
export declare const LOCATIONS_MESSAGES: {
|
|
170
|
-
PICKUP: {
|
|
171
|
-
default: {
|
|
172
|
-
title: string;
|
|
173
|
-
msg: string;
|
|
174
|
-
};
|
|
175
|
-
address: {
|
|
176
|
-
title: string;
|
|
177
|
-
msg: string;
|
|
178
|
-
};
|
|
179
|
-
addressFar: {
|
|
180
|
-
title: string;
|
|
181
|
-
msg: string;
|
|
182
|
-
};
|
|
183
|
-
geo: {
|
|
184
|
-
title: string;
|
|
185
|
-
msg: string;
|
|
186
|
-
};
|
|
187
|
-
geoFar: {
|
|
188
|
-
title: string;
|
|
189
|
-
msg: string;
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
DELIVERY: {
|
|
193
|
-
default: {
|
|
194
|
-
title: string;
|
|
195
|
-
msg: string;
|
|
196
|
-
error: null;
|
|
197
|
-
};
|
|
198
|
-
noStreet: {
|
|
199
|
-
title: string;
|
|
200
|
-
msg: string;
|
|
201
|
-
error: string;
|
|
202
|
-
};
|
|
203
|
-
hasDelivery: {
|
|
204
|
-
title: string;
|
|
205
|
-
msg: string;
|
|
206
|
-
error: null;
|
|
207
|
-
};
|
|
208
|
-
noDelivery: {
|
|
209
|
-
title: string;
|
|
210
|
-
msg: string;
|
|
211
|
-
error: null;
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
export declare const renameLocation: (str: string, names: string[]) => string;
|
|
216
|
-
export declare const makeMapStyles: ({ labelColor, roadColor, featureColor, waterColor, backgroundColor }: GoogleMapsStyles) => {
|
|
217
|
-
featureType: string;
|
|
218
|
-
elementType: string;
|
|
219
|
-
stylers: ({
|
|
220
|
-
visibility: string;
|
|
221
|
-
color?: undefined;
|
|
222
|
-
} | {
|
|
223
|
-
color: string;
|
|
224
|
-
visibility?: undefined;
|
|
225
|
-
})[];
|
|
226
|
-
}[];
|
|
1
|
+
import { Address, GoogleMapsStyles, LatLng, RevenueCenter, RevenueCenters, ServiceType } from '@open-tender/types';
|
|
2
|
+
export declare const getDistance: (pointA: LatLng, pointB: LatLng, inMiles?: boolean) => number;
|
|
3
|
+
export declare const inZone: (latLng: LatLng, polygon: number[][]) => boolean;
|
|
4
|
+
export declare const addDistance: (revenueCenters: RevenueCenters, latLng: LatLng) => RevenueCenters;
|
|
5
|
+
export declare const sortRevenueCenters: (revenueCenters: RevenueCenters, isDelivery?: boolean) => RevenueCenter[];
|
|
6
|
+
export declare const calcMinDistance: (revenueCenters: RevenueCenters, maxDistance?: number) => number;
|
|
7
|
+
export declare const checkServiceType: (revenueCenter: RevenueCenter, serviceType: ServiceType) => boolean;
|
|
8
|
+
export declare const makePickupRevenueCenters: (revenueCenters: Array<RevenueCenter>, maxDistance?: number) => RevenueCenter[];
|
|
9
|
+
export declare const makeWalkinRevenueCenters: (revenueCenters: Array<RevenueCenter>, maxDistance?: number) => RevenueCenter[];
|
|
10
|
+
export declare const makeDeliveryRevenueCenters: (revenueCenters: Array<RevenueCenter>) => RevenueCenter[];
|
|
11
|
+
export declare const makePickupMesssaging: (address: Address | null, latLng: LatLng | null, count: number, minDistance: number, maxDistance?: number, messages?: {
|
|
12
|
+
PICKUP: {
|
|
13
|
+
default: {
|
|
14
|
+
title: string;
|
|
15
|
+
msg: string;
|
|
16
|
+
};
|
|
17
|
+
address: {
|
|
18
|
+
title: string;
|
|
19
|
+
msg: string;
|
|
20
|
+
};
|
|
21
|
+
addressFar: {
|
|
22
|
+
title: string;
|
|
23
|
+
msg: string;
|
|
24
|
+
};
|
|
25
|
+
geo: {
|
|
26
|
+
title: string;
|
|
27
|
+
msg: string;
|
|
28
|
+
};
|
|
29
|
+
geoFar: {
|
|
30
|
+
title: string;
|
|
31
|
+
msg: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
DELIVERY: {
|
|
35
|
+
default: {
|
|
36
|
+
title: string;
|
|
37
|
+
msg: string;
|
|
38
|
+
error: null;
|
|
39
|
+
};
|
|
40
|
+
noStreet: {
|
|
41
|
+
title: string;
|
|
42
|
+
msg: string;
|
|
43
|
+
error: string;
|
|
44
|
+
};
|
|
45
|
+
hasDelivery: {
|
|
46
|
+
title: string;
|
|
47
|
+
msg: string;
|
|
48
|
+
error: null;
|
|
49
|
+
};
|
|
50
|
+
noDelivery: {
|
|
51
|
+
title: string;
|
|
52
|
+
msg: string;
|
|
53
|
+
error: null;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}) => {
|
|
57
|
+
title: string;
|
|
58
|
+
msg: string;
|
|
59
|
+
};
|
|
60
|
+
export declare const makeWalkinMessaging: (address: Address | null, latLng: LatLng | null, count: number, minDistance: number, maxDistance?: number, messages?: {
|
|
61
|
+
PICKUP: {
|
|
62
|
+
default: {
|
|
63
|
+
title: string;
|
|
64
|
+
msg: string;
|
|
65
|
+
};
|
|
66
|
+
address: {
|
|
67
|
+
title: string;
|
|
68
|
+
msg: string;
|
|
69
|
+
};
|
|
70
|
+
addressFar: {
|
|
71
|
+
title: string;
|
|
72
|
+
msg: string;
|
|
73
|
+
};
|
|
74
|
+
geo: {
|
|
75
|
+
title: string;
|
|
76
|
+
msg: string;
|
|
77
|
+
};
|
|
78
|
+
geoFar: {
|
|
79
|
+
title: string;
|
|
80
|
+
msg: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
DELIVERY: {
|
|
84
|
+
default: {
|
|
85
|
+
title: string;
|
|
86
|
+
msg: string;
|
|
87
|
+
error: null;
|
|
88
|
+
};
|
|
89
|
+
noStreet: {
|
|
90
|
+
title: string;
|
|
91
|
+
msg: string;
|
|
92
|
+
error: string;
|
|
93
|
+
};
|
|
94
|
+
hasDelivery: {
|
|
95
|
+
title: string;
|
|
96
|
+
msg: string;
|
|
97
|
+
error: null;
|
|
98
|
+
};
|
|
99
|
+
noDelivery: {
|
|
100
|
+
title: string;
|
|
101
|
+
msg: string;
|
|
102
|
+
error: null;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}) => {
|
|
106
|
+
title: string;
|
|
107
|
+
msg: string;
|
|
108
|
+
};
|
|
109
|
+
export declare const makeDeliveryMesssaging: (address: Address | null, count: number, messages?: {
|
|
110
|
+
PICKUP: {
|
|
111
|
+
default: {
|
|
112
|
+
title: string;
|
|
113
|
+
msg: string;
|
|
114
|
+
};
|
|
115
|
+
address: {
|
|
116
|
+
title: string;
|
|
117
|
+
msg: string;
|
|
118
|
+
};
|
|
119
|
+
addressFar: {
|
|
120
|
+
title: string;
|
|
121
|
+
msg: string;
|
|
122
|
+
};
|
|
123
|
+
geo: {
|
|
124
|
+
title: string;
|
|
125
|
+
msg: string;
|
|
126
|
+
};
|
|
127
|
+
geoFar: {
|
|
128
|
+
title: string;
|
|
129
|
+
msg: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
DELIVERY: {
|
|
133
|
+
default: {
|
|
134
|
+
title: string;
|
|
135
|
+
msg: string;
|
|
136
|
+
error: null;
|
|
137
|
+
};
|
|
138
|
+
noStreet: {
|
|
139
|
+
title: string;
|
|
140
|
+
msg: string;
|
|
141
|
+
error: string;
|
|
142
|
+
};
|
|
143
|
+
hasDelivery: {
|
|
144
|
+
title: string;
|
|
145
|
+
msg: string;
|
|
146
|
+
error: null;
|
|
147
|
+
};
|
|
148
|
+
noDelivery: {
|
|
149
|
+
title: string;
|
|
150
|
+
msg: string;
|
|
151
|
+
error: null;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}) => {
|
|
155
|
+
title: string;
|
|
156
|
+
msg: string;
|
|
157
|
+
error: null;
|
|
158
|
+
} | {
|
|
159
|
+
title: string;
|
|
160
|
+
msg: string;
|
|
161
|
+
error: string;
|
|
162
|
+
};
|
|
163
|
+
export declare const makeDisplayedRevenueCenters: (revenueCenters: RevenueCenter[], serviceType: ServiceType | null, address: Address | null, latLng: LatLng | null, maxDistance: number, isGroupOrder: boolean) => {
|
|
164
|
+
title: string;
|
|
165
|
+
msg: string;
|
|
166
|
+
error: string | null;
|
|
167
|
+
displayed: RevenueCenter[];
|
|
168
|
+
};
|
|
169
|
+
export declare const LOCATIONS_MESSAGES: {
|
|
170
|
+
PICKUP: {
|
|
171
|
+
default: {
|
|
172
|
+
title: string;
|
|
173
|
+
msg: string;
|
|
174
|
+
};
|
|
175
|
+
address: {
|
|
176
|
+
title: string;
|
|
177
|
+
msg: string;
|
|
178
|
+
};
|
|
179
|
+
addressFar: {
|
|
180
|
+
title: string;
|
|
181
|
+
msg: string;
|
|
182
|
+
};
|
|
183
|
+
geo: {
|
|
184
|
+
title: string;
|
|
185
|
+
msg: string;
|
|
186
|
+
};
|
|
187
|
+
geoFar: {
|
|
188
|
+
title: string;
|
|
189
|
+
msg: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
DELIVERY: {
|
|
193
|
+
default: {
|
|
194
|
+
title: string;
|
|
195
|
+
msg: string;
|
|
196
|
+
error: null;
|
|
197
|
+
};
|
|
198
|
+
noStreet: {
|
|
199
|
+
title: string;
|
|
200
|
+
msg: string;
|
|
201
|
+
error: string;
|
|
202
|
+
};
|
|
203
|
+
hasDelivery: {
|
|
204
|
+
title: string;
|
|
205
|
+
msg: string;
|
|
206
|
+
error: null;
|
|
207
|
+
};
|
|
208
|
+
noDelivery: {
|
|
209
|
+
title: string;
|
|
210
|
+
msg: string;
|
|
211
|
+
error: null;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
export declare const renameLocation: (str: string, names: string[]) => string;
|
|
216
|
+
export declare const makeMapStyles: ({ labelColor, roadColor, featureColor, waterColor, backgroundColor }: GoogleMapsStyles) => {
|
|
217
|
+
featureType: string;
|
|
218
|
+
elementType: string;
|
|
219
|
+
stylers: ({
|
|
220
|
+
visibility: string;
|
|
221
|
+
color?: undefined;
|
|
222
|
+
} | {
|
|
223
|
+
color: string;
|
|
224
|
+
visibility?: undefined;
|
|
225
|
+
})[];
|
|
226
|
+
}[];
|