ordering-ui-external 11.0.5 → 11.0.6
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.8cefea0092c95753147e.js → 7.ordering-ui.6eb4ea73ee332216542d.js} +1 -1
- package/_bundles/{ordering-ui.8cefea0092c95753147e.js → ordering-ui.6eb4ea73ee332216542d.js} +2 -2
- package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +5 -10
- package/package.json +2 -2
- package/src/themes/five/src/components/ProductOptionSubOption/index.js +8 -8
- /package/_bundles/{0.ordering-ui.8cefea0092c95753147e.js → 0.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{1.ordering-ui.8cefea0092c95753147e.js → 1.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{2.ordering-ui.8cefea0092c95753147e.js → 2.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{4.ordering-ui.8cefea0092c95753147e.js → 4.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{5.ordering-ui.8cefea0092c95753147e.js → 5.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{6.ordering-ui.8cefea0092c95753147e.js → 6.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{7.ordering-ui.8cefea0092c95753147e.js.LICENSE.txt → 7.ordering-ui.6eb4ea73ee332216542d.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.8cefea0092c95753147e.js → 8.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{9.ordering-ui.8cefea0092c95753147e.js → 9.ordering-ui.6eb4ea73ee332216542d.js} +0 -0
- /package/_bundles/{ordering-ui.8cefea0092c95753147e.js.LICENSE.txt → ordering-ui.6eb4ea73ee332216542d.js.LICENSE.txt} +0 -0
|
@@ -35,7 +35,7 @@ var ProductOptionSubOptionPropsAreEqual = function ProductOptionSubOptionPropsAr
|
|
|
35
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 _pizzaState, _props$beforeElements, _props$beforeComponen,
|
|
38
|
+
var _pizzaState, _pizzaState2, _props$beforeElements, _props$beforeComponen, _pizzaState3, _props$afterComponent, _props$afterElements;
|
|
39
39
|
var state = props.state,
|
|
40
40
|
increment = props.increment,
|
|
41
41
|
decrement = props.decrement,
|
|
@@ -48,7 +48,7 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
48
48
|
setIsScrollAvailable = props.setIsScrollAvailable,
|
|
49
49
|
usePizzaValidation = props.usePizzaValidation,
|
|
50
50
|
pizzaState = props.pizzaState;
|
|
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);
|
|
51
|
+
var disableIncrement = option !== null && option !== void 0 && option.with_half_option ? (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) === (option === null || option === void 0 ? void 0 : option.max) : 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);
|
|
52
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;
|
|
53
53
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
54
54
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -88,7 +88,7 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
88
88
|
if (!minMaxValidation) {
|
|
89
89
|
setShowMessage(false);
|
|
90
90
|
}
|
|
91
|
-
}, [balance, pizzaState === null || pizzaState === void 0 || (
|
|
91
|
+
}, [balance, 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]);
|
|
92
92
|
(0, _react.useEffect)(function () {
|
|
93
93
|
if (balance === (option === null || option === void 0 ? void 0 : option.max) && state !== null && state !== void 0 && state.selected && dirtyRef) {
|
|
94
94
|
if ((dirtyRef === null || dirtyRef === void 0 ? void 0 : dirtyRef.current) !== null) {
|
|
@@ -97,11 +97,6 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}, [state === null || state === void 0 ? void 0 : state.selected]);
|
|
100
|
-
(0, _react.useEffect)(function () {
|
|
101
|
-
if (option !== null && option !== void 0 && option.with_half_option) {
|
|
102
|
-
handlePosition({}, 'left');
|
|
103
|
-
}
|
|
104
|
-
}, [state === null || state === void 0 ? void 0 : state.selected, suboption === null || suboption === void 0 ? void 0 : suboption.id]);
|
|
105
100
|
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) {
|
|
106
101
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
107
102
|
key: i
|
|
@@ -124,7 +119,7 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
124
119
|
disabled: state.quantity === 0 || isSoldOut,
|
|
125
120
|
onClick: handleDecrement
|
|
126
121
|
}), state.quantity, /*#__PURE__*/_react.default.createElement(_BsPlusCircle.default, {
|
|
127
|
-
disabled: disableIncrement || isSoldOut,
|
|
122
|
+
disabled: disableIncrement || isSoldOut || usePizzaValidation,
|
|
128
123
|
onClick: handleIncrement
|
|
129
124
|
}))), /*#__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, {
|
|
130
125
|
className: ['reverse', state.selected && state.position === 'left' ? 'selected' : null].filter(function (classname) {
|
|
@@ -134,7 +129,7 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
|
|
|
134
129
|
return handlePosition(e, 'left');
|
|
135
130
|
}
|
|
136
131
|
}), /*#__PURE__*/_react.default.createElement(_BsCircleFill.default, {
|
|
137
|
-
className: [(pizzaState === null || pizzaState === void 0 || (
|
|
132
|
+
className: [(pizzaState === null || pizzaState === void 0 || (_pizzaState3 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState3 === void 0 ? void 0 : _pizzaState3.value) === (option === null || option === void 0 ? void 0 : option.max) ? 'disabled' : '', state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
|
|
138
133
|
return classname;
|
|
139
134
|
}).join(' '),
|
|
140
135
|
onClick: function onClick(e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-external",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.6",
|
|
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": "10.0.
|
|
91
|
+
"ordering-components-external": "10.0.8",
|
|
92
92
|
"payment": "^2.4.6",
|
|
93
93
|
"polished": "^3.6.6",
|
|
94
94
|
"react-bootstrap-icons": "^1.7.2",
|
|
@@ -48,7 +48,13 @@ const ProductOptionSubOptionUI = React.memo((props) => {
|
|
|
48
48
|
pizzaState
|
|
49
49
|
} = props
|
|
50
50
|
|
|
51
|
-
const disableIncrement =
|
|
51
|
+
const disableIncrement =
|
|
52
|
+
option?.with_half_option
|
|
53
|
+
? pizzaState?.[`option:${option?.id}`]?.value === option?.max
|
|
54
|
+
: option?.limit_suboptions_by_max
|
|
55
|
+
? (balance === option?.max || state.quantity === suboption.max)
|
|
56
|
+
: state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
57
|
+
|
|
52
58
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
53
59
|
const [, t] = useLanguage()
|
|
54
60
|
const [{ parsePrice }] = useUtils()
|
|
@@ -95,12 +101,6 @@ const ProductOptionSubOptionUI = React.memo((props) => {
|
|
|
95
101
|
}
|
|
96
102
|
}, [state?.selected])
|
|
97
103
|
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
if (option?.with_half_option) {
|
|
100
|
-
handlePosition({}, 'left')
|
|
101
|
-
}
|
|
102
|
-
}, [state?.selected, suboption?.id])
|
|
103
|
-
|
|
104
104
|
return (
|
|
105
105
|
<>
|
|
106
106
|
{props.beforeElements?.map((BeforeElement, i) => (
|
|
@@ -144,7 +144,7 @@ const ProductOptionSubOptionUI = React.memo((props) => {
|
|
|
144
144
|
/>
|
|
145
145
|
{state.quantity}
|
|
146
146
|
<BsPlusCircle
|
|
147
|
-
disabled={disableIncrement || isSoldOut}
|
|
147
|
+
disabled={disableIncrement || isSoldOut || usePizzaValidation}
|
|
148
148
|
onClick={handleIncrement}
|
|
149
149
|
/>
|
|
150
150
|
</>
|
/package/_bundles/{0.ordering-ui.8cefea0092c95753147e.js → 0.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|
/package/_bundles/{1.ordering-ui.8cefea0092c95753147e.js → 1.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|
/package/_bundles/{2.ordering-ui.8cefea0092c95753147e.js → 2.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|
/package/_bundles/{4.ordering-ui.8cefea0092c95753147e.js → 4.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|
/package/_bundles/{5.ordering-ui.8cefea0092c95753147e.js → 5.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|
/package/_bundles/{6.ordering-ui.8cefea0092c95753147e.js → 6.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|
|
File without changes
|
/package/_bundles/{8.ordering-ui.8cefea0092c95753147e.js → 8.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|
/package/_bundles/{9.ordering-ui.8cefea0092c95753147e.js → 9.ordering-ui.6eb4ea73ee332216542d.js}
RENAMED
|
File without changes
|