@voyant-travel/bookings-react 0.138.6 → 0.138.8

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 (51) hide show
  1. package/dist/admin/booking-journey-host.js +1 -1
  2. package/dist/components/booking-create-form-utils.d.ts +1 -0
  3. package/dist/components/booking-create-form-utils.d.ts.map +1 -1
  4. package/dist/components/booking-create-form-utils.js +4 -0
  5. package/dist/components/booking-create-sheet.d.ts.map +1 -1
  6. package/dist/components/booking-create-sheet.js +5 -1
  7. package/dist/hooks/use-booking.d.ts +93 -8
  8. package/dist/hooks/use-booking.d.ts.map +1 -1
  9. package/dist/hooks/use-public-booking-session-flow-mutation.d.ts +1 -1
  10. package/dist/hooks/use-public-booking-session.d.ts +1 -1
  11. package/dist/i18n/en-create-list.d.ts +1 -0
  12. package/dist/i18n/en-create-list.d.ts.map +1 -1
  13. package/dist/i18n/en-create-list.js +1 -0
  14. package/dist/i18n/en-journey.d.ts +1 -0
  15. package/dist/i18n/en-journey.d.ts.map +1 -1
  16. package/dist/i18n/en-journey.js +2 -1
  17. package/dist/i18n/en.d.ts +2 -0
  18. package/dist/i18n/en.d.ts.map +1 -1
  19. package/dist/i18n/messages-create-list.d.ts +1 -0
  20. package/dist/i18n/messages-create-list.d.ts.map +1 -1
  21. package/dist/i18n/messages-journey.d.ts +1 -0
  22. package/dist/i18n/messages-journey.d.ts.map +1 -1
  23. package/dist/i18n/provider.d.ts +4 -0
  24. package/dist/i18n/provider.d.ts.map +1 -1
  25. package/dist/i18n/ro-create-list.d.ts +1 -0
  26. package/dist/i18n/ro-create-list.d.ts.map +1 -1
  27. package/dist/i18n/ro-create-list.js +1 -0
  28. package/dist/i18n/ro-journey.d.ts +1 -0
  29. package/dist/i18n/ro-journey.d.ts.map +1 -1
  30. package/dist/i18n/ro-journey.js +2 -1
  31. package/dist/i18n/ro.d.ts +2 -0
  32. package/dist/i18n/ro.d.ts.map +1 -1
  33. package/dist/journey/components/booking-journey-rules.d.ts.map +1 -1
  34. package/dist/journey/components/booking-journey-rules.js +17 -3
  35. package/dist/journey/components/booking-journey.d.ts.map +1 -1
  36. package/dist/journey/components/booking-journey.js +6 -1
  37. package/dist/journey/components/journey-steps/billing-step.js +2 -2
  38. package/dist/journey/components/side-panel.js +1 -1
  39. package/dist/journey/lib/draft-state.d.ts +1 -0
  40. package/dist/journey/lib/draft-state.d.ts.map +1 -1
  41. package/dist/journey/lib/draft-state.js +14 -0
  42. package/dist/journey/lib/payment-schedule.d.ts +1 -0
  43. package/dist/journey/lib/payment-schedule.d.ts.map +1 -1
  44. package/dist/journey/lib/payment-schedule.js +32 -13
  45. package/dist/query-options.d.ts +376 -36
  46. package/dist/query-options.d.ts.map +1 -1
  47. package/dist/query-options.js +2 -2
  48. package/dist/schemas.d.ts +397 -0
  49. package/dist/schemas.d.ts.map +1 -1
  50. package/dist/schemas.js +27 -0
  51. package/package.json +11 -11
@@ -6,6 +6,7 @@ import { Button } from "@voyant-travel/ui/components/button";
6
6
  import { useEffect, useMemo, useRef, useState } from "react";
7
7
  import { useBookingsUiMessagesOrDefault } from "../../i18n/index.js";
8
8
  import { emptyDraft, totalPax } from "../lib/draft-state.js";
9
+ import { findPaidScheduleRowsMissingPaymentDate } from "../lib/payment-schedule.js";
9
10
  import { JOURNEY_STEP_ORDER, } from "../types.js";
10
11
  import { buildCommitParty, canAdvanceFromStep, defaultMinimalShape, isStepVisible, makeHoldSignature, resolveInitialStatus, stackedStepComplete, warningsForStep, } from "./booking-journey-rules.js";
11
12
  import { ConfigureStepSkeleton } from "./configure-step-skeleton.js";
@@ -329,6 +330,10 @@ export function BookingJourney(props) {
329
330
  : messages.bookingJourney.validation.quoteUnavailable);
