@tiquo/dom-package 1.5.1 → 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 +29 -1
- package/dist/index.d.mts +93 -24
- package/dist/index.d.ts +93 -24
- package/dist/index.js +500 -80
- package/dist/index.mjs +499 -80
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Tiquo SDK for third-party websites. Integrate authentication, customer profiles,
|
|
|
9
9
|
- **Multi-Tab Sync** - Auth state automatically syncs across all browser tabs
|
|
10
10
|
- **Native App Integration** - WebView token injection for iOS/Android hybrid apps
|
|
11
11
|
- **Customer Flow Integration** - Embed authenticated customer flows with one line of code
|
|
12
|
+
- **First-Party Website Analytics** - Cookie-free pageview, session, attribution, and known-customer activity tracking
|
|
12
13
|
- **Phone Number Utilities** - Validation, formatting, and country code support for 200+ countries
|
|
13
14
|
- **Framework Agnostic** - Works with React, Vue, Svelte, or vanilla JavaScript
|
|
14
15
|
- **TypeScript Support** - Full type definitions included
|
|
@@ -39,6 +40,19 @@ const auth = new TiquoAuth({
|
|
|
39
40
|
});
|
|
40
41
|
```
|
|
41
42
|
|
|
43
|
+
Website analytics starts automatically when you initialize `TiquoAuth` or `TiquoCMS`.
|
|
44
|
+
The same public key is used across all websites in your organization; Tiquo records
|
|
45
|
+
the source domain for each event and rolls `www.example.com` into `example.com`.
|
|
46
|
+
Other subdomains are tracked as separate websites.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Optional custom analytics events
|
|
50
|
+
await auth.analytics?.track('booking_started', {
|
|
51
|
+
eventName: 'Booking Started',
|
|
52
|
+
eventProperties: { serviceId: 'svc_123' }
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
42
56
|
### 3. Authenticate Users
|
|
43
57
|
|
|
44
58
|
```typescript
|
|
@@ -65,6 +79,7 @@ const auth = new TiquoAuth({
|
|
|
65
79
|
storagePrefix?: string; // Optional: localStorage key prefix
|
|
66
80
|
debug?: boolean; // Optional: Enable debug logging
|
|
67
81
|
enableTabSync?: boolean; // Optional: Multi-tab session sync (default: true)
|
|
82
|
+
analytics?: boolean; // Optional: Website analytics (default: true)
|
|
68
83
|
});
|
|
69
84
|
```
|
|
70
85
|
|
|
@@ -210,6 +225,15 @@ const confirmedBookings = await auth.getBookings({ status: 'confirmed' });
|
|
|
210
225
|
// With pagination
|
|
211
226
|
const page1 = await auth.getBookings({ limit: 10 });
|
|
212
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;
|
|
213
237
|
```
|
|
214
238
|
|
|
215
239
|
**Options:**
|
|
@@ -219,10 +243,14 @@ const page2 = await auth.getBookings({ limit: 10, cursor: page1.nextCursor });
|
|
|
219
243
|
- `upcoming` - If true, only return future bookings (sorted soonest first)
|
|
220
244
|
|
|
221
245
|
**Returns:**
|
|
222
|
-
- `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.
|
|
223
247
|
- `hasMore` - Whether there are more bookings to fetch
|
|
224
248
|
- `nextCursor` - Cursor for the next page (if `hasMore` is true)
|
|
225
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
|
+
|
|
226
254
|
#### `getEnquiries(options?): Promise<GetEnquiriesResult>`
|
|
227
255
|
|
|
228
256
|
Get the authenticated customer's enquiry history. Only returns enquiries for the logged-in customer.
|
package/dist/index.d.mts
CHANGED
|
@@ -209,8 +209,27 @@ declare function buildPhone(countryCode: string, nationalNumber: string): string
|
|
|
209
209
|
* ```
|
|
210
210
|
*/
|
|
211
211
|
|
|
212
|
+
declare class TiquoAnalytics {
|
|
213
|
+
private static activeInstances;
|
|
214
|
+
private config;
|
|
215
|
+
private clientSessionId;
|
|
216
|
+
private pageStartedAt;
|
|
217
|
+
private lastPath;
|
|
218
|
+
private started;
|
|
219
|
+
constructor(config: TiquoAnalyticsConfig);
|
|
220
|
+
start(): void;
|
|
221
|
+
trackPageview(options?: TiquoAnalyticsEventOptions): Promise<void>;
|
|
222
|
+
track(eventType: string, options?: TiquoAnalyticsEventOptions): Promise<void>;
|
|
223
|
+
identify(options?: TiquoAnalyticsEventOptions): Promise<void>;
|
|
224
|
+
private trackEngagement;
|
|
225
|
+
private send;
|
|
226
|
+
private getClientSessionId;
|
|
227
|
+
private log;
|
|
228
|
+
private adoptConfig;
|
|
229
|
+
}
|
|
212
230
|
declare class TiquoCMS {
|
|
213
231
|
private config;
|
|
232
|
+
analytics: TiquoAnalytics | null;
|
|
214
233
|
constructor(config: TiquoCMSConfig);
|
|
215
234
|
/**
|
|
216
235
|
* Fetch a published CMS page for the website attached to this public key.
|
|
@@ -236,6 +255,8 @@ interface TiquoAuthConfig {
|
|
|
236
255
|
accessToken?: string;
|
|
237
256
|
/** Pre-authenticated refresh token (for WebView injection from native apps) */
|
|
238
257
|
refreshToken?: string;
|
|
258
|
+
/** Enable first-party website analytics (default: true) */
|
|
259
|
+
analytics?: boolean;
|
|
239
260
|
}
|
|
240
261
|
interface TiquoCMSConfig {
|
|
241
262
|
/** Public key from your Tiquo Auth DOM settings */
|
|
@@ -244,6 +265,35 @@ interface TiquoCMSConfig {
|
|
|
244
265
|
apiEndpoint?: string;
|
|
245
266
|
/** Enable debug logging */
|
|
246
267
|
debug?: boolean;
|
|
268
|
+
/** Enable first-party website analytics (default: true) */
|
|
269
|
+
analytics?: boolean;
|
|
270
|
+
}
|
|
271
|
+
interface TiquoAnalyticsConfig {
|
|
272
|
+
/** Public key from your Tiquo Auth DOM settings */
|
|
273
|
+
publicKey: string;
|
|
274
|
+
/** API endpoint (defaults to production) */
|
|
275
|
+
apiEndpoint?: string;
|
|
276
|
+
/** Enable debug logging */
|
|
277
|
+
debug?: boolean;
|
|
278
|
+
/** Optional CMS website slug */
|
|
279
|
+
siteSlug?: string;
|
|
280
|
+
/** Enable automatic pageview tracking (default: true) */
|
|
281
|
+
autoTrackPageviews?: boolean;
|
|
282
|
+
/** Optional access-token getter used to associate events with known customers */
|
|
283
|
+
getAccessToken?: () => string | null | undefined;
|
|
284
|
+
}
|
|
285
|
+
interface TiquoAnalyticsEventOptions {
|
|
286
|
+
eventName?: string;
|
|
287
|
+
eventProperties?: Record<string, unknown>;
|
|
288
|
+
siteSlug?: string;
|
|
289
|
+
pageSlug?: string;
|
|
290
|
+
path?: string;
|
|
291
|
+
url?: string;
|
|
292
|
+
title?: string;
|
|
293
|
+
referrer?: string;
|
|
294
|
+
durationMs?: number;
|
|
295
|
+
scrollDepth?: number;
|
|
296
|
+
identityLinkType?: "auth_dom_login" | "email_capture" | "booking" | "enquiry" | "order" | "customer_portal" | "manual";
|
|
247
297
|
}
|
|
248
298
|
interface TiquoCMSPageRequest {
|
|
249
299
|
/** CMS website slug */
|
|
@@ -392,7 +442,7 @@ interface TiquoOrderItem {
|
|
|
392
442
|
quantity: number;
|
|
393
443
|
unitPrice: number;
|
|
394
444
|
total: number;
|
|
395
|
-
type:
|
|
445
|
+
type: "product" | "booking" | "custom";
|
|
396
446
|
}
|
|
397
447
|
/**
|
|
398
448
|
* An order belonging to the authenticated customer.
|
|
@@ -404,8 +454,8 @@ interface TiquoOrderItem {
|
|
|
404
454
|
interface TiquoOrder {
|
|
405
455
|
id: string;
|
|
406
456
|
orderNumber: string;
|
|
407
|
-
status:
|
|
408
|
-
paymentStatus:
|
|
457
|
+
status: "draft" | "processing" | "completed" | "cancelled" | "refunded" | "open_tab";
|
|
458
|
+
paymentStatus: "pending" | "paid" | "partial" | "refunded" | "partially_refunded" | "failed" | "cancelled";
|
|
409
459
|
total: number;
|
|
410
460
|
subtotal: number;
|
|
411
461
|
taxTotal: number;
|
|
@@ -413,12 +463,12 @@ interface TiquoOrder {
|
|
|
413
463
|
items: TiquoOrderItem[];
|
|
414
464
|
createdAt: number;
|
|
415
465
|
completedAt?: number;
|
|
416
|
-
customerRole:
|
|
466
|
+
customerRole: "primary" | "attendee" | "billing" | "referrer" | "other";
|
|
417
467
|
}
|
|
418
468
|
interface GetOrdersOptions {
|
|
419
469
|
limit?: number;
|
|
420
470
|
cursor?: string;
|
|
421
|
-
status?: TiquoOrder[
|
|
471
|
+
status?: TiquoOrder["status"];
|
|
422
472
|
}
|
|
423
473
|
interface GetOrdersResult {
|
|
424
474
|
orders: TiquoOrder[];
|
|
@@ -434,7 +484,7 @@ interface TiquoReceiptItem {
|
|
|
434
484
|
tax: number;
|
|
435
485
|
discount: number;
|
|
436
486
|
total: number;
|
|
437
|
-
type:
|
|
487
|
+
type: "product" | "booking" | "custom" | "membership";
|
|
438
488
|
specialInstructions?: string;
|
|
439
489
|
}
|
|
440
490
|
interface TiquoReceiptBusiness {
|
|
@@ -461,8 +511,8 @@ interface TiquoReceiptCustomer {
|
|
|
461
511
|
interface TiquoReceiptOrder {
|
|
462
512
|
id: string;
|
|
463
513
|
orderNumber: string;
|
|
464
|
-
status: TiquoOrder[
|
|
465
|
-
paymentStatus: TiquoOrder[
|
|
514
|
+
status: TiquoOrder["status"];
|
|
515
|
+
paymentStatus: TiquoOrder["paymentStatus"];
|
|
466
516
|
currency: string;
|
|
467
517
|
subtotal: number;
|
|
468
518
|
taxTotal: number;
|
|
@@ -502,7 +552,7 @@ interface TiquoReceipt {
|
|
|
502
552
|
interface TiquoBooking {
|
|
503
553
|
id: string;
|
|
504
554
|
bookingNumber: string;
|
|
505
|
-
status:
|
|
555
|
+
status: "scheduled" | "confirmed" | "reminder_sent" | "waiting_room" | "waiting_list" | "checked_in" | "active" | "in_progress" | "completed" | "cancelled" | "no_show" | "rescheduled";
|
|
506
556
|
date: number;
|
|
507
557
|
startTime: string;
|
|
508
558
|
endTime: string;
|
|
@@ -510,11 +560,22 @@ interface TiquoBooking {
|
|
|
510
560
|
timezone: string;
|
|
511
561
|
attendeeCount: number;
|
|
512
562
|
/**
|
|
513
|
-
* Service title
|
|
514
|
-
*
|
|
515
|
-
* 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.
|
|
516
565
|
*/
|
|
517
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
|
+
};
|
|
518
579
|
serviceId: string;
|
|
519
580
|
sublocationId: string;
|
|
520
581
|
customerNotes?: string;
|
|
@@ -526,7 +587,7 @@ interface TiquoBooking {
|
|
|
526
587
|
interface GetBookingsOptions {
|
|
527
588
|
limit?: number;
|
|
528
589
|
cursor?: string;
|
|
529
|
-
status?: TiquoBooking[
|
|
590
|
+
status?: TiquoBooking["status"];
|
|
530
591
|
upcoming?: boolean;
|
|
531
592
|
}
|
|
532
593
|
interface GetBookingsResult {
|
|
@@ -541,27 +602,27 @@ interface TiquoEnquiry {
|
|
|
541
602
|
subject: string;
|
|
542
603
|
message: string;
|
|
543
604
|
category: string;
|
|
544
|
-
status:
|
|
545
|
-
priority:
|
|
546
|
-
source:
|
|
605
|
+
status: "new" | "in_progress" | "waiting_customer" | "waiting_internal" | "won" | "lost" | "closed" | "resolved" | "archived";
|
|
606
|
+
priority: "low" | "medium" | "high" | "urgent";
|
|
607
|
+
source: "online" | "website" | "phone" | "email" | "walk_in" | "social" | "referral" | "pos" | "admin";
|
|
547
608
|
responseCount: number;
|
|
548
609
|
createdAt: string;
|
|
549
610
|
updatedAt: string;
|
|
550
611
|
firstResponseAt?: string;
|
|
551
612
|
resolvedAt?: string;
|
|
552
|
-
customerRole:
|
|
613
|
+
customerRole: "primary" | "attendee" | "billing" | "referrer" | "other";
|
|
553
614
|
}
|
|
554
615
|
interface GetEnquiriesOptions {
|
|
555
616
|
limit?: number;
|
|
556
617
|
cursor?: string;
|
|
557
|
-
status?: TiquoEnquiry[
|
|
618
|
+
status?: TiquoEnquiry["status"];
|
|
558
619
|
}
|
|
559
620
|
interface GetEnquiriesResult {
|
|
560
621
|
enquiries: TiquoEnquiry[];
|
|
561
622
|
hasMore: boolean;
|
|
562
623
|
nextCursor?: string;
|
|
563
624
|
}
|
|
564
|
-
type TiquoCompanyRelationship =
|
|
625
|
+
type TiquoCompanyRelationship = "employee" | "contractor" | "manager" | "executive" | "owner" | "contact" | "other";
|
|
565
626
|
/**
|
|
566
627
|
* The authenticated customer's membership in a company. Each company the
|
|
567
628
|
* customer belongs to has its own membership record — a customer can be
|
|
@@ -599,9 +660,9 @@ interface TiquoCompany {
|
|
|
599
660
|
postalCode?: string;
|
|
600
661
|
country?: string;
|
|
601
662
|
industry?: string;
|
|
602
|
-
companySize?:
|
|
603
|
-
status:
|
|
604
|
-
type?:
|
|
663
|
+
companySize?: "1-10" | "11-50" | "51-200" | "201-500" | "501-1000" | "1000+";
|
|
664
|
+
status: "active" | "inactive" | "archived";
|
|
665
|
+
type?: "client" | "prospect" | "vendor" | "partner" | "other";
|
|
605
666
|
membership: TiquoCompanyMembership;
|
|
606
667
|
}
|
|
607
668
|
interface GetCompaniesResult {
|
|
@@ -652,6 +713,7 @@ declare class TiquoAuth {
|
|
|
652
713
|
private visibilityHandler;
|
|
653
714
|
private iframeObserver;
|
|
654
715
|
private injectedIframes;
|
|
716
|
+
analytics: TiquoAnalytics | null;
|
|
655
717
|
private broadcastChannel;
|
|
656
718
|
private tabId;
|
|
657
719
|
private isProcessingTabSync;
|
|
@@ -721,6 +783,13 @@ declare class TiquoAuth {
|
|
|
721
783
|
* first.
|
|
722
784
|
*/
|
|
723
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>;
|
|
724
793
|
/**
|
|
725
794
|
* Convenience wrapper around `getBookings({ upcoming: true })` for the
|
|
726
795
|
* common "show me my upcoming bookings" case. Results are sorted
|
|
@@ -731,7 +800,7 @@ declare class TiquoAuth {
|
|
|
731
800
|
* future, since they're effectively history. Use `getBookings()` without
|
|
732
801
|
* `upcoming: true` if you need those.
|
|
733
802
|
*/
|
|
734
|
-
getUpcomingBookings(options?: Omit<GetBookingsOptions,
|
|
803
|
+
getUpcomingBookings(options?: Omit<GetBookingsOptions, "upcoming">): Promise<GetBookingsResult>;
|
|
735
804
|
/**
|
|
736
805
|
* Get a printable receipt for a single order owned by the authenticated
|
|
737
806
|
* customer. Only resolves for orders that are paid (full or partial),
|
|
@@ -941,4 +1010,4 @@ declare class TiquoPhone {
|
|
|
941
1010
|
static buildPhone: typeof buildPhone;
|
|
942
1011
|
}
|
|
943
1012
|
|
|
944
|
-
export { type AuthStateChangeCallback, type CountryPhoneInfo, type GetBookingsOptions, type GetBookingsResult, type GetCompaniesResult, type GetCompanyColleaguesResult, type GetEnquiriesOptions, type GetEnquiriesResult, type GetOrdersOptions, type GetOrdersResult, type IframeTokenResult, type PhoneValidationResult, type ProfilePhotoUploadResult, type ProfileUpdateData, type ProfileUpdateResult, type SendOTPResult, TiquoAuth, type TiquoAuthConfig, TiquoAuthError, type TiquoBooking, TiquoCMS, type TiquoCMSBlock, type TiquoCMSConfig, type TiquoCMSPage, type TiquoCMSPageRequest, type TiquoCompany, type TiquoCompanyColleague, type TiquoCompanyMembership, type TiquoCompanyRelationship, type TiquoCustomer, type TiquoCustomerEmail, type TiquoCustomerPhone, type TiquoEnquiry, type TiquoOrder, type TiquoOrderItem, TiquoPhone, type TiquoReceipt, type TiquoReceiptBusiness, type TiquoReceiptCustomer, type TiquoReceiptItem, type TiquoReceiptOrder, type TiquoSession, type TiquoUser, type VerifyOTPResult, addCustomerUserId, clearCachedEmail, TiquoAuth as default, getCustomerUserIds, getPrefilledEmailFromCookie, isDashboardSession, trackCustomerPresence, useTiquoAuth };
|
|
1013
|
+
export { type AuthStateChangeCallback, type CountryPhoneInfo, type GetBookingsOptions, type GetBookingsResult, type GetCompaniesResult, type GetCompanyColleaguesResult, type GetEnquiriesOptions, type GetEnquiriesResult, type GetOrdersOptions, type GetOrdersResult, type IframeTokenResult, type PhoneValidationResult, type ProfilePhotoUploadResult, type ProfileUpdateData, type ProfileUpdateResult, type SendOTPResult, TiquoAnalytics, type TiquoAnalyticsConfig, type TiquoAnalyticsEventOptions, TiquoAuth, type TiquoAuthConfig, TiquoAuthError, type TiquoBooking, TiquoCMS, type TiquoCMSBlock, type TiquoCMSConfig, type TiquoCMSPage, type TiquoCMSPageRequest, type TiquoCompany, type TiquoCompanyColleague, type TiquoCompanyMembership, type TiquoCompanyRelationship, type TiquoCustomer, type TiquoCustomerEmail, type TiquoCustomerPhone, type TiquoEnquiry, type TiquoOrder, type TiquoOrderItem, TiquoPhone, type TiquoReceipt, type TiquoReceiptBusiness, type TiquoReceiptCustomer, type TiquoReceiptItem, type TiquoReceiptOrder, type TiquoSession, type TiquoUser, type VerifyOTPResult, addCustomerUserId, clearCachedEmail, TiquoAuth as default, getCustomerUserIds, getPrefilledEmailFromCookie, isDashboardSession, trackCustomerPresence, useTiquoAuth };
|
package/dist/index.d.ts
CHANGED
|
@@ -209,8 +209,27 @@ declare function buildPhone(countryCode: string, nationalNumber: string): string
|
|
|
209
209
|
* ```
|
|
210
210
|
*/
|
|
211
211
|
|
|
212
|
+
declare class TiquoAnalytics {
|
|
213
|
+
private static activeInstances;
|
|
214
|
+
private config;
|
|
215
|
+
private clientSessionId;
|
|
216
|
+
private pageStartedAt;
|
|
217
|
+
private lastPath;
|
|
218
|
+
private started;
|
|
219
|
+
constructor(config: TiquoAnalyticsConfig);
|
|
220
|
+
start(): void;
|
|
221
|
+
trackPageview(options?: TiquoAnalyticsEventOptions): Promise<void>;
|
|
222
|
+
track(eventType: string, options?: TiquoAnalyticsEventOptions): Promise<void>;
|
|
223
|
+
identify(options?: TiquoAnalyticsEventOptions): Promise<void>;
|
|
224
|
+
private trackEngagement;
|
|
225
|
+
private send;
|
|
226
|
+
private getClientSessionId;
|
|
227
|
+
private log;
|
|
228
|
+
private adoptConfig;
|
|
229
|
+
}
|
|
212
230
|
declare class TiquoCMS {
|
|
213
231
|
private config;
|
|
232
|
+
analytics: TiquoAnalytics | null;
|
|
214
233
|
constructor(config: TiquoCMSConfig);
|
|
215
234
|
/**
|
|
216
235
|
* Fetch a published CMS page for the website attached to this public key.
|
|
@@ -236,6 +255,8 @@ interface TiquoAuthConfig {
|
|
|
236
255
|
accessToken?: string;
|
|
237
256
|
/** Pre-authenticated refresh token (for WebView injection from native apps) */
|
|
238
257
|
refreshToken?: string;
|
|
258
|
+
/** Enable first-party website analytics (default: true) */
|
|
259
|
+
analytics?: boolean;
|
|
239
260
|
}
|
|
240
261
|
interface TiquoCMSConfig {
|
|
241
262
|
/** Public key from your Tiquo Auth DOM settings */
|
|
@@ -244,6 +265,35 @@ interface TiquoCMSConfig {
|
|
|
244
265
|
apiEndpoint?: string;
|
|
245
266
|
/** Enable debug logging */
|
|
246
267
|
debug?: boolean;
|
|
268
|
+
/** Enable first-party website analytics (default: true) */
|
|
269
|
+
analytics?: boolean;
|
|
270
|
+
}
|
|
271
|
+
interface TiquoAnalyticsConfig {
|
|
272
|
+
/** Public key from your Tiquo Auth DOM settings */
|
|
273
|
+
publicKey: string;
|
|
274
|
+
/** API endpoint (defaults to production) */
|
|
275
|
+
apiEndpoint?: string;
|
|
276
|
+
/** Enable debug logging */
|
|
277
|
+
debug?: boolean;
|
|
278
|
+
/** Optional CMS website slug */
|
|
279
|
+
siteSlug?: string;
|
|
280
|
+
/** Enable automatic pageview tracking (default: true) */
|
|
281
|
+
autoTrackPageviews?: boolean;
|
|
282
|
+
/** Optional access-token getter used to associate events with known customers */
|
|
283
|
+
getAccessToken?: () => string | null | undefined;
|
|
284
|
+
}
|
|
285
|
+
interface TiquoAnalyticsEventOptions {
|
|
286
|
+
eventName?: string;
|
|
287
|
+
eventProperties?: Record<string, unknown>;
|
|
288
|
+
siteSlug?: string;
|
|
289
|
+
pageSlug?: string;
|
|
290
|
+
path?: string;
|
|
291
|
+
url?: string;
|
|
292
|
+
title?: string;
|
|
293
|
+
referrer?: string;
|
|
294
|
+
durationMs?: number;
|
|
295
|
+
scrollDepth?: number;
|
|
296
|
+
identityLinkType?: "auth_dom_login" | "email_capture" | "booking" | "enquiry" | "order" | "customer_portal" | "manual";
|
|
247
297
|
}
|
|
248
298
|
interface TiquoCMSPageRequest {
|
|
249
299
|
/** CMS website slug */
|
|
@@ -392,7 +442,7 @@ interface TiquoOrderItem {
|
|
|
392
442
|
quantity: number;
|
|
393
443
|
unitPrice: number;
|
|
394
444
|
total: number;
|
|
395
|
-
type:
|
|
445
|
+
type: "product" | "booking" | "custom";
|
|
396
446
|
}
|
|
397
447
|
/**
|
|
398
448
|
* An order belonging to the authenticated customer.
|
|
@@ -404,8 +454,8 @@ interface TiquoOrderItem {
|
|
|
404
454
|
interface TiquoOrder {
|
|
405
455
|
id: string;
|
|
406
456
|
orderNumber: string;
|
|
407
|
-
status:
|
|
408
|
-
paymentStatus:
|
|
457
|
+
status: "draft" | "processing" | "completed" | "cancelled" | "refunded" | "open_tab";
|
|
458
|
+
paymentStatus: "pending" | "paid" | "partial" | "refunded" | "partially_refunded" | "failed" | "cancelled";
|
|
409
459
|
total: number;
|
|
410
460
|
subtotal: number;
|
|
411
461
|
taxTotal: number;
|
|
@@ -413,12 +463,12 @@ interface TiquoOrder {
|
|
|
413
463
|
items: TiquoOrderItem[];
|
|
414
464
|
createdAt: number;
|
|
415
465
|
completedAt?: number;
|
|
416
|
-
customerRole:
|
|
466
|
+
customerRole: "primary" | "attendee" | "billing" | "referrer" | "other";
|
|
417
467
|
}
|
|
418
468
|
interface GetOrdersOptions {
|
|
419
469
|
limit?: number;
|
|
420
470
|
cursor?: string;
|
|
421
|
-
status?: TiquoOrder[
|
|
471
|
+
status?: TiquoOrder["status"];
|
|
422
472
|
}
|
|
423
473
|
interface GetOrdersResult {
|
|
424
474
|
orders: TiquoOrder[];
|
|
@@ -434,7 +484,7 @@ interface TiquoReceiptItem {
|
|
|
434
484
|
tax: number;
|
|
435
485
|
discount: number;
|
|
436
486
|
total: number;
|
|
437
|
-
type:
|
|
487
|
+
type: "product" | "booking" | "custom" | "membership";
|
|
438
488
|
specialInstructions?: string;
|
|
439
489
|
}
|
|
440
490
|
interface TiquoReceiptBusiness {
|
|
@@ -461,8 +511,8 @@ interface TiquoReceiptCustomer {
|
|
|
461
511
|
interface TiquoReceiptOrder {
|
|
462
512
|
id: string;
|
|
463
513
|
orderNumber: string;
|
|
464
|
-
status: TiquoOrder[
|
|
465
|
-
paymentStatus: TiquoOrder[
|
|
514
|
+
status: TiquoOrder["status"];
|
|
515
|
+
paymentStatus: TiquoOrder["paymentStatus"];
|
|
466
516
|
currency: string;
|
|
467
517
|
subtotal: number;
|
|
468
518
|
taxTotal: number;
|
|
@@ -502,7 +552,7 @@ interface TiquoReceipt {
|
|
|
502
552
|
interface TiquoBooking {
|
|
503
553
|
id: string;
|
|
504
554
|
bookingNumber: string;
|
|
505
|
-
status:
|
|
555
|
+
status: "scheduled" | "confirmed" | "reminder_sent" | "waiting_room" | "waiting_list" | "checked_in" | "active" | "in_progress" | "completed" | "cancelled" | "no_show" | "rescheduled";
|
|
506
556
|
date: number;
|
|
507
557
|
startTime: string;
|
|
508
558
|
endTime: string;
|
|
@@ -510,11 +560,22 @@ interface TiquoBooking {
|
|
|
510
560
|
timezone: string;
|
|
511
561
|
attendeeCount: number;
|
|
512
562
|
/**
|
|
513
|
-
* Service title
|
|
514
|
-
*
|
|
515
|
-
* 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.
|
|
516
565
|
*/
|
|
517
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
|
+
};
|
|
518
579
|
serviceId: string;
|
|
519
580
|
sublocationId: string;
|
|
520
581
|
customerNotes?: string;
|
|
@@ -526,7 +587,7 @@ interface TiquoBooking {
|
|
|
526
587
|
interface GetBookingsOptions {
|
|
527
588
|
limit?: number;
|
|
528
589
|
cursor?: string;
|
|
529
|
-
status?: TiquoBooking[
|
|
590
|
+
status?: TiquoBooking["status"];
|
|
530
591
|
upcoming?: boolean;
|
|
531
592
|
}
|
|
532
593
|
interface GetBookingsResult {
|
|
@@ -541,27 +602,27 @@ interface TiquoEnquiry {
|
|
|
541
602
|
subject: string;
|
|
542
603
|
message: string;
|
|
543
604
|
category: string;
|
|
544
|
-
status:
|
|
545
|
-
priority:
|
|
546
|
-
source:
|
|
605
|
+
status: "new" | "in_progress" | "waiting_customer" | "waiting_internal" | "won" | "lost" | "closed" | "resolved" | "archived";
|
|
606
|
+
priority: "low" | "medium" | "high" | "urgent";
|
|
607
|
+
source: "online" | "website" | "phone" | "email" | "walk_in" | "social" | "referral" | "pos" | "admin";
|
|
547
608
|
responseCount: number;
|
|
548
609
|
createdAt: string;
|
|
549
610
|
updatedAt: string;
|
|
550
611
|
firstResponseAt?: string;
|
|
551
612
|
resolvedAt?: string;
|
|
552
|
-
customerRole:
|
|
613
|
+
customerRole: "primary" | "attendee" | "billing" | "referrer" | "other";
|
|
553
614
|
}
|
|
554
615
|
interface GetEnquiriesOptions {
|
|
555
616
|
limit?: number;
|
|
556
617
|
cursor?: string;
|
|
557
|
-
status?: TiquoEnquiry[
|
|
618
|
+
status?: TiquoEnquiry["status"];
|
|
558
619
|
}
|
|
559
620
|
interface GetEnquiriesResult {
|
|
560
621
|
enquiries: TiquoEnquiry[];
|
|
561
622
|
hasMore: boolean;
|
|
562
623
|
nextCursor?: string;
|
|
563
624
|
}
|
|
564
|
-
type TiquoCompanyRelationship =
|
|
625
|
+
type TiquoCompanyRelationship = "employee" | "contractor" | "manager" | "executive" | "owner" | "contact" | "other";
|
|
565
626
|
/**
|
|
566
627
|
* The authenticated customer's membership in a company. Each company the
|
|
567
628
|
* customer belongs to has its own membership record — a customer can be
|
|
@@ -599,9 +660,9 @@ interface TiquoCompany {
|
|
|
599
660
|
postalCode?: string;
|
|
600
661
|
country?: string;
|
|
601
662
|
industry?: string;
|
|
602
|
-
companySize?:
|
|
603
|
-
status:
|
|
604
|
-
type?:
|
|
663
|
+
companySize?: "1-10" | "11-50" | "51-200" | "201-500" | "501-1000" | "1000+";
|
|
664
|
+
status: "active" | "inactive" | "archived";
|
|
665
|
+
type?: "client" | "prospect" | "vendor" | "partner" | "other";
|
|
605
666
|
membership: TiquoCompanyMembership;
|
|
606
667
|
}
|
|
607
668
|
interface GetCompaniesResult {
|
|
@@ -652,6 +713,7 @@ declare class TiquoAuth {
|
|
|
652
713
|
private visibilityHandler;
|
|
653
714
|
private iframeObserver;
|
|
654
715
|
private injectedIframes;
|
|
716
|
+
analytics: TiquoAnalytics | null;
|
|
655
717
|
private broadcastChannel;
|
|
656
718
|
private tabId;
|
|
657
719
|
private isProcessingTabSync;
|
|
@@ -721,6 +783,13 @@ declare class TiquoAuth {
|
|
|
721
783
|
* first.
|
|
722
784
|
*/
|
|
723
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>;
|
|
724
793
|
/**
|
|
725
794
|
* Convenience wrapper around `getBookings({ upcoming: true })` for the
|
|
726
795
|
* common "show me my upcoming bookings" case. Results are sorted
|
|
@@ -731,7 +800,7 @@ declare class TiquoAuth {
|
|
|
731
800
|
* future, since they're effectively history. Use `getBookings()` without
|
|
732
801
|
* `upcoming: true` if you need those.
|
|
733
802
|
*/
|
|
734
|
-
getUpcomingBookings(options?: Omit<GetBookingsOptions,
|
|
803
|
+
getUpcomingBookings(options?: Omit<GetBookingsOptions, "upcoming">): Promise<GetBookingsResult>;
|
|
735
804
|
/**
|
|
736
805
|
* Get a printable receipt for a single order owned by the authenticated
|
|
737
806
|
* customer. Only resolves for orders that are paid (full or partial),
|
|
@@ -941,4 +1010,4 @@ declare class TiquoPhone {
|
|
|
941
1010
|
static buildPhone: typeof buildPhone;
|
|
942
1011
|
}
|
|
943
1012
|
|
|
944
|
-
export { type AuthStateChangeCallback, type CountryPhoneInfo, type GetBookingsOptions, type GetBookingsResult, type GetCompaniesResult, type GetCompanyColleaguesResult, type GetEnquiriesOptions, type GetEnquiriesResult, type GetOrdersOptions, type GetOrdersResult, type IframeTokenResult, type PhoneValidationResult, type ProfilePhotoUploadResult, type ProfileUpdateData, type ProfileUpdateResult, type SendOTPResult, TiquoAuth, type TiquoAuthConfig, TiquoAuthError, type TiquoBooking, TiquoCMS, type TiquoCMSBlock, type TiquoCMSConfig, type TiquoCMSPage, type TiquoCMSPageRequest, type TiquoCompany, type TiquoCompanyColleague, type TiquoCompanyMembership, type TiquoCompanyRelationship, type TiquoCustomer, type TiquoCustomerEmail, type TiquoCustomerPhone, type TiquoEnquiry, type TiquoOrder, type TiquoOrderItem, TiquoPhone, type TiquoReceipt, type TiquoReceiptBusiness, type TiquoReceiptCustomer, type TiquoReceiptItem, type TiquoReceiptOrder, type TiquoSession, type TiquoUser, type VerifyOTPResult, addCustomerUserId, clearCachedEmail, TiquoAuth as default, getCustomerUserIds, getPrefilledEmailFromCookie, isDashboardSession, trackCustomerPresence, useTiquoAuth };
|
|
1013
|
+
export { type AuthStateChangeCallback, type CountryPhoneInfo, type GetBookingsOptions, type GetBookingsResult, type GetCompaniesResult, type GetCompanyColleaguesResult, type GetEnquiriesOptions, type GetEnquiriesResult, type GetOrdersOptions, type GetOrdersResult, type IframeTokenResult, type PhoneValidationResult, type ProfilePhotoUploadResult, type ProfileUpdateData, type ProfileUpdateResult, type SendOTPResult, TiquoAnalytics, type TiquoAnalyticsConfig, type TiquoAnalyticsEventOptions, TiquoAuth, type TiquoAuthConfig, TiquoAuthError, type TiquoBooking, TiquoCMS, type TiquoCMSBlock, type TiquoCMSConfig, type TiquoCMSPage, type TiquoCMSPageRequest, type TiquoCompany, type TiquoCompanyColleague, type TiquoCompanyMembership, type TiquoCompanyRelationship, type TiquoCustomer, type TiquoCustomerEmail, type TiquoCustomerPhone, type TiquoEnquiry, type TiquoOrder, type TiquoOrderItem, TiquoPhone, type TiquoReceipt, type TiquoReceiptBusiness, type TiquoReceiptCustomer, type TiquoReceiptItem, type TiquoReceiptOrder, type TiquoSession, type TiquoUser, type VerifyOTPResult, addCustomerUserId, clearCachedEmail, TiquoAuth as default, getCustomerUserIds, getPrefilledEmailFromCookie, isDashboardSession, trackCustomerPresence, useTiquoAuth };
|