ordering-ui-external 4.0.2 → 4.0.4
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/_modules/themes/five/src/components/BusinessController/index.js +1 -1
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -1
- package/_modules/themes/five/src/components/ProductForm/index.js +11 -8
- package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +6 -7
- package/package.json +1 -1
- package/src/themes/five/src/components/BusinessController/index.js +1 -1
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -1
- package/src/themes/five/src/components/ProductForm/index.js +13 -8
- package/src/themes/five/src/components/ProductOptionSubOption/index.js +5 -6
|
@@ -194,7 +194,7 @@ var BusinessControllerUI = function BusinessControllerUI(props) {
|
|
|
194
194
|
className: "reviews"
|
|
195
195
|
}, /*#__PURE__*/_react.default.createElement(_BisStar.default, null), /*#__PURE__*/_react.default.createElement("span", null, businessReviews !== null && businessReviews !== void 0 ? businessReviews : business === null || business === void 0 ? void 0 : (_business$reviews2 = business.reviews) === null || _business$reviews2 === void 0 ? void 0 : _business$reviews2.total)) : /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
196
196
|
width: 50
|
|
197
|
-
})), !hideBusinessFavorite && /*#__PURE__*/_react.default.createElement(_styles.FavoriteWrapper, {
|
|
197
|
+
})), !hideBusinessFavorite && !isCustomerMode && /*#__PURE__*/_react.default.createElement(_styles.FavoriteWrapper, {
|
|
198
198
|
ref: favoriteRef,
|
|
199
199
|
onClick: handleChangeFavorite
|
|
200
200
|
}, !isSkeleton ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, businessState !== null && businessState !== void 0 && (_businessState$busine2 = businessState.business) !== null && _businessState$busine2 !== void 0 && _businessState$busine2.favorite ? /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.HeartFill, null) : /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.Heart, null)) : /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
@@ -263,7 +263,7 @@ var BusinessesListingUI = function BusinessesListingUI(props) {
|
|
|
263
263
|
position: "web_business_listing"
|
|
264
264
|
}), (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, {
|
|
265
265
|
isBusinessList: true,
|
|
266
|
-
hideHero:
|
|
266
|
+
hideHero: (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
|
|
267
267
|
}), (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 && !hideHero && /*#__PURE__*/_react.default.createElement(_styles.BusinessHeroImg, {
|
|
268
268
|
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,
|
|
269
269
|
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
|
|
@@ -74,7 +74,8 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
|
|
|
74
74
|
productAddedToCartLength = props.productAddedToCartLength,
|
|
75
75
|
handleFavoriteProduct = props.handleFavoriteProduct,
|
|
76
76
|
handleCreateGuestUser = props.handleCreateGuestUser,
|
|
77
|
-
actionStatus = props.actionStatus
|
|
77
|
+
actionStatus = props.actionStatus,
|
|
78
|
+
isCustomerMode = props.isCustomerMode;
|
|
78
79
|
var product = productObject.product,
|
|
79
80
|
loading = productObject.loading,
|
|
80
81
|
error = productObject.error;
|
|
@@ -304,17 +305,19 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
|
|
|
304
305
|
if ((product === null || product === void 0 ? void 0 : product.ingredients.length) > 0 || (product === null || product === void 0 ? void 0 : product.extras.length) > 0) {
|
|
305
306
|
var _product$ingredients;
|
|
306
307
|
var menuList = [];
|
|
307
|
-
if ((product === null || product === void 0 ? void 0 : (_product$ingredients = product.ingredients) === null || _product$ingredients === void 0 ? void 0 : _product$ingredients.length) > 0)
|
|
308
|
-
|
|
308
|
+
if ((product === null || product === void 0 ? void 0 : (_product$ingredients = product.ingredients) === null || _product$ingredients === void 0 ? void 0 : _product$ingredients.length) > 0) {
|
|
309
|
+
menuList.push('ingredients');
|
|
310
|
+
}
|
|
311
|
+
((product === null || product === void 0 ? void 0 : product.extras.length) > 0 && (product === null || product === void 0 ? void 0 : product.extras) || []).sort(function (a, b) {
|
|
309
312
|
return a.rank - b.rank;
|
|
310
313
|
}).forEach(function (extra) {
|
|
311
|
-
(extra === null || extra === void 0 ? void 0 : extra.options.length) > 0 && (extra === null || extra === void 0 ? void 0 : extra.options.sort(function (a, b) {
|
|
314
|
+
((extra === null || extra === void 0 ? void 0 : extra.options.length) > 0 && (extra === null || extra === void 0 ? void 0 : extra.options) || []).sort(function (a, b) {
|
|
312
315
|
return a.rank - b.rank;
|
|
313
316
|
}).forEach(function (option) {
|
|
314
317
|
showOption(option) && menuList.push("id_".concat(option === null || option === void 0 ? void 0 : option.id));
|
|
315
|
-
})
|
|
316
|
-
})
|
|
317
|
-
menuList.forEach(function (menu) {
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
menuList.length && menuList.forEach(function (menu) {
|
|
318
321
|
var elementTop = scrollElement.scrollTop;
|
|
319
322
|
var topPos = document.getElementById(menu).offsetTop;
|
|
320
323
|
if (Math.abs(elementTop - topPos) < extraHeight) {
|
|
@@ -518,7 +521,7 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
|
|
|
518
521
|
}), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
519
522
|
variant: "rect",
|
|
520
523
|
height: 200
|
|
521
|
-
})), !loading && !error && product && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.ProductInfo, null, /*#__PURE__*/_react.default.createElement(_styles.ProductFormTitle, null, /*#__PURE__*/_react.default.createElement(_styles.TitleWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.ProductName, null, /*#__PURE__*/_react.default.createElement("span", null, product === null || product === void 0 ? void 0 : product.name)), /*#__PURE__*/_react.default.createElement("span", {
|
|
524
|
+
})), !loading && !error && product && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.ProductInfo, null, /*#__PURE__*/_react.default.createElement(_styles.ProductFormTitle, null, /*#__PURE__*/_react.default.createElement(_styles.TitleWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.ProductName, null, /*#__PURE__*/_react.default.createElement("span", null, product === null || product === void 0 ? void 0 : product.name)), !isCustomerMode && /*#__PURE__*/_react.default.createElement("span", {
|
|
522
525
|
className: "favorite",
|
|
523
526
|
onClick: function onClick() {
|
|
524
527
|
return handleChangeFavorite();
|
|
@@ -11,7 +11,6 @@ var _BsCircleFill = _interopRequireDefault(require("@meronex/icons/bs/BsCircleFi
|
|
|
11
11
|
var _BsCircleHalf = _interopRequireDefault(require("@meronex/icons/bs/BsCircleHalf"));
|
|
12
12
|
var _BsDashCircle = _interopRequireDefault(require("@meronex/icons/bs/BsDashCircle"));
|
|
13
13
|
var _BsPlusCircle = _interopRequireDefault(require("@meronex/icons/bs/BsPlusCircle"));
|
|
14
|
-
var _useWindowSize2 = require("../../../../../hooks/useWindowSize");
|
|
15
14
|
var _styles = require("./styles");
|
|
16
15
|
var _MdCheckBox = _interopRequireDefault(require("@meronex/icons/md/MdCheckBox"));
|
|
17
16
|
var _MdCheckBoxOutlineBlank = _interopRequireDefault(require("@meronex/icons/md/MdCheckBoxOutlineBlank"));
|
|
@@ -53,8 +52,6 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
|
|
|
53
52
|
var _useUtils = (0, _orderingComponentsExternal.useUtils)(),
|
|
54
53
|
_useUtils2 = _slicedToArray(_useUtils, 1),
|
|
55
54
|
parsePrice = _useUtils2[0].parsePrice;
|
|
56
|
-
var _useWindowSize = (0, _useWindowSize2.useWindowSize)(),
|
|
57
|
-
width = _useWindowSize.width;
|
|
58
55
|
var _useState = (0, _react.useState)(false),
|
|
59
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
57
|
showMessage = _useState2[0],
|
|
@@ -88,8 +85,10 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
|
|
|
88
85
|
}, [balance]);
|
|
89
86
|
(0, _react.useEffect)(function () {
|
|
90
87
|
if (balance === (option === null || option === void 0 ? void 0 : option.max) && state !== null && state !== void 0 && state.selected && dirtyRef) {
|
|
91
|
-
dirtyRef.current
|
|
92
|
-
|
|
88
|
+
if ((dirtyRef === null || dirtyRef === void 0 ? void 0 : dirtyRef.current) !== null) {
|
|
89
|
+
dirtyRef.current = false;
|
|
90
|
+
setIsScrollAvailable(true);
|
|
91
|
+
}
|
|
93
92
|
}
|
|
94
93
|
}, [state === null || state === void 0 ? void 0 : state.selected]);
|
|
95
94
|
(0, _react.useEffect)(function () {
|
|
@@ -118,7 +117,7 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
|
|
|
118
117
|
disabled: true
|
|
119
118
|
})), suboption.image && suboption.image !== '-' && /*#__PURE__*/_react.default.createElement(_styles.SubOptionThumbnail, {
|
|
120
119
|
src: suboption.image
|
|
121
|
-
}), /*#__PURE__*/_react.default.createElement(_styles.Text, null, /*#__PURE__*/_react.default.createElement("div", null, suboption === null || suboption === void 0 ? void 0 : suboption.name)
|
|
120
|
+
}), /*#__PURE__*/_react.default.createElement(_styles.Text, null, /*#__PURE__*/_react.default.createElement("div", null, suboption === null || suboption === void 0 ? void 0 : suboption.name))), /*#__PURE__*/_react.default.createElement(_styles.RightOptionContainer, null, /*#__PURE__*/_react.default.createElement(_styles.QuantityControl, null, (option === null || option === void 0 ? void 0 : option.allow_suboption_quantity) && (state === null || state === void 0 ? void 0 : state.selected) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_BsDashCircle.default, {
|
|
122
121
|
disabled: state.quantity === 0 || isSoldOut,
|
|
123
122
|
onClick: handleDecrement
|
|
124
123
|
}), state.quantity, /*#__PURE__*/_react.default.createElement(_BsPlusCircle.default, {
|
|
@@ -145,7 +144,7 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
|
|
|
145
144
|
onClick: function onClick(e) {
|
|
146
145
|
return handlePosition(e, 'right');
|
|
147
146
|
}
|
|
148
|
-
})))), /*#__PURE__*/_react.default.createElement(_styles.SuboptionPrice, null, price > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "+ ", parsePrice(price)))), showMessage &&
|
|
147
|
+
})))), /*#__PURE__*/_react.default.createElement(_styles.SuboptionPrice, null, price > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "+ ", parsePrice(price)))), showMessage && /*#__PURE__*/_react.default.createElement(_styles.Text, {
|
|
149
148
|
noMargin: true
|
|
150
149
|
}, /*#__PURE__*/_react.default.createElement("span", null, "".concat(t('OPTIONS_MAX_LIMIT', 'Maximum options to choose'), ": ").concat(option === null || option === void 0 ? void 0 : option.max))), (_props$afterComponent = props.afterComponents) === null || _props$afterComponent === void 0 ? void 0 : _props$afterComponent.map(function (AfterComponent, i) {
|
|
151
150
|
return /*#__PURE__*/_react.default.createElement(AfterComponent, _extends({
|
package/package.json
CHANGED
package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js
CHANGED
|
@@ -229,7 +229,7 @@ const BusinessesListingUI = (props) => {
|
|
|
229
229
|
{(windowSize.width < 576 || (configs?.business_listing_hide_image?.value !== '1' && !isChew)) && (
|
|
230
230
|
<BusinessBanner>
|
|
231
231
|
{windowSize.width < 576 && (
|
|
232
|
-
<OrderContextUI isBusinessList hideHero={(
|
|
232
|
+
<OrderContextUI isBusinessList hideHero={(configs?.business_listing_hide_image?.value !== '1' && !isChew) && !hideHero} />
|
|
233
233
|
)}
|
|
234
234
|
{(configs?.business_listing_hide_image?.value !== '1' && !isChew) && !hideHero && (
|
|
235
235
|
<BusinessHeroImg
|
|
@@ -99,7 +99,8 @@ const ProductOptionsUI = (props) => {
|
|
|
99
99
|
productAddedToCartLength,
|
|
100
100
|
handleFavoriteProduct,
|
|
101
101
|
handleCreateGuestUser,
|
|
102
|
-
actionStatus
|
|
102
|
+
actionStatus,
|
|
103
|
+
isCustomerMode
|
|
103
104
|
} = props
|
|
104
105
|
|
|
105
106
|
const { product, loading, error } = productObject
|
|
@@ -283,13 +284,15 @@ const ProductOptionsUI = (props) => {
|
|
|
283
284
|
const extraHeight = 60
|
|
284
285
|
if (product?.ingredients.length > 0 || product?.extras.length > 0) {
|
|
285
286
|
const menuList = []
|
|
286
|
-
if (product?.ingredients?.length > 0)
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
if (product?.ingredients?.length > 0) {
|
|
288
|
+
menuList.push('ingredients')
|
|
289
|
+
}
|
|
290
|
+
((product?.extras.length > 0 && product?.extras) || []).sort((a, b) => a.rank - b.rank).forEach(extra => {
|
|
291
|
+
((extra?.options.length > 0 && extra?.options) || []).sort((a, b) => a.rank - b.rank).forEach(option => {
|
|
289
292
|
showOption(option) && menuList.push(`id_${option?.id}`)
|
|
290
293
|
})
|
|
291
294
|
})
|
|
292
|
-
menuList.forEach(menu => {
|
|
295
|
+
menuList.length && menuList.forEach(menu => {
|
|
293
296
|
const elementTop = scrollElement.scrollTop
|
|
294
297
|
const topPos = document.getElementById(menu).offsetTop
|
|
295
298
|
if (Math.abs(elementTop - topPos) < extraHeight) {
|
|
@@ -500,9 +503,11 @@ const ProductOptionsUI = (props) => {
|
|
|
500
503
|
<ProductName>
|
|
501
504
|
<span>{product?.name}</span>
|
|
502
505
|
</ProductName>
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
+
{!isCustomerMode && (
|
|
507
|
+
<span className='favorite' onClick={() => handleChangeFavorite()}>
|
|
508
|
+
{product?.favorite ? <Like /> : <DisLike />}
|
|
509
|
+
</span>
|
|
510
|
+
)}
|
|
506
511
|
</TitleWrapper>
|
|
507
512
|
<Properties>
|
|
508
513
|
{isHaveWeight ? (
|
|
@@ -8,7 +8,6 @@ import BsCircleFill from '@meronex/icons/bs/BsCircleFill'
|
|
|
8
8
|
import BsCircleHalf from '@meronex/icons/bs/BsCircleHalf'
|
|
9
9
|
import BsDashCircle from '@meronex/icons/bs/BsDashCircle'
|
|
10
10
|
import BsPlusCircle from '@meronex/icons/bs/BsPlusCircle'
|
|
11
|
-
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
12
11
|
|
|
13
12
|
import {
|
|
14
13
|
Container,
|
|
@@ -45,7 +44,6 @@ const ProductOptionSubOptionUI = (props) => {
|
|
|
45
44
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
46
45
|
const [, t] = useLanguage()
|
|
47
46
|
const [{ parsePrice }] = useUtils()
|
|
48
|
-
const { width } = useWindowSize()
|
|
49
47
|
const [showMessage, setShowMessage] = useState(false)
|
|
50
48
|
const dirtyRef = useRef(null)
|
|
51
49
|
|
|
@@ -80,8 +78,10 @@ const ProductOptionSubOptionUI = (props) => {
|
|
|
80
78
|
|
|
81
79
|
useEffect(() => {
|
|
82
80
|
if (balance === option?.max && state?.selected && dirtyRef) {
|
|
83
|
-
dirtyRef
|
|
84
|
-
|
|
81
|
+
if (dirtyRef?.current !== null) {
|
|
82
|
+
dirtyRef.current = false
|
|
83
|
+
setIsScrollAvailable(true)
|
|
84
|
+
}
|
|
85
85
|
}
|
|
86
86
|
}, [state?.selected])
|
|
87
87
|
|
|
@@ -120,7 +120,6 @@ const ProductOptionSubOptionUI = (props) => {
|
|
|
120
120
|
)}
|
|
121
121
|
<Text>
|
|
122
122
|
<div>{suboption?.name}</div>
|
|
123
|
-
{showMessage && width > 576 && <span>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</span>}
|
|
124
123
|
</Text>
|
|
125
124
|
</LeftOptionContainer>
|
|
126
125
|
<RightOptionContainer>
|
|
@@ -167,7 +166,7 @@ const ProductOptionSubOptionUI = (props) => {
|
|
|
167
166
|
)}
|
|
168
167
|
</SuboptionPrice>
|
|
169
168
|
</Container>
|
|
170
|
-
{showMessage &&
|
|
169
|
+
{showMessage && (
|
|
171
170
|
<Text noMargin>
|
|
172
171
|
<span>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</span>
|
|
173
172
|
</Text>
|