@commercelayer/react-components 4.0.0-alpha.3 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/ExternalFunction.d.ts +9 -2
- package/lib/cjs/components/ExternalFunction.js +1 -1
- package/lib/cjs/components/MetadataInput.d.ts +10 -0
- package/lib/cjs/components/MetadataInput.js +1 -1
- package/lib/cjs/components/SubmitButton.d.ts +12 -2
- package/lib/cjs/components/SubmitButton.js +1 -1
- package/lib/cjs/components/addresses/Address.d.ts +7 -2
- package/lib/cjs/components/addresses/Address.js +1 -1
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +16 -0
- package/lib/cjs/components/addresses/AddressCountrySelector.js +1 -1
- package/lib/cjs/components/addresses/AddressField.d.ts +6 -0
- package/lib/cjs/components/addresses/AddressField.js +1 -1
- package/lib/cjs/components/addresses/AddressInput.d.ts +11 -0
- package/lib/cjs/components/addresses/AddressInput.js +1 -1
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +16 -0
- package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
- package/lib/cjs/components/addresses/AddressesContainer.d.ts +9 -2
- package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
- package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +2 -2
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +7 -2
- package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
- package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +7 -2
- package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +7 -2
- package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/cjs/components/auth/CommerceLayer.d.ts +9 -2
- package/lib/cjs/components/auth/CommerceLayer.js +1 -1
- package/lib/cjs/components/customers/CustomerAddressForm.d.ts +7 -2
- package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
- package/lib/cjs/components/customers/CustomerContainer.d.ts +2 -2
- package/lib/cjs/components/customers/CustomerInput.d.ts +12 -0
- package/lib/cjs/components/customers/CustomerInput.js +1 -1
- package/lib/cjs/components/customers/SaveCustomerButton.d.ts +3 -3
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +12 -2
- package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +8 -2
- package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +15 -0
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +9 -0
- package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +7 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +7 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +9 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +10 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +9 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
- package/lib/cjs/components/line_items/LineItem.d.ts +9 -2
- package/lib/cjs/components/line_items/LineItem.js +1 -1
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +13 -0
- package/lib/cjs/components/line_items/LineItemAmount.js +1 -1
- package/lib/cjs/components/line_items/LineItemCode.d.ts +6 -0
- package/lib/cjs/components/line_items/LineItemCode.js +1 -1
- package/lib/cjs/components/line_items/LineItemImage.d.ts +7 -0
- package/lib/cjs/components/line_items/LineItemImage.js +1 -1
- package/lib/cjs/components/line_items/LineItemName.d.ts +6 -0
- package/lib/cjs/components/line_items/LineItemName.js +1 -1
- package/lib/cjs/components/line_items/LineItemOption.d.ts +11 -0
- package/lib/cjs/components/line_items/LineItemOption.js +1 -1
- package/lib/cjs/components/line_items/LineItemOptions.d.ts +5 -2
- package/lib/cjs/components/line_items/LineItemOptions.js +1 -1
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +12 -0
- package/lib/cjs/components/line_items/LineItemQuantity.js +1 -1
- package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +10 -0
- package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/cjs/components/line_items/LineItemsContainer.d.ts +15 -3
- package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +10 -0
- package/lib/cjs/components/line_items/LineItemsCount.js +1 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +11 -0
- package/lib/cjs/components/line_items/LineItemsEmpty.js +1 -1
- package/lib/cjs/components/orders/AddToCartButton.js +1 -1
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +2 -2
- package/lib/cjs/components/orders/AdjustmentAmount.js +1 -1
- package/lib/cjs/components/orders/CartLink.d.ts +2 -2
- package/lib/cjs/components/orders/DiscountAmount.d.ts +14 -0
- package/lib/cjs/components/orders/DiscountAmount.js +1 -1
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +11 -0
- package/lib/cjs/components/orders/GiftCardAmount.js +1 -1
- package/lib/cjs/components/orders/ItemContainer.d.ts +13 -2
- package/lib/cjs/components/orders/ItemContainer.js +1 -1
- package/lib/cjs/components/orders/OrderContainer.d.ts +16 -2
- package/lib/cjs/components/orders/OrderContainer.js +1 -1
- package/lib/cjs/components/orders/OrderList.d.ts +26 -21
- package/lib/cjs/components/orders/OrderList.js +1 -1
- package/lib/cjs/components/orders/OrderNumber.d.ts +6 -0
- package/lib/cjs/components/orders/OrderNumber.js +1 -1
- package/lib/cjs/components/orders/OrderStorage.d.ts +10 -2
- package/lib/cjs/components/orders/OrderStorage.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderButton.d.ts +12 -2
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +8 -2
- package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +6 -0
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/cjs/components/orders/ShippingAmount.d.ts +11 -0
- package/lib/cjs/components/orders/ShippingAmount.js +1 -1
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +14 -0
- package/lib/cjs/components/orders/SubTotalAmount.js +1 -1
- package/lib/cjs/components/orders/TaxesAmount.d.ts +14 -0
- package/lib/cjs/components/orders/TaxesAmount.js +1 -1
- package/lib/cjs/components/orders/TotalAmount.d.ts +14 -0
- package/lib/cjs/components/orders/TotalAmount.js +1 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/KlarnaGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +16 -10
- package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodAmount.d.ts +14 -0
- package/lib/cjs/components/payment_methods/PaymentMethodAmount.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +6 -0
- package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +12 -0
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +6 -0
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +8 -2
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/cjs/components/{payment_sources → payment_source}/AdyenPayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/AdyenPayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/BraintreePayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/BraintreePayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/CheckoutComPayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/CheckoutComPayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/KlarnaPayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/KlarnaPayment.js +0 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaymentSource.d.ts +9 -2
- package/lib/cjs/components/payment_source/PaymentSource.js +1 -0
- package/lib/cjs/components/{payment_sources → payment_source}/PaymentSourceBrandIcon.d.ts +10 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +1 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaymentSourceBrandName.d.ts +7 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +1 -0
- package/lib/cjs/components/{payment_sources → payment_source}/PaymentSourceDetail.d.ts +6 -0
- package/lib/cjs/components/payment_source/PaymentSourceDetail.js +1 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaymentSourceEditButton.d.ts +9 -2
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +1 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaypalPayment.d.ts +2 -2
- package/lib/cjs/components/{payment_sources → payment_source}/PaypalPayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/StripePayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/StripePayment.js +0 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/WireTransferPayment.d.ts +2 -2
- package/lib/cjs/components/{payment_sources → payment_source}/WireTransferPayment.js +0 -0
- package/lib/cjs/components/prices/Price.d.ts +12 -0
- package/lib/cjs/components/prices/Price.js +1 -1
- package/lib/cjs/components/prices/PricesContainer.d.ts +18 -2
- package/lib/cjs/components/prices/PricesContainer.js +1 -1
- package/lib/cjs/components/shipments/Shipment.d.ts +8 -2
- package/lib/cjs/components/shipments/Shipment.js +1 -1
- package/lib/cjs/components/shipments/ShipmentField.d.ts +7 -0
- package/lib/cjs/components/shipments/ShipmentField.js +1 -1
- package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +8 -2
- package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +9 -2
- package/lib/cjs/components/shipping_methods/ShippingMethod.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +6 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodName.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +12 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +6 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/cjs/components/skus/AvailabilityContainer.d.ts +9 -2
- package/lib/cjs/components/skus/AvailabilityContainer.js +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +9 -0
- package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +7 -0
- package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
- package/lib/cjs/components/skus/QuantitySelector.d.ts +14 -0
- package/lib/cjs/components/skus/QuantitySelector.js +1 -1
- package/lib/cjs/components/skus/SkuField.d.ts +6 -2
- package/lib/cjs/components/skus/SkuField.js +1 -1
- package/lib/cjs/components/skus/SkuList.d.ts +9 -2
- package/lib/cjs/components/skus/SkuList.js +1 -1
- package/lib/cjs/components/skus/SkuListsContainer.d.ts +8 -2
- package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
- package/lib/cjs/components/skus/SkuOption.d.ts +9 -2
- package/lib/cjs/components/skus/SkuOption.js +1 -1
- package/lib/cjs/components/skus/SkuOptionInput.d.ts +10 -0
- package/lib/cjs/components/skus/SkuOptionInput.js +1 -1
- package/lib/cjs/components/skus/SkuOptionsContainer.d.ts +9 -2
- package/lib/cjs/components/skus/SkuOptionsContainer.js +1 -1
- package/lib/cjs/components/skus/Skus.d.ts +7 -2
- package/lib/cjs/components/skus/Skus.js +1 -1
- package/lib/cjs/components/skus/SkusContainer.d.ts +11 -2
- package/lib/cjs/components/skus/VariantSelector.d.ts +25 -2
- package/lib/cjs/components/skus/VariantSelector.js +1 -1
- package/lib/cjs/components/skus/VariantsContainer.d.ts +14 -2
- package/lib/cjs/components/skus/VariantsContainer.js +1 -1
- package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +8 -2
- package/lib/cjs/components/stock_transfers/StockTransfer.js +1 -1
- package/lib/cjs/components/utils/PriceTemplate.js +1 -1
- package/lib/cjs/components/utils/VariantTemplate.d.ts +21 -2
- package/lib/cjs/components/utils/VariantTemplate.js +1 -1
- package/lib/cjs/components/utils/getAllErrors.d.ts +1 -1
- package/lib/cjs/config/components.d.ts +934 -0
- package/lib/cjs/config/components.js +1 -0
- package/lib/cjs/index.d.ts +7 -7
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +6 -6
- package/lib/cjs/typings/index.d.ts +3 -3
- package/lib/cjs/utils/childrenTypes.d.ts +9 -0
- package/lib/cjs/utils/childrenTypes.js +1 -0
- package/lib/cjs/utils/getCardDetails.js +1 -1
- package/lib/cjs/utils/getPrices.d.ts +2 -2
- package/lib/cjs/utils/paypalPayment.d.ts +1 -1
- package/lib/cjs/utils/validateFormFields.js +1 -1
- package/lib/esm/components/ExternalFunction.d.ts +9 -2
- package/lib/esm/components/ExternalFunction.js +1 -1
- package/lib/esm/components/MetadataInput.d.ts +10 -0
- package/lib/esm/components/MetadataInput.js +1 -1
- package/lib/esm/components/SubmitButton.d.ts +12 -2
- package/lib/esm/components/SubmitButton.js +1 -1
- package/lib/esm/components/addresses/Address.d.ts +7 -2
- package/lib/esm/components/addresses/Address.js +1 -1
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +16 -0
- package/lib/esm/components/addresses/AddressCountrySelector.js +1 -1
- package/lib/esm/components/addresses/AddressField.d.ts +6 -0
- package/lib/esm/components/addresses/AddressField.js +1 -1
- package/lib/esm/components/addresses/AddressInput.d.ts +11 -0
- package/lib/esm/components/addresses/AddressInput.js +1 -1
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +16 -0
- package/lib/esm/components/addresses/AddressStateSelector.js +1 -1
- package/lib/esm/components/addresses/AddressesContainer.d.ts +9 -2
- package/lib/esm/components/addresses/AddressesContainer.js +1 -1
- package/lib/esm/components/addresses/BillingAddressContainer.d.ts +2 -2
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +7 -2
- package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
- package/lib/esm/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +7 -2
- package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -1
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +7 -2
- package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/esm/components/auth/CommerceLayer.d.ts +9 -2
- package/lib/esm/components/auth/CommerceLayer.js +1 -1
- package/lib/esm/components/customers/CustomerAddressForm.d.ts +7 -2
- package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerContainer.d.ts +2 -2
- package/lib/esm/components/customers/CustomerInput.d.ts +12 -0
- package/lib/esm/components/customers/CustomerInput.js +1 -1
- package/lib/esm/components/customers/SaveCustomerButton.d.ts +3 -3
- package/lib/esm/components/gift_cards/GiftCard.d.ts +12 -2
- package/lib/esm/components/gift_cards/GiftCard.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +8 -2
- package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +15 -0
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +9 -0
- package/lib/esm/components/gift_cards/GiftCardInput.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +7 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +7 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +9 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +10 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +9 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
- package/lib/esm/components/line_items/LineItem.d.ts +9 -2
- package/lib/esm/components/line_items/LineItem.js +1 -1
- package/lib/esm/components/line_items/LineItemAmount.d.ts +13 -0
- package/lib/esm/components/line_items/LineItemAmount.js +1 -1
- package/lib/esm/components/line_items/LineItemCode.d.ts +6 -0
- package/lib/esm/components/line_items/LineItemCode.js +1 -1
- package/lib/esm/components/line_items/LineItemImage.d.ts +7 -0
- package/lib/esm/components/line_items/LineItemImage.js +1 -1
- package/lib/esm/components/line_items/LineItemName.d.ts +6 -0
- package/lib/esm/components/line_items/LineItemName.js +1 -1
- package/lib/esm/components/line_items/LineItemOption.d.ts +11 -0
- package/lib/esm/components/line_items/LineItemOption.js +1 -1
- package/lib/esm/components/line_items/LineItemOptions.d.ts +5 -2
- package/lib/esm/components/line_items/LineItemOptions.js +1 -1
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +12 -0
- package/lib/esm/components/line_items/LineItemQuantity.js +1 -1
- package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +10 -0
- package/lib/esm/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/esm/components/line_items/LineItemsContainer.d.ts +15 -3
- package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
- package/lib/esm/components/line_items/LineItemsCount.d.ts +10 -0
- package/lib/esm/components/line_items/LineItemsCount.js +1 -1
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +11 -0
- package/lib/esm/components/line_items/LineItemsEmpty.js +1 -1
- package/lib/esm/components/orders/AddToCartButton.js +1 -1
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +2 -2
- package/lib/esm/components/orders/AdjustmentAmount.js +1 -1
- package/lib/esm/components/orders/CartLink.d.ts +2 -2
- package/lib/esm/components/orders/DiscountAmount.d.ts +14 -0
- package/lib/esm/components/orders/DiscountAmount.js +1 -1
- package/lib/esm/components/orders/GiftCardAmount.d.ts +11 -0
- package/lib/esm/components/orders/GiftCardAmount.js +1 -1
- package/lib/esm/components/orders/ItemContainer.d.ts +13 -2
- package/lib/esm/components/orders/ItemContainer.js +1 -1
- package/lib/esm/components/orders/OrderContainer.d.ts +16 -2
- package/lib/esm/components/orders/OrderContainer.js +1 -1
- package/lib/esm/components/orders/OrderList.d.ts +26 -21
- package/lib/esm/components/orders/OrderList.js +1 -1
- package/lib/esm/components/orders/OrderNumber.d.ts +6 -0
- package/lib/esm/components/orders/OrderNumber.js +1 -1
- package/lib/esm/components/orders/OrderStorage.d.ts +10 -2
- package/lib/esm/components/orders/OrderStorage.js +1 -1
- package/lib/esm/components/orders/PlaceOrderButton.d.ts +12 -2
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/orders/PlaceOrderContainer.d.ts +8 -2
- package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +6 -0
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/esm/components/orders/ShippingAmount.d.ts +11 -0
- package/lib/esm/components/orders/ShippingAmount.js +1 -1
- package/lib/esm/components/orders/SubTotalAmount.d.ts +14 -0
- package/lib/esm/components/orders/SubTotalAmount.js +1 -1
- package/lib/esm/components/orders/TaxesAmount.d.ts +14 -0
- package/lib/esm/components/orders/TaxesAmount.js +1 -1
- package/lib/esm/components/orders/TotalAmount.d.ts +14 -0
- package/lib/esm/components/orders/TotalAmount.js +1 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/CheckoutComGateway.js +1 -1
- package/lib/esm/components/payment_gateways/KlarnaGateway.js +1 -1
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/esm/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +16 -10
- package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodAmount.d.ts +14 -0
- package/lib/esm/components/payment_methods/PaymentMethodAmount.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +6 -0
- package/lib/esm/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +12 -0
- package/lib/esm/components/payment_methods/PaymentMethodPrice.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +6 -0
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +8 -2
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/esm/components/{payment_sources → payment_source}/AdyenPayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/AdyenPayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/BraintreePayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/BraintreePayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/CheckoutComPayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/CheckoutComPayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/KlarnaPayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/KlarnaPayment.js +0 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaymentSource.d.ts +9 -2
- package/lib/esm/components/payment_source/PaymentSource.js +1 -0
- package/lib/esm/components/{payment_sources → payment_source}/PaymentSourceBrandIcon.d.ts +10 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.js +1 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaymentSourceBrandName.d.ts +7 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandName.js +1 -0
- package/lib/esm/components/{payment_sources → payment_source}/PaymentSourceDetail.d.ts +6 -0
- package/lib/esm/components/payment_source/PaymentSourceDetail.js +1 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaymentSourceEditButton.d.ts +9 -2
- package/lib/esm/components/payment_source/PaymentSourceEditButton.js +1 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaypalPayment.d.ts +2 -2
- package/lib/esm/components/{payment_sources → payment_source}/PaypalPayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/StripePayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/StripePayment.js +0 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/WireTransferPayment.d.ts +2 -2
- package/lib/esm/components/{payment_sources → payment_source}/WireTransferPayment.js +0 -0
- package/lib/esm/components/prices/Price.d.ts +12 -0
- package/lib/esm/components/prices/Price.js +1 -1
- package/lib/esm/components/prices/PricesContainer.d.ts +18 -2
- package/lib/esm/components/prices/PricesContainer.js +1 -1
- package/lib/esm/components/shipments/Shipment.d.ts +8 -2
- package/lib/esm/components/shipments/Shipment.js +1 -1
- package/lib/esm/components/shipments/ShipmentField.d.ts +7 -0
- package/lib/esm/components/shipments/ShipmentField.js +1 -1
- package/lib/esm/components/shipments/ShipmentsContainer.d.ts +8 -2
- package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +9 -2
- package/lib/esm/components/shipping_methods/ShippingMethod.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +6 -0
- package/lib/esm/components/shipping_methods/ShippingMethodName.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +12 -0
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +6 -0
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/esm/components/skus/AvailabilityContainer.d.ts +9 -2
- package/lib/esm/components/skus/AvailabilityContainer.js +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +9 -0
- package/lib/esm/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/esm/components/skus/DeliveryLeadTime.d.ts +7 -0
- package/lib/esm/components/skus/DeliveryLeadTime.js +1 -1
- package/lib/esm/components/skus/QuantitySelector.d.ts +14 -0
- package/lib/esm/components/skus/QuantitySelector.js +1 -1
- package/lib/esm/components/skus/SkuField.d.ts +6 -2
- package/lib/esm/components/skus/SkuField.js +1 -1
- package/lib/esm/components/skus/SkuList.d.ts +9 -2
- package/lib/esm/components/skus/SkuList.js +1 -1
- package/lib/esm/components/skus/SkuListsContainer.d.ts +8 -2
- package/lib/esm/components/skus/SkuListsContainer.js +1 -1
- package/lib/esm/components/skus/SkuOption.d.ts +9 -2
- package/lib/esm/components/skus/SkuOption.js +1 -1
- package/lib/esm/components/skus/SkuOptionInput.d.ts +10 -0
- package/lib/esm/components/skus/SkuOptionInput.js +1 -1
- package/lib/esm/components/skus/SkuOptionsContainer.d.ts +9 -2
- package/lib/esm/components/skus/SkuOptionsContainer.js +1 -1
- package/lib/esm/components/skus/Skus.d.ts +7 -2
- package/lib/esm/components/skus/Skus.js +1 -1
- package/lib/esm/components/skus/SkusContainer.d.ts +11 -2
- package/lib/esm/components/skus/VariantSelector.d.ts +25 -2
- package/lib/esm/components/skus/VariantSelector.js +1 -1
- package/lib/esm/components/skus/VariantsContainer.d.ts +14 -2
- package/lib/esm/components/skus/VariantsContainer.js +1 -1
- package/lib/esm/components/stock_transfers/StockTransfer.d.ts +8 -2
- package/lib/esm/components/stock_transfers/StockTransfer.js +1 -1
- package/lib/esm/components/utils/PriceTemplate.js +1 -1
- package/lib/esm/components/utils/VariantTemplate.d.ts +21 -2
- package/lib/esm/components/utils/VariantTemplate.js +1 -1
- package/lib/esm/components/utils/getAllErrors.d.ts +1 -1
- package/lib/esm/config/components.d.ts +934 -0
- package/lib/esm/config/components.js +1 -0
- package/lib/esm/index.d.ts +7 -7
- package/lib/esm/index.js +1 -1
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +6 -6
- package/lib/esm/typings/index.d.ts +3 -3
- package/lib/esm/utils/childrenTypes.d.ts +9 -0
- package/lib/esm/utils/childrenTypes.js +1 -0
- package/lib/esm/utils/getCardDetails.js +1 -1
- package/lib/esm/utils/getPrices.d.ts +2 -2
- package/lib/esm/utils/paypalPayment.d.ts +1 -1
- package/lib/esm/utils/validateFormFields.js +1 -1
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +26 -26
- package/lib/cjs/components/payment_sources/PaymentSource.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceBrandIcon.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceBrandName.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceDetail.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceEditButton.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSource.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceBrandIcon.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceBrandName.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceDetail.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceEditButton.js +0 -1
|
@@ -9,4 +9,11 @@ declare type Props = {
|
|
|
9
9
|
name: ShipmentAttribute;
|
|
10
10
|
} & JSX.IntrinsicElements['span'];
|
|
11
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<NonNullable<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 get from"lodash/get";import ShipmentChildrenContext from"../../context/ShipmentChildrenContext";export function ShipmentField(props){const{name}=props,{shipment,keyNumber}=useContext(ShipmentChildrenContext),key=name,text=key!=="key_number"?get(shipment,key):keyNumber,parentProps={shipment,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...props,children:text})}export default ShipmentField;
|
|
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={shipment,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...props,children:text})}ShipmentField.propTypes=propTypes,ShipmentField.displayName=displayName;export default ShipmentField;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
};
|
|
5
5
|
export declare function ShipmentsContainer(props: Props): JSX.Element;
|
|
6
|
+
export declare namespace ShipmentsContainer {
|
|
7
|
+
var propTypes: {
|
|
8
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
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,setShipmentErrors,getShipments,setShippingMethod}from"../../reducers/ShipmentReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import
|
|
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/isEmpty";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=>!!(lineItem.item?.do_not_ship||lineItem.item?.do_not_track||lineItem.item?.inventory?.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={...state,setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})};return _jsx(ShipmentContext.Provider,{value:contextValue,children})}ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
readonly?: boolean;
|
|
5
5
|
emptyText?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function ShippingMethod(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace ShippingMethod {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
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 ShipmentChildrenContext from"../../context/ShipmentChildrenContext";import isEmpty from"lodash/isEmpty";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=>{const deliveryShippingMethodId=delivery.shipping_method?.id;return shippingMethod.id===deliveryShippingMethodId}),shippingProps={shipmentId:shipment?.id,shippingMethod,currentShippingMethodId,deliveryLeadTimeForShipment};return _jsx(ShippingMethodChildrenContext.Provider,{value:shippingProps,children},k)});methods&&setItems(methods)},[currentShippingMethodId,deliveryLeadTimes,shippingMethods]);const
|
|
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=>{const deliveryShippingMethodId=delivery.shipping_method?.id;return shippingMethod.id===deliveryShippingMethodId}),shippingProps={shipmentId:shipment?.id,shippingMethod,currentShippingMethodId,deliveryLeadTimeForShipment};return _jsx(ShippingMethodChildrenContext.Provider,{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;
|
|
@@ -8,4 +8,10 @@ declare type Props = {
|
|
|
8
8
|
children?: (props: ChildrenProps) => JSX.Element;
|
|
9
9
|
} & JSX.IntrinsicElements['label'];
|
|
10
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";export function ShippingMethodName(props){const{shippingMethod,deliveryLeadTimeForShipment,shipmentId}=useContext(ShippingMethodChildrenContext),htmlFor=`shipment-${shipmentId}-${shippingMethod?.id}`||"",labelName=shippingMethod?.name,parentProps={shippingMethod,deliveryLeadTimeForShipment,label:labelName,htmlFor,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("label",{htmlFor,...props,children:labelName})}export default ShippingMethodName;
|
|
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={shippingMethod,deliveryLeadTimeForShipment,label:labelName,htmlFor,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("label",{htmlFor,...props,children:labelName})}ShippingMethodName.propTypes=propTypes,ShippingMethodName.displayName=displayName;export default ShippingMethodName;
|
|
@@ -10,4 +10,16 @@ declare type Props = BaseAmountComponent & {
|
|
|
10
10
|
base?: 'price';
|
|
11
11
|
});
|
|
12
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{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";export function ShippingMethodPrice(props){const{base="price_amount",type="for_shipment",format="formatted",labelFreeOver="Free",...p}=props,{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={price,...p},finalPrice=priceCents===0?labelFreeOver:price;return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:finalPrice})}export default ShippingMethodPrice;
|
|
1
|
+
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",...p}=props,{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={price,...p},finalPrice=priceCents===0?labelFreeOver:price;return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:finalPrice})}ShippingMethodPrice.propTypes=propTypes,ShippingMethodPrice.displayName=displayName;export default ShippingMethodPrice;
|
|
@@ -10,4 +10,10 @@ declare type Props = {
|
|
|
10
10
|
onChange?: ShippingMethodRadioButtonOnChangeType;
|
|
11
11
|
} & Omit<JSX.IntrinsicElements['input'], 'onChange'>;
|
|
12
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{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import ShipmentContext from"../../context/ShipmentContext";export function ShippingMethodRadioButton(props){const{onChange,...p}=props,[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={shippingMethod,shipmentId,handleOnChange,name,id,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("input",{type:"radio",name,id,onChange:handleOnChange,checked,...p})}export default ShippingMethodRadioButton;
|
|
1
|
+
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,...p}=props,[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={shippingMethod,shipmentId,handleOnChange,name,id,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("input",{type:"radio",name,id,onChange:handleOnChange,checked,...p})}ShippingMethodRadioButton.propTypes=propTypes,ShippingMethodRadioButton.displayName=displayName;export default ShippingMethodRadioButton;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
skuCode?: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function AvailabilityContainer(props: Props): JSX.Element;
|
|
7
|
+
export declare namespace AvailabilityContainer {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
10
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
11
|
+
};
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
7
14
|
export default AvailabilityContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useReducer,useEffect}from"react";import availabilityReducer,{availabilityInitialState,getAvailability,getAvailabilityByIds}from"../../reducers/AvailabilityReducer";import AvailabilityContext from"../../context/AvailabilityContext";import ItemContext from"../../context/ItemContext";import getCurrentItemKey from"../../utils/getCurrentItemKey";import CommerceLayerContext from"../../context/CommerceLayerContext";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import SkuChildrenContext from"../../context/SkuChildrenContext";import SkuContext from"../../context/SkuContext";import isEqual from"lodash/isEqual";export function AvailabilityContainer(props){const{children,skuCode}=props,{item,skuCode:itemSkuCode,setItem}=useContext(ItemContext),{lineItem}=useContext(LineItemChildrenContext),{sku}=useContext(SkuChildrenContext),{skus}=useContext(SkuContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(availabilityReducer,availabilityInitialState),sCode=skuCode||getCurrentItemKey(item)||itemSkuCode||lineItem?.sku_code||sku?.code;return useEffect(()=>{if(sCode&&!skus){const available=item[sCode]?.inventory?.available,quantity=item[sCode]?.inventory?.quantity,[level]=item[sCode]?.inventory?.levels||[{quantity:null,delivery_lead_times:[]}];if(level!==void 0&&level?.delivery_lead_times?.length>0){const[delivery]=level.delivery_lead_times;dispatch({type:"setAvailability",payload:{...delivery,quantity:level?.quantity}})}else config.accessToken&&!item?.[sCode]?getAvailability({skuCode:sCode,config,dispatch,setItem,item}):available||dispatch({type:"setAvailability",payload:{quantity}})}else if(skus&&config.accessToken){const itemKeys=Object.keys(item).sort(),skuCodes=skus.map(s=>s?.code).sort();if(!isEqual(skuCodes,itemKeys)){const skusIds=skus.map(s=>s.id);getAvailabilityByIds({skusIds,config,dispatch,setItem})}}return()=>{dispatch({type:"setAvailability",payload:{}})}},[config.accessToken,item,sCode,skus]),_jsx(AvailabilityContext.Provider,{value:{...state},children})}export default AvailabilityContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useReducer,useEffect}from"react";import availabilityReducer,{availabilityInitialState,getAvailability,getAvailabilityByIds}from"../../reducers/AvailabilityReducer";import AvailabilityContext from"../../context/AvailabilityContext";import ItemContext from"../../context/ItemContext";import getCurrentItemKey from"../../utils/getCurrentItemKey";import components from"../../config/components";import CommerceLayerContext from"../../context/CommerceLayerContext";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import SkuChildrenContext from"../../context/SkuChildrenContext";import SkuContext from"../../context/SkuContext";import isEqual from"lodash/isEqual";const propTypes=components.AvailabilityContainer.propTypes,displayName=components.AvailabilityContainer.displayName;export function AvailabilityContainer(props){const{children,skuCode}=props,{item,skuCode:itemSkuCode,setItem}=useContext(ItemContext),{lineItem}=useContext(LineItemChildrenContext),{sku}=useContext(SkuChildrenContext),{skus}=useContext(SkuContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(availabilityReducer,availabilityInitialState),sCode=skuCode||getCurrentItemKey(item)||itemSkuCode||lineItem?.sku_code||sku?.code;return useEffect(()=>{if(sCode&&!skus){const available=item[sCode]?.inventory?.available,quantity=item[sCode]?.inventory?.quantity,[level]=item[sCode]?.inventory?.levels||[{quantity:null,delivery_lead_times:[]}];if(level!==void 0&&level?.delivery_lead_times?.length>0){const[delivery]=level.delivery_lead_times;dispatch({type:"setAvailability",payload:{...delivery,quantity:level?.quantity}})}else config.accessToken&&!item?.[sCode]?getAvailability({skuCode:sCode,config,dispatch,setItem,item}):available||dispatch({type:"setAvailability",payload:{quantity}})}else if(skus&&config.accessToken){const itemKeys=Object.keys(item).sort(),skuCodes=skus.map(s=>s?.code).sort();if(!isEqual(skuCodes,itemKeys)){const skusIds=skus.map(s=>s.id);getAvailabilityByIds({skusIds,config,dispatch,setItem})}}return()=>{dispatch({type:"setAvailability",payload:{}})}},[config.accessToken,item,sCode,skus]),_jsx(AvailabilityContext.Provider,{value:{...state},children})}AvailabilityContainer.propTypes=propTypes,AvailabilityContainer.displayName=displayName;export default AvailabilityContainer;
|
|
@@ -12,4 +12,13 @@ declare type Props = {
|
|
|
12
12
|
showShippingMethodPrice?: boolean;
|
|
13
13
|
} & JSX.IntrinsicElements['p'];
|
|
14
14
|
export declare function AvailabilityTemplate(props: Props): JSX.Element;
|
|
15
|
+
export declare namespace AvailabilityTemplate {
|
|
16
|
+
var propTypes: {
|
|
17
|
+
timeFormat: import("prop-types").Requireable<TimeFormat>;
|
|
18
|
+
showShippingMethodName: import("prop-types").Requireable<boolean>;
|
|
19
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
20
|
+
};
|
|
21
|
+
var defaultProps: Props;
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
15
24
|
export default AvailabilityTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import AvailabilityContext from"../../context/AvailabilityContext";import Parent from"../utils/Parent";import{isEmpty}from"lodash";import ItemContext from"../../context/ItemContext";import SkuChildrenContext from"../../context/SkuChildrenContext";export function AvailabilityTemplate(props){const{timeFormat,showShippingMethodName,showShippingMethodPrice,children,...p}=props;let{min,max,shipping_method,quantity}=useContext(AvailabilityContext);const{item}=useContext(ItemContext),{sku}=useContext(SkuChildrenContext),text=[];if(item&&sku){const code=sku.code,currentItem=item[code];if(currentItem){const[level]=currentItem.inventory?.levels||[],[delivery]=level?.delivery_lead_times||[];delivery&&(min=delivery?.min,max=delivery?.max,shipping_method=delivery?.shipping_method),quantity=currentItem.inventory.quantity}}const mn=!isEmpty(min)&&timeFormat?min?.[timeFormat]:"",mx=!isEmpty(max)&&timeFormat?max?.[timeFormat]:"",shippingMethodPrice=showShippingMethodPrice&&shipping_method?.formatted_price_amount?`(${shipping_method?.formatted_price_amount})`:"",name=showShippingMethodName&&shipping_method?`with ${shipping_method.name}`:"";quantity&&quantity>0?(text.push("Available"),mn&&mx&&text.push(`in ${mn} - ${mx} ${timeFormat} ${name} ${shippingMethodPrice}`)):quantity===0&&text.push("Out of stock");const parentProps={min,max,shipping_method,quantity,text:text.join(" "),...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("p",{...p,children:text.join(" ")})}export default AvailabilityTemplate;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import AvailabilityContext from"../../context/AvailabilityContext";import Parent from"../utils/Parent";import{isEmpty}from"lodash";import components from"../../config/components";import ItemContext from"../../context/ItemContext";import SkuChildrenContext from"../../context/SkuChildrenContext";const propTypes=components.AvailabilityTemplate.propTypes,defaultProps=components.AvailabilityTemplate.defaultProps,displayName=components.AvailabilityTemplate.displayName;export function AvailabilityTemplate(props){const{timeFormat,showShippingMethodName,showShippingMethodPrice,children,...p}=props;let{min,max,shipping_method,quantity}=useContext(AvailabilityContext);const{item}=useContext(ItemContext),{sku}=useContext(SkuChildrenContext),text=[];if(item&&sku){const code=sku.code,currentItem=item[code];if(currentItem){const[level]=currentItem.inventory?.levels||[],[delivery]=level?.delivery_lead_times||[];delivery&&(min=delivery?.min,max=delivery?.max,shipping_method=delivery?.shipping_method),quantity=currentItem.inventory.quantity}}const mn=!isEmpty(min)&&timeFormat?min?.[timeFormat]:"",mx=!isEmpty(max)&&timeFormat?max?.[timeFormat]:"",shippingMethodPrice=showShippingMethodPrice&&shipping_method?.formatted_price_amount?`(${shipping_method?.formatted_price_amount})`:"",name=showShippingMethodName&&shipping_method?`with ${shipping_method.name}`:"";quantity&&quantity>0?(text.push("Available"),mn&&mx&&text.push(`in ${mn} - ${mx} ${timeFormat} ${name} ${shippingMethodPrice}`)):quantity===0&&text.push("Out of stock");const parentProps={min,max,shipping_method,quantity,text:text.join(" "),...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("p",{...p,children:text.join(" ")})}AvailabilityTemplate.propTypes=propTypes,AvailabilityTemplate.defaultProps=defaultProps,AvailabilityTemplate.displayName=displayName;export default AvailabilityTemplate;
|
|
@@ -7,4 +7,11 @@ declare type Props = Partial<JSX.IntrinsicElements['span']> & {
|
|
|
7
7
|
text?: string;
|
|
8
8
|
};
|
|
9
9
|
export declare function DeliveryLeadTime(props: Props): JSX.Element;
|
|
10
|
+
export declare namespace DeliveryLeadTime {
|
|
11
|
+
var propTypes: {
|
|
12
|
+
type: import("prop-types").Validator<NonNullable<DeliveryLeadTimeField>>;
|
|
13
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
14
|
+
};
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
10
17
|
export default DeliveryLeadTime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";export function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=useState(),{deliveryLeadTimeForShipment}=useContext(ShippingMethodChildrenContext);useEffect(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:text})}export default DeliveryLeadTime;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import components from"../../config/components";const propTypes=components.DeliveryLeadTime.propTypes,displayName=components.DeliveryLeadTime.displayName;export function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=useState(),{deliveryLeadTimeForShipment}=useContext(ShippingMethodChildrenContext);useEffect(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:text})}DeliveryLeadTime.propTypes=propTypes,DeliveryLeadTime.displayName=displayName;export default DeliveryLeadTime;
|
|
@@ -14,4 +14,18 @@ declare type Props = {
|
|
|
14
14
|
skuListId?: string;
|
|
15
15
|
} & JSX.IntrinsicElements['input'];
|
|
16
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{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 SkuListsContext from"../../context/SkuListsContext";import SkuChildrenContext from"../../context/SkuChildrenContext";export function QuantitySelector(props){const{skuCode,skuListId,children,min=1,max,...p}=props,{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?items[skuCode]?.code:sku?.code||skuCode||getCurrentItemKey(item)||itemSkuCode,inventory=isEmpty(item)?50:item[sCode]?.inventory?.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({...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({...quantity,[`${skuListId}`]:Number(qty)}):sCode&&valid&&setQuantity&&setQuantity({...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({...quantity,[`${skuListId}`]:Number(resetVal)}):setQuantity&&setQuantity({...quantity,[`${sCode}`]:Number(resetVal)})}},parentProps={min,max:maxInv,disabled,handleChange,handleBlur,value,...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("input",{type:"number",max:maxInv,min,value:value||"",disabled,onChange:handleChange,onBlur:handleBlur,...p})}export default QuantitySelector;
|
|
1
|
+
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){const{skuCode,skuListId,children,min=1,max,...p}=props,{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?items[skuCode]?.code:sku?.code||skuCode||getCurrentItemKey(item)||itemSkuCode,inventory=isEmpty(item)?50:item[sCode]?.inventory?.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({...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({...quantity,[`${skuListId}`]:Number(qty)}):sCode&&valid&&setQuantity&&setQuantity({...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({...quantity,[`${skuListId}`]:Number(resetVal)}):setQuantity&&setQuantity({...quantity,[`${sCode}`]:Number(resetVal)})}},parentProps={min,max:maxInv,disabled,handleChange,handleBlur,value,...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("input",{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;
|
|
@@ -6,5 +6,9 @@ declare type TCondition = ConditionalElement<Exclude<TResources['Sku'], 'resourc
|
|
|
6
6
|
declare type Props = {
|
|
7
7
|
children?: (props: SkuFieldChildrenProps) => JSX.Element;
|
|
8
8
|
} & TCondition;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @param props {@link Props}
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function SkuField<P extends Props>(props: P): JSX.Element;
|
|
14
|
+
export default SkuField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import SkuChildrenContext from"../../context/SkuChildrenContext";import GenericFieldComponent from"../utils/GenericFieldComponent";export
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import SkuChildrenContext from"../../context/SkuChildrenContext";import GenericFieldComponent from"../utils/GenericFieldComponent";export function SkuField(props){const{attribute,tagElement,children,...p}=props;return _jsx(GenericFieldComponent,{resource:"skus",attribute,tagElement,context:SkuChildrenContext,...p,children})}export default SkuField;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
id: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function SkuList(props: Props): JSX.Element;
|
|
7
|
+
export declare namespace SkuList {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
10
|
+
id: import("prop-types").Validator<string>;
|
|
11
|
+
};
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
7
14
|
export default SkuList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,Fragment}from"react";import SkuListsContext from"../../context/SkuListsContext";import components from"../../config/components";const propTypes=components.SkuList.propTypes,displayName=components.SkuList.displayName;export function SkuList(props){const{id,children}=props,{listIds}=useContext(SkuListsContext);return useEffect(()=>{listIds&&!listIds.includes(id)&&listIds.push(id)},[]),_jsx(Fragment,{children})}SkuList.propTypes=propTypes,SkuList.displayName=displayName;export default SkuList;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
};
|
|
5
5
|
export declare function SkuListsContainer(props: Props): JSX.Element;
|
|
6
|
+
export declare namespace SkuListsContainer {
|
|
7
|
+
var propTypes: {
|
|
8
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
9
|
+
};
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
6
12
|
export default SkuListsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuListsContext from"../../context/SkuListsContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import skuListsReducer,{skuListsInitialState,getSkuList}from"../../reducers/SkuListsReducer";export function SkuListsContainer(props){const{children}=props,[state,dispatch]=useReducer(skuListsReducer,skuListsInitialState),config=useContext(CommerceLayerContext);return useEffect(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&getSkuList({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),_jsx(SkuListsContext.Provider,{value:state,children})}export default SkuListsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuListsContext from"../../context/SkuListsContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import skuListsReducer,{skuListsInitialState,getSkuList}from"../../reducers/SkuListsReducer";import components from"../../config/components";const propTypes=components.SkuListsContainer.propTypes,displayName=components.SkuListsContainer.displayName;export function SkuListsContainer(props){const{children}=props,[state,dispatch]=useReducer(skuListsReducer,skuListsInitialState),config=useContext(CommerceLayerContext);return useEffect(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&getSkuList({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),_jsx(SkuListsContext.Provider,{value:state,children})}SkuListsContainer.propTypes=propTypes,SkuListsContainer.displayName=displayName;export default SkuListsContainer;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
id: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function SkuOption(props: Props): JSX.Element;
|
|
7
|
+
export declare namespace SkuOption {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
10
|
+
id: import("prop-types").Validator<string>;
|
|
11
|
+
};
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
7
14
|
export default SkuOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import SkuOptionChildrenContext from"../../context/SkuOptionChildrenContext";import SkuOptionsContext from"../../context/SkuOptionsContext";export function SkuOption(props){const{id}=props,{skuOptions,skuCode}=useContext(SkuOptionsContext),items=skuOptions&&skuOptions.filter(l=>l.id===id).map((skuOption,k)=>_jsx(SkuOptionChildrenContext.Provider,{value:{skuOption,skuCode},children:props.children},k));return _jsx(Fragment,{children:items})}export default SkuOption;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import SkuOptionChildrenContext from"../../context/SkuOptionChildrenContext";import SkuOptionsContext from"../../context/SkuOptionsContext";import components from"../../config/components";const propTypes=components.SkuOption.propTypes,displayName=components.SkuOption.displayName;export function SkuOption(props){const{id}=props,{skuOptions,skuCode}=useContext(SkuOptionsContext),items=skuOptions&&skuOptions.filter(l=>l.id===id).map((skuOption,k)=>_jsx(SkuOptionChildrenContext.Provider,{value:{skuOption,skuCode},children:props.children},k));return _jsx(Fragment,{children:items})}SkuOption.propTypes=propTypes,SkuOption.displayName=displayName;export default SkuOption;
|
|
@@ -2,4 +2,14 @@
|
|
|
2
2
|
import { BaseInputComponentProps } from '../../typings/index';
|
|
3
3
|
declare type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
4
4
|
export declare function SkuOptionInput(props: Props): JSX.Element;
|
|
5
|
+
export declare namespace SkuOptionInput {
|
|
6
|
+
var propTypes: {
|
|
7
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
8
|
+
name: import("prop-types").Validator<string>;
|
|
9
|
+
type: import("prop-types").Validator<NonNullable<import("../../typings/index").BaseInputType>>;
|
|
10
|
+
onChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
11
|
+
placeholder: import("prop-types").Requireable<string>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
5
15
|
export default SkuOptionInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import BaseInput from"../utils/BaseInput";import ItemContext from"../../context/ItemContext";import SkuOptionChildrenContext from"../../context/SkuOptionChildrenContext";import has from"lodash/has";export function SkuOptionInput(props){const{name}=props,{option,setOption}=useContext(ItemContext),{skuOption,skuCode}=useContext(SkuOptionChildrenContext);return _jsx(BaseInput,{onChange:event=>{const val=event.target.value,options=has(option,`${skuCode}.${skuOption?.id}`)?option[skuCode]?.[`${skuOption?.id}`]?.options:{},o={[skuCode]:{...option[skuCode],[`${skuOption?.id}`]:{skuOptionId:skuOption?.id,options:{...options,[name]:val}}}};setOption&&setOption(o)},...props})}export default SkuOptionInput;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import BaseInput from"../utils/BaseInput";import ItemContext from"../../context/ItemContext";import SkuOptionChildrenContext from"../../context/SkuOptionChildrenContext";import has from"lodash/has";import components from"../../config/components";const propTypes=components.SkuOptionInput.propTypes,displayName=components.SkuOptionInput.displayName;export function SkuOptionInput(props){const{name}=props,{option,setOption}=useContext(ItemContext),{skuOption,skuCode}=useContext(SkuOptionChildrenContext);return _jsx(BaseInput,{onChange:event=>{const val=event.target.value,options=has(option,`${skuCode}.${skuOption?.id}`)?option[skuCode]?.[`${skuOption?.id}`]?.options:{},o={[skuCode]:{...option[skuCode],[`${skuOption?.id}`]:{skuOptionId:skuOption?.id,options:{...options,[name]:val}}}};setOption&&setOption(o)},...props})}SkuOptionInput.propTypes=propTypes,SkuOptionInput.displayName=displayName;export default SkuOptionInput;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
skuCode?: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function SkuOptionsContainer(props: Props): JSX.Element;
|
|
7
|
+
export declare namespace SkuOptionsContainer {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
10
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
11
|
+
};
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
7
14
|
export default SkuOptionsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuOptionsContext from"../../context/SkuOptionsContext";import skuOptionsReducer,{skuOptionsInitialState}from"../../reducers/SkuOptionsReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import{isEmpty}from"lodash";import getCurrentItemKey from"../../utils/getCurrentItemKey";import ItemContext from"../../context/ItemContext";import{getSkuOptions}from"../../reducers/SkuOptionsReducer";export function SkuOptionsContainer(props){const{skuCode,children}=props,[state,dispatch]=useReducer(skuOptionsReducer,skuOptionsInitialState),config=useContext(CommerceLayerContext),{item,items}=useContext(ItemContext),sCode=!isEmpty(items)&&skuCode?items[skuCode]?.code:skuCode||getCurrentItemKey(item),skuOptionsValue={...state,skuCode:sCode};return useEffect(()=>(sCode&&item[sCode]?.sku_options&&getSkuOptions({skuOptions:item[sCode]?.sku_options,dispatch}),()=>{isEmpty(sCode)&&dispatch({type:"setSkuOptions",payload:{skuOptions:[]}})}),[config,sCode]),_jsx(SkuOptionsContext.Provider,{value:skuOptionsValue,children})}export default SkuOptionsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuOptionsContext from"../../context/SkuOptionsContext";import skuOptionsReducer,{skuOptionsInitialState}from"../../reducers/SkuOptionsReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import{isEmpty}from"lodash";import getCurrentItemKey from"../../utils/getCurrentItemKey";import ItemContext from"../../context/ItemContext";import{getSkuOptions}from"../../reducers/SkuOptionsReducer";import components from"../../config/components";const propTypes=components.SkuOptionsContainer.propTypes,displayName=components.SkuOptionsContainer.displayName;export function SkuOptionsContainer(props){const{skuCode,children}=props,[state,dispatch]=useReducer(skuOptionsReducer,skuOptionsInitialState),config=useContext(CommerceLayerContext),{item,items}=useContext(ItemContext),sCode=!isEmpty(items)&&skuCode?items[skuCode]?.code:skuCode||getCurrentItemKey(item),skuOptionsValue={...state,skuCode:sCode};return useEffect(()=>(sCode&&item[sCode]?.sku_options&&getSkuOptions({skuOptions:item[sCode]?.sku_options,dispatch}),()=>{isEmpty(sCode)&&dispatch({type:"setSkuOptions",payload:{skuOptions:[]}})}),[config,sCode]),_jsx(SkuOptionsContext.Provider,{value:skuOptionsValue,children})}SkuOptionsContainer.propTypes=propTypes,SkuOptionsContainer.displayName=displayName;export default SkuOptionsContainer;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
};
|
|
5
5
|
export declare function Skus<P extends Props>({ children }: P): JSX.Element;
|
|
6
|
+
export declare namespace Skus {
|
|
7
|
+
var propTypes: {
|
|
8
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
6
11
|
export default Skus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import SkuChildrenContext from"../../context/SkuChildrenContext";import SkuContext from"../../context/SkuContext";import{useContext}from"react";export function Skus({children}){const{skus}=useContext(SkuContext),
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import components from"../../config/components";import SkuChildrenContext from"../../context/SkuChildrenContext";import SkuContext from"../../context/SkuContext";import{useContext}from"react";export function Skus({children}){const{skus}=useContext(SkuContext),components2=skus&&skus.map((sku,key)=>{const value={sku};return _jsx(SkuChildrenContext.Provider,{value,children},key)});return _jsx(_Fragment,{children:components2})}Skus.propTypes=components.Skus.propTypes;export default Skus;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { QueryParamsList } from '@commercelayer/sdk';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
declare type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* An array of skus to display.
|
|
6
|
+
*/
|
|
4
7
|
skus: string[];
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Accept a React node, [Skus](./Skus.d.ts), and [ItemContainer](../ItemContainer.d.ts) as children to display above the skus.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* An object params to query the skus resource
|
|
14
|
+
*/
|
|
6
15
|
queryParams?: QueryParamsList;
|
|
7
16
|
};
|
|
8
17
|
export declare function SkusContainer<P extends Props>(props: P): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { VariantHandleCallback } from '../utils/VariantTemplate';
|
|
3
3
|
import { BaseSelectorType } from '../../typings/index';
|
|
4
4
|
import { FunctionChildren } from '../../typings/index';
|
|
@@ -20,10 +20,33 @@ declare type Props = {
|
|
|
20
20
|
children?: ChildrenProps;
|
|
21
21
|
options: VariantOption[];
|
|
22
22
|
type?: BaseSelectorType;
|
|
23
|
-
loader?:
|
|
23
|
+
loader?: ReactNode;
|
|
24
24
|
placeholder?: string;
|
|
25
25
|
skuCode?: string;
|
|
26
26
|
handleCallback?: VariantHandleCallback;
|
|
27
27
|
} & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['select'];
|
|
28
28
|
export declare function VariantSelector(props: Props): JSX.Element;
|
|
29
|
+
export declare namespace VariantSelector {
|
|
30
|
+
var propTypes: {
|
|
31
|
+
options: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
|
|
32
|
+
label: import("prop-types").Validator<string>;
|
|
33
|
+
code: import("prop-types").Validator<string>;
|
|
34
|
+
lineItem: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
35
|
+
name: import("prop-types").Validator<string>;
|
|
36
|
+
imageUrl: import("prop-types").Requireable<string>;
|
|
37
|
+
}>>;
|
|
38
|
+
}>>[]>;
|
|
39
|
+
name: import("prop-types").Requireable<string>;
|
|
40
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
41
|
+
type: import("prop-types").Requireable<BaseSelectorType>;
|
|
42
|
+
loader: import("prop-types").Requireable<import("prop-types").ReactElementLike>;
|
|
43
|
+
placeholder: import("prop-types").Requireable<string>;
|
|
44
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
45
|
+
};
|
|
46
|
+
var defaultProps: {
|
|
47
|
+
placeholder: string;
|
|
48
|
+
type: BaseSelectorType;
|
|
49
|
+
};
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
29
52
|
export default VariantSelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect}from"react";import VariantTemplate from"../utils/VariantTemplate";import Parent from"../utils/Parent";import VariantsContext from"../../context/VariantsContext";export function VariantSelector(props){const{children,type
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect}from"react";import VariantTemplate from"../utils/VariantTemplate";import Parent from"../utils/Parent";import VariantsContext from"../../context/VariantsContext";import components from"../../config/components";const propTypes=components.VariantSelector.propTypes,defaultProps=components.VariantSelector.defaultProps,displayName=components.VariantSelector.displayName;export function VariantSelector(props){const{children,type,placeholder,skuCode,name,options,...prs}=props,{setSkuCode,skuCode:variantSkuCode,loading,variants,setSkuCodes}=useContext(VariantsContext);useEffect(()=>(setSkuCodes&&setSkuCodes(options),()=>{setSkuCodes&&setSkuCodes([])}),[options]);const sCode=variantSkuCode||skuCode||"",DefaultTemplate=()=>loading?_jsx(Fragment,{children:props.loader||"Loading..."}):_jsx(VariantTemplate,{variants,type,placeholder,skuCode:sCode,options,handleChange:setSkuCode,name,...prs}),parentProps={variants,loading:!!loading,handleSelect:setSkuCode,skuCode:sCode,...props};return children?_jsx(Parent,{...parentProps,children}):_jsx(Fragment,{children:_jsx(DefaultTemplate,{})})}VariantSelector.propTypes=propTypes,VariantSelector.defaultProps=defaultProps,VariantSelector.displayName=displayName;export default VariantSelector;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
filters?: Record<string, any>;
|
|
5
5
|
skuCode?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function VariantsContainer(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace VariantsContainer {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
12
|
+
filters: import("prop-types").Requireable<object>;
|
|
13
|
+
};
|
|
14
|
+
var defaultProps: {
|
|
15
|
+
skuCode: string;
|
|
16
|
+
filters: {};
|
|
17
|
+
};
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
8
20
|
export default VariantsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import variantReducer,{variantInitialState,unsetVariantState,setSkuCode,getVariants}from"../../reducers/VariantReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import VariantsContext from"../../context/VariantsContext";import{setVariantSkuCodes}from"../../reducers/VariantReducer";import isEmpty from"lodash/isEmpty";import isEqual from"lodash/isEqual";import getCurrentItemKey from"../../utils/getCurrentItemKey";import ItemContext from"../../context/ItemContext";export function VariantsContainer(props){const{children,skuCode="",filters={}}=props,config=useContext(CommerceLayerContext),{setItem,setItems,items,item:currentItem,setCustomLineItems,skuCode:itemSkuCode,setSkuCode:setItemSkuCode}=useContext(ItemContext),[state,dispatch]=useReducer(variantReducer,variantInitialState),sCode=getCurrentItemKey(currentItem)||skuCode||state.skuCode||itemSkuCode||"";useEffect(()=>{if(!isEmpty(items)&&!isEmpty(state.variants)&&!isEqual(items,state.variants)){const mergeItems={...items,...state.variants};setItems&&setItems(mergeItems)}return state.skuCodes.length>=1&&config.accessToken&&(dispatch({type:"setLoading",payload:{loading:!0}}),getVariants({config,state,dispatch,setItem,skuCode:sCode,filters})),()=>unsetVariantState(dispatch)},[config.accessToken]);const variantValue={...state,skuCode:sCode,setSkuCode:(code,id,lineItem={})=>{isEmpty(lineItem)||setCustomLineItems&&setCustomLineItems({[code]:lineItem}),setSkuCode({code,id,config,setItem,dispatch,setItemSkuCode})},setSkuCodes:skuCodes=>setVariantSkuCodes({skuCodes,dispatch,setCustomLineItems})};return _jsx(VariantsContext.Provider,{value:variantValue,children})}export default VariantsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import variantReducer,{variantInitialState,unsetVariantState,setSkuCode,getVariants}from"../../reducers/VariantReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import VariantsContext from"../../context/VariantsContext";import{setVariantSkuCodes}from"../../reducers/VariantReducer";import isEmpty from"lodash/isEmpty";import isEqual from"lodash/isEqual";import getCurrentItemKey from"../../utils/getCurrentItemKey";import ItemContext from"../../context/ItemContext";import components from"../../config/components";const propTypes=components.VariantsContainer.propTypes,defaultProps=components.VariantsContainer.defaultProps,displayName=components.VariantsContainer.displayName;export function VariantsContainer(props){const{children,skuCode="",filters={}}=props,config=useContext(CommerceLayerContext),{setItem,setItems,items,item:currentItem,setCustomLineItems,skuCode:itemSkuCode,setSkuCode:setItemSkuCode}=useContext(ItemContext),[state,dispatch]=useReducer(variantReducer,variantInitialState),sCode=getCurrentItemKey(currentItem)||skuCode||state.skuCode||itemSkuCode||"";useEffect(()=>{if(!isEmpty(items)&&!isEmpty(state.variants)&&!isEqual(items,state.variants)){const mergeItems={...items,...state.variants};setItems&&setItems(mergeItems)}return state.skuCodes.length>=1&&config.accessToken&&(dispatch({type:"setLoading",payload:{loading:!0}}),getVariants({config,state,dispatch,setItem,skuCode:sCode,filters})),()=>unsetVariantState(dispatch)},[config.accessToken]);const variantValue={...state,skuCode:sCode,setSkuCode:(code,id,lineItem={})=>{isEmpty(lineItem)||setCustomLineItems&&setCustomLineItems({[code]:lineItem}),setSkuCode({code,id,config,setItem,dispatch,setItemSkuCode})},setSkuCodes:skuCodes=>setVariantSkuCodes({skuCodes,dispatch,setCustomLineItems})};return _jsx(VariantsContext.Provider,{value:variantValue,children})}VariantsContainer.propTypes=propTypes,VariantsContainer.defaultProps=defaultProps,VariantsContainer.displayName=displayName;export default VariantsContainer;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
} & JSX.IntrinsicElements['p'];
|
|
5
5
|
export declare function StockTransfer(props: Props): JSX.Element;
|
|
6
|
+
export declare namespace StockTransfer {
|
|
7
|
+
var propTypes: {
|
|
8
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
9
|
+
};
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
6
12
|
export default StockTransfer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import ShipmentChildrenContext from"../../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../../context/StockTransferChildrenContext";export function StockTransfer(props){const{children}=props,{stockTransfers,lineItems}=useContext(ShipmentChildrenContext),
|
|
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,{value:stockTransferProps,children},k)});return _jsx(_Fragment,{children:components2})}StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName;export default StockTransfer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const PriceTemplate=props=>{const{showCompare,formattedCompare,compareClassName,className,formattedAmount,...p}=props;return delete p
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import PropTypes from"prop-types";const propTypes={formattedAmount:PropTypes.string,formattedCompare:PropTypes.string},defaultProps={formattedAmount:"",formattedCompare:""},PriceTemplate=props=>{const{showCompare,formattedCompare,compareClassName,className,formattedAmount,...p}=props;return delete p.skuCode,_jsxs(_Fragment,{children:[_jsx("span",{className,...p,children:formattedAmount}),showCompare&&_jsx("span",{className:compareClassName||"",...p,children:formattedCompare})]})};PriceTemplate.propTypes=propTypes,PriceTemplate.defaultProps=defaultProps;export default PriceTemplate;
|