@commercelayer/react-components 4.3.5 → 4.4.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/ExternalFunction.d.ts +1 -1
- package/lib/cjs/components/ExternalFunction.js +1 -1
- package/lib/cjs/components/MetadataInput.d.ts +1 -1
- package/lib/cjs/components/MetadataInput.js +1 -1
- package/lib/cjs/components/SubmitButton.d.ts +2 -2
- package/lib/cjs/components/SubmitButton.js +1 -1
- package/lib/cjs/components/addresses/Address.d.ts +1 -1
- package/lib/cjs/components/addresses/Address.js +1 -1
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +2 -2
- package/lib/cjs/components/addresses/AddressCountrySelector.js +1 -1
- package/lib/cjs/components/addresses/AddressField.d.ts +3 -3
- package/lib/cjs/components/addresses/AddressField.js +1 -1
- package/lib/cjs/components/addresses/AddressInput.d.ts +2 -2
- package/lib/cjs/components/addresses/AddressInput.js +1 -1
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
- package/lib/cjs/components/addresses/AddressesContainer.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressesEmpty.js +1 -1
- package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
- package/lib/cjs/components/addresses/BillingAddressContainer.js +1 -1
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
- package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
- package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/cjs/components/addresses/SaveAddressesButton.js +1 -1
- package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +1 -1
- package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/cjs/components/auth/CommerceLayer.js +1 -1
- package/lib/cjs/components/customers/CustomerAddressForm.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
- package/lib/cjs/components/customers/CustomerContainer.js +1 -1
- package/lib/cjs/components/customers/CustomerField.d.ts +2 -2
- package/lib/cjs/components/customers/CustomerField.js +1 -1
- package/lib/cjs/components/customers/CustomerInput.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerInput.js +1 -1
- package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerPaymentSource.js +1 -1
- package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.js +1 -1
- package/lib/cjs/components/customers/SaveCustomerButton.d.ts +2 -2
- package/lib/cjs/components/customers/SaveCustomerButton.js +1 -1
- package/lib/cjs/components/errors/Errors.d.ts +1 -1
- package/lib/cjs/components/errors/Errors.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
- package/lib/cjs/components/line_items/LineItem.js +1 -1
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemAmount.js +1 -1
- package/lib/cjs/components/line_items/LineItemCode.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemCode.js +1 -1
- package/lib/cjs/components/line_items/LineItemField.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemField.js +1 -1
- package/lib/cjs/components/line_items/LineItemImage.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemImage.js +1 -1
- package/lib/cjs/components/line_items/LineItemName.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemName.js +1 -1
- package/lib/cjs/components/line_items/LineItemOption.d.ts +3 -3
- package/lib/cjs/components/line_items/LineItemOption.js +1 -1
- package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemOptions.js +1 -1
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemQuantity.js +1 -1
- package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemsCount.js +1 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.js +1 -1
- package/lib/cjs/components/orders/AddToCartButton.d.ts +3 -3
- package/lib/cjs/components/orders/AddToCartButton.js +1 -1
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -1
- package/lib/cjs/components/orders/AdjustmentAmount.js +1 -1
- package/lib/cjs/components/orders/CartLink.d.ts +2 -2
- package/lib/cjs/components/orders/CartLink.js +1 -1
- package/lib/cjs/components/orders/CheckoutLink.d.ts +1 -1
- package/lib/cjs/components/orders/CheckoutLink.js +1 -1
- package/lib/cjs/components/orders/DiscountAmount.d.ts +1 -1
- package/lib/cjs/components/orders/DiscountAmount.js +1 -1
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -1
- package/lib/cjs/components/orders/GiftCardAmount.js +1 -1
- package/lib/cjs/components/orders/OrderContainer.d.ts +1 -1
- package/lib/cjs/components/orders/OrderContainer.js +1 -1
- package/lib/cjs/components/orders/OrderList.d.ts +2 -2
- package/lib/cjs/components/orders/OrderList.js +1 -1
- package/lib/cjs/components/orders/OrderListEmpty.d.ts +1 -1
- package/lib/cjs/components/orders/OrderListEmpty.js +1 -1
- package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +1 -1
- package/lib/cjs/components/orders/OrderListPaginationButtons.js +1 -1
- package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +1 -1
- package/lib/cjs/components/orders/OrderListPaginationInfo.js +1 -1
- package/lib/cjs/components/orders/OrderListRow.js +1 -1
- package/lib/cjs/components/orders/OrderNumber.d.ts +1 -1
- package/lib/cjs/components/orders/OrderNumber.js +1 -1
- package/lib/cjs/components/orders/OrderStorage.d.ts +1 -1
- package/lib/cjs/components/orders/OrderStorage.js +1 -1
- package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +1 -1
- package/lib/cjs/components/orders/PaymentMethodAmount.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderButton.d.ts +2 -2
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +2 -2
- package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/cjs/components/orders/ShippingAmount.d.ts +1 -1
- package/lib/cjs/components/orders/ShippingAmount.js +1 -1
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +1 -1
- package/lib/cjs/components/orders/SubTotalAmount.js +1 -1
- package/lib/cjs/components/orders/TaxesAmount.d.ts +1 -1
- package/lib/cjs/components/orders/TaxesAmount.js +1 -1
- package/lib/cjs/components/orders/TotalAmount.d.ts +1 -1
- package/lib/cjs/components/orders/TotalAmount.js +1 -1
- package/lib/cjs/components/parcels/ParcelField.d.ts +2 -2
- package/lib/cjs/components/parcels/ParcelField.js +1 -1
- package/lib/cjs/components/parcels/ParcelLineItem.js +1 -1
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +2 -2
- package/lib/cjs/components/parcels/ParcelLineItemField.js +1 -1
- package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +1 -1
- package/lib/cjs/components/parcels/ParcelLineItemsCount.js +1 -1
- package/lib/cjs/components/parcels/Parcels.js +1 -1
- package/lib/cjs/components/parcels/ParcelsCount.d.ts +1 -1
- package/lib/cjs/components/parcels/ParcelsCount.js +1 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/ExternalGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/KlarnaGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/PaymentGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +14 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +2 -2
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -5
- package/lib/cjs/components/payment_source/BraintreePayment.js +1 -1
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +3 -3
- package/lib/cjs/components/payment_source/CheckoutComPayment.js +1 -1
- package/lib/cjs/components/payment_source/ExternalPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/ExternalPayment.js +1 -1
- package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/KlarnaPayment.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSource.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceDetail.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +1 -1
- package/lib/cjs/components/payment_source/PaypalPayment.d.ts +1 -1
- package/lib/cjs/components/payment_source/PaypalPayment.js +1 -1
- package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +5 -0
- package/lib/cjs/components/payment_source/StripeExpressPayment.js +1 -0
- package/lib/cjs/components/payment_source/StripePayment.d.ts +8 -5
- package/lib/cjs/components/payment_source/StripePayment.js +1 -1
- package/lib/cjs/components/payment_source/WireTransferPayment.js +1 -1
- package/lib/cjs/components/prices/Price.d.ts +2 -2
- package/lib/cjs/components/prices/Price.js +1 -1
- package/lib/cjs/components/prices/PricesContainer.d.ts +1 -1
- package/lib/cjs/components/prices/PricesContainer.js +1 -1
- package/lib/cjs/components/shipments/Shipment.d.ts +1 -1
- package/lib/cjs/components/shipments/Shipment.js +1 -1
- package/lib/cjs/components/shipments/ShipmentField.d.ts +1 -1
- package/lib/cjs/components/shipments/ShipmentField.js +1 -1
- package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +1 -1
- package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +1 -1
- package/lib/cjs/components/shipments/ShipmentsCount.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethod.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/cjs/components/skus/AvailabilityContainer.d.ts +1 -1
- package/lib/cjs/components/skus/AvailabilityContainer.js +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
- package/lib/cjs/components/skus/SkuField.d.ts +2 -2
- package/lib/cjs/components/skus/SkuField.js +1 -1
- package/lib/cjs/components/skus/SkuList.d.ts +1 -1
- package/lib/cjs/components/skus/SkuListsContainer.d.ts +1 -1
- package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
- package/lib/cjs/components/skus/Skus.d.ts +1 -1
- package/lib/cjs/components/skus/Skus.js +1 -1
- package/lib/cjs/components/skus/SkusContainer.d.ts +1 -1
- package/lib/cjs/components/skus/SkusContainer.js +1 -1
- package/lib/cjs/components/stock_transfers/StockTransfer.js +1 -1
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +2 -2
- package/lib/cjs/components/stock_transfers/StockTransferField.js +1 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/cjs/components/utils/BaseField.d.ts +1 -1
- package/lib/cjs/components/utils/BaseField.js +1 -1
- package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
- package/lib/cjs/components/utils/BaseInput.js +1 -1
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +3 -3
- package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
- package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
- package/lib/cjs/components/utils/BaseSelect.js +1 -1
- package/lib/cjs/components/utils/ErrorBoundary.d.ts +1 -1
- package/lib/cjs/components/utils/ErrorBoundary.js +1 -1
- package/lib/cjs/components/utils/GenericFieldComponent.d.ts +7 -7
- package/lib/cjs/components/utils/GenericFieldComponent.js +1 -1
- package/lib/cjs/components/utils/Parent.d.ts +1 -1
- package/lib/cjs/components/utils/Parent.js +1 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +3 -3
- package/lib/cjs/components/utils/PaymentCardsTemplate.js +1 -1
- package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
- package/lib/cjs/components/utils/PriceTemplate.js +1 -1
- package/lib/cjs/components/utils/getAllErrors.d.ts +3 -3
- package/lib/cjs/components/utils/getAllErrors.js +1 -1
- package/lib/cjs/context/AddressChildrenContext.d.ts +1 -1
- package/lib/cjs/context/AddressContext.d.ts +2 -2
- package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
- package/lib/cjs/context/BillingAddressFormContext.d.ts +5 -7
- package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/cjs/context/CustomerAddressFormContext.d.ts +7 -9
- package/lib/cjs/context/CustomerContext.d.ts +1 -1
- package/lib/cjs/context/CustomerPaymentSourceContext.d.ts +1 -1
- package/lib/cjs/context/ExternalFunctionContext.js +1 -1
- package/lib/cjs/context/GiftCardContext.d.ts +2 -2
- package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/cjs/context/LineItemContext.d.ts +2 -2
- package/lib/cjs/context/LineItemOptionChildrenContext.d.ts +5 -2
- package/lib/cjs/context/OrderContext.d.ts +3 -3
- package/lib/cjs/context/OrderContext.js +1 -1
- package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
- package/lib/cjs/context/OrderListPaginationContext.d.ts +1 -1
- package/lib/cjs/context/PaymentMethodChildrenContext.d.ts +2 -1
- package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
- package/lib/cjs/context/PlaceOrderContext.d.ts +2 -2
- package/lib/cjs/context/PricesContext.d.ts +1 -1
- package/lib/cjs/context/ShipmentContext.d.ts +1 -1
- package/lib/cjs/context/ShippingAddressContext.d.ts +1 -1
- package/lib/cjs/context/ShippingAddressFormContext.d.ts +1 -1
- package/lib/cjs/context/ShippingMethodChildrenContext.d.ts +1 -1
- package/lib/cjs/context/SkuChildrenContext.d.ts +1 -1
- package/lib/cjs/context/SkuContext.d.ts +1 -1
- package/lib/cjs/context/StockTransferChildrenContext.d.ts +1 -1
- package/lib/cjs/hooks/useOrderContainer.js +1 -1
- package/lib/cjs/reducers/AddressReducer.d.ts +6 -6
- package/lib/cjs/reducers/AddressReducer.js +1 -1
- package/lib/cjs/reducers/AvailabilityReducer.d.ts +4 -4
- package/lib/cjs/reducers/AvailabilityReducer.js +1 -1
- package/lib/cjs/reducers/BillingAddressReducer.d.ts +4 -4
- package/lib/cjs/reducers/BillingAddressReducer.js +1 -1
- package/lib/cjs/reducers/CustomerReducer.d.ts +4 -4
- package/lib/cjs/reducers/CustomerReducer.js +1 -1
- package/lib/cjs/reducers/GiftCardReducer.d.ts +6 -6
- package/lib/cjs/reducers/GiftCardReducer.js +1 -1
- package/lib/cjs/reducers/LineItemReducer.d.ts +6 -6
- package/lib/cjs/reducers/LineItemReducer.js +1 -1
- package/lib/cjs/reducers/OrderReducer.d.ts +6 -6
- package/lib/cjs/reducers/OrderReducer.js +1 -1
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +16 -12
- package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
- package/lib/cjs/reducers/PlaceOrderReducer.d.ts +4 -1
- package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
- package/lib/cjs/reducers/PriceReducer.d.ts +6 -8
- package/lib/cjs/reducers/PriceReducer.js +1 -1
- package/lib/cjs/reducers/ShipmentReducer.d.ts +5 -5
- package/lib/cjs/reducers/ShipmentReducer.js +1 -1
- package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
- package/lib/cjs/reducers/ShippingAddressReducer.js +1 -1
- package/lib/cjs/reducers/SkuListsReducer.d.ts +2 -2
- package/lib/cjs/reducers/SkuListsReducer.js +1 -1
- package/lib/cjs/reducers/SkuReducer.d.ts +4 -4
- package/lib/cjs/reducers/SkuReducer.js +1 -1
- package/lib/cjs/typings/errors.d.ts +1 -1
- package/lib/cjs/typings/index.d.ts +7 -11
- package/lib/cjs/typings/index.js +1 -1
- package/lib/cjs/utils/PropsType.d.ts +2 -2
- package/lib/cjs/utils/addressesManager.d.ts +3 -3
- package/lib/cjs/utils/baseReducer.d.ts +1 -1
- package/lib/cjs/utils/baseReducer.js +1 -1
- package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
- package/lib/cjs/utils/customMessages.d.ts +1 -1
- package/lib/cjs/utils/expressPaymentHelper.d.ts +83 -0
- package/lib/cjs/utils/expressPaymentHelper.js +1 -0
- package/lib/cjs/utils/filterChildren.d.ts +1 -1
- package/lib/cjs/utils/getCardDetails.d.ts +3 -3
- package/lib/cjs/utils/getCardDetails.js +1 -1
- package/lib/cjs/utils/getErrors.d.ts +4 -3
- package/lib/cjs/utils/getErrors.js +1 -1
- package/lib/cjs/utils/getLoaderComponent.d.ts +1 -1
- package/lib/cjs/utils/getPaymentAttributes.d.ts +3 -3
- package/lib/cjs/utils/getPrices.d.ts +2 -2
- package/lib/cjs/utils/getPrices.js +1 -1
- package/lib/cjs/utils/getSdk.d.ts +1 -1
- package/lib/cjs/utils/getSdk.js +1 -1
- package/lib/cjs/utils/getSkus.d.ts +1 -1
- package/lib/cjs/utils/hooks/useCustomContext.d.ts +1 -1
- package/lib/cjs/utils/icons.js +1 -1
- package/lib/cjs/utils/isEmpty.d.ts +1 -0
- package/lib/cjs/utils/isEmpty.js +1 -0
- package/lib/cjs/utils/localStorage.js +1 -1
- package/lib/cjs/utils/promisify.js +1 -1
- package/lib/cjs/utils/shipments.d.ts +1 -1
- package/lib/cjs/utils/shipments.js +1 -1
- package/lib/cjs/utils/snakeToCamelCase.js +1 -1
- package/lib/cjs/utils/validateFormFields.d.ts +6 -6
- package/lib/cjs/utils/validateFormFields.js +1 -1
- package/lib/esm/components/ExternalFunction.d.ts +1 -1
- package/lib/esm/components/MetadataInput.d.ts +1 -1
- package/lib/esm/components/SubmitButton.d.ts +2 -2
- package/lib/esm/components/addresses/Address.d.ts +1 -1
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +2 -2
- package/lib/esm/components/addresses/AddressField.d.ts +3 -3
- package/lib/esm/components/addresses/AddressInput.d.ts +2 -2
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -1
- package/lib/esm/components/addresses/AddressesContainer.d.ts +1 -1
- package/lib/esm/components/addresses/AddressesContainer.js +1 -1
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
- package/lib/esm/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +1 -1
- package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerAddressForm.d.ts +1 -1
- package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerContainer.js +1 -1
- package/lib/esm/components/customers/CustomerField.d.ts +2 -2
- package/lib/esm/components/customers/CustomerField.js +1 -1
- package/lib/esm/components/customers/CustomerInput.d.ts +1 -1
- package/lib/esm/components/customers/CustomerPaymentSource.d.ts +1 -1
- package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
- package/lib/esm/components/customers/SaveCustomerButton.d.ts +2 -2
- package/lib/esm/components/errors/Errors.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCard.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemCode.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemField.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemField.js +1 -1
- package/lib/esm/components/line_items/LineItemImage.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemName.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemOption.d.ts +3 -3
- package/lib/esm/components/line_items/LineItemOption.js +1 -1
- package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
- package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +1 -1
- package/lib/esm/components/orders/AddToCartButton.d.ts +3 -3
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -1
- package/lib/esm/components/orders/CartLink.d.ts +2 -2
- package/lib/esm/components/orders/CheckoutLink.d.ts +1 -1
- package/lib/esm/components/orders/DiscountAmount.d.ts +1 -1
- package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -1
- package/lib/esm/components/orders/OrderContainer.d.ts +1 -1
- package/lib/esm/components/orders/OrderContainer.js +1 -1
- package/lib/esm/components/orders/OrderList.d.ts +2 -2
- package/lib/esm/components/orders/OrderListEmpty.d.ts +1 -1
- package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +1 -1
- package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +1 -1
- package/lib/esm/components/orders/OrderNumber.d.ts +1 -1
- package/lib/esm/components/orders/OrderStorage.d.ts +1 -1
- package/lib/esm/components/orders/PaymentMethodAmount.d.ts +1 -1
- package/lib/esm/components/orders/PlaceOrderButton.d.ts +2 -2
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/orders/PlaceOrderContainer.d.ts +2 -2
- package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -1
- package/lib/esm/components/orders/ShippingAmount.d.ts +1 -1
- package/lib/esm/components/orders/SubTotalAmount.d.ts +1 -1
- package/lib/esm/components/orders/TaxesAmount.d.ts +1 -1
- package/lib/esm/components/orders/TotalAmount.d.ts +1 -1
- package/lib/esm/components/parcels/ParcelField.d.ts +2 -2
- package/lib/esm/components/parcels/ParcelField.js +1 -1
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +2 -2
- package/lib/esm/components/parcels/ParcelLineItemField.js +1 -1
- package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +1 -1
- package/lib/esm/components/parcels/ParcelsCount.d.ts +1 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/PaymentGateway.js +1 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +14 -1
- package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +2 -2
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -5
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +3 -3
- package/lib/esm/components/payment_source/ExternalPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/KlarnaPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/KlarnaPayment.js +1 -1
- package/lib/esm/components/payment_source/PaymentSource.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSource.js +1 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSourceBrandName.js +1 -1
- package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
- package/lib/esm/components/payment_source/PaypalPayment.d.ts +1 -1
- package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +5 -0
- package/lib/esm/components/payment_source/StripeExpressPayment.js +1 -0
- package/lib/esm/components/payment_source/StripePayment.d.ts +8 -5
- package/lib/esm/components/payment_source/StripePayment.js +1 -1
- package/lib/esm/components/prices/Price.d.ts +2 -2
- package/lib/esm/components/prices/PricesContainer.d.ts +1 -1
- package/lib/esm/components/prices/PricesContainer.js +1 -1
- package/lib/esm/components/shipments/Shipment.d.ts +1 -1
- package/lib/esm/components/shipments/ShipmentField.d.ts +1 -1
- package/lib/esm/components/shipments/ShipmentsContainer.d.ts +1 -1
- package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
- package/lib/esm/components/skus/AvailabilityContainer.d.ts +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/esm/components/skus/SkuField.d.ts +2 -2
- package/lib/esm/components/skus/SkuField.js +1 -1
- package/lib/esm/components/skus/SkuList.d.ts +1 -1
- package/lib/esm/components/skus/SkuListsContainer.d.ts +1 -1
- package/lib/esm/components/skus/Skus.d.ts +1 -1
- package/lib/esm/components/skus/SkusContainer.d.ts +1 -1
- package/lib/esm/components/skus/SkusContainer.js +1 -1
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +2 -2
- package/lib/esm/components/stock_transfers/StockTransferField.js +1 -1
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/esm/components/utils/BaseField.d.ts +1 -1
- package/lib/esm/components/utils/BaseInput.d.ts +1 -1
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +3 -3
- package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
- package/lib/esm/components/utils/ErrorBoundary.d.ts +1 -1
- package/lib/esm/components/utils/GenericFieldComponent.d.ts +7 -7
- package/lib/esm/components/utils/Parent.d.ts +1 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +3 -3
- package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
- package/lib/esm/components/utils/getAllErrors.d.ts +3 -3
- package/lib/esm/context/AddressChildrenContext.d.ts +1 -1
- package/lib/esm/context/AddressContext.d.ts +2 -2
- package/lib/esm/context/BillingAddressContext.d.ts +1 -1
- package/lib/esm/context/BillingAddressFormContext.d.ts +5 -7
- package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/esm/context/CustomerAddressFormContext.d.ts +7 -9
- package/lib/esm/context/CustomerContext.d.ts +1 -1
- package/lib/esm/context/CustomerPaymentSourceContext.d.ts +1 -1
- package/lib/esm/context/GiftCardContext.d.ts +2 -2
- package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/esm/context/LineItemContext.d.ts +2 -2
- package/lib/esm/context/LineItemOptionChildrenContext.d.ts +5 -2
- package/lib/esm/context/OrderContext.d.ts +3 -3
- package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
- package/lib/esm/context/OrderListPaginationContext.d.ts +1 -1
- package/lib/esm/context/PaymentMethodChildrenContext.d.ts +2 -1
- package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
- package/lib/esm/context/PlaceOrderContext.d.ts +2 -2
- package/lib/esm/context/PricesContext.d.ts +1 -1
- package/lib/esm/context/ShipmentContext.d.ts +1 -1
- package/lib/esm/context/ShippingAddressContext.d.ts +1 -1
- package/lib/esm/context/ShippingAddressFormContext.d.ts +1 -1
- package/lib/esm/context/ShippingMethodChildrenContext.d.ts +1 -1
- package/lib/esm/context/SkuChildrenContext.d.ts +1 -1
- package/lib/esm/context/SkuContext.d.ts +1 -1
- package/lib/esm/context/StockTransferChildrenContext.d.ts +1 -1
- package/lib/esm/reducers/AddressReducer.d.ts +6 -6
- package/lib/esm/reducers/AvailabilityReducer.d.ts +4 -4
- package/lib/esm/reducers/BillingAddressReducer.d.ts +4 -4
- package/lib/esm/reducers/CustomerReducer.d.ts +4 -4
- package/lib/esm/reducers/GiftCardReducer.d.ts +6 -6
- package/lib/esm/reducers/LineItemReducer.d.ts +6 -6
- package/lib/esm/reducers/OrderReducer.d.ts +6 -6
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +16 -12
- package/lib/esm/reducers/PlaceOrderReducer.d.ts +4 -1
- package/lib/esm/reducers/PriceReducer.d.ts +6 -8
- package/lib/esm/reducers/ShipmentReducer.d.ts +5 -5
- package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
- package/lib/esm/reducers/SkuListsReducer.d.ts +2 -2
- package/lib/esm/reducers/SkuReducer.d.ts +4 -4
- package/lib/esm/typings/errors.d.ts +1 -1
- package/lib/esm/typings/index.d.ts +7 -11
- package/lib/esm/utils/PropsType.d.ts +2 -2
- package/lib/esm/utils/addressesManager.d.ts +3 -3
- package/lib/esm/utils/baseReducer.d.ts +1 -1
- package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
- package/lib/esm/utils/customMessages.d.ts +1 -1
- package/lib/esm/utils/expressPaymentHelper.d.ts +83 -0
- package/lib/esm/utils/expressPaymentHelper.js +1 -0
- package/lib/esm/utils/filterChildren.d.ts +1 -1
- package/lib/esm/utils/getCardDetails.d.ts +3 -3
- package/lib/esm/utils/getCardDetails.js +1 -1
- package/lib/esm/utils/getErrors.d.ts +4 -3
- package/lib/esm/utils/getLoaderComponent.d.ts +1 -1
- package/lib/esm/utils/getPaymentAttributes.d.ts +3 -3
- package/lib/esm/utils/getPrices.d.ts +2 -2
- package/lib/esm/utils/getSdk.d.ts +1 -1
- package/lib/esm/utils/getSkus.d.ts +1 -1
- package/lib/esm/utils/hooks/useCustomContext.d.ts +1 -1
- package/lib/esm/utils/isEmpty.d.ts +1 -0
- package/lib/esm/utils/isEmpty.js +1 -0
- package/lib/esm/utils/localStorage.js +1 -1
- package/lib/esm/utils/shipments.d.ts +1 -1
- package/lib/esm/utils/validateFormFields.d.ts +6 -6
- package/lib/esm/utils/validateFormFields.js +1 -1
- package/package.json +19 -19
- package/lib/tsconfig.prod.esm.tsbuildinfo +0 -1
- package/lib/tsconfig.prod.tsbuildinfo +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { BillingAddressState } from '../reducers/BillingAddressReducer';
|
|
2
|
+
import { type BillingAddressState } from '../reducers/BillingAddressReducer';
|
|
3
3
|
type DefaultContext = {
|
|
4
4
|
setBillingAddress?: (id: string, options?: {
|
|
5
5
|
customerAddressId: string;
|
|
@@ -4,13 +4,11 @@ export type AddressValuesKeys = `${keyof Address}` | `billing_address_${keyof Ad
|
|
|
4
4
|
export interface DefaultContextAddress {
|
|
5
5
|
validation?: void;
|
|
6
6
|
setValue?: (name: AddressValuesKeys, value: string | number | readonly string[]) => void;
|
|
7
|
-
errors?: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
};
|
|
7
|
+
errors?: Record<string, {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
error: boolean;
|
|
11
|
+
}>;
|
|
14
12
|
errorClassName?: string;
|
|
15
13
|
requiresBillingInfo?: boolean;
|
|
16
14
|
resetField?: (name: string) => void;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AddressCountrySelectName, AddressInputName } from '../typings/index';
|
|
3
|
-
import { AddressField } from '../reducers/AddressReducer';
|
|
2
|
+
import { type AddressCountrySelectName, type AddressInputName } from '../typings/index';
|
|
3
|
+
import { type AddressField } from '../reducers/AddressReducer';
|
|
4
4
|
export interface DefaultContextAddress {
|
|
5
5
|
validation?: void;
|
|
6
6
|
setValue?: (name: AddressField | AddressInputName | AddressCountrySelectName, value: any) => void;
|
|
7
|
-
errors?: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
};
|
|
7
|
+
errors?: Record<string, {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
error: boolean;
|
|
11
|
+
}>;
|
|
14
12
|
errorClassName?: string;
|
|
15
13
|
requiresBillingInfo?: boolean;
|
|
16
14
|
resetField?: (name: string) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SetCustomerErrors, deleteCustomerAddress, CustomerState, getCustomerPaymentSources, setCustomerEmail, TCustomerAddress, getCustomerAddresses } from '../reducers/CustomerReducer';
|
|
2
|
+
import { type SetCustomerErrors, type deleteCustomerAddress, type CustomerState, type getCustomerPaymentSources, type setCustomerEmail, type TCustomerAddress, type getCustomerAddresses } from '../reducers/CustomerReducer';
|
|
3
3
|
export type InitialCustomerContext = Partial<{
|
|
4
4
|
saveCustomerUser: (customerEmail: string) => Promise<void>;
|
|
5
5
|
setCustomerErrors: SetCustomerErrors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.callExternalFunction=void 0;const tslib_1=require("tslib"),react_1=require("react"),axios_1=tslib_1.__importDefault(require("axios")),callExternalFunction=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.callExternalFunction=void 0;const tslib_1=require("tslib"),react_1=require("react"),axios_1=tslib_1.__importDefault(require("axios")),callExternalFunction=({url,data})=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){return yield axios_1.default.post(url,data)});exports.callExternalFunction=callExternalFunction;const ExternalFunctionContext=(0,react_1.createContext)({url:null,callExternalFunction:exports.callExternalFunction});exports.default=ExternalFunctionContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { GiftCardState, GiftCardRecipientI, GiftCardI } from '../reducers/GiftCardReducer';
|
|
3
|
-
import { BaseError } from '../typings/errors';
|
|
2
|
+
import { type GiftCardState, type GiftCardRecipientI, type GiftCardI } from '../reducers/GiftCardReducer';
|
|
3
|
+
import { type BaseError } from '../typings/errors';
|
|
4
4
|
export interface GCContext extends GiftCardState {
|
|
5
5
|
addGiftCardRecipient: (values: GiftCardRecipientI & object) => void;
|
|
6
6
|
addGiftCard: (values: GiftCardI & object) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { LineItemState } from '../reducers/LineItemReducer';
|
|
3
|
-
import { LineItem } from '@commercelayer/sdk';
|
|
2
|
+
import { type LineItemState } from '../reducers/LineItemReducer';
|
|
3
|
+
import { type LineItem } from '@commercelayer/sdk';
|
|
4
4
|
export interface LineItemContextValue extends LineItemState {
|
|
5
5
|
lineItems?: LineItem[] | undefined;
|
|
6
6
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { LineItemOption } from '@commercelayer/sdk';
|
|
2
|
+
import type { LineItemOption } from '@commercelayer/sdk';
|
|
3
|
+
export interface TLineItemOptions extends LineItemOption {
|
|
4
|
+
options?: Record<string, string>;
|
|
5
|
+
}
|
|
3
6
|
export interface InitialLineItemContext {
|
|
4
|
-
lineItemOption: Partial<
|
|
7
|
+
lineItemOption: Partial<TLineItemOptions>;
|
|
5
8
|
showAll?: boolean;
|
|
6
9
|
}
|
|
7
10
|
declare const LineItemOptionChildrenContext: import("react").Context<InitialLineItemContext>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Order } from '@commercelayer/sdk';
|
|
3
|
-
import { OrderState, CreateOrder, SaveAddressToCustomerAddressBook, setGiftCardOrCouponCode, removeGiftCardOrCouponCode, addResourceToInclude, updateOrder, getOrderContext, addToCart } from '../reducers/OrderReducer';
|
|
4
|
-
import { BaseError } from '../typings/errors';
|
|
2
|
+
import { type Order } from '@commercelayer/sdk';
|
|
3
|
+
import { type OrderState, type CreateOrder, type SaveAddressToCustomerAddressBook, setGiftCardOrCouponCode, removeGiftCardOrCouponCode, addResourceToInclude, updateOrder, type getOrderContext, type addToCart } from '../reducers/OrderReducer';
|
|
4
|
+
import { type BaseError } from '../typings/errors';
|
|
5
5
|
interface DefaultContext extends OrderState {
|
|
6
6
|
createOrder: CreateOrder;
|
|
7
7
|
addToCart?: typeof addToCart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultOrderContext=void 0;const react_1=require("react"),OrderReducer_1=require("../reducers/OrderReducer");exports.defaultOrderContext={createOrder:OrderReducer_1.createOrder,setOrderErrors:()=>{},setOrder:()=>{},setGiftCardOrCouponCode:OrderReducer_1.setGiftCardOrCouponCode,removeGiftCardOrCouponCode:OrderReducer_1.removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook:OrderReducer_1.saveAddressToCustomerAddressBook,addResourceToInclude:OrderReducer_1.addResourceToInclude,getOrder:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultOrderContext=void 0;const tslib_1=require("tslib"),react_1=require("react"),OrderReducer_1=require("../reducers/OrderReducer");exports.defaultOrderContext={createOrder:OrderReducer_1.createOrder,setOrderErrors:()=>{},setOrder:()=>{},setGiftCardOrCouponCode:OrderReducer_1.setGiftCardOrCouponCode,removeGiftCardOrCouponCode:OrderReducer_1.removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook:OrderReducer_1.saveAddressToCustomerAddressBook,addResourceToInclude:OrderReducer_1.addResourceToInclude,getOrder:()=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){}),updateOrder:OrderReducer_1.updateOrder};const OrderContext=(0,react_1.createContext)(exports.defaultOrderContext);exports.default=OrderContext;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PaymentMethod } from '@commercelayer/sdk';
|
|
2
|
+
import { type PaymentMethod } from '@commercelayer/sdk';
|
|
3
3
|
export interface InitialPaymentMethodChildrenContext {
|
|
4
4
|
payment?: PaymentMethod;
|
|
5
5
|
clickableContainer?: boolean;
|
|
6
6
|
paymentSelected?: string;
|
|
7
7
|
setPaymentSelected?: (paymentId: string) => void;
|
|
8
|
+
expressPayments?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const PaymentMethodChildrenContext: import("react").Context<InitialPaymentMethodChildrenContext>;
|
|
10
11
|
export default PaymentMethodChildrenContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { UpdatePaymentSource, PaymentMethodState, SetPaymentMethodErrors, SetPaymentSource, setPaymentMethod, DestroyPaymentSource, SetPaymentRef, setLoading } from '../reducers/PaymentMethodReducer';
|
|
2
|
+
import { type UpdatePaymentSource, type PaymentMethodState, type SetPaymentMethodErrors, type SetPaymentSource, setPaymentMethod, type DestroyPaymentSource, type SetPaymentRef, setLoading } from '../reducers/PaymentMethodReducer';
|
|
3
3
|
type DefaultContext = {
|
|
4
4
|
setPaymentMethodErrors: SetPaymentMethodErrors;
|
|
5
5
|
setPaymentMethod: typeof setPaymentMethod;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { PlaceOrderState, setPlaceOrder, setPlaceOrderErrors } from '../reducers/PlaceOrderReducer';
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import { type PlaceOrderState, type setPlaceOrder, setPlaceOrderErrors } from '../reducers/PlaceOrderReducer';
|
|
3
3
|
type DefaultContext = {
|
|
4
4
|
setPlaceOrderErrors?: typeof setPlaceOrderErrors;
|
|
5
5
|
setPlaceOrder?: typeof setPlaceOrder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ShipmentState, SetShipmentErrors, setShippingMethod } from '../reducers/ShipmentReducer';
|
|
2
|
+
import { type ShipmentState, type SetShipmentErrors, type setShippingMethod } from '../reducers/ShipmentReducer';
|
|
3
3
|
type DefaultContext = {
|
|
4
4
|
setShipmentErrors: SetShipmentErrors;
|
|
5
5
|
setShippingMethod?: (shipmentId: string, shippingMethodId: string) => ReturnType<typeof setShippingMethod>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ShippingAddressState } from '../reducers/ShippingAddressReducer';
|
|
2
|
+
import { type ShippingAddressState } from '../reducers/ShippingAddressReducer';
|
|
3
3
|
type DefaultContext = {
|
|
4
4
|
setShippingAddress?: (id: string, options?: {
|
|
5
5
|
customerAddressId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DefaultContextAddress } from './BillingAddressFormContext';
|
|
2
|
+
import { type DefaultContextAddress } from './BillingAddressFormContext';
|
|
3
3
|
declare const ShippingAddressFormContext: import("react").Context<DefaultContextAddress>;
|
|
4
4
|
export default ShippingAddressFormContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DeliveryLeadTime, ShippingMethod } from '@commercelayer/sdk';
|
|
2
|
+
import { type DeliveryLeadTime, type ShippingMethod } from '@commercelayer/sdk';
|
|
3
3
|
export interface InitialShippingMethodContext {
|
|
4
4
|
shippingMethod?: ShippingMethod;
|
|
5
5
|
deliveryLeadTimeForShipment?: DeliveryLeadTime;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SkuState } from '../reducers/SkuReducer';
|
|
2
|
+
import { type SkuState } from '../reducers/SkuReducer';
|
|
3
3
|
export type SkuContextValue = SkuState;
|
|
4
4
|
declare const SkuContext: import("react").Context<Partial<{
|
|
5
5
|
skus: import("@commercelayer/sdk/lib/cjs/resources/skus").Sku[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useOrderContainer=void 0;const tslib_1=require("tslib"),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),react_1=require("react");function useOrderContainer(){const ctx=(0,react_1.useContext)(OrderContext_1.default);if("order"in ctx)return{order:ctx.order,reloadOrder:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useOrderContainer=void 0;const tslib_1=require("tslib"),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),react_1=require("react");function useOrderContainer(){const ctx=(0,react_1.useContext)(OrderContext_1.default);if("order"in ctx)return{order:ctx.order,reloadOrder:()=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b;if(!((_a=ctx?.order)===null||_a===void 0)&&_a.id)return yield ctx?.getOrder((_b=ctx?.order)===null||_b===void 0?void 0:_b.id)})};throw new Error("Cannot use `useOrderContainer` outside of <OrderContainer/>")}exports.useOrderContainer=useOrderContainer,exports.default=useOrderContainer;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { BaseError } from '../typings/errors';
|
|
3
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
1
|
+
import { type Dispatch } from 'react';
|
|
2
|
+
import { type BaseError } from '../typings/errors';
|
|
3
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
4
|
import type { Address, AddressCreate, Order } from '@commercelayer/sdk';
|
|
5
|
-
import { updateOrder } from './OrderReducer';
|
|
6
|
-
import { TCustomerAddress } from './CustomerReducer';
|
|
7
|
-
import { TResourceError } from '../components/errors/Errors';
|
|
5
|
+
import { type updateOrder } from './OrderReducer';
|
|
6
|
+
import { type TCustomerAddress } from './CustomerReducer';
|
|
7
|
+
import { type TResourceError } from '../components/errors/Errors';
|
|
8
8
|
export type AddressActionType = 'setErrors' | 'setAddress' | 'setShipToDifferentAddress' | 'setCloneAddress' | 'cleanup';
|
|
9
9
|
export type AddressField = 'city' | 'company' | 'country_code' | 'first_name' | 'last_name' | 'line_1' | 'line_2' | 'phone' | 'state_code' | 'zip_code' | 'billing_info';
|
|
10
10
|
export type AddressFieldView = AddressField | 'full_address' | 'full_name';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.saveAddresses=exports.setCloneAddress=exports.setAddress=exports.setAddressErrors=exports.addressInitialState=exports.addressFields=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),camelCase_1=tslib_1.__importDefault(require("lodash/camelCase"));exports.addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"],exports.addressInitialState={errors:[]};const 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}})};exports.setAddressErrors=setAddressErrors;const setAddress=({values,resource,dispatch})=>{dispatch&&dispatch({type:"setAddress",payload:{[`${resource}`]:values}})};exports.setAddress=setAddress;const setCloneAddress=(id,resource,dispatch)=>{dispatch({type:"setCloneAddress",payload:{[`${(0,camelCase_1.default)(resource)}Id`]:id}})};exports.setCloneAddress=setCloneAddress;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.saveAddresses=exports.setCloneAddress=exports.setAddress=exports.setAddressErrors=exports.addressInitialState=exports.addressFields=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),camelCase_1=tslib_1.__importDefault(require("lodash/camelCase"));exports.addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"],exports.addressInitialState={errors:[]};const 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}})};exports.setAddressErrors=setAddressErrors;const setAddress=({values,resource,dispatch})=>{dispatch&&dispatch({type:"setAddress",payload:{[`${resource}`]:values}})};exports.setAddress=setAddress;const setCloneAddress=(id,resource,dispatch)=>{dispatch({type:"setCloneAddress",payload:{[`${(0,camelCase_1.default)(resource)}Id`]:id}})};exports.setCloneAddress=setCloneAddress;function saveAddresses({config,updateOrder,order,state,customerEmail}){var _a,_b,_c;return tslib_1.__awaiter(this,void 0,void 0,function*(){const{shipToDifferentAddress,billing_address:billingAddress,shipping_address:shippingAddress,billingAddressId,shippingAddressId}=state;try{const sdk=(0,getSdk_1.default)(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,customer_email:customerEmail};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),!(0,isEmpty_1.default)(billingAddress)&&billingAddress){delete orderAttributes._billing_address_clone_id,delete orderAttributes._shipping_address_clone_id,orderAttributes._shipping_address_same_as_billing=!0;const address=yield sdk.addresses.create(billingAddress);orderAttributes.billing_address=sdk.addresses.relationship(address.id)}if(shipToDifferentAddress&&(delete orderAttributes._shipping_address_same_as_billing,shippingAddressId&&(orderAttributes._shipping_address_clone_id=shippingAddressId),!(0,isEmpty_1.default)(shippingAddress)&&shippingAddress)){delete orderAttributes._shipping_address_clone_id;const address=yield sdk.addresses.create(shippingAddress);orderAttributes.shipping_address=sdk.addresses.relationship(address.id)}if(!(0,isEmpty_1.default)(orderAttributes)&&updateOrder){const orderUpdated=yield updateOrder({id:order.id,attributes:orderAttributes});return{success:!0,order:orderUpdated?.order}}}return{success:!1}}catch(error){return console.error(error),{success:!1,error}}})}exports.saveAddresses=saveAddresses;const type=["setErrors","setAddress","setShipToDifferentAddress","setCloneAddress","cleanup"],addressReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=addressReducer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseError } from '../typings/errors';
|
|
2
|
-
import { Sku } from '@commercelayer/sdk';
|
|
3
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
|
-
import { Dispatch } from 'react';
|
|
1
|
+
import { type BaseError } from '../typings/errors';
|
|
2
|
+
import { type Sku } from '@commercelayer/sdk';
|
|
3
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
|
+
import { type Dispatch } from 'react';
|
|
5
5
|
export interface DeliveryLeadTime {
|
|
6
6
|
shipping_method: {
|
|
7
7
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getAvailability=exports.availabilityInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.availabilityInitialState={};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getAvailability=exports.availabilityInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.availabilityInitialState={};function getAvailability({skuCode,dispatch,config}){var _a;return tslib_1.__awaiter(this,void 0,void 0,function*(){const sdk=(0,getSdk_1.default)(config);try{const[sku]=yield sdk.skus.list({fields:{skus:["id"]},filters:{code_in:skuCode}});if(sku){const skuInventory=yield 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,skuCode})})}}catch(error){console.error("Get SKU availability",error)}})}exports.getAvailability=getAvailability;const typeAction=["setAvailability","setErrors"],availabilityReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,typeAction);exports.default=availabilityReducer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
-
import { Order } from '@commercelayer/sdk';
|
|
4
|
-
import { AddressResource } from './AddressReducer';
|
|
1
|
+
import { type Dispatch } from 'react';
|
|
2
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
+
import { type Order } from '@commercelayer/sdk';
|
|
4
|
+
import { type AddressResource } from './AddressReducer';
|
|
5
5
|
export type BillingAddressActionType = 'setBillingAddress' | 'setBillingCustomerAddressId' | 'cleanup';
|
|
6
6
|
export interface BillingAddressActionPayload {
|
|
7
7
|
_billing_address_clone_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setBillingCustomerAddressId=exports.setBillingAddress=exports.billingAddressInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.billingAddressInitialState={_billing_address_clone_id:""};const setBillingAddress=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setBillingCustomerAddressId=exports.setBillingAddress=exports.billingAddressInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.billingAddressInitialState={_billing_address_clone_id:""};const setBillingAddress=(id,options)=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){try{if(options?.order){if(options.customerAddressId){const sdk=(0,getSdk_1.default)(options.config),attributes={id,reference:options.customerAddressId};yield sdk.addresses.update(attributes)}options.dispatch({type:"setBillingAddress",payload:{_billing_address_clone_id:id}})}}catch(error){console.error("Set billing address",error)}});exports.setBillingAddress=setBillingAddress;function setBillingCustomerAddressId({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)}}exports.setBillingCustomerAddressId=setBillingCustomerAddressId;const type=["setBillingAddress","setBillingCustomerAddressId","cleanup"],billingAddressReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=billingAddressReducer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { BaseError } from '../typings/errors';
|
|
1
|
+
import { type Dispatch } from 'react';
|
|
2
|
+
import { type BaseError } from '../typings/errors';
|
|
3
3
|
import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSource, Order } from '@commercelayer/sdk';
|
|
4
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
-
import { updateOrder } from './OrderReducer';
|
|
4
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
+
import { type updateOrder } from './OrderReducer';
|
|
6
6
|
export type CustomerActionType = 'setErrors' | 'setCustomerEmail' | 'setAddresses' | 'setPayments' | 'setOrders';
|
|
7
7
|
export interface CustomerActionPayload {
|
|
8
8
|
addresses: Address[] | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.customerInitialState=exports.getCustomerPayments=exports.createCustomerAddress=exports.getCustomerOrders=exports.getCustomerPaymentSources=exports.deleteCustomerAddress=exports.getCustomerAddresses=exports.setCustomerEmail=exports.setCustomerErrors=exports.saveCustomerUser=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),jwt_1=tslib_1.__importDefault(require("../utils/jwt"));
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.customerInitialState=exports.getCustomerPayments=exports.createCustomerAddress=exports.getCustomerOrders=exports.getCustomerPaymentSources=exports.deleteCustomerAddress=exports.getCustomerAddresses=exports.setCustomerEmail=exports.setCustomerErrors=exports.saveCustomerUser=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),jwt_1=tslib_1.__importDefault(require("../utils/jwt"));function saveCustomerUser({customerEmail,order,updateOrder}){return tslib_1.__awaiter(this,void 0,void 0,function*(){if(order){const attributes={customer_email:customerEmail,id:order.id};yield updateOrder({id:order.id,attributes})}})}exports.saveCustomerUser=saveCustomerUser;function setCustomerErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}exports.setCustomerErrors=setCustomerErrors;function setCustomerEmail(customerEmail,dispatch){dispatch&&dispatch({type:"setCustomerEmail",payload:{customerEmail}})}exports.setCustomerEmail=setCustomerEmail;function getCustomerAddresses({config,dispatch,isOrderAvailable}){return tslib_1.__awaiter(this,void 0,void 0,function*(){try{const addresses=[];(yield(0,getSdk_1.default)(config).customer_addresses.list({include:["address"]})).forEach(customerAddress=>{customerAddress.address&&(customerAddress.id!==customerAddress.address.reference&&!isOrderAvailable&&(customerAddress.address.reference=customerAddress.id),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=(0,getErrors_1.default)({error,resource:"addresses"});dispatch({type:"setErrors",payload:{errors}})}})}exports.getCustomerAddresses=getCustomerAddresses;function deleteCustomerAddress({config,dispatch,customerAddressId,addresses}){return tslib_1.__awaiter(this,void 0,void 0,function*(){if(config&&addresses&&dispatch&&config)try{yield(0,getSdk_1.default)(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")}})}exports.deleteCustomerAddress=deleteCustomerAddress;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}})}}exports.getCustomerPaymentSources=getCustomerPaymentSources;function getCustomerOrders({config,dispatch}){var _a;return tslib_1.__awaiter(this,void 0,void 0,function*(){if(config.accessToken){const{owner}=(0,jwt_1.default)(config.accessToken);if(owner?.id){const customers=yield(0,getSdk_1.default)(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}})}}})}exports.getCustomerOrders=getCustomerOrders;function createCustomerAddress({address,config,dispatch,state}){var _a,_b,_c;return tslib_1.__awaiter(this,void 0,void 0,function*(){if(config&&address){const sdk=(0,getSdk_1.default)(config),{id}=address;try{if(id){const upAddress=yield 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=yield sdk.addresses.create(address);if(!((_b=state?.customers)===null||_b===void 0)&&_b.id&&newAddress?.id){const newCustomerAddress=yield 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)});yield 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")}}})}exports.createCustomerAddress=createCustomerAddress;function getCustomerPayments({config,dispatch}){return tslib_1.__awaiter(this,void 0,void 0,function*(){if(config!=null&&dispatch!=null){const payments=yield(0,getSdk_1.default)(config).customer_payment_sources.list({include:["payment_source"]});dispatch({type:"setPayments",payload:{payments}})}})}exports.getCustomerPayments=getCustomerPayments,exports.customerInitialState={errors:[],addresses:null,payments:null};const type=["setErrors","setCustomerEmail","setAddresses","setPayments","setOrders"],customerReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=customerReducer;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Customer, Market, GiftCardRecipient, GiftCardRecipientCreate, Order } from '@commercelayer/sdk';
|
|
2
|
-
import { BaseMetadata } from '../typings/index';
|
|
3
|
-
import { Dispatch } from 'react';
|
|
4
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
-
import { BaseError } from '../typings/errors';
|
|
6
|
-
import { CreateOrder, getOrderContext } from './OrderReducer';
|
|
1
|
+
import { type Customer, type Market, type GiftCardRecipient, type GiftCardRecipientCreate, type Order } from '@commercelayer/sdk';
|
|
2
|
+
import { type BaseMetadata } from '../typings/index';
|
|
3
|
+
import { type Dispatch } from 'react';
|
|
4
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
+
import { type BaseError } from '../typings/errors';
|
|
6
|
+
import { type CreateOrder, type getOrderContext } from './OrderReducer';
|
|
7
7
|
export type GiftCardActionType = 'setAvailability' | 'setGiftCardRecipient' | 'setGiftCardErrors' | 'setGiftCardLoading';
|
|
8
8
|
export interface GiftCardRecipientI {
|
|
9
9
|
email: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addGiftCardError=exports.addGiftCard=exports.addGiftCardLoading=exports.addGiftCardRecipient=exports.giftCardInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addGiftCardError=exports.addGiftCard=exports.addGiftCardLoading=exports.addGiftCardRecipient=exports.giftCardInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]};function addGiftCardRecipient(values,config,dispatch){return tslib_1.__awaiter(this,void 0,void 0,function*(){try{const recipient=yield(0,getSdk_1.default)(config).gift_card_recipients.create(values);dispatch({type:"setGiftCardRecipient",payload:{giftCardRecipient:recipient}})}catch(error){console.error(error)}})}exports.addGiftCardRecipient=addGiftCardRecipient;const addGiftCardLoading=(loading,dispatch)=>{dispatch({type:"setGiftCardLoading",payload:{loading}})};exports.addGiftCardLoading=addGiftCardLoading;function addGiftCard(values,{config,dispatch,getOrder,createOrder,order}){var _a;return tslib_1.__awaiter(this,void 0,void 0,function*(){try{const sdk=(0,getSdk_1.default)(config);(0,exports.addGiftCardLoading)(!0,dispatch);const{firstName,lastName,email}=values,val=tslib_1.__rest(values,["firstName","lastName","email"]),giftCardValue=Object.assign({recipient_email:email},val),giftCard=yield sdk.gift_cards.create(giftCardValue,{include:["gift_card_recipient"]}),recipientValues={id:(_a=giftCard.gift_card_recipient)===null||_a===void 0?void 0:_a.id};if(firstName&&(recipientValues.first_name=firstName),lastName&&(recipientValues.last_name=lastName),(0,isEmpty_1.default)(recipientValues)||(yield sdk.gift_card_recipients.update(recipientValues)),createOrder&&getOrder){const id=order?order.id:yield createOrder();if(id){const order2=sdk.orders.relationship(id),item=sdk.gift_cards.relationship(giftCard.id);yield sdk.line_items.create({quantity:1,order:order2,item}),yield getOrder(id)}}dispatch({type:"setGiftCardRecipient",payload:Object.assign({},giftCardValue)}),(0,exports.addGiftCardLoading)(!1,dispatch)}catch(error){const errors=(0,getErrors_1.default)({error,resource:"gift_cards"});dispatch({type:"setGiftCardErrors",payload:{errors}}),(0,exports.addGiftCardLoading)(!1,dispatch)}})}exports.addGiftCard=addGiftCard;const addGiftCardError=(errors,dispatch)=>{dispatch({type:"setGiftCardErrors",payload:{errors}})};exports.addGiftCardError=addGiftCardError;const type=["setAvailability","setGiftCardRecipient","setGiftCardErrors","setGiftCardLoading"],giftCardReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=giftCardReducer;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
-
import { getOrderContext } from './OrderReducer';
|
|
4
|
-
import { LoaderType } from '../typings/index';
|
|
5
|
-
import { BaseError } from '../typings/errors';
|
|
6
|
-
import { Order, LineItem } from '@commercelayer/sdk';
|
|
1
|
+
import { type Dispatch } from 'react';
|
|
2
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
+
import { type getOrderContext } from './OrderReducer';
|
|
4
|
+
import { type LoaderType } from '../typings/index';
|
|
5
|
+
import { type BaseError } from '../typings/errors';
|
|
6
|
+
import { type Order, type LineItem } from '@commercelayer/sdk';
|
|
7
7
|
export interface UpdateLineItemParams {
|
|
8
8
|
lineItemId: string;
|
|
9
9
|
quantity?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lineItemInitialState=exports.deleteLineItem=exports.updateLineItem=exports.getLineItems=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getLineItems=params=>{const{order,dispatch,config}=params,sdk=(0,getSdk_1.default)(config);let allLineItems=[];order&&sdk.orders.retrieve(order?.id,{include:["line_items","line_items.line_item_options.sku_option"],fields:{orders:["line_items"]}}).then(response=>{dispatch({type:"setLoading",payload:{loading:!1}});const items=response.line_items||[];allLineItems=[...allLineItems,...items],dispatch({type:"setLineItems",payload:{lineItems:allLineItems}})}).catch(error=>{const errors=(0,getErrors_1.default)({error,resource:"line_items"});dispatch({type:"setErrors",payload:{errors}})})};exports.getLineItems=getLineItems;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lineItemInitialState=exports.deleteLineItem=exports.updateLineItem=exports.getLineItems=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getLineItems=params=>{const{order,dispatch,config}=params,sdk=(0,getSdk_1.default)(config);let allLineItems=[];order&&sdk.orders.retrieve(order?.id,{include:["line_items","line_items.line_item_options.sku_option"],fields:{orders:["line_items"]}}).then(response=>{dispatch({type:"setLoading",payload:{loading:!1}});const items=response.line_items||[];allLineItems=[...allLineItems,...items],dispatch({type:"setLineItems",payload:{lineItems:allLineItems}})}).catch(error=>{const errors=(0,getErrors_1.default)({error,resource:"line_items"});dispatch({type:"setErrors",payload:{errors}})})};exports.getLineItems=getLineItems;function updateLineItem(params){return tslib_1.__awaiter(this,void 0,void 0,function*(){const{config,lineItemId,quantity,getOrder,orderId,dispatch}=params,sdk=(0,getSdk_1.default)(config);try{yield sdk.line_items.update({id:lineItemId,quantity}),getOrder&&(yield getOrder(orderId)),dispatch({type:"setErrors",payload:{errors:[]}})}catch(error){const errors=(0,getErrors_1.default)({error,resource:"line_items",attributes:{id:lineItemId}});dispatch({type:"setErrors",payload:{errors}})}})}exports.updateLineItem=updateLineItem;const deleteLineItem=params=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){const{config,lineItemId,getOrder,orderId,dispatch}=params,sdk=(0,getSdk_1.default)(config);try{yield sdk.line_items.delete(lineItemId),getOrder&&(yield getOrder(orderId)),dispatch({type:"setErrors",payload:{errors:[]}})}catch(error){const errors=(0,getErrors_1.default)({error,resource:"line_items"});dispatch({type:"setErrors",payload:{errors}})}});exports.deleteLineItem=deleteLineItem,exports.lineItemInitialState={loading:!1,errors:[]};const actionType=["setLineItems","setErrors","setLoading"],lineItemReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,actionType);exports.default=lineItemReducer;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { SetLocalOrder, DeleteLocalOrder } from '../utils/localStorage';
|
|
3
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
|
-
import { BaseMetadataObject } from '../typings/index';
|
|
5
|
-
import { BaseError } from '../typings/errors';
|
|
6
|
-
import { AddressResource } from './AddressReducer';
|
|
1
|
+
import { type Dispatch } from 'react';
|
|
2
|
+
import { type SetLocalOrder, type DeleteLocalOrder } from '../utils/localStorage';
|
|
3
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
|
+
import { type BaseMetadataObject } from '../typings/index';
|
|
5
|
+
import { type BaseError } from '../typings/errors';
|
|
6
|
+
import { type AddressResource } from './AddressReducer';
|
|
7
7
|
import type { Order, OrderUpdate } from '@commercelayer/sdk';
|
|
8
8
|
export type GetOrderParams = Partial<{
|
|
9
9
|
clearWhenPlaced: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.orderInitialState=exports.removeGiftCardOrCouponCode=exports.setGiftCardOrCouponCode=exports.saveAddressToCustomerAddressBook=exports.setOrderErrors=exports.unsetOrderState=exports.addToCart=exports.addResourceToInclude=exports.setOrder=exports.updateOrder=exports.getApiOrder=exports.createOrder=void 0;const tslib_1=require("tslib"),localStorage_1=require("../utils/localStorage"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importStar(require("../utils/getErrors")),organization_1=tslib_1.__importDefault(require("../utils/organization")),actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"],createOrder=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.orderInitialState=exports.removeGiftCardOrCouponCode=exports.setGiftCardOrCouponCode=exports.saveAddressToCustomerAddressBook=exports.setOrderErrors=exports.unsetOrderState=exports.addToCart=exports.addResourceToInclude=exports.setOrder=exports.updateOrder=exports.getApiOrder=exports.createOrder=void 0;const tslib_1=require("tslib"),localStorage_1=require("../utils/localStorage"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importStar(require("../utils/getErrors")),organization_1=tslib_1.__importDefault(require("../utils/organization")),actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"],createOrder=params=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){if(params){const{persistKey,state,dispatch,config,orderMetadata:metadata,orderAttributes={},setLocalOrder}=params;if(state?.orderId)return state.orderId;const sdk=(0,getSdk_1.default)(config);try{const o=yield sdk?.orders.create(Object.assign({metadata},orderAttributes));return dispatch&&dispatch({type:"setOrderId",payload:{orderId:o?.id}}),persistKey&&setLocalOrder&&setLocalOrder(persistKey,o.id),o.id}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders"});console.error("Create order",errors),dispatch&&(0,getErrors_1.setErrors)({currentErrors:state?.errors,newErrors:errors,dispatch})}}return""});exports.createOrder=createOrder;const getApiOrder=params=>tslib_1.__awaiter(void 0,void 0,void 0,function*(){const{id,dispatch,config,clearWhenPlaced,persistKey,deleteLocalOrder,state}=params,sdk=(0,getSdk_1.default)(config);try{const options={};state?.include&&state.include.length>0&&(options.include=state.include);const order=yield sdk.orders.retrieve(id,options);return clearWhenPlaced&&order.editable===!1?(persistKey&&deleteLocalOrder&&deleteLocalOrder(persistKey),dispatch&&dispatch({type:"setOrder",payload:{order:void 0,orderId:""}})):dispatch&&dispatch({type:"setOrder",payload:{order,orderId:order.id}}),order}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders"});console.error("Retrieve order",errors),dispatch&&(0,getErrors_1.setErrors)({currentErrors:state?.errors,newErrors:errors,dispatch});return}});exports.getApiOrder=getApiOrder;function updateOrder({id,attributes,dispatch,config,include,state}){return tslib_1.__awaiter(this,void 0,void 0,function*(){const sdk=(0,getSdk_1.default)(config);try{const resource=Object.assign(Object.assign({},attributes),{id});yield sdk.orders.update(resource,{include});const order=yield(0,exports.getApiOrder)({id,config,dispatch,state});return dispatch&&order&&dispatch({type:"setOrder",payload:{order}}),{success:!0,order}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders"});return dispatch&&(setOrderErrors({errors,dispatch}),dispatch({type:"setErrors",payload:{errors}})),{success:!1,error}}})}exports.updateOrder=updateOrder;const setOrder=(order,dispatch)=>{dispatch&&dispatch({type:"setOrder",payload:{order}})};exports.setOrder=setOrder;function addResourceToInclude({resourcesIncluded=[],dispatch,newResource,newResourceLoaded,resourceIncludedLoaded}){const payload={include:void 0,includeLoaded:void 0};if(newResource){const resources=typeof newResource=="string"?[newResource]:newResource;payload.include=[...new Set([...resourcesIncluded,...resources])],resources.forEach(resource=>{const includeLoaded=Object.assign(Object.assign({},payload.includeLoaded),{[resource]:!0});payload.includeLoaded=includeLoaded})}else delete payload.include;const payloadIncludeLoaded=Object.assign(Object.assign(Object.assign({},resourceIncludedLoaded),newResourceLoaded),payload.includeLoaded&&payload.includeLoaded);payload.includeLoaded=payloadIncludeLoaded,dispatch&&dispatch({type:"setIncludesResource",payload:Object.assign(Object.assign({},payload),{withoutIncludes:!1})})}exports.addResourceToInclude=addResourceToInclude;function addToCart(params){var _a,_b,_c,_d;return tslib_1.__awaiter(this,void 0,void 0,function*(){const{skuCode,bundleCode,quantity,config,dispatch,lineItem,state,errors=[],buyNowMode,checkoutUrl,lineItemOption}=params;try{if(config){const sdk=(0,getSdk_1.default)(config),id=yield(0,exports.createOrder)(params);if(id){const order=sdk.orders.relationship(id),name=lineItem?.name,imageUrl=lineItem?.imageUrl,metadata=lineItem?.metadata;if(buyNowMode)if(!((_a=state?.order)===null||_a===void 0)&&_a.line_items)yield Promise.all((_b=state?.order)===null||_b===void 0?void 0:_b.line_items.map(lineItem2=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield sdk.line_items.delete(lineItem2.id)})));else{const{line_items:lineItems}=yield sdk.orders.retrieve(id,{fields:["line_items"],include:["line_items"]});lineItems&&lineItems?.length>0&&(yield Promise.all(lineItems.map(lineItem2=>tslib_1.__awaiter(this,void 0,void 0,function*(){yield sdk.line_items.delete(lineItem2.id)}))))}const attrs={order,sku_code:skuCode,name,image_url:imageUrl,quantity:quantity??1,_update_quantity:!0,bundle_code:bundleCode,metadata},newLineItem=yield sdk.line_items.create(attrs);if(lineItemOption!=null){const{skuOptionId,options,quantity:quantity2}=lineItemOption,skuOption=sdk.sku_options.relationship(skuOptionId),lineItemRel=sdk.line_items.relationship(newLineItem.id),lineItemOptionsAttributes={quantity:quantity2??1,options,sku_option:skuOption,line_item:lineItemRel};yield sdk.line_item_options.create(lineItemOptionsAttributes),yield(0,exports.getApiOrder)(Object.assign({id},params))}else yield(0,exports.getApiOrder)(Object.assign(Object.assign({id},params),{state}));if(!(0,isEmpty_1.default)(errors)&&dispatch&&dispatch({type:"setErrors",payload:{errors:[]}}),buyNowMode){const{organization}=(0,organization_1.default)((_c=config.endpoint)!==null&&_c!==void 0?_c:""),params2=`${id}?accessToken=${(_d=config.accessToken)!==null&&_d!==void 0?_d:""}`,redirectUrl=checkoutUrl?`${checkoutUrl}/${params2}`:`https://${organization}.checkout.commercelayer.app/${params2}`;location.href=redirectUrl}return{success:!0,orderId:id}}}return{success:!1}}catch(error){const errors2=(0,getErrors_1.default)({error,resource:"orders"});return console.error("Add to cart",errors2),dispatch&&(0,getErrors_1.setErrors)({currentErrors:state?.errors,newErrors:errors2,dispatch}),{success:!1}}})}exports.addToCart=addToCart;const unsetOrderState=dispatch=>{dispatch({type:"setOrderId",payload:{orderId:""}}),dispatch({type:"setOrder",payload:{order:void 0}})};exports.unsetOrderState=unsetOrderState;function setOrderErrors({dispatch,errors=[]}){return dispatch&&dispatch({type:"setErrors",payload:{errors}}),{success:!1}}exports.setOrderErrors=setOrderErrors;const saveAddressToCustomerAddressBook=({type,value,dispatch})=>{const k=`_save_${type}_to_customer_address_book`,v=`${value.toString()}`;(0,localStorage_1.setCustomerOrderParam)(k,v),dispatch&&dispatch({type:"setSaveAddressToCustomerAddressBook",payload:{[k]:v}})};exports.saveAddressToCustomerAddressBook=saveAddressToCustomerAddressBook;function setGiftCardOrCouponCode({code,codeType,dispatch,config,order,include,state}){return tslib_1.__awaiter(this,void 0,void 0,function*(){try{if(config&&order&&code&&dispatch){const attributes={[codeType]:code},{success,order:currentOrder,error}=yield updateOrder({id:order.id,attributes,config,include,dispatch,state});if(!success)throw error;return dispatch({type:"setErrors",payload:{errors:[]}}),{success,order:currentOrder}}return{success:!1}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders",field:codeType});return dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}})}exports.setGiftCardOrCouponCode=setGiftCardOrCouponCode;function removeGiftCardOrCouponCode({codeType,dispatch,config,order,include,state}){return tslib_1.__awaiter(this,void 0,void 0,function*(){try{if(config&&order&&dispatch){const attributes={[codeType]:""},orderUpdated=yield updateOrder({id:order.id,attributes,config,include,dispatch,state});return dispatch({type:"setErrors",payload:{errors:[]}}),{success:!0,order:orderUpdated?.order}}return{success:!1}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders",field:codeType});return console.error("Remove gift card o coupon code",errors),dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}})}exports.removeGiftCardOrCouponCode=removeGiftCardOrCouponCode,exports.orderInitialState={loading:!0,orderId:"",order:void 0,errors:[],include:void 0,withoutIncludes:!0};const orderReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,actionType);exports.default=orderReducer;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AdyenPaymentConfig } from '../components/payment_source/AdyenPayment';
|
|
2
|
-
import { BraintreeConfig } from '../components/payment_source/BraintreePayment';
|
|
3
|
-
import { PaypalConfig } from '../components/payment_source/PaypalPayment';
|
|
4
|
-
import { StripeConfig } from '../components/payment_source/StripePayment';
|
|
5
|
-
import { WireTransferConfig } from '../components/payment_source/WireTransferPayment';
|
|
6
|
-
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
7
|
-
import { getOrderContext, updateOrder } from './OrderReducer';
|
|
1
|
+
import { type AdyenPaymentConfig } from '../components/payment_source/AdyenPayment';
|
|
2
|
+
import { type BraintreeConfig } from '../components/payment_source/BraintreePayment';
|
|
3
|
+
import { type PaypalConfig } from '../components/payment_source/PaypalPayment';
|
|
4
|
+
import { type StripeConfig } from '../components/payment_source/StripePayment';
|
|
5
|
+
import { type WireTransferConfig } from '../components/payment_source/WireTransferPayment';
|
|
6
|
+
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
7
|
+
import { type getOrderContext, type updateOrder } from './OrderReducer';
|
|
8
8
|
import type { 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/payment_source/CheckoutComPayment';
|
|
12
|
-
import { ExternalPaymentConfig } from '../components/payment_source/ExternalPayment';
|
|
13
|
-
import { ResourceKeys } from '../utils/getPaymentAttributes';
|
|
9
|
+
import { type Order, type PaymentMethod, type StripePayment, type WireTransfer, type AdyenPayment, type BraintreePayment, type CheckoutComPayment, type ExternalPayment, type PaypalPayment, type KlarnaPayment } from '@commercelayer/sdk';
|
|
10
|
+
import { type Dispatch, type MutableRefObject } from 'react';
|
|
11
|
+
import { type CheckoutComConfig } from '../components/payment_source/CheckoutComPayment';
|
|
12
|
+
import { type ExternalPaymentConfig } from '../components/payment_source/ExternalPayment';
|
|
13
|
+
import { type ResourceKeys } from '../utils/getPaymentAttributes';
|
|
14
14
|
export type PaymentSourceType = AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer;
|
|
15
15
|
interface Card {
|
|
16
16
|
type: string;
|
|
@@ -41,6 +41,10 @@ export interface PaymentSourceObject {
|
|
|
41
41
|
options?: {
|
|
42
42
|
card: Card;
|
|
43
43
|
};
|
|
44
|
+
payment_method?: {
|
|
45
|
+
card: Card;
|
|
46
|
+
type: string | 'klarna' | 'card';
|
|
47
|
+
};
|
|
44
48
|
};
|
|
45
49
|
wire_transfers: WireTransfer;
|
|
46
50
|
checkout_com_payments: CheckoutComPayment & {
|