/** * @fileoverview Cart Coupon Components * * This module provides coupon-related components for cart functionality. * These components manage local coupon input state separately from applied coupons. */ import React from 'react'; /** * Props for Coupon Root component */ export interface CouponRootProps { /** Child components that will have access to coupon context */ children: React.ReactNode; /** Initial input value */ defaultValue?: string; } /** * Root component that provides coupon context to its children. * Manages local input state separately from the applied coupon in the cart. * Shows input/apply when no coupon is applied, shows coupon display when applied. * * @component * @example * ```tsx * * * Apply * * * ``` */ export declare const Root: React.ForwardRefExoticComponent>; /** * Props for Coupon.Input component */ export interface CouponInputProps { asChild?: boolean; placeholder?: string; className?: string; children?: React.ForwardRefRenderFunction void; }>; } /** * Coupon code input field. * Automatically hides when a coupon is already applied. * * @component * @example * ```tsx * // Must be used within Cart.Coupon.Root container * * * Apply * * * * // Custom rendering with asChild * * * {React.forwardRef(({value, onChange, ...props}, ref) => ( * onChange(e.target.value)} * className="px-3 py-2 border rounded-lg focus:ring-2 focus:ring-brand-primary" * /> * ))} * * * ``` */ export declare const Input: React.ForwardRefExoticComponent>; /** * Props for Coupon.Trigger component */ export interface CouponTriggerProps { asChild?: boolean; className?: string; children?: React.ReactNode | React.ForwardRefRenderFunction Promise; apply: (value: string) => Promise; }>; } /** * Apply coupon button. * Automatically hides when a coupon is already applied. * * @component * @example * ```tsx * // Must be used within Cart.Coupon.Root container * * * Apply * * * * // Custom rendering with asChild * * * * {React.forwardRef(({apply, disabled, isLoading, onClick, ...props}, ref) => ( * * {isLoading ? 'Applying...' : 'Apply'} * * ))} * * * ``` */ export declare const Trigger: React.ForwardRefExoticComponent>; /** * Props for Coupon.Clear component */ export interface CouponClearProps { asChild?: boolean; className?: string; children?: React.ReactNode | React.ForwardRefRenderFunction Promise; appliedCoupon: string | null; disabled: boolean; isLoading: boolean; }>; } /** * Display applied coupon with remove option. * Shows the applied coupon in a styled container with a remove button. * * @component * @example * ```tsx * // Must be used within Cart.Coupon.Root container * * * Apply * * * * // Custom rendering with asChild * * * {React.forwardRef(({onClick, disabled, isLoading, appliedCoupon, ...props}, ref) => ( * * Coupon: {appliedCoupon} * * {isLoading ? 'Removing...' : 'Remove'} * * * ))} * * * ``` */ export declare const Clear: React.ForwardRefExoticComponent>; /** * Props for Coupon.Raw component */ export interface CouponRawProps { /** Whether to render the raw component as a child */ asChild?: boolean; /** Render prop function that receives all coupon data and actions */ children: (props: { /** Applied coupon code if any */ appliedCoupon: string | null; /** Function to apply a coupon code */ apply: (code: string) => Promise; /** Function to remove the applied coupon */ remove: () => Promise; /** Whether coupon operations are loading */ isLoading: boolean; /** Error message if coupon operation failed */ error: string | null; }) => React.ReactNode; } /** * Raw component that exposes all coupon render props without any UI wrapper. * Provides direct access to all coupon functionality and state. * * @component * @example * ```tsx * * {({ appliedCoupon, apply, remove, isLoading, error }) => ( * * {appliedCoupon ? ( * * Applied: {appliedCoupon} * * {isLoading ? 'Removing...' : 'Remove'} * * * ) : ( * * { * if (e.key === 'Enter') { * apply(e.currentTarget.value); * } * }} * /> * apply('DISCOUNT10')} * disabled={isLoading} * > * {isLoading ? 'Applying...' : 'Apply Sample'} * * * )} * {error && {error}} * * )} * * ``` */ export declare const Raw: React.FC;