ordering-components-external 13.0.34 → 13.0.35

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 (16) hide show
  1. package/_bundles/{7.ordering-component.3760baa5b9906f197b42.js → 7.ordering-component.94801bc40091dbe6e0c4.js} +1 -1
  2. package/_bundles/{ordering-component.3760baa5b9906f197b42.js → ordering-component.94801bc40091dbe6e0c4.js} +2 -2
  3. package/_modules/components/ProductForm/index.js +9 -3
  4. package/_modules/components/ProductOptionSuboption/index.js +3 -2
  5. package/package.json +1 -1
  6. package/src/components/ProductForm/index.js +8 -2
  7. package/src/components/ProductOptionSuboption/index.js +3 -2
  8. /package/_bundles/{0.ordering-component.3760baa5b9906f197b42.js → 0.ordering-component.94801bc40091dbe6e0c4.js} +0 -0
  9. /package/_bundles/{1.ordering-component.3760baa5b9906f197b42.js → 1.ordering-component.94801bc40091dbe6e0c4.js} +0 -0
  10. /package/_bundles/{2.ordering-component.3760baa5b9906f197b42.js → 2.ordering-component.94801bc40091dbe6e0c4.js} +0 -0
  11. /package/_bundles/{4.ordering-component.3760baa5b9906f197b42.js → 4.ordering-component.94801bc40091dbe6e0c4.js} +0 -0
  12. /package/_bundles/{5.ordering-component.3760baa5b9906f197b42.js → 5.ordering-component.94801bc40091dbe6e0c4.js} +0 -0
  13. /package/_bundles/{6.ordering-component.3760baa5b9906f197b42.js → 6.ordering-component.94801bc40091dbe6e0c4.js} +0 -0
  14. /package/_bundles/{7.ordering-component.3760baa5b9906f197b42.js.LICENSE.txt → 7.ordering-component.94801bc40091dbe6e0c4.js.LICENSE.txt} +0 -0
  15. /package/_bundles/{8.ordering-component.3760baa5b9906f197b42.js → 8.ordering-component.94801bc40091dbe6e0c4.js} +0 -0
  16. /package/_bundles/{ordering-component.3760baa5b9906f197b42.js.LICENSE.txt → ordering-component.94801bc40091dbe6e0c4.js.LICENSE.txt} +0 -0
