ordering-ui-external 5.0.1 → 5.0.3
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.dc2501dcf51ed5b7b821.js → 0.ordering-ui.72b67ac0e449c40276fb.js} +1 -1
- package/_bundles/{4.ordering-ui.dc2501dcf51ed5b7b821.js → 4.ordering-ui.72b67ac0e449c40276fb.js} +1 -1
- package/_bundles/{7.ordering-ui.dc2501dcf51ed5b7b821.js → 7.ordering-ui.72b67ac0e449c40276fb.js} +1 -1
- package/_bundles/ordering-ui.72b67ac0e449c40276fb.js +2 -0
- package/_modules/components/Checkout/index.js +12 -7
- package/_modules/components/PaymentOptions/index.js +7 -1
- package/_modules/themes/five/src/components/AddressForm/index.js +8 -9
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +2 -2
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +12 -1
- package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +2 -2
- package/_modules/themes/five/src/components/MultiCheckout/index.js +3 -2
- package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +1 -1
- package/_modules/themes/five/src/components/OrderDetails/index.js +1 -0
- package/_modules/themes/five/src/components/OrderTypeSelectorContent/index.js +11 -10
- package/package.json +2 -2
- package/src/components/Checkout/index.js +12 -6
- package/src/components/PaymentOptions/index.js +7 -1
- package/src/themes/five/src/components/AddressForm/index.js +6 -5
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +4 -4
- package/src/themes/five/src/components/BusinessProductsListing/index.js +12 -0
- package/src/themes/five/src/components/BusinessProductsListing/styles.js +3 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +3 -1
- package/src/themes/five/src/components/MultiCheckout/index.js +4 -1
- package/src/themes/five/src/components/OrderDetails/OrderHistory.js +6 -2
- package/src/themes/five/src/components/OrderDetails/index.js +1 -0
- package/src/themes/five/src/components/OrderTypeSelectorContent/index.js +2 -2
- package/template/pages/OrderDetails/index.js +1 -0
- package/_bundles/ordering-ui.dc2501dcf51ed5b7b821.js +0 -2
- /package/_bundles/{1.ordering-ui.dc2501dcf51ed5b7b821.js → 1.ordering-ui.72b67ac0e449c40276fb.js} +0 -0
- /package/_bundles/{2.ordering-ui.dc2501dcf51ed5b7b821.js → 2.ordering-ui.72b67ac0e449c40276fb.js} +0 -0
- /package/_bundles/{5.ordering-ui.dc2501dcf51ed5b7b821.js → 5.ordering-ui.72b67ac0e449c40276fb.js} +0 -0
- /package/_bundles/{6.ordering-ui.dc2501dcf51ed5b7b821.js → 6.ordering-ui.72b67ac0e449c40276fb.js} +0 -0
- /package/_bundles/{7.ordering-ui.dc2501dcf51ed5b7b821.js.LICENSE.txt → 7.ordering-ui.72b67ac0e449c40276fb.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.dc2501dcf51ed5b7b821.js → 8.ordering-ui.72b67ac0e449c40276fb.js} +0 -0
- /package/_bundles/{9.ordering-ui.dc2501dcf51ed5b7b821.js → 9.ordering-ui.72b67ac0e449c40276fb.js} +0 -0
- /package/_bundles/{ordering-ui.dc2501dcf51ed5b7b821.js.LICENSE.txt → ordering-ui.72b67ac0e449c40276fb.js.LICENSE.txt} +0 -0
|
@@ -133,12 +133,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
133
133
|
showOnSelected: t(option === null || option === void 0 ? void 0 : option.name.toUpperCase().replace(/\s/g, '_'), option === null || option === void 0 ? void 0 : option.name)
|
|
134
134
|
};
|
|
135
135
|
}));
|
|
136
|
-
var
|
|
137
|
-
setCreateOrder(true);
|
|
138
|
-
if (!userErrors.length) {
|
|
139
|
-
handlerClickPlaceOrder && handlerClickPlaceOrder();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
136
|
+
var handleCheckoutValidationError = function handleCheckoutValidationError() {
|
|
142
137
|
setAlertState({
|
|
143
138
|
open: true,
|
|
144
139
|
content: Object.values(userErrors).map(function (error) {
|
|
@@ -147,6 +142,14 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
147
142
|
});
|
|
148
143
|
setIsUserDetailsEdit(true);
|
|
149
144
|
};
|
|
145
|
+
var handlePlaceOrder = function handlePlaceOrder() {
|
|
146
|
+
if (!userErrors.length) {
|
|
147
|
+
setCreateOrder(true);
|
|
148
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
handleCheckoutValidationError();
|
|
152
|
+
};
|
|
150
153
|
var closeAlert = function closeAlert() {
|
|
151
154
|
setAlertState({
|
|
152
155
|
open: false,
|
|
@@ -385,7 +388,9 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
385
388
|
setCardData: setCardData,
|
|
386
389
|
handlePlaceOrder: handlePlaceOrder,
|
|
387
390
|
onPlaceOrderClick: onPlaceOrderClick,
|
|
388
|
-
setCreateOrder: setCreateOrder
|
|
391
|
+
setCreateOrder: setCreateOrder,
|
|
392
|
+
userErrors: userErrors,
|
|
393
|
+
handleCheckoutValidationError: handleCheckoutValidationError
|
|
389
394
|
})), (_props$beforeElements8 = props.beforeElementsSectionSix) === null || _props$beforeElements8 === void 0 ? void 0 : _props$beforeElements8.map(function (BeforeElement, i) {
|
|
390
395
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
391
396
|
key: i
|
|
@@ -102,7 +102,9 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
|
|
|
102
102
|
onPlaceOrderClick = props.onPlaceOrderClick,
|
|
103
103
|
setCreateOrder = props.setCreateOrder,
|
|
104
104
|
handlePlaceOrder = props.handlePlaceOrder,
|
|
105
|
-
paymethods = props.paymethods
|
|
105
|
+
paymethods = props.paymethods,
|
|
106
|
+
userErrors = props.userErrors,
|
|
107
|
+
handleCheckoutValidationError = props.handleCheckoutValidationError;
|
|
106
108
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
107
109
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
108
110
|
t = _useLanguage2[1];
|
|
@@ -133,6 +135,10 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
|
|
|
133
135
|
var stripeDirectMethods = ['stripe_direct'].concat(methodsPay);
|
|
134
136
|
var handlePaymentMethodClick = function handlePaymentMethodClick(paymethod) {
|
|
135
137
|
var _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6;
|
|
138
|
+
if ((paymethod === null || paymethod === void 0 ? void 0 : paymethod.gateway) === 'paypal' && (userErrors === null || userErrors === void 0 ? void 0 : userErrors.length) > 0) {
|
|
139
|
+
handleCheckoutValidationError();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
136
142
|
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
143
|
setAlertState({
|
|
138
144
|
open: true,
|
|
@@ -16,6 +16,7 @@ var _GoogleGpsButton = require("../../../../../components/GoogleGpsButton");
|
|
|
16
16
|
var _styles = require("./styles");
|
|
17
17
|
var _Buttons = require("../../styles/Buttons");
|
|
18
18
|
var _Inputs = require("../../styles/Inputs");
|
|
19
|
+
var _styledComponents = require("styled-components");
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
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); }
|
|
21
22
|
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; }
|
|
@@ -49,7 +50,7 @@ var inputNames = [{
|
|
|
49
50
|
code: 'Address notes'
|
|
50
51
|
}];
|
|
51
52
|
var AddressFormUI = function AddressFormUI(props) {
|
|
52
|
-
var _addressState$address, _ref, _formState$changes$ad, _formState$changes, _addressState$address2, _addressState$address3,
|
|
53
|
+
var _addressState$address, _ref, _formState$changes$ad, _formState$changes, _addressState$address2, _addressState$address3, _theme$header, _theme$header$compone, _theme$header$compone2, _theme$header$compone3, _addressState$address4, _formState$changes$lo, _formState$changes2, _theme$address, _theme$address$compon, _theme$address$compon2, _theme$address2, _theme$address2$compo, _theme$address2$compo2, _configState$configs, _configState$configs$, _configState$configs2, _configState$configs3, _configState$configs4, _configState$configs5, _configState$configs6, _configState$configs7, _props$beforeElements, _props$beforeComponen, _props$beforeMidEleme, _props$beforeMidCompo, _props$afterMidElemen, _props$afterMidCompon, _orderState$options6, _orderState$options6$, _props$afterComponent, _props$afterElements;
|
|
53
54
|
var addressesList = props.addressesList,
|
|
54
55
|
googleMapsControls = props.googleMapsControls,
|
|
55
56
|
formState = props.formState,
|
|
@@ -75,9 +76,7 @@ var AddressFormUI = function AddressFormUI(props) {
|
|
|
75
76
|
var _useSession = (0, _orderingComponentsExternal.useSession)(),
|
|
76
77
|
_useSession2 = _slicedToArray(_useSession, 1),
|
|
77
78
|
auth = _useSession2[0].auth;
|
|
78
|
-
var
|
|
79
|
-
_useOrderingTheme2 = _slicedToArray(_useOrderingTheme, 1),
|
|
80
|
-
orderingTheme = _useOrderingTheme2[0];
|
|
79
|
+
var theme = (0, _styledComponents.useTheme)();
|
|
81
80
|
var _useState = (0, _react.useState)({
|
|
82
81
|
selectedFromAutocomplete: true
|
|
83
82
|
}),
|
|
@@ -106,13 +105,13 @@ var AddressFormUI = function AddressFormUI(props) {
|
|
|
106
105
|
firstLocationNoEdit = _useState10[0],
|
|
107
106
|
setFirstLocationNoEdit = _useState10[1];
|
|
108
107
|
var isEditing = !!((_addressState$address3 = addressState.address) !== null && _addressState$address3 !== void 0 && _addressState$address3.id);
|
|
109
|
-
var isChew = (
|
|
108
|
+
var isChew = (theme === null || theme === void 0 ? void 0 : (_theme$header = theme.header) === null || _theme$header === void 0 ? void 0 : (_theme$header$compone = _theme$header.components) === null || _theme$header$compone === void 0 ? void 0 : (_theme$header$compone2 = _theme$header$compone.layout) === null || _theme$header$compone2 === void 0 ? void 0 : (_theme$header$compone3 = _theme$header$compone2.type) === null || _theme$header$compone3 === void 0 ? void 0 : _theme$header$compone3.toLowerCase()) === 'chew';
|
|
110
109
|
var _useState11 = (0, _react.useState)(isEditing ? addressState === null || addressState === void 0 ? void 0 : (_addressState$address4 = addressState.address) === null || _addressState$address4 === void 0 ? void 0 : _addressState$address4.location : (_formState$changes$lo = (_formState$changes2 = formState.changes) === null || _formState$changes2 === void 0 ? void 0 : _formState$changes2.location) !== null && _formState$changes$lo !== void 0 ? _formState$changes$lo : null),
|
|
111
110
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
112
111
|
locationChange = _useState12[0],
|
|
113
112
|
setLocationChange = _useState12[1];
|
|
114
|
-
var isHideMap =
|
|
115
|
-
var isHideIcons =
|
|
113
|
+
var isHideMap = theme === null || theme === void 0 ? void 0 : (_theme$address = theme.address) === null || _theme$address === void 0 ? void 0 : (_theme$address$compon = _theme$address.components) === null || _theme$address$compon === void 0 ? void 0 : (_theme$address$compon2 = _theme$address$compon.map) === null || _theme$address$compon2 === void 0 ? void 0 : _theme$address$compon2.hidden;
|
|
114
|
+
var isHideIcons = theme === null || theme === void 0 ? void 0 : (_theme$address2 = theme.address) === null || _theme$address2 === void 0 ? void 0 : (_theme$address2$compo = _theme$address2.components) === null || _theme$address2$compo === void 0 ? void 0 : (_theme$address2$compo2 = _theme$address2$compo.icons) === null || _theme$address2$compo2 === void 0 ? void 0 : _theme$address2$compo2.hidden;
|
|
116
115
|
var maxLimitLocation = configState === null || configState === void 0 ? void 0 : (_configState$configs = configState.configs) === null || _configState$configs === void 0 ? void 0 : (_configState$configs$ = _configState$configs.meters_to_change_address) === null || _configState$configs$ === void 0 ? void 0 : _configState$configs$.value;
|
|
117
116
|
var googleMapsApiKey = configState === null || configState === void 0 ? void 0 : (_configState$configs2 = configState.configs) === null || _configState$configs2 === void 0 ? void 0 : (_configState$configs3 = _configState$configs2.google_maps_api_key) === null || _configState$configs3 === void 0 ? void 0 : _configState$configs3.value;
|
|
118
117
|
var isLocationRequired = ((_configState$configs4 = configState.configs) === null || _configState$configs4 === void 0 ? void 0 : (_configState$configs5 = _configState$configs4.google_autocomplete_selection_required) === null || _configState$configs5 === void 0 ? void 0 : _configState$configs5.value) === '1' || ((_configState$configs6 = configState.configs) === null || _configState$configs6 === void 0 ? void 0 : (_configState$configs7 = _configState$configs6.google_autocomplete_selection_required) === null || _configState$configs7 === void 0 ? void 0 : _configState$configs7.value) === 'true';
|
|
@@ -321,8 +320,8 @@ var AddressFormUI = function AddressFormUI(props) {
|
|
|
321
320
|
});
|
|
322
321
|
};
|
|
323
322
|
var showFieldWithTheme = function showFieldWithTheme(name) {
|
|
324
|
-
var
|
|
325
|
-
return !(
|
|
323
|
+
var _theme$address3, _theme$address3$compo, _theme$address3$compo2;
|
|
324
|
+
return !(theme !== null && theme !== void 0 && (_theme$address3 = theme.address) !== null && _theme$address3 !== void 0 && (_theme$address3$compo = _theme$address3.components) !== null && _theme$address3$compo !== void 0 && (_theme$address3$compo2 = _theme$address3$compo[name]) !== null && _theme$address3$compo2 !== void 0 && _theme$address3$compo2.hidden);
|
|
326
325
|
};
|
|
327
326
|
(0, _react.useEffect)(function () {
|
|
328
327
|
var _formState$result, _ref5, _formState$changes$ad3, _formState$changes9, _addressState$address8, _ref6, _formState$changes$ad4, _formState$changes10, _addressState$address9;
|
|
@@ -139,7 +139,7 @@ var BusinessBasicInformation = function BusinessBasicInformation(props) {
|
|
|
139
139
|
var handleScroll = function handleScroll() {
|
|
140
140
|
var searchElement = document.getElementById('search-component');
|
|
141
141
|
if (searchElement) {
|
|
142
|
-
var limit = window.pageYOffset >= (searchElement === null || searchElement === void 0 ? void 0 : searchElement.offsetTop) && window.pageYOffset > 0;
|
|
142
|
+
var limit = window.pageYOffset >= (isChew ? (searchElement === null || searchElement === void 0 ? void 0 : searchElement.offsetTop) + 40 : searchElement === null || searchElement === void 0 ? void 0 : searchElement.offsetTop) && window.pageYOffset > 0;
|
|
143
143
|
if (limit) {
|
|
144
144
|
var classAdded = searchElement.classList.contains('fixed-search');
|
|
145
145
|
!classAdded && searchElement.classList.add('fixed-search');
|
|
@@ -149,7 +149,7 @@ var BusinessBasicInformation = function BusinessBasicInformation(props) {
|
|
|
149
149
|
}
|
|
150
150
|
var businessNameElement = document.getElementById('business_name');
|
|
151
151
|
if (businessNameElement) {
|
|
152
|
-
var _limit = window.pageYOffset >= (businessNameElement === null || businessNameElement === void 0 ? void 0 : businessNameElement.offsetTop) - 55 && window.pageYOffset > 0;
|
|
152
|
+
var _limit = window.pageYOffset >= (isChew && searchElement ? (searchElement === null || searchElement === void 0 ? void 0 : searchElement.offsetTop) + 40 : (businessNameElement === null || businessNameElement === void 0 ? void 0 : businessNameElement.offsetTop) - 55) && window.pageYOffset > 0;
|
|
153
153
|
if (_limit) {
|
|
154
154
|
var _classAdded = businessNameElement.classList.contains('fixed-name');
|
|
155
155
|
!_classAdded && businessNameElement.classList.add('fixed-name');
|
|
@@ -45,7 +45,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
45
45
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
46
46
|
var PIXELS_TO_SCROLL = 300;
|
|
47
47
|
var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
|
|
48
|
-
var _configs$add_product_, _configs$checkout_mul, _Object$values$find, _businessState$busine, _theme$business_view, _theme$business_view$, _theme$business_view$2, _theme$defaultLanguag, _theme$defaultLanguag2, _theme$defaultLanguag3, _theme$defaultLanguag4, _theme$defaultLanguag5, _theme$defaultLanguag6, _currentCart$products2, _theme$defaultLanguag7, _theme$defaultLanguag8, _theme$defaultLanguag9, _theme$defaultLanguag10, _error$, _theme$defaultLanguag11, _currentCart$products3, _theme$defaultLanguag12, _theme$defaultLanguag13, _theme$defaultLanguag14, _theme$defaultLanguag15, _currentCart$products4, _currentCart$products5, _currentCart$products6, _productModal$error$, _theme$defaultLanguag16, _productModal$product2, _business$professiona2, _currentCart$products7, _currentCart$products8;
|
|
48
|
+
var _configs$add_product_, _configs$checkout_mul, _Object$values$find, _businessState$busine, _theme$business_view, _theme$business_view$, _theme$business_view$2, _theme$header, _theme$header$compone, _theme$header$compone2, _theme$header$compone3, _theme$defaultLanguag, _theme$defaultLanguag2, _theme$defaultLanguag3, _theme$defaultLanguag4, _theme$defaultLanguag5, _theme$defaultLanguag6, _currentCart$products2, _theme$defaultLanguag7, _theme$defaultLanguag8, _theme$defaultLanguag9, _theme$defaultLanguag10, _error$, _theme$defaultLanguag11, _currentCart$products3, _theme$defaultLanguag12, _theme$defaultLanguag13, _theme$defaultLanguag14, _theme$defaultLanguag15, _currentCart$products4, _currentCart$products5, _currentCart$products6, _productModal$error$, _theme$defaultLanguag16, _productModal$product2, _business$professiona2, _currentCart$products7, _currentCart$products8;
|
|
49
49
|
var errors = props.errors,
|
|
50
50
|
openCategories = props.openCategories,
|
|
51
51
|
isInitialRender = props.isInitialRender,
|
|
@@ -162,6 +162,7 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
|
|
|
162
162
|
})) !== null && _Object$values$find !== void 0 ? _Object$values$find : {};
|
|
163
163
|
var isLazy = businessState === null || businessState === void 0 ? void 0 : (_businessState$busine = businessState.business) === null || _businessState$busine === void 0 ? void 0 : _businessState$busine.lazy_load_products_recommended;
|
|
164
164
|
var showViewOrderButton = !(theme !== null && theme !== void 0 && (_theme$business_view = theme.business_view) !== null && _theme$business_view !== void 0 && (_theme$business_view$ = _theme$business_view.components) !== null && _theme$business_view$ !== void 0 && (_theme$business_view$2 = _theme$business_view$.order_view_button) !== null && _theme$business_view$2 !== void 0 && _theme$business_view$2.hidden);
|
|
165
|
+
var isChew = (theme === null || theme === void 0 ? void 0 : (_theme$header = theme.header) === null || _theme$header === void 0 ? void 0 : (_theme$header$compone = _theme$header.components) === null || _theme$header$compone === void 0 ? void 0 : (_theme$header$compone2 = _theme$header$compone.layout) === null || _theme$header$compone2 === void 0 ? void 0 : (_theme$header$compone3 = _theme$header$compone2.type) === null || _theme$header$compone3 === void 0 ? void 0 : _theme$header$compone3.toLowerCase()) === 'chew';
|
|
165
166
|
var cateringTypes = [7, 8];
|
|
166
167
|
var cateringPreorder = cateringTypes.includes(options === null || options === void 0 ? void 0 : options.type);
|
|
167
168
|
var sortByOptions = [{
|
|
@@ -272,8 +273,18 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
|
|
|
272
273
|
var handleScroll = (0, _react.useCallback)(function () {
|
|
273
274
|
var _document$documentEle, _document$documentEle2;
|
|
274
275
|
var backArrowElement = document.getElementById('back-arrow');
|
|
276
|
+
var searchElement = document.getElementById('search-component');
|
|
275
277
|
if (backArrowElement) {
|
|
276
278
|
var limit = window.pageYOffset >= (backArrowElement === null || backArrowElement === void 0 ? void 0 : backArrowElement.offsetTop) && window.pageYOffset > 0;
|
|
279
|
+
var limitWidth = window.pageYOffset >= (searchElement === null || searchElement === void 0 ? void 0 : searchElement.offsetTop) + 40 && window.pageYOffset > 0;
|
|
280
|
+
if (isChew) {
|
|
281
|
+
if (limit && !limitWidth) {
|
|
282
|
+
var classWidthAdded = backArrowElement.classList.contains('fixed-arrow-width');
|
|
283
|
+
!classWidthAdded && backArrowElement.classList.add('fixed-arrow-width');
|
|
284
|
+
} else {
|
|
285
|
+
backArrowElement && backArrowElement.classList.remove('fixed-arrow-width');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
277
288
|
if (limit) {
|
|
278
289
|
var classAdded = backArrowElement.classList.contains('fixed-arrow');
|
|
279
290
|
!classAdded && backArrowElement.classList.add('fixed-arrow');
|
|
@@ -42,7 +42,7 @@ var EmptyBtnWrapper = _styledComponents.default.div(_templateObject9 || (_templa
|
|
|
42
42
|
return props.theme.colors.darkTextColor;
|
|
43
43
|
});
|
|
44
44
|
exports.EmptyBtnWrapper = EmptyBtnWrapper;
|
|
45
|
-
var HeaderContent = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin-bottom: 10px;\n .back-arrow {\n font-size: 24px;\n cursor: pointer;\n }\n .fixed-arrow {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 10001;\n width: 100vw;\n background-color: ", ";\n height: 56px;\n display: flex;\n align-items: center;\n ", "\n @media (min-width: 993px){\n width: 100px;\n }\n }\n"])), function (props) {
|
|
45
|
+
var HeaderContent = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin-bottom: 10px;\n .back-arrow {\n font-size: 24px;\n cursor: pointer;\n }\n .fixed-arrow {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 10001;\n width: 100vw;\n background-color: ", ";\n height: 56px;\n display: flex;\n align-items: center;\n ", "\n @media (min-width: 993px){\n width: 100px;\n }\n }\n .fixed-arrow-width{\n width: 100vw; \n }\n"])), function (props) {
|
|
46
46
|
return props.theme.colors.backgroundPage;
|
|
47
47
|
}, function (props) {
|
|
48
48
|
var _props$theme;
|
|
@@ -295,9 +295,9 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
295
295
|
onSearch: handleChangeSearch,
|
|
296
296
|
handleCustomEnter: function handleCustomEnter() {
|
|
297
297
|
var _configs$advanced_bus;
|
|
298
|
-
return (configs === null || configs === void 0 ? void 0 : (_configs$advanced_bus = configs.advanced_business_search_enabled) === null || _configs$advanced_bus === void 0 ? void 0 : _configs$advanced_bus.value) === '
|
|
298
|
+
return (configs === null || configs === void 0 ? void 0 : (_configs$advanced_bus = configs.advanced_business_search_enabled) === null || _configs$advanced_bus === void 0 ? void 0 : _configs$advanced_bus.value) === '0' ? null : onRedirectPage({
|
|
299
299
|
page: 'business_search'
|
|
300
|
-
})
|
|
300
|
+
});
|
|
301
301
|
}
|
|
302
302
|
}), !hideCities && (citiesState === null || citiesState === void 0 ? void 0 : (_citiesState$cities5 = citiesState.cities) === null || _citiesState$cities5 === void 0 ? void 0 : _citiesState$cities5.length) > 0 && /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
303
303
|
color: "primary",
|
|
@@ -42,7 +42,7 @@ var mapConfigs = {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
45
|
-
var _Object$values, _cartGroup$result, _paymethodSelected$pa, _cardList$cards, _configs$checkout_mul, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$multi_busine, _configs$driver_tip_o4, _configs$driver_tip_o5, _cartGroup$result2, _loyaltyPlansState$re, _creditPointPlan$busi, _creditPointPlan$busi2, _loyaltyPlansState$re2, _creditPointGeneralPl, _creditPointGeneralPl2, _configs$google_maps_, _customerState$user, _cartGroup$result3, _cartGroup$result4, _validationFields$fie9, _validationFields$fie10, _validationFields$fie11, _configs$multi_busine2, _validationFields$fie12, _validationFields$fie13, _validationFields$fie14, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _openCarts$, _configs$multi_busine6, _configs$multi_busine7;
|
|
45
|
+
var _Object$values, _cartGroup$result, _paymethodSelected$pa, _cardList$cards, _configs$checkout_mul, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$multi_busine, _configs$driver_tip_o4, _configs$driver_tip_o5, _cartGroup$result2, _loyaltyPlansState$re, _creditPointPlan$busi, _creditPointPlan$busi2, _loyaltyPlansState$re2, _creditPointGeneralPl, _creditPointGeneralPl2, _configs$cash_wallet, _configs$wallet_enabl, _configs$wallet_cash_, _configs$wallet_credi, _configs$google_maps_, _customerState$user, _cartGroup$result3, _cartGroup$result4, _validationFields$fie9, _validationFields$fie10, _validationFields$fie11, _configs$multi_busine2, _validationFields$fie12, _validationFields$fie13, _validationFields$fie14, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _openCarts$, _configs$multi_busine6, _configs$multi_busine7;
|
|
46
46
|
var placing = props.placing,
|
|
47
47
|
isCustomerMode = props.isCustomerMode,
|
|
48
48
|
openCarts = props.openCarts,
|
|
@@ -132,6 +132,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
132
132
|
var loyalBusinessAvailable = (_creditPointGeneralPl = creditPointGeneralPlan === null || creditPointGeneralPlan === void 0 ? void 0 : (_creditPointGeneralPl2 = creditPointGeneralPlan.businesses) === null || _creditPointGeneralPl2 === void 0 ? void 0 : _creditPointGeneralPl2.filter(function (b) {
|
|
133
133
|
return b.accumulates;
|
|
134
134
|
})) !== null && _creditPointGeneralPl !== void 0 ? _creditPointGeneralPl : [];
|
|
135
|
+
var isWalletEnabled = (configs === null || configs === void 0 ? void 0 : (_configs$cash_wallet = configs.cash_wallet) === null || _configs$cash_wallet === void 0 ? void 0 : _configs$cash_wallet.value) && (configs === null || configs === void 0 ? void 0 : (_configs$wallet_enabl = configs.wallet_enabled) === null || _configs$wallet_enabl === void 0 ? void 0 : _configs$wallet_enabl.value) === '1' && ((configs === null || configs === void 0 ? void 0 : (_configs$wallet_cash_ = configs.wallet_cash_enabled) === null || _configs$wallet_cash_ === void 0 ? void 0 : _configs$wallet_cash_.value) === '1' || (configs === null || configs === void 0 ? void 0 : (_configs$wallet_credi = configs.wallet_credit_point_enabled) === null || _configs$wallet_credi === void 0 ? void 0 : _configs$wallet_credi.value) === '1');
|
|
135
136
|
var accumulationRateBusiness = function accumulationRateBusiness(businessId) {
|
|
136
137
|
var _loyalBusinessAvailab, _loyalBusinessAvailab2, _creditPointGeneralPl3;
|
|
137
138
|
var value = (_loyalBusinessAvailab = loyalBusinessAvailable === null || loyalBusinessAvailable === void 0 ? void 0 : (_loyalBusinessAvailab2 = loyalBusinessAvailable.find(function (loyal) {
|
|
@@ -330,7 +331,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
330
331
|
return sum + (cart === null || cart === void 0 ? void 0 : cart.driver_tip);
|
|
331
332
|
}, 0) > 0 && (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine7 = configs.multi_business_checkout_show_combined_driver_tip) === null || _configs$multi_busine7 === void 0 ? void 0 : _configs$multi_busine7.value) === '1' && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("p", null, t('DRIVER_TIP', 'Driver tip')), /*#__PURE__*/_react.default.createElement("p", null, parsePrice(openCarts.reduce(function (sum, cart) {
|
|
332
333
|
return sum + (cart === null || cart === void 0 ? void 0 : cart.driver_tip);
|
|
333
|
-
}, 0)))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", null, t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')), /*#__PURE__*/_react.default.createElement("h4", null, parsePrice(totalCartsPrice))), !!loyaltyRewardValue && isFinite(loyaltyRewardValue) && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("p", null, "\xA0"), /*#__PURE__*/_react.default.createElement("p", null, t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue))), /*#__PURE__*/_react.default.createElement("p", null, t('MULTI_CHECKOUT_DESCRIPTION', 'You will receive a receipt for each business. The payment is not combined between multiple stores. Each payment is processed by the store')))), /*#__PURE__*/_react.default.createElement(_styles.WrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
334
|
+
}, 0)))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", null, t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')), /*#__PURE__*/_react.default.createElement("h4", null, parsePrice(totalCartsPrice))), isWalletEnabled && !!loyaltyRewardValue && isFinite(loyaltyRewardValue) && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("p", null, "\xA0"), /*#__PURE__*/_react.default.createElement("p", null, t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue))), /*#__PURE__*/_react.default.createElement("p", null, t('MULTI_CHECKOUT_DESCRIPTION', 'You will receive a receipt for each business. The payment is not combined between multiple stores. Each payment is processed by the store')))), /*#__PURE__*/_react.default.createElement(_styles.WrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
334
335
|
color: "primary",
|
|
335
336
|
disabled: isDisablePlaceOrderButton || placing || (cartGroup === null || cartGroup === void 0 ? void 0 : cartGroup.loading),
|
|
336
337
|
onClick: handlePlaceOrder
|
|
@@ -110,7 +110,7 @@ var OrderHistory = function OrderHistory(props) {
|
|
|
110
110
|
return (0, _utils.getTraduction)(status);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
return /*#__PURE__*/_react.default.createElement(_styles.OrderHistoryContainer, null, !(messages !== null && messages !== void 0 && messages.loading) && order && /*#__PURE__*/_react.default.createElement(_styles.HistoryItemWrapper, null, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.CheckCircleFill, null), /*#__PURE__*/_react.default.createElement(_styles.DetailWrapper, null, /*#__PURE__*/_react.default.createElement("h3", null, t('ORDER_PLACED', 'Order placed'), " ", ' ', t('VIA', 'Via'), ' ', order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')), /*#__PURE__*/_react.default.createElement("p", null, parseDate(order.created_at, {
|
|
113
|
+
return /*#__PURE__*/_react.default.createElement(_styles.OrderHistoryContainer, null, !(messages !== null && messages !== void 0 && messages.loading) && order && /*#__PURE__*/_react.default.createElement(_styles.HistoryItemWrapper, null, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.CheckCircleFill, null), /*#__PURE__*/_react.default.createElement(_styles.DetailWrapper, null, /*#__PURE__*/_react.default.createElement("h3", null, t('ORDER_PLACED', 'Order placed'), " ", ' ', !props.hideViaText && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, t('VIA', 'Via'), ' ', order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other'))), /*#__PURE__*/_react.default.createElement("p", null, parseDate(order.created_at, {
|
|
114
114
|
outputFormat: "MMM DD, ".concat(configs === null || configs === void 0 ? void 0 : (_configs$general_hour = configs.general_hour_format) === null || _configs$general_hour === void 0 ? void 0 : _configs$general_hour.value)
|
|
115
115
|
})))), messages && (messages === null || messages === void 0 ? void 0 : messages.messages.map(function (message, i) {
|
|
116
116
|
var _message$change, _message$change2, _message$change3, _message$change4, _message$driver, _message$driver2, _configs$general_hour2;
|
|
@@ -782,6 +782,7 @@ var OrderDetailsUI = function OrderDetailsUI(props) {
|
|
|
782
782
|
content: confirm.content,
|
|
783
783
|
acceptText: t('ACCEPT', 'Accept'),
|
|
784
784
|
open: confirm.open,
|
|
785
|
+
hideViaText: props.hideViaText,
|
|
785
786
|
onClose: function onClose() {
|
|
786
787
|
return handleOriginalReorder();
|
|
787
788
|
},
|
|
@@ -24,7 +24,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
24
24
|
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; } }
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
var OrderTypeSelectorContentUI = function OrderTypeSelectorContentUI(props) {
|
|
27
|
-
var _props$beforeElements, _props$beforeComponen, _props$afterComponent, _props$afterElements;
|
|
27
|
+
var _theme$order_types, _theme$order_types$co, _props$beforeElements, _props$beforeComponen, _props$afterComponent, _props$afterElements;
|
|
28
28
|
var handleChangeOrderType = props.handleChangeOrderType,
|
|
29
29
|
orderTypes = props.orderTypes,
|
|
30
30
|
onClose = props.onClose,
|
|
@@ -40,21 +40,22 @@ var OrderTypeSelectorContentUI = function OrderTypeSelectorContentUI(props) {
|
|
|
40
40
|
onClose && onClose();
|
|
41
41
|
handleChangeOrderType && handleChangeOrderType(orderType);
|
|
42
42
|
};
|
|
43
|
+
var titleOrdertype = theme === null || theme === void 0 ? void 0 : (_theme$order_types = theme.order_types) === null || _theme$order_types === void 0 ? void 0 : (_theme$order_types$co = _theme$order_types.components) === null || _theme$order_types$co === void 0 ? void 0 : _theme$order_types$co.title_menu;
|
|
43
44
|
var orderTypeImage = function orderTypeImage(type) {
|
|
44
|
-
var _theme$
|
|
45
|
-
return theme === null || theme === void 0 ? void 0 : (_theme$
|
|
45
|
+
var _theme$order_types2, _theme$order_types2$c, _theme$order_types2$c2, _theme$order_types2$c3;
|
|
46
|
+
return theme === null || theme === void 0 ? void 0 : (_theme$order_types2 = theme.order_types) === null || _theme$order_types2 === void 0 ? void 0 : (_theme$order_types2$c = _theme$order_types2.components) === null || _theme$order_types2$c === void 0 ? void 0 : (_theme$order_types2$c2 = _theme$order_types2$c[type]) === null || _theme$order_types2$c2 === void 0 ? void 0 : (_theme$order_types2$c3 = _theme$order_types2$c2.components) === null || _theme$order_types2$c3 === void 0 ? void 0 : _theme$order_types2$c3.image;
|
|
46
47
|
};
|
|
47
48
|
var orderTypeTitle = function orderTypeTitle(type) {
|
|
48
|
-
var _theme$
|
|
49
|
-
return theme === null || theme === void 0 ? void 0 : (_theme$
|
|
49
|
+
var _theme$order_types3, _theme$order_types3$c, _theme$order_types3$c2, _theme$order_types3$c3;
|
|
50
|
+
return theme === null || theme === void 0 ? void 0 : (_theme$order_types3 = theme.order_types) === null || _theme$order_types3 === void 0 ? void 0 : (_theme$order_types3$c = _theme$order_types3.components) === null || _theme$order_types3$c === void 0 ? void 0 : (_theme$order_types3$c2 = _theme$order_types3$c[type]) === null || _theme$order_types3$c2 === void 0 ? void 0 : (_theme$order_types3$c3 = _theme$order_types3$c2.components) === null || _theme$order_types3$c3 === void 0 ? void 0 : _theme$order_types3$c3.title;
|
|
50
51
|
};
|
|
51
52
|
var orderTypeDescription = function orderTypeDescription(type) {
|
|
52
|
-
var _theme$
|
|
53
|
-
return theme === null || theme === void 0 ? void 0 : (_theme$
|
|
53
|
+
var _theme$order_types4, _theme$order_types4$c, _theme$order_types4$c2, _theme$order_types4$c3;
|
|
54
|
+
return theme === null || theme === void 0 ? void 0 : (_theme$order_types4 = theme.order_types) === null || _theme$order_types4 === void 0 ? void 0 : (_theme$order_types4$c = _theme$order_types4.components) === null || _theme$order_types4$c === void 0 ? void 0 : (_theme$order_types4$c2 = _theme$order_types4$c[type]) === null || _theme$order_types4$c2 === void 0 ? void 0 : (_theme$order_types4$c3 = _theme$order_types4$c2.components) === null || _theme$order_types4$c3 === void 0 ? void 0 : _theme$order_types4$c3.description;
|
|
54
55
|
};
|
|
55
56
|
var orderTypeCallAction = function orderTypeCallAction(type) {
|
|
56
|
-
var _theme$
|
|
57
|
-
return theme === null || theme === void 0 ? void 0 : (_theme$
|
|
57
|
+
var _theme$order_types5, _theme$order_types5$c, _theme$order_types5$c2, _theme$order_types5$c3;
|
|
58
|
+
return theme === null || theme === void 0 ? void 0 : (_theme$order_types5 = theme.order_types) === null || _theme$order_types5 === void 0 ? void 0 : (_theme$order_types5$c = _theme$order_types5.components) === null || _theme$order_types5$c === void 0 ? void 0 : (_theme$order_types5$c2 = _theme$order_types5$c[type]) === null || _theme$order_types5$c2 === void 0 ? void 0 : (_theme$order_types5$c3 = _theme$order_types5$c2.components) === null || _theme$order_types5$c3 === void 0 ? void 0 : _theme$order_types5$c3.call_to_action;
|
|
58
59
|
};
|
|
59
60
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
60
61
|
className: "order-type",
|
|
@@ -69,7 +70,7 @@ var OrderTypeSelectorContentUI = function OrderTypeSelectorContentUI(props) {
|
|
|
69
70
|
return /*#__PURE__*/_react.default.createElement(BeforeComponent, _extends({
|
|
70
71
|
key: i
|
|
71
72
|
}, props));
|
|
72
|
-
}), /*#__PURE__*/_react.default.createElement(_styles.OrderTypeSelectorContainer, null, /*#__PURE__*/_react.default.createElement(_styles.OrderTypeListTitle, null, t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will you delivery type?')), orderTypes && (configTypes ? orderTypes.filter(function (type) {
|
|
73
|
+
}), /*#__PURE__*/_react.default.createElement(_styles.OrderTypeSelectorContainer, null, /*#__PURE__*/_react.default.createElement(_styles.OrderTypeListTitle, null, titleOrdertype || t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will you delivery type?')), orderTypes && (configTypes ? orderTypes.filter(function (type) {
|
|
73
74
|
return configTypes === null || configTypes === void 0 ? void 0 : configTypes.includes(type.value);
|
|
74
75
|
}) : orderTypes).map(function (item, i) {
|
|
75
76
|
var _item$text, _item$text$replace, _orderStatus$options, _item$text2, _item$text2$replace, _item$text3, _item$text3$replace, _item$text4, _item$text4$replace;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-external",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Ordering UI Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"lodash": "^4.17.19",
|
|
88
88
|
"moment": "^2.29.4",
|
|
89
89
|
"nanoid": "^4.0.0",
|
|
90
|
-
"ordering-components-external": "4.0.
|
|
90
|
+
"ordering-components-external": "4.0.2",
|
|
91
91
|
"payment": "^2.4.6",
|
|
92
92
|
"polished": "^3.6.6",
|
|
93
93
|
"react-bootstrap-icons": "^1.7.2",
|
|
@@ -100,12 +100,7 @@ const CheckoutUI = (props) => {
|
|
|
100
100
|
}
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
-
const
|
|
104
|
-
setCreateOrder(true)
|
|
105
|
-
if (!userErrors.length) {
|
|
106
|
-
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
107
|
-
return
|
|
108
|
-
}
|
|
103
|
+
const handleCheckoutValidationError = () => {
|
|
109
104
|
setAlertState({
|
|
110
105
|
open: true,
|
|
111
106
|
content: Object.values(userErrors).map(error => error)
|
|
@@ -113,6 +108,15 @@ const CheckoutUI = (props) => {
|
|
|
113
108
|
setIsUserDetailsEdit(true)
|
|
114
109
|
}
|
|
115
110
|
|
|
111
|
+
const handlePlaceOrder = () => {
|
|
112
|
+
if (!userErrors.length) {
|
|
113
|
+
setCreateOrder(true)
|
|
114
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
handleCheckoutValidationError()
|
|
118
|
+
}
|
|
119
|
+
|
|
116
120
|
const closeAlert = () => {
|
|
117
121
|
setAlertState({
|
|
118
122
|
open: false,
|
|
@@ -394,6 +398,8 @@ const CheckoutUI = (props) => {
|
|
|
394
398
|
handlePlaceOrder={handlePlaceOrder}
|
|
395
399
|
onPlaceOrderClick={onPlaceOrderClick}
|
|
396
400
|
setCreateOrder={setCreateOrder}
|
|
401
|
+
userErrors={userErrors}
|
|
402
|
+
handleCheckoutValidationError={handleCheckoutValidationError}
|
|
397
403
|
/>
|
|
398
404
|
</PaymentMethodContainer>
|
|
399
405
|
)}
|
|
@@ -87,7 +87,9 @@ const PaymentOptionsUI = (props) => {
|
|
|
87
87
|
onPlaceOrderClick,
|
|
88
88
|
setCreateOrder,
|
|
89
89
|
handlePlaceOrder,
|
|
90
|
-
paymethods
|
|
90
|
+
paymethods,
|
|
91
|
+
userErrors,
|
|
92
|
+
handleCheckoutValidationError
|
|
91
93
|
} = props
|
|
92
94
|
const [, t] = useLanguage()
|
|
93
95
|
const [{ token }] = useSession()
|
|
@@ -105,6 +107,10 @@ const PaymentOptionsUI = (props) => {
|
|
|
105
107
|
const stripeDirectMethods = ['stripe_direct', ...methodsPay]
|
|
106
108
|
|
|
107
109
|
const handlePaymentMethodClick = (paymethod) => {
|
|
110
|
+
if (paymethod?.gateway === 'paypal' && userErrors?.length > 0) {
|
|
111
|
+
handleCheckoutValidationError()
|
|
112
|
+
return
|
|
113
|
+
}
|
|
108
114
|
if (paymethod?.gateway === 'paypal' &&
|
|
109
115
|
options.type === 1 &&
|
|
110
116
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
|
|
35
35
|
import { Button } from '../../styles/Buttons'
|
|
36
36
|
import { Input, TextArea } from '../../styles/Inputs'
|
|
37
|
+
import { useTheme } from 'styled-components'
|
|
37
38
|
|
|
38
39
|
const inputNames = [
|
|
39
40
|
{ name: 'address', code: 'Address' },
|
|
@@ -63,14 +64,14 @@ const AddressFormUI = (props) => {
|
|
|
63
64
|
const [, t] = useLanguage()
|
|
64
65
|
const formMethods = useForm()
|
|
65
66
|
const [{ auth }] = useSession()
|
|
66
|
-
const
|
|
67
|
+
const theme = useTheme()
|
|
67
68
|
const [state, setState] = useState({ selectedFromAutocomplete: true })
|
|
68
69
|
const [addressTag, setAddressTag] = useState(addressState?.address?.tag)
|
|
69
70
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
70
71
|
const [addressValue, setAddressValue] = useState(formState.changes?.address ?? addressState.address?.address ?? '')
|
|
71
72
|
const [firstLocationNoEdit, setFirstLocationNoEdit] = useState({ value: null })
|
|
72
73
|
const isEditing = !!addressState.address?.id
|
|
73
|
-
const isChew =
|
|
74
|
+
const isChew = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
74
75
|
|
|
75
76
|
const [locationChange, setLocationChange] = useState(
|
|
76
77
|
isEditing
|
|
@@ -78,8 +79,8 @@ const AddressFormUI = (props) => {
|
|
|
78
79
|
: formState.changes?.location ?? null
|
|
79
80
|
)
|
|
80
81
|
|
|
81
|
-
const isHideMap =
|
|
82
|
-
const isHideIcons =
|
|
82
|
+
const isHideMap = theme?.address?.components?.map?.hidden
|
|
83
|
+
const isHideIcons = theme?.address?.components?.icons?.hidden
|
|
83
84
|
|
|
84
85
|
const maxLimitLocation = configState?.configs?.meters_to_change_address?.value
|
|
85
86
|
const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
|
|
@@ -253,7 +254,7 @@ const AddressFormUI = (props) => {
|
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
const showFieldWithTheme = (name) => {
|
|
256
|
-
return !
|
|
257
|
+
return !theme?.address?.components?.[name]?.hidden
|
|
257
258
|
}
|
|
258
259
|
|
|
259
260
|
useEffect(() => {
|
|
@@ -131,7 +131,7 @@ export const BusinessBasicInformation = (props) => {
|
|
|
131
131
|
const handleScroll = () => {
|
|
132
132
|
const searchElement = document.getElementById('search-component')
|
|
133
133
|
if (searchElement) {
|
|
134
|
-
const limit = window.pageYOffset >= searchElement?.offsetTop && window.pageYOffset > 0
|
|
134
|
+
const limit = window.pageYOffset >= (isChew ? searchElement?.offsetTop + 40 : searchElement?.offsetTop) && window.pageYOffset > 0
|
|
135
135
|
if (limit) {
|
|
136
136
|
const classAdded = searchElement.classList.contains('fixed-search')
|
|
137
137
|
!classAdded && searchElement.classList.add('fixed-search')
|
|
@@ -142,7 +142,7 @@ export const BusinessBasicInformation = (props) => {
|
|
|
142
142
|
|
|
143
143
|
const businessNameElement = document.getElementById('business_name')
|
|
144
144
|
if (businessNameElement) {
|
|
145
|
-
const limit = window.pageYOffset >= (businessNameElement?.offsetTop - 55) && window.pageYOffset > 0
|
|
145
|
+
const limit = window.pageYOffset >= (isChew && searchElement ? searchElement?.offsetTop + 40 : (businessNameElement?.offsetTop - 55)) && window.pageYOffset > 0
|
|
146
146
|
if (limit) {
|
|
147
147
|
const classAdded = businessNameElement.classList.contains('fixed-name')
|
|
148
148
|
!classAdded && businessNameElement.classList.add('fixed-name')
|
|
@@ -249,7 +249,7 @@ export const BusinessBasicInformation = (props) => {
|
|
|
249
249
|
)}
|
|
250
250
|
</BusinessInfoWrapper>
|
|
251
251
|
{(windowSize.width <= 768 && categoryClicked) && (
|
|
252
|
-
|
|
252
|
+
<BackButton>
|
|
253
253
|
<Button
|
|
254
254
|
color='primary'
|
|
255
255
|
initialIcon
|
|
@@ -259,7 +259,7 @@ export const BusinessBasicInformation = (props) => {
|
|
|
259
259
|
<div>{t('GO_TO_ALL_CATEGORIES', 'Go to all categories')}</div>
|
|
260
260
|
</Button>
|
|
261
261
|
</BackButton>
|
|
262
|
-
|
|
262
|
+
)}
|
|
263
263
|
<Modal
|
|
264
264
|
width='70%'
|
|
265
265
|
open={openBusinessInformation}
|
|
@@ -116,6 +116,7 @@ const BusinessProductsListingUI = (props) => {
|
|
|
116
116
|
const currentCart = Object.values(carts).find(cart => cart?.business?.slug === business?.slug) ?? {}
|
|
117
117
|
const isLazy = businessState?.business?.lazy_load_products_recommended
|
|
118
118
|
const showViewOrderButton = !theme?.business_view?.components?.order_view_button?.hidden
|
|
119
|
+
const isChew = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
119
120
|
const cateringTypes = [7, 8]
|
|
120
121
|
const cateringPreorder = cateringTypes.includes(options?.type)
|
|
121
122
|
const sortByOptions = [
|
|
@@ -193,8 +194,19 @@ const BusinessProductsListingUI = (props) => {
|
|
|
193
194
|
|
|
194
195
|
const handleScroll = useCallback(() => {
|
|
195
196
|
const backArrowElement = document.getElementById('back-arrow')
|
|
197
|
+
const searchElement = document.getElementById('search-component')
|
|
196
198
|
if (backArrowElement) {
|
|
197
199
|
const limit = window.pageYOffset >= backArrowElement?.offsetTop && window.pageYOffset > 0
|
|
200
|
+
const limitWidth = window.pageYOffset >= searchElement?.offsetTop + 40 && window.pageYOffset > 0
|
|
201
|
+
if (isChew) {
|
|
202
|
+
if (limit && !limitWidth) {
|
|
203
|
+
const classWidthAdded = backArrowElement.classList.contains('fixed-arrow-width')
|
|
204
|
+
!classWidthAdded && backArrowElement.classList.add('fixed-arrow-width')
|
|
205
|
+
} else {
|
|
206
|
+
backArrowElement && backArrowElement.classList.remove('fixed-arrow-width')
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
198
210
|
if (limit) {
|
|
199
211
|
const classAdded = backArrowElement.classList.contains('fixed-arrow')
|
|
200
212
|
!classAdded && backArrowElement.classList.add('fixed-arrow')
|
package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js
CHANGED
|
@@ -273,7 +273,9 @@ const BusinessesListingUI = (props) => {
|
|
|
273
273
|
isCustomLayout={isCustomLayout}
|
|
274
274
|
placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
|
|
275
275
|
onSearch={handleChangeSearch}
|
|
276
|
-
handleCustomEnter={() => configs?.advanced_business_search_enabled?.value === '
|
|
276
|
+
handleCustomEnter={() => configs?.advanced_business_search_enabled?.value === '0'
|
|
277
|
+
? null
|
|
278
|
+
: onRedirectPage({ page: 'business_search' })}
|
|
277
279
|
/>
|
|
278
280
|
)}
|
|
279
281
|
{!hideCities && citiesState?.cities?.length > 0 && (
|
|
@@ -108,6 +108,9 @@ const MultiCheckoutUI = (props) => {
|
|
|
108
108
|
const creditPointPlanOnBusiness = businessIds.every((bid) => loyalBusinessIds.includes(bid)) && creditPointPlan
|
|
109
109
|
const creditPointGeneralPlan = loyaltyPlansState?.result?.find((loyal) => loyal.type === 'credit_point')
|
|
110
110
|
const loyalBusinessAvailable = creditPointGeneralPlan?.businesses?.filter((b) => b.accumulates) ?? []
|
|
111
|
+
const isWalletEnabled = (configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' &&
|
|
112
|
+
(configs?.wallet_cash_enabled?.value === '1' ||
|
|
113
|
+
configs?.wallet_credit_point_enabled?.value === '1'))
|
|
111
114
|
|
|
112
115
|
const accumulationRateBusiness = (businessId) => {
|
|
113
116
|
const value = loyalBusinessAvailable?.find((loyal) => loyal.business_id === businessId)?.accumulation_rate ?? 0
|
|
@@ -371,7 +374,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
371
374
|
<h4>{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}</h4>
|
|
372
375
|
<h4>{parsePrice(totalCartsPrice)}</h4>
|
|
373
376
|
</div>
|
|
374
|
-
{!!loyaltyRewardValue && isFinite(loyaltyRewardValue) && (
|
|
377
|
+
{isWalletEnabled && !!loyaltyRewardValue && isFinite(loyaltyRewardValue) && (
|
|
375
378
|
<span>
|
|
376
379
|
<p> </p>
|
|
377
380
|
<p>{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}</p>
|
|
@@ -111,8 +111,12 @@ export const OrderHistory = (props) => {
|
|
|
111
111
|
<DetailWrapper>
|
|
112
112
|
<h3>
|
|
113
113
|
{t('ORDER_PLACED', 'Order placed')} {' '}
|
|
114
|
-
{
|
|
115
|
-
|
|
114
|
+
{!props.hideViaText && (
|
|
115
|
+
<>
|
|
116
|
+
{t('VIA', 'Via')}{' '}
|
|
117
|
+
{order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
|
|
118
|
+
</>
|
|
119
|
+
)}
|
|
116
120
|
</h3>
|
|
117
121
|
<p>{parseDate(order.created_at, { outputFormat: `MMM DD, ${configs?.general_hour_format?.value}` })}</p>
|
|
118
122
|
</DetailWrapper>
|
|
@@ -816,6 +816,7 @@ const OrderDetailsUI = (props) => {
|
|
|
816
816
|
content={confirm.content}
|
|
817
817
|
acceptText={t('ACCEPT', 'Accept')}
|
|
818
818
|
open={confirm.open}
|
|
819
|
+
hideViaText={props.hideViaText}
|
|
819
820
|
onClose={() => handleOriginalReorder()}
|
|
820
821
|
onCancel={() => handleOriginalReorder()}
|
|
821
822
|
onAccept={confirm.handleOnAccept}
|