@voyant-travel/bookings-react 0.201.1 → 0.203.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 (76) hide show
  1. package/README.md +8 -8
  2. package/dist/admin/bookings-host.d.ts +1 -2
  3. package/dist/admin/bookings-host.js +2 -3
  4. package/dist/admin/index.d.ts +6 -44
  5. package/dist/admin/index.js +2 -65
  6. package/dist/components/booking-create-utils.d.ts +1 -1
  7. package/dist/components/booking-create-utils.js +5 -17
  8. package/dist/components/booking-dialog.d.ts +4 -19
  9. package/dist/components/booking-dialog.js +3 -12
  10. package/dist/components/booking-list.d.ts +1 -2
  11. package/dist/components/booking-list.js +5 -13
  12. package/dist/components/bookings-page.d.ts +1 -2
  13. package/dist/components/bookings-page.js +2 -2
  14. package/dist/hooks/booking-create-types.d.ts +34 -0
  15. package/dist/hooks/booking-create-types.js +1 -0
  16. package/dist/hooks/index.d.ts +2 -4
  17. package/dist/hooks/index.js +1 -4
  18. package/dist/hooks/use-booking-mutation.d.ts +3 -65
  19. package/dist/hooks/use-booking-mutation.js +1 -10
  20. package/dist/i18n/en-create-list.d.ts +0 -1
  21. package/dist/i18n/en-create-list.js +0 -1
  22. package/dist/i18n/en.d.ts +0 -1
  23. package/dist/i18n/messages-create-list.d.ts +0 -1
  24. package/dist/i18n/provider.d.ts +0 -2
  25. package/dist/i18n/ro-create-list.d.ts +0 -1
  26. package/dist/i18n/ro-create-list.js +0 -1
  27. package/dist/i18n/ro.d.ts +0 -1
  28. package/dist/journey/components/booking-journey-rules.d.ts +0 -22
  29. package/dist/journey/components/booking-journey-rules.js +0 -54
  30. package/dist/journey/components/journey-steps/payment-step.js +1 -1
  31. package/dist/journey/components/journey-steps/shared.d.ts +3 -3
  32. package/dist/journey/components/journey-steps.d.ts +1 -1
  33. package/dist/journey/components/journey-steps.js +1 -1
  34. package/dist/journey/index.d.ts +2 -12
  35. package/dist/journey/index.js +1 -11
  36. package/dist/journey/types.d.ts +3 -208
  37. package/dist/journey/types.js +2 -6
  38. package/dist/storefront/index.d.ts +0 -2
  39. package/dist/storefront/index.js +0 -2
  40. package/dist/ui.d.ts +0 -2
  41. package/dist/ui.js +0 -2
  42. package/package.json +33 -33
  43. package/dist/admin/booking-journey-host.d.ts +0 -23
  44. package/dist/admin/booking-journey-host.js +0 -280
  45. package/dist/admin/journey-billing-duplicate-warning.d.ts +0 -2
  46. package/dist/admin/journey-billing-duplicate-warning.js +0 -26
  47. package/dist/admin/journey-departure-picker.d.ts +0 -6
  48. package/dist/admin/journey-departure-picker.js +0 -91
  49. package/dist/admin/journey-travel-credit-picker.d.ts +0 -2
  50. package/dist/admin/journey-travel-credit-picker.js +0 -72
  51. package/dist/admin/journey-units-picker.d.ts +0 -10
  52. package/dist/admin/journey-units-picker.js +0 -60
  53. package/dist/admin/pages/booking-journey-page.d.ts +0 -11
  54. package/dist/admin/pages/booking-journey-page.js +0 -26
  55. package/dist/admin/pages/booking-new-page.d.ts +0 -15
  56. package/dist/admin/pages/booking-new-page.js +0 -50
  57. package/dist/components/booking-create-page.d.ts +0 -13
  58. package/dist/components/booking-create-page.js +0 -11
  59. package/dist/components/booking-create-sheet.d.ts +0 -34
  60. package/dist/components/booking-create-sheet.js +0 -815
  61. package/dist/hooks/use-booking-convert-mutation.d.ts +0 -80
  62. package/dist/hooks/use-booking-convert-mutation.js +0 -24
  63. package/dist/hooks/use-booking-create-mutation.d.ts +0 -336
  64. package/dist/hooks/use-booking-create-mutation.js +0 -43
  65. package/dist/hooks/use-booking-dual-create-mutation.d.ts +0 -337
  66. package/dist/hooks/use-booking-dual-create-mutation.js +0 -45
  67. package/dist/journey/components/booking-journey.d.ts +0 -2
  68. package/dist/journey/components/booking-journey.js +0 -485
  69. package/dist/storefront/storefront-booking-errors.d.ts +0 -12
  70. package/dist/storefront/storefront-booking-errors.js +0 -50
  71. package/dist/storefront/storefront-booking-journey.d.ts +0 -71
  72. package/dist/storefront/storefront-booking-journey.js +0 -327
  73. package/dist/storefront/storefront-booking-page.d.ts +0 -35
  74. package/dist/storefront/storefront-booking-page.js +0 -215
  75. package/dist/storefront/storefront-checkout-bodies.d.ts +0 -36
  76. package/dist/storefront/storefront-checkout-bodies.js +0 -69
