import type { ComponentClass } from 'react'; import type { CommerceTypes, FetchDataFunction, ReviewDataSource, ReviewTypes, WithCommerceProps, WithCommerceProviderProps } from '../../../libs/fscommerce'; export declare type CommerceToReviewMapFunction = (product: ProductType) => keyof ProductType; /** * Additional props that are consumed by the high order component. * * @template ProductType The type of product contained within the product index. Defaults to * `Product` * @template IdxType The type of product index data that will be provided. Defaults to * `ProductIndex` */ export interface WithProductIndexProviderProps = CommerceTypes.ProductIndex> extends WithCommerceProviderProps { reviewDataSource?: ReviewDataSource; commerceToReviewMap?: CommerceToReviewMapFunction | keyof ProductType; onReceiveCommerceData?: (data: IdxType) => void; disableReviews?: boolean; } /** * Additional props that will be provided to the wrapped component. * * @template ProductType The type of product contained within the product index. Defaults to * `Product` * @template IdxType The type of product index data that will be provided. Defaults to * `ProductIndex` */ export declare type WithProductIndexProps = CommerceTypes.ProductIndex> = WithCommerceProps & { reviewsData?: ReviewTypes.ReviewSummary[]; }; /** * The state of the ProductIndexProvider component which is passed to the wrapped component as a * prop. * * @template ProductType The type of product contained within the product index. Defaults to * `Product` * @template IdxType The type of product index data that will be provided. Defaults to * `ProductIndex` */ export interface WithProductIndexState = CommerceTypes.ProductIndex> extends Pick, 'commerceData'> { /** * Indicates that we've received new commerce data but have not yet requested and merged reviews * for that data */ reviewsData?: ReviewTypes.ReviewSummary[]; } /** * A function that wraps a a component and returns a new high order component. The wrapped * component will be given product index data as props. * * @template P The original props of the wrapped component. They'll be passed through unmodified. * @template ProductType The type of product contained within the product index. Defaults to * `Product` * @template IdxType The type of product index data that will be provided. Defaults to * `ProductIndex` * @param WrappedComponent A * component to wrap and provide product index data to as props. * @return A high order * component. */ export declare type ProductIndexWrapper = CommerceTypes.ProductIndex> = (WrappedComponent: ComponentClass

>) => ComponentClass

>; /** * Returns a function that wraps a component and returns a new high order component. The wrapped * component will be given product index data as props. * * @template P The original props of the wrapped component. They'll be passed through unmodified. * @template ProductType The type of product contained within the product index. Defaults to * `Product` * @template IdxType The type of product index data that will be provided. Defaults to * `ProductIndex` * @param fetchProducts A function that will return product index * data. * @return A function that wraps a component and returns a new high order * component. */ declare function withProductIndexData = CommerceTypes.ProductIndex>(fetchProducts: FetchDataFunction): ProductIndexWrapper; export default withProductIndexData;