@commercelayer/react-components 2.53.1 → 3.0.0-alpha.1
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/LICENSE +2 -2
- package/README.md +3 -3
- package/lib/components/AdyenPayment.d.ts +25 -0
- package/lib/components/AdyenPayment.js +1 -0
- package/lib/components/AvailabilityContainer.d.ts +14 -0
- package/lib/components/AvailabilityContainer.js +1 -0
- package/lib/components/AvailabilityTemplate.d.ts +24 -0
- package/lib/components/AvailabilityTemplate.js +1 -0
- package/lib/components/BillingAddressContainer.d.ts +11 -0
- package/lib/components/BillingAddressContainer.js +1 -0
- package/lib/components/BillingAddressForm.d.ts +13 -0
- package/lib/components/BillingAddressForm.js +1 -0
- package/lib/components/BraintreePayment.d.ts +30 -0
- package/lib/components/BraintreePayment.js +1 -0
- package/lib/components/CheckoutComPayment.d.ts +23 -0
- package/lib/components/CheckoutComPayment.js +1 -0
- package/lib/components/CheckoutLink.d.ts +23 -0
- package/lib/components/CheckoutLink.js +1 -0
- package/lib/components/DeliveryLeadTime.d.ts +17 -0
- package/lib/components/DeliveryLeadTime.js +1 -0
- package/lib/components/DiscountAmount.d.ts +18 -0
- package/lib/components/DiscountAmount.js +1 -0
- package/lib/components/Errors.d.ts +5 -0
- package/lib/components/Errors.js +1 -0
- package/lib/components/ExternalFunction.d.ts +14 -0
- package/lib/components/ExternalFunction.js +1 -0
- package/lib/components/GiftCard.d.ts +18 -0
- package/lib/components/GiftCard.js +1 -0
- package/lib/components/GiftCardContainer.d.ts +12 -0
- package/lib/components/GiftCardContainer.js +1 -0
- package/lib/components/GiftCardCurrencySelector.d.ts +22 -0
- package/lib/components/GiftCardCurrencySelector.js +1 -0
- package/lib/components/GiftCardInput.d.ts +16 -0
- package/lib/components/GiftCardInput.js +1 -0
- package/lib/components/GiftCardOrCouponCode.d.ts +24 -0
- package/lib/components/GiftCardOrCouponCode.js +1 -0
- package/lib/components/GiftCardOrCouponForm.d.ts +15 -0
- package/lib/components/GiftCardOrCouponForm.js +1 -0
- package/lib/components/GiftCardOrCouponInput.d.ts +19 -0
- package/lib/components/GiftCardOrCouponInput.js +1 -0
- package/lib/components/GiftCardOrCouponRemoveButton.d.ts +26 -0
- package/lib/components/GiftCardOrCouponRemoveButton.js +1 -0
- package/lib/components/GiftCardOrCouponSubmit.d.ts +16 -0
- package/lib/components/GiftCardOrCouponSubmit.js +1 -0
- package/lib/{cjs/components → components}/GiftCardRecipient.d.ts +0 -0
- package/lib/{cjs/components → components}/GiftCardRecipient.js +0 -0
- package/lib/{cjs/components → components}/GiftCardRecipientInput.d.ts +0 -0
- package/lib/{cjs/components → components}/GiftCardRecipientInput.js +0 -0
- package/lib/components/ItemContainer.d.ts +22 -0
- package/lib/components/ItemContainer.js +1 -0
- package/lib/components/KlarnaPayment.d.ts +10 -0
- package/lib/components/KlarnaPayment.js +1 -0
- package/lib/components/LineItem.d.ts +15 -0
- package/lib/components/LineItem.js +1 -0
- package/lib/components/LineItemAmount.d.ts +20 -0
- package/lib/components/LineItemAmount.js +1 -0
- package/lib/components/LineItemCode.d.ts +18 -0
- package/lib/components/LineItemCode.js +1 -0
- package/lib/components/LineItemImage.d.ts +23 -0
- package/lib/components/LineItemImage.js +1 -0
- package/lib/components/LineItemName.d.ts +17 -0
- package/lib/components/LineItemName.js +1 -0
- package/lib/components/LineItemOption.d.ts +30 -0
- package/lib/components/LineItemOption.js +1 -0
- package/lib/components/LineItemOptions.d.ts +19 -0
- package/lib/components/LineItemOptions.js +1 -0
- package/lib/components/LineItemQuantity.d.ts +26 -0
- package/lib/components/LineItemQuantity.js +1 -0
- package/lib/components/LineItemRemoveLink.d.ts +22 -0
- package/lib/components/LineItemRemoveLink.js +1 -0
- package/lib/components/LineItemsContainer.d.ts +20 -0
- package/lib/components/LineItemsContainer.js +1 -0
- package/lib/components/LineItemsCount.d.ts +22 -0
- package/lib/components/LineItemsCount.js +1 -0
- package/lib/components/LineItemsEmpty.d.ts +23 -0
- package/lib/components/LineItemsEmpty.js +1 -0
- package/lib/components/MetadataInput.d.ts +15 -0
- package/lib/components/MetadataInput.js +1 -0
- package/lib/components/PaymentGateway.d.ts +16 -0
- package/lib/components/PaymentGateway.js +1 -0
- package/lib/components/PaymentMethod.d.ts +22 -0
- package/lib/components/PaymentMethod.js +1 -0
- package/lib/components/PaymentMethodAmount.d.ts +18 -0
- package/lib/components/PaymentMethodAmount.js +1 -0
- package/lib/components/PaymentMethodName.d.ts +15 -0
- package/lib/components/PaymentMethodName.js +1 -0
- package/lib/components/PaymentMethodPrice.d.ts +20 -0
- package/lib/components/PaymentMethodPrice.js +1 -0
- package/lib/components/PaymentMethodRadioButton.d.ts +18 -0
- package/lib/components/PaymentMethodRadioButton.js +1 -0
- package/lib/components/PaymentMethodsContainer.d.ts +14 -0
- package/lib/components/PaymentMethodsContainer.js +1 -0
- package/lib/components/PaymentSource.d.ts +26 -0
- package/lib/components/PaymentSource.js +1 -0
- package/lib/components/PaymentSourceBrandIcon.d.ts +25 -0
- package/lib/components/PaymentSourceBrandIcon.js +1 -0
- package/lib/components/PaymentSourceBrandName.d.ts +19 -0
- package/lib/components/PaymentSourceBrandName.js +1 -0
- package/lib/components/PaymentSourceDetail.d.ts +18 -0
- package/lib/components/PaymentSourceDetail.js +1 -0
- package/lib/components/PaymentSourceEditButton.d.ts +16 -0
- package/lib/components/PaymentSourceEditButton.js +1 -0
- package/lib/components/PaypalPayment.d.ts +12 -0
- package/lib/components/PaypalPayment.js +1 -0
- package/lib/components/Price.d.ts +28 -0
- package/lib/components/Price.js +1 -0
- package/lib/components/PricesContainer.d.ts +27 -0
- package/lib/components/PricesContainer.js +1 -0
- package/lib/components/QuantitySelector.d.ts +31 -0
- package/lib/components/QuantitySelector.js +1 -0
- package/lib/components/SaveAddressesButton.d.ts +23 -0
- package/lib/components/SaveAddressesButton.js +1 -0
- package/lib/components/SaveCustomerButton.d.ts +24 -0
- package/lib/components/SaveCustomerButton.js +1 -0
- package/lib/components/Shipment.d.ts +15 -0
- package/lib/components/Shipment.js +1 -0
- package/lib/components/ShipmentField.d.ts +19 -0
- package/lib/components/ShipmentField.js +1 -0
- package/lib/components/ShipmentsContainer.d.ts +12 -0
- package/lib/components/ShipmentsContainer.js +1 -0
- package/lib/components/ShippingAddressContainer.d.ts +11 -0
- package/lib/components/ShippingAddressContainer.js +1 -0
- package/lib/components/ShippingAddressForm.d.ts +13 -0
- package/lib/components/ShippingAddressForm.js +1 -0
- package/lib/components/ShippingAmount.d.ts +15 -0
- package/lib/components/ShippingAmount.js +1 -0
- package/lib/components/ShippingMethod.d.ts +15 -0
- package/lib/components/ShippingMethod.js +1 -0
- package/lib/components/ShippingMethodName.d.ts +17 -0
- package/lib/components/ShippingMethodName.js +1 -0
- package/lib/components/ShippingMethodPrice.d.ts +25 -0
- package/lib/components/ShippingMethodPrice.js +1 -0
- package/lib/components/ShippingMethodRadioButton.d.ts +19 -0
- package/lib/components/ShippingMethodRadioButton.js +1 -0
- package/lib/components/StockTransfer.d.ts +12 -0
- package/lib/components/StockTransfer.js +1 -0
- package/lib/components/StockTransferField.d.ts +10 -0
- package/lib/components/StockTransferField.js +1 -0
- package/lib/components/StripePayment.d.ts +18 -0
- package/lib/components/StripePayment.js +1 -0
- package/lib/components/SubmitButton.d.ts +19 -0
- package/lib/components/SubmitButton.js +1 -0
- package/lib/components/VariantSelector.d.ts +52 -0
- package/lib/components/VariantSelector.js +1 -0
- package/lib/components/VariantsContainer.d.ts +20 -0
- package/lib/components/VariantsContainer.js +1 -0
- package/lib/components/WireTransferPayment.d.ts +10 -0
- package/lib/components/WireTransferPayment.js +1 -0
- package/lib/components/addresses/Address.d.ts +18 -0
- package/lib/components/addresses/Address.js +1 -0
- package/lib/components/addresses/AddressCountrySelector.d.ts +26 -0
- package/lib/components/addresses/AddressCountrySelector.js +1 -0
- package/lib/components/addresses/AddressField.d.ts +43 -0
- package/lib/components/addresses/AddressField.js +1 -0
- package/lib/components/addresses/AddressInput.d.ts +19 -0
- package/lib/components/addresses/AddressInput.js +1 -0
- package/lib/components/addresses/AddressStateSelector.d.ts +27 -0
- package/lib/components/addresses/AddressStateSelector.js +1 -0
- package/lib/components/addresses/AddressesContainer.d.ts +15 -0
- package/lib/components/addresses/AddressesContainer.js +1 -0
- package/lib/components/auth/CommerceLayer.d.ts +15 -0
- package/lib/components/auth/CommerceLayer.js +1 -0
- package/lib/components/customers/CustomerAddressForm.d.ts +13 -0
- package/lib/components/customers/CustomerAddressForm.js +1 -0
- package/lib/components/customers/CustomerContainer.d.ts +17 -0
- package/lib/components/customers/CustomerContainer.js +1 -0
- package/lib/components/customers/CustomerField.d.ts +10 -0
- package/lib/components/customers/CustomerField.js +1 -0
- package/lib/components/customers/CustomerInput.d.ts +23 -0
- package/lib/components/customers/CustomerInput.js +1 -0
- package/lib/components/gateways/AdyenGateway.d.ts +5 -0
- package/lib/components/gateways/AdyenGateway.js +1 -0
- package/lib/components/gateways/BraintreeGateway.d.ts +5 -0
- package/lib/components/gateways/BraintreeGateway.js +1 -0
- package/lib/components/gateways/CheckoutComGateway.d.ts +5 -0
- package/lib/components/gateways/CheckoutComGateway.js +1 -0
- package/lib/components/gateways/KlarnaGateway.d.ts +5 -0
- package/lib/components/gateways/KlarnaGateway.js +1 -0
- package/lib/components/gateways/PaypalGateway.d.ts +5 -0
- package/lib/components/gateways/PaypalGateway.js +1 -0
- package/lib/components/gateways/StripeGateway.d.ts +5 -0
- package/lib/components/gateways/StripeGateway.js +1 -0
- package/lib/components/gateways/WireTransferGateway.d.ts +5 -0
- package/lib/components/gateways/WireTransferGateway.js +1 -0
- package/lib/components/orders/AddToCartButton.d.ts +34 -0
- package/lib/components/orders/AddToCartButton.js +1 -0
- package/lib/components/orders/AdjustmentAmount.d.ts +18 -0
- package/lib/components/orders/AdjustmentAmount.js +1 -0
- package/lib/components/orders/CartLink.d.ts +12 -0
- package/lib/components/orders/CartLink.js +1 -0
- package/lib/components/orders/GiftCardAmount.d.ts +15 -0
- package/lib/components/orders/GiftCardAmount.js +1 -0
- package/lib/components/orders/OrderContainer.d.ts +26 -0
- package/lib/components/orders/OrderContainer.js +1 -0
- package/lib/components/orders/OrderList.d.ts +61 -0
- package/lib/components/orders/OrderList.js +1 -0
- package/lib/components/orders/OrderListRow.d.ts +30 -0
- package/lib/components/orders/OrderListRow.js +1 -0
- package/lib/components/orders/OrderNumber.d.ts +11 -0
- package/lib/components/orders/OrderNumber.js +1 -0
- package/lib/components/orders/OrderStorage.d.ts +16 -0
- package/lib/components/orders/OrderStorage.js +1 -0
- package/lib/components/orders/PlaceOrderButton.d.ts +24 -0
- package/lib/components/orders/PlaceOrderButton.js +1 -0
- package/lib/components/orders/PlaceOrderContainer.d.ts +14 -0
- package/lib/components/orders/PlaceOrderContainer.js +1 -0
- package/lib/components/orders/PrivacyAndTermsCheckbox.d.ts +10 -0
- package/lib/components/orders/PrivacyAndTermsCheckbox.js +1 -0
- package/lib/components/orders/SubTotalAmount.d.ts +18 -0
- package/lib/components/orders/SubTotalAmount.js +1 -0
- package/lib/components/orders/TaxesAmount.d.ts +18 -0
- package/lib/components/orders/TaxesAmount.js +1 -0
- package/lib/components/orders/TotalAmount.d.ts +18 -0
- package/lib/components/orders/TotalAmount.js +1 -0
- package/lib/components/skus/SkuField.d.ts +14 -0
- package/lib/components/skus/SkuField.js +1 -0
- package/lib/components/skus/SkuList.d.ts +14 -0
- package/lib/components/skus/SkuList.js +1 -0
- package/lib/components/skus/SkuListsContainer.d.ts +12 -0
- package/lib/components/skus/SkuListsContainer.js +1 -0
- package/lib/components/skus/SkuOption.d.ts +14 -0
- package/lib/components/skus/SkuOption.js +1 -0
- package/lib/components/skus/SkuOptionInput.d.ts +15 -0
- package/lib/components/skus/SkuOptionInput.js +1 -0
- package/lib/components/skus/SkuOptionsContainer.d.ts +14 -0
- package/lib/components/skus/SkuOptionsContainer.js +1 -0
- package/lib/components/skus/Skus.d.ts +11 -0
- package/lib/components/skus/Skus.js +1 -0
- package/lib/components/skus/SkusContainer.d.ts +23 -0
- package/lib/components/skus/SkusContainer.js +1 -0
- package/lib/components/utils/AddressCardsTemplate.d.ts +27 -0
- package/lib/components/utils/AddressCardsTemplate.js +1 -0
- package/lib/{cjs/components → components}/utils/BaseField.d.ts +0 -0
- package/lib/components/utils/BaseField.js +1 -0
- package/lib/components/utils/BaseInput.d.ts +5 -0
- package/lib/components/utils/BaseInput.js +1 -0
- package/lib/{cjs/components → components}/utils/BaseOrderPrice.d.ts +0 -0
- package/lib/components/utils/BaseOrderPrice.js +1 -0
- package/lib/{cjs/components → components}/utils/BaseSelect.d.ts +0 -0
- package/lib/components/utils/BaseSelect.js +1 -0
- package/lib/components/utils/GenericFieldComponent.d.ts +42 -0
- package/lib/components/utils/GenericFieldComponent.js +1 -0
- package/lib/components/utils/Parent.d.ts +6 -0
- package/lib/components/utils/Parent.js +1 -0
- package/lib/components/utils/PaymentCardsTemplate.d.ts +23 -0
- package/lib/components/utils/PaymentCardsTemplate.js +1 -0
- package/lib/components/utils/PriceTemplate.d.ts +8 -0
- package/lib/components/utils/PriceTemplate.js +1 -0
- package/lib/{cjs/components → components}/utils/VariantTemplate.d.ts +0 -0
- package/lib/components/utils/VariantTemplate.js +1 -0
- package/lib/{cjs/components → components}/utils/getAllErrors.d.ts +0 -0
- package/lib/components/utils/getAllErrors.js +1 -0
- package/lib/config/components.d.ts +934 -0
- package/lib/config/components.js +1 -0
- package/lib/{cjs/config → config}/currency.d.ts +0 -0
- package/lib/{esm/config → config}/currency.js +0 -0
- package/lib/context/AddressChildrenContext.d.ts +7 -0
- package/lib/context/AddressChildrenContext.js +1 -0
- package/lib/context/AddressContext.d.ts +17 -0
- package/lib/{esm/context → context}/AddressContext.js +0 -0
- package/lib/{cjs/context → context}/AvailabilityContext.d.ts +0 -0
- package/lib/{esm/context → context}/AvailabilityContext.js +0 -0
- package/lib/context/BillingAddressContext.d.ts +10 -0
- package/lib/context/BillingAddressContext.js +1 -0
- package/lib/context/BillingAddressFormContext.d.ts +25 -0
- package/lib/{esm/context → context}/BillingAddressFormContext.js +0 -0
- package/lib/{cjs/context → context}/CommerceLayerContext.d.ts +0 -0
- package/lib/{esm/context → context}/CommerceLayerContext.js +0 -0
- package/lib/context/CouponAndGiftCardFormContext.d.ts +9 -0
- package/lib/{esm/context → context}/CouponAndGiftCardFormContext.js +0 -0
- package/lib/context/CustomerAddressFormContext.d.ts +20 -0
- package/lib/context/CustomerAddressFormContext.js +1 -0
- package/lib/context/CustomerContext.d.ts +22 -0
- package/lib/context/CustomerContext.js +1 -0
- package/lib/{cjs/context → context}/ExternalFunctionContext.d.ts +0 -0
- package/lib/{esm/context → context}/ExternalFunctionContext.js +0 -0
- package/lib/{cjs/context → context}/GiftCardContext.d.ts +0 -0
- package/lib/{esm/context → context}/GiftCardContext.js +0 -0
- package/lib/{cjs/context → context}/ItemContext.d.ts +0 -0
- package/lib/{esm/context → context}/ItemContext.js +0 -0
- package/lib/{cjs/context → context}/LineItemChildrenContext.d.ts +0 -0
- package/lib/{esm/context → context}/LineItemChildrenContext.js +0 -0
- package/lib/{cjs/context → context}/LineItemContext.d.ts +0 -0
- package/lib/{esm/context → context}/LineItemContext.js +0 -0
- package/lib/{cjs/context → context}/LineItemOptionChildrenContext.d.ts +0 -0
- package/lib/{esm/context → context}/LineItemOptionChildrenContext.js +0 -0
- package/lib/context/OrderContext.d.ts +30 -0
- package/lib/context/OrderContext.js +1 -0
- package/lib/context/OrderListChildrenContext.d.ts +60 -0
- package/lib/context/OrderListChildrenContext.js +1 -0
- package/lib/{cjs/context → context}/OrderStorageContext.d.ts +0 -0
- package/lib/{esm/context → context}/OrderStorageContext.js +0 -0
- package/lib/{cjs/context → context}/PaymentMethodChildrenContext.d.ts +0 -0
- package/lib/{esm/context → context}/PaymentMethodChildrenContext.js +0 -0
- package/lib/{cjs/context → context}/PaymentMethodContext.d.ts +0 -0
- package/lib/{esm/context → context}/PaymentMethodContext.js +0 -0
- package/lib/context/PaymentSourceContext.d.ts +14 -0
- package/lib/{esm/context → context}/PaymentSourceContext.js +0 -0
- package/lib/context/PlaceOrderContext.d.ts +18 -0
- package/lib/{esm/context → context}/PlaceOrderContext.js +0 -0
- package/lib/{cjs/context → context}/PricesContext.d.ts +0 -0
- package/lib/{esm/context → context}/PricesContext.js +0 -0
- package/lib/{cjs/context → context}/ShipmentChildrenContext.d.ts +0 -0
- package/lib/{esm/context → context}/ShipmentChildrenContext.js +0 -0
- package/lib/{cjs/context → context}/ShipmentContext.d.ts +0 -0
- package/lib/{esm/context → context}/ShipmentContext.js +0 -0
- package/lib/context/ShippingAddressContext.d.ts +10 -0
- package/lib/{esm/context → context}/ShippingAddressContext.js +0 -0
- package/lib/{cjs/context → context}/ShippingAddressFormContext.d.ts +0 -0
- package/lib/{esm/context → context}/ShippingAddressFormContext.js +0 -0
- package/lib/{cjs/context → context}/ShippingMethodChildrenContext.d.ts +0 -0
- package/lib/{esm/context → context}/ShippingMethodChildrenContext.js +0 -0
- package/lib/context/SkuChildrenContext.d.ts +9 -0
- package/lib/context/SkuChildrenContext.js +1 -0
- package/lib/context/SkuContext.d.ts +9 -0
- package/lib/context/SkuContext.js +1 -0
- package/lib/{cjs/context → context}/SkuListsContext.d.ts +0 -0
- package/lib/{esm/context → context}/SkuListsContext.js +0 -0
- package/lib/{cjs/context → context}/SkuOptionChildrenContext.d.ts +0 -0
- package/lib/{esm/context → context}/SkuOptionChildrenContext.js +0 -0
- package/lib/{cjs/context → context}/SkuOptionsContext.d.ts +0 -0
- package/lib/{esm/context → context}/SkuOptionsContext.js +0 -0
- package/lib/{cjs/context → context}/StockTransferChildrenContext.d.ts +0 -0
- package/lib/{esm/context → context}/StockTransferChildrenContext.js +0 -0
- package/lib/{cjs/context → context}/VariantsContext.d.ts +0 -0
- package/lib/{esm/context → context}/VariantsContext.js +0 -0
- package/lib/index.d.ts +107 -0
- package/lib/index.js +1 -0
- package/lib/reducers/AddressReducer.d.ts +60 -0
- package/lib/reducers/AddressReducer.js +1 -0
- package/lib/reducers/AvailabilityReducer.d.ts +61 -0
- package/lib/reducers/AvailabilityReducer.js +1 -0
- package/lib/{cjs/reducers → reducers}/BillingAddressReducer.d.ts +0 -0
- package/lib/reducers/BillingAddressReducer.js +1 -0
- package/lib/reducers/CustomerReducer.d.ts +131 -0
- package/lib/reducers/CustomerReducer.js +1 -0
- package/lib/{cjs/reducers → reducers}/GiftCardReducer.d.ts +0 -0
- package/lib/reducers/GiftCardReducer.js +1 -0
- package/lib/{cjs/reducers → reducers}/ItemReducer.d.ts +0 -0
- package/lib/{esm/reducers → reducers}/ItemReducer.js +0 -0
- package/lib/{cjs/reducers → reducers}/LineItemReducer.d.ts +0 -0
- package/lib/reducers/LineItemReducer.js +1 -0
- package/lib/reducers/OrderReducer.d.ts +147 -0
- package/lib/reducers/OrderReducer.js +1 -0
- package/lib/reducers/PaymentMethodReducer.d.ts +151 -0
- package/lib/reducers/PaymentMethodReducer.js +1 -0
- package/lib/reducers/PlaceOrderReducer.d.ts +59 -0
- package/lib/reducers/PlaceOrderReducer.js +1 -0
- package/lib/{cjs/reducers → reducers}/PriceReducer.d.ts +0 -0
- package/lib/{esm/reducers → reducers}/PriceReducer.js +0 -0
- package/lib/{cjs/reducers → reducers}/ShipmentReducer.d.ts +0 -0
- package/lib/reducers/ShipmentReducer.js +1 -0
- package/lib/{cjs/reducers → reducers}/ShippingAddressReducer.d.ts +0 -0
- package/lib/reducers/ShippingAddressReducer.js +1 -0
- package/lib/{cjs/reducers → reducers}/SkuListsReducer.d.ts +0 -0
- package/lib/{esm/reducers → reducers}/SkuListsReducer.js +0 -0
- package/lib/{cjs/reducers → reducers}/SkuOptionsReducer.d.ts +0 -0
- package/lib/{esm/reducers → reducers}/SkuOptionsReducer.js +0 -0
- package/lib/reducers/SkuReducer.d.ts +21 -0
- package/lib/reducers/SkuReducer.js +1 -0
- package/lib/reducers/VariantReducer.d.ts +72 -0
- package/lib/reducers/VariantReducer.js +1 -0
- package/lib/typings/errors.d.ts +51 -0
- package/lib/typings/errors.js +1 -0
- package/lib/typings/index.d.ts +137 -0
- package/lib/{esm/typings → typings}/index.js +0 -0
- package/lib/{cjs/utils → utils}/PropsType.d.ts +0 -0
- package/lib/{esm/utils → utils}/PropsType.js +0 -0
- package/lib/utils/addressesManager.d.ts +28 -0
- package/lib/utils/addressesManager.js +1 -0
- package/lib/{cjs/utils → utils}/baseReducer.d.ts +0 -0
- package/lib/{esm/utils → utils}/baseReducer.js +0 -0
- package/lib/{cjs/utils → utils}/browserInfo.d.ts +0 -0
- package/lib/{esm/utils → utils}/browserInfo.js +0 -0
- package/lib/utils/checkIncludeResource.d.ts +8 -0
- package/lib/utils/checkIncludeResource.js +1 -0
- package/lib/utils/childrenTypes.d.ts +9 -0
- package/lib/utils/childrenTypes.js +1 -0
- package/lib/utils/compareObjAttribute.d.ts +7 -0
- package/lib/utils/compareObjAttribute.js +1 -0
- package/lib/{cjs/utils → utils}/countryStateCity.d.ts +0 -0
- package/lib/utils/countryStateCity.js +1 -0
- package/lib/utils/customMessages.d.ts +2 -0
- package/lib/utils/customMessages.js +1 -0
- package/lib/{cjs/utils → utils}/customerOrderOptions.d.ts +0 -0
- package/lib/{esm/utils → utils}/customerOrderOptions.js +0 -0
- package/lib/{cjs/utils → utils}/getAmount.d.ts +0 -0
- package/lib/{esm/utils → utils}/getAmount.js +0 -0
- package/lib/utils/getCardDetails.d.ts +15 -0
- package/lib/utils/getCardDetails.js +1 -0
- package/lib/utils/getCartLink.d.ts +7 -0
- package/lib/utils/getCartLink.js +1 -0
- package/lib/{cjs/utils → utils}/getCurrentItemKey.d.ts +0 -0
- package/lib/utils/getCurrentItemKey.js +1 -0
- package/lib/utils/getErrors.d.ts +11 -0
- package/lib/utils/getErrors.js +1 -0
- package/lib/utils/getLineItemsCount.d.ts +10 -0
- package/lib/utils/getLineItemsCount.js +1 -0
- package/lib/{cjs/utils → utils}/getLoaderComponent.d.ts +0 -0
- package/lib/utils/getLoaderComponent.js +1 -0
- package/lib/{cjs/utils → utils}/getPrices.d.ts +0 -0
- package/lib/utils/getPrices.js +1 -0
- package/lib/{cjs/utils → utils}/getSdk.d.ts +0 -0
- package/lib/{esm/utils → utils}/getSdk.js +0 -0
- package/lib/{cjs/utils → utils}/getSkus.d.ts +0 -0
- package/lib/utils/getSkus.js +1 -0
- package/lib/utils/hooks/useExternalScript.d.ts +1 -0
- package/lib/utils/hooks/useExternalScript.js +1 -0
- package/lib/utils/icons.d.ts +3 -0
- package/lib/utils/icons.js +1 -0
- package/lib/utils/isDate.d.ts +1 -0
- package/lib/utils/isDate.js +1 -0
- package/lib/{cjs/utils → utils}/isEmptyStates.d.ts +0 -0
- package/lib/{esm/utils → utils}/isEmptyStates.js +0 -0
- package/lib/{cjs/utils → utils}/isJSON.d.ts +0 -0
- package/lib/{esm/utils → utils}/isJSON.js +0 -0
- package/lib/utils/jwt.d.ts +27 -0
- package/lib/{esm/utils → utils}/jwt.js +0 -0
- package/lib/{cjs/utils → utils}/localStorage.d.ts +0 -0
- package/lib/{esm/utils → utils}/localStorage.js +0 -0
- package/lib/{cjs/utils → utils}/organization.d.ts +0 -0
- package/lib/{esm/utils → utils}/organization.js +0 -0
- package/lib/{cjs/utils → utils}/paypalPayment.d.ts +0 -0
- package/lib/{esm/utils → utils}/paypalPayment.js +0 -0
- package/lib/utils/placeholderImages.d.ts +2 -0
- package/lib/utils/placeholderImages.js +1 -0
- package/lib/{cjs/utils → utils}/promisify.d.ts +0 -0
- package/lib/utils/promisify.js +1 -0
- package/lib/utils/scrollbarWidth.d.ts +1 -0
- package/lib/utils/scrollbarWidth.js +1 -0
- package/lib/utils/shipments.d.ts +3 -0
- package/lib/utils/shipments.js +1 -0
- package/lib/utils/validateFormFields.d.ts +22 -0
- package/lib/utils/validateFormFields.js +1 -0
- package/package.json +98 -95
- package/lib/cjs/components/AddToCartButton.d.ts +0 -20
- package/lib/cjs/components/AddToCartButton.js +0 -1
- package/lib/cjs/components/Address.d.ts +0 -13
- package/lib/cjs/components/Address.js +0 -1
- package/lib/cjs/components/AddressCountrySelector.d.ts +0 -9
- package/lib/cjs/components/AddressCountrySelector.js +0 -1
- package/lib/cjs/components/AddressField.d.ts +0 -15
- package/lib/cjs/components/AddressField.js +0 -1
- package/lib/cjs/components/AddressInput.d.ts +0 -7
- package/lib/cjs/components/AddressInput.js +0 -1
- package/lib/cjs/components/AddressStateSelector.d.ts +0 -11
- package/lib/cjs/components/AddressStateSelector.js +0 -1
- package/lib/cjs/components/AddressesContainer.d.ts +0 -7
- package/lib/cjs/components/AddressesContainer.js +0 -1
- package/lib/cjs/components/AdjustmentAmount.d.ts +0 -4
- package/lib/cjs/components/AdjustmentAmount.js +0 -1
- package/lib/cjs/components/AdyenPayment.d.ts +0 -25
- package/lib/cjs/components/AdyenPayment.js +0 -1
- package/lib/cjs/components/AvailabilityContainer.d.ts +0 -7
- package/lib/cjs/components/AvailabilityContainer.js +0 -1
- package/lib/cjs/components/AvailabilityTemplate.d.ts +0 -15
- package/lib/cjs/components/AvailabilityTemplate.js +0 -1
- package/lib/cjs/components/BillingAddressContainer.d.ts +0 -6
- package/lib/cjs/components/BillingAddressContainer.js +0 -1
- package/lib/cjs/components/BillingAddressForm.d.ts +0 -8
- package/lib/cjs/components/BillingAddressForm.js +0 -1
- package/lib/cjs/components/BraintreePayment.d.ts +0 -30
- package/lib/cjs/components/BraintreePayment.js +0 -1
- package/lib/cjs/components/CheckoutLink.d.ts +0 -11
- package/lib/cjs/components/CheckoutLink.js +0 -1
- package/lib/cjs/components/CommerceLayer.d.ts +0 -8
- package/lib/cjs/components/CommerceLayer.js +0 -1
- package/lib/cjs/components/CustomerContainer.d.ts +0 -7
- package/lib/cjs/components/CustomerContainer.js +0 -1
- package/lib/cjs/components/CustomerInput.d.ts +0 -11
- package/lib/cjs/components/CustomerInput.js +0 -1
- package/lib/cjs/components/DeliveryLeadTime.d.ts +0 -10
- package/lib/cjs/components/DeliveryLeadTime.js +0 -1
- package/lib/cjs/components/DiscountAmount.d.ts +0 -4
- package/lib/cjs/components/DiscountAmount.js +0 -1
- package/lib/cjs/components/Errors.d.ts +0 -5
- package/lib/cjs/components/Errors.js +0 -1
- package/lib/cjs/components/ExternalFunction.d.ts +0 -7
- package/lib/cjs/components/ExternalFunction.js +0 -1
- package/lib/cjs/components/GiftCard.d.ts +0 -8
- package/lib/cjs/components/GiftCard.js +0 -1
- package/lib/cjs/components/GiftCardAmount.d.ts +0 -4
- package/lib/cjs/components/GiftCardAmount.js +0 -1
- package/lib/cjs/components/GiftCardContainer.d.ts +0 -6
- package/lib/cjs/components/GiftCardContainer.js +0 -1
- package/lib/cjs/components/GiftCardCurrencySelector.d.ts +0 -7
- package/lib/cjs/components/GiftCardCurrencySelector.js +0 -1
- package/lib/cjs/components/GiftCardInput.d.ts +0 -7
- package/lib/cjs/components/GiftCardInput.js +0 -1
- package/lib/cjs/components/GiftCardOrCouponCode.d.ts +0 -13
- package/lib/cjs/components/GiftCardOrCouponCode.js +0 -1
- package/lib/cjs/components/GiftCardOrCouponForm.d.ts +0 -10
- package/lib/cjs/components/GiftCardOrCouponForm.js +0 -1
- package/lib/cjs/components/GiftCardOrCouponInput.d.ts +0 -8
- package/lib/cjs/components/GiftCardOrCouponInput.js +0 -1
- package/lib/cjs/components/GiftCardOrCouponRemoveButton.d.ts +0 -16
- package/lib/cjs/components/GiftCardOrCouponRemoveButton.js +0 -1
- package/lib/cjs/components/GiftCardOrCouponSubmit.d.ts +0 -9
- package/lib/cjs/components/GiftCardOrCouponSubmit.js +0 -1
- package/lib/cjs/components/ItemContainer.d.ts +0 -11
- package/lib/cjs/components/ItemContainer.js +0 -1
- package/lib/cjs/components/LineItem.d.ts +0 -8
- package/lib/cjs/components/LineItem.js +0 -1
- package/lib/cjs/components/LineItemAmount.d.ts +0 -7
- package/lib/cjs/components/LineItemAmount.js +0 -1
- package/lib/cjs/components/LineItemCode.d.ts +0 -12
- package/lib/cjs/components/LineItemCode.js +0 -1
- package/lib/cjs/components/LineItemImage.d.ts +0 -16
- package/lib/cjs/components/LineItemImage.js +0 -1
- package/lib/cjs/components/LineItemName.d.ts +0 -11
- package/lib/cjs/components/LineItemName.js +0 -1
- package/lib/cjs/components/LineItemOption.d.ts +0 -19
- package/lib/cjs/components/LineItemOption.js +0 -1
- package/lib/cjs/components/LineItemOptions.d.ts +0 -14
- package/lib/cjs/components/LineItemOptions.js +0 -1
- package/lib/cjs/components/LineItemQuantity.d.ts +0 -14
- package/lib/cjs/components/LineItemQuantity.js +0 -1
- package/lib/cjs/components/LineItemRemoveLink.d.ts +0 -12
- package/lib/cjs/components/LineItemRemoveLink.js +0 -1
- package/lib/cjs/components/LineItemsContainer.d.ts +0 -8
- package/lib/cjs/components/LineItemsContainer.js +0 -1
- package/lib/cjs/components/LineItemsCount.d.ts +0 -12
- package/lib/cjs/components/LineItemsCount.js +0 -1
- package/lib/cjs/components/LineItemsEmpty.d.ts +0 -12
- package/lib/cjs/components/LineItemsEmpty.js +0 -1
- package/lib/cjs/components/MetadataInput.d.ts +0 -5
- package/lib/cjs/components/MetadataInput.js +0 -1
- package/lib/cjs/components/OrderContainer.d.ts +0 -11
- package/lib/cjs/components/OrderContainer.js +0 -1
- package/lib/cjs/components/OrderNumber.d.ts +0 -5
- package/lib/cjs/components/OrderNumber.js +0 -1
- package/lib/cjs/components/OrderStorage.d.ts +0 -8
- package/lib/cjs/components/OrderStorage.js +0 -1
- package/lib/cjs/components/PaymentGateway.d.ts +0 -16
- package/lib/cjs/components/PaymentGateway.js +0 -1
- package/lib/cjs/components/PaymentMethod.d.ts +0 -16
- package/lib/cjs/components/PaymentMethod.js +0 -1
- package/lib/cjs/components/PaymentMethodAmount.d.ts +0 -4
- package/lib/cjs/components/PaymentMethodAmount.js +0 -1
- package/lib/cjs/components/PaymentMethodName.d.ts +0 -9
- package/lib/cjs/components/PaymentMethodName.js +0 -1
- package/lib/cjs/components/PaymentMethodPrice.d.ts +0 -9
- package/lib/cjs/components/PaymentMethodPrice.js +0 -1
- package/lib/cjs/components/PaymentMethodRadioButton.d.ts +0 -11
- package/lib/cjs/components/PaymentMethodRadioButton.js +0 -1
- package/lib/cjs/components/PaymentMethodsContainer.d.ts +0 -8
- package/lib/cjs/components/PaymentMethodsContainer.js +0 -1
- package/lib/cjs/components/PaymentSource.d.ts +0 -19
- package/lib/cjs/components/PaymentSource.js +0 -1
- package/lib/cjs/components/PaymentSourceBrandIcon.d.ts +0 -15
- package/lib/cjs/components/PaymentSourceBrandIcon.js +0 -1
- package/lib/cjs/components/PaymentSourceBrandName.d.ts +0 -12
- package/lib/cjs/components/PaymentSourceBrandName.js +0 -1
- package/lib/cjs/components/PaymentSourceDetail.d.ts +0 -12
- package/lib/cjs/components/PaymentSourceDetail.js +0 -1
- package/lib/cjs/components/PaymentSourceEditButton.d.ts +0 -9
- package/lib/cjs/components/PaymentSourceEditButton.js +0 -1
- package/lib/cjs/components/PaypalPayment.d.ts +0 -12
- package/lib/cjs/components/PaypalPayment.js +0 -1
- package/lib/cjs/components/PlaceOrderButton.d.ts +0 -12
- package/lib/cjs/components/PlaceOrderButton.js +0 -1
- package/lib/cjs/components/PlaceOrderContainer.d.ts +0 -8
- package/lib/cjs/components/PlaceOrderContainer.js +0 -1
- package/lib/cjs/components/Price.d.ts +0 -16
- package/lib/cjs/components/Price.js +0 -1
- package/lib/cjs/components/PricesContainer.d.ts +0 -11
- package/lib/cjs/components/PricesContainer.js +0 -1
- package/lib/cjs/components/PrivacyAndTermsCheckbox.d.ts +0 -4
- package/lib/cjs/components/PrivacyAndTermsCheckbox.js +0 -1
- package/lib/cjs/components/QuantitySelector.d.ts +0 -17
- package/lib/cjs/components/QuantitySelector.js +0 -1
- package/lib/cjs/components/SaveAddressesButton.d.ts +0 -10
- package/lib/cjs/components/SaveAddressesButton.js +0 -1
- package/lib/cjs/components/SaveCustomerButton.d.ts +0 -13
- package/lib/cjs/components/SaveCustomerButton.js +0 -1
- package/lib/cjs/components/Shipment.d.ts +0 -8
- package/lib/cjs/components/Shipment.js +0 -1
- package/lib/cjs/components/ShipmentField.d.ts +0 -12
- package/lib/cjs/components/ShipmentField.js +0 -1
- package/lib/cjs/components/ShipmentsContainer.d.ts +0 -6
- package/lib/cjs/components/ShipmentsContainer.js +0 -1
- package/lib/cjs/components/ShippingAddressContainer.d.ts +0 -6
- package/lib/cjs/components/ShippingAddressContainer.js +0 -1
- package/lib/cjs/components/ShippingAddressForm.d.ts +0 -8
- package/lib/cjs/components/ShippingAddressForm.js +0 -1
- package/lib/cjs/components/ShippingAmount.d.ts +0 -4
- package/lib/cjs/components/ShippingAmount.js +0 -1
- package/lib/cjs/components/ShippingMethod.d.ts +0 -8
- package/lib/cjs/components/ShippingMethod.js +0 -1
- package/lib/cjs/components/ShippingMethodName.d.ts +0 -11
- package/lib/cjs/components/ShippingMethodName.js +0 -1
- package/lib/cjs/components/ShippingMethodPrice.d.ts +0 -13
- package/lib/cjs/components/ShippingMethodPrice.js +0 -1
- package/lib/cjs/components/ShippingMethodRadioButton.d.ts +0 -13
- package/lib/cjs/components/ShippingMethodRadioButton.js +0 -1
- package/lib/cjs/components/SkuList.d.ts +0 -7
- package/lib/cjs/components/SkuList.js +0 -1
- package/lib/cjs/components/SkuListsContainer.d.ts +0 -6
- package/lib/cjs/components/SkuListsContainer.js +0 -1
- package/lib/cjs/components/SkuOption.d.ts +0 -7
- package/lib/cjs/components/SkuOption.js +0 -1
- package/lib/cjs/components/SkuOptionInput.d.ts +0 -5
- package/lib/cjs/components/SkuOptionInput.js +0 -1
- package/lib/cjs/components/SkuOptionsContainer.d.ts +0 -7
- package/lib/cjs/components/SkuOptionsContainer.js +0 -1
- package/lib/cjs/components/StockTransfer.d.ts +0 -6
- package/lib/cjs/components/StockTransfer.js +0 -1
- package/lib/cjs/components/StockTransferField.d.ts +0 -9
- package/lib/cjs/components/StockTransferField.js +0 -1
- package/lib/cjs/components/StripePayment.d.ts +0 -18
- package/lib/cjs/components/StripePayment.js +0 -1
- package/lib/cjs/components/SubTotalAmount.d.ts +0 -4
- package/lib/cjs/components/SubTotalAmount.js +0 -1
- package/lib/cjs/components/SubmitButton.d.ts +0 -9
- package/lib/cjs/components/SubmitButton.js +0 -1
- package/lib/cjs/components/TaxesAmount.d.ts +0 -4
- package/lib/cjs/components/TaxesAmount.js +0 -1
- package/lib/cjs/components/TotalAmount.d.ts +0 -4
- package/lib/cjs/components/TotalAmount.js +0 -1
- package/lib/cjs/components/VariantSelector.d.ts +0 -29
- package/lib/cjs/components/VariantSelector.js +0 -1
- package/lib/cjs/components/VariantsContainer.d.ts +0 -8
- package/lib/cjs/components/VariantsContainer.js +0 -1
- package/lib/cjs/components/WireTransferPayment.d.ts +0 -10
- package/lib/cjs/components/WireTransferPayment.js +0 -1
- package/lib/cjs/components/gateways/AdyenGateway.d.ts +0 -5
- package/lib/cjs/components/gateways/AdyenGateway.js +0 -1
- package/lib/cjs/components/gateways/BraintreeGateway.d.ts +0 -5
- package/lib/cjs/components/gateways/BraintreeGateway.js +0 -1
- package/lib/cjs/components/gateways/PaypalGateway.d.ts +0 -5
- package/lib/cjs/components/gateways/PaypalGateway.js +0 -1
- package/lib/cjs/components/gateways/StripeGateway.d.ts +0 -5
- package/lib/cjs/components/gateways/StripeGateway.js +0 -1
- package/lib/cjs/components/gateways/WireTransferGateway.d.ts +0 -5
- package/lib/cjs/components/gateways/WireTransferGateway.js +0 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +0 -27
- package/lib/cjs/components/utils/AddressCardsTemplate.js +0 -1
- package/lib/cjs/components/utils/BaseField.js +0 -1
- package/lib/cjs/components/utils/BaseInput.d.ts +0 -5
- package/lib/cjs/components/utils/BaseInput.js +0 -1
- package/lib/cjs/components/utils/BaseOrderPrice.js +0 -1
- package/lib/cjs/components/utils/BaseSelect.js +0 -1
- package/lib/cjs/components/utils/Parent.d.ts +0 -8
- package/lib/cjs/components/utils/Parent.js +0 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +0 -23
- package/lib/cjs/components/utils/PaymentCardsTemplate.js +0 -1
- package/lib/cjs/components/utils/PriceTemplate.d.ts +0 -8
- package/lib/cjs/components/utils/PriceTemplate.js +0 -1
- package/lib/cjs/components/utils/VariantTemplate.js +0 -1
- package/lib/cjs/components/utils/getAllErrors.js +0 -1
- package/lib/cjs/config/components.d.ts +0 -892
- package/lib/cjs/config/components.js +0 -1
- package/lib/cjs/config/currency.js +0 -1
- package/lib/cjs/context/AddressChildrenContext.d.ts +0 -7
- package/lib/cjs/context/AddressChildrenContext.js +0 -1
- package/lib/cjs/context/AddressContext.d.ts +0 -17
- package/lib/cjs/context/AddressContext.js +0 -1
- package/lib/cjs/context/AvailabilityContext.js +0 -1
- package/lib/cjs/context/BillingAddressContext.d.ts +0 -12
- package/lib/cjs/context/BillingAddressContext.js +0 -1
- package/lib/cjs/context/BillingAddressFormContext.d.ts +0 -18
- package/lib/cjs/context/BillingAddressFormContext.js +0 -1
- package/lib/cjs/context/CommerceLayerContext.js +0 -1
- package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +0 -7
- package/lib/cjs/context/CouponAndGiftCardFormContext.js +0 -1
- package/lib/cjs/context/CustomerContext.d.ts +0 -16
- package/lib/cjs/context/CustomerContext.js +0 -1
- package/lib/cjs/context/ExternalFunctionContext.js +0 -1
- package/lib/cjs/context/GiftCardContext.js +0 -1
- package/lib/cjs/context/ItemContext.js +0 -1
- package/lib/cjs/context/LineItemChildrenContext.js +0 -1
- package/lib/cjs/context/LineItemContext.js +0 -1
- package/lib/cjs/context/LineItemOptionChildrenContext.js +0 -1
- package/lib/cjs/context/OrderContext.d.ts +0 -26
- package/lib/cjs/context/OrderContext.js +0 -1
- package/lib/cjs/context/OrderStorageContext.js +0 -1
- package/lib/cjs/context/PaymentMethodChildrenContext.js +0 -1
- package/lib/cjs/context/PaymentMethodContext.js +0 -1
- package/lib/cjs/context/PaymentSourceContext.d.ts +0 -14
- package/lib/cjs/context/PaymentSourceContext.js +0 -1
- package/lib/cjs/context/PlaceOrderContext.d.ts +0 -16
- package/lib/cjs/context/PlaceOrderContext.js +0 -1
- package/lib/cjs/context/PricesContext.js +0 -1
- package/lib/cjs/context/ShipmentChildrenContext.js +0 -1
- package/lib/cjs/context/ShipmentContext.js +0 -1
- package/lib/cjs/context/ShippingAddressContext.d.ts +0 -10
- package/lib/cjs/context/ShippingAddressContext.js +0 -1
- package/lib/cjs/context/ShippingAddressFormContext.js +0 -1
- package/lib/cjs/context/ShippingMethodChildrenContext.js +0 -1
- package/lib/cjs/context/SkuListsContext.js +0 -1
- package/lib/cjs/context/SkuOptionChildrenContext.js +0 -1
- package/lib/cjs/context/SkuOptionsContext.js +0 -1
- package/lib/cjs/context/StockTransferChildrenContext.js +0 -1
- package/lib/cjs/context/VariantsContext.js +0 -1
- package/lib/cjs/index.d.ts +0 -96
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/reducers/AddressReducer.d.ts +0 -58
- package/lib/cjs/reducers/AddressReducer.js +0 -1
- package/lib/cjs/reducers/AvailabilityReducer.d.ts +0 -53
- package/lib/cjs/reducers/AvailabilityReducer.js +0 -1
- package/lib/cjs/reducers/BillingAddressReducer.js +0 -1
- package/lib/cjs/reducers/CustomerReducer.d.ts +0 -50
- package/lib/cjs/reducers/CustomerReducer.js +0 -1
- package/lib/cjs/reducers/GiftCardReducer.js +0 -1
- package/lib/cjs/reducers/ItemReducer.js +0 -1
- package/lib/cjs/reducers/LineItemReducer.js +0 -1
- package/lib/cjs/reducers/OrderReducer.d.ts +0 -131
- package/lib/cjs/reducers/OrderReducer.js +0 -1
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +0 -105
- package/lib/cjs/reducers/PaymentMethodReducer.js +0 -1
- package/lib/cjs/reducers/PlaceOrderReducer.d.ts +0 -52
- package/lib/cjs/reducers/PlaceOrderReducer.js +0 -1
- package/lib/cjs/reducers/PriceReducer.js +0 -1
- package/lib/cjs/reducers/ShipmentReducer.js +0 -1
- package/lib/cjs/reducers/ShippingAddressReducer.js +0 -1
- package/lib/cjs/reducers/SkuListsReducer.js +0 -1
- package/lib/cjs/reducers/SkuOptionsReducer.js +0 -1
- package/lib/cjs/reducers/VariantReducer.d.ts +0 -71
- package/lib/cjs/reducers/VariantReducer.js +0 -1
- package/lib/cjs/typings/errors.d.ts +0 -42
- package/lib/cjs/typings/errors.js +0 -1
- package/lib/cjs/typings/index.d.ts +0 -126
- package/lib/cjs/typings/index.js +0 -1
- package/lib/cjs/utils/PropsType.js +0 -1
- package/lib/cjs/utils/addressesManager.d.ts +0 -28
- package/lib/cjs/utils/addressesManager.js +0 -1
- package/lib/cjs/utils/baseReducer.js +0 -1
- package/lib/cjs/utils/browserInfo.js +0 -1
- package/lib/cjs/utils/childrenTypes.d.ts +0 -9
- package/lib/cjs/utils/childrenTypes.js +0 -1
- package/lib/cjs/utils/countryStateCity.js +0 -1
- package/lib/cjs/utils/customMessages.d.ts +0 -8
- package/lib/cjs/utils/customMessages.js +0 -1
- package/lib/cjs/utils/customerOrderOptions.js +0 -1
- package/lib/cjs/utils/getAmount.js +0 -1
- package/lib/cjs/utils/getCurrentItemKey.js +0 -1
- package/lib/cjs/utils/getErrors.d.ts +0 -11
- package/lib/cjs/utils/getErrors.js +0 -1
- package/lib/cjs/utils/getLineItemsCount.d.ts +0 -12
- package/lib/cjs/utils/getLineItemsCount.js +0 -1
- package/lib/cjs/utils/getLoaderComponent.js +0 -1
- package/lib/cjs/utils/getPrices.js +0 -1
- package/lib/cjs/utils/getSdk.js +0 -1
- package/lib/cjs/utils/getSkus.js +0 -1
- package/lib/cjs/utils/isEmptyStates.js +0 -1
- package/lib/cjs/utils/isJSON.js +0 -1
- package/lib/cjs/utils/jwt.d.ts +0 -27
- package/lib/cjs/utils/jwt.js +0 -1
- package/lib/cjs/utils/localStorage.js +0 -1
- package/lib/cjs/utils/organization.js +0 -1
- package/lib/cjs/utils/paypalPayment.js +0 -1
- package/lib/cjs/utils/promisify.js +0 -1
- package/lib/cjs/utils/shipments.d.ts +0 -2
- package/lib/cjs/utils/shipments.js +0 -1
- package/lib/cjs/utils/validateFormFields.d.ts +0 -20
- package/lib/cjs/utils/validateFormFields.js +0 -1
- package/lib/esm/components/AddToCartButton.d.ts +0 -20
- package/lib/esm/components/AddToCartButton.js +0 -1
- package/lib/esm/components/Address.d.ts +0 -13
- package/lib/esm/components/Address.js +0 -1
- package/lib/esm/components/AddressCountrySelector.d.ts +0 -9
- package/lib/esm/components/AddressCountrySelector.js +0 -1
- package/lib/esm/components/AddressField.d.ts +0 -15
- package/lib/esm/components/AddressField.js +0 -1
- package/lib/esm/components/AddressInput.d.ts +0 -7
- package/lib/esm/components/AddressInput.js +0 -1
- package/lib/esm/components/AddressStateSelector.d.ts +0 -11
- package/lib/esm/components/AddressStateSelector.js +0 -1
- package/lib/esm/components/AddressesContainer.d.ts +0 -7
- package/lib/esm/components/AddressesContainer.js +0 -1
- package/lib/esm/components/AdjustmentAmount.d.ts +0 -4
- package/lib/esm/components/AdjustmentAmount.js +0 -1
- package/lib/esm/components/AdyenPayment.d.ts +0 -25
- package/lib/esm/components/AdyenPayment.js +0 -1
- package/lib/esm/components/AvailabilityContainer.d.ts +0 -7
- package/lib/esm/components/AvailabilityContainer.js +0 -1
- package/lib/esm/components/AvailabilityTemplate.d.ts +0 -15
- package/lib/esm/components/AvailabilityTemplate.js +0 -1
- package/lib/esm/components/BillingAddressContainer.d.ts +0 -6
- package/lib/esm/components/BillingAddressContainer.js +0 -1
- package/lib/esm/components/BillingAddressForm.d.ts +0 -8
- package/lib/esm/components/BillingAddressForm.js +0 -1
- package/lib/esm/components/BraintreePayment.d.ts +0 -30
- package/lib/esm/components/BraintreePayment.js +0 -1
- package/lib/esm/components/CheckoutLink.d.ts +0 -11
- package/lib/esm/components/CheckoutLink.js +0 -1
- package/lib/esm/components/CommerceLayer.d.ts +0 -8
- package/lib/esm/components/CommerceLayer.js +0 -1
- package/lib/esm/components/CustomerContainer.d.ts +0 -7
- package/lib/esm/components/CustomerContainer.js +0 -1
- package/lib/esm/components/CustomerInput.d.ts +0 -11
- package/lib/esm/components/CustomerInput.js +0 -1
- package/lib/esm/components/DeliveryLeadTime.d.ts +0 -10
- package/lib/esm/components/DeliveryLeadTime.js +0 -1
- package/lib/esm/components/DiscountAmount.d.ts +0 -4
- package/lib/esm/components/DiscountAmount.js +0 -1
- package/lib/esm/components/Errors.d.ts +0 -5
- package/lib/esm/components/Errors.js +0 -1
- package/lib/esm/components/ExternalFunction.d.ts +0 -7
- package/lib/esm/components/ExternalFunction.js +0 -1
- package/lib/esm/components/GiftCard.d.ts +0 -8
- package/lib/esm/components/GiftCard.js +0 -1
- package/lib/esm/components/GiftCardAmount.d.ts +0 -4
- package/lib/esm/components/GiftCardAmount.js +0 -1
- package/lib/esm/components/GiftCardContainer.d.ts +0 -6
- package/lib/esm/components/GiftCardContainer.js +0 -1
- package/lib/esm/components/GiftCardCurrencySelector.d.ts +0 -7
- package/lib/esm/components/GiftCardCurrencySelector.js +0 -1
- package/lib/esm/components/GiftCardInput.d.ts +0 -7
- package/lib/esm/components/GiftCardInput.js +0 -1
- package/lib/esm/components/GiftCardOrCouponCode.d.ts +0 -13
- package/lib/esm/components/GiftCardOrCouponCode.js +0 -1
- package/lib/esm/components/GiftCardOrCouponForm.d.ts +0 -10
- package/lib/esm/components/GiftCardOrCouponForm.js +0 -1
- package/lib/esm/components/GiftCardOrCouponInput.d.ts +0 -8
- package/lib/esm/components/GiftCardOrCouponInput.js +0 -1
- package/lib/esm/components/GiftCardOrCouponRemoveButton.d.ts +0 -16
- package/lib/esm/components/GiftCardOrCouponRemoveButton.js +0 -1
- package/lib/esm/components/GiftCardOrCouponSubmit.d.ts +0 -9
- package/lib/esm/components/GiftCardOrCouponSubmit.js +0 -1
- package/lib/esm/components/GiftCardRecipient.d.ts +0 -0
- package/lib/esm/components/GiftCardRecipient.js +0 -1
- package/lib/esm/components/GiftCardRecipientInput.d.ts +0 -0
- package/lib/esm/components/GiftCardRecipientInput.js +0 -1
- package/lib/esm/components/ItemContainer.d.ts +0 -11
- package/lib/esm/components/ItemContainer.js +0 -1
- package/lib/esm/components/LineItem.d.ts +0 -8
- package/lib/esm/components/LineItem.js +0 -1
- package/lib/esm/components/LineItemAmount.d.ts +0 -7
- package/lib/esm/components/LineItemAmount.js +0 -1
- package/lib/esm/components/LineItemCode.d.ts +0 -12
- package/lib/esm/components/LineItemCode.js +0 -1
- package/lib/esm/components/LineItemImage.d.ts +0 -16
- package/lib/esm/components/LineItemImage.js +0 -1
- package/lib/esm/components/LineItemName.d.ts +0 -11
- package/lib/esm/components/LineItemName.js +0 -1
- package/lib/esm/components/LineItemOption.d.ts +0 -19
- package/lib/esm/components/LineItemOption.js +0 -1
- package/lib/esm/components/LineItemOptions.d.ts +0 -14
- package/lib/esm/components/LineItemOptions.js +0 -1
- package/lib/esm/components/LineItemQuantity.d.ts +0 -14
- package/lib/esm/components/LineItemQuantity.js +0 -1
- package/lib/esm/components/LineItemRemoveLink.d.ts +0 -12
- package/lib/esm/components/LineItemRemoveLink.js +0 -1
- package/lib/esm/components/LineItemsContainer.d.ts +0 -8
- package/lib/esm/components/LineItemsContainer.js +0 -1
- package/lib/esm/components/LineItemsCount.d.ts +0 -12
- package/lib/esm/components/LineItemsCount.js +0 -1
- package/lib/esm/components/LineItemsEmpty.d.ts +0 -12
- package/lib/esm/components/LineItemsEmpty.js +0 -1
- package/lib/esm/components/MetadataInput.d.ts +0 -5
- package/lib/esm/components/MetadataInput.js +0 -1
- package/lib/esm/components/OrderContainer.d.ts +0 -11
- package/lib/esm/components/OrderContainer.js +0 -1
- package/lib/esm/components/OrderNumber.d.ts +0 -5
- package/lib/esm/components/OrderNumber.js +0 -1
- package/lib/esm/components/OrderStorage.d.ts +0 -8
- package/lib/esm/components/OrderStorage.js +0 -1
- package/lib/esm/components/PaymentGateway.d.ts +0 -16
- package/lib/esm/components/PaymentGateway.js +0 -1
- package/lib/esm/components/PaymentMethod.d.ts +0 -16
- package/lib/esm/components/PaymentMethod.js +0 -1
- package/lib/esm/components/PaymentMethodAmount.d.ts +0 -4
- package/lib/esm/components/PaymentMethodAmount.js +0 -1
- package/lib/esm/components/PaymentMethodName.d.ts +0 -9
- package/lib/esm/components/PaymentMethodName.js +0 -1
- package/lib/esm/components/PaymentMethodPrice.d.ts +0 -9
- package/lib/esm/components/PaymentMethodPrice.js +0 -1
- package/lib/esm/components/PaymentMethodRadioButton.d.ts +0 -11
- package/lib/esm/components/PaymentMethodRadioButton.js +0 -1
- package/lib/esm/components/PaymentMethodsContainer.d.ts +0 -8
- package/lib/esm/components/PaymentMethodsContainer.js +0 -1
- package/lib/esm/components/PaymentSource.d.ts +0 -19
- package/lib/esm/components/PaymentSource.js +0 -1
- package/lib/esm/components/PaymentSourceBrandIcon.d.ts +0 -15
- package/lib/esm/components/PaymentSourceBrandIcon.js +0 -1
- package/lib/esm/components/PaymentSourceBrandName.d.ts +0 -12
- package/lib/esm/components/PaymentSourceBrandName.js +0 -1
- package/lib/esm/components/PaymentSourceDetail.d.ts +0 -12
- package/lib/esm/components/PaymentSourceDetail.js +0 -1
- package/lib/esm/components/PaymentSourceEditButton.d.ts +0 -9
- package/lib/esm/components/PaymentSourceEditButton.js +0 -1
- package/lib/esm/components/PaypalPayment.d.ts +0 -12
- package/lib/esm/components/PaypalPayment.js +0 -1
- package/lib/esm/components/PlaceOrderButton.d.ts +0 -12
- package/lib/esm/components/PlaceOrderButton.js +0 -1
- package/lib/esm/components/PlaceOrderContainer.d.ts +0 -8
- package/lib/esm/components/PlaceOrderContainer.js +0 -1
- package/lib/esm/components/Price.d.ts +0 -16
- package/lib/esm/components/Price.js +0 -1
- package/lib/esm/components/PricesContainer.d.ts +0 -11
- package/lib/esm/components/PricesContainer.js +0 -1
- package/lib/esm/components/PrivacyAndTermsCheckbox.d.ts +0 -4
- package/lib/esm/components/PrivacyAndTermsCheckbox.js +0 -1
- package/lib/esm/components/QuantitySelector.d.ts +0 -17
- package/lib/esm/components/QuantitySelector.js +0 -1
- package/lib/esm/components/SaveAddressesButton.d.ts +0 -10
- package/lib/esm/components/SaveAddressesButton.js +0 -1
- package/lib/esm/components/SaveCustomerButton.d.ts +0 -13
- package/lib/esm/components/SaveCustomerButton.js +0 -1
- package/lib/esm/components/Shipment.d.ts +0 -8
- package/lib/esm/components/Shipment.js +0 -1
- package/lib/esm/components/ShipmentField.d.ts +0 -12
- package/lib/esm/components/ShipmentField.js +0 -1
- package/lib/esm/components/ShipmentsContainer.d.ts +0 -6
- package/lib/esm/components/ShipmentsContainer.js +0 -1
- package/lib/esm/components/ShippingAddressContainer.d.ts +0 -6
- package/lib/esm/components/ShippingAddressContainer.js +0 -1
- package/lib/esm/components/ShippingAddressForm.d.ts +0 -8
- package/lib/esm/components/ShippingAddressForm.js +0 -1
- package/lib/esm/components/ShippingAmount.d.ts +0 -4
- package/lib/esm/components/ShippingAmount.js +0 -1
- package/lib/esm/components/ShippingMethod.d.ts +0 -8
- package/lib/esm/components/ShippingMethod.js +0 -1
- package/lib/esm/components/ShippingMethodName.d.ts +0 -11
- package/lib/esm/components/ShippingMethodName.js +0 -1
- package/lib/esm/components/ShippingMethodPrice.d.ts +0 -13
- package/lib/esm/components/ShippingMethodPrice.js +0 -1
- package/lib/esm/components/ShippingMethodRadioButton.d.ts +0 -13
- package/lib/esm/components/ShippingMethodRadioButton.js +0 -1
- package/lib/esm/components/SkuList.d.ts +0 -7
- package/lib/esm/components/SkuList.js +0 -1
- package/lib/esm/components/SkuListsContainer.d.ts +0 -6
- package/lib/esm/components/SkuListsContainer.js +0 -1
- package/lib/esm/components/SkuOption.d.ts +0 -7
- package/lib/esm/components/SkuOption.js +0 -1
- package/lib/esm/components/SkuOptionInput.d.ts +0 -5
- package/lib/esm/components/SkuOptionInput.js +0 -1
- package/lib/esm/components/SkuOptionsContainer.d.ts +0 -7
- package/lib/esm/components/SkuOptionsContainer.js +0 -1
- package/lib/esm/components/StockTransfer.d.ts +0 -6
- package/lib/esm/components/StockTransfer.js +0 -1
- package/lib/esm/components/StockTransferField.d.ts +0 -9
- package/lib/esm/components/StockTransferField.js +0 -1
- package/lib/esm/components/StripePayment.d.ts +0 -18
- package/lib/esm/components/StripePayment.js +0 -1
- package/lib/esm/components/SubTotalAmount.d.ts +0 -4
- package/lib/esm/components/SubTotalAmount.js +0 -1
- package/lib/esm/components/SubmitButton.d.ts +0 -9
- package/lib/esm/components/SubmitButton.js +0 -1
- package/lib/esm/components/TaxesAmount.d.ts +0 -4
- package/lib/esm/components/TaxesAmount.js +0 -1
- package/lib/esm/components/TotalAmount.d.ts +0 -4
- package/lib/esm/components/TotalAmount.js +0 -1
- package/lib/esm/components/VariantSelector.d.ts +0 -29
- package/lib/esm/components/VariantSelector.js +0 -1
- package/lib/esm/components/VariantsContainer.d.ts +0 -8
- package/lib/esm/components/VariantsContainer.js +0 -1
- package/lib/esm/components/WireTransferPayment.d.ts +0 -10
- package/lib/esm/components/WireTransferPayment.js +0 -1
- package/lib/esm/components/gateways/AdyenGateway.d.ts +0 -5
- package/lib/esm/components/gateways/AdyenGateway.js +0 -1
- package/lib/esm/components/gateways/BraintreeGateway.d.ts +0 -5
- package/lib/esm/components/gateways/BraintreeGateway.js +0 -1
- package/lib/esm/components/gateways/PaypalGateway.d.ts +0 -5
- package/lib/esm/components/gateways/PaypalGateway.js +0 -1
- package/lib/esm/components/gateways/StripeGateway.d.ts +0 -5
- package/lib/esm/components/gateways/StripeGateway.js +0 -1
- package/lib/esm/components/gateways/WireTransferGateway.d.ts +0 -5
- package/lib/esm/components/gateways/WireTransferGateway.js +0 -1
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +0 -27
- package/lib/esm/components/utils/AddressCardsTemplate.js +0 -1
- package/lib/esm/components/utils/BaseField.d.ts +0 -8
- package/lib/esm/components/utils/BaseField.js +0 -1
- package/lib/esm/components/utils/BaseInput.d.ts +0 -5
- package/lib/esm/components/utils/BaseInput.js +0 -1
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +0 -6
- package/lib/esm/components/utils/BaseOrderPrice.js +0 -1
- package/lib/esm/components/utils/BaseSelect.d.ts +0 -5
- package/lib/esm/components/utils/BaseSelect.js +0 -1
- package/lib/esm/components/utils/Parent.d.ts +0 -8
- package/lib/esm/components/utils/Parent.js +0 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +0 -23
- package/lib/esm/components/utils/PaymentCardsTemplate.js +0 -1
- package/lib/esm/components/utils/PriceTemplate.d.ts +0 -8
- package/lib/esm/components/utils/PriceTemplate.js +0 -1
- package/lib/esm/components/utils/VariantTemplate.d.ts +0 -36
- package/lib/esm/components/utils/VariantTemplate.js +0 -1
- package/lib/esm/components/utils/getAllErrors.d.ts +0 -17
- package/lib/esm/components/utils/getAllErrors.js +0 -1
- package/lib/esm/config/components.d.ts +0 -892
- package/lib/esm/config/components.js +0 -1
- package/lib/esm/config/currency.d.ts +0 -5
- package/lib/esm/context/AddressChildrenContext.d.ts +0 -7
- package/lib/esm/context/AddressChildrenContext.js +0 -1
- package/lib/esm/context/AddressContext.d.ts +0 -17
- package/lib/esm/context/AvailabilityContext.d.ts +0 -3
- package/lib/esm/context/BillingAddressContext.d.ts +0 -12
- package/lib/esm/context/BillingAddressContext.js +0 -1
- package/lib/esm/context/BillingAddressFormContext.d.ts +0 -18
- package/lib/esm/context/CommerceLayerContext.d.ts +0 -7
- package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +0 -7
- package/lib/esm/context/CustomerContext.d.ts +0 -16
- package/lib/esm/context/CustomerContext.js +0 -1
- package/lib/esm/context/ExternalFunctionContext.d.ts +0 -12
- package/lib/esm/context/GiftCardContext.d.ts +0 -11
- package/lib/esm/context/ItemContext.d.ts +0 -13
- package/lib/esm/context/LineItemChildrenContext.d.ts +0 -9
- package/lib/esm/context/LineItemContext.d.ts +0 -8
- package/lib/esm/context/LineItemOptionChildrenContext.d.ts +0 -8
- package/lib/esm/context/OrderContext.d.ts +0 -26
- package/lib/esm/context/OrderContext.js +0 -1
- package/lib/esm/context/OrderStorageContext.d.ts +0 -11
- package/lib/esm/context/PaymentMethodChildrenContext.d.ts +0 -10
- package/lib/esm/context/PaymentMethodContext.d.ts +0 -23
- package/lib/esm/context/PaymentSourceContext.d.ts +0 -14
- package/lib/esm/context/PlaceOrderContext.d.ts +0 -16
- package/lib/esm/context/PricesContext.d.ts +0 -7
- package/lib/esm/context/ShipmentChildrenContext.d.ts +0 -13
- package/lib/esm/context/ShipmentContext.d.ts +0 -12
- package/lib/esm/context/ShippingAddressContext.d.ts +0 -10
- package/lib/esm/context/ShippingAddressFormContext.d.ts +0 -4
- package/lib/esm/context/ShippingMethodChildrenContext.d.ts +0 -10
- package/lib/esm/context/SkuListsContext.d.ts +0 -6
- package/lib/esm/context/SkuOptionChildrenContext.d.ts +0 -8
- package/lib/esm/context/SkuOptionsContext.d.ts +0 -3
- package/lib/esm/context/StockTransferChildrenContext.d.ts +0 -7
- package/lib/esm/context/VariantsContext.d.ts +0 -3
- package/lib/esm/index.d.ts +0 -96
- package/lib/esm/index.js +0 -1
- package/lib/esm/reducers/AddressReducer.d.ts +0 -58
- package/lib/esm/reducers/AddressReducer.js +0 -1
- package/lib/esm/reducers/AvailabilityReducer.d.ts +0 -53
- package/lib/esm/reducers/AvailabilityReducer.js +0 -1
- package/lib/esm/reducers/BillingAddressReducer.d.ts +0 -31
- package/lib/esm/reducers/BillingAddressReducer.js +0 -1
- package/lib/esm/reducers/CustomerReducer.d.ts +0 -50
- package/lib/esm/reducers/CustomerReducer.js +0 -1
- package/lib/esm/reducers/GiftCardReducer.d.ts +0 -76
- package/lib/esm/reducers/GiftCardReducer.js +0 -1
- package/lib/esm/reducers/ItemReducer.d.ts +0 -69
- package/lib/esm/reducers/LineItemReducer.d.ts +0 -52
- package/lib/esm/reducers/LineItemReducer.js +0 -1
- package/lib/esm/reducers/OrderReducer.d.ts +0 -131
- package/lib/esm/reducers/OrderReducer.js +0 -1
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +0 -105
- package/lib/esm/reducers/PaymentMethodReducer.js +0 -1
- package/lib/esm/reducers/PlaceOrderReducer.d.ts +0 -52
- package/lib/esm/reducers/PlaceOrderReducer.js +0 -1
- package/lib/esm/reducers/PriceReducer.d.ts +0 -44
- package/lib/esm/reducers/ShipmentReducer.d.ts +0 -40
- package/lib/esm/reducers/ShipmentReducer.js +0 -1
- package/lib/esm/reducers/ShippingAddressReducer.d.ts +0 -32
- package/lib/esm/reducers/ShippingAddressReducer.js +0 -1
- package/lib/esm/reducers/SkuListsReducer.d.ts +0 -21
- package/lib/esm/reducers/SkuOptionsReducer.d.ts +0 -26
- package/lib/esm/reducers/VariantReducer.d.ts +0 -71
- package/lib/esm/reducers/VariantReducer.js +0 -1
- package/lib/esm/typings/errors.d.ts +0 -42
- package/lib/esm/typings/errors.js +0 -1
- package/lib/esm/typings/index.d.ts +0 -126
- package/lib/esm/utils/PropsType.d.ts +0 -33
- package/lib/esm/utils/addressesManager.d.ts +0 -28
- package/lib/esm/utils/addressesManager.js +0 -1
- package/lib/esm/utils/baseReducer.d.ts +0 -3
- package/lib/esm/utils/browserInfo.d.ts +0 -9
- package/lib/esm/utils/childrenTypes.d.ts +0 -9
- package/lib/esm/utils/childrenTypes.js +0 -1
- package/lib/esm/utils/countryStateCity.d.ts +0 -9
- package/lib/esm/utils/countryStateCity.js +0 -1
- package/lib/esm/utils/customMessages.d.ts +0 -8
- package/lib/esm/utils/customMessages.js +0 -1
- package/lib/esm/utils/customerOrderOptions.d.ts +0 -3
- package/lib/esm/utils/getAmount.d.ts +0 -9
- package/lib/esm/utils/getCurrentItemKey.d.ts +0 -6
- package/lib/esm/utils/getCurrentItemKey.js +0 -1
- package/lib/esm/utils/getErrors.d.ts +0 -11
- package/lib/esm/utils/getErrors.js +0 -1
- package/lib/esm/utils/getLineItemsCount.d.ts +0 -12
- package/lib/esm/utils/getLineItemsCount.js +0 -1
- package/lib/esm/utils/getLoaderComponent.d.ts +0 -3
- package/lib/esm/utils/getLoaderComponent.js +0 -1
- package/lib/esm/utils/getPrices.d.ts +0 -17
- package/lib/esm/utils/getPrices.js +0 -1
- package/lib/esm/utils/getSdk.d.ts +0 -3
- package/lib/esm/utils/getSkus.d.ts +0 -3
- package/lib/esm/utils/getSkus.js +0 -1
- package/lib/esm/utils/isEmptyStates.d.ts +0 -1
- package/lib/esm/utils/isJSON.d.ts +0 -1
- package/lib/esm/utils/jwt.d.ts +0 -27
- package/lib/esm/utils/localStorage.d.ts +0 -17
- package/lib/esm/utils/organization.d.ts +0 -6
- package/lib/esm/utils/paypalPayment.d.ts +0 -3
- package/lib/esm/utils/promisify.d.ts +0 -1
- package/lib/esm/utils/promisify.js +0 -1
- package/lib/esm/utils/shipments.d.ts +0 -2
- package/lib/esm/utils/shipments.js +0 -1
- package/lib/esm/utils/validateFormFields.d.ts +0 -20
- package/lib/esm/utils/validateFormFields.js +0 -1
- package/lib/tsconfig.prod.esm.tsbuildinfo +0 -1
- package/lib/tsconfig.prod.tsbuildinfo +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { BaseError, ResourceErrorType } from '../typings/errors';
|
|
3
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
|
+
import type { Address, AddressCreate, Order } from '@commercelayer/sdk';
|
|
5
|
+
import { updateOrder } from './OrderReducer';
|
|
6
|
+
import { TCustomerAddress } from './CustomerReducer';
|
|
7
|
+
export declare type AddressActionType = 'setErrors' | 'setAddress' | 'setShipToDifferentAddress' | 'setCloneAddress' | 'cleanup';
|
|
8
|
+
export declare type AddressField = 'city' | 'company' | 'country_code' | 'first_name' | 'last_name' | 'line_1' | 'line_2' | 'phone' | 'state_code' | 'zip_code' | 'billing_info';
|
|
9
|
+
export declare type AddressFieldView = AddressField | 'full_address' | 'full_name';
|
|
10
|
+
export declare const addressFields: AddressField[];
|
|
11
|
+
export declare type AddressResource = Extract<ResourceErrorType, 'billing_address' | 'shipping_address'>;
|
|
12
|
+
export declare type AddressSchema = Address;
|
|
13
|
+
export interface AddressActionPayload {
|
|
14
|
+
errors: BaseError[];
|
|
15
|
+
billing_address: TCustomerAddress;
|
|
16
|
+
shipping_address: AddressCreate;
|
|
17
|
+
shipToDifferentAddress: boolean;
|
|
18
|
+
billingAddressId: string;
|
|
19
|
+
shippingAddressId: string;
|
|
20
|
+
isBusiness: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare type AddressState = Partial<AddressActionPayload>;
|
|
23
|
+
export interface AddressAction {
|
|
24
|
+
type: AddressActionType;
|
|
25
|
+
payload: Partial<AddressActionPayload>;
|
|
26
|
+
}
|
|
27
|
+
export declare const addressInitialState: AddressState;
|
|
28
|
+
export interface SetAddressErrors {
|
|
29
|
+
<V extends BaseError[]>(args: {
|
|
30
|
+
errors: V;
|
|
31
|
+
resource: Extract<ResourceErrorType, 'billing_address' | 'shipping_address'>;
|
|
32
|
+
dispatch?: Dispatch<AddressAction>;
|
|
33
|
+
currentErrors?: V;
|
|
34
|
+
}): void;
|
|
35
|
+
}
|
|
36
|
+
export declare type SetAddressParams<V extends AddressSchema> = {
|
|
37
|
+
values: V;
|
|
38
|
+
resource: AddressResource;
|
|
39
|
+
dispatch?: Dispatch<AddressAction>;
|
|
40
|
+
};
|
|
41
|
+
export interface SetAddress {
|
|
42
|
+
<V extends AddressSchema>(params: SetAddressParams<V>): void;
|
|
43
|
+
}
|
|
44
|
+
export interface SaveAddresses {
|
|
45
|
+
(params: {
|
|
46
|
+
orderId?: string;
|
|
47
|
+
order?: Order | null;
|
|
48
|
+
updateOrder?: typeof updateOrder;
|
|
49
|
+
config: CommerceLayerConfig;
|
|
50
|
+
state: AddressState;
|
|
51
|
+
dispatch: Dispatch<AddressAction>;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export declare const setAddressErrors: SetAddressErrors;
|
|
55
|
+
export declare const setAddress: SetAddress;
|
|
56
|
+
declare type SetCloneAddress = (id: string, resource: AddressResource, dispatch: Dispatch<AddressAction>) => void;
|
|
57
|
+
export declare const setCloneAddress: SetCloneAddress;
|
|
58
|
+
export declare const saveAddresses: SaveAddresses;
|
|
59
|
+
declare const addressReducer: (state: AddressState, reducer: AddressAction) => AddressState;
|
|
60
|
+
export default addressReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import getSdk from"../utils/getSdk";import camelCase from"lodash/camelCase";export const addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"],addressInitialState={errors:[]},setAddressErrors=({errors,dispatch,currentErrors=[],resource})=>{const billingErrors=resource==="billing_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="billing_address"),shippingErrors=resource==="shipping_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="shipping_address"),finalErrors=[...billingErrors,...shippingErrors];dispatch&&dispatch({type:"setErrors",payload:{errors:finalErrors}})},setAddress=({values,resource,dispatch})=>{dispatch&&dispatch({type:"setAddress",payload:{[`${resource}`]:values}})},setCloneAddress=(id,resource,dispatch)=>{dispatch({type:"setCloneAddress",payload:{[`${camelCase(resource)}Id`]:id}})},saveAddresses=async({config,updateOrder,order,state})=>{var _a,_b,_c;const{shipToDifferentAddress,billing_address,shipping_address,billingAddressId,shippingAddressId}=state;try{const sdk=getSdk(config);if(order){const currentBillingAddressRef=(_a=order?.billing_address)===null||_a===void 0?void 0:_a.reference,orderAttributes={id:order?.id,_billing_address_clone_id:billingAddressId,_shipping_address_clone_id:billingAddressId};if(currentBillingAddressRef===billingAddressId&&(orderAttributes._billing_address_clone_id=(_b=order?.billing_address)===null||_b===void 0?void 0:_b.id,orderAttributes._shipping_address_clone_id=(_c=order?.shipping_address)===null||_c===void 0?void 0:_c.id),!isEmpty(billing_address)&&billing_address){delete orderAttributes._billing_address_clone_id,delete orderAttributes._shipping_address_clone_id,orderAttributes._shipping_address_same_as_billing=!0;const address=await sdk.addresses.create(billing_address);orderAttributes.billing_address=sdk.addresses.relationship(address.id)}if(shipToDifferentAddress&&(delete orderAttributes._shipping_address_same_as_billing,shippingAddressId&&(orderAttributes._shipping_address_clone_id=shippingAddressId),!isEmpty(shipping_address)&&shipping_address)){delete orderAttributes._shipping_address_clone_id;const address=await sdk.addresses.create(shipping_address);orderAttributes.shipping_address=sdk.addresses.relationship(address.id)}!isEmpty(orderAttributes)&&updateOrder&&await updateOrder({id:order.id,attributes:orderAttributes})}}catch(error){console.error(error)}};const type=["setErrors","setAddress","setShipToDifferentAddress","setCloneAddress","cleanup"],addressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default addressReducer;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { BaseError } from '../typings/errors';
|
|
2
|
+
import { Sku } from '@commercelayer/sdk';
|
|
3
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
|
+
import { Dispatch } from 'react';
|
|
5
|
+
import { Items } from './ItemReducer';
|
|
6
|
+
export declare type DeliveryLeadTime = {
|
|
7
|
+
shipping_method: {
|
|
8
|
+
name: string;
|
|
9
|
+
reference: string;
|
|
10
|
+
price_amount_cents: number;
|
|
11
|
+
free_over_amount_cents: number;
|
|
12
|
+
formatted_price_amount: string;
|
|
13
|
+
formatted_free_over_amount: string;
|
|
14
|
+
};
|
|
15
|
+
min: LeadTimes;
|
|
16
|
+
max: LeadTimes;
|
|
17
|
+
};
|
|
18
|
+
declare type Level = {
|
|
19
|
+
delivery_lead_times: Partial<DeliveryLeadTime>[];
|
|
20
|
+
quantity: number;
|
|
21
|
+
};
|
|
22
|
+
declare type Inventory = {
|
|
23
|
+
inventory: {
|
|
24
|
+
available: boolean;
|
|
25
|
+
quantity: number;
|
|
26
|
+
levels: Level[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare type SkuInventory = Sku & Inventory;
|
|
30
|
+
export declare type LeadTimes = {
|
|
31
|
+
hours: number;
|
|
32
|
+
days: number;
|
|
33
|
+
};
|
|
34
|
+
export declare type AvailabilityPayload = {
|
|
35
|
+
quantity?: number | null;
|
|
36
|
+
errors?: BaseError[];
|
|
37
|
+
} & Partial<DeliveryLeadTime>;
|
|
38
|
+
export declare type AvailabilityState = AvailabilityPayload;
|
|
39
|
+
export interface AvailabilityAction {
|
|
40
|
+
type: AvailabilityActionType;
|
|
41
|
+
payload: AvailabilityPayload;
|
|
42
|
+
}
|
|
43
|
+
export declare const availabilityInitialState: AvailabilityState;
|
|
44
|
+
declare type GetAvailability = (args: {
|
|
45
|
+
skuCode: string;
|
|
46
|
+
dispatch: Dispatch<AvailabilityAction>;
|
|
47
|
+
config: CommerceLayerConfig;
|
|
48
|
+
setItem?: (item: Items) => void;
|
|
49
|
+
item?: Items;
|
|
50
|
+
}) => void;
|
|
51
|
+
export declare const getAvailability: GetAvailability;
|
|
52
|
+
declare type GetAvailabilityArgs = {
|
|
53
|
+
skusIds: string[];
|
|
54
|
+
dispatch: Dispatch<AvailabilityAction>;
|
|
55
|
+
config: CommerceLayerConfig;
|
|
56
|
+
setItem?: (item: Items) => void;
|
|
57
|
+
};
|
|
58
|
+
export declare function getAvailabilityByIds({ skusIds, config, setItem, }: GetAvailabilityArgs): Promise<void>;
|
|
59
|
+
export declare type AvailabilityActionType = 'setAvailability' | 'setErrors';
|
|
60
|
+
declare const availabilityReducer: (state: AvailabilityState, reducer: AvailabilityAction) => AvailabilityState;
|
|
61
|
+
export default availabilityReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const availabilityInitialState={quantity:null,min:{days:0,hours:0},max:{days:0,hours:0},errors:[]},getAvailability=async({skuCode,dispatch,config,setItem,item})=>{var _a;const sdk=getSdk(config);try{const[sku]=await sdk.skus.list({fields:{skus:["id"]},filters:{code_in:skuCode}});if(sku){const skuInventory=await sdk.skus.retrieve(sku.id,{fields:{skus:["inventory"]}}),[level]=((_a=skuInventory.inventory)===null||_a===void 0?void 0:_a.levels)||[],[delivery]=level?.delivery_lead_times||[];dispatch({type:"setAvailability",payload:Object.assign(Object.assign({},delivery),{quantity:skuInventory.inventory.quantity})}),setItem&&setItem(Object.assign(Object.assign({},item),{[skuCode]:skuInventory}))}}catch(error){console.error("Get SKU availability",error)}};export async function getAvailabilityByIds({skusIds,config,setItem}){const sdk=getSdk(config);try{const inventories=await Promise.all(skusIds.map(async id=>await sdk.skus.retrieve(id,{fields:{skus:["inventory","code"]}}))),item={};inventories.forEach(v=>{v?.code&&(item[v.code]=v)}),setItem&&setItem(item)}catch(error){console.error("Get SKU availability",error)}}const typeAction=["setAvailability","setErrors"],availabilityReducer=(state,reducer)=>baseReducer(state,reducer,typeAction);export default availabilityReducer;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const billingAddressInitialState={_billing_address_clone_id:""},setBillingAddress=async(id,options)=>{try{if(options?.order){if(options.customerAddressId){const sdk=getSdk(options.config),attributes={id,reference:options.customerAddressId};await sdk.addresses.update(attributes)}options.dispatch({type:"setBillingAddress",payload:{_billing_address_clone_id:id}})}}catch(error){console.error("Set billing address",error)}},setBillingCustomerAddressId=async({dispatch,order,setCloneAddress})=>{var _a;const customerAddressId=(_a=order?.billing_address)===null||_a===void 0?void 0:_a.reference;try{customerAddressId&&(dispatch({type:"setBillingCustomerAddressId",payload:{billingCustomerAddressId:customerAddressId}}),setCloneAddress(customerAddressId,"billing_address"))}catch(error){console.error("error",error)}};const type=["setBillingAddress","setBillingCustomerAddressId","cleanup"],billingAddressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default billingAddressReducer;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { BaseError } from '../typings/errors';
|
|
3
|
+
import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSource, Order } from '@commercelayer/sdk';
|
|
4
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
+
import { updateOrder } from './OrderReducer';
|
|
6
|
+
export declare type CustomerActionType = 'setErrors' | 'setCustomerEmail' | 'setAddresses' | 'setPayments' | 'setOrders';
|
|
7
|
+
export declare type CustomerActionPayload = {
|
|
8
|
+
addresses: Address[];
|
|
9
|
+
payments: CustomerPaymentSource[];
|
|
10
|
+
customerEmail: string;
|
|
11
|
+
errors: BaseError[];
|
|
12
|
+
orders: Order[];
|
|
13
|
+
isGuest: boolean;
|
|
14
|
+
customers: Customer;
|
|
15
|
+
};
|
|
16
|
+
export declare type CustomerState = Partial<CustomerActionPayload>;
|
|
17
|
+
export interface CustomerAction {
|
|
18
|
+
type: CustomerActionType;
|
|
19
|
+
payload: Partial<CustomerActionPayload>;
|
|
20
|
+
}
|
|
21
|
+
export declare type SetSaveOnBlur = (args: {
|
|
22
|
+
saveOnBlur: boolean;
|
|
23
|
+
dispatch: Dispatch<CustomerAction>;
|
|
24
|
+
}) => void;
|
|
25
|
+
export declare type SaveCustomerUser = {
|
|
26
|
+
/**
|
|
27
|
+
* The Commerce Layer Config
|
|
28
|
+
*/
|
|
29
|
+
config: CommerceLayerConfig;
|
|
30
|
+
/**
|
|
31
|
+
* The customer email
|
|
32
|
+
*/
|
|
33
|
+
customerEmail: string;
|
|
34
|
+
/**
|
|
35
|
+
* The Customer dispatch function
|
|
36
|
+
*/
|
|
37
|
+
dispatch: Dispatch<CustomerAction>;
|
|
38
|
+
/**
|
|
39
|
+
* The Commerce Layer Order resource
|
|
40
|
+
*/
|
|
41
|
+
order?: Order;
|
|
42
|
+
/**
|
|
43
|
+
* The function to update the order resource
|
|
44
|
+
*/
|
|
45
|
+
updateOrder: typeof updateOrder;
|
|
46
|
+
};
|
|
47
|
+
export declare function saveCustomerUser({ customerEmail, order, updateOrder, }: SaveCustomerUser): Promise<void>;
|
|
48
|
+
export interface SetCustomerErrors {
|
|
49
|
+
<V extends BaseError[]>(errors: V, dispatch?: Dispatch<CustomerAction>): void;
|
|
50
|
+
}
|
|
51
|
+
export declare function setCustomerErrors(
|
|
52
|
+
/**
|
|
53
|
+
* @param errors - An array of errors
|
|
54
|
+
*/
|
|
55
|
+
errors: BaseError[],
|
|
56
|
+
/**
|
|
57
|
+
* @param dispatch - The dispatch function
|
|
58
|
+
*/
|
|
59
|
+
dispatch?: Dispatch<CustomerAction>): void;
|
|
60
|
+
export declare function setCustomerEmail(
|
|
61
|
+
/**
|
|
62
|
+
* @param customerEmail The email address of the customer
|
|
63
|
+
*/
|
|
64
|
+
customerEmail: string,
|
|
65
|
+
/**
|
|
66
|
+
* @param dispatch The dispatch function
|
|
67
|
+
*/
|
|
68
|
+
dispatch?: Dispatch<CustomerAction>): void;
|
|
69
|
+
export declare type GetCustomerAddresses = {
|
|
70
|
+
/**
|
|
71
|
+
* The Commerce Layer config
|
|
72
|
+
*/
|
|
73
|
+
config: CommerceLayerConfig;
|
|
74
|
+
/**
|
|
75
|
+
* The Customer dispatch function
|
|
76
|
+
*/
|
|
77
|
+
dispatch: Dispatch<CustomerAction>;
|
|
78
|
+
};
|
|
79
|
+
export declare function getCustomerAddresses({ config, dispatch, }: GetCustomerAddresses): Promise<void>;
|
|
80
|
+
export declare type DeleteCustomerAddress = {
|
|
81
|
+
config?: CommerceLayerConfig;
|
|
82
|
+
dispatch?: Dispatch<CustomerAction>;
|
|
83
|
+
customerAddressId: string;
|
|
84
|
+
addresses?: Address[];
|
|
85
|
+
};
|
|
86
|
+
export declare function deleteCustomerAddress({ config, dispatch, customerAddressId, addresses, }: DeleteCustomerAddress): Promise<void>;
|
|
87
|
+
export declare type GetCustomerPaymentSources = {
|
|
88
|
+
/**
|
|
89
|
+
* The Customer dispatch function
|
|
90
|
+
*/
|
|
91
|
+
dispatch?: Dispatch<CustomerAction>;
|
|
92
|
+
/**
|
|
93
|
+
* The Commerce Layer Order resource
|
|
94
|
+
*/
|
|
95
|
+
order?: Order;
|
|
96
|
+
};
|
|
97
|
+
export declare function getCustomerPaymentSources(params?: GetCustomerPaymentSources): void;
|
|
98
|
+
export declare type GetCustomerOrders = (params: {
|
|
99
|
+
/**
|
|
100
|
+
* The Commerce Layer config
|
|
101
|
+
*/
|
|
102
|
+
config: CommerceLayerConfig;
|
|
103
|
+
/**
|
|
104
|
+
* The Customer dispatch function
|
|
105
|
+
*/
|
|
106
|
+
dispatch: Dispatch<CustomerAction>;
|
|
107
|
+
}) => Promise<void>;
|
|
108
|
+
export declare const getCustomerOrders: GetCustomerOrders;
|
|
109
|
+
export declare type TCustomerAddress = AddressCreate & AddressUpdate;
|
|
110
|
+
declare type TCreateCustomerAddress = {
|
|
111
|
+
/**
|
|
112
|
+
* Customer address dispatch function
|
|
113
|
+
*/
|
|
114
|
+
dispatch?: Dispatch<CustomerAction>;
|
|
115
|
+
/**
|
|
116
|
+
* The Commerce Layer Config
|
|
117
|
+
*/
|
|
118
|
+
config?: CommerceLayerConfig;
|
|
119
|
+
/**
|
|
120
|
+
* The address to create or update if there is an id
|
|
121
|
+
*/
|
|
122
|
+
address: TCustomerAddress;
|
|
123
|
+
/**
|
|
124
|
+
* Current state of the customer
|
|
125
|
+
*/
|
|
126
|
+
state?: CustomerState;
|
|
127
|
+
};
|
|
128
|
+
export declare function createCustomerAddress({ address, config, dispatch, state, }: TCreateCustomerAddress): Promise<void>;
|
|
129
|
+
export declare const customerInitialState: CustomerState;
|
|
130
|
+
declare const customerReducer: (state: CustomerState, reducer: CustomerAction) => CustomerState;
|
|
131
|
+
export default customerReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";import jwtDecode from"../utils/jwt";export async function saveCustomerUser({customerEmail,order,updateOrder}){if(order){const attributes={customer_email:customerEmail,id:order.id};await updateOrder({id:order.id,attributes})}}export function setCustomerErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}export function setCustomerEmail(customerEmail,dispatch){dispatch&&dispatch({type:"setCustomerEmail",payload:{customerEmail}})}export async function getCustomerAddresses({config,dispatch}){try{const addresses=[];(await getSdk(config).customer_addresses.list({include:["address"]})).forEach(customerAddress=>{customerAddress.address&&addresses.push(customerAddress.address)}),addresses.sort((a,b)=>a.full_name&&b.full_name?a.full_name.localeCompare(b.full_name):0),dispatch({type:"setAddresses",payload:{addresses}})}catch(error){const errors=getErrors(error,"addresses");dispatch({type:"setErrors",payload:{errors}})}}export async function deleteCustomerAddress({config,dispatch,customerAddressId,addresses}){if(config&&addresses&&dispatch&&config)try{await getSdk(config).customer_addresses.delete(customerAddressId);const newAddresses=addresses.filter(({reference})=>reference!==customerAddressId);dispatch({type:"setAddresses",payload:{addresses:newAddresses}})}catch{throw new Error("Couldn't delete address")}}export function getCustomerPaymentSources(params){if(params){const{order,dispatch}=params;order?.available_customer_payment_sources&&dispatch&&dispatch({type:"setPayments",payload:{payments:order.available_customer_payment_sources}})}}export const getCustomerOrders=async({config,dispatch})=>{var _a;if(config.accessToken){const{owner}=jwtDecode(config.accessToken);if(owner?.id){const customers=await getSdk(config).customers.retrieve(owner.id,{include:["orders"]}),orders=(_a=customers.orders)===null||_a===void 0?void 0:_a.filter(order=>order.status!=="pending"&&order.status!=="draft");dispatch({type:"setOrders",payload:{orders,customers}})}}};export async function createCustomerAddress({address,config,dispatch,state}){var _a,_b,_c;if(config&&address){const sdk=getSdk(config),{id}=address;try{if(id){const upAddress=await sdk.addresses.update(address),updatedAddresses=(_a=state?.addresses)===null||_a===void 0?void 0:_a.map(a=>a.id===upAddress.id?upAddress:a);dispatch&&dispatch({type:"setAddresses",payload:{addresses:updatedAddresses}})}else{const newAddress=await sdk.addresses.create(address);if(((_b=state?.customers)===null||_b===void 0?void 0:_b.id)&&newAddress?.id){const newCustomerAddress=await sdk.customer_addresses.create({customer:sdk.customers.relationship((_c=state?.customers)===null||_c===void 0?void 0:_c.id),address:sdk.addresses.relationship(newAddress.id)});await sdk.addresses.update({id:newAddress.id,reference:newCustomerAddress.id}),dispatch&&state?.addresses&&(newAddress.reference=newCustomerAddress.id,dispatch({type:"setAddresses",payload:{addresses:[...state.addresses,newAddress]}}))}}}catch{throw new Error("Couldn't create customer address")}}}export const customerInitialState={errors:[],addresses:[],payments:[],orders:[]};const type=["setErrors","setCustomerEmail","setAddresses","setPayments","setOrders"],customerReducer=(state,reducer)=>baseReducer(state,reducer,type);export default customerReducer;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest}from"tslib";import baseReducer from"../utils/baseReducer";import{isEmpty}from"lodash";import getErrors from"../utils/getErrors";import getSdk from"../utils/getSdk";export const giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]},addGiftCardRecipient=async(values,config,dispatch)=>{try{const recipient=await getSdk(config).gift_card_recipients.create(values);dispatch({type:"setGiftCardRecipient",payload:{giftCardRecipient:recipient}})}catch(error){console.error(error)}},addGiftCardLoading=(loading,dispatch)=>{dispatch({type:"setGiftCardLoading",payload:{loading}})},addGiftCard=async(values,{config,dispatch,getOrder,createOrder,order})=>{var _a;try{const sdk=getSdk(config);addGiftCardLoading(!0,dispatch);const{firstName,lastName,email}=values,val=__rest(values,["firstName","lastName","email"]),giftCardValue=Object.assign({recipient_email:email},val),giftCard=await sdk.gift_cards.create(giftCardValue,{include:["gift_card_recipient"]}),recipientValues={id:(_a=giftCard.gift_card_recipient)===null||_a===void 0?void 0:_a.id};if(firstName&&(recipientValues.first_name=firstName),lastName&&(recipientValues.last_name=lastName),isEmpty(recipientValues)||await sdk.gift_card_recipients.update(recipientValues),createOrder&&getOrder){const id=order?order.id:await createOrder();if(id){const order2=sdk.orders.relationship(id),item=sdk.gift_cards.relationship(giftCard.id);await sdk.line_items.create({quantity:1,order:order2,item}),getOrder&&await getOrder(id)}}dispatch({type:"setGiftCardRecipient",payload:Object.assign({},giftCardValue)}),addGiftCardLoading(!1,dispatch)}catch(error){const errors=getErrors(error,"gift_cards");dispatch({type:"setGiftCardErrors",payload:{errors}}),addGiftCardLoading(!1,dispatch)}},addGiftCardError=(errors,dispatch)=>{dispatch({type:"setGiftCardErrors",payload:{errors}})};const type=["setAvailability","setGiftCardRecipient","setGiftCardErrors","setGiftCardLoading"],giftCardReducer=(state,reducer)=>baseReducer(state,reducer,type);export default giftCardReducer;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const getLineItems=params=>{const{order,dispatch,config}=params,sdk=getSdk(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=getErrors(error,"line_items");dispatch({type:"setErrors",payload:{errors}})})},updateLineItem=async params=>{const{config,lineItemId,quantity,getOrder,orderId,dispatch}=params,sdk=getSdk(config);try{await sdk.line_items.update({id:lineItemId,quantity}),getOrder&&await getOrder(orderId),dispatch({type:"setErrors",payload:{errors:[]}})}catch(error){const errors=getErrors(error,"line_items");dispatch({type:"setErrors",payload:{errors}})}},deleteLineItem=async params=>{const{config,lineItemId,getOrder,orderId,dispatch}=params,sdk=getSdk(config);try{await sdk.line_items.delete(lineItemId),getOrder&&await getOrder(orderId),dispatch({type:"setErrors",payload:{errors:[]}})}catch(error){const errors=getErrors(error,"line_items");dispatch({type:"setErrors",payload:{errors}})}},lineItemInitialState={loading:!1,lineItems:[],errors:[]};const actionType=["setLineItems","setErrors","setLoading"],lineItemReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default lineItemReducer;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { SetLocalOrder, DeleteLocalOrder } from '../utils/localStorage';
|
|
3
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
|
+
import { ItemOption, CustomLineItem } from './ItemReducer';
|
|
5
|
+
import { BaseMetadataObject } from '../typings/index';
|
|
6
|
+
import { BaseError } from '../typings/errors';
|
|
7
|
+
import { AddressResource } from './AddressReducer';
|
|
8
|
+
import type { Order, OrderUpdate } from '@commercelayer/sdk';
|
|
9
|
+
export declare 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 interface GetOrder {
|
|
19
|
+
(params: GetOrderParams): Promise<void | Order>;
|
|
20
|
+
}
|
|
21
|
+
declare type CreateOrderParams = Pick<AddToCartParams, 'config' | 'dispatch' | 'persistKey' | 'state' | 'orderMetadata' | 'orderAttributes' | 'setLocalOrder'>;
|
|
22
|
+
export interface CreateOrder {
|
|
23
|
+
(params?: CreateOrderParams): Promise<string>;
|
|
24
|
+
}
|
|
25
|
+
export declare type AddToCartParams = Partial<{
|
|
26
|
+
bundleCode: string;
|
|
27
|
+
skuCode: string;
|
|
28
|
+
persistKey: string;
|
|
29
|
+
config: CommerceLayerConfig;
|
|
30
|
+
dispatch: Dispatch<OrderActions>;
|
|
31
|
+
state: Partial<OrderState>;
|
|
32
|
+
skuId: string;
|
|
33
|
+
quantity: number;
|
|
34
|
+
option: ItemOption;
|
|
35
|
+
lineItem: CustomLineItem;
|
|
36
|
+
orderMetadata: BaseMetadataObject;
|
|
37
|
+
orderAttributes: Record<string, any>;
|
|
38
|
+
errors: BaseError[];
|
|
39
|
+
setLocalOrder: SetLocalOrder;
|
|
40
|
+
buyNowMode: boolean;
|
|
41
|
+
checkoutUrl: string;
|
|
42
|
+
}>;
|
|
43
|
+
export interface AddToCartImportParams extends Omit<AddToCartParams, 'skuCode' | 'skuId' | 'quantity' | 'option' | 'lineItem'> {
|
|
44
|
+
lineItems: CustomLineItem[];
|
|
45
|
+
}
|
|
46
|
+
export declare type AddToCartReturn = Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
orderId: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export interface AddToCart {
|
|
51
|
+
(params: AddToCartParams): AddToCartReturn;
|
|
52
|
+
}
|
|
53
|
+
export interface AddToCartImport {
|
|
54
|
+
(params: AddToCartImportParams): AddToCartReturn;
|
|
55
|
+
}
|
|
56
|
+
export interface UnsetOrderState {
|
|
57
|
+
(dispatch: Dispatch<OrderActions>): void;
|
|
58
|
+
}
|
|
59
|
+
export declare type ResourceIncluded = 'billing_address' | 'shipping_address' | 'line_items.line_item_options.sku_option' | 'line_items.item' | 'available_customer_payment_sources.payment_source' | 'shipments.available_shipping_methods' | 'shipments.stock_transfers' | 'shipments.stock_transfers.line_item' | 'shipments.shipment_line_items.line_item' | 'shipments.shipping_method' | 'shipments.stock_location' | 'payment_source' | 'available_payment_methods' | 'payment_method';
|
|
60
|
+
declare type ResourceIncludedLoaded = Partial<Record<ResourceIncluded, boolean>>;
|
|
61
|
+
export interface OrderPayload {
|
|
62
|
+
loading?: boolean;
|
|
63
|
+
orderId?: string;
|
|
64
|
+
order?: Order;
|
|
65
|
+
errors?: BaseError[];
|
|
66
|
+
include?: ResourceIncluded[] | undefined;
|
|
67
|
+
includeLoaded?: ResourceIncludedLoaded;
|
|
68
|
+
withoutIncludes?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare type AddToCartValues = Pick<AddToCartParams, 'bundleCode' | 'lineItem' | 'quantity' | 'skuCode' | 'skuId' | 'option' | 'buyNowMode' | 'checkoutUrl'>;
|
|
71
|
+
export declare type AddToCartImportValues = Pick<AddToCartImportParams, 'lineItems'>;
|
|
72
|
+
export declare type getOrderContext = (id: string) => Promise<void | Order>;
|
|
73
|
+
export declare type OrderState = Partial<OrderPayload>;
|
|
74
|
+
export interface OrderActions {
|
|
75
|
+
type: OrderActionType;
|
|
76
|
+
payload: OrderPayload;
|
|
77
|
+
}
|
|
78
|
+
export declare type OrderActionType = 'setLoading' | 'setOrderId' | 'setOrder' | 'setSingleQuantity' | 'setCurrentSkuCodes' | 'setCurrentSkuPrices' | 'setCurrentItem' | 'setErrors' | 'setSaveAddressToCustomerAddressBook' | 'setGiftCardOrCouponCode' | 'setIncludesResource';
|
|
79
|
+
export declare const createOrder: CreateOrder;
|
|
80
|
+
export declare const getApiOrder: GetOrder;
|
|
81
|
+
export declare type UpdateOrderArgs = {
|
|
82
|
+
id: string;
|
|
83
|
+
attributes: Omit<OrderUpdate, 'id'>;
|
|
84
|
+
dispatch?: Dispatch<OrderActions>;
|
|
85
|
+
include?: string[];
|
|
86
|
+
config?: CommerceLayerConfig;
|
|
87
|
+
state?: OrderState;
|
|
88
|
+
};
|
|
89
|
+
export declare function updateOrder({ id, attributes, dispatch, config, include, state, }: UpdateOrderArgs): Promise<{
|
|
90
|
+
success: boolean;
|
|
91
|
+
error?: undefined;
|
|
92
|
+
} | {
|
|
93
|
+
success: boolean;
|
|
94
|
+
error: unknown;
|
|
95
|
+
}>;
|
|
96
|
+
export declare const setOrder: (order: Order, dispatch?: Dispatch<OrderActions>) => void;
|
|
97
|
+
export declare type AddResourceToInclude = {
|
|
98
|
+
resourcesIncluded?: ResourceIncluded[];
|
|
99
|
+
dispatch?: Dispatch<OrderActions>;
|
|
100
|
+
newResource?: ResourceIncluded | ResourceIncluded[];
|
|
101
|
+
resourceIncludedLoaded?: ResourceIncludedLoaded;
|
|
102
|
+
newResourceLoaded?: ResourceIncludedLoaded;
|
|
103
|
+
};
|
|
104
|
+
export declare function addResourceToInclude({ resourcesIncluded, dispatch, newResource, newResourceLoaded, resourceIncludedLoaded, }: AddResourceToInclude): void;
|
|
105
|
+
export declare const addToCart: AddToCart;
|
|
106
|
+
export declare const unsetOrderState: UnsetOrderState;
|
|
107
|
+
declare type OrderErrors = {
|
|
108
|
+
dispatch?: Dispatch<OrderActions>;
|
|
109
|
+
errors: BaseError[];
|
|
110
|
+
};
|
|
111
|
+
export declare function setOrderErrors({ dispatch, errors }: OrderErrors): {
|
|
112
|
+
success: boolean;
|
|
113
|
+
};
|
|
114
|
+
export declare type SaveAddressToCustomerAddressBook = (params: {
|
|
115
|
+
dispatch?: Dispatch<OrderActions>;
|
|
116
|
+
type: AddressResource;
|
|
117
|
+
value: boolean;
|
|
118
|
+
}) => void;
|
|
119
|
+
export declare const saveAddressToCustomerAddressBook: SaveAddressToCustomerAddressBook;
|
|
120
|
+
export declare type SetGiftCardOrCouponCode = (args: {
|
|
121
|
+
code: string;
|
|
122
|
+
codeType: OrderCodeType;
|
|
123
|
+
dispatch?: Dispatch<OrderActions>;
|
|
124
|
+
config?: CommerceLayerConfig;
|
|
125
|
+
order?: Order;
|
|
126
|
+
include?: string[];
|
|
127
|
+
state?: OrderState;
|
|
128
|
+
}) => Promise<{
|
|
129
|
+
success: boolean;
|
|
130
|
+
}>;
|
|
131
|
+
export declare const setGiftCardOrCouponCode: SetGiftCardOrCouponCode;
|
|
132
|
+
export declare type CodeType = 'coupon' | 'gift_card' | 'gift_card_or_coupon';
|
|
133
|
+
export declare type OrderCodeType = `${CodeType}_code`;
|
|
134
|
+
export declare type RemoveGiftCardOrCouponCode = (args: {
|
|
135
|
+
codeType: OrderCodeType;
|
|
136
|
+
dispatch?: Dispatch<OrderActions>;
|
|
137
|
+
config?: CommerceLayerConfig;
|
|
138
|
+
order?: Order;
|
|
139
|
+
include?: string[];
|
|
140
|
+
state?: OrderState;
|
|
141
|
+
}) => Promise<{
|
|
142
|
+
success: boolean;
|
|
143
|
+
}>;
|
|
144
|
+
export declare const removeGiftCardOrCouponCode: RemoveGiftCardOrCouponCode;
|
|
145
|
+
export declare const orderInitialState: Partial<OrderState>;
|
|
146
|
+
declare const orderReducer: (state: OrderState, reducer: OrderActions) => OrderState;
|
|
147
|
+
export default orderReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setCustomerOrderParam}from"../utils/localStorage";import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import size from"lodash/size";import map from"lodash/map";import getSdk from"../utils/getSdk";import getErrors,{setErrors}from"../utils/getErrors";import getOrganizationSlug from"../utils/organization";const actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];export const createOrder=async params=>{if(params){const{persistKey,state,dispatch,config,orderMetadata:metadata,orderAttributes={},setLocalOrder}=params;if(state?.orderId)return state.orderId;const sdk=getSdk(config);try{const o=await 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=getErrors(error,"orders");console.error("Create order",errors),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors,dispatch})}}return""},getApiOrder=async params=>{const{id,dispatch,config,clearWhenPlaced,persistKey,deleteLocalOrder,state}=params,sdk=getSdk(config);try{const options={};state?.include&&state.include.length>0&&(options.include=state.include);const order=await sdk.orders.retrieve(id,options);return clearWhenPlaced&&order.status==="placed"||order.status==="approved"||order.status==="cancelled"?(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=getErrors(error,"orders");console.error("Retrieve order",errors),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors,dispatch});return}};export async function updateOrder({id,attributes,dispatch,config,include,state}){const sdk=getSdk(config);try{const resource=Object.assign(Object.assign({},attributes),{id});await sdk.orders.update(resource,{include});const order=await getApiOrder({id,config,dispatch,state});return dispatch&&order&&dispatch({type:"setOrder",payload:{order}}),{success:!0}}catch(error){const errors=getErrors(error,"orders");return dispatch&&(setOrderErrors({errors,dispatch}),dispatch({type:"setErrors",payload:{errors}})),{success:!1,error}}}export const setOrder=(order,dispatch)=>{dispatch&&dispatch({type:"setOrder",payload:{order}})};export 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=[...resourcesIncluded,...resources],resources.forEach(resource=>{payload.includeLoaded=Object.assign(Object.assign({},payload.includeLoaded),{[resource]:!0})})}else delete payload.include;payload.includeLoaded=Object.assign(Object.assign(Object.assign({},resourceIncludedLoaded),newResourceLoaded),payload.includeLoaded&&payload.includeLoaded),dispatch&&dispatch({type:"setIncludesResource",payload:Object.assign(Object.assign({},payload),{withoutIncludes:!1})})}export const addToCart=async params=>{var _a,_b;const{skuCode,bundleCode,skuId,quantity,option,config,dispatch,lineItem,state,errors=[],buyNowMode,checkoutUrl}=params;try{if(!config)throw{errors:[{code:"INVALID_RESOURCE",resource:"orders",title:"Markup error",message:"You are trying to place an order outside the OrderContainer component"}]};const sdk=getSdk(config),id=await createOrder(params);if(id){const order=sdk.orders.relationship(id),name=lineItem?.name,imageUrl=lineItem?.imageUrl;if(buyNowMode)if(!((_a=state?.order)===null||_a===void 0)&&_a.line_items)await Promise.all((_b=state?.order)===null||_b===void 0?void 0:_b.line_items.map(async lineItem2=>{await sdk.line_items.delete(lineItem2.id)}));else{const{line_items}=await sdk.orders.retrieve(id,{fields:["line_items"],include:["line_items"]});line_items&&line_items?.length>0&&await Promise.all(line_items.map(async lineItem2=>{await sdk.line_items.delete(lineItem2.id)}))}const attrs={order,sku_code:skuCode,name,image_url:imageUrl,quantity:quantity||1,_update_quantity:!0,bundle_code:bundleCode};skuId&&(attrs.item=sdk.skus.relationship(skuId));const newLineItem=await sdk.line_items.create(attrs);if(isEmpty(option))await getApiOrder(Object.assign(Object.assign({id},params),{state}));else{let c=0;map(option,async opt=>{const{options,skuOptionId}=opt,skuOption=sdk.sku_options.relationship(skuOptionId),lineItemRel=sdk.line_items.relationship(newLineItem.id),lineItemOptionsAttributes={quantity:1,options,sku_option:skuOption,line_item:lineItemRel};await sdk.line_item_options.create(lineItemOptionsAttributes),c+=1,c===size(option)&&await getApiOrder(Object.assign({id},params))})}if(!isEmpty(errors)&&dispatch&&dispatch({type:"setErrors",payload:{errors:[]}}),buyNowMode){const{organization}=getOrganizationSlug(config.endpoint),params2=`${id}?accessToken=${config.accessToken}`,redirectUrl=checkoutUrl?`${checkoutUrl}/${params2}`:`https://${organization}.checkout.commercelayer.app/${params2}`;location.href=redirectUrl}return{success:!0,orderId:id}}return{success:!1,orderId:void 0}}catch(error){const errors2=getErrors(error,"orders");return console.error("Add to cart",errors2),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors2,dispatch}),{success:!1,orderId:void 0}}},unsetOrderState=dispatch=>{dispatch({type:"setOrderId",payload:{orderId:""}}),dispatch({type:"setOrder",payload:{order:void 0}})};export function setOrderErrors({dispatch,errors=[]}){return dispatch&&dispatch({type:"setErrors",payload:{errors}}),{success:!1}}export const saveAddressToCustomerAddressBook=({type,value,dispatch})=>{const k=`_save_${type}_to_customer_address_book`,v=`${value}`;setCustomerOrderParam(k,v),dispatch&&dispatch({type:"setSaveAddressToCustomerAddressBook",payload:{[k]:v}})},setGiftCardOrCouponCode=async({code,codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&code&&dispatch){const attributes={[codeType]:code},{success,error}=await updateOrder({id:order.id,attributes,config,include,dispatch,state});if(!success)throw error;return dispatch({type:"setErrors",payload:{errors:[]}}),{success}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},removeGiftCardOrCouponCode=async({codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&dispatch){const attributes={[codeType]:""};return await updateOrder({id:order.id,attributes,config,include,dispatch,state}),dispatch({type:"setErrors",payload:{errors:[]}}),{success:!0}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return console.error("Remove gift card o coupon code",errors),dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},orderInitialState={loading:!0,orderId:"",order:void 0,errors:[],include:void 0,withoutIncludes:!0};const orderReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default orderReducer;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { AdyenPaymentConfig } from '../components/AdyenPayment';
|
|
2
|
+
import { BraintreeConfig } from '../components/BraintreePayment';
|
|
3
|
+
import { PaypalConfig } from '../components/PaypalPayment';
|
|
4
|
+
import { StripeConfig } from '../components/StripePayment';
|
|
5
|
+
import { WireTransferConfig } from '../components/WireTransferPayment';
|
|
6
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
7
|
+
import { getOrderContext, updateOrder } from './OrderReducer';
|
|
8
|
+
import { BaseError } from '../typings/errors';
|
|
9
|
+
import { Order, PaymentMethod, StripePayment, WireTransfer, AdyenPayment, BraintreePayment, CheckoutComPayment, ExternalPayment, PaypalPayment, KlarnaPayment } from '@commercelayer/sdk';
|
|
10
|
+
import { Dispatch, MutableRefObject } from 'react';
|
|
11
|
+
import { CheckoutComConfig } from '../components/CheckoutComPayment';
|
|
12
|
+
export declare type PaymentSourceType = AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer;
|
|
13
|
+
declare type Card = {
|
|
14
|
+
brand: string;
|
|
15
|
+
last4: string;
|
|
16
|
+
exp_year: number;
|
|
17
|
+
exp_month: number;
|
|
18
|
+
};
|
|
19
|
+
export declare type PaymentSourceObject = {
|
|
20
|
+
adyen_payments: AdyenPayment & {
|
|
21
|
+
payment_request_data?: {
|
|
22
|
+
payment_method?: Card;
|
|
23
|
+
};
|
|
24
|
+
payment_response?: {
|
|
25
|
+
resultCode?: 'Authorised';
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
braintree_payments: BraintreePayment & {
|
|
29
|
+
options?: {
|
|
30
|
+
card: Card;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
external_payments: ExternalPayment & {
|
|
34
|
+
payment_source_token?: string;
|
|
35
|
+
};
|
|
36
|
+
paypal_payments: PaypalPayment;
|
|
37
|
+
stripe_payments: StripePayment & {
|
|
38
|
+
options?: {
|
|
39
|
+
card: Card;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
wire_transfers: WireTransfer;
|
|
43
|
+
checkout_com_payments: CheckoutComPayment & {
|
|
44
|
+
payment_response: {
|
|
45
|
+
source?: Pick<Card, 'last4'> & {
|
|
46
|
+
scheme: string;
|
|
47
|
+
expiry_year: number;
|
|
48
|
+
expiry_month: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
klarna_payments: KlarnaPayment;
|
|
53
|
+
};
|
|
54
|
+
export declare type PaymentMethodActionType = 'setErrors' | 'setPaymentMethods' | 'setPaymentMethodConfig' | 'setPaymentSource' | 'setPaymentRef' | 'setLoading';
|
|
55
|
+
export declare type PaymentRef = MutableRefObject<null | HTMLFormElement>;
|
|
56
|
+
export interface PaymentMethodActionPayload {
|
|
57
|
+
errors: BaseError[];
|
|
58
|
+
paymentMethods: PaymentMethod[];
|
|
59
|
+
currentPaymentMethodType: PaymentResource;
|
|
60
|
+
currentPaymentMethodId: string;
|
|
61
|
+
currentPaymentMethodRef: PaymentRef;
|
|
62
|
+
config: PaymentMethodConfig;
|
|
63
|
+
paymentSource: PaymentSourceTypes;
|
|
64
|
+
loading: boolean;
|
|
65
|
+
}
|
|
66
|
+
export declare function setLoading({ loading, dispatch, }: {
|
|
67
|
+
loading: boolean;
|
|
68
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
69
|
+
}): void;
|
|
70
|
+
export declare type SetPaymentRef = (args: {
|
|
71
|
+
ref: PaymentRef;
|
|
72
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
73
|
+
}) => void;
|
|
74
|
+
export declare const setPaymentRef: SetPaymentRef;
|
|
75
|
+
export declare type PaymentMethodState = Partial<PaymentMethodActionPayload>;
|
|
76
|
+
export interface PaymentMethodAction {
|
|
77
|
+
type: PaymentMethodActionType;
|
|
78
|
+
payload: Partial<PaymentMethodActionPayload>;
|
|
79
|
+
}
|
|
80
|
+
export declare const paymentMethodInitialState: PaymentMethodState;
|
|
81
|
+
export interface SetPaymentMethodErrors {
|
|
82
|
+
<V extends BaseError[]>(errors: V, dispatch?: Dispatch<PaymentMethodAction>): void;
|
|
83
|
+
}
|
|
84
|
+
export declare const setPaymentMethodErrors: SetPaymentMethodErrors;
|
|
85
|
+
declare type GetPaymentMethods = (args: {
|
|
86
|
+
order: Order;
|
|
87
|
+
dispatch: Dispatch<PaymentMethodAction>;
|
|
88
|
+
}) => Promise<void>;
|
|
89
|
+
export declare const getPaymentMethods: GetPaymentMethods;
|
|
90
|
+
export declare type PaymentResource = keyof PaymentSourceObject;
|
|
91
|
+
export declare type PaymentResourceKey = 'braintreePayment' | 'stripePayment' | 'klarnaPayment' | 'wireTransfer' | 'paypalPayment' | 'adyenPayment' | 'checkoutComPayment';
|
|
92
|
+
export declare type SDKPaymentResource = 'AdyenPayment' | 'BraintreePayment' | 'ExternalPayment' | 'PaypalPayment' | 'StripePayment' | 'WireTransfer' | 'CheckoutComPayment';
|
|
93
|
+
export declare type SetPaymentMethod = (args: {
|
|
94
|
+
config?: CommerceLayerConfig;
|
|
95
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
96
|
+
updateOrder?: typeof updateOrder;
|
|
97
|
+
setOrderErrors?: (collection: any) => {
|
|
98
|
+
success: boolean;
|
|
99
|
+
};
|
|
100
|
+
order?: Order;
|
|
101
|
+
paymentMethodId: string;
|
|
102
|
+
paymentResource?: PaymentResource;
|
|
103
|
+
}) => Promise<void>;
|
|
104
|
+
export declare const setPaymentMethod: SetPaymentMethod;
|
|
105
|
+
declare type PaymentSourceTypes = (StripePayment & WireTransfer) | (StripePayment | WireTransfer);
|
|
106
|
+
export declare type SetPaymentSourceResponse = {
|
|
107
|
+
order: Order;
|
|
108
|
+
paymentSource: PaymentSourceTypes;
|
|
109
|
+
} | null;
|
|
110
|
+
export declare type SetPaymentSource = (args: {
|
|
111
|
+
config?: CommerceLayerConfig;
|
|
112
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
113
|
+
getOrder?: getOrderContext;
|
|
114
|
+
attributes?: Record<string, unknown>;
|
|
115
|
+
order?: Order;
|
|
116
|
+
paymentResource: PaymentResource;
|
|
117
|
+
paymentSourceId?: string;
|
|
118
|
+
customerPaymentSourceId?: string;
|
|
119
|
+
updateOrder?: typeof updateOrder;
|
|
120
|
+
} & PaymentMethodState) => Promise<PaymentSourceType | void>;
|
|
121
|
+
export declare const setPaymentSource: SetPaymentSource;
|
|
122
|
+
export declare type UpdatePaymentSource = (args: {
|
|
123
|
+
id: string;
|
|
124
|
+
attributes: Record<string, any>;
|
|
125
|
+
paymentResource: PaymentResource;
|
|
126
|
+
config?: CommerceLayerConfig;
|
|
127
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
128
|
+
}) => Promise<void>;
|
|
129
|
+
export declare const updatePaymentSource: UpdatePaymentSource;
|
|
130
|
+
export declare type DestroyPaymentSource = (args: {
|
|
131
|
+
paymentSourceId: string;
|
|
132
|
+
paymentResource: PaymentResource;
|
|
133
|
+
dispatch?: Dispatch<PaymentMethodAction>;
|
|
134
|
+
updateOrder?: typeof updateOrder;
|
|
135
|
+
orderId?: string;
|
|
136
|
+
}) => Promise<void>;
|
|
137
|
+
export declare const destroyPaymentSource: DestroyPaymentSource;
|
|
138
|
+
export declare type PaymentMethodConfig = {
|
|
139
|
+
stripePayment?: StripeConfig;
|
|
140
|
+
braintreePayment?: BraintreeConfig;
|
|
141
|
+
wireTransfer?: Partial<WireTransferConfig>;
|
|
142
|
+
paypalPayment?: PaypalConfig;
|
|
143
|
+
adyenPayment?: AdyenPaymentConfig;
|
|
144
|
+
checkoutComPayment?: CheckoutComConfig;
|
|
145
|
+
klarnaPayment?: Pick<AdyenPaymentConfig, 'placeOrderCallback'> & Pick<StripeConfig, 'containerClassName'>;
|
|
146
|
+
};
|
|
147
|
+
declare type SetPaymentMethodConfig = (config: PaymentMethodConfig, dispatch: Dispatch<PaymentMethodAction>) => void;
|
|
148
|
+
export declare const setPaymentMethodConfig: SetPaymentMethodConfig;
|
|
149
|
+
export declare function getPaymentConfig<K extends PaymentResourceKey>(paymentResource: PaymentResource, config: PaymentMethodConfig): PaymentMethodConfig[K];
|
|
150
|
+
declare const paymentMethodReducer: (state: PaymentMethodState, reducer: PaymentMethodAction) => PaymentMethodState;
|
|
151
|
+
export default paymentMethodReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getErrors,{setErrors}from"../utils/getErrors";import getSdk from"../utils/getSdk";import camelCase from"lodash/camelCase";import has from"lodash/has";import isEmpty from"lodash/isEmpty";export function setLoading({loading,dispatch}){dispatch&&dispatch({type:"setLoading",payload:{loading}})}export const setPaymentRef=({ref,dispatch})=>{ref&&dispatch&&dispatch({type:"setPaymentRef",payload:{currentPaymentMethodRef:ref}})},paymentMethodInitialState={errors:[]},setPaymentMethodErrors=(errors,dispatch)=>{dispatch&&dispatch({type:"setErrors",payload:{errors}})},getPaymentMethods=async({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}})},setPaymentMethod=async({config,dispatch,order,paymentMethodId,updateOrder,setOrderErrors,paymentResource})=>{try{if(config&&order&&dispatch&&paymentResource){localStorage.removeItem("_save_payment_source_to_customer_wallet");const attributes={payment_method:getSdk(config).payment_methods.relationship(paymentMethodId)};updateOrder&&await updateOrder({id:order.id,attributes}),dispatch({type:"setPaymentMethods",payload:{currentPaymentMethodId:paymentMethodId,currentPaymentMethodType:paymentResource,errors:[]}}),setOrderErrors&&setOrderErrors([])}}catch(error){const errors=getErrors(error,"orders",paymentResource);console.error("Set payment method",errors)}},setPaymentSource=async({config,dispatch,getOrder,attributes={},order,paymentResource,customerPaymentSourceId,paymentSourceId,updateOrder,errors:currentErrors})=>{try{if(config&&order){let paymentSource;const sdk=getSdk(config);if(customerPaymentSourceId)updateOrder&&await updateOrder({id:order.id,attributes:{_customer_payment_source_id:customerPaymentSourceId}});else{if(paymentSourceId){const attrs=Object.assign({id:paymentSourceId},attributes);paymentSource=await sdk[paymentResource].update(attrs)}else{const attrs=Object.assign(Object.assign({},attributes),{order:sdk.orders.relationship(order.id)});paymentSource=await sdk[paymentResource].create(attrs)}return getOrder&&await getOrder(order.id),dispatch&&dispatch({type:"setPaymentSource",payload:{paymentSource,errors:[]}}),paymentSource}}}catch(error){const errors=getErrors(error,"payment_methods",paymentResource);console.error("Set payment source:",errors),dispatch&&setErrors({currentErrors,newErrors:errors,dispatch})}},updatePaymentSource=async({id,attributes,config,dispatch,paymentResource})=>{if(config)try{const paymentSource=await getSdk(config)[paymentResource].update(Object.assign({id},attributes));dispatch&&dispatch({type:"setPaymentSource",payload:{paymentSource}})}catch(err){console.error("Update payment source:",err)}},destroyPaymentSource=async({paymentSourceId,paymentResource,dispatch})=>{paymentSourceId&&paymentResource&&dispatch&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},setPaymentMethodConfig=(config,dispatch)=>{dispatch({type:"setPaymentMethodConfig",payload:{config}})};export function getPaymentConfig(paymentResource,config){const resource=camelCase(paymentResource).replace("Payments","Payment").replace("Transfers","Transfer");return!isEmpty(config)&&has(config,resource)?config[resource]:void 0}const type=["setErrors","setPaymentMethodConfig","setPaymentMethods","setPaymentSource","setPaymentRef","setLoading"],paymentMethodReducer=(state,reducer)=>baseReducer(state,reducer,type);export default paymentMethodReducer;
|