@commercelayer/react-components 4.0.0-alpha.8 → 4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/auth/CommerceLayer.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItem.d.ts +4 -11
- package/lib/cjs/components/line_items/LineItem.js +1 -1
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +0 -13
- package/lib/cjs/components/line_items/LineItemAmount.js +1 -1
- package/lib/cjs/components/line_items/LineItemCode.d.ts +6 -11
- package/lib/cjs/components/line_items/LineItemCode.js +1 -1
- package/lib/cjs/components/line_items/LineItemField.d.ts +14 -0
- package/lib/cjs/components/line_items/LineItemField.js +1 -0
- package/lib/cjs/components/line_items/LineItemImage.d.ts +4 -11
- package/lib/cjs/components/line_items/LineItemImage.js +1 -1
- package/lib/cjs/components/line_items/LineItemName.d.ts +6 -11
- package/lib/cjs/components/line_items/LineItemName.js +1 -1
- package/lib/cjs/components/line_items/LineItemOption.d.ts +5 -16
- package/lib/cjs/components/line_items/LineItemOption.js +1 -1
- package/lib/cjs/components/line_items/LineItemOptions.d.ts +2 -5
- package/lib/cjs/components/line_items/LineItemOptions.js +1 -1
- package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/cjs/components/line_items/LineItemsContainer.d.ts +2 -14
- package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
- package/lib/cjs/components/orders/AddToCartButton.d.ts +34 -9
- 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.js +1 -1
- package/lib/cjs/components/orders/CheckoutLink.js +1 -1
- package/lib/cjs/components/orders/DiscountAmount.d.ts +0 -14
- package/lib/cjs/components/orders/DiscountAmount.js +1 -1
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +0 -11
- package/lib/cjs/components/orders/GiftCardAmount.js +1 -1
- package/lib/cjs/components/orders/OrderContainer.js +1 -1
- package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +4 -0
- package/lib/cjs/components/orders/PaymentMethodAmount.js +1 -0
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +2 -8
- package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -6
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/cjs/components/orders/ShippingAmount.d.ts +0 -11
- package/lib/cjs/components/orders/ShippingAmount.js +1 -1
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +0 -14
- package/lib/cjs/components/orders/SubTotalAmount.js +1 -1
- package/lib/cjs/components/orders/TaxesAmount.d.ts +0 -14
- package/lib/cjs/components/orders/TaxesAmount.js +1 -1
- package/lib/cjs/components/orders/TotalAmount.d.ts +0 -14
- package/lib/cjs/components/orders/TotalAmount.js +1 -1
- package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +18 -0
- package/lib/cjs/components/parcels/ParcelLineItemsCount.js +1 -0
- package/lib/cjs/components/parcels/Parcels.d.ts +2 -1
- package/lib/cjs/components/parcels/Parcels.js +1 -1
- package/lib/cjs/components/parcels/ParcelsCount.d.ts +18 -0
- package/lib/cjs/components/parcels/ParcelsCount.js +1 -0
- package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/PaymentGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +2 -2
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +1 -7
- package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +6 -11
- package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +2 -14
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +4 -9
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +2 -8
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/cjs/components/payment_source/AdyenPayment.d.ts +5 -5
- package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +4 -11
- package/lib/cjs/components/payment_source/PaymentSource.js +1 -1
- package/lib/cjs/components/prices/Price.js +1 -1
- package/lib/cjs/components/prices/PricesContainer.js +1 -1
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +18 -0
- package/lib/cjs/components/shipments/ShipmentsCount.js +1 -0
- package/lib/cjs/components/skus/AvailabilityContainer.d.ts +3 -9
- package/lib/cjs/components/skus/AvailabilityContainer.js +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +23 -4
- package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/cjs/components/skus/SkuField.js +1 -1
- package/lib/cjs/components/skus/SkusContainer.d.ts +2 -2
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +3 -4
- package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +3 -3
- package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
- package/lib/cjs/components/utils/GenericFieldComponent.d.ts +4 -4
- package/lib/cjs/components/utils/GenericFieldComponent.js +1 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +3 -3
- package/lib/cjs/context/CommerceLayerContext.d.ts +2 -2
- package/lib/cjs/context/CommerceLayerContext.js +1 -1
- package/lib/cjs/context/ExternalFunctionContext.d.ts +2 -2
- package/lib/cjs/context/ExternalFunctionContext.js +1 -1
- package/lib/cjs/context/LineItemContext.d.ts +1 -1
- package/lib/cjs/context/OrderContext.d.ts +2 -3
- package/lib/cjs/context/OrderContext.js +1 -1
- package/lib/cjs/context/PaymentMethodContext.d.ts +2 -11
- package/lib/cjs/context/PaymentMethodContext.js +1 -1
- package/lib/cjs/index.d.ts +6 -16
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/AvailabilityReducer.d.ts +13 -23
- package/lib/cjs/reducers/AvailabilityReducer.js +1 -1
- package/lib/cjs/reducers/OrderReducer.d.ts +36 -22
- package/lib/cjs/reducers/OrderReducer.js +1 -1
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +9 -11
- package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
- package/lib/cjs/reducers/PriceReducer.d.ts +12 -19
- package/lib/cjs/reducers/PriceReducer.js +1 -1
- package/lib/cjs/reducers/SkuReducer.d.ts +3 -3
- package/lib/cjs/typings/errors.d.ts +4 -4
- package/lib/cjs/typings/index.d.ts +3 -3
- package/lib/cjs/utils/browserInfo.d.ts +5 -2
- package/lib/cjs/utils/browserInfo.js +1 -1
- package/lib/cjs/utils/getLineItemsCount.d.ts +3 -3
- package/lib/cjs/utils/getSdk.js +1 -1
- package/lib/cjs/utils/hooks/useCustomContext.d.ts +21 -0
- package/lib/cjs/utils/hooks/useCustomContext.js +1 -0
- package/lib/esm/components/auth/CommerceLayer.d.ts +2 -2
- package/lib/esm/components/line_items/LineItem.d.ts +4 -11
- package/lib/esm/components/line_items/LineItem.js +1 -1
- package/lib/esm/components/line_items/LineItemAmount.d.ts +0 -13
- package/lib/esm/components/line_items/LineItemAmount.js +1 -1
- package/lib/esm/components/line_items/LineItemCode.d.ts +6 -11
- package/lib/esm/components/line_items/LineItemCode.js +1 -1
- package/lib/esm/components/line_items/LineItemField.d.ts +14 -0
- package/lib/esm/components/line_items/LineItemField.js +1 -0
- package/lib/esm/components/line_items/LineItemImage.d.ts +4 -11
- package/lib/esm/components/line_items/LineItemImage.js +1 -1
- package/lib/esm/components/line_items/LineItemName.d.ts +6 -11
- package/lib/esm/components/line_items/LineItemName.js +1 -1
- package/lib/esm/components/line_items/LineItemOption.d.ts +5 -16
- package/lib/esm/components/line_items/LineItemOption.js +1 -1
- package/lib/esm/components/line_items/LineItemOptions.d.ts +2 -5
- package/lib/esm/components/line_items/LineItemOptions.js +1 -1
- package/lib/esm/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/esm/components/line_items/LineItemsContainer.d.ts +2 -14
- package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
- package/lib/esm/components/orders/AddToCartButton.d.ts +34 -9
- 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.js +1 -1
- package/lib/esm/components/orders/CheckoutLink.js +1 -1
- package/lib/esm/components/orders/DiscountAmount.d.ts +0 -14
- package/lib/esm/components/orders/DiscountAmount.js +1 -1
- package/lib/esm/components/orders/GiftCardAmount.d.ts +0 -11
- package/lib/esm/components/orders/GiftCardAmount.js +1 -1
- package/lib/esm/components/orders/OrderContainer.js +1 -1
- package/lib/esm/components/orders/PaymentMethodAmount.d.ts +4 -0
- package/lib/esm/components/orders/PaymentMethodAmount.js +1 -0
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/orders/PlaceOrderContainer.d.ts +2 -8
- package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +0 -6
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.js +1 -1
- package/lib/esm/components/orders/ShippingAmount.d.ts +0 -11
- package/lib/esm/components/orders/ShippingAmount.js +1 -1
- package/lib/esm/components/orders/SubTotalAmount.d.ts +0 -14
- package/lib/esm/components/orders/SubTotalAmount.js +1 -1
- package/lib/esm/components/orders/TaxesAmount.d.ts +0 -14
- package/lib/esm/components/orders/TaxesAmount.js +1 -1
- package/lib/esm/components/orders/TotalAmount.d.ts +0 -14
- package/lib/esm/components/orders/TotalAmount.js +1 -1
- package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +18 -0
- package/lib/esm/components/parcels/ParcelLineItemsCount.js +1 -0
- package/lib/esm/components/parcels/Parcels.d.ts +2 -1
- package/lib/esm/components/parcels/Parcels.js +1 -1
- package/lib/esm/components/parcels/ParcelsCount.d.ts +18 -0
- package/lib/esm/components/parcels/ParcelsCount.js +1 -0
- package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/BraintreeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/PaymentGateway.js +1 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/StripeGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +2 -2
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +1 -7
- package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +6 -11
- package/lib/esm/components/payment_methods/PaymentMethodName.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +2 -14
- package/lib/esm/components/payment_methods/PaymentMethodPrice.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +4 -9
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +2 -8
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/esm/components/payment_source/AdyenPayment.d.ts +5 -5
- package/lib/esm/components/payment_source/AdyenPayment.js +1 -1
- package/lib/esm/components/payment_source/PaymentSource.d.ts +4 -11
- package/lib/esm/components/payment_source/PaymentSource.js +1 -1
- package/lib/esm/components/prices/Price.js +1 -1
- package/lib/esm/components/prices/PricesContainer.js +1 -1
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +18 -0
- package/lib/esm/components/shipments/ShipmentsCount.js +1 -0
- package/lib/esm/components/skus/AvailabilityContainer.d.ts +3 -9
- package/lib/esm/components/skus/AvailabilityContainer.js +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +23 -4
- package/lib/esm/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/esm/components/skus/SkuField.js +1 -1
- package/lib/esm/components/skus/SkusContainer.d.ts +2 -2
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +3 -4
- package/lib/esm/components/utils/BaseInput.d.ts +1 -1
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +3 -3
- package/lib/esm/components/utils/BaseOrderPrice.js +1 -1
- package/lib/esm/components/utils/GenericFieldComponent.d.ts +4 -4
- package/lib/esm/components/utils/GenericFieldComponent.js +1 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +3 -3
- package/lib/esm/context/CommerceLayerContext.d.ts +2 -2
- package/lib/esm/context/CommerceLayerContext.js +1 -1
- package/lib/esm/context/ExternalFunctionContext.d.ts +2 -2
- package/lib/esm/context/ExternalFunctionContext.js +1 -1
- package/lib/esm/context/LineItemContext.d.ts +1 -1
- package/lib/esm/context/OrderContext.d.ts +2 -3
- package/lib/esm/context/OrderContext.js +1 -1
- package/lib/esm/context/PaymentMethodContext.d.ts +2 -11
- package/lib/esm/context/PaymentMethodContext.js +1 -1
- package/lib/esm/index.d.ts +6 -16
- package/lib/esm/index.js +1 -1
- package/lib/esm/reducers/AvailabilityReducer.d.ts +13 -23
- package/lib/esm/reducers/AvailabilityReducer.js +1 -1
- package/lib/esm/reducers/OrderReducer.d.ts +36 -22
- package/lib/esm/reducers/OrderReducer.js +1 -1
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +9 -11
- package/lib/esm/reducers/PaymentMethodReducer.js +1 -1
- package/lib/esm/reducers/PriceReducer.d.ts +12 -19
- package/lib/esm/reducers/PriceReducer.js +1 -1
- package/lib/esm/reducers/SkuReducer.d.ts +3 -3
- package/lib/esm/typings/errors.d.ts +4 -4
- package/lib/esm/typings/index.d.ts +3 -3
- package/lib/esm/utils/browserInfo.d.ts +5 -2
- package/lib/esm/utils/browserInfo.js +1 -1
- package/lib/esm/utils/getLineItemsCount.d.ts +3 -3
- package/lib/esm/utils/getSdk.js +1 -1
- package/lib/esm/utils/hooks/useCustomContext.d.ts +21 -0
- package/lib/esm/utils/hooks/useCustomContext.js +1 -0
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +9 -15
- package/lib/cjs/components/orders/ItemContainer.d.ts +0 -11
- package/lib/cjs/components/orders/ItemContainer.js +0 -1
- package/lib/cjs/components/payment_methods/PaymentMethodAmount.d.ts +0 -18
- package/lib/cjs/components/payment_methods/PaymentMethodAmount.js +0 -1
- package/lib/cjs/components/skus/QuantitySelector.d.ts +0 -17
- package/lib/cjs/components/skus/QuantitySelector.js +0 -1
- package/lib/cjs/components/skus/SkuOption.d.ts +0 -14
- package/lib/cjs/components/skus/SkuOption.js +0 -1
- package/lib/cjs/components/skus/SkuOptionInput.d.ts +0 -15
- package/lib/cjs/components/skus/SkuOptionInput.js +0 -1
- package/lib/cjs/components/skus/SkuOptionsContainer.d.ts +0 -14
- package/lib/cjs/components/skus/SkuOptionsContainer.js +0 -1
- package/lib/cjs/components/skus/VariantSelector.d.ts +0 -29
- package/lib/cjs/components/skus/VariantSelector.js +0 -1
- package/lib/cjs/components/skus/VariantsContainer.d.ts +0 -20
- package/lib/cjs/components/skus/VariantsContainer.js +0 -1
- package/lib/cjs/components/utils/VariantTemplate.d.ts +0 -36
- package/lib/cjs/components/utils/VariantTemplate.js +0 -1
- package/lib/cjs/context/ItemContext.d.ts +0 -13
- package/lib/cjs/context/ItemContext.js +0 -1
- package/lib/cjs/context/SkuOptionChildrenContext.d.ts +0 -8
- package/lib/cjs/context/SkuOptionChildrenContext.js +0 -1
- package/lib/cjs/context/SkuOptionsContext.d.ts +0 -3
- package/lib/cjs/context/SkuOptionsContext.js +0 -1
- package/lib/cjs/context/VariantsContext.d.ts +0 -3
- package/lib/cjs/context/VariantsContext.js +0 -1
- package/lib/cjs/reducers/ItemReducer.d.ts +0 -69
- package/lib/cjs/reducers/ItemReducer.js +0 -1
- package/lib/cjs/reducers/SkuOptionsReducer.d.ts +0 -26
- package/lib/cjs/reducers/SkuOptionsReducer.js +0 -1
- package/lib/cjs/reducers/VariantReducer.d.ts +0 -72
- package/lib/cjs/reducers/VariantReducer.js +0 -1
- package/lib/cjs/utils/getCurrentItemKey.d.ts +0 -6
- package/lib/cjs/utils/getCurrentItemKey.js +0 -1
- package/lib/esm/components/orders/ItemContainer.d.ts +0 -11
- package/lib/esm/components/orders/ItemContainer.js +0 -1
- package/lib/esm/components/payment_methods/PaymentMethodAmount.d.ts +0 -18
- package/lib/esm/components/payment_methods/PaymentMethodAmount.js +0 -1
- package/lib/esm/components/skus/QuantitySelector.d.ts +0 -17
- package/lib/esm/components/skus/QuantitySelector.js +0 -1
- package/lib/esm/components/skus/SkuOption.d.ts +0 -14
- package/lib/esm/components/skus/SkuOption.js +0 -1
- package/lib/esm/components/skus/SkuOptionInput.d.ts +0 -15
- package/lib/esm/components/skus/SkuOptionInput.js +0 -1
- package/lib/esm/components/skus/SkuOptionsContainer.d.ts +0 -14
- package/lib/esm/components/skus/SkuOptionsContainer.js +0 -1
- package/lib/esm/components/skus/VariantSelector.d.ts +0 -29
- package/lib/esm/components/skus/VariantSelector.js +0 -1
- package/lib/esm/components/skus/VariantsContainer.d.ts +0 -20
- package/lib/esm/components/skus/VariantsContainer.js +0 -1
- package/lib/esm/components/utils/VariantTemplate.d.ts +0 -36
- package/lib/esm/components/utils/VariantTemplate.js +0 -1
- package/lib/esm/context/ItemContext.d.ts +0 -13
- package/lib/esm/context/ItemContext.js +0 -1
- package/lib/esm/context/SkuOptionChildrenContext.d.ts +0 -8
- package/lib/esm/context/SkuOptionChildrenContext.js +0 -1
- package/lib/esm/context/SkuOptionsContext.d.ts +0 -3
- package/lib/esm/context/SkuOptionsContext.js +0 -1
- package/lib/esm/context/VariantsContext.d.ts +0 -3
- package/lib/esm/context/VariantsContext.js +0 -1
- package/lib/esm/reducers/ItemReducer.d.ts +0 -69
- package/lib/esm/reducers/ItemReducer.js +0 -1
- package/lib/esm/reducers/SkuOptionsReducer.d.ts +0 -26
- package/lib/esm/reducers/SkuOptionsReducer.js +0 -1
- package/lib/esm/reducers/VariantReducer.d.ts +0 -72
- package/lib/esm/reducers/VariantReducer.js +0 -1
- package/lib/esm/utils/getCurrentItemKey.d.ts +0 -6
- package/lib/esm/utils/getCurrentItemKey.js +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ConditionalElement } from '../../typings/index';
|
|
3
|
+
import { TGenericChildrenProps, TResources } from '../utils/GenericFieldComponent';
|
|
4
|
+
declare type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
|
|
5
|
+
declare type TCondition = ConditionalElement<Exclude<TResources['LineItem'], 'resource'>>;
|
|
6
|
+
declare type Props = {
|
|
7
|
+
children?: (props: LineItemFieldChildrenProps) => JSX.Element;
|
|
8
|
+
} & TCondition;
|
|
9
|
+
/**
|
|
10
|
+
* @param props {@link Props}
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function LineItemField<P extends Props>(props: P): JSX.Element;
|
|
14
|
+
export default LineItemField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import GenericFieldComponent from"../utils/GenericFieldComponent";export function LineItemField(props){const{attribute,tagElement,children,...p}=props;return _jsx(GenericFieldComponent,{resource:"lineItem",attribute,tagElement,context:LineItemChildrenContext,...p,children})}export default LineItemField;
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LineItem } from '@commercelayer/sdk';
|
|
3
|
-
import { LineItemType } from '../../typings/index';
|
|
4
|
-
export
|
|
3
|
+
import { ChildrenFunction, LineItemType } from '../../typings/index';
|
|
4
|
+
export interface TLineItemImage extends Omit<Props, 'children'> {
|
|
5
5
|
src: string;
|
|
6
6
|
lineItem: LineItem;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
declare type Props = {
|
|
9
|
-
children?:
|
|
9
|
+
children?: ChildrenFunction<TLineItemImage>;
|
|
10
10
|
width?: number;
|
|
11
11
|
placeholder?: {
|
|
12
12
|
[K in LineItemType]?: string;
|
|
13
13
|
};
|
|
14
14
|
} & Omit<JSX.IntrinsicElements['img'], 'src' | 'srcSet' | 'placeholder'>;
|
|
15
15
|
export declare function LineItemImage(props: Props): JSX.Element | null;
|
|
16
|
-
export declare namespace LineItemImage {
|
|
17
|
-
var propTypes: {
|
|
18
|
-
width: import("prop-types").Requireable<number>;
|
|
19
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
20
|
-
};
|
|
21
|
-
var displayName: string;
|
|
22
|
-
}
|
|
23
16
|
export default LineItemImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import{defaultGiftCardImgUrl,defaultImgUrl}from"../../utils/placeholderImages";import Parent from"../utils/Parent";export function LineItemImage(props){const{placeholder,children,...p}=props,{lineItem}=useContext(LineItemChildrenContext),itemType=lineItem?.item_type;let src=lineItem?.image_url;src||(placeholder?.[itemType]?src=placeholder?.[itemType]:src=itemType==="gift_cards"?defaultGiftCardImgUrl:defaultImgUrl);const parenProps={lineItem,src,placeholder,...p};return children?_jsx(Parent,{...parenProps,children}):src?_jsx("img",{"data-testid":`line-item-image-${lineItem?.sku_code??""}`,alt:lineItem?.name,src,...p}):null}export default LineItemImage;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { LineItem } from '@commercelayer/sdk';
|
|
3
|
-
|
|
3
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
4
|
+
export interface TLineItemName extends Omit<Props, 'children'> {
|
|
4
5
|
label: string;
|
|
5
6
|
lineItem: LineItem;
|
|
6
|
-
};
|
|
7
|
-
declare type Props = {
|
|
8
|
-
children?: (props: LineItemNameType) => JSX.Element;
|
|
9
|
-
} & JSX.IntrinsicElements['p'];
|
|
10
|
-
export declare function LineItemName(props: Props): JSX.Element;
|
|
11
|
-
export declare namespace LineItemName {
|
|
12
|
-
var propTypes: {
|
|
13
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
14
|
-
};
|
|
15
|
-
var displayName: string;
|
|
16
7
|
}
|
|
8
|
+
interface Props extends Omit<JSX.IntrinsicElements['p'], 'children'> {
|
|
9
|
+
children?: ChildrenFunction<TLineItemName>;
|
|
10
|
+
}
|
|
11
|
+
export declare function LineItemName(props: Props): JSX.Element;
|
|
17
12
|
export default LineItemName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import Parent from"../utils/Parent";
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import Parent from"../utils/Parent";export function LineItemName(props){const{lineItem}=useContext(LineItemChildrenContext),label=lineItem?.name,parentProps={label,lineItem,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("p",{"data-testid":`line-item-name-${lineItem?.sku_code??""}`,...props,children:label})}export default LineItemName;
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { LineItemOption as LineItemOptionType } from '@commercelayer/sdk';
|
|
3
3
|
import { ChildrenFunction } from '../../typings/index';
|
|
4
|
-
|
|
4
|
+
export interface TLineItemOption extends Omit<Props, 'children'> {
|
|
5
5
|
lineItemOption: LineItemOptionType;
|
|
6
|
-
}
|
|
7
|
-
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
8
|
id?: string;
|
|
9
9
|
className?: string;
|
|
10
10
|
key?: string;
|
|
11
11
|
style?: CSSProperties;
|
|
12
|
-
children?:
|
|
12
|
+
children?: ChildrenFunction<TLineItemOption>;
|
|
13
13
|
name?: string;
|
|
14
14
|
valueClassName?: string;
|
|
15
15
|
tagElement?: keyof JSX.IntrinsicElements;
|
|
16
16
|
tagContainer?: keyof JSX.IntrinsicElements;
|
|
17
|
-
};
|
|
18
|
-
export declare function LineItemOption(props: Props): JSX.Element;
|
|
19
|
-
export declare namespace LineItemOption {
|
|
20
|
-
var propTypes: {
|
|
21
|
-
name: import("prop-types").Requireable<string>;
|
|
22
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
23
|
-
valueClassName: import("prop-types").Requireable<string>;
|
|
24
|
-
className: import("prop-types").Requireable<string>;
|
|
25
|
-
id: import("prop-types").Requireable<string>;
|
|
26
|
-
style: import("prop-types").Requireable<object>;
|
|
27
|
-
};
|
|
28
|
-
var displayName: string;
|
|
29
17
|
}
|
|
18
|
+
export declare function LineItemOption(props: Props): JSX.Element;
|
|
30
19
|
export default LineItemOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext}from"react";import LineItemOptionChildrenContext from"../../context/LineItemOptionChildrenContext";import get from"lodash/get";import has from"lodash/has";import map from"lodash/map";import Parent from"../utils/Parent";import
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext}from"react";import LineItemOptionChildrenContext from"../../context/LineItemOptionChildrenContext";import get from"lodash/get";import has from"lodash/has";import map from"lodash/map";import Parent from"../utils/Parent";import isJSON from"../../utils/isJSON";export function LineItemOption(props){const{name,children,valueClassName,key,tagElement="li",tagContainer="ul",...p}=props,{lineItemOption,showAll}=useContext(LineItemOptionChildrenContext),parentProps={...props,lineItemOption},TagElement=tagElement,TagContainer=tagContainer,components=showAll&&isJSON(JSON.stringify(lineItemOption?.options))?map(lineItemOption?.options,(value,key2)=>_jsxs(TagElement,{...p,children:[`${key2}:`,_jsx("span",{className:valueClassName,children:`${value}`})]},key2)):has(lineItemOption,`options.${name}`)?_jsxs(TagElement,{...p,children:[`${name}:`,_jsx("span",{className:valueClassName,...p,children:`${get(lineItemOption,`options.${name}`)}`})]},key):null;return children?_jsx(Parent,{...parentProps,children:props.children}):_jsx(TagContainer,{children:components})}export default LineItemOption;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
declare type Props =
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
title?: string;
|
|
5
5
|
showName?: boolean;
|
|
6
6
|
titleTagElement?: keyof JSX.IntrinsicElements;
|
|
7
7
|
titleClassName?: string;
|
|
8
|
-
} & ({
|
|
8
|
+
} & Omit<JSX.IntrinsicElements['div'], 'children'> & ({
|
|
9
9
|
skuOptionId: string;
|
|
10
10
|
showAll?: never;
|
|
11
11
|
} | {
|
|
@@ -13,7 +13,4 @@ declare type Props = JSX.IntrinsicElements['div'] & {
|
|
|
13
13
|
showAll: true;
|
|
14
14
|
});
|
|
15
15
|
export declare function LineItemOptions(props: Props): JSX.Element;
|
|
16
|
-
export declare namespace LineItemOptions {
|
|
17
|
-
var displayName: string;
|
|
18
|
-
}
|
|
19
16
|
export default LineItemOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import LineItemOptionChildrenContext from"../../context/LineItemOptionChildrenContext";
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import LineItemOptionChildrenContext from"../../context/LineItemOptionChildrenContext";export function LineItemOptions(props){const{skuOptionId,title,children,showName=!0,showAll,className,titleTagElement="h6",titleClassName,...p}=props,{lineItem}=useContext(LineItemChildrenContext),lineItemOptions=lineItem!=null?lineItem?.line_item_options||[]:[],TitleTagElement=titleTagElement,options=lineItemOptions.filter(o=>showAll?!0:o.skuOption().id===skuOptionId).map((o,k)=>{const showTitle=showName?_jsx(TitleTagElement,{className:titleClassName,children:title||o.name}):null,valueProps={lineItemOption:o,showAll};return _jsxs("div",{className,...p,children:[showTitle,_jsx(LineItemOptionChildrenContext.Provider,{value:valueProps,children})]},k)});return _jsx(_Fragment,{children:options})}export default LineItemOptions;
|
|
@@ -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}=
|
|
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 useCustomContext from"../../utils/hooks/useCustomContext";export function LineItemRemoveLink(props){const{label="Remove",onClick}=props,{lineItem}=useCustomContext({context:LineItemChildrenContext,contextComponentName:"LineItem",currentComponentName:"LineItemRemoveLink",key:"lineItem"}),{deleteLineItem}=useContext(LineItemContext),handleRemove=e=>{e.preventDefault(),deleteLineItem!=null&&lineItem!=null&&deleteLineItem(lineItem.id),onClick?.(e)},parentProps={handleRemove,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("a",{"data-testid":`line-item-remove-link-${lineItem?.sku_code??""}`,...props,href:"#",onClick:handleRemove,children:label})}export default LineItemRemoveLink;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
filters?: Record<string, any>;
|
|
5
5
|
loader?: ReactNode;
|
|
6
|
-
};
|
|
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
6
|
}
|
|
7
|
+
export declare function LineItemsContainer(props: Props): JSX.Element;
|
|
20
8
|
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";
|
|
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,11 +1,9 @@
|
|
|
1
1
|
import { PropsWithoutRef } from 'react';
|
|
2
2
|
import { ChildrenFunction } from '../../typings/index';
|
|
3
|
-
import { AddToCartReturn } from '../../reducers/OrderReducer';
|
|
4
|
-
|
|
5
|
-
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
3
|
+
import { AddToCartReturn, CustomLineItem, LineItemOption } from '../../reducers/OrderReducer';
|
|
4
|
+
interface TAddToCartButton extends Omit<Props, 'children'> {
|
|
6
5
|
handleClick: () => AddToCartReturn;
|
|
7
6
|
}
|
|
8
|
-
export declare type AddToCartButtonType = ChildrenProps;
|
|
9
7
|
declare type BuyNowMode = {
|
|
10
8
|
buyNowMode: true;
|
|
11
9
|
checkoutUrl?: string;
|
|
@@ -20,14 +18,41 @@ declare type THostedCart = {
|
|
|
20
18
|
redirectToHostedCart?: false;
|
|
21
19
|
hostedCartUrl?: never;
|
|
22
20
|
};
|
|
21
|
+
declare type TButton = PropsWithoutRef<Omit<JSX.IntrinsicElements['button'], 'children'>>;
|
|
23
22
|
declare type Props = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Code of a bundle
|
|
25
|
+
*/
|
|
27
26
|
bundleCode?: string;
|
|
27
|
+
children?: ChildrenFunction<TAddToCartButton>;
|
|
28
|
+
/**
|
|
29
|
+
* Disable the cart button
|
|
30
|
+
*/
|
|
28
31
|
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Label to display
|
|
34
|
+
*/
|
|
35
|
+
label?: string | JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* Line item which allow you customize the cart item
|
|
38
|
+
*/
|
|
39
|
+
lineItem?: CustomLineItem;
|
|
40
|
+
/**
|
|
41
|
+
* Line item option to add to cart
|
|
42
|
+
*/
|
|
43
|
+
lineItemOption?: LineItemOption;
|
|
44
|
+
/**
|
|
45
|
+
* Quantity of the item
|
|
46
|
+
*/
|
|
47
|
+
quantity?: string;
|
|
48
|
+
/**
|
|
49
|
+
* SKU code to add to cart
|
|
50
|
+
*/
|
|
51
|
+
skuCode?: string;
|
|
52
|
+
/**
|
|
53
|
+
* SKU list to add to cart
|
|
54
|
+
*/
|
|
29
55
|
skuListId?: string;
|
|
30
|
-
|
|
31
|
-
} & BuyNowMode & THostedCart & PropsWithoutRef<JSX.IntrinsicElements['button']>;
|
|
56
|
+
} & TButton & BuyNowMode & THostedCart;
|
|
32
57
|
export declare function AddToCartButton(props: Props): JSX.Element;
|
|
33
58
|
export default AddToCartButton;
|
|
@@ -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
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";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";import useCustomContext from"../../utils/hooks/useCustomContext";export function AddToCartButton(props){const{label="Add to cart",children,skuCode,bundleCode,skuListId,lineItem,buyNowMode=!1,checkoutUrl,redirectToHostedCart,hostedCartUrl,quantity,lineItemOption,...p}=props,{accessToken,endpoint}=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"AddToCartButton",key:"accessToken"}),{addToCart,orderId,getOrder,setOrderErrors}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"AddToCartButton",key:"addToCart"}),{url,callExternalFunction}=useContext(ExternalFunctionContext),{skuLists}=useContext(SkuListsContext),{sku}=useContext(SkuChildrenContext),[slug]=endpoint?endpoint.split(".commercelayer"):[""],sCode=sku?.code??skuCode,handleClick=async()=>{const qty=quantity!=null?parseInt(quantity):1;if(skuLists!=null&&skuListId&&url&&skuListId in skuLists){const lineItems=skuLists?.[skuListId]?.map(skuCode2=>({skuCode:skuCode2,quantity:qty,_update_quantity:1}));return await callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems}]}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}if(!url&&addToCart!=null){const res=await addToCart({bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl});if(redirectToHostedCart&&accessToken!=null){const orderId2=res?.orderId;hostedCartUrl&&orderId2?location.href=`https://${hostedCartUrl}/${orderId2}?accessToken=${accessToken}`:orderId2&&slug&&(location.href=getCartLink({orderId:orderId2,slug,accessToken}))}return res}else if(url)return await callExternalFunction({url,data:{bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))},parentProps={handleClick,label,...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{...p,onClick:()=>{handleClick()},children:label})}export default AddToCartButton;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
|
-
declare
|
|
3
|
+
export declare function AdjustmentAmount(props: BaseAmountComponent): JSX.Element;
|
|
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";export function AdjustmentAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"adjustment",...props})}export default AdjustmentAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import getCartLink from"../../utils/getCartLink";export function CartLink(props){const{label,children,...p}=props,{order,createOrder}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext),[slug]=endpoint
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import getCartLink from"../../utils/getCartLink";export function CartLink(props){const{label,children,...p}=props,{order,createOrder}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext),[slug]=endpoint?.split(".commercelayer")??"";if(accessToken==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");const href=slug&&order?.id?getCartLink({slug,orderId:order?.id,accessToken}):"",handleClick=async event=>{if(event.preventDefault(),order?.id)location.href=href;else{const orderId=await createOrder();slug&&(location.href=getCartLink({slug,orderId,accessToken}))}},parentProps={handleClick,label,href,...p};return accessToken?children?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,...p,onClick:e=>{handleClick(e)},children:label}):null}export default CartLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";export function CheckoutLink(props){const{label,hostedCheckout=!0,children,...p}=props,{order}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext)
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";export function CheckoutLink(props){const{label,hostedCheckout=!0,children,...p}=props,{order}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext);if(accessToken==null||endpoint==null)throw new Error("Cannot use `CheckoutLink` outside of `CommerceLayer`");const[slug]=endpoint.split(".commercelayer"),href=hostedCheckout&&slug&&order?.id?`${slug}.checkout.commercelayer.app/${order.id}?accessToken=${accessToken}`:order?.checkout_url,parentProps={checkoutUrl:order?.checkout_url,hostedCheckout,label,href,...p};return children?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,...p,children:label})}export default CheckoutLink;
|
|
@@ -1,18 +1,4 @@
|
|
|
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
|
-
}
|
|
18
4
|
export default DiscountAmount;
|
|
@@ -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";export function DiscountAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"discount",...props})}export default DiscountAmount;
|
|
@@ -1,15 +1,4 @@
|
|
|
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
|
-
}
|
|
15
4
|
export default GiftCardAmount;
|
|
@@ -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";export function GiftCardAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"gift_card",...props})}export default GiftCardAmount;
|
|
@@ -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=
|
|
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,addToCart}from"../../reducers/OrderReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext,{defaultOrderContext}from"../../context/OrderContext";import OrderStorageContext from"../../context/OrderStorageContext";import compareObjAttribute from"../../utils/compareObjAttribute";import useCustomContext from"../../utils/hooks/useCustomContext";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=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"OrderContainer"});if(config.accessToken==null)throw new Error("Cannot use `OrderContainer` outside of `CommerceLayer`");const{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:async id=>await getApiOrder({id,dispatch,config,state}),setOrderErrors:errors=>setOrderErrors({dispatch,errors}),createOrder:async()=>await createOrder({persistKey,dispatch,config,state,orderMetadata:metadata,orderAttributes:attributes,setLocalOrder}),addToCart:async params=>await addToCart({...params,persistKey,dispatch,state,config,errors:state.errors,orderMetadata:metadata||{},orderAttributes:attributes,setLocalOrder}),saveAddressToCustomerAddressBook:args=>defaultOrderContext.saveAddressToCustomerAddressBook({...args,dispatch}),setGiftCardOrCouponCode:async({code,codeType})=>await defaultOrderContext.setGiftCardOrCouponCode({code,codeType,dispatch,order:state.order,config,include:state.include,state}),removeGiftCardOrCouponCode:async({codeType})=>await 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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";export function PaymentMethodAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"payment_method",...props})}export default PaymentMethodAmount;
|
|
@@ -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
|
|
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,setPaymentMethodErrors}=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)&&paymentSource!=null){const paymentData=paymentSource?.payment_response?.paymentData,attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult},paymentData},_details:1};paymentData!=null&&setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode=res?.payment_response?.resultCode,errorCode=res?.payment_response?.errorCode,message=res?.payment_response?.message;["Authorised","Pending","Received"].includes(resultCode)?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}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?.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&&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,14 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { PlaceOrderOptions } from '../../reducers/PlaceOrderReducer';
|
|
3
|
-
|
|
3
|
+
interface Props {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
options?: PlaceOrderOptions;
|
|
6
|
-
};
|
|
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
6
|
}
|
|
7
|
+
export declare function PlaceOrderContainer(props: Props): JSX.Element;
|
|
14
8
|
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
|
|
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";import useCustomContext from"../../utils/hooks/useCustomContext";export function PlaceOrderContainer(props){const{children,options}=props,[state,dispatch]=useReducer(placeOrderReducer,placeOrderInitialState),{order,setOrder,setOrderErrors,include,addResourceToInclude,includeLoaded}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"PlaceOrderContainer",key:"order"}),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:async({paymentSource})=>await 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,10 +1,4 @@
|
|
|
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
|
-
}
|
|
10
4
|
export default PrivacyAndTermsCheckbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import
|
|
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.toString()),placeOrderPermitted&&placeOrderPermitted()};return useEffect(()=>(order?.privacy_url&&order?.terms_url&&setForceDisabled(!1),checked||localStorage.setItem(fieldName,checked.toString()),()=>{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,15 +1,4 @@
|
|
|
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
|
-
}
|
|
15
4
|
export default ShippingAmount;
|
|
@@ -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";export function ShippingAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"shipping",...props})}export default ShippingAmount;
|
|
@@ -1,18 +1,4 @@
|
|
|
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
|
-
}
|
|
18
4
|
export default SubTotalAmount;
|
|
@@ -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";export function SubTotalAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"subtotal",...props})}export default SubTotalAmount;
|
|
@@ -1,18 +1,4 @@
|
|
|
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
|
-
}
|
|
18
4
|
export default TaxesAmount;
|
|
@@ -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";export function TaxesAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"total_tax",...props})}export default TaxesAmount;
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent } from '../../typings/index';
|
|
3
3
|
export declare function TotalAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
|
-
export declare namespace TotalAmount {
|
|
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
|
-
}
|
|
18
4
|
export default TotalAmount;
|
|
@@ -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";export function TotalAmount(props){return _jsx(BaseOrderPrice,{base:"total_amount",type:"with_taxes",...props})}export default TotalAmount;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
import type { Parcel } from '@commercelayer/sdk';
|
|
4
|
+
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* Parcel of the current shipment
|
|
7
|
+
*/
|
|
8
|
+
parcel?: Parcel;
|
|
9
|
+
/**
|
|
10
|
+
* Quantity of the parcel line items
|
|
11
|
+
*/
|
|
12
|
+
quantity: number;
|
|
13
|
+
}
|
|
14
|
+
interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
|
|
15
|
+
children?: ChildrenFunction<ChildrenProps>;
|
|
16
|
+
}
|
|
17
|
+
export declare function ParcelLineItemsCount({ children, ...p }: Props): JSX.Element;
|
|
18
|
+
export default ParcelLineItemsCount;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import ParcelChildrenContext from"../../context/ParcelChildrenContext";import useCustomContext from"../../utils/hooks/useCustomContext";export function ParcelLineItemsCount({children,...p}){const{parcel}=useCustomContext({context:ParcelChildrenContext,contextComponentName:"Parcels",currentComponentName:"ParcelLineItemsCount",key:"parcel"}),quantity=parcel?.parcel_line_items?.length??0,childrenProps={...p,quantity,parcel};return children?_jsx(Parent,{...childrenProps,children}):_jsx("span",{...p,children:quantity})}export default ParcelLineItemsCount;
|