tripstorekrabi-shared 1.7.3 → 1.7.6
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/utils.js +2 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tripstorekrabi-shared",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "Shared library for Trip Store Krabi",
|
|
5
5
|
"author": "Stefan Sommer <tonprince@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"./availability": "./availability.js"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"dayjs": "^1.11.
|
|
16
|
+
"dayjs": "^1.11.5"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"deploy": "npm publish"
|
package/utils.js
CHANGED
|
@@ -5,6 +5,7 @@ import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js";
|
|
|
5
5
|
import utc from 'dayjs/plugin/utc.js';
|
|
6
6
|
import timezone from 'dayjs/plugin/timezone.js';
|
|
7
7
|
import { findEndPoint, findStartingPoint } from "./price.js";
|
|
8
|
+
import fetch from "node-fetch";
|
|
8
9
|
|
|
9
10
|
dayjs.extend(customParseFormat);
|
|
10
11
|
dayjs.extend(advancedFormat);
|
|
@@ -277,18 +278,6 @@ export function countPeople(people) {
|
|
|
277
278
|
return people.adults ?? 0 + people.children ?? 0 + people.infants ?? 0;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
export function recaptchaChallenge(secret, token) {
|
|
281
|
-
const url = `https://www.google.com/recaptcha/api/siteverify?secret=${secret}&response=${token}`;
|
|
282
|
-
return fetch(url, {
|
|
283
|
-
method: "POST",
|
|
284
|
-
}).then(async (result) => result.json())
|
|
285
|
-
.then((result) => result.success
|
|
286
|
-
).catch((e) => {
|
|
287
|
-
console.error(e);
|
|
288
|
-
return false
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
281
|
export function isNumeric(n) {
|
|
293
282
|
return !isNaN(parseFloat(n)) && isFinite(n);
|
|
294
283
|
}
|
|
@@ -479,7 +468,7 @@ export function createVoucherRequest(booking, product) {
|
|
|
479
468
|
let request = {
|
|
480
469
|
booking: {
|
|
481
470
|
referenceNumber: booking.referenceNumber,
|
|
482
|
-
specialRequirements: booking.specialRequirements,
|
|
471
|
+
specialRequirements: booking.specialRequirements ? booking.specialRequirements.toUpperCase() : "",
|
|
483
472
|
nationalParkFee:
|
|
484
473
|
product && product.nationalPark
|
|
485
474
|
? "NATIONAL PARK ENTRANCE FEE: " +
|