/** * Cross-used leaf helpers + shared types for the journey step components. * Everything else imports shared helpers from here. */ import type { BookingDraftShape } from "@voyant-travel/catalog-contracts/booking-engine/draft-shape"; import { useBookingsUiMessagesOrDefault } from "../../../i18n/index.js"; import type { Draft } from "../../lib/draft-state.js"; import type { DeparturePickerProps, UnitsPickerProps } from "../../types.js"; /** Injectable departure-picker render slot for composed draft surfaces. */ export type RenderDeparturePicker = (props: DeparturePickerProps) => React.ReactNode; /** Injectable units (rooms) render slot for composed draft surfaces. */ export type RenderUnitsPicker = (props: UnitsPickerProps) => React.ReactNode; export interface StepCommonProps { draft: Draft; setDraft: (next: Draft | ((prev: Draft) => Draft)) => void; shape: BookingDraftShape; /** * Default country (ISO 3166-1 alpha-2) for the step's phone inputs, already * resolved by the draft surface from its configured default or the * scope locale. When omitted the `PhoneField` derives one from the active * i18n locale before falling back to GB. */ defaultPhoneCountry?: string; } /** * Derives a default country (ISO 3166-1 alpha-2) for a phone input from an * explicit value or a locale, or `undefined` when neither yields one — so * callers can chain multiple locale sources before falling back. * * Order of preference: * 1. An explicit value (e.g. a deployment's market/storefront setting) when it * looks like a valid alpha-2 code. * 2. The region subtag of `locale` (e.g. `"ro-RO"` -> `"RO"`). A bare language * tag with no region (e.g. `"ro"`) yields no guess — we don't invent a * country from a language. */ export declare function deriveDefaultPhoneCountry(explicit?: string, locale?: string): string | undefined; /** * Resolves the default country (ISO 3166-1 alpha-2) for a phone input, applying * {@link deriveDefaultPhoneCountry} and falling back to `"GB"` as the * last resort. */ export declare function resolveDefaultPhoneCountry(explicit?: string, locale?: string): string; /** * Soft validation warnings for a step, rendered INSIDE its card (below the * content) so they're visibly scoped to the block they belong to. */ export declare function JourneyWarnings({ warnings, }: { warnings?: ReadonlyArray; }): React.ReactElement | null; export declare function JourneyErrors({ errors, }: { errors?: ReadonlyArray; }): React.ReactElement | null; export declare function Field({ id, label, value, onChange, type, placeholder, error, }: { id: string; label: string; value: string; onChange: (v: string) => void; type?: string; placeholder?: string; error?: string; }): React.ReactElement; export declare function PhoneField({ id, label, value, onChange, defaultCountry, }: { id: string; label: string; value: string; onChange: (v: string) => void; /** Explicit default country (ISO 3166-1 alpha-2). Falls back to the active * locale's region, then GB. */ defaultCountry?: string; }): React.ReactElement; /** * Date field that uses the shared `` from * `@voyant-travel/ui` with a month + year dropdown caption so users can * jump across decades without arrow-clicking. The `range` hint picks * a reasonable startMonth/endMonth window per use case: * * - `"past"` — DOB-style picks (today back ~120 years) * - `"future"` — departure / check-in / check-out (today forward ~5 years) * - `"document"` — passport / ID expiry (today forward ~20 years) */ export declare function DateField({ id, label, value, onChange, range, }: { id: string; label: string; value: string; onChange: (v: string) => void; range?: "past" | "future" | "document"; }): React.ReactElement; export declare function SelectField({ id, label, value, options, onChange, }: { id: string; label: string; value: string; options: ReadonlyArray<{ value: string; label: string; }>; onChange: (v: string) => void; }): React.ReactElement; /** * Years between an ISO date-of-birth and today. Returns `null` for * unparseable input or future dates so the UI can hide the badge * gracefully rather than rendering "age -3". */ export declare function computeAge(dob: string): number | null; export declare function ageHint(min: number | undefined, max: number | undefined, messages: ReturnType): string; export declare function bucketBy(items: ReadonlyArray, keyFn: (item: T) => string): Map; export declare function cryptoRowId(): string;