@commercelayer/react-components 4.7.9 → 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/cjs/utils/validateFormFields.d.ts +1 -1
- package/lib/cjs/utils/validateFormFields.js +1 -1
- 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/lib/esm/utils/validateFormFields.d.ts +1 -1
- package/lib/esm/utils/validateFormFields.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type BaseInputComponentProps } from '../typings/index';
|
|
2
3
|
type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
3
4
|
export declare function MetadataInput(props: Props): JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type Address as AddressType } from '@commercelayer/sdk';
|
|
2
3
|
import { type AddressCardsTemplateChildren } from '../utils/AddressCardsTemplate';
|
|
3
4
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
@@ -9,5 +10,22 @@ interface Props extends Omit<JSX.IntrinsicElements['div'], 'children' | 'onSelec
|
|
|
9
10
|
addresses?: AddressType[];
|
|
10
11
|
deselect?: boolean;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* The Address component is aimed to read from active context the list of available addresses to generate for each of them a suitable and interactive wrapper ready to deal with addresses data.
|
|
15
|
+
*
|
|
16
|
+
* It accept:
|
|
17
|
+
* - a `selectedClassName` prop to define the className of selected generated address wrapper.
|
|
18
|
+
* - a `disabledClassName` prop to define the className of disabled generated address wrapper.
|
|
19
|
+
* - an `onSelect` prop to define a custom method triggered when an address wrapper is clicked.
|
|
20
|
+
* - an `addresses` prop to define a list of addresses to be used instead of the ones available from active context.
|
|
21
|
+
* - a `deselect` prop to define if the current address is deselected through a custom logic.
|
|
22
|
+
*
|
|
23
|
+
* <span title='Requirements' type='warning'>
|
|
24
|
+
* Must be a child of the `<AddressesContainer>` component.
|
|
25
|
+
* </span>
|
|
26
|
+
* <span title='Children' type='info'>
|
|
27
|
+
* `<AddressField>`,
|
|
28
|
+
* </span>
|
|
29
|
+
*/
|
|
12
30
|
export declare function Address(props: Props): JSX.Element;
|
|
13
31
|
export default Address;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type BaseSelectComponentProps } from '../../typings/index';
|
|
2
3
|
import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
3
4
|
import { type Country } from '../../utils/countryStateCity';
|
|
@@ -11,5 +12,23 @@ interface Props extends Omit<BaseSelectComponentProps, 'options' | 'name'>, Pick
|
|
|
11
12
|
*/
|
|
12
13
|
countries?: Country[];
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The AddressInput component creates a form `select` related to the `country_code` attribute of the `address` object.
|
|
17
|
+
*
|
|
18
|
+
* It requires a `name` prop to define the field name associated with the select and accepts most of HTML `select` tag standard props.
|
|
19
|
+
*
|
|
20
|
+
* <span title="Name prop" type="info">
|
|
21
|
+
* The `name` prop must respect the convention of mentioning one of the available addresses forms (`billing_address` or `shipping_address` or `customer_address`) concatenated to the `country_code` address attribute with a `_` separator. Eg.: `billing_address_country_code`.
|
|
22
|
+
* </span>
|
|
23
|
+
*
|
|
24
|
+
* <span title="Requirement" type="warning">
|
|
25
|
+
* It must to be used inside either the `<BillingAddressForm>` or the `<ShippingAddressForm>` component.
|
|
26
|
+
* </span>
|
|
27
|
+
*
|
|
28
|
+
* <span title="Fields" type="info">
|
|
29
|
+
* Check the `addresses` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/addresses/object)
|
|
30
|
+
* for more details about the available attributes to render.
|
|
31
|
+
* </span>
|
|
32
|
+
*/
|
|
14
33
|
export declare function AddressCountrySelector(props: Props): JSX.Element;
|
|
15
34
|
export default AddressCountrySelector;
|
|
@@ -35,5 +35,27 @@ type Props = {
|
|
|
35
35
|
name?: never;
|
|
36
36
|
className?: string;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* The AddressField component displays any attribute of the `address` object set in the state of the parent `<Address>` component.
|
|
40
|
+
*
|
|
41
|
+
* It accepts a `name` prop to define the attribute to be shown.
|
|
42
|
+
* It also accepts:
|
|
43
|
+
* - a `type` props to enable different kind of behaviors like `field` (default), `edit` or `delete`.
|
|
44
|
+
* - a `label` props to show a custom label if chosen `type` is `edit` or `delete`.
|
|
45
|
+
* - an `onClick` props to define a custom click behavior.
|
|
46
|
+
*
|
|
47
|
+
* <span title="Type `delete`" type="info">
|
|
48
|
+
* Only in case `type` is set to `delete` a default `onClick` behavior will be set to manage current address removal.
|
|
49
|
+
* </span>
|
|
50
|
+
*
|
|
51
|
+
* <span title="Requirement" type="warning">
|
|
52
|
+
* It must to be used inside the `<Address>` component.
|
|
53
|
+
* </span>
|
|
54
|
+
*
|
|
55
|
+
* <span title="Fields" type="info">
|
|
56
|
+
* Check the `addresses` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/addresses/object)
|
|
57
|
+
* for more details about the available attributes to render.
|
|
58
|
+
* </span>
|
|
59
|
+
*/
|
|
38
60
|
export declare function AddressField(props: Props): JSX.Element;
|
|
39
61
|
export default AddressField;
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type BaseInputComponentProps, type AddressInputName } from '../../typings/index';
|
|
2
3
|
import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
3
4
|
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the input.
|
|
7
|
+
*/
|
|
4
8
|
name: Extract<AddressValuesKeys, AddressInputName>;
|
|
9
|
+
/**
|
|
10
|
+
* Used to add a custom validation rule.
|
|
11
|
+
*/
|
|
12
|
+
pattern?: RegExp | string;
|
|
5
13
|
} & Omit<BaseInputComponentProps, 'name'> & JSX.IntrinsicElements['input'] & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
|
|
14
|
+
/**
|
|
15
|
+
* The AddressInput component creates a form `input` related to a particular address attribute.
|
|
16
|
+
*
|
|
17
|
+
* It requires a `name` prop to define the field name associated with the input and accepts most of HTML `input` tag standard props.
|
|
18
|
+
*
|
|
19
|
+
* <span title="Name prop" type="info">
|
|
20
|
+
* The `name` prop must respect the convention of mentioning one of the available addresses forms (`billing_address` or `shipping_address` or `customer_address`) concatenated to the address attribute name with a `_` separator. Eg.: `billing_address_first_name`.
|
|
21
|
+
* </span>
|
|
22
|
+
*
|
|
23
|
+
* <span title="Requirement" type="warning">
|
|
24
|
+
* It must to be used inside either the `<BillingAddressForm>` or the `<ShippingAddressForm>` component.
|
|
25
|
+
* </span>
|
|
26
|
+
*
|
|
27
|
+
* <span title="Fields" type="info">
|
|
28
|
+
* Check the `addresses` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/addresses/object)
|
|
29
|
+
* for more details about the available attributes to render.
|
|
30
|
+
* </span>
|
|
31
|
+
*/
|
|
6
32
|
export declare function AddressInput(props: Props): JSX.Element | null;
|
|
7
33
|
export default AddressInput;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type AddressStateSelectName, type BaseSelectComponentProps } from '../../typings/index';
|
|
2
3
|
import { type States } from '../../utils/countryStateCity';
|
|
3
4
|
type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
|
|
@@ -13,5 +14,23 @@ type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
|
|
|
13
14
|
*/
|
|
14
15
|
states?: States;
|
|
15
16
|
} & Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'>;
|
|
17
|
+
/**
|
|
18
|
+
* The AddressInput component creates a form `select` related to the `state_code` attribute of the `address` object.
|
|
19
|
+
*
|
|
20
|
+
* It requires a `name` prop to define the field name associated with the select and accepts most of HTML `select` tag standard props.
|
|
21
|
+
*
|
|
22
|
+
* <span title="Name prop" type="info">
|
|
23
|
+
* The `name` prop must respect the convention of mentioning one of the available addresses forms (`billing_address` or `shipping_address`) concatenated to the `state_code` address attribute with a `_` separator. Eg.: `billing_address_state_code`.
|
|
24
|
+
* </span>
|
|
25
|
+
*
|
|
26
|
+
* <span title="Requirement" type="warning">
|
|
27
|
+
* It must to be used inside either the `<BillingAddressForm>` or the `<ShippingAddressForm>` component.
|
|
28
|
+
* </span>
|
|
29
|
+
*
|
|
30
|
+
* <span title="Fields" type="info">
|
|
31
|
+
* Check the `addresses` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/addresses/object)
|
|
32
|
+
* for more details about the available attributes to render.
|
|
33
|
+
* </span>
|
|
34
|
+
*/
|
|
16
35
|
export declare function AddressStateSelector(props: Props): JSX.Element;
|
|
17
36
|
export default AddressStateSelector;
|
|
@@ -1,8 +1,36 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* If true, the shipping address will be considered. Default is false.
|
|
6
|
+
*/
|
|
4
7
|
shipToDifferentAddress?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* If true, the address will be considered a business address.
|
|
10
|
+
*/
|
|
5
11
|
isBusiness?: boolean;
|
|
6
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Main container for the Addresses components.
|
|
15
|
+
* It provides demanded functionalities to show/manage an address or a series of addresses depending on the context in use.
|
|
16
|
+
* In addition it provides order oriented functionalities to manage billing and shipping addresses.
|
|
17
|
+
*
|
|
18
|
+
* It accept:
|
|
19
|
+
* - a `shipToDifferentAddress` prop to define if the order related shipping address will be different from the billing one.
|
|
20
|
+
* - a `isBusiness` prop to define if the current address needs to be threated as a `business` address during creation/update.
|
|
21
|
+
*
|
|
22
|
+
* <span title='Requirements' type='warning'>
|
|
23
|
+
* Must be a child of the `<CommerceLayer>` component.
|
|
24
|
+
* </span>
|
|
25
|
+
* <span title='Children' type='info'>
|
|
26
|
+
* `<BillingAddressContainer>`,
|
|
27
|
+
* `<BillingAddressForm>`,
|
|
28
|
+
* `<ShippingAddressContainer>`,
|
|
29
|
+
* `<ShippingAddressForm>`,
|
|
30
|
+
* `<CustomerAddressForm>`,
|
|
31
|
+
* `<AddressesEmpty>`,
|
|
32
|
+
* `<Addresses>`
|
|
33
|
+
* </span>
|
|
34
|
+
*/
|
|
7
35
|
export declare function AddressesContainer(props: Props): JSX.Element;
|
|
8
36
|
export default AddressesContainer;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type ChildrenFunction } from '../../typings/index';
|
|
2
3
|
interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
|
|
3
4
|
/**
|
|
@@ -9,5 +10,17 @@ interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
|
|
|
9
10
|
*/
|
|
10
11
|
emptyText?: string;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* The AddressesEmpty component is aimed to display a message in case no customer address is available, otherwise it won't show.
|
|
15
|
+
*
|
|
16
|
+
* It accepts an optional `emptyText` prop to customize default message.
|
|
17
|
+
*
|
|
18
|
+
* It is also possible to wrap inside this component any children elements to create a completely custom experience regarding the absence of customer addresses.
|
|
19
|
+
*
|
|
20
|
+
* <span title="Requirement" type="warning">
|
|
21
|
+
* It must to be used inside the `<AddressesContainer>` component.
|
|
22
|
+
* </span>
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
12
25
|
export declare function AddressesEmpty(props: Props): JSX.Element | null;
|
|
13
26
|
export default AddressesEmpty;
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Define if current form needs to be reset over a defined boolean condition
|
|
6
|
+
*/
|
|
4
7
|
reset?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Define children input and select classnames assigned in case of validation error.
|
|
10
|
+
*/
|
|
5
11
|
errorClassName?: string;
|
|
6
12
|
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
13
|
+
/**
|
|
14
|
+
* Form container for creating or editing an order related billing address or a customer address, depending on the context in use.
|
|
15
|
+
*
|
|
16
|
+
* <span title='Requirements' type='warning'>
|
|
17
|
+
* Must be a child of the `<AddressesContainer>` component.
|
|
18
|
+
* Can optionally be a child of the `<OrderContainer>` component, when it needs to be used in the checkout process and store the billing address in the order object.
|
|
19
|
+
* </span>
|
|
20
|
+
* <span title='Children' type='info'>
|
|
21
|
+
* `<AddressInput>`,
|
|
22
|
+
* `<AddressCountrySelector>`,
|
|
23
|
+
* `<AddressStateSelector>`,
|
|
24
|
+
* `<SaveAddressesButton>`
|
|
25
|
+
* </span>
|
|
26
|
+
*/
|
|
7
27
|
export declare function BillingAddressForm(props: Props): JSX.Element;
|
|
8
28
|
export default BillingAddressForm;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SaveAddressesButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),AddressContext_1=tslib_1.__importDefault(require("../../context/AddressContext")),addressesManager_1=require("../../utils/addressesManager"),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction"));function SaveAddressesButton(props){const{children,label="Continue to delivery",resource,disabled=!1,addressId,onClick}=props,p=tslib_1.__rest(props,["children","label","resource","disabled","addressId","onClick"]),{errors,billing_address:billingAddress,shipToDifferentAddress,shipping_address:shippingAddress,saveAddresses,billingAddressId,shippingAddressId}=(0,react_1.useContext)(AddressContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{customerEmail:email,addresses,isGuest,createCustomerAddress}=(0,react_1.useContext)(CustomerContext_1.default),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled);let customerEmail=(isGuest===!0||typeof isGuest>"u")&&!order?.customer_email;email!=null&&email!==""
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SaveAddressesButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),AddressContext_1=tslib_1.__importDefault(require("../../context/AddressContext")),addressesManager_1=require("../../utils/addressesManager"),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),validateFormFields_1=require("../../utils/validateFormFields");function SaveAddressesButton(props){const{children,label="Continue to delivery",resource,disabled=!1,addressId,onClick}=props,p=tslib_1.__rest(props,["children","label","resource","disabled","addressId","onClick"]),{errors,billing_address:billingAddress,shipToDifferentAddress,shipping_address:shippingAddress,saveAddresses,billingAddressId,shippingAddressId}=(0,react_1.useContext)(AddressContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{customerEmail:email,addresses,isGuest,createCustomerAddress}=(0,react_1.useContext)(CustomerContext_1.default),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled);let customerEmail=(isGuest===!0||typeof isGuest>"u")&&!order?.customer_email;if(email!=null&&email!==""){const isValidEmail=(0,validateFormFields_1.validateValue)(email,"customer_email","email","orders");customerEmail=Object.keys(isValidEmail).length>0}const billingDisable=(0,addressesManager_1.billingAddressController)({billing_address:billingAddress,errors,billingAddressId,requiresBillingInfo:order?.requires_billing_info}),shippingDisable=(0,addressesManager_1.shippingAddressController)({billingDisable,errors,shipToDifferentAddress,shipping_address:shippingAddress,shippingAddressId}),countryLockDisable=(0,addressesManager_1.countryLockController)({countryCodeLock:order?.shipping_country_code_lock,addresses,shipToDifferentAddress,billingAddressId,billing_address:billingAddress,shipping_address:shippingAddress,shippingAddressId,lineItems:order?.line_items}),disable=disabled||customerEmail||billingDisable||shippingDisable||countryLockDisable,handleClick=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(errors&&Object.keys(errors).length===0&&!disable){let response={success:!1};if(setForceDisable(!0),order&&saveAddresses!=null)response=yield saveAddresses(email);else if(createCustomerAddress&&billingAddress){const address=Object.assign({},billingAddress);addressId&&(address.id=addressId),createCustomerAddress(address),response={success:!0}}setForceDisable(!1),onClick&&response.success&&onClick(response)}}),parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("button",Object.assign({type:"button",disabled:disable||forceDisable,onClick:()=>{handleClick()}},p,{children:(0,isFunction_1.default)(label)?label():label}))}exports.SaveAddressesButton=SaveAddressesButton,exports.default=SaveAddressesButton;
|
|
@@ -4,5 +4,22 @@ interface Props extends Omit<JSX.IntrinsicElements['form'], 'onSubmit'> {
|
|
|
4
4
|
reset?: boolean;
|
|
5
5
|
errorClassName?: string;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Form container for creating or editing an order related shipping address.
|
|
9
|
+
*
|
|
10
|
+
* It accept:
|
|
11
|
+
* - a `reset` prop to define if current form needs to be reset over a defined boolean condition.
|
|
12
|
+
* - a `errorClassName` prop to define children input and select classnames assigned in case of validation error.
|
|
13
|
+
*
|
|
14
|
+
* <span title='Requirements' type='warning'>
|
|
15
|
+
* Must be a child of the `<AddressesContainer>` component.
|
|
16
|
+
* </span>
|
|
17
|
+
* <span title='Children' type='info'>
|
|
18
|
+
* `<AddressInput>`,
|
|
19
|
+
* `<AddressCountrySelector>`,
|
|
20
|
+
* `<AddressStateSelector>`,
|
|
21
|
+
* `<SaveAddressesButton>`
|
|
22
|
+
* </span>
|
|
23
|
+
*/
|
|
7
24
|
export declare function ShippingAddressForm(props: Props): JSX.Element;
|
|
8
25
|
export default ShippingAddressForm;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
2
3
|
interface Props {
|
|
3
4
|
children: DefaultChildrenType;
|
|
@@ -7,7 +8,25 @@ interface Props {
|
|
|
7
8
|
isGuest?: boolean;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Main container for the Customers components.
|
|
12
|
+
* It stores - in its context - the details of an active customer, if present.
|
|
13
|
+
*
|
|
14
|
+
* It also accept a `isGuest` prop to define if no customer is currently set as active.
|
|
15
|
+
*
|
|
16
|
+
* <span title='Requirements' type='warning'>
|
|
17
|
+
* Must be a child of the `<CommerceLayer>` component.
|
|
18
|
+
* </span>
|
|
19
|
+
* <span title='Children' type='info'>
|
|
20
|
+
* `<CustomerField>`,
|
|
21
|
+
* `<CustomerInput>`,
|
|
22
|
+
* `<SaveCustomerButton>`,
|
|
23
|
+
* `<AddressesContainer>`,
|
|
24
|
+
* `<AddressesEmpty>`,
|
|
25
|
+
* `<CustomerPaymentSource>`,
|
|
26
|
+
* `<CustomerPaymentSourceEmpty>`,
|
|
27
|
+
* `<PaymentMethodsContainer>`,
|
|
28
|
+
* `<OrdersList>`
|
|
29
|
+
* </span>
|
|
11
30
|
*/
|
|
12
31
|
export declare function CustomerContainer(props: Props): JSX.Element;
|
|
13
32
|
export default CustomerContainer;
|
|
@@ -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 StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['Customer']>;
|
|
@@ -5,5 +6,20 @@ type TCondition = ConditionalElement<Exclude<TResources['Customer'], 'resource'>
|
|
|
5
6
|
type Props = {
|
|
6
7
|
children?: (props: StockTransferFieldChildrenProps) => JSX.Element;
|
|
7
8
|
} & TCondition;
|
|
9
|
+
/**
|
|
10
|
+
* The CustomerField component displays any attribute of the `customer` set in the state of the parent `<CustomerContainer>` 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 `<CustomerContainer>` component.
|
|
17
|
+
* </span>
|
|
18
|
+
*
|
|
19
|
+
* <span title="Fields" type="info">
|
|
20
|
+
* Check the `customers` resource from our [Core API documentation](https://docs.commercelayer.io/core/v/api-reference/customers/object)
|
|
21
|
+
* for more details about the available attributes to render.
|
|
22
|
+
* </span>
|
|
23
|
+
*/
|
|
8
24
|
export declare function CustomerField<P extends Props>(props: P): JSX.Element;
|
|
9
25
|
export default CustomerField;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomerInput=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),BaseInput_1=tslib_1.__importDefault(require("../utils/BaseInput")),rapid_form_1=require("rapid-form"),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),validateFormFields_1=require("../../utils/validateFormFields");function CustomerInput(props){const{name="customer_email",placeholder="",required=!0,saveOnBlur=!1,type="email",value,onBlur,className,errorClassName}=props,p=tslib_1.__rest(props,["name","placeholder","required","saveOnBlur","type","value","onBlur","className","errorClassName"]),{validation,values,errors,setError}=(0,rapid_form_1.useRapidForm)({fieldEvent:"blur"}),{saveCustomerUser,setCustomerErrors,setCustomerEmail}=(0,react_1.useContext)(CustomerContext_1.default),[hasError,setHasError]=(0,react_1.useState)(!1),handleOnBlur=e=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a;const v=(_a=e?.target)===null||_a===void 0?void 0:_a.value,checkValue=(0,validateFormFields_1.validateValue)(v,name,type,"
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomerInput=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),BaseInput_1=tslib_1.__importDefault(require("../utils/BaseInput")),rapid_form_1=require("rapid-form"),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),validateFormFields_1=require("../../utils/validateFormFields");function CustomerInput(props){const{name="customer_email",placeholder="",required=!0,saveOnBlur=!1,type="email",value,onBlur,className,errorClassName}=props,p=tslib_1.__rest(props,["name","placeholder","required","saveOnBlur","type","value","onBlur","className","errorClassName"]),{validation,values,errors,setError}=(0,rapid_form_1.useRapidForm)({fieldEvent:"blur"}),{saveCustomerUser,setCustomerErrors,setCustomerEmail}=(0,react_1.useContext)(CustomerContext_1.default),[hasError,setHasError]=(0,react_1.useState)(!1),handleOnBlur=e=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a;const v=(_a=e?.target)===null||_a===void 0?void 0:_a.value,checkValue=(0,validateFormFields_1.validateValue)(v,name,type,"orders"),isValid=Object.keys(checkValue).length===0;if(saveOnBlur&&Object.keys(values).length>0&&saveCustomerUser!=null&&(yield saveCustomerUser(values[name].value),onBlur&&onBlur(values[name].value)),!isValid){const currentError=Object.assign(Object.assign({},checkValue),{name:checkValue?.field});setError(currentError)}});(0,react_1.useEffect)(()=>{var _a,_b;if(Object.keys(errors).length>0){const formErrors=[];for(const fieldName in errors){const code=(_a=errors[fieldName])===null||_a===void 0?void 0:_a.code,message=(_b=errors[fieldName])===null||_b===void 0?void 0:_b.message;formErrors.push({code,message:message||"",resource:"orders",field:fieldName})}formErrors.length>0&&(setHasError(!0),setCustomerErrors&&setCustomerErrors(formErrors))}else setCustomerErrors&&setCustomerErrors([]),setHasError(!1);return Object.keys(values).length>0&&setCustomerEmail&&setCustomerEmail(values[name].value),()=>{setHasError(!1)}},[errors]);const classNameComputed=`${className??""} ${hasError&&errorClassName?errorClassName:""}`;return(0,jsx_runtime_1.jsx)(BaseInput_1.default,Object.assign({name,type,ref:validation,required,placeholder,defaultValue:value,onBlur:e=>{handleOnBlur(e)},className:classNameComputed},p))}exports.CustomerInput=CustomerInput,exports.default=CustomerInput;
|
|
@@ -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
|
/**
|
|
@@ -23,5 +24,15 @@ interface Props extends Omit<JSX.IntrinsicElements['a'], 'children'> {
|
|
|
23
24
|
*/
|
|
24
25
|
customDomain?: string;
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* This component generates a link to the hosted mfe-my-account application.
|
|
29
|
+
* In this way you can connect your shop application with our hosted micro-frontend and let your customers manage their account with zero code.
|
|
30
|
+
*
|
|
31
|
+
* <span title="Requirement" type="warning">
|
|
32
|
+
* Must be a child of the `<CustomerContainer>` component. <br />
|
|
33
|
+
* </span>
|
|
34
|
+
*
|
|
35
|
+
* @link https://github.com/commercelayer/mfe-my-account
|
|
36
|
+
*/
|
|
26
37
|
export declare function MyAccountLink(props: Props): JSX.Element;
|
|
27
38
|
export default MyAccountLink;
|
|
@@ -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
|
/**
|
|
@@ -35,5 +36,20 @@ interface Props extends Omit<JSX.IntrinsicElements['a'], 'children'> {
|
|
|
35
36
|
*/
|
|
36
37
|
customDomain?: string;
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* This component generates a link to the hosted mfe-identity application.
|
|
41
|
+
*
|
|
42
|
+
* In this way you can connect your shop application with our hosted micro-frontend and let your customers manage their account with zero code.
|
|
43
|
+
*
|
|
44
|
+
* <span title="Requirement" type="warning">
|
|
45
|
+
* Must be a child of the `<CommerceLayer>` component.
|
|
46
|
+
* </span>
|
|
47
|
+
*
|
|
48
|
+
* <span title="My Identity" type="info">
|
|
49
|
+
* The Commerce Layer Identity micro frontend (React) provides you with an application, powered by Commerce Layer APIs, handling customer login and sign-up functionalities
|
|
50
|
+
* </span>
|
|
51
|
+
*
|
|
52
|
+
* @link https://github.com/commercelayer/mfe-identity
|
|
53
|
+
*/
|
|
38
54
|
export declare function MyIdentityLink(props: Props): JSX.Element;
|
|
39
55
|
export default MyIdentityLink;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { CodeErrorType } from '../../typings/errors';
|
|
2
3
|
import { type ChildrenFunction } from '../../typings/index';
|
|
3
4
|
export type TResourceError = 'addresses' | 'billing_address' | 'gift_cards' | 'gift_card_or_coupon_code' | 'line_items' | 'orders' | 'payment_methods' | 'prices' | 'shipments' | 'shipping_address' | 'customer_address' | 'sku_options' | 'variant' | 'in_stock_subscriptions';
|
|
@@ -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 LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
|
|
@@ -5,14 +5,26 @@ interface TAddToCartButton extends Omit<Props, 'children'> {
|
|
|
5
5
|
handleClick: () => AddToCartReturn;
|
|
6
6
|
}
|
|
7
7
|
type BuyNowMode = {
|
|
8
|
+
/**
|
|
9
|
+
* Once item has been added, it redirects to the hosted checkout micro-frontend.
|
|
10
|
+
*/
|
|
8
11
|
buyNowMode: true;
|
|
12
|
+
/**
|
|
13
|
+
* If you have a self-hosted checkout, you can pass the url to redirect to it.
|
|
14
|
+
*/
|
|
9
15
|
checkoutUrl?: string;
|
|
10
16
|
} | {
|
|
11
17
|
buyNowMode?: false;
|
|
12
18
|
checkoutUrl?: never;
|
|
13
19
|
};
|
|
14
20
|
type THostedCart = {
|
|
21
|
+
/**
|
|
22
|
+
* Once item has been added, it redirects to the hosted cart micro-frontend.
|
|
23
|
+
*/
|
|
15
24
|
redirectToHostedCart: true;
|
|
25
|
+
/**
|
|
26
|
+
* If you have a self-hosted cart, you can pass the url to redirect to it.
|
|
27
|
+
*/
|
|
16
28
|
hostedCartUrl?: string;
|
|
17
29
|
} | {
|
|
18
30
|
redirectToHostedCart?: false;
|
|
@@ -54,5 +66,25 @@ type Props = {
|
|
|
54
66
|
*/
|
|
55
67
|
skuListId?: string;
|
|
56
68
|
} & TButton & BuyNowMode & THostedCart;
|
|
69
|
+
/**
|
|
70
|
+
* This component adds `line_items` to the cart (aka draft order), see the [how to create a shopping cart](https://docs.commercelayer.io/core/v/how-tos/placing-orders/shopping-cart/create-a-shopping-cart) documentation,
|
|
71
|
+
* for a general understanding of the process.
|
|
72
|
+
*
|
|
73
|
+
* It can be used to add `skus` or `bundle` by receiving `skuCode` or `bundleCode` from props.
|
|
74
|
+
* When `skuListId` is passed as prop , it will add all the `skus` in the `sku_list` to the cart.
|
|
75
|
+
*
|
|
76
|
+
* It's possible to select the quantity of the item to add to cart by passing the `quantity` prop.
|
|
77
|
+
*
|
|
78
|
+
* When this component is used inside a `<Skus>` or `<SkuList>` component, it will automatically get the `skuCode` and quantity from the context,
|
|
79
|
+
* so you don't need to pass it as prop.
|
|
80
|
+
*
|
|
81
|
+
* It can automatically redirect to the cart page of the application using the `redirectToHostedCart` prop and optionally a `hostedCartUrl`.
|
|
82
|
+
*
|
|
83
|
+
* With a similar logic, you can enable a "Buy Now" experience and automatically redirect the customer to the checkout page using the `buyNowMode` prop and optionally a `checkoutUrl`.
|
|
84
|
+
*
|
|
85
|
+
* <span title="Requirement" type="warning">
|
|
86
|
+
* Must be a child of the `<OrderContainer>` component.
|
|
87
|
+
* </span>
|
|
88
|
+
*/
|
|
57
89
|
export declare function AddToCartButton(props: Props): JSX.Element;
|
|
58
90
|
export default AddToCartButton;
|
|
@@ -35,5 +35,13 @@ interface Props extends Omit<JSX.IntrinsicElements['a'], 'children'> {
|
|
|
35
35
|
*/
|
|
36
36
|
customDomain?: string;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* This component generates a link to the hosted mfe-cart application.
|
|
40
|
+
* In this way you can connect your shop application with our hosted micro-frontend.
|
|
41
|
+
*
|
|
42
|
+
* <span title="Requirement" type="warning">
|
|
43
|
+
* Must be a child of the `<OrderContainer>` component. <br />
|
|
44
|
+
* </span>
|
|
45
|
+
*/
|
|
38
46
|
export declare function CartLink(props: Props): JSX.Element | null;
|
|
39
47
|
export default CartLink;
|