ordering-ui-external 10.10.7 → 10.10.9

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 (24) hide show
  1. package/_bundles/{0.ordering-ui.9a2b08dbac2c71a0030c.js → 0.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  2. package/_bundles/{1.ordering-ui.9a2b08dbac2c71a0030c.js → 1.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  3. package/_bundles/{2.ordering-ui.9a2b08dbac2c71a0030c.js → 2.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  4. package/_bundles/{4.ordering-ui.9a2b08dbac2c71a0030c.js → 4.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  5. package/_bundles/{5.ordering-ui.9a2b08dbac2c71a0030c.js → 5.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  6. package/_bundles/{6.ordering-ui.9a2b08dbac2c71a0030c.js → 6.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  7. package/_bundles/{7.ordering-ui.9a2b08dbac2c71a0030c.js → 7.ordering-ui.5adc4f46e634487b1938.js} +2 -2
  8. package/_bundles/{8.ordering-ui.9a2b08dbac2c71a0030c.js → 8.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  9. package/_bundles/{9.ordering-ui.9a2b08dbac2c71a0030c.js → 9.ordering-ui.5adc4f46e634487b1938.js} +1 -1
  10. package/_bundles/ordering-ui.5adc4f46e634487b1938.js +2 -0
  11. package/_modules/themes/five/src/components/OrderDetails/index.js +1 -1
  12. package/_modules/themes/five/src/components/ProductForm/index.js +4 -1
  13. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +34 -15
  14. package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +2 -2
  15. package/_modules/utils/index.js +13 -8
  16. package/package.json +2 -2
  17. package/src/themes/five/src/components/OrderDetails/index.js +1 -1
  18. package/src/themes/five/src/components/ProductForm/index.js +3 -0
  19. package/src/themes/five/src/components/ProductOptionSubOption/index.js +40 -11
  20. package/src/themes/five/src/components/ProductOptionSubOption/styles.js +9 -1
  21. package/src/utils/index.js +1 -0
  22. package/_bundles/ordering-ui.9a2b08dbac2c71a0030c.js +0 -2
  23. /package/_bundles/{7.ordering-ui.9a2b08dbac2c71a0030c.js.LICENSE.txt → 7.ordering-ui.5adc4f46e634487b1938.js.LICENSE.txt} +0 -0
  24. /package/_bundles/{ordering-ui.9a2b08dbac2c71a0030c.js.LICENSE.txt → ordering-ui.5adc4f46e634487b1938.js.LICENSE.txt} +0 -0
@@ -179,7 +179,7 @@ var OrderDetailsUI = function OrderDetailsUI(props) {
179
179
  businessData = _props$order.businessData,
180
180
  error = _props$order.error;
181
181
  var yourSpotString = (order === null || order === void 0 ? void 0 : order.delivery_type) === 3 ? t('TABLE_NUMBER', 'Table number') : t('SPOT_NUMBER', 'Spot number');
182
- var acceptedStatus = [1, 2, 5, 6, 10, 11, 12];
182
+ var acceptedStatus = [1, 2, 5, 6, 10, 11, 12, 15];
183
183
  var completedStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17];
184
184
  var placeSpotTypes = [3, 4, 5];
185
185
  var activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23];
@@ -72,6 +72,7 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
72
72
  handleChangeSuboptionState = props.handleChangeSuboptionState,
73
73
  handleChangeCommentState = props.handleChangeCommentState,
74
74
  productAddedToCartLength = props.productAddedToCartLength,
75
+ pizzaType = props.pizzaType,
75
76
  handleFavoriteProduct = props.handleFavoriteProduct,
76
77
  handleCreateGuestUser = props.handleCreateGuestUser,
77
78
  actionStatus = props.actionStatus,
@@ -617,7 +618,9 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
617
618
  state: currentState,
618
619
  isSoldOut: isSoldOut,
619
620
  scrollDown: scrollDown,
620
- setIsScrollAvailable: setIsScrollAvailable
621
+ setIsScrollAvailable: setIsScrollAvailable,
622
+ pizzaType: pizzaType,
623
+ productCart: productCart
621
624
  });
622
625
  }))));
