import { CmsCollectionServiceConfig, type WixDataItem, type WixDataQueryResult, type LinkItemParams } from '../../services/cms-collection-service.js'; export interface RootProps { children: (props: RootRenderProps) => React.ReactNode; collectionServiceConfig: CmsCollectionServiceConfig; } /** * Render props exposed by CmsCollection.Root */ export interface RootRenderProps { /** Boolean indicating if items are currently being loaded for the first time (no data exists yet) */ loading: boolean; /** Boolean indicating if any fetch operation is currently in progress */ fetching: boolean; /** Error message, or null if no error */ error: string | null; /** Current query result with pagination data */ queryResult: WixDataQueryResult | null; /** Function to explicitly invalidate and reload items */ invalidate: () => Promise; /** Function to load items with optional query options */ loadItems: (options?: { limit?: number; skip?: number; returnTotalCount?: boolean; }) => Promise; /** Function to navigate to the next page of results */ nextPage: () => Promise; /** Function to navigate to the previous page of results */ prevPage: () => Promise; /** Function to create a new item in the collection */ createItem: (itemData: Partial) => Promise; /** Function to insert a reference between items */ linkItem: (params: LinkItemParams) => Promise; /** Function to update an existing item in the collection */ updateItem: (itemId: string, itemData: Partial) => Promise; /** Function to delete an item from the collection */ deleteItem: (itemId: string) => Promise; /** Function to remove a reference between items */ unlinkItem: (params: LinkItemParams) => Promise; /** Function to fetch options for a field (referenced items or distinct values) */ fetchFieldOptions: (fieldId: string) => Promise; /** Function to create a new item in a referenced collection */ createReferencedCollectionItem: (referenceFieldId: string, itemData: Partial) => Promise; /** The collection ID */ collectionId: string; } /** * Core Root component that provides CMS Collection functionality via render props. * This component sets up the necessary services and exposes all collection operations * and state through a render prop function. * * @example * ```tsx * * {({ queryResult, loading, createItem, updateItem }) => ( *
* {loading ? ( *
Loading...
* ) : ( * <> * {queryResult?.items.map(item => ( *
{item.title}
* ))} * * * )} *
* )} *
* ``` */ export declare function Root(props: RootProps): React.ReactNode; /** * Render props exposed by CoreCmsCollection.Action.AddToCart */ export interface ActionAddToCartRenderProps { /** CMS App ID for e-commerce integration */ appId: string; /** Collection ID */ collectionId: string; } /** * Props for CoreCmsCollection.Action.AddToCart component */ export interface ActionAddToCartProps { /** Render function that receives action data */ children: (props: ActionAddToCartRenderProps) => React.ReactNode; } /** * Core Add to Cart action component for CMS collection items. * Uses the CmsCollection service to get collection information. */ export declare function ActionAddToCart(props: ActionAddToCartProps): React.ReactNode; /** * Render props exposed by CoreCmsCollection.Action.BuyNow */ export interface ActionBuyNowRenderProps { /** CMS App ID for e-commerce integration */ appId: string; /** Collection ID */ collectionId: string; } /** * Props for CoreCmsCollection.Action.BuyNow component */ export interface ActionBuyNowProps { /** Quantity to purchase (defaults to 1) */ quantity?: number; /** Render function that receives action data */ children: (props: ActionBuyNowRenderProps) => React.ReactNode; } /** * Core Buy Now action component for CMS collection items. * Uses the CmsCollection service to get collection information. */ export declare function ActionBuyNow(props: ActionBuyNowProps): React.ReactNode; /** * Namespace containing all CMS collection action components. */ export declare const Action: { /** Add to Cart action component */ readonly AddToCart: typeof ActionAddToCart; /** Buy Now action component */ readonly BuyNow: typeof ActionBuyNow; };