ordering-ui-external 10.10.6 → 10.10.8

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 (23) hide show
  1. package/_bundles/{0.ordering-ui.afa79d6da9c5e4c1ddf7.js → 0.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  2. package/_bundles/{1.ordering-ui.afa79d6da9c5e4c1ddf7.js → 1.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  3. package/_bundles/{2.ordering-ui.afa79d6da9c5e4c1ddf7.js → 2.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  4. package/_bundles/{4.ordering-ui.afa79d6da9c5e4c1ddf7.js → 4.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  5. package/_bundles/{5.ordering-ui.afa79d6da9c5e4c1ddf7.js → 5.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  6. package/_bundles/{6.ordering-ui.afa79d6da9c5e4c1ddf7.js → 6.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  7. package/_bundles/{7.ordering-ui.afa79d6da9c5e4c1ddf7.js → 7.ordering-ui.52dae15bda2bcf26f93e.js} +2 -2
  8. package/_bundles/{8.ordering-ui.afa79d6da9c5e4c1ddf7.js → 8.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  9. package/_bundles/{9.ordering-ui.afa79d6da9c5e4c1ddf7.js → 9.ordering-ui.52dae15bda2bcf26f93e.js} +1 -1
  10. package/_bundles/ordering-ui.52dae15bda2bcf26f93e.js +2 -0
  11. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +3 -2
  12. package/_modules/themes/five/src/components/ProductForm/index.js +4 -1
  13. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +29 -5
  14. package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +2 -2
  15. package/package.json +2 -2
  16. package/src/themes/five/src/components/BusinessProductsListing/index.js +3 -2
  17. package/src/themes/five/src/components/ProductForm/index.js +3 -0
  18. package/src/themes/five/src/components/ProductOptionSubOption/index.js +33 -5
  19. package/src/themes/five/src/components/ProductOptionSubOption/styles.js +9 -1
  20. package/template/components/ScrollToTop/index.js +1 -1
  21. package/_bundles/ordering-ui.afa79d6da9c5e4c1ddf7.js +0 -2
  22. /package/_bundles/{7.ordering-ui.afa79d6da9c5e4c1ddf7.js.LICENSE.txt → 7.ordering-ui.52dae15bda2bcf26f93e.js.LICENSE.txt} +0 -0
  23. /package/_bundles/{ordering-ui.afa79d6da9c5e4c1ddf7.js.LICENSE.txt → ordering-ui.52dae15bda2bcf26f93e.js.LICENSE.txt} +0 -0
@@ -83,7 +83,8 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
83
83
  isCustomerMode = props.isCustomerMode,
84
84
  isCustomLayout = props.isCustomLayout,
85
85
  notFound = props.notFound,
86
- setNotFound = props.setNotFound;
86
+ setNotFound = props.setNotFound,
87
+ loadedFirstTime = props.loadedFirstTime;
87
88
  var business = businessState.business,
88
89
  loading = businessState.loading,
89
90
  error = businessState.error;
@@ -528,7 +529,7 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
528
529
  handleUpdateProfessionals: handleUpdateProfessionals,
529
530
  isCustomerMode: isCustomerMode,
530
531
  handleCustomProductBannerClick: handleCustomProductBannerClick
531
- }), isMounted && !loading && business && !Object.keys(business).length && /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
532
+ }), isMounted && !loading && loadedFirstTime && business && !Object.keys(business).length && /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
532
533
  content: t('NOT_FOUND_BUSINESS_PRODUCTS', (theme === null || theme === void 0 || (_theme$defaultLanguag7 = theme.defaultLanguages) === null || _theme$defaultLanguag7 === void 0 ? void 0 : _theme$defaultLanguag7.NOT_FOUND_BUSINESS_PRODUCTS) || 'No products to show at this business, please try with other business.'),
533
534
  btnTitle: t('SEARCH_REDIRECT', (theme === null || theme === void 0 || (_theme$defaultLanguag8 = theme.defaultLanguages) === null || _theme$defaultLanguag8 === void 0 ? void 0 : _theme$defaultLanguag8.SEARCH_REDIRECT) || 'Go to Businesses'),
534
535
  onClickButton: function onClickButton() {
@@ -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
  });
@@ -43,7 +43,9 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
43
43
  changePosition = props.changePosition,
44
44
  isSoldOut = props.isSoldOut,
45
45
  setIsScrollAvailable = props.setIsScrollAvailable,
46
- onChange = props.onChange;
46
+ onChange = props.onChange,
47
+ pizzaType = props.pizzaType,
48
+ productCart = props.productCart;
47
49
  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
50
  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
51
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
@@ -66,7 +68,7 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
66
68
  decrement();
67
69
  };
68
70
  var handlePosition = function handlePosition(e, position) {
69
- e.stopPropagation();
71
+ e.stopPropagation && e.stopPropagation();
70
72
  changePosition(position);
71
73
  };
72
74
  var handleSuboptionClick = function handleSuboptionClick() {
@@ -99,6 +101,28 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
99
101
  });
