import type { PriceFormat } from "../Commerce/commerceTypes"; /** How a line is inked: default is body ink, success for discounts, muted for secondary lines. */ export type OrderSummaryTone = "default" | "success" | "muted"; /** One row of the breakdown. Negative numbers render as a deduction ("−₹500") in the success tone. */ export interface OrderSummaryLine { /** Stable key; falls back to the label. */ id?: string; /** Row text on the left; the fallback key when `id` is omitted. */ label: string; /** A number is formatted as a price; a string is shown as is, e.g. "Calculated at checkout". */ amount: number | string; /** Ink of the row; a negative amount, a free line and "success" all use the success tone. */ tone?: OrderSummaryTone; /** Muted line under the label, e.g. "Applied: WELCOME10". */ hint?: string; /** Shows "FREE" in the success tone when `amount` is 0. */ freeWhenZero?: boolean; } /** Progress toward a free-delivery threshold, in the same currency as the lines. */ export interface FreeShippingProgress { /** Subtotal at which free delivery unlocks. */ threshold: number; /** Eligible subtotal so far; at or above `threshold` the line reads as unlocked. */ current: number; } /** Visible copy; override every string for another language. */ export interface OrderSummaryLabels { /** Panel heading, also the accessible name when `hideTitle` is set. */ title: string; /** Label beside the large total. */ total: string; /** Shown instead of a number when `amount` is 0 on a `freeWhenZero` line. */ free: string; /** Banner text, given the formatted saving. */ savings: (amount: string) => string; /** Progress text while below the threshold, given the formatted shortfall. */ addMore: (amount: string) => string; /** Progress text once the threshold is met. */ unlocked: string; /** Accessible name of the progress bar. */ progressLabel: string; } /** Price breakdown for the bag and checkout: lines, a large tabular total, optional savings banner and free-delivery progress. Flows in the page, so it is sticky-friendly. */ export interface OrderSummaryProps extends PriceFormat { /** Breakdown rows in order, above the total. */ lines: OrderSummaryLine[]; /** Grand total, formatted as a price in the large tabular figure. */ total: number; /** Total saved on the order; the banner is hidden at 0 or when omitted. */ savings?: number; /** Muted line under the total, e.g. "Inclusive of all taxes". */ taxNote?: string; /** Shows a progress bar and message above the panel; reads unlocked once `current` reaches `threshold`. */ freeShippingProgress?: FreeShippingProgress; /** Hides the "Price details" heading when the page already has one. */ hideTitle?: boolean; /** Skeleton of the same shape; the total and lines are not rendered. */ isLoading?: boolean; /** Partial overrides of the default English strings. */ labels?: Partial; /** Test id on the outer wrapper. */ "data-testid"?: string; }