623
626
  });
@@ -19,19 +19,22 @@ var _MdRadioButtonUnchecked = _interopRequireDefault(require("@meronex/icons/md/
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
  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
21
  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; }
22
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
22
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
23
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
25
24
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
25
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
27
26
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
27
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
28
28
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
29
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
30
30
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
31
31
  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; }
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
- var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
34
+ var ProductOptionSubOptionPropsAreEqual = function ProductOptionSubOptionPropsAreEqual(prevProps, nextProps) {
35
+ return JSON.stringify(prevProps.state) === JSON.stringify(nextProps.state) && JSON.stringify(prevProps.pizzaType) === JSON.stringify(nextProps.pizzaType) && prevProps.balance === nextProps.balance && JSON.stringify(prevProps.productCart) === JSON.stringify(nextProps.productCart);
36
+ };
37
+ var ProductOptionSubOptionUI = /*#__PURE__*/_react.default.memo(function (props) {
35
38
  var _props$beforeElements, _props$beforeComponen, _props$afterComponent, _props$afterElements;
36
39
  var state = props.state,
37
40
  increment = props.increment,
@@ -43,7 +46,9 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
43
46
  changePosition = props.changePosition,
44
47
  isSoldOut = props.isSoldOut,
45
48
  setIsScrollAvailable = props.setIsScrollAvailable,
46
- onChange = props.onChange;
49
+ onChange = props.onChange,
50
+ pizzaType = props.pizzaType,
51
+ productCart = props.productCart;
47
52
  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);
48
53
  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;
49
54
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
@@ -66,7 +71,7 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
66
71
  decrement();
67
72
  };
68
73
  var handlePosition = function handlePosition(e, position) {
69
- e.stopPropagation();
74
+ e.stopPropagation && e.stopPropagation();
70
75
  changePosition(position);
71
76
  };
72
77
  var handleSuboptionClick = function handleSuboptionClick() {
@@ -92,13 +97,27 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
92
97
  }
93
98
  }, [state === null || state === void 0 ? void 0 : state.selected]);
