tripstorekrabi-shared 1.13.69 → 1.13.71

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 +10 -3
  2. package/package.json +1 -1
  3. package/utils.js +6 -5
package/booking.js CHANGED
@@ -8,6 +8,11 @@ dayjs.extend(advancedFormat);
8
8
  dayjs.extend(utc);
9
9
  dayjs.extend(timezone);
10
10
 
11
+ export let OPERATOR_NOTE = 'Operator';
12
+ export let CUSTOMER_NOTE = 'Customer';
13
+ export const NOTES = [OPERATOR_NOTE, CUSTOMER_NOTE];
14
+ export const MAX_NOTES = 10;
15
+
11
16
  const PHONE_REGEXP = /[^\d+]/g;
12
17
 
13
18
  export function addBookingFromInvoice(
@@ -252,9 +257,11 @@ export function getStartingPointMessage(booking, product) {
252
257
  text += '\n\nWHAT TO BRING: ' + product.whatToBring;
253
258
  }
254
259
 
255
- if (booking.specialRequirements) {
256
- text +=
257
- '\n\nSPECIAL REQUIREMENTS: ' + booking.specialRequirements.toUpperCase();
260
+ let notes = Object.values(booking.notes ?? {})
261
+ .filter((item) => item.visibility.includes(CUSTOMER_NOTE))
262
+ .map((item) => item.description);
263
+ if (notes.length > 0) {
264
+ text += '\n\nSPECIAL CUSTOMER NEEDS: ' + notes.join(', ');
258
265
  }
259
266
 
260
267
  if (product?.customerInformation?.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.13.69",
3
+ "version": "1.13.71",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
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 { CUSTOMER_NOTE } from './booking.js';
8
9
 
9
10
  dayjs.extend(customParseFormat);
10
11
  dayjs.extend(advancedFormat);
@@ -602,13 +603,13 @@ export function createVoucherRequest(booking, product) {
602
603
  let request = {
603
604
  booking: {
604
605
  referenceNumber: booking.referenceNumber,
605
- specialRequirements: booking.specialRequirements
606
- ? booking.specialRequirements.toUpperCase()
607
- : '',
606
+ specialRequirements: Object.values(booking.notes ?? {})
607
+ .filter((item) => item.visibility.includes(CUSTOMER_NOTE))
608
+ .map((item) => item.description)
609
+ .join(', '),
608
610
  nationalParkFee:
609
611
  product && product.nationalPark
610
- ? 'NATIONAL PARK ENTRANCE FEE: ' +
611
- booking.nationalParkFee.toUpperCase()
612
+ ? 'NATIONAL PARK ENTRANCE FEE: ' + booking.nationalParkFee
612
613
  : '',
613
614
  productDescription: booking.productDescription,
614
615
  leadTraveller: booking.leadTraveller,