330
331
  return;
331
332
  }
333
+ if (findPaidScheduleRowsMissingPaymentDate(draft.paymentSchedules) !== null) {
334
+ setConfirmError(messages.bookingJourney.validation.paidPaymentDateRequired);
335
+ return;
336
+ }
332
337
  setConfirmError(null);
333
338
  // 1. Contract is wired → open the dialog. Acceptance triggers
334
339
  // onContractAccepted (the storefront's checkout-start path).
@@ -356,7 +361,7 @@ export function BookingJourney(props) {
356
361
  ? () => props.renderBillingExtras?.({
357
362
  buyerType: draft.billing.buyerType,
358
363
  personId: draft.billing.contact.personId,
359
- organizationId: draft.billing.organizationId,
364
+ organizationId: draft.billing.buyerType === "B2B" ? draft.billing.organizationId : undefined,
360
365
  productId: props.entityId,
361
366
  departureSlotId: draft.configure.departureSlotId,
362
367
  departureDate: draft.configure.departureDate,
@@ -6,7 +6,7 @@ import { CountryCombobox } from "@voyant-travel/ui/components/country-combobox";
6
6
  import { Label } from "@voyant-travel/ui/components/label";
7
7
  import { RadioGroup, RadioGroupItem } from "@voyant-travel/ui/components/radio-group";
8
8
  import { useBookingsUiMessagesOrDefault } from "../../../i18n/index.js";
9
- import { patchBilling } from "../../lib/draft-state.js";
9
+ import { patchBilling, setBillingBuyerType } from "../../lib/draft-state.js";
10
10
  import { Field, JourneyWarnings, PhoneField } from "./shared.js";
11
11
  // ─────────────────────────────────────────────────────────────────
12
12
  // Billing
@@ -46,7 +46,7 @@ export function BillingStep({ draft, setDraft, renderLeadContactPicker, renderEx
46
46
  }
47
47
  setDraft(patchBilling(draft, patch));
48
48
  };
49
- return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.bookingJourney.billing.title }) }), _jsx(Separator, {}), _jsxs(CardContent, { className: "space-y-6", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: messages.bookingJourney.billing.buyerType }), _jsxs(RadioGroup, { value: billing.buyerType, onValueChange: (v) => setDraft(patchBilling(draft, { buyerType: v })), className: "flex gap-4", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2C" }), " ", messages.bookingJourney.billing.individual] }), _jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2B" }), " ", messages.bookingJourney.billing.company] })] })] }), renderLeadContactPicker ? (_jsx("div", { children: renderLeadContactPicker({ apply, buyerType: billing.buyerType }) })) : null, renderLeadContactPicker ? null : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [_jsx(Field, { id: "bj-billing-firstName", label: messages.bookingJourney.billing.firstName, value: billing.contact.firstName, onChange: (v) => setDraft(patchBilling(draft, {
49
+ return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.bookingJourney.billing.title }) }), _jsx(Separator, {}), _jsxs(CardContent, { className: "space-y-6", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: messages.bookingJourney.billing.buyerType }), _jsxs(RadioGroup, { value: billing.buyerType, onValueChange: (v) => setDraft(setBillingBuyerType(draft, v)), className: "flex gap-4", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2C" }), " ", messages.bookingJourney.billing.individual] }), _jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2B" }), " ", messages.bookingJourney.billing.company] })] })] }), renderLeadContactPicker ? (_jsx("div", { children: renderLeadContactPicker({ apply, buyerType: billing.buyerType }) })) : null, renderLeadContactPicker ? null : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [_jsx(Field, { id: "bj-billing-firstName", label: messages.bookingJourney.billing.firstName, value: billing.contact.firstName, onChange: (v) => setDraft(patchBilling(draft, {
50
50
  contact: { ...billing.contact, firstName: v },
51
51
  })) }), _jsx(Field, { id: "bj-billing-lastName", label: messages.bookingJourney.billing.lastName, value: billing.contact.lastName, onChange: (v) => setDraft(patchBilling(draft, {
52
52
  contact: { ...billing.contact, lastName: v },
@@ -164,7 +164,7 @@ function BillingDetails({ draft, }) {
164
164
  return (_jsxs("dl", { className: "space-y-1 text-xs", children: [_jsx(Row, { label: messages.bookingJourney.sidePanel.name, value: [c.firstName, c.lastName].filter(Boolean).join(" ") ||
165
165
  messages.bookingJourney.values.noValue }), _jsx(Row, { label: messages.bookingJourney.sidePanel.email, value: c.email || messages.bookingJourney.values.noValue }), c.phone ? _jsx(Row, { label: messages.bookingJourney.sidePanel.phone, value: c.phone }) : null, _jsx(Row, { label: messages.bookingJourney.sidePanel.buyer, value: draft.billing.buyerType === "B2B"
166
166
  ? messages.bookingJourney.sidePanel.company
167
- : messages.bookingJourney.sidePanel.individual }), draft.billing.company?.name ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.company, value: draft.billing.company.name })) : null, draft.billing.company?.vatId ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.vat, value: draft.billing.company.vatId })) : null, addressLine ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.address, value: addressLine })) : null] }));
167
+ : messages.bookingJourney.sidePanel.individual }), draft.billing.buyerType === "B2B" && draft.billing.company?.name ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.company, value: draft.billing.company.name })) : null, draft.billing.buyerType === "B2B" && draft.billing.company?.vatId ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.vat, value: draft.billing.company.vatId })) : null, addressLine ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.address, value: addressLine })) : null] }));
168
168
  }
