import type { BookingConfirmation, MeetingAvailability, MeetingBookingErrorCode } from '../schemas/meeting-booking-schema'; /** * useMeetingBooking — data layer for `` (the widget * files never inline fetch; same split as `useContactSubmission`/ContactForm). * * REQUIRES a `QueryClientProvider` in the host, like every other query-backed * surface in this lib (tickets, chat, onboarding-guides). `@tanstack/react-query` * is a declared peer dependency; the lib never mounts a provider of its own. * * Availability is a per-month GET, cached per (host, link, month). The cache is * the point: paging back to a month already seen is INSTANT and silent, which * is what a hand-rolled `useEffect` + `useState` could not do — it re-fetched * and re-skeletoned the same month every time the visitor stepped back. * * Deliberately NOT `placeholderData: keepPreviousData`. The payload is * month-scoped, so last month's slots under this month's caption describe days * that aren't on screen — a grid that lights up the wrong dates is worse than * one that is briefly inert. What kills the flicker instead is WHERE the * loading state lands: the calendar is fully derivable from the date alone, so * it keeps rendering (with nothing selectable yet) while only the times column * — the part that genuinely has no answer — shows a placeholder. * * `staleTime` is deliberately short: HubSpot slots go stale in about a minute, * and a slot that is gone by the time it is clicked costs a booking. Fresh * enough to trust, cached enough not to blink. * * Booking: a mutation, guarded so a second submit can't start while one is in * flight (the transport never retries POST — this is the only double-booking * guard). Errors surface as typed `MeetingBookingErrorCode`s the widget keys * its recovery UI off, never as thrown rejections. * * All requests go through the host proxy (`apiBaseUrl` prefix, FaqSection * precedent) via `contentFetch`, so embedded hosts with an embed-auth adapter * inherit auth with zero extra wiring. */ export interface BookingResult { ok: boolean; confirmation?: BookingConfirmation; code?: MeetingBookingErrorCode; message?: string; } /** Query key for one month of one link. Exported so a host can prefetch or * invalidate a month it knows changed (e.g. after booking elsewhere). */ export declare function meetingAvailabilityKey(apiBaseUrl: string, meetingId: string, monthOffset: number): readonly ["meeting-availability", string, string, number]; export declare function useMeetingBooking(options: { meetingId: string; apiBaseUrl?: string; initialAvailability?: MeetingAvailability; }): { readonly availability: MeetingAvailability | null; /** No availability for this month yet — the times column has nothing to show. */ readonly isLoadingAvailability: boolean; /** ANY request in flight, including a silent revalidation of cached data. */ readonly isFetchingAvailability: boolean; readonly availabilityError: string | null; readonly monthOffset: number; readonly setMonthOffset: (offset: number) => void; readonly refetchAvailability: () => Promise; readonly book: (payload: Record) => Promise; readonly isSubmitting: boolean; }; //# sourceMappingURL=use-meeting-booking.d.ts.map