@@ -251,6 +251,11 @@ var ProductForm = exports.ProductForm = function ProductForm(props) {
251
251
  */
252
252
  var isAlsea = ['alsea', 'alsea-staging'].includes(ordering.project);
253
253
 
254
+ /**
255
+ * alsea custom options
256
+ */
257
+ var quesoYSalsaOptions = ['queso y salsa', 'queso mozzarella y salsa'];
258
+
254
259
  /**
255
260
  * Init product cart status
256
261
  * @param {object} product Product to init product cart status
@@ -655,7 +660,7 @@ var ProductForm = exports.ProductForm = function ProductForm(props) {
655
660
  name: cartSuboption.name,
656
661
  position: (state === null || state === void 0 ? void 0 : state.id) === (cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.id) ? state === null || state === void 0 ? void 0 : state.position : cartSuboption.position || 'whole',
657
662
  price: (state === null || state === void 0 ? void 0 : state.id) === (cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.id) ? state.price : price,
658
- quantity: (state === null || state === void 0 ? void 0 : state.id) === (cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.id) ? state.quantity : ((_preselectedOptions$i3 = preselectedOptions[i]) === null || _preselectedOptions$i3 === void 0 || (_preselectedOptions$i3 = _preselectedOptions$i3.name) === null || _preselectedOptions$i3 === void 0 ? void 0 : _preselectedOptions$i3.toLowerCase()) === 'queso y salsa' && isAlsea ? (_cartSuboption$quanti = cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.quantity) !== null && _cartSuboption$quanti !== void 0 ? _cartSuboption$quanti : 1 : (cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.quantity) || 1,
663
+ quantity: (state === null || state === void 0 ? void 0 : state.id) === (cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.id) ? state.quantity : quesoYSalsaOptions.includes((_preselectedOptions$i3 = preselectedOptions[i]) === null || _preselectedOptions$i3 === void 0 || (_preselectedOptions$i3 = _preselectedOptions$i3.name) === null || _preselectedOptions$i3 === void 0 ? void 0 : _preselectedOptions$i3.toLowerCase()) && isAlsea ? (_cartSuboption$quanti = cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.quantity) !== null && _cartSuboption$quanti !== void 0 ? _cartSuboption$quanti : 1 : (cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.quantity) || 1,
659
664
  selected: true,
660
665
  total: (state === null || state === void 0 ? void 0 : state.id) === (cartSuboption === null || cartSuboption === void 0 ? void 0 : cartSuboption.id) ? state.total : price
661
666
  };
@@ -786,7 +791,7 @@ var ProductForm = exports.ProductForm = function ProductForm(props) {
786
791
  if ((option === null || option === void 0 || (_option$suboptions3 = option.suboptions) === null || _option$suboptions3 === void 0 ? void 0 : _option$suboptions3.length) > 0 && evaluate) {
787
792
  if (option.min > quantity) {
788
793
  errors["id:".concat(option.id)] = true;
789
- } else if (option.max < quantity) {
794
+ } else if (option.max < quantity && option !== null && option !== void 0 && option.with_half_option && isAlsea && option.max + 0.5 < quantity) {
790
795
  errors["id:".concat(option.id)] = true;
791
796
  }
792
797
  }
@@ -1383,7 +1388,8 @@ var ProductForm = exports.ProductForm = function ProductForm(props) {
1383
1388
  handleChangeCommentState: handleChangeCommentState,
1384
1389
  professionalListState: professionalListState,
1385
1390
  cart2: props.productCart,
1386
- isAlsea: isAlsea
1391
+ isAlsea: isAlsea,
1392
+ quesoYSalsaOptions: quesoYSalsaOptions
1387
1393
  })));
1388
1394
  };
1389
1395
  ProductForm.propTypes = {
@@ -26,7 +26,8 @@ var ProductOptionSuboption = exports.ProductOptionSuboption = function ProductOp
26
26
  onChange = props.onChange,
27
27
  isOrigin = props.isOrigin,
28
28
  pizzaState = props.pizzaState,
29
- isAlsea = props.isAlsea;
29
+ isAlsea = props.isAlsea,
30
+ quesoYSalsaOptions = props.quesoYSalsaOptions;
30
31
 
31
32
  /**
32
33
  * Predefine default values for suboption state
@@ -37,7 +38,7 @@ var ProductOptionSuboption = exports.ProductOptionSuboption = function ProductOp
37
38
  quantity = props.state.quantity;
38
39
  } else if (selected) {
39
40
  var _option$name;
40
- quantity = (option === null || option === void 0 || (_option$name = option.name) === null || _option$name === void 0 ? void 0 : _option$name.toLowerCase()) === 'queso y salsa' && isAlsea ? props.state.quantity : 1;
41
+ quantity = quesoYSalsaOptions.includes(option === null || option === void 0 || (_option$name = option.name) === null || _option$name === void 0 ? void 0 : _option$name.toLowerCase()) && isAlsea ? props.state.quantity : 1;
41
42
  }
42
43
  var position = props.state.position || 'whole';
43
44
  var price = option.with_half_option && suboption.half_price && position !== 'whole' ? suboption.half_price : suboption.price;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-components-external",
3
- "version": "13.0.34",
3
+ "version": "13.0.35",
4
4
  "description": "Ordering Internal Dashboard",
5
5
  "main": "./_modules/index.js",
6
6
  "scripts": {
@@ -158,6 +158,11 @@ export const ProductForm = (props) => {
158
158
  */
159
159
  const isAlsea = ['alsea', 'alsea-staging'].includes(ordering.project)
160
160
 
161
+ /**
162
+ * alsea custom options
163
+ */
164
+ const quesoYSalsaOptions = ['queso y salsa', 'queso mozzarella y salsa']
165
+
161
166
  /**
162
167
  * Init product cart status
163
168
  * @param {object} product Product to init product cart status
@@ -422,7 +427,7 @@ export const ProductForm = (props) => {
422
427
  price: state?.id === cartSuboption?.id ? state.price : price,
423
428
  quantity: state?.id === cartSuboption?.id
424
429
  ? state.quantity
425
- : preselectedOptions[i]?.name?.toLowerCase() === 'queso y salsa' && isAlsea
430
+ : quesoYSalsaOptions.includes(preselectedOptions[i]?.name?.toLowerCase()) && isAlsea
426
431
  ? cartSuboption?.quantity ?? 1
427
432
  : cartSuboption?.quantity || 1,
428
433
  selected: true,
@@ -552,7 +557,7 @@ export const ProductForm = (props) => {
552
557
  if (option?.suboptions?.length > 0 && evaluate) {
553
558
  if (option.min > quantity) {
554
559
  errors[`id:${option.id}`] = true
555
- } else if (option.max < quantity) {
560
+ } else if (option.max < quantity && (option?.with_half_option && isAlsea && (option.max + 0.5 < quantity))) {
556
561
  errors[`id:${option.id}`] = true
557
562
  }
558
563
  }
@@ -1041,6 +1046,7 @@ export const ProductForm = (props) => {
1041
1046
  professionalListState={professionalListState}
1042
1047
  cart2={props.productCart}
1043
1048
  isAlsea={isAlsea}
1049
+ quesoYSalsaOptions={quesoYSalsaOptions}
1044
1050
  />
1045
1051
  )
1046
1052
  }
@@ -13,7 +13,8 @@ export const ProductOptionSuboption = (props) => {
13
13
  onChange,
14
14
  isOrigin,
15
15
  pizzaState,
16
- isAlsea
16
+ isAlsea,
17
+ quesoYSalsaOptions
17
18
  } = props
18
19
 
19
20
  /**
@@ -24,7 +25,7 @@ export const ProductOptionSuboption = (props) => {
24
25
  if (selected && props.state.quantity && props.state.quantity > 0) {
25
26
  quantity = props.state.quantity
26
27
  } else if (selected) {
27
- quantity = option?.name?.toLowerCase() === 'queso y salsa' && isAlsea ? props.state.quantity : 1
28
+ quantity = quesoYSalsaOptions.includes(option?.name?.toLowerCase()) && isAlsea ? props.state.quantity : 1
28
29
  }
29
30
  const position = props.state.position || 'whole'
30
31
  const price = option.with_half_option && suboption.half_price && position !== 'whole' ? suboption.half_price : suboption.price