@commercelayer/react-components 2.53.3 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +3 -3
- package/lib/components/AdyenPayment.d.ts +3 -3
- package/lib/components/AdyenPayment.js +1 -1
- package/lib/components/AvailabilityContainer.d.ts +10 -3
- package/lib/components/AvailabilityContainer.js +1 -1
- package/lib/components/AvailabilityTemplate.d.ts +13 -4
- package/lib/components/AvailabilityTemplate.js +1 -1
- package/lib/components/BillingAddressContainer.d.ts +7 -2
- package/lib/components/BillingAddressContainer.js +1 -1
- package/lib/components/BillingAddressForm.d.ts +8 -3
- package/lib/components/BillingAddressForm.js +1 -1
- package/lib/components/BraintreePayment.d.ts +3 -3
- package/lib/components/BraintreePayment.js +1 -1
- package/lib/components/CheckoutComPayment.d.ts +23 -0
- package/lib/components/CheckoutComPayment.js +1 -0
- package/lib/components/CheckoutLink.d.ts +16 -4
- package/lib/components/CheckoutLink.js +1 -1
- package/lib/components/DeliveryLeadTime.d.ts +11 -4
- package/lib/components/DeliveryLeadTime.js +1 -1
- package/lib/components/DiscountAmount.d.ts +16 -2
- package/lib/components/DiscountAmount.js +1 -1
- package/lib/components/Errors.d.ts +4 -4
- package/lib/components/Errors.js +1 -1
- package/lib/components/ExternalFunction.d.ts +9 -2
- package/lib/components/ExternalFunction.js +1 -1
- package/lib/components/GiftCard.d.ts +13 -3
- package/lib/components/GiftCard.js +1 -1
- package/lib/components/GiftCardContainer.d.ts +9 -3
- package/lib/components/GiftCardContainer.js +1 -1
- package/lib/components/GiftCardCurrencySelector.d.ts +18 -3
- package/lib/components/GiftCardCurrencySelector.js +1 -1
- package/lib/components/GiftCardInput.d.ts +12 -3
- package/lib/components/GiftCardInput.js +1 -1
- package/lib/components/GiftCardOrCouponCode.d.ts +17 -6
- package/lib/components/GiftCardOrCouponCode.js +1 -1
- package/lib/components/GiftCardOrCouponForm.d.ts +9 -4
- package/lib/components/GiftCardOrCouponForm.js +1 -1
- package/lib/components/GiftCardOrCouponInput.d.ts +14 -3
- package/lib/components/GiftCardOrCouponInput.js +1 -1
- package/lib/components/GiftCardOrCouponRemoveButton.d.ts +15 -5
- package/lib/components/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/components/GiftCardOrCouponSubmit.d.ts +11 -4
- package/lib/components/GiftCardOrCouponSubmit.js +1 -1
- package/lib/components/ItemContainer.d.ts +14 -3
- package/lib/components/ItemContainer.js +1 -1
- package/lib/components/KlarnaPayment.d.ts +10 -0
- package/lib/components/KlarnaPayment.js +1 -0
- package/lib/components/LineItem.d.ts +10 -3
- package/lib/components/LineItem.js +1 -1
- package/lib/components/LineItemAmount.d.ts +16 -3
- package/lib/components/LineItemAmount.js +1 -1
- package/lib/components/LineItemCode.d.ts +10 -4
- package/lib/components/LineItemCode.js +1 -1
- package/lib/components/LineItemImage.d.ts +11 -4
- package/lib/components/LineItemImage.js +1 -1
- package/lib/components/LineItemName.d.ts +11 -5
- package/lib/components/LineItemName.js +1 -1
- package/lib/components/LineItemOption.d.ts +15 -4
- package/lib/components/LineItemOption.js +1 -1
- package/lib/components/LineItemOptions.d.ts +8 -3
- package/lib/components/LineItemOptions.js +1 -1
- package/lib/components/LineItemQuantity.d.ts +16 -4
- package/lib/components/LineItemQuantity.js +1 -1
- package/lib/components/LineItemRemoveLink.d.ts +15 -5
- package/lib/components/LineItemRemoveLink.js +1 -1
- package/lib/components/LineItemsContainer.d.ts +15 -3
- package/lib/components/LineItemsContainer.js +1 -1
- package/lib/components/LineItemsCount.d.ts +14 -4
- package/lib/components/LineItemsCount.js +1 -1
- package/lib/components/LineItemsEmpty.d.ts +13 -2
- package/lib/components/LineItemsEmpty.js +1 -1
- package/lib/components/MetadataInput.d.ts +13 -3
- package/lib/components/MetadataInput.js +1 -1
- package/lib/components/PaymentGateway.d.ts +4 -4
- package/lib/components/PaymentGateway.js +1 -1
- package/lib/components/PaymentMethod.d.ts +9 -3
- package/lib/components/PaymentMethod.js +1 -1
- package/lib/components/PaymentMethodAmount.d.ts +16 -2
- package/lib/components/PaymentMethodAmount.js +1 -1
- package/lib/components/PaymentMethodName.d.ts +10 -4
- package/lib/components/PaymentMethodName.js +1 -1
- package/lib/components/PaymentMethodPrice.d.ts +15 -4
- package/lib/components/PaymentMethodPrice.js +1 -1
- package/lib/components/PaymentMethodRadioButton.d.ts +11 -4
- package/lib/components/PaymentMethodRadioButton.js +1 -1
- package/lib/components/PaymentMethodsContainer.d.ts +9 -3
- package/lib/components/PaymentMethodsContainer.js +1 -1
- package/lib/components/PaymentSource.d.ts +9 -2
- package/lib/components/PaymentSource.js +1 -1
- package/lib/components/PaymentSourceBrandIcon.d.ts +14 -4
- package/lib/components/PaymentSourceBrandIcon.js +1 -1
- package/lib/components/PaymentSourceBrandName.d.ts +11 -4
- package/lib/components/PaymentSourceBrandName.js +1 -1
- package/lib/components/PaymentSourceDetail.d.ts +8 -2
- package/lib/components/PaymentSourceDetail.js +1 -1
- package/lib/components/PaymentSourceEditButton.d.ts +9 -2
- package/lib/components/PaymentSourceEditButton.js +1 -1
- package/lib/components/PaypalPayment.d.ts +2 -2
- package/lib/components/PaypalPayment.js +1 -1
- package/lib/components/Price.d.ts +15 -3
- package/lib/components/Price.js +1 -1
- package/lib/components/PricesContainer.d.ts +19 -3
- package/lib/components/PricesContainer.js +1 -1
- package/lib/components/QuantitySelector.d.ts +19 -5
- package/lib/components/QuantitySelector.js +1 -1
- package/lib/components/SaveAddressesButton.d.ts +18 -5
- package/lib/components/SaveAddressesButton.js +1 -1
- package/lib/components/SaveCustomerButton.d.ts +16 -5
- package/lib/components/SaveCustomerButton.js +1 -1
- package/lib/components/Shipment.d.ts +9 -2
- package/lib/components/Shipment.js +1 -1
- package/lib/components/ShipmentField.d.ts +11 -4
- package/lib/components/ShipmentField.js +1 -1
- package/lib/components/ShipmentsContainer.d.ts +9 -3
- package/lib/components/ShipmentsContainer.js +1 -1
- package/lib/components/ShippingAddressContainer.d.ts +7 -2
- package/lib/components/ShippingAddressContainer.js +1 -1
- package/lib/components/ShippingAddressForm.d.ts +8 -3
- package/lib/components/ShippingAddressForm.js +1 -1
- package/lib/components/ShippingAmount.d.ts +13 -2
- package/lib/components/ShippingAmount.js +1 -1
- package/lib/components/ShippingMethod.d.ts +10 -3
- package/lib/components/ShippingMethod.js +1 -1
- package/lib/components/ShippingMethodName.d.ts +11 -5
- package/lib/components/ShippingMethodName.js +1 -1
- package/lib/components/ShippingMethodPrice.d.ts +15 -3
- package/lib/components/ShippingMethodPrice.js +1 -1
- package/lib/components/ShippingMethodRadioButton.d.ts +11 -5
- package/lib/components/ShippingMethodRadioButton.js +1 -1
- package/lib/components/StockTransfer.d.ts +9 -3
- package/lib/components/StockTransfer.js +1 -1
- package/lib/components/StockTransferField.d.ts +9 -8
- package/lib/components/StockTransferField.js +1 -1
- package/lib/components/StripePayment.d.ts +3 -3
- package/lib/components/StripePayment.js +1 -1
- package/lib/components/SubmitButton.d.ts +15 -5
- package/lib/components/SubmitButton.js +1 -1
- package/lib/components/VariantSelector.d.ts +28 -5
- package/lib/components/VariantSelector.js +1 -1
- package/lib/components/VariantsContainer.d.ts +15 -3
- package/lib/components/VariantsContainer.js +1 -1
- package/lib/components/WireTransferPayment.d.ts +2 -2
- package/lib/components/WireTransferPayment.js +1 -1
- package/lib/components/addresses/Address.d.ts +18 -0
- package/lib/components/addresses/Address.js +1 -0
- package/lib/components/addresses/AddressCountrySelector.d.ts +26 -0
- package/lib/components/addresses/AddressCountrySelector.js +1 -0
- package/lib/components/addresses/AddressField.d.ts +43 -0
- package/lib/components/addresses/AddressField.js +1 -0
- package/lib/components/addresses/AddressInput.d.ts +19 -0
- package/lib/components/addresses/AddressInput.js +1 -0
- package/lib/components/addresses/AddressStateSelector.d.ts +27 -0
- package/lib/components/addresses/AddressStateSelector.js +1 -0
- package/lib/components/addresses/AddressesContainer.d.ts +15 -0
- package/lib/components/addresses/AddressesContainer.js +1 -0
- package/lib/components/auth/CommerceLayer.d.ts +15 -0
- package/lib/components/auth/CommerceLayer.js +1 -0
- package/lib/components/customers/CustomerAddressForm.d.ts +13 -0
- package/lib/components/customers/CustomerAddressForm.js +1 -0
- package/lib/components/customers/CustomerContainer.d.ts +17 -0
- package/lib/components/customers/CustomerContainer.js +1 -0
- package/lib/components/customers/CustomerField.d.ts +10 -0
- package/lib/components/customers/CustomerField.js +1 -0
- package/lib/components/customers/CustomerInput.d.ts +23 -0
- package/lib/components/customers/CustomerInput.js +1 -0
- package/lib/components/gateways/AdyenGateway.d.ts +2 -2
- package/lib/components/gateways/AdyenGateway.js +1 -1
- package/lib/components/gateways/BraintreeGateway.d.ts +2 -2
- package/lib/components/gateways/BraintreeGateway.js +1 -1
- package/lib/components/gateways/CheckoutComGateway.d.ts +5 -0
- package/lib/components/gateways/CheckoutComGateway.js +1 -0
- package/lib/components/gateways/KlarnaGateway.d.ts +5 -0
- package/lib/components/gateways/KlarnaGateway.js +1 -0
- package/lib/components/gateways/PaypalGateway.d.ts +3 -3
- package/lib/components/gateways/PaypalGateway.js +1 -1
- package/lib/components/gateways/StripeGateway.d.ts +2 -2
- package/lib/components/gateways/StripeGateway.js +1 -1
- package/lib/components/gateways/WireTransferGateway.d.ts +2 -2
- package/lib/components/gateways/WireTransferGateway.js +1 -1
- package/lib/components/orders/AddToCartButton.d.ts +34 -0
- package/lib/components/orders/AddToCartButton.js +1 -0
- package/lib/components/orders/AdjustmentAmount.d.ts +18 -0
- package/lib/components/orders/AdjustmentAmount.js +1 -0
- package/lib/components/orders/CartLink.d.ts +12 -0
- package/lib/components/orders/CartLink.js +1 -0
- package/lib/components/orders/GiftCardAmount.d.ts +15 -0
- package/lib/components/orders/GiftCardAmount.js +1 -0
- package/lib/components/orders/OrderContainer.d.ts +26 -0
- package/lib/components/orders/OrderContainer.js +1 -0
- package/lib/components/orders/OrderList.d.ts +61 -0
- package/lib/components/orders/OrderList.js +1 -0
- package/lib/components/orders/OrderListRow.d.ts +30 -0
- package/lib/components/orders/OrderListRow.js +1 -0
- package/lib/components/orders/OrderNumber.d.ts +11 -0
- package/lib/components/orders/OrderNumber.js +1 -0
- package/lib/components/orders/OrderStorage.d.ts +16 -0
- package/lib/components/orders/OrderStorage.js +1 -0
- package/lib/components/orders/PlaceOrderButton.d.ts +24 -0
- package/lib/components/orders/PlaceOrderButton.js +1 -0
- package/lib/components/orders/PlaceOrderContainer.d.ts +14 -0
- package/lib/components/orders/PlaceOrderContainer.js +1 -0
- package/lib/components/orders/PrivacyAndTermsCheckbox.d.ts +10 -0
- package/lib/components/orders/PrivacyAndTermsCheckbox.js +1 -0
- package/lib/components/orders/SubTotalAmount.d.ts +18 -0
- package/lib/components/orders/SubTotalAmount.js +1 -0
- package/lib/components/orders/TaxesAmount.d.ts +18 -0
- package/lib/components/orders/TaxesAmount.js +1 -0
- package/lib/components/orders/TotalAmount.d.ts +18 -0
- package/lib/components/orders/TotalAmount.js +1 -0
- package/lib/components/skus/SkuField.d.ts +14 -0
- package/lib/components/skus/SkuField.js +1 -0
- package/lib/components/skus/SkuList.d.ts +14 -0
- package/lib/components/skus/SkuList.js +1 -0
- package/lib/components/skus/SkuListsContainer.d.ts +12 -0
- package/lib/components/skus/SkuListsContainer.js +1 -0
- package/lib/components/skus/SkuOption.d.ts +14 -0
- package/lib/components/skus/SkuOption.js +1 -0
- package/lib/components/skus/SkuOptionInput.d.ts +15 -0
- package/lib/components/skus/SkuOptionInput.js +1 -0
- package/lib/components/skus/SkuOptionsContainer.d.ts +14 -0
- package/lib/components/skus/SkuOptionsContainer.js +1 -0
- package/lib/components/skus/Skus.d.ts +11 -0
- package/lib/components/skus/Skus.js +1 -0
- package/lib/components/skus/SkusContainer.d.ts +23 -0
- package/lib/components/skus/SkusContainer.js +1 -0
- package/lib/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/components/utils/BaseField.js +1 -1
- package/lib/components/utils/BaseInput.d.ts +1 -1
- package/lib/components/utils/BaseInput.js +1 -1
- package/lib/components/utils/BaseOrderPrice.js +1 -1
- package/lib/components/utils/BaseSelect.js +1 -1
- package/lib/components/utils/GenericFieldComponent.d.ts +42 -0
- package/lib/components/utils/GenericFieldComponent.js +1 -0
- package/lib/components/utils/Parent.d.ts +3 -5
- package/lib/components/utils/Parent.js +1 -1
- package/lib/components/utils/PaymentCardsTemplate.d.ts +2 -2
- package/lib/components/utils/PaymentCardsTemplate.js +1 -1
- package/lib/components/utils/PriceTemplate.d.ts +2 -2
- package/lib/components/utils/PriceTemplate.js +1 -1
- package/lib/components/utils/VariantTemplate.js +1 -1
- package/lib/components/utils/getAllErrors.js +1 -1
- package/lib/config/components.d.ts +77 -35
- package/lib/config/components.js +1 -1
- package/lib/context/AddressChildrenContext.d.ts +1 -1
- package/lib/context/AddressChildrenContext.js +1 -1
- package/lib/context/AddressContext.d.ts +1 -1
- package/lib/context/BillingAddressContext.d.ts +2 -4
- package/lib/context/BillingAddressContext.js +1 -1
- package/lib/context/BillingAddressFormContext.d.ts +17 -10
- package/lib/context/CouponAndGiftCardFormContext.d.ts +2 -0
- package/lib/context/CustomerAddressFormContext.d.ts +20 -0
- package/lib/context/CustomerAddressFormContext.js +1 -0
- package/lib/context/CustomerContext.d.ts +17 -11
- package/lib/context/CustomerContext.js +1 -1
- package/lib/context/OrderContext.d.ts +8 -4
- package/lib/context/OrderContext.js +1 -1
- package/lib/context/OrderListChildrenContext.d.ts +60 -0
- package/lib/context/OrderListChildrenContext.js +1 -0
- package/lib/context/PaymentSourceContext.d.ts +4 -4
- package/lib/context/PlaceOrderContext.d.ts +4 -2
- package/lib/context/ShippingAddressContext.d.ts +1 -1
- package/lib/context/SkuChildrenContext.d.ts +9 -0
- package/lib/context/SkuChildrenContext.js +1 -0
- package/lib/context/SkuContext.d.ts +9 -0
- package/lib/context/SkuContext.js +1 -0
- package/lib/index.d.ts +101 -90
- package/lib/index.js +1 -1
- package/lib/reducers/AddressReducer.d.ts +4 -2
- package/lib/reducers/AddressReducer.js +1 -1
- package/lib/reducers/AvailabilityReducer.d.ts +8 -0
- package/lib/reducers/AvailabilityReducer.js +1 -1
- package/lib/reducers/BillingAddressReducer.js +1 -1
- package/lib/reducers/CustomerReducer.d.ts +98 -17
- package/lib/reducers/CustomerReducer.js +1 -1
- package/lib/reducers/GiftCardReducer.js +1 -1
- package/lib/reducers/LineItemReducer.js +1 -1
- package/lib/reducers/OrderReducer.d.ts +24 -8
- package/lib/reducers/OrderReducer.js +1 -1
- package/lib/reducers/PaymentMethodReducer.d.ts +51 -5
- package/lib/reducers/PaymentMethodReducer.js +1 -1
- package/lib/reducers/PlaceOrderReducer.d.ts +9 -2
- package/lib/reducers/PlaceOrderReducer.js +1 -1
- package/lib/reducers/ShipmentReducer.js +1 -1
- package/lib/reducers/ShippingAddressReducer.js +1 -1
- package/lib/reducers/SkuReducer.d.ts +21 -0
- package/lib/reducers/SkuReducer.js +1 -0
- package/lib/reducers/VariantReducer.d.ts +1 -0
- package/lib/reducers/VariantReducer.js +1 -1
- package/lib/typings/errors.d.ts +13 -4
- package/lib/typings/errors.js +1 -1
- package/lib/typings/index.d.ts +17 -6
- package/lib/utils/addressesManager.d.ts +1 -1
- package/lib/utils/addressesManager.js +1 -1
- package/lib/utils/checkIncludeResource.d.ts +8 -0
- package/lib/utils/checkIncludeResource.js +1 -0
- package/lib/utils/childrenTypes.d.ts +1 -1
- package/lib/utils/childrenTypes.js +1 -1
- package/lib/utils/compareObjAttribute.d.ts +7 -0
- package/lib/utils/compareObjAttribute.js +1 -0
- package/lib/utils/customMessages.d.ts +1 -7
- package/lib/utils/customMessages.js +1 -1
- package/lib/utils/getCardDetails.d.ts +15 -0
- package/lib/utils/getCardDetails.js +1 -0
- package/lib/utils/getCartLink.d.ts +7 -0
- package/lib/utils/getCartLink.js +1 -0
- package/lib/utils/getCurrentItemKey.js +1 -1
- package/lib/utils/getErrors.d.ts +1 -1
- package/lib/utils/getErrors.js +1 -1
- package/lib/utils/getLineItemsCount.d.ts +8 -10
- package/lib/utils/getLineItemsCount.js +1 -1
- package/lib/utils/getLoaderComponent.js +1 -1
- package/lib/utils/getPrices.js +1 -1
- package/lib/utils/getSkus.js +1 -1
- package/lib/utils/hooks/useExternalScript.d.ts +1 -0
- package/lib/utils/hooks/useExternalScript.js +1 -0
- package/lib/utils/icons.d.ts +3 -0
- package/lib/utils/icons.js +1 -0
- package/lib/utils/isDate.d.ts +1 -0
- package/lib/utils/isDate.js +1 -0
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/placeholderImages.d.ts +2 -0
- package/lib/utils/placeholderImages.js +1 -0
- package/lib/utils/promisify.js +1 -1
- package/lib/utils/scrollbarWidth.d.ts +1 -0
- package/lib/utils/scrollbarWidth.js +1 -0
- package/lib/utils/shipments.d.ts +2 -1
- package/lib/utils/shipments.js +1 -1
- package/lib/utils/validateFormFields.d.ts +2 -0
- package/lib/utils/validateFormFields.js +1 -1
- package/package.json +96 -93
- package/lib/components/AddToCartButton.d.ts +0 -20
- package/lib/components/AddToCartButton.js +0 -1
- package/lib/components/Address.d.ts +0 -13
- package/lib/components/Address.js +0 -1
- package/lib/components/AddressCountrySelector.d.ts +0 -9
- package/lib/components/AddressCountrySelector.js +0 -1
- package/lib/components/AddressField.d.ts +0 -15
- package/lib/components/AddressField.js +0 -1
- package/lib/components/AddressInput.d.ts +0 -7
- package/lib/components/AddressInput.js +0 -1
- package/lib/components/AddressStateSelector.d.ts +0 -11
- package/lib/components/AddressStateSelector.js +0 -1
- package/lib/components/AddressesContainer.d.ts +0 -7
- package/lib/components/AddressesContainer.js +0 -1
- package/lib/components/AdjustmentAmount.d.ts +0 -4
- package/lib/components/AdjustmentAmount.js +0 -1
- package/lib/components/CommerceLayer.d.ts +0 -8
- package/lib/components/CommerceLayer.js +0 -1
- package/lib/components/CustomerContainer.d.ts +0 -7
- package/lib/components/CustomerContainer.js +0 -1
- package/lib/components/CustomerInput.d.ts +0 -11
- package/lib/components/CustomerInput.js +0 -1
- package/lib/components/GiftCardAmount.d.ts +0 -4
- package/lib/components/GiftCardAmount.js +0 -1
- package/lib/components/OrderContainer.d.ts +0 -11
- package/lib/components/OrderContainer.js +0 -1
- package/lib/components/OrderNumber.d.ts +0 -5
- package/lib/components/OrderNumber.js +0 -1
- package/lib/components/OrderStorage.d.ts +0 -8
- package/lib/components/OrderStorage.js +0 -1
- package/lib/components/PlaceOrderButton.d.ts +0 -12
- package/lib/components/PlaceOrderButton.js +0 -1
- package/lib/components/PlaceOrderContainer.d.ts +0 -8
- package/lib/components/PlaceOrderContainer.js +0 -1
- package/lib/components/PrivacyAndTermsCheckbox.d.ts +0 -4
- package/lib/components/PrivacyAndTermsCheckbox.js +0 -1
- package/lib/components/SkuList.d.ts +0 -7
- package/lib/components/SkuList.js +0 -1
- package/lib/components/SkuListsContainer.d.ts +0 -6
- package/lib/components/SkuListsContainer.js +0 -1
- package/lib/components/SkuOption.d.ts +0 -7
- package/lib/components/SkuOption.js +0 -1
- package/lib/components/SkuOptionInput.d.ts +0 -5
- package/lib/components/SkuOptionInput.js +0 -1
- package/lib/components/SkuOptionsContainer.d.ts +0 -7
- package/lib/components/SkuOptionsContainer.js +0 -1
- package/lib/components/SubTotalAmount.d.ts +0 -4
- package/lib/components/SubTotalAmount.js +0 -1
- package/lib/components/TaxesAmount.d.ts +0 -4
- package/lib/components/TaxesAmount.js +0 -1
- package/lib/components/TotalAmount.d.ts +0 -4
- package/lib/components/TotalAmount.js +0 -1
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LoaderType } from '../typings/index';
|
|
3
|
-
declare type
|
|
3
|
+
declare type Props = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
filters?: object;
|
|
6
6
|
loader?: LoaderType;
|
|
7
7
|
perPage?: number;
|
|
8
8
|
skuCode?: string;
|
|
9
9
|
};
|
|
10
|
-
declare
|
|
10
|
+
export declare function PricesContainer(props: Props): JSX.Element;
|
|
11
|
+
export declare namespace PricesContainer {
|
|
12
|
+
var propTypes: {
|
|
13
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
14
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
15
|
+
loader: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
|
|
16
|
+
perPage: import("prop-types").Requireable<number>;
|
|
17
|
+
filters: import("prop-types").Requireable<object>;
|
|
18
|
+
};
|
|
19
|
+
var defaultProps: {
|
|
20
|
+
perPage: number;
|
|
21
|
+
filters: {};
|
|
22
|
+
loader: string;
|
|
23
|
+
skuCode: string;
|
|
24
|
+
};
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
11
27
|
export default PricesContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import getPrices from"../utils/getPrices";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import getPrices from"../utils/getPrices";import isEmpty from"lodash/isEmpty";import has from"lodash/has";import indexOf from"lodash/indexOf";import CommerceLayerContext from"../context/CommerceLayerContext";import priceReducer,{unsetPriceState}from"../reducers/PriceReducer";import{priceInitialState,getSkusPrice}from"../reducers/PriceReducer";import PricesContext from"../context/PricesContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuContext from"../context/SkuContext";const propTypes=components.PricesContainer.propTypes,defaultProps=components.PricesContainer.defaultProps,displayName=components.PricesContainer.displayName;export function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{skuCodes}=useContext(SkuContext),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=useContext(ItemContext);indexOf(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode||getCurrentItemKey(currentItem)||itemSkuCode||"",setSkuCodes=skuCodes2=>{dispatch({type:"setSkuCodes",payload:{skuCodes:skuCodes2}})};useEffect(()=>{if(state.skuCodes.length===0&&skuCodes&&skuCodes.length>0&&setSkuCodes(skuCodes),currentItem&&has(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!isEmpty(items)&&isEmpty(currentItem)){const p=getPrices(items);dispatch({type:"setPrices",payload:{prices:p}})}return config.accessToken&&!has(prices,itemSkuCode||sCode)&&(state.skuCodes.length>0||itemSkuCode||sCode)&&getSkusPrice(sCode&&[itemSkuCode||sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),config.accessToken&&isEmpty(currentItem)&&(state.skuCodes.length>0||skuCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{isEmpty(currentItem)&&unsetPriceState(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length,itemSkuCode]);const priceValue=Object.assign(Object.assign({},state),{skuCode:sCode,loader,setSkuCodes});return _jsx(PricesContext.Provider,Object.assign({value:priceValue},{children}))}PricesContainer.propTypes=propTypes,PricesContainer.defaultProps=defaultProps,PricesContainer.displayName=displayName;export default PricesContainer;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
|
-
declare type
|
|
3
|
+
declare type ChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
|
|
4
4
|
handleChange: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
5
5
|
handleBlur: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
6
6
|
}>;
|
|
7
|
-
declare type
|
|
8
|
-
children?:
|
|
7
|
+
declare type Props = {
|
|
8
|
+
children?: ChildrenProps;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
min?: number;
|
|
11
11
|
max?: number;
|
|
@@ -13,5 +13,19 @@ declare type QuantitySelectorProps = {
|
|
|
13
13
|
skuCode?: string;
|
|
14
14
|
skuListId?: string;
|
|
15
15
|
} & JSX.IntrinsicElements['input'];
|
|
16
|
-
declare
|
|
16
|
+
export declare function QuantitySelector(props: Props): JSX.Element;
|
|
17
|
+
export declare namespace QuantitySelector {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
20
|
+
min: import("prop-types").Requireable<number>;
|
|
21
|
+
max: import("prop-types").Requireable<number>;
|
|
22
|
+
value: import("prop-types").Requireable<string>;
|
|
23
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
24
|
+
disabled: import("prop-types").Requireable<boolean>;
|
|
25
|
+
};
|
|
26
|
+
var defaultProps: {
|
|
27
|
+
min: number;
|
|
28
|
+
};
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
17
31
|
export default QuantitySelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"./utils/Parent";import
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"./utils/Parent";import has from"lodash/has";import isEmpty from"lodash/isEmpty";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.QuantitySelector.propTypes,defaultProps=components.QuantitySelector.defaultProps,displayName=components.QuantitySelector.displayName;export function QuantitySelector(props){var _a,_b,_c;const{skuCode,skuListId,children,min=1,max}=props,p=__rest(props,["skuCode","skuListId","children","min","max"]),{item,setQuantity,items,quantity,prices,skuCode:itemSkuCode}=useContext(ItemContext),{sku}=useContext(SkuChildrenContext),{skuLists,listIds}=useContext(SkuListsContext),defaultVal=p?.value||min,[value,setValue]=useState(defaultVal),[disabled,setDisabled]=useState(!!p.disabled),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:sku?.code||skuCode||getCurrentItemKey(item)||itemSkuCode,inventory=isEmpty(item)?50:(_c=(_b=item[sCode])===null||_b===void 0?void 0:_b.inventory)===null||_c===void 0?void 0:_c.quantity,maxInv=max||inventory;useEffect(()=>{if(setValue(defaultVal),(!prices[sCode]||!sCode)&&setDisabled(!0),skuListId&&setDisabled(!1),sCode&&!quantity[sCode]){const qty=Number(defaultVal);setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:qty})),!isEmpty(prices)&&has(prices,sCode)&&setDisabled(!1)}return()=>{setValue(defaultVal)}},[item,listIds,prices,quantity]);const handleChange=e=>{const qty=Number(e.target.value),valid=Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv);setValue(qty),!isEmpty(skuLists)&&skuListId&&valid?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(qty)})):sCode&&valid&&setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(qty)}))},handleBlur=e=>{const qty=e.target.value;if(!(Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv))){const resetVal=Number(qty)<Number(min)?min:maxInv;resetVal&&setValue(resetVal),!isEmpty(skuLists)&&skuListId?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(resetVal)})):setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(resetVal)}))}},parentProps=Object.assign({min,max:maxInv,disabled,handleChange,handleBlur,value},props);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("input",Object.assign({type:"number",max:maxInv,min,value:value||"",disabled,onChange:handleChange,onBlur:handleBlur},p))}QuantitySelector.propTypes=propTypes,QuantitySelector.defaultProps=defaultProps,QuantitySelector.displayName=displayName;export default QuantitySelector;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
|
-
declare type
|
|
4
|
-
declare type
|
|
5
|
-
children?:
|
|
3
|
+
declare type ChildrenProps = FunctionChildren<Omit<Props, 'children'>>;
|
|
4
|
+
declare type Props = {
|
|
5
|
+
children?: ChildrenProps;
|
|
6
6
|
label?: string | ReactNode;
|
|
7
7
|
onClick?: () => void;
|
|
8
|
+
addressId?: string;
|
|
8
9
|
} & JSX.IntrinsicElements['button'];
|
|
9
|
-
declare
|
|
10
|
+
export declare function SaveAddressesButton(props: Props): JSX.Element;
|
|
11
|
+
export declare namespace SaveAddressesButton {
|
|
12
|
+
var propTypes: {
|
|
13
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
14
|
+
label: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
|
|
15
|
+
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
16
|
+
disabled: import("prop-types").Requireable<boolean>;
|
|
17
|
+
};
|
|
18
|
+
var defaultProps: {
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
10
23
|
export default SaveAddressesButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState}from"react";import Parent from"./utils/Parent";import components from"../config/components";import AddressContext from"../context/AddressContext";import{
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState}from"react";import Parent from"./utils/Parent";import components from"../config/components";import AddressContext from"../context/AddressContext";import{shippingAddressController,countryLockController,billingAddressController}from"../utils/addressesManager";import OrderContext from"../context/OrderContext";import CustomerContext from"../context/CustomerContext";import isFunction from"lodash/isFunction";const propTypes=components.SaveAddressesButton.propTypes,defaultProps=components.SaveAddressesButton.defaultProps,displayName=components.SaveAddressesButton.displayName;export function SaveAddressesButton(props){const{children,label="Continue to delivery",resource,disabled=!1,addressId,onClick}=props,p=__rest(props,["children","label","resource","disabled","addressId","onClick"]),{errors,billing_address,shipToDifferentAddress,shipping_address,saveAddresses,billingAddressId,shippingAddressId}=useContext(AddressContext),{order}=useContext(OrderContext),{addresses,isGuest,createCustomerAddress}=useContext(CustomerContext),[forceDisable,setForceDisable]=useState(disabled),customerEmail=(isGuest===!0||typeof isGuest>"u")&&!order?.customer_email,billingDisable=billingAddressController({billing_address,errors,billingAddressId,requiresBillingInfo:order?.requires_billing_info}),shippingDisable=shippingAddressController({billingDisable,errors,shipToDifferentAddress,shipping_address,shippingAddressId}),countryLockDisable=countryLockController({countryCodeLock:order?.shipping_country_code_lock,addresses,shipToDifferentAddress,billingAddressId,billing_address,shipping_address,shippingAddressId}),disable=disabled||customerEmail||billingDisable||shippingDisable||countryLockDisable,handleClick=()=>{if(errors&&Object.keys(errors).length===0&&!disable){if(setForceDisable(!0),order)saveAddresses(addressId);else if(createCustomerAddress&&billing_address){const address=Object.assign({},billing_address);addressId&&(address.id=addressId),createCustomerAddress(address)}setForceDisable(!1),onClick&&onClick()}},parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({type:"button",disabled:disable||forceDisable,onClick:handleClick},p,{children:isFunction(label)?label():label}))}SaveAddressesButton.propTypes=propTypes,SaveAddressesButton.defaultProps=defaultProps,SaveAddressesButton.displayName=displayName;export default SaveAddressesButton;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
3
|
declare type ParentProps = {
|
|
4
4
|
handleClick: () => any;
|
|
5
5
|
};
|
|
6
|
-
declare type
|
|
7
|
-
declare type
|
|
8
|
-
children?:
|
|
6
|
+
declare type ChildrenProps = FunctionChildren<Omit<Props & ParentProps, 'children'>>;
|
|
7
|
+
declare type Props = {
|
|
8
|
+
children?: ChildrenProps;
|
|
9
9
|
label?: string | ReactNode;
|
|
10
10
|
onClick?: () => void;
|
|
11
11
|
} & JSX.IntrinsicElements['button'];
|
|
12
|
-
declare
|
|
12
|
+
export declare function SaveCustomerButton(props: Props): JSX.Element;
|
|
13
|
+
export declare namespace SaveCustomerButton {
|
|
14
|
+
var propTypes: {
|
|
15
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
16
|
+
label: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
|
|
17
|
+
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
18
|
+
};
|
|
19
|
+
var defaultProps: {
|
|
20
|
+
label: string;
|
|
21
|
+
};
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
13
24
|
export default SaveCustomerButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import{isEmpty}from"lodash";import CustomerContext from"../context/CustomerContext";const propTypes=components.SaveCustomerButton.propTypes,defaultProps=components.SaveCustomerButton.defaultProps,displayName=components.SaveCustomerButton.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import{isEmpty}from"lodash";import CustomerContext from"../context/CustomerContext";const propTypes=components.SaveCustomerButton.propTypes,defaultProps=components.SaveCustomerButton.defaultProps,displayName=components.SaveCustomerButton.displayName;export function SaveCustomerButton(props){const{children,label="Save",resource,disabled,onClick}=props,p=__rest(props,["children","label","resource","disabled","onClick"]),{errors,saveCustomerUser,customerEmail}=useContext(CustomerContext),disable=disabled||!isEmpty(errors)||isEmpty(customerEmail),handleClick=async()=>{isEmpty(errors)&&!disable&&(saveCustomerUser&&await saveCustomerUser(customerEmail),onClick&&onClick())},parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({type:"button",disabled:disable,onClick:void 0},p,{children:label}))}SaveCustomerButton.propTypes=propTypes,SaveCustomerButton.defaultProps=defaultProps,SaveCustomerButton.displayName=displayName;export default SaveCustomerButton;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LoaderType } from '../typings/index';
|
|
3
3
|
declare type ShipmentProps = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
loader?: LoaderType;
|
|
6
|
+
autoSelectSingleShippingMethod?: boolean | (() => void);
|
|
6
7
|
};
|
|
7
|
-
declare
|
|
8
|
+
export declare function Shipment({ children, loader, autoSelectSingleShippingMethod, }: ShipmentProps): JSX.Element;
|
|
9
|
+
export declare namespace Shipment {
|
|
10
|
+
var propTypes: {
|
|
11
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
8
15
|
export default Shipment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShipmentContext from"../context/ShipmentContext";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import components from"../config/components";import getLoaderComponent from"../utils/getLoaderComponent";const propTypes=components.Shipment.propTypes,displayName=components.Shipment.displayName;export function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=useState(!0),{shipments,deliveryLeadTimes,setShippingMethod}=useContext(ShipmentContext);useEffect(()=>{shipments&&(autoSelectSingleShippingMethod?(async()=>await shipments.forEach(async shipment=>{var _a;const isSingle=((_a=shipment?.available_shipping_methods)===null||_a===void 0?void 0:_a.length)===1;if(!shipment?.shipping_method&&isSingle){const[shippingMethod]=shipment?.available_shipping_methods||[];shippingMethod&&await setShippingMethod(shipment.id,shippingMethod.id),typeof autoSelectSingleShippingMethod=="function"&&autoSelectSingleShippingMethod()}else setTimeout(()=>{setLoading(!1)},200)}))():setLoading(!1))},[shipments]);const components2=shipments&&shipments.map((shipment,k)=>{var _a,_b;const shipmentLineItems=shipment.shipment_line_items,lineItems=shipmentLineItems?.map(shipmentLineItem=>{const l=shipmentLineItem.line_item;return l&&(l.quantity=shipmentLineItem.quantity),l}),shippingMethods=shipment.available_shipping_methods,currentShippingMethodId=autoSelectSingleShippingMethod&&shippingMethods&&shippingMethods.length===1?(_a=shippingMethods[0])===null||_a===void 0?void 0:_a.id:(_b=shipment.shipping_method)===null||_b===void 0?void 0:_b.id,stockTransfers=shipment.stock_transfers,times=deliveryLeadTimes?.filter(time=>{var _a2,_b2;return((_a2=time.stock_location)===null||_a2===void 0?void 0:_a2.id)===((_b2=shipment.stock_location)===null||_b2===void 0?void 0:_b2.id)}),shipmentProps={lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:k+1};return _jsx(ShipmentChildrenContext.Provider,Object.assign({value:shipmentProps},{children}),k)});return loading?getLoaderComponent(loader):_jsx(_Fragment,{children:components2})}Shipment.propTypes=propTypes,Shipment.displayName=displayName;export default Shipment;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { Shipment } from '@commercelayer/sdk';
|
|
3
|
-
declare type ShipmentFieldChildrenProps = Omit<
|
|
3
|
+
declare type ShipmentFieldChildrenProps = Omit<Props, 'children'> & {
|
|
4
4
|
shipment: Shipment;
|
|
5
5
|
};
|
|
6
6
|
export declare type ShipmentAttribute = 'number' | 'currency_code' | 'status' | 'cost_amount_cents' | 'cost_amount_float' | 'formatted_cost_amount' | 'key_number';
|
|
7
|
-
declare type
|
|
7
|
+
declare type Props = {
|
|
8
8
|
children?: (props: ShipmentFieldChildrenProps) => ReactNode;
|
|
9
9
|
name: ShipmentAttribute;
|
|
10
10
|
} & JSX.IntrinsicElements['span'];
|
|
11
|
-
declare
|
|
11
|
+
export declare function ShipmentField(props: Props): JSX.Element;
|
|
12
|
+
export declare namespace ShipmentField {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
name: import("prop-types").Validator<ShipmentAttribute>;
|
|
16
|
+
};
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
12
19
|
export default ShipmentField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import get from"lodash/get";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";const propTypes=components.ShipmentField.propTypes,displayName=components.ShipmentField.displayName
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import get from"lodash/get";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";const propTypes=components.ShipmentField.propTypes,displayName=components.ShipmentField.displayName;export function ShipmentField(props){const{name}=props,{shipment,keyNumber}=useContext(ShipmentChildrenContext),key=name,text=key!=="key_number"?get(shipment,key):keyNumber,parentProps=Object.assign({shipment},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("span",Object.assign({},props,{children:text}))}ShipmentField.propTypes=propTypes,ShipmentField.displayName=displayName;export default ShipmentField;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare type
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
};
|
|
5
|
-
declare
|
|
5
|
+
export declare function ShipmentsContainer(props: Props): JSX.Element;
|
|
6
|
+
export declare namespace ShipmentsContainer {
|
|
7
|
+
var propTypes: {
|
|
8
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
9
|
+
};
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
6
12
|
export default ShipmentsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName;export function ShipmentsContainer(props){const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),order&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order,include,includeLoaded]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type})=>item_type==="skus").map(lineItem=>{var _a,_b,_c,_d;return!!(((_a=lineItem.item)===null||_a===void 0?void 0:_a.do_not_ship)||((_b=lineItem.item)===null||_b===void 0?void 0:_b.do_not_track)||((_d=(_c=lineItem.item)===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity)>=lineItem?.quantity)}).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order?.shipments]);const contextValue=Object.assign(Object.assign({},state),{setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})});return _jsx(ShipmentContext.Provider,Object.assign({value:contextValue},{children}))}ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
};
|
|
5
|
-
declare
|
|
5
|
+
export declare function ShippingAddressContainer(props: Props): JSX.Element;
|
|
6
|
+
export declare namespace ShippingAddressContainer {
|
|
7
|
+
var propTypes: {
|
|
8
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
6
11
|
export default ShippingAddressContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import ShippingAddressContext from"../context/ShippingAddressContext";import{useContext,useEffect,useReducer}from"react";import shippingAddressReducer,{setShippingAddress,shippingAddressInitialState,setShippingCustomerAddressId}from"../reducers/ShippingAddressReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";const propTypes=components.ShippingAddressContainer.propTypes
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import ShippingAddressContext from"../context/ShippingAddressContext";import{useContext,useEffect,useReducer}from"react";import shippingAddressReducer,{setShippingAddress,shippingAddressInitialState,setShippingCustomerAddressId}from"../reducers/ShippingAddressReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";const propTypes=components.ShippingAddressContainer.propTypes;export function ShippingAddressContainer(props){const{children}=props,[state,dispatch]=useReducer(shippingAddressReducer,shippingAddressInitialState),config=useContext(CommerceLayerContext),{order}=useContext(OrderContext),{setCloneAddress}=useContext(AddressContext);useEffect(()=>(order&&config&&setShippingCustomerAddressId({dispatch,order,setCloneAddress}),()=>{dispatch({type:"cleanup",payload:{}})}),[config,order]);const contextValue=Object.assign(Object.assign({},state),{setShippingAddress:async(id,options)=>{await setShippingAddress(id,{config,dispatch,order,customerAddressId:options?.customerAddressId}),setCloneAddress(id,"shipping_address")}});return _jsx(ShippingAddressContext.Provider,Object.assign({value:contextValue},{children}))}ShippingAddressContainer.propTypes=propTypes;export default ShippingAddressContainer;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare type
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
reset?: boolean;
|
|
5
5
|
errorClassName?: string;
|
|
6
6
|
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
7
|
-
declare
|
|
7
|
+
export declare function ShippingAddressForm(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace ShippingAddressForm {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
8
13
|
export default ShippingAddressForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import AddressesContext from"../context/AddressContext";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import ShippingAddressFormContext from"../context/ShippingAddressFormContext";import{isEmpty}from"lodash";import components from"../config/components";import OrderContext from"../context/OrderContext";import{getSaveShippingAddressToAddressBook}from"../utils/localStorage";const propTypes=components.ShippingAddressForm.propTypes
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import AddressesContext from"../context/AddressContext";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import ShippingAddressFormContext from"../context/ShippingAddressFormContext";import{isEmpty}from"lodash";import components from"../config/components";import OrderContext from"../context/OrderContext";import{getSaveShippingAddressToAddressBook}from"../utils/localStorage";import{businessMandatoryField}from"../utils/validateFormFields";const propTypes=components.ShippingAddressForm.propTypes;export function ShippingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1}=props,p=__rest(props,["children","errorClassName","autoComplete","reset"]),{validation,values,errors,reset:resetForm}=useRapidForm(),{setAddressErrors,setAddress,shipToDifferentAddress,isBusiness}=useContext(AddressesContext),{saveAddressToCustomerAddressBook,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),ref=useRef(null);useEffect(()=>{var _a,_b,_c,_d,_e;if(include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address"}),isEmpty(errors)){if(!isEmpty(values)&&shipToDifferentAddress){setAddressErrors([],"shipping_address");for(const name in values){const field=values[name];businessMandatoryField(name,isBusiness)||delete values[name],(field?.value||field?.required===!1&&field?.type!=="checkbox")&&(values[name.replace("shipping_address_","")]=field.value,delete values[name]),field?.type==="checkbox"&&(delete values[name],saveAddressToCustomerAddressBook({type:"shipping_address",value:field.checked}))}setAddress({values:Object.assign(Object.assign({},values),isBusiness&&{business:isBusiness}),resource:"shipping_address"})}}else{const formErrors=[];for(const fieldName in errors){const code=(_a=errors[fieldName])===null||_a===void 0?void 0:_a.code,message=(_b=errors[fieldName])===null||_b===void 0?void 0:_b.message;["shipping_address_state_code"].includes(fieldName)?isEmpty(values.state_code)?delete errors[fieldName]:formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName}):formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName})}shipToDifferentAddress&&setAddressErrors(formErrors,"shipping_address")}const checkboxChecked=((_d=(_c=ref.current)===null||_c===void 0?void 0:_c.querySelector('[name="shipping_address_save_to_customer_book"]'))===null||_d===void 0?void 0:_d.checked)||getSaveShippingAddressToAddressBook();reset&&(!isEmpty(values)||!isEmpty(errors)||checkboxChecked)&&(saveAddressToCustomerAddressBook&&saveAddressToCustomerAddressBook({type:"shipping_address",value:!1}),ref&&((_e=ref.current)===null||_e===void 0||_e.reset(),resetForm({target:ref.current}),setAddressErrors([],"shipping_address"),setAddress({values:{},resource:"shipping_address"})))},[values,errors,shipToDifferentAddress,reset,include,includeLoaded,isBusiness]);const providerValues={values,validation,setValue:(name,value)=>{const field={[name.replace("shipping_address_","")]:value};setAddress({values:Object.assign(Object.assign(Object.assign({},values),field),isBusiness&&{business:isBusiness}),resource:"shipping_address"})},errorClassName,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return _jsx(ShippingAddressFormContext.Provider,Object.assign({value:providerValues},{children:_jsx("form",Object.assign({ref,autoComplete},p,{children}))}))}ShippingAddressForm.propTypes=propTypes;export default ShippingAddressForm;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../typings/index';
|
|
3
|
-
declare
|
|
3
|
+
export declare function ShippingAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
+
export declare namespace ShippingAmount {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
id: import("prop-types").Requireable<string>;
|
|
7
|
+
className: import("prop-types").Requireable<string>;
|
|
8
|
+
style: import("prop-types").Requireable<object>;
|
|
9
|
+
name: import("prop-types").Requireable<string>;
|
|
10
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
11
|
+
format: import("prop-types").Requireable<import("../typings/index").BaseFormatPrice>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
4
15
|
export default ShippingAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.ShippingAmount.propTypes,displayName=components.ShippingAmount.displayName
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.ShippingAmount.propTypes,displayName=components.ShippingAmount.displayName;export function ShippingAmount(props){return _jsx(BaseOrderPrice,Object.assign({base:"amount",type:"shipping"},props))}ShippingAmount.propTypes=propTypes,ShippingAmount.displayName=displayName;export default ShippingAmount;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare type
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
readonly?: boolean;
|
|
5
5
|
emptyText?: string;
|
|
6
6
|
};
|
|
7
|
-
declare
|
|
7
|
+
export declare function ShippingMethod(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace ShippingMethod {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
11
|
+
readonly: import("prop-types").Requireable<boolean>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
8
15
|
export default ShippingMethod;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import isEmpty from"lodash/isEmpty";const propTypes=components.ShippingMethod.propTypes,displayName=components.ShippingMethod.displayName
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import isEmpty from"lodash/isEmpty";const propTypes=components.ShippingMethod.propTypes,displayName=components.ShippingMethod.displayName;export function ShippingMethod(props){const{children,readonly,emptyText="There are not any shipping method available"}=props,{shippingMethods,currentShippingMethodId,deliveryLeadTimes,shipment}=useContext(ShipmentChildrenContext),[items,setItems]=useState([]);useEffect(()=>{const methods=shippingMethods&&shippingMethods.filter(s=>readonly?s.id===currentShippingMethodId:!0).map((shippingMethod,k)=>{const[deliveryLeadTimeForShipment]=deliveryLeadTimes?.filter(delivery=>{var _a;const deliveryShippingMethodId=(_a=delivery.shipping_method)===null||_a===void 0?void 0:_a.id;return shippingMethod.id===deliveryShippingMethodId}),shippingProps={shipmentId:shipment?.id,shippingMethod,currentShippingMethodId,deliveryLeadTimeForShipment};return _jsx(ShippingMethodChildrenContext.Provider,Object.assign({value:shippingProps},{children}),k)});methods&&setItems(methods)},[currentShippingMethodId,deliveryLeadTimes,shippingMethods]);const components2=!isEmpty(items)&&items||emptyText;return _jsx(Fragment,{children:components2})}ShippingMethod.propTypes=propTypes,ShippingMethod.displayName=displayName;export default ShippingMethod;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { ShippingMethod } from '@commercelayer/sdk';
|
|
3
|
-
declare type
|
|
3
|
+
declare type ChildrenProps = Omit<Props, 'children'> & {
|
|
4
4
|
label: string;
|
|
5
5
|
shippingMethod: ShippingMethod;
|
|
6
6
|
};
|
|
7
|
-
declare type
|
|
8
|
-
children?: (props:
|
|
7
|
+
declare type Props = {
|
|
8
|
+
children?: (props: ChildrenProps) => ReactNode;
|
|
9
9
|
} & JSX.IntrinsicElements['label'];
|
|
10
|
-
declare
|
|
10
|
+
export declare function ShippingMethodName(props: Props): JSX.Element;
|
|
11
|
+
export declare namespace ShippingMethodName {
|
|
12
|
+
var propTypes: {
|
|
13
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
14
|
+
};
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
11
17
|
export default ShippingMethodName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.ShippingMethodName.propTypes,displayName=components.ShippingMethodName.displayName
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.ShippingMethodName.propTypes,displayName=components.ShippingMethodName.displayName;export function ShippingMethodName(props){const{shippingMethod,deliveryLeadTimeForShipment,shipmentId}=useContext(ShippingMethodChildrenContext),htmlFor=`shipment-${shipmentId}-${shippingMethod?.id}`||"",labelName=shippingMethod?.name,parentProps=Object.assign({shippingMethod,deliveryLeadTimeForShipment,label:labelName,htmlFor},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("label",Object.assign({htmlFor},props,{children:labelName}))}ShippingMethodName.propTypes=propTypes,ShippingMethodName.displayName=displayName;export default ShippingMethodName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../typings/index';
|
|
3
|
-
|
|
3
|
+
declare type Props = BaseAmountComponent & {
|
|
4
4
|
labelFreeOver?: string;
|
|
5
5
|
} & ({
|
|
6
6
|
type?: 'amount';
|
|
@@ -9,5 +9,17 @@ export declare type ShippingMethodPriceProps = BaseAmountComponent & {
|
|
|
9
9
|
type?: 'amount' | 'amountForShipment';
|
|
10
10
|
base?: 'price';
|
|
11
11
|
});
|
|
12
|
-
declare
|
|
12
|
+
export declare function ShippingMethodPrice(props: Props): JSX.Element;
|
|
13
|
+
export declare namespace ShippingMethodPrice {
|
|
14
|
+
var propTypes: {
|
|
15
|
+
type: import("prop-types").Requireable<"amount">;
|
|
16
|
+
id: import("prop-types").Requireable<string>;
|
|
17
|
+
className: import("prop-types").Requireable<string>;
|
|
18
|
+
style: import("prop-types").Requireable<object>;
|
|
19
|
+
name: import("prop-types").Requireable<string>;
|
|
20
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
21
|
+
format: import("prop-types").Requireable<import("../typings/index").BaseFormatPrice>;
|
|
22
|
+
};
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
13
25
|
export default ShippingMethodPrice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.ShippingMethodPrice.propTypes,displayName=components.ShippingMethodPrice.displayName;export function ShippingMethodPrice(props){const{base="price_amount",type="for_shipment",format="formatted",labelFreeOver="Free"}=props,p=__rest(props,["base","type","format","labelFreeOver"]),{shippingMethod}=useContext(ShippingMethodChildrenContext),[price,setPrice]=useState(""),[priceCents,setPriceCents]=useState(0);useEffect(()=>{if(shippingMethod){const p2=getAmount({base,type,format,obj:shippingMethod});setPrice(p2);const pCents=getAmount({base:"price_amount",type:"for_shipment",format:"cents",obj:shippingMethod});setPriceCents(pCents)}return()=>{setPrice(""),setPriceCents(0)}},[shippingMethod]);const parentProps=Object.assign({price},p),finalPrice=priceCents===0?labelFreeOver:price;return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("span",Object.assign({},p,{children:finalPrice}))}ShippingMethodPrice.propTypes=propTypes,ShippingMethodPrice.displayName=displayName;export default ShippingMethodPrice;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ShippingMethod } from '@commercelayer/sdk';
|
|
3
|
-
export declare type ShippingMethodRadioButtonType = Omit<
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { ShippingMethod } from '@commercelayer/sdk';
|
|
3
|
+
export declare type ShippingMethodRadioButtonType = Omit<Props, 'children'> & {
|
|
4
4
|
shippingMethod: ShippingMethod;
|
|
5
5
|
shipmentId: string;
|
|
6
6
|
};
|
|
7
7
|
export declare type ShippingMethodRadioButtonOnChangeType = (shippingMethod: ShippingMethod, shipmentId: string) => void;
|
|
8
|
-
declare type
|
|
8
|
+
declare type Props = {
|
|
9
9
|
children?: (props: ShippingMethodRadioButtonType) => ReactNode;
|
|
10
10
|
onChange?: ShippingMethodRadioButtonOnChangeType;
|
|
11
11
|
} & Omit<JSX.IntrinsicElements['input'], 'onChange'>;
|
|
12
|
-
declare
|
|
12
|
+
export declare function ShippingMethodRadioButton(props: Props): JSX.Element;
|
|
13
|
+
export declare namespace ShippingMethodRadioButton {
|
|
14
|
+
var propTypes: {
|
|
15
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
13
19
|
export default ShippingMethodRadioButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import ShipmentContext from"../context/ShipmentContext";const propTypes=components.ShippingMethodRadioButton.propTypes,displayName=components.ShippingMethodRadioButton.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import ShipmentContext from"../context/ShipmentContext";const propTypes=components.ShippingMethodRadioButton.propTypes,displayName=components.ShippingMethodRadioButton.displayName;export function ShippingMethodRadioButton(props){const{onChange}=props,p=__rest(props,["onChange"]),[checked,setChecked]=useState(!1),{shippingMethod,currentShippingMethodId,shipmentId}=useContext(ShippingMethodChildrenContext),{setShippingMethod}=useContext(ShipmentContext),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId}`,id=`${name}-${shippingMethodId}`;useEffect(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId]);const handleOnChange=async()=>{shipmentId&&shippingMethodId&&(setChecked(!0),await setShippingMethod(shipmentId,shippingMethodId),shippingMethod&&onChange&&onChange(shippingMethod,shipmentId))},parentProps=Object.assign({shippingMethod,shipmentId,handleOnChange,name,id},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("input",Object.assign({type:"radio",name,id,onChange:handleOnChange,checked},p))}ShippingMethodRadioButton.propTypes=propTypes,ShippingMethodRadioButton.displayName=displayName;export default ShippingMethodRadioButton;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare type
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
} & JSX.IntrinsicElements['p'];
|
|
5
|
-
declare
|
|
5
|
+
export declare function StockTransfer(props: Props): JSX.Element;
|
|
6
|
+
export declare namespace StockTransfer {
|
|
7
|
+
var propTypes: {
|
|
8
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
9
|
+
};
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
6
12
|
export default StockTransfer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes,displayName=components.StockTransfer.displayName;export function StockTransfer(props){const{children}=props,{stockTransfers,lineItems}=useContext(ShipmentChildrenContext),components2=stockTransfers?.filter(st=>!!lineItems?.find(l=>l.sku_code!==st.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer:stockTransfer.type==="line_items"?stockTransfer:stockTransfer?.line_item};return _jsx(StockTransferChildrenContext.Provider,Object.assign({value:stockTransferProps},{children}),k)});return _jsx(_Fragment,{children:components2})}StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName;export default StockTransfer;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ConditionalElement } from '../typings/index';
|
|
3
|
+
import { TGenericChildrenProps, TResources } from './utils/GenericFieldComponent';
|
|
4
|
+
declare type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['StockTransfer']>;
|
|
5
|
+
declare type TCondition = ConditionalElement<Exclude<TResources['StockTransfer'], 'resource'>>;
|
|
6
|
+
declare type Props = {
|
|
7
|
+
children?: (props: StockTransferFieldChildrenProps) => JSX.Element;
|
|
8
|
+
} & TCondition;
|
|
9
|
+
export declare function StockTransferField<P extends Props>(props: P): JSX.Element;
|
|
9
10
|
export default StockTransferField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import GenericFieldComponent from"./utils/GenericFieldComponent";export function StockTransferField(props){const{attribute,tagElement,children}=props,p=__rest(props,["attribute","tagElement","children"]);return _jsx(GenericFieldComponent,Object.assign({resource:"stock_transfers",attribute,tagElement,context:StockTransferChildrenContext},p,{children}))}export default StockTransferField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { StripeCardElementOptions, StripeElementLocale } from '@stripe/stripe-js';
|
|
3
3
|
import { PaymentMethodConfig } from '../reducers/PaymentMethodReducer';
|
|
4
4
|
import { PaymentSourceProps } from './PaymentSource';
|
|
@@ -9,10 +9,10 @@ export declare type StripeConfig = {
|
|
|
9
9
|
options?: StripeCardElementOptions;
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
};
|
|
12
|
-
declare type
|
|
12
|
+
declare type Props = PaymentMethodConfig['stripePayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
|
|
13
13
|
show?: boolean;
|
|
14
14
|
publishableKey: string;
|
|
15
15
|
locale?: StripeElementLocale;
|
|
16
16
|
};
|
|
17
|
-
declare
|
|
17
|
+
export declare function StripePayment({ publishableKey, show, options, locale, ...p }: Props): JSX.Element | null;
|
|
18
18
|
export default StripePayment;
|