@voyantjs/customer-portal-react 0.2.0

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 (46) hide show
  1. package/dist/client.d.ts +16 -0
  2. package/dist/client.d.ts.map +1 -0
  3. package/dist/client.js +78 -0
  4. package/dist/hooks/index.d.ts +8 -0
  5. package/dist/hooks/index.d.ts.map +1 -0
  6. package/dist/hooks/index.js +7 -0
  7. package/dist/hooks/use-customer-portal-booking-documents.d.ts +13 -0
  8. package/dist/hooks/use-customer-portal-booking-documents.d.ts.map +1 -0
  9. package/dist/hooks/use-customer-portal-booking-documents.js +12 -0
  10. package/dist/hooks/use-customer-portal-booking.d.ts +63 -0
  11. package/dist/hooks/use-customer-portal-booking.d.ts.map +1 -0
  12. package/dist/hooks/use-customer-portal-booking.js +12 -0
  13. package/dist/hooks/use-customer-portal-bookings.d.ts +20 -0
  14. package/dist/hooks/use-customer-portal-bookings.d.ts.map +1 -0
  15. package/dist/hooks/use-customer-portal-bookings.js +12 -0
  16. package/dist/hooks/use-customer-portal-companions.d.ts +17 -0
  17. package/dist/hooks/use-customer-portal-companions.d.ts.map +1 -0
  18. package/dist/hooks/use-customer-portal-companions.js +12 -0
  19. package/dist/hooks/use-customer-portal-contact-exists.d.ts +12 -0
  20. package/dist/hooks/use-customer-portal-contact-exists.d.ts.map +1 -0
  21. package/dist/hooks/use-customer-portal-contact-exists.js +12 -0
  22. package/dist/hooks/use-customer-portal-mutation.d.ts +167 -0
  23. package/dist/hooks/use-customer-portal-mutation.d.ts.map +1 -0
  24. package/dist/hooks/use-customer-portal-mutation.js +54 -0
  25. package/dist/hooks/use-customer-portal-profile.d.ts +36 -0
  26. package/dist/hooks/use-customer-portal-profile.d.ts.map +1 -0
  27. package/dist/hooks/use-customer-portal-profile.js +12 -0
  28. package/dist/index.d.ts +9 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +7 -0
  31. package/dist/operations.d.ts +253 -0
  32. package/dist/operations.d.ts.map +1 -0
  33. package/dist/operations.js +50 -0
  34. package/dist/provider.d.ts +2 -0
  35. package/dist/provider.d.ts.map +1 -0
  36. package/dist/provider.js +1 -0
  37. package/dist/query-keys.d.ts +14 -0
  38. package/dist/query-keys.d.ts.map +1 -0
  39. package/dist/query-keys.js +10 -0
  40. package/dist/query-options.d.ts +576 -0
  41. package/dist/query-options.d.ts.map +1 -0
  42. package/dist/query-options.js +40 -0
  43. package/dist/schemas.d.ts +321 -0
  44. package/dist/schemas.d.ts.map +1 -0
  45. package/dist/schemas.js +14 -0
  46. package/package.json +84 -0
