tripstorekrabi-shared 1.23.5 → 1.23.7

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 (3) hide show
  1. package/booking.js +1 -1
  2. package/package.json +2 -2
  3. package/price.js +6 -4
package/booking.js CHANGED
@@ -365,7 +365,7 @@ export function getStartingPointMessage(booking, product, options = { compact: f
365
365
  export function requiresDietaryInfo(booking, product) {
366
366
  if (!product) return true;
367
367
 
368
- const mainIsFood = hasFood(product);
368
+ const mainIsFood = hasFood(product.includes);
369
369
 
370
370
  const productFoodAddOns = (product.addOns || []).filter(pAddOn => hasFood(pAddOn));
371
371
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.23.5",
3
+ "version": "1.23.7",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "dayjs": "^1.11.19",
21
- "libphonenumber-js": "^1.12.36",
21
+ "libphonenumber-js": "^1.12.38",
22
22
  "nanoid": "^5.1.6"
23
23
  },
24
24
  "scripts": {
package/price.js CHANGED
@@ -176,13 +176,15 @@ export function findVolume(people, pricing) {
176
176
  }
177
177
 
178
178
  export function countMinPeople(pricing) {
179
- let volume = pricing.volumes.map((item) => item.min);
180
- return volume ? Math.max(volume.reduce((p, v) => p < v ? p : v), 1) : 1;
179
+ const volumes = pricing?.volumes?.map((item) => item.min) || [];
180
+ if (volumes.length === 0) return 1;
181
+ return Math.max(Math.min(...volumes), 1);
181
182
  }
182
183
 
183
184
  export function countMaxPeople(pricing) {
184
- let volume = pricing.volumes.map((item) => item.max);
185
- return volume ? volume.reduce((p, v) => p > v ? p : v) : MAX_PAX;
185
+ const volumes = pricing?.volumes?.map((item) => item.max) || [];
186
+ if (volumes.length === 0) return MAX_PAX;
187
+ return Math.max(...volumes);
186
188
  }
187
189
 
188
190
  export function getTotalAmountToBeReceived(booking, options = {}) {