import type { CommerceEngine } from '../../../../app/commerce-engine/commerce-engine.js'; import { type Controller } from '../../../controller/headless-controller.js'; import type { FetchProductsActionCreator } from '../common.js'; /** * The `Pagination` sub-controller is responsible for navigating between pages of results in a commerce interface. * * @group Sub-controllers * @category Pagination */ export interface Pagination extends Controller { /** * Navigates to a specific page. * * @param page - The page to navigate to. */ selectPage(page: number): void; /** * Navigates to the next page. */ nextPage(): void; /** * Navigates to the previous page. */ previousPage(): void; /** * Sets the page size. * * @param pageSize - The page size. */ setPageSize(pageSize: number): void; /** * Fetches the next page of products, and appends them to the current list of products. */ fetchMoreProducts(): void; /** * A scoped and simplified part of the headless state that is relevant to the `Pagination` sub-controller. */ state: PaginationState; } /** * @group Sub-controllers * @category Pagination */ export interface PaginationState { page: number; pageSize: number; totalEntries: number; totalPages: number; } export interface CorePaginationOptions { /** * For internal use by Headless. */ slotId?: string; /** * The number of products to fetch per page. */ pageSize?: number; } export interface CorePaginationProps { fetchProductsActionCreator: FetchProductsActionCreator; fetchMoreProductsActionCreator: FetchProductsActionCreator; options?: CorePaginationOptions; } export type PaginationOptions = Omit; export interface PaginationProps { options?: PaginationOptions; } /** * @internal * Creates a `Pagination` sub-controller instance. * * @param engine - The headless commerce engine. * @param props - The configurable `Pagination` sub-controller properties. * @returns A `Pagination` sub-controller instance. * */ export declare function buildCorePagination(engine: CommerceEngine, props: CorePaginationProps): Pagination;