@commercelayer/react-components 2.53.3 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +3 -3
- package/lib/components/AdyenPayment.d.ts +3 -3
- package/lib/components/AdyenPayment.js +1 -1
- package/lib/components/AvailabilityContainer.d.ts +10 -3
- package/lib/components/AvailabilityContainer.js +1 -1
- package/lib/components/AvailabilityTemplate.d.ts +13 -4
- package/lib/components/AvailabilityTemplate.js +1 -1
- package/lib/components/BillingAddressContainer.d.ts +7 -2
- package/lib/components/BillingAddressContainer.js +1 -1
- package/lib/components/BillingAddressForm.d.ts +8 -3
- package/lib/components/BillingAddressForm.js +1 -1
- package/lib/components/BraintreePayment.d.ts +3 -3
- package/lib/components/BraintreePayment.js +1 -1
- package/lib/components/CheckoutComPayment.d.ts +23 -0
- package/lib/components/CheckoutComPayment.js +1 -0
- package/lib/components/CheckoutLink.d.ts +16 -4
- package/lib/components/CheckoutLink.js +1 -1
- package/lib/components/DeliveryLeadTime.d.ts +11 -4
- package/lib/components/DeliveryLeadTime.js +1 -1
- package/lib/components/DiscountAmount.d.ts +16 -2
- package/lib/components/DiscountAmount.js +1 -1
- package/lib/components/Errors.d.ts +4 -4
- package/lib/components/Errors.js +1 -1
- package/lib/components/ExternalFunction.d.ts +9 -2
- package/lib/components/ExternalFunction.js +1 -1
- package/lib/components/GiftCard.d.ts +13 -3
- package/lib/components/GiftCard.js +1 -1
- package/lib/components/GiftCardContainer.d.ts +9 -3
- package/lib/components/GiftCardContainer.js +1 -1
- package/lib/components/GiftCardCurrencySelector.d.ts +18 -3
- package/lib/components/GiftCardCurrencySelector.js +1 -1
- package/lib/components/GiftCardInput.d.ts +12 -3
- package/lib/components/GiftCardInput.js +1 -1
- package/lib/components/GiftCardOrCouponCode.d.ts +17 -6
- package/lib/components/GiftCardOrCouponCode.js +1 -1
- package/lib/components/GiftCardOrCouponForm.d.ts +9 -4
- package/lib/components/GiftCardOrCouponForm.js +1 -1
- package/lib/components/GiftCardOrCouponInput.d.ts +14 -3
- package/lib/components/GiftCardOrCouponInput.js +1 -1
- package/lib/components/GiftCardOrCouponRemoveButton.d.ts +15 -5
- package/lib/components/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/components/GiftCardOrCouponSubmit.d.ts +11 -4
- package/lib/components/GiftCardOrCouponSubmit.js +1 -1
- package/lib/components/ItemContainer.d.ts +14 -3
- package/lib/components/ItemContainer.js +1 -1
- package/lib/components/KlarnaPayment.d.ts +10 -0
- package/lib/components/KlarnaPayment.js +1 -0
- package/lib/components/LineItem.d.ts +10 -3
- package/lib/components/LineItem.js +1 -1
- package/lib/components/LineItemAmount.d.ts +16 -3
- package/lib/components/LineItemAmount.js +1 -1
- package/lib/components/LineItemCode.d.ts +10 -4
- package/lib/components/LineItemCode.js +1 -1
- package/lib/components/LineItemImage.d.ts +11 -4
- package/lib/components/LineItemImage.js +1 -1
- package/lib/components/LineItemName.d.ts +11 -5
- package/lib/components/LineItemName.js +1 -1
- package/lib/components/LineItemOption.d.ts +15 -4
- package/lib/components/LineItemOption.js +1 -1
- package/lib/components/LineItemOptions.d.ts +8 -3
- package/lib/components/LineItemOptions.js +1 -1
- package/lib/components/LineItemQuantity.d.ts +16 -4
- package/lib/components/LineItemQuantity.js +1 -1
- package/lib/components/LineItemRemoveLink.d.ts +15 -5
- package/lib/components/LineItemRemoveLink.js +1 -1
- package/lib/components/LineItemsContainer.d.ts +15 -3
- package/lib/components/LineItemsContainer.js +1 -1
- package/lib/components/LineItemsCount.d.ts +14 -4
- package/lib/components/LineItemsCount.js +1 -1
- package/lib/components/LineItemsEmpty.d.ts +13 -2
- package/lib/components/LineItemsEmpty.js +1 -1
- package/lib/components/MetadataInput.d.ts +13 -3
- package/lib/components/MetadataInput.js +1 -1
- package/lib/components/PaymentGateway.d.ts +4 -4
- package/lib/components/PaymentGateway.js +1 -1
- package/lib/components/PaymentMethod.d.ts +9 -3
- package/lib/components/PaymentMethod.js +1 -1
- package/lib/components/PaymentMethodAmount.d.ts +16 -2
- package/lib/components/PaymentMethodAmount.js +1 -1
- package/lib/components/PaymentMethodName.d.ts +10 -4
- package/lib/components/PaymentMethodName.js +1 -1
- package/lib/components/PaymentMethodPrice.d.ts +15 -4
- package/lib/components/PaymentMethodPrice.js +1 -1
- package/lib/components/PaymentMethodRadioButton.d.ts +11 -4
- package/lib/components/PaymentMethodRadioButton.js +1 -1
- package/lib/components/PaymentMethodsContainer.d.ts +9 -3
- package/lib/components/PaymentMethodsContainer.js +1 -1
- package/lib/components/PaymentSource.d.ts +9 -2
- package/lib/components/PaymentSource.js +1 -1
- package/lib/components/PaymentSourceBrandIcon.d.ts +14 -4
- package/lib/components/PaymentSourceBrandIcon.js +1 -1
- package/lib/components/PaymentSourceBrandName.d.ts +11 -4
- package/lib/components/PaymentSourceBrandName.js +1 -1
- package/lib/components/PaymentSourceDetail.d.ts +8 -2
- package/lib/components/PaymentSourceDetail.js +1 -1
- package/lib/components/PaymentSourceEditButton.d.ts +9 -2
- package/lib/components/PaymentSourceEditButton.js +1 -1
- package/lib/components/PaypalPayment.d.ts +2 -2
- package/lib/components/PaypalPayment.js +1 -1
- package/lib/components/Price.d.ts +15 -3
- package/lib/components/Price.js +1 -1
- package/lib/components/PricesContainer.d.ts +19 -3
- package/lib/components/PricesContainer.js +1 -1
- package/lib/components/QuantitySelector.d.ts +19 -5
- package/lib/components/QuantitySelector.js +1 -1
- package/lib/components/SaveAddressesButton.d.ts +18 -5
- package/lib/components/SaveAddressesButton.js +1 -1
- package/lib/components/SaveCustomerButton.d.ts +16 -5
- package/lib/components/SaveCustomerButton.js +1 -1
- package/lib/components/Shipment.d.ts +9 -2
- package/lib/components/Shipment.js +1 -1
- package/lib/components/ShipmentField.d.ts +11 -4
- package/lib/components/ShipmentField.js +1 -1
- package/lib/components/ShipmentsContainer.d.ts +9 -3
- package/lib/components/ShipmentsContainer.js +1 -1
- package/lib/components/ShippingAddressContainer.d.ts +7 -2
- package/lib/components/ShippingAddressContainer.js +1 -1
- package/lib/components/ShippingAddressForm.d.ts +8 -3
- package/lib/components/ShippingAddressForm.js +1 -1
- package/lib/components/ShippingAmount.d.ts +13 -2
- package/lib/components/ShippingAmount.js +1 -1
- package/lib/components/ShippingMethod.d.ts +10 -3
- package/lib/components/ShippingMethod.js +1 -1
- package/lib/components/ShippingMethodName.d.ts +11 -5
- package/lib/components/ShippingMethodName.js +1 -1
- package/lib/components/ShippingMethodPrice.d.ts +15 -3
- package/lib/components/ShippingMethodPrice.js +1 -1
- package/lib/components/ShippingMethodRadioButton.d.ts +11 -5
- package/lib/components/ShippingMethodRadioButton.js +1 -1
- package/lib/components/StockTransfer.d.ts +9 -3
- package/lib/components/StockTransfer.js +1 -1
- package/lib/components/StockTransferField.d.ts +9 -8
- package/lib/components/StockTransferField.js +1 -1
- package/lib/components/StripePayment.d.ts +3 -3
- package/lib/components/StripePayment.js +1 -1
- package/lib/components/SubmitButton.d.ts +15 -5
- package/lib/components/SubmitButton.js +1 -1
- package/lib/components/VariantSelector.d.ts +28 -5
- package/lib/components/VariantSelector.js +1 -1
- package/lib/components/VariantsContainer.d.ts +15 -3
- package/lib/components/VariantsContainer.js +1 -1
- package/lib/components/WireTransferPayment.d.ts +2 -2
- package/lib/components/WireTransferPayment.js +1 -1
- package/lib/components/addresses/Address.d.ts +18 -0
- package/lib/components/addresses/Address.js +1 -0
- package/lib/components/addresses/AddressCountrySelector.d.ts +26 -0
- package/lib/components/addresses/AddressCountrySelector.js +1 -0
- package/lib/components/addresses/AddressField.d.ts +43 -0
- package/lib/components/addresses/AddressField.js +1 -0
- package/lib/components/addresses/AddressInput.d.ts +19 -0
- package/lib/components/addresses/AddressInput.js +1 -0
- package/lib/components/addresses/AddressStateSelector.d.ts +27 -0
- package/lib/components/addresses/AddressStateSelector.js +1 -0
- package/lib/components/addresses/AddressesContainer.d.ts +15 -0
- package/lib/components/addresses/AddressesContainer.js +1 -0
- package/lib/components/auth/CommerceLayer.d.ts +15 -0
- package/lib/components/auth/CommerceLayer.js +1 -0
- package/lib/components/customers/CustomerAddressForm.d.ts +13 -0
- package/lib/components/customers/CustomerAddressForm.js +1 -0
- package/lib/components/customers/CustomerContainer.d.ts +17 -0
- package/lib/components/customers/CustomerContainer.js +1 -0
- package/lib/components/customers/CustomerField.d.ts +10 -0
- package/lib/components/customers/CustomerField.js +1 -0
- package/lib/components/customers/CustomerInput.d.ts +23 -0
- package/lib/components/customers/CustomerInput.js +1 -0
- package/lib/components/gateways/AdyenGateway.d.ts +2 -2
- package/lib/components/gateways/AdyenGateway.js +1 -1
- package/lib/components/gateways/BraintreeGateway.d.ts +2 -2
- package/lib/components/gateways/BraintreeGateway.js +1 -1
- package/lib/components/gateways/CheckoutComGateway.d.ts +5 -0
- package/lib/components/gateways/CheckoutComGateway.js +1 -0
- package/lib/components/gateways/KlarnaGateway.d.ts +5 -0
- package/lib/components/gateways/KlarnaGateway.js +1 -0
- package/lib/components/gateways/PaypalGateway.d.ts +3 -3
- package/lib/components/gateways/PaypalGateway.js +1 -1
- package/lib/components/gateways/StripeGateway.d.ts +2 -2
- package/lib/components/gateways/StripeGateway.js +1 -1
- package/lib/components/gateways/WireTransferGateway.d.ts +2 -2
- package/lib/components/gateways/WireTransferGateway.js +1 -1
- package/lib/components/orders/AddToCartButton.d.ts +34 -0
- package/lib/components/orders/AddToCartButton.js +1 -0
- package/lib/components/orders/AdjustmentAmount.d.ts +18 -0
- package/lib/components/orders/AdjustmentAmount.js +1 -0
- package/lib/components/orders/CartLink.d.ts +12 -0
- package/lib/components/orders/CartLink.js +1 -0
- package/lib/components/orders/GiftCardAmount.d.ts +15 -0
- package/lib/components/orders/GiftCardAmount.js +1 -0
- package/lib/components/orders/OrderContainer.d.ts +26 -0
- package/lib/components/orders/OrderContainer.js +1 -0
- package/lib/components/orders/OrderList.d.ts +61 -0
- package/lib/components/orders/OrderList.js +1 -0
- package/lib/components/orders/OrderListRow.d.ts +30 -0
- package/lib/components/orders/OrderListRow.js +1 -0
- package/lib/components/orders/OrderNumber.d.ts +11 -0
- package/lib/components/orders/OrderNumber.js +1 -0
- package/lib/components/orders/OrderStorage.d.ts +16 -0
- package/lib/components/orders/OrderStorage.js +1 -0
- package/lib/components/orders/PlaceOrderButton.d.ts +24 -0
- package/lib/components/orders/PlaceOrderButton.js +1 -0
- package/lib/components/orders/PlaceOrderContainer.d.ts +14 -0
- package/lib/components/orders/PlaceOrderContainer.js +1 -0
- package/lib/components/orders/PrivacyAndTermsCheckbox.d.ts +10 -0
- package/lib/components/orders/PrivacyAndTermsCheckbox.js +1 -0
- package/lib/components/orders/SubTotalAmount.d.ts +18 -0
- package/lib/components/orders/SubTotalAmount.js +1 -0
- package/lib/components/orders/TaxesAmount.d.ts +18 -0
- package/lib/components/orders/TaxesAmount.js +1 -0
- package/lib/components/orders/TotalAmount.d.ts +18 -0
- package/lib/components/orders/TotalAmount.js +1 -0
- package/lib/components/skus/SkuField.d.ts +14 -0
- package/lib/components/skus/SkuField.js +1 -0
- package/lib/components/skus/SkuList.d.ts +14 -0
- package/lib/components/skus/SkuList.js +1 -0
- package/lib/components/skus/SkuListsContainer.d.ts +12 -0
- package/lib/components/skus/SkuListsContainer.js +1 -0
- package/lib/components/skus/SkuOption.d.ts +14 -0
- package/lib/components/skus/SkuOption.js +1 -0
- package/lib/components/skus/SkuOptionInput.d.ts +15 -0
- package/lib/components/skus/SkuOptionInput.js +1 -0
- package/lib/components/skus/SkuOptionsContainer.d.ts +14 -0
- package/lib/components/skus/SkuOptionsContainer.js +1 -0
- package/lib/components/skus/Skus.d.ts +11 -0
- package/lib/components/skus/Skus.js +1 -0
- package/lib/components/skus/SkusContainer.d.ts +23 -0
- package/lib/components/skus/SkusContainer.js +1 -0
- package/lib/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/components/utils/BaseField.js +1 -1
- package/lib/components/utils/BaseInput.d.ts +1 -1
- package/lib/components/utils/BaseInput.js +1 -1
- package/lib/components/utils/BaseOrderPrice.js +1 -1
- package/lib/components/utils/BaseSelect.js +1 -1
- package/lib/components/utils/GenericFieldComponent.d.ts +42 -0
- package/lib/components/utils/GenericFieldComponent.js +1 -0
- package/lib/components/utils/Parent.d.ts +3 -5
- package/lib/components/utils/Parent.js +1 -1
- package/lib/components/utils/PaymentCardsTemplate.d.ts +2 -2
- package/lib/components/utils/PaymentCardsTemplate.js +1 -1
- package/lib/components/utils/PriceTemplate.d.ts +2 -2
- package/lib/components/utils/PriceTemplate.js +1 -1
- package/lib/components/utils/VariantTemplate.js +1 -1
- package/lib/components/utils/getAllErrors.js +1 -1
- package/lib/config/components.d.ts +77 -35
- package/lib/config/components.js +1 -1
- package/lib/context/AddressChildrenContext.d.ts +1 -1
- package/lib/context/AddressChildrenContext.js +1 -1
- package/lib/context/AddressContext.d.ts +1 -1
- package/lib/context/BillingAddressContext.d.ts +2 -4
- package/lib/context/BillingAddressContext.js +1 -1
- package/lib/context/BillingAddressFormContext.d.ts +17 -10
- package/lib/context/CouponAndGiftCardFormContext.d.ts +2 -0
- package/lib/context/CustomerAddressFormContext.d.ts +20 -0
- package/lib/context/CustomerAddressFormContext.js +1 -0
- package/lib/context/CustomerContext.d.ts +17 -11
- package/lib/context/CustomerContext.js +1 -1
- package/lib/context/OrderContext.d.ts +8 -4
- package/lib/context/OrderContext.js +1 -1
- package/lib/context/OrderListChildrenContext.d.ts +60 -0
- package/lib/context/OrderListChildrenContext.js +1 -0
- package/lib/context/PaymentSourceContext.d.ts +4 -4
- package/lib/context/PlaceOrderContext.d.ts +4 -2
- package/lib/context/ShippingAddressContext.d.ts +1 -1
- package/lib/context/SkuChildrenContext.d.ts +9 -0
- package/lib/context/SkuChildrenContext.js +1 -0
- package/lib/context/SkuContext.d.ts +9 -0
- package/lib/context/SkuContext.js +1 -0
- package/lib/index.d.ts +101 -90
- package/lib/index.js +1 -1
- package/lib/reducers/AddressReducer.d.ts +4 -2
- package/lib/reducers/AddressReducer.js +1 -1
- package/lib/reducers/AvailabilityReducer.d.ts +8 -0
- package/lib/reducers/AvailabilityReducer.js +1 -1
- package/lib/reducers/BillingAddressReducer.js +1 -1
- package/lib/reducers/CustomerReducer.d.ts +98 -17
- package/lib/reducers/CustomerReducer.js +1 -1
- package/lib/reducers/GiftCardReducer.js +1 -1
- package/lib/reducers/LineItemReducer.js +1 -1
- package/lib/reducers/OrderReducer.d.ts +24 -8
- package/lib/reducers/OrderReducer.js +1 -1
- package/lib/reducers/PaymentMethodReducer.d.ts +51 -5
- package/lib/reducers/PaymentMethodReducer.js +1 -1
- package/lib/reducers/PlaceOrderReducer.d.ts +9 -2
- package/lib/reducers/PlaceOrderReducer.js +1 -1
- package/lib/reducers/ShipmentReducer.js +1 -1
- package/lib/reducers/ShippingAddressReducer.js +1 -1
- package/lib/reducers/SkuReducer.d.ts +21 -0
- package/lib/reducers/SkuReducer.js +1 -0
- package/lib/reducers/VariantReducer.d.ts +1 -0
- package/lib/reducers/VariantReducer.js +1 -1
- package/lib/typings/errors.d.ts +13 -4
- package/lib/typings/errors.js +1 -1
- package/lib/typings/index.d.ts +17 -6
- package/lib/utils/addressesManager.d.ts +1 -1
- package/lib/utils/addressesManager.js +1 -1
- package/lib/utils/checkIncludeResource.d.ts +8 -0
- package/lib/utils/checkIncludeResource.js +1 -0
- package/lib/utils/childrenTypes.d.ts +1 -1
- package/lib/utils/childrenTypes.js +1 -1
- package/lib/utils/compareObjAttribute.d.ts +7 -0
- package/lib/utils/compareObjAttribute.js +1 -0
- package/lib/utils/customMessages.d.ts +1 -7
- package/lib/utils/customMessages.js +1 -1
- package/lib/utils/getCardDetails.d.ts +15 -0
- package/lib/utils/getCardDetails.js +1 -0
- package/lib/utils/getCartLink.d.ts +7 -0
- package/lib/utils/getCartLink.js +1 -0
- package/lib/utils/getCurrentItemKey.js +1 -1
- package/lib/utils/getErrors.d.ts +1 -1
- package/lib/utils/getErrors.js +1 -1
- package/lib/utils/getLineItemsCount.d.ts +8 -10
- package/lib/utils/getLineItemsCount.js +1 -1
- package/lib/utils/getLoaderComponent.js +1 -1
- package/lib/utils/getPrices.js +1 -1
- package/lib/utils/getSkus.js +1 -1
- package/lib/utils/hooks/useExternalScript.d.ts +1 -0
- package/lib/utils/hooks/useExternalScript.js +1 -0
- package/lib/utils/icons.d.ts +3 -0
- package/lib/utils/icons.js +1 -0
- package/lib/utils/isDate.d.ts +1 -0
- package/lib/utils/isDate.js +1 -0
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/placeholderImages.d.ts +2 -0
- package/lib/utils/placeholderImages.js +1 -0
- package/lib/utils/promisify.js +1 -1
- package/lib/utils/scrollbarWidth.d.ts +1 -0
- package/lib/utils/scrollbarWidth.js +1 -0
- package/lib/utils/shipments.d.ts +2 -1
- package/lib/utils/shipments.js +1 -1
- package/lib/utils/validateFormFields.d.ts +2 -0
- package/lib/utils/validateFormFields.js +1 -1
- package/package.json +96 -93
- package/lib/components/AddToCartButton.d.ts +0 -20
- package/lib/components/AddToCartButton.js +0 -1
- package/lib/components/Address.d.ts +0 -13
- package/lib/components/Address.js +0 -1
- package/lib/components/AddressCountrySelector.d.ts +0 -9
- package/lib/components/AddressCountrySelector.js +0 -1
- package/lib/components/AddressField.d.ts +0 -15
- package/lib/components/AddressField.js +0 -1
- package/lib/components/AddressInput.d.ts +0 -7
- package/lib/components/AddressInput.js +0 -1
- package/lib/components/AddressStateSelector.d.ts +0 -11
- package/lib/components/AddressStateSelector.js +0 -1
- package/lib/components/AddressesContainer.d.ts +0 -7
- package/lib/components/AddressesContainer.js +0 -1
- package/lib/components/AdjustmentAmount.d.ts +0 -4
- package/lib/components/AdjustmentAmount.js +0 -1
- package/lib/components/CommerceLayer.d.ts +0 -8
- package/lib/components/CommerceLayer.js +0 -1
- package/lib/components/CustomerContainer.d.ts +0 -7
- package/lib/components/CustomerContainer.js +0 -1
- package/lib/components/CustomerInput.d.ts +0 -11
- package/lib/components/CustomerInput.js +0 -1
- package/lib/components/GiftCardAmount.d.ts +0 -4
- package/lib/components/GiftCardAmount.js +0 -1
- package/lib/components/OrderContainer.d.ts +0 -11
- package/lib/components/OrderContainer.js +0 -1
- package/lib/components/OrderNumber.d.ts +0 -5
- package/lib/components/OrderNumber.js +0 -1
- package/lib/components/OrderStorage.d.ts +0 -8
- package/lib/components/OrderStorage.js +0 -1
- package/lib/components/PlaceOrderButton.d.ts +0 -12
- package/lib/components/PlaceOrderButton.js +0 -1
- package/lib/components/PlaceOrderContainer.d.ts +0 -8
- package/lib/components/PlaceOrderContainer.js +0 -1
- package/lib/components/PrivacyAndTermsCheckbox.d.ts +0 -4
- package/lib/components/PrivacyAndTermsCheckbox.js +0 -1
- package/lib/components/SkuList.d.ts +0 -7
- package/lib/components/SkuList.js +0 -1
- package/lib/components/SkuListsContainer.d.ts +0 -6
- package/lib/components/SkuListsContainer.js +0 -1
- package/lib/components/SkuOption.d.ts +0 -7
- package/lib/components/SkuOption.js +0 -1
- package/lib/components/SkuOptionInput.d.ts +0 -5
- package/lib/components/SkuOptionInput.js +0 -1
- package/lib/components/SkuOptionsContainer.d.ts +0 -7
- package/lib/components/SkuOptionsContainer.js +0 -1
- package/lib/components/SubTotalAmount.d.ts +0 -4
- package/lib/components/SubTotalAmount.js +0 -1
- package/lib/components/TaxesAmount.d.ts +0 -4
- package/lib/components/TaxesAmount.js +0 -1
- package/lib/components/TotalAmount.d.ts +0 -4
- package/lib/components/TotalAmount.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.GiftCardInput.propTypes,displayName=components.GiftCardInput.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.GiftCardInput.propTypes,displayName=components.GiftCardInput.displayName;export function GiftCardInput(props){const{placeholder=""}=props,p=__rest(props,["placeholder"]);return _jsx(BaseInput,Object.assign({placeholder},p))}GiftCardInput.propTypes=propTypes,GiftCardInput.displayName=displayName;export default GiftCardInput;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
|
-
import { CodeType } from '../reducers/OrderReducer';
|
|
4
|
-
declare type
|
|
3
|
+
import type { CodeType } from '../reducers/OrderReducer';
|
|
4
|
+
declare type ChildrenProps = Omit<Props, 'children'> & {
|
|
5
5
|
code?: string;
|
|
6
6
|
hide?: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
discountAmountCents?: string;
|
|
8
|
+
discountAmountFloat?: string;
|
|
9
|
+
formattedDiscountAmount?: string;
|
|
10
|
+
};
|
|
11
|
+
declare type GiftCardOrCouponCodeChildrenProps = FunctionChildren<ChildrenProps>;
|
|
12
|
+
declare type Props = {
|
|
9
13
|
type?: CodeType;
|
|
10
14
|
children?: GiftCardOrCouponCodeChildrenProps;
|
|
11
15
|
} & JSX.IntrinsicElements['span'];
|
|
12
|
-
declare
|
|
16
|
+
export declare function GiftCardOrCouponCode({ children, type, ...props }: Props): JSX.Element | null;
|
|
17
|
+
export declare namespace GiftCardOrCouponCode {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
20
|
+
type: import("prop-types").Requireable<CodeType>;
|
|
21
|
+
};
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
13
24
|
export default GiftCardOrCouponCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import has from"lodash/has";import isEmpty from"lodash/isEmpty";const propTypes=components.GiftCardOrCouponCode.propTypes,displayName=components.GiftCardOrCouponCode.displayName;export function GiftCardOrCouponCode(_a){var{children,type}=_a,props=__rest(_a,["children","type"]);const{order}=useContext(OrderContext);let codeType=type&&`${type}_code`;!type&&order&&has(order,"coupon_code")&&!isEmpty(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),parentProps=Object.assign(Object.assign({},props),{code,hide,discountAmountCents:order?.discount_amount_cents,discountAmountFloat:order?.discount_amount_float,formattedDiscountAmount:order?.formatted_discount_amount});return children?_jsx(Parent,Object.assign({},parentProps,{children})):hide?null:_jsx("span",Object.assign({},props,{children:code}))}GiftCardOrCouponCode.propTypes=propTypes,GiftCardOrCouponCode.displayName=displayName;export default GiftCardOrCouponCode;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare type
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
reset?: boolean;
|
|
5
4
|
onSubmit?: (response: {
|
|
6
5
|
success: boolean;
|
|
6
|
+
value: string;
|
|
7
7
|
}) => void;
|
|
8
8
|
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
9
|
-
declare
|
|
9
|
+
export declare function GiftCardOrCouponForm(props: Props): JSX.Element | null;
|
|
10
|
+
export declare namespace GiftCardOrCouponForm {
|
|
11
|
+
var propTypes: {
|
|
12
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
10
15
|
export default GiftCardOrCouponForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";import OrderContext from"../context/OrderContext";import isEmpty from"lodash/isEmpty";import components from"../config/components";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";const propTypes=components.GiftCardOrCouponForm.propTypes
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef,useState}from"react";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";import OrderContext from"../context/OrderContext";import isEmpty from"lodash/isEmpty";import components from"../config/components";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";const propTypes=components.GiftCardOrCouponForm.propTypes;export function GiftCardOrCouponForm(props){const{children,autoComplete="on",onSubmit}=props,p=__rest(props,["children","autoComplete","onSubmit"]),{validation,values,reset}=useRapidForm(),[codeType,setCodeType]=useState("gift_card_or_coupon_code"),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=useContext(OrderContext),ref=useRef(null),inputName="gift_card_or_coupon_code";useEffect(()=>{var _a,_b,_c,_d;if(((_a=values[inputName])===null||_a===void 0?void 0:_a.value)===""&&findIndex(errors,{field:camelCase(inputName)})!==-1){const err=dropWhile(errors,i=>i.field===camelCase(inputName));setOrderErrors(err),onSubmit&&onSubmit({value:(_b=values[inputName])===null||_b===void 0?void 0:_b.value,success:!1})}((_c=values[inputName])===null||_c===void 0?void 0:_c.value)===""&&(setOrderErrors([]),onSubmit&&onSubmit({value:(_d=values[inputName])===null||_d===void 0?void 0:_d.value,success:!1}))},[values]),useEffect(()=>{order?.gift_card_code&&!order?.coupon_code&&setCodeType("coupon_code"),!order?.gift_card_code&&order?.coupon_code&&setCodeType("gift_card_code"),!order?.gift_card_code&&!order?.coupon_code&&setCodeType("gift_card_or_coupon_code")},[order]);const handleSubmit=async e=>{var _a;e.preventDefault();const code=has(values,inputName)?values[inputName].value:void 0;if(code){const{success}=await setGiftCardOrCouponCode({code,codeType}),value=(_a=values[inputName])===null||_a===void 0?void 0:_a.value;onSubmit&&onSubmit({success,value}),success&&reset(e)}};return order?.gift_card_code&&order?.coupon_code||isEmpty(order)?null:_jsx(CouponAndGiftCardFormContext.Provider,Object.assign({value:{validation,codeType}},{children:_jsx("form",Object.assign({ref,autoComplete,onSubmit:handleSubmit},p,{children}))}))}GiftCardOrCouponForm.propTypes=propTypes;export default GiftCardOrCouponForm;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BaseInputComponentProps } from '../typings/index';
|
|
3
|
-
|
|
3
|
+
import { OrderCodeType } from '../reducers/OrderReducer';
|
|
4
|
+
declare type Props = {
|
|
4
5
|
name?: 'gift_card_or_coupon_code';
|
|
5
6
|
type?: 'text';
|
|
7
|
+
placeholderTranslation?: (codeType: OrderCodeType) => string;
|
|
6
8
|
} & Omit<BaseInputComponentProps, 'name' | 'type'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
7
|
-
declare
|
|
9
|
+
export declare function GiftCardOrCouponInput(props: Props): JSX.Element;
|
|
10
|
+
export declare namespace GiftCardOrCouponInput {
|
|
11
|
+
var propTypes: {
|
|
12
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
13
|
+
placeholder: import("prop-types").Requireable<string>;
|
|
14
|
+
disabled: import("prop-types").Requireable<boolean>;
|
|
15
|
+
required: import("prop-types").Requireable<boolean>;
|
|
16
|
+
};
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
8
19
|
export default GiftCardOrCouponInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import BaseInput from"./utils/BaseInput";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";const propTypes=components.GiftCardOrCouponInput.propTypes,displayName=components.GiftCardOrCouponInput.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import BaseInput from"./utils/BaseInput";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";const propTypes=components.GiftCardOrCouponInput.propTypes,displayName=components.GiftCardOrCouponInput.displayName;export function GiftCardOrCouponInput(props){const{placeholder="",required,value,placeholderTranslation}=props,p=__rest(props,["placeholder","required","value","placeholderTranslation"]),{validation,codeType}=useContext(CouponAndGiftCardFormContext);let placeholderLabel=placeholder;return placeholderTranslation&&codeType&&(placeholderLabel=placeholderTranslation(codeType)),_jsx(BaseInput,Object.assign({type:"text",name:"gift_card_or_coupon_code",ref:validation,required:required!==void 0?required:!0,placeholder:placeholderLabel,defaultValue:value},p))}GiftCardOrCouponInput.propTypes=propTypes,GiftCardOrCouponInput.displayName=displayName;export default GiftCardOrCouponInput;
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
3
|
import { CodeType, OrderCodeType } from '../reducers/OrderReducer';
|
|
4
|
-
declare type GiftCardOrCouponRemoveButtonChildrenProps = FunctionChildren<Omit<
|
|
4
|
+
declare type GiftCardOrCouponRemoveButtonChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
|
|
5
5
|
codeType?: OrderCodeType;
|
|
6
6
|
hide?: boolean;
|
|
7
7
|
handleClick?: () => void;
|
|
8
8
|
}>;
|
|
9
|
-
declare type
|
|
9
|
+
declare type Props = {
|
|
10
10
|
type?: CodeType;
|
|
11
11
|
children?: GiftCardOrCouponRemoveButtonChildrenProps;
|
|
12
12
|
label?: string | ReactNode;
|
|
13
|
-
onClick?: (
|
|
13
|
+
onClick?: (response: {
|
|
14
|
+
success: boolean;
|
|
15
|
+
}) => void;
|
|
14
16
|
} & Omit<JSX.IntrinsicElements['button'], 'type'>;
|
|
15
|
-
declare
|
|
17
|
+
export declare function GiftCardOrCouponRemoveButton(props: Props): JSX.Element | null;
|
|
18
|
+
export declare namespace GiftCardOrCouponRemoveButton {
|
|
19
|
+
var propTypes: {
|
|
20
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
21
|
+
type: import("prop-types").Requireable<CodeType>;
|
|
22
|
+
label: import("prop-types").Requireable<string | object>;
|
|
23
|
+
};
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
16
26
|
export default GiftCardOrCouponRemoveButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponRemoveButton.propTypes,displayName=components.GiftCardOrCouponRemoveButton.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponRemoveButton.propTypes,displayName=components.GiftCardOrCouponRemoveButton.displayName;export function GiftCardOrCouponRemoveButton(props){const{children,label="Remove",onClick,type}=props,p=__rest(props,["children","label","onClick","type"]),{order,removeGiftCardOrCouponCode}=useContext(OrderContext);let codeType=`${type}_code`;!type&&order&&has(order,"coupon_code")&&!isEmpty(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),handleClick=async()=>{const response=removeGiftCardOrCouponCode&&await removeGiftCardOrCouponCode({codeType});onClick&&onClick(response)},parentProps=Object.assign(Object.assign({},p),{label,handleClick,codeType});return children?_jsx(Parent,Object.assign({},parentProps,{children})):hide?null:_jsx("button",Object.assign({type:"button",onClick:handleClick},p,{children:label}))}GiftCardOrCouponRemoveButton.propTypes=propTypes,GiftCardOrCouponRemoveButton.displayName=displayName;export default GiftCardOrCouponRemoveButton;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
|
-
declare type GiftCardOrCouponSubmitChildrenProps = FunctionChildren<Omit<
|
|
4
|
-
declare type
|
|
3
|
+
declare type GiftCardOrCouponSubmitChildrenProps = FunctionChildren<Omit<Props, 'children'>>;
|
|
4
|
+
declare type Props = {
|
|
5
5
|
children?: GiftCardOrCouponSubmitChildrenProps;
|
|
6
6
|
label?: string | ReactNode;
|
|
7
7
|
} & JSX.IntrinsicElements['button'];
|
|
8
|
-
declare
|
|
8
|
+
export declare function GiftCardOrCouponSubmit(props: Props): JSX.Element;
|
|
9
|
+
export declare namespace GiftCardOrCouponSubmit {
|
|
10
|
+
var propTypes: {
|
|
11
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
12
|
+
label: import("prop-types").Requireable<string | object>;
|
|
13
|
+
};
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
9
16
|
export default GiftCardOrCouponSubmit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.GiftCardOrCouponSubmit.propTypes,displayName=components.GiftCardOrCouponSubmit.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.GiftCardOrCouponSubmit.propTypes,displayName=components.GiftCardOrCouponSubmit.displayName;export function GiftCardOrCouponSubmit(props){const{children,label="Submit"}=props,p=__rest(props,["children","label"]),parentProps=Object.assign(Object.assign({},p),{label});return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({type:"submit"},p,{children:label}))}GiftCardOrCouponSubmit.propTypes=propTypes,GiftCardOrCouponSubmit.displayName=displayName;export default GiftCardOrCouponSubmit;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare type
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
skuCode?: string | null;
|
|
5
5
|
lineItem?: {
|
|
@@ -7,5 +7,16 @@ declare type ItemContainerProps = {
|
|
|
7
7
|
imageUrl?: string | null;
|
|
8
8
|
} | null;
|
|
9
9
|
};
|
|
10
|
-
declare
|
|
10
|
+
export declare function ItemContainer(props: Props): JSX.Element;
|
|
11
|
+
export declare namespace ItemContainer {
|
|
12
|
+
var propTypes: {
|
|
13
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
14
|
+
skuCode: import("prop-types").Requireable<string>;
|
|
15
|
+
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";import components from"../config/components";const propTypes=components.ItemContainer.propTypes,displayName=components.ItemContainer.displayName
|
|
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 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),itemValue=Object.assign(Object.assign(Object.assign({},initialItemContext),state),{setItems,setItem,setQuantity,setOption,setPrices,setCustomLineItems,setSkuCode});return _jsx(ItemContext.Provider,Object.assign({value:itemValue},{children}))}ItemContainer.propTypes=propTypes,ItemContainer.displayName=displayName;export default ItemContainer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaymentMethodConfig } from '../reducers/PaymentMethodReducer';
|
|
3
|
+
import { PaymentSourceProps } from './PaymentSource';
|
|
4
|
+
declare type KlarnaPaymentProps = PaymentMethodConfig['klarnaPayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
|
|
5
|
+
show?: boolean;
|
|
6
|
+
clientToken: string;
|
|
7
|
+
locale?: string;
|
|
8
|
+
};
|
|
9
|
+
export default function KlarnaPayment({ clientToken, placeOrderCallback, locale, ...p }: KlarnaPaymentProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import OrderContext from"../context/OrderContext";import useExternalScript from"../utils/hooks/useExternalScript";import PlaceOrderContext from"../context/PlaceOrderContext";function typeOfLine(lineItemType){switch(lineItemType){case"payment_methods":default:return null;case"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical"}}function klarnaOrderLines(lineItems){return lineItems?lineItems.map(item=>{const type=item.item_type?typeOfLine(item.item_type):null;return{name:item.name,quantity:item.quantity,total_amount:item.total_amount_cents,unit_price:item.unit_amount_cents,type}}):[]}export default function KlarnaPayment(_a){var _b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,{clientToken,placeOrderCallback,locale="EN"}=_a,p=__rest(_a,["clientToken","placeOrderCallback","locale"]);const ref=useRef(null),{paymentSource,currentPaymentMethodType,setPaymentRef,setPaymentSource,setPaymentMethodErrors}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{setPlaceOrder}=useContext(PlaceOrderContext),loaded=useExternalScript("https://x.klarnacdn.net/kp/lib/v1/api.js"),[klarna,setKlarna]=useState(),{containerClassName}=p,divProps=__rest(p,["containerClassName"]);useEffect(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),useEffect(()=>(ref.current&&paymentSource&¤tPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=()=>handleClick(klarna),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=async kl=>{var _a2,_b2,_c2,_d2,_e2,_f2,_g2,_h2,_j2,_k2,_l2,_m2,_o2,_p2,_q2,_r2;const[first]=paymentSource?.payment_methods||void 0,payment_method_category=first?.identifier,billing_address={given_name:(_a2=order?.billing_address)===null||_a2===void 0?void 0:_a2.first_name,family_name:(_b2=order?.billing_address)===null||_b2===void 0?void 0:_b2.last_name,email:order?.customer_email,street_address:(_c2=order?.billing_address)===null||_c2===void 0?void 0:_c2.line_1,street_address2:null,organization_name:null,postal_code:(_d2=order?.billing_address)===null||_d2===void 0?void 0:_d2.zip_code,city:(_e2=order?.billing_address)===null||_e2===void 0?void 0:_e2.city,region:(_f2=order?.billing_address)===null||_f2===void 0?void 0:_f2.state_code,phone:(_g2=order?.billing_address)===null||_g2===void 0?void 0:_g2.phone,country:(_h2=order?.billing_address)===null||_h2===void 0?void 0:_h2.country_code},shipping_address={given_name:(_j2=order?.shipping_address)===null||_j2===void 0?void 0:_j2.first_name,family_name:(_k2=order?.shipping_address)===null||_k2===void 0?void 0:_k2.last_name,email:order?.customer_email,street_address:(_l2=order?.shipping_address)===null||_l2===void 0?void 0:_l2.line_1,street_address2:null,postal_code:(_m2=order?.shipping_address)===null||_m2===void 0?void 0:_m2.zip_code,organization_name:null,city:(_o2=order?.shipping_address)===null||_o2===void 0?void 0:_o2.city,region:(_p2=order?.shipping_address)===null||_p2===void 0?void 0:_p2.state_code,phone:(_q2=order?.shipping_address)===null||_q2===void 0?void 0:_q2.phone,country:(_r2=order?.shipping_address)===null||_r2===void 0?void 0:_r2.country_code},klarnaData={merchant_data:order?.id,purchase_country:order?.country_code,purchase_currency:order?.currency_code,locale,shipping_address,billing_address,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items)};try{kl.Payments.load({container:"#klarna-payments-container",payment_method_category},{billing_address,shipping_address},async function({show_form}){if(show_form)try{await kl.Payments.authorize({payment_method_category},klarnaData,async function(res){if(res.approved&&paymentSource&¤tPaymentMethodType){const ps=await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{auth_token:res.authorization_token}}),{placed}=setPlaceOrder&&ps&&await setPlaceOrder({paymentSource:ps})||{placed:!1};placed&&placeOrderCallback&&placeOrderCallback({placed})}})}catch(e){console.error("e",e),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:"Authorization error"}])}})}catch(e){console.error("Load Klarna libray",e)}};if(klarna&&clientToken){const[first]=paymentSource?.payment_methods||void 0;klarna.Payments.init({client_token:clientToken}),klarna.Payments.load({container:"#klarna-payments-container",payment_method_category:first?.identifier},{billing_address:{given_name:(_b=order?.billing_address)===null||_b===void 0?void 0:_b.first_name,family_name:(_c=order?.billing_address)===null||_c===void 0?void 0:_c.last_name,email:order?.customer_email,street_address:(_d=order?.billing_address)===null||_d===void 0?void 0:_d.line_1,street_address2:(_e=order?.billing_address)===null||_e===void 0?void 0:_e.line_2,postal_code:(_f=order?.billing_address)===null||_f===void 0?void 0:_f.zip_code,city:(_g=order?.billing_address)===null||_g===void 0?void 0:_g.city,region:(_h=order?.billing_address)===null||_h===void 0?void 0:_h.state_code,phone:(_j=order?.billing_address)===null||_j===void 0?void 0:_j.phone,country:(_k=order?.billing_address)===null||_k===void 0?void 0:_k.country_code},shipping_address:{given_name:(_l=order?.shipping_address)===null||_l===void 0?void 0:_l.first_name,family_name:(_m=order?.shipping_address)===null||_m===void 0?void 0:_m.last_name,street_address:(_o=order?.shipping_address)===null||_o===void 0?void 0:_o.line_1,street_address2:(_p=order?.shipping_address)===null||_p===void 0?void 0:_p.line_2,postal_code:(_q=order?.shipping_address)===null||_q===void 0?void 0:_q.zip_code,city:(_r=order?.shipping_address)===null||_r===void 0?void 0:_r.city,region:(_s=order?.shipping_address)===null||_s===void 0?void 0:_s.state_code,phone:(_t=order?.shipping_address)===null||_t===void 0?void 0:_t.phone,country:(_u=order?.shipping_address)===null||_u===void 0?void 0:_u.country_code}})}return _jsx("form",Object.assign({ref},{children:_jsx("div",Object.assign({className:containerClassName},divProps,{children:_jsx("div",{id:"klarna-payments-container"})}))}))}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LineItemType } from '../typings/index';
|
|
3
|
-
declare type
|
|
3
|
+
declare type Props = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
type?: LineItemType;
|
|
6
6
|
};
|
|
7
|
-
declare
|
|
7
|
+
export declare function LineItem(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace LineItem {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
11
|
+
type: import("prop-types").Requireable<LineItemType>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
8
15
|
export default LineItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";const propTypes=components.LineItem.propTypes,displayName=components.LineItem.displayName;export function LineItem(props){const{type="skus",children}=props,{lineItems}=useContext(LineItemContext),{lineItems:shipmentLineItems}=useContext(ShipmentChildrenContext),items=shipmentLineItems&&shipmentLineItems?.length>0?shipmentLineItems:lineItems,components2=items&&items.filter(l=>l.item_type===type).map((lineItem,k,check)=>{var _a;if(lineItem.item_type==="bundles"&&k>0&&((_a=check[k-1])===null||_a===void 0?void 0:_a.bundle_code)===lineItem.bundle_code||lineItem.item_type==="gift_cards"&&lineItem?.total_amount_cents&&lineItem?.total_amount_cents<=0)return null;const lineProps={lineItem};return _jsx(LineItemChildrenContext.Provider,Object.assign({value:lineProps},{children}),k)});return _jsx(_Fragment,{children:components2})}LineItem.propTypes=propTypes,LineItem.displayName=displayName;export default LineItem;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent, BasePriceType } from '../typings/index';
|
|
3
|
-
|
|
3
|
+
declare type Props = BaseAmountComponent & {
|
|
4
4
|
type?: BasePriceType;
|
|
5
5
|
};
|
|
6
|
-
declare
|
|
6
|
+
export declare function LineItemAmount(props: Props): JSX.Element;
|
|
7
|
+
export declare namespace LineItemAmount {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
type: import("prop-types").Requireable<BasePriceType>;
|
|
10
|
+
id: import("prop-types").Requireable<string>;
|
|
11
|
+
className: import("prop-types").Requireable<string>;
|
|
12
|
+
style: import("prop-types").Requireable<object>;
|
|
13
|
+
name: import("prop-types").Requireable<string>;
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
format: import("prop-types").Requireable<import("../typings/index").BaseFormatPrice>;
|
|
16
|
+
};
|
|
17
|
+
var defaultProps: Props;
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
7
20
|
export default LineItemAmount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemAmount.propTypes,defaultProps=components.LineItemAmount.defaultProps,displayName=components.LineItemAmount.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemAmount.propTypes,defaultProps=components.LineItemAmount.defaultProps,displayName=components.LineItemAmount.displayName;export function LineItemAmount(props){const{format="formatted",type="total"}=props,p=__rest(props,["format","type"]),{lineItem}=useContext(LineItemChildrenContext),[price,setPrice]=useState("");useEffect(()=>{if(lineItem){const p2=getAmount({base:"amount",type,format,obj:lineItem});setPrice(p2)}return()=>{setPrice("")}},[lineItem]);const parentProps=Object.assign({price},p);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("span",Object.assign({},p,{children:price}))}LineItemAmount.propTypes=propTypes,LineItemAmount.defaultProps=defaultProps,LineItemAmount.displayName=displayName;export default LineItemAmount;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LineItem } from '@commercelayer/sdk';
|
|
3
|
-
export declare type LineItemCodeType = Omit<
|
|
3
|
+
export declare type LineItemCodeType = Omit<Props, 'children'> & {
|
|
4
4
|
lineItem: LineItem;
|
|
5
5
|
skuCode: string;
|
|
6
6
|
};
|
|
7
|
-
declare type
|
|
7
|
+
declare type Props = {
|
|
8
8
|
children?: (props: LineItemCodeType) => ReactNode;
|
|
9
9
|
type?: 'sku_code' | 'bundle_code';
|
|
10
10
|
} & JSX.IntrinsicElements['p'];
|
|
11
|
-
declare
|
|
11
|
+
export declare function LineItemCode({ type, children, ...p }: Props): JSX.Element;
|
|
12
|
+
export declare namespace LineItemCode {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
+
};
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
12
18
|
export default LineItemCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemCode.propTypes,displayName=components.LineItemCode.displayName
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemCode.propTypes,displayName=components.LineItemCode.displayName;export function LineItemCode(_a){var{type="sku_code",children}=_a,p=__rest(_a,["type","children"]);const{lineItem}=useContext(LineItemChildrenContext),labelName=lineItem?.[type],parentProps=Object.assign({lineItem,skuCode:labelName},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("p",Object.assign({},p,{children:labelName}))}LineItemCode.propTypes=propTypes,LineItemCode.displayName=displayName;export default LineItemCode;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { LineItem } from '@commercelayer/sdk';
|
|
3
3
|
import { LineItemType } from '../typings/index';
|
|
4
|
-
export declare type LineItemImageType = Omit<
|
|
4
|
+
export declare type LineItemImageType = Omit<Props, 'children'> & {
|
|
5
5
|
src: string;
|
|
6
6
|
lineItem: LineItem;
|
|
7
7
|
};
|
|
8
|
-
declare type
|
|
8
|
+
declare type Props = {
|
|
9
9
|
children?: (props: LineItemImageType) => ReactNode;
|
|
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
|
-
declare
|
|
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
|
+
}
|
|
16
23
|
export default LineItemImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import{defaultGiftCardImgUrl,defaultImgUrl}from"../utils/placeholderImages";const propTypes=components.LineItemImage.propTypes,displayName=components.LineItemImage.displayName;export function LineItemImage(props){const{placeholder,children}=props,p=__rest(props,["placeholder","children"]),{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=Object.assign({lineItem,src,placeholder},p);return children?_jsx(Parent,Object.assign({},parenProps,{children})):src?_jsx("img",Object.assign({alt:"",src},p)):null}LineItemImage.propTypes=propTypes,LineItemImage.displayName=displayName;export default LineItemImage;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LineItem } from '@commercelayer/sdk';
|
|
3
|
-
export declare type LineItemNameType = Omit<
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { LineItem } from '@commercelayer/sdk';
|
|
3
|
+
export declare type LineItemNameType = Omit<Props, 'children'> & {
|
|
4
4
|
label: string;
|
|
5
5
|
lineItem: LineItem;
|
|
6
6
|
};
|
|
7
|
-
declare type
|
|
7
|
+
declare type Props = {
|
|
8
8
|
children?: (props: LineItemNameType) => ReactNode;
|
|
9
9
|
} & JSX.IntrinsicElements['p'];
|
|
10
|
-
declare
|
|
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
|
+
}
|
|
11
17
|
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";import components from"../config/components";const propTypes=components.LineItemName.propTypes,displayName=components.LineItemName.displayName
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemName.propTypes,displayName=components.LineItemName.displayName;export function LineItemName(props){const{lineItem}=useContext(LineItemChildrenContext),label=lineItem?.name,parentProps=Object.assign({label,lineItem},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("p",Object.assign({},props,{children:label}))}LineItemName.propTypes=propTypes,LineItemName.displayName=displayName;export default LineItemName;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
2
|
import { LineItemOption as LineItemOptionType } from '@commercelayer/sdk';
|
|
3
3
|
import { FunctionChildren } from '../typings/index';
|
|
4
|
-
declare type LineItemOptionChildrenProps = FunctionChildren<Omit<
|
|
4
|
+
declare type LineItemOptionChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
|
|
5
5
|
lineItemOption: LineItemOptionType;
|
|
6
6
|
}>;
|
|
7
|
-
declare type
|
|
7
|
+
declare type Props = {
|
|
8
8
|
id?: string;
|
|
9
9
|
className?: string;
|
|
10
10
|
key?: string;
|
|
@@ -15,5 +15,16 @@ declare type LineItemOptionProps = {
|
|
|
15
15
|
tagElement?: keyof JSX.IntrinsicElements;
|
|
16
16
|
tagContainer?: keyof JSX.IntrinsicElements;
|
|
17
17
|
};
|
|
18
|
-
declare
|
|
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
|
+
}
|
|
19
30
|
export default LineItemOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";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 components from"../config/components";import isJSON from"../utils/isJSON";const propTypes=components.LineItemOption.propTypes,displayName=components.LineItemOption.displayName
|
|
1
|
+
import{__rest}from"tslib";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 components from"../config/components";import isJSON from"../utils/isJSON";const propTypes=components.LineItemOption.propTypes,displayName=components.LineItemOption.displayName;export function LineItemOption(props){const{name,children,valueClassName,key,tagElement="li",tagContainer="ul"}=props,p=__rest(props,["name","children","valueClassName","key","tagElement","tagContainer"]),{lineItemOption,showAll}=useContext(LineItemOptionChildrenContext),parentProps=Object.assign(Object.assign({},props),{lineItemOption}),TagElement=tagElement,TagContainer=tagContainer,components2=showAll&&isJSON(JSON.stringify(lineItemOption?.options))?map(lineItemOption?.options,(value,key2)=>_jsxs(TagElement,Object.assign({},p,{children:[`${key2}:`,_jsx("span",Object.assign({className:valueClassName},{children:`${value}`}))]}),key2)):has(lineItemOption,`options.${name}`)?_jsxs(TagElement,Object.assign({},p,{children:[`${name}:`,_jsx("span",Object.assign({className:valueClassName},p,{children:`${get(lineItemOption,`options.${name}`)}`}))]}),key):null;return children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx(TagContainer,{children:components2})}LineItemOption.propTypes=propTypes,LineItemOption.displayName=displayName;export default LineItemOption;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = JSX.IntrinsicElements['div'] & {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
title?: string;
|
|
5
5
|
showName?: boolean;
|
|
6
|
+
titleTagElement?: keyof JSX.IntrinsicElements;
|
|
7
|
+
titleClassName?: string;
|
|
6
8
|
} & ({
|
|
7
9
|
skuOptionId: string;
|
|
8
10
|
showAll?: never;
|
|
@@ -10,5 +12,8 @@ export declare type LineItemOptionsProps = JSX.IntrinsicElements['span'] & {
|
|
|
10
12
|
skuOptionId?: never;
|
|
11
13
|
showAll: true;
|
|
12
14
|
});
|
|
13
|
-
declare
|
|
15
|
+
export declare function LineItemOptions(props: Props): JSX.Element;
|
|
16
|
+
export declare namespace LineItemOptions {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
14
19
|
export default LineItemOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext
|
|
1
|
+
import{__rest}from"tslib";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";import{isEmpty}from"lodash";import components from"../config/components";const displayName=components.LineItemOptions.displayName;export function LineItemOptions(props){const{skuOptionId,title,children,showName=!0,showAll,className,titleTagElement="h6",titleClassName}=props,p=__rest(props,["skuOptionId","title","children","showName","showAll","className","titleTagElement","titleClassName"]),{lineItem}=useContext(LineItemChildrenContext),lineItemOptions=isEmpty(lineItem)?[]:lineItem?.line_item_options||[],TitleTagElement=titleTagElement,options=lineItemOptions.filter(o=>showAll?!0:o.skuOption().id===skuOptionId).map((o,k)=>{const showTitle=showName?_jsx(TitleTagElement,Object.assign({className:titleClassName},{children:title||o.name})):null,valueProps={lineItemOption:o,showAll};return _jsxs("div",Object.assign({className},p,{children:[showTitle,_jsx(LineItemOptionChildrenContext.Provider,Object.assign({value:valueProps},{children}))]}),k)});return _jsx(_Fragment,{children:options})}LineItemOptions.displayName=displayName;export default LineItemOptions;
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
|
-
declare type LineItemQuantityChildrenProps = FunctionChildren<Omit<
|
|
3
|
+
declare type LineItemQuantityChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
|
|
4
4
|
quantity: number;
|
|
5
5
|
handleChange: (event: React.MouseEvent<HTMLSelectElement>) => void;
|
|
6
6
|
}>;
|
|
7
|
-
declare type
|
|
7
|
+
declare type Props = {
|
|
8
8
|
children?: LineItemQuantityChildrenProps;
|
|
9
9
|
max?: number;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
readonly?: boolean;
|
|
12
12
|
} & (JSX.IntrinsicElements['select'] & JSX.IntrinsicElements['span']);
|
|
13
|
-
declare
|
|
13
|
+
export declare function LineItemQuantity(props: Props): JSX.Element;
|
|
14
|
+
export declare namespace LineItemQuantity {
|
|
15
|
+
var propTypes: {
|
|
16
|
+
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
17
|
+
max: import("prop-types").Requireable<number>;
|
|
18
|
+
disabled: import("prop-types").Requireable<boolean>;
|
|
19
|
+
readonly: import("prop-types").Requireable<boolean>;
|
|
20
|
+
};
|
|
21
|
+
var defaultProps: {
|
|
22
|
+
max: number;
|
|
23
|
+
};
|
|
24
|
+
var displayName: string;
|
|
25
|
+
}
|
|
14
26
|
export default LineItemQuantity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";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
|
|
1
|
+
import{__rest}from"tslib";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}=props,p=__rest(props,["max","readonly"]),{lineItem}=useContext(LineItemChildrenContext),{updateLineItem}=useContext(LineItemContext),options=[];for(let i=1;i<=max;i++)options.push(_jsx("option",Object.assign({value:`${i}`},{children:i}),i));const handleChange=e=>{const quantity2=Number(e.target.value);updateLineItem&&lineItem&&updateLineItem(lineItem.id,quantity2)},quantity=lineItem?.quantity,parentProps=Object.assign({handleChange,quantity},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):readonly?_jsx("span",Object.assign({},p,{children:quantity})):_jsx("select",Object.assign({title:lineItem?.name,value:quantity,onChange:handleChange},p,{children:options}))}LineItemQuantity.propTypes=propTypes,LineItemQuantity.defaultProps=defaultProps,LineItemQuantity.displayName=displayName;export default LineItemQuantity;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PropsWithoutRef } from 'react';
|
|
2
2
|
import { FunctionChildren } from '../typings/index';
|
|
3
|
-
declare type
|
|
3
|
+
declare type ChildrenProps = FunctionChildren<{
|
|
4
4
|
handleRemove: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
5
5
|
label?: string;
|
|
6
6
|
}>;
|
|
7
|
-
declare type
|
|
8
|
-
children?:
|
|
7
|
+
declare type Props = {
|
|
8
|
+
children?: ChildrenProps;
|
|
9
9
|
label?: string;
|
|
10
10
|
} & PropsWithoutRef<JSX.IntrinsicElements['a']>;
|
|
11
|
-
declare
|
|
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";import components from"../config/components";const propTypes=components.LineItemRemoveLink.propTypes,defaultProps=components.LineItemRemoveLink.defaultProps,displayName=components.LineItemRemoveLink.displayName
|
|
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=Object.assign({handleRemove},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("a",Object.assign({},props,{href:"#",onClick:handleRemove},{children:label}))}LineItemRemoveLink.propTypes=propTypes,LineItemRemoveLink.defaultProps=defaultProps,LineItemRemoveLink.displayName=displayName;export default LineItemRemoveLink;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare type
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
filters?: Record<string, any>;
|
|
5
5
|
loader?: ReactNode;
|
|
6
6
|
};
|
|
7
|
-
declare
|
|
7
|
+
export declare function LineItemsContainer(props: Props): JSX.Element;
|
|
8
|
+
export declare namespace LineItemsContainer {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
11
|
+
filters: import("prop-types").Requireable<object>;
|
|
12
|
+
loader: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
|
|
13
|
+
};
|
|
14
|
+
var defaultProps: {
|
|
15
|
+
filters: {};
|
|
16
|
+
loader: string;
|
|
17
|
+
};
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
8
20
|
export default LineItemsContainer;
|