ordering-ui-external 14.1.91 → 14.1.93

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.
Files changed (17) hide show
  1. package/_bundles/{7.ordering-ui.b84618721c7b15e5e4e3.js → 7.ordering-ui.812f92333fdb110abdd5.js} +1 -1
  2. package/_bundles/{ordering-ui.b84618721c7b15e5e4e3.js → ordering-ui.812f92333fdb110abdd5.js} +2 -2
  3. package/_modules/themes/five/src/components/Checkout/index.js +2 -1
  4. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +8 -5
  5. package/package.json +2 -2
  6. package/src/themes/five/src/components/Checkout/index.js +1 -0
  7. package/src/themes/five/src/components/ProductOptionSubOption/index.js +13 -1
  8. /package/_bundles/{0.ordering-ui.b84618721c7b15e5e4e3.js → 0.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  9. /package/_bundles/{1.ordering-ui.b84618721c7b15e5e4e3.js → 1.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  10. /package/_bundles/{2.ordering-ui.b84618721c7b15e5e4e3.js → 2.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  11. /package/_bundles/{4.ordering-ui.b84618721c7b15e5e4e3.js → 4.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  12. /package/_bundles/{5.ordering-ui.b84618721c7b15e5e4e3.js → 5.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  13. /package/_bundles/{6.ordering-ui.b84618721c7b15e5e4e3.js → 6.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  14. /package/_bundles/{7.ordering-ui.b84618721c7b15e5e4e3.js.LICENSE.txt → 7.ordering-ui.812f92333fdb110abdd5.js.LICENSE.txt} +0 -0
  15. /package/_bundles/{8.ordering-ui.b84618721c7b15e5e4e3.js → 8.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  16. /package/_bundles/{9.ordering-ui.b84618721c7b15e5e4e3.js → 9.ordering-ui.812f92333fdb110abdd5.js} +0 -0
  17. /package/_bundles/{ordering-ui.b84618721c7b15e5e4e3.js.LICENSE.txt → ordering-ui.812f92333fdb110abdd5.js.LICENSE.txt} +0 -0
@@ -817,7 +817,8 @@ var CheckoutUI = function CheckoutUI(props) {
817
817
  }
818
818
  }, /*#__PURE__*/_react.default.createElement(_PaymentOptionStripeLink.PaymentOptionStripeLink, {
819
819
  businessConfigs: (_businessDetails$busi13 = businessDetails === null || businessDetails === void 0 || (_businessDetails$busi14 = businessDetails.business) === null || _businessDetails$busi14 === void 0 ? void 0 : _businessDetails$busi14.configs) !== null && _businessDetails$busi13 !== void 0 ? _businessDetails$busi13 : [],
820
- paymentURL: cart === null || cart === void 0 || (_cart$paymethod_data = cart.paymethod_data) === null || _cart$paymethod_data === void 0 || (_cart$paymethod_data = _cart$paymethod_data.result) === null || _cart$paymethod_data === void 0 ? void 0 : _cart$paymethod_data.payment_url
820
+ paymentURL: cart === null || cart === void 0 || (_cart$paymethod_data = cart.paymethod_data) === null || _cart$paymethod_data === void 0 || (_cart$paymethod_data = _cart$paymethod_data.result) === null || _cart$paymethod_data === void 0 ? void 0 : _cart$paymethod_data.payment_url,
821
+ cartTotal: cart === null || cart === void 0 ? void 0 : cart.total
821
822
  })));
822
823
  };
823
824
  var Checkout = exports.Checkout = function Checkout(props) {
@@ -36,7 +36,7 @@ var ProductOptionSubOptionPropsAreEqual = function ProductOptionSubOptionPropsAr
36
36
  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);
37
37
  };
38
38
  var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props) {
39
- var _pizzaState, _option$name, _option$name$toLowerC, _pizzaState2, _props$beforeElements, _props$beforeComponen, _pizzaState3, _pizzaState4, _props$afterComponent, _props$afterElements;
39
+ var _pizzaState, _pizzaState2, _option$name, _option$name$toLowerC, _pizzaState3, _props$beforeElements, _props$beforeComponen, _pizzaState4, _pizzaState5, _props$afterComponent, _props$afterElements;
40
40
  var state = props.state,
41
41
  increment = props.increment,
42
42
  decrement = props.decrement,
@@ -52,7 +52,10 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
52
52
  changeQuantity = props.changeQuantity,
53
53
  isAlsea = props.isAlsea,
54
54
  quesoYSalsaOptions = props.quesoYSalsaOptions;
55
- 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);
55
+ var maxByPosition = state.position === 'whole' ? suboption === null || suboption === void 0 ? void 0 : suboption.max : (suboption === null || suboption === void 0 ? void 0 : suboption.max) * 2;
56
+ var shouldApplyHalfLogic = (option === null || option === void 0 ? void 0 : option.with_half_option) && (option === null || option === void 0 ? void 0 : option.allow_suboption_quantity) && (option === null || option === void 0 ? void 0 : option.limit_suboptions_by_max);
57
+ var wouldExceedMaxInWhole = shouldApplyHalfLogic && state.position === 'whole' ? balance - state.quantity + (state.quantity + 1) > (option === null || option === void 0 ? void 0 : option.max) : false;
58
+ var disableIncrement = option !== null && option !== void 0 && option.with_half_option ? shouldApplyHalfLogic ? state.quantity === maxByPosition || (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) || wouldExceedMaxInWhole : (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) : 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);
56
59
  var quesoYSalsa = quesoYSalsaOptions.includes(option === null || option === void 0 || (_option$name = option.name) === null || _option$name === void 0 || (_option$name$toLowerC = _option$name.toLowerCase) === null || _option$name$toLowerC === void 0 ? void 0 : _option$name$toLowerC.call(_option$name));
