ordering-ui-external 10.10.22 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/{7.ordering-ui.912d728f17fd4dc8bb87.js → 7.ordering-ui.fa5f19340751cb2d73a3.js} +1 -1
- package/_bundles/{ordering-ui.912d728f17fd4dc8bb87.js → ordering-ui.fa5f19340751cb2d73a3.js} +2 -2
- package/_modules/components/BusinessProductsList/index.js +15 -4
- package/_modules/themes/callcenterOriginal/src/components/CartPopover/styles.js +1 -1
- package/_modules/themes/callcenterOriginal/src/components/Header/index.js +0 -1
- package/_modules/themes/callcenterOriginal/src/components/Header/styles.js +2 -2
- package/_modules/themes/five/src/components/BusinessProductsList/SubcategoriesComponent/index.js +57 -0
- package/_modules/themes/five/src/components/BusinessProductsList/index.js +21 -63
- package/_modules/themes/five/src/components/Cart/index.js +1 -1
- package/_modules/themes/five/src/components/HighestRated/index.js +40 -7
- package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
- package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +4 -1
- package/_modules/themes/five/src/components/OrderDetails/index.js +2 -1
- package/_modules/themes/five/src/components/ProductForm/index.js +2 -2
- package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +14 -13
- package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +1 -1
- package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +3 -2
- package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +3 -2
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +7 -13
- package/package.json +2 -2
- package/src/components/BusinessProductsList/index.js +9 -1
- package/src/themes/callcenterOriginal/src/components/CartPopover/styles.js +1 -1
- package/src/themes/callcenterOriginal/src/components/Header/index.js +0 -1
- package/src/themes/callcenterOriginal/src/components/Header/styles.js +2 -2
- package/src/themes/five/src/components/BusinessProductsList/SubcategoriesComponent/index.js +57 -0
- package/src/themes/five/src/components/BusinessProductsList/index.js +13 -64
- package/src/themes/five/src/components/Cart/index.js +1 -1
- package/src/themes/five/src/components/HighestRated/index.js +35 -1
- package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
- package/src/themes/five/src/components/OrderDetails/OrderEta.js +1 -1
- package/src/themes/five/src/components/OrderDetails/index.js +2 -1
- package/src/themes/five/src/components/ProductForm/index.js +2 -2
- package/src/themes/five/src/components/ProductOptionSubOption/index.js +11 -12
- package/src/themes/five/src/components/ProductOptionSubOption/styles.js +1 -1
- package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +3 -2
- package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +3 -2
- package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +12 -17
- package/template/pages/SignUpDriver/index.js +5 -1
- /package/_bundles/{0.ordering-ui.912d728f17fd4dc8bb87.js → 0.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{1.ordering-ui.912d728f17fd4dc8bb87.js → 1.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{2.ordering-ui.912d728f17fd4dc8bb87.js → 2.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{4.ordering-ui.912d728f17fd4dc8bb87.js → 4.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{5.ordering-ui.912d728f17fd4dc8bb87.js → 5.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{6.ordering-ui.912d728f17fd4dc8bb87.js → 6.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{7.ordering-ui.912d728f17fd4dc8bb87.js.LICENSE.txt → 7.ordering-ui.fa5f19340751cb2d73a3.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.912d728f17fd4dc8bb87.js → 8.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{9.ordering-ui.912d728f17fd4dc8bb87.js → 9.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
- /package/_bundles/{ordering-ui.912d728f17fd4dc8bb87.js.LICENSE.txt → ordering-ui.fa5f19340751cb2d73a3.js.LICENSE.txt} +0 -0
- /package/template/{utils → Utils}/index.js +0 -0
|
@@ -32,10 +32,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
32
32
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
33
33
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
34
|
var ProductOptionSubOptionPropsAreEqual = function ProductOptionSubOptionPropsAreEqual(prevProps, nextProps) {
|
|
35
|
-
return JSON.stringify(prevProps.state) === JSON.stringify(nextProps.state) && prevProps.
|
|
35
|
+
return JSON.stringify(prevProps.state) === JSON.stringify(nextProps.state) && JSON.stringify(prevProps.pizzaState) === JSON.stringify(nextProps.pizzaState) && prevProps.balance === nextProps.balance && JSON.stringify(prevProps.productCart) === JSON.stringify(nextProps.productCart);
|
|
36
36
|
};
|
|
37
37
|
var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props) {
|
|
38
|
-
var _props$beforeElements, _props$beforeComponen, _props$afterComponent, _props$afterElements;
|
|
38
|
+
var _pizzaState, _props$beforeElements, _props$beforeComponen, _pizzaState2, _props$afterComponent, _props$afterElements;
|
|
39
39
|
var state = props.state,
|
|
40
40
|
increment = props.increment,
|
|
41
41
|
decrement = props.decrement,
|
|
@@ -46,9 +46,8 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
46
46
|
changePosition = props.changePosition,
|
|
47
47
|
isSoldOut = props.isSoldOut,
|
|
48
48
|
setIsScrollAvailable = props.setIsScrollAvailable,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
productCart = props.productCart;
|
|
49
|
+
usePizzaValidation = props.usePizzaValidation,
|
|
50
|
+
pizzaState = props.pizzaState;
|
|
52
51
|
var disableIncrement = option !== null && option !== void 0 && option.limit_suboptions_by_max ? balance === (option === null || option === void 0 ? void 0 : option.max) || state.quantity === suboption.max : state.quantity === (suboption === null || suboption === void 0 ? void 0 : suboption.max) || !state.selected && balance === (option === null || option === void 0 ? void 0 : option.max);
|
|
53
52
|
var price = option !== null && option !== void 0 && option.with_half_option && suboption !== null && suboption !== void 0 && suboption.half_price && state.position !== 'whole' ? suboption === null || suboption === void 0 ? void 0 : suboption.half_price : suboption === null || suboption === void 0 ? void 0 : suboption.price;
|
|
54
53
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
@@ -78,16 +77,18 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
78
77
|
var _option$suboptions;
|
|
79
78
|
dirtyRef.current = true;
|
|
80
79
|
toggleSelect();
|
|
81
|
-
|
|
80
|
+
var minMaxValidation = option !== null && option !== void 0 && option.with_half_option ? usePizzaValidation : balance === (option === null || option === void 0 ? void 0 : option.max) && (option === null || option === void 0 || (_option$suboptions = option.suboptions) === null || _option$suboptions === void 0 ? void 0 : _option$suboptions.length) > balance && !((option === null || option === void 0 ? void 0 : option.min) === 1 && (option === null || option === void 0 ? void 0 : option.max) === 1);
|
|
81
|
+
if (!state.selected && minMaxValidation) {
|
|
82
82
|
setShowMessage(true);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
(0, _react.useEffect)(function () {
|
|
86
86
|
var _option$suboptions2;
|
|
87
|
-
|
|
87
|
+
var minMaxValidation = option !== null && option !== void 0 && option.with_half_option ? usePizzaValidation : !state.selected && balance === (option === null || option === void 0 ? void 0 : option.max) && (option === null || option === void 0 || (_option$suboptions2 = option.suboptions) === null || _option$suboptions2 === void 0 ? void 0 : _option$suboptions2.length) > balance && !((option === null || option === void 0 ? void 0 : option.min) === 1 && (option === null || option === void 0 ? void 0 : option.max) === 1);
|
|
88
|
+
if (!minMaxValidation) {
|
|
88
89
|
setShowMessage(false);
|
|
89
90
|
}
|
|
90
|
-
}, [balance]);
|
|
91
|
+
}, [balance, pizzaState === null || pizzaState === void 0 || (_pizzaState = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState === void 0 ? void 0 : _pizzaState.value]);
|
|
91
92
|
(0, _react.useEffect)(function () {
|
|
92
93
|
if (balance === (option === null || option === void 0 ? void 0 : option.max) && state !== null && state !== void 0 && state.selected && dirtyRef) {
|
|
93
94
|
if ((dirtyRef === null || dirtyRef === void 0 ? void 0 : dirtyRef.current) !== null) {
|
|
@@ -97,10 +98,10 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
97
98
|
}
|
|
98
99
|
}, [state === null || state === void 0 ? void 0 : state.selected]);
|
|
99
100
|
(0, _react.useEffect)(function () {
|
|
100
|
-
if (
|
|
101
|
+
if (option !== null && option !== void 0 && option.with_half_option) {
|
|
101
102
|
handlePosition({}, 'left');
|
|
102
103
|
}
|
|
103
|
-
}, [
|
|
104
|
+
}, [state === null || state === void 0 ? void 0 : state.selected, suboption === null || suboption === void 0 ? void 0 : suboption.id]);
|
|
104
105
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (_props$beforeElements = props.beforeElements) === null || _props$beforeElements === void 0 ? void 0 : _props$beforeElements.map(function (BeforeElement, i) {
|
|
105
106
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
106
107
|
key: i
|
|
@@ -126,21 +127,21 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
126
127
|
disabled: disableIncrement || isSoldOut,
|
|
127
128
|
onClick: handleIncrement
|
|
128
129
|
}))), /*#__PURE__*/_react.default.createElement(_styles.PositionControl, null, (option === null || option === void 0 ? void 0 : option.with_half_option) && (state === null || state === void 0 ? void 0 : state.selected) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_BsCircleHalf.default, {
|
|
129
|
-
className: [
|
|
130
|
+
className: ['reverse', state.selected && state.position === 'left' ? 'selected' : null].filter(function (classname) {
|
|
130
131
|
return classname;
|
|
131
132
|
}).join(' '),
|
|
132
133
|
onClick: function onClick(e) {
|
|
133
134
|
return handlePosition(e, 'left');
|
|
134
135
|
}
|
|
135
136
|
}), /*#__PURE__*/_react.default.createElement(_BsCircleFill.default, {
|
|
136
|
-
className: [
|
|
137
|
+
className: [(pizzaState === null || pizzaState === void 0 || (_pizzaState2 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState2 === void 0 ? void 0 : _pizzaState2.value) === (option === null || option === void 0 ? void 0 : option.max) ? 'disabled' : '', state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
|
|
137
138
|
return classname;
|
|
138
139
|
}).join(' '),
|
|
139
140
|
onClick: function onClick(e) {
|
|
140
141
|
return handlePosition(e, 'whole');
|
|
141
142
|
}
|
|
142
143
|
}), /*#__PURE__*/_react.default.createElement(_BsCircleHalf.default, {
|
|
143
|
-
className: [
|
|
144
|
+
className: [state.selected && state.position === 'right' ? 'selected' : null].filter(function (classname) {
|
|
144
145
|
return classname;
|
|
145
146
|
}).join(' '),
|
|
146
147
|
onClick: function onClick(e) {
|
|
@@ -25,7 +25,7 @@ var Text = exports.Text = _styledComponents.default.div(_templateObject4 || (_te
|
|
|
25
25
|
return props.theme.colors.primary;
|
|
26
26
|
}, function (props) {
|
|
27
27
|
var _props$theme2;
|
|
28
|
-
return ((_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.rtl) && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: 0;\n margin-right: 10px
|
|
28
|
+
return ((_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.rtl) && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: 0;\n margin-right: 10px; \n "])));
|
|
29
29
|
}, function (_ref) {
|
|
30
30
|
var noMargin = _ref.noMargin;
|
|
31
31
|
return noMargin && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n span {\n margin: 0;\n }\n "])));
|
|
@@ -57,7 +57,8 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
|
|
|
57
57
|
saveCustomerUser = props.saveCustomerUser,
|
|
58
58
|
fieldsNotValid = props.fieldsNotValid,
|
|
59
59
|
signupData = props.signupData,
|
|
60
|
-
enableReCaptcha = props.enableReCaptcha
|
|
60
|
+
enableReCaptcha = props.enableReCaptcha,
|
|
61
|
+
isDriverSignup = props.isDriverSignup;
|
|
61
62
|
var theme = (0, _styledComponents.useTheme)();
|
|
62
63
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
63
64
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -358,7 +359,7 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
|
|
|
358
359
|
className: "formButton",
|
|
359
360
|
disabled: formState.loading || (validationFields === null || validationFields === void 0 ? void 0 : validationFields.loading)
|
|
360
361
|
}, formState.loading ? "".concat(t('LOADING', 'Loading'), "...") : t('SUBMIT', 'Submit')))), /*#__PURE__*/_react.default.createElement(_Confirm.Alert, {
|
|
361
|
-
title: t('SIGN_UP_FOR_BUSINESS', 'Sign up for business'),
|
|
362
|
+
title: isDriverSignup ? t('SIGN_UP_FOR_DRIVER', 'Sign up for driver') : t('SIGN_UP_FOR_BUSINESS', 'Sign up for business'),
|
|
362
363
|
content: alertState.content,
|
|
363
364
|
acceptText: t('ACCEPT', 'Accept'),
|
|
364
365
|
open: alertState.open,
|
|
@@ -57,7 +57,8 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
|
|
|
57
57
|
saveCustomerUser = props.saveCustomerUser,
|
|
58
58
|
fieldsNotValid = props.fieldsNotValid,
|
|
59
59
|
signupData = props.signupData,
|
|
60
|
-
enableReCaptcha = props.enableReCaptcha
|
|
60
|
+
enableReCaptcha = props.enableReCaptcha,
|
|
61
|
+
isDriverSignup = props.isDriverSignup;
|
|
61
62
|
var theme = (0, _styledComponents.useTheme)();
|
|
62
63
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
63
64
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -353,7 +354,7 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
|
|
|
353
354
|
type: "submit",
|
|
354
355
|
disabled: formState.loading || (validationFields === null || validationFields === void 0 ? void 0 : validationFields.loading)
|
|
355
356
|
}, formState.loading ? "".concat(t('LOADING', 'Loading'), "...") : t('SUBMIT', 'Submit')))), /*#__PURE__*/_react.default.createElement(_Confirm.Alert, {
|
|
356
|
-
title: t('SIGN_UP_FOR_BUSINESS', 'Sign up for business'),
|
|
357
|
+
title: isDriverSignup ? t('SIGN_UP_FOR_DRIVER', 'Sign up for driver') : t('SIGN_UP_FOR_BUSINESS', 'Sign up for business'),
|
|
357
358
|
content: alertState.content,
|
|
358
359
|
acceptText: t('ACCEPT', 'Accept'),
|
|
359
360
|
open: alertState.open,
|
|
@@ -37,7 +37,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
37
37
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
38
38
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
39
39
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
40
|
-
var
|
|
40
|
+
var singleProductCardPropsAreEqual = function singleProductCardPropsAreEqual(prevProps, nextProps) {
|
|
41
|
+
return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) && prevProps.isSkeleton === nextProps.isSkeleton && prevProps.isSoldOut === nextProps.isSoldOut && prevProps.isCartOnProductsList === nextProps.isCartOnProductsList && prevProps.productAddedToCartLength === nextProps.productAddedToCartLength;
|
|
42
|
+
};
|
|
43
|
+
var SingleProductCardUI = /*#__PURE__*/_react.default.memo(function (props) {
|
|
41
44
|
var _theme$business_view$, _theme$business_view, _theme$business_view2, _theme$business_view3, _theme$viewString, _theme$business_view4, _theme$images, _theme$images2, _product$ribbon, _product$ribbon2, _product$ribbon3, _product$ribbon4, _product$ribbon5, _theme$images3, _product$ribbon6, _theme$defaultLanguag, _theme$defaultLanguag2, _theme$defaultLanguag3, _theme$defaultLanguag4;
|
|
42
45
|
var product = props.product,
|
|
43
46
|
isSoldOut = props.isSoldOut,
|
|
@@ -175,7 +178,7 @@ var SingleProductCardUI = function SingleProductCardUI(props) {
|
|
|
175
178
|
style: useCustomFunctionality && customStyle,
|
|
176
179
|
className: "product-card",
|
|
177
180
|
isShowAddButt: !useCustomFunctionality && !hideAddButton && !isSkeleton
|
|
178
|
-
}, isObservedValidation
|
|
181
|
+
}, isObservedValidation && /*#__PURE__*/_react.default.createElement("div", null, !useCustomFunctionality && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !isSkeleton && productAddedToCartLength > 0 && /*#__PURE__*/_react.default.createElement(_styles.QuantityContainer, null, /*#__PURE__*/_react.default.createElement("span", null, productAddedToCartLength)), /*#__PURE__*/_react.default.createElement(_styles.CardInfo, {
|
|
179
182
|
soldOut: isSoldOut || maxProductQuantity <= 0,
|
|
180
183
|
isBgimage: optimizeImage((product === null || product === void 0 ? void 0 : product.images) || (theme === null || theme === void 0 || (_theme$images = theme.images) === null || _theme$images === void 0 || (_theme$images = _theme$images.dummies) === null || _theme$images === void 0 ? void 0 : _theme$images.product), 'h_86,c_limit'),
|
|
181
184
|
oneLine: isPreviously
|
|
@@ -230,16 +233,7 @@ var SingleProductCardUI = function SingleProductCardUI(props) {
|
|
|
230
233
|
fontSize: 16,
|
|
231
234
|
fontWeight: 500
|
|
232
235
|
}
|
|
233
|
-
}, customText))
|
|
234
|
-
width: 100
|
|
235
|
-
}), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
236
|
-
width: 100
|
|
237
|
-
}), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
238
|
-
width: 100
|
|
239
|
-
})), /*#__PURE__*/_react.default.createElement(_styles.SkeletonCardLogo, null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
240
|
-
height: 75,
|
|
241
|
-
width: 75
|
|
242
|
-
}))), !useCustomFunctionality && !hideAddButton && !isSkeleton && /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
236
|
+
}, customText)), !useCustomFunctionality && !hideAddButton && !isSkeleton && /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
243
237
|
outline: true,
|
|
244
238
|
color: "primary",
|
|
245
239
|
disabled: productAddedToCartLength && (product === null || product === void 0 ? void 0 : product.maximum_per_order) && productAddedToCartLength >= (product === null || product === void 0 ? void 0 : product.maximum_per_order)
|
|
@@ -312,7 +306,7 @@ var SingleProductCardUI = function SingleProductCardUI(props) {
|
|
|
312
306
|
},
|
|
313
307
|
closeOnBackdrop: false
|
|
314
308
|
}));
|
|
315
|
-
};
|
|
309
|
+
}, singleProductCardPropsAreEqual);
|
|
316
310
|
var SingleProductCard = exports.SingleProductCard = function SingleProductCard(props) {
|
|
317
311
|
var singleProductCardProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
318
312
|
UIComponent: SingleProductCardUI
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-external",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "Ordering UI Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"lodash": "^4.17.19",
|
|
89
89
|
"moment": "^2.29.4",
|
|
90
90
|
"nanoid": "^4.0.0",
|
|
91
|
-
"ordering-components-external": "
|
|
91
|
+
"ordering-components-external": "10.0.0",
|
|
92
92
|
"payment": "^2.4.6",
|
|
93
93
|
"polished": "^3.6.6",
|
|
94
94
|
"react-bootstrap-icons": "^1.7.2",
|
|
@@ -33,6 +33,14 @@ const BusinessProductsListUI = (props) => {
|
|
|
33
33
|
|
|
34
34
|
const [, t] = useLanguage()
|
|
35
35
|
|
|
36
|
+
const uniqueFeaturedProducts = (data, key) => {
|
|
37
|
+
return [
|
|
38
|
+
...new Map(
|
|
39
|
+
data.map(p => [key(p), p])
|
|
40
|
+
).values()
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
return (
|
|
37
45
|
<>
|
|
38
46
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -69,7 +77,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
69
77
|
<WrapAllCategories>
|
|
70
78
|
<h3>{t('FEATURED', 'Featured')}</h3>
|
|
71
79
|
<ProductsListing>
|
|
72
|
-
{categoryState.products?.sort((a, b) => a.rank - b.rank).
|
|
80
|
+
{uniqueFeaturedProducts(categoryState.products?.sort((a, b) => a.rank - b.rank).filter((p, i, hash) => p.featured), (product) => product.name)?.sort((a, b) => a.rank - b.rank).map(product => (
|
|
73
81
|
<SingleProductCard
|
|
74
82
|
key={product?.id}
|
|
75
83
|
isSoldOut={(product.inventoried && !product.quantity)}
|
|
@@ -40,7 +40,6 @@ import { HeaderOption } from '../HeaderOption'
|
|
|
40
40
|
import { SidebarMenu } from '../SidebarMenu'
|
|
41
41
|
import { UserDetails } from '../UserDetails'
|
|
42
42
|
import { Confirm } from '../Confirm'
|
|
43
|
-
import { getDistance } from '../../../../../utils'
|
|
44
43
|
import { BusinessPreorder } from '../BusinessPreorder'
|
|
45
44
|
import { AdminAreaPopover } from '../AdminAreaPopover'
|
|
46
45
|
|
|
@@ -184,7 +184,7 @@ export const Menu = styled.div`
|
|
|
184
184
|
min-width: auto;
|
|
185
185
|
text-overflow: ellipsis;
|
|
186
186
|
overflow: hidden;
|
|
187
|
-
width: 40px;
|
|
187
|
+
min-width: 40px;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
@media (min-width: 1123px) {
|
|
@@ -336,7 +336,7 @@ export const MomentMenu = styled.div`
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
@media (min-width: 1400px) {
|
|
339
|
-
width:
|
|
339
|
+
width: 300px;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
> div {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useLanguage } from 'ordering-components-external'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { ContainerButton, SubCategoriesContainer, SubCategoriesInnerContainer } from '../styles'
|
|
4
|
+
import { AutoScroll } from '../../AutoScroll'
|
|
5
|
+
import { XLg as Close } from 'react-bootstrap-icons'
|
|
6
|
+
import { Button } from '../../../styles/Buttons'
|
|
7
|
+
|
|
8
|
+
const subcategoriesComponentPropsAreEqual = (prevProps, nextProps) => {
|
|
9
|
+
return JSON.stringify(prevProps.category) === JSON.stringify(nextProps.category) &&
|
|
10
|
+
JSON.stringify(prevProps.subcategoriesSelected) === JSON.stringify(nextProps.subcategoriesSelected)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SubcategoriesComponent = React.memo((props) => {
|
|
14
|
+
const {
|
|
15
|
+
category,
|
|
16
|
+
subcategoriesSelected,
|
|
17
|
+
onClickSubcategory
|
|
18
|
+
} = props
|
|
19
|
+
|
|
20
|
+
const [, t] = useLanguage()
|
|
21
|
+
const allsubcategorySelected = !subcategoriesSelected?.some(subcategory => category?.id === subcategory?.parent_category_id)
|
|
22
|
+
return (
|
|
23
|
+
<SubCategoriesContainer>
|
|
24
|
+
<SubCategoriesInnerContainer>
|
|
25
|
+
<AutoScroll scrollId={`scroll_${category?.id}`}>
|
|
26
|
+
<ContainerButton
|
|
27
|
+
isSelected={allsubcategorySelected}
|
|
28
|
+
>
|
|
29
|
+
<Button
|
|
30
|
+
onClick={() => onClickSubcategory(null, category)}
|
|
31
|
+
color={allsubcategorySelected ? 'primary' : 'lightGray'}
|
|
32
|
+
>
|
|
33
|
+
{t('ALL', 'All')}
|
|
34
|
+
</Button>
|
|
35
|
+
</ContainerButton>
|
|
36
|
+
{category?.subcategories?.map(subcategory => {
|
|
37
|
+
const isSubcategorySelected = subcategoriesSelected?.find(_subcategory => _subcategory?.id === subcategory?.id)
|
|
38
|
+
return (
|
|
39
|
+
<ContainerButton
|
|
40
|
+
key={subcategory?.id}
|
|
41
|
+
isSelected={isSubcategorySelected}
|
|
42
|
+
>
|
|
43
|
+
<Button
|
|
44
|
+
onClick={() => onClickSubcategory(subcategory, category)}
|
|
45
|
+
color={isSubcategorySelected ? 'primary' : 'lightGray'}
|
|
46
|
+
>
|
|
47
|
+
{subcategory?.name} {isSubcategorySelected && <Close />}
|
|
48
|
+
</Button>
|
|
49
|
+
</ContainerButton>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
)}
|
|
53
|
+
</AutoScroll>
|
|
54
|
+
</SubCategoriesInnerContainer>
|
|
55
|
+
</SubCategoriesContainer>
|
|
56
|
+
)
|
|
57
|
+
}, subcategoriesComponentPropsAreEqual)
|
|
@@ -6,7 +6,6 @@ import { NotFoundSource } from '../NotFoundSource'
|
|
|
6
6
|
import { Modal } from '../Modal'
|
|
7
7
|
import { shape } from '../../../../../utils'
|
|
8
8
|
import { AutoScroll } from '../AutoScroll'
|
|
9
|
-
import { XLg as Close } from 'react-bootstrap-icons'
|
|
10
9
|
|
|
11
10
|
import {
|
|
12
11
|
ProductsContainer,
|
|
@@ -17,16 +16,13 @@ import {
|
|
|
17
16
|
HeaderWrapper,
|
|
18
17
|
DescriptionModalContainer,
|
|
19
18
|
RibbonBox,
|
|
20
|
-
SubCategoriesContainer,
|
|
21
|
-
ContainerButton,
|
|
22
19
|
CategoryDescription,
|
|
23
20
|
DescriptionContainer,
|
|
24
21
|
SubcategorySearchContainer,
|
|
25
|
-
SubCategoriesInnerContainer,
|
|
26
22
|
PreviouslyOrderedContainer,
|
|
27
23
|
PreviouslyOrderedWrapper
|
|
28
24
|
} from './styles'
|
|
29
|
-
import {
|
|
25
|
+
import { SubcategoriesComponent } from './SubcategoriesComponent'
|
|
30
26
|
|
|
31
27
|
const BusinessProductsListUI = (props) => {
|
|
32
28
|
const {
|
|
@@ -60,6 +56,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
60
56
|
const isUseParentCategory = configs?.use_parent_category?.value === 'true' || configs?.use_parent_category?.value === '1'
|
|
61
57
|
const [openDescription, setOpenDescription] = useState(null)
|
|
62
58
|
const headerRef = useRef()
|
|
59
|
+
|
|
63
60
|
const onClickSubcategory = (subCategory, parentCategory) => {
|
|
64
61
|
if (parentCategory && isLazy) {
|
|
65
62
|
onClickCategory(parentCategory)
|
|
@@ -76,46 +73,6 @@ const BusinessProductsListUI = (props) => {
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
const SubcategoriesComponent = ({ category }) => {
|
|
80
|
-
const allsubcategorySelected = !subcategoriesSelected?.some(subcategory => category?.id === subcategory?.parent_category_id)
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<SubCategoriesContainer>
|
|
84
|
-
<SubCategoriesInnerContainer>
|
|
85
|
-
<AutoScroll scrollId={`scroll_${category?.id}`}>
|
|
86
|
-
<ContainerButton
|
|
87
|
-
isSelected={allsubcategorySelected}
|
|
88
|
-
>
|
|
89
|
-
<Button
|
|
90
|
-
onClick={() => onClickSubcategory(null, category)}
|
|
91
|
-
color={allsubcategorySelected ? 'primary' : 'lightGray'}
|
|
92
|
-
>
|
|
93
|
-
{t('ALL', 'All')}
|
|
94
|
-
</Button>
|
|
95
|
-
</ContainerButton>
|
|
96
|
-
{category?.subcategories?.map(subcategory => {
|
|
97
|
-
const isSubcategorySelected = subcategoriesSelected?.find(_subcategory => _subcategory?.id === subcategory?.id)
|
|
98
|
-
return (
|
|
99
|
-
<ContainerButton
|
|
100
|
-
key={subcategory?.id}
|
|
101
|
-
isSelected={isSubcategorySelected}
|
|
102
|
-
>
|
|
103
|
-
<Button
|
|
104
|
-
onClick={() => onClickSubcategory(subcategory, category)}
|
|
105
|
-
color={isSubcategorySelected ? 'primary' : 'lightGray'}
|
|
106
|
-
>
|
|
107
|
-
{subcategory?.name} {isSubcategorySelected && <Close />}
|
|
108
|
-
</Button>
|
|
109
|
-
</ContainerButton>
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
)}
|
|
113
|
-
</AutoScroll>
|
|
114
|
-
</SubCategoriesInnerContainer>
|
|
115
|
-
</SubCategoriesContainer>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
76
|
const productsCategorySelected = categoryState.products
|
|
120
77
|
?.filter(product =>
|
|
121
78
|
!subcategoriesSelected?.find(subcategory => subcategory?.parent_category_id === category?.id) ||
|
|
@@ -123,18 +80,16 @@ const BusinessProductsListUI = (props) => {
|
|
|
123
80
|
|
|
124
81
|
return (
|
|
125
82
|
<>
|
|
126
|
-
{props.beforeElements?.map((BeforeElement, i) => (
|
|
127
|
-
<React.Fragment key={i}>
|
|
128
|
-
{BeforeElement}
|
|
129
|
-
</React.Fragment>))}
|
|
130
|
-
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
131
|
-
<BeforeComponent key={i} {...props} />))}
|
|
132
83
|
<ProductsContainer>
|
|
133
84
|
{category?.id && (
|
|
134
85
|
<>
|
|
135
86
|
<HeaderWrapper>
|
|
136
87
|
{category?.subcategories?.length > 0 && !isSearchMode && (
|
|
137
|
-
<SubcategoriesComponent
|
|
88
|
+
<SubcategoriesComponent
|
|
89
|
+
category={category}
|
|
90
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
91
|
+
onClickSubcategory={onClickSubcategory}
|
|
92
|
+
/>
|
|
138
93
|
)}
|
|
139
94
|
</HeaderWrapper>
|
|
140
95
|
<ProductsListing>
|
|
@@ -226,7 +181,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
226
181
|
productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
|
|
227
182
|
/>
|
|
228
183
|
))}
|
|
229
|
-
{!business?.food && !categoryState?.loading && categoryState?.products?.length > 9 && (
|
|
184
|
+
{!business?.food && !categoryState?.loading && categoryState?.products?.filter(product => product.featured)?.length > 9 && (
|
|
230
185
|
<SingleProductCard
|
|
231
186
|
useCustomFunctionality
|
|
232
187
|
onCustomClick={() => onClickCategory(category)}
|
|
@@ -293,7 +248,11 @@ const BusinessProductsListUI = (props) => {
|
|
|
293
248
|
</CategoryDescription>
|
|
294
249
|
)}
|
|
295
250
|
{category?.subcategories?.length > 0 && !isSearchMode && (
|
|
296
|
-
<SubcategoriesComponent
|
|
251
|
+
<SubcategoriesComponent
|
|
252
|
+
category={category}
|
|
253
|
+
subcategoriesSelected={subcategoriesSelected}
|
|
254
|
+
onClickSubcategory={onClickSubcategory}
|
|
255
|
+
/>
|
|
297
256
|
)}
|
|
298
257
|
</HeaderWrapper>
|
|
299
258
|
<ProductsListing isSubcategorySearch={isSubcategorySearch}>
|
|
@@ -444,16 +403,6 @@ const BusinessProductsListUI = (props) => {
|
|
|
444
403
|
</DescriptionModalContainer>
|
|
445
404
|
</Modal>
|
|
446
405
|
</ProductsContainer>
|
|
447
|
-
{
|
|
448
|
-
props.afterComponents?.map((AfterComponent, i) => (
|
|
449
|
-
<AfterComponent key={i} {...props} />))
|
|
450
|
-
}
|
|
451
|
-
{
|
|
452
|
-
props.afterElements?.map((AfterElement, i) => (
|
|
453
|
-
<React.Fragment key={i}>
|
|
454
|
-
{AfterElement}
|
|
455
|
-
</React.Fragment>))
|
|
456
|
-
}
|
|
457
406
|
</>
|
|
458
407
|
)
|
|
459
408
|
}
|
|
@@ -399,7 +399,7 @@ const CartUI = (props) => {
|
|
|
399
399
|
)
|
|
400
400
|
}
|
|
401
401
|
{
|
|
402
|
-
cart?.taxes?.length > 0 && cart?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0).map(tax => (
|
|
402
|
+
cart?.taxes?.length > 0 && cart?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map(tax => (
|
|
403
403
|
<tr key={tax?.id}>
|
|
404
404
|
<td className='icon'>
|
|
405
405
|
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { useLanguage, useOrder, BusinessList as BusinessListController } from 'ordering-components-external'
|
|
3
3
|
import { BusinessController } from '../BusinessController'
|
|
4
4
|
import { Button } from '../../styles/Buttons'
|
|
@@ -12,6 +12,9 @@ import {
|
|
|
12
12
|
BusinessListWrapper
|
|
13
13
|
} from './styles'
|
|
14
14
|
import { AutoScroll } from '../AutoScroll'
|
|
15
|
+
import Modal from '../Modal'
|
|
16
|
+
import { BusinessPreorder } from '../BusinessPreorder'
|
|
17
|
+
import { getCateringValues } from '../../../../../utils'
|
|
15
18
|
|
|
16
19
|
const HighestRatedUI = (props) => {
|
|
17
20
|
const {
|
|
@@ -27,8 +30,25 @@ const HighestRatedUI = (props) => {
|
|
|
27
30
|
|
|
28
31
|
const [, t] = useLanguage()
|
|
29
32
|
const [orderState] = useOrder()
|
|
33
|
+
const [isPreorder, setIsPreorder] = useState(false)
|
|
34
|
+
const [preorderBusiness, setPreorderBusiness] = useState(null)
|
|
30
35
|
|
|
31
36
|
const isBusinessWithReviews = businessesList?.businesses?.every((business) => business?.reviews?.total === 0)
|
|
37
|
+
const cateringTypeString = orderState?.options?.type === 7
|
|
38
|
+
? 'catering_delivery'
|
|
39
|
+
: orderState?.options?.type === 8
|
|
40
|
+
? 'catering_pickup'
|
|
41
|
+
: null
|
|
42
|
+
const cateringValues = preorderBusiness?.configs && getCateringValues(cateringTypeString, preorderBusiness?.configs)
|
|
43
|
+
|
|
44
|
+
const handleClosePreorder = () => {
|
|
45
|
+
setIsPreorder(false)
|
|
46
|
+
setPreorderBusiness(null)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (preorderBusiness) setIsPreorder(true)
|
|
51
|
+
}, [preorderBusiness])
|
|
32
52
|
|
|
33
53
|
useEffect(() => {
|
|
34
54
|
if (!businessesList.loading) {
|
|
@@ -90,6 +110,7 @@ const HighestRatedUI = (props) => {
|
|
|
90
110
|
isCustomerMode={isCustomerMode}
|
|
91
111
|
favoriteIds={favoriteIds}
|
|
92
112
|
setFavoriteIds={setFavoriteIds}
|
|
113
|
+
onPreorderBusiness={setPreorderBusiness}
|
|
93
114
|
/>
|
|
94
115
|
)
|
|
95
116
|
))
|
|
@@ -114,6 +135,19 @@ const HighestRatedUI = (props) => {
|
|
|
114
135
|
</BusinessList>
|
|
115
136
|
</BusinessListWrapper>
|
|
116
137
|
</HighestRatedContainer>
|
|
138
|
+
<Modal
|
|
139
|
+
open={isPreorder}
|
|
140
|
+
width='760px'
|
|
141
|
+
onClose={() => handleClosePreorder()}
|
|
142
|
+
>
|
|
143
|
+
<BusinessPreorder
|
|
144
|
+
business={preorderBusiness}
|
|
145
|
+
handleClick={handleBusinessClick}
|
|
146
|
+
showButton
|
|
147
|
+
cateringPreorder={!!cateringTypeString}
|
|
148
|
+
{...cateringValues}
|
|
149
|
+
/>
|
|
150
|
+
</Modal>
|
|
117
151
|
{props.afterComponents?.map((AfterComponent, i) => (
|
|
118
152
|
<AfterComponent key={i} {...props} />))}
|
|
119
153
|
{props.afterElements?.map((AfterElement, i) => (
|
|
@@ -124,7 +124,7 @@ export const OrderBillSection = (props) => {
|
|
|
124
124
|
)
|
|
125
125
|
}
|
|
126
126
|
{
|
|
127
|
-
order?.taxes?.length > 0 && order?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0).map(tax => (
|
|
127
|
+
order?.taxes?.length > 0 && order?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map(tax => (
|
|
128
128
|
<tr key={tax?.id}>
|
|
129
129
|
<td>
|
|
130
130
|
{t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
|
|
@@ -57,7 +57,7 @@ export const OrderEta = (props) => {
|
|
|
57
57
|
}
|
|
58
58
|
estimatedUtcTime = moment.utc(_delivery).add(totalEta, 'minutes')
|
|
59
59
|
const _estimatedTime = outputFormat ? moment(estimatedUtcTime).local().format(outputFormat) : parseDate(estimatedUtcTime, { utc: false })
|
|
60
|
-
setEstimatedDeliveryTime(_estimatedTime)
|
|
60
|
+
setEstimatedDeliveryTime(order?.status === 13 ? parseDate(_delivery, { utc: !!order?.delivery_datetime_utc, outputFormat: outputFormat }) : _estimatedTime)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
useEffect(() => {
|
|
@@ -130,6 +130,7 @@ const OrderDetailsUI = (props) => {
|
|
|
130
130
|
const completedStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
131
131
|
const placeSpotTypes = [3, 4, 5]
|
|
132
132
|
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
133
|
+
const preorderStatus = [0, 13]
|
|
133
134
|
const googleMapsApiKey = configs?.google_maps_api_key?.value
|
|
134
135
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
135
136
|
|
|
@@ -546,7 +547,7 @@ const OrderDetailsUI = (props) => {
|
|
|
546
547
|
</DirectionButtonWrapper>
|
|
547
548
|
)}
|
|
548
549
|
</BusinessInfo>
|
|
549
|
-
{!hideOrderActions && (
|
|
550
|
+
{!hideOrderActions && !preorderStatus.includes(order?.status) && (
|
|
550
551
|
<BtsOrderStatus>
|
|
551
552
|
<div>
|
|
552
553
|
<Button
|
|
@@ -98,7 +98,7 @@ const ProductOptionsUI = (props) => {
|
|
|
98
98
|
handleChangeSuboptionState,
|
|
99
99
|
handleChangeCommentState,
|
|
100
100
|
productAddedToCartLength,
|
|
101
|
-
|
|
101
|
+
pizzaState,
|
|
102
102
|
handleFavoriteProduct,
|
|
103
103
|
handleCreateGuestUser,
|
|
104
104
|
actionStatus,
|
|
@@ -654,7 +654,7 @@ const ProductOptionsUI = (props) => {
|
|
|
654
654
|
isSoldOut={isSoldOut}
|
|
655
655
|
scrollDown={scrollDown}
|
|
656
656
|
setIsScrollAvailable={setIsScrollAvailable}
|
|
657
|
-
|
|
657
|
+
pizzaState={pizzaState}
|
|
658
658
|
productCart={productCart}
|
|
659
659
|
/>
|
|
660
660
|
)
|