@commercelayer/react-components 4.0.0-alpha.3 → 4.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/ExternalFunction.d.ts +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
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WireTransferGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),WireTransferPayment_1=tslib_1.__importDefault(require("../
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WireTransferGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),WireTransferPayment_1=tslib_1.__importDefault(require("../payment_source/WireTransferPayment")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react");function WireTransferGateway(props){const{readonly,showCard,handleEditClick,children,...p}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="wire_transfers";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly||showCard){const card=paymentSource?.options?.card||paymentSource?.metadata?.card,value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}const wireTransferConfig=config&&paymentResource?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{};return(0,jsx_runtime_1.jsx)(WireTransferPayment_1.default,{...p,...wireTransferConfig})}exports.WireTransferGateway=WireTransferGateway,exports.default=WireTransferGateway;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LoaderType } from '../../typings/index';
|
|
3
3
|
import { PaymentMethod as PaymentMethodType } from '@commercelayer/sdk';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { PaymentResource } from '../../reducers/PaymentMethodReducer';
|
|
5
|
+
declare type Props = {
|
|
6
|
+
/**
|
|
7
|
+
* Hide payment methods by an array of strings
|
|
8
|
+
*/
|
|
9
|
+
hide?: Array<PaymentResource>;
|
|
10
|
+
children: ReactNode;
|
|
10
11
|
activeClass?: string;
|
|
11
12
|
loader?: LoaderType;
|
|
12
|
-
autoSelectSinglePaymentMethod?: boolean | (() => void);
|
|
13
13
|
} & Omit<JSX.IntrinsicElements['div'], 'onClick'> & ({
|
|
14
14
|
clickableContainer: true;
|
|
15
|
-
onClick?:
|
|
15
|
+
onClick?: (payment?: PaymentMethodType | Record<string, any>) => void;
|
|
16
16
|
} | {
|
|
17
17
|
clickableContainer?: never;
|
|
18
18
|
onClick?: never;
|
|
19
19
|
});
|
|
20
|
-
export declare function PaymentMethod({ children, className, activeClass, loader, clickableContainer,
|
|
20
|
+
export declare function PaymentMethod({ children, className, activeClass, loader, clickableContainer, hide, onClick, ...p }: Props): JSX.Element;
|
|
21
|
+
export declare namespace PaymentMethod {
|
|
22
|
+
var propTypes: {
|
|
23
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
24
|
+
};
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
21
27
|
export default PaymentMethod;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethod=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethod=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),components_1=tslib_1.__importDefault(require("../../config/components")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),propTypes=components_1.default.PaymentMethod.propTypes,displayName=components_1.default.PaymentMethod.displayName;function PaymentMethod({children,className,activeClass,loader="Loading...",clickableContainer,hide,onClick,...p}){const[loading,setLoading]=(0,react_1.useState)(!0),[paymentSelected,setPaymentSelected]=(0,react_1.useState)(""),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder}=(0,react_1.useContext)(PaymentMethodContext_1.default);(0,react_1.useEffect)(()=>(paymentMethods&&setLoading(!1),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0)}),[paymentMethods,currentPaymentMethodId]);const components=paymentMethods&&paymentMethods.filter(payment=>{if(hide){const source=payment?.payment_source_type;return hide?.includes(source)===!1}return!0}).map((payment,k)=>{const isActive=currentPaymentMethodId===payment?.id,paymentMethodProps={payment,clickableContainer,paymentSelected,setPaymentSelected},paymentResource=payment?.payment_source_type,onClickable=clickableContainer?async e=>{e.stopPropagation(),setLoadingPlaceOrder({loading:!0}),setPaymentSelected(payment.id);const paymentMethodId=payment?.id;await setPaymentMethod({paymentResource,paymentMethodId}),onClick&&onClick(payment),setLoadingPlaceOrder({loading:!1})}:void 0;return(0,jsx_runtime_1.jsx)("div",{"data-test-id":paymentResource,className:`${className} ${isActive?activeClass:""}`,onClick:onClickable,...p,children:(0,jsx_runtime_1.jsx)(PaymentMethodChildrenContext_1.default.Provider,{value:paymentMethodProps,children})},k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:components})}exports.PaymentMethod=PaymentMethod,PaymentMethod.propTypes=propTypes,PaymentMethod.displayName=displayName,exports.default=PaymentMethod;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
3
|
export declare function PaymentMethodAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
+
export declare namespace PaymentMethodAmount {
|
|
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 defaultProps: {
|
|
14
|
+
format: import("../../typings/index").BaseFormatPrice;
|
|
15
|
+
};
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
4
18
|
export default PaymentMethodAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodAmount=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseOrderPrice_1=tslib_1.__importDefault(require("../utils/BaseOrderPrice"));function PaymentMethodAmount(props){return(0,jsx_runtime_1.jsx)(BaseOrderPrice_1.default,{base:"amount",type:"payment_method",...props})}exports.PaymentMethodAmount=PaymentMethodAmount,exports.default=PaymentMethodAmount;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodAmount=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseOrderPrice_1=tslib_1.__importDefault(require("../utils/BaseOrderPrice")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.PaymentMethodAmount.propTypes,defaultProps=components_1.default.PaymentMethodAmount.defaultProps,displayName=components_1.default.PaymentMethodAmount.displayName;function PaymentMethodAmount(props){return(0,jsx_runtime_1.jsx)(BaseOrderPrice_1.default,{base:"amount",type:"payment_method",...props})}exports.PaymentMethodAmount=PaymentMethodAmount,PaymentMethodAmount.propTypes=propTypes,PaymentMethodAmount.defaultProps=defaultProps,PaymentMethodAmount.displayName=displayName,exports.default=PaymentMethodAmount;
|
|
@@ -6,4 +6,10 @@ declare type Props = {
|
|
|
6
6
|
children?: (props: PaymentMethodNameChildrenProps) => JSX.Element;
|
|
7
7
|
} & JSX.IntrinsicElements['label'];
|
|
8
8
|
export declare function PaymentMethodName(props: Props): JSX.Element;
|
|
9
|
+
export declare namespace PaymentMethodName {
|
|
10
|
+
var propTypes: {
|
|
11
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
9
15
|
export default PaymentMethodName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodName=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent"));function PaymentMethodName(props){const{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),labelName=payment?.name,htmlFor=payment?.payment_source_type,parentProps={htmlFor,labelName,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("label",{htmlFor,...props,children:labelName})}exports.PaymentMethodName=PaymentMethodName,exports.default=PaymentMethodName;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodName=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.PaymentMethodName.propTypes,displayName=components_1.default.PaymentMethodName.displayName;function PaymentMethodName(props){const{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),labelName=payment?.name,htmlFor=payment?.payment_source_type,parentProps={htmlFor,labelName,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("label",{htmlFor,...props,children:labelName})}exports.PaymentMethodName=PaymentMethodName,PaymentMethodName.propTypes=propTypes,PaymentMethodName.displayName=displayName,exports.default=PaymentMethodName;
|
|
@@ -5,4 +5,16 @@ declare type Props = {
|
|
|
5
5
|
labelFree?: string;
|
|
6
6
|
} & BaseAmountComponent;
|
|
7
7
|
export declare function PaymentMethodPrice(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace PaymentMethodPrice {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
type: import("prop-types").Requireable<"amount">;
|
|
11
|
+
id: import("prop-types").Requireable<string>;
|
|
12
|
+
className: import("prop-types").Requireable<string>;
|
|
13
|
+
style: import("prop-types").Requireable<object>;
|
|
14
|
+
name: import("prop-types").Requireable<string>;
|
|
15
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
16
|
+
format: import("prop-types").Requireable<import("../../typings/index").BaseFormatPrice>;
|
|
17
|
+
};
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
8
20
|
export default PaymentMethodPrice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodPrice=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getAmount_1=tslib_1.__importDefault(require("../../utils/getAmount")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent"));function PaymentMethodPrice(props){const{format="formatted",type="amount",labelFree="Free",...p}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),[price,setPrice]=(0,react_1.useState)(""),[priceCents,setPriceCents]=(0,react_1.useState)(0);(0,react_1.useEffect)(()=>{if(payment){const p2=(0,getAmount_1.default)({base:"price",type,format,obj:payment});setPrice(p2);const c=(0,getAmount_1.default)({base:"price",type,format:"cents",obj:payment});setPriceCents(c)}return()=>{setPrice(""),setPriceCents(0)}},[payment]);const parentProps={labelFree,price,priceCents,...p};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:priceCents===0?labelFree:price})}exports.PaymentMethodPrice=PaymentMethodPrice,exports.default=PaymentMethodPrice;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodPrice=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getAmount_1=tslib_1.__importDefault(require("../../utils/getAmount")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.PaymentMethodPrice.propTypes,displayName=components_1.default.PaymentMethodPrice.displayName;function PaymentMethodPrice(props){const{format="formatted",type="amount",labelFree="Free",...p}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),[price,setPrice]=(0,react_1.useState)(""),[priceCents,setPriceCents]=(0,react_1.useState)(0);(0,react_1.useEffect)(()=>{if(payment){const p2=(0,getAmount_1.default)({base:"price",type,format,obj:payment});setPrice(p2);const c=(0,getAmount_1.default)({base:"price",type,format:"cents",obj:payment});setPriceCents(c)}return()=>{setPrice(""),setPriceCents(0)}},[payment]);const parentProps={labelFree,price,priceCents,...p};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:priceCents===0?labelFree:price})}exports.PaymentMethodPrice=PaymentMethodPrice,PaymentMethodPrice.propTypes=propTypes,PaymentMethodPrice.displayName=displayName,exports.default=PaymentMethodPrice;
|
|
@@ -9,4 +9,10 @@ declare type Props = {
|
|
|
9
9
|
onChange?: (payment?: PaymentMethod | Record<string, any>) => void;
|
|
10
10
|
} & JSX.IntrinsicElements['input'];
|
|
11
11
|
export declare function PaymentMethodRadioButton(props: Props): JSX.Element;
|
|
12
|
+
export declare namespace PaymentMethodRadioButton {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
};
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
12
18
|
export default PaymentMethodRadioButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodRadioButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext"));function PaymentMethodRadioButton(props){const{onChange,...p}=props,{payment,paymentSelected,setPaymentSelected,clickableContainer}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{setPaymentMethod,setLoading}=(0,react_1.useContext)(PaymentMethodContext_1.default),orderId=order?.id||"",paymentResource=payment?.payment_source_type,paymentMethodId=payment?.id,name=`payment-${orderId}`,checked=paymentSelected===payment?.id,handleOnChange=async e=>{e.stopPropagation(),setPaymentSelected&&setPaymentSelected(paymentMethodId),setLoading({loading:!0}),!clickableContainer&&await setPaymentMethod({paymentResource,paymentMethodId}),onChange&&onChange(payment),setLoading({loading:!1})},id=payment?.payment_source_type,parentProps={handleOnChange,checked,id,name,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("input",{title:name,type:"radio",id,onChange:handleOnChange,checked,...p})}exports.PaymentMethodRadioButton=PaymentMethodRadioButton,exports.default=PaymentMethodRadioButton;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodRadioButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),propTypes=components_1.default.PaymentMethodRadioButton.propTypes,displayName=components_1.default.PaymentMethodRadioButton.displayName;function PaymentMethodRadioButton(props){const{onChange,...p}=props,{payment,paymentSelected,setPaymentSelected,clickableContainer}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{setPaymentMethod,setLoading}=(0,react_1.useContext)(PaymentMethodContext_1.default),orderId=order?.id||"",paymentResource=payment?.payment_source_type,paymentMethodId=payment?.id,name=`payment-${orderId}`,checked=paymentSelected===payment?.id,handleOnChange=async e=>{e.stopPropagation(),setPaymentSelected&&setPaymentSelected(paymentMethodId),setLoading({loading:!0}),!clickableContainer&&await setPaymentMethod({paymentResource,paymentMethodId}),onChange&&onChange(payment),setLoading({loading:!1})},id=payment?.payment_source_type,parentProps={handleOnChange,checked,id,name,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("input",{title:name,type:"radio",id,onChange:handleOnChange,checked,...p})}exports.PaymentMethodRadioButton=PaymentMethodRadioButton,PaymentMethodRadioButton.propTypes=propTypes,PaymentMethodRadioButton.displayName=displayName,exports.default=PaymentMethodRadioButton;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
children:
|
|
4
|
+
children: ReactNode;
|
|
5
5
|
config?: PaymentMethodConfig;
|
|
6
6
|
};
|
|
7
7
|
export declare function PaymentMethodsContainer(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace PaymentMethodsContainer {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
+
};
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
8
14
|
export default PaymentMethodsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentMethodContext_1=tslib_1.__importStar(require("../../context/PaymentMethodContext")),react_1=require("react"),PaymentMethodReducer_1=tslib_1.__importStar(require("../../reducers/PaymentMethodReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),lodash_1=require("lodash"),PaymentMethodReducer_2=require("../../reducers/PaymentMethodReducer");function PaymentMethodsContainer(props){const{children,config}=props,[state,dispatch]=(0,react_1.useReducer)(PaymentMethodReducer_1.default,PaymentMethodReducer_1.paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),credentials=(0,react_1.useContext)(CommerceLayerContext_1.default);async function getPayMethods(){order&&await(0,PaymentMethodReducer_1.getPaymentMethods)({order,dispatch})}(0,react_1.useEffect)(()=>{include?.includes("available_payment_methods")?includeLoaded?.available_payment_methods||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0,"line_items.item":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option","line_items.item"]}),config&&(0,lodash_1.isEmpty)(state.config)&&(0,PaymentMethodReducer_1.setPaymentMethodConfig)(config,dispatch),credentials&&order&&(state.paymentMethods||getPayMethods()),order?.payment_source&&dispatch({type:"setPaymentSource",payload:{paymentSource:order?.payment_source}}),order?.payment_source===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include,includeLoaded]);const contextValue=(0,react_1.useMemo)(()=>({...state,setLoading:({loading})=>PaymentMethodContext_1.defaultPaymentMethodContext.setLoading({loading,dispatch}),setPaymentRef:({ref})=>(0,PaymentMethodReducer_2.setPaymentRef)({ref,dispatch}),setPaymentMethodErrors:errors=>PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch),setPaymentMethod:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentMethod({...args,config:credentials,updateOrder,order,dispatch,setOrderErrors}),setPaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentSource({...state,...args,config:credentials,dispatch,getOrder,updateOrder,order}),updatePaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.updatePaymentSource({...args,config:credentials,dispatch}),destroyPaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.destroyPaymentSource({...args,dispatch,config:credentials,updateOrder,orderId:order?.id})}),[state]);return(0,jsx_runtime_1.jsx)(PaymentMethodContext_1.default.Provider,{value:contextValue,children})}exports.PaymentMethodsContainer=PaymentMethodsContainer,exports.default=PaymentMethodsContainer;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentMethodContext_1=tslib_1.__importStar(require("../../context/PaymentMethodContext")),react_1=require("react"),PaymentMethodReducer_1=tslib_1.__importStar(require("../../reducers/PaymentMethodReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),components_1=tslib_1.__importDefault(require("../../config/components")),lodash_1=require("lodash"),PaymentMethodReducer_2=require("../../reducers/PaymentMethodReducer"),propTypes=components_1.default.PaymentMethodsContainer.propTypes,displayName=components_1.default.PaymentMethodsContainer.displayName;function PaymentMethodsContainer(props){const{children,config}=props,[state,dispatch]=(0,react_1.useReducer)(PaymentMethodReducer_1.default,PaymentMethodReducer_1.paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),credentials=(0,react_1.useContext)(CommerceLayerContext_1.default);async function getPayMethods(){order&&await(0,PaymentMethodReducer_1.getPaymentMethods)({order,dispatch})}(0,react_1.useEffect)(()=>{include?.includes("available_payment_methods")?includeLoaded?.available_payment_methods||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0,"line_items.item":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option","line_items.item"]}),config&&(0,lodash_1.isEmpty)(state.config)&&(0,PaymentMethodReducer_1.setPaymentMethodConfig)(config,dispatch),credentials&&order&&(state.paymentMethods||getPayMethods()),order?.payment_source&&dispatch({type:"setPaymentSource",payload:{paymentSource:order?.payment_source}}),order?.payment_source===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include,includeLoaded]);const contextValue=(0,react_1.useMemo)(()=>({...state,setLoading:({loading})=>PaymentMethodContext_1.defaultPaymentMethodContext.setLoading({loading,dispatch}),setPaymentRef:({ref})=>(0,PaymentMethodReducer_2.setPaymentRef)({ref,dispatch}),setPaymentMethodErrors:errors=>PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch),setPaymentMethod:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentMethod({...args,config:credentials,updateOrder,order,dispatch,setOrderErrors}),setPaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentSource({...state,...args,config:credentials,dispatch,getOrder,updateOrder,order}),updatePaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.updatePaymentSource({...args,config:credentials,dispatch}),destroyPaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.destroyPaymentSource({...args,dispatch,config:credentials,updateOrder,orderId:order?.id})}),[state]);return(0,jsx_runtime_1.jsx)(PaymentMethodContext_1.default.Provider,{value:contextValue,children})}exports.PaymentMethodsContainer=PaymentMethodsContainer,PaymentMethodsContainer.propTypes=propTypes,PaymentMethodsContainer.displayName=displayName,exports.default=PaymentMethodsContainer;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaymentSource.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LoaderType } from '../../typings/index';
|
|
3
3
|
import { CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
|
|
4
4
|
export declare type CustomerCardsProps = {
|
|
@@ -8,7 +8,7 @@ export declare type CustomerSaveToWalletProps = {
|
|
|
8
8
|
name: 'save_payment_source_to_customer_wallet';
|
|
9
9
|
};
|
|
10
10
|
export declare type PaymentSourceProps = {
|
|
11
|
-
children?:
|
|
11
|
+
children?: ReactNode;
|
|
12
12
|
readonly?: boolean;
|
|
13
13
|
templateCustomerCards?: CustomerCardsTemplateChildren;
|
|
14
14
|
onClickCustomerCards?: () => void;
|
|
@@ -16,4 +16,11 @@ export declare type PaymentSourceProps = {
|
|
|
16
16
|
loader?: LoaderType;
|
|
17
17
|
} & JSX.IntrinsicElements['div'];
|
|
18
18
|
export declare function PaymentSource(props: PaymentSourceProps): JSX.Element;
|
|
19
|
+
export declare namespace PaymentSource {
|
|
20
|
+
var propTypes: {
|
|
21
|
+
children: import("prop-types").Requireable<ReactNode | (() => JSX.Element)>;
|
|
22
|
+
readonly: import("prop-types").Requireable<boolean>;
|
|
23
|
+
};
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
19
26
|
export default PaymentSource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSource=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),components_1=tslib_1.__importDefault(require("../../config/components")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),PaymentGateway_1=tslib_1.__importDefault(require("../payment_gateways/PaymentGateway")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),propTypes=components_1.default.PaymentSource.propTypes,displayName=components_1.default.PaymentSource.displayName;function PaymentSource(props){const{readonly}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{payments}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,paymentSource,destroyPaymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),[show,setShow]=(0,react_1.useState)(!1),[showCard,setShowCard]=(0,react_1.useState)(!1);(0,react_1.useEffect)(()=>(readonly?(setShow(!0),setShowCard(!0)):payment?.id===currentPaymentMethodId?(setShow(!0),(0,getCardDetails_1.default)({paymentType:payment?.payment_source_type,customerPayment:{payment_source:paymentSource}}).brand&&setShowCard(!0)):setShow(!1),()=>{setShow(!1),setShowCard(!1)}),[currentPaymentMethodId,paymentSource,payments,payment,readonly,order]);const gatewayProps={...props,show,showCard,handleEditClick:async e=>{if(e.stopPropagation(),paymentSource){const paymentSourceId=paymentSource?.id;await destroyPaymentSource({paymentSourceId,paymentResource:payment?.payment_source_type})}setShowCard(!showCard),setShow(!0)},readonly};return(0,jsx_runtime_1.jsx)(PaymentGateway_1.default,{...gatewayProps})}exports.PaymentSource=PaymentSource,PaymentSource.propTypes=propTypes,PaymentSource.displayName=displayName,exports.default=PaymentSource;
|
|
@@ -12,4 +12,14 @@ declare type Props = {
|
|
|
12
12
|
height?: number;
|
|
13
13
|
} & JSX.IntrinsicElements['img'];
|
|
14
14
|
export declare function PaymentSourceBrandIcon({ src, width, children, ...p }: Props): JSX.Element;
|
|
15
|
+
export declare namespace PaymentSourceBrandIcon {
|
|
16
|
+
var propTypes: {
|
|
17
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
18
|
+
width: import("prop-types").Requireable<number>;
|
|
19
|
+
height: import("prop-types").Requireable<number>;
|
|
20
|
+
src: import("prop-types").Requireable<string>;
|
|
21
|
+
className: import("prop-types").Requireable<string>;
|
|
22
|
+
};
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
15
25
|
export default PaymentSourceBrandIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceBrandIcon=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.PaymentSourceBrandIcon.propTypes,displayName=components_1.default.PaymentSourceBrandIcon.displayName;function PaymentSourceBrandIcon({src,width=32,children,...p}){const{brand}=(0,react_1.useContext)(PaymentSourceContext_1.default),ref=(0,react_1.useRef)(null),defaultSrc="//data.commercelayer.app/assets/images/icons/credit-cards/color/credit-card.svg",url=src||`//data.commercelayer.app/assets/images/icons/credit-cards/color/${brand}.svg`,handleError=()=>{ref.current&&(ref.current.src=defaultSrc)},parentProps={brand,defaultSrc,url,width,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("img",{ref,src:url,onError:handleError,width,...p})}exports.PaymentSourceBrandIcon=PaymentSourceBrandIcon,PaymentSourceBrandIcon.propTypes=propTypes,PaymentSourceBrandIcon.displayName=displayName,exports.default=PaymentSourceBrandIcon;
|
|
@@ -9,4 +9,11 @@ declare type Props = {
|
|
|
9
9
|
label?: string;
|
|
10
10
|
} & JSX.IntrinsicElements['span'];
|
|
11
11
|
export declare function PaymentSourceBrandName({ children, label, ...props }: Props): JSX.Element;
|
|
12
|
+
export declare namespace PaymentSourceBrandName {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
label: import("prop-types").Requireable<string>;
|
|
16
|
+
};
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
12
19
|
export default PaymentSourceBrandName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceBrandName=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),lodash_1=require("lodash"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.PaymentSourceBrandName.propTypes,displayName=components_1.default.PaymentSourceBrandName.displayName;function PaymentSourceBrandName({children,label,...props}){const{brand}=(0,react_1.useContext)(PaymentSourceContext_1.default),brandName=brand&&(0,lodash_1.capitalize)(brand.replace("-"," ")),parentProps={brand:brandName,label,...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("span",{...props,children:label||(0,lodash_1.capitalize)(brandName)})}exports.PaymentSourceBrandName=PaymentSourceBrandName,PaymentSourceBrandName.propTypes=propTypes,PaymentSourceBrandName.displayName=displayName,exports.default=PaymentSourceBrandName;
|
|
@@ -9,4 +9,10 @@ declare type Props = {
|
|
|
9
9
|
type: PaymentSourceDetailType;
|
|
10
10
|
} & JSX.IntrinsicElements['span'];
|
|
11
11
|
export declare function PaymentSourceDetail({ type, children, ...p }: Props): JSX.Element;
|
|
12
|
+
export declare namespace PaymentSourceDetail {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
type: import("prop-types").Validator<NonNullable<PaymentSourceDetailType>>;
|
|
15
|
+
};
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
12
18
|
export default PaymentSourceDetail;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceDetail=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),components_1=tslib_1.__importDefault(require("../../config/components")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),lodash_1=require("lodash"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),propTypes=components_1.default.PaymentSourceDetail.propTypes,displayName=components_1.default.PaymentSourceDetail.displayName;function PaymentSourceDetail({type,children,...p}){const card=(0,react_1.useContext)(PaymentSourceContext_1.default),text=(0,lodash_1.has)(card,type)?card[type]:type==="last4"?"****":"**",parentProps={type,text,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("span",{...p,children:text})}exports.PaymentSourceDetail=PaymentSourceDetail,PaymentSourceDetail.propTypes=propTypes,PaymentSourceDetail.displayName=displayName,exports.default=PaymentSourceDetail;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../../typings/index';
|
|
3
3
|
declare type CustomComponent = FunctionChildren<Omit<Props, 'children'>>;
|
|
4
4
|
declare type Props = {
|
|
5
5
|
children?: CustomComponent;
|
|
6
|
-
label?: string |
|
|
6
|
+
label?: string | ReactNode;
|
|
7
7
|
} & Omit<JSX.IntrinsicElements['button'], 'onClick'>;
|
|
8
8
|
export declare function PaymentSourceEditButton({ children, label, ...props }: Props): JSX.Element | null;
|
|
9
|
+
export declare namespace PaymentSourceEditButton {
|
|
10
|
+
var propTypes: {
|
|
11
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
12
|
+
label: import("prop-types").Requireable<NonNullable<string | import("prop-types").ReactElementLike | null | undefined>>;
|
|
13
|
+
};
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
9
16
|
export default PaymentSourceEditButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceEditButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),displayName=components_1.default.PaymentSourceEditButton.displayName,propTypes=components_1.default.PaymentSourceEditButton.propTypes;function PaymentSourceEditButton({children,label="Edit",...props}){const{showCard,handleEditClick,readonly}=(0,react_1.useContext)(PaymentSourceContext_1.default),parentProps={showCard,label,handleEditClick,...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):readonly?null:(0,jsx_runtime_1.jsx)("button",{...props,onClick:handleEditClick,children:label})}exports.PaymentSourceEditButton=PaymentSourceEditButton,PaymentSourceEditButton.propTypes=propTypes,PaymentSourceEditButton.displayName=displayName,exports.default=PaymentSourceEditButton;
|
package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaypalPayment.d.ts
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export declare type PaypalConfig = {
|
|
3
3
|
return_url: string;
|
|
4
4
|
cancel_url: string;
|
|
5
5
|
infoMessage?: {
|
|
6
|
-
text?: string |
|
|
6
|
+
text?: string | ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -13,4 +13,16 @@ export declare type PriceProps = Partial<JSX.IntrinsicElements['span']> & {
|
|
|
13
13
|
skuCode?: string;
|
|
14
14
|
};
|
|
15
15
|
export declare function Price(props: PriceProps): JSX.Element;
|
|
16
|
+
export declare namespace Price {
|
|
17
|
+
var propTypes: {
|
|
18
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
19
|
+
compareClassName: import("prop-types").Requireable<string>;
|
|
20
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
21
|
+
showCompare: import("prop-types").Requireable<boolean>;
|
|
22
|
+
};
|
|
23
|
+
var defaultProps: {
|
|
24
|
+
skuCode: string;
|
|
25
|
+
};
|
|
26
|
+
var displayName: string;
|
|
27
|
+
}
|
|
16
28
|
export default Price;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Price=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),lodash_1=require("lodash"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PricesContext_1=tslib_1.__importDefault(require("../../context/PricesContext")),getPrices_1=require("../../utils/getPrices"),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext"));function Price(props){const{children,skuCode=""}=props,{prices,skuCode:pricesSkuCode,loading,skuCodes,setSkuCodes,loader}=(0,react_1.useContext)(PricesContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),[skuPrices,setSkuPrices]=(0,react_1.useState)([]),sCode=pricesSkuCode||skuCode||sku?.code;(0,react_1.useEffect)(()=>(!(0,lodash_1.isEmpty)(prices)&&(0,lodash_1.has)(prices,`${sCode}`)?setSkuPrices(prices[sCode]):sCode&&(0,lodash_1.indexOf)(skuCodes,sCode)===-1&&(skuCodes.push(sCode),setSkuCodes&&setSkuCodes(skuCodes)),()=>{setSkuPrices([])}),[prices,sCode]);const parentProps={loading,loader,prices:skuPrices,...props},pricesComponent=(0,lodash_1.isEmpty)(prices)||(0,lodash_1.isEmpty)(skuPrices)?null:(0,getPrices_1.getPricesComponent)(skuPrices,props);return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:loading||(0,lodash_1.isEmpty)(pricesComponent)?loader:pricesComponent})}exports.Price=Price,exports.default=Price;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Price=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),lodash_1=require("lodash"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PricesContext_1=tslib_1.__importDefault(require("../../context/PricesContext")),getPrices_1=require("../../utils/getPrices"),components_1=tslib_1.__importDefault(require("../../config/components")),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext")),propTypes=components_1.default.Price.propTypes,defaultProps=components_1.default.Price.defaultProps,displayName=components_1.default.Price.displayName;function Price(props){const{children,skuCode=""}=props,{prices,skuCode:pricesSkuCode,loading,skuCodes,setSkuCodes,loader}=(0,react_1.useContext)(PricesContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),[skuPrices,setSkuPrices]=(0,react_1.useState)([]),sCode=pricesSkuCode||skuCode||sku?.code;(0,react_1.useEffect)(()=>(!(0,lodash_1.isEmpty)(prices)&&(0,lodash_1.has)(prices,`${sCode}`)?setSkuPrices(prices[sCode]):sCode&&(0,lodash_1.indexOf)(skuCodes,sCode)===-1&&(skuCodes.push(sCode),setSkuCodes&&setSkuCodes(skuCodes)),()=>{setSkuPrices([])}),[prices,sCode]);const parentProps={loading,loader,prices:skuPrices,...props},pricesComponent=(0,lodash_1.isEmpty)(prices)||(0,lodash_1.isEmpty)(skuPrices)?null:(0,getPrices_1.getPricesComponent)(skuPrices,props);return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:loading||(0,lodash_1.isEmpty)(pricesComponent)?loader:pricesComponent})}exports.Price=Price,Price.propTypes=propTypes,Price.defaultProps=defaultProps,Price.displayName=displayName,exports.default=Price;
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LoaderType } from '../../typings/index';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
children:
|
|
4
|
+
children: ReactNode;
|
|
5
5
|
filters?: object;
|
|
6
6
|
loader?: LoaderType;
|
|
7
7
|
perPage?: number;
|
|
8
8
|
skuCode?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare function PricesContainer(props: Props): JSX.Element;
|
|
11
|
+
export declare namespace PricesContainer {
|
|
12
|
+
var propTypes: {
|
|
13
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
14
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
15
|
+
loader: import("prop-types").Requireable<NonNullable<string | import("prop-types").ReactElementLike | null | undefined>>;
|
|
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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PricesContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getPrices_1=tslib_1.__importDefault(require("../../utils/getPrices")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),has_1=tslib_1.__importDefault(require("lodash/has")),indexOf_1=tslib_1.__importDefault(require("lodash/indexOf")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),PriceReducer_1=tslib_1.__importStar(require("../../reducers/PriceReducer")),PriceReducer_2=require("../../reducers/PriceReducer"),PricesContext_1=tslib_1.__importDefault(require("../../context/PricesContext")),getCurrentItemKey_1=tslib_1.__importDefault(require("../../utils/getCurrentItemKey")),ItemContext_1=tslib_1.__importDefault(require("../../context/ItemContext")),SkuContext_1=tslib_1.__importDefault(require("../../context/SkuContext"));function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=(0,react_1.useReducer)(PriceReducer_1.default,PriceReducer_2.priceInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default),{skuCodes}=(0,react_1.useContext)(SkuContext_1.default),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=(0,react_1.useContext)(ItemContext_1.default);(0,indexOf_1.default)(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode||(0,getCurrentItemKey_1.default)(currentItem)||itemSkuCode||"",setSkuCodes=skuCodes2=>{dispatch({type:"setSkuCodes",payload:{skuCodes:skuCodes2}})};(0,react_1.useEffect)(()=>{if(state.skuCodes.length===0&&skuCodes&&skuCodes.length>0&&setSkuCodes(skuCodes),currentItem&&(0,has_1.default)(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!(0,isEmpty_1.default)(items)&&(0,isEmpty_1.default)(currentItem)){const p=(0,getPrices_1.default)(items);dispatch({type:"setPrices",payload:{prices:p}})}return config.accessToken&&!(0,has_1.default)(prices,itemSkuCode||sCode)&&(state.skuCodes.length>0||itemSkuCode||sCode)&&(0,PriceReducer_2.getSkusPrice)(sCode&&[itemSkuCode||sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),config.accessToken&&(0,isEmpty_1.default)(currentItem)&&(state.skuCodes.length>0||skuCode)&&(0,PriceReducer_2.getSkusPrice)(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{(0,isEmpty_1.default)(currentItem)&&(0,PriceReducer_1.unsetPriceState)(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length,itemSkuCode]);const priceValue={...state,skuCode:sCode,loader,setSkuCodes};return(0,jsx_runtime_1.jsx)(PricesContext_1.default.Provider,{value:priceValue,children})}exports.PricesContainer=PricesContainer,exports.default=PricesContainer;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PricesContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getPrices_1=tslib_1.__importDefault(require("../../utils/getPrices")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),has_1=tslib_1.__importDefault(require("lodash/has")),indexOf_1=tslib_1.__importDefault(require("lodash/indexOf")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),PriceReducer_1=tslib_1.__importStar(require("../../reducers/PriceReducer")),PriceReducer_2=require("../../reducers/PriceReducer"),PricesContext_1=tslib_1.__importDefault(require("../../context/PricesContext")),getCurrentItemKey_1=tslib_1.__importDefault(require("../../utils/getCurrentItemKey")),ItemContext_1=tslib_1.__importDefault(require("../../context/ItemContext")),components_1=tslib_1.__importDefault(require("../../config/components")),SkuContext_1=tslib_1.__importDefault(require("../../context/SkuContext")),propTypes=components_1.default.PricesContainer.propTypes,defaultProps=components_1.default.PricesContainer.defaultProps,displayName=components_1.default.PricesContainer.displayName;function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=(0,react_1.useReducer)(PriceReducer_1.default,PriceReducer_2.priceInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default),{skuCodes}=(0,react_1.useContext)(SkuContext_1.default),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=(0,react_1.useContext)(ItemContext_1.default);(0,indexOf_1.default)(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode||(0,getCurrentItemKey_1.default)(currentItem)||itemSkuCode||"",setSkuCodes=skuCodes2=>{dispatch({type:"setSkuCodes",payload:{skuCodes:skuCodes2}})};(0,react_1.useEffect)(()=>{if(state.skuCodes.length===0&&skuCodes&&skuCodes.length>0&&setSkuCodes(skuCodes),currentItem&&(0,has_1.default)(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!(0,isEmpty_1.default)(items)&&(0,isEmpty_1.default)(currentItem)){const p=(0,getPrices_1.default)(items);dispatch({type:"setPrices",payload:{prices:p}})}return config.accessToken&&!(0,has_1.default)(prices,itemSkuCode||sCode)&&(state.skuCodes.length>0||itemSkuCode||sCode)&&(0,PriceReducer_2.getSkusPrice)(sCode&&[itemSkuCode||sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),config.accessToken&&(0,isEmpty_1.default)(currentItem)&&(state.skuCodes.length>0||skuCode)&&(0,PriceReducer_2.getSkusPrice)(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{(0,isEmpty_1.default)(currentItem)&&(0,PriceReducer_1.unsetPriceState)(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length,itemSkuCode]);const priceValue={...state,skuCode:sCode,loader,setSkuCodes};return(0,jsx_runtime_1.jsx)(PricesContext_1.default.Provider,{value:priceValue,children})}exports.PricesContainer=PricesContainer,PricesContainer.propTypes=propTypes,PricesContainer.defaultProps=defaultProps,PricesContainer.displayName=displayName,exports.default=PricesContainer;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LoaderType } from '../../typings/index';
|
|
3
3
|
declare type ShipmentProps = {
|
|
4
|
-
children:
|
|
4
|
+
children: ReactNode;
|
|
5
5
|
loader?: LoaderType;
|
|
6
6
|
autoSelectSingleShippingMethod?: boolean | (() => void);
|
|
7
7
|
};
|
|
8
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<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
9
15
|
export default Shipment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shipment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent"));function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=(0,react_1.useState)(!0),{shipments,deliveryLeadTimes,setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default);(0,react_1.useEffect)(()=>
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shipment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),components_1=tslib_1.__importDefault(require("../../config/components")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),propTypes=components_1.default.Shipment.propTypes,displayName=components_1.default.Shipment.displayName;function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=(0,react_1.useState)(!0),{shipments,deliveryLeadTimes,setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default);(0,react_1.useEffect)(()=>{shipments&&(autoSelectSingleShippingMethod?(async()=>await shipments.forEach(async shipment=>{const isSingle=shipment?.available_shipping_methods?.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 components=shipments&&shipments.map((shipment,k)=>{const lineItems=shipment.shipment_line_items?.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?shippingMethods[0]?.id:shipment.shipping_method?.id,stockTransfers=shipment.stock_transfers,times=deliveryLeadTimes?.filter(time=>time.stock_location?.id===shipment.stock_location?.id),shipmentProps={lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:k+1};return(0,jsx_runtime_1.jsx)(ShipmentChildrenContext_1.default.Provider,{value:shipmentProps,children},k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Shipment=Shipment,Shipment.propTypes=propTypes,Shipment.displayName=displayName,exports.default=Shipment;
|
|
@@ -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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentField=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),get_1=tslib_1.__importDefault(require("lodash/get")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext"));function ShipmentField(props){const{name}=props,{shipment,keyNumber}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),key=name,text=key!=="key_number"?(0,get_1.default)(shipment,key):keyNumber,parentProps={shipment,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...props,children:text})}exports.ShipmentField=ShipmentField,exports.default=ShipmentField;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentField=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),get_1=tslib_1.__importDefault(require("lodash/get")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),propTypes=components_1.default.ShipmentField.propTypes,displayName=components_1.default.ShipmentField.displayName;function ShipmentField(props){const{name}=props,{shipment,keyNumber}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),key=name,text=key!=="key_number"?(0,get_1.default)(shipment,key):keyNumber,parentProps={shipment,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...props,children:text})}exports.ShipmentField=ShipmentField,ShipmentField.propTypes=propTypes,ShipmentField.displayName=displayName,exports.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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ShipmentContext_1=tslib_1.__importStar(require("../../context/ShipmentContext")),react_1=require("react"),ShipmentReducer_1=tslib_1.__importStar(require("../../reducers/ShipmentReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ShipmentContext_1=tslib_1.__importStar(require("../../context/ShipmentContext")),react_1=require("react"),ShipmentReducer_1=tslib_1.__importStar(require("../../reducers/ShipmentReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),components_1=tslib_1.__importDefault(require("../../config/components")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),propTypes=components_1.default.ShipmentsContainer.propTypes,displayName=components_1.default.ShipmentsContainer.displayName;function ShipmentsContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(ShipmentReducer_1.default,ShipmentReducer_1.shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default);(0,react_1.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&&!(0,isEmpty_1.default)(config)&&order.shipments&&(0,ShipmentReducer_1.getShipments)({order,dispatch,config})},[order,include,includeLoaded]),(0,react_1.useEffect)(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&(0,ShipmentReducer_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)&&(0,ShipmentReducer_1.setShipmentErrors)([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{(0,ShipmentReducer_1.setShipmentErrors)([],dispatch)}),[order?.shipments]);const contextValue={...state,setShipmentErrors:errors=>ShipmentContext_1.defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await(0,ShipmentReducer_1.setShippingMethod)({shippingMethodId,shipmentId,config,getOrder,order})};return(0,jsx_runtime_1.jsx)(ShipmentContext_1.default.Provider,{value:contextValue,children})}exports.ShipmentsContainer=ShipmentsContainer,ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName,exports.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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethod=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty"));function ShippingMethod(props){const{children,readonly,emptyText="There are not any shipping method available"}=props,{shippingMethods,currentShippingMethodId,deliveryLeadTimes,shipment}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),[items,setItems]=(0,react_1.useState)([]);(0,react_1.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(0,jsx_runtime_1.jsx)(ShippingMethodChildrenContext_1.default.Provider,{value:shippingProps,children},k)});methods&&setItems(methods)},[currentShippingMethodId,deliveryLeadTimes,shippingMethods]);const components=!(0,isEmpty_1.default)(items)&&items||emptyText;return(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:components})}exports.ShippingMethod=ShippingMethod,exports.default=ShippingMethod;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethod=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),components_1=tslib_1.__importDefault(require("../../config/components")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),propTypes=components_1.default.ShippingMethod.propTypes,displayName=components_1.default.ShippingMethod.displayName;function ShippingMethod(props){const{children,readonly,emptyText="There are not any shipping method available"}=props,{shippingMethods,currentShippingMethodId,deliveryLeadTimes,shipment}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),[items,setItems]=(0,react_1.useState)([]);(0,react_1.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(0,jsx_runtime_1.jsx)(ShippingMethodChildrenContext_1.default.Provider,{value:shippingProps,children},k)});methods&&setItems(methods)},[currentShippingMethodId,deliveryLeadTimes,shippingMethods]);const components=!(0,isEmpty_1.default)(items)&&items||emptyText;return(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:components})}exports.ShippingMethod=ShippingMethod,ShippingMethod.propTypes=propTypes,ShippingMethod.displayName=displayName,exports.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;
|