ordering-ui-external 2.2.2 → 2.3.1
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.da916a51373ae7f6cfcc.js → 0.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/{1.ordering-ui.da916a51373ae7f6cfcc.js → 1.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/{2.ordering-ui.da916a51373ae7f6cfcc.js → 2.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/{4.ordering-ui.da916a51373ae7f6cfcc.js → 4.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/{5.ordering-ui.da916a51373ae7f6cfcc.js → 5.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/{6.ordering-ui.da916a51373ae7f6cfcc.js → 6.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/{7.ordering-ui.da916a51373ae7f6cfcc.js → 7.ordering-ui.c46aca08b04b2755b967.js} +2 -2
- package/_bundles/{7.ordering-ui.da916a51373ae7f6cfcc.js.LICENSE.txt → 7.ordering-ui.c46aca08b04b2755b967.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.da916a51373ae7f6cfcc.js → 8.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/{9.ordering-ui.da916a51373ae7f6cfcc.js → 9.ordering-ui.c46aca08b04b2755b967.js} +1 -1
- package/_bundles/ordering-ui.c46aca08b04b2755b967.js +2 -0
- package/_bundles/{ordering-ui.da916a51373ae7f6cfcc.js.LICENSE.txt → ordering-ui.c46aca08b04b2755b967.js.LICENSE.txt} +0 -0
- package/_modules/components/PaymentOptions/index.js +42 -2
- package/_modules/index.js +7 -0
- package/_modules/themes/five/index.js +7 -0
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +1 -4
- package/_modules/themes/five/src/components/Cart/index.js +6 -2
- package/_modules/themes/five/src/components/Cart/styles.js +1 -1
- package/_modules/themes/five/src/components/Checkout/index.js +142 -42
- package/_modules/themes/five/src/components/Checkout/styles.js +5 -3
- package/_modules/themes/five/src/components/InputPhoneNumber/index.js +10 -21
- package/_modules/themes/five/src/components/LoginForm/index.js +29 -13
- package/_modules/themes/five/src/components/MultiCheckout/index.js +5 -1
- package/_modules/themes/five/src/components/QueryLoginSpoonity/index.js +37 -0
- package/_modules/themes/five/src/components/SignUpForm/index.js +15 -7
- package/_modules/themes/five/src/components/Wallets/index.js +1 -1
- package/_modules/themes/five/src/styles/Buttons/index.js +32 -2
- package/package.json +2 -2
- package/src/components/PaymentOptions/index.js +35 -2
- package/src/index.js +2 -0
- package/src/themes/five/index.js +2 -1
- package/src/themes/five/src/components/BusinessProductsListing/index.js +3 -2
- package/src/themes/five/src/components/Cart/index.js +10 -1
- package/src/themes/five/src/components/Cart/styles.js +5 -0
- package/src/themes/five/src/components/Checkout/index.js +141 -54
- package/src/themes/five/src/components/Checkout/styles.js +15 -0
- package/src/themes/five/src/components/InputPhoneNumber/index.js +33 -38
- package/src/themes/five/src/components/LoginForm/index.js +27 -10
- package/src/themes/five/src/components/MultiCheckout/index.js +11 -2
- package/src/themes/five/src/components/QueryLoginSpoonity/index.js +19 -0
- package/src/themes/five/src/components/SignUpForm/index.js +9 -1
- package/src/themes/five/src/components/Wallets/index.js +1 -1
- package/src/themes/five/src/styles/Buttons/index.js +24 -0
- package/template/app.js +22 -7
- package/_bundles/ordering-ui.da916a51373ae7f6cfcc.js +0 -2
|
File without changes
|
|
@@ -26,6 +26,7 @@ var _PaymentOptionSquare = require("../PaymentOptionSquare");
|
|
|
26
26
|
var _NotFoundSource = require("../NotFoundSource");
|
|
27
27
|
var _utils = require("../../utils");
|
|
28
28
|
var _styles = require("./styles");
|
|
29
|
+
var _Confirm = require("../Confirm");
|
|
29
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
31
|
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); }
|
|
31
32
|
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; }
|
|
@@ -110,7 +111,20 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
|
|
|
110
111
|
token = _useSession2[0].token;
|
|
111
112
|
var _useOrder = (0, _orderingComponentsExternal.useOrder)(),
|
|
112
113
|
_useOrder2 = _slicedToArray(_useOrder, 1),
|
|
113
|
-
|
|
114
|
+
options = _useOrder2[0].options;
|
|
115
|
+
var _useOrder3 = (0, _orderingComponentsExternal.useOrder)(),
|
|
116
|
+
_useOrder4 = _slicedToArray(_useOrder3, 1),
|
|
117
|
+
loadingOptions = _useOrder4[0].loading;
|
|
118
|
+
var _useValidationFields = (0, _orderingComponentsExternal.useValidationFields)(),
|
|
119
|
+
_useValidationFields2 = _slicedToArray(_useValidationFields, 1),
|
|
120
|
+
validationFields = _useValidationFields2[0];
|
|
121
|
+
var _useState = (0, _react.useState)({
|
|
122
|
+
open: false,
|
|
123
|
+
content: []
|
|
124
|
+
}),
|
|
125
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
126
|
+
alertState = _useState2[0],
|
|
127
|
+
setAlertState = _useState2[1];
|
|
114
128
|
var list = paymethodsList ? paymethodsList === null || paymethodsList === void 0 ? void 0 : paymethodsList.paymethods : paymethods === null || paymethods === void 0 ? void 0 : paymethods.map(function (pay) {
|
|
115
129
|
return pay.paymethod;
|
|
116
130
|
});
|
|
@@ -118,6 +132,14 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
|
|
|
118
132
|
var methodsPay = ['google_pay', 'apple_pay'];
|
|
119
133
|
var stripeDirectMethods = ['stripe_direct'].concat(methodsPay);
|
|
120
134
|
var handlePaymentMethodClick = function handlePaymentMethodClick(paymethod) {
|
|
135
|
+
var _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6;
|
|
136
|
+
if ((paymethod === null || paymethod === void 0 ? void 0 : paymethod.gateway) === 'paypal' && options.type === 1 && validationFields !== null && validationFields !== void 0 && (_validationFields$fie = validationFields.fields) !== null && _validationFields$fie !== void 0 && (_validationFields$fie2 = _validationFields$fie.checkout) !== null && _validationFields$fie2 !== void 0 && (_validationFields$fie3 = _validationFields$fie2.driver_tip) !== null && _validationFields$fie3 !== void 0 && _validationFields$fie3.enabled && validationFields !== null && validationFields !== void 0 && (_validationFields$fie4 = validationFields.fields) !== null && _validationFields$fie4 !== void 0 && (_validationFields$fie5 = _validationFields$fie4.checkout) !== null && _validationFields$fie5 !== void 0 && (_validationFields$fie6 = _validationFields$fie5.driver_tip) !== null && _validationFields$fie6 !== void 0 && _validationFields$fie6.required && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0) {
|
|
137
|
+
setAlertState({
|
|
138
|
+
open: true,
|
|
139
|
+
content: [t('DRIVER_TIPS_REQUIRED', 'Driver tips is required, please select a driver tip before select this paymethod')]
|
|
140
|
+
});
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
121
143
|
var isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal', 'square', 'google_pay', 'apple_pay'].includes(paymethod === null || paymethod === void 0 ? void 0 : paymethod.gateway);
|
|
122
144
|
handlePaymethodClick(paymethod, isPopupMethod);
|
|
123
145
|
};
|
|
@@ -145,6 +167,12 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
|
|
|
145
167
|
handlePlaceOrder();
|
|
146
168
|
}
|
|
147
169
|
}, [paymethodData, paymethodSelected]);
|
|
170
|
+
var closeAlert = function closeAlert() {
|
|
171
|
+
setAlertState({
|
|
172
|
+
open: false,
|
|
173
|
+
content: []
|
|
174
|
+
});
|
|
175
|
+
};
|
|
148
176
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (_props$beforeElements = props.beforeElements) === null || _props$beforeElements === void 0 ? void 0 : _props$beforeElements.map(function (BeforeElement, i) {
|
|
149
177
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
150
178
|
key: i
|
|
@@ -292,7 +320,19 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
|
|
|
292
320
|
},
|
|
293
321
|
onPlaceOrderClick: onPlaceOrderClick,
|
|
294
322
|
setCreateOrder: setCreateOrder
|
|
295
|
-
}))
|
|
323
|
+
})), /*#__PURE__*/_react.default.createElement(_Confirm.Alert, {
|
|
324
|
+
title: t('PAYMENT_METHODS', 'Payment methods'),
|
|
325
|
+
content: alertState.content,
|
|
326
|
+
acceptText: t('ACCEPT', 'Accept'),
|
|
327
|
+
open: alertState.open,
|
|
328
|
+
onClose: function onClose() {
|
|
329
|
+
return closeAlert();
|
|
330
|
+
},
|
|
331
|
+
onAccept: function onAccept() {
|
|
332
|
+
return closeAlert();
|
|
333
|
+
},
|
|
334
|
+
closeOnBackdrop: false
|
|
335
|
+
})), (_props$afterComponent = props.afterComponents) === null || _props$afterComponent === void 0 ? void 0 : _props$afterComponent.map(function (AfterComponent, i) {
|
|
296
336
|
return /*#__PURE__*/_react.default.createElement(AfterComponent, _extends({
|
|
297
337
|
key: i
|
|
298
338
|
}, props));
|
package/_modules/index.js
CHANGED
|
@@ -837,6 +837,12 @@ Object.defineProperty(exports, "useOnlineStatus", {
|
|
|
837
837
|
return _useOnlineStatus.useOnlineStatus;
|
|
838
838
|
}
|
|
839
839
|
});
|
|
840
|
+
Object.defineProperty(exports, "useRecaptcha", {
|
|
841
|
+
enumerable: true,
|
|
842
|
+
get: function get() {
|
|
843
|
+
return _useRecaptcha.useRecaptcha;
|
|
844
|
+
}
|
|
845
|
+
});
|
|
840
846
|
Object.defineProperty(exports, "useTheme", {
|
|
841
847
|
enumerable: true,
|
|
842
848
|
get: function get() {
|
|
@@ -954,6 +960,7 @@ var _SearchProducts = require("./components/RenderProductsLayout/SearchProducts"
|
|
|
954
960
|
var _ThemeContext = require("./contexts/ThemeContext");
|
|
955
961
|
var _useOnlineStatus = require("./hooks/useOnlineStatus");
|
|
956
962
|
var _useWindowSize = require("./hooks/useWindowSize");
|
|
963
|
+
var _useRecaptcha = require("./hooks/useRecaptcha");
|
|
957
964
|
var _useCountdownTimer = require("./hooks/useCountdownTimer");
|
|
958
965
|
var _useIntersectionObserver = require("./hooks/useIntersectionObserver");
|
|
959
966
|
var _useIsMounted = require("./hooks/useIsMounted");
|
|
@@ -549,6 +549,12 @@ Object.defineProperty(exports, "Promotions", {
|
|
|
549
549
|
return _Promotions.Promotions;
|
|
550
550
|
}
|
|
551
551
|
});
|
|
552
|
+
Object.defineProperty(exports, "QueryLoginSpoonity", {
|
|
553
|
+
enumerable: true,
|
|
554
|
+
get: function get() {
|
|
555
|
+
return _QueryLoginSpoonity.QueryLoginSpoonity;
|
|
556
|
+
}
|
|
557
|
+
});
|
|
552
558
|
Object.defineProperty(exports, "RenderProductsLayout", {
|
|
553
559
|
enumerable: true,
|
|
554
560
|
get: function get() {
|
|
@@ -857,6 +863,7 @@ var _OrderPreferencesSections = require("./src/components/OrderDetails/OrderPref
|
|
|
857
863
|
var _ActionsSection = require("./src/components/OrderDetails/ActionsSection");
|
|
858
864
|
var _ProductShare = require("./src/components/ProductShare");
|
|
859
865
|
var _MultiCart = require("./src/components/MultiCart");
|
|
866
|
+
var _QueryLoginSpoonity = require("./src/components/QueryLoginSpoonity");
|
|
860
867
|
var _Buttons = require("./src/styles/Buttons");
|
|
861
868
|
var _Inputs = require("./src/styles/Inputs");
|
|
862
869
|
var _Select = require("./src/styles/Select");
|
|
@@ -395,10 +395,7 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
|
|
|
395
395
|
adjustBusiness(adjustBusinessId);
|
|
396
396
|
}
|
|
397
397
|
}, [currentCart]);
|
|
398
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.ProductsContainer, null, !props.useKioskApp &&
|
|
399
|
-
/*#__PURE__*/
|
|
400
|
-
// <ArrowLeft onClick={() => handleGoToBusinessList()} />
|
|
401
|
-
_react.default.createElement(_styles.HeaderContent, null, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.ArrowLeft, {
|
|
398
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.ProductsContainer, null, !props.useKioskApp && /*#__PURE__*/_react.default.createElement(_styles.HeaderContent, null, !location.pathname.includes('/marketplace') && /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.ArrowLeft, {
|
|
402
399
|
className: "back-arrow",
|
|
403
400
|
onClick: function onClick() {
|
|
404
401
|
return handleGoToBusinessList();
|
|
@@ -70,7 +70,8 @@ var CartUI = function CartUI(props) {
|
|
|
70
70
|
hideDeliveryFee = props.hideDeliveryFee,
|
|
71
71
|
hideDriverTip = props.hideDriverTip,
|
|
72
72
|
hideCouponInput = props.hideCouponInput,
|
|
73
|
-
businessConfigs = props.businessConfigs
|
|
73
|
+
businessConfigs = props.businessConfigs,
|
|
74
|
+
loyaltyRewardRate = props.loyaltyRewardRate;
|
|
74
75
|
var theme = (0, _styledComponents.useTheme)();
|
|
75
76
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
76
77
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -170,6 +171,7 @@ var CartUI = function CartUI(props) {
|
|
|
170
171
|
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet')
|
|
171
172
|
}
|
|
172
173
|
};
|
|
174
|
+
var loyaltyRewardValue = Math.round((cart === null || cart === void 0 ? void 0 : cart.subtotal) / loyaltyRewardRate);
|
|
173
175
|
var momentFormatted = !(orderState !== null && orderState !== void 0 && (_orderState$option = orderState.option) !== null && _orderState$option !== void 0 && _orderState$option.moment) ? t('RIGHT_NOW', 'Right Now') : parseDate(orderState === null || orderState === void 0 ? void 0 : (_orderState$option2 = orderState.option) === null || _orderState$option2 === void 0 ? void 0 : _orderState$option2.moment, {
|
|
174
176
|
outputFormat: 'YYYY-MM-DD HH:mm'
|
|
175
177
|
});
|
|
@@ -498,7 +500,9 @@ var CartUI = function CartUI(props) {
|
|
|
498
500
|
useOrderContext: true
|
|
499
501
|
}))), /*#__PURE__*/_react.default.createElement("table", {
|
|
500
502
|
className: "total"
|
|
501
|
-
}, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((cart === null || cart === void 0 ? void 0 : cart.total) >= 0 ? cart === null || cart === void 0 ? void 0 : cart.total : 0)))
|
|
503
|
+
}, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((cart === null || cart === void 0 ? void 0 : cart.total) >= 0 ? cart === null || cart === void 0 ? void 0 : cart.total : 0))), !!loyaltyRewardValue && isFinite(loyaltyRewardValue) && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, "\xA0"), /*#__PURE__*/_react.default.createElement("td", {
|
|
504
|
+
id: "loyalty"
|
|
505
|
+
}, t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue))))), (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && !hideCartComments && /*#__PURE__*/_react.default.createElement("table", {
|
|
502
506
|
className: "comments"
|
|
503
507
|
}, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('COMMENTS', 'Comments'))), /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement(_styles.CommentContainer, null, /*#__PURE__*/_react.default.createElement(_Inputs.TextArea, {
|
|
504
508
|
defaultValue: cart === null || cart === void 0 ? void 0 : cart.comment,
|
|
@@ -18,7 +18,7 @@ var CartSticky = _styledComponents.default.div(_templateObject2 || (_templateObj
|
|
|
18
18
|
return isCartOnProductsList && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow-y: auto;\n max-height: 70vh;\n position: sticky;\n top: 20px;\n "])));
|
|
19
19
|
});
|
|
20
20
|
exports.CartSticky = CartSticky;
|
|
21
|
-
var OrderBill = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n flex-direction: column;\n padding: 10px 0px;\n background-color: ", ";\n table {\n width: 100%;\n font-size: 14px;\n\n td span {\n unicode-bidi: bidi-override;\n }\n\n tr td:nth-child(2) {\n text-align: right;\n ", "\n }\n\n .icon {\n display: flex;\n align-items: center;\n max-height: 25px;\n }\n }\n table.total {\n border-top: 1px solid #EAEAEA;\n padding-top: 10px;\n tr {\n td {\n font-weight: bold;\n color: ", ";\n font-size: 16px;\n }\n }\n }\n table.comments {\n margin-top: 20px;\n tr {\n td:nth-child(1) {\n font-weight: bold;\n }\n }\n textarea {\n width: 100%;\n box-sizing: border-box;\n border-radius: 7.6px;\n height: 77px;\n padding-right: 60px;\n }\n }\n table.spot {\n tr {\n td:nth-child(1) {\n font-weight: bold;\n }\n td:nth-child(2) {\n font-weight: bold;\n color: ", ";\n cursor: pointer;\n &:hover {\n text-decoration: underline;\n }\n }\n }\n }\n"])), function (isCheckout) {
|
|
21
|
+
var OrderBill = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n flex-direction: column;\n padding: 10px 0px;\n background-color: ", ";\n table {\n width: 100%;\n font-size: 14px;\n\n td span {\n unicode-bidi: bidi-override;\n }\n\n tr td:nth-child(2) {\n text-align: right;\n ", "\n }\n\n .icon {\n display: flex;\n align-items: center;\n max-height: 25px;\n }\n }\n table.total {\n border-top: 1px solid #EAEAEA;\n padding-top: 10px;\n tr {\n td {\n font-weight: bold;\n color: ", ";\n font-size: 16px;\n\n &#loyalty {\n font-weight: normal;\n font-size: 14px;\n }\n }\n }\n }\n table.comments {\n margin-top: 20px;\n tr {\n td:nth-child(1) {\n font-weight: bold;\n }\n }\n textarea {\n width: 100%;\n box-sizing: border-box;\n border-radius: 7.6px;\n height: 77px;\n padding-right: 60px;\n }\n }\n table.spot {\n tr {\n td:nth-child(1) {\n font-weight: bold;\n }\n td:nth-child(2) {\n font-weight: bold;\n color: ", ";\n cursor: pointer;\n &:hover {\n text-decoration: underline;\n }\n }\n }\n }\n"])), function (isCheckout) {
|
|
22
22
|
return isCheckout ? 'transparent' : '#FFF';
|
|
23
23
|
}, function (props) {
|
|
24
24
|
var _props$theme;
|
|
@@ -31,21 +31,23 @@ var _CartContent = require("../CartContent");
|
|
|
31
31
|
var _Select = require("../../styles/Select");
|
|
32
32
|
var _PlaceSpot = require("../PlaceSpot");
|
|
33
33
|
var _OrderContextUI = require("../OrderContextUI");
|
|
34
|
+
var _SignUpForm = require("../SignUpForm");
|
|
35
|
+
var _LoginForm = require("../LoginForm");
|
|
34
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
37
|
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); }
|
|
36
38
|
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; }
|
|
37
39
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
38
|
-
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; }
|
|
39
|
-
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; }
|
|
40
|
-
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; }
|
|
41
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
42
|
-
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); }
|
|
43
40
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
44
41
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
45
42
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
46
43
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
47
44
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
48
45
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
46
|
+
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; }
|
|
47
|
+
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
|
+
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; }
|
|
49
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
50
|
+
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); }
|
|
49
51
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
50
52
|
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."); }
|
|
51
53
|
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); }
|
|
@@ -60,12 +62,13 @@ var mapConfigs = {
|
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
64
|
var CheckoutUI = function CheckoutUI(props) {
|
|
63
|
-
var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _cartState$cart, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _instructionsOptions$2, _theme$checkout, _theme$checkout$compo, _theme$checkout$compo2, _theme$checkout$compo3, _theme$checkout$compo4, _theme$checkout2, _theme$checkout2$comp, _theme$checkout2$comp2, _theme$checkout3, _theme$checkout3$comp, _theme$checkout3$comp2, _theme$checkout3$comp3, _theme$checkout3$comp4, _theme$checkout4, _theme$checkout4$comp, _theme$checkout4$comp2, _validationFields$fie7, _validationFields$fie8, _validationFields$fie9, _businessDetails$busi3, _businessDetails$busi4, _theme$images, _theme$images$dummies, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi9, _businessDetails$busi10, _businessDetails$busi11, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _cart$business3, _cart$products2, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _validationFields$fie18, _validationFields$fie19, _validationFields$fie20, _validationFields$fie21, _validationFields$fie22, _validationFields$fie23, _customerState$user3;
|
|
65
|
+
var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _cardList$cards, _cartState$cart, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _instructionsOptions$2, _theme$checkout, _theme$checkout$compo, _theme$checkout$compo2, _theme$checkout$compo3, _theme$checkout$compo4, _theme$checkout2, _theme$checkout2$comp, _theme$checkout2$comp2, _theme$checkout3, _theme$checkout3$comp, _theme$checkout3$comp2, _theme$checkout3$comp3, _theme$checkout3$comp4, _theme$checkout4, _theme$checkout4$comp, _theme$checkout4$comp2, _validationFields$fie7, _validationFields$fie8, _validationFields$fie9, _businessDetails$busi3, _businessDetails$busi4, _theme$images, _theme$images$dummies, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi9, _businessDetails$busi10, _businessDetails$busi11, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _cart$business3, _cart$products2, _loyaltyPlansState$re, _loyaltyPlansState$re2, _loyaltyPlansState$re3, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _validationFields$fie18, _validationFields$fie19, _validationFields$fie20, _validationFields$fie21, _validationFields$fie22, _validationFields$fie23, _customerState$user3;
|
|
64
66
|
var cart = props.cart,
|
|
65
67
|
errors = props.errors,
|
|
66
68
|
placing = props.placing,
|
|
67
69
|
cartState = props.cartState,
|
|
68
70
|
useKioskApp = props.useKioskApp,
|
|
71
|
+
loyaltyPlansState = props.loyaltyPlansState,
|
|
69
72
|
businessDetails = props.businessDetails,
|
|
70
73
|
paymethodSelected = props.paymethodSelected,
|
|
71
74
|
handlePaymethodChange = props.handlePaymethodChange,
|
|
@@ -100,8 +103,9 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
100
103
|
_useUtils2 = _slicedToArray(_useUtils, 1),
|
|
101
104
|
parsePrice = _useUtils2[0].parsePrice;
|
|
102
105
|
var _useSession = (0, _orderingComponentsExternal.useSession)(),
|
|
103
|
-
_useSession2 = _slicedToArray(_useSession,
|
|
104
|
-
user = _useSession2[0].user
|
|
106
|
+
_useSession2 = _slicedToArray(_useSession, 2),
|
|
107
|
+
user = _useSession2[0].user,
|
|
108
|
+
login = _useSession2[1].login;
|
|
105
109
|
var _useConfig = (0, _orderingComponentsExternal.useConfig)(),
|
|
106
110
|
_useConfig2 = _slicedToArray(_useConfig, 1),
|
|
107
111
|
configs = _useConfig2[0].configs;
|
|
@@ -148,6 +152,21 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
148
152
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
149
153
|
isSuccess = _useState16[0],
|
|
150
154
|
setIsSuccess = _useState16[1];
|
|
155
|
+
var _useState17 = (0, _react.useState)({
|
|
156
|
+
login: false,
|
|
157
|
+
signup: false
|
|
158
|
+
}),
|
|
159
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
160
|
+
openModal = _useState18[0],
|
|
161
|
+
setOpenModal = _useState18[1];
|
|
162
|
+
var _useState19 = (0, _react.useState)(false),
|
|
163
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
164
|
+
allowedGuest = _useState20[0],
|
|
165
|
+
setAllowedGuest = _useState20[1];
|
|
166
|
+
var _useState21 = (0, _react.useState)([]),
|
|
167
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
168
|
+
cardList = _useState22[0],
|
|
169
|
+
setCardList = _useState22[1];
|
|
151
170
|
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 : [];
|
|
152
171
|
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;
|
|
153
172
|
var isWalletCashEnabled = ((_businessConfigs$find = businessConfigs.find(function (config) {
|
|
@@ -163,7 +182,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
163
182
|
var isGiftCardCart = !(cart !== null && cart !== void 0 && cart.business_id);
|
|
164
183
|
// const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
|
|
165
184
|
|
|
166
|
-
var isDisablePlaceOrderButton = !(cart !== null && cart !== void 0 && cart.valid) || !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 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) ||
|
|
185
|
+
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) === 'stripe' && (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) ||
|
|
167
186
|
// (((placeSpotTypes.includes(options?.type) && !cart?.place) && hasBusinessPlaces)) ||
|
|
168
187
|
options.type === 1 && (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.driver_tip) === 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.driver_tip) === null || _validationFields$fie6 === void 0 ? void 0 : _validationFields$fie6.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0;
|
|
169
188
|
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) || [];
|
|
@@ -182,7 +201,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
182
201
|
var hideCustomerDetails = theme === null || theme === void 0 ? void 0 : (_theme$checkout4 = theme.checkout) === null || _theme$checkout4 === void 0 ? void 0 : (_theme$checkout4$comp = _theme$checkout4.components) === null || _theme$checkout4$comp === void 0 ? void 0 : (_theme$checkout4$comp2 = _theme$checkout4$comp.customer) === null || _theme$checkout4$comp2 === void 0 ? void 0 : _theme$checkout4$comp2.hidden;
|
|
183
202
|
var driverTipsField = !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && options.type === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (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) && driverTipsOptions.length > 0 && !useKioskApp;
|
|
184
203
|
var handlePlaceOrder = function handlePlaceOrder() {
|
|
185
|
-
if (!userErrors.length && !(requiredFields !== null && requiredFields !== void 0 && requiredFields.length)) {
|
|
204
|
+
if (!userErrors.length && (!(requiredFields !== null && requiredFields !== void 0 && requiredFields.length) || allowedGuest)) {
|
|
186
205
|
var body = {};
|
|
187
206
|
if (behalfName) {
|
|
188
207
|
body.on_behalf_of = behalfName;
|
|
@@ -202,6 +221,14 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
202
221
|
});
|
|
203
222
|
setIsUserDetailsEdit(true);
|
|
204
223
|
};
|
|
224
|
+
var handlePlaceOrderAsGuest = function handlePlaceOrderAsGuest() {
|
|
225
|
+
setIsOpen(false);
|
|
226
|
+
var body = {};
|
|
227
|
+
if (behalfName) {
|
|
228
|
+
body.on_behalf_of = behalfName;
|
|
229
|
+
}
|
|
230
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, body);
|
|
231
|
+
};
|
|
205
232
|
var closeAlert = function closeAlert() {
|
|
206
233
|
setAlertState({
|
|
207
234
|
open: false,
|
|
@@ -241,6 +268,21 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
241
268
|
}
|
|
242
269
|
setUserErrors(errors);
|
|
243
270
|
};
|
|
271
|
+
var handleSuccessSignup = function handleSuccessSignup(user) {
|
|
272
|
+
var _user$session;
|
|
273
|
+
login({
|
|
274
|
+
user: user,
|
|
275
|
+
token: user === null || user === void 0 ? void 0 : (_user$session = user.session) === null || _user$session === void 0 ? void 0 : _user$session.access_token
|
|
276
|
+
});
|
|
277
|
+
setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
278
|
+
signup: false
|
|
279
|
+
}));
|
|
280
|
+
};
|
|
281
|
+
var handleSuccessLogin = function handleSuccessLogin(user) {
|
|
282
|
+
if (user) setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
283
|
+
login: false
|
|
284
|
+
}));
|
|
285
|
+
};
|
|
244
286
|
var handleScrollTo = function handleScrollTo() {
|
|
245
287
|
if (!(!paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2)) return;
|
|
246
288
|
var scrollElement = document.querySelector('.paymentsContainer');
|
|
@@ -291,7 +333,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
291
333
|
isCheckOut: true
|
|
292
334
|
}))), !cartState.loading && (cart === null || cart === void 0 ? void 0 : cart.status) === 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningMessage, null, /*#__PURE__*/_react.default.createElement(_VscWarning.default, null), /*#__PURE__*/_react.default.createElement("h1", null, t('CART_STATUS_PENDING_MESSAGE', 'Your order is being processed, please wait a little more. if you\'ve been waiting too long, please reload the page'))), /*#__PURE__*/_react.default.createElement("h2", {
|
|
293
335
|
className: "checkout-title"
|
|
294
|
-
}, t('CHECKOUT', 'Checkout')), !useKioskApp ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (cart === null || cart === void 0 ? void 0 : cart.business_id) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, businessDetails !== null && businessDetails !== void 0 && businessDetails.loading || cartState.loading ? /*#__PURE__*/_react.default.createElement("div", {
|
|
336
|
+
}, t('CHECKOUT', 'Checkout')), !useKioskApp ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (cart === null || cart === void 0 ? void 0 : cart.business_id) && !hideBusinessMap && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, businessDetails !== null && businessDetails !== void 0 && businessDetails.loading || cartState.loading ? /*#__PURE__*/_react.default.createElement("div", {
|
|
295
337
|
style: {
|
|
296
338
|
width: '100%',
|
|
297
339
|
marginBottom: '20px'
|
|
@@ -311,7 +353,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
311
353
|
apiKey: configs === null || configs === void 0 ? void 0 : (_configs$google_maps_ = configs.google_maps_api_key) === null || _configs$google_maps_ === void 0 ? void 0 : _configs$google_maps_.value,
|
|
312
354
|
mapConfigs: mapConfigs,
|
|
313
355
|
isCustomerMode: isCustomerMode
|
|
314
|
-
})), /*#__PURE__*/_react.default.createElement(_styles.UserDetailsContainer, null, /*#__PURE__*/_react.default.createElement(_styles.WrapperUserDetails, null, cartState.loading || isCustomerMode && !(customerState !== null && customerState !== void 0 && (_customerState$user = customerState.user) !== null && _customerState$user !== void 0 && _customerState$user.id) ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
356
|
+
})), !hideCustomerDetails && /*#__PURE__*/_react.default.createElement(_styles.UserDetailsContainer, null, /*#__PURE__*/_react.default.createElement(_styles.WrapperUserDetails, null, cartState.loading || isCustomerMode && !(customerState !== null && customerState !== void 0 && (_customerState$user = customerState.user) !== null && _customerState$user !== void 0 && _customerState$user.id) ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
315
357
|
height: 35,
|
|
316
358
|
style: {
|
|
317
359
|
marginBottom: '10px'
|
|
@@ -336,7 +378,28 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
336
378
|
style: {
|
|
337
379
|
marginBottom: '10px'
|
|
338
380
|
}
|
|
339
|
-
})) : /*#__PURE__*/_react.default.createElement(
|
|
381
|
+
})) : user !== null && user !== void 0 && user.guest_id && !allowedGuest ? /*#__PURE__*/_react.default.createElement(_styles.AuthButtonList, null, /*#__PURE__*/_react.default.createElement("h2", null, t('CUSTOMER_DETAILS', 'Customer details')), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
382
|
+
color: "primary",
|
|
383
|
+
onClick: function onClick() {
|
|
384
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
385
|
+
signup: true
|
|
386
|
+
}));
|
|
387
|
+
}
|
|
388
|
+
}, t('SIGN_UP', 'Sign up')), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
389
|
+
color: "primary",
|
|
390
|
+
outline: true,
|
|
391
|
+
onClick: function onClick() {
|
|
392
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
393
|
+
login: true
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
}, t('LOGIN', 'Login')), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
397
|
+
color: "black",
|
|
398
|
+
outline: true,
|
|
399
|
+
onClick: function onClick() {
|
|
400
|
+
return setAllowedGuest(true);
|
|
401
|
+
}
|
|
402
|
+
}, t('CONTINUE_AS_GUEST', 'Continue as guest'))) : /*#__PURE__*/_react.default.createElement(_UserDetails.UserDetails, {
|
|
340
403
|
isUserDetailsEdit: isUserDetailsEdit,
|
|
341
404
|
cartStatus: cart === null || cart === void 0 ? void 0 : cart.status,
|
|
342
405
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
@@ -348,7 +411,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
348
411
|
userId: isCustomerMode && (customerState === null || customerState === void 0 ? void 0 : (_customerState$user2 = customerState.user) === null || _customerState$user2 === void 0 ? void 0 : _customerState$user2.id),
|
|
349
412
|
isSuccess: isSuccess,
|
|
350
413
|
isCheckout: true
|
|
351
|
-
}))), (cart === null || cart === void 0 ? void 0 : cart.business_id) && /*#__PURE__*/_react.default.createElement(_styles.BusinessDetailsContainer, null, ((businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.loading) || cartState.loading) && !(businessDetails !== null && businessDetails !== void 0 && businessDetails.error) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
414
|
+
}))), (cart === null || cart === void 0 ? void 0 : cart.business_id) && !hideBusinessDetails && /*#__PURE__*/_react.default.createElement(_styles.BusinessDetailsContainer, null, ((businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.loading) || cartState.loading) && !(businessDetails !== null && businessDetails !== void 0 && businessDetails.error) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
352
415
|
height: 35,
|
|
353
416
|
style: {
|
|
354
417
|
marginBottom: '10px'
|
|
@@ -373,7 +436,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
373
436
|
style: {
|
|
374
437
|
marginBottom: '10px'
|
|
375
438
|
}
|
|
376
|
-
}))), !cartState.loading && (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business) && ((_Object$values = Object.values(businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business)) === null || _Object$values === void 0 ? void 0 : _Object$values.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi5 = businessDetails.business) === null || _businessDetails$busi5 === void 0 ? void 0 : _businessDetails$busi5.address), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi6 = businessDetails.business) === null || _businessDetails$busi6 === void 0 ? void 0 : _businessDetails$busi6.name), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi7 = businessDetails.business) === null || _businessDetails$busi7 === void 0 ? void 0 : _businessDetails$busi7.email), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi8 = businessDetails.business) === null || _businessDetails$busi8 === void 0 ? void 0 : _businessDetails$busi8.cellphone))), (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error) && (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$erro = businessDetails.error) === null || _businessDetails$erro === void 0 ? void 0 : _businessDetails$erro.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
|
|
439
|
+
}))), !cartState.loading && (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business) && ((_Object$values = Object.values(businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business)) === null || _Object$values === void 0 ? void 0 : _Object$values.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement("div", null, !hideBusinessAddress && /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi5 = businessDetails.business) === null || _businessDetails$busi5 === void 0 ? void 0 : _businessDetails$busi5.address), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi6 = businessDetails.business) === null || _businessDetails$busi6 === void 0 ? void 0 : _businessDetails$busi6.name), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi7 = businessDetails.business) === null || _businessDetails$busi7 === void 0 ? void 0 : _businessDetails$busi7.email), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi8 = businessDetails.business) === null || _businessDetails$busi8 === void 0 ? void 0 : _businessDetails$busi8.cellphone))), (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error) && (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$erro = businessDetails.error) === null || _businessDetails$erro === void 0 ? void 0 : _businessDetails$erro.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
|
|
377
440
|
content: (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$erro2 = businessDetails.error[0]) === null || _businessDetails$erro2 === void 0 ? void 0 : _businessDetails$erro2.message) || (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error[0])
|
|
378
441
|
}))), /*#__PURE__*/_react.default.createElement(_styles.CheckOutDivider, null)) : /*#__PURE__*/_react.default.createElement(_styles.WrapperActionsInput, null, /*#__PURE__*/_react.default.createElement("h1", null, t('WHATS_YOUR_NAME', "What's your name?")), /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
|
|
379
442
|
placeholder: t('WRITE_YOUR_NAME', 'Write your name'),
|
|
@@ -418,9 +481,11 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
418
481
|
isCustomerMode: isCustomerMode,
|
|
419
482
|
paySelected: paymethodSelected,
|
|
420
483
|
handlePlaceOrder: handlePlaceOrder,
|
|
421
|
-
onPlaceOrderClick: onPlaceOrderClick
|
|
484
|
+
onPlaceOrderClick: onPlaceOrderClick,
|
|
485
|
+
setCardList: setCardList
|
|
422
486
|
})), isWalletEnabled && !(businessDetails !== null && businessDetails !== void 0 && businessDetails.loading) && /*#__PURE__*/_react.default.createElement(_styles.WalletPaymentOptionContainer, null, /*#__PURE__*/_react.default.createElement(_PaymentOptionWallet.PaymentOptionWallet, {
|
|
423
487
|
cart: cart,
|
|
488
|
+
loyaltyPlansState: loyaltyPlansState,
|
|
424
489
|
businessConfigs: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi11 = businessDetails.business) === null || _businessDetails$busi11 === void 0 ? void 0 : _businessDetails$busi11.configs
|
|
425
490
|
})))), /*#__PURE__*/_react.default.createElement(_styles.WrapperRightContainer, null, !!(!isMultiDriverTips && driverTipsField) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
|
|
426
491
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
@@ -448,7 +513,12 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
448
513
|
cart: cart,
|
|
449
514
|
useKioskApp: useKioskApp,
|
|
450
515
|
isCheckout: true,
|
|
451
|
-
isProducts: (cart === null || cart === void 0 ? void 0 : (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0
|
|
516
|
+
isProducts: (cart === null || cart === void 0 ? void 0 : (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0,
|
|
517
|
+
viewString: "checkout",
|
|
518
|
+
businessConfigs: businessConfigs,
|
|
519
|
+
loyaltyRewardRate: (_loyaltyPlansState$re = loyaltyPlansState === null || loyaltyPlansState === void 0 ? void 0 : (_loyaltyPlansState$re2 = loyaltyPlansState.result) === null || _loyaltyPlansState$re2 === void 0 ? void 0 : (_loyaltyPlansState$re3 = _loyaltyPlansState$re2.find(function (loyal) {
|
|
520
|
+
return loyal.type === 'credit_point';
|
|
521
|
+
})) === null || _loyaltyPlansState$re3 === void 0 ? void 0 : _loyaltyPlansState$re3.accumulation_rate) !== null && _loyaltyPlansState$re !== void 0 ? _loyaltyPlansState$re : 0
|
|
452
522
|
})), !!(isMultiDriverTips && driverTipsField) && /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
|
|
453
523
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
454
524
|
driverTipsOptions: driverTipsOptions,
|
|
@@ -463,7 +533,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
463
533
|
onClick: function onClick() {
|
|
464
534
|
return handlePlaceOrder();
|
|
465
535
|
}
|
|
466
|
-
}, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.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) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')), options.type === 1 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie18 = validationFields.fields) === null || _validationFields$fie18 === void 0 ? void 0 : (_validationFields$fie19 = _validationFields$fie18.checkout) === null || _validationFields$fie19 === void 0 ? void 0 : (_validationFields$fie20 = _validationFields$fie19.driver_tip) === null || _validationFields$fie20 === void 0 ? void 0 : _validationFields$fie20.enabled) && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie21 = validationFields.fields) === null || _validationFields$fie21 === void 0 ? void 0 : (_validationFields$fie22 = _validationFields$fie21.checkout) === null || _validationFields$fie22 === void 0 ? void 0 : (_validationFields$fie23 = _validationFields$fie22.driver_tip) === null || _validationFields$fie23 === void 0 ? void 0 : _validationFields$fie23.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.'))), windowSize.width < 576 && !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.MobileWrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
536
|
+
}, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.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) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')), options.type === 1 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie18 = validationFields.fields) === null || _validationFields$fie18 === void 0 ? void 0 : (_validationFields$fie19 = _validationFields$fie18.checkout) === null || _validationFields$fie19 === void 0 ? void 0 : (_validationFields$fie20 = _validationFields$fie19.driver_tip) === null || _validationFields$fie20 === void 0 ? void 0 : _validationFields$fie20.enabled) && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie21 = validationFields.fields) === null || _validationFields$fie21 === void 0 ? void 0 : (_validationFields$fie22 = _validationFields$fie21.checkout) === null || _validationFields$fie22 === void 0 ? void 0 : (_validationFields$fie23 = _validationFields$fie22.driver_tip) === null || _validationFields$fie23 === void 0 ? void 0 : _validationFields$fie23.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')), !(cart !== null && cart !== void 0 && cart.valid_preorder) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.'))), windowSize.width < 576 && !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.MobileWrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
467
537
|
color: !(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) ? 'secundary' : 'primary',
|
|
468
538
|
disabled: isDisablePlaceOrderButton,
|
|
469
539
|
onClick: function onClick() {
|
|
@@ -503,10 +573,39 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
503
573
|
isCheckout: true,
|
|
504
574
|
isEdit: true,
|
|
505
575
|
isModal: true,
|
|
576
|
+
handlePlaceOrderAsGuest: handlePlaceOrderAsGuest,
|
|
506
577
|
onClose: function onClose() {
|
|
507
578
|
setIsOpen(false);
|
|
508
579
|
handlePlaceOrder();
|
|
509
580
|
}
|
|
581
|
+
})), /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
582
|
+
open: openModal.signup,
|
|
583
|
+
width: "760px",
|
|
584
|
+
padding: "30px",
|
|
585
|
+
onClose: function onClose() {
|
|
586
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
587
|
+
signup: false
|
|
588
|
+
}));
|
|
589
|
+
}
|
|
590
|
+
}, /*#__PURE__*/_react.default.createElement(_SignUpForm.SignUpForm, {
|
|
591
|
+
useLoginByCellphone: true,
|
|
592
|
+
useChekoutFileds: true,
|
|
593
|
+
handleSuccessSignup: handleSuccessSignup,
|
|
594
|
+
isPopup: true,
|
|
595
|
+
isGuest: true
|
|
596
|
+
})), /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
597
|
+
open: openModal.login,
|
|
598
|
+
width: "760px",
|
|
599
|
+
padding: "30px",
|
|
600
|
+
onClose: function onClose() {
|
|
601
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
602
|
+
login: false
|
|
603
|
+
}));
|
|
604
|
+
}
|
|
605
|
+
}, /*#__PURE__*/_react.default.createElement(_LoginForm.LoginForm, {
|
|
606
|
+
handleSuccessLogin: handleSuccessLogin,
|
|
607
|
+
isPopup: true,
|
|
608
|
+
isGuest: true
|
|
510
609
|
})));
|
|
511
610
|
};
|
|
512
611
|
var Checkout = function Checkout(props) {
|
|
@@ -531,37 +630,37 @@ var Checkout = function Checkout(props) {
|
|
|
531
630
|
var _useLanguage3 = (0, _orderingComponentsExternal.useLanguage)(),
|
|
532
631
|
_useLanguage4 = _slicedToArray(_useLanguage3, 2),
|
|
533
632
|
t = _useLanguage4[1];
|
|
534
|
-
var
|
|
633
|
+
var _useState23 = (0, _react.useState)({
|
|
535
634
|
loading: true,
|
|
536
635
|
error: null,
|
|
537
636
|
cart: null
|
|
538
637
|
}),
|
|
539
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
540
|
-
cartState = _useState18[0],
|
|
541
|
-
setCartState = _useState18[1];
|
|
542
|
-
var _useState19 = (0, _react.useState)(false),
|
|
543
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
544
|
-
openUpselling = _useState20[0],
|
|
545
|
-
setOpenUpselling = _useState20[1];
|
|
546
|
-
var _useState21 = (0, _react.useState)(false),
|
|
547
|
-
_useState22 = _slicedToArray(_useState21, 2),
|
|
548
|
-
canOpenUpselling = _useState22[0],
|
|
549
|
-
setCanOpenUpselling = _useState22[1];
|
|
550
|
-
var _useState23 = (0, _react.useState)(null),
|
|
551
638
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
var _useState25 = (0, _react.useState)(
|
|
555
|
-
open: false,
|
|
556
|
-
content: []
|
|
557
|
-
}),
|
|
639
|
+
cartState = _useState24[0],
|
|
640
|
+
setCartState = _useState24[1];
|
|
641
|
+
var _useState25 = (0, _react.useState)(false),
|
|
558
642
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
559
|
-
|
|
560
|
-
|
|
643
|
+
openUpselling = _useState26[0],
|
|
644
|
+
setOpenUpselling = _useState26[1];
|
|
561
645
|
var _useState27 = (0, _react.useState)(false),
|
|
562
646
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
563
|
-
|
|
564
|
-
|
|
647
|
+
canOpenUpselling = _useState28[0],
|
|
648
|
+
setCanOpenUpselling = _useState28[1];
|
|
649
|
+
var _useState29 = (0, _react.useState)(null),
|
|
650
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
651
|
+
currentCart = _useState30[0],
|
|
652
|
+
setCurrentCart = _useState30[1];
|
|
653
|
+
var _useState31 = (0, _react.useState)({
|
|
654
|
+
open: false,
|
|
655
|
+
content: []
|
|
656
|
+
}),
|
|
657
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
658
|
+
alertState = _useState32[0],
|
|
659
|
+
setAlertState = _useState32[1];
|
|
660
|
+
var _useState33 = (0, _react.useState)(false),
|
|
661
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
|
662
|
+
isResetPaymethod = _useState34[0],
|
|
663
|
+
setIsResetPaymethod = _useState34[1];
|
|
565
664
|
var cartsWithProducts = (orderState === null || orderState === void 0 ? void 0 : orderState.carts) && (((_Object$values2 = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.filter(function (cart) {
|
|
566
665
|
var _cart$products3;
|
|
567
666
|
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);
|
|
@@ -629,7 +728,8 @@ var Checkout = function Checkout(props) {
|
|
|
629
728
|
method: 'GET',
|
|
630
729
|
headers: {
|
|
631
730
|
'Content-Type': 'application/json',
|
|
632
|
-
Authorization: "Bearer ".concat(token)
|
|
731
|
+
Authorization: "Bearer ".concat(token),
|
|
732
|
+
'X-App-X': ordering.appId
|
|
633
733
|
}
|
|
634
734
|
});
|
|
635
735
|
case 12:
|