94
99
  (0, _react.useEffect)(function () {
95
- if (dirtyRef !== null && dirtyRef !== void 0 && dirtyRef.current || !(suboption !== null && suboption !== void 0 && suboption.preselected) || !(option !== null && option !== void 0 && option.respect_to)) return;
96
- var newState = _objectSpread(_objectSpread({}, state), {}, {
97
- selected: suboption === null || suboption === void 0 ? void 0 : suboption.preselected,
98
- quantity: state.selected ? 0 : 1
99
- });
100
- onChange(newState, suboption, option);
101
- }, [suboption, dirtyRef, option]);
100
+ var _pizzaType$type, _pizzaType$type$toLow;
101
+ if ((pizzaType === null || pizzaType === void 0 || (_pizzaType$type = pizzaType.type) === null || _pizzaType$type === void 0 || (_pizzaType$type$toLow = _pizzaType$type.toLowerCase) === null || _pizzaType$type$toLow === void 0 ? void 0 : _pizzaType$type$toLow.call(_pizzaType$type)) === 'mitad y mitad' && option !== null && option !== void 0 && option.with_half_option) {
102
+ var _Object$values, _Object$values3;
103
+ var _option = (_Object$values = Object.values((productCart === null || productCart === void 0 ? void 0 : productCart.options) || {})) === null || _Object$values === void 0 ? void 0 : _Object$values.find(function (option) {
104
+ var _option$name, _option$name$toLowerC, _Object$values2;
105
+ return (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)) === 'elige tus ingredientes' && ((_Object$values2 = Object.values(option === null || option === void 0 ? void 0 : option.suboptions)) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.length) > 0;
106
+ });
107
+ var alreadyRight = (_Object$values3 = Object.values((_option === null || _option === void 0 ? void 0 : _option.suboptions) || {})) === null || _Object$values3 === void 0 ? void 0 : _Object$values3.some(function (suboption) {
108
+ return (suboption === null || suboption === void 0 ? void 0 : suboption.position) === 'right';
109
+ });
110
+ if (pizzaType.right && !alreadyRight) {
111
+ if (state !== null && state !== void 0 && state.selected) {
112
+ handlePosition({}, 'right');
113
+ }
114
+ } else if (pizzaType.left || alreadyRight) {
115
+ if (state !== null && state !== void 0 && state.selected) {
116
+ handlePosition({}, 'left');
117
+ }
118
+ }
119
+ }
120
+ }, [pizzaType === null || pizzaType === void 0 ? void 0 : pizzaType.type, state === null || state === void 0 ? void 0 : state.selected, suboption === null || suboption === void 0 ? void 0 : suboption.id]);
102
121
  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) {
103
122
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
104
123
  key: i
@@ -124,21 +143,21 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
124
143
  disabled: disableIncrement || isSoldOut,
125
144
  onClick: handleIncrement
126
145
  }))), /*#__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, {
127
- className: ['reverse', state.selected && state.position === 'left' ? 'selected' : null].filter(function (classname) {
146
+ className: [pizzaType.center ? 'disabled' : '', pizzaType.type === 'Mitad y mitad' && 'disable-clicks', 'reverse', state.selected && state.position === 'left' ? 'selected' : null].filter(function (classname) {
128
147
  return classname;
129
148
  }).join(' '),
130
149
  onClick: function onClick(e) {
131
150
  return handlePosition(e, 'left');
132
151
  }
133
152
  }), /*#__PURE__*/_react.default.createElement(_BsCircleFill.default, {
134
- className: [state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
153
+ className: [!pizzaType.center && pizzaType.type === 'Mitad y mitad' ? 'disabled' : '', state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
135
154
  return classname;
136
155
  }).join(' '),
137
156
  onClick: function onClick(e) {
138
157
  return handlePosition(e, 'whole');
139
158
  }
140
159
  }), /*#__PURE__*/_react.default.createElement(_BsCircleHalf.default, {
141
- className: [state.selected && state.position === 'right' ? 'selected' : null].filter(function (classname) {
160
+ className: [pizzaType.center ? 'disabled' : '', pizzaType.type === 'Mitad y mitad' && 'disable-clicks', state.selected && state.position === 'right' ? 'selected' : null].filter(function (classname) {
142
161
  return classname;
143
162
  }).join(' '),
144
163
  onClick: function onClick(e) {
@@ -155,7 +174,7 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
155
174
  key: i
156
175
  }, AfterElement);
157
176
  }));
