/** Ratings per star count, 1 to 5. */ export type RatingBreakdown = Record<1 | 2 | 3 | 4 | 5, number>; /** Every string the summary renders; override all of them for another language. */ export interface ReviewSummaryLabels { /** Section heading text. */ heading: string; /** Text of the write-a-review button. */ writeReview: string; /** Count line, given the total number of ratings. */ ratings: (count: number) => string; /** Heading of the no-ratings state. */ emptyTitle: string; /** Invitation text of the no-ratings state. */ emptyBody: string; /** Accessible name of one bar, given the star level and the share as a whole percentage. */ bar: (stars: number, percent: number) => string; } /** Average rating, count and a five-row distribution; scales down to an invitation when there are no ratings. */ export interface ReviewSummaryProps { /** Average rating from 0 to 5. */ rating: number; /** Total number of ratings. */ count: number; /** Counts per star; the bars show each row's share of their sum. */ breakdown?: RatingBreakdown; /** The distribution only appears at or above this many ratings, because bars on a handful of ratings mislead; defaults to 10. */ minRatingsForBars?: number; /** Shows a "Write a review" button when provided. */ onWriteReview?: () => void; /** Heading element id, so a "4.6 (412)" link elsewhere can scroll here and a region can be labelled by it. */ id?: string; /** Locale for number formatting; defaults to en-IN. */ locale?: string; /** Partial overrides of the default English strings. */ labels?: Partial; /** Test id on the root section. */ "data-testid"?: string; }