import {useShopActionInfiniteQuery} from '../../internal/reactQuery' import {useShopActions} from '../../internal/useShopActions' import { Product, PaginatedDataHookOptionsBase, PaginatedDataHookReturnsBase, } from '../../types' export interface UseRecommendedProductsParams extends PaginatedDataHookOptionsBase {} export interface UseRecommendedProductsReturns extends PaginatedDataHookReturnsBase { products: Product[] | null } /** * @param options - The options for the query */ export const useRecommendedProducts = ( params?: UseRecommendedProductsParams ): UseRecommendedProductsReturns => { const {getRecommendedProducts} = useShopActions() const {skip, ...shopActionParams} = params ?? {} const {data, ...rest} = useShopActionInfiniteQuery( ['recommendedProducts', shopActionParams], getRecommendedProducts, shopActionParams, {skip} ) return { ...rest, products: data, } } /** * The `useRecommendedProducts` hook fetches personalized product recommendations based on the user's shopping behavior, purchase history, and preferences in the Shop app. Recommendations may be empty for new users without sufficient activity. You can use this for personalized discovery sections, "You might like" carousels, or filling empty states with relevant products. Unlike `useRecentProducts` which shows browsing history, this hook provides algorithmic suggestions. * @publicDocs */ export type UseRecommendedProductsGeneratedType = ( params?: UseRecommendedProductsParams ) => UseRecommendedProductsReturns