import type { PriceFormat } from "../Commerce/commerceTypes"; /** What the primary slot does: add, prompt for an option, notify, confirm an add, go to the bag, or edit the quantity in place. */ export type StickyBuyBarMode = "add" | "select-option" | "notify" | "added" | "go-to-bag" | "stepper"; /** `sticky` pins to the viewport bottom inside its scroll parent; `static` flows with the page, e.g. inside a phone frame. */ export type StickyBuyBarPosition = "sticky" | "static"; /** Every string the bar renders; override all of them for another language. */ export interface StickyBuyBarLabels { /** Accessible name of the landmark region. */ region: string; /** Primary button text in `add` mode; defaults to "Add to bag". */ add: string; /** Prompt shown when an option is still unpicked, e.g. "Select a size". */ selectOption: string; /** Primary button text in `notify` mode; defaults to "Notify me". */ notify: string; /** Short confirmation in the button while mode is `added`. */ added: string; /** Primary button text in `go-to-bag` mode; defaults to "Go to bag". */ goToBag: string; /** Secondary button text shown beside the primary when `onBuyNow` is set; defaults to "Buy now". */ buyNow: string; /** Screen-reader name of the busy button while `isLoading`. */ adding: string; } /** Mobile bottom bar: price on the left, one primary action on the right; the parent decides when it is `visible`. */ export interface StickyBuyBarProps extends PriceFormat { /** Selling price of the selected variant. */ price: number; /** List price; the strike and discount only render when it is above `price`. */ mrp?: number; /** State of the primary slot; the width never changes between states. */ mode?: StickyBuyBarMode; /** Controlled: slides in when true and out when false, and is removed from the tab order while out. Typically driven by an IntersectionObserver on the inline CTA. */ visible?: boolean; /** Defaults to "sticky". */ position?: StickyBuyBarPosition; /** Marks the primary as busy (aria-busy) and ignores further taps. */ isLoading?: boolean; /** `stepper` mode only: current quantity. */ quantity?: number; /** `stepper` mode only: fires with the new quantity. */ onQuantityChange?: (quantity: number) => void; /** `stepper` mode only: ceiling, e.g. the variant's remaining stock. */ maxQuantity?: number; /** Fires on the primary in `add` mode. */ onAddToBag?: () => void; /** Fires on the primary in `select-option` mode; the page should scroll the selector into view. */ onSelectOption?: () => void; /** Fires on the primary in `notify` mode. */ onNotify?: () => void; /** Fires on the primary in `go-to-bag` mode. */ onGoToBag?: () => void; /** Adds a secondary "Buy now" beside the primary in `add` mode when provided. */ onBuyNow?: () => void; /** Product name, so the stepper reads "Quantity of Slim-Fit Denim Jacket". */ itemLabel?: string; /** Per-key overrides merged over the English defaults. */ labels?: Partial; "data-testid"?: string; }