import { CmsItemServiceConfig, type WixDataItem } from '../../services/cms-item-service.js'; import { LinkItemParams } from '../../services/cms-collection-service.js'; export interface RootProps { children: (props: RootRenderProps) => React.ReactNode; itemServiceConfig: CmsItemServiceConfig; } /** * Render props exposed by CmsItem.Root */ export interface RootRenderProps { /** Current item data */ item: WixDataItem; /** Boolean indicating if the item is 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; /** The collection ID for this item */ collectionId: string; /** Function to update the current item */ updateItem: (itemData: Partial) => Promise; /** Function to delete the current item */ deleteItem: () => Promise; /** Function to insert a reference between the current item and other items */ linkItem: (params: LinkItemParams) => Promise; /** Function to remove a reference between the current item and other 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; } /** * Core Root component that provides CMS Item functionality via render props. * This component sets up the necessary services and exposes all item operations * and state through a render prop function. * * @example * ```tsx * * {({ item, loading, updateItem, deleteItem }) => ( *
* {loading ? ( *
Loading...
* ) : ( * <> *

{item?.title}

* * * * )} *
* )} *
* ``` */ export declare function Root(props: RootProps): React.ReactNode; /** * Render props exposed by CoreCmsItem.Action.AddToCart */ export interface ActionAddToCartRenderProps { /** CMS App ID for e-commerce integration */ appId: string; /** Collection ID */ collectionId: string; /** Item ID */ itemId: string; } /** * Props for CoreCmsItem.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 items. * Uses the CmsItem service to get item and collection information. */ export declare function ActionAddToCart(props: ActionAddToCartProps): React.ReactNode; /** * Render props exposed by CoreCmsItem.Action.BuyNow */ export interface ActionBuyNowRenderProps { /** CMS App ID for e-commerce integration */ appId: string; /** Collection ID */ collectionId: string; /** Item ID */ itemId: string; } /** * Props for CoreCmsItem.Action.BuyNow component */ export interface ActionBuyNowProps { /** Render function that receives action data */ children: (props: ActionBuyNowRenderProps) => React.ReactNode; } /** * Core Buy Now action component for CMS items. * Uses the CmsItem service to get item and collection information. */ export declare function ActionBuyNow(props: ActionBuyNowProps): React.ReactNode; /** * Namespace containing all CMS item action components. */ export declare const Action: { /** Add to Cart action component */ readonly AddToCart: typeof ActionAddToCart; /** Buy Now action component */ readonly BuyNow: typeof ActionBuyNow; };