/** * Non-catalog (flight) trip-component orchestration — owned by * `@voyant-travel/trips`. * * Trips owns the reserve/checkout flow for flight placeholder components, so the * orchestration that prices a selected flight offer before reserve (detecting * price changes / expiry) and books the held flight order lives here: * - flight preflight + price-change detection (`validateBeforeReserve`), * - passenger-roster building (DOB / contact fallbacks) + billing mapping, * - reserve (book the held flight order), * - cancellation mapping to the flight connector order. * * WHY THE FLIGHT ADAPTER IS INJECTED (not imported): * * Trips reads flight *contract types* from `@voyant-travel/flights` (a leaf * contract dependency, acyclic), but the concrete adapter is deployment-specific * provider wiring, so it is injected via `options.adapter` rather than imported. The price/expiry * detection, passenger mapping, and billing fallbacks are vertical-agnostic * orchestration and live here. * * Behaviour is byte-for-byte equivalent to the operator's previous * `trips-flight-runtime.ts`. */ import type { FlightCancelReason, FlightCancelResponse } from "@voyant-travel/flights/contract/adapter"; import type { FlightBookRequest, FlightOffer, FlightOrder } from "@voyant-travel/flights/contract/types"; import type { CancelComponentInput, CancelComponentResult, ComponentCancellationPreview, ComponentCancellationPreviewInput, ReserveComponentInput, ReserveComponentPreflightResult, ReserveComponentResult } from "./service-types.js"; /** Per-request adapter context propagated to the flight adapter. */ export interface FlightAdapterContext { connectionId: string; correlationId?: string; } /** * The minimal flight-adapter surface the orchestration needs. Injected because * the concrete adapter is deployment-specific provider wiring. */ export interface FlightComponentAdapter { priceOffer(ctx: FlightAdapterContext, request: { offerId: string; offer?: FlightOffer; }): Promise<{ offer: FlightOffer; valid: boolean; invalidReason?: string; }>; bookFlight(ctx: FlightAdapterContext, request: FlightBookRequest): Promise<{ order: FlightOrder; }>; cancelOrder(ctx: FlightAdapterContext, orderId: string, reason?: FlightCancelReason): Promise; } /** Deployment-supplied, request-scoped flight wiring. */ export interface FlightComponentAdapterOptions { /** The deployment-specific flight adapter (provider + base URL). */ adapter: FlightComponentAdapter; /** Per-request adapter context (connection id + correlation id). */ adapterContext: FlightAdapterContext; } /** The flight component orchestration surface produced by the factory. */ export interface FlightComponentAdapterApi { validateBeforeReserve(input: ReserveComponentInput): Promise; reserve(input: ReserveComponentInput): Promise; previewCancellation(input: ComponentCancellationPreviewInput): Promise; cancel(input: CancelComponentInput): Promise; } /** * Build the flight (non-catalog) trip-component orchestration bound to a * request's flight adapter + adapter context. */ export declare function createFlightComponentAdapter(options: FlightComponentAdapterOptions): FlightComponentAdapterApi; export declare function previewFlightCancellation(input: ComponentCancellationPreviewInput): Promise;