@commercelayer/react-components 4.21.0-beta.1 → 4.21.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/ExternalFunction.d.ts +7 -0
- package/lib/cjs/components/ExternalFunction.js +2 -0
- package/lib/cjs/components/MetadataInput.d.ts +5 -0
- package/lib/cjs/components/MetadataInput.js +2 -0
- package/lib/cjs/components/SubmitButton.d.ts +10 -0
- package/lib/cjs/components/SubmitButton.js +2 -0
- package/lib/cjs/components/addresses/Address.d.ts +31 -0
- package/lib/cjs/components/addresses/Address.js +2 -0
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +34 -0
- package/lib/cjs/components/addresses/AddressCountrySelector.js +2 -0
- package/lib/cjs/components/addresses/AddressField.d.ts +61 -0
- package/lib/cjs/components/addresses/AddressField.js +2 -0
- package/lib/cjs/components/addresses/AddressInput.d.ts +34 -0
- package/lib/cjs/components/addresses/AddressInput.js +2 -0
- package/lib/cjs/components/addresses/AddressInputSelect.d.ts +29 -0
- package/lib/cjs/components/addresses/AddressInputSelect.js +2 -0
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +50 -0
- package/lib/cjs/components/addresses/AddressStateSelector.js +2 -0
- package/lib/cjs/components/addresses/AddressesContainer.d.ts +40 -0
- package/lib/cjs/components/addresses/AddressesContainer.js +2 -0
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +26 -0
- package/lib/cjs/components/addresses/AddressesEmpty.js +2 -0
- package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +6 -0
- package/lib/cjs/components/addresses/BillingAddressContainer.js +2 -0
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +34 -0
- package/lib/cjs/components/addresses/BillingAddressForm.js +2 -0
- package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +18 -0
- package/lib/cjs/components/addresses/SaveAddressesButton.js +2 -0
- package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +7 -0
- package/lib/cjs/components/addresses/ShippingAddressContainer.js +2 -0
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +31 -0
- package/lib/cjs/components/addresses/ShippingAddressForm.js +2 -0
- package/lib/cjs/components/auth/CommerceLayer.d.ts +25 -0
- package/lib/cjs/components/auth/CommerceLayer.js +2 -0
- package/lib/cjs/components/customers/CustomerAddressForm.d.ts +13 -0
- package/lib/cjs/components/customers/CustomerAddressForm.js +2 -0
- package/lib/cjs/components/customers/CustomerContainer.d.ts +38 -0
- package/lib/cjs/components/customers/CustomerContainer.js +2 -0
- package/lib/cjs/components/customers/CustomerField.d.ts +25 -0
- package/lib/cjs/components/customers/CustomerField.js +2 -0
- package/lib/cjs/components/customers/CustomerInput.d.ts +11 -0
- package/lib/cjs/components/customers/CustomerInput.js +2 -0
- package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +11 -0
- package/lib/cjs/components/customers/CustomerPaymentSource.js +2 -0
- package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +14 -0
- package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.js +2 -0
- package/lib/cjs/components/customers/MyAccountLink.d.ts +38 -0
- package/lib/cjs/components/customers/MyAccountLink.js +2 -0
- package/lib/cjs/components/customers/MyIdentityLink.d.ts +59 -0
- package/lib/cjs/components/customers/MyIdentityLink.js +2 -0
- package/lib/cjs/components/customers/SaveCustomerButton.d.ts +12 -0
- package/lib/cjs/components/customers/SaveCustomerButton.js +2 -0
- package/lib/cjs/components/errors/Errors.d.ts +31 -0
- package/lib/cjs/components/errors/Errors.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +10 -0
- package/lib/cjs/components/gift_cards/GiftCard.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +6 -0
- package/lib/cjs/components/gift_cards/GiftCardContainer.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +7 -0
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +7 -0
- package/lib/cjs/components/gift_cards/GiftCardInput.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +16 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +15 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +11 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +20 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +10 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +2 -0
- package/lib/cjs/components/gift_cards/GiftCardRecipientInput.d.ts +0 -0
- package/lib/cjs/components/gift_cards/GiftCardRecipientInput.js +2 -0
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +36 -0
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.js +2 -0
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +10 -0
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.js +2 -0
- package/lib/cjs/components/line_items/LineItem.d.ts +8 -0
- package/lib/cjs/components/line_items/LineItem.js +2 -0
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +7 -0
- package/lib/cjs/components/line_items/LineItemAmount.js +2 -0
- package/lib/cjs/components/line_items/LineItemCode.d.ts +13 -0
- package/lib/cjs/components/line_items/LineItemCode.js +2 -0
- package/lib/cjs/components/line_items/LineItemField.d.ts +14 -0
- package/lib/cjs/components/line_items/LineItemField.js +2 -0
- package/lib/cjs/components/line_items/LineItemImage.d.ts +17 -0
- package/lib/cjs/components/line_items/LineItemImage.js +2 -0
- package/lib/cjs/components/line_items/LineItemName.d.ts +12 -0
- package/lib/cjs/components/line_items/LineItemName.js +2 -0
- package/lib/cjs/components/line_items/LineItemOption.d.ts +19 -0
- package/lib/cjs/components/line_items/LineItemOption.js +2 -0
- package/lib/cjs/components/line_items/LineItemOptions.d.ts +16 -0
- package/lib/cjs/components/line_items/LineItemOptions.js +2 -0
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +21 -0
- package/lib/cjs/components/line_items/LineItemQuantity.js +2 -0
- package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +14 -0
- package/lib/cjs/components/line_items/LineItemRemoveLink.js +2 -0
- package/lib/cjs/components/line_items/LineItemsContainer.d.ts +9 -0
- package/lib/cjs/components/line_items/LineItemsContainer.js +2 -0
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +12 -0
- package/lib/cjs/components/line_items/LineItemsCount.js +2 -0
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +12 -0
- package/lib/cjs/components/line_items/LineItemsEmpty.js +2 -0
- package/lib/cjs/components/orders/AddToCartButton.d.ts +95 -0
- package/lib/cjs/components/orders/AddToCartButton.js +2 -0
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +4 -0
- package/lib/cjs/components/orders/AdjustmentAmount.js +2 -0
- package/lib/cjs/components/orders/CartLink.d.ts +47 -0
- package/lib/cjs/components/orders/CartLink.js +2 -0
- package/lib/cjs/components/orders/CheckoutLink.d.ts +28 -0
- package/lib/cjs/components/orders/CheckoutLink.js +2 -0
- package/lib/cjs/components/orders/DiscountAmount.d.ts +4 -0
- package/lib/cjs/components/orders/DiscountAmount.js +2 -0
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +4 -0
- package/lib/cjs/components/orders/GiftCardAmount.js +2 -0
- package/lib/cjs/components/orders/HostedCart.d.ts +58 -0
- package/lib/cjs/components/orders/HostedCart.js +2 -0
- package/lib/cjs/components/orders/OrderContainer.d.ts +62 -0
- package/lib/cjs/components/orders/OrderContainer.js +2 -0
- package/lib/cjs/components/orders/OrderList.d.ts +83 -0
- package/lib/cjs/components/orders/OrderList.js +2 -0
- package/lib/cjs/components/orders/OrderListEmpty.d.ts +17 -0
- package/lib/cjs/components/orders/OrderListEmpty.js +2 -0
- package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +48 -0
- package/lib/cjs/components/orders/OrderListPaginationButtons.js +2 -0
- package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +29 -0
- package/lib/cjs/components/orders/OrderListPaginationInfo.js +2 -0
- package/lib/cjs/components/orders/OrderListRow.d.ts +29 -0
- package/lib/cjs/components/orders/OrderListRow.js +2 -0
- package/lib/cjs/components/orders/OrderNumber.d.ts +5 -0
- package/lib/cjs/components/orders/OrderNumber.js +2 -0
- package/lib/cjs/components/orders/OrderStorage.d.ts +31 -0
- package/lib/cjs/components/orders/OrderStorage.js +2 -0
- package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +4 -0
- package/lib/cjs/components/orders/PaymentMethodAmount.js +2 -0
- package/lib/cjs/components/orders/PlaceOrderButton.d.ts +35 -0
- package/lib/cjs/components/orders/PlaceOrderButton.js +2 -0
- package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +8 -0
- package/lib/cjs/components/orders/PlaceOrderContainer.js +2 -0
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +4 -0
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.js +2 -0
- package/lib/cjs/components/orders/ShippingAmount.d.ts +4 -0
- package/lib/cjs/components/orders/ShippingAmount.js +2 -0
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +4 -0
- package/lib/cjs/components/orders/SubTotalAmount.js +2 -0
- package/lib/cjs/components/orders/TaxesAmount.d.ts +4 -0
- package/lib/cjs/components/orders/TaxesAmount.js +2 -0
- package/lib/cjs/components/orders/TotalAmount.d.ts +4 -0
- package/lib/cjs/components/orders/TotalAmount.js +2 -0
- package/lib/cjs/components/parcels/ParcelField.d.ts +14 -0
- package/lib/cjs/components/parcels/ParcelField.js +2 -0
- package/lib/cjs/components/parcels/ParcelLineItem.d.ts +7 -0
- package/lib/cjs/components/parcels/ParcelLineItem.js +2 -0
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +14 -0
- package/lib/cjs/components/parcels/ParcelLineItemField.js +2 -0
- package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +18 -0
- package/lib/cjs/components/parcels/ParcelLineItemsCount.js +2 -0
- package/lib/cjs/components/parcels/Parcels.d.ts +7 -0
- package/lib/cjs/components/parcels/Parcels.js +2 -0
- package/lib/cjs/components/parcels/ParcelsCount.d.ts +18 -0
- package/lib/cjs/components/parcels/ParcelsCount.js +2 -0
- package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/AdyenGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/BraintreeGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/ExternalGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/KlarnaGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +16 -0
- package/lib/cjs/components/payment_gateways/PaymentGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/PaypalGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/StripeGateway.js +2 -0
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +5 -0
- package/lib/cjs/components/payment_gateways/WireTransferGateway.js +2 -0
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +45 -0
- package/lib/cjs/components/payment_methods/PaymentMethod.js +2 -0
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +10 -0
- package/lib/cjs/components/payment_methods/PaymentMethodName.js +2 -0
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +8 -0
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +2 -0
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +17 -0
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +2 -0
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +8 -0
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +2 -0
- package/lib/cjs/components/payment_source/AdyenPayment.d.ts +66 -0
- package/lib/cjs/components/payment_source/AdyenPayment.js +2 -0
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +32 -0
- package/lib/cjs/components/payment_source/BraintreePayment.js +2 -0
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +23 -0
- package/lib/cjs/components/payment_source/CheckoutComPayment.js +2 -0
- package/lib/cjs/components/payment_source/ExternalPayment.d.ts +24 -0
- package/lib/cjs/components/payment_source/ExternalPayment.js +2 -0
- package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +10 -0
- package/lib/cjs/components/payment_source/KlarnaPayment.js +2 -0
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +19 -0
- package/lib/cjs/components/payment_source/PaymentSource.js +2 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +15 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +2 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +12 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +2 -0
- package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +15 -0
- package/lib/cjs/components/payment_source/PaymentSourceDetail.js +2 -0
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +10 -0
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +2 -0
- package/lib/cjs/components/payment_source/PaypalPayment.d.ts +12 -0
- package/lib/cjs/components/payment_source/PaypalPayment.js +2 -0
- package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +6 -0
- package/lib/cjs/components/payment_source/StripeExpressPayment.js +2 -0
- package/lib/cjs/components/payment_source/StripePayment.d.ts +21 -0
- package/lib/cjs/components/payment_source/StripePayment.js +2 -0
- package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +12 -0
- package/lib/cjs/components/payment_source/WireTransferPayment.js +2 -0
- package/lib/cjs/components/prices/Price.d.ts +35 -0
- package/lib/cjs/components/prices/Price.js +2 -0
- package/lib/cjs/components/prices/PricesContainer.d.ts +41 -0
- package/lib/cjs/components/prices/PricesContainer.js +2 -0
- package/lib/cjs/components/shipments/Shipment.d.ts +10 -0
- package/lib/cjs/components/shipments/Shipment.js +2 -0
- package/lib/cjs/components/shipments/ShipmentField.d.ts +12 -0
- package/lib/cjs/components/shipments/ShipmentField.js +2 -0
- package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +6 -0
- package/lib/cjs/components/shipments/ShipmentsContainer.js +2 -0
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +18 -0
- package/lib/cjs/components/shipments/ShipmentsCount.js +2 -0
- package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +8 -0
- package/lib/cjs/components/shipping_methods/ShippingMethod.js +2 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +11 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodName.js +2 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +20 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +2 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +17 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +2 -0
- package/lib/cjs/components/skus/AvailabilityContainer.d.ts +34 -0
- package/lib/cjs/components/skus/AvailabilityContainer.js +2 -0
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +52 -0
- package/lib/cjs/components/skus/AvailabilityTemplate.js +2 -0
- package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +10 -0
- package/lib/cjs/components/skus/DeliveryLeadTime.js +2 -0
- package/lib/cjs/components/skus/SkuField.d.ts +25 -0
- package/lib/cjs/components/skus/SkuField.js +2 -0
- package/lib/cjs/components/skus/SkuList.d.ts +10 -0
- package/lib/cjs/components/skus/SkuList.js +2 -0
- package/lib/cjs/components/skus/SkuListsContainer.d.ts +6 -0
- package/lib/cjs/components/skus/SkuListsContainer.js +2 -0
- package/lib/cjs/components/skus/Skus.d.ts +18 -0
- package/lib/cjs/components/skus/Skus.js +2 -0
- package/lib/cjs/components/skus/SkusContainer.d.ts +31 -0
- package/lib/cjs/components/skus/SkusContainer.js +2 -0
- package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +7 -0
- package/lib/cjs/components/stock_transfers/StockTransfer.js +2 -0
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +10 -0
- package/lib/cjs/components/stock_transfers/StockTransferField.js +2 -0
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +26 -0
- package/lib/cjs/components/utils/AddressCardsTemplate.js +2 -0
- package/lib/cjs/components/utils/BaseField.d.ts +8 -0
- package/lib/cjs/components/utils/BaseField.js +2 -0
- package/lib/cjs/components/utils/BaseInput.d.ts +5 -0
- package/lib/cjs/components/utils/BaseInput.js +2 -0
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +6 -0
- package/lib/cjs/components/utils/BaseOrderPrice.js +2 -0
- package/lib/cjs/components/utils/BaseSelect.d.ts +5 -0
- package/lib/cjs/components/utils/BaseSelect.js +2 -0
- package/lib/cjs/components/utils/ErrorBoundary.d.ts +14 -0
- package/lib/cjs/components/utils/ErrorBoundary.js +2 -0
- package/lib/cjs/components/utils/GenericFieldComponent.d.ts +58 -0
- package/lib/cjs/components/utils/GenericFieldComponent.js +2 -0
- package/lib/cjs/components/utils/Parent.d.ts +6 -0
- package/lib/cjs/components/utils/Parent.js +2 -0
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +41 -0
- package/lib/cjs/components/utils/PaymentCardsTemplate.js +2 -0
- package/lib/cjs/components/utils/PriceTemplate.d.ts +8 -0
- package/lib/cjs/components/utils/PriceTemplate.js +2 -0
- package/lib/cjs/components/utils/getAllErrors.d.ts +16 -0
- package/lib/cjs/components/utils/getAllErrors.js +2 -0
- package/lib/cjs/config/currency.d.ts +5 -0
- package/lib/cjs/config/currency.js +2 -0
- package/lib/cjs/context/AddressChildrenContext.d.ts +6 -0
- package/lib/cjs/context/AddressChildrenContext.js +2 -0
- package/lib/cjs/context/AddressContext.d.ts +18 -0
- package/lib/cjs/context/AddressContext.js +2 -0
- package/lib/cjs/context/AvailabilityContext.d.ts +2 -0
- package/lib/cjs/context/AvailabilityContext.js +2 -0
- package/lib/cjs/context/BillingAddressContext.d.ts +9 -0
- package/lib/cjs/context/BillingAddressContext.js +2 -0
- package/lib/cjs/context/BillingAddressFormContext.d.ts +22 -0
- package/lib/cjs/context/BillingAddressFormContext.js +2 -0
- package/lib/cjs/context/CommerceLayerContext.d.ts +6 -0
- package/lib/cjs/context/CommerceLayerContext.js +2 -0
- package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +8 -0
- package/lib/cjs/context/CouponAndGiftCardFormContext.js +2 -0
- package/lib/cjs/context/CustomerAddressFormContext.d.ts +17 -0
- package/lib/cjs/context/CustomerAddressFormContext.js +2 -0
- package/lib/cjs/context/CustomerContext.d.ts +29 -0
- package/lib/cjs/context/CustomerContext.js +2 -0
- package/lib/cjs/context/CustomerPaymentSourceContext.d.ts +11 -0
- package/lib/cjs/context/CustomerPaymentSourceContext.js +2 -0
- package/lib/cjs/context/ExternalFunctionContext.d.ts +11 -0
- package/lib/cjs/context/ExternalFunctionContext.js +2 -0
- package/lib/cjs/context/GiftCardContext.d.ts +10 -0
- package/lib/cjs/context/GiftCardContext.js +2 -0
- package/lib/cjs/context/InStockSubscriptionContext.d.ts +6 -0
- package/lib/cjs/context/InStockSubscriptionContext.js +2 -0
- package/lib/cjs/context/LineItemChildrenContext.d.ts +8 -0
- package/lib/cjs/context/LineItemChildrenContext.js +2 -0
- package/lib/cjs/context/LineItemContext.d.ts +7 -0
- package/lib/cjs/context/LineItemContext.js +2 -0
- package/lib/cjs/context/LineItemOptionChildrenContext.d.ts +9 -0
- package/lib/cjs/context/LineItemOptionChildrenContext.js +2 -0
- package/lib/cjs/context/OrderContext.d.ts +30 -0
- package/lib/cjs/context/OrderContext.js +2 -0
- package/lib/cjs/context/OrderListChildrenContext.d.ts +73 -0
- package/lib/cjs/context/OrderListChildrenContext.js +2 -0
- package/lib/cjs/context/OrderListPaginationContext.d.ts +15 -0
- package/lib/cjs/context/OrderListPaginationContext.js +2 -0
- package/lib/cjs/context/OrderStorageContext.d.ts +10 -0
- package/lib/cjs/context/OrderStorageContext.js +2 -0
- package/lib/cjs/context/ParcelChildrenContext.d.ts +6 -0
- package/lib/cjs/context/ParcelChildrenContext.js +2 -0
- package/lib/cjs/context/ParcelLineItemChildrenContext.d.ts +6 -0
- package/lib/cjs/context/ParcelLineItemChildrenContext.js +2 -0
- package/lib/cjs/context/PaymentMethodChildrenContext.d.ts +10 -0
- package/lib/cjs/context/PaymentMethodChildrenContext.js +2 -0
- package/lib/cjs/context/PaymentMethodContext.d.ts +13 -0
- package/lib/cjs/context/PaymentMethodContext.js +2 -0
- package/lib/cjs/context/PaymentSourceContext.d.ts +14 -0
- package/lib/cjs/context/PaymentSourceContext.js +2 -0
- package/lib/cjs/context/PlaceOrderContext.d.ts +12 -0
- package/lib/cjs/context/PlaceOrderContext.js +2 -0
- package/lib/cjs/context/PricesContext.d.ts +6 -0
- package/lib/cjs/context/PricesContext.js +2 -0
- package/lib/cjs/context/ShipmentChildrenContext.d.ts +13 -0
- package/lib/cjs/context/ShipmentChildrenContext.js +2 -0
- package/lib/cjs/context/ShipmentContext.d.ts +10 -0
- package/lib/cjs/context/ShipmentContext.js +2 -0
- package/lib/cjs/context/ShippingAddressContext.d.ts +9 -0
- package/lib/cjs/context/ShippingAddressContext.js +2 -0
- package/lib/cjs/context/ShippingAddressFormContext.d.ts +3 -0
- package/lib/cjs/context/ShippingAddressFormContext.js +2 -0
- package/lib/cjs/context/ShippingMethodChildrenContext.d.ts +9 -0
- package/lib/cjs/context/ShippingMethodChildrenContext.js +2 -0
- package/lib/cjs/context/SkuChildrenContext.d.ts +8 -0
- package/lib/cjs/context/SkuChildrenContext.js +2 -0
- package/lib/cjs/context/SkuContext.d.ts +8 -0
- package/lib/cjs/context/SkuContext.js +2 -0
- package/lib/cjs/context/SkuListsContext.d.ts +5 -0
- package/lib/cjs/context/SkuListsContext.js +2 -0
- package/lib/cjs/context/StockTransferChildrenContext.d.ts +6 -0
- package/lib/cjs/context/StockTransferChildrenContext.js +2 -0
- package/lib/cjs/hooks/useCommerceLayer.d.ts +12 -0
- package/lib/cjs/hooks/useCommerceLayer.js +2 -0
- package/lib/cjs/hooks/useCustomerContainer.d.ts +12 -0
- package/lib/cjs/hooks/useCustomerContainer.js +2 -0
- package/lib/cjs/hooks/useOrderContainer.d.ts +16 -0
- package/lib/cjs/hooks/useOrderContainer.js +2 -0
- package/lib/cjs/index.d.ts +107 -0
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/reducers/AddressReducer.d.ts +80 -0
- package/lib/cjs/reducers/AddressReducer.js +2 -0
- package/lib/cjs/reducers/AvailabilityReducer.d.ts +53 -0
- package/lib/cjs/reducers/AvailabilityReducer.js +2 -0
- package/lib/cjs/reducers/BillingAddressReducer.d.ts +31 -0
- package/lib/cjs/reducers/BillingAddressReducer.js +2 -0
- package/lib/cjs/reducers/CustomerReducer.d.ts +183 -0
- package/lib/cjs/reducers/CustomerReducer.js +2 -0
- package/lib/cjs/reducers/GiftCardReducer.d.ts +66 -0
- package/lib/cjs/reducers/GiftCardReducer.js +2 -0
- package/lib/cjs/reducers/InStockSubscriptionReducer.d.ts +33 -0
- package/lib/cjs/reducers/InStockSubscriptionReducer.js +2 -0
- package/lib/cjs/reducers/LineItemReducer.d.ts +47 -0
- package/lib/cjs/reducers/LineItemReducer.js +2 -0
- package/lib/cjs/reducers/OrderReducer.d.ts +171 -0
- package/lib/cjs/reducers/OrderReducer.js +2 -0
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +161 -0
- package/lib/cjs/reducers/PaymentMethodReducer.js +2 -0
- package/lib/cjs/reducers/PlaceOrderReducer.d.ts +72 -0
- package/lib/cjs/reducers/PlaceOrderReducer.js +2 -0
- package/lib/cjs/reducers/PriceReducer.d.ts +35 -0
- package/lib/cjs/reducers/PriceReducer.js +2 -0
- package/lib/cjs/reducers/ShipmentReducer.d.ts +41 -0
- package/lib/cjs/reducers/ShipmentReducer.js +2 -0
- package/lib/cjs/reducers/ShippingAddressReducer.d.ts +32 -0
- package/lib/cjs/reducers/ShippingAddressReducer.js +2 -0
- package/lib/cjs/reducers/SkuListsReducer.d.ts +21 -0
- package/lib/cjs/reducers/SkuListsReducer.js +2 -0
- package/lib/cjs/reducers/SkuReducer.d.ts +21 -0
- package/lib/cjs/reducers/SkuReducer.js +2 -0
- package/lib/cjs/typings/errors.d.ts +15 -0
- package/lib/cjs/typings/errors.js +2 -0
- package/lib/cjs/typings/globals.d.ts +6 -0
- package/lib/cjs/typings/globals.js +2 -0
- package/lib/cjs/typings/index.d.ts +117 -0
- package/lib/cjs/typings/index.js +2 -0
- package/lib/cjs/utils/PropsType.d.ts +33 -0
- package/lib/cjs/utils/PropsType.js +2 -0
- package/lib/cjs/utils/addressesManager.d.ts +64 -0
- package/lib/cjs/utils/addressesManager.js +2 -0
- package/lib/cjs/utils/adyen/manageGiftCard.d.ts +16 -0
- package/lib/cjs/utils/adyen/manageGiftCard.js +2 -0
- package/lib/cjs/utils/baseReducer.d.ts +3 -0
- package/lib/cjs/utils/baseReducer.js +2 -0
- package/lib/cjs/utils/browserInfo.d.ts +12 -0
- package/lib/cjs/utils/browserInfo.js +2 -0
- package/lib/cjs/utils/canPlaceOrder.d.ts +5 -0
- package/lib/cjs/utils/canPlaceOrder.js +2 -0
- package/lib/cjs/utils/checkIncludeResource.d.ts +8 -0
- package/lib/cjs/utils/checkIncludeResource.js +2 -0
- package/lib/cjs/utils/compareObjAttribute.d.ts +7 -0
- package/lib/cjs/utils/compareObjAttribute.js +2 -0
- package/lib/cjs/utils/countryStateCity.d.ts +801 -0
- package/lib/cjs/utils/countryStateCity.js +2 -0
- package/lib/cjs/utils/customMessages.d.ts +2 -0
- package/lib/cjs/utils/customMessages.js +2 -0
- package/lib/cjs/utils/customerOrderOptions.d.ts +3 -0
- package/lib/cjs/utils/customerOrderOptions.js +2 -0
- package/lib/cjs/utils/events.d.ts +5 -0
- package/lib/cjs/utils/events.js +2 -0
- package/lib/cjs/utils/expressPaymentHelper.d.ts +92 -0
- package/lib/cjs/utils/expressPaymentHelper.js +2 -0
- package/lib/cjs/utils/filterChildren.d.ts +12 -0
- package/lib/cjs/utils/filterChildren.js +2 -0
- package/lib/cjs/utils/formCleaner.d.ts +4 -0
- package/lib/cjs/utils/formCleaner.js +2 -0
- package/lib/cjs/utils/getAmount.d.ts +7 -0
- package/lib/cjs/utils/getAmount.js +2 -0
- package/lib/cjs/utils/getApplicationLink.d.ts +35 -0
- package/lib/cjs/utils/getApplicationLink.js +2 -0
- package/lib/cjs/utils/getCardDetails.d.ts +16 -0
- package/lib/cjs/utils/getCardDetails.js +2 -0
- package/lib/cjs/utils/getCustomerIdByToken.d.ts +6 -0
- package/lib/cjs/utils/getCustomerIdByToken.js +2 -0
- package/lib/cjs/utils/getDomain.d.ts +4 -0
- package/lib/cjs/utils/getDomain.js +2 -0
- package/lib/cjs/utils/getErrors.d.ts +19 -0
- package/lib/cjs/utils/getErrors.js +2 -0
- package/lib/cjs/utils/getLineItemsCount.d.ts +10 -0
- package/lib/cjs/utils/getLineItemsCount.js +2 -0
- package/lib/cjs/utils/getLoaderComponent.d.ts +3 -0
- package/lib/cjs/utils/getLoaderComponent.js +2 -0
- package/lib/cjs/utils/getPaymentAttributes.d.ts +17 -0
- package/lib/cjs/utils/getPaymentAttributes.js +2 -0
- package/lib/cjs/utils/getPrices.d.ts +6 -0
- package/lib/cjs/utils/getPrices.js +2 -0
- package/lib/cjs/utils/getPublicIp.d.ts +1 -0
- package/lib/cjs/utils/getPublicIp.js +2 -0
- package/lib/cjs/utils/getSdk.d.ts +3 -0
- package/lib/cjs/utils/getSdk.js +2 -0
- package/lib/cjs/utils/getSkus.d.ts +3 -0
- package/lib/cjs/utils/getSkus.js +2 -0
- package/lib/cjs/utils/hasSubscriptions.d.ts +7 -0
- package/lib/cjs/utils/hasSubscriptions.js +2 -0
- package/lib/cjs/utils/hooks/useCustomContext.d.ts +21 -0
- package/lib/cjs/utils/hooks/useCustomContext.js +2 -0
- package/lib/cjs/utils/hooks/useExternalScript.d.ts +1 -0
- package/lib/cjs/utils/hooks/useExternalScript.js +2 -0
- package/lib/cjs/utils/icons.d.ts +2 -0
- package/lib/cjs/utils/icons.js +2 -0
- package/lib/cjs/utils/isDate.d.ts +1 -0
- package/lib/cjs/utils/isDate.js +2 -0
- package/lib/cjs/utils/isEmpty.d.ts +1 -0
- package/lib/cjs/utils/isEmpty.js +2 -0
- package/lib/cjs/utils/isGuestToken.d.ts +6 -0
- package/lib/cjs/utils/isGuestToken.js +2 -0
- package/lib/cjs/utils/isJSON.d.ts +1 -0
- package/lib/cjs/utils/isJSON.js +2 -0
- package/lib/cjs/utils/jwt.d.ts +27 -0
- package/lib/cjs/utils/jwt.js +2 -0
- package/lib/cjs/utils/localStorage.d.ts +11 -0
- package/lib/cjs/utils/localStorage.js +2 -0
- package/lib/cjs/utils/omit.d.ts +1 -0
- package/lib/cjs/utils/omit.js +2 -0
- package/lib/cjs/utils/organization.d.ts +18 -0
- package/lib/cjs/utils/organization.js +2 -0
- package/lib/cjs/utils/payment-methods/sortPaymentMethods.d.ts +2 -0
- package/lib/cjs/utils/payment-methods/sortPaymentMethods.js +2 -0
- package/lib/cjs/utils/pick.d.ts +1 -0
- package/lib/cjs/utils/pick.js +2 -0
- package/lib/cjs/utils/placeholderImages.d.ts +2 -0
- package/lib/cjs/utils/placeholderImages.js +2 -0
- package/lib/cjs/utils/promisify.d.ts +1 -0
- package/lib/cjs/utils/promisify.js +2 -0
- package/lib/cjs/utils/replace.d.ts +2 -0
- package/lib/cjs/utils/replace.js +2 -0
- package/lib/cjs/utils/scrollbarWidth.d.ts +1 -0
- package/lib/cjs/utils/scrollbarWidth.js +2 -0
- package/lib/cjs/utils/shipments.d.ts +3 -0
- package/lib/cjs/utils/shipments.js +2 -0
- package/lib/cjs/utils/snakeToCamelCase.d.ts +5 -0
- package/lib/cjs/utils/snakeToCamelCase.js +2 -0
- package/lib/cjs/utils/stripe/retrievePaymentIntent.d.ts +14 -0
- package/lib/cjs/utils/stripe/retrievePaymentIntent.js +2 -0
- package/lib/cjs/utils/triggerAttributeHelper.d.ts +31 -0
- package/lib/cjs/utils/triggerAttributeHelper.js +2 -0
- package/lib/cjs/utils/updateOrderSubscriptionCustomerPaymentSource.d.ts +8 -0
- package/lib/cjs/utils/updateOrderSubscriptionCustomerPaymentSource.js +2 -0
- package/lib/cjs/utils/validateFormFields.d.ts +16 -0
- package/lib/cjs/utils/validateFormFields.js +2 -0
- package/lib/esm/components/ExternalFunction.d.ts +7 -0
- package/lib/esm/components/ExternalFunction.js +2 -0
- package/lib/esm/components/MetadataInput.d.ts +5 -0
- package/lib/esm/components/MetadataInput.js +2 -0
- package/lib/esm/components/SubmitButton.d.ts +10 -0
- package/lib/esm/components/SubmitButton.js +2 -0
- package/lib/esm/components/addresses/Address.d.ts +31 -0
- package/lib/esm/components/addresses/Address.js +2 -0
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +34 -0
- package/lib/esm/components/addresses/AddressCountrySelector.js +2 -0
- package/lib/esm/components/addresses/AddressField.d.ts +61 -0
- package/lib/esm/components/addresses/AddressField.js +2 -0
- package/lib/esm/components/addresses/AddressInput.d.ts +34 -0
- package/lib/esm/components/addresses/AddressInput.js +2 -0
- package/lib/esm/components/addresses/AddressInputSelect.d.ts +29 -0
- package/lib/esm/components/addresses/AddressInputSelect.js +2 -0
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +50 -0
- package/lib/esm/components/addresses/AddressStateSelector.js +2 -0
- package/lib/esm/components/addresses/AddressesContainer.d.ts +40 -0
- package/lib/esm/components/addresses/AddressesContainer.js +2 -0
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +26 -0
- package/lib/esm/components/addresses/AddressesEmpty.js +2 -0
- package/lib/esm/components/addresses/BillingAddressContainer.d.ts +6 -0
- package/lib/esm/components/addresses/BillingAddressContainer.js +2 -0
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +34 -0
- package/lib/esm/components/addresses/BillingAddressForm.js +2 -0
- package/lib/esm/components/addresses/SaveAddressesButton.d.ts +18 -0
- package/lib/esm/components/addresses/SaveAddressesButton.js +2 -0
- package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +7 -0
- package/lib/esm/components/addresses/ShippingAddressContainer.js +2 -0
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +31 -0
- package/lib/esm/components/addresses/ShippingAddressForm.js +2 -0
- package/lib/esm/components/auth/CommerceLayer.d.ts +25 -0
- package/lib/esm/components/auth/CommerceLayer.js +2 -0
- package/lib/esm/components/customers/CustomerAddressForm.d.ts +13 -0
- package/lib/esm/components/customers/CustomerAddressForm.js +2 -0
- package/lib/esm/components/customers/CustomerContainer.d.ts +38 -0
- package/lib/esm/components/customers/CustomerContainer.js +2 -0
- package/lib/esm/components/customers/CustomerField.d.ts +25 -0
- package/lib/esm/components/customers/CustomerField.js +2 -0
- package/lib/esm/components/customers/CustomerInput.d.ts +11 -0
- package/lib/esm/components/customers/CustomerInput.js +2 -0
- package/lib/esm/components/customers/CustomerPaymentSource.d.ts +11 -0
- package/lib/esm/components/customers/CustomerPaymentSource.js +2 -0
- package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +14 -0
- package/lib/esm/components/customers/CustomerPaymentSourceEmpty.js +2 -0
- package/lib/esm/components/customers/MyAccountLink.d.ts +38 -0
- package/lib/esm/components/customers/MyAccountLink.js +2 -0
- package/lib/esm/components/customers/MyIdentityLink.d.ts +59 -0
- package/lib/esm/components/customers/MyIdentityLink.js +2 -0
- package/lib/esm/components/customers/SaveCustomerButton.d.ts +12 -0
- package/lib/esm/components/customers/SaveCustomerButton.js +2 -0
- package/lib/esm/components/errors/Errors.d.ts +31 -0
- package/lib/esm/components/errors/Errors.js +2 -0
- package/lib/esm/components/gift_cards/GiftCard.d.ts +10 -0
- package/lib/esm/components/gift_cards/GiftCard.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +6 -0
- package/lib/esm/components/gift_cards/GiftCardContainer.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +7 -0
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +7 -0
- package/lib/esm/components/gift_cards/GiftCardInput.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +16 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +15 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +11 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +20 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +10 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.js +2 -0
- package/lib/esm/components/gift_cards/GiftCardRecipientInput.d.ts +0 -0
- package/lib/esm/components/gift_cards/GiftCardRecipientInput.js +2 -0
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +36 -0
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.js +2 -0
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +10 -0
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.js +2 -0
- package/lib/esm/components/line_items/LineItem.d.ts +8 -0
- package/lib/esm/components/line_items/LineItem.js +2 -0
- package/lib/esm/components/line_items/LineItemAmount.d.ts +7 -0
- package/lib/esm/components/line_items/LineItemAmount.js +2 -0
- package/lib/esm/components/line_items/LineItemCode.d.ts +13 -0
- package/lib/esm/components/line_items/LineItemCode.js +2 -0
- package/lib/esm/components/line_items/LineItemField.d.ts +14 -0
- package/lib/esm/components/line_items/LineItemField.js +2 -0
- package/lib/esm/components/line_items/LineItemImage.d.ts +17 -0
- package/lib/esm/components/line_items/LineItemImage.js +2 -0
- package/lib/esm/components/line_items/LineItemName.d.ts +12 -0
- package/lib/esm/components/line_items/LineItemName.js +2 -0
- package/lib/esm/components/line_items/LineItemOption.d.ts +19 -0
- package/lib/esm/components/line_items/LineItemOption.js +2 -0
- package/lib/esm/components/line_items/LineItemOptions.d.ts +16 -0
- package/lib/esm/components/line_items/LineItemOptions.js +2 -0
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +21 -0
- package/lib/esm/components/line_items/LineItemQuantity.js +2 -0
- package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +14 -0
- package/lib/esm/components/line_items/LineItemRemoveLink.js +2 -0
- package/lib/esm/components/line_items/LineItemsContainer.d.ts +9 -0
- package/lib/esm/components/line_items/LineItemsContainer.js +2 -0
- package/lib/esm/components/line_items/LineItemsCount.d.ts +12 -0
- package/lib/esm/components/line_items/LineItemsCount.js +2 -0
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +12 -0
- package/lib/esm/components/line_items/LineItemsEmpty.js +2 -0
- package/lib/esm/components/orders/AddToCartButton.d.ts +95 -0
- package/lib/esm/components/orders/AddToCartButton.js +2 -0
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +4 -0
- package/lib/esm/components/orders/AdjustmentAmount.js +2 -0
- package/lib/esm/components/orders/CartLink.d.ts +47 -0
- package/lib/esm/components/orders/CartLink.js +2 -0
- package/lib/esm/components/orders/CheckoutLink.d.ts +28 -0
- package/lib/esm/components/orders/CheckoutLink.js +2 -0
- package/lib/esm/components/orders/DiscountAmount.d.ts +4 -0
- package/lib/esm/components/orders/DiscountAmount.js +2 -0
- package/lib/esm/components/orders/GiftCardAmount.d.ts +4 -0
- package/lib/esm/components/orders/GiftCardAmount.js +2 -0
- package/lib/esm/components/orders/HostedCart.d.ts +58 -0
- package/lib/esm/components/orders/HostedCart.js +2 -0
- package/lib/esm/components/orders/OrderContainer.d.ts +62 -0
- package/lib/esm/components/orders/OrderContainer.js +2 -0
- package/lib/esm/components/orders/OrderList.d.ts +83 -0
- package/lib/esm/components/orders/OrderList.js +2 -0
- package/lib/esm/components/orders/OrderListEmpty.d.ts +17 -0
- package/lib/esm/components/orders/OrderListEmpty.js +2 -0
- package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +48 -0
- package/lib/esm/components/orders/OrderListPaginationButtons.js +2 -0
- package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +29 -0
- package/lib/esm/components/orders/OrderListPaginationInfo.js +2 -0
- package/lib/esm/components/orders/OrderListRow.d.ts +29 -0
- package/lib/esm/components/orders/OrderListRow.js +2 -0
- package/lib/esm/components/orders/OrderNumber.d.ts +5 -0
- package/lib/esm/components/orders/OrderNumber.js +2 -0
- package/lib/esm/components/orders/OrderStorage.d.ts +31 -0
- package/lib/esm/components/orders/OrderStorage.js +2 -0
- package/lib/esm/components/orders/PaymentMethodAmount.d.ts +4 -0
- package/lib/esm/components/orders/PaymentMethodAmount.js +2 -0
- package/lib/esm/components/orders/PlaceOrderButton.d.ts +35 -0
- package/lib/esm/components/orders/PlaceOrderButton.js +2 -0
- package/lib/esm/components/orders/PlaceOrderContainer.d.ts +8 -0
- package/lib/esm/components/orders/PlaceOrderContainer.js +2 -0
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +4 -0
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.js +2 -0
- package/lib/esm/components/orders/ShippingAmount.d.ts +4 -0
- package/lib/esm/components/orders/ShippingAmount.js +2 -0
- package/lib/esm/components/orders/SubTotalAmount.d.ts +4 -0
- package/lib/esm/components/orders/SubTotalAmount.js +2 -0
- package/lib/esm/components/orders/TaxesAmount.d.ts +4 -0
- package/lib/esm/components/orders/TaxesAmount.js +2 -0
- package/lib/esm/components/orders/TotalAmount.d.ts +4 -0
- package/lib/esm/components/orders/TotalAmount.js +2 -0
- package/lib/esm/components/parcels/ParcelField.d.ts +14 -0
- package/lib/esm/components/parcels/ParcelField.js +2 -0
- package/lib/esm/components/parcels/ParcelLineItem.d.ts +7 -0
- package/lib/esm/components/parcels/ParcelLineItem.js +2 -0
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +14 -0
- package/lib/esm/components/parcels/ParcelLineItemField.js +2 -0
- package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +18 -0
- package/lib/esm/components/parcels/ParcelLineItemsCount.js +2 -0
- package/lib/esm/components/parcels/Parcels.d.ts +7 -0
- package/lib/esm/components/parcels/Parcels.js +2 -0
- package/lib/esm/components/parcels/ParcelsCount.d.ts +18 -0
- package/lib/esm/components/parcels/ParcelsCount.js +2 -0
- package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/AdyenGateway.js +2 -0
- package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/BraintreeGateway.js +2 -0
- package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/CheckoutComGateway.js +2 -0
- package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/ExternalGateway.js +2 -0
- package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/KlarnaGateway.js +2 -0
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +16 -0
- package/lib/esm/components/payment_gateways/PaymentGateway.js +2 -0
- package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/PaypalGateway.js +2 -0
- package/lib/esm/components/payment_gateways/StripeGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/StripeGateway.js +2 -0
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +5 -0
- package/lib/esm/components/payment_gateways/WireTransferGateway.js +2 -0
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +45 -0
- package/lib/esm/components/payment_methods/PaymentMethod.js +2 -0
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +10 -0
- package/lib/esm/components/payment_methods/PaymentMethodName.js +2 -0
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +8 -0
- package/lib/esm/components/payment_methods/PaymentMethodPrice.js +2 -0
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +17 -0
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.js +2 -0
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +8 -0
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +2 -0
- package/lib/esm/components/payment_source/AdyenPayment.d.ts +66 -0
- package/lib/esm/components/payment_source/AdyenPayment.js +2 -0
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +32 -0
- package/lib/esm/components/payment_source/BraintreePayment.js +2 -0
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +23 -0
- package/lib/esm/components/payment_source/CheckoutComPayment.js +2 -0
- package/lib/esm/components/payment_source/ExternalPayment.d.ts +24 -0
- package/lib/esm/components/payment_source/ExternalPayment.js +2 -0
- package/lib/esm/components/payment_source/KlarnaPayment.d.ts +10 -0
- package/lib/esm/components/payment_source/KlarnaPayment.js +2 -0
- package/lib/esm/components/payment_source/PaymentSource.d.ts +19 -0
- package/lib/esm/components/payment_source/PaymentSource.js +2 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +15 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.js +2 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +12 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandName.js +2 -0
- package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +15 -0
- package/lib/esm/components/payment_source/PaymentSourceDetail.js +2 -0
- package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +10 -0
- package/lib/esm/components/payment_source/PaymentSourceEditButton.js +2 -0
- package/lib/esm/components/payment_source/PaypalPayment.d.ts +12 -0
- package/lib/esm/components/payment_source/PaypalPayment.js +2 -0
- package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +6 -0
- package/lib/esm/components/payment_source/StripeExpressPayment.js +2 -0
- package/lib/esm/components/payment_source/StripePayment.d.ts +21 -0
- package/lib/esm/components/payment_source/StripePayment.js +2 -0
- package/lib/esm/components/payment_source/WireTransferPayment.d.ts +12 -0
- package/lib/esm/components/payment_source/WireTransferPayment.js +2 -0
- package/lib/esm/components/prices/Price.d.ts +35 -0
- package/lib/esm/components/prices/Price.js +2 -0
- package/lib/esm/components/prices/PricesContainer.d.ts +41 -0
- package/lib/esm/components/prices/PricesContainer.js +2 -0
- package/lib/esm/components/shipments/Shipment.d.ts +10 -0
- package/lib/esm/components/shipments/Shipment.js +2 -0
- package/lib/esm/components/shipments/ShipmentField.d.ts +12 -0
- package/lib/esm/components/shipments/ShipmentField.js +2 -0
- package/lib/esm/components/shipments/ShipmentsContainer.d.ts +6 -0
- package/lib/esm/components/shipments/ShipmentsContainer.js +2 -0
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +18 -0
- package/lib/esm/components/shipments/ShipmentsCount.js +2 -0
- package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +8 -0
- package/lib/esm/components/shipping_methods/ShippingMethod.js +2 -0
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +11 -0
- package/lib/esm/components/shipping_methods/ShippingMethodName.js +2 -0
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +20 -0
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.js +2 -0
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +17 -0
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +2 -0
- package/lib/esm/components/skus/AvailabilityContainer.d.ts +34 -0
- package/lib/esm/components/skus/AvailabilityContainer.js +2 -0
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +52 -0
- package/lib/esm/components/skus/AvailabilityTemplate.js +2 -0
- package/lib/esm/components/skus/DeliveryLeadTime.d.ts +10 -0
- package/lib/esm/components/skus/DeliveryLeadTime.js +2 -0
- package/lib/esm/components/skus/SkuField.d.ts +25 -0
- package/lib/esm/components/skus/SkuField.js +2 -0
- package/lib/esm/components/skus/SkuList.d.ts +10 -0
- package/lib/esm/components/skus/SkuList.js +2 -0
- package/lib/esm/components/skus/SkuListsContainer.d.ts +6 -0
- package/lib/esm/components/skus/SkuListsContainer.js +2 -0
- package/lib/esm/components/skus/Skus.d.ts +18 -0
- package/lib/esm/components/skus/Skus.js +2 -0
- package/lib/esm/components/skus/SkusContainer.d.ts +31 -0
- package/lib/esm/components/skus/SkusContainer.js +2 -0
- package/lib/esm/components/stock_transfers/StockTransfer.d.ts +7 -0
- package/lib/esm/components/stock_transfers/StockTransfer.js +2 -0
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +10 -0
- package/lib/esm/components/stock_transfers/StockTransferField.js +2 -0
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +26 -0
- package/lib/esm/components/utils/AddressCardsTemplate.js +2 -0
- package/lib/esm/components/utils/BaseField.d.ts +8 -0
- package/lib/esm/components/utils/BaseField.js +2 -0
- package/lib/esm/components/utils/BaseInput.d.ts +5 -0
- package/lib/esm/components/utils/BaseInput.js +2 -0
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +6 -0
- package/lib/esm/components/utils/BaseOrderPrice.js +2 -0
- package/lib/esm/components/utils/BaseSelect.d.ts +5 -0
- package/lib/esm/components/utils/BaseSelect.js +2 -0
- package/lib/esm/components/utils/ErrorBoundary.d.ts +14 -0
- package/lib/esm/components/utils/ErrorBoundary.js +2 -0
- package/lib/esm/components/utils/GenericFieldComponent.d.ts +58 -0
- package/lib/esm/components/utils/GenericFieldComponent.js +2 -0
- package/lib/esm/components/utils/Parent.d.ts +6 -0
- package/lib/esm/components/utils/Parent.js +2 -0
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +41 -0
- package/lib/esm/components/utils/PaymentCardsTemplate.js +2 -0
- package/lib/esm/components/utils/PriceTemplate.d.ts +8 -0
- package/lib/esm/components/utils/PriceTemplate.js +2 -0
- package/lib/esm/components/utils/getAllErrors.d.ts +16 -0
- package/lib/esm/components/utils/getAllErrors.js +2 -0
- package/lib/esm/config/currency.d.ts +5 -0
- package/lib/esm/config/currency.js +2 -0
- package/lib/esm/context/AddressChildrenContext.d.ts +6 -0
- package/lib/esm/context/AddressChildrenContext.js +2 -0
- package/lib/esm/context/AddressContext.d.ts +18 -0
- package/lib/esm/context/AddressContext.js +2 -0
- package/lib/esm/context/AvailabilityContext.d.ts +2 -0
- package/lib/esm/context/AvailabilityContext.js +2 -0
- package/lib/esm/context/BillingAddressContext.d.ts +9 -0
- package/lib/esm/context/BillingAddressContext.js +2 -0
- package/lib/esm/context/BillingAddressFormContext.d.ts +22 -0
- package/lib/esm/context/BillingAddressFormContext.js +2 -0
- package/lib/esm/context/CommerceLayerContext.d.ts +6 -0
- package/lib/esm/context/CommerceLayerContext.js +2 -0
- package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +8 -0
- package/lib/esm/context/CouponAndGiftCardFormContext.js +2 -0
- package/lib/esm/context/CustomerAddressFormContext.d.ts +17 -0
- package/lib/esm/context/CustomerAddressFormContext.js +2 -0
- package/lib/esm/context/CustomerContext.d.ts +29 -0
- package/lib/esm/context/CustomerContext.js +2 -0
- package/lib/esm/context/CustomerPaymentSourceContext.d.ts +11 -0
- package/lib/esm/context/CustomerPaymentSourceContext.js +2 -0
- package/lib/esm/context/ExternalFunctionContext.d.ts +11 -0
- package/lib/esm/context/ExternalFunctionContext.js +2 -0
- package/lib/esm/context/GiftCardContext.d.ts +10 -0
- package/lib/esm/context/GiftCardContext.js +2 -0
- package/lib/esm/context/InStockSubscriptionContext.d.ts +6 -0
- package/lib/esm/context/InStockSubscriptionContext.js +2 -0
- package/lib/esm/context/LineItemChildrenContext.d.ts +8 -0
- package/lib/esm/context/LineItemChildrenContext.js +2 -0
- package/lib/esm/context/LineItemContext.d.ts +7 -0
- package/lib/esm/context/LineItemContext.js +2 -0
- package/lib/esm/context/LineItemOptionChildrenContext.d.ts +9 -0
- package/lib/esm/context/LineItemOptionChildrenContext.js +2 -0
- package/lib/esm/context/OrderContext.d.ts +30 -0
- package/lib/esm/context/OrderContext.js +2 -0
- package/lib/esm/context/OrderListChildrenContext.d.ts +73 -0
- package/lib/esm/context/OrderListChildrenContext.js +2 -0
- package/lib/esm/context/OrderListPaginationContext.d.ts +15 -0
- package/lib/esm/context/OrderListPaginationContext.js +2 -0
- package/lib/esm/context/OrderStorageContext.d.ts +10 -0
- package/lib/esm/context/OrderStorageContext.js +2 -0
- package/lib/esm/context/ParcelChildrenContext.d.ts +6 -0
- package/lib/esm/context/ParcelChildrenContext.js +2 -0
- package/lib/esm/context/ParcelLineItemChildrenContext.d.ts +6 -0
- package/lib/esm/context/ParcelLineItemChildrenContext.js +2 -0
- package/lib/esm/context/PaymentMethodChildrenContext.d.ts +10 -0
- package/lib/esm/context/PaymentMethodChildrenContext.js +2 -0
- package/lib/esm/context/PaymentMethodContext.d.ts +13 -0
- package/lib/esm/context/PaymentMethodContext.js +2 -0
- package/lib/esm/context/PaymentSourceContext.d.ts +14 -0
- package/lib/esm/context/PaymentSourceContext.js +2 -0
- package/lib/esm/context/PlaceOrderContext.d.ts +12 -0
- package/lib/esm/context/PlaceOrderContext.js +2 -0
- package/lib/esm/context/PricesContext.d.ts +6 -0
- package/lib/esm/context/PricesContext.js +2 -0
- package/lib/esm/context/ShipmentChildrenContext.d.ts +13 -0
- package/lib/esm/context/ShipmentChildrenContext.js +2 -0
- package/lib/esm/context/ShipmentContext.d.ts +10 -0
- package/lib/esm/context/ShipmentContext.js +2 -0
- package/lib/esm/context/ShippingAddressContext.d.ts +9 -0
- package/lib/esm/context/ShippingAddressContext.js +2 -0
- package/lib/esm/context/ShippingAddressFormContext.d.ts +3 -0
- package/lib/esm/context/ShippingAddressFormContext.js +2 -0
- package/lib/esm/context/ShippingMethodChildrenContext.d.ts +9 -0
- package/lib/esm/context/ShippingMethodChildrenContext.js +2 -0
- package/lib/esm/context/SkuChildrenContext.d.ts +8 -0
- package/lib/esm/context/SkuChildrenContext.js +2 -0
- package/lib/esm/context/SkuContext.d.ts +8 -0
- package/lib/esm/context/SkuContext.js +2 -0
- package/lib/esm/context/SkuListsContext.d.ts +5 -0
- package/lib/esm/context/SkuListsContext.js +2 -0
- package/lib/esm/context/StockTransferChildrenContext.d.ts +6 -0
- package/lib/esm/context/StockTransferChildrenContext.js +2 -0
- package/lib/esm/hooks/useCommerceLayer.d.ts +12 -0
- package/lib/esm/hooks/useCommerceLayer.js +2 -0
- package/lib/esm/hooks/useCustomerContainer.d.ts +12 -0
- package/lib/esm/hooks/useCustomerContainer.js +2 -0
- package/lib/esm/hooks/useOrderContainer.d.ts +16 -0
- package/lib/esm/hooks/useOrderContainer.js +2 -0
- package/lib/esm/index.d.ts +107 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/reducers/AddressReducer.d.ts +80 -0
- package/lib/esm/reducers/AddressReducer.js +2 -0
- package/lib/esm/reducers/AvailabilityReducer.d.ts +53 -0
- package/lib/esm/reducers/AvailabilityReducer.js +2 -0
- package/lib/esm/reducers/BillingAddressReducer.d.ts +31 -0
- package/lib/esm/reducers/BillingAddressReducer.js +2 -0
- package/lib/esm/reducers/CustomerReducer.d.ts +183 -0
- package/lib/esm/reducers/CustomerReducer.js +2 -0
- package/lib/esm/reducers/GiftCardReducer.d.ts +66 -0
- package/lib/esm/reducers/GiftCardReducer.js +2 -0
- package/lib/esm/reducers/InStockSubscriptionReducer.d.ts +33 -0
- package/lib/esm/reducers/InStockSubscriptionReducer.js +2 -0
- package/lib/esm/reducers/LineItemReducer.d.ts +47 -0
- package/lib/esm/reducers/LineItemReducer.js +2 -0
- package/lib/esm/reducers/OrderReducer.d.ts +171 -0
- package/lib/esm/reducers/OrderReducer.js +2 -0
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +161 -0
- package/lib/esm/reducers/PaymentMethodReducer.js +2 -0
- package/lib/esm/reducers/PlaceOrderReducer.d.ts +72 -0
- package/lib/esm/reducers/PlaceOrderReducer.js +2 -0
- package/lib/esm/reducers/PriceReducer.d.ts +35 -0
- package/lib/esm/reducers/PriceReducer.js +2 -0
- package/lib/esm/reducers/ShipmentReducer.d.ts +41 -0
- package/lib/esm/reducers/ShipmentReducer.js +2 -0
- package/lib/esm/reducers/ShippingAddressReducer.d.ts +32 -0
- package/lib/esm/reducers/ShippingAddressReducer.js +2 -0
- package/lib/esm/reducers/SkuListsReducer.d.ts +21 -0
- package/lib/esm/reducers/SkuListsReducer.js +2 -0
- package/lib/esm/reducers/SkuReducer.d.ts +21 -0
- package/lib/esm/reducers/SkuReducer.js +2 -0
- package/lib/esm/typings/errors.d.ts +15 -0
- package/lib/esm/typings/errors.js +2 -0
- package/lib/esm/typings/globals.d.ts +6 -0
- package/lib/esm/typings/globals.js +2 -0
- package/lib/esm/typings/index.d.ts +117 -0
- package/lib/esm/typings/index.js +2 -0
- package/lib/esm/utils/PropsType.d.ts +33 -0
- package/lib/esm/utils/PropsType.js +2 -0
- package/lib/esm/utils/addressesManager.d.ts +64 -0
- package/lib/esm/utils/addressesManager.js +2 -0
- package/lib/esm/utils/adyen/manageGiftCard.d.ts +16 -0
- package/lib/esm/utils/adyen/manageGiftCard.js +2 -0
- package/lib/esm/utils/baseReducer.d.ts +3 -0
- package/lib/esm/utils/baseReducer.js +2 -0
- package/lib/esm/utils/browserInfo.d.ts +12 -0
- package/lib/esm/utils/browserInfo.js +2 -0
- package/lib/esm/utils/canPlaceOrder.d.ts +5 -0
- package/lib/esm/utils/canPlaceOrder.js +2 -0
- package/lib/esm/utils/checkIncludeResource.d.ts +8 -0
- package/lib/esm/utils/checkIncludeResource.js +2 -0
- package/lib/esm/utils/compareObjAttribute.d.ts +7 -0
- package/lib/esm/utils/compareObjAttribute.js +2 -0
- package/lib/esm/utils/countryStateCity.d.ts +801 -0
- package/lib/esm/utils/countryStateCity.js +2 -0
- package/lib/esm/utils/customMessages.d.ts +2 -0
- package/lib/esm/utils/customMessages.js +2 -0
- package/lib/esm/utils/customerOrderOptions.d.ts +3 -0
- package/lib/esm/utils/customerOrderOptions.js +2 -0
- package/lib/esm/utils/events.d.ts +5 -0
- package/lib/esm/utils/events.js +2 -0
- package/lib/esm/utils/expressPaymentHelper.d.ts +92 -0
- package/lib/esm/utils/expressPaymentHelper.js +2 -0
- package/lib/esm/utils/filterChildren.d.ts +12 -0
- package/lib/esm/utils/filterChildren.js +2 -0
- package/lib/esm/utils/formCleaner.d.ts +4 -0
- package/lib/esm/utils/formCleaner.js +2 -0
- package/lib/esm/utils/getAmount.d.ts +7 -0
- package/lib/esm/utils/getAmount.js +2 -0
- package/lib/esm/utils/getApplicationLink.d.ts +35 -0
- package/lib/esm/utils/getApplicationLink.js +2 -0
- package/lib/esm/utils/getCardDetails.d.ts +16 -0
- package/lib/esm/utils/getCardDetails.js +2 -0
- package/lib/esm/utils/getCustomerIdByToken.d.ts +6 -0
- package/lib/esm/utils/getCustomerIdByToken.js +2 -0
- package/lib/esm/utils/getDomain.d.ts +4 -0
- package/lib/esm/utils/getDomain.js +2 -0
- package/lib/esm/utils/getErrors.d.ts +19 -0
- package/lib/esm/utils/getErrors.js +2 -0
- package/lib/esm/utils/getLineItemsCount.d.ts +10 -0
- package/lib/esm/utils/getLineItemsCount.js +2 -0
- package/lib/esm/utils/getLoaderComponent.d.ts +3 -0
- package/lib/esm/utils/getLoaderComponent.js +2 -0
- package/lib/esm/utils/getPaymentAttributes.d.ts +17 -0
- package/lib/esm/utils/getPaymentAttributes.js +2 -0
- package/lib/esm/utils/getPrices.d.ts +6 -0
- package/lib/esm/utils/getPrices.js +2 -0
- package/lib/esm/utils/getPublicIp.d.ts +1 -0
- package/lib/esm/utils/getPublicIp.js +2 -0
- package/lib/esm/utils/getSdk.d.ts +3 -0
- package/lib/esm/utils/getSdk.js +2 -0
- package/lib/esm/utils/getSkus.d.ts +3 -0
- package/lib/esm/utils/getSkus.js +2 -0
- package/lib/esm/utils/hasSubscriptions.d.ts +7 -0
- package/lib/esm/utils/hasSubscriptions.js +2 -0
- package/lib/esm/utils/hooks/useCustomContext.d.ts +21 -0
- package/lib/esm/utils/hooks/useCustomContext.js +2 -0
- package/lib/esm/utils/hooks/useExternalScript.d.ts +1 -0
- package/lib/esm/utils/hooks/useExternalScript.js +2 -0
- package/lib/esm/utils/icons.d.ts +2 -0
- package/lib/esm/utils/icons.js +2 -0
- package/lib/esm/utils/isDate.d.ts +1 -0
- package/lib/esm/utils/isDate.js +2 -0
- package/lib/esm/utils/isEmpty.d.ts +1 -0
- package/lib/esm/utils/isEmpty.js +2 -0
- package/lib/esm/utils/isGuestToken.d.ts +6 -0
- package/lib/esm/utils/isGuestToken.js +2 -0
- package/lib/esm/utils/isJSON.d.ts +1 -0
- package/lib/esm/utils/isJSON.js +2 -0
- package/lib/esm/utils/jwt.d.ts +27 -0
- package/lib/esm/utils/jwt.js +2 -0
- package/lib/esm/utils/localStorage.d.ts +11 -0
- package/lib/esm/utils/localStorage.js +2 -0
- package/lib/esm/utils/omit.d.ts +1 -0
- package/lib/esm/utils/omit.js +2 -0
- package/lib/esm/utils/organization.d.ts +18 -0
- package/lib/esm/utils/organization.js +2 -0
- package/lib/esm/utils/payment-methods/sortPaymentMethods.d.ts +2 -0
- package/lib/esm/utils/payment-methods/sortPaymentMethods.js +2 -0
- package/lib/esm/utils/pick.d.ts +1 -0
- package/lib/esm/utils/pick.js +2 -0
- package/lib/esm/utils/placeholderImages.d.ts +2 -0
- package/lib/esm/utils/placeholderImages.js +2 -0
- package/lib/esm/utils/promisify.d.ts +1 -0
- package/lib/esm/utils/promisify.js +2 -0
- package/lib/esm/utils/replace.d.ts +2 -0
- package/lib/esm/utils/replace.js +2 -0
- package/lib/esm/utils/scrollbarWidth.d.ts +1 -0
- package/lib/esm/utils/scrollbarWidth.js +2 -0
- package/lib/esm/utils/shipments.d.ts +3 -0
- package/lib/esm/utils/shipments.js +2 -0
- package/lib/esm/utils/snakeToCamelCase.d.ts +5 -0
- package/lib/esm/utils/snakeToCamelCase.js +2 -0
- package/lib/esm/utils/stripe/retrievePaymentIntent.d.ts +14 -0
- package/lib/esm/utils/stripe/retrievePaymentIntent.js +2 -0
- package/lib/esm/utils/triggerAttributeHelper.d.ts +31 -0
- package/lib/esm/utils/triggerAttributeHelper.js +2 -0
- package/lib/esm/utils/updateOrderSubscriptionCustomerPaymentSource.d.ts +8 -0
- package/lib/esm/utils/updateOrderSubscriptionCustomerPaymentSource.js +2 -0
- package/lib/esm/utils/validateFormFields.d.ts +16 -0
- package/lib/esm/utils/validateFormFields.js +2 -0
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -0
- package/lib/tsconfig.prod.tsbuildinfo +1 -0
- package/package.json +152 -13
- package/lib/index.cjs +0 -3
- package/lib/index.cjs.map +0 -1
- package/lib/index.d.cts +0 -3266
- package/lib/index.d.ts +0 -3266
- package/lib/index.js +0 -3
- package/lib/index.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Customer, Market, GiftCardRecipient, GiftCardRecipientCreate, Order } from '@commercelayer/sdk';
|
|
2
|
+
import type { BaseMetadata } from '../typings/index';
|
|
3
|
+
import type { Dispatch } from 'react';
|
|
4
|
+
import type { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
+
import type { BaseError } from '../typings/errors';
|
|
6
|
+
import type { createOrder as makeOrder, getOrderContext } from './OrderReducer';
|
|
7
|
+
export type GiftCardActionType = 'setAvailability' | 'setGiftCardRecipient' | 'setGiftCardErrors' | 'setGiftCardLoading';
|
|
8
|
+
export interface GiftCardRecipientI {
|
|
9
|
+
email: string;
|
|
10
|
+
firstName?: string;
|
|
11
|
+
lastName?: string;
|
|
12
|
+
referenceOrigin?: string;
|
|
13
|
+
reference?: string;
|
|
14
|
+
metadata?: BaseMetadata;
|
|
15
|
+
customer?: Customer;
|
|
16
|
+
}
|
|
17
|
+
export interface GiftCardI {
|
|
18
|
+
currencyCode?: string;
|
|
19
|
+
balanceCent?: number;
|
|
20
|
+
balanceMaxCents?: number;
|
|
21
|
+
singleUse?: boolean;
|
|
22
|
+
rechargeable?: boolean;
|
|
23
|
+
imageUrl?: string;
|
|
24
|
+
expiresAt?: null | Date;
|
|
25
|
+
firstName?: string;
|
|
26
|
+
lastName?: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
referenceOrigin?: string;
|
|
29
|
+
recipientEmail?: string;
|
|
30
|
+
reference?: string;
|
|
31
|
+
metadata?: BaseMetadata;
|
|
32
|
+
orderId?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface GiftCardActionPayload extends GiftCardI {
|
|
35
|
+
market?: Market;
|
|
36
|
+
giftCardRecipient?: GiftCardRecipient;
|
|
37
|
+
errors?: BaseError[];
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface GiftCardState extends GiftCardActionPayload {
|
|
41
|
+
currencyCode: string;
|
|
42
|
+
balanceCent: number;
|
|
43
|
+
addGiftCardRecipient?: (values: GiftCardRecipientI & Record<string, any>) => void;
|
|
44
|
+
addGiftCard?: (values: GiftCardI & Record<string, any>) => void;
|
|
45
|
+
addGiftCardError?: (errors: BaseError[]) => void;
|
|
46
|
+
addGiftCardLoading?: (loading: boolean) => void;
|
|
47
|
+
}
|
|
48
|
+
export interface GiftCardAction {
|
|
49
|
+
type: GiftCardActionType;
|
|
50
|
+
payload: GiftCardActionPayload;
|
|
51
|
+
}
|
|
52
|
+
export declare const giftCardInitialState: GiftCardState;
|
|
53
|
+
export type AddGiftCardError = <V extends BaseError[]>(errors: V, dispatch: Dispatch<GiftCardAction>) => void;
|
|
54
|
+
export type AddGiftCardLoading = <V extends boolean>(loading: V, dispatch: Dispatch<GiftCardAction>) => void;
|
|
55
|
+
export declare function addGiftCardRecipient<V extends GiftCardRecipientCreate>(values: V, config: CommerceLayerConfig, dispatch: Dispatch<GiftCardAction>): Promise<void>;
|
|
56
|
+
export declare const addGiftCardLoading: AddGiftCardLoading;
|
|
57
|
+
export declare function addGiftCard<V extends GiftCardI>(values: V, { config, dispatch, getOrder, createOrder, order }: {
|
|
58
|
+
getOrder?: getOrderContext;
|
|
59
|
+
createOrder?: typeof makeOrder;
|
|
60
|
+
config: CommerceLayerConfig;
|
|
61
|
+
dispatch: Dispatch<GiftCardAction>;
|
|
62
|
+
order?: Order;
|
|
63
|
+
}): Promise<void>;
|
|
64
|
+
export declare const addGiftCardError: AddGiftCardError;
|
|
65
|
+
declare const giftCardReducer: (state: GiftCardState, reducer: GiftCardAction) => GiftCardState;
|
|
66
|
+
export default giftCardReducer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addGiftCardError=exports.addGiftCardLoading=exports.giftCardInitialState=void 0,exports.addGiftCardRecipient=addGiftCardRecipient,exports.addGiftCard=addGiftCard;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]};function addGiftCardRecipient(values,config,dispatch){return tslib_1.__awaiter(this,void 0,void 0,function*(){try{const recipient=yield(0,getSdk_1.default)(config).gift_card_recipients.create(values);dispatch({type:"setGiftCardRecipient",payload:{giftCardRecipient:recipient}})}catch(error){console.error(error)}})}const addGiftCardLoading=(loading,dispatch)=>{dispatch({type:"setGiftCardLoading",payload:{loading}})};exports.addGiftCardLoading=addGiftCardLoading;function addGiftCard(values_1,_a){return tslib_1.__awaiter(this,arguments,void 0,function*(values,{config,dispatch,getOrder,createOrder,order}){var _b,_c;try{const sdk=(0,getSdk_1.default)(config);(0,exports.addGiftCardLoading)(!0,dispatch);const{firstName,lastName,email}=values,val=tslib_1.__rest(values,["firstName","lastName","email"]),giftCardValue=Object.assign({recipient_email:email},val),giftCard=yield sdk.gift_cards.create(giftCardValue,{include:["gift_card_recipient"]}),recipientValues={id:(_c=(_b=giftCard.gift_card_recipient)===null||_b===void 0?void 0:_b.id)!==null&&_c!==void 0?_c:""};if(firstName&&(recipientValues.first_name=firstName),lastName&&(recipientValues.last_name=lastName),(0,isEmpty_1.default)(recipientValues)||(yield sdk.gift_card_recipients.update(recipientValues)),createOrder&&getOrder){const id=order?order.id:yield createOrder({});if(id){const order2=sdk.orders.relationship(id),item=sdk.gift_cards.relationship(giftCard.id);yield sdk.line_items.create({quantity:1,order:order2,item}),yield getOrder(id)}}dispatch({type:"setGiftCardRecipient",payload:Object.assign({},giftCardValue)}),(0,exports.addGiftCardLoading)(!1,dispatch)}catch(error){const errors=(0,getErrors_1.default)({error,resource:"gift_cards"});dispatch({type:"setGiftCardErrors",payload:{errors}}),(0,exports.addGiftCardLoading)(!1,dispatch)}})}const addGiftCardError=(errors,dispatch)=>{dispatch({type:"setGiftCardErrors",payload:{errors}})};exports.addGiftCardError=addGiftCardError;const type=["setAvailability","setGiftCardRecipient","setGiftCardErrors","setGiftCardLoading"],giftCardReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=giftCardReducer;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
2
|
+
import type { BaseAction } from '../typings/index';
|
|
3
|
+
import type { Dispatch } from 'react';
|
|
4
|
+
import type { BaseError } from '../typings/errors';
|
|
5
|
+
type InStockSubscriptionActionType = 'setErrors';
|
|
6
|
+
type InStockSubscriptionAction = BaseAction<InStockSubscriptionActionType, InStockSubscriptionState>;
|
|
7
|
+
export interface InStockSubscriptionState {
|
|
8
|
+
errors?: BaseError[];
|
|
9
|
+
}
|
|
10
|
+
export declare const inStockSubscriptionInitialState: InStockSubscriptionState;
|
|
11
|
+
interface TSetInStockSubscriptionParams {
|
|
12
|
+
/**
|
|
13
|
+
* Commerce Layer config
|
|
14
|
+
*/
|
|
15
|
+
config?: CommerceLayerConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Customer email
|
|
18
|
+
*/
|
|
19
|
+
customerEmail?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Sku code
|
|
22
|
+
*/
|
|
23
|
+
skuCode: string;
|
|
24
|
+
/**
|
|
25
|
+
* Dispatch function
|
|
26
|
+
*/
|
|
27
|
+
dispatch?: Dispatch<InStockSubscriptionAction>;
|
|
28
|
+
}
|
|
29
|
+
export declare function setInStockSubscription<T extends TSetInStockSubscriptionParams>({ config, customerEmail, skuCode, dispatch }: T): Promise<{
|
|
30
|
+
success: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
export default function inStockSubscriptionReducer(state: InStockSubscriptionState, reducer: InStockSubscriptionAction): InStockSubscriptionState;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.inStockSubscriptionInitialState=void 0,exports.setInStockSubscription=setInStockSubscription,exports.default=inStockSubscriptionReducer;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),actionType=["setErrors"];exports.inStockSubscriptionInitialState={errors:[]};function setInStockSubscription(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({config,customerEmail,skuCode,dispatch}){try{if(config==null)throw new Error("Access token and endpoint is required");const sdk=(0,getSdk_1.default)(config),attributes={sku_code:skuCode};return customerEmail!=null&&(attributes.customer_email=customerEmail),yield sdk.in_stock_subscriptions.create(attributes),{success:!0}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"in_stock_subscriptions"});return dispatch?.({type:"setErrors",payload:{errors}}),{success:!1}}})}function inStockSubscriptionReducer(state,reducer){return(0,baseReducer_1.default)(state,reducer,actionType)}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Dispatch } from 'react';
|
|
2
|
+
import type { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
+
import type { getOrderContext } from './OrderReducer';
|
|
4
|
+
import type { LoaderType } from '../typings/index';
|
|
5
|
+
import type { BaseError } from '../typings/errors';
|
|
6
|
+
import type { Order, LineItem } from '@commercelayer/sdk';
|
|
7
|
+
export interface UpdateLineItemParams {
|
|
8
|
+
lineItemId: string;
|
|
9
|
+
quantity?: number;
|
|
10
|
+
hasExternalPrice?: boolean;
|
|
11
|
+
dispatch: Dispatch<LineItemAction>;
|
|
12
|
+
config: CommerceLayerConfig;
|
|
13
|
+
getOrder: getOrderContext | undefined;
|
|
14
|
+
orderId: string;
|
|
15
|
+
errors: BaseError[] | undefined;
|
|
16
|
+
}
|
|
17
|
+
export type UpdateLineItem = (params: UpdateLineItemParams) => Promise<void>;
|
|
18
|
+
export type DeleteLineItemParam = Record<string, any> & UpdateLineItemParams;
|
|
19
|
+
export type DeleteLineItem = (params: DeleteLineItemParam) => Promise<void>;
|
|
20
|
+
export interface GetLineItemsParams {
|
|
21
|
+
dispatch: Dispatch<LineItemAction>;
|
|
22
|
+
config: CommerceLayerConfig;
|
|
23
|
+
order: Order | null;
|
|
24
|
+
filters: Record<string, any>;
|
|
25
|
+
}
|
|
26
|
+
export type GetLineItems = (params: GetLineItemsParams) => void;
|
|
27
|
+
export interface LineItemPayload {
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
loader?: LoaderType;
|
|
30
|
+
lineItems?: LineItem[] | null;
|
|
31
|
+
errors?: BaseError[];
|
|
32
|
+
}
|
|
33
|
+
export interface LineItemState extends LineItemPayload {
|
|
34
|
+
updateLineItem?: (lineItemId: string, quantity?: number, hasExternalPrice?: boolean) => Promise<void>;
|
|
35
|
+
deleteLineItem?: (lineItemId: string) => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface LineItemAction {
|
|
38
|
+
type: LineItemActionType;
|
|
39
|
+
payload: LineItemPayload;
|
|
40
|
+
}
|
|
41
|
+
export declare const getLineItems: GetLineItems;
|
|
42
|
+
export declare function updateLineItem(params: UpdateLineItemParams): Promise<void>;
|
|
43
|
+
export declare const deleteLineItem: DeleteLineItem;
|
|
44
|
+
export declare const lineItemInitialState: LineItemState;
|
|
45
|
+
export type LineItemActionType = 'setLineItems' | 'setErrors' | 'setLoading';
|
|
46
|
+
declare const lineItemReducer: (state: LineItemState, reducer: LineItemAction) => LineItemState;
|
|
47
|
+
export default lineItemReducer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lineItemInitialState=exports.deleteLineItem=exports.getLineItems=void 0,exports.updateLineItem=updateLineItem;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getLineItems=params=>{const{order,dispatch,config}=params,sdk=(0,getSdk_1.default)(config);let allLineItems=[];order&&sdk.orders.retrieve(order?.id,{include:["line_items","line_items.line_item_options.sku_option"],fields:{orders:["line_items"]}}).then(response=>{dispatch({type:"setLoading",payload:{loading:!1}});const items=response.line_items||[];allLineItems=[...allLineItems,...items],dispatch({type:"setLineItems",payload:{lineItems:allLineItems}})}).catch(error=>{const errors=(0,getErrors_1.default)({error,resource:"line_items"});dispatch({type:"setErrors",payload:{errors}})})};exports.getLineItems=getLineItems;function updateLineItem(params){return tslib_1.__awaiter(this,void 0,void 0,function*(){const{config,lineItemId,quantity,hasExternalPrice,getOrder,orderId,dispatch}=params,sdk=(0,getSdk_1.default)(config);try{yield sdk.line_items.update({id:lineItemId,quantity,_external_price:hasExternalPrice}),getOrder&&(yield getOrder(orderId)),dispatch({type:"setErrors",payload:{errors:[]}})}catch(error){const errors=(0,getErrors_1.default)({error,resource:"line_items",attributes:{id:lineItemId}});dispatch({type:"setErrors",payload:{errors}})}})}const deleteLineItem=params=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){const{config,lineItemId,getOrder,orderId,dispatch}=params,sdk=(0,getSdk_1.default)(config);try{yield sdk.line_items.delete(lineItemId),getOrder&&(yield getOrder(orderId)),dispatch({type:"setErrors",payload:{errors:[]}})}catch(error){const errors=(0,getErrors_1.default)({error,resource:"line_items"});dispatch({type:"setErrors",payload:{errors}})}});exports.deleteLineItem=deleteLineItem,exports.lineItemInitialState={loading:!1,errors:[],lineItems:[]};const actionType=["setLineItems","setErrors","setLoading"],lineItemReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,actionType);exports.default=lineItemReducer;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { Dispatch } from "react";
|
|
2
|
+
import { type SetLocalOrder, type DeleteLocalOrder } from "../utils/localStorage";
|
|
3
|
+
import type { CommerceLayerConfig } from "../context/CommerceLayerContext";
|
|
4
|
+
import type { BaseMetadataObject } from "../typings/index";
|
|
5
|
+
import type { BaseError } from "../typings/errors";
|
|
6
|
+
import type { AddressResource } from "./AddressReducer";
|
|
7
|
+
import type { Order, OrderUpdate, CommerceLayerClient, ResourceUpdate, AdyenPaymentUpdate } from "@commercelayer/sdk";
|
|
8
|
+
import type { LooseAutocomplete } from "../typings/globals";
|
|
9
|
+
export type GetOrderParams = Partial<{
|
|
10
|
+
clearWhenPlaced: boolean;
|
|
11
|
+
config: CommerceLayerConfig;
|
|
12
|
+
deleteLocalOrder: DeleteLocalOrder;
|
|
13
|
+
dispatch: Dispatch<OrderActions>;
|
|
14
|
+
id: string;
|
|
15
|
+
persistKey: string;
|
|
16
|
+
state: OrderState;
|
|
17
|
+
}>;
|
|
18
|
+
export type GetOrder = (params: GetOrderParams) => Promise<undefined | Order>;
|
|
19
|
+
type CreateOrderParams = Pick<AddToCartParams, "config" | "dispatch" | "persistKey" | "state" | "orderMetadata" | "orderAttributes" | "setLocalOrder">;
|
|
20
|
+
export interface AddToCartImportParams extends Omit<AddToCartParams, "skuCode" | "skuId" | "quantity" | "option" | "lineItem"> {
|
|
21
|
+
lineItems: CustomLineItem[];
|
|
22
|
+
}
|
|
23
|
+
export type AddToCartReturn = Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
orderId: string | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export type AddToCartImport = (params: AddToCartImportParams) => AddToCartReturn;
|
|
28
|
+
export type UnsetOrderState = (dispatch: Dispatch<OrderActions>) => void;
|
|
29
|
+
export type ResourceIncluded = "billing_address" | "shipping_address" | "line_items.line_item_options.sku_option" | "line_items.item" | "available_customer_payment_sources.payment_source" | "available_customer_payment_sources.payment_method" | "shipments.available_shipping_methods" | "shipments.stock_transfers" | "shipments.stock_transfers.line_item" | "shipments.stock_line_items.line_item" | "shipments.shipping_method" | "shipments.stock_location" | "shipments.parcels" | "shipments.parcels.parcel_line_items" | "payment_source" | "available_payment_methods" | "payment_method";
|
|
30
|
+
type ResourceIncludedLoaded = Partial<Record<ResourceIncluded, boolean>>;
|
|
31
|
+
export interface OrderPayload {
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
orderId?: string;
|
|
34
|
+
order?: Order;
|
|
35
|
+
errors?: BaseError[];
|
|
36
|
+
include?: ResourceIncluded[] | undefined;
|
|
37
|
+
includeLoaded?: ResourceIncludedLoaded;
|
|
38
|
+
withoutIncludes?: boolean;
|
|
39
|
+
manageAdyenGiftCard?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export type AddToCartImportValues = Pick<AddToCartImportParams, "lineItems">;
|
|
42
|
+
export type getOrderContext = (id: string) => Promise<undefined | Order>;
|
|
43
|
+
export type OrderState = Partial<OrderPayload>;
|
|
44
|
+
export interface OrderActions {
|
|
45
|
+
type: OrderActionType;
|
|
46
|
+
payload: OrderPayload;
|
|
47
|
+
}
|
|
48
|
+
export type OrderActionType = "setLoading" | "setOrderId" | "setOrder" | "setSingleQuantity" | "setCurrentSkuCodes" | "setCurrentSkuPrices" | "setCurrentItem" | "setErrors" | "setSaveAddressToCustomerAddressBook" | "setGiftCardOrCouponCode" | "setIncludesResource";
|
|
49
|
+
export declare function createOrder(params: CreateOrderParams): Promise<string>;
|
|
50
|
+
export declare const getApiOrder: GetOrder;
|
|
51
|
+
export interface UpdateOrderArgs {
|
|
52
|
+
id: string;
|
|
53
|
+
attributes: Omit<OrderUpdate, "id">;
|
|
54
|
+
dispatch?: Dispatch<OrderActions>;
|
|
55
|
+
include?: string[];
|
|
56
|
+
config?: CommerceLayerConfig;
|
|
57
|
+
state?: OrderState;
|
|
58
|
+
}
|
|
59
|
+
export declare function updateOrder({ id, attributes, dispatch, config, include, state, }: UpdateOrderArgs): Promise<{
|
|
60
|
+
success: boolean;
|
|
61
|
+
error?: unknown;
|
|
62
|
+
order?: Order;
|
|
63
|
+
}>;
|
|
64
|
+
interface TResourceRequest {
|
|
65
|
+
resource: Extract<keyof CommerceLayerClient, "adyen_payments">;
|
|
66
|
+
requestType: "update";
|
|
67
|
+
attributes: TResourceRequest["resource"] extends "adyen_payments" ? AdyenPaymentUpdate : ResourceUpdate;
|
|
68
|
+
order: Order;
|
|
69
|
+
dispatch?: Dispatch<OrderActions>;
|
|
70
|
+
config?: CommerceLayerConfig;
|
|
71
|
+
state?: OrderState;
|
|
72
|
+
}
|
|
73
|
+
export declare function paymentSourceRequest({ resource, requestType, dispatch, attributes, config, order, state, }: TResourceRequest): Promise<{
|
|
74
|
+
success: boolean;
|
|
75
|
+
order?: Order;
|
|
76
|
+
}>;
|
|
77
|
+
export declare const setOrder: (order: Order, dispatch?: Dispatch<OrderActions>) => void;
|
|
78
|
+
export interface AddResourceToInclude {
|
|
79
|
+
resourcesIncluded?: ResourceIncluded[];
|
|
80
|
+
dispatch?: Dispatch<OrderActions>;
|
|
81
|
+
newResource?: ResourceIncluded | ResourceIncluded[];
|
|
82
|
+
resourceIncludedLoaded?: ResourceIncludedLoaded;
|
|
83
|
+
newResourceLoaded?: ResourceIncludedLoaded;
|
|
84
|
+
}
|
|
85
|
+
export declare function addResourceToInclude({ resourcesIncluded, dispatch, newResource, newResourceLoaded, resourceIncludedLoaded, }: AddResourceToInclude): void;
|
|
86
|
+
export interface LineItemOption {
|
|
87
|
+
/**
|
|
88
|
+
* SKU Option ID. Ex: mNJEgsJwBn
|
|
89
|
+
*/
|
|
90
|
+
skuOptionId: string;
|
|
91
|
+
/**
|
|
92
|
+
* Set of key-value pairs that represent the selected options. Ex: { message: 'This is a option message' }
|
|
93
|
+
*/
|
|
94
|
+
options: Record<string, string>;
|
|
95
|
+
quantity?: number;
|
|
96
|
+
}
|
|
97
|
+
type TFrequency = "hourly" | "daily" | "weekly" | "monthly" | "two-month" | "three-month" | "four-month" | "six-month" | "yearly";
|
|
98
|
+
export interface CustomLineItem {
|
|
99
|
+
name?: string;
|
|
100
|
+
imageUrl?: string | null;
|
|
101
|
+
metadata?: Record<string, string>;
|
|
102
|
+
frequency?: LooseAutocomplete<TFrequency>;
|
|
103
|
+
externalPrice?: boolean;
|
|
104
|
+
_update_quantity?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export type AddToCartParams = Partial<{
|
|
107
|
+
bundleCode: string;
|
|
108
|
+
skuCode: string;
|
|
109
|
+
persistKey: string;
|
|
110
|
+
config: CommerceLayerConfig;
|
|
111
|
+
dispatch: Dispatch<OrderActions>;
|
|
112
|
+
state: Partial<OrderState>;
|
|
113
|
+
quantity: number;
|
|
114
|
+
lineItemOption: LineItemOption;
|
|
115
|
+
lineItem: CustomLineItem;
|
|
116
|
+
orderMetadata: BaseMetadataObject;
|
|
117
|
+
orderAttributes: Record<string, any>;
|
|
118
|
+
errors: BaseError[];
|
|
119
|
+
setLocalOrder: SetLocalOrder;
|
|
120
|
+
buyNowMode: boolean;
|
|
121
|
+
checkoutUrl: string;
|
|
122
|
+
openMiniCart: boolean;
|
|
123
|
+
}>;
|
|
124
|
+
export declare function addToCart(params: AddToCartParams): Promise<{
|
|
125
|
+
success: boolean;
|
|
126
|
+
orderId?: string;
|
|
127
|
+
}>;
|
|
128
|
+
export declare const unsetOrderState: UnsetOrderState;
|
|
129
|
+
interface OrderErrors {
|
|
130
|
+
dispatch?: Dispatch<OrderActions>;
|
|
131
|
+
errors: BaseError[];
|
|
132
|
+
}
|
|
133
|
+
export declare function setOrderErrors({ dispatch, errors }: OrderErrors): {
|
|
134
|
+
success: boolean;
|
|
135
|
+
};
|
|
136
|
+
export type SaveAddressToCustomerAddressBook = (params: {
|
|
137
|
+
dispatch?: Dispatch<OrderActions>;
|
|
138
|
+
type: AddressResource;
|
|
139
|
+
value: boolean;
|
|
140
|
+
}) => void;
|
|
141
|
+
export declare const saveAddressToCustomerAddressBook: SaveAddressToCustomerAddressBook;
|
|
142
|
+
interface TSetGiftCardOrCouponCodeParams {
|
|
143
|
+
code: string;
|
|
144
|
+
codeType: OrderCodeType;
|
|
145
|
+
dispatch?: Dispatch<OrderActions>;
|
|
146
|
+
config?: CommerceLayerConfig;
|
|
147
|
+
order?: Order;
|
|
148
|
+
include?: string[];
|
|
149
|
+
state?: OrderState;
|
|
150
|
+
}
|
|
151
|
+
export declare function setGiftCardOrCouponCode({ code, codeType, dispatch, config, order, include, state, }: TSetGiftCardOrCouponCodeParams): Promise<{
|
|
152
|
+
success: boolean;
|
|
153
|
+
order?: Order;
|
|
154
|
+
}>;
|
|
155
|
+
export type CodeType = "coupon" | "gift_card";
|
|
156
|
+
export type OrderCodeType = `${CodeType}_code`;
|
|
157
|
+
interface TRemoveGiftCardOrCouponCodeParams {
|
|
158
|
+
codeType: OrderCodeType;
|
|
159
|
+
dispatch?: Dispatch<OrderActions>;
|
|
160
|
+
config?: CommerceLayerConfig;
|
|
161
|
+
order?: Order;
|
|
162
|
+
include?: string[];
|
|
163
|
+
state?: OrderState;
|
|
164
|
+
}
|
|
165
|
+
export declare function removeGiftCardOrCouponCode({ codeType, dispatch, config, order, include, state, }: TRemoveGiftCardOrCouponCodeParams): Promise<{
|
|
166
|
+
success: boolean;
|
|
167
|
+
order?: Order;
|
|
168
|
+
}>;
|
|
169
|
+
export declare const orderInitialState: Partial<OrderState>;
|
|
170
|
+
declare const orderReducer: (state: OrderState, reducer: OrderActions) => OrderState;
|
|
171
|
+
export default orderReducer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.orderInitialState=exports.saveAddressToCustomerAddressBook=exports.unsetOrderState=exports.setOrder=exports.getApiOrder=void 0,exports.createOrder=createOrder,exports.updateOrder=updateOrder,exports.paymentSourceRequest=paymentSourceRequest,exports.addResourceToInclude=addResourceToInclude,exports.addToCart=addToCart,exports.setOrderErrors=setOrderErrors,exports.setGiftCardOrCouponCode=setGiftCardOrCouponCode,exports.removeGiftCardOrCouponCode=removeGiftCardOrCouponCode;const tslib_1=require("tslib"),localStorage_1=require("../utils/localStorage"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importStar(require("../utils/getErrors")),organization_1=require("../utils/organization"),events_1=require("../utils/events"),getDomain_1=require("../utils/getDomain"),getApplicationLink_1=require("../utils/getApplicationLink"),actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];function createOrder(params){return tslib_1.__awaiter(this,void 0,void 0,function*(){if(params){const{persistKey,state,dispatch,config,orderMetadata:metadata,orderAttributes={},setLocalOrder}=params;if(state?.orderId)return state.orderId;const sdk=config!=null?(0,getSdk_1.default)(config):void 0;try{if(sdk==null)return"";const o=yield sdk?.orders.create(Object.assign({metadata},orderAttributes));return dispatch&&dispatch({type:"setOrderId",payload:{orderId:o?.id}}),persistKey&&setLocalOrder&&setLocalOrder(persistKey,o.id),o.id}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders"});console.error("Create order",errors),dispatch&&(0,getErrors_1.setErrors)({currentErrors:state?.errors,newErrors:errors,dispatch})}}return""})}const getApiOrder=params=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){const{id,dispatch,config,clearWhenPlaced,persistKey,deleteLocalOrder,state}=params,sdk=config!=null?(0,getSdk_1.default)(config):void 0;try{if(sdk==null)return;const options={};state?.include&&state.include.length>0&&(options.include=state.include);const order=yield sdk.orders.retrieve(id??"",options);return clearWhenPlaced&&order.editable===!1?(persistKey&&deleteLocalOrder&&deleteLocalOrder(persistKey),dispatch&&dispatch({type:"setOrder",payload:{order:void 0,orderId:""}})):dispatch&&dispatch({type:"setOrder",payload:{order,orderId:order.id}}),order}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders"});console.error("Retrieve order",errors),dispatch&&(0,getErrors_1.setErrors)({currentErrors:state?.errors,newErrors:errors,dispatch});return}});exports.getApiOrder=getApiOrder;function updateOrder(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({id,attributes,dispatch,config,include,state}){const sdk=config!=null?(0,getSdk_1.default)(config):void 0;try{if(sdk==null)return{success:!1};const resource=Object.assign(Object.assign({},attributes),{id});yield sdk.orders.update(resource,{include});const order=yield(0,exports.getApiOrder)({id,config,dispatch,state});return dispatch&&order&&dispatch({type:"setOrder",payload:{order}}),{success:!0,order}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders"});return dispatch&&(setOrderErrors({errors,dispatch}),dispatch({type:"setErrors",payload:{errors}})),{success:!1,error}}})}function paymentSourceRequest(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({resource,requestType,dispatch,attributes,config,order,state}){const sdk=config!=null?(0,getSdk_1.default)(config):void 0;try{if(sdk==null)return{success:!1};yield sdk[resource][requestType](attributes);const orderUpdated=yield updateOrder({id:order.id,attributes:{},config,include:state?.include,dispatch,state});return{success:!0,order:orderUpdated?.order}}catch(error){console.error("Resource request",error);const errors=(0,getErrors_1.default)({error,resource:"orders"});return console.error("Remove gift card o coupon code",errors),dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}})}const setOrder=(order,dispatch)=>{dispatch&&dispatch({type:"setOrder",payload:{order}})};exports.setOrder=setOrder;function addResourceToInclude({resourcesIncluded=[],dispatch,newResource,newResourceLoaded,resourceIncludedLoaded}){const payload={include:void 0,includeLoaded:void 0};if(newResource){const resources=typeof newResource=="string"?[newResource]:newResource;payload.include=[...new Set([...resourcesIncluded,...resources])],resources.forEach(resource=>{const includeLoaded=Object.assign(Object.assign({},payload.includeLoaded),{[resource]:!0});payload.includeLoaded=includeLoaded})}else delete payload.include;const payloadIncludeLoaded=Object.assign(Object.assign(Object.assign({},resourceIncludedLoaded),newResourceLoaded),payload.includeLoaded&&payload.includeLoaded);payload.includeLoaded=payloadIncludeLoaded,dispatch&&dispatch({type:"setIncludesResource",payload:Object.assign(Object.assign({},payload),{withoutIncludes:!1})})}function addToCart(params){return tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f;const{skuCode,bundleCode,quantity,config,dispatch,lineItem,state,errors=[],buyNowMode,checkoutUrl,lineItemOption,openMiniCart=!0}=params;try{if(config){const sdk=(0,getSdk_1.default)(config),id=yield createOrder(params);if(id){const order=sdk.orders.relationship(id),name=lineItem?.name,imageUrl=lineItem?.imageUrl,metadata=lineItem?.metadata,frequency=lineItem?.frequency,externalPrice=lineItem?.externalPrice;if(buyNowMode)if(!((_a=state?.order)===null||_a===void 0)&&_a.line_items)yield Promise.all((_b=state?.order)===null||_b===void 0?void 0:_b.line_items.map(lineItem2=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield sdk.line_items.delete(lineItem2.id)})));else{const{line_items:lineItems}=yield sdk.orders.retrieve(id,{fields:["line_items"],include:["line_items"]});lineItems&&lineItems?.length>0&&(yield Promise.all(lineItems.map(lineItem2=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield sdk.line_items.delete(lineItem2.id)}))))}const attrs={order,sku_code:skuCode,name,image_url:imageUrl,quantity:quantity??1,_update_quantity:(_c=lineItem?._update_quantity)!==null&&_c!==void 0?_c:!0,bundle_code:bundleCode,metadata,frequency};externalPrice===!0&&(attrs._external_price=externalPrice);const newLineItem=yield sdk.line_items.create(attrs);if(lineItemOption!=null){const{skuOptionId,options,quantity:quantity2}=lineItemOption,skuOption=sdk.sku_options.relationship(skuOptionId),lineItemRel=sdk.line_items.relationship(newLineItem.id),lineItemOptionsAttributes={quantity:quantity2??1,options,sku_option:skuOption,line_item:lineItemRel};yield sdk.line_item_options.create(lineItemOptionsAttributes),yield(0,exports.getApiOrder)(Object.assign({id},params))}else yield(0,exports.getApiOrder)(Object.assign(Object.assign({id},params),{state}));if(!(0,isEmpty_1.default)(errors)&&dispatch&&dispatch({type:"setErrors",payload:{errors:[]}}),buyNowMode&&id&&config?.accessToken!=null&&config?.endpoint!=null){const params2=`${id}?accessToken=${(_d=config.accessToken)!==null&&_d!==void 0?_d:""}`,{domain,slug}=(0,getDomain_1.getDomain)(config.endpoint),href=(0,getApplicationLink_1.getApplicationLink)({slug,orderId:id,accessToken:config.accessToken,applicationType:"checkout",domain}),organizationConfig=yield(0,organization_1.getOrganizationConfig)({accessToken:config.accessToken,endpoint:config.endpoint,params:{accessToken:config.accessToken,orderId:order?.id,slug}}),redirectUrl=checkoutUrl?`${checkoutUrl}/${params2}`:(_f=(_e=organizationConfig?.links)===null||_e===void 0?void 0:_e.checkout)!==null&&_f!==void 0?_f:href;location.href=redirectUrl}else openMiniCart&&(0,events_1.publish)("open-cart");return{success:!0,orderId:id}}}return{success:!1}}catch(error){const errors2=(0,getErrors_1.default)({error,resource:"orders"});return console.error("Add to cart",errors2),dispatch&&(0,getErrors_1.setErrors)({currentErrors:state?.errors,newErrors:errors2,dispatch}),{success:!1}}})}const unsetOrderState=dispatch=>{dispatch({type:"setOrderId",payload:{orderId:""}}),dispatch({type:"setOrder",payload:{order:void 0}})};exports.unsetOrderState=unsetOrderState;function setOrderErrors({dispatch,errors=[]}){return dispatch&&dispatch({type:"setErrors",payload:{errors}}),{success:!1}}const saveAddressToCustomerAddressBook=({type,value,dispatch})=>{const k=`_save_${type}_to_customer_address_book`,v=`${value.toString()}`;(0,localStorage_1.setCustomerOrderParam)(k,v),dispatch&&dispatch({type:"setSaveAddressToCustomerAddressBook",payload:{[k]:v}})};exports.saveAddressToCustomerAddressBook=saveAddressToCustomerAddressBook;function setGiftCardOrCouponCode(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({code,codeType,dispatch,config,order,include,state}){try{if(config&&order&&code&&dispatch){const attributes={[codeType]:code},{success,order:currentOrder,error}=yield updateOrder({id:order.id,attributes,config,include,dispatch,state});if(!success)throw error;return dispatch({type:"setErrors",payload:{errors:[]}}),{success,order:currentOrder}}return{success:!1}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders",field:codeType});return dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}})}function removeGiftCardOrCouponCode(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({codeType,dispatch,config,order,include,state}){try{if(config&&order&&dispatch){const attributes={[codeType]:""},orderUpdated=yield updateOrder({id:order.id,attributes,config,include,dispatch,state});return dispatch({type:"setErrors",payload:{errors:[]}}),{success:!0,order:orderUpdated?.order}}return{success:!1}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders",field:codeType});return console.error("Remove gift card o coupon code",errors),dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}})}exports.orderInitialState={loading:!0,orderId:"",order:void 0,errors:[],include:void 0,withoutIncludes:!0};const orderReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,actionType);exports.default=orderReducer;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { AdyenPaymentConfig } from "../components/payment_source/AdyenPayment";
|
|
2
|
+
import type { BraintreeConfig } from "../components/payment_source/BraintreePayment";
|
|
3
|
+
import type { PaypalConfig } from "../components/payment_source/PaypalPayment";
|
|
4
|
+
import type { StripeConfig } from "../components/payment_source/StripePayment";
|
|
5
|
+
import type { WireTransferConfig } from "../components/payment_source/WireTransferPayment";
|
|
6
|
+
import type { CommerceLayerConfig } from "../context/CommerceLayerContext";
|
|
7
|
+
import type { getOrderContext, updateOrder } from "./OrderReducer";
|
|
8
|
+
import type { BaseError } from "../typings/errors";
|
|
9
|
+
import type { Order, PaymentMethod, StripePayment, WireTransfer, AdyenPayment, BraintreePayment, CheckoutComPayment, ExternalPayment, PaypalPayment, KlarnaPayment } from "@commercelayer/sdk";
|
|
10
|
+
import type { Dispatch, MutableRefObject } from "react";
|
|
11
|
+
import type { CheckoutComConfig } from "../components/payment_source/CheckoutComPayment";
|
|
12
|
+
import type { ExternalPaymentConfig } from "../components/payment_source/ExternalPayment";
|
|
13
|
+
import type { ResourceKeys } from "../utils/getPaymentAttributes";
|
|
14
|
+
export type PaymentSourceType = Order["payment_source"];
|
|
15
|
+
interface Card {
|
|
16
|
+
type: string;
|
|
17
|
+
brand: string;
|
|
18
|
+
last4: string;
|
|
19
|
+
exp_year: number;
|
|
20
|
+
exp_month: number;
|
|
21
|
+
}
|
|
22
|
+
export interface PaymentSourceObject {
|
|
23
|
+
adyen_payments: AdyenPayment & {
|
|
24
|
+
payment_request_data?: {
|
|
25
|
+
payment_method?: Card;
|
|
26
|
+
};
|
|
27
|
+
payment_response?: {
|
|
28
|
+
resultCode?: "Authorised";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
braintree_payments: BraintreePayment & {
|
|
32
|
+
options?: {
|
|
33
|
+
card: Card;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
external_payments: ExternalPayment & {
|
|
37
|
+
payment_source_token?: string;
|
|
38
|
+
};
|
|
39
|
+
paypal_payments: PaypalPayment;
|
|
40
|
+
stripe_payments: StripePayment & {
|
|
41
|
+
options?: {
|
|
42
|
+
card: Card;
|
|
43
|
+
};
|
|
44
|
+
payment_method?: {
|
|
45
|
+
card: Card;
|
|
46
|
+
type: string | "klarna" | "card";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
wire_transfers: WireTransfer;
|
|
50
|
+
checkout_com_payments: CheckoutComPayment & {
|
|
51
|
+
payment_response: {
|
|
52
|
+
source?: Pick<Card, "last4"> & {
|
|
53
|
+
scheme: string;
|
|
54
|
+
expiry_year: number;
|
|
55
|
+
expiry_month: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
klarna_payments: KlarnaPayment;
|
|
60
|
+
}
|
|
61
|
+
export type PaymentMethodActionType = "setErrors" | "setPaymentMethods" | "setPaymentMethodConfig" | "setPaymentSource" | "setPaymentRef" | "setLoading";
|
|
62
|
+
export type PaymentRef = MutableRefObject<null | HTMLFormElement>;
|
|
63
|
+
export interface PaymentMethodActionPayload {
|
|
64
|
+
errors: BaseError[];
|
|
65
|
+
paymentMethods: PaymentMethod[] | null;
|
|
66
|
+
currentPaymentMethodType: PaymentResource;
|
|
67
|
+
currentPaymentMethodId: string;
|
|
68
|
+
currentPaymentMethodRef: PaymentRef;
|
|
69
|
+
currentCustomerPaymentSourceId: string | null;
|
|
70
|
+
config: PaymentMethodConfig;
|
|
71
|
+
paymentSource: Order["payment_source"] | null;
|
|
72
|
+
loading: boolean;
|
|
73
|
+
}
|
|
74
|
+
export declare function setLoading({ loading, dispatch, }: {
|
|
75
|
+
loading: boolean;
|
|
76
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
77
|
+
}): void;
|
|
78
|
+
export type SetPaymentRef = (args: {
|
|
79
|
+
ref: PaymentRef;
|
|
80
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
81
|
+
}) => void;
|
|
82
|
+
export declare const setPaymentRef: SetPaymentRef;
|
|
83
|
+
export type PaymentMethodState = Partial<PaymentMethodActionPayload>;
|
|
84
|
+
export interface PaymentMethodAction {
|
|
85
|
+
type: PaymentMethodActionType;
|
|
86
|
+
payload: Partial<PaymentMethodActionPayload>;
|
|
87
|
+
}
|
|
88
|
+
export declare const paymentMethodInitialState: PaymentMethodState;
|
|
89
|
+
export type SetPaymentMethodErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<PaymentMethodAction>) => void;
|
|
90
|
+
export declare const setPaymentMethodErrors: SetPaymentMethodErrors;
|
|
91
|
+
type GetPaymentMethods = (args: {
|
|
92
|
+
order: Order;
|
|
93
|
+
dispatch: Dispatch<PaymentMethodAction>;
|
|
94
|
+
}) => Promise<void>;
|
|
95
|
+
export declare const getPaymentMethods: GetPaymentMethods;
|
|
96
|
+
export type PaymentResource = keyof PaymentSourceObject;
|
|
97
|
+
export type PaymentResourceKey = "braintreePayment" | "stripePayment" | "klarnaPayment" | "wireTransfer" | "paypalPayment" | "adyenPayment" | "checkoutComPayment";
|
|
98
|
+
export type SDKPaymentResource = "AdyenPayment" | "BraintreePayment" | "ExternalPayment" | "PaypalPayment" | "StripePayment" | "WireTransfer" | "CheckoutComPayment";
|
|
99
|
+
interface TSetPaymentMethodParams {
|
|
100
|
+
config?: CommerceLayerConfig;
|
|
101
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
102
|
+
updateOrder?: typeof updateOrder;
|
|
103
|
+
setOrderErrors?: (collection: any) => {
|
|
104
|
+
success: boolean;
|
|
105
|
+
};
|
|
106
|
+
order?: Order;
|
|
107
|
+
paymentMethodId: string;
|
|
108
|
+
paymentResource?: PaymentResource;
|
|
109
|
+
}
|
|
110
|
+
export declare function setPaymentMethod({ config, dispatch, order, paymentMethodId, updateOrder, setOrderErrors, paymentResource, }: TSetPaymentMethodParams): Promise<{
|
|
111
|
+
success: boolean;
|
|
112
|
+
order?: Order;
|
|
113
|
+
}>;
|
|
114
|
+
type PaymentSourceTypes = (StripePayment & WireTransfer) | (StripePayment | WireTransfer);
|
|
115
|
+
export type SetPaymentSourceResponse = {
|
|
116
|
+
order: Order;
|
|
117
|
+
paymentSource: PaymentSourceTypes;
|
|
118
|
+
} | null;
|
|
119
|
+
export interface SetPaymentSourceParams extends Omit<PaymentMethodState, "config"> {
|
|
120
|
+
config?: CommerceLayerConfig;
|
|
121
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
122
|
+
getOrder?: getOrderContext;
|
|
123
|
+
attributes?: Record<string, unknown>;
|
|
124
|
+
order?: Order;
|
|
125
|
+
paymentResource: PaymentResource;
|
|
126
|
+
paymentSourceId?: string;
|
|
127
|
+
customerPaymentSourceId?: string;
|
|
128
|
+
updateOrder?: typeof updateOrder;
|
|
129
|
+
}
|
|
130
|
+
export declare function setPaymentSource({ config, dispatch, getOrder, attributes, order, paymentResource, customerPaymentSourceId, paymentSourceId, updateOrder, errors: currentErrors, }: SetPaymentSourceParams): Promise<PaymentSourceType | undefined | null>;
|
|
131
|
+
export type UpdatePaymentSource = (args: {
|
|
132
|
+
id: string;
|
|
133
|
+
attributes: Record<string, any>;
|
|
134
|
+
paymentResource: PaymentResource;
|
|
135
|
+
config?: CommerceLayerConfig;
|
|
136
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
137
|
+
}) => Promise<void>;
|
|
138
|
+
export declare const updatePaymentSource: UpdatePaymentSource;
|
|
139
|
+
export type DestroyPaymentSource = (args: {
|
|
140
|
+
paymentSourceId: string;
|
|
141
|
+
paymentResource: PaymentResource;
|
|
142
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
143
|
+
updateOrder?: typeof updateOrder;
|
|
144
|
+
orderId?: string;
|
|
145
|
+
}) => Promise<void>;
|
|
146
|
+
export declare const destroyPaymentSource: DestroyPaymentSource;
|
|
147
|
+
export interface PaymentMethodConfig {
|
|
148
|
+
adyenPayment?: AdyenPaymentConfig;
|
|
149
|
+
braintreePayment?: BraintreeConfig;
|
|
150
|
+
checkoutComPayment?: CheckoutComConfig;
|
|
151
|
+
externalPayment?: ExternalPaymentConfig;
|
|
152
|
+
klarnaPayment?: Pick<AdyenPaymentConfig, "placeOrderCallback"> & Pick<StripeConfig, "containerClassName">;
|
|
153
|
+
paypalPayment?: PaypalConfig;
|
|
154
|
+
stripePayment?: StripeConfig;
|
|
155
|
+
wireTransfer?: Partial<WireTransferConfig>;
|
|
156
|
+
}
|
|
157
|
+
type SetPaymentMethodConfig = (config: PaymentMethodConfig, dispatch: Dispatch<PaymentMethodAction>) => void;
|
|
158
|
+
export declare const setPaymentMethodConfig: SetPaymentMethodConfig;
|
|
159
|
+
export declare function getPaymentConfig<R extends PaymentResource = PaymentResource, K extends PaymentMethodConfig = PaymentMethodConfig>(paymentResource: R, config: K): Pick<K, ResourceKeys<R>>;
|
|
160
|
+
declare const paymentMethodReducer: (state: PaymentMethodState, reducer: PaymentMethodAction) => PaymentMethodState;
|
|
161
|
+
export default paymentMethodReducer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setPaymentMethodConfig=exports.destroyPaymentSource=exports.updatePaymentSource=exports.getPaymentMethods=exports.setPaymentMethodErrors=exports.paymentMethodInitialState=exports.setPaymentRef=void 0,exports.setLoading=setLoading,exports.setPaymentMethod=setPaymentMethod,exports.setPaymentSource=setPaymentSource,exports.getPaymentConfig=getPaymentConfig;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getErrors_1=tslib_1.__importStar(require("../utils/getErrors")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),snakeToCamelCase_1=require("../utils/snakeToCamelCase"),replace_1=require("../utils/replace"),pick_1=require("../utils/pick");function setLoading({loading,dispatch}){dispatch&&dispatch({type:"setLoading",payload:{loading}})}const setPaymentRef=({ref,dispatch})=>{ref&&dispatch&&dispatch({type:"setPaymentRef",payload:{currentPaymentMethodRef:ref}})};exports.setPaymentRef=setPaymentRef,exports.paymentMethodInitialState={errors:[],paymentMethods:void 0};const setPaymentMethodErrors=(errors,dispatch)=>{dispatch&&dispatch({type:"setErrors",payload:{errors}})};exports.setPaymentMethodErrors=setPaymentMethodErrors;const getPaymentMethods=_a=>tslib_1.__awaiter(void 0,[_a],void 0,function*({order,dispatch}){const paymentMethods=order.available_payment_methods,paymentMethod=order.payment_method,paymentSource=order.payment_source;dispatch({type:"setPaymentMethods",payload:{paymentMethods,currentPaymentMethodId:paymentMethod?.id,currentPaymentMethodType:paymentMethod?.payment_source_type,paymentSource}})});exports.getPaymentMethods=getPaymentMethods;function setPaymentMethod(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({config,dispatch,order,paymentMethodId,updateOrder,setOrderErrors,paymentResource}){let response={success:!1};try{if(config&&order&&dispatch&&paymentResource){localStorage.removeItem("_save_payment_source_to_customer_wallet");const attributes={payment_method:(0,getSdk_1.default)(config).payment_methods.relationship(paymentMethodId)};updateOrder!=null&&(response=yield updateOrder({id:order.id,attributes})),dispatch({type:"setPaymentMethods",payload:{currentPaymentMethodId:paymentMethodId,currentPaymentMethodType:paymentResource,errors:[]}}),setOrderErrors&&setOrderErrors([])}return response}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders",field:paymentResource});return console.error("Set payment method",errors),response}})}function setPaymentSource(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({config,dispatch,getOrder,attributes,order,paymentResource,customerPaymentSourceId,paymentSourceId,updateOrder,errors:currentErrors}){var _b;try{const isAlreadyPlaced=order?.status==="placed";if(config&&order&&!isAlreadyPlaced){let paymentSource;const sdk=(0,getSdk_1.default)(config);if(customerPaymentSourceId){if(updateOrder!=null){const{order:orderUpdated}=yield updateOrder({id:order.id,attributes:{_customer_payment_source_id:customerPaymentSourceId}});dispatch!=null&&orderUpdated!=null&&dispatch({type:"setPaymentSource",payload:{paymentSource:orderUpdated.payment_source,currentCustomerPaymentSourceId:(_b=orderUpdated.payment_source)===null||_b===void 0?void 0:_b.id}})}}else{if(paymentSourceId){const attrs=Object.assign({id:paymentSourceId},attributes);paymentSource=attributes!=null?yield sdk[paymentResource].update(attrs):yield sdk[paymentResource].retrieve(paymentSourceId)}else{const attrs=Object.assign(Object.assign({},attributes),{order:sdk.orders.relationship(order.id)});paymentSource=yield sdk[paymentResource].create(attrs)}return getOrder&&(yield getOrder(order.id)),dispatch&&dispatch({type:"setPaymentSource",payload:{paymentSource,errors:[],currentCustomerPaymentSourceId:null}}),paymentSource}}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"payment_methods",field:paymentResource});if(errors!=null&&errors?.length>0){const[error2]=errors;if(error2?.status==="401"&&getOrder!=null&&order!=null){const currentOrder=yield getOrder(order?.id);currentOrder?.status!=null&&!["placed","approved"].includes(currentOrder.status)&&(console.error("Set payment source:",errors),(0,getErrors_1.setErrors)({currentErrors,newErrors:errors,dispatch}))}}else(0,getErrors_1.setErrors)({currentErrors,newErrors:errors,dispatch})}})}const updatePaymentSource=_a=>tslib_1.__awaiter(void 0,[_a],void 0,function*({id,attributes,config,dispatch,paymentResource}){if(config)try{const paymentSource=yield(0,getSdk_1.default)(config)[paymentResource].update(Object.assign({id},attributes));dispatch&&dispatch({type:"setPaymentSource",payload:{paymentSource}})}catch(err){console.error("Update payment source:",err)}});exports.updatePaymentSource=updatePaymentSource;const destroyPaymentSource=_a=>tslib_1.__awaiter(void 0,[_a],void 0,function*({paymentSourceId,paymentResource,dispatch}){paymentSourceId&&paymentResource&&dispatch&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})});exports.destroyPaymentSource=destroyPaymentSource;const setPaymentMethodConfig=(config,dispatch)=>{dispatch({type:"setPaymentMethodConfig",payload:{config}})};exports.setPaymentMethodConfig=setPaymentMethodConfig;function getPaymentConfig(paymentResource,config){const resourceKeys=(0,replace_1.replace)((0,replace_1.replace)(paymentResource,"payments","payment"),"transfers","transfer"),resource=(0,snakeToCamelCase_1.snakeToCamelCase)(resourceKeys);return(0,pick_1.pick)(config,[resource])}const type=["setErrors","setPaymentMethodConfig","setPaymentMethods","setPaymentSource","setPaymentRef","setLoading"],paymentMethodReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=paymentMethodReducer;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Dispatch, RefObject } from "react";
|
|
2
|
+
import type { CommerceLayerConfig } from "../context/CommerceLayerContext";
|
|
3
|
+
import type { BaseError } from "../typings/errors";
|
|
4
|
+
import type { Order } from "@commercelayer/sdk";
|
|
5
|
+
import type { PaymentResource, PaymentSourceType } from "./PaymentMethodReducer";
|
|
6
|
+
export type PlaceOrderActionType = "setErrors" | "setPlaceOrderPermitted" | "setButtonRef" | "setStatus";
|
|
7
|
+
export interface PlaceOrderOptions {
|
|
8
|
+
paypalPayerId?: string;
|
|
9
|
+
adyen?: {
|
|
10
|
+
MD?: string;
|
|
11
|
+
PaRes?: string;
|
|
12
|
+
redirectResult?: string;
|
|
13
|
+
};
|
|
14
|
+
checkoutCom?: {
|
|
15
|
+
session_id: string;
|
|
16
|
+
};
|
|
17
|
+
stripe?: {
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated
|
|
20
|
+
* Use `paymentIntentClientSecret` instead
|
|
21
|
+
*/
|
|
22
|
+
redirectStatus?: string;
|
|
23
|
+
paymentIntentClientSecret: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface PlaceOrderActionPayload {
|
|
27
|
+
errors: BaseError[];
|
|
28
|
+
isPermitted: boolean;
|
|
29
|
+
paymentType: PaymentResource;
|
|
30
|
+
paymentSecret: string;
|
|
31
|
+
paymentId: string;
|
|
32
|
+
paymentSource: PaymentSourceType;
|
|
33
|
+
options?: PlaceOrderOptions;
|
|
34
|
+
placeOrderButtonRef?: RefObject<HTMLButtonElement | null>;
|
|
35
|
+
status: "placing" | "standby";
|
|
36
|
+
}
|
|
37
|
+
export declare function setButtonRef(ref: RefObject<HTMLButtonElement | null>, dispatch: Dispatch<PlaceOrderAction>): void;
|
|
38
|
+
export type PlaceOrderState = Partial<PlaceOrderActionPayload>;
|
|
39
|
+
export interface PlaceOrderAction {
|
|
40
|
+
type: PlaceOrderActionType;
|
|
41
|
+
payload: Partial<PlaceOrderActionPayload>;
|
|
42
|
+
}
|
|
43
|
+
export declare const placeOrderInitialState: PlaceOrderState;
|
|
44
|
+
export declare function setPlaceOrderErrors<V extends BaseError[]>(errors: V, dispatch: Dispatch<PlaceOrderAction>): void;
|
|
45
|
+
interface TPlaceOrderPermittedParams {
|
|
46
|
+
config?: CommerceLayerConfig;
|
|
47
|
+
dispatch: Dispatch<PlaceOrderAction>;
|
|
48
|
+
order?: Order;
|
|
49
|
+
options?: PlaceOrderOptions;
|
|
50
|
+
}
|
|
51
|
+
export declare function placeOrderPermitted({ config, order, dispatch, options, }: TPlaceOrderPermittedParams): void;
|
|
52
|
+
interface TSetPlaceOrderParams {
|
|
53
|
+
config?: CommerceLayerConfig;
|
|
54
|
+
order?: Order;
|
|
55
|
+
state?: PlaceOrderState;
|
|
56
|
+
setOrderErrors?: (errors: BaseError[]) => void;
|
|
57
|
+
paymentSource?: PaymentSourceType;
|
|
58
|
+
include?: string[];
|
|
59
|
+
setOrder?: (order: Order) => void;
|
|
60
|
+
currentCustomerPaymentSourceId?: string | null;
|
|
61
|
+
}
|
|
62
|
+
export declare function setPlaceOrder({ state, order, config, setOrderErrors, paymentSource, setOrder, include, currentCustomerPaymentSourceId, }: TSetPlaceOrderParams): Promise<{
|
|
63
|
+
placed: boolean;
|
|
64
|
+
errors?: BaseError[];
|
|
65
|
+
order?: Order;
|
|
66
|
+
}>;
|
|
67
|
+
export declare function setPlaceOrderStatus({ status, dispatch, }: {
|
|
68
|
+
status: "placing" | "standby";
|
|
69
|
+
dispatch?: Dispatch<PlaceOrderAction>;
|
|
70
|
+
}): void;
|
|
71
|
+
declare const placeOrderReducer: (state: PlaceOrderState, reducer: PlaceOrderAction) => PlaceOrderState;
|
|
72
|
+
export default placeOrderReducer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.placeOrderInitialState=void 0,exports.setButtonRef=setButtonRef,exports.setPlaceOrderErrors=setPlaceOrderErrors,exports.placeOrderPermitted=placeOrderPermitted,exports.setPlaceOrder=setPlaceOrder,exports.setPlaceOrderStatus=setPlaceOrderStatus;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),shipments_1=require("../utils/shipments"),customerOrderOptions_1=require("../utils/customerOrderOptions"),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),isGuestToken_1=require("../utils/isGuestToken"),localStorage_1=require("../utils/localStorage"),hasSubscriptions_1=require("../utils/hasSubscriptions"),updateOrderSubscriptionCustomerPaymentSource_1=require("../utils/updateOrderSubscriptionCustomerPaymentSource");function setButtonRef(ref,dispatch){ref?.current!=null&&dispatch({type:"setButtonRef",payload:{placeOrderButtonRef:ref}})}exports.placeOrderInitialState={errors:[],isPermitted:!1,status:"standby"};function setPlaceOrderErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}function placeOrderPermitted({config,order,dispatch,options}){var _a;if(order&&config){let isPermitted=!0;order.privacy_url&&order.terms_url&&(isPermitted=localStorage.getItem("privacy-terms")==="true");const billingAddress=order.billing_address,shippingAddress=order.shipping_address,doNotShip=(0,shipments_1.isDoNotShip)(order.line_items),shipments=order.shipments,shipment=shipments&&(0,shipments_1.shipmentsFilled)(shipments),paymentMethod=order.payment_method,paymentSource=order.payment_source;order.total_amount_with_taxes_cents!==0&&(0,isEmpty_1.default)(paymentMethod?.id)&&(isPermitted=!1),(0,isEmpty_1.default)(billingAddress)&&(isPermitted=!1),(0,isEmpty_1.default)(shippingAddress)&&!doNotShip&&(isPermitted=!1),!(0,isEmpty_1.default)(shipments)&&!shipment&&(isPermitted=!1),paymentSource?.mismatched_amounts&&(isPermitted=!1),dispatch({type:"setPlaceOrderPermitted",payload:{isPermitted,paymentType:paymentMethod?.payment_source_type,paymentSecret:paymentSource?.client_secret,paymentId:(_a=paymentSource?.options)===null||_a===void 0?void 0:_a.id,paymentSource,options}})}}function setPlaceOrder(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({state,order,config,setOrderErrors,paymentSource,setOrder,include,currentCustomerPaymentSourceId}){var _b,_c,_d,_e,_f,_g,_h;const response={placed:!1};if(state&&config&&order){if(order?.status==="placed")return{placed:!0,order};const sdk=(0,getSdk_1.default)(config),{options,paymentType}=state;try{const lastOrderStatus=yield sdk.orders.retrieve(order.id);if(lastOrderStatus.status==="placed")return{placed:!0,order:lastOrderStatus};if(paymentType==="paypal_payments"&&paymentSource?.type==="paypal_payments"){if(!options?.paypalPayerId&&paymentSource?.approval_url)return window.location.href=paymentSource?.approval_url,response;yield sdk[paymentType].update({id:paymentSource.id,paypal_payer_id:options?.paypalPayerId})}if(paymentType==="checkout_com_payments"&&paymentSource&&(!((_b=options?.checkoutCom)===null||_b===void 0)&&_b.session_id)){const payment=yield sdk[paymentType].update({id:paymentSource.id,_details:!0,session_id:(_c=options?.checkoutCom)===null||_c===void 0?void 0:_c.session_id});if(((_d=payment?.payment_response)===null||_d===void 0?void 0:_d.status)!=="Authorized"){const[action]=((_e=payment?.payment_response)===null||_e===void 0?void 0:_e.actions)||[""];throw{errors:[{code:"PAYMENT_NOT_APPROVED_FOR_EXECUTION",message:action?.response_summary,resource:"orders",field:"checkout_com_payments"}]}}}const updateAttributes={id:order.id,_place:!0};if((0,customerOrderOptions_1.saveBillingAddress)()&&(yield sdk.orders.update({id:order.id,_save_billing_address_to_customer_address_book:!0})),(0,customerOrderOptions_1.saveShippingAddress)()&&(yield sdk.orders.update({id:order.id,_save_shipping_address_to_customer_address_book:!0})),paymentType==="stripe_payments"&&paymentSource!=null){const ps=paymentSource,currentUrl=window.location.href,returnUrl=(_f=ps?.options)===null||_f===void 0?void 0:_f.return_url;currentUrl!==returnUrl&&(yield sdk[paymentType].update({id:paymentSource.id,options:{return_url:currentUrl}}))}switch((0,hasSubscriptions_1.hasSubscriptions)(order)&&config?.accessToken!=null&&!(0,isGuestToken_1.isGuestToken)(config.accessToken)&¤tCustomerPaymentSourceId==null&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","true"),paymentType){case"braintree_payments":{const total=(_g=order?.total_amount_cents)!==null&&_g!==void 0?_g:0;yield Promise.all([(0,customerOrderOptions_1.saveToWallet)()&&total>0&&sdk.orders.update({id:order.id,_save_payment_source_to_customer_wallet:!0})]);const orderUpdated=yield sdk.orders.update(updateAttributes,{include});return setOrder&&setOrder(orderUpdated),setOrderErrors&&setOrderErrors([]),(0,updateOrderSubscriptionCustomerPaymentSource_1.updateOrderSubscriptionCustomerPaymentSource)(orderUpdated,paymentType,sdk),{placed:!0,order:orderUpdated}}default:{const orderUpdated=yield sdk.orders.update(updateAttributes,{include}),total=(_h=orderUpdated?.total_amount_cents)!==null&&_h!==void 0?_h:0;return setOrder&&setOrder(orderUpdated),yield Promise.all([(0,customerOrderOptions_1.saveToWallet)()&&total>0&&sdk.orders.update({id:order.id,_save_payment_source_to_customer_wallet:!0}).catch(error=>{const errors=(0,getErrors_1.default)({error,resource:"orders",field:paymentType});setOrderErrors&&setOrderErrors(errors)})]).then(()=>{(0,updateOrderSubscriptionCustomerPaymentSource_1.updateOrderSubscriptionCustomerPaymentSource)(orderUpdated,paymentType,sdk)}),{placed:!0,order:orderUpdated}}}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders",field:paymentType});return setOrderErrors&&setOrderErrors(errors),Object.assign(Object.assign({},response),{errors})}}return response})}function setPlaceOrderStatus({status,dispatch}){dispatch?.({type:"setStatus",payload:{status}})}const type=["setErrors","setPlaceOrderPermitted","setButtonRef","setStatus"],placeOrderReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=placeOrderReducer;
|