57
60
  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;
58
61
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
@@ -102,7 +105,7 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
102
105
  if (!minMaxValidation) {
103
106
  setShowMessage(false);
104
107
  }
105
- }, [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]);
108
+ }, [balance, 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]);
106
109
  (0, _react.useEffect)(function () {
107
110
  if (balance === (option === null || option === void 0 ? void 0 : option.max) && state !== null && state !== void 0 && state.selected && dirtyRef) {
108
111
  if ((dirtyRef === null || dirtyRef === void 0 ? void 0 : dirtyRef.current) !== null) {
@@ -143,7 +146,7 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
143
146
  return handlePosition(e, 'left');
144
147
  }
145
148
  }), /*#__PURE__*/_react.default.createElement(_BsCircleFill.default, {
146
- 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) && !((option === null || option === void 0 ? void 0 : option.max) === 1 && (option === null || option === void 0 ? void 0 : option.min) === 1) ? 'disabled' : '', state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
149
+ className: [(pizzaState === null || pizzaState === void 0 || (_pizzaState4 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState4 === void 0 ? void 0 : _pizzaState4.value) >= (option === null || option === void 0 ? void 0 : option.max) && !((option === null || option === void 0 ? void 0 : option.max) === 1 && (option === null || option === void 0 ? void 0 : option.min) === 1) ? 'disabled' : '', state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
147
150
  return classname;
148
151
  }).join(' '),
149
152
  onClick: function onClick(e) {
@@ -164,7 +167,7 @@ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props)
164
167
  onClick: function onClick(e) {
165
168
  return handleChangeQuantity(e, 2);
166
169
  },
167
- className: (pizzaState === null || pizzaState === void 0 || (_pizzaState4 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState4 === void 0 ? void 0 : _pizzaState4.value) >= (option === null || option === void 0 ? void 0 : option.max) && !((option === null || option === void 0 ? void 0 : option.max) === 1 && (option === null || option === void 0 ? void 0 : option.min) === 1) ? 'disabled' : ''
170
+ className: (pizzaState === null || pizzaState === void 0 || (_pizzaState5 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState5 === void 0 ? void 0 : _pizzaState5.value) >= (option === null || option === void 0 ? void 0 : option.max) && !((option === null || option === void 0 ? void 0 : option.max) === 1 && (option === null || option === void 0 ? void 0 : option.min) === 1) ? 'disabled' : ''
168
171
  }, /*#__PURE__*/_react.default.createElement(_styles.Text, null, /*#__PURE__*/_react.default.createElement("div", null, t('EXTRA', 'Extra'))), " ", /*#__PURE__*/_react.default.createElement(_MdCheckBoxOutlineBlank.default, {
169
172
  disabled: true
170
173
  })))), /*#__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, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "14.1.91",
3
+ "version": "14.1.93",
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": "13.2.23",
91
+ "ordering-components-external": "13.2.25",
92
92
  "payment": "^2.4.6",
93
93
  "polished": "^3.6.6",
94
94
  "react-bootstrap-icons": "^1.7.2",
@@ -918,6 +918,7 @@ const CheckoutUI = (props) => {
918
918
  <PaymentOptionStripeLink
919
919
  businessConfigs={businessDetails?.business?.configs ?? []}
920
920
  paymentURL={cart?.paymethod_data?.result?.payment_url}
921
+ cartTotal={cart?.total}
921
922
  />
922
923
  </Modal>
923
924
  </Container>
@@ -54,9 +54,21 @@ const ProductOptionSubOptionUI = React.memo((props) => {
54
54
  quesoYSalsaOptions
55
55
  } = props
56
56
 
57
+ const maxByPosition = state.position === 'whole'
58
+ ? suboption?.max
59
+ : suboption?.max * 2
60
+
61
+ const shouldApplyHalfLogic = option?.with_half_option && option?.allow_suboption_quantity && option?.limit_suboptions_by_max
62
+
63
+ const wouldExceedMaxInWhole = shouldApplyHalfLogic && state.position === 'whole'
64
+ ? (balance - state.quantity + (state.quantity + 1)) > option?.max
65
+ : false
66
+
57
67
  const disableIncrement =
58
68
  option?.with_half_option
59
- ? pizzaState?.[`option:${option?.id}`]?.value >= option?.max
69
+ ? shouldApplyHalfLogic
70
+ ? state.quantity === maxByPosition || pizzaState?.[`option:${option?.id}`]?.value >= option?.max || wouldExceedMaxInWhole
71
+ : pizzaState?.[`option:${option?.id}`]?.value >= option?.max
60
72
  : option?.limit_suboptions_by_max
61
73
  ? (balance === option?.max || state.quantity === suboption.max)
62
74
  : state.quantity === suboption?.max || (!state.selected && balance === option?.max)