import {useShopActionInfiniteQuery} from '../../internal/reactQuery' import {useShopActions} from '../../internal/useShopActions' import { PaginatedDataHookOptionsBase, PaginatedDataHookReturnsBase, Shop, } from '../../types' export interface UseRecentShopsParams extends PaginatedDataHookOptionsBase {} export interface UseRecentShopsReturns extends PaginatedDataHookReturnsBase { /** * The recent shops returned from the query. */ shops: Shop[] | null } export const useRecentShops = ( params?: UseRecentShopsParams ): UseRecentShopsReturns => { const {getRecentShops} = useShopActions() const {skip = false, ...restParams} = params ?? {} const {data, ...rest} = useShopActionInfiniteQuery( ['recentShops', restParams], getRecentShops, restParams, {skip} ) return { ...rest, shops: data, } } /** * The `useRecentShops` hook fetches shops the user recently interacted with in the Shop app, ordered by recency. You can use this to create quick access to favorite stores or personalized shop recommendations. * @publicDocs */ export type UseRecentShopsGeneratedType = ( params?: UseRecentShopsParams ) => UseRecentShopsReturns