@@ -0,0 +1,253 @@
1
+ import { type FetchWithValidationOptions } from "./client.js";
2
+ import { type BootstrapCustomerPortalInput, type CreateCustomerPortalCompanionInput, type UpdateCustomerPortalCompanionInput, type UpdateCustomerPortalProfileInput } from "./schemas.js";
3
+ export declare function getCustomerPortalContactExists(client: FetchWithValidationOptions, email: string): Promise<{
4
+ data: {
5
+ email: string;
6
+ authAccountExists: boolean;
7
+ customerRecordExists: boolean;
8
+ linkedCustomerRecordExists: boolean;
9
+ };
10
+ }>;
11
+ export declare function getCustomerPortalProfile(client: FetchWithValidationOptions): Promise<{
12
+ data: {
13
+ userId: string;
14
+ email: string;
15
+ emailVerified: boolean;
16
+ firstName: string | null;
17
+ lastName: string | null;
18
+ avatarUrl: string | null;
19
+ locale: string;
20
+ timezone: string | null;
21
+ seatingPreference: "aisle" | "window" | "middle" | "no_preference" | null;
22
+ marketingConsent: boolean;
23
+ marketingConsentAt: string | null;
24
+ notificationDefaults: Record<string, unknown> | null;
25
+ uiPrefs: Record<string, unknown> | null;
26
+ customerRecord: {
27
+ id: string;
28
+ firstName: string;
29
+ lastName: string;
30
+ preferredLanguage: string | null;
31
+ preferredCurrency: string | null;
32
+ birthday: string | null;
33
+ email: string | null;
34
+ phone: string | null;
35
+ address: string | null;
36
+ city: string | null;
37
+ country: string | null;
38
+ relation: string | null;
39
+ status: string;
40
+ } | null;
41
+ };
42
+ }>;
43
+ export declare function updateCustomerPortalProfile(client: FetchWithValidationOptions, input: UpdateCustomerPortalProfileInput): Promise<{
44
+ data: {
45
+ userId: string;
46
+ email: string;
47
+ emailVerified: boolean;
48
+ firstName: string | null;
49
+ lastName: string | null;
50
+ avatarUrl: string | null;
51
+ locale: string;
52
+ timezone: string | null;
53
+ seatingPreference: "aisle" | "window" | "middle" | "no_preference" | null;
54
+ marketingConsent: boolean;
55
+ marketingConsentAt: string | null;
56
+ notificationDefaults: Record<string, unknown> | null;
57
+ uiPrefs: Record<string, unknown> | null;
58
+ customerRecord: {
59
+ id: string;
60
+ firstName: string;
61
+ lastName: string;
62
+ preferredLanguage: string | null;
63
+ preferredCurrency: string | null;
64
+ birthday: string | null;
65
+ email: string | null;
66
+ phone: string | null;
67
+ address: string | null;
68
+ city: string | null;
69
+ country: string | null;
70
+ relation: string | null;
71
+ status: string;
72
+ } | null;
73
+ };
74
+ }>;
75
+ export declare function bootstrapCustomerPortal(client: FetchWithValidationOptions, input: BootstrapCustomerPortalInput): Promise<{
76
+ data: {
77
+ status: "already_linked" | "linked_existing_customer" | "created_customer" | "customer_selection_required";
78
+ profile: {
79
+ userId: string;
80
+ email: string;
81
+ emailVerified: boolean;
82
+ firstName: string | null;
83
+ lastName: string | null;
84
+ avatarUrl: string | null;
85
+ locale: string;
86
+ timezone: string | null;
87
+ seatingPreference: "aisle" | "window" | "middle" | "no_preference" | null;
88
+ marketingConsent: boolean;
89
+ marketingConsentAt: string | null;
90
+ notificationDefaults: Record<string, unknown> | null;
91
+ uiPrefs: Record<string, unknown> | null;
92
+ customerRecord: {
93
+ id: string;
94
+ firstName: string;
95
+ lastName: string;
96
+ preferredLanguage: string | null;
97
+ preferredCurrency: string | null;
98
+ birthday: string | null;
99
+ email: string | null;
100
+ phone: string | null;
101
+ address: string | null;
102
+ city: string | null;
103
+ country: string | null;
104
+ relation: string | null;
105
+ status: string;
106
+ } | null;
107
+ } | null;
108
+ candidates: {
109
+ id: string;
110
+ firstName: string;
111
+ lastName: string;
112
+ preferredLanguage: string | null;
113
+ preferredCurrency: string | null;
114
+ birthday: string | null;
115
+ email: string | null;
116
+ phone: string | null;
117
+ address: string | null;
118
+ city: string | null;
119
+ country: string | null;
120
+ relation: string | null;
121
+ status: string;
122
+ linkable: boolean;
123
+ claimedByAnotherUser: boolean;
124
+ }[];
125
+ };
126
+ }>;
127
+ export declare function listCustomerPortalCompanions(client: FetchWithValidationOptions): Promise<{
128
+ data: {
129
+ id: string;
130
+ role: string;
131
+ name: string;
132
+ title: string | null;
133
+ email: string | null;
134
+ phone: string | null;
135
+ isPrimary: boolean;
136
+ notes: string | null;
137
+ metadata: Record<string, unknown> | null;
138
+ }[];
139
+ }>;
140
+ export declare function createCustomerPortalCompanion(client: FetchWithValidationOptions, input: CreateCustomerPortalCompanionInput): Promise<{
141
+ data: {
142
+ id: string;
143
+ role: string;
144
+ name: string;
145
+ title: string | null;
146
+ email: string | null;
147
+ phone: string | null;
148
+ isPrimary: boolean;
149
+ notes: string | null;
150
+ metadata: Record<string, unknown> | null;
151
+ };
152
+ }>;
153
+ export declare function updateCustomerPortalCompanion(client: FetchWithValidationOptions, companionId: string, input: UpdateCustomerPortalCompanionInput): Promise<{
154
+ data: {
155
+ id: string;
156
+ role: string;
157
+ name: string;
158
+ title: string | null;
159
+ email: string | null;
160
+ phone: string | null;
161
+ isPrimary: boolean;
162
+ notes: string | null;
163
+ metadata: Record<string, unknown> | null;
164
+ };
165
+ }>;
166
+ export declare function deleteCustomerPortalCompanion(client: FetchWithValidationOptions, companionId: string): Promise<{
167
+ success: boolean;
168
+ }>;
169
+ export declare function listCustomerPortalBookings(client: FetchWithValidationOptions): Promise<{
170
+ data: {
171
+ bookingId: string;
172
+ bookingNumber: string;
173
+ status: "draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled";
174
+ sellCurrency: string;
175
+ sellAmountCents: number | null;
176
+ startDate: string | null;
177
+ endDate: string | null;
178
+ pax: number | null;
179
+ confirmedAt: string | null;
180
+ completedAt: string | null;
181
+ participantCount: number;
182
+ primaryTravelerName: string | null;
183
+ }[];
184
+ }>;
185
+ export declare function getCustomerPortalBooking(client: FetchWithValidationOptions, bookingId: string): Promise<{
186
+ data: {
187
+ bookingId: string;
188
+ bookingNumber: string;
189
+ status: "draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled";
190
+ sellCurrency: string;
191
+ sellAmountCents: number | null;
192
+ startDate: string | null;
193
+ endDate: string | null;
194
+ pax: number | null;
195
+ confirmedAt: string | null;
196
+ cancelledAt: string | null;
197
+ completedAt: string | null;
198
+ participants: {
199
+ id: string;
200
+ participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
201
+ firstName: string;
202
+ lastName: string;
203
+ isPrimary: boolean;
204
+ }[];
205
+ items: {
206
+ id: string;
207
+ title: string;
208
+ description: string | null;
209
+ itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
210
+ status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
211
+ serviceDate: string | null;
212
+ startsAt: string | null;
213
+ endsAt: string | null;
214
+ quantity: number;
215
+ sellCurrency: string;
216
+ unitSellAmountCents: number | null;
217
+ totalSellAmountCents: number | null;
218
+ notes: string | null;
219
+ participantLinks: {
220
+ id: string;
221
+ participantId: string;
222
+ role: "other" | "traveler" | "occupant" | "primary_contact" | "service_assignee" | "beneficiary";
223
+ isPrimary: boolean;
224
+ }[];
225
+ }[];
226
+ documents: {
227
+ id: string;
228
+ participantId: string | null;
229
+ type: "visa" | "insurance" | "health" | "passport_copy" | "other";
230
+ fileName: string;
231
+ fileUrl: string;
232
+ }[];
233
+ fulfillments: {
234
+ id: string;
235
+ bookingItemId: string | null;
236
+ participantId: string | null;
237
+ fulfillmentType: "other" | "voucher" | "ticket" | "pdf" | "qr_code" | "barcode" | "mobile";
238
+ deliveryChannel: "other" | "download" | "email" | "api" | "wallet";
239
+ status: "pending" | "issued" | "reissued" | "revoked" | "failed";
240
+ artifactUrl: string | null;
241
+ }[];
242
+ };
243
+ }>;
244
+ export declare function listCustomerPortalBookingDocuments(client: FetchWithValidationOptions, bookingId: string): Promise<{
245
+ data: {
246
+ id: string;
247
+ participantId: string | null;
248
+ type: "visa" | "insurance" | "health" | "passport_copy" | "other";
249
+ fileName: string;
250
+ fileUrl: string;
251
+ }[];
252
+ }>;
253
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EAUvC,KAAK,kCAAkC,EACvC,KAAK,gCAAgC,EACtC,MAAM,cAAc,CAAA;AAErB,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM;;;;;;;GAM/F;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM1E;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAWxC;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAWpC;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;GAM9E;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,kCAAkC;;;;;;;;;;;;GAW1C;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,0BAA0B,EAClC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,kCAAkC;;;;;;;;;;;;GAW1C;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,0BAA0B,EAClC,WAAW,EAAE,MAAM;;GAUpB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;;GAM5E;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM7F;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,MAAM;;;;;;;;GAOlB"}
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { fetchWithValidation, withQueryParams } from "./client.js";
3
+ import { customerPortalBookingDocumentsResponseSchema, customerPortalBookingResponseSchema, customerPortalBookingsResponseSchema, customerPortalBootstrapResponseSchema, customerPortalCompanionResponseSchema, customerPortalCompanionsResponseSchema, customerPortalContactExistsResponseSchema, customerPortalProfileResponseSchema, successEnvelope, } from "./schemas.js";
4
+ export function getCustomerPortalContactExists(client, email) {
5
+ return fetchWithValidation(withQueryParams("/v1/customer-portal/contact-exists", { email }), customerPortalContactExistsResponseSchema, client);
6
+ }
7
+ export function getCustomerPortalProfile(client) {
8
+ return fetchWithValidation("/v1/public/customer-portal/me", customerPortalProfileResponseSchema, client);
9
+ }
10
+ export function updateCustomerPortalProfile(client, input) {
11
+ return fetchWithValidation("/v1/public/customer-portal/me", customerPortalProfileResponseSchema, client, {
12
+ method: "PATCH",
13
+ body: JSON.stringify(input),
14
+ });
15
+ }
16
+ export function bootstrapCustomerPortal(client, input) {
17
+ return fetchWithValidation("/v1/public/customer-portal/bootstrap", customerPortalBootstrapResponseSchema, client, {
18
+ method: "POST",
19
+ body: JSON.stringify(input),
20
+ });
21
+ }
22
+ export function listCustomerPortalCompanions(client) {
23
+ return fetchWithValidation("/v1/public/customer-portal/companions", customerPortalCompanionsResponseSchema, client);
24
+ }
25
+ export function createCustomerPortalCompanion(client, input) {
26
+ return fetchWithValidation("/v1/public/customer-portal/companions", customerPortalCompanionResponseSchema, client, {
27
+ method: "POST",
28
+ body: JSON.stringify(input),
29
+ });
30
+ }
31
+ export function updateCustomerPortalCompanion(client, companionId, input) {
32
+ return fetchWithValidation(`/v1/public/customer-portal/companions/${companionId}`, customerPortalCompanionResponseSchema, client, {
33
+ method: "PATCH",
34
+ body: JSON.stringify(input),
35
+ });
36
+ }
37
+ export function deleteCustomerPortalCompanion(client, companionId) {
38
+ return fetchWithValidation(`/v1/public/customer-portal/companions/${companionId}`, successEnvelope, client, {
39
+ method: "DELETE",
40
+ });
41
+ }
42
+ export function listCustomerPortalBookings(client) {
43
+ return fetchWithValidation("/v1/public/customer-portal/bookings", customerPortalBookingsResponseSchema, client);
44
+ }
45
+ export function getCustomerPortalBooking(client, bookingId) {
46
+ return fetchWithValidation(`/v1/public/customer-portal/bookings/${bookingId}`, customerPortalBookingResponseSchema, client);
47
+ }
48
+ export function listCustomerPortalBookingDocuments(client, bookingId) {
49
+ return fetchWithValidation(`/v1/public/customer-portal/bookings/${bookingId}/documents`, customerPortalBookingDocumentsResponseSchema, client);
50
+ }
@@ -0,0 +1,2 @@
1
+ export { useVoyantReactContext as useVoyantCustomerPortalContext, type VoyantReactContextValue as VoyantCustomerPortalContextValue, VoyantReactProvider as VoyantCustomerPortalProvider, type VoyantReactProviderProps as VoyantCustomerPortalProviderProps, } from "@voyantjs/react";
2
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,8BAA8B,EACvD,KAAK,uBAAuB,IAAI,gCAAgC,EAChE,mBAAmB,IAAI,4BAA4B,EACnD,KAAK,wBAAwB,IAAI,iCAAiC,GACnE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1 @@
1
+ export { useVoyantReactContext as useVoyantCustomerPortalContext, VoyantReactProvider as VoyantCustomerPortalProvider, } from "@voyantjs/react";
@@ -0,0 +1,14 @@
1
+ export interface CustomerPortalContactExistsFilters {
2
+ email: string;
3
+ }
4
+ export declare const customerPortalQueryKeys: {
5
+ all: readonly ["customer-portal"];
6
+ profile: () => readonly ["customer-portal", "profile"];
7
+ companions: () => readonly ["customer-portal", "companions"];
8
+ bookings: () => readonly ["customer-portal", "bookings"];
9
+ booking: (bookingId: string) => readonly ["customer-portal", "bookings", string];
10
+ bookingDocuments: (bookingId: string) => readonly ["customer-portal", "bookings", string, "documents"];
11
+ contactExists: () => readonly ["customer-portal", "contact-exists"];
12
+ contactExistsLookup: (filters: CustomerPortalContactExistsFilters) => readonly ["customer-portal", "contact-exists", CustomerPortalContactExistsFilters];
13
+ };
14
+ //# sourceMappingURL=query-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kCAAkC;IACjD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,uBAAuB;;;;;yBAKb,MAAM;kCACG,MAAM;;mCAGL,kCAAkC;CAElE,CAAA"}
@@ -0,0 +1,10 @@
1
+ export const customerPortalQueryKeys = {
2
+ all: ["customer-portal"],
3
+ profile: () => [...customerPortalQueryKeys.all, "profile"],
4
+ companions: () => [...customerPortalQueryKeys.all, "companions"],
5
+ bookings: () => [...customerPortalQueryKeys.all, "bookings"],
6
+ booking: (bookingId) => [...customerPortalQueryKeys.bookings(), bookingId],
7
+ bookingDocuments: (bookingId) => [...customerPortalQueryKeys.booking(bookingId), "documents"],
8
+ contactExists: () => [...customerPortalQueryKeys.all, "contact-exists"],
9
+ contactExistsLookup: (filters) => [...customerPortalQueryKeys.contactExists(), filters],
10
+ };