tripstorekrabi-shared 1.19.6 → 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.
- package/booking.js +70 -68
- 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 (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
-
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
if (product?.whatToBring?.length > 0) {
|
|
294
|
+
text += '\n\nWHAT TO BRING: ' + product.whatToBring;
|
|
295
|
+
}
|
|
295
296
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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
|
-
|
|
311
|
-
|
|
311
|
+
if (startingPoint?.customerInformation) {
|
|
312
|
+
important.push(startingPoint.customerInformation.trim());
|
|
313
|
+
}
|
|
312
314
|
}
|
|
313
|
-
}
|
|
314
315
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
if (product?.customerInformation?.length > 0) {
|
|
317
|
+
important.push(product.customerInformation);
|
|
318
|
+
}
|
|
318
319
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
if (important.length > 0) {
|
|
321
|
+
text += '\n\nIMPORTANT INFORMATION: ' + important.join("\n\n");
|
|
322
|
+
}
|
|
322
323
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
if (booking.dietary?.length > 0) {
|
|
325
|
+
text += '\n\nDIETARY NEEDS: ' + booking.dietary;
|
|
326
|
+
}
|
|
326
327
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
-
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
if (product?.nationalPark) {
|
|
333
|
+
item += ' to ' + product?.nationalPark.title;
|
|
334
|
+
}
|
|
334
335
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
|
|
346
|
-
|
|
346
|
+
payOnTour.push(` • ${item}`);
|
|
347
|
+
}
|
|
347
348
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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;
|
|
@@ -373,8 +375,8 @@ export function createTodos(booking, product) {
|
|
|
373
375
|
);
|
|
374
376
|
|
|
375
377
|
let customerBookingStatus = booking.customerBookingStatus;
|
|
376
|
-
if (customerBookingStatus !== 'Canceled') {
|
|
377
|
-
if (isHotelPickup(booking.startingPointDescription)
|
|
378
|
+
if (customerBookingStatus !== 'Canceled' && !pastTravelDate) {
|
|
379
|
+
if (isHotelPickup(booking.startingPointDescription)) {
|
|
378
380
|
if (booking.startingPointDescription === NO_PICKUP_HOTEL_YET) {
|
|
379
381
|
todos.pickupHotel = "missing";
|
|
380
382
|
}
|
|
@@ -386,7 +388,7 @@ export function createTodos(booking, product) {
|
|
|
386
388
|
booking.roomNumber !== STAY_NEARBY &&
|
|
387
389
|
booking.roomNumber !== KEEP_PRIVATE &&
|
|
388
390
|
booking.roomNumber !== CHECK_IN_LATE &&
|
|
389
|
-
!booking.roomNumber
|
|
391
|
+
!booking.roomNumber
|
|
390
392
|
) {
|
|
391
393
|
todos.roomNumber = "missing";
|
|
392
394
|
} else if (
|
|
@@ -397,13 +399,13 @@ export function createTodos(booking, product) {
|
|
|
397
399
|
booking.roomNumber !== KEEP_PRIVATE &&
|
|
398
400
|
booking.roomNumber !== CHECK_IN_LATE &&
|
|
399
401
|
booking.roomNumber &&
|
|
400
|
-
booking.sentToOperator === true
|
|
402
|
+
booking.sentToOperator === true
|
|
401
403
|
) {
|
|
402
404
|
todos.roomNumber = "sendToOperator";
|
|
403
405
|
}
|
|
404
406
|
}
|
|
405
407
|
|
|
406
|
-
if (product && hasFood(product)
|
|
408
|
+
if (product && hasFood(product)) {
|
|
407
409
|
if (!booking.dietary) {
|
|
408
410
|
todos.dietary = "missing";
|
|
409
411
|
} else if (!booking.dietaryConfirmed && booking.dietary?.length > 0 && booking.dietary !== 'None' && booking.sentToOperator === true) {
|
|
@@ -412,7 +414,7 @@ export function createTodos(booking, product) {
|
|
|
412
414
|
}
|
|
413
415
|
|
|
414
416
|
// hotel dropoff
|
|
415
|
-
if (booking.productDescription.includes('with transfer to hotel')
|
|
417
|
+
if (booking.productDescription.includes('with transfer to hotel')) {
|
|
416
418
|
if ((booking.dropoffHotel ?? "").length === 0) {
|
|
417
419
|
todos.dropoffHotel = "missing";
|
|
418
420
|
} else if (!booking.dropoffHotelConfirmed) {
|
|
@@ -420,7 +422,7 @@ export function createTodos(booking, product) {
|
|
|
420
422
|
}
|
|
421
423
|
}
|
|
422
424
|
|
|
423
|
-
if (isAirportPickup(booking.startingPointDescription)
|
|
425
|
+
if (isAirportPickup(booking.startingPointDescription)) {
|
|
424
426
|
if (!booking.flight) {
|
|
425
427
|
todos.inboundFlightDetails = "missing";
|
|
426
428
|
} else if (!booking.flightConfirmed) {
|
|
@@ -428,7 +430,7 @@ export function createTodos(booking, product) {
|
|
|
428
430
|
}
|
|
429
431
|
}
|
|
430
432
|
|
|
431
|
-
if (isAirportDropOff(booking.productDescription)
|
|
433
|
+
if (isAirportDropOff(booking.productDescription)) {
|
|
432
434
|
if (!booking.flight) {
|
|
433
435
|
todos.outboundFlightDetails = "missing";
|
|
434
436
|
} else if (!booking.flightConfirmed) {
|
|
@@ -436,7 +438,7 @@ export function createTodos(booking, product) {
|
|
|
436
438
|
}
|
|
437
439
|
}
|
|
438
440
|
|
|
439
|
-
if (isTrainStation(booking.startingPointDescription)
|
|
441
|
+
if (isTrainStation(booking.startingPointDescription)) {
|
|
440
442
|
if (!booking.train) {
|
|
441
443
|
todos.inboundTrainDetails = "missing";
|
|
442
444
|
} else if (!booking.trainConfirmed) {
|
|
@@ -444,7 +446,7 @@ export function createTodos(booking, product) {
|
|
|
444
446
|
}
|
|
445
447
|
}
|
|
446
448
|
|
|
447
|
-
if (isTrainStation(booking.productDescription)
|
|
449
|
+
if (isTrainStation(booking.productDescription)) {
|
|
448
450
|
if (!booking.train) {
|
|
449
451
|
todos.outboundTrainDetails = "missing";
|
|
450
452
|
} else if (!booking.trainConfirmed) {
|