ordering-ui-external 1.9.3 → 1.9.5
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.ea0875b41af5b7f1d809.js → 0.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{1.ordering-ui.ea0875b41af5b7f1d809.js → 1.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{2.ordering-ui.ea0875b41af5b7f1d809.js → 2.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{4.ordering-ui.ea0875b41af5b7f1d809.js → 4.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{5.ordering-ui.ea0875b41af5b7f1d809.js → 5.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{6.ordering-ui.ea0875b41af5b7f1d809.js → 6.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{7.ordering-ui.ea0875b41af5b7f1d809.js → 7.ordering-ui.55652fab015bca672f9d.js} +1 -1
- package/_bundles/{7.ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt → 7.ordering-ui.55652fab015bca672f9d.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.ea0875b41af5b7f1d809.js → 8.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{9.ordering-ui.ea0875b41af5b7f1d809.js → 9.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/ordering-ui.55652fab015bca672f9d.js +2 -0
- package/_bundles/{ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt → ordering-ui.55652fab015bca672f9d.js.LICENSE.txt} +0 -0
- package/_modules/components/BusinessesListing/index.js +1 -3
- package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +17 -2
- package/_modules/components/VerticalOrdersLayout/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +14 -6
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +24 -60
- package/_modules/themes/five/src/components/Cart/index.js +52 -96
- package/_modules/themes/five/src/components/CartContent/index.js +25 -72
- package/_modules/themes/five/src/components/MultiCheckout/index.js +2 -3
- package/_modules/themes/five/src/components/MultiOrdersDetails/index.js +7 -1
- package/_modules/themes/five/src/components/OrdersOption/index.js +2 -1
- package/_modules/utils/index.js +136 -2
- package/package.json +2 -2
- package/src/components/BusinessesListing/index.js +1 -3
- package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +13 -2
- package/src/components/VerticalOrdersLayout/styles.js +8 -0
- package/src/themes/five/src/components/BusinessListingSearch/index.js +4 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +218 -261
- package/src/themes/five/src/components/Cart/index.js +44 -54
- package/src/themes/five/src/components/CartContent/index.js +23 -41
- package/src/themes/five/src/components/MultiCheckout/index.js +1 -7
- package/src/themes/five/src/components/MultiOrdersDetails/index.js +19 -13
- package/src/themes/five/src/components/OrdersOption/index.js +2 -1
- package/src/utils/index.js +35 -1
- package/template/app.js +178 -65
- package/template/components/ListenPageChanges/index.js +1 -1
- package/template/pages/MultiCart/index.js +6 -0
- package/_bundles/ordering-ui.ea0875b41af5b7f1d809.js +0 -2
|
File without changes
|
|
@@ -140,9 +140,7 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
140
140
|
}
|
|
141
141
|
}, [mapErrors]);
|
|
142
142
|
(0, _react.useEffect)(function () {
|
|
143
|
-
if (orderState.loading
|
|
144
|
-
// const newurl = window.location.protocol + '//' + window.location.host + window.location.pathname
|
|
145
|
-
// window.history.pushState({ path: newurl }, '', newurl)
|
|
143
|
+
if (orderState.loading || businessesList.loading) {
|
|
146
144
|
var params = new URLSearchParams();
|
|
147
145
|
history.replace({
|
|
148
146
|
pathname: location.pathname,
|
|
@@ -33,7 +33,9 @@ var SingleOrderCardUI = function SingleOrderCardUI(props) {
|
|
|
33
33
|
reorderLoading = props.reorderLoading,
|
|
34
34
|
orderID = props.orderID,
|
|
35
35
|
handleFavoriteOrder = props.handleFavoriteOrder,
|
|
36
|
-
setOrderSelected = props.setOrderSelected
|
|
36
|
+
setOrderSelected = props.setOrderSelected,
|
|
37
|
+
onRedirectPage = props.onRedirectPage,
|
|
38
|
+
customArray = props.customArray;
|
|
37
39
|
var theme = (0, _styledComponents.useTheme)();
|
|
38
40
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
39
41
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -44,9 +46,22 @@ var SingleOrderCardUI = function SingleOrderCardUI(props) {
|
|
|
44
46
|
var handleChangeFavorite = function handleChangeFavorite(order) {
|
|
45
47
|
handleFavoriteOrder && handleFavoriteOrder(!(order !== null && order !== void 0 && order.favorite));
|
|
46
48
|
};
|
|
49
|
+
var handleClickCard = function handleClickCard(e, order) {
|
|
50
|
+
var _order$cart_group_id;
|
|
51
|
+
if (e.target.closest('.favorite') || e.target.closest('.review') || e.target.closest('.reorder')) return;
|
|
52
|
+
var params = _defineProperty({}, customArray ? 'cartUuid' : 'orderId', customArray ? order.uuid : (_order$cart_group_id = order === null || order === void 0 ? void 0 : order.cart_group_id) !== null && _order$cart_group_id !== void 0 ? _order$cart_group_id : order.uuid);
|
|
53
|
+
var page = customArray ? 'checkout' : order !== null && order !== void 0 && order.cart_group_id ? 'multi_orders' : 'order_detail';
|
|
54
|
+
onRedirectPage({
|
|
55
|
+
page: page,
|
|
56
|
+
params: params
|
|
57
|
+
});
|
|
58
|
+
};
|
|
47
59
|
return /*#__PURE__*/_react.default.createElement(_styles2.SingleCard, {
|
|
48
60
|
key: order.id,
|
|
49
|
-
id: "order-card"
|
|
61
|
+
id: "order-card",
|
|
62
|
+
onClick: function onClick(e) {
|
|
63
|
+
return handleClickCard(e, order);
|
|
64
|
+
}
|
|
50
65
|
}, /*#__PURE__*/_react.default.createElement(_styles2.OrderPastContent, null, (((_order$business = order.business) === null || _order$business === void 0 ? void 0 : _order$business.logo) || ((_theme$images = theme.images) === null || _theme$images === void 0 ? void 0 : (_theme$images$dummies = _theme$images.dummies) === null || _theme$images$dummies === void 0 ? void 0 : _theme$images$dummies.businessLogo)) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (order === null || order === void 0 ? void 0 : (_order$business2 = order.business) === null || _order$business2 === void 0 ? void 0 : _order$business2.length) > 1 ? /*#__PURE__*/_react.default.createElement(_styles2.MultiLogosContainer, null, order === null || order === void 0 ? void 0 : (_order$business3 = order.business) === null || _order$business3 === void 0 ? void 0 : _order$business3.map(function (business, i) {
|
|
51
66
|
var _theme$images2, _theme$images2$dummie;
|
|
52
67
|
return i < 2 && /*#__PURE__*/_react.default.createElement(_styles2.PastLogo, {
|
|
@@ -11,7 +11,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
11
11
|
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); }
|
|
12
12
|
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
13
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
14
|
-
var SingleCard = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n max-height: 100px;\n height: auto;\n border-bottom: 1px solid #F5F6F6;\n\n ", "\n\n @media(min-width: 480px){\n height: 140px;\n ", "\n }\n"])), function (props) {
|
|
14
|
+
var SingleCard = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n max-height: 100px;\n height: auto;\n border-radius: 16px;\n padding: 10px;\n transition: all 0.3s ease;\n border-bottom: 1px solid #F5F6F6;\n cursor: pointer;\n\n ", "\n\n @media(min-width: 480px){\n height: 140px;\n ", "\n }\n\n &:hover {\n box-shadow: rgb(0 0 0 / 20%) 0px 8px 24px;\n }\n"])), function (props) {
|
|
15
15
|
return (props.theme.colors.backgroundPage === '#FFF' || props.theme.colors.backgroundPage === '#FFFFFF') && (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: 15px;\n "])));
|
|
16
16
|
}, function (props) {
|
|
17
17
|
return (props.theme.colors.backgroundPage === '#FFF' || props.theme.colors.backgroundPage === '#FFFFFF') && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-top: none !important;\n "])));
|
|
@@ -47,7 +47,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
47
47
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
48
48
|
var PIXELS_TO_SCROLL = 300;
|
|
49
49
|
var BusinessListingSearchUI = function BusinessListingSearchUI(props) {
|
|
50
|
-
var _businessesSearchList, _sortItems$filter, _brandList$brands, _brandList$brands$fil, _orderState$options3, _orderState$options4, _orderState$options5, _businessesSearchList3, _businessesSearchList4, _businessesSearchList6, _curProduct$
|
|
50
|
+
var _businessesSearchList, _Object$values$find, _sortItems$filter, _brandList$brands, _brandList$brands$fil, _orderState$options3, _orderState$options4, _orderState$options5, _businessesSearchList3, _businessesSearchList4, _businessesSearchList6, _curProduct$business2, _curProduct$business3, _curProduct$product, _curProduct$product2, _currentCart$products;
|
|
51
51
|
var businessesSearchList = props.businessesSearchList,
|
|
52
52
|
onBusinessClick = props.onBusinessClick,
|
|
53
53
|
handleChangeFilters = props.handleChangeFilters,
|
|
@@ -117,6 +117,10 @@ var BusinessListingSearchUI = function BusinessListingSearchUI(props) {
|
|
|
117
117
|
content: '$$$$$'
|
|
118
118
|
}];
|
|
119
119
|
var noResults = !businessesSearchList.loading && !businessesSearchList.lengthError && (businessesSearchList === null || businessesSearchList === void 0 ? void 0 : (_businessesSearchList = businessesSearchList.businesses) === null || _businessesSearchList === void 0 ? void 0 : _businessesSearchList.length) === 0;
|
|
120
|
+
var currentCart = (_Object$values$find = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts).find(function (cart) {
|
|
121
|
+
var _cart$business, _curProduct$business;
|
|
122
|
+
return (cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.slug) === (curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$business = curProduct.business) === null || _curProduct$business === void 0 ? void 0 : _curProduct$business.slug);
|
|
123
|
+
})) !== null && _Object$values$find !== void 0 ? _Object$values$find : {};
|
|
120
124
|
var handleScroll = (0, _react.useCallback)(function () {
|
|
121
125
|
var _document$documentEle, _document$documentEle2, _businessesSearchList2;
|
|
122
126
|
var innerHeightScrolltop = window.innerHeight + ((_document$documentEle = document.documentElement) === null || _document$documentEle === void 0 ? void 0 : _document$documentEle.scrollTop) + PIXELS_TO_SCROLL;
|
|
@@ -346,16 +350,20 @@ var BusinessListingSearchUI = function BusinessListingSearchUI(props) {
|
|
|
346
350
|
isProductForm: true,
|
|
347
351
|
disableOverflowX: true
|
|
348
352
|
}, !!(curProduct !== null && curProduct !== void 0 && curProduct.product) && /*#__PURE__*/_react.default.createElement(_ProductForm.ProductForm, {
|
|
349
|
-
businessSlug: curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$
|
|
353
|
+
businessSlug: curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$business2 = curProduct.business) === null || _curProduct$business2 === void 0 ? void 0 : _curProduct$business2.slug,
|
|
350
354
|
useKioskApp: props === null || props === void 0 ? void 0 : props.useKioskApp,
|
|
351
|
-
|
|
355
|
+
product: curProduct === null || curProduct === void 0 ? void 0 : curProduct.product,
|
|
356
|
+
businessId: curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$business3 = curProduct.business) === null || _curProduct$business3 === void 0 ? void 0 : _curProduct$business3.id,
|
|
352
357
|
categoryId: curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$product = curProduct.product) === null || _curProduct$product === void 0 ? void 0 : _curProduct$product.category_id,
|
|
353
358
|
productId: curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$product2 = curProduct.product) === null || _curProduct$product2 === void 0 ? void 0 : _curProduct$product2.id,
|
|
354
359
|
onSave: handleRedirectToCart,
|
|
355
360
|
handleUpdateProducts: function handleUpdateProducts(productId, changes) {
|
|
356
|
-
var _curProduct$product3, _curProduct$
|
|
357
|
-
return _handleUpdateProducts(productId, curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$product3 = curProduct.product) === null || _curProduct$product3 === void 0 ? void 0 : _curProduct$product3.category_id, curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$
|
|
358
|
-
}
|
|
361
|
+
var _curProduct$product3, _curProduct$business4;
|
|
362
|
+
return _handleUpdateProducts(productId, curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$product3 = curProduct.product) === null || _curProduct$product3 === void 0 ? void 0 : _curProduct$product3.category_id, curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$business4 = curProduct.business) === null || _curProduct$business4 === void 0 ? void 0 : _curProduct$business4.id, changes);
|
|
363
|
+
},
|
|
364
|
+
productAddedToCartLength: (currentCart === null || currentCart === void 0 ? void 0 : (_currentCart$products = currentCart.products) === null || _currentCart$products === void 0 ? void 0 : _currentCart$products.reduce(function (productsLength, Cproduct) {
|
|
365
|
+
return productsLength + ((Cproduct === null || Cproduct === void 0 ? void 0 : Cproduct.id) === (curProduct === null || curProduct === void 0 ? void 0 : curProduct.id) ? Cproduct === null || Cproduct === void 0 ? void 0 : Cproduct.quantity : 0);
|
|
366
|
+
}, 0)) || 0
|
|
359
367
|
})));
|
|
360
368
|
};
|
|
361
369
|
exports.BusinessListingSearchUI = BusinessListingSearchUI;
|
|
@@ -29,10 +29,10 @@ var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skelet
|
|
|
29
29
|
var _AutoScroll = require("../../../AutoScroll");
|
|
30
30
|
var _CitiesControl = require("../../../CitiesControl");
|
|
31
31
|
var _OrderContextUI = require("../../../OrderContextUI");
|
|
32
|
+
var _OrdersSection = require("./OrdersSection");
|
|
32
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
34
|
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); }
|
|
34
35
|
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; }
|
|
35
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
36
36
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
37
|
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."); }
|
|
38
38
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -50,7 +50,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
50
50
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
51
51
|
var PIXELS_TO_SCROLL = 300;
|
|
52
52
|
var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
53
|
-
var _ref, _theme$business_listi, _theme$business_listi2, _theme$business_listi3, _orderState$options, _theme$business_listi4, _theme$business_listi5, _theme$business_listi6, _theme$business_listi7, _theme$business_listi8, _theme$business_listi9, _theme$business_listi10, _theme$business_listi11, _theme$business_listi12, _businessesList$busin, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _businessesList$busin3,
|
|
53
|
+
var _ref, _theme$business_listi, _theme$business_listi2, _theme$business_listi3, _orderState$options, _theme$business_listi4, _theme$business_listi5, _theme$business_listi6, _theme$business_listi7, _theme$business_listi8, _theme$business_listi9, _theme$business_listi10, _theme$business_listi11, _theme$business_listi12, _theme$business_listi13, _theme$business_listi14, _theme$business_listi15, _theme$business_listi16, _theme$business_listi17, _theme$business_listi18, _theme$business_listi19, _theme$business_listi20, _theme$business_listi21, _businessesList$busin, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _businessesList$busin3, _configs$business_lis, _configs$business_lis2, _theme$images2, _theme$images2$genera, _theme$business_listi22, _theme$business_listi23, _theme$business_listi24, _theme$business_listi25, _Object$values, _configs$business_lis3, _theme$images3, _theme$images3$genera, _theme$business_listi26, _theme$business_listi27, _theme$business_listi28, _theme$business_listi29, _citiesState$cities2, _citiesState$cities3, _citiesState$cities3$, _configs$advanced_bus, _orderState$options4, _orderState$options4$, _configs$advanced_bus2, _orderState$options5, _orderState$options5$, _businessesList$busin6, _businessesList$busin7;
|
|
54
54
|
var businessesList = props.businessesList,
|
|
55
55
|
paginationProps = props.paginationProps,
|
|
56
56
|
searchValue = props.searchValue,
|
|
@@ -128,9 +128,12 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
128
128
|
var hideCities = (_ref = (theme === null || theme === void 0 ? void 0 : (_theme$business_listi = theme.business_listing_view) === null || _theme$business_listi === void 0 ? void 0 : (_theme$business_listi2 = _theme$business_listi.components) === null || _theme$business_listi2 === void 0 ? void 0 : (_theme$business_listi3 = _theme$business_listi2.cities) === null || _theme$business_listi3 === void 0 ? void 0 : _theme$business_listi3.hidden) || (orderState === null || orderState === void 0 ? void 0 : (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) !== 2) !== null && _ref !== void 0 ? _ref : true;
|
|
129
129
|
var hideSearch = theme === null || theme === void 0 ? void 0 : (_theme$business_listi4 = theme.business_listing_view) === null || _theme$business_listi4 === void 0 ? void 0 : (_theme$business_listi5 = _theme$business_listi4.components) === null || _theme$business_listi5 === void 0 ? void 0 : (_theme$business_listi6 = _theme$business_listi5.search) === null || _theme$business_listi6 === void 0 ? void 0 : _theme$business_listi6.hidden;
|
|
130
130
|
var hideFilter = (theme === null || theme === void 0 ? void 0 : (_theme$business_listi7 = theme.business_listing_view) === null || _theme$business_listi7 === void 0 ? void 0 : (_theme$business_listi8 = _theme$business_listi7.components) === null || _theme$business_listi8 === void 0 ? void 0 : (_theme$business_listi9 = _theme$business_listi8.filter) === null || _theme$business_listi9 === void 0 ? void 0 : _theme$business_listi9.hidden) || hideSearch;
|
|
131
|
+
var hideHero = theme === null || theme === void 0 ? void 0 : (_theme$business_listi10 = theme.business_listing_view) === null || _theme$business_listi10 === void 0 ? void 0 : (_theme$business_listi11 = _theme$business_listi10.components) === null || _theme$business_listi11 === void 0 ? void 0 : (_theme$business_listi12 = _theme$business_listi11.business_hero) === null || _theme$business_listi12 === void 0 ? void 0 : _theme$business_listi12.hidden;
|
|
132
|
+
var hidePreviousOrders = theme === null || theme === void 0 ? void 0 : (_theme$business_listi13 = theme.business_listing_view) === null || _theme$business_listi13 === void 0 ? void 0 : (_theme$business_listi14 = _theme$business_listi13.components) === null || _theme$business_listi14 === void 0 ? void 0 : (_theme$business_listi15 = _theme$business_listi14.previous_orders_block) === null || _theme$business_listi15 === void 0 ? void 0 : _theme$business_listi15.hidden;
|
|
133
|
+
var hideHighestBusiness = theme === null || theme === void 0 ? void 0 : (_theme$business_listi16 = theme.business_listing_view) === null || _theme$business_listi16 === void 0 ? void 0 : (_theme$business_listi17 = _theme$business_listi16.components) === null || _theme$business_listi17 === void 0 ? void 0 : (_theme$business_listi18 = _theme$business_listi17.highest_rated_business_block) === null || _theme$business_listi18 === void 0 ? void 0 : _theme$business_listi18.hidden;
|
|
131
134
|
var hideSearchSection = hideCities && hideSearch && hideFilter;
|
|
132
|
-
var isAllCategoriesHidden = theme === null || theme === void 0 ? void 0 : (_theme$
|
|
133
|
-
var businessesIds =
|
|
135
|
+
var isAllCategoriesHidden = theme === null || theme === void 0 ? void 0 : (_theme$business_listi19 = theme.business_listing_view) === null || _theme$business_listi19 === void 0 ? void 0 : (_theme$business_listi20 = _theme$business_listi19.components) === null || _theme$business_listi20 === void 0 ? void 0 : (_theme$business_listi21 = _theme$business_listi20.categories) === null || _theme$business_listi21 === void 0 ? void 0 : _theme$business_listi21.hidden;
|
|
136
|
+
var businessesIds = businessesList.businesses && ((_businessesList$busin = businessesList.businesses) === null || _businessesList$busin === void 0 ? void 0 : _businessesList$busin.map(function (business) {
|
|
134
137
|
return business.id;
|
|
135
138
|
}));
|
|
136
139
|
var isChew = (orderingTheme === null || orderingTheme === void 0 ? void 0 : (_orderingTheme$theme = orderingTheme.theme) === null || _orderingTheme$theme === void 0 ? void 0 : (_orderingTheme$theme$ = _orderingTheme$theme.header) === null || _orderingTheme$theme$ === void 0 ? void 0 : (_orderingTheme$theme$2 = _orderingTheme$theme$.components) === null || _orderingTheme$theme$2 === void 0 ? void 0 : (_orderingTheme$theme$3 = _orderingTheme$theme$2.layout) === null || _orderingTheme$theme$3 === void 0 ? void 0 : (_orderingTheme$theme$4 = _orderingTheme$theme$3.type) === null || _orderingTheme$theme$4 === void 0 ? void 0 : _orderingTheme$theme$4.toLowerCase()) === 'chew';
|
|
@@ -216,36 +219,6 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
216
219
|
});
|
|
217
220
|
setFavoriteIds(_toConsumableArray(new Set(ids)));
|
|
218
221
|
}, [businessesList === null || businessesList === void 0 ? void 0 : (_businessesList$busin3 = businessesList.businesses) === null || _businessesList$busin3 === void 0 ? void 0 : _businessesList$busin3.length]);
|
|
219
|
-
var OrdersSection = function OrdersSection(_ref2) {
|
|
220
|
-
var _getCustomArray;
|
|
221
|
-
var titleContent = _ref2.titleContent;
|
|
222
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isCustomLayout && onRedirectPage && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_OrdersOption.OrdersOption, {
|
|
223
|
-
horizontal: true,
|
|
224
|
-
isBusinessesPage: true,
|
|
225
|
-
onRedirectPage: onRedirectPage,
|
|
226
|
-
titleContent: t('CARTS', 'Carts'),
|
|
227
|
-
businessesIds: businessesIds,
|
|
228
|
-
customArray: (_getCustomArray = getCustomArray(orderState.carts)) === null || _getCustomArray === void 0 ? void 0 : _getCustomArray.filter(function (cart) {
|
|
229
|
-
return cart.products.length > 0;
|
|
230
|
-
}),
|
|
231
|
-
isCustomLayout: true,
|
|
232
|
-
isBusinessesLoading: businessesList.loading,
|
|
233
|
-
isCustomerMode: isCustomerMode,
|
|
234
|
-
franchiseId: props.franchiseId
|
|
235
|
-
}), /*#__PURE__*/_react.default.createElement(_OrdersOption.OrdersOption, {
|
|
236
|
-
horizontal: true,
|
|
237
|
-
asDashboard: true,
|
|
238
|
-
isBusinessesPage: true,
|
|
239
|
-
businessesIds: businessesIds,
|
|
240
|
-
onRedirectPage: onRedirectPage,
|
|
241
|
-
userCustomerId: userCustomer === null || userCustomer === void 0 ? void 0 : userCustomer.id,
|
|
242
|
-
isCustomLayout: true,
|
|
243
|
-
titleContent: titleContent,
|
|
244
|
-
isBusinessesLoading: businessesList.loading,
|
|
245
|
-
isCustomerMode: isCustomerMode,
|
|
246
|
-
franchiseId: props.franchiseId
|
|
247
|
-
})));
|
|
248
|
-
};
|
|
249
222
|
if (logosLayout) {
|
|
250
223
|
var _businessesList$busin4, _businessesList$busin5;
|
|
251
224
|
return /*#__PURE__*/_react.default.createElement(_styles.BusinessLogosWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.BusinessLogosContainer, null, /*#__PURE__*/_react.default.createElement(_AutoScroll.AutoScroll, {
|
|
@@ -268,19 +241,11 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
268
241
|
});
|
|
269
242
|
})))));
|
|
270
243
|
}
|
|
271
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
272
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
273
|
-
key: i
|
|
274
|
-
}, BeforeElement);
|
|
275
|
-
}), (_props$beforeComponen = props.beforeComponents) === null || _props$beforeComponen === void 0 ? void 0 : _props$beforeComponen.map(function (BeforeComponent, i) {
|
|
276
|
-
return /*#__PURE__*/_react.default.createElement(BeforeComponent, _extends({
|
|
277
|
-
key: i
|
|
278
|
-
}, props));
|
|
279
|
-
}), /*#__PURE__*/_react.default.createElement(_styles.BusinessContainer, null, (windowSize.width < 576 || (configs === null || configs === void 0 ? void 0 : (_configs$business_lis = configs.business_listing_hide_image) === null || _configs$business_lis === void 0 ? void 0 : _configs$business_lis.value) !== '1' && !isChew) && /*#__PURE__*/_react.default.createElement(_styles.BusinessBanner, null, windowSize.width < 576 && /*#__PURE__*/_react.default.createElement(_OrderContextUI.OrderContextUI, {
|
|
244
|
+
return /*#__PURE__*/_react.default.createElement(_styles.BusinessContainer, null, (windowSize.width < 576 || (configs === null || configs === void 0 ? void 0 : (_configs$business_lis = configs.business_listing_hide_image) === null || _configs$business_lis === void 0 ? void 0 : _configs$business_lis.value) !== '1' && !isChew) && /*#__PURE__*/_react.default.createElement(_styles.BusinessBanner, null, windowSize.width < 576 && /*#__PURE__*/_react.default.createElement(_OrderContextUI.OrderContextUI, {
|
|
280
245
|
isBusinessList: true
|
|
281
|
-
}), (configs === null || configs === void 0 ? void 0 : (_configs$business_lis2 = configs.business_listing_hide_image) === null || _configs$business_lis2 === void 0 ? void 0 : _configs$business_lis2.value) !== '1' && !isChew && /*#__PURE__*/_react.default.createElement(_styles.BusinessHeroImg, {
|
|
246
|
+
}), (configs === null || configs === void 0 ? void 0 : (_configs$business_lis2 = configs.business_listing_hide_image) === null || _configs$business_lis2 === void 0 ? void 0 : _configs$business_lis2.value) !== '1' && !isChew && !hideHero && /*#__PURE__*/_react.default.createElement(_styles.BusinessHeroImg, {
|
|
282
247
|
bgimage: (_theme$images2 = theme.images) === null || _theme$images2 === void 0 ? void 0 : (_theme$images2$genera = _theme$images2.general) === null || _theme$images2$genera === void 0 ? void 0 : _theme$images2$genera.businessHero,
|
|
283
|
-
height: theme === null || theme === void 0 ? void 0 : (_theme$
|
|
248
|
+
height: theme === null || theme === void 0 ? void 0 : (_theme$business_listi22 = theme.business_listing_view) === null || _theme$business_listi22 === void 0 ? void 0 : (_theme$business_listi23 = _theme$business_listi22.components) === null || _theme$business_listi23 === void 0 ? void 0 : (_theme$business_listi24 = _theme$business_listi23.business_hero) === null || _theme$business_listi24 === void 0 ? void 0 : (_theme$business_listi25 = _theme$business_listi24.style) === null || _theme$business_listi25 === void 0 ? void 0 : _theme$business_listi25.height
|
|
284
249
|
})), !!((_Object$values = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) !== null && _Object$values !== void 0 && _Object$values.length) && /*#__PURE__*/_react.default.createElement(_OrderProgress.OrderProgress, {
|
|
285
250
|
isChew: isChew,
|
|
286
251
|
franchiseId: props.franchiseId,
|
|
@@ -289,9 +254,15 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
289
254
|
isCustomerMode: isCustomerMode
|
|
290
255
|
}), (configs === null || configs === void 0 ? void 0 : (_configs$business_lis3 = configs.business_listing_hide_image) === null || _configs$business_lis3 === void 0 ? void 0 : _configs$business_lis3.value) !== '1' && isChew && /*#__PURE__*/_react.default.createElement(_styles.BusinessHeroImg, {
|
|
291
256
|
bgimage: (_theme$images3 = theme.images) === null || _theme$images3 === void 0 ? void 0 : (_theme$images3$genera = _theme$images3.general) === null || _theme$images3$genera === void 0 ? void 0 : _theme$images3$genera.businessHero,
|
|
292
|
-
height: theme === null || theme === void 0 ? void 0 : (_theme$
|
|
293
|
-
}), isCustomerMode && /*#__PURE__*/_react.default.createElement(OrdersSection, {
|
|
294
|
-
titleContent: t('PREVIOUS_ORDERS', 'Previous orders')
|
|
257
|
+
height: theme === null || theme === void 0 ? void 0 : (_theme$business_listi26 = theme.business_listing_view) === null || _theme$business_listi26 === void 0 ? void 0 : (_theme$business_listi27 = _theme$business_listi26.components) === null || _theme$business_listi27 === void 0 ? void 0 : (_theme$business_listi28 = _theme$business_listi27.business_hero) === null || _theme$business_listi28 === void 0 ? void 0 : (_theme$business_listi29 = _theme$business_listi28.style) === null || _theme$business_listi29 === void 0 ? void 0 : _theme$business_listi29.height
|
|
258
|
+
}), isCustomerMode && !hidePreviousOrders && !businessesList.loading && /*#__PURE__*/_react.default.createElement(_OrdersSection.OrdersSection, {
|
|
259
|
+
titleContent: t('PREVIOUS_ORDERS', 'Previous orders'),
|
|
260
|
+
onRedirectPage: onRedirectPage,
|
|
261
|
+
businessesIds: businessesIds,
|
|
262
|
+
getCustomArray: getCustomArray,
|
|
263
|
+
businessesList: businessesList,
|
|
264
|
+
isCustomerMode: isCustomerMode,
|
|
265
|
+
userCustomer: userCustomer
|
|
295
266
|
}), !isCustomerMode && !hideSearchSection && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.WrapperSearch, {
|
|
296
267
|
isCustomLayout: isCustomLayout,
|
|
297
268
|
isCustomerMode: isCustomerMode
|
|
@@ -324,13 +295,14 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
324
295
|
businessList: businessesList.businesses,
|
|
325
296
|
userLocation: orderState === null || orderState === void 0 ? void 0 : (_orderState$options4 = orderState.options) === null || _orderState$options4 === void 0 ? void 0 : (_orderState$options4$ = _orderState$options4.address) === null || _orderState$options4$ === void 0 ? void 0 : _orderState$options4$.location,
|
|
326
297
|
setErrors: setMapErrors
|
|
327
|
-
})), !isChew && hasHighRatedBusiness && !props.franchiseId && /*#__PURE__*/_react.default.createElement(_styles.HightestRatedWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement(_HighestRated.HighestRated, {
|
|
298
|
+
})), !isChew && hasHighRatedBusiness && !props.franchiseId && !hideHighestBusiness && /*#__PURE__*/_react.default.createElement(_styles.HightestRatedWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement(_HighestRated.HighestRated, {
|
|
328
299
|
handleClickAddress: handleClickAddress,
|
|
329
300
|
setHasHighRatedBusiness: setHasHighRatedBusiness,
|
|
330
301
|
onBusinessClick: onBusinessClick,
|
|
331
302
|
isCustomerMode: isCustomerMode,
|
|
332
303
|
favoriteIds: favoriteIds,
|
|
333
|
-
setFavoriteIds: setFavoriteIds
|
|
304
|
+
setFavoriteIds: setFavoriteIds,
|
|
305
|
+
disabledCities: true
|
|
334
306
|
}), /*#__PURE__*/_react.default.createElement(_styles.Divider, null)), /*#__PURE__*/_react.default.createElement(_PageBanner.PageBanner, {
|
|
335
307
|
position: "web_business_listing"
|
|
336
308
|
}), (configs && (configs === null || configs === void 0 ? void 0 : configs.business_listing_categories) !== false || !isCustomLayout) && !isAllCategoriesHidden && /*#__PURE__*/_react.default.createElement(_BusinessTypeFilter.BusinessTypeFilter, {
|
|
@@ -361,7 +333,7 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
361
333
|
businessList: businessesList.businesses,
|
|
362
334
|
userLocation: orderState === null || orderState === void 0 ? void 0 : (_orderState$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : (_orderState$options5$ = _orderState$options5.address) === null || _orderState$options5$ === void 0 ? void 0 : _orderState$options5$.location,
|
|
363
335
|
setErrors: setMapErrors
|
|
364
|
-
}),
|
|
336
|
+
}), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (!isCustomLayout && isCustomerMode && (businessesList === null || businessesList === void 0 ? void 0 : (_businessesList$busin6 = businessesList.businesses) === null || _businessesList$busin6 === void 0 ? void 0 : _businessesList$busin6.length) > 0 || isChew) && /*#__PURE__*/_react.default.createElement(_styles.BusinessesTitle, null, t('BUSINESSES', 'Businesses')), /*#__PURE__*/_react.default.createElement(_styles.BusinessList, null, !businessesList.loading && businessesList.businesses.length === 0 && (businessesList === null || businessesList === void 0 ? void 0 : businessesList.fetched) && /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
|
|
365
337
|
content: t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')
|
|
366
338
|
}, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
367
339
|
outline: true,
|
|
@@ -397,7 +369,7 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
397
369
|
favoriteIds: favoriteIds,
|
|
398
370
|
setFavoriteIds: setFavoriteIds
|
|
399
371
|
});
|
|
400
|
-
}), businessesList.loading && _toConsumableArray(Array((paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.nextPageItems) > 4 ? paginationProps.nextPageItems : 8).keys()).map(function (i) {
|
|
372
|
+
}), (businessesList.loading || !(businessesList !== null && businessesList !== void 0 && businessesList.fetched)) && _toConsumableArray(Array((paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.nextPageItems) > 4 ? paginationProps.nextPageItems : 8).keys()).map(function (i) {
|
|
401
373
|
var _orderState$options7;
|
|
402
374
|
return /*#__PURE__*/_react.default.createElement(_BusinessController.BusinessController, {
|
|
403
375
|
key: i,
|
|
@@ -445,14 +417,6 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
445
417
|
return handleCloseAlerts();
|
|
446
418
|
},
|
|
447
419
|
closeOnBackdrop: false
|
|
448
|
-
})), (_props$afterComponent = props.afterComponents) === null || _props$afterComponent === void 0 ? void 0 : _props$afterComponent.map(function (AfterComponent, i) {
|
|
449
|
-
return /*#__PURE__*/_react.default.createElement(AfterComponent, _extends({
|
|
450
|
-
key: i
|
|
451
|
-
}, props));
|
|
452
|
-
}), (_props$afterElements = props.afterElements) === null || _props$afterElements === void 0 ? void 0 : _props$afterElements.map(function (AfterElement, i) {
|
|
453
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
454
|
-
key: i
|
|
455
|
-
}, AfterElement);
|
|
456
420
|
}));
|
|
457
421
|
};
|
|
458
422
|
var OriginalBusinessesListing = function OriginalBusinessesListing(props) {
|
|
@@ -20,7 +20,6 @@ var _useWindowSize = require("../../../../../hooks/useWindowSize");
|
|
|
20
20
|
var _TaxInformation = require("../TaxInformation");
|
|
21
21
|
var _Inputs = require("../../styles/Inputs");
|
|
22
22
|
var _SpinnerLoader = require("../../../../../components/SpinnerLoader");
|
|
23
|
-
var _CartStoresListing = require("../../../../franchise/src/components/CartStoresListing");
|
|
24
23
|
var _DriverTips = require("../DriverTips");
|
|
25
24
|
var _ServiceForm = require("../ServiceForm");
|
|
26
25
|
var _styles = require("./styles");
|
|
@@ -31,10 +30,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
31
30
|
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); }
|
|
32
31
|
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; }
|
|
33
32
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
34
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
35
|
-
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."); }
|
|
36
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
37
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
38
33
|
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
34
|
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
35
|
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; }
|
|
@@ -47,7 +42,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
47
42
|
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; } }
|
|
48
43
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
44
|
var CartUI = function CartUI(props) {
|
|
50
|
-
var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul,
|
|
45
|
+
var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul, _orderState$carts, _props$cart, _theme$viewString, _theme$viewString$com, _theme$viewString$com2, _theme$viewString$com3, _theme$viewString$com4, _theme$viewString2, _theme$viewString2$co, _theme$viewString2$co2, _theme$viewString2$co3, _theme$viewString2$co4, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers3$filter, _cart$offers4, _cart$offers4$filter, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes2, _cart$taxes3, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _cart$offers6$filter, _orderState$options, _cart$delivery_price_, _cart$offers7, _cart$offers8, _cart$offers8$filter, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options2, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _cart$business2, _cart$business3, _curProduct$calendar_, _openTaxModal$data, _openTaxModal$data2, _openTaxModal$data3, _openTaxModal$data4, _openTaxModal$data$fi, _openTaxModal$data5, _openTaxModal$data6, _props$afterComponent, _props$afterElements;
|
|
51
46
|
var currentCartUuid = props.currentCartUuid,
|
|
52
47
|
clearCart = props.clearCart,
|
|
53
48
|
isProducts = props.isProducts,
|
|
@@ -58,7 +53,6 @@ var CartUI = function CartUI(props) {
|
|
|
58
53
|
onClickCheckout = props.onClickCheckout,
|
|
59
54
|
isCheckout = props.isCheckout,
|
|
60
55
|
useKioskApp = props.useKioskApp,
|
|
61
|
-
isMultiCheckout = props.isMultiCheckout,
|
|
62
56
|
isCartPending = props.isCartPending,
|
|
63
57
|
isCartPopover = props.isCartPopover,
|
|
64
58
|
isForceOpenCart = props.isForceOpenCart,
|
|
@@ -89,9 +83,6 @@ var CartUI = function CartUI(props) {
|
|
|
89
83
|
parsePrice = _useUtils2$.parsePrice,
|
|
90
84
|
parseNumber = _useUtils2$.parseNumber,
|
|
91
85
|
parseDate = _useUtils2$.parseDate;
|
|
92
|
-
var _useOrderingTheme = (0, _orderingComponentsExternal.useOrderingTheme)(),
|
|
93
|
-
_useOrderingTheme2 = _slicedToArray(_useOrderingTheme, 1),
|
|
94
|
-
orderingTheme = _useOrderingTheme2[0];
|
|
95
86
|
var _useValidationFields = (0, _orderingComponentsExternal.useValidationFields)(),
|
|
96
87
|
_useValidationFields2 = _slicedToArray(_useValidationFields, 1),
|
|
97
88
|
validationFields = _useValidationFields2[0];
|
|
@@ -141,20 +132,15 @@ var CartUI = function CartUI(props) {
|
|
|
141
132
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
142
133
|
isUpselling = _useState14[0],
|
|
143
134
|
setIsUpselling = _useState14[1];
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
openChangeStore = _useState16[0],
|
|
147
|
-
setOpenChangeStore = _useState16[1];
|
|
135
|
+
// const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
136
|
+
|
|
148
137
|
var businessUrlTemplate = (site === null || site === void 0 ? void 0 : site.business_url_template) || '/store/:business_slug';
|
|
149
138
|
var isCouponEnabled = 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.coupon) === null || _validationFields$fie3 === void 0 ? void 0 : _validationFields$fie3.enabled;
|
|
150
|
-
var
|
|
151
|
-
var
|
|
152
|
-
var _cart$products;
|
|
153
|
-
return (cart === null || cart === void 0 ? void 0 : cart.products) && (cart === null || cart === void 0 ? void 0 : (_cart$products = cart.products) === null || _cart$products === void 0 ? void 0 : _cart$products.length) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (cart === null || cart === void 0 ? void 0 : cart.valid_schedule) && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.valid_maximum) && (cart === null || cart === void 0 ? void 0 : cart.valid_minimum) && !(cart !== null && cart !== void 0 && cart.wallets);
|
|
154
|
-
})) || null || [];
|
|
155
|
-
var cart = orderState === null || orderState === void 0 ? void 0 : (_orderState$carts = orderState.carts) === null || _orderState$carts === void 0 ? void 0 : _orderState$carts["businessId:".concat(props.cart.business_id)];
|
|
139
|
+
var isMultiCheckout = (configs === null || configs === void 0 ? void 0 : (_configs$checkout_mul = configs.checkout_multi_business_enabled) === null || _configs$checkout_mul === void 0 ? void 0 : _configs$checkout_mul.value) === '1';
|
|
140
|
+
var cart = cartMulticart || (orderState === null || orderState === void 0 ? void 0 : (_orderState$carts = orderState.carts) === null || _orderState$carts === void 0 ? void 0 : _orderState$carts["businessId:".concat((_props$cart = props.cart) === null || _props$cart === void 0 ? void 0 : _props$cart.business_id)]);
|
|
156
141
|
var viewString = isStore ? 'business_view' : 'header';
|
|
157
|
-
var hideCartComments =
|
|
142
|
+
var hideCartComments = theme === null || theme === void 0 ? void 0 : (_theme$viewString = theme[viewString]) === null || _theme$viewString === void 0 ? void 0 : (_theme$viewString$com = _theme$viewString.components) === null || _theme$viewString$com === void 0 ? void 0 : (_theme$viewString$com2 = _theme$viewString$com.cart) === null || _theme$viewString$com2 === void 0 ? void 0 : (_theme$viewString$com3 = _theme$viewString$com2.components) === null || _theme$viewString$com3 === void 0 ? void 0 : (_theme$viewString$com4 = _theme$viewString$com3.comments) === null || _theme$viewString$com4 === void 0 ? void 0 : _theme$viewString$com4.hidden;
|
|
143
|
+
var hideCartDiscount = theme === null || theme === void 0 ? void 0 : (_theme$viewString2 = theme[viewString]) === null || _theme$viewString2 === void 0 ? void 0 : (_theme$viewString2$co = _theme$viewString2.components) === null || _theme$viewString2$co === void 0 ? void 0 : (_theme$viewString2$co2 = _theme$viewString2$co.cart) === null || _theme$viewString2$co2 === void 0 ? void 0 : (_theme$viewString2$co3 = _theme$viewString2$co2.components) === null || _theme$viewString2$co3 === void 0 ? void 0 : (_theme$viewString2$co4 = _theme$viewString2$co3.discount) === null || _theme$viewString2$co4 === void 0 ? void 0 : _theme$viewString2$co4.hidden;
|
|
158
144
|
var walletName = {
|
|
159
145
|
cash: {
|
|
160
146
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
|
|
@@ -183,72 +169,37 @@ var CartUI = function CartUI(props) {
|
|
|
183
169
|
setModalIsOpen(true);
|
|
184
170
|
};
|
|
185
171
|
var handleClickCheckout = function handleClickCheckout() {
|
|
186
|
-
var
|
|
187
|
-
var
|
|
188
|
-
var cartFilterValidation = function cartFilterValidation(cart) {
|
|
172
|
+
var _Object$values;
|
|
173
|
+
var cartsAvailable = (_Object$values = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (cart) {
|
|
189
174
|
return (cart === null || cart === void 0 ? void 0 : cart.valid) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2;
|
|
190
|
-
};
|
|
191
|
-
var cartsGroupLength = cartSelectedHasGroup ? (_Object$values$filter = Object.values(orderState.carts).filter(function (_cart) {
|
|
192
|
-
var _cart$group2;
|
|
193
|
-
return (_cart === null || _cart === void 0 ? void 0 : (_cart$group2 = _cart.group) === null || _cart$group2 === void 0 ? void 0 : _cart$group2.uuid) === cartSelectedHasGroup && cartFilterValidation(_cart);
|
|
194
|
-
})) === null || _Object$values$filter === void 0 ? void 0 : _Object$values$filter.length : 0;
|
|
195
|
-
if (cartsGroupLength > 1 && checkoutMultiBusinessEnabled) {
|
|
196
|
-
var _cart$group3;
|
|
197
|
-
events.emit('go_to_page', {
|
|
198
|
-
page: 'multi_checkout',
|
|
199
|
-
params: {
|
|
200
|
-
cartUuid: cart === null || cart === void 0 ? void 0 : (_cart$group3 = cart.group) === null || _cart$group3 === void 0 ? void 0 : _cart$group3.uuid
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
events.emit('cart_popover_closed');
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
var cartGroupsCount = {};
|
|
207
|
-
// eslint-disable-next-line no-unused-expressions
|
|
208
|
-
(_Object$values$filter2 = Object.values(orderState.carts).filter(function (_cart) {
|
|
209
|
-
return cartFilterValidation(_cart);
|
|
210
|
-
})) === null || _Object$values$filter2 === void 0 ? void 0 : _Object$values$filter2.forEach(function (_cart) {
|
|
211
|
-
var _cart$group4;
|
|
212
|
-
if (cartGroupsCount[_cart === null || _cart === void 0 ? void 0 : (_cart$group4 = _cart.group) === null || _cart$group4 === void 0 ? void 0 : _cart$group4.uuid]) {
|
|
213
|
-
var _cart$group5;
|
|
214
|
-
cartGroupsCount[_cart === null || _cart === void 0 ? void 0 : (_cart$group5 = _cart.group) === null || _cart$group5 === void 0 ? void 0 : _cart$group5.uuid] += 1;
|
|
215
|
-
} else {
|
|
216
|
-
var _cart$group6;
|
|
217
|
-
cartGroupsCount[_cart === null || _cart === void 0 ? void 0 : (_cart$group6 = _cart.group) === null || _cart$group6 === void 0 ? void 0 : _cart$group6.uuid] = 1;
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
var groupForTheCart;
|
|
221
|
-
var groupForAddCartArray = Object.keys(cartGroupsCount).filter(function (cartGroupUuid) {
|
|
222
|
-
return cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5;
|
|
223
|
-
});
|
|
224
|
-
var max = Math.max.apply(Math, _toConsumableArray(groupForAddCartArray.map(function (uuid) {
|
|
225
|
-
return cartGroupsCount[uuid];
|
|
226
|
-
})));
|
|
227
|
-
var indexes = groupForAddCartArray.filter(function (uuid) {
|
|
228
|
-
return cartGroupsCount[uuid] === max;
|
|
229
175
|
});
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
return uuid !== 'undefined';
|
|
233
|
-
});
|
|
234
|
-
} else {
|
|
235
|
-
groupForTheCart = indexes[0];
|
|
236
|
-
}
|
|
237
|
-
if (checkoutMultiBusinessEnabled && (openCarts === null || openCarts === void 0 ? void 0 : openCarts.length) > 1 && groupForTheCart) {
|
|
176
|
+
if (cartsAvailable.length === 1) {
|
|
177
|
+
var _cartsAvailable$;
|
|
238
178
|
events.emit('go_to_page', {
|
|
239
|
-
page: '
|
|
179
|
+
page: 'checkout',
|
|
240
180
|
params: {
|
|
241
|
-
cartUuid:
|
|
242
|
-
cartGroup: groupForTheCart === 'undefined' ? 'create' : groupForTheCart
|
|
181
|
+
cartUuid: (_cartsAvailable$ = cartsAvailable[0]) === null || _cartsAvailable$ === void 0 ? void 0 : _cartsAvailable$.uuid
|
|
243
182
|
}
|
|
244
183
|
});
|
|
245
184
|
} else {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
185
|
+
var groupKeys = {};
|
|
186
|
+
cartsAvailable.forEach(function (_cart) {
|
|
187
|
+
var _cart$group, _cart$group2, _cart$group$uuid, _cart$group3;
|
|
188
|
+
groupKeys[_cart === null || _cart === void 0 ? void 0 : (_cart$group = _cart.group) === null || _cart$group === void 0 ? void 0 : _cart$group.uuid] ? groupKeys[_cart === null || _cart === void 0 ? void 0 : (_cart$group2 = _cart.group) === null || _cart$group2 === void 0 ? void 0 : _cart$group2.uuid] += 1 : groupKeys[(_cart$group$uuid = _cart === null || _cart === void 0 ? void 0 : (_cart$group3 = _cart.group) === null || _cart$group3 === void 0 ? void 0 : _cart$group3.uuid) !== null && _cart$group$uuid !== void 0 ? _cart$group$uuid : 'null'] = 1;
|
|
251
189
|
});
|
|
190
|
+
if (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null' || Object.keys(groupKeys).length > 1) {
|
|
191
|
+
events.emit('go_to_page', {
|
|
192
|
+
page: 'multi_cart'
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
var _cartsAvailable$2, _cartsAvailable$2$gro;
|
|
196
|
+
events.emit('go_to_page', {
|
|
197
|
+
page: 'multi_checkout',
|
|
198
|
+
params: {
|
|
199
|
+
cartUuid: (_cartsAvailable$2 = cartsAvailable[0]) === null || _cartsAvailable$2 === void 0 ? void 0 : (_cartsAvailable$2$gro = _cartsAvailable$2.group) === null || _cartsAvailable$2$gro === void 0 ? void 0 : _cartsAvailable$2$gro.uuid
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
252
203
|
}
|
|
253
204
|
events.emit('cart_popover_closed');
|
|
254
205
|
onClickCheckout && onClickCheckout();
|
|
@@ -306,7 +257,7 @@ var CartUI = function CartUI(props) {
|
|
|
306
257
|
};
|
|
307
258
|
var getIncludedTaxes = function getIncludedTaxes() {
|
|
308
259
|
if ((cart === null || cart === void 0 ? void 0 : cart.taxes) === null) {
|
|
309
|
-
return cart.business.tax_type === 1 ? cart === null || cart === void 0 ? void 0 : cart.tax : 0;
|
|
260
|
+
return (cart === null || cart === void 0 ? void 0 : cart.business.tax_type) === 1 ? cart === null || cart === void 0 ? void 0 : cart.tax : 0;
|
|
310
261
|
} else {
|
|
311
262
|
return cart === null || cart === void 0 ? void 0 : cart.taxes.reduce(function (taxIncluded, tax) {
|
|
312
263
|
var _tax$summary;
|
|
@@ -336,9 +287,11 @@ var CartUI = function CartUI(props) {
|
|
|
336
287
|
}
|
|
337
288
|
});
|
|
338
289
|
};
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
290
|
+
|
|
291
|
+
// const handleChangeStore = () => {
|
|
292
|
+
// setOpenChangeStore(true)
|
|
293
|
+
// }
|
|
294
|
+
|
|
342
295
|
(0, _react.useEffect)(function () {
|
|
343
296
|
if (isCustomMode) setIsUpselling(true);
|
|
344
297
|
}, [isCustomMode]);
|
|
@@ -374,14 +327,16 @@ var CartUI = function CartUI(props) {
|
|
|
374
327
|
total: cart === null || cart === void 0 ? void 0 : cart.total,
|
|
375
328
|
handleClickCheckout: handleClickCheckout,
|
|
376
329
|
checkoutButtonDisabled: openUpselling && !canOpenUpselling || !(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) || !(cart !== null && cart !== void 0 && cart.valid_address),
|
|
377
|
-
setPreorderBusiness: setPreorderBusiness
|
|
378
|
-
handleChangeStore
|
|
330
|
+
setPreorderBusiness: setPreorderBusiness
|
|
331
|
+
// handleChangeStore={!useKioskApp && handleChangeStore}
|
|
332
|
+
,
|
|
379
333
|
isMultiCheckout: isMultiCheckout
|
|
380
|
-
}, (cart === null || cart === void 0 ? void 0 : (_cart$
|
|
334
|
+
}, (cart === null || cart === void 0 ? void 0 : (_cart$products = cart.products) === null || _cart$products === void 0 ? void 0 : _cart$products.length) > 0 && (cart === null || cart === void 0 ? void 0 : cart.products.map(function (product) {
|
|
381
335
|
return /*#__PURE__*/_react.default.createElement(_ProductItemAccordion.ProductItemAccordion, {
|
|
382
336
|
key: product.code,
|
|
383
337
|
isCartPending: isCartPending,
|
|
384
338
|
isCartProduct: true,
|
|
339
|
+
isDisabledEdit: !(cart !== null && cart !== void 0 && cart.business_id),
|
|
385
340
|
product: product,
|
|
386
341
|
isCheckout: isCheckout,
|
|
387
342
|
changeQuantity: changeQuantity,
|
|
@@ -389,7 +344,8 @@ var CartUI = function CartUI(props) {
|
|
|
389
344
|
offsetDisabled: offsetDisabled,
|
|
390
345
|
onDeleteProduct: handleDeleteClick,
|
|
391
346
|
onEditProduct: handleEditProduct,
|
|
392
|
-
isStore: isStore
|
|
347
|
+
isStore: isStore,
|
|
348
|
+
viewString: viewString
|
|
393
349
|
});
|
|
394
350
|
})), !(cart !== null && cart !== void 0 && cart.valid_products) && /*#__PURE__*/_react.default.createElement(_styles.NoValidProductMessage, null, t('REMOVE_NOT_AVAILABLE_CART_PRODUCTS', 'To continue with your checkout, please remove from your cart the products that are not available.')), (cart === null || cart === void 0 ? void 0 : cart.valid_products) && /*#__PURE__*/_react.default.createElement(_styles.OrderBill, {
|
|
395
351
|
isCheckout: isCheckout
|
|
@@ -487,7 +443,7 @@ var CartUI = function CartUI(props) {
|
|
|
487
443
|
return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
|
|
488
444
|
}
|
|
489
445
|
}))), /*#__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)));
|
|
490
|
-
})), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price) > 0 && !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))), (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) {
|
|
446
|
+
})), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price) > 0 && !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$delivery_price_ = cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount) !== null && _cart$delivery_price_ !== void 0 ? _cart$delivery_price_ : cart === null || cart === void 0 ? void 0 : cart.delivery_price))), !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) {
|
|
491
447
|
return (offer === null || offer === void 0 ? void 0 : offer.target) === 2;
|
|
492
448
|
})) === null || _cart$offers8$filter === void 0 ? void 0 : _cart$offers8$filter.map(function (offer) {
|
|
493
449
|
var _offer$summary3;
|
|
@@ -512,9 +468,9 @@ var CartUI = function CartUI(props) {
|
|
|
512
468
|
return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
|
|
513
469
|
}
|
|
514
470
|
}))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 ? void 0 : (_offer$summary3 = offer.summary) === null || _offer$summary3 === void 0 ? void 0 : _offer$summary3.discount)));
|
|
515
|
-
})), (cart === null || cart === void 0 ? void 0 : cart.driver_tip) > 0 && !hideDriverTip && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DRIVER_TIP', 'Driver tip'), ' ', (cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate) > 0 && parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_t = configs.driver_tip_type) === null || _configs$driver_tip_t === void 0 ? void 0 : _configs$driver_tip_t.value, 10) === 2 && !parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_u = configs.driver_tip_use_custom) === null || _configs$driver_tip_u === void 0 ? void 0 : _configs$driver_tip_u.value, 10) && /*#__PURE__*/_react.default.createElement("span", null, "(".concat((0, _utils.verifyDecimals)(cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate, parseNumber), "%)"))), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.driver_tip))))), isCouponEnabled && !isCartPending && (isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover) && /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
|
|
516
|
-
businessId: cart.business_id,
|
|
517
|
-
price: cart.total
|
|
471
|
+
})), (cart === null || cart === void 0 ? void 0 : cart.driver_tip) > 0 && !hideDriverTip && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DRIVER_TIP', 'Driver tip'), ' ', (cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate) > 0 && parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_t = configs.driver_tip_type) === null || _configs$driver_tip_t === void 0 ? void 0 : _configs$driver_tip_t.value, 10) === 2 && !parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_u = configs.driver_tip_use_custom) === null || _configs$driver_tip_u === void 0 ? void 0 : _configs$driver_tip_u.value, 10) && /*#__PURE__*/_react.default.createElement("span", null, "(".concat((0, _utils.verifyDecimals)(cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate, parseNumber), "%)"))), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.driver_tip))))), isCouponEnabled && !isCartPending && (isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover) && !hideCartDiscount && /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
|
|
472
|
+
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
473
|
+
price: cart === null || cart === void 0 ? void 0 : cart.total
|
|
518
474
|
})), isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === void 0 ? void 0 : (_orderState$options2 = orderState.options) === null || _orderState$options2 === void 0 ? void 0 : _orderState$options2.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (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.enabled) && driverTipsOptions.length > 0 && !useKioskApp && /*#__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, {
|
|
519
475
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
520
476
|
driverTipsOptions: driverTipsOptions,
|
|
@@ -572,7 +528,7 @@ var CartUI = function CartUI(props) {
|
|
|
572
528
|
style: {
|
|
573
529
|
fontWeight: 'bold'
|
|
574
530
|
}
|
|
575
|
-
}, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), (onClickCheckout || isForceOpenCart) && !isCheckout && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && /*#__PURE__*/_react.default.createElement(_styles.CheckoutAction, null, /*#__PURE__*/_react.default.createElement("p", null, (cart === null || cart === void 0 ? void 0 : cart.total) >= 1 && parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
531
|
+
}, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), (onClickCheckout || isForceOpenCart) && !isCheckout && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (!isMultiCheckout || isStore) && /*#__PURE__*/_react.default.createElement(_styles.CheckoutAction, null, /*#__PURE__*/_react.default.createElement("p", null, (cart === null || cart === void 0 ? void 0 : cart.total) >= 1 && parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
576
532
|
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) || !(cart !== null && cart !== void 0 && cart.valid_address) ? 'secundary' : 'primary',
|
|
577
533
|
onClick: checkOutBtnClick,
|
|
578
534
|
disabled: openUpselling && !canOpenUpselling || !(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) || !(cart !== null && cart !== void 0 && cart.valid_address)
|
|
@@ -640,14 +596,14 @@ var CartUI = function CartUI(props) {
|
|
|
640
596
|
}, /*#__PURE__*/_react.default.createElement(_TaxInformation.TaxInformation, {
|
|
641
597
|
type: openTaxModal.type,
|
|
642
598
|
data: openTaxModal.data,
|
|
643
|
-
products: cart.products,
|
|
599
|
+
products: cart === null || cart === void 0 ? void 0 : cart.products,
|
|
644
600
|
useKioskApp: useKioskApp
|
|
645
601
|
})), (openUpselling || isUpselling) && /*#__PURE__*/_react.default.createElement(_UpsellingPage.UpsellingPage, {
|
|
646
602
|
useKioskApp: useKioskApp,
|
|
647
|
-
businessId: cart.business_id,
|
|
603
|
+
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
648
604
|
isCustomMode: isCustomMode,
|
|
649
|
-
cartProducts: cart.products,
|
|
650
|
-
business: cart.business,
|
|
605
|
+
cartProducts: cart === null || cart === void 0 ? void 0 : cart.products,
|
|
606
|
+
business: cart === null || cart === void 0 ? void 0 : cart.business,
|
|
651
607
|
handleUpsellingPage: handleUpsellingPage,
|
|
652
608
|
openUpselling: openUpselling,
|
|
653
609
|
canOpenUpselling: canOpenUpselling,
|