/** * Payment - High-level component for displaying payment information * Provides components for displaying payment summary, totals, and line items */ import React from 'react'; import { AsChildChildren } from '@wix/headless-utils/react'; import { MoneyData } from '@wix/headless-components/react'; import type { PaymentServiceConfig, PricingServiceSelection, ServicePaymentOptions } from '../../services/payment/payment.js'; export declare const TestIds: { readonly paymentRoot: "payment-root"; readonly paymentSubtotal: "payment-subtotal"; readonly paymentTax: "payment-tax"; readonly paymentTotal: "payment-total"; readonly paymentPayNow: "payment-pay-now"; readonly paymentPayLater: "payment-pay-later"; readonly paymentLineItems: "payment-line-items"; readonly paymentLineItemsList: "payment-line-items-list"; readonly paymentLineItemRepeater: "payment-line-item-repeater"; readonly paymentLineItemTotal: "payment-line-item-total"; readonly paymentLineItemSubtotal: "payment-line-item-subtotal"; readonly paymentLineItemDeposit: "payment-line-item-deposit"; readonly paymentServiceOptions: "payment-service-options"; }; /** * Props for Payment.Root component */ export interface RootProps { children?: React.ReactNode | ((props: { isLoading: boolean; hasError: boolean; }) => React.ReactNode); /** Service config for SSR (pre-fetched paymentDetails) */ paymentServiceConfig?: PaymentServiceConfig; /** Pricing service selections for lazy loading (triggers API call) */ pricingServiceSelections?: PricingServiceSelection[]; /** Number of participants for lazy loading */ totalParticipants?: number; asChild?: boolean; className?: string; } /** * Root component that provides payment context to the entire app. * Supports 3 modes: * 1. SSR: paymentServiceConfig.paymentDetails - pre-fetched data * 2. Lazy loading: pricingServiceSelections + totalParticipants props - calls API via useEffect * 3. Reactive: no config/props - reads from BookingService signals * * @order 1 * @component * @example * ```tsx * import { Payment } from '@wix/bookings/components'; * * // SSR mode * function PaymentPage({ paymentDetails }) { * return ( * * * * ); * } * * // Lazy loading mode * function LazyPayment({ slotServices }) { * return ( * * {({ isLoading }) => isLoading ?
Loading...
: } *
* ); * } * ``` */ export declare const Root: React.ForwardRefExoticComponent>; /** * Props for Payment.Subtotal component */ export interface SubtotalProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ subtotal: MoneyData | null; customPrice: string | null; }>; } /** * Displays the payment subtotal. * Always displays the monetary value. Exposes customPrice for custom rendering. * * @component * @example * ```tsx * * ``` * @example * ```tsx * * {({ subtotal, customPrice }) => ( *
* {customPrice ? {customPrice} : } *
* )} *
* ``` */ export declare const Subtotal: React.ForwardRefExoticComponent>; /** * Props for Payment.Tax component */ export interface TaxProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ tax: MoneyData | null; }>; } /** * Displays the payment tax. * Uses data-has-tax attribute for conditional visibility. * * @component * @example * ```tsx * * ``` */ export declare const Tax: React.ForwardRefExoticComponent>; /** * Props for Payment.Total component */ export interface TotalProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ total: MoneyData | null; customPrice: string | null; }>; } /** * Displays the payment total. * Always displays the monetary value. Exposes customPrice for custom rendering. * * @component * @example * ```tsx * * ``` * @example * ```tsx * * {({ total, customPrice }) => ( *
* {customPrice ? {customPrice} : } *
* )} *
* ``` */ export declare const Total: React.ForwardRefExoticComponent>; /** * Props for Payment.PayNow component */ export interface PayNowProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ payNow: MoneyData | null; isDeposit: boolean; }>; } /** * Displays the pay now amount (amount to pay upfront in deposit scenarios). * Only renders in deposit mode when payNow has a valid amount. * * @component * @example * ```tsx * * ``` */ export declare const PayNow: React.ForwardRefExoticComponent>; /** * Props for Payment.PayLater component */ export interface PayLaterProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ payLater: MoneyData | null; isDeposit: boolean; }>; } /** * Displays the pay later amount (for deposit scenarios). * Only renders when in deposit mode and payLater has a valid amount. * * @component * @example * ```tsx * * ``` */ export declare const PayLater: React.ForwardRefExoticComponent>; /** * Props for Payment.ServiceOptions component */ export interface ServiceOptionsProps { asChild?: boolean; /** Render prop receiving service payment options. This component renders no * visible DOM element by default — it is a flags-only data component. */ children?: AsChildChildren; } /** * Exposes service payment options via render props. * Use this to determine which payment scenario to render without reading the service entity directly. * * Payment scenarios: * - `isOnline=true, isInPerson=false, isDeposit=false` → Pay now only (Due now = total) * - `isOnline=true, isInPerson=false, isDeposit=true` → Pay now + security deposit * - `isOnline=true, isInPerson=true` → Radio: Pay Online / Pay on Arrival * - `isOnline=false, isInPerson=true` → Pay on arrival only * * @component * Note: This component renders no visible DOM element. It is a flags-only data * component — use `asChild` with a render function to consume the flags. * For the actual split amounts (deposit / pay-later), use `Payment.PayNow` and * `Payment.PayLater`. * * @example * ```tsx * * {({ isOnline, isInPerson, isDeposit }) => ( * // render the correct payment scenario * )} * * ``` */ export declare const ServiceOptions: React.ForwardRefExoticComponent>; /** * Props for Payment.LineItems component (Container Level) */ export interface LineItemsProps { asChild?: boolean; children?: React.ReactNode; className?: string; } /** * Container component for line items. * Follows the 3-level List/Options/Repeater pattern. * Provides context and handles loading/error states via GenericList. * * @component * @example * ```tsx * * No items} * loadingState={
Loading...
} * errorState={
Failed to load
} * > * * * *
*
* ``` */ export declare const LineItems: React.ForwardRefExoticComponent>; /** * Props for Payment.LineItemsList component */ export interface LineItemsListProps { children?: React.ReactNode; /** Content to display when no items are available */ emptyState?: React.ReactNode; /** Content to display when loading */ loadingState?: React.ReactNode; /** Content to display when there's an error */ errorState?: React.ReactNode; className?: string; } /** * List container for line items with empty/loading/error state support. * * @component * @example * ```tsx * No items} * loadingState={
Loading...
} * errorState={
Failed to load payment details
} * > * *
* ``` */ export declare const LineItemsList: React.ForwardRefExoticComponent>; /** * Props for Payment.LineItemRepeater component */ export interface LineItemRepeaterProps { children: React.ReactNode; } /** * Repeater component that maps over line items and provides context per item. * Uses GenericList.Repeater internally with itemWrapper that provides LineItemContext. * * @component * @example * ```tsx * * * * ``` */ export declare const LineItemRepeater: React.ForwardRefExoticComponent>; /** * Props for Payment.LineItemTotal component */ export interface LineItemTotalProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ totalPrice: MoneyData | null; customPrice: string | null; }>; } /** * Displays the line item total (total price after tax). * Shows customPrice for CUSTOM rate type services, otherwise shows totalPrice. * * @component * @example * ```tsx * * ``` */ export declare const LineItemTotal: React.ForwardRefExoticComponent>; /** * Props for Payment.LineItemSubtotal component */ export interface LineItemSubtotalProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ subtotal: MoneyData | null; customPrice: string | null; }>; } /** * Displays the line item subtotal (full price before discounts). * Shows customPrice for CUSTOM rate type services, otherwise shows subtotal. * * @component * @example * ```tsx * * ``` */ export declare const LineItemSubtotal: React.ForwardRefExoticComponent>; /** * Props for Payment.LineItemDeposit component */ export interface LineItemDepositProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ deposit: MoneyData | null; }>; } /** * Displays the line item deposit amount. * Uses data-has-deposit attribute for conditional visibility. * * @component * @example * ```tsx * * ``` */ export declare const LineItemDeposit: React.ForwardRefExoticComponent>;