158
- };
177
+ }, ProductOptionSubOptionPropsAreEqual);
159
178
  var ProductOptionSubOption = exports.ProductOptionSubOption = function ProductOptionSubOption(props) {
160
179
  var productOptionSubOptionProps = _objectSpread(_objectSpread({}, props), {}, {
161
180
  UIComponent: ProductOptionSubOptionUI,
@@ -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; \n "])));
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 "])));
@@ -51,7 +51,7 @@ var QuantityControl = exports.QuantityControl = _styledComponents.default.div(_t
51
51
  var _props$theme6;
52
52
  return ((_props$theme6 = props.theme) === null || _props$theme6 === void 0 ? void 0 : _props$theme6.rtl) && (0, _styledComponents.css)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-right: 3px;\n margin-left: 0px;\n "])));
53
53
  });
54
- var PositionControl = exports.PositionControl = _styledComponents.default.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n color: #CBCBCB;\n font-weight: 300;\n font-size: 18px;\n margin: 0 5px;\n\n svg {\n font-size: 20px;\n margin-right: 3px;\n ", "\n &.reverse {\n transform: rotate(180deg);\n }\n\n &.selected {\n color: ", ";\n }\n\n &:last-child {\n margin-right: 0;\n ", "\n }\n }\n"])), function (props) {
54
+ var PositionControl = exports.PositionControl = _styledComponents.default.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n color: #CBCBCB;\n font-weight: 300;\n font-size: 18px;\n margin: 0 5px;\n\n svg {\n font-size: 20px;\n margin-right: 3px;\n ", "\n &.reverse {\n transform: rotate(180deg);\n }\n\n &.selected {\n color: ", ";\n }\n\n &.disabled {\n pointer-events: none;\n opacity: 0.2\n }\n &.disable-clicks {\n pointer-events: none;\n }\n\n &:last-child {\n margin-right: 0;\n ", "\n }\n }\n"])), function (props) {
55
55
  var _props$theme7;
56
56
  return ((_props$theme7 = props.theme) === null || _props$theme7 === void 0 ? void 0 : _props$theme7.rtl) && (0, _styledComponents.css)(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin-left: 3px;\n margin-right: 0px;\n "])));
57
57
  }, function (props) {
@@ -1004,7 +1004,7 @@ var getOrderStatus = exports.getOrderStatus = function getOrderStatus(s) {
1004
1004
  return objectStatus && objectStatus;
1005
1005
  };
1006
1006
  var getOrderStatuPickUp = exports.getOrderStatuPickUp = function getOrderStatuPickUp(s) {
1007
- var _theme$defaultLanguag25, _theme$defaultLanguag26, _theme$defaultLanguag27, _theme$defaultLanguag28, _theme$defaultLanguag29, _theme$defaultLanguag30, _theme$defaultLanguag31, _theme$defaultLanguag32, _theme$defaultLanguag33, _theme$defaultLanguag34, _theme$defaultLanguag35, _theme$defaultLanguag36, _theme$defaultLanguag37;
1007
+ var _theme$defaultLanguag25, _theme$defaultLanguag26, _theme$defaultLanguag27, _theme$defaultLanguag28, _theme$defaultLanguag29, _theme$defaultLanguag30, _theme$defaultLanguag31, _theme$defaultLanguag32, _theme$defaultLanguag33, _theme$defaultLanguag34, _theme$defaultLanguag35, _theme$defaultLanguag36, _theme$defaultLanguag37, _theme$defaultLanguag38;
1008
1008
  var _useLanguage9 = (0, _orderingComponentsExternal.useLanguage)(),
1009
1009
  _useLanguage10 = _slicedToArray(_useLanguage9, 2),
1010
1010
  t = _useLanguage10[1];
@@ -1040,39 +1040,44 @@ var getOrderStatuPickUp = exports.getOrderStatuPickUp = function getOrderStatuPi
1040
1040
  value: t('ACCEPTED_BY_BUSINESS', (theme === null || theme === void 0 || (_theme$defaultLanguag30 = theme.defaultLanguages) === null || _theme$defaultLanguag30 === void 0 ? void 0 : _theme$defaultLanguag30.ACCEPTED_BY_BUSINESS) || 'Accepted by business'),
1041
1041
  slug: 'ACCEPTED_BY_BUSINESS',
1042
1042
  percentage: 30
1043
+ }, {
1044
+ key: 11,
1045
+ value: t('DELIVERY_COMPLETED_BY_DRIVER', (theme === null || theme === void 0 || (_theme$defaultLanguag31 = theme.defaultLanguages) === null || _theme$defaultLanguag31 === void 0 ? void 0 : _theme$defaultLanguag31.DELIVERY_COMPLETED_BY_DRIVER) || 'Delivery completed by driver'),
1046
+ slug: 'DELIVERY_COMPLETED_BY_DRIVER',
1047
+ percentage: 100
1043
1048
  }, {
1044
1049
  key: 13,
1045
- value: t('PREORDER', (theme === null || theme === void 0 || (_theme$defaultLanguag31 = theme.defaultLanguages) === null || _theme$defaultLanguag31 === void 0 ? void 0 : _theme$defaultLanguag31.PREORDER) || 'PreOrder'),
1050
+ value: t('PREORDER', (theme === null || theme === void 0 || (_theme$defaultLanguag32 = theme.defaultLanguages) === null || _theme$defaultLanguag32 === void 0 ? void 0 : _theme$defaultLanguag32.PREORDER) || 'PreOrder'),
1046
1051
  slug: 'PREORDER',
1047
1052
  percentage: 0
1048
1053
  }, {
1049
1054
  key: 14,
1050
- value: t('ORDER_NOT_READY', (theme === null || theme === void 0 || (_theme$defaultLanguag32 = theme.defaultLanguages) === null || _theme$defaultLanguag32 === void 0 ? void 0 : _theme$defaultLanguag32.ORDER_NOT_READY) || 'Order not ready'),
1055
+ value: t('ORDER_NOT_READY', (theme === null || theme === void 0 || (_theme$defaultLanguag33 = theme.defaultLanguages) === null || _theme$defaultLanguag33 === void 0 ? void 0 : _theme$defaultLanguag33.ORDER_NOT_READY) || 'Order not ready'),
1051
1056
  slug: 'ORDER_NOT_READY',
1052
1057
  percentage: 30
1053
1058
  }, {
1054
1059
  key: 15,
1055
- value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', (theme === null || theme === void 0 || (_theme$defaultLanguag33 = theme.defaultLanguages) === null || _theme$defaultLanguag33 === void 0 ? void 0 : _theme$defaultLanguag33.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER) || 'Order picked up completed by customer'),
1060
+ value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', (theme === null || theme === void 0 || (_theme$defaultLanguag34 = theme.defaultLanguages) === null || _theme$defaultLanguag34 === void 0 ? void 0 : _theme$defaultLanguag34.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER) || 'Order picked up completed by customer'),
1056
1061
  slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
1057
1062
  percentage: 100
1058
1063
  }, {
1059
1064
  key: 16,
1060
- value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', (theme === null || theme === void 0 || (_theme$defaultLanguag34 = theme.defaultLanguages) === null || _theme$defaultLanguag34 === void 0 ? void 0 : _theme$defaultLanguag34.ORDER_STATUS_CANCELLED_BY_CUSTOMER) || 'Order cancelled by customer'),
1065
+ value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', (theme === null || theme === void 0 || (_theme$defaultLanguag35 = theme.defaultLanguages) === null || _theme$defaultLanguag35 === void 0 ? void 0 : _theme$defaultLanguag35.ORDER_STATUS_CANCELLED_BY_CUSTOMER) || 'Order cancelled by customer'),
1061
1066
  slug: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
1062
1067
  percentage: 0
1063
1068
  }, {
1064
1069
  key: 17,
1065
- value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', (theme === null || theme === void 0 || (_theme$defaultLanguag35 = theme.defaultLanguages) === null || _theme$defaultLanguag35 === void 0 ? void 0 : _theme$defaultLanguag35.ORDER_NOT_PICKEDUP_BY_CUSTOMER) || 'Order not picked up by customer'),
1070
+ value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', (theme === null || theme === void 0 || (_theme$defaultLanguag36 = theme.defaultLanguages) === null || _theme$defaultLanguag36 === void 0 ? void 0 : _theme$defaultLanguag36.ORDER_NOT_PICKEDUP_BY_CUSTOMER) || 'Order not picked up by customer'),
1066
1071
  slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
1067
1072
  percentage: 0
1068
1073
  }, {
1069
1074
  key: 20,
1070
- value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', (theme === null || theme === void 0 || (_theme$defaultLanguag36 = theme.defaultLanguages) === null || _theme$defaultLanguag36 === void 0 ? void 0 : _theme$defaultLanguag36.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS) || 'Customer almost arrived to business'),
1075
+ value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', (theme === null || theme === void 0 || (_theme$defaultLanguag37 = theme.defaultLanguages) === null || _theme$defaultLanguag37 === void 0 ? void 0 : _theme$defaultLanguag37.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS) || 'Customer almost arrived to business'),
1071
1076
  slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
1072
1077
  percentage: 70
1073
1078
  }, {
1074
1079
  key: 21,
1075
- value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', (theme === null || theme === void 0 || (_theme$defaultLanguag37 = theme.defaultLanguages) === null || _theme$defaultLanguag37 === void 0 ? void 0 : _theme$defaultLanguag37.ORDER_CUSTOMER_ARRIVED_BUSINESS) || 'Customer arrived to business'),
1080
+ value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', (theme === null || theme === void 0 || (_theme$defaultLanguag38 = theme.defaultLanguages) === null || _theme$defaultLanguag38 === void 0 ? void 0 : _theme$defaultLanguag38.ORDER_CUSTOMER_ARRIVED_BUSINESS) || 'Customer arrived to business'),
1076
1081
  slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
1077
1082
  percentage: 90
1078
1083
  }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "10.10.7",
3
+ "version": "10.10.9",
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": "9.11.5",
91
+ "ordering-components-external": "9.11.11",
92
92
  "payment": "^2.4.6",
93
93
  "polished": "^3.6.6",
94
94
  "react-bootstrap-icons": "^1.7.2",
@@ -126,7 +126,7 @@ const OrderDetailsUI = (props) => {
126
126
  const [isShowBusinessLogo, setIsShowBusinessLogo] = useState(true)
127
127
  const { order, loading, businessData, error } = props.order
128
128
  const yourSpotString = order?.delivery_type === 3 ? t('TABLE_NUMBER', 'Table number') : t('SPOT_NUMBER', 'Spot number')
129
- const acceptedStatus = [1, 2, 5, 6, 10, 11, 12]
129
+ const acceptedStatus = [1, 2, 5, 6, 10, 11, 12, 15]
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]
@@ -98,6 +98,7 @@ const ProductOptionsUI = (props) => {
98
98
  handleChangeSuboptionState,
99
99
  handleChangeCommentState,
100
100
  productAddedToCartLength,
101
+ pizzaType,
101
102
  handleFavoriteProduct,
102
103
  handleCreateGuestUser,
103
104
  actionStatus,
@@ -653,6 +654,8 @@ const ProductOptionsUI = (props) => {
653
654
  isSoldOut={isSoldOut}
654
655
  scrollDown={scrollDown}
655
656
  setIsScrollAvailable={setIsScrollAvailable}
657
+ pizzaType={pizzaType}
658
+ productCart={productCart}
656
659
  />
657
660
  )
658
661
  })
@@ -25,7 +25,14 @@ import MdCheckBoxOutlineBlank from '@meronex/icons/md/MdCheckBoxOutlineBlank'
25
25
  import RiRadioButtonFill from '@meronex/icons/ri/RiRadioButtonFill'
26
26
  import MdRadioButtonUnchecked from '@meronex/icons/md/MdRadioButtonUnchecked'
27
27
 
28
- const ProductOptionSubOptionUI = (props) => {
28
+ const ProductOptionSubOptionPropsAreEqual = (prevProps, nextProps) => {
29
+ return JSON.stringify(prevProps.state) === JSON.stringify(nextProps.state) &&
30
+ JSON.stringify(prevProps.pizzaType) === JSON.stringify(nextProps.pizzaType) &&
31
+ prevProps.balance === nextProps.balance &&
32
+ JSON.stringify(prevProps.productCart) === JSON.stringify(nextProps.productCart)
33
+ }
34
+
35
+ const ProductOptionSubOptionUI = React.memo((props) => {
29
36
  const {
30
37
  state,
31
38
  increment,
@@ -37,7 +44,9 @@ const ProductOptionSubOptionUI = (props) => {
37
44
  changePosition,
38
45
  isSoldOut,
39
46
  setIsScrollAvailable,
40
- onChange
47
+ onChange,
48
+ pizzaType,
49
+ productCart
41
50
  } = props
42
51
 
43
52
  const disableIncrement = option?.limit_suboptions_by_max ? (balance === option?.max || state.quantity === suboption.max) : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
@@ -58,7 +67,7 @@ const ProductOptionSubOptionUI = (props) => {
58
67
  }
59
68
 
60
69
  const handlePosition = (e, position) => {
61
- e.stopPropagation()
70
+ e.stopPropagation && e.stopPropagation()
62
71
  changePosition(position)
63
72
  }
64
73
 
@@ -86,10 +95,21 @@ const ProductOptionSubOptionUI = (props) => {
86
95
  }, [state?.selected])
87
96
 
88
97
  useEffect(() => {
89
- if (dirtyRef?.current || !suboption?.preselected || !option?.respect_to) return
90
- const newState = { ...state, selected: suboption?.preselected, quantity: state.selected ? 0 : 1 }
91
- onChange(newState, suboption, option)
92
- }, [suboption, dirtyRef, option])
98
+ if (pizzaType?.type?.toLowerCase?.() === 'mitad y mitad' && option?.with_half_option) {
99
+ const option = Object.values(productCart?.options || {})?.find(option => option?.name?.toLowerCase?.() === 'elige tus ingredientes' && Object.values(option?.suboptions)?.length > 0)
100
+ const alreadyRight = Object.values(option?.suboptions || {})?.some(suboption => suboption?.position === 'right')
101
+ if (pizzaType.right && !alreadyRight) {
102
+ if (state?.selected) {
103
+ handlePosition({}, 'right')
104
+ }
105
+ } else if (pizzaType.left || alreadyRight) {
106
+ if (state?.selected) {
107
+ handlePosition({}, 'left')
108
+ }
109
+ }
110
+ }
111
+ }, [pizzaType?.type, state?.selected, suboption?.id])
112
+
93
113
  return (
94
114
  <>
95
115
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -144,15 +164,24 @@ const ProductOptionSubOptionUI = (props) => {
144
164
  option?.with_half_option && state?.selected && (
145
165
  <>
146
166
  <BsCircleHalf
147
- className={['reverse', state.selected && state.position === 'left' ? 'selected' : null].filter(classname => classname).join(' ')}
167
+ className={[
168
+ pizzaType.center ? 'disabled' : '',
169
+ pizzaType.type === 'Mitad y mitad' && 'disable-clicks',
170
+ 'reverse',
171
+ state.selected && state.position === 'left' ? 'selected' : null].filter(classname => classname).join(' ')}
148
172
  onClick={(e) => handlePosition(e, 'left')}
149
173
  />
150
174
  <BsCircleFill
151
- className={[state.selected && state.position === 'whole' ? 'selected' : null].filter(classname => classname).join(' ')}
175
+ className={[
176
+ !pizzaType.center && pizzaType.type === 'Mitad y mitad' ? 'disabled' : '',
177
+ state.selected && state.position === 'whole' ? 'selected' : null].filter(classname => classname).join(' ')}
152
178
  onClick={(e) => handlePosition(e, 'whole')}
153
179
  />
154
180
  <BsCircleHalf
155
- className={[state.selected && state.position === 'right' ? 'selected' : null].filter(classname => classname).join(' ')}
181
+ className={[
182
+ pizzaType.center ? 'disabled' : '',
183
+ pizzaType.type === 'Mitad y mitad' && 'disable-clicks',
184
+ state.selected && state.position === 'right' ? 'selected' : null].filter(classname => classname).join(' ')}
156
185
  onClick={(e) => handlePosition(e, 'right')}
157
186
  />
158
187
  </>
@@ -179,7 +208,7 @@ const ProductOptionSubOptionUI = (props) => {
179
208
  </React.Fragment>))}
180
209
  </>
181
210
  )
182
- }
211
+ }, ProductOptionSubOptionPropsAreEqual)
183
212
 
184
213
  export const ProductOptionSubOption = (props) => {
185
214
  const productOptionSubOptionProps = {
@@ -56,7 +56,7 @@ export const Text = styled.div`
56
56
  text-overflow: ellipsis;
57
57
  ${props => props.theme?.rtl && css`
58
58
  margin-left: 0;
59
- margin-right: 10px;
59
+ margin-right: 10px;
60
60
  `}
61
61
  }
62
62
 
@@ -153,6 +153,14 @@ export const PositionControl = styled.div`
153
153
  color: ${props => props.theme.colors.primary};
154
154
  }
155
155
 
156
+ &.disabled {
157
+ pointer-events: none;
158
+ opacity: 0.2
159
+ }
160
+ &.disable-clicks {
161
+ pointer-events: none;
162
+ }
163
+
156
164
  &:last-child {
157
165
  margin-right: 0;
158
166
  ${props => props.theme?.rtl && css`
@@ -668,6 +668,7 @@ export const getOrderStatuPickUp = (s) => {
668
668
  { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 50 },
669
669
  { key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
670
670
  { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 30 },
671
+ { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver'), slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 100 },
671
672
  { key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
672
673
  { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 30 },
673
674
  { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer'), slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', percentage: 100 },