@commercelayer/react-components 4.7.10 → 4.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/MetadataInput.d.ts +1 -0
- package/lib/cjs/components/addresses/Address.d.ts +18 -0
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +19 -0
- package/lib/cjs/components/addresses/AddressField.d.ts +22 -0
- package/lib/cjs/components/addresses/AddressInput.d.ts +26 -0
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +19 -0
- package/lib/cjs/components/addresses/AddressesContainer.d.ts +28 -0
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +13 -0
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +20 -0
- package/lib/cjs/components/addresses/SaveAddressesButton.js +1 -1
- package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +1 -0
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +17 -0
- package/lib/cjs/components/auth/CommerceLayer.d.ts +1 -0
- package/lib/cjs/components/customers/CustomerContainer.d.ts +20 -1
- package/lib/cjs/components/customers/CustomerField.d.ts +16 -0
- package/lib/cjs/components/customers/CustomerInput.d.ts +1 -0
- package/lib/cjs/components/customers/CustomerInput.js +1 -1
- package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +1 -0
- package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -0
- package/lib/cjs/components/customers/MyAccountLink.d.ts +11 -0
- package/lib/cjs/components/customers/MyIdentityLink.d.ts +16 -0
- package/lib/cjs/components/errors/Errors.d.ts +1 -0
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +1 -0
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -0
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -0
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -0
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItem.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemCode.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemField.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemImage.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemName.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemsContainer.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -0
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +1 -0
- package/lib/cjs/components/orders/AddToCartButton.d.ts +32 -0
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -0
- package/lib/cjs/components/orders/CartLink.d.ts +8 -0
- package/lib/cjs/components/orders/CartLink.js +1 -1
- package/lib/cjs/components/orders/CheckoutLink.d.ts +16 -0
- package/lib/cjs/components/orders/DiscountAmount.d.ts +1 -0
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -0
- package/lib/cjs/components/orders/HostedCart.d.ts +30 -8
- package/lib/cjs/components/orders/OrderContainer.d.ts +34 -0
- package/lib/cjs/components/orders/OrderList.d.ts +1 -0
- package/lib/cjs/components/orders/OrderListEmpty.d.ts +1 -0
- package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +1 -0
- package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +1 -0
- package/lib/cjs/components/orders/OrderListRow.d.ts +1 -0
- package/lib/cjs/components/orders/OrderNumber.d.ts +1 -0
- package/lib/cjs/components/orders/OrderStorage.d.ts +23 -0
- package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +1 -0
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -0
- package/lib/cjs/components/orders/ShippingAmount.d.ts +1 -0
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +1 -0
- package/lib/cjs/components/orders/TaxesAmount.d.ts +1 -0
- package/lib/cjs/components/orders/TotalAmount.d.ts +1 -0
- package/lib/cjs/components/parcels/ParcelField.d.ts +1 -0
- package/lib/cjs/components/parcels/ParcelLineItem.d.ts +1 -0
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +1 -0
- package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +1 -0
- package/lib/cjs/components/parcels/Parcels.d.ts +1 -0
- package/lib/cjs/components/parcels/ParcelsCount.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -0
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -0
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +1 -0
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +1 -0
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +1 -0
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +1 -0
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +1 -0
- package/lib/cjs/components/payment_source/ExternalPayment.d.ts +1 -0
- package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +1 -0
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +1 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +1 -0
- package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +1 -0
- package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +1 -0
- package/lib/cjs/components/payment_source/StripePayment.d.ts +1 -0
- package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +1 -0
- package/lib/cjs/components/prices/Price.d.ts +1 -0
- package/lib/cjs/components/prices/PricesContainer.d.ts +1 -0
- package/lib/cjs/components/shipments/ShipmentField.d.ts +1 -0
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +1 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +1 -0
- package/lib/cjs/components/skus/AvailabilityContainer.d.ts +13 -0
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +17 -3
- package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +1 -0
- package/lib/cjs/components/skus/SkuField.d.ts +14 -2
- package/lib/cjs/components/skus/Skus.d.ts +12 -0
- package/lib/cjs/components/skus/SkusContainer.d.ts +14 -1
- package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +1 -0
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +1 -0
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -0
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +1 -0
- package/lib/cjs/components/utils/GenericFieldComponent.d.ts +6 -0
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +1 -0
- package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -0
- package/lib/cjs/components/utils/getAllErrors.d.ts +1 -0
- package/lib/cjs/typings/globals.d.ts +1 -0
- package/lib/cjs/utils/filterChildren.d.ts +1 -0
- package/lib/cjs/utils/getLoaderComponent.d.ts +1 -0
- package/lib/cjs/utils/getPrices.d.ts +1 -0
- package/lib/esm/components/MetadataInput.d.ts +1 -0
- package/lib/esm/components/addresses/Address.d.ts +18 -0
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +19 -0
- package/lib/esm/components/addresses/AddressField.d.ts +22 -0
- package/lib/esm/components/addresses/AddressInput.d.ts +26 -0
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +19 -0
- package/lib/esm/components/addresses/AddressesContainer.d.ts +28 -0
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +13 -0
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +20 -0
- package/lib/esm/components/addresses/SaveAddressesButton.js +1 -1
- package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +1 -0
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +17 -0
- package/lib/esm/components/auth/CommerceLayer.d.ts +1 -0
- package/lib/esm/components/customers/CustomerContainer.d.ts +20 -1
- package/lib/esm/components/customers/CustomerField.d.ts +16 -0
- package/lib/esm/components/customers/CustomerInput.d.ts +1 -0
- package/lib/esm/components/customers/CustomerInput.js +1 -1
- package/lib/esm/components/customers/CustomerPaymentSource.d.ts +1 -0
- package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -0
- package/lib/esm/components/customers/MyAccountLink.d.ts +11 -0
- package/lib/esm/components/customers/MyIdentityLink.d.ts +16 -0
- package/lib/esm/components/errors/Errors.d.ts +1 -0
- package/lib/esm/components/gift_cards/GiftCard.d.ts +1 -0
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -0
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -0
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -0
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -0
- package/lib/esm/components/line_items/LineItem.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemCode.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemField.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemImage.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemName.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemsContainer.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -0
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +1 -0
- package/lib/esm/components/orders/AddToCartButton.d.ts +32 -0
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -0
- package/lib/esm/components/orders/CartLink.d.ts +8 -0
- package/lib/esm/components/orders/CartLink.js +1 -1
- package/lib/esm/components/orders/CheckoutLink.d.ts +16 -0
- package/lib/esm/components/orders/DiscountAmount.d.ts +1 -0
- package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -0
- package/lib/esm/components/orders/HostedCart.d.ts +30 -8
- package/lib/esm/components/orders/OrderContainer.d.ts +34 -0
- package/lib/esm/components/orders/OrderList.d.ts +1 -0
- package/lib/esm/components/orders/OrderListEmpty.d.ts +1 -0
- package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +1 -0
- package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +1 -0
- package/lib/esm/components/orders/OrderListRow.d.ts +1 -0
- package/lib/esm/components/orders/OrderNumber.d.ts +1 -0
- package/lib/esm/components/orders/OrderStorage.d.ts +23 -0
- package/lib/esm/components/orders/PaymentMethodAmount.d.ts +1 -0
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -0
- package/lib/esm/components/orders/ShippingAmount.d.ts +1 -0
- package/lib/esm/components/orders/SubTotalAmount.d.ts +1 -0
- package/lib/esm/components/orders/TaxesAmount.d.ts +1 -0
- package/lib/esm/components/orders/TotalAmount.d.ts +1 -0
- package/lib/esm/components/parcels/ParcelField.d.ts +1 -0
- package/lib/esm/components/parcels/ParcelLineItem.d.ts +1 -0
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +1 -0
- package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +1 -0
- package/lib/esm/components/parcels/Parcels.d.ts +1 -0
- package/lib/esm/components/parcels/ParcelsCount.d.ts +1 -0
- package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -0
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -0
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +1 -0
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +1 -0
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +1 -0
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +1 -0
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +1 -0
- package/lib/esm/components/payment_source/ExternalPayment.d.ts +1 -0
- package/lib/esm/components/payment_source/KlarnaPayment.d.ts +1 -0
- package/lib/esm/components/payment_source/PaymentSource.d.ts +1 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +1 -0
- package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +1 -0
- package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +1 -0
- package/lib/esm/components/payment_source/StripePayment.d.ts +1 -0
- package/lib/esm/components/payment_source/WireTransferPayment.d.ts +1 -0
- package/lib/esm/components/prices/Price.d.ts +1 -0
- package/lib/esm/components/prices/PricesContainer.d.ts +1 -0
- package/lib/esm/components/shipments/ShipmentField.d.ts +1 -0
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +1 -0
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -0
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -0
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +1 -0
- package/lib/esm/components/skus/AvailabilityContainer.d.ts +13 -0
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +17 -3
- package/lib/esm/components/skus/DeliveryLeadTime.d.ts +1 -0
- package/lib/esm/components/skus/SkuField.d.ts +14 -2
- package/lib/esm/components/skus/Skus.d.ts +12 -0
- package/lib/esm/components/skus/SkusContainer.d.ts +14 -1
- package/lib/esm/components/stock_transfers/StockTransfer.d.ts +1 -0
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +1 -0
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -0
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +1 -0
- package/lib/esm/components/utils/GenericFieldComponent.d.ts +6 -0
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +1 -0
- package/lib/esm/components/utils/PriceTemplate.d.ts +1 -0
- package/lib/esm/components/utils/getAllErrors.d.ts +1 -0
- package/lib/esm/typings/globals.d.ts +1 -0
- package/lib/esm/utils/filterChildren.d.ts +1 -0
- package/lib/esm/utils/getLoaderComponent.d.ts +1 -0
- package/lib/esm/utils/getPrices.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CartLink=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),getDomain_1=require("../../utils/getDomain"),events_1=require("../../utils/events");function CartLink(props){const{label,children,type,customDomain}=props,p=tslib_1.__rest(props,["label","children","type","customDomain"]),{order,createOrder}=(0,react_1.useContext)(OrderContext_1.default),{accessToken,endpoint}=(0,react_1.useContext)(CommerceLayerContext_1.default);if(accessToken==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");if(endpoint==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");const{domain,slug}=(0,getDomain_1.getDomain)(endpoint),href=slug&&order?.id?(0,getApplicationLink_1.getApplicationLink)({slug,orderId:order?.id,accessToken,domain,applicationType:"cart",customDomain}):void 0,handleClick=event=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(event.preventDefault(),type!=="mini")if(order?.id)location.href=href??"";else{const orderId=yield createOrder({});slug&&(location.href=(0,getApplicationLink_1.getApplicationLink)({slug,orderId,accessToken,domain,applicationType:"cart",customDomain}))}else(0,events_1.publish)("open-cart")}),parentProps=Object.assign({handleClick,label,href,orderId:order?.id,accessToken},p);return accessToken?children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("a",Object.assign({href
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CartLink=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),getDomain_1=require("../../utils/getDomain"),events_1=require("../../utils/events");function CartLink(props){const{label,children,type,customDomain}=props,p=tslib_1.__rest(props,["label","children","type","customDomain"]),{order,createOrder}=(0,react_1.useContext)(OrderContext_1.default),{accessToken,endpoint}=(0,react_1.useContext)(CommerceLayerContext_1.default);if(accessToken==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");if(endpoint==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");const{domain,slug}=(0,getDomain_1.getDomain)(endpoint),href=slug&&order?.id?(0,getApplicationLink_1.getApplicationLink)({slug,orderId:order?.id,accessToken,domain,applicationType:"cart",customDomain}):void 0,handleClick=event=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(event.preventDefault(),type!=="mini")if(order?.id)location.href=href??"";else{const orderId=yield createOrder({});slug&&(location.href=(0,getApplicationLink_1.getApplicationLink)({slug,orderId,accessToken,domain,applicationType:"cart",customDomain}))}else(0,events_1.publish)("open-cart")}),parentProps=Object.assign({handleClick,label,href,orderId:order?.id,accessToken},p);return accessToken?children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("a",Object.assign({href,onClick:e=>{handleClick(e)}},p,{children:label})):null}exports.CartLink=CartLink,exports.default=CartLink;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type ChildrenFunction } from '../../typings/index';
|
|
2
3
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
3
4
|
checkoutUrl: string;
|
|
@@ -5,8 +6,23 @@ interface ChildrenProps extends Omit<Props, 'children'> {
|
|
|
5
6
|
}
|
|
6
7
|
interface Props extends Omit<JSX.IntrinsicElements['a'], 'children'> {
|
|
7
8
|
children?: ChildrenFunction<ChildrenProps>;
|
|
9
|
+
/**
|
|
10
|
+
* Label for the checkout link
|
|
11
|
+
*/
|
|
8
12
|
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Ignores `order.checkout_url` and redirects to the hosted checkout micro-frontend.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
9
17
|
hostedCheckout?: boolean;
|
|
10
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* This component generates a link to the hosted mfe-checkout application.
|
|
21
|
+
* In this way you can connect your shop application with our hosted micro-frontend.
|
|
22
|
+
*
|
|
23
|
+
* By default it will takes the customer to our hosted checkout micro-frontend,
|
|
24
|
+
* but if `hostedCheckout` is set as `false` it will use the `checkout_url` attribute
|
|
25
|
+
* found in the `order` object.
|
|
26
|
+
*/
|
|
11
27
|
export declare function CheckoutLink(props: Props): JSX.Element;
|
|
12
28
|
export default CheckoutLink;
|
|
@@ -7,30 +7,52 @@ interface Styles {
|
|
|
7
7
|
iconContainer?: CSSProperties;
|
|
8
8
|
}
|
|
9
9
|
interface Props extends Omit<JSX.IntrinsicElements['div'], 'children' | 'style'> {
|
|
10
|
+
/**
|
|
11
|
+
* The style of the cart.
|
|
12
|
+
*/
|
|
13
|
+
style?: Styles;
|
|
14
|
+
/**
|
|
15
|
+
* The domain of your forked application.
|
|
16
|
+
*/
|
|
17
|
+
customDomain?: string;
|
|
10
18
|
/**
|
|
11
19
|
* The type of the cart. Defaults to undefined.
|
|
12
20
|
*/
|
|
13
21
|
type?: 'mini';
|
|
14
22
|
/**
|
|
15
23
|
* If true, the cart will open when a line item is added to the order clicking the add to cart button. Defaults to false.
|
|
24
|
+
* Works only with the `type` prop set to `mini`.
|
|
16
25
|
*/
|
|
17
26
|
openAdd?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* The style of the cart.
|
|
20
|
-
*/
|
|
21
|
-
style?: Styles;
|
|
22
27
|
/**
|
|
23
28
|
* If true, the cart will be open. Defaults to false.
|
|
29
|
+
* Works only with the `type` prop set to `mini`.
|
|
24
30
|
*/
|
|
25
31
|
open?: boolean;
|
|
26
32
|
/**
|
|
27
33
|
* A function that will be called when the cart is open and the background is clicked.
|
|
34
|
+
* Works only with the `type` prop set to `mini`.
|
|
28
35
|
*/
|
|
29
36
|
handleOpen?: () => void;
|
|
30
|
-
/**
|
|
31
|
-
* The domain of your forked application.
|
|
32
|
-
*/
|
|
33
|
-
customDomain?: string;
|
|
34
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* This component allows to embed the cart application in your page as an `<iframe>`.
|
|
40
|
+
*
|
|
41
|
+
* By default, it will be rendered as inline cart and its content will fit the available container width
|
|
42
|
+
* while the height will be automatically adjusted to the content.
|
|
43
|
+
*
|
|
44
|
+
* Or it can work as mini cart - when `type` prop is set to `mini` - and it will be opened in a modal (popup).
|
|
45
|
+
*
|
|
46
|
+
* <span title="Requirement" type="warning">
|
|
47
|
+
* Must be a child of the `<OrderContainer>` component.
|
|
48
|
+
* </span>
|
|
49
|
+
*
|
|
50
|
+
* <span title="Mini cart" type="info">
|
|
51
|
+
* When set as `mini` cart, it requires the `<CartLink type='mini' />` component to be on the same page,
|
|
52
|
+
* to show the cart when clicked. <br />
|
|
53
|
+
* View the `<CartLink />` component documentation for more details and examples.
|
|
54
|
+
* </span>
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
35
57
|
export declare function HostedCart({ type, openAdd, style, open, handleOpen, customDomain, ...props }: Props): JSX.Element | null;
|
|
36
58
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type BaseMetadataObject } from '../../typings/index';
|
|
2
3
|
import type { OrderCreate, Order } from '@commercelayer/sdk';
|
|
3
4
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
@@ -20,5 +21,38 @@ interface Props {
|
|
|
20
21
|
*/
|
|
21
22
|
fetchOrder?: (order: Order) => void;
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* This component is responsible for fetching the order and store it in its context.
|
|
26
|
+
* It also provides the `fetchOrder` callback that is triggered every time the order is updated (it returns the updated order object as argument).
|
|
27
|
+
* When the order is not placed yet, its possible to pass the `metadata` and `attributes` props to update the order.
|
|
28
|
+
*
|
|
29
|
+
* <span title="Requirement" type="warning">
|
|
30
|
+
* Must be a child of the `<CommerceLayer>` component. <br />
|
|
31
|
+
* Can be a child of the `<OrderStorage>` component and receive the `orderId` from it.
|
|
32
|
+
* </span>
|
|
33
|
+
*
|
|
34
|
+
* <span title="Children" type="info">
|
|
35
|
+
* `<AddToCartButton>`,
|
|
36
|
+
* `<AdjustmentAmount>`,
|
|
37
|
+
* `<CartLink>`,
|
|
38
|
+
* `<CheckoutLink>`,
|
|
39
|
+
* `<DiscountAmount>`,
|
|
40
|
+
* `<GiftCardAmount>`,
|
|
41
|
+
* `<HostedCart>`,
|
|
42
|
+
* `<OrderNumber>`,
|
|
43
|
+
* `<PaymentMethodAmount>`,
|
|
44
|
+
* `<PlaceOrderButton>`,
|
|
45
|
+
* `<PlaceOrderContainer>`,
|
|
46
|
+
* `<PrivacyAndTermsCheckbox>`,
|
|
47
|
+
* `<Shipping Amount>`,
|
|
48
|
+
* `<SubTotalAmount>`,
|
|
49
|
+
* `<TaxesAmount>`,
|
|
50
|
+
* `<TotalAmount>`,
|
|
51
|
+
* </span>
|
|
52
|
+
*
|
|
53
|
+
* <span title="Core API" type="info">
|
|
54
|
+
* Check the `orders` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/orders/object).
|
|
55
|
+
* </span>
|
|
56
|
+
*/
|
|
23
57
|
export declare function OrderContainer(props: Props): JSX.Element;
|
|
24
58
|
export default OrderContainer;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type TOrderList, type InitialOrderListContext, type OrderListContent } from '../../context/OrderListChildrenContext';
|
|
2
3
|
import { type ColumnDef, type SortingState } from '@tanstack/react-table';
|
|
3
4
|
import type { DefaultChildrenType, TRange } from '../../typings/globals';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type OrderListPaginationContext as TOrderListPaginationContext } from '../../context/OrderListPaginationContext';
|
|
2
3
|
import { type ChildrenFunction } from '../../typings/index';
|
|
3
4
|
interface PaginationButton extends Omit<JSX.IntrinsicElements['button'], 'children' | 'disabled'> {
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* The key used to persist the order id in the browser local storage.
|
|
6
|
+
*/
|
|
4
7
|
persistKey: string;
|
|
8
|
+
/**
|
|
9
|
+
* Removes the saved order id from the local storage when order is placed.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
5
12
|
clearWhenPlaced?: boolean;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* This component handle the persistence of the order id in the browser local storage.
|
|
16
|
+
* When adding a product into the cart and the order does not exist yet, in will be created by the `OrderContainer` and
|
|
17
|
+
* the order id will then be automatically saved in the local storage using `OrderStorage` context.
|
|
18
|
+
* In this way on page refresh or components remounting, the `OrderContainer` will be able to load the order getting the id from this context.
|
|
19
|
+
*
|
|
20
|
+
* By default, the localStorage key will be deleted once the order has been placed, but you can disable this behavior via `clearWhenPlaced` prop.
|
|
21
|
+
*
|
|
22
|
+
* <span title="Requirement" type="warning">
|
|
23
|
+
* Must be a child of the `<CommerceLayer>` component. <br />
|
|
24
|
+
* </span>
|
|
25
|
+
*
|
|
26
|
+
* <span title="Children" type="info">
|
|
27
|
+
* `<OrderContainer>`,
|
|
28
|
+
* </span>
|
|
29
|
+
*/
|
|
7
30
|
export declare function OrderStorage(props: Props): JSX.Element;
|
|
8
31
|
export default OrderStorage;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type ConditionalElement } from '../../typings/index';
|
|
2
3
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
3
4
|
type ParcelLineItemFieldChildrenProps = TGenericChildrenProps<TResources['ParcelLineItem']>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
2
3
|
import { type PaymentSourceProps } from './PaymentSource';
|
|
3
4
|
type KlarnaPaymentProps = PaymentMethodConfig['klarnaPayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type StripeElementLocale, type StripeElementsOptions, type StripePaymentElementOptions } from '@stripe/stripe-js';
|
|
2
3
|
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
3
4
|
import { type PaymentSourceProps } from './PaymentSource';
|
|
@@ -17,5 +17,18 @@ interface Props {
|
|
|
17
17
|
*/
|
|
18
18
|
getQuantity?: (quantity: number) => void;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Main container for the Availability components.
|
|
22
|
+
* 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.
|
|
23
|
+
*
|
|
24
|
+
* It can be used to fetch the quantities for a specific `sku_code` passed as prop.
|
|
25
|
+
* <span title='Requirements' type='warning'>
|
|
26
|
+
* Must be a child of the `<CommerceLayer>` component. <br/>
|
|
27
|
+
* Can be a child of the `<SkusContainer>` component and receive the `sku_code` from its context.
|
|
28
|
+
* </span>
|
|
29
|
+
* <span title='Children' type='info'>
|
|
30
|
+
* `<AvailabilityTemplate>`
|
|
31
|
+
* </span>
|
|
32
|
+
*/
|
|
20
33
|
export declare function AvailabilityContainer({ children, skuCode, skuId, getQuantity }: Props): JSX.Element;
|
|
21
34
|
export default AvailabilityContainer;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type TimeFormat, type ChildrenFunction } from '../../typings/index';
|
|
2
3
|
import { type DeliveryLeadTime } from '../../reducers/AvailabilityReducer';
|
|
3
4
|
interface AvailabilityTemplateChildrenProps extends Omit<Props, 'children'>, DeliveryLeadTime {
|
|
@@ -6,15 +7,16 @@ interface AvailabilityTemplateChildrenProps extends Omit<Props, 'children'>, Del
|
|
|
6
7
|
}
|
|
7
8
|
type FormatRules = {
|
|
8
9
|
/**
|
|
9
|
-
* Set time format for shipping method
|
|
10
|
+
* Set time format for shipping method. When not set, ``delivery_lead_times`` will not be displayed.
|
|
11
|
+
* When set, `delivery_lead_times` for the first shipping method found in the inventory model, will be displayed in the format specified.
|
|
10
12
|
*/
|
|
11
13
|
timeFormat?: TimeFormat;
|
|
12
14
|
/**
|
|
13
|
-
* Show shipping method name
|
|
15
|
+
* Show shipping method name. Requires `timeFormat` to be set.
|
|
14
16
|
*/
|
|
15
17
|
showShippingMethodName?: false;
|
|
16
18
|
/**
|
|
17
|
-
* Show shipping method price
|
|
19
|
+
* Show shipping method price. Requires `timeFormat` to be set.
|
|
18
20
|
*/
|
|
19
21
|
showShippingMethodPrice?: false;
|
|
20
22
|
} | {
|
|
@@ -34,5 +36,17 @@ type Props = {
|
|
|
34
36
|
negativeStock?: string;
|
|
35
37
|
};
|
|
36
38
|
} & Omit<JSX.IntrinsicElements['span'], 'children'> & FormatRules;
|
|
39
|
+
/**
|
|
40
|
+
* The AvailabilityTemplate component displays the availability of the SKU specified
|
|
41
|
+
* in the parent `<AvailabilityContainer>` component.
|
|
42
|
+
*
|
|
43
|
+
* It is possible to customize the text displayed in case of `available`, `outOfStock` or `negativeStock.
|
|
44
|
+
* It is also possible to show delivery lead time and either shipping method name and/or price.
|
|
45
|
+
* This information will be retrieve from the first shipping method found in the inventory model.
|
|
46
|
+
*
|
|
47
|
+
* <span type="Requirement" type="info">
|
|
48
|
+
* It must to be used inside the `<AvailabilityContainer>` component.
|
|
49
|
+
* </span>
|
|
50
|
+
*/
|
|
37
51
|
export declare function AvailabilityTemplate(props: Props): JSX.Element;
|
|
38
52
|
export default AvailabilityTemplate;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type ConditionalElement } from '../../typings/index';
|
|
2
3
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
3
4
|
type SkuFieldChildrenProps = TGenericChildrenProps<TResources['Sku']>;
|
|
@@ -6,8 +7,19 @@ type Props = {
|
|
|
6
7
|
children?: (props: SkuFieldChildrenProps) => JSX.Element;
|
|
7
8
|
} & TCondition;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* The SkuField component displays any attribute of the `sku` specified in the parent `<SkusContainer>` component.
|
|
11
|
+
*
|
|
12
|
+
* It also accepts a `tagElement` props to enable specific tag-related props.
|
|
13
|
+
* For examples, when `tagElement` is set to `img` it will also accept props related to `<img>` tag such as `height` and `width`.
|
|
14
|
+
*
|
|
15
|
+
* <span title="Requirement" type="warning">
|
|
16
|
+
* It must to be used inside the `<SkusContainer>` component.
|
|
17
|
+
* </span>
|
|
18
|
+
*
|
|
19
|
+
* <span title="Fields" type="info">
|
|
20
|
+
* Check the `skus` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/skus/object)
|
|
21
|
+
* for more details about the available attributes to render.
|
|
22
|
+
* </span>
|
|
11
23
|
*/
|
|
12
24
|
export declare function SkuField<P extends Props>(props: P): JSX.Element;
|
|
13
25
|
export default SkuField;
|
|
@@ -2,5 +2,17 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* The `Skus` components loop through the list of `skus` found in `SkusContainer` context and render the children filled with the proper sku value.
|
|
7
|
+
* This means that the children will be rendered as many times as the number of skus found in the `skus` prop array
|
|
8
|
+
* and there is no need to manually loop through them from your consumer app.
|
|
9
|
+
*
|
|
10
|
+
* <span title='Requirements' type='warning'>
|
|
11
|
+
* Must be a child of the `<SkusContainer>` component.
|
|
12
|
+
* </span>
|
|
13
|
+
* <span title='Children' type='info'>
|
|
14
|
+
* `<SkuField>`, `<AvailabilityContainer>`
|
|
15
|
+
* </span>
|
|
16
|
+
*/
|
|
5
17
|
export declare function Skus<P extends Props>({ children }: P): JSX.Element;
|
|
6
18
|
export default Skus;
|