/** * Generate structured data for Review snippets and `AggregateRating`. * * Accepts a compact `ReviewSnippetOptions` object and returns a plain object * compatible with schema.org JSON-LD for embedding in a page. The function * supports formatting `Person` and `Organization` references and can produce * an `AggregateRating` object either from supplied options or derived from * reviews. * * See the TypeScript interfaces below for the exact input shape. * @returns A JSON-LD compatible Review / ReviewSnippet object */ interface PersonRef { name: string; url?: string; } interface OrgRef { name: string; url?: string; } interface RatingItem { ratingValue: number | string; bestRating?: number | string; worstRating?: number | string; } interface ReviewItem { author?: string | PersonRef; datePublished?: string; reviewBody?: string; reviewRating?: RatingItem; name?: string; url?: string; publisher?: string | OrgRef; } interface AggregateRatingOptions { ratingValue: number | string; reviewCount?: number; ratingCount?: number; bestRating?: number | string; worstRating?: number | string; } interface ReviewSnippetOptions { itemReviewed?: string | { name: string; '@type'?: string; }; reviews?: ReviewItem[]; aggregateRating?: AggregateRatingOptions; } declare const generateReviewSnippetSchema: ({ itemReviewed, reviews, aggregateRating, }: ReviewSnippetOptions) => any; export { generateReviewSnippetSchema as default, generateReviewSnippetSchema };