import React from 'react'; import * as CoreGiftCard from './core/GiftCard.js'; import type { GiftCardServiceConfig, GiftCardProduct } from '../services/gift-card-service.js'; import { AsChildChildren } from '@wix/headless-utils/react'; import { WixMediaImage } from '@wix/headless-media/react'; /** * Props for the GiftCard root component */ export interface GiftCardRootProps { children: React.ReactNode; giftCardServiceConfig: GiftCardServiceConfig; } /** * Root component that provides the GiftCard service context. * Supports both SSR (with product in config) and client-side auto-fetch (empty config). * * @component * @example * ```tsx * // With SSR config * * * * * // Without config (auto-fetch) * * * * ``` */ export declare const Root: { (props: GiftCardRootProps): React.ReactNode; displayName: string; }; /** * Data exposed by the Raw component via render props */ export interface GiftCardRawData { /** The gift card product data, or null if not loaded */ giftCard: GiftCardProduct | null; /** Whether the gift card is currently loading */ isLoading: boolean; /** Error message if loading failed, or null */ error: string | null; } /** * Props for the GiftCard Raw component */ export interface RawProps { /** Whether to render as a child component - must be true for Raw */ asChild?: boolean; /** Render function that receives the gift card state */ children?: AsChildChildren; /** CSS classes to apply to the element */ className?: string; } /** * Provides direct access to the gift card data via render props. * Should be used only when you need full control over rendering all states. * For standard usage, use GiftCard.Loading and GiftCard.Error as siblings. * * @component * @example * ```tsx * // Full control with render props * * {({ giftCard, isLoading, error }) => { * if (isLoading) return
Loading gift card...
; * if (error) return
Error: {error}
; * return ( *
*

Gift Card: {giftCard.name}

*

ID: {giftCard.product_id}

*
* ); * }} *
* ``` */ export declare const Raw: React.ForwardRefExoticComponent>; /** * Props for the GiftCard Image component */ type ImageProps = Omit, 'src' | 'media'>; /** * Displays the gift card image using WixMediaImage * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * * * // asChild with react component * * {React.forwardRef(({src, ...props}, ref) => ( * * ))} * * ``` */ export declare const Image: React.ForwardRefExoticComponent & React.RefAttributes>; /** * Data exposed by the GiftCard Name component */ export interface GiftCardNameData { /** Gift card product name */ name: string; } /** * Props for GiftCard Name component */ export interface NameProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Displays the gift card product name with customizable rendering. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * *

* * * // asChild with react component * * {React.forwardRef(({ name, ...props }, ref) => ( *

* {name} *

