Shopvento UI - v0.2.0
    Preparing search index...

    Function useSubmitBooking

    • Submit the booking once, expose field errors, validate checkout hosts and handle accepted orders safely.

      Parameters

      • client: {
            checkVoucher: (
                code: string,
                signal?: AbortSignal,
            ) => Promise<VoucherCheck>;
            getEvent: (id: number, signal?: AbortSignal) => Promise<ShopTasting[]>;
            getSettings: (signal?: AbortSignal) => Promise<ShopSettings>;
            getTasting: (id: number, signal?: AbortSignal) => Promise<ShopTasting[]>;
            listEvents: (signal?: AbortSignal) => Promise<ShopTasting[]>;
            listLocations: (
                signal?: AbortSignal,
            ) => Promise<{ locations: ShopFranchiseLocationResponse[]; total: number }>;
            listLocationTimewindows: (
                locationId: number,
                __namedParameters?: {
                    endDate?: string;
                    signal?: AbortSignal;
                    startDate?: string;
                },
            ) => Promise<{ timewindows: Timewindow[]; total: number }>;
            listTastings: (signal?: AbortSignal) => Promise<ShopTasting[]>;
            listTimewindows: (
                id: number,
                signal?: AbortSignal,
                locationId?: number,
            ) => Promise<{ timewindows: Timewindow[]; total: number }>;
            submit: (body: ShopBookingRequest) => Promise<ShopBookingResponse>;
            submitGuest: (
                body: ShopGuestBookingRequest,
            ) => Promise<ShopBookingResponse>;
        }

        Stable client instance used for API requests.

        • checkVoucher: (code: string, signal?: AbortSignal) => Promise<VoucherCheck>

          Check a public voucher code; final redemption happens atomically at booking.

        • getEvent: (id: number, signal?: AbortSignal) => Promise<ShopTasting[]>

          Filter the public list by event identifier; there is no public detail endpoint.

        • getSettings: (signal?: AbortSignal) => Promise<ShopSettings>

          Read public installation settings. Optional signal cancels the request.

        • getTasting: (id: number, signal?: AbortSignal) => Promise<ShopTasting[]>

          Use getEvent. Removed in 1.0.

        • listEvents: (signal?: AbortSignal) => Promise<ShopTasting[]>

          List public event variants. Optional signal cancels the request.

        • listLocations: (
              signal?: AbortSignal,
          ) => Promise<{ locations: ShopFranchiseLocationResponse[]; total: number }>

          List public event locations. Optional signal cancels the request.

        • listLocationTimewindows: (
              locationId: number,
              __namedParameters?: {
                  endDate?: string;
                  signal?: AbortSignal;
                  startDate?: string;
              },
          ) => Promise<{ timewindows: Timewindow[]; total: number }>

          Discover timewindows across all events at one location.

        • listTastings: (signal?: AbortSignal) => Promise<ShopTasting[]>

          Use listEvents. Removed in 1.0.

        • listTimewindows: (
              id: number,
              signal?: AbortSignal,
              locationId?: number,
          ) => Promise<{ timewindows: Timewindow[]; total: number }>

          List slots for one event. Date defaults to today in Europe/Berlin; optional location filters availability.

        • submit: (body: ShopBookingRequest) => Promise<ShopBookingResponse>

          Submit an authenticated booking request. In useSubmitBooking, pass guest, challenge token and consent explicitly for guest submissions; consent defaults to false.

        • submitGuest: (body: ShopGuestBookingRequest) => Promise<ShopBookingResponse>

          Submit guest contact, seats, live challenge token and current consent.

      • redirect: (url: string) => void

        Redirect supplied by the host.

      • checkoutHosts: readonly string[] = ...

        Allowed HTTPS checkout hostnames. Defaults to checkout.stripe.com. Defaults to ["checkout.stripe.com"].

      • OptionalonAccepted: (response: ShopBookingResponse) => void

        On accepted supplied by the host.

      • OptionalonFailure: (error: unknown) => void

        On failure supplied by the host.

      Returns {
          clearError: () => void;
          error: string | null;
          fieldErrors: Partial<
              Record<"email" | "phone" | "first_name" | "last_name", string>,
          >;
          pending: boolean;
          result: ShopBookingResponse | null;
          submit: (
              draft: BookingDraft,
              guest: boolean,
              token: string,
              consent?: boolean,
          ) => Promise<ShopBookingResponse | undefined>;
      }

      • clearError: () => void

        Clear the visible booking error and field errors.

      • error: string | null

        Customer-visible error, or null.

      • fieldErrors: Partial<Record<"email" | "phone" | "first_name" | "last_name", string>>

        Validation errors keyed by contact field.

      • pending: boolean

        Whether booking submission is in progress.

      • result: ShopBookingResponse | null

        Accepted booking response, when available.

      • submit: (
            draft: BookingDraft,
            guest: boolean,
            token: string,
            consent?: boolean,
        ) => Promise<ShopBookingResponse | undefined>

        Submit an authenticated booking request. In useSubmitBooking, pass guest, challenge token and consent explicitly for guest submissions; consent defaults to false.