tripstorekrabi-shared 1.12.0 → 1.12.2

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 +56 -0
  2. package/package.json +1 -1
  3. package/utils.js +0 -4
package/booking.js CHANGED
@@ -189,4 +189,60 @@ function addPhoneNumbers(phoneNumbers, phoneNumber) {
189
189
  phoneNumbers.push(phoneNumber);
190
190
  phoneNumbers.push("+" + phoneNumber);
191
191
  }
192
+ }
193
+
194
+ export function getStartingPointMessage(booking, product) {
195
+ let text = booking.startingPointDescription;
196
+ if (booking.pickupTime.indexOf('-') != -1) {
197
+ text +=
198
+ ' between ' +
199
+ booking.pickupTime.replace(' - ', ' and ').replace('-', ' and ');
200
+ } else {
201
+ text += ' at ' + booking.pickupTime;
202
+ }
203
+
204
+ let now = dayjs().tz("Asia/Bangkok");
205
+ let dayjsDate = dayjs.tz(booking.departureDate.toDate(), "Asia/Bangkok");
206
+ let date = dayjsDate.format('Do MMM');
207
+
208
+ if (
209
+ now.add(1, 'day').isSame(dayjsDate, 'day')
210
+ ) {
211
+ text += ' tomorrow the ' + date;
212
+ } else if (now.isSame(dayjsDate, 'day')) {
213
+ text += ' today the ' + date;
214
+ } else {
215
+ text += ' on the ' + date;
216
+ }
217
+
218
+ text += '. Please watch out for the staff of ' + booking.operator + '.';
219
+
220
+ if (booking.specialRequirements) {
221
+ text +=
222
+ '\n\nSPECIAL REQUIREMENTS: ' +
223
+ booking.specialRequirements.toUpperCase();
224
+ }
225
+
226
+ if (booking.nationalParkFee == 'Pay on tour') {
227
+ text += '\n\nAs stated on the website, there is an entrance fee';
228
+
229
+ if (product?.nationalPark) {
230
+ text += ' to ' + product?.nationalPark.title;
231
+ }
232
+
233
+ if (product?.nationalPark?.pricing
234
+ ) {
235
+ text +=
236
+ ' of ' +
237
+ product.nationalPark.pricing.adult +
238
+ ' THB per adult and ' +
239
+ product.nationalPark.pricing.child +
240
+ ' THB per child';
241
+ }
242
+
243
+ text +=
244
+ ' to be paid at point of entry. Please bring the required amount in cash to the trip.';
245
+ }
246
+
247
+ return text;
192
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/utils.js CHANGED
@@ -532,10 +532,6 @@ export function isAirbnbBooking(referenceNumber) {
532
532
  return referenceNumber.startsWith("Airbnb-");
533
533
  }
534
534
 
535
- export function isAirAsiaBooking(referenceNumber) {
536
- return referenceNumber.startsWith("AirAsia-");
537
- }
538
-
539
535
  export function isKKdayBooking(referenceNumber) {
540
536
  return referenceNumber.startsWith("KKday-");
541
537
  }