@tiquo/dom-package 1.5.2 → 1.5.3
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/README.md +14 -1
- package/dist/index.d.mts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +30 -0
- package/dist/index.mjs +30 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -225,6 +225,15 @@ const confirmedBookings = await auth.getBookings({ status: 'confirmed' });
|
|
|
225
225
|
// With pagination
|
|
226
226
|
const page1 = await auth.getBookings({ limit: 10 });
|
|
227
227
|
const page2 = await auth.getBookings({ limit: 10, cursor: page1.nextCursor });
|
|
228
|
+
|
|
229
|
+
// Download a QR-code ticket PDF when ticketing is enabled
|
|
230
|
+
const [booking] = upcomingBookings.bookings;
|
|
231
|
+
if (booking?.ticketing.qrCodeTicketsEnabled) {
|
|
232
|
+
const ticketPdf = await auth.downloadBookingTicket(booking.id);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Wallet links are included when Apple Wallet / Google Wallet tickets are enabled
|
|
236
|
+
const walletUrl = booking?.ticketing.walletTicketUrl;
|
|
228
237
|
```
|
|
229
238
|
|
|
230
239
|
**Options:**
|
|
@@ -234,10 +243,14 @@ const page2 = await auth.getBookings({ limit: 10, cursor: page1.nextCursor });
|
|
|
234
243
|
- `upcoming` - If true, only return future bookings (sorted soonest first)
|
|
235
244
|
|
|
236
245
|
**Returns:**
|
|
237
|
-
- `bookings` - Array of booking objects with service details, date/time, and
|
|
246
|
+
- `bookings` - Array of booking objects with service details, date/time, status, and `ticketing` links. `serviceName` and `serviceCategoryName` come from the booking's order-item snapshot.
|
|
238
247
|
- `hasMore` - Whether there are more bookings to fetch
|
|
239
248
|
- `nextCursor` - Cursor for the next page (if `hasMore` is true)
|
|
240
249
|
|
|
250
|
+
#### `downloadBookingTicket(bookingId): Promise<Blob>`
|
|
251
|
+
|
|
252
|
+
Download the QR-code ticket PDF for one of the authenticated customer's bookings. Use this when `booking.ticketing.qrCodeTicketsEnabled` is true. Wallet-capable bookings also expose `booking.ticketing.walletTicketUrl`, `appleWalletTicketUrl`, and `googleWalletTicketUrl`.
|
|
253
|
+
|
|
241
254
|
#### `getEnquiries(options?): Promise<GetEnquiriesResult>`
|
|
242
255
|
|
|
243
256
|
Get the authenticated customer's enquiry history. Only returns enquiries for the logged-in customer.
|
package/dist/index.d.mts
CHANGED
|
@@ -560,11 +560,22 @@ interface TiquoBooking {
|
|
|
560
560
|
timezone: string;
|
|
561
561
|
attendeeCount: number;
|
|
562
562
|
/**
|
|
563
|
-
* Service title
|
|
564
|
-
*
|
|
565
|
-
* need a non-empty display string.
|
|
563
|
+
* Service title from the booking's order-item snapshot. Empty string when no
|
|
564
|
+
* order snapshot is available — render your own fallback if needed.
|
|
566
565
|
*/
|
|
567
566
|
serviceName: string;
|
|
567
|
+
/**
|
|
568
|
+
* Service category from the booking's order-item snapshot, when captured.
|
|
569
|
+
*/
|
|
570
|
+
serviceCategoryName?: string;
|
|
571
|
+
ticketing: {
|
|
572
|
+
qrCodeTicketsEnabled: boolean;
|
|
573
|
+
walletTicketsEnabled: boolean;
|
|
574
|
+
ticketDownloadUrl?: string;
|
|
575
|
+
walletTicketUrl?: string;
|
|
576
|
+
appleWalletTicketUrl?: string;
|
|
577
|
+
googleWalletTicketUrl?: string;
|
|
578
|
+
};
|
|
568
579
|
serviceId: string;
|
|
569
580
|
sublocationId: string;
|
|
570
581
|
customerNotes?: string;
|
|
@@ -772,6 +783,13 @@ declare class TiquoAuth {
|
|
|
772
783
|
* first.
|
|
773
784
|
*/
|
|
774
785
|
getBookings(options?: GetBookingsOptions): Promise<GetBookingsResult>;
|
|
786
|
+
/**
|
|
787
|
+
* Download a QR-code ticket PDF for one of the authenticated customer's bookings.
|
|
788
|
+
*
|
|
789
|
+
* This is only available when `booking.ticketing.qrCodeTicketsEnabled` is
|
|
790
|
+
* true in the booking list response.
|
|
791
|
+
*/
|
|
792
|
+
downloadBookingTicket(bookingId: string): Promise<Blob>;
|
|
775
793
|
/**
|
|
776
794
|
* Convenience wrapper around `getBookings({ upcoming: true })` for the
|
|
777
795
|
* common "show me my upcoming bookings" case. Results are sorted
|
package/dist/index.d.ts
CHANGED
|
@@ -560,11 +560,22 @@ interface TiquoBooking {
|
|
|
560
560
|
timezone: string;
|
|
561
561
|
attendeeCount: number;
|
|
562
562
|
/**
|
|
563
|
-
* Service title
|
|
564
|
-
*
|
|
565
|
-
* need a non-empty display string.
|
|
563
|
+
* Service title from the booking's order-item snapshot. Empty string when no
|
|
564
|
+
* order snapshot is available — render your own fallback if needed.
|
|
566
565
|
*/
|
|
567
566
|
serviceName: string;
|
|
567
|
+
/**
|
|
568
|
+
* Service category from the booking's order-item snapshot, when captured.
|
|
569
|
+
*/
|
|
570
|
+
serviceCategoryName?: string;
|
|
571
|
+
ticketing: {
|
|
572
|
+
qrCodeTicketsEnabled: boolean;
|
|
573
|
+
walletTicketsEnabled: boolean;
|
|
574
|
+
ticketDownloadUrl?: string;
|
|
575
|
+
walletTicketUrl?: string;
|
|
576
|
+
appleWalletTicketUrl?: string;
|
|
577
|
+
googleWalletTicketUrl?: string;
|
|
578
|
+
};
|
|
568
579
|
serviceId: string;
|
|
569
580
|
sublocationId: string;
|
|
570
581
|
customerNotes?: string;
|
|
@@ -772,6 +783,13 @@ declare class TiquoAuth {
|
|
|
772
783
|
* first.
|
|
773
784
|
*/
|
|
774
785
|
getBookings(options?: GetBookingsOptions): Promise<GetBookingsResult>;
|
|
786
|
+
/**
|
|
787
|
+
* Download a QR-code ticket PDF for one of the authenticated customer's bookings.
|
|
788
|
+
*
|
|
789
|
+
* This is only available when `booking.ticketing.qrCodeTicketsEnabled` is
|
|
790
|
+
* true in the booking list response.
|
|
791
|
+
*/
|
|
792
|
+
downloadBookingTicket(bookingId: string): Promise<Blob>;
|
|
775
793
|
/**
|
|
776
794
|
* Convenience wrapper around `getBookings({ upcoming: true })` for the
|
|
777
795
|
* common "show me my upcoming bookings" case. Results are sorted
|
package/dist/index.js
CHANGED
|
@@ -1475,6 +1475,36 @@ var TiquoAuth = class {
|
|
|
1475
1475
|
const result = await response.json();
|
|
1476
1476
|
return result.data || { bookings: [], hasMore: false };
|
|
1477
1477
|
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Download a QR-code ticket PDF for one of the authenticated customer's bookings.
|
|
1480
|
+
*
|
|
1481
|
+
* This is only available when `booking.ticketing.qrCodeTicketsEnabled` is
|
|
1482
|
+
* true in the booking list response.
|
|
1483
|
+
*/
|
|
1484
|
+
async downloadBookingTicket(bookingId) {
|
|
1485
|
+
await this.ensureValidToken();
|
|
1486
|
+
this.log("Downloading booking ticket:", bookingId);
|
|
1487
|
+
const url = new URL(
|
|
1488
|
+
`${this.config.apiEndpoint}/api/client/v1/booking-ticket`
|
|
1489
|
+
);
|
|
1490
|
+
url.searchParams.set("bookingId", bookingId);
|
|
1491
|
+
const response = await fetch(url.toString(), {
|
|
1492
|
+
method: "GET",
|
|
1493
|
+
headers: {
|
|
1494
|
+
Authorization: `Bearer ${this.accessToken}`
|
|
1495
|
+
},
|
|
1496
|
+
credentials: "include"
|
|
1497
|
+
});
|
|
1498
|
+
if (!response.ok) {
|
|
1499
|
+
const error = await response.json().catch(() => ({ error: "Failed to download booking ticket" }));
|
|
1500
|
+
throw new TiquoAuthError(
|
|
1501
|
+
error.error || "Failed to download booking ticket",
|
|
1502
|
+
"DOWNLOAD_BOOKING_TICKET_FAILED",
|
|
1503
|
+
response.status
|
|
1504
|
+
);
|
|
1505
|
+
}
|
|
1506
|
+
return response.blob();
|
|
1507
|
+
}
|
|
1478
1508
|
/**
|
|
1479
1509
|
* Convenience wrapper around `getBookings({ upcoming: true })` for the
|
|
1480
1510
|
* common "show me my upcoming bookings" case. Results are sorted
|
package/dist/index.mjs
CHANGED
|
@@ -1437,6 +1437,36 @@ var TiquoAuth = class {
|
|
|
1437
1437
|
const result = await response.json();
|
|
1438
1438
|
return result.data || { bookings: [], hasMore: false };
|
|
1439
1439
|
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Download a QR-code ticket PDF for one of the authenticated customer's bookings.
|
|
1442
|
+
*
|
|
1443
|
+
* This is only available when `booking.ticketing.qrCodeTicketsEnabled` is
|
|
1444
|
+
* true in the booking list response.
|
|
1445
|
+
*/
|
|
1446
|
+
async downloadBookingTicket(bookingId) {
|
|
1447
|
+
await this.ensureValidToken();
|
|
1448
|
+
this.log("Downloading booking ticket:", bookingId);
|
|
1449
|
+
const url = new URL(
|
|
1450
|
+
`${this.config.apiEndpoint}/api/client/v1/booking-ticket`
|
|
1451
|
+
);
|
|
1452
|
+
url.searchParams.set("bookingId", bookingId);
|
|
1453
|
+
const response = await fetch(url.toString(), {
|
|
1454
|
+
method: "GET",
|
|
1455
|
+
headers: {
|
|
1456
|
+
Authorization: `Bearer ${this.accessToken}`
|
|
1457
|
+
},
|
|
1458
|
+
credentials: "include"
|
|
1459
|
+
});
|
|
1460
|
+
if (!response.ok) {
|
|
1461
|
+
const error = await response.json().catch(() => ({ error: "Failed to download booking ticket" }));
|
|
1462
|
+
throw new TiquoAuthError(
|
|
1463
|
+
error.error || "Failed to download booking ticket",
|
|
1464
|
+
"DOWNLOAD_BOOKING_TICKET_FAILED",
|
|
1465
|
+
response.status
|
|
1466
|
+
);
|
|
1467
|
+
}
|
|
1468
|
+
return response.blob();
|
|
1469
|
+
}
|
|
1440
1470
|
/**
|
|
1441
1471
|
* Convenience wrapper around `getBookings({ upcoming: true })` for the
|
|
1442
1472
|
* common "show me my upcoming bookings" case. Results are sorted
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiquo/dom-package",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Tiquo SDK for third-party websites - authentication, customer profiles, orders, bookings, enquiries, receipts, and companies",
|
|
5
5
|
"sideEffects": true,
|
|
6
6
|
"publishConfig": {
|
|
7
|
-
"access": "
|
|
7
|
+
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"module": "dist/index.mjs",
|