UNPKG

1.36 kBTypeScriptView Raw
1import { ComponentClass } from 'react';
2import { CommerceTypes, FetchDataFunction, ReviewDataSource, ReviewTypes, WithCommerceProps, WithCommerceProviderProps } from '@brandingbrand/fscommerce';
3export declare type CommerceToReviewMapFunction<T extends CommerceTypes.Product = CommerceTypes.Product> = (product: T) => string;
4export interface WithProductDetailProviderProps<T extends CommerceTypes.Product = CommerceTypes.Product> extends WithCommerceProviderProps<T> {
5 commerceToReviewMap: keyof T | CommerceToReviewMapFunction<T>;
6 reviewDataSource?: ReviewDataSource;
7}
8export declare type WithProductDetailProps<T extends CommerceTypes.Product = CommerceTypes.Product> = WithCommerceProps<T> & {
9 reviewsData?: ReviewTypes.ReviewDetails[];
10};
11export declare type WithProductDetailState<T extends CommerceTypes.Product = CommerceTypes.Product> = Pick<WithCommerceProps<T>, 'commerceData'> & {
12 reviewsData?: ReviewTypes.ReviewDetails[];
13};
14export declare type ProductDetailWrapper<P, T extends CommerceTypes.Product = CommerceTypes.Product> = (WrappedComponent: ComponentClass<P & WithProductDetailProps<T>>) => ComponentClass<P & WithProductDetailProviderProps<T>>;
15export default function withProductDetailData<P, T extends CommerceTypes.Product = CommerceTypes.Product>(fetchProduct: FetchDataFunction<P, T>): ProductDetailWrapper<P, T>;