UNPKG

@commercelayer/react-components

Version:
36 lines (35 loc) 1.13 kB
import type { Order } from "@commercelayer/sdk"; import { type JSX, type ReactNode } from "react"; import type { BaseError } from "../../typings/errors"; import type { ChildrenFunction } from "../../typings/index"; interface ChildrenProps extends Omit<Props, "children"> { /** * Callback function to place the order */ handleClick: () => Promise<void>; } interface Props extends Omit<JSX.IntrinsicElements["button"], "children" | "onClick"> { children?: ChildrenFunction<ChildrenProps>; /** * The label of the button */ label?: string | ReactNode; /** * The label of the button when it's loading */ loadingLabel?: string | ReactNode; /** * If false, the button doesn't place the order automatically. Default: true */ autoPlaceOrder?: boolean; /** * Callback function that is fired when the button is clicked */ onClick?: (response: { placed: boolean; order?: Order; errors?: BaseError[]; }) => void; } export declare function PlaceOrderButton(props: Props): JSX.Element; export default PlaceOrderButton;