@commercelayer/react-components 4.1.2 → 4.2.1-beta.0
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 +0 -1
- package/lib/cjs/components/addresses/Address.d.ts +2 -2
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +5 -5
- package/lib/cjs/components/addresses/AddressInput.d.ts +0 -1
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +0 -1
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +0 -1
- package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +2 -2
- package/lib/cjs/components/auth/CommerceLayer.d.ts +2 -2
- package/lib/cjs/components/customers/CustomerField.d.ts +0 -1
- package/lib/cjs/components/customers/CustomerInput.d.ts +0 -1
- package/lib/cjs/components/errors/Errors.d.ts +28 -3
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +2 -2
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +0 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +2 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/cjs/components/line_items/LineItem.d.ts +2 -3
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemCode.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemField.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemImage.d.ts +3 -3
- package/lib/cjs/components/line_items/LineItemName.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemsContainer.d.ts +3 -3
- package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +0 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +0 -1
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +0 -1
- package/lib/cjs/components/orders/CheckoutLink.d.ts +0 -1
- package/lib/cjs/components/orders/DiscountAmount.d.ts +0 -1
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +0 -1
- package/lib/cjs/components/orders/OrderContainer.d.ts +2 -2
- package/lib/cjs/components/orders/OrderList.d.ts +2 -2
- package/lib/cjs/components/orders/OrderListEmpty.d.ts +0 -1
- package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +0 -1
- package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +0 -1
- package/lib/cjs/components/orders/OrderListRow.d.ts +0 -1
- package/lib/cjs/components/orders/OrderNumber.d.ts +0 -1
- package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +0 -1
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -1
- package/lib/cjs/components/orders/ShippingAmount.d.ts +0 -1
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +0 -1
- package/lib/cjs/components/orders/TaxesAmount.d.ts +0 -1
- package/lib/cjs/components/orders/TotalAmount.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelField.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelLineItem.d.ts +2 -2
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +0 -1
- package/lib/cjs/components/parcels/Parcels.d.ts +0 -1
- package/lib/cjs/components/parcels/ParcelsCount.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +4 -0
- package/lib/cjs/components/payment_gateways/ExternalGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/PaymentGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +0 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +0 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +7 -6
- package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +0 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +0 -1
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +5 -6
- package/lib/cjs/components/payment_source/BraintreePayment.js +1 -1
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/ExternalPayment.d.ts +23 -0
- package/lib/cjs/components/payment_source/ExternalPayment.js +1 -0
- package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +0 -1
- package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +0 -1
- package/lib/cjs/components/payment_source/StripePayment.d.ts +2 -3
- package/lib/cjs/components/payment_source/StripePayment.js +1 -1
- package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +3 -4
- package/lib/cjs/components/payment_source/WireTransferPayment.js +1 -1
- package/lib/cjs/components/prices/Price.d.ts +0 -1
- package/lib/cjs/components/prices/PricesContainer.d.ts +0 -1
- package/lib/cjs/components/shipments/Shipment.js +1 -1
- package/lib/cjs/components/shipments/ShipmentField.d.ts +0 -1
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +0 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +0 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +0 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +0 -1
- package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +0 -1
- package/lib/cjs/components/skus/SkuField.d.ts +0 -1
- package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +2 -2
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +0 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +0 -1
- package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +0 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +0 -1
- package/lib/cjs/components/utils/PriceTemplate.d.ts +0 -1
- package/lib/cjs/components/utils/getAllErrors.d.ts +3 -3
- package/lib/cjs/index.d.ts +1 -2
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/AddressReducer.d.ts +4 -3
- package/lib/cjs/reducers/OrderReducer.js +1 -1
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +8 -5
- package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
- package/lib/cjs/typings/errors.d.ts +2 -42
- package/lib/cjs/typings/errors.js +1 -1
- package/lib/cjs/typings/globals.d.ts +1 -0
- package/lib/cjs/typings/globals.js +1 -0
- package/lib/cjs/typings/index.d.ts +5 -14
- package/lib/cjs/typings/index.js +1 -1
- package/lib/cjs/utils/filterChildren.d.ts +3 -3
- package/lib/cjs/utils/filterChildren.js +1 -1
- package/lib/cjs/utils/getErrors.d.ts +3 -2
- package/lib/cjs/utils/getLineItemsCount.d.ts +2 -2
- package/lib/cjs/utils/getLoaderComponent.d.ts +1 -2
- package/lib/cjs/utils/getLoaderComponent.js +1 -1
- package/lib/cjs/utils/getPaymentAttributes.d.ts +15 -0
- package/lib/cjs/utils/getPaymentAttributes.js +1 -0
- package/lib/cjs/utils/getPrices.d.ts +0 -1
- package/lib/cjs/utils/icons.d.ts +0 -1
- package/lib/cjs/utils/pick.d.ts +1 -0
- package/lib/cjs/utils/pick.js +1 -0
- package/lib/cjs/utils/replace.d.ts +2 -0
- package/lib/cjs/utils/replace.js +1 -0
- package/lib/cjs/utils/snakeToCamelCase.d.ts +5 -0
- package/lib/cjs/utils/snakeToCamelCase.js +1 -0
- package/lib/cjs/utils/validateFormFields.d.ts +4 -3
- package/lib/esm/components/MetadataInput.d.ts +0 -1
- package/lib/esm/components/addresses/Address.d.ts +2 -2
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +5 -5
- package/lib/esm/components/addresses/AddressInput.d.ts +0 -1
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +0 -1
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +0 -1
- package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +2 -2
- package/lib/esm/components/auth/CommerceLayer.d.ts +2 -2
- package/lib/esm/components/customers/CustomerField.d.ts +0 -1
- package/lib/esm/components/customers/CustomerInput.d.ts +0 -1
- package/lib/esm/components/errors/Errors.d.ts +28 -3
- package/lib/esm/components/gift_cards/GiftCard.d.ts +2 -2
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +0 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +2 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/esm/components/line_items/LineItem.d.ts +2 -3
- package/lib/esm/components/line_items/LineItemAmount.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemCode.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemField.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemImage.d.ts +3 -3
- package/lib/esm/components/line_items/LineItemName.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemsContainer.d.ts +3 -3
- package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
- package/lib/esm/components/line_items/LineItemsCount.d.ts +0 -1
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +0 -1
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +0 -1
- package/lib/esm/components/orders/CheckoutLink.d.ts +0 -1
- package/lib/esm/components/orders/DiscountAmount.d.ts +0 -1
- package/lib/esm/components/orders/GiftCardAmount.d.ts +0 -1
- package/lib/esm/components/orders/OrderContainer.d.ts +2 -2
- package/lib/esm/components/orders/OrderList.d.ts +2 -2
- package/lib/esm/components/orders/OrderListEmpty.d.ts +0 -1
- package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +0 -1
- package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +0 -1
- package/lib/esm/components/orders/OrderListRow.d.ts +0 -1
- package/lib/esm/components/orders/OrderNumber.d.ts +0 -1
- package/lib/esm/components/orders/PaymentMethodAmount.d.ts +0 -1
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -1
- package/lib/esm/components/orders/ShippingAmount.d.ts +0 -1
- package/lib/esm/components/orders/SubTotalAmount.d.ts +0 -1
- package/lib/esm/components/orders/TaxesAmount.d.ts +0 -1
- package/lib/esm/components/orders/TotalAmount.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelField.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelLineItem.d.ts +2 -2
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +0 -1
- package/lib/esm/components/parcels/Parcels.d.ts +0 -1
- package/lib/esm/components/parcels/ParcelsCount.d.ts +0 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +4 -0
- package/lib/esm/components/payment_gateways/ExternalGateway.js +1 -1
- package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/PaymentGateway.js +1 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/esm/components/payment_gateways/StripeGateway.d.ts +0 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +0 -1
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +7 -6
- package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +0 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +0 -1
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +5 -6
- package/lib/esm/components/payment_source/BraintreePayment.js +1 -1
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +0 -1
- package/lib/esm/components/payment_source/ExternalPayment.d.ts +23 -0
- package/lib/esm/components/payment_source/ExternalPayment.js +1 -0
- package/lib/esm/components/payment_source/KlarnaPayment.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSource.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +0 -1
- package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +0 -1
- package/lib/esm/components/payment_source/StripePayment.d.ts +2 -3
- package/lib/esm/components/payment_source/StripePayment.js +1 -1
- package/lib/esm/components/payment_source/WireTransferPayment.d.ts +3 -4
- package/lib/esm/components/payment_source/WireTransferPayment.js +1 -1
- package/lib/esm/components/prices/Price.d.ts +0 -1
- package/lib/esm/components/prices/PricesContainer.d.ts +0 -1
- package/lib/esm/components/shipments/Shipment.js +1 -1
- package/lib/esm/components/shipments/ShipmentField.d.ts +0 -1
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +0 -1
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +0 -1
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +0 -1
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +0 -1
- package/lib/esm/components/skus/DeliveryLeadTime.d.ts +0 -1
- package/lib/esm/components/skus/SkuField.d.ts +0 -1
- package/lib/esm/components/stock_transfers/StockTransfer.d.ts +2 -2
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +0 -1
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +0 -1
- package/lib/esm/components/utils/BaseInput.d.ts +1 -1
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +0 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +0 -1
- package/lib/esm/components/utils/PriceTemplate.d.ts +0 -1
- package/lib/esm/components/utils/getAllErrors.d.ts +3 -3
- package/lib/esm/index.d.ts +1 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/reducers/AddressReducer.d.ts +4 -3
- package/lib/esm/reducers/OrderReducer.js +1 -1
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +8 -5
- package/lib/esm/reducers/PaymentMethodReducer.js +1 -1
- package/lib/esm/typings/errors.d.ts +2 -42
- package/lib/esm/typings/errors.js +1 -1
- package/lib/esm/typings/globals.d.ts +1 -0
- package/lib/esm/typings/globals.js +1 -0
- package/lib/esm/typings/index.d.ts +5 -14
- package/lib/esm/typings/index.js +1 -1
- package/lib/esm/utils/filterChildren.d.ts +3 -3
- package/lib/esm/utils/filterChildren.js +1 -1
- package/lib/esm/utils/getErrors.d.ts +3 -2
- package/lib/esm/utils/getLineItemsCount.d.ts +2 -2
- package/lib/esm/utils/getLoaderComponent.d.ts +1 -2
- package/lib/esm/utils/getLoaderComponent.js +1 -1
- package/lib/esm/utils/getPaymentAttributes.d.ts +15 -0
- package/lib/esm/utils/getPaymentAttributes.js +1 -0
- package/lib/esm/utils/getPrices.d.ts +0 -1
- package/lib/esm/utils/icons.d.ts +0 -1
- package/lib/esm/utils/pick.d.ts +1 -0
- package/lib/esm/utils/pick.js +1 -0
- package/lib/esm/utils/replace.d.ts +2 -0
- package/lib/esm/utils/replace.js +1 -0
- package/lib/esm/utils/snakeToCamelCase.d.ts +5 -0
- package/lib/esm/utils/snakeToCamelCase.js +1 -0
- package/lib/esm/utils/validateFormFields.d.ts +4 -3
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +23 -24
- package/lib/cjs/components/gift_cards/GiftCardRecipient.d.ts +0 -0
- package/lib/cjs/components/gift_cards/GiftCardRecipient.js +0 -1
- package/lib/cjs/utils/paypalPayment.d.ts +0 -3
- package/lib/cjs/utils/paypalPayment.js +0 -1
- package/lib/esm/components/gift_cards/GiftCardRecipient.d.ts +0 -0
- package/lib/esm/components/gift_cards/GiftCardRecipient.js +0 -1
- package/lib/esm/utils/paypalPayment.d.ts +0 -3
- package/lib/esm/utils/paypalPayment.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { Address as AddressType } from '@commercelayer/sdk';
|
|
3
2
|
import { AddressCardsTemplateChildren } from '../utils/AddressCardsTemplate';
|
|
3
|
+
import type { DefaultChildrenType } from '../../typings/globals';
|
|
4
4
|
interface Props extends Omit<JSX.IntrinsicElements['div'], 'children' | 'onSelect'> {
|
|
5
|
-
children:
|
|
5
|
+
children: DefaultChildrenType | AddressCardsTemplateChildren;
|
|
6
6
|
selectedClassName?: string;
|
|
7
7
|
disabledClassName?: string;
|
|
8
8
|
onSelect?: (address: AddressType) => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { AddressCountrySelectName, BaseSelectComponentProps } from '../../typings/index';
|
|
1
|
+
import { BaseSelectComponentProps } from '../../typings/index';
|
|
3
2
|
import { AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
4
|
-
type
|
|
5
|
-
|
|
3
|
+
type TCountryFieldName = 'billing_address_country_code' | 'shipping_address_country_code' | 'customer_address_country_code';
|
|
4
|
+
interface Props extends Omit<BaseSelectComponentProps, 'options' | 'name'>, Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'> {
|
|
5
|
+
name: Extract<AddressValuesKeys, TCountryFieldName>;
|
|
6
6
|
required?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
export declare function AddressCountrySelector(props: Props): JSX.Element;
|
|
10
10
|
export default AddressCountrySelector;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DefaultChildrenType } from '../../typings/globals';
|
|
2
2
|
interface Props {
|
|
3
|
-
children:
|
|
3
|
+
children: DefaultChildrenType;
|
|
4
4
|
}
|
|
5
5
|
export declare function ShippingAddressContainer(props: Props): JSX.Element;
|
|
6
6
|
export default ShippingAddressContainer;
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
type
|
|
1
|
+
import type { CodeErrorType } from '../../typings/errors';
|
|
2
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
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';
|
|
4
|
+
type ErrorChildrenComponentProps = ChildrenFunction<Omit<TErrorComponent, 'children'> & {
|
|
5
|
+
errors: string[];
|
|
6
|
+
}>;
|
|
7
|
+
export interface TErrorComponent extends Omit<JSX.IntrinsicElements['span'], 'children'> {
|
|
8
|
+
/**
|
|
9
|
+
* Resource which get the error
|
|
10
|
+
*/
|
|
11
|
+
resource: TResourceError;
|
|
12
|
+
children?: ErrorChildrenComponentProps;
|
|
13
|
+
/**
|
|
14
|
+
* Field which get the error
|
|
15
|
+
*/
|
|
16
|
+
field?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Error message which you can translate
|
|
19
|
+
*/
|
|
20
|
+
messages?: Array<{
|
|
21
|
+
code: CodeErrorType;
|
|
22
|
+
message: string;
|
|
23
|
+
resource?: TResourceError;
|
|
24
|
+
field?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
type Props = TErrorComponent;
|
|
4
29
|
export declare function Errors(props: Props): JSX.Element;
|
|
5
30
|
export default Errors;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BaseState } from '../../typings/index';
|
|
2
|
+
import type { DefaultChildrenType } from '../../typings/globals';
|
|
3
3
|
interface Props extends Omit<JSX.IntrinsicElements['form'], 'children'> {
|
|
4
|
-
children:
|
|
4
|
+
children: DefaultChildrenType;
|
|
5
5
|
onSubmit?: (values: BaseState) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function GiftCard(props: Props): JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ChildrenFunction } from '../../typings/index';
|
|
3
3
|
import { CodeType, OrderCodeType } from '../../reducers/OrderReducer';
|
|
4
|
-
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
4
|
+
interface ChildrenProps extends Omit<Props, 'children' | 'onClick'> {
|
|
5
5
|
codeType?: OrderCodeType;
|
|
6
6
|
hide?: boolean;
|
|
7
7
|
handleClick?: () => void;
|
|
@@ -13,6 +13,6 @@ type Props = {
|
|
|
13
13
|
onClick?: (response: {
|
|
14
14
|
success: boolean;
|
|
15
15
|
}) => void;
|
|
16
|
-
} & Omit<JSX.IntrinsicElements['button'], 'type'>;
|
|
16
|
+
} & Omit<JSX.IntrinsicElements['button'], 'type' | 'onClick'>;
|
|
17
17
|
export declare function GiftCardOrCouponRemoveButton(props: Props): JSX.Element | null;
|
|
18
18
|
export default GiftCardOrCouponRemoveButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardOrCouponRemoveButton=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")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext"))
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardOrCouponRemoveButton=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")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext"));function GiftCardOrCouponRemoveButton(props){const{children,label="Remove",onClick,type,...p}=props,{order,removeGiftCardOrCouponCode}=(0,react_1.useContext)(OrderContext_1.default);let codeType=type?`${type}_code`:void 0;!type&&order&&"coupon_code"in order&&order.coupon_code!=null?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),handleClick=async()=>{const response=removeGiftCardOrCouponCode&&codeType&&await removeGiftCardOrCouponCode({codeType});onClick&&response&&onClick(response)},parentProps={...p,label,handleClick,codeType};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):hide?null:(0,jsx_runtime_1.jsx)("button",{type:"button",onClick:()=>{handleClick()},...p,children:label})}exports.GiftCardOrCouponRemoveButton=GiftCardOrCouponRemoveButton,exports.default=GiftCardOrCouponRemoveButton;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { LineItemType } from '../../typings/index';
|
|
1
|
+
export type TLineItem = 'gift_cards' | 'payment_methods' | 'promotions' | 'shipments' | 'skus' | 'bundles' | 'adjustments';
|
|
3
2
|
interface Props {
|
|
4
3
|
children: JSX.Element | JSX.Element[];
|
|
5
|
-
type?:
|
|
4
|
+
type?: TLineItem;
|
|
6
5
|
}
|
|
7
6
|
export declare function LineItem(props: Props): JSX.Element;
|
|
8
7
|
export default LineItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { LineItem } from '@commercelayer/sdk';
|
|
3
|
-
import { ChildrenFunction
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
import { TLineItem } from './LineItem';
|
|
4
4
|
export interface TLineItemImage extends Omit<Props, 'children'> {
|
|
5
5
|
src: string;
|
|
6
6
|
lineItem: LineItem;
|
|
@@ -9,7 +9,7 @@ type Props = {
|
|
|
9
9
|
children?: ChildrenFunction<TLineItemImage>;
|
|
10
10
|
width?: number;
|
|
11
11
|
placeholder?: {
|
|
12
|
-
[K in
|
|
12
|
+
[K in TLineItem]?: string;
|
|
13
13
|
};
|
|
14
14
|
} & Omit<JSX.IntrinsicElements['img'], 'src' | 'srcSet' | 'placeholder'>;
|
|
15
15
|
export declare function LineItemImage(props: Props): JSX.Element | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DefaultChildrenType } from '../../typings/globals';
|
|
2
2
|
interface Props {
|
|
3
|
-
children:
|
|
3
|
+
children: DefaultChildrenType;
|
|
4
4
|
filters?: Record<string, any>;
|
|
5
|
-
loader?:
|
|
5
|
+
loader?: JSX.Element;
|
|
6
6
|
}
|
|
7
7
|
export declare function LineItemsContainer(props: Props): JSX.Element;
|
|
8
8
|
export default LineItemsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemReducer_1=tslib_1.__importStar(require("../../reducers/LineItemReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),LineItemContext_1=tslib_1.__importDefault(require("../../context/LineItemContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext"));function LineItemsContainer(props){const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default),[state,dispatch]=(0,react_1.useReducer)(LineItemReducer_1.default,LineItemReducer_1.lineItemInitialState);(0,react_1.useEffect)(()=>{include?.includes("line_items.line_item_options.sku_option")?includeLoaded?.["line_items.line_item_options.sku_option"]||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),include?.includes("line_items.item")?includeLoaded?.["line_items.item"]||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]})},[include,includeLoaded]),(0,react_1.useEffect)(()=>{order?.line_items&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}})},[order?.line_items]);const lineItemValue={...state,loader,updateLineItem:(lineItemId,quantity=1)=>(0,LineItemReducer_1.updateLineItem)({lineItemId,quantity,dispatch,config,getOrder,orderId,errors:state.errors}),deleteLineItem:lineItemId=>(0,LineItemReducer_1.deleteLineItem)({lineItemId,dispatch,config,getOrder,orderId,errors:state.errors})};return(0,jsx_runtime_1.jsx)(LineItemContext_1.default.Provider,{value:lineItemValue,children:state.loading?loader:children})}exports.LineItemsContainer=LineItemsContainer,exports.default=LineItemsContainer;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemReducer_1=tslib_1.__importStar(require("../../reducers/LineItemReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),LineItemContext_1=tslib_1.__importDefault(require("../../context/LineItemContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext"));function LineItemsContainer(props){const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default),[state,dispatch]=(0,react_1.useReducer)(LineItemReducer_1.default,LineItemReducer_1.lineItemInitialState);(0,react_1.useEffect)(()=>{include?.includes("line_items.line_item_options.sku_option")?includeLoaded?.["line_items.line_item_options.sku_option"]||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),include?.includes("line_items.item")?includeLoaded?.["line_items.item"]||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]})},[include,includeLoaded]),(0,react_1.useEffect)(()=>{order?.line_items&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}})},[order?.line_items]);const lineItemValue={...state,loader,updateLineItem:async(lineItemId,quantity=1)=>await(0,LineItemReducer_1.updateLineItem)({lineItemId,quantity,dispatch,config,getOrder,orderId,errors:state.errors}),deleteLineItem:async lineItemId=>await(0,LineItemReducer_1.deleteLineItem)({lineItemId,dispatch,config,getOrder,orderId,errors:state.errors})};return(0,jsx_runtime_1.jsx)(LineItemContext_1.default.Provider,{value:lineItemValue,children:state.loading?loader:children})}exports.LineItemsContainer=LineItemsContainer,exports.default=LineItemsContainer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BaseMetadataObject } from '../../typings/index';
|
|
3
2
|
import type { OrderCreate, Order } from '@commercelayer/sdk';
|
|
3
|
+
import type { DefaultChildrenType } from '../../typings/globals';
|
|
4
4
|
interface Props {
|
|
5
|
-
children:
|
|
5
|
+
children: DefaultChildrenType;
|
|
6
6
|
/**
|
|
7
7
|
* Metadata to add when creates a new order
|
|
8
8
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { InitialOrderListContext } from '../../context/OrderListChildrenContext';
|
|
3
2
|
import { Column } from 'react-table';
|
|
4
3
|
import type { Order } from '@commercelayer/sdk';
|
|
4
|
+
import type { DefaultChildrenType } from '../../typings/globals';
|
|
5
5
|
export type OrderListColumn = Column & {
|
|
6
6
|
Header: string;
|
|
7
7
|
accessor: keyof Order;
|
|
@@ -31,7 +31,7 @@ type PaginationProps = {
|
|
|
31
31
|
pageSize?: never;
|
|
32
32
|
};
|
|
33
33
|
type Props = {
|
|
34
|
-
children:
|
|
34
|
+
children: DefaultChildrenType;
|
|
35
35
|
/**
|
|
36
36
|
* Columns to show
|
|
37
37
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type OrderListPaginationContext as TOrderListPaginationContext } from '../../context/OrderListPaginationContext';
|
|
3
2
|
import { ChildrenFunction } from '../../typings/index';
|
|
4
3
|
interface PaginationButton extends Omit<JSX.IntrinsicElements['button'], 'children' | 'disabled'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlaceOrderButton=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")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails"));function PlaceOrderButton(props){const ref=(0,react_1.useRef)(null),{children,label="Place order",disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef}=(0,react_1.useContext)(PlaceOrderContext_1.default),[notPermitted,setNotPermitted]=(0,react_1.useState)(!0),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),isFree=order?.total_amount_with_taxes_cents===0;(0,react_1.useEffect)(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType});(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,currentPaymentMethodRef?.current?.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),(0,react_1.useEffect)(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.paypalPayerId,paymentType]),(0,react_1.useEffect)(()=>{if(paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&order?.status&&["draft","pending"].includes(order?.status)&&paymentSource!=null){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlaceOrderButton=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")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails"));function PlaceOrderButton(props){const ref=(0,react_1.useRef)(null),{children,label="Place order",disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef}=(0,react_1.useContext)(PlaceOrderContext_1.default),[notPermitted,setNotPermitted]=(0,react_1.useState)(!0),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),isFree=order?.total_amount_with_taxes_cents===0;(0,react_1.useEffect)(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType});(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,currentPaymentMethodRef?.current?.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),(0,react_1.useEffect)(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.paypalPayerId,paymentType]),(0,react_1.useEffect)(()=>{if(paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&order?.status&&["draft","pending"].includes(order?.status)&&paymentSource!=null){const attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode=res?.payment_response?.resultCode,errorCode=res?.payment_response?.errorCode,message=res?.payment_response?.message;["Authorised","Pending","Received"].includes(resultCode)?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}paymentType==="adyen_payments"&&options?.adyen?.MD&&options?.adyen?.PaRes&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.adyen,paymentType]),(0,react_1.useEffect)(()=>{paymentType==="checkout_com_payments"&&options?.checkoutCom?.session_id&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.checkoutCom,paymentType]),(0,react_1.useEffect)(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=async()=>{let isValid=!0;setForceDisable(!0);const checkPaymentSource=await setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}),card=paymentType&&(0,getCardDetails_1.default)({paymentType,customerPayment:{payment_source:checkPaymentSource}});currentPaymentMethodRef?.current?.onsubmit&&[!options?.paypalPayerId,!options?.adyen?.MD,!options?.checkoutCom?.session_id].every(Boolean)?(isValid=await currentPaymentMethodRef.current?.onsubmit(checkPaymentSource),!isValid&&checkPaymentSource.payment_response?.resultCode==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0);const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&await setPlaceOrder({paymentSource:checkPaymentSource});setForceDisable(!1),onClick&&placed&&onClick(placed)},disabledButton=disabled!==void 0?disabled:notPermitted,parentProps={...p,label,disabled:disabledButton,handleClick,ref};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("button",{ref,type:"button",disabled:disabledButton||forceDisable,onClick:()=>{handleClick()},...p,children:(0,isFunction_1.default)(label)?label():label})}exports.PlaceOrderButton=PlaceOrderButton,exports.default=PlaceOrderButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DefaultChildrenType } from '../../typings/globals';
|
|
2
2
|
interface Props {
|
|
3
|
-
children:
|
|
3
|
+
children: DefaultChildrenType;
|
|
4
4
|
}
|
|
5
5
|
export declare function ParcelLineItem({ children }: Props): JSX.Element;
|
|
6
6
|
export default ParcelLineItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),AdyenPayment_1=tslib_1.__importDefault(require("../payment_source/AdyenPayment")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),jwt_1=tslib_1.__importDefault(require("../../utils/jwt")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes");function AdyenGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=(0,react_1.useContext)(OrderContext_1.default),{accessToken}=(0,react_1.useContext)(CommerceLayerContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{payments,isGuest}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="adyen_payments",locale=order?.language_code,paymentMethods=paymentSource?.payment_methods;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientKey=paymentSource?.public_key,environment=accessToken&&(0,jwt_1.default)(accessToken).test?"test":"live",paymentConfig=(0,getPaymentAttributes_1.getPaymentAttributes)({resource:paymentResource,config:config??{},keys:["adyen_payments"]})?.adyenPayment,customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type==="adyen_payments"):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{templateCustomerSaveToWallet,clientKey,locale,environment,config:paymentConfig})]}):loaderComponent:clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{clientKey,locale,config:paymentConfig,environment}):loaderComponent}exports.AdyenGateway=AdyenGateway,exports.default=AdyenGateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BraintreeGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BraintreePayment_1=tslib_1.__importDefault(require("../payment_source/BraintreePayment")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BraintreeGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BraintreePayment_1=tslib_1.__importDefault(require("../payment_source/BraintreePayment")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes");function BraintreeGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=(0,react_1.useContext)(OrderContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{payments,isGuest}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="braintree_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const authorization=paymentSource?.client_token,paymentConfig=(0,getPaymentAttributes_1.getPaymentAttributes)({resource:paymentResource,config:config??{},keys:["braintree_payments"]})?.braintreePayment,customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type==="braintree_payments"):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?authorization&&!loading?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(BraintreePayment_1.default,{templateCustomerSaveToWallet,authorization,locale,config:paymentConfig})]}):loaderComponent:authorization&&!loading?(0,jsx_runtime_1.jsx)(BraintreePayment_1.default,{locale,authorization,config:paymentConfig}):loaderComponent}exports.BraintreeGateway=BraintreeGateway,exports.default=BraintreeGateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExternalGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ExternalPayment_1=tslib_1.__importDefault(require("../payment_source/ExternalPayment")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=tslib_1.__importDefault(require("react")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate"));function ExternalGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=react_1.default.useContext(OrderContext_1.default),{payment}=react_1.default.useContext(PaymentMethodChildrenContext_1.default),{payments,isGuest}=react_1.default.useContext(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=react_1.default.useContext(PaymentMethodContext_1.default),paymentResource="external_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const paymentSourceToken=paymentSource?.payment_source_token,paymentSourceId=order?.payment_source?.id||paymentSource?.id,paymentConfig=(config?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{})?.externalPayment,customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type===paymentResource):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(ExternalPayment_1.default,{show,templateCustomerSaveToWallet,paymentSourceToken,locale,...paymentConfig})]}):paymentSourceToken&&!loading&&paymentSourceId?(0,jsx_runtime_1.jsx)(ExternalPayment_1.default,{show,paymentSourceToken,locale,...paymentConfig}):loaderComponent}exports.ExternalGateway=ExternalGateway,exports.default=ExternalGateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),react_1=require("react"),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),AdyenGateway_1=tslib_1.__importDefault(require("./AdyenGateway")),StripeGateway_1=tslib_1.__importDefault(require("./StripeGateway")),BraintreeGateway_1=tslib_1.__importDefault(require("./BraintreeGateway")),PaypalGateway_1=tslib_1.__importDefault(require("./PaypalGateway")),WireTransferGateway_1=tslib_1.__importDefault(require("./WireTransferGateway")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),CheckoutComGateway_1=tslib_1.__importDefault(require("./CheckoutComGateway")),KlarnaGateway_1=tslib_1.__importDefault(require("./KlarnaGateway")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes"),ExternalGateway_1=tslib_1.__importDefault(require("./ExternalGateway"));function PaymentGateway({readonly,showCard,handleEditClick,children,templateCustomerCards,templateCustomerSaveToWallet,onClickCustomerCards,show,loader="Loading...",...p}){const loaderComponent=(0,getLoaderComponent_1.default)(loader),[loading,setLoading]=(0,react_1.useState)(!0),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{getCustomerPaymentSources}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,currentPaymentMethodType,setPaymentSource,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource=readonly?currentPaymentMethodType:payment?.payment_source_type;(0,react_1.useEffect)(()=>{if(payment?.id===currentPaymentMethodId&&paymentResource&&order?.payment_method?.payment_source_type===paymentResource){let attributes={};config!=null&&paymentResource==="paypal_payments"&&(attributes=(0,getPaymentAttributes_1.getPaypalAttributes)(paymentResource,config)),config!=null&&paymentResource==="external_payments"&&(attributes=(0,getPaymentAttributes_1.getExternalPaymentAttributes)(paymentResource,config));const setPaymentSources=async()=>{await setPaymentSource({paymentResource,order,attributes}),getCustomerPaymentSources&&getCustomerPaymentSources()};(!paymentSource&&order?.payment_method.id&&show||(!paymentSource||paymentSource.type!==paymentResource)&&show)&&setPaymentSources(),paymentSource?.mismatched_amounts&&show&&setPaymentSources(),setLoading(!1)}return()=>{setLoading(!0)}},[order?.payment_method?.id,show,paymentSource]);const gatewayConfig={readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet,...p};switch(paymentResource){case"adyen_payments":return(0,jsx_runtime_1.jsx)(AdyenGateway_1.default,{...gatewayConfig,children});case"braintree_payments":return(0,jsx_runtime_1.jsx)(BraintreeGateway_1.default,{...gatewayConfig,children});case"checkout_com_payments":return(0,jsx_runtime_1.jsx)(CheckoutComGateway_1.default,{...gatewayConfig,children});case"external_payments":return(0,jsx_runtime_1.jsx)(ExternalGateway_1.default,{...gatewayConfig,children});case"klarna_payments":return(0,jsx_runtime_1.jsx)(KlarnaGateway_1.default,{...gatewayConfig,children});case"stripe_payments":return(0,jsx_runtime_1.jsx)(StripeGateway_1.default,{...gatewayConfig,children});case"wire_transfers":return(0,jsx_runtime_1.jsx)(WireTransferGateway_1.default,{...gatewayConfig,children});case"paypal_payments":return(0,jsx_runtime_1.jsx)(PaypalGateway_1.default,{...gatewayConfig,children});default:return null}}exports.PaymentGateway=PaymentGateway,exports.default=PaymentGateway;
|