import { type Signal } from '@wix/services-definitions/core-services/signals'; import { categories } from '@wix/categories'; export type Category = categories.Category; /** * Configuration interface for the Categories List service. * Contains the initial categories data that will be loaded into the service. * * @interface CategoriesListServiceConfig */ export type CategoriesListServiceConfig = { /** Array of category objects to initialize the service with */ categories: Category[]; }; /** * Service definition for the Categories List service. * This defines the reactive API contract for managing a list of product categories. * * @constant */ export declare const CategoriesListServiceDefinition: string & { __api: { /** Reactive signal containing the list of categories */ categories: Signal; /** Reactive signal indicating if categories are currently being loaded */ isLoading: Signal; /** Reactive signal containing any error message, or null if no error */ error: Signal; }; __config: CategoriesListServiceConfig; isServiceDefinition?: boolean; } & { /** Reactive signal containing the list of categories */ categories: Signal; /** Reactive signal indicating if categories are currently being loaded */ isLoading: Signal; /** Reactive signal containing any error message, or null if no error */ error: Signal; }; /** * Implementation of the Categories List service that manages reactive categories data. * This service provides signals for categories data, loading state, and error handling. * The service is initialized with pre-loaded categories and maintains them in reactive signals. * * @example * ```tsx * import { CategoriesListService, CategoriesListServiceDefinition } from '@wix/stores/services'; * import { useService } from '@wix/services-manager-react'; * * function CategoriesComponent({ categoriesConfig }) { * return ( * * * * ); * } * * function CategoriesDisplay() { * const categoriesService = useService(CategoriesListServiceDefinition); * const categories = categoriesService.categories.get(); * const isLoading = categoriesService.isLoading.get(); * const error = categoriesService.error.get(); * * if (isLoading) return
Loading categories...
; * if (error) return
Error: {error}
; * * return ( *
    * {categories.map(category => ( *
  • {category.name}
  • * ))} *
* ); * } * ``` */ export declare const CategoriesListService: import("@wix/services-definitions").ServiceFactory; /** Reactive signal indicating if categories are currently being loaded */ isLoading: Signal; /** Reactive signal containing any error message, or null if no error */ error: Signal; }; __config: CategoriesListServiceConfig; isServiceDefinition?: boolean; } & { /** Reactive signal containing the list of categories */ categories: Signal; /** Reactive signal indicating if categories are currently being loaded */ isLoading: Signal; /** Reactive signal containing any error message, or null if no error */ error: Signal; }, CategoriesListServiceConfig>; /** * Loads categories list service configuration from the Wix Categories API for SSR initialization. * This function is designed to be used during Server-Side Rendering (SSR) to preload * all visible product categories. The "all-products" category is automatically moved to the front of the list. * *
* * __Important:__ * * This function requires the @wix/categories app to be installed on your Wix site.
* If you receive an APP_NOT_INSTALLED error with app ID f534c0d3-dd59-4047-a86a-be3234d4591f, * ensure the Wix Categories service is properly provisioned on your site. * *
* @returns {Promise} Promise that resolves to the categories configuration * * @example Astro - SSR categories page * ```astro * --- * // Astro page example - pages/categories.astro * import { loadCategoriesListServiceConfig } from '@wix/stores/services'; * import { CategoryList } from '@wix/stores/components/react'; * * // Load categories data during SSR * const categoriesConfig = await loadCategoriesListServiceConfig(); * --- * * * * {({ category }) => ( *
*

{category.name}

*

{category.description}

*
* )} *
*
* ``` * * @example Next.js - SSR categories page * ```tsx * // Next.js page example - pages/categories.tsx * import { GetServerSideProps } from 'next'; * import { loadCategoriesListServiceConfig } from '@wix/stores/services'; * import { CategoryList } from '@wix/stores/components/react'; * * interface CategoriesPageProps { * categoriesConfig: Awaited>; * } * * export const getServerSideProps: GetServerSideProps = async () => { * const categoriesConfig = await loadCategoriesListServiceConfig(); * * return { * props: { * categoriesConfig, * }, * }; * }; * * export default function CategoriesPage({ categoriesConfig }: CategoriesPageProps) { * return ( * * * {({ category }) => ( *
*

{category.name}

*

{category.description}

*
* )} *
*
* ); * } * ``` */ export declare function loadCategoriesListServiceConfig(): Promise;