tripstorekrabi-shared 1.23.2 → 1.23.4

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 (2) hide show
  1. package/booking.js +11 -11
  2. package/package.json +1 -1
package/booking.js CHANGED
@@ -367,18 +367,18 @@ export function requiresDietaryInfo(booking, product) {
367
367
 
368
368
  const mainIsFood = hasFood(product);
369
369
 
370
- const foodAddOnsInBooking =
371
- booking?.addOns?.filter((bAddOn) => {
372
- const productAddOn = product.addOns?.find((pAddOn) => pAddOn.id === bAddOn.id);
373
- return productAddOn && hasFood(productAddOn.title);
374
- }) || [];
375
-
376
- const hasFoodAddOnWithPax = foodAddOnsInBooking.some((bAddOn) => {
377
- return (bAddOn.adults || 0) + (bAddOn.children || 0) > 0;
378
- });
370
+ const productFoodAddOns = (product.addOns || []).filter(pAddOn => hasFood(pAddOn));
371
+
372
+ if (productFoodAddOns.length > 0) {
373
+ const hasActiveFoodAddOn = productFoodAddOns.some(pAddOn => {
374
+ const bookedAddOn = (booking?.addOns ?? []).find(bAddOn => bAddOn.id === pAddOn.id);
375
+ if (!bookedAddOn) return false;
376
+
377
+ const totalPax = (bookedAddOn.adults || 0) + (bookedAddOn.children || 0);
378
+ return totalPax > 0;
379
+ });
379
380
 
380
- if (foodAddOnsInBooking.length > 0) {
381
- return hasFoodAddOnWithPax;
381
+ return hasActiveFoodAddOn;
382
382
  }
383
383
 
384
384
  return mainIsFood;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.23.2",
3
+ "version": "1.23.4",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {