ordering-ui-external 2.6.7 → 2.7.0
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/_bundles/0.ordering-ui.0a58ae9fc1a4bce64c6e.js +1 -0
- package/_bundles/{1.ordering-ui.fd1dc326de89a8eb39f9.js → 1.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
- package/_bundles/4.ordering-ui.0a58ae9fc1a4bce64c6e.js +1 -0
- package/_bundles/{5.ordering-ui.fd1dc326de89a8eb39f9.js → 5.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
- package/_bundles/{6.ordering-ui.fd1dc326de89a8eb39f9.js → 6.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
- package/_bundles/{7.ordering-ui.fd1dc326de89a8eb39f9.js → 7.ordering-ui.0a58ae9fc1a4bce64c6e.js} +2 -2
- package/_bundles/ordering-ui.0a58ae9fc1a4bce64c6e.js +2 -0
- package/_modules/components/LanguageSelector/index.js +1 -0
- package/_modules/components/OrderTypeSelectorHeader/index.js +3 -1
- package/_modules/components/SmartAppBanner/index.js +5 -2
- package/_modules/contexts/ThemeContext/index.js +1 -1
- package/_modules/styles/Select/index.js +14 -2
- package/_modules/styles/Selects/index.js +11 -8
- package/_modules/themes/five/index.js +21 -0
- package/_modules/themes/five/src/components/BusinessBasicInformation/BusinessInfoComponent.js +168 -0
- package/_modules/themes/five/src/components/BusinessBasicInformation/SearchComponent.js +39 -0
- package/_modules/themes/five/src/components/BusinessBasicInformation/SocialNetWork.js +19 -0
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +35 -156
- package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +45 -35
- package/_modules/themes/five/src/components/BusinessController/index.js +6 -2
- package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +5 -4
- package/_modules/themes/five/src/components/CardForm/index.js +16 -3
- package/_modules/themes/five/src/components/CardForm/styles.js +13 -9
- package/_modules/themes/five/src/components/CardFormCustom/cardUtils.js +102 -0
- package/_modules/themes/five/src/components/CardFormCustom/index.js +148 -0
- package/_modules/themes/five/src/components/CardFormCustom/styles.js +16 -0
- package/_modules/themes/five/src/components/Cart/index.js +1 -1
- package/_modules/themes/five/src/components/CartPopover/styles.js +1 -1
- package/_modules/themes/five/src/components/Checkout/index.js +41 -27
- package/_modules/themes/five/src/components/Header/index.js +10 -4
- package/_modules/themes/five/src/components/LanguageSelector/index.js +4 -1
- package/_modules/themes/five/src/components/LoginForm/index.js +11 -8
- package/_modules/themes/five/src/components/Modal/styles.js +1 -1
- package/_modules/themes/five/src/components/OrderContextUI/index.js +13 -1
- package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
- package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +18 -8
- package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +7 -3
- package/_modules/themes/five/src/components/OrderDetails/index.js +4 -2
- package/_modules/themes/five/src/components/PaymentOptionCard/index.js +84 -0
- package/_modules/themes/five/src/components/PaymentOptionStripe/index.js +48 -22
- package/_modules/themes/five/src/components/PaymentOptionStripe/styles.js +3 -1
- package/_modules/themes/five/src/components/PaymentOptions/index.js +46 -24
- package/_modules/themes/five/src/components/ProductForm/styles.js +1 -1
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +2 -2
- package/_modules/themes/five/src/components/SearchProducts/styles.js +1 -1
- package/_modules/themes/five/src/components/UserDetails/index.js +1 -1
- package/_modules/themes/five/src/components/UserPopover/styles.js +1 -1
- package/_modules/themes/five/src/styles/Select/index.js +4 -2
- package/_modules/themes/five/src/styles/Selects/index.js +7 -4
- package/_modules/themes/pwa/src/components/MomentPopover/styles.js +1 -1
- package/index.html +1 -1
- package/package.json +4 -2
- package/src/components/LanguageSelector/index.js +1 -0
- package/src/components/OrderTypeSelectorHeader/index.js +3 -1
- package/src/components/SmartAppBanner/index.js +4 -2
- package/src/contexts/ThemeContext/index.js +1 -1
- package/src/styles/Select/index.js +11 -2
- package/src/styles/Selects/index.js +1 -1
- package/src/themes/five/index.js +6 -0
- package/src/themes/five/src/components/BusinessBasicInformation/BusinessInfoComponent.js +230 -0
- package/src/themes/five/src/components/BusinessBasicInformation/SearchComponent.js +40 -0
- package/src/themes/five/src/components/BusinessBasicInformation/SocialNetWork.js +10 -0
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +39 -247
- package/src/themes/five/src/components/BusinessBasicInformation/styles.js +14 -4
- package/src/themes/five/src/components/BusinessController/index.js +2 -2
- package/src/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
- package/src/themes/five/src/components/BusinessProductsListing/index.js +5 -4
- package/src/themes/five/src/components/CardForm/index.js +25 -4
- package/src/themes/five/src/components/CardForm/styles.js +35 -0
- package/src/themes/five/src/components/CardFormCustom/cardUtils.js +111 -0
- package/src/themes/five/src/components/CardFormCustom/index.js +161 -0
- package/src/themes/five/src/components/CardFormCustom/styles.js +20 -0
- package/src/themes/five/src/components/Cart/index.js +1 -1
- package/src/themes/five/src/components/CartPopover/styles.js +1 -1
- package/src/themes/five/src/components/Checkout/index.js +42 -30
- package/src/themes/five/src/components/Header/index.js +9 -4
- package/src/themes/five/src/components/LanguageSelector/index.js +2 -1
- package/src/themes/five/src/components/LoginForm/index.js +6 -4
- package/src/themes/five/src/components/Modal/styles.js +1 -0
- package/src/themes/five/src/components/OrderContextUI/index.js +10 -3
- package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
- package/src/themes/five/src/components/OrderDetails/OrderEta.js +21 -9
- package/src/themes/five/src/components/OrderDetails/OrderHistory.js +4 -3
- package/src/themes/five/src/components/OrderDetails/index.js +1 -1
- package/src/themes/five/src/components/PaymentOptionCard/index.js +70 -0
- package/src/themes/five/src/components/PaymentOptionStripe/index.js +46 -20
- package/src/themes/five/src/components/PaymentOptionStripe/styles.js +6 -1
- package/src/themes/five/src/components/PaymentOptions/index.js +28 -3
- package/src/themes/five/src/components/ProductForm/index.js +0 -1
- package/src/themes/five/src/components/ProductForm/styles.js +1 -1
- package/src/themes/five/src/components/RenderProductsLayout/index.js +2 -2
- package/src/themes/five/src/components/SearchProducts/styles.js +1 -1
- package/src/themes/five/src/components/UserDetails/index.js +1 -1
- package/src/themes/five/src/components/UserPopover/styles.js +1 -1
- package/src/themes/five/src/styles/Select/index.js +3 -2
- package/src/themes/five/src/styles/Selects/index.js +1 -1
- package/src/themes/pwa/src/components/MomentPopover/styles.js +4 -1
- package/template/app.js +13 -7
- package/template/pages/BusinessProductsList/index.js +4 -3
- package/template/pages/BusinessesList/index.js +2 -1
- package/template/pages/Checkout/index.js +1 -0
- package/template/pages/MyOrders/index.js +1 -0
- package/template/theme.json +3 -1
- package/_bundles/0.ordering-ui.fd1dc326de89a8eb39f9.js +0 -1
- package/_bundles/4.ordering-ui.fd1dc326de89a8eb39f9.js +0 -1
- package/_bundles/ordering-ui.fd1dc326de89a8eb39f9.js +0 -2
- /package/_bundles/{2.ordering-ui.fd1dc326de89a8eb39f9.js → 2.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
- /package/_bundles/{7.ordering-ui.fd1dc326de89a8eb39f9.js.LICENSE.txt → 7.ordering-ui.0a58ae9fc1a4bce64c6e.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.fd1dc326de89a8eb39f9.js → 8.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
- /package/_bundles/{9.ordering-ui.fd1dc326de89a8eb39f9.js → 9.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
- /package/_bundles/{ordering-ui.fd1dc326de89a8eb39f9.js.LICENSE.txt → ordering-ui.0a58ae9fc1a4bce64c6e.js.LICENSE.txt} +0 -0
|
@@ -4,9 +4,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.FormStripe = exports.FormRow = exports.FormActions = exports.ErrorMessage = exports.CardNumberField = exports.CardExpiryField = exports.CardExpiryCvcField = exports.CardCvcField = void 0;
|
|
7
|
+
exports.ZipcodeField = exports.FormStripe = exports.FormRow = exports.FormActions = exports.ErrorMessage = exports.CardZipcodeField = exports.CardNumberField = exports.CardExpiryField = exports.CardExpiryCvcField = exports.CardCvcField = void 0;
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
9
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
12
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
@@ -16,16 +16,20 @@ var CardExpiryField = _styledComponents.default.div(_templateObject2 || (_templa
|
|
|
16
16
|
exports.CardExpiryField = CardExpiryField;
|
|
17
17
|
var CardCvcField = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: #ADB2B9;\n"])));
|
|
18
18
|
exports.CardCvcField = CardCvcField;
|
|
19
|
-
var
|
|
19
|
+
var CardZipcodeField = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: #ADB2B9;\n"])));
|
|
20
|
+
exports.CardZipcodeField = CardZipcodeField;
|
|
21
|
+
var CardNumberField = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: 100%;\n color: #ADB2B9;\n"])));
|
|
20
22
|
exports.CardNumberField = CardNumberField;
|
|
21
|
-
var CardExpiryCvcField = _styledComponents.default.div(
|
|
23
|
+
var CardExpiryCvcField = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n grid-gap: 10px;\n"])));
|
|
22
24
|
exports.CardExpiryCvcField = CardExpiryCvcField;
|
|
23
|
-
var FormRow = _styledComponents.default.div(
|
|
25
|
+
var FormRow = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n input {\n display: block;\n border: none;\n font-size: 18px;\n margin: 10px 0 20px 0;\n max-width: 100%;\n padding: 10px 14px;\n box-shadow: rgba(50, 50, 93, 0.14902) 0px 1px 3px,\n rgba(0, 0, 0, 0.0196078) 0px 1px 0px;\n border-radius: 4px;\n background: white;\n color: #424770;\n letter-spacing: 0.025em;\n width: 500px;\n }\n\n input::placeholder {\n color: #aab7c4;\n }\n"])));
|
|
24
26
|
exports.FormRow = FormRow;
|
|
25
|
-
var ErrorMessage = _styledComponents.default.div(
|
|
27
|
+
var ErrorMessage = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: 16px;\n font-weight: bold;\n margin-top: 10px;\n margin-bottom: 20px;\n color: #D81212;\n margin: 10px 0px 0px 10px;\n ", "\n"])), function (props) {
|
|
26
28
|
var _props$theme;
|
|
27
|
-
return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.rtl) && (0, _styledComponents.css)(
|
|
29
|
+
return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.rtl) && (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin: 10px 10px 0px 0px\n "])));
|
|
28
30
|
});
|
|
29
31
|
exports.ErrorMessage = ErrorMessage;
|
|
30
|
-
var FormActions = _styledComponents.default.div(
|
|
31
|
-
exports.FormActions = FormActions;
|
|
32
|
+
var FormActions = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n width: 100%;\n margin-top: 20px;\n\n button {\n height: 44px;\n width: 100%;\n border-radius: 7.6px;\n\n &:disabled {\n opacity: 0.5;\n }\n }\n"])));
|
|
33
|
+
exports.FormActions = FormActions;
|
|
34
|
+
var ZipcodeField = _styledComponents.default.input(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n font-weight: 500;\n font-size: 16px;\n box-sizing: border-box;\n width: 100% !important;\n &:-webkit-autofill {\n color: '#fce883'\n }\n &::placeholder {\n font-weight: 500\n }\n &:focus(){\n box-shadow: rgba(50, 50, 93, 0.109804) 0px 4px 6px,\n rgba(0, 0, 0, 0.0784314) 0px 1px 3px;\n -webkit-transition: all 150ms ease;\n transition: all 150ms ease;\n }\n\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n &[type=number] {\n -moz-appearance: textfield;\n }\n \n"])));
|
|
35
|
+
exports.ZipcodeField = ZipcodeField;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCardType = exports.formatExpirationDate = exports.formatCreditCardNumber = exports.formatCVC = void 0;
|
|
7
|
+
var _payment = _interopRequireDefault(require("payment"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var clearNumber = function clearNumber() {
|
|
10
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
+
return value.replace(/\D+/g, '');
|
|
12
|
+
};
|
|
13
|
+
var formatCreditCardNumber = function formatCreditCardNumber(value) {
|
|
14
|
+
if (!value) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
var issuer = _payment.default.fns.cardType(value);
|
|
18
|
+
var clearValue = clearNumber(value);
|
|
19
|
+
var nextValue;
|
|
20
|
+
switch (issuer) {
|
|
21
|
+
case 'amex':
|
|
22
|
+
nextValue = "".concat(clearValue.slice(0, 4), " ").concat(clearValue.slice(4, 10), " ").concat(clearValue.slice(10, 15));
|
|
23
|
+
break;
|
|
24
|
+
case 'dinersclub':
|
|
25
|
+
nextValue = "".concat(clearValue.slice(0, 4), " ").concat(clearValue.slice(4, 10), " ").concat(clearValue.slice(10, 14));
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
nextValue = "".concat(clearValue.slice(0, 4), " ").concat(clearValue.slice(4, 8), " ").concat(clearValue.slice(8, 12), " ").concat(clearValue.slice(12, 19));
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
return nextValue.trim();
|
|
32
|
+
};
|
|
33
|
+
exports.formatCreditCardNumber = formatCreditCardNumber;
|
|
34
|
+
var formatCVC = function formatCVC(value, prevValue) {
|
|
35
|
+
var allValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
36
|
+
var clearValue = clearNumber(value);
|
|
37
|
+
var maxLength = 4;
|
|
38
|
+
if (allValues.number) {
|
|
39
|
+
var issuer = _payment.default.fns.cardType(allValues.number);
|
|
40
|
+
maxLength = issuer === 'amex' ? 4 : 3;
|
|
41
|
+
}
|
|
42
|
+
return clearValue.slice(0, maxLength);
|
|
43
|
+
};
|
|
44
|
+
exports.formatCVC = formatCVC;
|
|
45
|
+
var formatExpirationDate = function formatExpirationDate(value) {
|
|
46
|
+
var clearValue = clearNumber(value);
|
|
47
|
+
if (clearValue.length >= 3) {
|
|
48
|
+
return "".concat(clearValue.slice(0, 2), "/").concat(clearValue.slice(2, 4));
|
|
49
|
+
}
|
|
50
|
+
return clearValue;
|
|
51
|
+
};
|
|
52
|
+
exports.formatExpirationDate = formatExpirationDate;
|
|
53
|
+
var getCardType = function getCardType(number) {
|
|
54
|
+
// visa
|
|
55
|
+
var re = new RegExp('^4');
|
|
56
|
+
if (number.match(re) != null) {
|
|
57
|
+
return 'Visa';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Mastercard
|
|
61
|
+
// Updated for Mastercard 2017 BINs expansion
|
|
62
|
+
if (/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/.test(number)) {
|
|
63
|
+
return 'Mastercard';
|
|
64
|
+
}
|
|
65
|
+
// AMEX
|
|
66
|
+
re = new RegExp('^3[47]');
|
|
67
|
+
if (number.match(re) != null) {
|
|
68
|
+
return 'AMEX';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Discover
|
|
72
|
+
re = new RegExp('^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)');
|
|
73
|
+
if (number.match(re) != null) {
|
|
74
|
+
return 'Discover';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Diners
|
|
78
|
+
re = new RegExp('^36');
|
|
79
|
+
if (number.match(re) != null) {
|
|
80
|
+
return 'Diners';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Diners - Carte Blanche
|
|
84
|
+
re = new RegExp('^30[0-5]');
|
|
85
|
+
if (number.match(re) != null) {
|
|
86
|
+
return 'Diners - Carte Blanche';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// JCB
|
|
90
|
+
re = new RegExp('^35(2[89]|[3-8][0-9])');
|
|
91
|
+
if (number.match(re) != null) {
|
|
92
|
+
return 'JCB';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Visa Electron
|
|
96
|
+
re = new RegExp('^(4026|417500|4508|4844|491(3|7))');
|
|
97
|
+
if (number.match(re) != null) {
|
|
98
|
+
return 'Visa Electron';
|
|
99
|
+
}
|
|
100
|
+
return '';
|
|
101
|
+
};
|
|
102
|
+
exports.getCardType = getCardType;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CardFormCustom = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactCreditCards = _interopRequireDefault(require("react-credit-cards-2"));
|
|
10
|
+
require("react-credit-cards-2/es/styles-compiled.css");
|
|
11
|
+
var _cardUtils = require("./cardUtils");
|
|
12
|
+
var _reactHookForm = require("react-hook-form");
|
|
13
|
+
var _Inputs = require("../../styles/Inputs");
|
|
14
|
+
var _orderingComponentsExternal = require("ordering-components-external");
|
|
15
|
+
var _Buttons = _interopRequireDefault(require("../../styles/Buttons"));
|
|
16
|
+
var _styles = require("./styles");
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
29
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
var CardFormCustom = function CardFormCustom(props) {
|
|
32
|
+
var _Object$keys;
|
|
33
|
+
var handleNewCard = props.handleNewCard,
|
|
34
|
+
setAddCardOpen = props.setAddCardOpen;
|
|
35
|
+
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
36
|
+
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
37
|
+
t = _useLanguage2[1];
|
|
38
|
+
var _useState = (0, _react.useState)({
|
|
39
|
+
cvc: '',
|
|
40
|
+
expiry: '',
|
|
41
|
+
focus: '',
|
|
42
|
+
name: '',
|
|
43
|
+
number: ''
|
|
44
|
+
}),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
formState = _useState2[0],
|
|
47
|
+
setFormState = _useState2[1];
|
|
48
|
+
var formMethods = (0, _reactHookForm.useForm)();
|
|
49
|
+
var handleInputFocus = function handleInputFocus(e) {
|
|
50
|
+
setFormState(_objectSpread(_objectSpread({}, formState), {}, {
|
|
51
|
+
focus: e.target.name
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
var handleInputChange = function handleInputChange(_ref) {
|
|
55
|
+
var target = _ref.target;
|
|
56
|
+
if (target.name === 'number') {
|
|
57
|
+
target.value = (0, _cardUtils.formatCreditCardNumber)(target.value);
|
|
58
|
+
} else if (target.name === 'expiry') {
|
|
59
|
+
target.value = (0, _cardUtils.formatExpirationDate)(target.value);
|
|
60
|
+
} else if (target.name === 'cvc') {
|
|
61
|
+
target.value = (0, _cardUtils.formatCVC)(target.value);
|
|
62
|
+
}
|
|
63
|
+
setFormState(_objectSpread(_objectSpread({}, formState), {}, _defineProperty({}, target.name, target.value)));
|
|
64
|
+
};
|
|
65
|
+
var onSubmit = function onSubmit(values) {
|
|
66
|
+
var _values$number, _values$expiry;
|
|
67
|
+
var cardBrand = (0, _cardUtils.getCardType)(values === null || values === void 0 ? void 0 : values.number);
|
|
68
|
+
var lastFourDigits = values === null || values === void 0 ? void 0 : values.number.substr(-4);
|
|
69
|
+
var card = {
|
|
70
|
+
type: 'card',
|
|
71
|
+
brand: cardBrand,
|
|
72
|
+
last4: lastFourDigits,
|
|
73
|
+
ccnumber: values === null || values === void 0 ? void 0 : (_values$number = values.number) === null || _values$number === void 0 ? void 0 : _values$number.replace(/\s/g, ''),
|
|
74
|
+
ccexp: values === null || values === void 0 ? void 0 : (_values$expiry = values.expiry) === null || _values$expiry === void 0 ? void 0 : _values$expiry.replace('/', ''),
|
|
75
|
+
cvv: values === null || values === void 0 ? void 0 : values.cvc
|
|
76
|
+
};
|
|
77
|
+
handleNewCard(card);
|
|
78
|
+
setAddCardOpen(false);
|
|
79
|
+
};
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_styles.FormContainer, {
|
|
81
|
+
id: "PaymentForm"
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement(_reactCreditCards.default, {
|
|
83
|
+
cvc: formState.cvc,
|
|
84
|
+
expiry: formState.expiry,
|
|
85
|
+
focused: formState.focus,
|
|
86
|
+
name: formState.name,
|
|
87
|
+
number: formState.number,
|
|
88
|
+
placeholders: {
|
|
89
|
+
name: t('YOUR_NAME_HERE', 'Your name here')
|
|
90
|
+
}
|
|
91
|
+
}), /*#__PURE__*/_react.default.createElement("form", {
|
|
92
|
+
onSubmit: formMethods.handleSubmit(onSubmit)
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.InputContainer, null, /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
|
|
94
|
+
type: "tel",
|
|
95
|
+
name: "number",
|
|
96
|
+
placeholder: t('CARD_NUMBER', 'Card number'),
|
|
97
|
+
inputMode: "numeric",
|
|
98
|
+
onChange: handleInputChange,
|
|
99
|
+
onFocus: handleInputFocus,
|
|
100
|
+
pattern: "[\\d| ]{16,22}",
|
|
101
|
+
format: _cardUtils.formatCreditCardNumber,
|
|
102
|
+
maxLength: 19,
|
|
103
|
+
ref: formMethods.register({
|
|
104
|
+
required: t('CARD_NUMBER_REQUIRED', 'Card number is required'),
|
|
105
|
+
pattern: /^[\d| ]{16,22}$/i
|
|
106
|
+
}),
|
|
107
|
+
isError: formMethods.errors.number
|
|
108
|
+
})), /*#__PURE__*/_react.default.createElement(_styles.InputContainer, null, /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
|
|
109
|
+
type: "text",
|
|
110
|
+
name: "name",
|
|
111
|
+
placeholder: t('NAME', 'Name'),
|
|
112
|
+
onChange: handleInputChange,
|
|
113
|
+
onFocus: handleInputFocus,
|
|
114
|
+
ref: formMethods.register({
|
|
115
|
+
required: t('NAME_REQUIRED', 'Name is required')
|
|
116
|
+
}),
|
|
117
|
+
isError: formMethods.errors.name
|
|
118
|
+
})), /*#__PURE__*/_react.default.createElement(_styles.InputContainer, null, /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
|
|
119
|
+
type: "text",
|
|
120
|
+
name: "expiry",
|
|
121
|
+
pattern: "\\d\\d/\\d\\d",
|
|
122
|
+
placeholder: t('EXPIRY', 'Expiry'),
|
|
123
|
+
onChange: handleInputChange,
|
|
124
|
+
onFocus: handleInputFocus,
|
|
125
|
+
format: _cardUtils.formatExpirationDate,
|
|
126
|
+
ref: formMethods.register({
|
|
127
|
+
required: t('EXPIRY_DATE_REQUIRED', 'Expiry date required')
|
|
128
|
+
}),
|
|
129
|
+
isError: formMethods.errors.expiry
|
|
130
|
+
}), /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
|
|
131
|
+
type: "text",
|
|
132
|
+
name: "cvc",
|
|
133
|
+
placeholder: t('CVC', 'CVC'),
|
|
134
|
+
pattern: "\\d{3,4}",
|
|
135
|
+
onChange: handleInputChange,
|
|
136
|
+
onFocus: handleInputFocus,
|
|
137
|
+
format: _cardUtils.formatCVC,
|
|
138
|
+
ref: formMethods.register({
|
|
139
|
+
required: t('CVC_REQUIRED', 'CVC is required')
|
|
140
|
+
}),
|
|
141
|
+
isError: formMethods.errors.cvc
|
|
142
|
+
})), /*#__PURE__*/_react.default.createElement(_Buttons.default, {
|
|
143
|
+
type: "submit",
|
|
144
|
+
color: "primary",
|
|
145
|
+
disabled: ((_Object$keys = Object.keys(formMethods.errors)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0
|
|
146
|
+
}, t('SAVE', 'Save'))));
|
|
147
|
+
};
|
|
148
|
+
exports.CardFormCustom = CardFormCustom;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.InputContainer = exports.FormContainer = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
var _templateObject, _templateObject2;
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
|
+
var InputContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n justify-content: space-between;\n\n input{\n box-sizing: border-box;\n width: 100%;\n margin: 10px;\n }\n"])));
|
|
14
|
+
exports.InputContainer = InputContainer;
|
|
15
|
+
var FormContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n button{\n width: 100%;\n margin: 10px;\n }\n"])));
|
|
16
|
+
exports.FormContainer = FormContainer;
|
|
@@ -454,7 +454,7 @@ var CartUI = function CartUI(props) {
|
|
|
454
454
|
return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
|
|
455
455
|
}
|
|
456
456
|
}))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 ? void 0 : (_offer$summary2 = offer.summary) === null || _offer$summary2 === void 0 ? void 0 : _offer$summary2.discount)));
|
|
457
|
-
})), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 &&
|
|
457
|
+
})), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 && !hideDeliveryFee && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE', 'Delivery Fee')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount))), !hideCartDiscount && (cart === null || cart === void 0 ? void 0 : (_cart$offers7 = cart.offers) === null || _cart$offers7 === void 0 ? void 0 : _cart$offers7.length) > 0 && (cart === null || cart === void 0 ? void 0 : (_cart$offers8 = cart.offers) === null || _cart$offers8 === void 0 ? void 0 : (_cart$offers8$filter = _cart$offers8.filter(function (offer) {
|
|
458
458
|
return (offer === null || offer === void 0 ? void 0 : offer.target) === 2;
|
|
459
459
|
})) === null || _cart$offers8$filter === void 0 ? void 0 : _cart$offers8$filter.map(function (offer) {
|
|
460
460
|
var _offer$summary3;
|
|
@@ -19,7 +19,7 @@ var HeaderItem = _styledComponents.default.div(_templateObject || (_templateObje
|
|
|
19
19
|
return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: 10px;\n "]))) : (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: 10px;\n "])));
|
|
20
20
|
});
|
|
21
21
|
exports.HeaderItem = HeaderItem;
|
|
22
|
-
var PopoverBody = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: #FFF;\n color: #333;\n padding: 15px;\n border-radius: 10px;\n max-width: 500px;\n z-index:
|
|
22
|
+
var PopoverBody = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: #FFF;\n color: #333;\n padding: 15px;\n border-radius: 10px;\n max-width: 500px;\n z-index: 10002;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 8px 24px;\n"])));
|
|
23
23
|
exports.PopoverBody = PopoverBody;
|
|
24
24
|
var PopoverArrow = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: 0;\n height: 0;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n border-bottom: 8px solid #FFF;\n top: -8px;\n"])));
|
|
25
25
|
exports.PopoverArrow = PopoverArrow;
|
|
@@ -167,6 +167,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
167
167
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
168
168
|
cardList = _useState22[0],
|
|
169
169
|
setCardList = _useState22[1];
|
|
170
|
+
var cardsMethods = ['stripe', 'credomatic'];
|
|
170
171
|
var businessConfigs = (_businessDetails$busi = businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi2 = businessDetails.business) === null || _businessDetails$busi2 === void 0 ? void 0 : _businessDetails$busi2.configs) !== null && _businessDetails$busi !== void 0 ? _businessDetails$busi : [];
|
|
171
172
|
var isTableNumberEnabled = configs === null || configs === void 0 ? void 0 : (_configs$table_numer_ = configs.table_numer_enabled) === null || _configs$table_numer_ === void 0 ? void 0 : _configs$table_numer_.value;
|
|
172
173
|
var isWalletCashEnabled = ((_businessConfigs$find = businessConfigs.find(function (config) {
|
|
@@ -183,7 +184,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
183
184
|
// const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
|
|
184
185
|
|
|
185
186
|
var validateCommentsCartField = (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie = validationFields.fields) === null || _validationFields$fie === void 0 ? void 0 : (_validationFields$fie2 = _validationFields$fie.checkout) === null || _validationFields$fie2 === void 0 ? void 0 : (_validationFields$fie3 = _validationFields$fie2.comments) === null || _validationFields$fie3 === void 0 ? void 0 : _validationFields$fie3.enabled) && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie4 = validationFields.fields) === null || _validationFields$fie4 === void 0 ? void 0 : (_validationFields$fie5 = _validationFields$fie4.checkout) === null || _validationFields$fie5 === void 0 ? void 0 : (_validationFields$fie6 = _validationFields$fie5.comments) === null || _validationFields$fie6 === void 0 ? void 0 : _validationFields$fie6.required) && ((cart === null || cart === void 0 ? void 0 : cart.comment) === null || (cart === null || cart === void 0 ? void 0 : (_cart$comment = cart.comment) === null || _cart$comment === void 0 ? void 0 : _cart$comment.trim().length) === 0);
|
|
186
|
-
var isDisablePlaceOrderButton = !(cart !== null && cart !== void 0 && cart.valid) || !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 || (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway)
|
|
187
|
+
var isDisablePlaceOrderButton = !(cart !== null && cart !== void 0 && cart.valid) || !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 || cardsMethods.includes(paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) && (cardList === null || cardList === void 0 ? void 0 : (_cardList$cards = cardList.cards) === null || _cardList$cards === void 0 ? void 0 : _cardList$cards.length) === 0 || placing || errorCash || loading || isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cartState !== null && cartState !== void 0 && (_cartState$cart = cartState.cart) !== null && _cartState$cart !== void 0 && _cartState$cart.spot_number || cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) || !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ||
|
|
187
188
|
// (((placeSpotTypes.includes(options?.type) && !cart?.place) && hasBusinessPlaces)) ||
|
|
188
189
|
options.type === 1 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie7 = validationFields.fields) === null || _validationFields$fie7 === void 0 ? void 0 : (_validationFields$fie8 = _validationFields$fie7.checkout) === null || _validationFields$fie8 === void 0 ? void 0 : (_validationFields$fie9 = _validationFields$fie8.driver_tip) === null || _validationFields$fie9 === void 0 ? void 0 : _validationFields$fie9.enabled) && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie10 = validationFields.fields) === null || _validationFields$fie10 === void 0 ? void 0 : (_validationFields$fie11 = _validationFields$fie10.checkout) === null || _validationFields$fie11 === void 0 ? void 0 : (_validationFields$fie12 = _validationFields$fie11.driver_tip) === null || _validationFields$fie12 === void 0 ? void 0 : _validationFields$fie12.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0 || validateCommentsCartField;
|
|
189
190
|
var driverTipsOptions = typeof (configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o = configs.driver_tip_options) === null || _configs$driver_tip_o === void 0 ? void 0 : _configs$driver_tip_o.value) === 'string' ? JSON.parse(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o2 = configs.driver_tip_options) === null || _configs$driver_tip_o2 === void 0 ? void 0 : _configs$driver_tip_o2.value) || [] : (configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o3 = configs.driver_tip_options) === null || _configs$driver_tip_o3 === void 0 ? void 0 : _configs$driver_tip_o3.value) || [];
|
|
@@ -264,7 +265,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
264
265
|
if (userSelected && userSelected !== null && userSelected !== void 0 && userSelected.cellphone) {
|
|
265
266
|
if (userSelected !== null && userSelected !== void 0 && userSelected.country_phone_code) {
|
|
266
267
|
var phone = null;
|
|
267
|
-
phone = "+".concat(userSelected === null || userSelected === void 0 ? void 0 : userSelected.country_phone_code).concat(userSelected === null || userSelected === void 0 ? void 0 : userSelected.cellphone);
|
|
268
|
+
phone = "+".concat(userSelected === null || userSelected === void 0 ? void 0 : userSelected.country_phone_code).concat(userSelected === null || userSelected === void 0 ? void 0 : userSelected.cellphone.replace("+".concat(userSelected === null || userSelected === void 0 ? void 0 : userSelected.country_phone_code), ''));
|
|
268
269
|
var phoneNumber = (0, _libphonenumberJs.default)(phone);
|
|
269
270
|
if (!(phoneNumber !== null && phoneNumber !== void 0 && phoneNumber.isValid())) {
|
|
270
271
|
errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_INVALID', 'The field Phone number is invalid.'));
|
|
@@ -621,7 +622,8 @@ var Checkout = function Checkout(props) {
|
|
|
621
622
|
handleOrderRedirect = props.handleOrderRedirect,
|
|
622
623
|
handleCheckoutRedirect = props.handleCheckoutRedirect,
|
|
623
624
|
handleSearchRedirect = props.handleSearchRedirect,
|
|
624
|
-
handleCheckoutListRedirect = props.handleCheckoutListRedirect
|
|
625
|
+
handleCheckoutListRedirect = props.handleCheckoutListRedirect,
|
|
626
|
+
businessSlug = props.businessSlug;
|
|
625
627
|
var _useOrder3 = (0, _orderingComponentsExternal.useOrder)(),
|
|
626
628
|
_useOrder4 = _slicedToArray(_useOrder3, 2),
|
|
627
629
|
orderState = _useOrder4[0],
|
|
@@ -670,6 +672,10 @@ var Checkout = function Checkout(props) {
|
|
|
670
672
|
var _cart$products3;
|
|
671
673
|
return (cart === null || cart === void 0 ? void 0 : cart.products) && (cart === null || cart === void 0 ? void 0 : (_cart$products3 = cart.products) === null || _cart$products3 === void 0 ? void 0 : _cart$products3.length);
|
|
672
674
|
})) || null);
|
|
675
|
+
var carts = businessSlug ? cartsWithProducts.filter(function (cart) {
|
|
676
|
+
var _cart$business6;
|
|
677
|
+
return (cart === null || cart === void 0 ? void 0 : (_cart$business6 = cart.business) === null || _cart$business6 === void 0 ? void 0 : _cart$business6.slug) === businessSlug || businessSlug === (cart === null || cart === void 0 ? void 0 : cart.business_id);
|
|
678
|
+
}) : cartsWithProducts;
|
|
673
679
|
var closeAlert = function closeAlert() {
|
|
674
680
|
setAlertState({
|
|
675
681
|
open: false,
|
|
@@ -706,13 +712,13 @@ var Checkout = function Checkout(props) {
|
|
|
706
712
|
}, [errors]);
|
|
707
713
|
var getOrder = /*#__PURE__*/function () {
|
|
708
714
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(cartId) {
|
|
709
|
-
var _result$order, result, cart, userCustomer, url, response, content, _confirmCartRes$resul, confirmCartRes, _cart, spotNumberFromStorage, _JSON$parse, _JSON$parse2, _cart2, _cart2$business, spotNumber, slug;
|
|
715
|
+
var _result$order, result, cart, userCustomer, url, response, content, _result, _result$paymethod_dat, credomaticData, urlParams, paramsObj, _confirmCartRes$resul, confirmCartRes, _cart, spotNumberFromStorage, _JSON$parse, _JSON$parse2, _cart2, _cart2$business, spotNumber, slug;
|
|
710
716
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
711
717
|
while (1) switch (_context.prev = _context.next) {
|
|
712
718
|
case 0:
|
|
713
719
|
_context.prev = 0;
|
|
714
720
|
result = {};
|
|
715
|
-
cart =
|
|
721
|
+
cart = carts.find(function (cart) {
|
|
716
722
|
return cart.uuid === cartId;
|
|
717
723
|
});
|
|
718
724
|
userCustomer = JSON.parse(window.localStorage.getItem('user-customer'));
|
|
@@ -753,17 +759,25 @@ var Checkout = function Checkout(props) {
|
|
|
753
759
|
setCartState(_objectSpread(_objectSpread({}, cartState), {}, {
|
|
754
760
|
loading: false
|
|
755
761
|
}));
|
|
756
|
-
_context.next =
|
|
762
|
+
_context.next = 43;
|
|
757
763
|
break;
|
|
758
764
|
case 22:
|
|
759
765
|
if (!(result.status === 2)) {
|
|
760
|
-
_context.next =
|
|
766
|
+
_context.next = 39;
|
|
761
767
|
break;
|
|
762
768
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
769
|
+
credomaticData = null;
|
|
770
|
+
if (((_result = result) === null || _result === void 0 ? void 0 : (_result$paymethod_dat = _result.paymethod_data) === null || _result$paymethod_dat === void 0 ? void 0 : _result$paymethod_dat.gateway) === 'credomatic') {
|
|
771
|
+
urlParams = new URLSearchParams(window.location.search);
|
|
772
|
+
paramsObj = Object.fromEntries(urlParams.entries());
|
|
773
|
+
credomaticData = {
|
|
774
|
+
credomatic: _objectSpread({}, paramsObj)
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
_context.prev = 25;
|
|
778
|
+
_context.next = 28;
|
|
779
|
+
return confirmCart(cartUuid, credomaticData);
|
|
780
|
+
case 28:
|
|
767
781
|
confirmCartRes = _context.sent;
|
|
768
782
|
if (confirmCartRes.error) {
|
|
769
783
|
setAlertState({
|
|
@@ -779,19 +793,19 @@ var Checkout = function Checkout(props) {
|
|
|
779
793
|
loading: false,
|
|
780
794
|
cart: result
|
|
781
795
|
}));
|
|
782
|
-
_context.next =
|
|
796
|
+
_context.next = 37;
|
|
783
797
|
break;
|
|
784
|
-
case
|
|
785
|
-
_context.prev =
|
|
786
|
-
_context.t0 = _context["catch"](
|
|
798
|
+
case 34:
|
|
799
|
+
_context.prev = 34;
|
|
800
|
+
_context.t0 = _context["catch"](25);
|
|
787
801
|
setAlertState({
|
|
788
802
|
open: true,
|
|
789
803
|
content: [_context.t0.message]
|
|
790
804
|
});
|
|
791
|
-
case 35:
|
|
792
|
-
_context.next = 41;
|
|
793
|
-
break;
|
|
794
805
|
case 37:
|
|
806
|
+
_context.next = 43;
|
|
807
|
+
break;
|
|
808
|
+
case 39:
|
|
795
809
|
_cart = Array.isArray(result) ? null : result;
|
|
796
810
|
spotNumberFromStorage = window.localStorage.getItem('table_number');
|
|
797
811
|
if (spotNumberFromStorage) {
|
|
@@ -808,21 +822,21 @@ var Checkout = function Checkout(props) {
|
|
|
808
822
|
cart: _cart,
|
|
809
823
|
error: _cart ? null : result
|
|
810
824
|
}));
|
|
811
|
-
case 41:
|
|
812
|
-
_context.next = 46;
|
|
813
|
-
break;
|
|
814
825
|
case 43:
|
|
815
|
-
_context.
|
|
826
|
+
_context.next = 48;
|
|
827
|
+
break;
|
|
828
|
+
case 45:
|
|
829
|
+
_context.prev = 45;
|
|
816
830
|
_context.t1 = _context["catch"](0);
|
|
817
831
|
setCartState(_objectSpread(_objectSpread({}, cartState), {}, {
|
|
818
832
|
loading: false,
|
|
819
833
|
error: [_context.t1.toString()]
|
|
820
834
|
}));
|
|
821
|
-
case
|
|
835
|
+
case 48:
|
|
822
836
|
case "end":
|
|
823
837
|
return _context.stop();
|
|
824
838
|
}
|
|
825
|
-
}, _callee, null, [[0,
|
|
839
|
+
}, _callee, null, [[0, 45], [25, 34]]);
|
|
826
840
|
}));
|
|
827
841
|
return function getOrder(_x2) {
|
|
828
842
|
return _ref2.apply(this, arguments);
|
|
@@ -844,12 +858,12 @@ var Checkout = function Checkout(props) {
|
|
|
844
858
|
isResetPaymethod: isResetPaymethod,
|
|
845
859
|
setIsResetPaymethod: setIsResetPaymethod
|
|
846
860
|
});
|
|
847
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !cartUuid && orderState.carts &&
|
|
861
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !cartUuid && orderState.carts && carts && (carts === null || carts === void 0 ? void 0 : carts.length) === 0 && /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
|
|
848
862
|
content: t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.'),
|
|
849
863
|
btnTitle: t('SEARCH_REDIRECT', 'Go to Businesses'),
|
|
850
864
|
onClickButton: handleSearchRedirect
|
|
851
|
-
}), !cartUuid && orderState.carts &&
|
|
852
|
-
carts:
|
|
865
|
+
}), !cartUuid && orderState.carts && carts && (carts === null || carts === void 0 ? void 0 : carts.length) > 0 && /*#__PURE__*/_react.default.createElement(_styles.CartsList, null, /*#__PURE__*/_react.default.createElement(_CartContent.CartContent, {
|
|
866
|
+
carts: carts,
|
|
853
867
|
isOrderStateCarts: !!orderState.carts,
|
|
854
868
|
isForceOpenCart: true
|
|
855
869
|
})), cartUuid && cartState.error && ((_cartState$error = cartState.error) === null || _cartState$error === void 0 ? void 0 : _cartState$error.length) > 0 && /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
|
|
@@ -58,7 +58,9 @@ var Header = function Header(props) {
|
|
|
58
58
|
isHideSignup = props.isHideSignup,
|
|
59
59
|
isCustomerMode = props.isCustomerMode,
|
|
60
60
|
searchValue = props.searchValue,
|
|
61
|
-
setSearchValue = props.setSearchValue
|
|
61
|
+
setSearchValue = props.setSearchValue,
|
|
62
|
+
businessSlug = props.businessSlug,
|
|
63
|
+
notificationState = props.notificationState;
|
|
62
64
|
var _useLocation = (0, _reactRouterDom.useLocation)(),
|
|
63
65
|
pathname = _useLocation.pathname;
|
|
64
66
|
var _useEvent = (0, _orderingComponentsExternal.useEvent)(),
|
|
@@ -146,6 +148,10 @@ var Header = function Header(props) {
|
|
|
146
148
|
var _cart$products;
|
|
147
149
|
return cart.products && ((_cart$products = cart.products) === null || _cart$products === void 0 ? void 0 : _cart$products.length) > 0;
|
|
148
150
|
}) || null;
|
|
151
|
+
var carts = businessSlug ? cartsWithProducts.filter(function (cart) {
|
|
152
|
+
var _cart$business;
|
|
153
|
+
return (cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.slug) === businessSlug || businessSlug === (cart === null || cart === void 0 ? void 0 : cart.business_id);
|
|
154
|
+
}) : cartsWithProducts;
|
|
149
155
|
var windowSize = (0, _useWindowSize.useWindowSize)();
|
|
150
156
|
var onlineStatus = (0, _useOnlineStatus.useOnlineStatus)();
|
|
151
157
|
var userCustomer = JSON.parse(window.localStorage.getItem('user-customer'));
|
|
@@ -366,7 +372,7 @@ var Header = function Header(props) {
|
|
|
366
372
|
}
|
|
367
373
|
}, t('SIGN_UP', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag3 = theme.defaultLanguages) === null || _theme$defaultLanguag3 === void 0 ? void 0 : _theme$defaultLanguag3.SIGN_UP) || 'Sign up'))), auth && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isShowOrderOptions && (windowSize.width > 768 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !isMulticheckoutPage ? /*#__PURE__*/_react.default.createElement(_CartPopover.CartPopover, {
|
|
368
374
|
open: openPopover.cart,
|
|
369
|
-
carts:
|
|
375
|
+
carts: carts,
|
|
370
376
|
onClick: function onClick() {
|
|
371
377
|
return handleTogglePopover('cart');
|
|
372
378
|
},
|
|
@@ -379,7 +385,7 @@ var Header = function Header(props) {
|
|
|
379
385
|
setPreorderBusiness: setPreorderBusiness
|
|
380
386
|
}) : null) : /*#__PURE__*/_react.default.createElement(_HeaderOption.HeaderOption, {
|
|
381
387
|
variant: "cart",
|
|
382
|
-
totalCarts:
|
|
388
|
+
totalCarts: carts === null || carts === void 0 ? void 0 : carts.length,
|
|
383
389
|
onClick: function onClick(variant) {
|
|
384
390
|
return openModal(variant);
|
|
385
391
|
}
|
|
@@ -431,7 +437,7 @@ var Header = function Header(props) {
|
|
|
431
437
|
},
|
|
432
438
|
width: modalSelected === 'address' ? orderState !== null && orderState !== void 0 && (_orderState$options17 = orderState.options) !== null && _orderState$options17 !== void 0 && _orderState$options17.user_id ? '70%' : '50%' : '700px'
|
|
433
439
|
}), modalSelected === 'cart' && /*#__PURE__*/_react.default.createElement(_CartContent.CartContent, {
|
|
434
|
-
carts:
|
|
440
|
+
carts: carts,
|
|
435
441
|
isOrderStateCarts: !!orderState.carts,
|
|
436
442
|
onClose: function onClose() {
|
|
437
443
|
return setModalIsOpen(false);
|
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LanguageSelector = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _orderingComponentsExternal = require("ordering-components-external");
|
|
9
9
|
var _Select = require("../../styles/Select");
|
|
10
10
|
var _styles = require("./styles");
|
|
11
11
|
var _BisDownArrow = _interopRequireDefault(require("@meronex/icons/bi/BisDownArrow"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
15
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
14
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -48,6 +50,7 @@ var LanguageSelectorUI = function LanguageSelectorUI(props) {
|
|
|
48
50
|
alt: currentLanguage,
|
|
49
51
|
src: "http://purecatamphetamine.github.io/country-flag-icons/3x2/".concat(transformLanguageToCountry(currentLanguage), ".svg")
|
|
50
52
|
}), /*#__PURE__*/_react.default.createElement(_Select.Select, {
|
|
53
|
+
zIndex: 20000,
|
|
51
54
|
isHomeStyle: true,
|
|
52
55
|
options: languagesState !== null && languagesState !== void 0 && languagesState.loading ? defaultLanguages : _languages,
|
|
53
56
|
defaultValue: languagesState !== null && languagesState !== void 0 && languagesState.loading ? defaultCurrentLanguage : currentLanguage,
|