100
102
  onChange(newState, suboption, option);
101
103
  }, [suboption, dirtyRef, option]);
104
+ (0, _react.useEffect)(function () {
105
+ var _pizzaType$type, _pizzaType$type$toLow;
106
+ if (((_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) {
107
+ var _Object$values, _Object$values3;
108
+ 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) {
109
+ var _option$name, _option$name$toLowerC, _Object$values2;
110
+ 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;
111
+ });
112
+ 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) {
113
+ return (suboption === null || suboption === void 0 ? void 0 : suboption.position) === 'right';
114
+ });
115
+ if (pizzaType.right && !alreadyRight) {
116
+ if (state !== null && state !== void 0 && state.selected) {
117
+ handlePosition({}, 'right');
118
+ }
119
+ } else if (pizzaType.left || alreadyRight) {
120
+ if (state !== null && state !== void 0 && state.selected) {
121
+ handlePosition({}, 'left');
122
+ }
123
+ }
124
+ }
125
+ }, [pizzaType.type, state === null || state === void 0 ? void 0 : state.selected, suboption === null || suboption === void 0 ? void 0 : suboption.id]);
102
126
  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
127
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
104
128
  key: i
@@ -124,21 +148,21 @@ var ProductOptionSubOptionUI = function ProductOptionSubOptionUI(props) {
124
148
  disabled: disableIncrement || isSoldOut,
125
149
  onClick: handleIncrement
126
150
  }))), /*#__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) {
151
+ className: [pizzaType.center ? 'disabled' : '', pizzaType.type === 'Mitad y mitad' && 'disable-clicks', 'reverse', state.selected && state.position === 'left' ? 'selected' : null].filter(function (classname) {
128
152
  return classname;
129
153
  }).join(' '),
130
154
  onClick: function onClick(e) {
131
155
  return handlePosition(e, 'left');
132
156
  }
133
157
  }), /*#__PURE__*/_react.default.createElement(_BsCircleFill.default, {
134
- className: [state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
158
+ className: [!pizzaType.center && pizzaType.type === 'Mitad y mitad' ? 'disabled' : '', state.selected && state.position === 'whole' ? 'selected' : null].filter(function (classname) {
135
159
  return classname;
136
160
  }).join(' '),
137
161
  onClick: function onClick(e) {
138
162
  return handlePosition(e, 'whole');
139
163
  }
140
164
  }), /*#__PURE__*/_react.default.createElement(_BsCircleHalf.default, {
141
- className: [state.selected && state.position === 'right' ? 'selected' : null].filter(function (classname) {
165
+ className: [pizzaType.center ? 'disabled' : '', pizzaType.type === 'Mitad y mitad' && 'disable-clicks', state.selected && state.position === 'right' ? 'selected' : null].filter(function (classname) {
142
166
  return classname;
143
167
  }).join(' '),
144
168
  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; \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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "10.10.6",
3
+ "version": "10.10.8",
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.4",
91
+ "ordering-components-external": "9.11.10",
92
92
  "payment": "^2.4.6",
93
93
  "polished": "^3.6.6",
94
94
  "react-bootstrap-icons": "^1.7.2",
@@ -87,7 +87,8 @@ const BusinessProductsListingUI = (props) => {
87
87
  isCustomerMode,
88
88
  isCustomLayout,
89
89
  notFound,
90
- setNotFound
90
+ setNotFound,
91
+ loadedFirstTime
91
92
  } = props
92
93
 
93
94
  const { business, loading, error } = businessState
@@ -435,7 +436,7 @@ const BusinessProductsListingUI = (props) => {
435
436
  />
436
437
 
437
438
  {
438
- isMounted && !loading && business && !Object.keys(business).length && (
439
+ isMounted && !loading && loadedFirstTime && business && !Object.keys(business).length && (
439
440
  <NotFoundSource
440
441
  content={t('NOT_FOUND_BUSINESS_PRODUCTS', theme?.defaultLanguages?.NOT_FOUND_BUSINESS_PRODUCTS || 'No products to show at this business, please try with other business.')}
441
442
  btnTitle={t('SEARCH_REDIRECT', theme?.defaultLanguages?.SEARCH_REDIRECT || 'Go to Businesses')}
@@ -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
  })
@@ -37,7 +37,9 @@ const ProductOptionSubOptionUI = (props) => {
37
37
  changePosition,
38
38
  isSoldOut,
39
39
  setIsScrollAvailable,
40
- onChange
40
+ onChange,
41
+ pizzaType,
42
+ productCart
41
43
  } = props
42
44
 
43
45
  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 +60,7 @@ const ProductOptionSubOptionUI = (props) => {
58
60
  }
59
61
 
60
62
  const handlePosition = (e, position) => {
61
- e.stopPropagation()
63
+ e.stopPropagation && e.stopPropagation()
62
64
  changePosition(position)
63
65
  }
64
66
 
@@ -90,6 +92,23 @@ const ProductOptionSubOptionUI = (props) => {
90
92
  const newState = { ...state, selected: suboption?.preselected, quantity: state.selected ? 0 : 1 }
91
93
  onChange(newState, suboption, option)
92
94
  }, [suboption, dirtyRef, option])
95
+
96
+ useEffect(() => {
97
+ if (pizzaType.type?.toLowerCase?.() === 'mitad y mitad' && option?.with_half_option) {
98
+ const option = Object.values(productCart?.options || {})?.find(option => option?.name?.toLowerCase?.() === 'elige tus ingredientes' && Object.values(option?.suboptions)?.length > 0)
99
+ const alreadyRight = Object.values(option?.suboptions || {})?.some(suboption => suboption?.position === 'right')
100
+ if (pizzaType.right && !alreadyRight) {
101
+ if (state?.selected) {
102
+ handlePosition({}, 'right')
103
+ }
104
+ } else if (pizzaType.left || alreadyRight) {
105
+ if (state?.selected) {
106
+ handlePosition({}, 'left')
107
+ }
108
+ }
109
+ }
110
+ }, [pizzaType.type, state?.selected, suboption?.id])
111
+
93
112
  return (
94
113
  <>
95
114
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -144,15 +163,24 @@ const ProductOptionSubOptionUI = (props) => {
144
163
  option?.with_half_option && state?.selected && (
145
164
  <>
146
165
  <BsCircleHalf
147
- className={['reverse', state.selected && state.position === 'left' ? 'selected' : null].filter(classname => classname).join(' ')}
166
+ className={[
167
+ pizzaType.center ? 'disabled' : '',
168
+ pizzaType.type === 'Mitad y mitad' && 'disable-clicks',
169
+ 'reverse',
170
+ state.selected && state.position === 'left' ? 'selected' : null].filter(classname => classname).join(' ')}
148
171
  onClick={(e) => handlePosition(e, 'left')}
149
172
  />
150
173
  <BsCircleFill
151
- className={[state.selected && state.position === 'whole' ? 'selected' : null].filter(classname => classname).join(' ')}
174
+ className={[
175
+ !pizzaType.center && pizzaType.type === 'Mitad y mitad' ? 'disabled' : '',
176
+ state.selected && state.position === 'whole' ? 'selected' : null].filter(classname => classname).join(' ')}
152
177
  onClick={(e) => handlePosition(e, 'whole')}
153
178
  />
154
179
  <BsCircleHalf
155
- className={[state.selected && state.position === 'right' ? 'selected' : null].filter(classname => classname).join(' ')}
180
+ className={[
181
+ pizzaType.center ? 'disabled' : '',
182
+ pizzaType.type === 'Mitad y mitad' && 'disable-clicks',
183
+ state.selected && state.position === 'right' ? 'selected' : null].filter(classname => classname).join(' ')}
156
184
  onClick={(e) => handlePosition(e, 'right')}
157
185
  />
158
186
  </>
@@ -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`
@@ -19,7 +19,7 @@ export const ScrollToTop = withRouter(({ history, children }) => {
19
19
  }
20
20
  }, [])
21
21
 
22
- return <>{children}</>
22
+ return <div style={{ minHeight: '100vh' }}>{children}</div>
23
23
  })
24
24
 
25
25
  export default ScrollToTop