@voyant-travel/bookings-react 0.202.0 → 0.204.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,9 +1,9 @@
1
- export interface CreateBookingInput {
2
- bookingNumber: string;
1
+ export interface UpdateBookingInput {
2
+ bookingNumber?: string;
3
3
  status?: "draft" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled";
4
4
  personId?: string | null;
5
5
  organizationId?: string | null;
6
- sellCurrency: string;
6
+ sellCurrency?: string;
7
7
  sellAmountCents?: number | null;
8
8
  costAmountCents?: number | null;
9
9
  startDate?: string | null;
@@ -24,69 +24,7 @@ export interface CreateBookingInput {
24
24
  contactAddressLine2?: string | null;
25
25
  contactPostalCode?: string | null;
26
26
  }
27
- export type UpdateBookingInput = Partial<CreateBookingInput>;
28
27
  export declare function useBookingMutation(): {
29
- create: import("@tanstack/react-query").UseMutationResult<{
30
- id: string;
31
- bookingNumber: string;
32
- status: "draft" | "expired" | "cancelled" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress" | "completed";
33
- personId: string | null;
34
- organizationId: string | null;
35
- sellCurrency: string;
36
- sellAmountCents: number | null;
37
- costAmountCents: number | null;
38
- marginPercent: number | null;
39
- startDate: string | null;
40
- endDate: string | null;
41
- pax: number | null;
42
- internalNotes: string | null;
43
- createdAt: string;
44
- updatedAt: string;
45
- startsAt?: string | null | undefined;
46
- endsAt?: string | null | undefined;
47
- items?: {
48
- id: string;
49
- title: string;
50
- itemType: string;
51
- productId: string | null;
52
- productName?: string | null | undefined;
53
- startsAt?: string | null | undefined;
54
- endsAt?: string | null | undefined;
55
- }[] | undefined;
56
- communicationLanguage?: string | null | undefined;
57
- contactFirstName?: string | null | undefined;
58
- contactLastName?: string | null | undefined;
59
- contactPartyType?: "individual" | "company" | null | undefined;
60
- contactTaxId?: string | null | undefined;
61
- contactEmail?: string | null | undefined;
62
- contactPhone?: string | null | undefined;
63
- contactPreferredLanguage?: string | null | undefined;
64
- contactCountry?: string | null | undefined;
65
- contactRegion?: string | null | undefined;
66
- contactCity?: string | null | undefined;
67
- contactAddressLine1?: string | null | undefined;
68
- contactAddressLine2?: string | null | undefined;
69
- contactPostalCode?: string | null | undefined;
70
- customerPaymentPolicy?: {
71
- deposit: {
72
- kind: "none" | "percent" | "fixed_cents";
73
- percent?: number | undefined;
74
- amountCents?: number | undefined;
75
- };
76
- minDaysBeforeDepartureForDeposit: number;
77
- balanceDueDaysBeforeDeparture: number;
78
- balanceDueMinDaysFromNow: number;
79
- } | null | undefined;
80
- priceOverride?: {
81
- isManual: true;
82
- originalAmountCents: number | null;
83
- overriddenAmountCents: number;
84
- currency: string;
85
- reason: string;
86
- overriddenBy: string;
87
- overriddenAt: string;
88
- } | null | undefined;
89
- }, Error, CreateBookingInput, unknown>;
90
28
  update: import("@tanstack/react-query").UseMutationResult<{
91
29
  id: string;
92
30
  bookingNumber: string;
@@ -7,15 +7,6 @@ import { bookingSingleResponse, successEnvelope } from "../schemas.js";
7
7
  export function useBookingMutation() {
8
8
  const { baseUrl, fetcher } = useVoyantBookingsContext();
9
9
  const queryClient = useQueryClient();
10
- const create = useMutation({
11
- mutationFn: async (input) => {
12
- const { data } = await fetchWithValidation("/v1/admin/bookings", bookingSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
13
- return data;
14
- },
15
- onSuccess: () => {
16
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.bookings() });
17
- },
18
- });
19
10
  const update = useMutation({
20
11
  mutationFn: async ({ id, input }) => {
21
12
  const { data } = await fetchWithValidation(`/v1/admin/bookings/${id}`, bookingSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
@@ -35,5 +26,5 @@ export function useBookingMutation() {
35
26
  queryClient.removeQueries({ queryKey: bookingsQueryKeys.booking(id) });
36
27
  },
37
28
  });
38
- return { create, update, remove };
29
+ return { update, remove };
39
30
  }
@@ -165,7 +165,6 @@ export declare const bookingsUiEnCreateList: {
165
165
  };
166
166
  bookingList: {
167
167
  searchPlaceholder: string;
168
- newBooking: string;
169
168
  columns: {
170
169
  bookingNumber: string;
171
170
  whatBooked: string;
@@ -165,7 +165,6 @@ export const bookingsUiEnCreateList = {
165
165
  },
166
166
  bookingList: {
167
167
  searchPlaceholder: "Search bookings…",
168
- newBooking: "New booking",
169
168
  columns: {
170
169
  bookingNumber: "Booking #",
171
170
  whatBooked: "Items",
package/dist/i18n/en.d.ts CHANGED
@@ -165,7 +165,6 @@ export declare const bookingsUiEn: {
165
165
  };
166
166
  bookingList: {
167
167
  searchPlaceholder: string;
168
- newBooking: string;
169
168
  columns: {
170
169
  bookingNumber: string;
171
170
  whatBooked: string;
@@ -167,7 +167,6 @@ export type BookingsUiCreateListMessages = {
167
167
  };
168
168
  bookingList: {
169
169
  searchPlaceholder: string;
170
- newBooking: string;
171
170
  columns: {
172
171
  bookingNumber: string;
173
172
  whatBooked: string;
@@ -169,7 +169,6 @@ export declare const bookingsUiMessageDefinitions: {
169
169
  };
170
170
  bookingList: {
171
171
  searchPlaceholder: string;
172
- newBooking: string;
173
172
  columns: {
174
173
  bookingNumber: string;
175
174
  whatBooked: string;
@@ -1772,7 +1771,6 @@ export declare const bookingsUiMessageDefinitions: {
1772
1771
  };
1773
1772
  bookingList: {
1774
1773
  searchPlaceholder: string;
1775
- newBooking: string;
1776
1774
  columns: {
1777
1775
  bookingNumber: string;
1778
1776
  whatBooked: string;
@@ -165,7 +165,6 @@ export declare const bookingsUiRoCreateList: {
165
165
  };
166
166
  bookingList: {
167
167
  searchPlaceholder: string;
168
- newBooking: string;
169
168
  columns: {
170
169
  bookingNumber: string;
171
170
  whatBooked: string;
@@ -165,7 +165,6 @@ export const bookingsUiRoCreateList = {
165
165
  },
166
166
  bookingList: {
167
167
  searchPlaceholder: "Cauta rezervari…",
168
- newBooking: "Rezervare noua",
169
168
  columns: {
170
169
  bookingNumber: "Rezervare #",
171
170
  whatBooked: "Articole",
package/dist/i18n/ro.d.ts CHANGED
@@ -165,7 +165,6 @@ export declare const bookingsUiRo: {
165
165
  };
166
166
  bookingList: {
167
167
  searchPlaceholder: string;
168
- newBooking: string;
169
168
  columns: {
170
169
  bookingNumber: string;
171
170
  whatBooked: string;
@@ -2,28 +2,6 @@ import { type BookingDraftShape } from "@voyant-travel/catalog-contracts/booking
2
2
  import { type BookingsUiMessages } from "../../i18n/index.js";
3
3
  import { type Draft } from "../lib/draft-state.js";
4
4
  import type { JourneyStep } from "../types.js";
5
- /**
6
- * The buyer + travelers the owned commit reads off `request.party` (the draft
7
- * carries them but `extractBillingParty` only inspects `party`). B2C supplies
8
- * `personId`; B2B supplies `organizationId`; traveler person links thread
9
- * through so the booking attaches to the right CRM records.
10
- */
11
- export declare function buildCommitParty(draft: Draft): Record<string, unknown>;
12
- /**
13
- * Initial booking status from the operator's choices: an explicit "save as
14
- * draft", else live — confirmed when the payment is fully marked paid,
15
- * otherwise awaiting payment.
16
- */
17
- export declare function resolveInitialStatus(draft: Draft): "draft" | "confirmed" | "awaiting_payment";
18
- /**
19
- * The packaged admin journey's in-process commit route can only create a held
20
- * booking. Other payment intents need a dedicated checkout/provider flow
21
- * because the route contract requires fields the generic draft does not carry
22
- * (`tokenizedCard`, `agencyAccount`, bank-transfer instructions, etc.).
23
- */
24
- export declare function buildCommitPaymentIntent(draft: Draft): {
25
- type: "hold";
26
- };
27
5
  export declare function isStepVisible(step: JourneyStep, shape: BookingDraftShape): boolean;
28
6
  export declare function canAdvanceFromStep(step: JourneyStep, draft: Draft, shape: BookingDraftShape, _available: boolean): boolean;
29
7
  export declare function validationErrorsForStep(step: JourneyStep, draft: Draft, messages: BookingsUiMessages): ReadonlyArray<string>;
@@ -4,60 +4,6 @@ import { totalPax } from "../lib/draft-state.js";
4
4
  import { isValidOptionalEmail } from "../lib/email-validation.js";
5
5
  import { evaluatePaxBandDependencies } from "../lib/pax-band-dependencies.js";
6
6
  import { findPaidScheduleRowsMissingPaymentDate } from "../lib/payment-schedule.js";
7
- /**
8
- * The buyer + travelers the owned commit reads off `request.party` (the draft
9
- * carries them but `extractBillingParty` only inspects `party`). B2C supplies
10
- * `personId`; B2B supplies `organizationId`; traveler person links thread
11
- * through so the booking attaches to the right CRM records.
12
- */
13
- export function buildCommitParty(draft) {
14
- const c = draft.billing.contact;
15
- const companyName = draft.billing.company?.name?.trim();
16
- const contactFirstName = draft.billing.buyerType === "B2B" && companyName ? companyName : c.firstName;
17
- const contactLastName = draft.billing.buyerType === "B2B" && contactFirstName === companyName ? "" : c.lastName;
18
- const personId = draft.billing.buyerType === "B2B" ? undefined : c.personId;
19
- const organizationId = draft.billing.buyerType === "B2B" ? draft.billing.organizationId : undefined;
20
- return {
21
- personId,
22
- organizationId,
23
- billing: {
24
- personId,
25
- organizationId,
26
- contact: {
27
- firstName: contactFirstName,
28
- lastName: contactLastName,
29
- email: draft.billing.buyerType === "B2B" && companyName ? "" : c.email,
30
- phone: draft.billing.buyerType === "B2B" && companyName ? undefined : c.phone,
31
- },
32
- },
33
- travelerParty: {
34
- travelers: draft.travelers.map((t) => ({ personId: t.personId })),
35
- },
36
- };
37
- }
38
- /**
39
- * Initial booking status from the operator's choices: an explicit "save as
40
- * draft", else live — confirmed when the payment is fully marked paid,
41
- * otherwise awaiting payment.
42
- */
43
- export function resolveInitialStatus(draft) {
44
- if (draft.saveAsDraft)
45
- return "draft";
46
- const schedules = draft.paymentSchedules ?? [];
47
- const fullyPaid = schedules.length > 0 && schedules.every((s) => s.status === "paid");
48
- return fullyPaid ? "confirmed" : "awaiting_payment";
49
- }
50
- /**
51
- * The packaged admin journey's in-process commit route can only create a held
52
- * booking. Other payment intents need a dedicated checkout/provider flow
53
- * because the route contract requires fields the generic draft does not carry
54
- * (`tokenizedCard`, `agencyAccount`, bank-transfer instructions, etc.).
55
- */
56
- export function buildCommitPaymentIntent(draft) {
57
- if (draft.payment.intent === "hold")
58
- return { type: "hold" };
59
- throw new Error(`Unsupported booking payment intent: ${draft.payment.intent}`);
60
- }
61
7
  export function isStepVisible(step, shape) {
62
8
  const subSteps = shape.configureSubSteps ?? [];
63
9
  switch (step) {
@@ -35,7 +35,7 @@ export function PaymentStep({ draft, setDraft, shape, capabilities, renderProvid
35
35
  // Snap the draft's intent to a sensible value when the current pick isn't on
36
36
  // the list — covers descriptor changes mid-flow (e.g. owned→sourced narrows
37
37
  // the list). In checkbox mode the baseline is always "hold". This MUST run in
38
- // an effect, not during render: `setDraft` updates the parent BookingJourney,
38
+ // an effect, not during render: `setDraft` updates the parent draft owner,
39
39
  // and calling it in the render body triggers React's "Cannot update a
40
40
  // component while rendering a different component" warning (and drops frames).
41
41
  const allowedKey = allowed.join("|");
@@ -6,9 +6,9 @@ import type { BookingDraftShape } from "@voyant-travel/catalog-contracts/booking
6
6
  import { useBookingsUiMessagesOrDefault } from "../../../i18n/index.js";
7
7
  import type { Draft } from "../../lib/draft-state.js";
8
8
  import type { DeparturePickerProps, UnitsPickerProps } from "../../types.js";
9
- /** Injectable departure-picker render slot, threaded from BookingJourneyProps. */
9
+ /** Injectable departure-picker render slot for composed draft surfaces. */
10
10
  export type RenderDeparturePicker = (props: DeparturePickerProps) => React.ReactNode;
11
- /** Injectable units (rooms) render slot, threaded from BookingJourneyProps. */
11
+ /** Injectable units (rooms) render slot for composed draft surfaces. */
12
12
  export type RenderUnitsPicker = (props: UnitsPickerProps) => React.ReactNode;
13
13
  export interface StepCommonProps {
14
14
  draft: Draft;
@@ -16,7 +16,7 @@ export interface StepCommonProps {
16
16
  shape: BookingDraftShape;
17
17
  /**
18
18
  * Default country (ISO 3166-1 alpha-2) for the step's phone inputs, already
19
- * resolved by `BookingJourney` from its `defaultPhoneCountry` prop or the
19
+ * resolved by the draft surface from its configured default or the
20
20
  * scope locale. When omitted the `PhoneField` derives one from the active
21
21
  * i18n locale before falling back to GB.
22
22
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Step components rendered inside `<BookingJourney />`. Each takes a
2
+ * Reusable booking-draft step components. Each takes a
3
3
  * draft + setDraft pair plus the active descriptor; updates flow up
4
4
  * via setDraft and the shell re-quotes on the next debounce tick.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Step components rendered inside `<BookingJourney />`. Each takes a
2
+ * Reusable booking-draft step components. Each takes a
3
3
  * draft + setDraft pair plus the active descriptor; updates flow up
4
4
  * via setDraft and the shell re-quotes on the next debounce tick.
5
5
  *
@@ -1,17 +1,7 @@
1
- /**
2
- * `@voyant-travel/bookings-react/journey` — the unified booking journey shell.
3
- *
4
- * Per `docs/architecture/booking-journey-architecture.md`.
5
- *
6
- * Single shell, slot-injected. Operator and storefront consume the
7
- * same `<BookingJourney />` and inject surface-specific behavior
8
- * (CRM picker, payment provider widget, B2B vs B2C defaults, post-
9
- * commit handoff) via render-prop slots.
10
- */
11
- export { BookingJourney } from "./components/booking-journey.js";
1
+ /** Shared booking-draft primitives retained for trip composition. */
12
2
  export { type ContractAcceptance, ContractPreviewDialog, type ContractPreviewDialogProps, } from "./components/contract-preview-dialog.js";
13
3
  export { AccommodationStep, AddonsStep, BillingStep, DepartureStep, OptionsStep, PaymentStep, ReviewStep, TravelersStep, } from "./components/journey-steps.js";
14
4
  export { PriceSidePanel } from "./components/side-panel.js";
15
5
  export { StepHeader } from "./components/step-header.js";
16
6
  export { type Draft, emptyDraft, patchBilling, patchConfigure, patchPaxCount, setAccommodation, setAddons, setPayment, setTravelers, totalPax, } from "./lib/draft-state.js";
17
- export { type BillingExtrasContext, type BookingEntitySummary, type BookingJourneyCheckoutContext, type BookingJourneyProps, type BookingJourneyTransitionGuard, type BookingJourneyTransitionGuardContext, type BookingJourneyTransitionGuardResult, type ContractAcceptanceEvent, type DeparturePickerProps, JOURNEY_STEP_ORDER, type JourneyHeaderState, type JourneyOptionSelection, type JourneyStep, type JourneySurface, type LeadContactPickerProps, type PaymentProviderCapabilities, type PaymentProviderStepRenderProps, type SidePanelState, type TravelCreditPickerProps, type TravelerContactPickerProps, type UnitsPickerProps, } from "./types.js";
7
+ export { type BillingExtrasContext, type BookingEntitySummary, type DeparturePickerProps, JOURNEY_STEP_ORDER, type JourneyHeaderState, type JourneyOptionSelection, type JourneyStep, type JourneySurface, type LeadContactPickerProps, type PaymentProviderCapabilities, type PaymentProviderStepRenderProps, type SidePanelState, type TravelCreditPickerProps, type TravelerContactPickerProps, type UnitsPickerProps, } from "./types.js";
@@ -1,14 +1,4 @@
1
- /**
2
- * `@voyant-travel/bookings-react/journey` — the unified booking journey shell.
3
- *
4
- * Per `docs/architecture/booking-journey-architecture.md`.
5
- *
6
- * Single shell, slot-injected. Operator and storefront consume the
7
- * same `<BookingJourney />` and inject surface-specific behavior
8
- * (CRM picker, payment provider widget, B2B vs B2C defaults, post-
9
- * commit handoff) via render-prop slots.
10
- */
11
- export { BookingJourney } from "./components/booking-journey.js";
1
+ /** Shared booking-draft primitives retained for trip composition. */
12
2
  export { ContractPreviewDialog, } from "./components/contract-preview-dialog.js";
13
3
  export { AccommodationStep, AddonsStep, BillingStep, DepartureStep, OptionsStep, PaymentStep, ReviewStep, TravelersStep, } from "./components/journey-steps.js";
14
4
  export { PriceSidePanel } from "./components/side-panel.js";
@@ -1,14 +1,9 @@
1
1
  /**
2
- * Shell-side types for `<BookingJourney />`. These complement the
3
- * engine contracts in `@voyant-travel/catalog-contracts/booking-engine/contracts`
4
- * with React-specific slots and event shapes that don't belong on
5
- * the wire.
6
- *
7
- * Per booking-journey-architecture §8.1.
2
+ * React-side draft and step types that complement the booking-engine wire
3
+ * contracts.
8
4
  */
9
- import type { BookingDraftV1, BookResponseV1, PricingBreakdownV1 } from "@voyant-travel/catalog-contracts/booking-engine/contracts";
5
+ import type { BookingDraftV1, PricingBreakdownV1 } from "@voyant-travel/catalog-contracts/booking-engine/contracts";
10
6
  import type { BookingDraftShape } from "@voyant-travel/catalog-contracts/booking-engine/draft-shape";
11
- import type { ReactNode } from "react";
12
7
  export type JourneyStep = "departure" | "billing" | "travelers" | "options" | "accommodation" | "addons" | "payment" | "documents" | "review";
13
8
  export declare const JOURNEY_STEP_ORDER: ReadonlyArray<JourneyStep>;
14
9
  export interface JourneySurface {
@@ -179,206 +174,6 @@ export interface PaymentProviderStepRenderProps {
179
174
  schedule: BookingDraftV1["payment"]["schedule"];
180
175
  capabilities: PaymentProviderCapabilities;
181
176
  }
182
- export type BookingJourneyTransitionGuardResult = undefined | boolean | {
183
- allow: boolean;
184
- message?: string;
185
- draft?: BookingDraftV1;
186
- };
187
- export interface BookingJourneyTransitionGuardContext {
188
- currentStep: JourneyStep;
189
- nextStep: JourneyStep;
190
- draft: BookingDraftV1;
191
- pricing: PricingBreakdownV1 | null;
192
- quoteId?: string;
193
- surface: "admin" | "public";
194
- }
195
- export type BookingJourneyTransitionGuard = (context: BookingJourneyTransitionGuardContext) => BookingJourneyTransitionGuardResult | Promise<BookingJourneyTransitionGuardResult>;
196
- export interface BookingJourneyProps {
197
- /** What to book. */
198
- entityModule: string;
199
- entityId: string;
200
- /**
201
- * Source pointer fields. Optional on the public surface — the
202
- * engine resolves provenance server-side from
203
- * `(entityModule, entityId)` via the catalog plane's
204
- * sourced-entry lookup. Operator surfaces should still pass
205
- * `sourceKind` explicitly when known.
206
- */
207
- sourceKind?: string;
208
- sourceConnectionId?: string;
209
- sourceRef?: string;
210
- /** Surface — drives audience defaults and slot wiring. */
211
- surface?: "admin" | "public";
212
- /**
213
- * Pricing/content scope forwarded to the live quote — the selected market
214
- * (catalog-search scope key), currency, locale, and audience. When omitted
215
- * the quote falls back to per-surface defaults. Storefronts thread the
216
- * shopper's selected market/currency here so checkout prices in the same
217
- * scope as browse/detail.
218
- */
219
- scope?: {
220
- locale?: string;
221
- audience?: "staff" | "customer" | "partner" | "supplier";
222
- market?: string;
223
- currency?: string;
224
- };
225
- /**
226
- * Default country (ISO 3166-1 alpha-2, e.g. `"RO"`, `"GB"`) for the
227
- * journey's phone inputs. Deployments should thread this from their
228
- * market/storefront settings so the phone country matches the shopper's
229
- * market instead of always defaulting to the UK. When omitted, the journey
230
- * derives a country from the active locale's region subtag (e.g. `"ro-RO"`
231
- * -> `"RO"`) and falls back to `"GB"` only as a last resort.
232
- */
233
- defaultPhoneCountry?: string;
234
- /**
235
- * Layout of the booking flow.
236
- * - `"wizard"` — one step at a time with Back/Next (the guided
237
- * storefront flow).
238
- * - `"stacked"` — every section rendered as a block on a single
239
- * scrollable page, nothing hidden (the operator flow — an admin
240
- * can see travelers while editing options, and jump around freely).
241
- * Defaults to `"stacked"` on the admin surface and `"wizard"` on
242
- * public, keeping the two processes deliberately separate. */
243
- layout?: "wizard" | "stacked";
244
- /** Stable draft id — caller persists in URL or session storage so
245
- * the journey survives page refresh. */
246
- draftId: string;
247
- /** Default buyer type — operator: B2B, storefront: B2C. */
248
- defaultBuyerType?: "B2C" | "B2B";
249
- /** Initial fallback shape — rendered before the first quote
250
- * resolves. The engine returns a more specific shape on the
251
- * first quote response. */
252
- fallbackShape?: BookingDraftShape;
253
- /**
254
- * Pre-locked configure state. When set, the journey skips the
255
- * Configure step entirely — Configure already happened on the
256
- * product detail page. Mirrors the BookingDraft's `configure`
257
- * shape (loosely typed so storefront callers can pass a
258
- * vertical-specific subset without fighting the contract).
259
- */
260
- initialConfigure?: Record<string, unknown>;
261
- /** Pre-locked accommodation slice (room/rate picks made on the
262
- * detail page). Loosely typed for the same reason. */
263
- initialAccommodation?: Record<string, unknown>;
264
- /**
265
- * When true, the wizard hides Configure regardless of descriptor
266
- * flags. Use for storefront flows where the product detail page
267
- * already collected those choices.
268
- */
269
- hideConfigure?: boolean;
270
- /** Per-payment-provider capabilities — passed through to the
271
- * Payment step's provider widget. */
272
- paymentCapabilities?: PaymentProviderCapabilities;
273
- /** Operator: pulls from CRM. Storefront: bare inline form. */
274
- renderLeadContactPicker?: (props: LeadContactPickerProps) => ReactNode;
275
- renderTravelerContactPicker?: (props: TravelerContactPickerProps) => ReactNode;
276
- /** Operator-only Travel Credit picker (async search). When omitted, the
277
- * control falls back to the customer code-entry form. */
278
- renderTravelCreditPicker?: (props: TravelCreditPickerProps) => ReactNode;
279
- /**
280
- * Renders the Configure step's `"departure"` sub-step. Operator
281
- * surfaces wire this to a scheduled-departure picker (availability);
282
- * when omitted, the journey renders a free date/time fallback.
283
- */
284
- renderDeparturePicker?: (props: DeparturePickerProps) => ReactNode;
285
- /**
286
- * Renders the Configure step's `"option-units"` sub-step (room/unit
287
- * quantity selection). Operator surfaces wire this to an inventory
288
- * units picker; when omitted, the sub-step renders nothing.
289
- */
290
- renderUnitsPicker?: (props: UnitsPickerProps) => ReactNode;
291
- /** Hook for the actual payment-provider widget — checkout-ui's
292
- * PaymentStep is the canonical implementation. When omitted, the
293
- * shell renders a "Hold only — no card collected" stub. */
294
- renderPaymentProviderStep?: (props: PaymentProviderStepRenderProps) => ReactNode;
295
- /**
296
- * Runs before a forward step transition. Return `false` or
297
- * `{ allow: false, message }` to keep the current step active and
298
- * surface an inline navigation error; return `{ allow: true,
299
- * draft }` to continue with an updated draft snapshot.
300
- */
301
- onBeforeStepAdvance?: BookingJourneyTransitionGuard;
302
- /** Optional pre/post-step extension slots — useful when a
303
- * template wants to inject a custom block (e.g. Promotion Code
304
- * banner, marketing opt-in). */
305
- renderConfigureExtras?: () => ReactNode;
306
- /** Billing extras — receives the picked lead + departure so a template can,
307
- * e.g., warn that this customer already has a booking on this departure. */
308
- renderBillingExtras?: (ctx: BillingExtrasContext) => ReactNode;
309
- renderReviewExtras?: () => ReactNode;
310
- /** Fired on successful commit — typically a navigation. */
311
- onCommitted?: (result: BookResponseV1) => void;
312
- /** Fired when the user explicitly abandons the journey via the
313
- * shell's cancel button. */
314
- onCancelled?: () => void;
315
- /** Optional class names. */
316
- className?: string;
317
- sidePanelClassName?: string;
318
- /**
319
- * Optional summary of the entity being booked — surfaces in the
320
- * side panel so the customer keeps context while filling out the
321
- * journey. Shape is loose because each vertical carries different
322
- * fields (cruises have ports, accommodations have check-in/out, etc.).
323
- */
324
- entitySummary?: BookingEntitySummary;
325
- /**
326
- * Contract preview integration. When `templateSlug` is set, the
327
- * Review step's "Continue to checkout" button opens the contract
328
- * preview dialog with the rendered template instead of committing
329
- * directly. The journey then surfaces the acceptance back to the
330
- * caller via `onContractAccepted` so the storefront can call its
331
- * own `/checkout/start` endpoint.
332
- *
333
- * - `previewUrl` — absolute URL of the public render endpoint.
334
- * - `resolveVariables` — maps the draft to the template's variable
335
- * schema. The storefront supplies a default mapper that covers
336
- * traveler / billing / room / dates.
337
- * - `marketingLabel` — when set, an additional opt-in checkbox is
338
- * rendered in the dialog. Marketing consent is optional and is
339
- * passed through `onContractAccepted` so the caller can decide
340
- * what to do with it.
341
- */
342
- contract?: {
343
- templateSlug: string;
344
- previewUrl: string;
345
- acceptLanguage?: string;
346
- resolveVariables: (input: {
347
- draft: BookingDraftV1;
348
- pricing: PricingBreakdownV1 | null;
349
- }) => Record<string, unknown>;
350
- marketingLabel?: ReactNode;
351
- termsLabel?: ReactNode;
352
- };
353
- /**
354
- * Fired when the user accepts the contract in the preview dialog.
355
- * The caller persists the acceptance + dispatches the checkout
356
- * workflow. Receives the rendered HTML so it can be stored
357
- * verbatim for the audit trail.
358
- */
359
- /**
360
- * Called when the user clicks Confirm on the Review step. Receives
361
- * the rendered contract acceptance when the contract dialog was
362
- * shown; receives `null` when the journey skipped the dialog
363
- * (no template configured — the storefront still wants to drive
364
- * the post-confirm /checkout/start flow).
365
- */
366
- onContractAccepted?: (acceptance: ContractAcceptanceEvent | null, context: BookingJourneyCheckoutContext) => void | Promise<void>;
367
- }
368
- export interface BookingJourneyCheckoutContext {
369
- draft: BookingDraftV1;
370
- pricing: PricingBreakdownV1 | null;
371
- quoteId?: string;
372
- }
373
- export interface ContractAcceptanceEvent {
374
- templateId: string;
375
- templateSlug: string;
376
- templateName: string;
377
- acceptedTerms: true;
378
- acceptedMarketing: boolean;
379
- acceptedAt: string;
380
- renderedHtml: string;
381
- }
382
177
  /**
383
178
  * Caller-provided context for the side-panel summary. Keep it
384
179
  * vertical-agnostic — the panel renders whatever subset is present.
@@ -1,10 +1,6 @@
1
1
  /**
2
- * Shell-side types for `<BookingJourney />`. These complement the
3
- * engine contracts in `@voyant-travel/catalog-contracts/booking-engine/contracts`
4
- * with React-specific slots and event shapes that don't belong on
5
- * the wire.
6
- *
7
- * Per booking-journey-architecture §8.1.
2
+ * React-side draft and step types that complement the booking-engine wire
3
+ * contracts.
8
4
  */
9
5
  export const JOURNEY_STEP_ORDER = [
10
6
  "departure",
@@ -1,3 +1 @@
1
1
  export { type ContractSourceContext, type OperatorInfoVariables, type ResolveContractVariablesContext, resolveContractVariables, } from "./resolve-contract-variables.js";
2
- export { buildStorefrontCommitParty, StorefrontBookingJourney, type StorefrontBookingJourneyMessages, type StorefrontBookingJourneyProps, type StorefrontBookingJourneyScope, type StorefrontCheckoutConfirmationKind, } from "./storefront-booking-journey.js";
3
- export { StorefrontBookingPage, type StorefrontBookingPageExtensions, type StorefrontBookingPageMessages, type StorefrontBookingPageProps, type StorefrontBookingSearch, storefrontBookingSearchSchema, } from "./storefront-booking-page.js";
@@ -1,3 +1 @@
1
1
  export { resolveContractVariables, } from "./resolve-contract-variables.js";
2
- export { buildStorefrontCommitParty, StorefrontBookingJourney, } from "./storefront-booking-journey.js";
3
- export { StorefrontBookingPage, storefrontBookingSearchSchema, } from "./storefront-booking-page.js";
package/dist/ui.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export { BookingActivityTimeline, type BookingActivityTimelineProps, } from "./components/booking-activity-timeline.js";
2
2
  export { BookingCancellationDialog, type BookingCancellationDialogProps, } from "./components/booking-cancellation-dialog.js";
3
3
  export { BookingCombobox, type BookingComboboxProps, } from "./components/booking-combobox.js";
4
- export { BookingCreatePage, type BookingCreatePageProps, } from "./components/booking-create-page.js";
5
- export { BookingCreateForm, type BookingCreateFormProps, BookingCreateSheet, type BookingCreateSheetProps, } from "./components/booking-create-sheet.js";
6
4
  export { type DepartureSlotSearchRecord, getBookableDepartureSlots, } from "./components/booking-create-utils.js";
7
5
  export { BookingBillingContextCard, BookingDetailPage, type BookingDetailPageProps, type BookingDetailPageSlots, type BookingDetailSlotContent, type BookingDetailTabSlot, } from "./components/booking-detail-page.js";
8
6
  export { BookingDialog, type BookingDialogProps } from "./components/booking-dialog.js";
package/dist/ui.js CHANGED
@@ -1,8 +1,6 @@
1
1
  export { BookingActivityTimeline, } from "./components/booking-activity-timeline.js";
2
2
  export { BookingCancellationDialog, } from "./components/booking-cancellation-dialog.js";
3
3
  export { BookingCombobox, } from "./components/booking-combobox.js";
4
- export { BookingCreatePage, } from "./components/booking-create-page.js";
5
- export { BookingCreateForm, BookingCreateSheet, } from "./components/booking-create-sheet.js";
6
4
  export { getBookableDepartureSlots, } from "./components/booking-create-utils.js";
7
5
  export { BookingBillingContextCard, BookingDetailPage, } from "./components/booking-detail-page.js";
8
6
  export { BookingDialog } from "./components/booking-dialog.js";