* ))} *
* ``` */ export declare const Name: React.ForwardRefExoticComponent>; /** * Data exposed by the GiftCard Description component */ export interface GiftCardDescriptionData { /** Gift card product description */ description: string; } /** * Props for GiftCard Description component */ export interface DescriptionProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Renders the gift card product description. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * *

* * * // asChild with react component * * {React.forwardRef(({ description, ...props }, ref) => ( *

{description}

* ))} *
* ``` */ export declare const Description: React.ForwardRefExoticComponent>; /** * Props for GiftCard Loading component */ export interface LoadingProps { /** CSS classes to apply to the default element */ className?: string; /** Content to show while loading */ children?: React.ReactNode; } /** * Displays loading state indicator. * Only renders content when isLoading is true. * * @component * @example * ```tsx * * Loading... * * ``` */ export declare const Loading: React.ForwardRefExoticComponent>; /** * Props for GiftCard Error component */ export interface ErrorProps { /** CSS classes to apply to the default element */ className?: string; } /** * Displays error state. * Only renders when there's an error. * * @component * @example * ```tsx * * ``` */ export declare const Error: React.ForwardRefExoticComponent>; /** * Data exposed by the PresetVariants component via render props */ export interface PresetVariantsData { /** Array of preset variants */ presetVariants: CoreGiftCard.PresetVariantItemData[]; } /** * Props for the PresetVariants component */ export interface PresetVariantsProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild, or ReactNode for default rendering */ children?: React.ReactNode | AsChildChildren; /** CSS classes to apply to the default element */ className?: string; /** Label displayed above the variants */ label?: string; /** Empty state to display when no variants are available */ emptyState?: React.ReactNode; } /** * Container component for preset variant selection. * Provides label and empty state support. * * @component * @example * ```tsx * // With label and empty state * No variants}> * * * * * * ``` */ export declare const PresetVariants: React.ForwardRefExoticComponent>; /** * Props for the PresetVariantRepeater component */ export interface PresetVariantRepeaterProps { /** Children to render for each preset variant */ children: React.ReactNode; /** CSS classes to apply to each variant container */ className?: string; } /** * Repeater component that renders children for each preset variant. * Creates a PresetVariant context for each variant that child components can access. * * @component * @example * ```tsx * * * * ``` */ export declare const PresetVariantRepeater: { (props: PresetVariantRepeaterProps): React.ReactNode; displayName: string; }; /** * Data exposed by the PresetVariant.Amount component via render props */ export interface PresetVariantAmountData { /** Variant ID */ id: string; /** Price amount as number (what the customer pays) */ price: number; /** Original value as number (what the gift card is worth) */ value: number; /** Whether this variant has a discount (price < value) */ hasDiscount: boolean; /** Whether this variant has a custom image */ hasImage: boolean; /** Whether this variant is currently selected */ isSelected: boolean; /** Currency code for Money formatting */ currencyCode: string; /** Locale code for Money formatting */ locale: string; } /** * Props for the PresetVariant.Amount component */ export interface PresetVariantAmountProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the button */ className?: string; } /** == * PresetVariant namespace containing preset variant sub-components */ export declare const PresetVariant: { readonly Amount: React.ForwardRefExoticComponent>; }; /** * Data exposed by the CurrentPrice component via render props. * Contains raw numeric amounts - use Money component for formatting. */ export interface GiftCardCurrentPriceData { /** Price amount as number (what the customer pays) */ price: number; /** Original value as number (what the gift card is worth) */ value: number; /** Whether current selection has a discount (price < value) */ hasDiscount: boolean; /** Currency code from service config (e.g., "ILS", "USD") */ currencyCode: string; /** Locale code from service config (e.g., "en-US", "he-IL") */ locale: string; } /** * Props for the GiftCard CurrentPrice component */ export interface CurrentPriceProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild, or ReactNode for default rendering */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Displays the current price based on the selected variant (preset or custom amount). * Uses the Money component for formatting. Supports discount display when price differs from value. * * Price vs Value: * - `price` - What the customer pays (raw number) * - `value` - What the gift card is worth (raw number) * - `hasDiscount` - `true` when `price < value`, indicating a discounted variant * * @component * @example * ```tsx * // Default usage - shows price, with strikethrough value when discounted * * * // asChild with primitive * * * * * // asChild with react component for full control * * {React.forwardRef(({ price, value, hasDiscount, currencyCode, ...props }, ref) => ( *
* {hasDiscount && ( * * )} * *
* ))} *
* ``` */ export declare const CurrentPrice: React.ForwardRefExoticComponent>; /** * Data exposed by the CustomVariantTrigger component via render props */ export interface GiftCardCustomVariantTriggerData { /** Whether the custom variant is currently selected */ isSelected: boolean; /** Function to select the custom variant */ onClick: () => void; } /** * Props for the GiftCard CustomVariantTrigger component */ export interface CustomVariantTriggerProps { /** Label text for the trigger button */ label?: string; /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild, or ReactNode for default rendering */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Trigger button for selecting custom amount option. * Use alongside PresetVariantRepeater to allow custom amounts. * Only renders when custom variant is enabled for the gift card. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * ))} * * ``` */ export declare const CustomVariantTrigger: React.ForwardRefExoticComponent>; /** * Data exposed by the CustomAmountInput component via render props */ export interface GiftCardCustomAmountInputData { /** Current custom amount value (defaults to 0) */ value: number; /** Function to update the custom amount */ setValue: (amount: number) => void; /** Minimum allowed amount (null if no minimum) */ min: number | null; /** Maximum allowed amount (null if no maximum) */ max: number | null; /** Whether the current value is valid (within min/max range) */ isValid: boolean; /** Whether the form has been submitted */ isFormSubmitted: boolean; /** Whether the input should be visible (custom variant is selected) */ isVisible: boolean; /** Currency code from service config (e.g., "ILS", "USD") */ currencyCode: string; /** Currency symbol derived from currency code (e.g., "$", "€", "₪") */ currencySymbol: string; } /** * Props for the GiftCard CustomAmountInput component */ export interface CustomAmountInputProps { /** Label for the input */ label?: string; /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild, or ReactNode for default rendering */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Input for entering a custom gift card amount. * Only renders when custom variant is selected. * The custom amount changes the currentPrice value displayed by GiftCard.CurrentPrice. * * Validation: * - Amount must be within min/max range defined by the product's custom variant * - data-invalid attribute is applied when isFormSubmitted is true and amount is outside the allowed range * - The isFormSubmitted flag is controlled by the checkout service (set to true after form submission attempts) * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * * * // asChild with react component with validation error display * * {React.forwardRef(({ value, setValue, min, max, isValid, isFormSubmitted, isVisible, currencyCode, ...props }, ref) => * isVisible && ( *
* * setValue(parseFloat(e.target.value) || 0)} * min={min ?? undefined} * max={max ?? undefined} * data-invalid={isFormSubmitted && !isValid} * /> * {isFormSubmitted && !isValid && ( *

* {min && max * ? `Amount must be between ${min} and ${max}` * : min * ? `Amount must be at least ${min}` * : max * ? `Amount must be no more than ${max}` * : 'Please enter a valid amount'} *

* )} *
* ) * )} *
* ``` */ export declare const CustomAmountInput: React.ForwardRefExoticComponent>; /** * Data exposed by the Quantity component via render props */ export interface GiftCardQuantityData { /** Current quantity value */ quantity: number; /** Function to set quantity value */ setQuantity: (quantity: number) => void; } /** * Props for the GiftCard Quantity component */ export interface QuantityProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the container */ className?: string; /** How much to increment/decrement (default: 1) */ steps?: number; /** Label displayed above the quantity input */ label?: string; } /** * Container for quantity selection controls. * Renders a Quantity.Root from @wix/headless-components connected to the gift card service state. * * Use with Quantity.Decrement, Quantity.Input, Quantity.Increment components from @wix/headless-components. * * @component * @example * ```tsx * import { Quantity } from '@wix/headless-components/react'; * * // Default usage - renders built-in Quantity components * * * // With label and custom styling * * * // asChild with custom Quantity children (use platform Quantity components) * * {({ quantity, setQuantity }) => ( * * * * * * )} * * * // asChild with fully custom implementation * * {React.forwardRef(({ quantity, setQuantity, ...props }, ref) => ( *
* * * {quantity} * * *
* ))} *
* ``` */ export declare const Quantity: React.ForwardRefExoticComponent>; /** * Data exposed by the GiftToggle component via render props */ export interface GiftCardGiftToggleData { /** Whether this is a gift purchase (for someone else) */ isGift: boolean; /** Function to set whether this is a gift purchase */ setIsGift: (value: boolean) => void; } /** * Props for the GiftCard GiftToggle component */ export interface GiftToggleProps { /** Label displayed above the toggle (optional) */ label?: string; /** Label for "For someone else" option */ forSomeoneLabel?: string; /** Label for "For myself" option */ forMyselfLabel?: string; /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Toggle between "For someone else" (gift) and "For myself" purchase modes. * When isGift is true, the recipient form should be shown. * When isGift is false, the recipient form should be hidden. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * *
* * * // asChild with react component * * {React.forwardRef(({ isGift, setIsGift, ...props }, ref) => ( *
*

Who is the gift card for?

*
* * *
*
* ))} *
* ``` */ export declare const GiftToggle: React.ForwardRefExoticComponent>; /** * Data exposed by the RecipientEmail component via render props */ export interface GiftCardRecipientEmailData { /** Current email value */ value: string; /** Function to update the email value */ setValue: (value: string) => void; /** Whether the email is valid */ isValid: boolean; /** Whether the form has been submitted */ isFormSubmitted: boolean; /** Whether the input should be visible (isGift is true) */ isVisible: boolean; } /** * Props for the GiftCard RecipientEmail component */ export interface RecipientEmailProps { /** Label for the email input */ label?: string; /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Input for entering recipient email address. * Provides email state, validation, and error display control. * * The `isFormSubmitted` flag is controlled by the checkout service and indicates * whether the form has been submitted * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * * * // asChild with react component * * {React.forwardRef(({ value, setValue, isValid, isFormSubmitted, ...props }, ref) => ( *
* * setValue(e.target.value)} * data-invalid={isFormSubmitted && !isValid} * className="w-full p-3 border-2 rounded-lg data-[invalid]:border-status-error" * /> * {isFormSubmitted && !isValid && ( *

Please enter a valid email

* )} *
* ))} *
* ``` */ export declare const RecipientEmail: React.ForwardRefExoticComponent>; /** * Data exposed by the RecipientName component via render props */ export interface GiftCardRecipientNameData { /** Current name value */ value: string; /** Function to update the name value */ setValue: (value: string) => void; /** Whether the input should be visible (isGift is true) */ isVisible: boolean; } /** * Props for the GiftCard RecipientName component */ export interface RecipientNameProps { /** Label for the name input */ label?: string; /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Input for entering recipient name. * Only renders when isGift is true (purchasing for someone else). * This field is optional - no validation is required. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * * * // asChild with react component * * {React.forwardRef(({ value, setValue, isVisible, ...props }, ref) => * isVisible && ( *
* * setValue(e.target.value)} * className="w-full p-3 border-2 rounded-lg" * /> *
* ) * )} *
* ``` */ export declare const RecipientName: React.ForwardRefExoticComponent>; /** * Data exposed by the RecipientDate component via render props */ export interface GiftCardRecipientDateData { /** Current delivery date value */ value: Date; /** Formatted date string according to locale (e.g., "Dec 25, 2025") */ formattedValue: string; /** Date value formatted for HTML date input (YYYY-MM-DD) */ inputValue: string; /** Function to update the delivery date */ setValue: (date: Date) => void; /** Whether the input should be visible (isGift is true) */ isVisible: boolean; } /** * Props for the GiftCard RecipientDate component */ export interface RecipientDateProps { /** Label for the date input */ label?: string; /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Input for selecting gift card delivery date. * Only renders when isGift is true (purchasing for someone else). * Provides both raw Date value and locale-formatted string. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * * * // asChild with react component - using inputValue for date input and formattedValue for display * * {React.forwardRef(({ value, formattedValue, inputValue, setValue, isVisible, ...props }, ref) => * isVisible && ( *
* * setValue(new Date(e.target.value))} * className="w-full p-3 border-2 rounded-lg" * /> *

Selected: {formattedValue}

*
* ) * )} *
* ``` */ export declare const RecipientDate: React.ForwardRefExoticComponent>; /** * Data exposed by the RecipientMessage component via render props */ export interface GiftCardRecipientMessageData { /** Current message value */ value: string; /** Function to update the message value */ setValue: (value: string) => void; /** Whether the input should be visible (isGift is true) */ isVisible: boolean; } /** * Props for the GiftCard RecipientMessage component */ export interface RecipientMessageProps { /** Label for the message textarea */ label?: string; /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren; /** CSS classes to apply to the default element */ className?: string; } /** * Textarea for entering a personal message to include with the gift card. * Only renders when isGift is true (purchasing for someone else). * This field is optional - no validation is required. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * *