tripstorekrabi-shared 1.22.9 → 1.23.1
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.
- package/booking.js +24 -0
- package/package.json +2 -2
- package/utils.js +1 -0
package/booking.js
CHANGED
|
@@ -362,6 +362,28 @@ export function getStartingPointMessage(booking, product, options = { compact: f
|
|
|
362
362
|
return text;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
export function requiresDietaryInfo(booking, product) {
|
|
366
|
+
if (!product) return true;
|
|
367
|
+
|
|
368
|
+
const mainIsFood = hasFood(product);
|
|
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);
|
|
374
|
+
}) || [];
|
|
375
|
+
|
|
376
|
+
const hasFoodAddOnWithPax = foodAddOnsInBooking.some((bAddOn) => {
|
|
377
|
+
return (bAddOn.adults || 0) + (bAddOn.children || 0) > 0;
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
if (foodAddOnsInBooking.length > 0) {
|
|
381
|
+
return hasFoodAddOnWithPax;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return mainIsFood;
|
|
385
|
+
}
|
|
386
|
+
|
|
365
387
|
export function hasFood(product) {
|
|
366
388
|
return (product.includes ?? []).find((item) => {
|
|
367
389
|
item = item.toLowerCase();
|
|
@@ -369,6 +391,8 @@ export function hasFood(product) {
|
|
|
369
391
|
}) != null;
|
|
370
392
|
}
|
|
371
393
|
|
|
394
|
+
|
|
395
|
+
|
|
372
396
|
export function createTodos(booking, product) {
|
|
373
397
|
let todos = {};
|
|
374
398
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tripstorekrabi-shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.1",
|
|
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.
|
|
21
|
+
"libphonenumber-js": "^1.12.36",
|
|
22
22
|
"nanoid": "^5.1.6"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|