@commercelayer/react-components
Version:
The Official Commerce Layer React Components
35 lines (34 loc) • 1.24 kB
TypeScript
import { type ReactNode, type JSX } from 'react';
interface Props {
/**
* The children component
*/
children: ReactNode;
/**
* The sku code
*/
skuCode?: string;
/**
* The sku id. If you use this prop, the skuCode will be ignored and the sku will be fetched by id improving the performance
*/
skuId?: string;
/**
* Callback called when the quantity is updated
*/
getQuantity?: (quantity: number) => void;
}
/**
* Main container for the Availability components.
* It stores - in its context - the sku quantity returned from the `inventory_model` and the `delivery_lead_time` for the first shipping method found in the inventory model.
*
* It can be used to fetch the quantities for a specific `sku_code` passed as prop.
* <span title='Requirements' type='warning'>
* Must be a child of the `<CommerceLayer>` component. <br/>
* Can be a child of the `<SkusContainer>` component and receive the `sku_code` from its context.
* </span>
* <span title='Children' type='info'>
* `<AvailabilityTemplate>`
* </span>
*/
export declare function AvailabilityContainer({ children, skuCode, skuId, getQuantity }: Props): JSX.Element;
export default AvailabilityContainer;