tripstorekrabi-shared 1.23.6 → 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.
- package/package.json +2 -2
- package/price.js +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tripstorekrabi-shared",
|
|
3
|
-
"version": "1.23.
|
|
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.
|
|
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
|
-
|
|
180
|
-
|
|
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
|
-
|
|
185
|
-
|
|
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 = {}) {
|