tripstorekrabi-shared 1.17.1 → 1.17.3

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/package.json +1 -1
  2. package/price.js +14 -7
  3. package/utils.js +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.17.1",
3
+ "version": "1.17.3",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/price.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getBookingType } from "./utils.js";
1
+ import { CUSTOM_MEETING_POINT, TELL_HOTEL_LATER_STARTING_POINT, getBookingType } from "./utils.js";
2
2
 
3
3
  export const MAX_PAX = 100;
4
4
  export const PAY_ON_TOUR = 'Pay on tour';
@@ -18,11 +18,6 @@ export const EXTRA_PAYMENT_CATEGORIES = [STARTING_POINT_EXTRA_PAYMENT,
18
18
  ADD_ON_EXTRA_PAYMENT,
19
19
  PRODUCT_CHANGE_EXTRA_PAYMENT,
20
20
  OTHER_EXTRA_PAYMENT];
21
- export const CUSTOM_MEETING_POINT = {
22
- id: 0,
23
- name: 'Custom meeting point',
24
- value: '',
25
- };
26
21
 
27
22
  const SELLING_MODE = 0;
28
23
  const PARTNER_MODE = 1;
@@ -386,7 +381,19 @@ function calculateStartEndPointPrice(people, startEndPoint, options = { mode: SE
386
381
  }
387
382
 
388
383
  export function findStartingPoint(product, startingPointId, useDefault = true) {
389
- return [...product.startingPoints, CUSTOM_MEETING_POINT].find((item) => item.id === startingPointId) ?? (useDefault ? product.startingPoints[0] : null);
384
+ return [
385
+ ...product.startingPoints,
386
+ {
387
+ id: TELL_HOTEL_LATER_STARTING_POINT.id,
388
+ name: TELL_HOTEL_LATER_STARTING_POINT.description,
389
+ value: '',
390
+ },
391
+ {
392
+ id: CUSTOM_MEETING_POINT.id,
393
+ name: CUSTOM_MEETING_POINT.description,
394
+ value: '',
395
+ },
396
+ ].find((item) => item.id === startingPointId) ?? (useDefault ? product.startingPoints[0] : null);
390
397
  }
391
398
 
392
399
  export function findEndPoint(product, endPointId, useDefault = true) {
package/utils.js CHANGED
@@ -21,6 +21,12 @@ export const CHECK_IN_LATE = 'CHECK-IN LATE';
21
21
  export const ROOM_NUMBER_LIST = [NO_ROOM, IN_HOUSE, CHECK_IN_LATE];
22
22
  export const NO_PICKUP_HOTEL_YET = "NO PICKUP HOTEL YET";
23
23
 
24
+ export const TELL_HOTEL_LATER_STARTING_POINT = { id: "ThDUqeSiUvvdjfHgQQq5a", description: "I will tell the hotel name later" };
25
+ export const CUSTOM_MEETING_POINT = {
26
+ id: "OlJFIHnowHZQ4SPD5tvgd",
27
+ description: 'Custom meeting point',
28
+ };
29
+
24
30
  export const TRIPSTORE_AGENCYID_IN_PHAYUN = '2Z5NPZTmd62tm22q0RNB';
25
31
  export const VIATOR_AGENCYID_IN_PHAYUN = 'eVxVUldoJhEiNUZyfcyt';
26
32
  export const GYG_AGENCYID_IN_PHAYUN = 'lPZIMbXgzaFwA366uzia';
@@ -238,6 +244,12 @@ export function isTrainStation(value) {
238
244
  return value.includes('train') && value.includes('station');
239
245
  }
240
246
 
247
+ export function isCruiser(value) {
248
+ return ['cruise', 'tender port', 'sea port'].some((item) => value
249
+ .toLowerCase()
250
+ .includes(item));
251
+ }
252
+
241
253
  export function validateName(name) {
242
254
  name = name.trim();
243
255
  if (name) {