UNPKG

@commercelayer/react-components

Version:
63 lines (62 loc) 2.03 kB
import { type JSX } from "react"; import type { BaseMetadataObject } from "../../typings/index"; import type { OrderCreate, Order } from "@commercelayer/sdk"; import type { DefaultChildrenType } from "../../typings/globals"; interface Props { children: DefaultChildrenType; /** * Metadata to add when creates a new order */ metadata?: BaseMetadataObject; /** * Attribute to add when creates/updates an order */ attributes?: OrderCreate; /** * ID of the order */ orderId?: string; /** * Callback called when the order is updated */ fetchOrder?: (order: Order) => void; /** * Indicate if Adyen gift card management is enabled */ manageAdyenGiftCard?: boolean; } /** * This component is responsible for fetching the order and store it in its context. * It also provides the `fetchOrder` callback that is triggered every time the order is updated (it returns the updated order object as argument). * When the order is not placed yet, its possible to pass the `metadata` and `attributes` props to update the order. * * <span title="Requirement" type="warning"> * Must be a child of the `<CommerceLayer>` component. <br /> * Can be a child of the `<OrderStorage>` component and receive the `orderId` from it. * </span> * * <span title="Children" type="info"> * `<AddToCartButton>`, * `<AdjustmentAmount>`, * `<CartLink>`, * `<CheckoutLink>`, * `<DiscountAmount>`, * `<GiftCardAmount>`, * `<HostedCart>`, * `<OrderNumber>`, * `<PaymentMethodAmount>`, * `<PlaceOrderButton>`, * `<PlaceOrderContainer>`, * `<PrivacyAndTermsCheckbox>`, * `<Shipping Amount>`, * `<SubTotalAmount>`, * `<TaxesAmount>`, * `<TotalAmount>`, * </span> * * <span title="Core API" type="info"> * Check the `orders` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/orders/object). * </span> */ export declare function OrderContainer(props: Props): JSX.Element; export default OrderContainer;