tripstorekrabi-shared 1.24.3 → 1.24.4

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 CHANGED
@@ -2,6 +2,7 @@ import dayjs from 'dayjs';
2
2
  import advancedFormat from 'dayjs/plugin/advancedFormat.js';
3
3
  import utc from 'dayjs/plugin/utc.js';
4
4
  import timezone from 'dayjs/plugin/timezone.js';
5
+ import { FieldValue, Timestamp } from 'firebase-admin/firestore';
5
6
  import { PAY_ON_TOUR, calculateTotalOperatorPrice } from './price.js';
6
7
  import { nanoid } from 'nanoid';
7
8
  import { CHECK_IN_LATE, IN_HOUSE, isAirportDropOff, isAirportPickup, isHotelPickup, isTrainStation, KEEP_PRIVATE, NO_PICKUP_HOTEL_YET, NO_ROOM, STAY_NEARBY } from './utils.js';
@@ -21,7 +22,6 @@ const PHONE_REGEXP = /[^\d+]/g;
21
22
 
22
23
  export function addBookingFromInvoice(
23
24
  firestore,
24
- admin,
25
25
  invoice,
26
26
  paymentData,
27
27
  comment = ''
@@ -78,7 +78,7 @@ export function addBookingFromInvoice(
78
78
  ? firestore.collection('products').doc(item.productId)
79
79
  : null,
80
80
  operator: productSnapshot?.get('operator.default.name') ?? '',
81
- departureDate: admin.firestore.Timestamp.fromDate(
81
+ departureDate: Timestamp.fromDate(
82
82
  dayjs(item.departureDate).toDate()
83
83
  ),
84
84
  schedule: item.schedule ?? '',
@@ -109,7 +109,7 @@ export function addBookingFromInvoice(
109
109
  paypalTransactionId: '',
110
110
  omiseChargeId: '',
111
111
  invoiceNumber: '',
112
- date: admin.firestore.FieldValue.serverTimestamp(),
112
+ date: FieldValue.serverTimestamp(),
113
113
  createdBy: 'Trip Store Krabi Next',
114
114
  lastModified: dayjs().toDate(),
115
115
  lastModifiedBy: 'Trip Store Krabi Next',
@@ -165,7 +165,7 @@ export function addBookingFromInvoice(
165
165
  transaction.set(
166
166
  bookingNumberDoc,
167
167
  {
168
- last: admin.firestore.FieldValue.increment(processed),
168
+ last: FieldValue.increment(processed),
169
169
  },
170
170
  { merge: true }
171
171
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.24.3",
3
+ "version": "1.24.4",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
@@ -18,8 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "dayjs": "^1.11.21",
21
- "libphonenumber-js": "^1.13.5",
22
- "nanoid": "^5.1.11"
21
+ "libphonenumber-js": "^1.13.6",
22
+ "nanoid": "^5.1.11",
23
+ "firebase-admin": "^14.0.0"
23
24
  },
24
25
  "scripts": {
25
26
  "deploy": "npm publish"
package/product.js CHANGED
@@ -1,5 +1,4 @@
1
- import dayjs from 'dayjs';
2
- import { calculateProductSellingPrice, countMinPeople, getActiveRevision } from "./price.js";
1
+ import { calculateProductSellingPrice, countMinPeople } from "./price.js";
3
2
 
4
3
  const MATCH_HTML_REGEXP = /(<([^>]+)>)/ig;
5
4