import { type ReactNode } from "react"; import { type BookingDetailPageSlots, type BookingDetailTabValue } from "../components/booking-detail-page.js"; import type { BookingPaymentsSummaryRow } from "../components/booking-payments-summary.js"; import { type BookingRecord } from "../index.js"; import { bookingDetailFinanceEndSlot, bookingDetailFinanceStartSlot, bookingDetailInvoicesTabSlot } from "./slots.js"; export { bookingDetailFinanceEndSlot, bookingDetailFinanceStartSlot, bookingDetailInvoicesTabSlot }; /** * Render context handed to the host's app-supplied slots AND to widget * contributions targeting {@link bookingDetailInvoicesTabSlot}. Carries the * booking plus the host-computed payment aggregates and the invoice-sheet * opener so contributed cards can participate without re-deriving them. */ export interface BookingDetailHostSlotContext { booking: BookingRecord; /** Customer payments summed across non-credit-note, non-draft invoices. */ paidAmountCents: number | null; /** * Localized "Booking is fully paid" reason when nothing is left to pay, * else `null`. The host already uses it for the Record payment / Add * schedule buttons; payment-link slots reuse it for their own gating. */ fullyPaidReason: string | null; /** Open an invoice in the host's side sheet (stays on the booking page). */ openInvoiceSheet: (invoiceId: string) => void; /** * Opens the selected Finance package's Generate payment link flow. */ onGenerateLink: (() => void) | undefined; } export type BookingDetailHostSlot = (context: BookingDetailHostSlotContext) => ReactNode; export interface BookingDetailPaymentActions { onEditPayment?: (row: BookingPaymentsSummaryRow) => void; onGenerateLink?: () => void; onRecordPayment?: () => void; } export interface BookingDetailPaymentControllerSlotContext { bookingId: string; onActionsChange: (actions: BookingDetailPaymentActions) => void; } /** * App-supplied extension points. The host owns everything package-clean * (the Documents tab, the action-ledger timeline merge, the finance-tab * widget slots); these slots remain for app-local additions on top. */ export interface BookingDetailHostSlots { /** Top of the Finance tab, rendered before any widget contributions. */ financeStart?: BookingDetailHostSlot; /** Bottom of the Finance tab, rendered before any widget contributions. */ financeEnd?: BookingDetailHostSlot; /** Mounts a dedicated Invoices tab between Payments and Suppliers. */ invoicesTab?: { label?: string; content: BookingDetailHostSlot; }; /** Replaces the Documents tab content (default: {@link BookingDocumentsTable}). */ documents?: BookingDetailHostSlot; /** Extra events merged into the Activity-tab timeline (the host already * merges the booking's central action-ledger entries). */ activityExtraEvents?: BookingDetailPageSlots["activityExtraEvents"]; /** Rendered below the activity timeline events, after the host's * action-ledger pager. */ activityTimelineFooter?: ReactNode; } export interface BookingDetailHostProps { id: string; /** Controlled tab value; the route file mirrors it into the URL. */ activeTab?: BookingDetailTabValue; onTabChange?: (tab: BookingDetailTabValue) => void; /** * Overrides the selected Finance package's record-payment action. */ onRecordPayment?: () => void; /** Opens the app's record-payment flow pre-filled with the row. */ onEditPayment?: (row: BookingPaymentsSummaryRow) => void; /** * Overrides the selected Finance package's Generate payment link action. */ onGenerateLink?: () => void; slots?: BookingDetailHostSlots; } /** * Packaged admin host for the canonical `BookingDetailPage` (packaged-admin * RFC Phase 3). Owns everything package-clean: * * - Cross-route links resolve through semantic destinations (RFC §4.7): * `booking.list`, `person.detail`, `organization.detail`, * `product.detail`, `availabilitySlot.detail`, `payment.detail`, * `invoice.detail` — no host route tree import. * - Admin chrome breadcrumbs (`useAdminBreadcrumbs`). * - Admin widget extension points: the `booking.details.header` and * `booking.details.after-summary` slots render through the shared * `AdminWidgetSlotRenderer`, which reads the workspace shell's * `AdminExtensionsProvider` context. * - Paid-amount aggregation across the booking's invoices and the * derived fully-paid disabled reasons. * - Payment row delete (finance-react mutation) and the in-place * invoice sheet ({@link BookingInvoiceSheet}). * * App-local cards without package-level data access stay injectable via * {@link BookingDetailHostSlots}. */ export declare function BookingDetailHost({ id, activeTab, onTabChange, onRecordPayment, onEditPayment, onGenerateLink, slots, }: BookingDetailHostProps): import("react").JSX.Element;