import type { PriceFormat } from "../Commerce/commerceTypes"; import type { UnitPrice } from "../../Utils/price"; /** Price typography scale: sm for cards, md for rows and sticky bars, lg for the product page. */ export type PriceBlockSize = "sm" | "md" | "lg"; /** Cross-axis alignment of the price lines inside the block. */ export type PriceBlockAlign = "start" | "center" | "end"; /** Visually-hidden and visible copy; override every string for another language. */ export interface PriceBlockLabels { /** Screen-reader prefix before the selling price. */ price: string; /** Screen-reader prefix inside the struck MRP. */ originalPrice: string; /** Visible discount text, given the whole-number percentage. */ off: (percent: number) => string; /** Visible savings text, given the already-formatted amount. */ save: (amount: string) => string; } /** Selling price with struck MRP, discount, tax note and unit price; every figure comes from `Utils/price` helpers. */ export interface PriceBlockProps extends PriceFormat { /** Selling price; ignored when `priceRange` is set. */ price?: number; /** Original list price; the strike and discount only render when it is above `price`. */ mrp?: number; /** Shows "min – max" instead of a single price, e.g. for a product whose variants differ; hides the MRP and discount. */ priceRange?: { /** Lowest price, formatted first; equal to `max` shows a single price. */ min: number; /** Highest price, formatted after the dash. */ max: number; }; /** Typography scale; defaults to "md". */ size?: PriceBlockSize; /** Alignment of the lines; defaults to "start". */ align?: PriceBlockAlign; /** Adds a "You save ₹1,500" line under the price; needs `mrp`. */ showSavings?: boolean; /** Muted line under the price, e.g. "Inclusive of all taxes". */ taxNote?: string; /** A `unitPrice()` result (null renders nothing), or a ready-made string; rendered as "₹169.80 / 100 g". */ unitPrice?: UnitPrice | string | null; /** Overrides the default English copy; unset keys keep their default. */ labels?: Partial; /** Test id on the block's root. */ "data-testid"?: string; }