@commercelayer/react-components 3.0.0-beta.7 → 3.0.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/README.md +1 -1
- package/{dist → lib}/components/AddToCartButton.d.ts +20 -17
- package/lib/components/AddToCartButton.js +1 -0
- package/{dist → lib}/components/Address.d.ts +13 -12
- package/lib/components/Address.js +1 -0
- package/{dist → lib}/components/AddressCountrySelector.d.ts +9 -9
- package/lib/components/AddressCountrySelector.js +1 -0
- package/{dist → lib}/components/AddressField.d.ts +15 -15
- package/lib/components/AddressField.js +1 -0
- package/{dist → lib}/components/AddressInput.d.ts +7 -7
- package/lib/components/AddressInput.js +1 -0
- package/lib/components/AddressStateSelector.d.ts +11 -0
- package/lib/components/AddressStateSelector.js +1 -0
- package/{dist → lib}/components/AddressesContainer.d.ts +7 -7
- package/lib/components/AddressesContainer.js +1 -0
- package/lib/components/AdjustmentAmount.d.ts +4 -0
- package/lib/components/AdjustmentAmount.js +1 -0
- package/lib/components/AdyenPayment.d.ts +25 -0
- package/lib/components/AdyenPayment.js +1 -0
- package/{dist → lib}/components/AvailabilityContainer.d.ts +7 -7
- package/lib/components/AvailabilityContainer.js +1 -0
- package/{dist → lib}/components/AvailabilityTemplate.d.ts +15 -16
- package/lib/components/AvailabilityTemplate.js +1 -0
- package/{dist → lib}/components/BillingAddressContainer.d.ts +6 -6
- package/lib/components/BillingAddressContainer.js +1 -0
- package/{dist → lib}/components/BillingAddressForm.d.ts +8 -8
- package/lib/components/BillingAddressForm.js +1 -0
- package/{dist → lib}/components/BraintreePayment.d.ts +30 -19
- package/lib/components/BraintreePayment.js +1 -0
- package/{dist → lib}/components/CheckoutLink.d.ts +11 -11
- package/lib/components/CheckoutLink.js +1 -0
- package/{dist → lib}/components/CommerceLayer.d.ts +8 -9
- package/lib/components/CommerceLayer.js +1 -0
- package/{dist → lib}/components/CustomerContainer.d.ts +7 -7
- package/lib/components/CustomerContainer.js +1 -0
- package/{dist → lib}/components/CustomerInput.d.ts +11 -11
- package/lib/components/CustomerInput.js +1 -0
- package/{dist → lib}/components/DeliveryLeadTime.d.ts +10 -10
- package/lib/components/DeliveryLeadTime.js +1 -0
- package/{dist → lib}/components/DiscountAmount.d.ts +4 -4
- package/lib/components/DiscountAmount.js +1 -0
- package/{dist → lib}/components/Errors.d.ts +5 -5
- package/lib/components/Errors.js +1 -0
- package/{dist → lib}/components/ExternalFunction.d.ts +7 -7
- package/lib/components/ExternalFunction.js +1 -0
- package/{dist → lib}/components/GiftCard.d.ts +8 -8
- package/lib/components/GiftCard.js +1 -0
- package/{dist → lib}/components/GiftCardAmount.d.ts +4 -4
- package/lib/components/GiftCardAmount.js +1 -0
- package/{dist → lib}/components/GiftCardContainer.d.ts +6 -6
- package/lib/components/GiftCardContainer.js +1 -0
- package/{dist → lib}/components/GiftCardCurrencySelector.d.ts +7 -7
- package/lib/components/GiftCardCurrencySelector.js +1 -0
- package/{dist → lib}/components/GiftCardInput.d.ts +7 -7
- package/lib/components/GiftCardInput.js +1 -0
- package/{dist → lib}/components/GiftCardOrCouponCode.d.ts +13 -13
- package/lib/components/GiftCardOrCouponCode.js +1 -0
- package/{dist → lib}/components/GiftCardOrCouponForm.d.ts +10 -10
- package/lib/components/GiftCardOrCouponForm.js +1 -0
- package/{dist → lib}/components/GiftCardOrCouponInput.d.ts +8 -8
- package/lib/components/GiftCardOrCouponInput.js +1 -0
- package/{dist → lib}/components/GiftCardOrCouponRemoveButton.d.ts +16 -16
- package/lib/components/GiftCardOrCouponRemoveButton.js +1 -0
- package/{dist → lib}/components/GiftCardOrCouponSubmit.d.ts +9 -9
- package/lib/components/GiftCardOrCouponSubmit.js +1 -0
- package/{dist → lib}/components/GiftCardRecipient.d.ts +0 -0
- package/lib/components/GiftCardRecipient.js +1 -0
- package/{dist → lib}/components/GiftCardRecipientInput.d.ts +0 -0
- package/lib/components/GiftCardRecipientInput.js +1 -0
- package/{dist → lib}/components/ItemContainer.d.ts +11 -11
- package/lib/components/ItemContainer.js +1 -0
- package/{dist → lib}/components/LineItem.d.ts +8 -8
- package/lib/components/LineItem.js +1 -0
- package/{dist → lib}/components/LineItemAmount.d.ts +7 -7
- package/lib/components/LineItemAmount.js +1 -0
- package/lib/components/LineItemCode.d.ts +12 -0
- package/lib/components/LineItemCode.js +1 -0
- package/lib/components/LineItemImage.d.ts +16 -0
- package/lib/components/LineItemImage.js +1 -0
- package/lib/components/LineItemName.d.ts +11 -0
- package/lib/components/LineItemName.js +1 -0
- package/{dist → lib}/components/LineItemOption.d.ts +19 -19
- package/lib/components/LineItemOption.js +1 -0
- package/{dist → lib}/components/LineItemOptions.d.ts +14 -14
- package/lib/components/LineItemOptions.js +1 -0
- package/{dist → lib}/components/LineItemQuantity.d.ts +14 -14
- package/lib/components/LineItemQuantity.js +1 -0
- package/{dist → lib}/components/LineItemRemoveLink.d.ts +12 -12
- package/lib/components/LineItemRemoveLink.js +1 -0
- package/{dist → lib}/components/LineItemsContainer.d.ts +8 -8
- package/lib/components/LineItemsContainer.js +1 -0
- package/{dist → lib}/components/LineItemsCount.d.ts +12 -10
- package/lib/components/LineItemsCount.js +1 -0
- package/lib/components/LineItemsEmpty.d.ts +12 -0
- package/lib/components/LineItemsEmpty.js +1 -0
- package/{dist → lib}/components/MetadataInput.d.ts +5 -5
- package/lib/components/MetadataInput.js +1 -0
- package/{dist → lib}/components/OrderContainer.d.ts +11 -10
- package/lib/components/OrderContainer.js +1 -0
- package/{dist → lib}/components/OrderNumber.d.ts +5 -5
- package/lib/components/OrderNumber.js +1 -0
- package/{dist → lib}/components/OrderStorage.d.ts +8 -8
- package/lib/components/OrderStorage.js +1 -0
- package/lib/components/PaymentGateway.d.ts +16 -0
- package/lib/components/PaymentGateway.js +1 -0
- package/{dist → lib}/components/PaymentMethod.d.ts +16 -16
- package/lib/components/PaymentMethod.js +1 -0
- package/{dist → lib}/components/PaymentMethodAmount.d.ts +4 -4
- package/lib/components/PaymentMethodAmount.js +1 -0
- package/{dist → lib}/components/PaymentMethodName.d.ts +9 -9
- package/lib/components/PaymentMethodName.js +1 -0
- package/{dist → lib}/components/PaymentMethodPrice.d.ts +9 -9
- package/lib/components/PaymentMethodPrice.js +1 -0
- package/{dist → lib}/components/PaymentMethodRadioButton.d.ts +11 -11
- package/lib/components/PaymentMethodRadioButton.js +1 -0
- package/{dist → lib}/components/PaymentMethodsContainer.d.ts +8 -8
- package/lib/components/PaymentMethodsContainer.js +1 -0
- package/{dist → lib}/components/PaymentSource.d.ts +19 -18
- package/lib/components/PaymentSource.js +1 -0
- package/{dist → lib}/components/PaymentSourceBrandIcon.d.ts +15 -15
- package/lib/components/PaymentSourceBrandIcon.js +1 -0
- package/{dist → lib}/components/PaymentSourceBrandName.d.ts +12 -12
- package/lib/components/PaymentSourceBrandName.js +1 -0
- package/{dist → lib}/components/PaymentSourceDetail.d.ts +12 -12
- package/lib/components/PaymentSourceDetail.js +1 -0
- package/{dist → lib}/components/PaymentSourceEditButton.d.ts +9 -9
- package/lib/components/PaymentSourceEditButton.js +1 -0
- package/{dist → lib}/components/PaypalPayment.d.ts +12 -12
- package/lib/components/PaypalPayment.js +1 -0
- package/{dist → lib}/components/PlaceOrderButton.d.ts +12 -12
- package/lib/components/PlaceOrderButton.js +1 -0
- package/{dist → lib}/components/PlaceOrderContainer.d.ts +8 -8
- package/lib/components/PlaceOrderContainer.js +1 -0
- package/{dist → lib}/components/Price.d.ts +16 -14
- package/lib/components/Price.js +1 -0
- package/{dist → lib}/components/PricesContainer.d.ts +11 -11
- package/lib/components/PricesContainer.js +1 -0
- package/{dist → lib}/components/PrivacyAndTermsCheckbox.d.ts +4 -4
- package/lib/components/PrivacyAndTermsCheckbox.js +1 -0
- package/{dist → lib}/components/QuantitySelector.d.ts +17 -17
- package/lib/components/QuantitySelector.js +1 -0
- package/{dist → lib}/components/SaveAddressesButton.d.ts +10 -10
- package/lib/components/SaveAddressesButton.js +1 -0
- package/{dist → lib}/components/SaveCustomerButton.d.ts +13 -13
- package/lib/components/SaveCustomerButton.js +1 -0
- package/{dist → lib}/components/Shipment.d.ts +8 -8
- package/lib/components/Shipment.js +1 -0
- package/{dist → lib}/components/ShipmentField.d.ts +12 -12
- package/lib/components/ShipmentField.js +1 -0
- package/{dist → lib}/components/ShipmentsContainer.d.ts +6 -6
- package/lib/components/ShipmentsContainer.js +1 -0
- package/{dist → lib}/components/ShippingAddressContainer.d.ts +6 -6
- package/lib/components/ShippingAddressContainer.js +1 -0
- package/{dist → lib}/components/ShippingAddressForm.d.ts +8 -8
- package/lib/components/ShippingAddressForm.js +1 -0
- package/{dist → lib}/components/ShippingAmount.d.ts +4 -4
- package/lib/components/ShippingAmount.js +1 -0
- package/{dist → lib}/components/ShippingMethod.d.ts +8 -8
- package/lib/components/ShippingMethod.js +1 -0
- package/{dist → lib}/components/ShippingMethodName.d.ts +11 -7
- package/lib/components/ShippingMethodName.js +1 -0
- package/{dist → lib}/components/ShippingMethodPrice.d.ts +13 -13
- package/lib/components/ShippingMethodPrice.js +1 -0
- package/lib/components/ShippingMethodRadioButton.d.ts +13 -0
- package/lib/components/ShippingMethodRadioButton.js +1 -0
- package/{dist → lib}/components/SkuList.d.ts +7 -7
- package/lib/components/SkuList.js +1 -0
- package/{dist → lib}/components/SkuListsContainer.d.ts +6 -6
- package/lib/components/SkuListsContainer.js +1 -0
- package/{dist → lib}/components/SkuOption.d.ts +7 -7
- package/lib/components/SkuOption.js +1 -0
- package/{dist → lib}/components/SkuOptionInput.d.ts +5 -5
- package/lib/components/SkuOptionInput.js +1 -0
- package/{dist → lib}/components/SkuOptionsContainer.d.ts +7 -7
- package/lib/components/SkuOptionsContainer.js +1 -0
- package/{dist → lib}/components/StockTransfer.d.ts +6 -6
- package/lib/components/StockTransfer.js +1 -0
- package/{dist → lib}/components/StockTransferField.d.ts +9 -9
- package/lib/components/StockTransferField.js +1 -0
- package/{dist → lib}/components/StripePayment.d.ts +18 -18
- package/lib/components/StripePayment.js +1 -0
- package/{dist → lib}/components/SubTotalAmount.d.ts +4 -4
- package/lib/components/SubTotalAmount.js +1 -0
- package/{dist → lib}/components/SubmitButton.d.ts +9 -9
- package/lib/components/SubmitButton.js +1 -0
- package/{dist → lib}/components/TaxesAmount.d.ts +4 -4
- package/lib/components/TaxesAmount.js +1 -0
- package/{dist → lib}/components/TotalAmount.d.ts +4 -4
- package/lib/components/TotalAmount.js +1 -0
- package/{dist → lib}/components/VariantSelector.d.ts +29 -27
- package/lib/components/VariantSelector.js +1 -0
- package/{dist → lib}/components/VariantsContainer.d.ts +8 -8
- package/lib/components/VariantsContainer.js +1 -0
- package/{dist → lib}/components/WireTransferPayment.d.ts +10 -10
- package/lib/components/WireTransferPayment.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/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/utils/AddressCardsTemplate.d.ts +27 -0
- package/lib/components/utils/AddressCardsTemplate.js +1 -0
- package/{dist → lib}/components/utils/BaseField.d.ts +8 -8
- 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/{dist → lib}/components/utils/BaseOrderPrice.d.ts +6 -6
- package/lib/components/utils/BaseOrderPrice.js +1 -0
- package/{dist → lib}/components/utils/BaseSelect.d.ts +5 -5
- package/lib/components/utils/BaseSelect.js +1 -0
- package/{dist → lib}/components/utils/Parent.d.ts +8 -8
- 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/{dist → lib}/components/utils/PriceTemplate.d.ts +8 -8
- package/lib/components/utils/PriceTemplate.js +1 -0
- package/{dist → lib}/components/utils/VariantTemplate.d.ts +36 -34
- package/lib/components/utils/VariantTemplate.js +1 -0
- package/{dist → lib}/components/utils/getAllErrors.d.ts +17 -17
- package/lib/components/utils/getAllErrors.js +1 -0
- package/{dist → lib}/config/components.d.ts +892 -865
- package/lib/config/components.js +1 -0
- package/lib/config/currency.d.ts +5 -0
- package/lib/config/currency.js +1 -0
- package/{dist → lib}/context/AddressChildrenContext.d.ts +7 -7
- package/lib/context/AddressChildrenContext.js +1 -0
- package/{dist → lib}/context/AddressContext.d.ts +17 -16
- package/lib/context/AddressContext.js +1 -0
- package/{dist → lib}/context/AvailabilityContext.d.ts +3 -3
- package/lib/context/AvailabilityContext.js +1 -0
- package/{dist → lib}/context/BillingAddressContext.d.ts +12 -12
- package/lib/context/BillingAddressContext.js +1 -0
- package/{dist → lib}/context/BillingAddressFormContext.d.ts +18 -16
- package/lib/context/BillingAddressFormContext.js +1 -0
- package/{dist → lib}/context/CommerceLayerContext.d.ts +7 -8
- package/lib/context/CommerceLayerContext.js +1 -0
- package/{dist → lib}/context/CouponAndGiftCardFormContext.d.ts +7 -7
- package/lib/context/CouponAndGiftCardFormContext.js +1 -0
- package/{dist → lib}/context/CustomerContext.d.ts +16 -14
- package/lib/context/CustomerContext.js +1 -0
- package/{dist → lib}/context/ExternalFunctionContext.d.ts +12 -12
- package/lib/context/ExternalFunctionContext.js +1 -0
- package/{dist → lib}/context/GiftCardContext.d.ts +11 -11
- package/lib/context/GiftCardContext.js +1 -0
- package/{dist → lib}/context/ItemContext.d.ts +13 -13
- package/lib/context/ItemContext.js +1 -0
- package/lib/context/LineItemChildrenContext.d.ts +9 -0
- package/lib/context/LineItemChildrenContext.js +1 -0
- package/{dist → lib}/context/LineItemContext.d.ts +8 -8
- package/lib/context/LineItemContext.js +1 -0
- package/{dist → lib}/context/LineItemOptionChildrenContext.d.ts +8 -8
- package/lib/context/LineItemOptionChildrenContext.js +1 -0
- package/lib/context/OrderContext.d.ts +26 -0
- package/lib/context/OrderContext.js +1 -0
- package/{dist → lib}/context/OrderStorageContext.d.ts +11 -11
- package/lib/context/OrderStorageContext.js +1 -0
- package/{dist → lib}/context/PaymentMethodChildrenContext.d.ts +10 -10
- package/lib/context/PaymentMethodChildrenContext.js +1 -0
- package/{dist → lib}/context/PaymentMethodContext.d.ts +23 -20
- package/lib/context/PaymentMethodContext.js +1 -0
- package/{dist → lib}/context/PaymentSourceContext.d.ts +14 -14
- package/lib/context/PaymentSourceContext.js +1 -0
- package/{dist → lib}/context/PlaceOrderContext.d.ts +16 -16
- package/lib/context/PlaceOrderContext.js +1 -0
- package/{dist → lib}/context/PricesContext.d.ts +7 -7
- package/lib/context/PricesContext.js +1 -0
- package/lib/context/ShipmentChildrenContext.d.ts +13 -0
- package/lib/context/ShipmentChildrenContext.js +1 -0
- package/{dist → lib}/context/ShipmentContext.d.ts +12 -12
- package/lib/context/ShipmentContext.js +1 -0
- package/{dist → lib}/context/ShippingAddressContext.d.ts +10 -10
- package/lib/context/ShippingAddressContext.js +1 -0
- package/{dist → lib}/context/ShippingAddressFormContext.d.ts +4 -4
- package/lib/context/ShippingAddressFormContext.js +1 -0
- package/lib/context/ShippingMethodChildrenContext.d.ts +10 -0
- package/lib/context/ShippingMethodChildrenContext.js +1 -0
- package/lib/context/SkuListsContext.d.ts +6 -0
- package/lib/context/SkuListsContext.js +1 -0
- package/{dist → lib}/context/SkuOptionChildrenContext.d.ts +8 -8
- package/lib/context/SkuOptionChildrenContext.js +1 -0
- package/{dist → lib}/context/SkuOptionsContext.d.ts +3 -3
- package/lib/context/SkuOptionsContext.js +1 -0
- package/{dist → lib}/context/StockTransferChildrenContext.d.ts +7 -7
- package/lib/context/StockTransferChildrenContext.js +1 -0
- package/{dist → lib}/context/VariantsContext.d.ts +3 -3
- package/lib/context/VariantsContext.js +1 -0
- package/lib/index.d.ts +99 -0
- package/lib/index.js +1 -0
- package/{dist → lib}/reducers/AddressReducer.d.ts +58 -52
- package/lib/reducers/AddressReducer.js +1 -0
- package/lib/reducers/AvailabilityReducer.d.ts +53 -0
- package/lib/reducers/AvailabilityReducer.js +1 -0
- package/{dist → lib}/reducers/BillingAddressReducer.d.ts +31 -32
- package/lib/reducers/BillingAddressReducer.js +1 -0
- package/{dist → lib}/reducers/CustomerReducer.d.ts +50 -60
- package/lib/reducers/CustomerReducer.js +1 -0
- package/{dist → lib}/reducers/GiftCardReducer.d.ts +76 -75
- package/lib/reducers/GiftCardReducer.js +1 -0
- package/{dist → lib}/reducers/ItemReducer.d.ts +69 -68
- package/lib/reducers/ItemReducer.js +1 -0
- package/{dist → lib}/reducers/LineItemReducer.d.ts +52 -52
- package/lib/reducers/LineItemReducer.js +1 -0
- package/lib/reducers/OrderReducer.d.ts +131 -0
- package/lib/reducers/OrderReducer.js +1 -0
- package/{dist → lib}/reducers/PaymentMethodReducer.d.ts +105 -95
- package/lib/reducers/PaymentMethodReducer.js +1 -0
- package/{dist → lib}/reducers/PlaceOrderReducer.d.ts +52 -50
- package/lib/reducers/PlaceOrderReducer.js +1 -0
- package/{dist → lib}/reducers/PriceReducer.d.ts +44 -45
- package/lib/reducers/PriceReducer.js +1 -0
- package/{dist → lib}/reducers/ShipmentReducer.d.ts +40 -37
- package/lib/reducers/ShipmentReducer.js +1 -0
- package/{dist → lib}/reducers/ShippingAddressReducer.d.ts +32 -31
- package/lib/reducers/ShippingAddressReducer.js +1 -0
- package/{dist → lib}/reducers/SkuListsReducer.d.ts +21 -22
- package/lib/reducers/SkuListsReducer.js +1 -0
- package/{dist → lib}/reducers/SkuOptionsReducer.d.ts +26 -26
- package/lib/reducers/SkuOptionsReducer.js +1 -0
- package/{dist → lib}/reducers/VariantReducer.d.ts +71 -71
- package/lib/reducers/VariantReducer.js +1 -0
- package/{dist → lib}/typings/errors.d.ts +42 -40
- package/lib/typings/errors.js +1 -0
- package/{dist → lib}/typings/index.d.ts +126 -150
- package/lib/typings/index.js +1 -0
- package/{dist → lib}/utils/PropsType.d.ts +33 -33
- package/lib/utils/PropsType.js +1 -0
- package/{dist → lib}/utils/addressesManager.d.ts +28 -27
- package/lib/utils/addressesManager.js +1 -0
- package/{dist → lib}/utils/baseReducer.d.ts +3 -3
- package/lib/utils/baseReducer.js +1 -0
- package/lib/utils/browserInfo.d.ts +9 -0
- package/lib/utils/browserInfo.js +1 -0
- package/{dist → lib}/utils/childrenTypes.d.ts +9 -9
- package/lib/utils/childrenTypes.js +1 -0
- package/lib/utils/countryStateCity.d.ts +9 -0
- package/lib/utils/countryStateCity.js +1 -0
- package/{dist → lib}/utils/customMessages.d.ts +8 -8
- package/lib/utils/customMessages.js +1 -0
- package/lib/utils/customerOrderOptions.d.ts +3 -0
- package/lib/utils/customerOrderOptions.js +1 -0
- package/{dist → lib}/utils/getAmount.d.ts +9 -9
- package/lib/utils/getAmount.js +1 -0
- package/{dist → lib}/utils/getCurrentItemKey.d.ts +6 -6
- 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 +12 -0
- package/lib/utils/getLineItemsCount.js +1 -0
- package/{dist → lib}/utils/getLoaderComponent.d.ts +3 -3
- package/lib/utils/getLoaderComponent.js +1 -0
- package/lib/utils/getPrices.d.ts +17 -0
- package/lib/utils/getPrices.js +1 -0
- package/lib/utils/getSdk.d.ts +3 -0
- package/lib/utils/getSdk.js +1 -0
- package/lib/utils/getSkus.d.ts +3 -0
- package/lib/utils/getSkus.js +1 -0
- package/lib/utils/isEmptyStates.d.ts +1 -0
- package/lib/utils/isEmptyStates.js +1 -0
- package/{dist → lib}/utils/isJSON.d.ts +1 -1
- package/lib/utils/isJSON.js +1 -0
- package/lib/utils/jwt.d.ts +27 -0
- package/lib/utils/jwt.js +1 -0
- package/lib/utils/localStorage.d.ts +17 -0
- package/lib/utils/localStorage.js +1 -0
- package/lib/utils/organization.d.ts +6 -0
- package/lib/utils/organization.js +1 -0
- package/lib/utils/paypalPayment.d.ts +3 -0
- package/lib/utils/paypalPayment.js +1 -0
- package/lib/utils/promisify.d.ts +1 -0
- package/lib/utils/promisify.js +1 -0
- package/lib/utils/shipments.d.ts +2 -0
- package/lib/utils/shipments.js +1 -0
- package/{dist → lib}/utils/validateFormFields.d.ts +20 -19
- package/lib/utils/validateFormFields.js +1 -0
- package/package.json +95 -81
- package/dist/components/CustomerField.d.ts +0 -10
- package/dist/components/LineItemImage.d.ts +0 -10
- package/dist/components/LineItemName.d.ts +0 -7
- package/dist/components/LineItemSkuCode.d.ts +0 -7
- package/dist/components/OrderList.d.ts +0 -26
- package/dist/components/OrderListRow.d.ts +0 -14
- package/dist/components/PaymentGateway.d.ts +0 -11
- package/dist/components/ShippingMethodRadioButton.d.ts +0 -9
- package/dist/components/utils/BaseInput.d.ts +0 -5
- package/dist/context/LineItemChildrenContext.d.ts +0 -7
- package/dist/context/OrderContext.d.ts +0 -4
- package/dist/context/OrderListChildrenContext.d.ts +0 -14
- package/dist/context/ShipmentChildrenContext.d.ts +0 -13
- package/dist/context/ShippingMethodChildrenContext.d.ts +0 -9
- package/dist/context/SkuListsContext.d.ts +0 -3
- package/dist/index.d.ts +0 -89
- package/dist/index.js +0 -8
- package/dist/react-components.cjs.development.js +0 -12693
- package/dist/react-components.cjs.development.js.map +0 -1
- package/dist/react-components.cjs.production.min.js +0 -2
- package/dist/react-components.cjs.production.min.js.map +0 -1
- package/dist/react-components.esm.js +0 -12597
- package/dist/react-components.esm.js.map +0 -1
- package/dist/reducers/AvailabilityReducer.d.ts +0 -40
- package/dist/reducers/OrderReducer.d.ts +0 -131
- package/dist/typings/order.d.ts +0 -120
- package/dist/utils/dynamicNaming.d.ts +0 -5
- package/dist/utils/getErrorsByCollection.d.ts +0 -11
- package/dist/utils/getLineItemsCount.d.ts +0 -6
- package/dist/utils/getPrices.d.ts +0 -18
- package/dist/utils/getSkus.d.ts +0 -3
- package/dist/utils/icons.d.ts +0 -3
- package/dist/utils/isDate.d.ts +0 -1
- package/dist/utils/localStorage.d.ts +0 -12
- package/dist/utils/paypalPayment.d.ts +0 -3
- package/dist/utils/scrollbarWidth.d.ts +0 -1
- package/dist/utils/shipments.d.ts +0 -5
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { BaseError } from
|
|
3
|
-
import {
|
|
4
|
-
import { CommerceLayerConfig } from
|
|
5
|
-
import { getOrderContext } from './OrderReducer';
|
|
6
|
-
export declare type ShipmentActionType = 'setErrors' | 'setShipments' | 'setShippingMethod';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { BaseError } from '../typings/errors';
|
|
3
|
+
import { DeliveryLeadTime, LineItem, Order, Shipment } from '@commercelayer/sdk';
|
|
4
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
+
import { getOrderContext } from './OrderReducer';
|
|
6
|
+
export declare type ShipmentActionType = 'setErrors' | 'setShipments' | 'setShippingMethod';
|
|
7
|
+
export declare type ShipmentLineItem = LineItem & {
|
|
8
|
+
line_item: LineItem;
|
|
9
|
+
};
|
|
10
|
+
export interface ShipmentActionPayload {
|
|
11
|
+
errors: BaseError[];
|
|
12
|
+
shipments: Shipment[];
|
|
13
|
+
deliveryLeadTimes: DeliveryLeadTime[];
|
|
14
|
+
}
|
|
15
|
+
export declare type ShipmentState = Partial<ShipmentActionPayload>;
|
|
16
|
+
export interface ShipmentAction {
|
|
17
|
+
type: ShipmentActionType;
|
|
18
|
+
payload: Partial<ShipmentActionPayload>;
|
|
19
|
+
}
|
|
20
|
+
export declare const shipmentInitialState: ShipmentState;
|
|
21
|
+
export interface SetShipmentErrors {
|
|
22
|
+
<V extends BaseError[]>(errors: V, dispatch?: Dispatch<ShipmentAction>): void;
|
|
23
|
+
}
|
|
24
|
+
export declare const setShipmentErrors: SetShipmentErrors;
|
|
25
|
+
declare type GetShipments = (args: {
|
|
26
|
+
order: Order;
|
|
27
|
+
dispatch: Dispatch<ShipmentAction>;
|
|
28
|
+
config: CommerceLayerConfig;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
export declare const getShipments: GetShipments;
|
|
31
|
+
declare type SetShippingMethod = (args: {
|
|
32
|
+
config: CommerceLayerConfig;
|
|
33
|
+
shipmentId: string;
|
|
34
|
+
shippingMethodId: string;
|
|
35
|
+
order?: Order;
|
|
36
|
+
getOrder?: getOrderContext;
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
export declare const setShippingMethod: SetShippingMethod;
|
|
39
|
+
declare const shipmentReducer: (state: ShipmentState, reducer: ShipmentAction) => ShipmentState;
|
|
40
|
+
export default shipmentReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const shipmentInitialState={errors:[]},setShipmentErrors=(errors,dispatch)=>{dispatch&&dispatch({type:"setErrors",payload:{errors}})},getShipments=async({order,dispatch,config})=>{try{const sdk=getSdk(config),shipments=order.shipments,deliveryLeadTimes=await sdk.delivery_lead_times.list({include:["shipping_method","stock_location"]});dispatch({type:"setShipments",payload:{shipments,deliveryLeadTimes}})}catch(error){console.error(error)}},setShippingMethod=async({config,shipmentId,shippingMethodId,getOrder,order})=>{try{if(shippingMethodId){const sdk=getSdk(config);await sdk.shipments.update({id:shipmentId,shipping_method:sdk.shipping_methods.relationship(shippingMethodId)}),getOrder&&order&&getOrder(order.id)}}catch(error){console.error(error)}};const type=["setErrors","setShipments","setShippingMethod"],shipmentReducer=(state,reducer)=>baseReducer(state,reducer,type);export default shipmentReducer;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { CommerceLayerConfig } from
|
|
3
|
-
import {
|
|
4
|
-
import { getOrderContext } from
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export declare
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
declare
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
declare const
|
|
31
|
-
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
+
import { Order } from '@commercelayer/sdk';
|
|
4
|
+
import { getOrderContext } from './OrderReducer';
|
|
5
|
+
import { AddressResource } from './AddressReducer';
|
|
6
|
+
export declare type ShippingAddressActionType = 'setShippingAddress' | 'setShippingCustomerAddressId' | 'cleanup';
|
|
7
|
+
export interface ShippingAddressActionPayload {
|
|
8
|
+
_shipping_address_clone_id: string;
|
|
9
|
+
shippingCustomerAddressId: string;
|
|
10
|
+
}
|
|
11
|
+
export declare type ShippingAddressState = Partial<ShippingAddressActionPayload>;
|
|
12
|
+
export interface ShippingAddressAction {
|
|
13
|
+
type: ShippingAddressActionType;
|
|
14
|
+
payload: Partial<ShippingAddressActionPayload>;
|
|
15
|
+
}
|
|
16
|
+
export declare const shippingAddressInitialState: ShippingAddressState;
|
|
17
|
+
export declare type SetShippingAddress = (id: string, options?: {
|
|
18
|
+
config: CommerceLayerConfig;
|
|
19
|
+
dispatch: Dispatch<ShippingAddressAction>;
|
|
20
|
+
order?: Order | null;
|
|
21
|
+
getOrder?: getOrderContext;
|
|
22
|
+
customerAddressId?: string;
|
|
23
|
+
}) => Promise<void>;
|
|
24
|
+
export declare const setShippingAddress: SetShippingAddress;
|
|
25
|
+
declare type SetShippingCustomerAddressId = (args: {
|
|
26
|
+
dispatch: Dispatch<ShippingAddressAction>;
|
|
27
|
+
order: Order;
|
|
28
|
+
setCloneAddress: (id: string, resource: AddressResource) => void;
|
|
29
|
+
}) => void;
|
|
30
|
+
export declare const setShippingCustomerAddressId: SetShippingCustomerAddressId;
|
|
31
|
+
declare const shippingAddressReducer: (state: ShippingAddressState, reducer: ShippingAddressAction) => ShippingAddressState;
|
|
32
|
+
export default shippingAddressReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const shippingAddressInitialState={_shipping_address_clone_id:""},setShippingAddress=async(id,options)=>{try{if(options==null?void 0:options.order){if(options.customerAddressId){const sdk=getSdk(options.config),attributes={id,reference:options.customerAddressId};await sdk.addresses.update(attributes)}options.dispatch({type:"setShippingAddress",payload:{_shipping_address_clone_id:id}})}}catch(error){console.error(error)}},setShippingCustomerAddressId=async({dispatch,order,setCloneAddress})=>{var _a;const customerAddressId=(_a=order==null?void 0:order.shipping_address)===null||_a===void 0?void 0:_a.reference;try{customerAddressId&&(dispatch({type:"setShippingCustomerAddressId",payload:{shippingCustomerAddressId:customerAddressId}}),setCloneAddress(customerAddressId,"shipping_address"))}catch(error){console.error("error",error)}};const type=["setShippingAddress","setShippingCustomerAddressId","cleanup"],shippingAddressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default shippingAddressReducer;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import { CommerceLayerConfig } from
|
|
3
|
-
declare type SkuListsActionType = 'getSkuList' | 'setSkuList';
|
|
4
|
-
export
|
|
5
|
-
listIds: string[];
|
|
6
|
-
skuLists:
|
|
7
|
-
}
|
|
8
|
-
export declare const skuListsInitialState: SkuListsState;
|
|
9
|
-
export interface SkuListsAction {
|
|
10
|
-
payload: Partial<SkuListsState>;
|
|
11
|
-
type: SkuListsActionType;
|
|
12
|
-
}
|
|
13
|
-
export declare type GetSkuList = (params: {
|
|
14
|
-
config: CommerceLayerConfig;
|
|
15
|
-
dispatch: Dispatch<SkuListsAction>;
|
|
16
|
-
listIds: string[];
|
|
17
|
-
state: SkuListsState;
|
|
18
|
-
}) => Promise<void>;
|
|
19
|
-
export declare
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export default skuListsReducer;
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
+
declare type SkuListsActionType = 'getSkuList' | 'setSkuList';
|
|
4
|
+
export declare type SkuListsState = Partial<{
|
|
5
|
+
listIds: string[];
|
|
6
|
+
skuLists: Record<string, any>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const skuListsInitialState: SkuListsState;
|
|
9
|
+
export interface SkuListsAction {
|
|
10
|
+
payload: Partial<SkuListsState>;
|
|
11
|
+
type: SkuListsActionType;
|
|
12
|
+
}
|
|
13
|
+
export declare type GetSkuList = (params: {
|
|
14
|
+
config: CommerceLayerConfig;
|
|
15
|
+
dispatch: Dispatch<SkuListsAction>;
|
|
16
|
+
listIds: string[];
|
|
17
|
+
state: SkuListsState;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
export declare const getSkuList: GetSkuList;
|
|
20
|
+
declare const skuListsReducer: (state: SkuListsState, reducer: SkuListsAction) => SkuListsState;
|
|
21
|
+
export default skuListsReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";const actionType=["getSkuList","setSkuList"];export const skuListsInitialState={listIds:[]},getSkuList=async({listIds,config,dispatch})=>{const skuLists={};try{const sdk=getSdk(config);listIds.forEach(async id=>{const skuCodes=(await sdk.sku_lists.retrieve(id,{include:["skus"],fields:{skus:["code"]}})).skus;skuLists[id]=skuCodes}),dispatch({payload:{skuLists},type:"getSkuList"})}catch(error){console.error(error)}};const skuListsReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default skuListsReducer;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Dispatch } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { BaseUnsetState } from
|
|
4
|
-
import { BaseError } from
|
|
5
|
-
export interface SkuOptionsState {
|
|
6
|
-
skuCode?: string;
|
|
7
|
-
skuOptions?:
|
|
8
|
-
errors?: BaseError[];
|
|
9
|
-
}
|
|
10
|
-
interface GetSkuOptionsParams {
|
|
11
|
-
dispatch: Dispatch<SkuOptionsAction>;
|
|
12
|
-
skuOptions?:
|
|
13
|
-
}
|
|
14
|
-
export interface GetSkuOptions {
|
|
15
|
-
(params: GetSkuOptionsParams): void;
|
|
16
|
-
}
|
|
17
|
-
export declare const getSkuOptions: GetSkuOptions;
|
|
18
|
-
export declare const unsetSkuOptionsState: BaseUnsetState<SkuOptionsAction>;
|
|
19
|
-
export declare type SkuOptionsActionType = 'setSkuOptions' | 'setErrors';
|
|
20
|
-
export interface SkuOptionsAction {
|
|
21
|
-
type: SkuOptionsActionType;
|
|
22
|
-
payload: SkuOptionsState;
|
|
23
|
-
}
|
|
24
|
-
export declare const skuOptionsInitialState: SkuOptionsState;
|
|
25
|
-
declare const skuOptionsReducer: (state: SkuOptionsState, reducer: SkuOptionsAction) => SkuOptionsState;
|
|
26
|
-
export default skuOptionsReducer;
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { SkuOption } from '@commercelayer/sdk';
|
|
3
|
+
import { BaseUnsetState } from '../typings/index';
|
|
4
|
+
import { BaseError } from '../typings/errors';
|
|
5
|
+
export interface SkuOptionsState {
|
|
6
|
+
skuCode?: string;
|
|
7
|
+
skuOptions?: SkuOption[];
|
|
8
|
+
errors?: BaseError[];
|
|
9
|
+
}
|
|
10
|
+
interface GetSkuOptionsParams {
|
|
11
|
+
dispatch: Dispatch<SkuOptionsAction>;
|
|
12
|
+
skuOptions?: SkuOption[];
|
|
13
|
+
}
|
|
14
|
+
export interface GetSkuOptions {
|
|
15
|
+
(params: GetSkuOptionsParams): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const getSkuOptions: GetSkuOptions;
|
|
18
|
+
export declare const unsetSkuOptionsState: BaseUnsetState<SkuOptionsAction>;
|
|
19
|
+
export declare type SkuOptionsActionType = 'setSkuOptions' | 'setErrors';
|
|
20
|
+
export interface SkuOptionsAction {
|
|
21
|
+
type: SkuOptionsActionType;
|
|
22
|
+
payload: SkuOptionsState;
|
|
23
|
+
}
|
|
24
|
+
export declare const skuOptionsInitialState: SkuOptionsState;
|
|
25
|
+
declare const skuOptionsReducer: (state: SkuOptionsState, reducer: SkuOptionsAction) => SkuOptionsState;
|
|
26
|
+
export default skuOptionsReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";export const getSkuOptions=async params=>{const{skuOptions,dispatch}=params;dispatch({type:"setSkuOptions",payload:{skuOptions}})},unsetSkuOptionsState=dispatch=>{dispatch({type:"setSkuOptions",payload:{skuOptions:[]}}),dispatch({type:"setErrors",payload:{errors:[]}})};const actionType=["setSkuOptions","setErrors"];export const skuOptionsInitialState={skuCode:"",skuOptions:[]};const skuOptionsReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default skuOptionsReducer;
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Dispatch } from 'react';
|
|
4
|
-
import { CommerceLayerConfig } from
|
|
5
|
-
import { Items, CustomLineItem, SetCustomLineItems } from './ItemReducer';
|
|
6
|
-
import { BaseError } from
|
|
7
|
-
declare type SetSkuCodeVariantParams = {
|
|
8
|
-
code: string;
|
|
9
|
-
id: string;
|
|
10
|
-
config: CommerceLayerConfig;
|
|
11
|
-
dispatch: Dispatch<VariantAction>;
|
|
12
|
-
setItem: ((item: Items) => void) | undefined;
|
|
13
|
-
};
|
|
14
|
-
export interface SetSkuCodeVariant {
|
|
15
|
-
(params: SetSkuCodeVariantParams): void;
|
|
16
|
-
}
|
|
17
|
-
declare type SetVariantSkuCodesParams = {
|
|
18
|
-
skuCodes:
|
|
19
|
-
dispatch: Dispatch<VariantAction>;
|
|
20
|
-
setCustomLineItems?: SetCustomLineItems;
|
|
21
|
-
};
|
|
22
|
-
export interface SetVariantSkuCodes {
|
|
23
|
-
(params: SetVariantSkuCodesParams): void;
|
|
24
|
-
}
|
|
25
|
-
export interface VariantsObject {
|
|
26
|
-
[key: string]:
|
|
27
|
-
}
|
|
28
|
-
export declare type SetSkuCode = (code: string, id: string, lineItem?: CustomLineItem) => void;
|
|
29
|
-
export interface VariantPayload {
|
|
30
|
-
loading?: boolean;
|
|
31
|
-
variants?: VariantsObject | Record<string, any>;
|
|
32
|
-
skuCodes?: string[];
|
|
33
|
-
skuCode?: string;
|
|
34
|
-
errors?: BaseError[];
|
|
35
|
-
currentSkuId?: string;
|
|
36
|
-
currentSkuInventory?: any;
|
|
37
|
-
currentQuantity?: number;
|
|
38
|
-
currentPrices?:
|
|
39
|
-
setSkuCode?: SetSkuCode;
|
|
40
|
-
setSkuCodes?: (skuCodes:
|
|
41
|
-
}
|
|
42
|
-
export interface VariantState extends VariantPayload {
|
|
43
|
-
skuCodes: string[];
|
|
44
|
-
variants: VariantsObject | Record<string, any>;
|
|
45
|
-
}
|
|
46
|
-
export interface VariantAction {
|
|
47
|
-
type: VariantActionType;
|
|
48
|
-
payload: VariantPayload;
|
|
49
|
-
}
|
|
50
|
-
export declare const setVariantSkuCodes: SetVariantSkuCodes;
|
|
51
|
-
export interface UnsetVariantState {
|
|
52
|
-
(dispatch: Dispatch<VariantAction>): void;
|
|
53
|
-
}
|
|
54
|
-
export declare const setSkuCode: SetSkuCodeVariant;
|
|
55
|
-
declare type GetVariantsParams = {
|
|
56
|
-
config: CommerceLayerConfig;
|
|
57
|
-
state: VariantState;
|
|
58
|
-
skuCode: string;
|
|
59
|
-
dispatch: Dispatch<VariantAction>;
|
|
60
|
-
filters: Record<string, any>;
|
|
61
|
-
setItem: ((item: Items) => void) | undefined;
|
|
62
|
-
};
|
|
63
|
-
export interface GetVariants {
|
|
64
|
-
(params: GetVariantsParams): void;
|
|
65
|
-
}
|
|
66
|
-
export declare const getVariants: GetVariants;
|
|
67
|
-
export declare const unsetVariantState: UnsetVariantState;
|
|
68
|
-
export declare const variantInitialState: VariantState;
|
|
69
|
-
export declare type VariantActionType = 'setLoading' | 'setVariants' | 'setSkuCodes' | 'setSkuCode' | 'setCurrentSkuId' | 'setCurrentSkuInventory' | 'setCurrentPrices' | 'setErrors';
|
|
70
|
-
declare const variantReducer: (state: VariantState, reducer: VariantAction) => VariantState;
|
|
71
|
-
export default variantReducer;
|
|
1
|
+
import { Sku } from '@commercelayer/sdk';
|
|
2
|
+
import { VariantOption } from '../components/VariantSelector';
|
|
3
|
+
import { Dispatch } from 'react';
|
|
4
|
+
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
|
+
import { Items, CustomLineItem, SetCustomLineItems } from './ItemReducer';
|
|
6
|
+
import { BaseError } from '../typings/errors';
|
|
7
|
+
declare type SetSkuCodeVariantParams = {
|
|
8
|
+
code: string;
|
|
9
|
+
id: string;
|
|
10
|
+
config: CommerceLayerConfig;
|
|
11
|
+
dispatch: Dispatch<VariantAction>;
|
|
12
|
+
setItem: ((item: Items) => void) | undefined;
|
|
13
|
+
};
|
|
14
|
+
export interface SetSkuCodeVariant {
|
|
15
|
+
(params: SetSkuCodeVariantParams): void;
|
|
16
|
+
}
|
|
17
|
+
declare type SetVariantSkuCodesParams = {
|
|
18
|
+
skuCodes: VariantOption[];
|
|
19
|
+
dispatch: Dispatch<VariantAction>;
|
|
20
|
+
setCustomLineItems?: SetCustomLineItems;
|
|
21
|
+
};
|
|
22
|
+
export interface SetVariantSkuCodes {
|
|
23
|
+
(params: SetVariantSkuCodesParams): void;
|
|
24
|
+
}
|
|
25
|
+
export interface VariantsObject {
|
|
26
|
+
[key: string]: Sku;
|
|
27
|
+
}
|
|
28
|
+
export declare type SetSkuCode = (code: string, id: string, lineItem?: CustomLineItem) => void;
|
|
29
|
+
export interface VariantPayload {
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
variants?: VariantsObject | Record<string, any>;
|
|
32
|
+
skuCodes?: string[];
|
|
33
|
+
skuCode?: string;
|
|
34
|
+
errors?: BaseError[];
|
|
35
|
+
currentSkuId?: string;
|
|
36
|
+
currentSkuInventory?: any;
|
|
37
|
+
currentQuantity?: number;
|
|
38
|
+
currentPrices?: Sku[];
|
|
39
|
+
setSkuCode?: SetSkuCode;
|
|
40
|
+
setSkuCodes?: (skuCodes: VariantOption[]) => void;
|
|
41
|
+
}
|
|
42
|
+
export interface VariantState extends VariantPayload {
|
|
43
|
+
skuCodes: string[];
|
|
44
|
+
variants: VariantsObject | Record<string, any>;
|
|
45
|
+
}
|
|
46
|
+
export interface VariantAction {
|
|
47
|
+
type: VariantActionType;
|
|
48
|
+
payload: VariantPayload;
|
|
49
|
+
}
|
|
50
|
+
export declare const setVariantSkuCodes: SetVariantSkuCodes;
|
|
51
|
+
export interface UnsetVariantState {
|
|
52
|
+
(dispatch: Dispatch<VariantAction>): void;
|
|
53
|
+
}
|
|
54
|
+
export declare const setSkuCode: SetSkuCodeVariant;
|
|
55
|
+
declare type GetVariantsParams = {
|
|
56
|
+
config: CommerceLayerConfig;
|
|
57
|
+
state: VariantState;
|
|
58
|
+
skuCode: string;
|
|
59
|
+
dispatch: Dispatch<VariantAction>;
|
|
60
|
+
filters: Record<string, any>;
|
|
61
|
+
setItem: ((item: Items) => void) | undefined;
|
|
62
|
+
};
|
|
63
|
+
export interface GetVariants {
|
|
64
|
+
(params: GetVariantsParams): void;
|
|
65
|
+
}
|
|
66
|
+
export declare const getVariants: GetVariants;
|
|
67
|
+
export declare const unsetVariantState: UnsetVariantState;
|
|
68
|
+
export declare const variantInitialState: VariantState;
|
|
69
|
+
export declare type VariantActionType = 'setLoading' | 'setVariants' | 'setSkuCodes' | 'setSkuCode' | 'setCurrentSkuId' | 'setCurrentSkuInventory' | 'setCurrentPrices' | 'setErrors';
|
|
70
|
+
declare const variantReducer: (state: VariantState, reducer: VariantAction) => VariantState;
|
|
71
|
+
export default variantReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSkus from"../utils/getSkus";import{isEmpty,has}from"lodash";import getSdk from"../utils/getSdk";export const setVariantSkuCodes=({skuCodes,dispatch,setCustomLineItems})=>{const lineItems={},sCodes=skuCodes.map(s=>(has(s,"lineItem")&&(lineItems[s.code]=s.lineItem),s.code));isEmpty(lineItems)||setCustomLineItems&&setCustomLineItems(lineItems),dispatch({type:"setSkuCodes",payload:{skuCodes:sCodes}})},setSkuCode=params=>{const{id,code,config,setItem,dispatch}=params;id&&getSdk(config).skus.retrieve(id,{include:["sku_options"]}).then(sku=>{setItem&&setItem({[`${code}`]:sku})}).catch(errors=>{dispatch({type:"setErrors",payload:{errors}})})},getVariants=params=>{const{config,state,skuCode,dispatch,setItem,filters}=params;getSdk(config).skus.list({filters:Object.assign({code_in:state.skuCodes.join(",")},filters)}).then(skus=>{const skusObj=getSkus(skus,state.skuCodes);skuCode&&setSkuCode({code:skusObj[skuCode].code,id:skusObj[skuCode].id,config,dispatch,setItem}),dispatch({type:"setVariants",payload:{variants:skusObj}}),dispatch({type:"setLoading",payload:{loading:!1}})}).catch(errors=>{dispatch({type:"setErrors",payload:{errors}})})},unsetVariantState=dispatch=>{dispatch({type:"setSkuCode",payload:{skuCode:""}}),dispatch({type:"setVariants",payload:{variants:{}}}),dispatch({type:"setLoading",payload:{loading:!1}})},variantInitialState={loading:!1,variants:{},skuCodes:[],skuCode:"",errors:[],currentSkuId:"",currentSkuInventory:{available:!1,quantity:0,levels:[]},currentQuantity:1,currentPrices:[]};const actionType=["setLoading","setVariants","setSkuCodes","setSkuCode","setCurrentSkuId","setCurrentSkuInventory","setCurrentPrices","setErrors"],variantReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default variantReducer;
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { FunctionChildren } from './index';
|
|
3
|
-
export declare type CodeErrorType = 'EMPTY_ERROR' | 'FILTER_NOT_ALLOWED' | 'FORBIDDEN' | 'INTERNAL_SERVER_ERROR' | 'INVALID_DATA_FORMAT' | 'INVALID_FIELD' | 'INVALID_FIELD_FORMAT' | 'INVALID_FIELD_VALUE' | 'INVALID_FILTERS_SYNTAX' | 'INVALID_FILTER_VALUE' | 'INVALID_INCLUDE' | 'INVALID_LINKS_OBJECT' | 'INVALID_PAGE_OBJECT' | 'INVALID_PAGE_VALUE' | 'INVALID_RESOURCE' | 'INVALID_RESOURCE_ID' | 'INVALID_SORT_CRITERIA' | 'INVALID_TOKEN' | 'KEY_NOT_INCLUDED_IN_URL' | 'KEY_ORDER_MISMATCH' | 'LOCKED' | 'NOT_ACCEPTABLE' | 'PARAM_MISSING' | 'PARAM_NOT_ALLOWED' | 'PAYMENT_NOT_APPROVED_FOR_EXECUTION' | 'PAYMENT_INTENT_AUTHENTICATION_FAILURE' | 'RECORD_NOT_FOUND' | 'RECORD_NOT_FOUND' | 'RELATION_EXISTS' | 'SAVE_FAILED' | 'TYPE_MISMATCH' | 'UNAUTHORIZED' | 'UNSUPPORTED_MEDIA_TYPE' | 'VALIDATION_ERROR';
|
|
4
|
-
export declare type ResourceErrorType = '
|
|
5
|
-
export interface BaseError {
|
|
6
|
-
code: CodeErrorType;
|
|
7
|
-
message: string;
|
|
8
|
-
resource?: ResourceErrorType | null;
|
|
9
|
-
field?: string;
|
|
10
|
-
id?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { FunctionChildren } from './index';
|
|
3
|
+
export declare type CodeErrorType = 'EMPTY_ERROR' | 'FILTER_NOT_ALLOWED' | 'FORBIDDEN' | 'INTERNAL_SERVER_ERROR' | 'INVALID_DATA_FORMAT' | 'INVALID_FIELD' | 'INVALID_FIELD_FORMAT' | 'INVALID_FIELD_VALUE' | 'INVALID_FILTERS_SYNTAX' | 'INVALID_FILTER_VALUE' | 'INVALID_INCLUDE' | 'INVALID_LINKS_OBJECT' | 'INVALID_PAGE_OBJECT' | 'INVALID_PAGE_VALUE' | 'INVALID_RESOURCE' | 'INVALID_RESOURCE_ID' | 'INVALID_SORT_CRITERIA' | 'INVALID_TOKEN' | 'KEY_NOT_INCLUDED_IN_URL' | 'KEY_ORDER_MISMATCH' | 'LOCKED' | 'NOT_ACCEPTABLE' | 'PARAM_MISSING' | 'PARAM_NOT_ALLOWED' | 'PAYMENT_NOT_APPROVED_FOR_EXECUTION' | 'PAYMENT_INTENT_AUTHENTICATION_FAILURE' | 'RECORD_NOT_FOUND' | 'RECORD_NOT_FOUND' | 'RELATION_EXISTS' | 'SAVE_FAILED' | 'TYPE_MISMATCH' | 'UNAUTHORIZED' | 'UNSUPPORTED_MEDIA_TYPE' | 'VALIDATION_ERROR';
|
|
4
|
+
export declare type ResourceErrorType = 'addresses' | 'billing_address' | 'gift_cards' | 'gift_card_or_coupon_code' | 'line_items' | 'orders' | 'payment_methods' | 'prices' | 'shipping_address' | 'sku_options' | 'variant';
|
|
5
|
+
export interface BaseError {
|
|
6
|
+
code: CodeErrorType;
|
|
7
|
+
message: string;
|
|
8
|
+
resource?: ResourceErrorType | null;
|
|
9
|
+
field?: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
detail?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const REType: ResourceErrorType[];
|
|
15
|
+
export declare const BaseErrorObject: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
+
code: PropTypes.Validator<CodeErrorType>;
|
|
17
|
+
message: PropTypes.Validator<string>;
|
|
18
|
+
resource: PropTypes.Requireable<ResourceErrorType>;
|
|
19
|
+
field: PropTypes.Requireable<string>;
|
|
20
|
+
id: PropTypes.Requireable<string>;
|
|
21
|
+
}>>;
|
|
22
|
+
export declare const ErrorPropTypes: {
|
|
23
|
+
resource: PropTypes.Validator<ResourceErrorType>;
|
|
24
|
+
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
+
field: PropTypes.Requireable<string>;
|
|
26
|
+
};
|
|
27
|
+
declare type ErrorChildrenComponentProps = FunctionChildren<Omit<ErrorComponentProps, 'children'> & {
|
|
28
|
+
errors: string[];
|
|
29
|
+
}>;
|
|
30
|
+
export interface ErrorComponentProps {
|
|
31
|
+
resource: ResourceErrorType;
|
|
32
|
+
children?: ErrorChildrenComponentProps;
|
|
33
|
+
field?: string;
|
|
34
|
+
messages?: {
|
|
35
|
+
code: CodeErrorType;
|
|
36
|
+
message: string;
|
|
37
|
+
resource?: ResourceErrorType;
|
|
38
|
+
field?: string;
|
|
39
|
+
id?: string;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import PropTypes from"prop-types";const CEType=["EMPTY_ERROR","FILTER_NOT_ALLOWED","FORBIDDEN","INTERNAL_SERVER_ERROR","INVALID_DATA_FORMAT","INVALID_FIELD","INVALID_FIELD_FORMAT","INVALID_FIELD_VALUE","INVALID_FILTERS_SYNTAX","INVALID_FILTER_VALUE","INVALID_INCLUDE","INVALID_LINKS_OBJECT","INVALID_PAGE_OBJECT","INVALID_PAGE_VALUE","INVALID_RESOURCE","INVALID_RESOURCE_ID","INVALID_SORT_CRITERIA","INVALID_TOKEN","KEY_NOT_INCLUDED_IN_URL","KEY_ORDER_MISMATCH","LOCKED","NOT_ACCEPTABLE","PARAM_MISSING","PARAM_NOT_ALLOWED","RECORD_NOT_FOUND","RECORD_NOT_FOUND","RELATION_EXISTS","SAVE_FAILED","TYPE_MISMATCH","UNAUTHORIZED","UNSUPPORTED_MEDIA_TYPE","VALIDATION_ERROR"];export const REType=["gift_cards","line_items","orders","prices","sku_options","variant"],BaseErrorObject=PropTypes.shape({code:PropTypes.oneOf(CEType).isRequired,message:PropTypes.string.isRequired,resource:PropTypes.oneOf(REType),field:PropTypes.string,id:PropTypes.string}),ErrorPropTypes={resource:PropTypes.oneOf(["billing_address","gift_cards","line_items","orders","payment_methods","prices","shipping_address","sku_options","variant"]).isRequired,children:PropTypes.func,field:PropTypes.string};
|