tripstorekrabi-shared 1.19.7 → 1.19.8

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 (2) hide show
  1. package/booking.js +60 -58
  2. package/package.json +1 -1
package/booking.js CHANGED
@@ -251,7 +251,7 @@ function addPhoneNumbers(phoneNumbers, phoneNumber) {
251
251
  }
252
252
  }
253
253
 
254
- export function getStartingPointMessage(booking, product) {
254
+ export function getStartingPointMessage(booking, product, options = { compact: false }) {
255
255
  let text = booking.startingPointDescription;
256
256
  if (booking.pickupTime.indexOf('-') != -1) {
257
257
  text +=
@@ -282,76 +282,78 @@ export function getStartingPointMessage(booking, product) {
282
282
 
283
283
  text += 'Kindly watch for staff representing ' + booking.operator + '.';
284
284
 
285
- if (booking.googleMapsLocation?.length > 0) {
286
- text += `\n\n${isHotelPickup(booking.startingPointDescription)
287
- ? 'PICKUP COORDINATES ON GOOGLE MAP'
288
- : 'MEETING COORDINATES ON GOOGLE MAP'
289
- }:\n${booking.googleMapsLocation}`;
290
- }
285
+ if (!options.compact) {
286
+ if (booking.googleMapsLocation?.length > 0) {
287
+ text += `\n\n${isHotelPickup(booking.startingPointDescription)
288
+ ? 'PICKUP COORDINATES ON GOOGLE MAP'
289
+ : 'MEETING COORDINATES ON GOOGLE MAP'
290
+ }:\n${booking.googleMapsLocation}`;
291
+ }
291
292
 
292
- if (product?.whatToBring?.length > 0) {
293
- text += '\n\nWHAT TO BRING: ' + product.whatToBring;
294
- }
293
+ if (product?.whatToBring?.length > 0) {
294
+ text += '\n\nWHAT TO BRING: ' + product.whatToBring;
295
+ }
295
296
 
296
- let notes = Object.values(booking.notes ?? {})
297
- .filter((item) => item.visibility.includes(CUSTOMER_NOTE))
298
- .map((item) => item.description);
299
- if (notes.length > 0) {
300
- text += '\n\nSPECIAL CUSTOMER NEEDS: ' + notes.join(', ');
301
- }
297
+ let notes = Object.values(booking.notes ?? {})
298
+ .filter((item) => item.visibility.includes(CUSTOMER_NOTE))
299
+ .map((item) => item.description);
300
+ if (notes.length > 0) {
301
+ text += '\n\nSPECIAL CUSTOMER NEEDS: ' + notes.join(', ');
302
+ }
302
303
 
303
- // add customer information from starting point
304
- let important = [];
305
- if (product) {
306
- let startingPoint = product.startingPoints.find(
307
- (item) => item.id === booking.startingPointId
308
- );
304
+ // add customer information from starting point
305
+ let important = [];
306
+ if (product) {
307
+ let startingPoint = product.startingPoints.find(
308
+ (item) => item.id === booking.startingPointId
309
+ );
309
310
 
310
- if (startingPoint?.customerInformation) {
311
- important.push(startingPoint.customerInformation.trim());
311
+ if (startingPoint?.customerInformation) {
312
+ important.push(startingPoint.customerInformation.trim());
313
+ }
312
314
  }
313
- }
314
315
 
315
- if (product?.customerInformation?.length > 0) {
316
- important.push(product.customerInformation);
317
- }
316
+ if (product?.customerInformation?.length > 0) {
317
+ important.push(product.customerInformation);
318
+ }
318
319
 
319
- if (important.length > 0) {
320
- text += '\n\nIMPORTANT INFORMATION: ' + important.join("\n\n");
321
- }
320
+ if (important.length > 0) {
321
+ text += '\n\nIMPORTANT INFORMATION: ' + important.join("\n\n");
322
+ }
322
323
 
323
- if (booking.dietary?.length > 0) {
324
- text += '\n\nDIETARY NEEDS: ' + booking.dietary;
325
- }
324
+ if (booking.dietary?.length > 0) {
325
+ text += '\n\nDIETARY NEEDS: ' + booking.dietary;
326
+ }
326
327
 
327
- let payOnTour = [];
328
- if (booking.nationalParkFee == PAY_ON_TOUR) {
329
- let item = 'As stated on the website, there is an entrance fee';
328
+ let payOnTour = [];
329
+ if (booking.nationalParkFee == PAY_ON_TOUR) {
330
+ let item = 'As stated on the website, there is an entrance fee';
330
331
 
331
- if (product?.nationalPark) {
332
- item += ' to ' + product?.nationalPark.title;
333
- }
332
+ if (product?.nationalPark) {
333
+ item += ' to ' + product?.nationalPark.title;
334
+ }
334
335
 
335
- if (product?.nationalPark?.pricing) {
336
- item +=
337
- ' of ' +
338
- product.nationalPark.pricing.adult +
339
- ' THB per adult and ' +
340
- product.nationalPark.pricing.child +
341
- ' THB per child';
342
- }
343
- item += ' to be paid at the point of entry';
336
+ if (product?.nationalPark?.pricing) {
337
+ item +=
338
+ ' of ' +
339
+ product.nationalPark.pricing.adult +
340
+ ' THB per adult and ' +
341
+ product.nationalPark.pricing.child +
342
+ ' THB per child';
343
+ }
344
+ item += ' to be paid at the point of entry';
344
345
 
345
- payOnTour.push(` • ${item}`);
346
- }
346
+ payOnTour.push(` • ${item}`);
347
+ }
347
348
 
348
- let extraPayments = Object.values(booking.extraPayments)
349
- .filter((item) => !item.disabled && item.paymentMethod === PAY_ON_TOUR)
350
- .map((item) => ` • ${item.description}: ${item.price} THB`);
351
- payOnTour = [...payOnTour, ...extraPayments];
352
- if (payOnTour.length > 0) {
353
- text += '\n\nTO BE PAID ON TOUR:\n' + payOnTour.join('\n');
354
- text += '\n\nPlease bring the total amount in cash to the trip.';
349
+ let extraPayments = Object.values(booking.extraPayments)
350
+ .filter((item) => !item.disabled && item.paymentMethod === PAY_ON_TOUR)
351
+ .map((item) => ` • ${item.description}: ${item.price} THB`);
352
+ payOnTour = [...payOnTour, ...extraPayments];
353
+ if (payOnTour.length > 0) {
354
+ text += '\n\nTO BE PAID ON TOUR:\n' + payOnTour.join('\n');
355
+ text += '\n\nPlease bring the total amount in cash to the trip.';
356
+ }
355
357
  }
356
358
 
357
359
  return text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.19.7",
3
+ "version": "1.19.8",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {