import type { OptionAxis, PriceFormat, StockState, VariantSelection } from "../Commerce/commerceTypes"; /** Row is the full bag line with controls; compact is read-only for a mini-bag or order review. */ export type CartItemLayout = "row" | "compact"; /** Every visible string; override for another language. */ export interface CartItemLabels { /** Text and accessible name of the move-to-wishlist action; default "Move to wishlist". */ moveToWishlist: string; /** Text and accessible name of the remove action; default "Remove". */ remove: string; /** Shown instead of the price when `unavailable`. */ outOfStock: string; /** Muted line under the out-of-stock state. */ notIncluded: string; /** Compact layout quantity text, given the quantity. */ quantity: (quantity: number) => string; /** Muted unit price under a multi-unit line total, given the formatted unit price. */ each: (price: string) => string; /** Delivery line, given `deliveryBy`. */ delivery: (date: string) => string; } /** One bag line: thumbnail, title, chosen options, line total, quantity and actions. Totals are computed here, so pass unit prices. */ export interface CartItemProps extends PriceFormat { /** Product name, clamped to two lines; also names the quantity stepper and action buttons for screen readers. */ title: string; /** Muted single line above the title. */ brand?: string; /** Makes the title a link to the product page. */ href?: string; /** Makes the title a button when there is no `href`, for client-side routing. */ onTitleClick?: () => void; /** Product image URL, shown 4:5. */ image?: string; /** Empty by default: the title beside the image already names it. */ imageAlt?: string; /** With `selection`, builds the "Indigo Wash ยท M" line from the chosen option labels. */ axes?: OptionAxis[]; /** Chosen option per axis, read against `axes` to build the options line. */ selection?: VariantSelection; /** Replaces the line built from `axes` and `selection`. */ optionsSummary?: string; /** Selling price of one unit; the line total is `price * quantity`. */ price: number; /** List price of one unit; the strike only shows when it is above `price`. */ mrp?: number; /** Units on this line; the line total is `price * quantity`. Controlled: update it from `onQuantityChange`. */ quantity: number; /** Called with the new quantity when the stepper changes it; never fires in the compact layout, which has no stepper. */ onQuantityChange?: (quantity: number) => void; /** Lowest quantity; at this value the minus becomes a trash button when `onRemove` is set. */ minQuantity?: number; /** Highest quantity, usually the stock on hand. */ maxQuantity?: number; /** Adds the Remove action (row layout) and turns the stepper's minus into a trash at `minQuantity`. */ onRemove?: () => void; /** Adds the "Move to wishlist" action. */ onMoveToWishlist?: () => void; /** Availability line under the price, e.g. low-stock. Omit for in-stock lines. */ stock?: StockState; /** Units left, shown for `low-stock`. */ stockCount?: number; /** Replaces the default stock words. */ stockMessage?: string; /** Pre-formatted date, e.g. "Thu, 9 Oct"; rendered as "Delivery by Thu, 9 Oct". */ deliveryBy?: string; /** Dims the image, drops price and stepper and keeps only Remove. */ unavailable?: boolean; /** "row" or "compact"; default "row". */ layout?: CartItemLayout; /** Skeleton of the same shape; actions are not rendered. */ isLoading?: boolean; /** Per-string copy overrides; unset keys keep the English defaults. */ labels?: Partial; "data-testid"?: string; }