169
169
  function TravelersDetails({ draft, }) {
170
170
  const messages = useBookingsUiMessagesOrDefault();
@@ -25,6 +25,7 @@ export declare function emptyDraft(entity: DraftEntityIdentity, defaults?: {
25
25
  }): Draft;
26
26
  export declare function patchConfigure(draft: Draft, patch: Partial<Draft["configure"]>): Draft;
27
27
  export declare function patchBilling(draft: Draft, patch: Partial<Draft["billing"]>): Draft;
28
+ export declare function setBillingBuyerType(draft: Draft, buyerType: "B2C" | "B2B"): Draft;
28
29
  export declare function canCopyBillingContactToTraveler(contact: Draft["billing"]["contact"]): boolean;
29
30
  export declare function patchPaxCount(draft: Draft, band: string, count: number): Draft;
30
31
  export declare function setTravelers(draft: Draft, travelers: Draft["travelers"]): Draft;
@@ -1 +1 @@
1
- {"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C,GAAG,OAAO,CAE7F;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAK9E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,KAAK,CAE/E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,KAAK,CAE3F;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,CAEtE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAEzE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAM7C"}
@@ -26,6 +26,20 @@ export function patchConfigure(draft, patch) {
26
26
  export function patchBilling(draft, patch) {
27
27
  return { ...draft, billing: { ...draft.billing, ...patch } };
28
28
  }
29
+ export function setBillingBuyerType(draft, buyerType) {
30
+ if (buyerType === "B2C") {
31
+ const { organizationId: _organizationId, company: _company, ...billing } = draft.billing;
32
+ return {
33
+ ...draft,
34
+ billing: {
35
+ ...billing,
36
+ buyerType,
37
+ address: {},
38
+ },
39
+ };
40
+ }
41
+ return patchBilling(draft, { buyerType });
42
+ }
29
43
  export function canCopyBillingContactToTraveler(contact) {
30
44
  return Boolean(contact.firstName || contact.lastName || contact.email || contact.phone);
31
45
  }
@@ -13,6 +13,7 @@ import type { Draft } from "./draft-state.js";
13
13
  type PaymentScheduleRow = NonNullable<Draft["paymentSchedules"]>[number];
14
14
  /** Editor value → draft rows. Returns `[]` when nothing is schedulable yet. */
15
15
  export declare function paymentScheduleValueToRows(value: PaymentScheduleValue, currency: string, totalAmountCents: number | null): PaymentScheduleRow[];
16
+ export declare function findPaidScheduleRowsMissingPaymentDate(rows: PaymentScheduleRow[] | undefined): number | null;
16
17
  /** Draft rows → editor value (re-init on step remount; preserves paid metadata). */
17
18
  export declare function rowsToPaymentScheduleValue(rows: PaymentScheduleRow[] | undefined, departureDate: string | null): PaymentScheduleValue;
18
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"payment-schedule.d.ts","sourceRoot":"","sources":["../../../src/journey/lib/payment-schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,8CAA8C,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,KAAK,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAmBxE,+EAA+E;AAC/E,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,EAC3B,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAC9B,kBAAkB,EAAE,CA8BtB;AAED,oFAAoF;AACpF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,kBAAkB,EAAE,GAAG,SAAS,EACtC,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,oBAAoB,CA8BtB"}
1
+ {"version":3,"file":"payment-schedule.d.ts","sourceRoot":"","sources":["../../../src/journey/lib/payment-schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,8CAA8C,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,KAAK,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAmBxE,+EAA+E;AAC/E,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,EAC3B,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAC9B,kBAAkB,EAAE,CA8BtB;AAED,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,kBAAkB,EAAE,GAAG,SAAS,GACrC,MAAM,GAAG,IAAI,CAQf;AAED,oFAAoF;AACpF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,kBAAkB,EAAE,GAAG,SAAS,EACtC,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,oBAAoB,CAwBtB"}
@@ -54,6 +54,17 @@ export function paymentScheduleValueToRows(value, currency, totalAmountCents) {
54
54
  }
55
55
  return rows;
56
56
  }
57
+ export function findPaidScheduleRowsMissingPaymentDate(rows) {
58
+ if (!rows)
59
+ return null;
60
+ const index = rows.findIndex((row) => {
61
+ const meta = parsePaidNotes(row.notes);
62
+ if (row.status !== "paid" && meta?.alreadyPaid !== true)
63
+ return false;
64
+ return !hasExplicitPaymentDate(meta);
65
+ });
66
+ return index >= 0 ? index : null;
67
+ }
57
68
  /** Draft rows → editor value (re-init on step remount; preserves paid metadata). */
58
69
  export function rowsToPaymentScheduleValue(rows, departureDate) {
59
70
  if (!rows || rows.length === 0)
@@ -63,19 +74,12 @@ export function rowsToPaymentScheduleValue(rows, departureDate) {
63
74
  let paymentDate = null;
64
75
  let paymentMethod = "bank_transfer";
65
76
  let paymentReference = "";
66
- if (row.notes) {
67
- try {
68
- const meta = JSON.parse(row.notes);
69
- if (meta.alreadyPaid) {
70
- alreadyPaid = true;
71
- paymentDate = meta.paymentDate ?? null;
72
- paymentMethod = meta.paymentMethod ?? "bank_transfer";
73
- paymentReference = meta.paymentReference ?? "";
74
- }
75
- }
76
- catch {
77
- // `notes` wasn't our JSON payload (e.g. a free-text note) — ignore.
78
- }
77
+ const meta = parsePaidNotes(row.notes);
78
+ if (meta?.alreadyPaid) {
79
+ alreadyPaid = true;
80
+ paymentDate = meta.paymentDate ?? null;
81
+ paymentMethod = meta.paymentMethod ?? "bank_transfer";
82
+ paymentReference = meta.paymentReference ?? "";
79
83
  }
80
84
  return createInstallment({
81
85
  amountCents: row.amountCents,
@@ -88,3 +92,18 @@ export function rowsToPaymentScheduleValue(rows, departureDate) {
88
92
  });
89
93
  return { mode: rows.length > 1 ? "split" : "full", installments };
90
94
  }
95
+ function parsePaidNotes(notes) {
96
+ if (!notes)
97
+ return null;
98
+ try {
99
+ const parsed = JSON.parse(notes);
100
+ return parsed && typeof parsed === "object" ? parsed : null;
101
+ }
102
+ catch {
103
+ // `notes` wasn't our JSON payload (e.g. a free-text note) — ignore.
104
+ return null;
105
+ }
106
+ }
107
+ function hasExplicitPaymentDate(meta) {
108
+ return typeof meta?.paymentDate === "string" && meta.paymentDate.trim().length > 0;
109
+ }
@@ -297,17 +297,102 @@ export declare function getBookingQueryOptions(client: FetchWithValidationOption
297
297
  internalNotes: string | null;
298
298
  createdAt: string;
299
299
  updatedAt: string;
300
- startsAt?: string | null | undefined;
301
- endsAt?: string | null | undefined;
302
- items?: {
300
+ items: {
303
301
  id: string;
302
+ bookingId: string;
304
303
  title: string;
305
- itemType: string;
304
+ description: string | null;
305
+ itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
306
+ status: "draft" | "cancelled" | "fulfilled" | "on_hold" | "confirmed" | "expired";
307
+ serviceDate: string | null;
308
+ startsAt: string | null;
309
+ endsAt: string | null;
310
+ quantity: number;
311
+ sellCurrency: string;
312
+ unitSellAmountCents: number | null;
313
+ totalSellAmountCents: number | null;
314
+ costCurrency: string | null;
315
+ unitCostAmountCents: number | null;
316
+ totalCostAmountCents: number | null;
317
+ notes: string | null;
306
318
  productId: string | null;
307
- productName?: string | null | undefined;
308
- startsAt?: string | null | undefined;
309
- endsAt?: string | null | undefined;
310
- }[] | undefined;
319
+ optionId: string | null;
320
+ optionUnitId: string | null;
321
+ pricingCategoryId: string | null;
322
+ availabilitySlotId: string | null;
323
+ createdAt: string;
324
+ updatedAt: string;
325
+ productNameSnapshot?: string | null | undefined;
326
+ optionNameSnapshot?: string | null | undefined;
327
+ unitNameSnapshot?: string | null | undefined;
328
+ departureLabelSnapshot?: string | null | undefined;
329
+ }[];
330
+ travelers: ({
331
+ id: string;
332
+ bookingId: string;
333
+ participantType: string;
334
+ firstName: string;
335
+ lastName: string;
336
+ email: string | null;
337
+ phone: string | null;
338
+ specialRequests: string | null;
339
+ isPrimary: boolean;
340
+ createdAt: string;
341
+ travelerCategory?: string | null | undefined;
342
+ personId?: string | null | undefined;
343
+ preferredLanguage?: string | null | undefined;
344
+ notes?: string | null | undefined;
345
+ updatedAt?: string | undefined;
346
+ } | {
347
+ id: string;
348
+ bookingId: string;
349
+ participantType: string;
350
+ firstName: string;
351
+ lastName: string;
352
+ email: string | null;
353
+ phone: string | null;
354
+ specialRequests: string | null;
355
+ isPrimary: boolean;
356
+ createdAt: string;
357
+ travelDetails: {
358
+ travelerId: string;
359
+ nationality: string | null;
360
+ documentType: "other" | "passport" | "id_card" | "driver_license" | "visa" | null;
361
+ documentNumber: string | null;
362
+ documentExpiry: string | null;
363
+ documentIssuingCountry: string | null;
364
+ documentIssuingAuthority: string | null;
365
+ documentPersonDocumentId: string | null;
366
+ dateOfBirth: string | null;
367
+ dietaryRequirements: string | null;
368
+ accessibilityNeeds: string | null;
369
+ isLeadTraveler: boolean;
370
+ sharingGroupId: string | null;
371
+ roomTypeId: string | null;
372
+ bedPreference: "double" | "single" | "twin" | "no-preference" | null;
373
+ allocations: Record<string, string>;
374
+ createdAt: string;
375
+ updatedAt: string;
376
+ } | null;
377
+ travelerCategory?: string | null | undefined;
378
+ personId?: string | null | undefined;
379
+ preferredLanguage?: string | null | undefined;
380
+ notes?: string | null | undefined;
381
+ updatedAt?: string | undefined;
382
+ })[];
383
+ documents: {
384
+ id: string;
385
+ bookingId: string;
386
+ travelerId: string | null;
387
+ type: "other" | "visa" | "insurance" | "health" | "passport_copy";
388
+ fileName: string;
389
+ fileUrl: string;
390
+ expiresAt: string | null;
391
+ notes: string | null;
392
+ createdAt: string;
393
+ }[];
394
+ startsAt?: string | null | undefined;
395
+ endsAt?: string | null | undefined;
311
396
  communicationLanguage?: string | null | undefined;
312
397
  contactFirstName?: string | null | undefined;
313
398
  contactLastName?: string | null | undefined;
@@ -359,17 +444,102 @@ export declare function getBookingQueryOptions(client: FetchWithValidationOption
359
444
  internalNotes: string | null;
360
445
  createdAt: string;
361
446
  updatedAt: string;
362
- startsAt?: string | null | undefined;
363
- endsAt?: string | null | undefined;
364
- items?: {
447
+ items: {
365
448
  id: string;
449
+ bookingId: string;
366
450
  title: string;
367
- itemType: string;
451
+ description: string | null;
452
+ itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
453
+ status: "draft" | "cancelled" | "fulfilled" | "on_hold" | "confirmed" | "expired";
454
+ serviceDate: string | null;
455
+ startsAt: string | null;
456
+ endsAt: string | null;
457
+ quantity: number;
458
+ sellCurrency: string;
459
+ unitSellAmountCents: number | null;
460
+ totalSellAmountCents: number | null;
461
+ costCurrency: string | null;
462
+ unitCostAmountCents: number | null;
463
+ totalCostAmountCents: number | null;
464
+ notes: string | null;
368
465
  productId: string | null;
369
- productName?: string | null | undefined;
370
- startsAt?: string | null | undefined;
371
- endsAt?: string | null | undefined;
372
- }[] | undefined;
466
+ optionId: string | null;
467
+ optionUnitId: string | null;
468
+ pricingCategoryId: string | null;
469
+ availabilitySlotId: string | null;
470
+ createdAt: string;
471
+ updatedAt: string;
472
+ productNameSnapshot?: string | null | undefined;
473
+ optionNameSnapshot?: string | null | undefined;
474
+ unitNameSnapshot?: string | null | undefined;
475
+ departureLabelSnapshot?: string | null | undefined;
476
+ }[];
477
+ travelers: ({
478
+ id: string;
479
+ bookingId: string;
480
+ participantType: string;
481
+ firstName: string;
482
+ lastName: string;
483
+ email: string | null;
484
+ phone: string | null;
485
+ specialRequests: string | null;
486
+ isPrimary: boolean;
487
+ createdAt: string;
488
+ travelerCategory?: string | null | undefined;
489
+ personId?: string | null | undefined;
490
+ preferredLanguage?: string | null | undefined;
491
+ notes?: string | null | undefined;
492
+ updatedAt?: string | undefined;
493
+ } | {
494
+ id: string;
495
+ bookingId: string;
496
+ participantType: string;
497
+ firstName: string;
498
+ lastName: string;
499
+ email: string | null;
500
+ phone: string | null;
501
+ specialRequests: string | null;
502
+ isPrimary: boolean;
503
+ createdAt: string;
504
+ travelDetails: {
505
+ travelerId: string;
506
+ nationality: string | null;
507
+ documentType: "other" | "passport" | "id_card" | "driver_license" | "visa" | null;
508
+ documentNumber: string | null;
509
+ documentExpiry: string | null;
510
+ documentIssuingCountry: string | null;
511
+ documentIssuingAuthority: string | null;
512
+ documentPersonDocumentId: string | null;
513
+ dateOfBirth: string | null;
514
+ dietaryRequirements: string | null;
515
+ accessibilityNeeds: string | null;
516
+ isLeadTraveler: boolean;
517
+ sharingGroupId: string | null;
518
+ roomTypeId: string | null;
519
+ bedPreference: "double" | "single" | "twin" | "no-preference" | null;
520
+ allocations: Record<string, string>;
521
+ createdAt: string;
522
+ updatedAt: string;
523
+ } | null;
524
+ travelerCategory?: string | null | undefined;
525
+ personId?: string | null | undefined;
526
+ preferredLanguage?: string | null | undefined;
527
+ notes?: string | null | undefined;
528
+ updatedAt?: string | undefined;
529
+ })[];
530
+ documents: {
531
+ id: string;
532
+ bookingId: string;
533
+ travelerId: string | null;
534
+ type: "other" | "visa" | "insurance" | "health" | "passport_copy";
535
+ fileName: string;
536
+ fileUrl: string;
537
+ expiresAt: string | null;
538
+ notes: string | null;
539
+ createdAt: string;
540
+ }[];
541
+ startsAt?: string | null | undefined;
542
+ endsAt?: string | null | undefined;
373
543
  communicationLanguage?: string | null | undefined;
374
544
  contactFirstName?: string | null | undefined;
375
545
  contactLastName?: string | null | undefined;
@@ -422,17 +592,102 @@ export declare function getBookingQueryOptions(client: FetchWithValidationOption
422
592
  internalNotes: string | null;
423
593
  createdAt: string;
424
594
  updatedAt: string;
425
- startsAt?: string | null | undefined;
426
- endsAt?: string | null | undefined;
427
- items?: {
595
+ items: {
428
596
  id: string;
597
+ bookingId: string;
429
598
  title: string;
430
- itemType: string;
599
+ description: string | null;
600
+ itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
601
+ status: "draft" | "cancelled" | "fulfilled" | "on_hold" | "confirmed" | "expired";
602
+ serviceDate: string | null;
603
+ startsAt: string | null;
604
+ endsAt: string | null;
605
+ quantity: number;
606
+ sellCurrency: string;
607
+ unitSellAmountCents: number | null;
608
+ totalSellAmountCents: number | null;
609
+ costCurrency: string | null;
610
+ unitCostAmountCents: number | null;
611
+ totalCostAmountCents: number | null;
612
+ notes: string | null;
431
613
  productId: string | null;
432
- productName?: string | null | undefined;
433
- startsAt?: string | null | undefined;
434
- endsAt?: string | null | undefined;
435
- }[] | undefined;
614
+ optionId: string | null;
615
+ optionUnitId: string | null;
616
+ pricingCategoryId: string | null;
617
+ availabilitySlotId: string | null;
618
+ createdAt: string;
619
+ updatedAt: string;
620
+ productNameSnapshot?: string | null | undefined;
621
+ optionNameSnapshot?: string | null | undefined;
622
+ unitNameSnapshot?: string | null | undefined;
623
+ departureLabelSnapshot?: string | null | undefined;
624
+ }[];
625
+ travelers: ({
626
+ id: string;
627
+ bookingId: string;
628
+ participantType: string;
629
+ firstName: string;
630
+ lastName: string;
631
+ email: string | null;
632
+ phone: string | null;
633
+ specialRequests: string | null;
634
+ isPrimary: boolean;
635
+ createdAt: string;
636
+ travelerCategory?: string | null | undefined;
637
+ personId?: string | null | undefined;
638
+ preferredLanguage?: string | null | undefined;
639
+ notes?: string | null | undefined;
640
+ updatedAt?: string | undefined;
641
+ } | {
642
+ id: string;
643
+ bookingId: string;
644
+ participantType: string;
645
+ firstName: string;
646
+ lastName: string;
647
+ email: string | null;
648
+ phone: string | null;
649
+ specialRequests: string | null;
650
+ isPrimary: boolean;
651
+ createdAt: string;
652
+ travelDetails: {
653
+ travelerId: string;
654
+ nationality: string | null;
655
+ documentType: "other" | "passport" | "id_card" | "driver_license" | "visa" | null;
656
+ documentNumber: string | null;
657
+ documentExpiry: string | null;
658
+ documentIssuingCountry: string | null;
659
+ documentIssuingAuthority: string | null;
660
+ documentPersonDocumentId: string | null;
661
+ dateOfBirth: string | null;
662
+ dietaryRequirements: string | null;
663
+ accessibilityNeeds: string | null;
664
+ isLeadTraveler: boolean;
665
+ sharingGroupId: string | null;
666
+ roomTypeId: string | null;
667
+ bedPreference: "double" | "single" | "twin" | "no-preference" | null;
668
+ allocations: Record<string, string>;
669
+ createdAt: string;
670
+ updatedAt: string;
671
+ } | null;
672
+ travelerCategory?: string | null | undefined;
673
+ personId?: string | null | undefined;
674
+ preferredLanguage?: string | null | undefined;
675
+ notes?: string | null | undefined;
676
+ updatedAt?: string | undefined;
677
+ })[];
678
+ documents: {
679
+ id: string;
680
+ bookingId: string;
681
+ travelerId: string | null;
682
+ type: "other" | "visa" | "insurance" | "health" | "passport_copy";
683
+ fileName: string;
684
+ fileUrl: string;
685
+ expiresAt: string | null;
686
+ notes: string | null;
687
+ createdAt: string;
688
+ }[];
689
+ startsAt?: string | null | undefined;
690
+ endsAt?: string | null | undefined;
436
691
  communicationLanguage?: string | null | undefined;
437
692
  contactFirstName?: string | null | undefined;
438
693
  contactLastName?: string | null | undefined;
@@ -487,17 +742,102 @@ export declare function getBookingQueryOptions(client: FetchWithValidationOption
487
742
  internalNotes: string | null;
488
743
  createdAt: string;
489
744
  updatedAt: string;
490
- startsAt?: string | null | undefined;
491
- endsAt?: string | null | undefined;
492
- items?: {
745
+ items: {
493
746
  id: string;
747
+ bookingId: string;
494
748
  title: string;
495
- itemType: string;
749
+ description: string | null;
750
+ itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
751
+ status: "draft" | "cancelled" | "fulfilled" | "on_hold" | "confirmed" | "expired";
752
+ serviceDate: string | null;
753
+ startsAt: string | null;
754
+ endsAt: string | null;
755
+ quantity: number;
756
+ sellCurrency: string;
757
+ unitSellAmountCents: number | null;
758
+ totalSellAmountCents: number | null;
759
+ costCurrency: string | null;
760
+ unitCostAmountCents: number | null;
761
+ totalCostAmountCents: number | null;
762
+ notes: string | null;
496
763
  productId: string | null;
497
- productName?: string | null | undefined;
498
- startsAt?: string | null | undefined;
499
- endsAt?: string | null | undefined;
500
- }[] | undefined;
764
+ optionId: string | null;
765
+ optionUnitId: string | null;
766
+ pricingCategoryId: string | null;
767
+ availabilitySlotId: string | null;
768
+ createdAt: string;
769
+ updatedAt: string;
770
+ productNameSnapshot?: string | null | undefined;
771
+ optionNameSnapshot?: string | null | undefined;
772
+ unitNameSnapshot?: string | null | undefined;
773
+ departureLabelSnapshot?: string | null | undefined;
774
+ }[];
775
+ travelers: ({
776
+ id: string;
777
+ bookingId: string;
778
+ participantType: string;
779
+ firstName: string;
780
+ lastName: string;
781
+ email: string | null;
782
+ phone: string | null;
783
+ specialRequests: string | null;
784
+ isPrimary: boolean;
785
+ createdAt: string;
786
+ travelerCategory?: string | null | undefined;
787
+ personId?: string | null | undefined;
788
+ preferredLanguage?: string | null | undefined;
789
+ notes?: string | null | undefined;
790
+ updatedAt?: string | undefined;
791
+ } | {
792
+ id: string;
793
+ bookingId: string;
794
+ participantType: string;
795
+ firstName: string;
796
+ lastName: string;
797
+ email: string | null;
798
+ phone: string | null;
799
+ specialRequests: string | null;
800
+ isPrimary: boolean;
801
+ createdAt: string;
802
+ travelDetails: {
803
+ travelerId: string;
804
+ nationality: string | null;
805
+ documentType: "other" | "passport" | "id_card" | "driver_license" | "visa" | null;
806
+ documentNumber: string | null;
807
+ documentExpiry: string | null;
808
+ documentIssuingCountry: string | null;
809
+ documentIssuingAuthority: string | null;
810
+ documentPersonDocumentId: string | null;
811
+ dateOfBirth: string | null;
812
+ dietaryRequirements: string | null;
813
+ accessibilityNeeds: string | null;
814
+ isLeadTraveler: boolean;
815
+ sharingGroupId: string | null;
816
+ roomTypeId: string | null;
817
+ bedPreference: "double" | "single" | "twin" | "no-preference" | null;
818
+ allocations: Record<string, string>;
819
+ createdAt: string;
820
+ updatedAt: string;
821
+ } | null;
822
+ travelerCategory?: string | null | undefined;
823
+ personId?: string | null | undefined;
824
+ preferredLanguage?: string | null | undefined;
825
+ notes?: string | null | undefined;
826
+ updatedAt?: string | undefined;
827
+ })[];
828
+ documents: {
829
+ id: string;
830
+ bookingId: string;
831
+ travelerId: string | null;
832
+ type: "other" | "visa" | "insurance" | "health" | "passport_copy";
833
+ fileName: string;
834
+ fileUrl: string;
835
+ expiresAt: string | null;
836
+ notes: string | null;
837
+ createdAt: string;
838
+ }[];
839
+ startsAt?: string | null | undefined;
840
+ endsAt?: string | null | undefined;
501
841
  communicationLanguage?: string | null | undefined;
502
842
  contactFirstName?: string | null | undefined;
503
843
  contactLastName?: string | null | undefined;
@@ -1399,7 +1739,7 @@ export declare function getPublicBookingSessionQueryOptions(client: FetchWithVal
1399
1739
  availabilitySlotId: string | null;
1400
1740
  quantity: number;
1401
1741
  allocationType: "resource" | "unit" | "pickup";
1402
- status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "released" | "held";
1742
+ status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "held" | "released";
1403
1743
  holdExpiresAt: string | null;
1404
1744
  confirmedAt: string | null;
1405
1745
  releasedAt: string | null;
@@ -1495,7 +1835,7 @@ export declare function getPublicBookingSessionQueryOptions(client: FetchWithVal
1495
1835
  availabilitySlotId: string | null;
1496
1836
  quantity: number;
1497
1837
  allocationType: "resource" | "unit" | "pickup";
1498
- status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "released" | "held";
1838
+ status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "held" | "released";
1499
1839
  holdExpiresAt: string | null;
1500
1840
  confirmedAt: string | null;
1501
1841
  releasedAt: string | null;
@@ -1592,7 +1932,7 @@ export declare function getPublicBookingSessionQueryOptions(client: FetchWithVal
1592
1932
  availabilitySlotId: string | null;
1593
1933
  quantity: number;
1594
1934
  allocationType: "resource" | "unit" | "pickup";
1595
- status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "released" | "held";
1935
+ status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "held" | "released";
1596
1936
  holdExpiresAt: string | null;
1597
1937
  confirmedAt: string | null;
1598
1938
  releasedAt: string | null;
@@ -1691,7 +2031,7 @@ export declare function getPublicBookingSessionQueryOptions(client: FetchWithVal
1691
2031
  availabilitySlotId: string | null;
1692
2032
  quantity: number;
1693
2033
  allocationType: "resource" | "unit" | "pickup";
1694
- status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "released" | "held";
2034
+ status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "held" | "released";
1695
2035
  holdExpiresAt: string | null;
1696
2036
  confirmedAt: string | null;
1697
2037
  releasedAt: string | null;