/** * Core Payment Components * Provides low-level access to PaymentService via render props * Note: Currently supports single service only */ import React from 'react'; import { type PaymentServiceConfig, type PricingServiceSelection, type ServicePaymentOptions } from '../../../services/payment/payment.js'; import type { MoneyData } from '@wix/headless-components/react'; /** * Props for Payment.Root component */ export interface RootProps { children: React.ReactNode | ((props: { isLoading: boolean; hasError: boolean; }) => React.ReactNode); /** Service config - SSR only (paymentDetails) */ paymentServiceConfig?: PaymentServiceConfig; /** Pricing service selections for lazy loading (triggers API call) */ pricingServiceSelections?: PricingServiceSelection[]; /** Number of participants for lazy loading */ totalParticipants?: number; } /** * Root component that provides payment context. * Supports 3 modes: * 1. SSR: paymentServiceConfig.paymentDetails - pre-fetched data * 2. Lazy loading: pricingServiceSelections + totalParticipants props - calls API on init * 3. Reactive: no config/props - reads from BookingService signals * * @component * @example * ```tsx * // SSR mode * * * * * // Lazy loading mode * * {({ isLoading }) => isLoading ? Loading... : } * * * // Reactive mode * * * * ``` */ export declare function Root(props: RootProps): React.ReactNode; /** * Props for Data render prop component */ export interface DataProps { children: (data: { subtotal: MoneyData | null; total: MoneyData | null; tax: MoneyData | null; discount: MoneyData | null; payNow: MoneyData | null; payLater: MoneyData | null; customPrice: string | null; hasTax: boolean; hasDiscount: boolean; isDeposit: boolean; currency: string; isLoading: boolean; error: string | null; }) => React.ReactNode; } /** * Core component that provides access to converted payment data. * Returns MoneyData for each price field, ready for rendering. * * @component */ export declare function Data(props: DataProps): React.ReactNode; /** * Line item with pre-converted MoneyData prices */ export interface LineItem { /** Unique identifier */ id: string; /** Total price after tax */ totalPrice: MoneyData | null; /** Subtotal (full price before discounts) */ subtotal: MoneyData | null; /** Tax amount */ tax: MoneyData | null; /** Discount amount */ discount: MoneyData | null; /** Deposit amount */ deposit: MoneyData | null; /** Custom price text (for CUSTOM rate type services) */ customPrice: string | null; } /** * Props for LineItems render prop component */ export interface LineItemsProps { children: (data: { lineItems: LineItem[]; hasLineItems: boolean; currency: string; isLoading: boolean; error: string | null; }) => React.ReactNode; } /** * Core component that provides access to calculated line items via render props. * Returns line items with pre-converted MoneyData prices. * * @component * @example * ```tsx * * {({ lineItems, hasLineItems, currency, isLoading, error }) => ( * * {lineItems.map((item) => ( * * * * ))} * * )} * * ``` */ export declare function LineItems(props: LineItemsProps): React.ReactNode; /** * Context value for LineItem components */ export interface LineItemContextValue { lineItem: LineItem; currency: string; } /** * Hook to access the current LineItem from context. * Must be used within LineItemProvider. * * @throws Error if used outside of LineItemProvider context */ export declare function useLineItemContext(): LineItemContextValue; /** * Props for LineItemProvider */ export interface LineItemProviderProps { children: React.ReactNode; lineItem: LineItem; currency: string; } /** * Provider component used by repeaters to provide LineItem context. * Can be used by core consumers to create their own repeater. * * @component * @example * ```tsx * {lineItems.map((item) => ( * * {children} * * ))} * ``` */ export declare function LineItemProvider(props: LineItemProviderProps): React.ReactNode; /** * Props for ServiceOptions render prop component */ export interface ServiceOptionsProps { children: (options: ServicePaymentOptions) => React.ReactNode; } /** * Core component that exposes service payment options via render props. * Reads isOnline, isInPerson, isDeposit from the payment service signal. * * @component */ export declare function ServiceOptions(props: ServiceOptionsProps): React.ReactNode; /** * Props for LineItemInfo render prop component */ export interface LineItemInfoProps { children: (data: { lineItem: LineItem; currency: string; totalPrice: MoneyData | null; subtotal: MoneyData | null; tax: MoneyData | null; discount: MoneyData | null; deposit: MoneyData | null; customPrice: string | null; hasDiscount: boolean; hasDeposit: boolean; }) => React.ReactNode; } /** * Core component that provides access to line item info via render props. * Must be used within LineItemProvider. * * @component * @example * ```tsx * * {({ totalPrice, customPrice, lineItem }) => ( * * {customPrice ? {customPrice} : } * * )} * * ``` */ export declare function LineItemInfo(props: LineItemInfoProps): React.ReactNode;