@@ -1,337 +0,0 @@
1
- import { z } from "zod";
2
- import type { BookingCreateInput } from "./use-booking-create-mutation.js";
3
- /**
4
- * Sub-booking payload for dual-create. Same shape as createBooking input
5
- * minus `groupMembership` — the dual endpoint manages the group itself.
6
- */
7
- export type DualCreateSubBookingInput = Omit<BookingCreateInput, "groupMembership">;
8
- export interface DualCreateGroupInput {
9
- kind?: "shared_room" | "other";
10
- label?: string | null;
11
- /**
12
- * option_unit the shared group occupies. The dual flow lives-or-dies on
13
- * matching this across both bookings — when set, both sub-bookings should
14
- * target the same optionUnitId in their travelers/allocations.
15
- */
16
- optionUnitId?: string | null;
17
- }
18
- export interface DualCreateBookingInput {
19
- primary: DualCreateSubBookingInput;
20
- secondary: DualCreateSubBookingInput;
21
- group?: DualCreateGroupInput;
22
- }
23
- declare const dualCreateResultSchema: z.ZodObject<{
24
- primary: z.ZodObject<{
25
- booking: z.ZodObject<{
26
- id: z.ZodString;
27
- bookingNumber: z.ZodString;
28
- status: z.ZodEnum<{
29
- draft: "draft";
30
- expired: "expired";
31
- cancelled: "cancelled";
32
- on_hold: "on_hold";
33
- awaiting_payment: "awaiting_payment";
34
- confirmed: "confirmed";
35
- in_progress: "in_progress";
36
- completed: "completed";
37
- }>;
38
- personId: z.ZodNullable<z.ZodString>;
39
- organizationId: z.ZodNullable<z.ZodString>;
40
- sellCurrency: z.ZodString;
41
- sellAmountCents: z.ZodNullable<z.ZodNumber>;
42
- costAmountCents: z.ZodNullable<z.ZodNumber>;
43
- marginPercent: z.ZodNullable<z.ZodNumber>;
44
- startDate: z.ZodNullable<z.ZodString>;
45
- endDate: z.ZodNullable<z.ZodString>;
46
- startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
- endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
- pax: z.ZodNullable<z.ZodNumber>;
49
- items: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
- id: z.ZodString;
51
- title: z.ZodString;
52
- itemType: z.ZodString;
53
- productId: z.ZodNullable<z.ZodString>;
54
- productName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
- startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
- endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
- }, z.core.$strip>>>;
58
- internalNotes: z.ZodNullable<z.ZodString>;
59
- communicationLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
- contactFirstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
- contactLastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
- contactPartyType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
63
- individual: "individual";
64
- company: "company";
65
- }>>>;
66
- contactTaxId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
- contactEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
- contactPhone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
- contactPreferredLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
- contactCountry: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
- contactRegion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
- contactCity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
- contactAddressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
- contactAddressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
- contactPostalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
- customerPaymentPolicy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
77
- deposit: z.ZodObject<{
78
- kind: z.ZodEnum<{
79
- none: "none";
80
- percent: "percent";
81
- fixed_cents: "fixed_cents";
82
- }>;
83
- percent: z.ZodOptional<z.ZodNumber>;
84
- amountCents: z.ZodOptional<z.ZodNumber>;
85
- }, z.core.$strip>;
86
- minDaysBeforeDepartureForDeposit: z.ZodNumber;
87
- balanceDueDaysBeforeDeparture: z.ZodNumber;
88
- balanceDueMinDaysFromNow: z.ZodNumber;
89
- }, z.core.$strip>>>;
90
- priceOverride: z.ZodOptional<z.ZodNullable<z.ZodObject<{
91
- isManual: z.ZodLiteral<true>;
92
- originalAmountCents: z.ZodNullable<z.ZodNumber>;
93
- overriddenAmountCents: z.ZodNumber;
94
- currency: z.ZodString;
95
- reason: z.ZodString;
96
- overriddenBy: z.ZodString;
97
- overriddenAt: z.ZodString;
98
- }, z.core.$strip>>>;
99
- createdAt: z.ZodString;
100
- updatedAt: z.ZodString;
101
- }, z.core.$strip>;
102
- travelers: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
103
- paymentSchedules: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
104
- travelCreditRedemption: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
105
- }, z.core.$strip>;
106
- secondary: z.ZodObject<{
107
- booking: z.ZodObject<{
108
- id: z.ZodString;
109
- bookingNumber: z.ZodString;
110
- status: z.ZodEnum<{
111
- draft: "draft";
112
- expired: "expired";
113
- cancelled: "cancelled";
114
- on_hold: "on_hold";
115
- awaiting_payment: "awaiting_payment";
116
- confirmed: "confirmed";
117
- in_progress: "in_progress";
118
- completed: "completed";
119
- }>;
120
- personId: z.ZodNullable<z.ZodString>;
121
- organizationId: z.ZodNullable<z.ZodString>;
122
- sellCurrency: z.ZodString;
123
- sellAmountCents: z.ZodNullable<z.ZodNumber>;
124
- costAmountCents: z.ZodNullable<z.ZodNumber>;
125
- marginPercent: z.ZodNullable<z.ZodNumber>;
126
- startDate: z.ZodNullable<z.ZodString>;
127
- endDate: z.ZodNullable<z.ZodString>;
128
- startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
- endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
- pax: z.ZodNullable<z.ZodNumber>;
131
- items: z.ZodOptional<z.ZodArray<z.ZodObject<{
132
- id: z.ZodString;
133
- title: z.ZodString;
134
- itemType: z.ZodString;
135
- productId: z.ZodNullable<z.ZodString>;
136
- productName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
137
- startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
- endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
- }, z.core.$strip>>>;
140
- internalNotes: z.ZodNullable<z.ZodString>;
141
- communicationLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
- contactFirstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
- contactLastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
- contactPartyType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
145
- individual: "individual";
146
- company: "company";
147
- }>>>;
148
- contactTaxId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
- contactEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
150
- contactPhone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
151
- contactPreferredLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
- contactCountry: z.ZodOptional<z.ZodNullable<z.ZodString>>;
153
- contactRegion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
154
- contactCity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
155
- contactAddressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
156
- contactAddressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
157
- contactPostalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
158
- customerPaymentPolicy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
159
- deposit: z.ZodObject<{
160
- kind: z.ZodEnum<{
161
- none: "none";
162
- percent: "percent";
163
- fixed_cents: "fixed_cents";
164
- }>;
165
- percent: z.ZodOptional<z.ZodNumber>;
166
- amountCents: z.ZodOptional<z.ZodNumber>;
167
- }, z.core.$strip>;
168
- minDaysBeforeDepartureForDeposit: z.ZodNumber;
169
- balanceDueDaysBeforeDeparture: z.ZodNumber;
170
- balanceDueMinDaysFromNow: z.ZodNumber;
171
- }, z.core.$strip>>>;
172
- priceOverride: z.ZodOptional<z.ZodNullable<z.ZodObject<{
173
- isManual: z.ZodLiteral<true>;
174
- originalAmountCents: z.ZodNullable<z.ZodNumber>;
175
- overriddenAmountCents: z.ZodNumber;
176
- currency: z.ZodString;
177
- reason: z.ZodString;
178
- overriddenBy: z.ZodString;
179
- overriddenAt: z.ZodString;
180
- }, z.core.$strip>>>;
181
- createdAt: z.ZodString;
182
- updatedAt: z.ZodString;
183
- }, z.core.$strip>;
184
- travelers: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
185
- paymentSchedules: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
186
- travelCreditRedemption: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
187
- }, z.core.$strip>;
188
- group: z.ZodUnknown;
189
- primaryMember: z.ZodUnknown;
190
- secondaryMember: z.ZodUnknown;
191
- }, z.core.$strip>;
192
- export type DualCreateBookingResult = z.infer<typeof dualCreateResultSchema>;
193
- /**
194
- * Atomic dual-booking (partaj) create: calls `POST /v1/admin/bookings/dual-create`
195
- * which wraps two createBooking calls + one booking_group in a single
196
- * transaction. Use this over calling useBookingCreateMutation twice
197
- * from a submit handler — a failure on the second call there would leave
198
- * the first booking orphaned.
199
- */
200
- export declare function useBookingDualCreateMutation(): import("@tanstack/react-query").UseMutationResult<{
201
- primary: {
202
- booking: {
203
- id: string;
204
- bookingNumber: string;
205
- status: "draft" | "expired" | "cancelled" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress" | "completed";
206
- personId: string | null;
207
- organizationId: string | null;
208
- sellCurrency: string;
209
- sellAmountCents: number | null;
210
- costAmountCents: number | null;
211
- marginPercent: number | null;
212
- startDate: string | null;
213
- endDate: string | null;
214
- pax: number | null;
215
- internalNotes: string | null;
216
- createdAt: string;
217
- updatedAt: string;
218
- startsAt?: string | null | undefined;
219
- endsAt?: string | null | undefined;
220
- items?: {
221
- id: string;
222
- title: string;
223
- itemType: string;
224
- productId: string | null;
225
- productName?: string | null | undefined;
226
- startsAt?: string | null | undefined;
227
- endsAt?: string | null | undefined;
228
- }[] | undefined;
229
- communicationLanguage?: string | null | undefined;
230
- contactFirstName?: string | null | undefined;
231
- contactLastName?: string | null | undefined;
232
- contactPartyType?: "individual" | "company" | null | undefined;
233
- contactTaxId?: string | null | undefined;
234
- contactEmail?: string | null | undefined;
235
- contactPhone?: string | null | undefined;
236
- contactPreferredLanguage?: string | null | undefined;
237
- contactCountry?: string | null | undefined;
238
- contactRegion?: string | null | undefined;
239
- contactCity?: string | null | undefined;
240
- contactAddressLine1?: string | null | undefined;
241
- contactAddressLine2?: string | null | undefined;
242
- contactPostalCode?: string | null | undefined;
243
- customerPaymentPolicy?: {
244
- deposit: {
245
- kind: "none" | "percent" | "fixed_cents";
246
- percent?: number | undefined;
247
- amountCents?: number | undefined;
248
- };
249
- minDaysBeforeDepartureForDeposit: number;
250
- balanceDueDaysBeforeDeparture: number;
251
- balanceDueMinDaysFromNow: number;
252
- } | null | undefined;
253
- priceOverride?: {
254
- isManual: true;
255
- originalAmountCents: number | null;
256
- overriddenAmountCents: number;
257
- currency: string;
258
- reason: string;
259
- overriddenBy: string;
260
- overriddenAt: string;
261
- } | null | undefined;
262
- };
263
- travelers?: unknown[] | undefined;
264
- paymentSchedules?: unknown[] | undefined;
265
- travelCreditRedemption?: unknown;
266
- };
267
- secondary: {
268
- booking: {
269
- id: string;
270
- bookingNumber: string;
271
- status: "draft" | "expired" | "cancelled" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress" | "completed";
272
- personId: string | null;
273
- organizationId: string | null;
274
- sellCurrency: string;
275
- sellAmountCents: number | null;
276
- costAmountCents: number | null;
277
- marginPercent: number | null;
278
- startDate: string | null;
279
- endDate: string | null;
280
- pax: number | null;
281
- internalNotes: string | null;
282
- createdAt: string;
283
- updatedAt: string;
284
- startsAt?: string | null | undefined;
285
- endsAt?: string | null | undefined;
286
- items?: {
287
- id: string;
288
- title: string;
289
- itemType: string;
290
- productId: string | null;
291
- productName?: string | null | undefined;
292
- startsAt?: string | null | undefined;
293
- endsAt?: string | null | undefined;
294
- }[] | undefined;
295
- communicationLanguage?: string | null | undefined;
296
- contactFirstName?: string | null | undefined;
297
- contactLastName?: string | null | undefined;
298
- contactPartyType?: "individual" | "company" | null | undefined;
299
- contactTaxId?: string | null | undefined;
300
- contactEmail?: string | null | undefined;
301
- contactPhone?: string | null | undefined;
302
- contactPreferredLanguage?: string | null | undefined;
303
- contactCountry?: string | null | undefined;
304
- contactRegion?: string | null | undefined;
305
- contactCity?: string | null | undefined;
306
- contactAddressLine1?: string | null | undefined;
307
- contactAddressLine2?: string | null | undefined;
308
- contactPostalCode?: string | null | undefined;
309
- customerPaymentPolicy?: {
310
- deposit: {
311
- kind: "none" | "percent" | "fixed_cents";
312
- percent?: number | undefined;
313
- amountCents?: number | undefined;
314
- };
315
- minDaysBeforeDepartureForDeposit: number;
316
- balanceDueDaysBeforeDeparture: number;
317
- balanceDueMinDaysFromNow: number;
318
- } | null | undefined;
319
- priceOverride?: {
320
- isManual: true;
321
- originalAmountCents: number | null;
322
- overriddenAmountCents: number;
323
- currency: string;
324
- reason: string;
325
- overriddenBy: string;
326
- overriddenAt: string;
327
- } | null | undefined;
328
- };
329
- travelers?: unknown[] | undefined;
330
- paymentSchedules?: unknown[] | undefined;
331
- travelCreditRedemption?: unknown;
332
- };
333
- group: unknown;
334
- primaryMember: unknown;
335
- secondaryMember: unknown;
336
- }, Error, DualCreateBookingInput, unknown>;
337
- export {};
@@ -1,45 +0,0 @@
1
- "use client";
2
- import { useMutation, useQueryClient } from "@tanstack/react-query";
3
- import { z } from "zod";
4
- import { fetchWithValidation } from "../client.js";
5
- import { useVoyantBookingsContext } from "../provider.js";
6
- import { bookingsQueryKeys } from "../query-keys.js";
7
- import { bookingRecordSchema } from "../schemas.js";
8
- const dualCreateResultSchema = z.object({
9
- primary: z.object({
10
- booking: bookingRecordSchema,
11
- travelers: z.array(z.unknown()).optional(),
12
- paymentSchedules: z.array(z.unknown()).optional(),
13
- travelCreditRedemption: z.unknown().nullable().optional(),
14
- }),
15
- secondary: z.object({
16
- booking: bookingRecordSchema,
17
- travelers: z.array(z.unknown()).optional(),
18
- paymentSchedules: z.array(z.unknown()).optional(),
19
- travelCreditRedemption: z.unknown().nullable().optional(),
20
- }),
21
- group: z.unknown(),
22
- primaryMember: z.unknown(),
23
- secondaryMember: z.unknown(),
24
- });
25
- const dualCreateResponseSchema = z.object({ data: dualCreateResultSchema });
26
- /**
27
- * Atomic dual-booking (partaj) create: calls `POST /v1/admin/bookings/dual-create`
28
- * which wraps two createBooking calls + one booking_group in a single
29
- * transaction. Use this over calling useBookingCreateMutation twice
30
- * from a submit handler — a failure on the second call there would leave
31
- * the first booking orphaned.
32
- */
33
- export function useBookingDualCreateMutation() {
34
- const { baseUrl, fetcher } = useVoyantBookingsContext();
35
- const queryClient = useQueryClient();
36
- return useMutation({
37
- mutationFn: async (input) => {
38
- const { data } = await fetchWithValidation("/v1/admin/bookings/dual-create", dualCreateResponseSchema, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
39
- return data;
40
- },
41
- onSuccess: () => {
42
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.bookings() });
43
- },
44
- });
45
- }
@@ -1,2 +0,0 @@
1
- import { type BookingJourneyProps } from "../types.js";
2
- export declare function BookingJourney(props: BookingJourneyProps): React.ReactElement;