@commercelayer/react-components 4.0.0-alpha.3 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/ExternalFunction.d.ts +9 -2
- package/lib/cjs/components/ExternalFunction.js +1 -1
- package/lib/cjs/components/MetadataInput.d.ts +10 -0
- package/lib/cjs/components/MetadataInput.js +1 -1
- package/lib/cjs/components/SubmitButton.d.ts +12 -2
- package/lib/cjs/components/SubmitButton.js +1 -1
- package/lib/cjs/components/addresses/Address.d.ts +7 -2
- package/lib/cjs/components/addresses/Address.js +1 -1
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +16 -0
- package/lib/cjs/components/addresses/AddressCountrySelector.js +1 -1
- package/lib/cjs/components/addresses/AddressField.d.ts +6 -0
- package/lib/cjs/components/addresses/AddressField.js +1 -1
- package/lib/cjs/components/addresses/AddressInput.d.ts +11 -0
- package/lib/cjs/components/addresses/AddressInput.js +1 -1
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +16 -0
- package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
- package/lib/cjs/components/addresses/AddressesContainer.d.ts +9 -2
- package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
- package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +2 -2
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +7 -2
- package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
- package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +7 -2
- package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +7 -2
- package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/cjs/components/auth/CommerceLayer.d.ts +9 -2
- package/lib/cjs/components/auth/CommerceLayer.js +1 -1
- package/lib/cjs/components/customers/CustomerAddressForm.d.ts +7 -2
- package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
- package/lib/cjs/components/customers/CustomerContainer.d.ts +2 -2
- package/lib/cjs/components/customers/CustomerInput.d.ts +12 -0
- package/lib/cjs/components/customers/CustomerInput.js +1 -1
- package/lib/cjs/components/customers/SaveCustomerButton.d.ts +3 -3
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +12 -2
- package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +8 -2
- package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +15 -0
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +9 -0
- package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +7 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +7 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +9 -0
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +10 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +9 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
- package/lib/cjs/components/line_items/LineItem.d.ts +9 -2
- package/lib/cjs/components/line_items/LineItem.js +1 -1
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +13 -0
- package/lib/cjs/components/line_items/LineItemAmount.js +1 -1
- package/lib/cjs/components/line_items/LineItemCode.d.ts +6 -0
- package/lib/cjs/components/line_items/LineItemCode.js +1 -1
- package/lib/cjs/components/line_items/LineItemImage.d.ts +7 -0
- package/lib/cjs/components/line_items/LineItemImage.js +1 -1
- package/lib/cjs/components/line_items/LineItemName.d.ts +6 -0
- package/lib/cjs/components/line_items/LineItemName.js +1 -1
- package/lib/cjs/components/line_items/LineItemOption.d.ts +11 -0
- package/lib/cjs/components/line_items/LineItemOption.js +1 -1
- package/lib/cjs/components/line_items/LineItemOptions.d.ts +5 -2
- package/lib/cjs/components/line_items/LineItemOptions.js +1 -1
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +12 -0
- package/lib/cjs/components/line_items/LineItemQuantity.js +1 -1
- package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +10 -0
- package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/cjs/components/line_items/LineItemsContainer.d.ts +15 -3
- package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +10 -0
- package/lib/cjs/components/line_items/LineItemsCount.js +1 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +11 -0
- package/lib/cjs/components/line_items/LineItemsEmpty.js +1 -1
- package/lib/cjs/components/orders/AddToCartButton.js +1 -1
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +2 -2
- package/lib/cjs/components/orders/AdjustmentAmount.js +1 -1
- package/lib/cjs/components/orders/CartLink.d.ts +2 -2
- package/lib/cjs/components/orders/DiscountAmount.d.ts +14 -0
- package/lib/cjs/components/orders/DiscountAmount.js +1 -1
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +11 -0
- package/lib/cjs/components/orders/GiftCardAmount.js +1 -1
- package/lib/cjs/components/orders/ItemContainer.d.ts +13 -2
- package/lib/cjs/components/orders/ItemContainer.js +1 -1
- package/lib/cjs/components/orders/OrderContainer.d.ts +16 -2
- package/lib/cjs/components/orders/OrderContainer.js +1 -1
- package/lib/cjs/components/orders/OrderList.d.ts +26 -21
- package/lib/cjs/components/orders/OrderList.js +1 -1
- package/lib/cjs/components/orders/OrderNumber.d.ts +6 -0
- package/lib/cjs/components/orders/OrderNumber.js +1 -1
- package/lib/cjs/components/orders/OrderStorage.d.ts +10 -2
- package/lib/cjs/components/orders/OrderStorage.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderButton.d.ts +12 -2
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +8 -2
- package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +6 -0
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/cjs/components/orders/ShippingAmount.d.ts +11 -0
- package/lib/cjs/components/orders/ShippingAmount.js +1 -1
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +14 -0
- package/lib/cjs/components/orders/SubTotalAmount.js +1 -1
- package/lib/cjs/components/orders/TaxesAmount.d.ts +14 -0
- package/lib/cjs/components/orders/TaxesAmount.js +1 -1
- package/lib/cjs/components/orders/TotalAmount.d.ts +14 -0
- package/lib/cjs/components/orders/TotalAmount.js +1 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/KlarnaGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +16 -10
- package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodAmount.d.ts +14 -0
- package/lib/cjs/components/payment_methods/PaymentMethodAmount.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +6 -0
- package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +12 -0
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +6 -0
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +8 -2
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/cjs/components/{payment_sources → payment_source}/AdyenPayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/AdyenPayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/BraintreePayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/BraintreePayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/CheckoutComPayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/CheckoutComPayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/KlarnaPayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/KlarnaPayment.js +0 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaymentSource.d.ts +9 -2
- package/lib/cjs/components/payment_source/PaymentSource.js +1 -0
- package/lib/cjs/components/{payment_sources → payment_source}/PaymentSourceBrandIcon.d.ts +10 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +1 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaymentSourceBrandName.d.ts +7 -0
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +1 -0
- package/lib/cjs/components/{payment_sources → payment_source}/PaymentSourceDetail.d.ts +6 -0
- package/lib/cjs/components/payment_source/PaymentSourceDetail.js +1 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaymentSourceEditButton.d.ts +9 -2
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +1 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/PaypalPayment.d.ts +2 -2
- package/lib/cjs/components/{payment_sources → payment_source}/PaypalPayment.js +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/StripePayment.d.ts +0 -0
- package/lib/cjs/components/{payment_sources → payment_source}/StripePayment.js +0 -0
- package/lib/{esm/components/payment_sources → cjs/components/payment_source}/WireTransferPayment.d.ts +2 -2
- package/lib/cjs/components/{payment_sources → payment_source}/WireTransferPayment.js +0 -0
- package/lib/cjs/components/prices/Price.d.ts +12 -0
- package/lib/cjs/components/prices/Price.js +1 -1
- package/lib/cjs/components/prices/PricesContainer.d.ts +18 -2
- package/lib/cjs/components/prices/PricesContainer.js +1 -1
- package/lib/cjs/components/shipments/Shipment.d.ts +8 -2
- package/lib/cjs/components/shipments/Shipment.js +1 -1
- package/lib/cjs/components/shipments/ShipmentField.d.ts +7 -0
- package/lib/cjs/components/shipments/ShipmentField.js +1 -1
- package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +8 -2
- package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +9 -2
- package/lib/cjs/components/shipping_methods/ShippingMethod.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +6 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodName.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +12 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +6 -0
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/cjs/components/skus/AvailabilityContainer.d.ts +9 -2
- package/lib/cjs/components/skus/AvailabilityContainer.js +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +9 -0
- package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +7 -0
- package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
- package/lib/cjs/components/skus/QuantitySelector.d.ts +14 -0
- package/lib/cjs/components/skus/QuantitySelector.js +1 -1
- package/lib/cjs/components/skus/SkuField.d.ts +6 -2
- package/lib/cjs/components/skus/SkuField.js +1 -1
- package/lib/cjs/components/skus/SkuList.d.ts +9 -2
- package/lib/cjs/components/skus/SkuList.js +1 -1
- package/lib/cjs/components/skus/SkuListsContainer.d.ts +8 -2
- package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
- package/lib/cjs/components/skus/SkuOption.d.ts +9 -2
- package/lib/cjs/components/skus/SkuOption.js +1 -1
- package/lib/cjs/components/skus/SkuOptionInput.d.ts +10 -0
- package/lib/cjs/components/skus/SkuOptionInput.js +1 -1
- package/lib/cjs/components/skus/SkuOptionsContainer.d.ts +9 -2
- package/lib/cjs/components/skus/SkuOptionsContainer.js +1 -1
- package/lib/cjs/components/skus/Skus.d.ts +7 -2
- package/lib/cjs/components/skus/Skus.js +1 -1
- package/lib/cjs/components/skus/SkusContainer.d.ts +11 -2
- package/lib/cjs/components/skus/VariantSelector.d.ts +25 -2
- package/lib/cjs/components/skus/VariantSelector.js +1 -1
- package/lib/cjs/components/skus/VariantsContainer.d.ts +14 -2
- package/lib/cjs/components/skus/VariantsContainer.js +1 -1
- package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +8 -2
- package/lib/cjs/components/stock_transfers/StockTransfer.js +1 -1
- package/lib/cjs/components/utils/PriceTemplate.js +1 -1
- package/lib/cjs/components/utils/VariantTemplate.d.ts +21 -2
- package/lib/cjs/components/utils/VariantTemplate.js +1 -1
- package/lib/cjs/components/utils/getAllErrors.d.ts +1 -1
- package/lib/cjs/config/components.d.ts +934 -0
- package/lib/cjs/config/components.js +1 -0
- package/lib/cjs/index.d.ts +7 -7
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +6 -6
- package/lib/cjs/typings/index.d.ts +3 -3
- package/lib/cjs/utils/childrenTypes.d.ts +9 -0
- package/lib/cjs/utils/childrenTypes.js +1 -0
- package/lib/cjs/utils/getCardDetails.js +1 -1
- package/lib/cjs/utils/getPrices.d.ts +2 -2
- package/lib/cjs/utils/paypalPayment.d.ts +1 -1
- package/lib/cjs/utils/validateFormFields.js +1 -1
- package/lib/esm/components/ExternalFunction.d.ts +9 -2
- package/lib/esm/components/ExternalFunction.js +1 -1
- package/lib/esm/components/MetadataInput.d.ts +10 -0
- package/lib/esm/components/MetadataInput.js +1 -1
- package/lib/esm/components/SubmitButton.d.ts +12 -2
- package/lib/esm/components/SubmitButton.js +1 -1
- package/lib/esm/components/addresses/Address.d.ts +7 -2
- package/lib/esm/components/addresses/Address.js +1 -1
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +16 -0
- package/lib/esm/components/addresses/AddressCountrySelector.js +1 -1
- package/lib/esm/components/addresses/AddressField.d.ts +6 -0
- package/lib/esm/components/addresses/AddressField.js +1 -1
- package/lib/esm/components/addresses/AddressInput.d.ts +11 -0
- package/lib/esm/components/addresses/AddressInput.js +1 -1
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +16 -0
- package/lib/esm/components/addresses/AddressStateSelector.js +1 -1
- package/lib/esm/components/addresses/AddressesContainer.d.ts +9 -2
- package/lib/esm/components/addresses/AddressesContainer.js +1 -1
- package/lib/esm/components/addresses/BillingAddressContainer.d.ts +2 -2
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +7 -2
- package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
- package/lib/esm/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +7 -2
- package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -1
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +7 -2
- package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/esm/components/auth/CommerceLayer.d.ts +9 -2
- package/lib/esm/components/auth/CommerceLayer.js +1 -1
- package/lib/esm/components/customers/CustomerAddressForm.d.ts +7 -2
- package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerContainer.d.ts +2 -2
- package/lib/esm/components/customers/CustomerInput.d.ts +12 -0
- package/lib/esm/components/customers/CustomerInput.js +1 -1
- package/lib/esm/components/customers/SaveCustomerButton.d.ts +3 -3
- package/lib/esm/components/gift_cards/GiftCard.d.ts +12 -2
- package/lib/esm/components/gift_cards/GiftCard.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +8 -2
- package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +15 -0
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +9 -0
- package/lib/esm/components/gift_cards/GiftCardInput.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +7 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +7 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +9 -0
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +10 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +9 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
- package/lib/esm/components/line_items/LineItem.d.ts +9 -2
- package/lib/esm/components/line_items/LineItem.js +1 -1
- package/lib/esm/components/line_items/LineItemAmount.d.ts +13 -0
- package/lib/esm/components/line_items/LineItemAmount.js +1 -1
- package/lib/esm/components/line_items/LineItemCode.d.ts +6 -0
- package/lib/esm/components/line_items/LineItemCode.js +1 -1
- package/lib/esm/components/line_items/LineItemImage.d.ts +7 -0
- package/lib/esm/components/line_items/LineItemImage.js +1 -1
- package/lib/esm/components/line_items/LineItemName.d.ts +6 -0
- package/lib/esm/components/line_items/LineItemName.js +1 -1
- package/lib/esm/components/line_items/LineItemOption.d.ts +11 -0
- package/lib/esm/components/line_items/LineItemOption.js +1 -1
- package/lib/esm/components/line_items/LineItemOptions.d.ts +5 -2
- package/lib/esm/components/line_items/LineItemOptions.js +1 -1
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +12 -0
- package/lib/esm/components/line_items/LineItemQuantity.js +1 -1
- package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +10 -0
- package/lib/esm/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/esm/components/line_items/LineItemsContainer.d.ts +15 -3
- package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
- package/lib/esm/components/line_items/LineItemsCount.d.ts +10 -0
- package/lib/esm/components/line_items/LineItemsCount.js +1 -1
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +11 -0
- package/lib/esm/components/line_items/LineItemsEmpty.js +1 -1
- package/lib/esm/components/orders/AddToCartButton.js +1 -1
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +2 -2
- package/lib/esm/components/orders/AdjustmentAmount.js +1 -1
- package/lib/esm/components/orders/CartLink.d.ts +2 -2
- package/lib/esm/components/orders/DiscountAmount.d.ts +14 -0
- package/lib/esm/components/orders/DiscountAmount.js +1 -1
- package/lib/esm/components/orders/GiftCardAmount.d.ts +11 -0
- package/lib/esm/components/orders/GiftCardAmount.js +1 -1
- package/lib/esm/components/orders/ItemContainer.d.ts +13 -2
- package/lib/esm/components/orders/ItemContainer.js +1 -1
- package/lib/esm/components/orders/OrderContainer.d.ts +16 -2
- package/lib/esm/components/orders/OrderContainer.js +1 -1
- package/lib/esm/components/orders/OrderList.d.ts +26 -21
- package/lib/esm/components/orders/OrderList.js +1 -1
- package/lib/esm/components/orders/OrderNumber.d.ts +6 -0
- package/lib/esm/components/orders/OrderNumber.js +1 -1
- package/lib/esm/components/orders/OrderStorage.d.ts +10 -2
- package/lib/esm/components/orders/OrderStorage.js +1 -1
- package/lib/esm/components/orders/PlaceOrderButton.d.ts +12 -2
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/orders/PlaceOrderContainer.d.ts +8 -2
- package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +6 -0
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/esm/components/orders/ShippingAmount.d.ts +11 -0
- package/lib/esm/components/orders/ShippingAmount.js +1 -1
- package/lib/esm/components/orders/SubTotalAmount.d.ts +14 -0
- package/lib/esm/components/orders/SubTotalAmount.js +1 -1
- package/lib/esm/components/orders/TaxesAmount.d.ts +14 -0
- package/lib/esm/components/orders/TaxesAmount.js +1 -1
- package/lib/esm/components/orders/TotalAmount.d.ts +14 -0
- package/lib/esm/components/orders/TotalAmount.js +1 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/CheckoutComGateway.js +1 -1
- package/lib/esm/components/payment_gateways/KlarnaGateway.js +1 -1
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/esm/components/payment_gateways/StripeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +16 -10
- package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodAmount.d.ts +14 -0
- package/lib/esm/components/payment_methods/PaymentMethodAmount.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +6 -0
- package/lib/esm/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +12 -0
- package/lib/esm/components/payment_methods/PaymentMethodPrice.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +6 -0
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +8 -2
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/esm/components/{payment_sources → payment_source}/AdyenPayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/AdyenPayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/BraintreePayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/BraintreePayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/CheckoutComPayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/CheckoutComPayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/KlarnaPayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/KlarnaPayment.js +0 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaymentSource.d.ts +9 -2
- package/lib/esm/components/payment_source/PaymentSource.js +1 -0
- package/lib/esm/components/{payment_sources → payment_source}/PaymentSourceBrandIcon.d.ts +10 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.js +1 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaymentSourceBrandName.d.ts +7 -0
- package/lib/esm/components/payment_source/PaymentSourceBrandName.js +1 -0
- package/lib/esm/components/{payment_sources → payment_source}/PaymentSourceDetail.d.ts +6 -0
- package/lib/esm/components/payment_source/PaymentSourceDetail.js +1 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaymentSourceEditButton.d.ts +9 -2
- package/lib/esm/components/payment_source/PaymentSourceEditButton.js +1 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/PaypalPayment.d.ts +2 -2
- package/lib/esm/components/{payment_sources → payment_source}/PaypalPayment.js +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/StripePayment.d.ts +0 -0
- package/lib/esm/components/{payment_sources → payment_source}/StripePayment.js +0 -0
- package/lib/{cjs/components/payment_sources → esm/components/payment_source}/WireTransferPayment.d.ts +2 -2
- package/lib/esm/components/{payment_sources → payment_source}/WireTransferPayment.js +0 -0
- package/lib/esm/components/prices/Price.d.ts +12 -0
- package/lib/esm/components/prices/Price.js +1 -1
- package/lib/esm/components/prices/PricesContainer.d.ts +18 -2
- package/lib/esm/components/prices/PricesContainer.js +1 -1
- package/lib/esm/components/shipments/Shipment.d.ts +8 -2
- package/lib/esm/components/shipments/Shipment.js +1 -1
- package/lib/esm/components/shipments/ShipmentField.d.ts +7 -0
- package/lib/esm/components/shipments/ShipmentField.js +1 -1
- package/lib/esm/components/shipments/ShipmentsContainer.d.ts +8 -2
- package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +9 -2
- package/lib/esm/components/shipping_methods/ShippingMethod.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +6 -0
- package/lib/esm/components/shipping_methods/ShippingMethodName.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +12 -0
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +6 -0
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/esm/components/skus/AvailabilityContainer.d.ts +9 -2
- package/lib/esm/components/skus/AvailabilityContainer.js +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +9 -0
- package/lib/esm/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/esm/components/skus/DeliveryLeadTime.d.ts +7 -0
- package/lib/esm/components/skus/DeliveryLeadTime.js +1 -1
- package/lib/esm/components/skus/QuantitySelector.d.ts +14 -0
- package/lib/esm/components/skus/QuantitySelector.js +1 -1
- package/lib/esm/components/skus/SkuField.d.ts +6 -2
- package/lib/esm/components/skus/SkuField.js +1 -1
- package/lib/esm/components/skus/SkuList.d.ts +9 -2
- package/lib/esm/components/skus/SkuList.js +1 -1
- package/lib/esm/components/skus/SkuListsContainer.d.ts +8 -2
- package/lib/esm/components/skus/SkuListsContainer.js +1 -1
- package/lib/esm/components/skus/SkuOption.d.ts +9 -2
- package/lib/esm/components/skus/SkuOption.js +1 -1
- package/lib/esm/components/skus/SkuOptionInput.d.ts +10 -0
- package/lib/esm/components/skus/SkuOptionInput.js +1 -1
- package/lib/esm/components/skus/SkuOptionsContainer.d.ts +9 -2
- package/lib/esm/components/skus/SkuOptionsContainer.js +1 -1
- package/lib/esm/components/skus/Skus.d.ts +7 -2
- package/lib/esm/components/skus/Skus.js +1 -1
- package/lib/esm/components/skus/SkusContainer.d.ts +11 -2
- package/lib/esm/components/skus/VariantSelector.d.ts +25 -2
- package/lib/esm/components/skus/VariantSelector.js +1 -1
- package/lib/esm/components/skus/VariantsContainer.d.ts +14 -2
- package/lib/esm/components/skus/VariantsContainer.js +1 -1
- package/lib/esm/components/stock_transfers/StockTransfer.d.ts +8 -2
- package/lib/esm/components/stock_transfers/StockTransfer.js +1 -1
- package/lib/esm/components/utils/PriceTemplate.js +1 -1
- package/lib/esm/components/utils/VariantTemplate.d.ts +21 -2
- package/lib/esm/components/utils/VariantTemplate.js +1 -1
- package/lib/esm/components/utils/getAllErrors.d.ts +1 -1
- package/lib/esm/config/components.d.ts +934 -0
- package/lib/esm/config/components.js +1 -0
- package/lib/esm/index.d.ts +7 -7
- package/lib/esm/index.js +1 -1
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +6 -6
- package/lib/esm/typings/index.d.ts +3 -3
- package/lib/esm/utils/childrenTypes.d.ts +9 -0
- package/lib/esm/utils/childrenTypes.js +1 -0
- package/lib/esm/utils/getCardDetails.js +1 -1
- package/lib/esm/utils/getPrices.d.ts +2 -2
- package/lib/esm/utils/paypalPayment.d.ts +1 -1
- package/lib/esm/utils/validateFormFields.js +1 -1
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +26 -26
- package/lib/cjs/components/payment_sources/PaymentSource.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceBrandIcon.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceBrandName.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceDetail.js +0 -1
- package/lib/cjs/components/payment_sources/PaymentSourceEditButton.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSource.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceBrandIcon.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceBrandName.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceDetail.js +0 -1
- package/lib/esm/components/payment_sources/PaymentSourceEditButton.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import LineItemContext from"../../context/LineItemContext";import Parent from"../utils/Parent";export function LineItemQuantity(props){const{max=50,readonly=!1,...p}=props,{lineItem}=useContext(LineItemChildrenContext),{updateLineItem}=useContext(LineItemContext),options=[];for(let i=1;i<=max;i++)options.push(_jsx("option",{value:`${i}`,children:i},i));const handleChange=e=>{const quantity2=Number(e.target.value);updateLineItem&&lineItem&&updateLineItem(lineItem.id,quantity2)},quantity=lineItem?.quantity,parentProps={handleChange,quantity,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):readonly?_jsx("span",{...p,children:quantity}):_jsx("select",{title:lineItem?.name,value:quantity,onChange:handleChange,...p,children:options})}export default LineItemQuantity;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import LineItemContext from"../../context/LineItemContext";import Parent from"../utils/Parent";import components from"../../config/components";const propTypes=components.LineItemQuantity.propTypes,defaultProps=components.LineItemQuantity.defaultProps,displayName=components.LineItemQuantity.displayName;export function LineItemQuantity(props){const{max=50,readonly=!1,...p}=props,{lineItem}=useContext(LineItemChildrenContext),{updateLineItem}=useContext(LineItemContext),options=[];for(let i=1;i<=max;i++)options.push(_jsx("option",{value:`${i}`,children:i},i));const handleChange=e=>{const quantity2=Number(e.target.value);updateLineItem&&lineItem&&updateLineItem(lineItem.id,quantity2)},quantity=lineItem?.quantity,parentProps={handleChange,quantity,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):readonly?_jsx("span",{...p,children:quantity}):_jsx("select",{title:lineItem?.name,value:quantity,onChange:handleChange,...p,children:options})}LineItemQuantity.propTypes=propTypes,LineItemQuantity.defaultProps=defaultProps,LineItemQuantity.displayName=displayName;export default LineItemQuantity;
|
|
@@ -9,4 +9,14 @@ declare type Props = {
|
|
|
9
9
|
label?: string;
|
|
10
10
|
} & PropsWithoutRef<JSX.IntrinsicElements['a']>;
|
|
11
11
|
export declare function LineItemRemoveLink(props: Props): JSX.Element;
|
|
12
|
+
export declare namespace LineItemRemoveLink {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
label: import("prop-types").Requireable<string>;
|
|
16
|
+
};
|
|
17
|
+
var defaultProps: {
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
12
22
|
export default LineItemRemoveLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import LineItemContext from"../../context/LineItemContext";import Parent from"../utils/Parent";export function LineItemRemoveLink(props){const{label="Remove"}=props,{lineItem}=useContext(LineItemChildrenContext),{deleteLineItem}=useContext(LineItemContext),handleRemove=e=>{e.preventDefault(),deleteLineItem&&lineItem&&deleteLineItem(lineItem.id)},parentProps={handleRemove,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("a",{...props,href:"#",onClick:handleRemove,children:label})}export default LineItemRemoveLink;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import LineItemContext from"../../context/LineItemContext";import Parent from"../utils/Parent";import components from"../../config/components";const propTypes=components.LineItemRemoveLink.propTypes,defaultProps=components.LineItemRemoveLink.defaultProps,displayName=components.LineItemRemoveLink.displayName;export function LineItemRemoveLink(props){const{label="Remove"}=props,{lineItem}=useContext(LineItemChildrenContext),{deleteLineItem}=useContext(LineItemContext),handleRemove=e=>{e.preventDefault(),deleteLineItem&&lineItem&&deleteLineItem(lineItem.id)},parentProps={handleRemove,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("a",{...props,href:"#",onClick:handleRemove,children:label})}LineItemRemoveLink.propTypes=propTypes,LineItemRemoveLink.defaultProps=defaultProps,LineItemRemoveLink.displayName=displayName;export default LineItemRemoveLink;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
filters?: Record<string, any>;
|
|
5
|
-
loader?:
|
|
5
|
+
loader?: ReactNode;
|
|
6
6
|
};
|
|
7
7
|
export declare function LineItemsContainer(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace LineItemsContainer {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
+
filters: import("prop-types").Requireable<object>;
|
|
12
|
+
loader: import("prop-types").Requireable<NonNullable<string | import("prop-types").ReactElementLike | null | undefined>>;
|
|
13
|
+
};
|
|
14
|
+
var defaultProps: {
|
|
15
|
+
filters: {};
|
|
16
|
+
loader: string;
|
|
17
|
+
};
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
8
20
|
export default LineItemsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import lineItemReducer,{lineItemInitialState,updateLineItem,deleteLineItem}from"../../reducers/LineItemReducer";import OrderContext from"../../context/OrderContext";import LineItemContext from"../../context/LineItemContext";import CommerceLayerContext from"../../context/CommerceLayerContext";export function LineItemsContainer(props){const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(lineItemReducer,lineItemInitialState);useEffect(()=>{include?.includes("line_items.line_item_options.sku_option")?includeLoaded?.["line_items.line_item_options.sku_option"]||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),include?.includes("line_items.item")?includeLoaded?.["line_items.item"]||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]})},[include,includeLoaded]),useEffect(()=>{order?.line_items&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}})},[order?.line_items]);const lineItemValue={...state,loader,updateLineItem:(lineItemId,quantity=1)=>updateLineItem({lineItemId,quantity,dispatch,config,getOrder,orderId,errors:state.errors}),deleteLineItem:lineItemId=>deleteLineItem({lineItemId,dispatch,config,getOrder,orderId,errors:state.errors})};return _jsx(LineItemContext.Provider,{value:lineItemValue,children:state.loading?loader:children})}export default LineItemsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import lineItemReducer,{lineItemInitialState,updateLineItem,deleteLineItem}from"../../reducers/LineItemReducer";import OrderContext from"../../context/OrderContext";import LineItemContext from"../../context/LineItemContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import components from"../../config/components";const propTypes=components.LineItemsContainer.propTypes,defaultProps=components.LineItemsContainer.defaultProps,displayName=components.LineItemsContainer.displayName;export function LineItemsContainer(props){const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(lineItemReducer,lineItemInitialState);useEffect(()=>{include?.includes("line_items.line_item_options.sku_option")?includeLoaded?.["line_items.line_item_options.sku_option"]||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),include?.includes("line_items.item")?includeLoaded?.["line_items.item"]||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]})},[include,includeLoaded]),useEffect(()=>{order?.line_items&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}})},[order?.line_items]);const lineItemValue={...state,loader,updateLineItem:(lineItemId,quantity=1)=>updateLineItem({lineItemId,quantity,dispatch,config,getOrder,orderId,errors:state.errors}),deleteLineItem:lineItemId=>deleteLineItem({lineItemId,dispatch,config,getOrder,orderId,errors:state.errors})};return _jsx(LineItemContext.Provider,{value:lineItemValue,children:state.loading?loader:children})}LineItemsContainer.propTypes=propTypes,LineItemsContainer.defaultProps=defaultProps,LineItemsContainer.displayName=displayName;export default LineItemsContainer;
|
|
@@ -9,4 +9,14 @@ declare type Props = {
|
|
|
9
9
|
typeAccepted?: TypeAccepted[];
|
|
10
10
|
} & JSX.IntrinsicElements['span'];
|
|
11
11
|
export declare function LineItemsCount(props: Props): JSX.Element;
|
|
12
|
+
export declare namespace LineItemsCount {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
id: import("prop-types").Requireable<string>;
|
|
16
|
+
className: import("prop-types").Requireable<string>;
|
|
17
|
+
name: import("prop-types").Requireable<string>;
|
|
18
|
+
style: import("prop-types").Requireable<object>;
|
|
19
|
+
};
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
12
22
|
export default LineItemsCount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"../utils/Parent";import getLineItemsCount from"../../utils/getLineItemsCount";import LineItemContext from"../../context/LineItemContext";export function LineItemsCount(props){const{children,typeAccepted,...p}=props,{lineItems}=useContext(LineItemContext),[quantity,setQuantity]=useState(0);useEffect(()=>{if(lineItems&&lineItems.length>0){const qty=getLineItemsCount({lineItems:lineItems||[],typeAccepted});setQuantity(qty)}return()=>{setQuantity(0)}},[lineItems,typeAccepted]);const parentProps={quantity,typeAccepted,...p};return children?_jsx(Parent,{...parentProps,children}):_jsx("span",{...p,children:quantity})}export default LineItemsCount;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"../utils/Parent";import getLineItemsCount from"../../utils/getLineItemsCount";import LineItemContext from"../../context/LineItemContext";import components from"../../config/components";const propTypes=components.LineItemsCount.propTypes,displayName=components.LineItemsCount.displayName;export function LineItemsCount(props){const{children,typeAccepted,...p}=props,{lineItems}=useContext(LineItemContext),[quantity,setQuantity]=useState(0);useEffect(()=>{if(lineItems&&lineItems.length>0){const qty=getLineItemsCount({lineItems:lineItems||[],typeAccepted});setQuantity(qty)}return()=>{setQuantity(0)}},[lineItems,typeAccepted]);const parentProps={quantity,typeAccepted,...p};return children?_jsx(Parent,{...parentProps,children}):_jsx("span",{...p,children:quantity})}LineItemsCount.propTypes=propTypes,LineItemsCount.displayName=displayName;export default LineItemsCount;
|
|
@@ -9,4 +9,15 @@ declare type LineItemsCountProps = {
|
|
|
9
9
|
text?: string;
|
|
10
10
|
} & JSX.IntrinsicElements['span'];
|
|
11
11
|
export declare function LineItemsEmpty(props: LineItemsCountProps): JSX.Element | null;
|
|
12
|
+
export declare namespace LineItemsEmpty {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
id: import("prop-types").Requireable<string>;
|
|
16
|
+
className: import("prop-types").Requireable<string>;
|
|
17
|
+
name: import("prop-types").Requireable<string>;
|
|
18
|
+
style: import("prop-types").Requireable<object>;
|
|
19
|
+
text: import("prop-types").Requireable<string>;
|
|
20
|
+
};
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
12
23
|
export default LineItemsEmpty;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"../utils/Parent";import getLineItemsCount from"../../utils/getLineItemsCount";import LineItemContext from"../../context/LineItemContext";export function LineItemsEmpty(props){const{children,text="Your shopping bag is empty",...p}=props,{lineItems}=useContext(LineItemContext),[quantity,setQuantity]=useState(),emptyText=quantity===0?_jsx("span",{...p,children:text}):null;useEffect(()=>{if(lineItems)if(lineItems.length>0){const qty=getLineItemsCount({lineItems:lineItems||[]});setQuantity(qty)}else setQuantity(0);return()=>{setQuantity(void 0)}},[lineItems]);const parentProps={quantity,text,...p};return children?_jsx(Parent,{...parentProps,children}):emptyText}export default LineItemsEmpty;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"../utils/Parent";import getLineItemsCount from"../../utils/getLineItemsCount";import LineItemContext from"../../context/LineItemContext";import components from"../../config/components";const propTypes=components.LineItemsEmpty.propTypes,displayName=components.LineItemsEmpty.displayName;export function LineItemsEmpty(props){const{children,text="Your shopping bag is empty",...p}=props,{lineItems}=useContext(LineItemContext),[quantity,setQuantity]=useState(),emptyText=quantity===0?_jsx("span",{...p,children:text}):null;useEffect(()=>{if(lineItems)if(lineItems.length>0){const qty=getLineItemsCount({lineItems:lineItems||[]});setQuantity(qty)}else setQuantity(0);return()=>{setQuantity(void 0)}},[lineItems]);const parentProps={quantity,text,...p};return children?_jsx(Parent,{...parentProps,children}):emptyText}LineItemsEmpty.propTypes=propTypes,LineItemsEmpty.displayName=displayName;export default LineItemsEmpty;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import isEmpty from"lodash/isEmpty";import has from"lodash/has";import ItemContext from"../../context/ItemContext";import getCurrentItemKey from"../../utils/getCurrentItemKey";import SkuListsContext from"../../context/SkuListsContext";import ExternalFunctionContext from"../../context/ExternalFunctionContext";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import isEmpty from"lodash/isEmpty";import has from"lodash/has";import ItemContext from"../../context/ItemContext";import getCurrentItemKey from"../../utils/getCurrentItemKey";import SkuListsContext from"../../context/SkuListsContext";import ExternalFunctionContext from"../../context/ExternalFunctionContext";import SkuChildrenContext from"../../context/SkuChildrenContext";import getCartLink from"../../utils/getCartLink";import CommerceLayerContext from"../../context/CommerceLayerContext";export function AddToCartButton(props){const{label="Add to cart",children,skuCode,bundleCode,disabled,skuListId,lineItem,buyNowMode=!1,checkoutUrl,redirectToHostedCart,hostedCartUrl,...p}=props,{accessToken,endpoint}=useContext(CommerceLayerContext),{addToCart,orderId,getOrder,setOrderErrors}=useContext(OrderContext),{url,callExternalFunction}=useContext(ExternalFunctionContext),{item,items,quantity,option,prices,lineItems,lineItem:lineItemContext,skuCode:itemSkuCode}=useContext(ItemContext),{skuLists}=useContext(SkuListsContext),{sku}=useContext(SkuChildrenContext),[slug]=endpoint?endpoint.split(".commercelayer"):[""],sCode=!isEmpty(items)&&skuCode?items[skuCode]?.code:sku?.code||skuCode||getCurrentItemKey(item)||itemSkuCode,availabilityQuantity=item[sCode]?.inventory?.quantity,handleClick=async()=>{const qty=quantity[sCode],opt=option[sCode],customLineItem=isEmpty(lineItem||lineItemContext)?lineItems[sCode]:lineItem||lineItemContext;if(!isEmpty(skuLists)&&skuListId&&url){const slQty=quantity[skuListId]||1;if(has(skuLists,skuListId)){const lineItems2=skuLists&&skuLists[skuListId].map(skuCode2=>({skuCode:skuCode2,quantity:slQty,_update_quantity:1}));return callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems:lineItems2}]}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}}if(!url&&addToCart){const res=await addToCart({bundleCode,skuCode:sCode,skuId:item[sCode]?.id,quantity:qty,option:opt,lineItem:customLineItem,buyNowMode,checkoutUrl});if(redirectToHostedCart){const orderId2=res.orderId;hostedCartUrl?location.href=`https://${hostedCartUrl}/${orderId2}?accessToken=${accessToken}`:orderId2&&slug&&(location.href=getCartLink({orderId:orderId2,slug,accessToken}))}return res}else if(url)return callExternalFunction({url,data:{bundleCode,skuCode:sCode,skuId:item[sCode]?.id,quantity:qty,option:opt,lineItem:customLineItem,buyNowMode,checkoutUrl}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))},autoDisabled=!isEmpty(skuLists)||skuListId?!1:disabled||!prices[sCode]||!sCode||availabilityQuantity===0,parentProps={handleClick,disabled:disabled||autoDisabled,label,...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{...p,disabled:autoDisabled,onClick:handleClick,children:label})}export default AddToCartButton;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
|
-
|
|
3
|
+
declare const AdjustmentAmount: FunctionComponent<BaseAmountComponent>;
|
|
4
4
|
export default AdjustmentAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";const AdjustmentAmount=props=>_jsx(BaseOrderPrice,{base:"amount",type:"adjustment",...props});export default AdjustmentAmount;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from 'react';
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../../typings/index';
|
|
3
3
|
declare type TChildren = FunctionChildren<Omit<Props, 'children'> & {
|
|
4
4
|
href: string;
|
|
@@ -6,7 +6,7 @@ declare type TChildren = FunctionChildren<Omit<Props, 'children'> & {
|
|
|
6
6
|
}>;
|
|
7
7
|
declare type Props = {
|
|
8
8
|
children?: TChildren;
|
|
9
|
-
label?: string |
|
|
9
|
+
label?: string | ReactNode;
|
|
10
10
|
} & JSX.IntrinsicElements['a'];
|
|
11
11
|
export declare function CartLink(props: Props): JSX.Element | null;
|
|
12
12
|
export default CartLink;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
3
|
export declare function DiscountAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
+
export declare namespace DiscountAmount {
|
|
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 DiscountAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";export function DiscountAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"discount",...props})}export default DiscountAmount;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";import components from"../../config/components";const propTypes=components.DiscountAmount.propTypes,defaultProps=components.DiscountAmount.defaultProps,displayName=components.DiscountAmount.displayName;export function DiscountAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"discount",...props})}DiscountAmount.propTypes=propTypes,DiscountAmount.defaultProps=defaultProps,DiscountAmount.displayName=displayName;export default DiscountAmount;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
3
|
export declare function GiftCardAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
+
export declare namespace GiftCardAmount {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
id: import("prop-types").Requireable<string>;
|
|
7
|
+
className: import("prop-types").Requireable<string>;
|
|
8
|
+
style: import("prop-types").Requireable<object>;
|
|
9
|
+
name: import("prop-types").Requireable<string>;
|
|
10
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
11
|
+
format: import("prop-types").Requireable<import("../../typings/index").BaseFormatPrice>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
4
15
|
export default GiftCardAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";export function GiftCardAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"gift_card",...props})}export default GiftCardAmount;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";import components from"../../config/components";const propTypes=components.GiftCardAmount.propTypes,displayName=components.GiftCardAmount.displayName;export function GiftCardAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"gift_card",...props})}GiftCardAmount.propTypes=propTypes,GiftCardAmount.displayName=displayName;export default GiftCardAmount;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
skuCode?: string | null;
|
|
5
5
|
lineItem?: {
|
|
6
6
|
name: string;
|
|
@@ -8,4 +8,15 @@ declare type Props = {
|
|
|
8
8
|
} | null;
|
|
9
9
|
};
|
|
10
10
|
export declare function ItemContainer(props: Props): JSX.Element;
|
|
11
|
+
export declare namespace ItemContainer {
|
|
12
|
+
var propTypes: {
|
|
13
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
14
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
15
|
+
lineItem: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
16
|
+
name: import("prop-types").Validator<string>;
|
|
17
|
+
imageUrl: import("prop-types").Requireable<string>;
|
|
18
|
+
}>>;
|
|
19
|
+
};
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
11
22
|
export default ItemContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useEffect}from"react";import ItemContext,{initialItemContext}from"../../context/ItemContext";import itemReducer,{itemInitialState,setItemState}from"../../reducers/ItemReducer";export function ItemContainer(props){const{children,skuCode,lineItem}=props,[state,dispatch]=useReducer(itemReducer,itemInitialState);useEffect(()=>{const code=skuCode;code&&setItemState(code,{type:"setSkuCode",key:"skuCode"},dispatch),lineItem&&setItemState(lineItem,{type:"setCustomLineItem",key:"lineItem"},dispatch)},[]);const itemValue={...initialItemContext,...state,setItems:items=>setItemState(items,{type:"setItems",key:"items"},dispatch),setItem:item=>setItemState(item,{type:"setItem",key:"item"},dispatch),setQuantity:item=>setItemState(item,{type:"setQuantity",key:"quantity"},dispatch),setOption:item=>setItemState(item,{type:"setOption",key:"option"},dispatch),setPrices:item=>setItemState(item,{type:"setPrices",key:"prices"},dispatch),setCustomLineItems:item=>setItemState(item,{type:"setCustomLineItems",key:"lineItems"},dispatch),setSkuCode:code=>setItemState(code,{type:"setSkuCode",key:"skuCode"},dispatch)};return _jsx(ItemContext.Provider,{value:itemValue,children})}export default ItemContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useEffect}from"react";import ItemContext,{initialItemContext}from"../../context/ItemContext";import itemReducer,{itemInitialState,setItemState}from"../../reducers/ItemReducer";import components from"../../config/components";const propTypes=components.ItemContainer.propTypes,displayName=components.ItemContainer.displayName;export function ItemContainer(props){const{children,skuCode,lineItem}=props,[state,dispatch]=useReducer(itemReducer,itemInitialState);useEffect(()=>{const code=skuCode;code&&setItemState(code,{type:"setSkuCode",key:"skuCode"},dispatch),lineItem&&setItemState(lineItem,{type:"setCustomLineItem",key:"lineItem"},dispatch)},[]);const itemValue={...initialItemContext,...state,setItems:items=>setItemState(items,{type:"setItems",key:"items"},dispatch),setItem:item=>setItemState(item,{type:"setItem",key:"item"},dispatch),setQuantity:item=>setItemState(item,{type:"setQuantity",key:"quantity"},dispatch),setOption:item=>setItemState(item,{type:"setOption",key:"option"},dispatch),setPrices:item=>setItemState(item,{type:"setPrices",key:"prices"},dispatch),setCustomLineItems:item=>setItemState(item,{type:"setCustomLineItems",key:"lineItems"},dispatch),setSkuCode:code=>setItemState(code,{type:"setSkuCode",key:"skuCode"},dispatch)};return _jsx(ItemContext.Provider,{value:itemValue,children})}ItemContainer.propTypes=propTypes,ItemContainer.displayName=displayName;export default ItemContainer;
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { BaseMetadataObject } from '../../typings/index';
|
|
3
3
|
import type { OrderCreate, Order } from '@commercelayer/sdk';
|
|
4
4
|
declare type Props = {
|
|
5
|
-
children:
|
|
5
|
+
children: ReactNode;
|
|
6
6
|
metadata?: BaseMetadataObject;
|
|
7
7
|
attributes?: OrderCreate;
|
|
8
8
|
orderId?: string;
|
|
9
9
|
fetchOrder?: (order: Order) => void;
|
|
10
10
|
};
|
|
11
11
|
export declare function OrderContainer(props: Props): JSX.Element;
|
|
12
|
+
export declare namespace OrderContainer {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
15
|
+
orderId: import("prop-types").Requireable<string>;
|
|
16
|
+
metadata: import("prop-types").Requireable<{
|
|
17
|
+
[x: string]: string | null | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
attributes: import("prop-types").Requireable<object>;
|
|
20
|
+
};
|
|
21
|
+
var defaultProps: {
|
|
22
|
+
metadata: {};
|
|
23
|
+
};
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
12
26
|
export default OrderContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext,useMemo,useState}from"react";import orderReducer,{createOrder,getApiOrder,setOrderErrors,setOrder,orderInitialState,updateOrder}from"../../reducers/OrderReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext,{defaultOrderContext}from"../../context/OrderContext";import OrderStorageContext from"../../context/OrderStorageContext";import compareObjAttribute from"../../utils/compareObjAttribute";export function OrderContainer(props){const{orderId,children,metadata,attributes,fetchOrder}=props,[state,dispatch]=useReducer(orderReducer,orderInitialState),[lock,setLock]=useState(!1),[lockOrder,setLockOrder]=useState(!0),config=useContext(CommerceLayerContext),{persistKey,clearWhenPlaced,getLocalOrder,setLocalOrder,deleteLocalOrder}=useContext(OrderStorageContext);useEffect(()=>{state.withoutIncludes||dispatch({type:"setLoading",payload:{loading:!0}})},[state.withoutIncludes]),useEffect(()=>{if(attributes&&state?.order&&!lock){const updateAttributes=compareObjAttribute({attributes,object:state.order});Object.keys(updateAttributes).length>0&&(updateOrder({id:state.order.id,attributes:updateAttributes,dispatch,config,include:state.include,state}),setLock(!0))}return()=>{if(attributes&&state?.order){const updateAttributes=compareObjAttribute({attributes,object:state.order});state.order&&Object.keys(updateAttributes).length===0&&setLock(!1)}}},[attributes,state?.order,lock]),useEffect(()=>{const localOrder=persistKey?getLocalOrder(persistKey):orderId,startRequest=Object.keys(state?.includeLoaded||{}).filter(key=>state?.includeLoaded?.[key]===!0),getOrder=async()=>{localOrder&&await getApiOrder({id:localOrder,dispatch,config,persistKey,clearWhenPlaced:!!(persistKey&&clearWhenPlaced),deleteLocalOrder,state})};return config.accessToken&&!state.loading?localOrder&&!state.order&&state.include?.length===startRequest.length&&!state.withoutIncludes&&!lockOrder?getOrder():state?.order?fetchOrder&&fetchOrder(state.order):state.withoutIncludes&&!state.include?.length&&startRequest.length===0&&getOrder():[config.accessToken,!state.order,state.loading,state.withoutIncludes].every(Boolean)?dispatch({type:"setLoading",payload:{loading:!1}}):[config.accessToken,!state.order,state.loading,!state.withoutIncludes].every(Boolean)&&dispatch({type:"setLoading",payload:{loading:!1}}),()=>{!state.order&&state.loading&&!state.withoutIncludes&&(state.include?.length===0&&startRequest.length>0?dispatch({type:"setLoading",payload:{loading:!1}}):state.include&&state.include?.length>0&&(dispatch({type:"setIncludesResource",payload:{include:[]}}),setLockOrder(!1)))}},[config.accessToken,state.includeLoaded,state.include,orderId,state.order,state.loading,state.withoutIncludes,lockOrder]);const orderValue=useMemo(()=>({...state,setOrder:order=>setOrder(order,dispatch),getOrder:id=>getApiOrder({id,dispatch,config,state}),setOrderErrors:errors=>setOrderErrors({dispatch,errors}),createOrder:()=>createOrder({persistKey,dispatch,config,state,orderMetadata:metadata,orderAttributes:attributes,setLocalOrder}),addToCart:values=>defaultOrderContext.addToCart({...values,persistKey,dispatch,state,config,errors:state.errors,orderMetadata:metadata||{},orderAttributes:attributes,setLocalOrder}),saveAddressToCustomerAddressBook:args=>defaultOrderContext.saveAddressToCustomerAddressBook({...args,dispatch}),setGiftCardOrCouponCode:({code,codeType})=>defaultOrderContext.setGiftCardOrCouponCode({code,codeType,dispatch,order:state.order,config,include:state.include,state}),removeGiftCardOrCouponCode:({codeType})=>defaultOrderContext.removeGiftCardOrCouponCode({codeType,dispatch,order:state.order,config,include:state.include,state}),addResourceToInclude:args=>defaultOrderContext.addResourceToInclude({...args,dispatch,resourcesIncluded:state.include,resourceIncludedLoaded:state.includeLoaded}),updateOrder:async args=>await defaultOrderContext.updateOrder({...args,dispatch,config,include:state.include,state})}),[state,config.accessToken]);return _jsx(OrderContext.Provider,{value:orderValue,children})}export default OrderContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext,useMemo,useState}from"react";import orderReducer,{createOrder,getApiOrder,setOrderErrors,setOrder,orderInitialState,updateOrder}from"../../reducers/OrderReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext,{defaultOrderContext}from"../../context/OrderContext";import components from"../../config/components";import OrderStorageContext from"../../context/OrderStorageContext";import compareObjAttribute from"../../utils/compareObjAttribute";const propTypes=components.OrderContainer.propTypes,defaultProps=components.OrderContainer.defaultProps,displayName=components.OrderContainer.displayName;export function OrderContainer(props){const{orderId,children,metadata,attributes,fetchOrder}=props,[state,dispatch]=useReducer(orderReducer,orderInitialState),[lock,setLock]=useState(!1),[lockOrder,setLockOrder]=useState(!0),config=useContext(CommerceLayerContext),{persistKey,clearWhenPlaced,getLocalOrder,setLocalOrder,deleteLocalOrder}=useContext(OrderStorageContext);useEffect(()=>{state.withoutIncludes||dispatch({type:"setLoading",payload:{loading:!0}})},[state.withoutIncludes]),useEffect(()=>{if(attributes&&state?.order&&!lock){const updateAttributes=compareObjAttribute({attributes,object:state.order});Object.keys(updateAttributes).length>0&&(updateOrder({id:state.order.id,attributes:updateAttributes,dispatch,config,include:state.include,state}),setLock(!0))}return()=>{if(attributes&&state?.order){const updateAttributes=compareObjAttribute({attributes,object:state.order});state.order&&Object.keys(updateAttributes).length===0&&setLock(!1)}}},[attributes,state?.order,lock]),useEffect(()=>{const localOrder=persistKey?getLocalOrder(persistKey):orderId,startRequest=Object.keys(state?.includeLoaded||{}).filter(key=>state?.includeLoaded?.[key]===!0),getOrder=async()=>{localOrder&&await getApiOrder({id:localOrder,dispatch,config,persistKey,clearWhenPlaced:!!(persistKey&&clearWhenPlaced),deleteLocalOrder,state})};return config.accessToken&&!state.loading?localOrder&&!state.order&&state.include?.length===startRequest.length&&!state.withoutIncludes&&!lockOrder?getOrder():state?.order?fetchOrder&&fetchOrder(state.order):state.withoutIncludes&&!state.include?.length&&startRequest.length===0&&getOrder():[config.accessToken,!state.order,state.loading,state.withoutIncludes].every(Boolean)?dispatch({type:"setLoading",payload:{loading:!1}}):[config.accessToken,!state.order,state.loading,!state.withoutIncludes].every(Boolean)&&dispatch({type:"setLoading",payload:{loading:!1}}),()=>{!state.order&&state.loading&&!state.withoutIncludes&&(state.include?.length===0&&startRequest.length>0?dispatch({type:"setLoading",payload:{loading:!1}}):state.include&&state.include?.length>0&&(dispatch({type:"setIncludesResource",payload:{include:[]}}),setLockOrder(!1)))}},[config.accessToken,state.includeLoaded,state.include,orderId,state.order,state.loading,state.withoutIncludes,lockOrder]);const orderValue=useMemo(()=>({...state,setOrder:order=>setOrder(order,dispatch),getOrder:id=>getApiOrder({id,dispatch,config,state}),setOrderErrors:errors=>setOrderErrors({dispatch,errors}),createOrder:()=>createOrder({persistKey,dispatch,config,state,orderMetadata:metadata,orderAttributes:attributes,setLocalOrder}),addToCart:values=>defaultOrderContext.addToCart({...values,persistKey,dispatch,state,config,errors:state.errors,orderMetadata:metadata||{},orderAttributes:attributes,setLocalOrder}),saveAddressToCustomerAddressBook:args=>defaultOrderContext.saveAddressToCustomerAddressBook({...args,dispatch}),setGiftCardOrCouponCode:({code,codeType})=>defaultOrderContext.setGiftCardOrCouponCode({code,codeType,dispatch,order:state.order,config,include:state.include,state}),removeGiftCardOrCouponCode:({codeType})=>defaultOrderContext.removeGiftCardOrCouponCode({codeType,dispatch,order:state.order,config,include:state.include,state}),addResourceToInclude:args=>defaultOrderContext.addResourceToInclude({...args,dispatch,resourcesIncluded:state.include,resourceIncludedLoaded:state.includeLoaded}),updateOrder:async args=>await defaultOrderContext.updateOrder({...args,dispatch,config,include:state.include,state})}),[state,config.accessToken]);return _jsx(OrderContext.Provider,{value:orderValue,children})}OrderContainer.propTypes=propTypes,OrderContainer.defaultProps=defaultProps,OrderContainer.displayName=displayName;export default OrderContainer;
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import { InitialOrderListContext } from '../../context/OrderListChildrenContext';
|
|
3
3
|
import { Column } from 'react-table';
|
|
4
|
-
declare type TConditional = {
|
|
5
|
-
/**
|
|
6
|
-
* Activate infinity scroll
|
|
7
|
-
*/
|
|
8
|
-
infiniteScroll: true;
|
|
9
|
-
/**
|
|
10
|
-
* The window options to use for the infinite scroll
|
|
11
|
-
*/
|
|
12
|
-
windowOptions?: {
|
|
13
|
-
height?: number;
|
|
14
|
-
itemSize?: number;
|
|
15
|
-
width?: number;
|
|
16
|
-
column?: number;
|
|
17
|
-
};
|
|
18
|
-
} | {
|
|
19
|
-
infiniteScroll?: false;
|
|
20
|
-
windowOptions?: never;
|
|
21
|
-
};
|
|
22
4
|
declare type Props = {
|
|
23
|
-
children:
|
|
5
|
+
children: ReactNode;
|
|
24
6
|
/**
|
|
25
7
|
* Columns to show
|
|
26
8
|
*/
|
|
@@ -51,6 +33,29 @@ declare type Props = {
|
|
|
51
33
|
* Class name to assign to the table row
|
|
52
34
|
*/
|
|
53
35
|
rowTrClassName?: string;
|
|
54
|
-
} &
|
|
36
|
+
} & JSX.IntrinsicElements['table'] & ({
|
|
37
|
+
/**
|
|
38
|
+
* Activate infinity scroll
|
|
39
|
+
*/
|
|
40
|
+
infiniteScroll: true;
|
|
41
|
+
/**
|
|
42
|
+
* The window options to use for the infinite scroll
|
|
43
|
+
*/
|
|
44
|
+
windowOptions?: {
|
|
45
|
+
height?: number;
|
|
46
|
+
itemSize?: number;
|
|
47
|
+
width?: number;
|
|
48
|
+
column?: number;
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
infiniteScroll?: false;
|
|
52
|
+
windowOptions?: never;
|
|
53
|
+
});
|
|
55
54
|
export declare function OrderList({ children, columns, loadingElement, showActions, actionsComponent, actionsContainerClassName, infiniteScroll, windowOptions, theadClassName, rowTrClassName, ...p }: Props): JSX.Element;
|
|
55
|
+
export declare namespace OrderList {
|
|
56
|
+
var propTypes: {
|
|
57
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
58
|
+
};
|
|
59
|
+
var displayName: string;
|
|
60
|
+
}
|
|
56
61
|
export default OrderList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as _createElement}from"react";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useMemo,useState,useEffect,useCallback}from"react";import CustomerContext from"../../context/CustomerContext";import OrderListChildrenContext from"../../context/OrderListChildrenContext";import{useTable,useSortBy,useBlockLayout}from"react-table";import{FixedSizeList}from"react-window";import scrollbarWidth from"../../utils/scrollbarWidth";import{sortDescIcon,sortAscIcon}from"../../utils/icons";export function OrderList({children,columns,loadingElement,showActions=!1,actionsComponent,actionsContainerClassName,infiniteScroll,windowOptions,theadClassName,rowTrClassName,...p}){const[loading,setLoading]=useState(!0),{orders}=useContext(CustomerContext),data=useMemo(()=>orders,[orders]),cols=useMemo(()=>columns,[columns]),tablePlugins=[useSortBy];infiniteScroll&&tablePlugins.push(useBlockLayout);const defaultColumn=useMemo(()=>({width:windowOptions?.column||150}),[windowOptions?.column]),table=useTable({data,columns:cols,...infiniteScroll&&{defaultColumn}},...tablePlugins),TableHtmlElement=infiniteScroll?"div":"table",TheadHtmlElement=infiniteScroll?"div":"thead",TbodyHtmlElement=infiniteScroll?"div":"tbody",ThHtmlElement=infiniteScroll?"div":"th",TrHtmlElement=infiniteScroll?"div":"tr";useEffect(()=>(orders&&orders.length>0&&setLoading(!1),()=>{setLoading(!0)}),[orders]);const scrollBarSize=infiniteScroll?useMemo(()=>scrollbarWidth(),[]):0,LoadingComponent=loadingElement||_jsx("div",{children:"Loading..."}),headerComponent=table.headerGroups.map((headerGroup,i)=>{const columns2=headerGroup.headers.map((column,k)=>_createElement(ThHtmlElement,{className:column?.className,...column.getHeaderProps(column?.getSortByToggleProps&&column?.getSortByToggleProps()),key:k},_jsxs("span",{className:column?.titleClassName,children:[column.render("Header"),column.isSorted?column.isSortedDesc?sortDescIcon:sortAscIcon:""]})));return _createElement(TrHtmlElement,{...headerGroup.getHeaderGroupProps(),key:i},columns2)}),
|
|
1
|
+
import{createElement as _createElement}from"react";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useMemo,useState,useEffect,useCallback}from"react";import components from"../../config/components";import CustomerContext from"../../context/CustomerContext";import OrderListChildrenContext from"../../context/OrderListChildrenContext";import{useTable,useSortBy,useBlockLayout}from"react-table";import{FixedSizeList}from"react-window";import scrollbarWidth from"../../utils/scrollbarWidth";import{sortDescIcon,sortAscIcon}from"../../utils/icons";const propTypes=components.OrderList.propTypes,displayName=components.OrderList.displayName;export function OrderList({children,columns,loadingElement,showActions=!1,actionsComponent,actionsContainerClassName,infiniteScroll,windowOptions,theadClassName,rowTrClassName,...p}){const[loading,setLoading]=useState(!0),{orders}=useContext(CustomerContext),data=useMemo(()=>orders,[orders]),cols=useMemo(()=>columns,[columns]),tablePlugins=[useSortBy];infiniteScroll&&tablePlugins.push(useBlockLayout);const defaultColumn=useMemo(()=>({width:windowOptions?.column||150}),[windowOptions?.column]),table=useTable({data,columns:cols,...infiniteScroll&&{defaultColumn}},...tablePlugins),TableHtmlElement=infiniteScroll?"div":"table",TheadHtmlElement=infiniteScroll?"div":"thead",TbodyHtmlElement=infiniteScroll?"div":"tbody",ThHtmlElement=infiniteScroll?"div":"th",TrHtmlElement=infiniteScroll?"div":"tr";useEffect(()=>(orders&&orders.length>0&&setLoading(!1),()=>{setLoading(!0)}),[orders]);const scrollBarSize=infiniteScroll?useMemo(()=>scrollbarWidth(),[]):0,LoadingComponent=loadingElement||_jsx("div",{children:"Loading..."}),headerComponent=table.headerGroups.map((headerGroup,i)=>{const columns2=headerGroup.headers.map((column,k)=>_createElement(ThHtmlElement,{className:column?.className,...column.getHeaderProps(column?.getSortByToggleProps&&column?.getSortByToggleProps()),key:k},_jsxs("span",{className:column?.titleClassName,children:[column.render("Header"),column.isSorted?column.isSortedDesc?sortDescIcon:sortAscIcon:""]})));return _createElement(TrHtmlElement,{...headerGroup.getHeaderGroupProps(),key:i},columns2)}),components2=infiniteScroll?useCallback(({index,style})=>{const row=table.rows[index];row&&table.prepareRow(row);const childProps={order:orders?.[index],row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll};return _jsx(TrHtmlElement,{...row&&row.getRowProps({style}),className:rowTrClassName,children:_jsx(OrderListChildrenContext.Provider,{value:childProps,children})})},[table.prepareRow,table.rows]):table.rows.map((row,i)=>{table.prepareRow(row);const childProps={order:orders?.[i],row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll};return _createElement(TrHtmlElement,{...row.getRowProps(),className:rowTrClassName,key:i},_jsx(OrderListChildrenContext.Provider,{value:childProps,children}))});return loading?LoadingComponent:_jsxs(TableHtmlElement,{...p,...table.getTableProps(),children:[_jsx(TheadHtmlElement,{className:theadClassName,children:headerComponent}),_jsx(TbodyHtmlElement,{...table.getTableBodyProps(),children:infiniteScroll?_jsx(FixedSizeList,{height:windowOptions?.height||400,itemCount:table.rows.length,itemSize:windowOptions?.itemSize||100,width:windowOptions?.width||table.totalColumnsWidth+scrollBarSize,children:components2}):components2})]})}OrderList.propTypes=propTypes,OrderList.displayName=displayName;export default OrderList;
|
|
@@ -2,4 +2,10 @@
|
|
|
2
2
|
import { BaseFieldProps } from '../utils/BaseField';
|
|
3
3
|
declare type Props = Omit<BaseFieldProps, 'attribute'>;
|
|
4
4
|
export declare function OrderNumber(props: Props): JSX.Element;
|
|
5
|
+
export declare namespace OrderNumber {
|
|
6
|
+
var propTypes: {
|
|
7
|
+
className: import("prop-types").Requireable<string>;
|
|
8
|
+
};
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
5
11
|
export default OrderNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseField from"../utils/BaseField";export function OrderNumber(props){return _jsx(BaseField,{attribute:"number",...props})}export default OrderNumber;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import components from"../../config/components";import BaseField from"../utils/BaseField";const propTypes=components.OrderNumber.propTypes,displayName=components.OrderNumber.displayName;export function OrderNumber(props){return _jsx(BaseField,{attribute:"number",...props})}OrderNumber.propTypes=propTypes,OrderNumber.displayName=displayName;export default OrderNumber;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
persistKey: string;
|
|
5
5
|
clearWhenPlaced?: boolean;
|
|
6
6
|
};
|
|
7
7
|
export declare function OrderStorage(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace OrderStorage {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
+
clearWhenPlaced: import("prop-types").Requireable<boolean>;
|
|
12
|
+
persistKey: import("prop-types").Validator<string>;
|
|
13
|
+
};
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
8
16
|
export default OrderStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import OrderStorageContext from"../../context/OrderStorageContext";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../../utils/localStorage";export function OrderStorage(props){const{children,clearWhenPlaced=!0,...p}=props;return _jsx(OrderStorageContext.Provider,{value:{...p,setLocalOrder,getLocalOrder,deleteLocalOrder,clearWhenPlaced},children})}export default OrderStorage;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import OrderStorageContext from"../../context/OrderStorageContext";import components from"../../config/components";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../../utils/localStorage";const propTypes=components.OrderStorage.propTypes,displayName=components.OrderStorage.displayName;export function OrderStorage(props){const{children,clearWhenPlaced=!0,...p}=props;return _jsx(OrderStorageContext.Provider,{value:{...p,setLocalOrder,getLocalOrder,deleteLocalOrder,clearWhenPlaced},children})}OrderStorage.propTypes=propTypes,OrderStorage.displayName=displayName;export default OrderStorage;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../../typings/index';
|
|
3
3
|
declare type ChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
|
|
4
4
|
handleClick: () => Promise<void>;
|
|
5
5
|
}>;
|
|
6
6
|
declare type Props = {
|
|
7
7
|
children?: ChildrenProps;
|
|
8
|
-
label?: string |
|
|
8
|
+
label?: string | ReactNode;
|
|
9
9
|
onClick?: (response: {
|
|
10
10
|
placed: boolean;
|
|
11
11
|
}) => void;
|
|
12
12
|
} & JSX.IntrinsicElements['button'];
|
|
13
13
|
export declare function PlaceOrderButton(props: Props): JSX.Element;
|
|
14
|
+
export declare namespace PlaceOrderButton {
|
|
15
|
+
var propTypes: {
|
|
16
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
17
|
+
label: import("prop-types").Requireable<NonNullable<string | import("prop-types").ReactElementLike | null | undefined>>;
|
|
18
|
+
};
|
|
19
|
+
var defaultProps: {
|
|
20
|
+
label: string;
|
|
21
|
+
};
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
14
24
|
export default PlaceOrderButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import Parent from"../utils/Parent";import PlaceOrderContext from"../../context/PlaceOrderContext";import isFunction from"lodash/isFunction";import PaymentMethodContext from"../../context/PaymentMethodContext";import OrderContext from"../../context/OrderContext";import getCardDetails from"../../utils/getCardDetails";export function PlaceOrderButton(props){const ref=useRef(null),{children,label="Place order",disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef}=useContext(PlaceOrderContext),[notPermitted,setNotPermitted]=useState(!0),[forceDisable,setForceDisable]=useState(disabled),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),isFree=order?.total_amount_with_taxes_cents===0;useEffect(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType});(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,currentPaymentMethodRef?.current?.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),useEffect(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.paypalPayerId,paymentType]),useEffect(()=>{if(paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&order?.status&&["draft","pending"].includes(order?.status)){const attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult},paymentData:paymentSource.payment_response.paymentData},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode=res?.payment_response?.resultCode;["Authorised","Pending","Received"].includes(resultCode)&&handleClick()})}paymentType==="adyen_payments"&&options?.adyen?.MD&&options?.adyen?.PaRes&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.adyen,paymentType]),useEffect(()=>{paymentType==="checkout_com_payments"&&options?.checkoutCom?.session_id&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.checkoutCom,paymentType]),useEffect(()=>{ref!=null&&ref.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=async()=>{let isValid=!0;setForceDisable(!0);const card=paymentType&&getCardDetails({paymentType,customerPayment:{payment_source:paymentSource}});currentPaymentMethodRef?.current?.onsubmit&&[!options?.paypalPayerId,!options?.adyen?.MD,!options?.checkoutCom?.session_id].every(Boolean)?(isValid=await currentPaymentMethodRef.current?.onsubmit(paymentSource),isValid===!1&&paymentSource.payment_response?.resultCode==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0);const placed=isValid&&setPlaceOrder&&(paymentSource||isFree)&&await setPlaceOrder({paymentSource});setForceDisable(!1),onClick&&placed&&onClick(placed)},disabledButton=disabled!==void 0?disabled:notPermitted,parentProps={...p,label,disabled:disabledButton,handleClick,ref};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{ref,type:"button",disabled:disabledButton||forceDisable,onClick:handleClick,...p,children:isFunction(label)?label():label})}export default PlaceOrderButton;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import Parent from"../utils/Parent";import components from"../../config/components";import PlaceOrderContext from"../../context/PlaceOrderContext";import isFunction from"lodash/isFunction";import PaymentMethodContext from"../../context/PaymentMethodContext";import OrderContext from"../../context/OrderContext";import getCardDetails from"../../utils/getCardDetails";const propTypes=components.PlaceOrderButton.propTypes,defaultProps=components.PlaceOrderButton.defaultProps,displayName=components.PlaceOrderButton.displayName;export function PlaceOrderButton(props){const ref=useRef(null),{children,label="Place order",disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef}=useContext(PlaceOrderContext),[notPermitted,setNotPermitted]=useState(!0),[forceDisable,setForceDisable]=useState(disabled),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),isFree=order?.total_amount_with_taxes_cents===0;useEffect(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType});(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,currentPaymentMethodRef?.current?.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),useEffect(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.paypalPayerId,paymentType]),useEffect(()=>{if(paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&order?.status&&["draft","pending"].includes(order?.status)){const attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult},paymentData:paymentSource.payment_response.paymentData},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode=res?.payment_response?.resultCode;["Authorised","Pending","Received"].includes(resultCode)&&handleClick()})}paymentType==="adyen_payments"&&options?.adyen?.MD&&options?.adyen?.PaRes&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.adyen,paymentType]),useEffect(()=>{paymentType==="checkout_com_payments"&&options?.checkoutCom?.session_id&&order?.status&&["draft","pending"].includes(order?.status)&&handleClick()},[options?.checkoutCom,paymentType]),useEffect(()=>{ref!=null&&ref.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=async()=>{let isValid=!0;setForceDisable(!0);const card=paymentType&&getCardDetails({paymentType,customerPayment:{payment_source:paymentSource}});currentPaymentMethodRef?.current?.onsubmit&&[!options?.paypalPayerId,!options?.adyen?.MD,!options?.checkoutCom?.session_id].every(Boolean)?(isValid=await currentPaymentMethodRef.current?.onsubmit(paymentSource),isValid===!1&&paymentSource.payment_response?.resultCode==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0);const placed=isValid&&setPlaceOrder&&(paymentSource||isFree)&&await setPlaceOrder({paymentSource});setForceDisable(!1),onClick&&placed&&onClick(placed)},disabledButton=disabled!==void 0?disabled:notPermitted,parentProps={...p,label,disabled:disabledButton,handleClick,ref};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{ref,type:"button",disabled:disabledButton||forceDisable,onClick:handleClick,...p,children:isFunction(label)?label():label})}PlaceOrderButton.propTypes=propTypes,PlaceOrderButton.defaultProps=defaultProps,PlaceOrderButton.displayName=displayName;export default PlaceOrderButton;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { PlaceOrderOptions } from '../../reducers/PlaceOrderReducer';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
children:
|
|
4
|
+
children: ReactNode;
|
|
5
5
|
options?: PlaceOrderOptions;
|
|
6
6
|
};
|
|
7
7
|
export declare function PlaceOrderContainer(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace PlaceOrderContainer {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
+
};
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
8
14
|
export default PlaceOrderContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import PlaceOrderContext from"../../context/PlaceOrderContext";import{useContext,useEffect,useReducer}from"react";import placeOrderReducer,{placeOrderInitialState,placeOrderPermitted,setButtonRef}from"../../reducers/PlaceOrderReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import{setPlaceOrder}from"../../reducers/PlaceOrderReducer";export function PlaceOrderContainer(props){const{children,options}=props,[state,dispatch]=useReducer(placeOrderReducer,placeOrderInitialState),{order,setOrder,setOrderErrors,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),include?.includes("billing_address")?includeLoaded?.billing_address||addResourceToInclude({newResourceLoaded:{billing_address:!0}}):addResourceToInclude({newResource:"billing_address"}),include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address",resourcesIncluded:include}),order&&placeOrderPermitted({config,dispatch,order,options:{...options}})},[order,include,includeLoaded]);const contextValue={...state,setPlaceOrder:({paymentSource})=>setPlaceOrder({config,order,state,setOrderErrors,paymentSource,include,setOrder}),placeOrderPermitted:()=>placeOrderPermitted({config,dispatch,order,options:{...options}}),setButtonRef:ref=>setButtonRef(ref,dispatch)};return _jsx(PlaceOrderContext.Provider,{value:contextValue,children})}export default PlaceOrderContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import PlaceOrderContext from"../../context/PlaceOrderContext";import{useContext,useEffect,useReducer}from"react";import placeOrderReducer,{placeOrderInitialState,placeOrderPermitted,setButtonRef}from"../../reducers/PlaceOrderReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import components from"../../config/components";import{setPlaceOrder}from"../../reducers/PlaceOrderReducer";const propTypes=components.PlaceOrderContainer.propTypes,displayName=components.PlaceOrderContainer.displayName;export function PlaceOrderContainer(props){const{children,options}=props,[state,dispatch]=useReducer(placeOrderReducer,placeOrderInitialState),{order,setOrder,setOrderErrors,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),include?.includes("billing_address")?includeLoaded?.billing_address||addResourceToInclude({newResourceLoaded:{billing_address:!0}}):addResourceToInclude({newResource:"billing_address"}),include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address",resourcesIncluded:include}),order&&placeOrderPermitted({config,dispatch,order,options:{...options}})},[order,include,includeLoaded]);const contextValue={...state,setPlaceOrder:({paymentSource})=>setPlaceOrder({config,order,state,setOrderErrors,paymentSource,include,setOrder}),placeOrderPermitted:()=>placeOrderPermitted({config,dispatch,order,options:{...options}}),setButtonRef:ref=>setButtonRef(ref,dispatch)};return _jsx(PlaceOrderContext.Provider,{value:contextValue,children})}PlaceOrderContainer.propTypes=propTypes,PlaceOrderContainer.displayName=displayName;export default PlaceOrderContainer;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseInputProps } from '../utils/BaseInput';
|
|
3
3
|
export declare function PrivacyAndTermsCheckbox(props: Partial<BaseInputProps>): JSX.Element;
|
|
4
|
+
export declare namespace PrivacyAndTermsCheckbox {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
7
|
+
};
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
4
10
|
export default PrivacyAndTermsCheckbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import PlaceOrderContext from"../../context/PlaceOrderContext";import{useContext,useEffect,useState}from"react";import BaseInput from"../utils/BaseInput";export function PrivacyAndTermsCheckbox(props){const{order}=useContext(OrderContext),{placeOrderPermitted}=useContext(PlaceOrderContext),[forceDisabled,setForceDisabled]=useState(!0),[checked,setChecked]=useState(!1),fieldName="privacy-terms",handleChange=e=>{const v=e.target?.checked;setChecked(v),localStorage.setItem(fieldName,`${v}`),placeOrderPermitted&&placeOrderPermitted()};return useEffect(()=>(order?.privacy_url&&order?.terms_url&&setForceDisabled(!1),checked||localStorage.setItem(fieldName,`${checked}`),()=>{setForceDisabled(!0),localStorage.removeItem(fieldName)}),[order?.privacy_url,order?.terms_url]),_jsx(BaseInput,{type:"checkbox",name:fieldName,disabled:forceDisabled,onChange:handleChange,checked,...props})}export default PrivacyAndTermsCheckbox;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import components from"../../config/components";import OrderContext from"../../context/OrderContext";import PlaceOrderContext from"../../context/PlaceOrderContext";import{useContext,useEffect,useState}from"react";import BaseInput from"../utils/BaseInput";const propTypes=components.PrivacyAndTermsCheckbox.propTypes,displayName=components.PrivacyAndTermsCheckbox.displayName;export function PrivacyAndTermsCheckbox(props){const{order}=useContext(OrderContext),{placeOrderPermitted}=useContext(PlaceOrderContext),[forceDisabled,setForceDisabled]=useState(!0),[checked,setChecked]=useState(!1),fieldName="privacy-terms",handleChange=e=>{const v=e.target?.checked;setChecked(v),localStorage.setItem(fieldName,`${v}`),placeOrderPermitted&&placeOrderPermitted()};return useEffect(()=>(order?.privacy_url&&order?.terms_url&&setForceDisabled(!1),checked||localStorage.setItem(fieldName,`${checked}`),()=>{setForceDisabled(!0),localStorage.removeItem(fieldName)}),[order?.privacy_url,order?.terms_url]),_jsx(BaseInput,{type:"checkbox",name:fieldName,disabled:forceDisabled,onChange:handleChange,checked,...props})}PrivacyAndTermsCheckbox.propTypes=propTypes,PrivacyAndTermsCheckbox.displayName=displayName;export default PrivacyAndTermsCheckbox;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
3
|
export declare function ShippingAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
+
export declare namespace ShippingAmount {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
id: import("prop-types").Requireable<string>;
|
|
7
|
+
className: import("prop-types").Requireable<string>;
|
|
8
|
+
style: import("prop-types").Requireable<object>;
|
|
9
|
+
name: import("prop-types").Requireable<string>;
|
|
10
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
11
|
+
format: import("prop-types").Requireable<import("../../typings/index").BaseFormatPrice>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
4
15
|
export default ShippingAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";export function ShippingAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"shipping",...props})}export default ShippingAmount;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";import components from"../../config/components";const propTypes=components.ShippingAmount.propTypes,displayName=components.ShippingAmount.displayName;export function ShippingAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"shipping",...props})}ShippingAmount.propTypes=propTypes,ShippingAmount.displayName=displayName;export default ShippingAmount;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
3
|
export declare function SubTotalAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
+
export declare namespace SubTotalAmount {
|
|
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 SubTotalAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";export function SubTotalAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"subtotal",...props})}export default SubTotalAmount;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";import components from"../../config/components";const propTypes=components.SubTotalAmount.propTypes,defaultProps=components.SubTotalAmount.defaultProps,displayName=components.SubTotalAmount.displayName;export function SubTotalAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"subtotal",...props})}SubTotalAmount.propTypes=propTypes,SubTotalAmount.defaultProps=defaultProps,SubTotalAmount.displayName=displayName;export default SubTotalAmount;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
3
|
export declare function TaxesAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
+
export declare namespace TaxesAmount {
|
|
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 TaxesAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";export function TaxesAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"total_tax",...props})}export default TaxesAmount;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";import components from"../../config/components";const propTypes=components.TaxesAmount.propTypes,defaultProps=components.TaxesAmount.defaultProps,displayName=components.TaxesAmount.displayName;export function TaxesAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"total_tax",...props})}TaxesAmount.propTypes=propTypes,TaxesAmount.defaultProps=defaultProps,TaxesAmount.displayName=displayName;export default TaxesAmount;
|