@commercelayer/react-components 4.18.0 → 4.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/ExternalFunction.d.ts +1 -1
- package/lib/cjs/components/MetadataInput.d.ts +1 -1
- package/lib/cjs/components/SubmitButton.d.ts +2 -2
- package/lib/cjs/components/addresses/Address.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressField.d.ts +2 -2
- package/lib/cjs/components/addresses/AddressInput.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressInputSelect.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +1 -1
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
- package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +1 -1
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerContainer.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerField.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerInput.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
- package/lib/cjs/components/customers/MyAccountLink.d.ts +1 -1
- package/lib/cjs/components/customers/MyIdentityLink.d.ts +1 -1
- package/lib/cjs/components/customers/SaveCustomerButton.d.ts +1 -1
- package/lib/cjs/components/errors/Errors.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +2 -2
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -1
- package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemCode.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemField.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemImage.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemName.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemOption.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +1 -1
- package/lib/cjs/components/orders/AddToCartButton.d.ts +6 -6
- package/lib/cjs/components/orders/AddToCartButton.js +1 -1
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -1
- package/lib/cjs/components/orders/CartLink.d.ts +1 -1
- package/lib/cjs/components/orders/CheckoutLink.d.ts +1 -1
- package/lib/cjs/components/orders/DiscountAmount.d.ts +1 -1
- package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -1
- package/lib/cjs/components/orders/OrderContainer.d.ts +1 -1
- package/lib/cjs/components/orders/OrderList.d.ts +1 -1
- package/lib/cjs/components/orders/OrderListEmpty.d.ts +1 -1
- package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +1 -1
- package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +1 -1
- package/lib/cjs/components/orders/OrderStorage.d.ts +1 -1
- package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +1 -1
- package/lib/cjs/components/orders/PlaceOrderButton.d.ts +6 -6
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/orders/ShippingAmount.d.ts +1 -1
- package/lib/cjs/components/orders/SubTotalAmount.d.ts +1 -1
- package/lib/cjs/components/orders/TaxesAmount.d.ts +1 -1
- package/lib/cjs/components/orders/TotalAmount.d.ts +1 -1
- package/lib/cjs/components/parcels/ParcelField.d.ts +1 -1
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +1 -1
- package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +1 -1
- package/lib/cjs/components/parcels/ParcelsCount.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +2 -2
- package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
- package/lib/cjs/components/payment_source/AdyenPayment.d.ts +10 -74
- package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/ExternalPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
- package/lib/cjs/components/payment_source/StripePayment.d.ts +3 -3
- package/lib/cjs/components/prices/Price.d.ts +2 -2
- package/lib/cjs/components/prices/PricesContainer.d.ts +2 -2
- package/lib/cjs/components/shipments/ShipmentField.d.ts +1 -1
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/cjs/components/skus/SkuField.d.ts +1 -1
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +1 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +2 -2
- package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
- package/lib/cjs/components/utils/GenericFieldComponent.d.ts +6 -6
- package/lib/cjs/components/utils/Parent.d.ts +1 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +3 -3
- package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
- package/lib/cjs/components/utils/getAllErrors.d.ts +3 -3
- package/lib/cjs/context/AddressChildrenContext.d.ts +1 -1
- package/lib/cjs/context/AddressContext.d.ts +1 -1
- package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
- package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/cjs/context/CustomerAddressFormContext.d.ts +2 -2
- package/lib/cjs/context/CustomerContext.d.ts +1 -1
- package/lib/cjs/context/CustomerPaymentSourceContext.d.ts +1 -1
- package/lib/cjs/context/GiftCardContext.d.ts +1 -1
- package/lib/cjs/context/InStockSubscriptionContext.d.ts +1 -1
- package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/cjs/context/LineItemContext.d.ts +2 -2
- package/lib/cjs/context/OrderContext.d.ts +2 -2
- package/lib/cjs/context/OrderListChildrenContext.d.ts +3 -3
- package/lib/cjs/context/PaymentMethodChildrenContext.d.ts +1 -1
- package/lib/cjs/context/ShippingAddressContext.d.ts +1 -1
- package/lib/cjs/context/ShippingAddressFormContext.d.ts +1 -1
- package/lib/cjs/context/ShippingMethodChildrenContext.d.ts +1 -1
- package/lib/cjs/context/SkuChildrenContext.d.ts +1 -1
- package/lib/cjs/context/SkuContext.d.ts +1 -1
- package/lib/cjs/context/StockTransferChildrenContext.d.ts +1 -1
- package/lib/cjs/hooks/useCommerceLayer.d.ts +1 -1
- package/lib/cjs/hooks/useCustomerContainer.d.ts +1 -1
- package/lib/cjs/hooks/useOrderContainer.d.ts +1 -1
- package/lib/cjs/reducers/AddressReducer.d.ts +9 -9
- package/lib/cjs/reducers/AvailabilityReducer.d.ts +5 -5
- package/lib/cjs/reducers/BillingAddressReducer.d.ts +4 -4
- package/lib/cjs/reducers/CustomerReducer.d.ts +4 -4
- package/lib/cjs/reducers/GiftCardReducer.d.ts +6 -6
- package/lib/cjs/reducers/InStockSubscriptionReducer.d.ts +3 -3
- package/lib/cjs/reducers/LineItemReducer.d.ts +6 -6
- package/lib/cjs/reducers/OrderReducer.d.ts +6 -6
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +26 -26
- package/lib/cjs/reducers/PlaceOrderReducer.d.ts +11 -11
- package/lib/cjs/reducers/PriceReducer.d.ts +5 -5
- package/lib/cjs/reducers/ShipmentReducer.d.ts +5 -5
- package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
- package/lib/cjs/reducers/SkuListsReducer.d.ts +2 -2
- package/lib/cjs/reducers/SkuReducer.d.ts +4 -4
- package/lib/cjs/typings/errors.d.ts +1 -1
- package/lib/cjs/typings/index.d.ts +2 -2
- package/lib/cjs/utils/addressesManager.d.ts +3 -3
- package/lib/cjs/utils/baseReducer.d.ts +1 -1
- package/lib/cjs/utils/canPlaceOrder.d.ts +1 -1
- package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
- package/lib/cjs/utils/customMessages.d.ts +1 -1
- package/lib/cjs/utils/expressPaymentHelper.d.ts +8 -8
- package/lib/cjs/utils/expressPaymentHelper.js +1 -1
- package/lib/cjs/utils/filterChildren.d.ts +1 -1
- package/lib/cjs/utils/formCleaner.d.ts +1 -1
- package/lib/cjs/utils/getCardDetails.d.ts +3 -3
- package/lib/cjs/utils/getErrors.d.ts +2 -2
- package/lib/cjs/utils/getLoaderComponent.d.ts +1 -1
- package/lib/cjs/utils/getPaymentAttributes.d.ts +2 -2
- package/lib/cjs/utils/getPrices.d.ts +1 -1
- package/lib/cjs/utils/getSdk.d.ts +1 -1
- package/lib/cjs/utils/getSkus.d.ts +1 -1
- package/lib/cjs/utils/hasSubscriptions.d.ts +1 -1
- package/lib/cjs/utils/organization.d.ts +4 -4
- package/lib/cjs/utils/organization.js +1 -1
- package/lib/cjs/utils/payment-methods/sortPaymentMethods.d.ts +2 -2
- package/lib/cjs/utils/shipments.d.ts +1 -1
- package/lib/cjs/utils/triggerAttributeHelper.d.ts +2 -2
- package/lib/cjs/utils/updateOrderSubscriptionCustomerPaymentSource.d.ts +2 -2
- package/lib/cjs/utils/validateFormFields.d.ts +5 -5
- package/lib/esm/components/ExternalFunction.d.ts +1 -1
- package/lib/esm/components/MetadataInput.d.ts +1 -1
- package/lib/esm/components/SubmitButton.d.ts +2 -2
- package/lib/esm/components/addresses/Address.d.ts +1 -1
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +1 -1
- package/lib/esm/components/addresses/AddressField.d.ts +2 -2
- package/lib/esm/components/addresses/AddressInput.d.ts +1 -1
- package/lib/esm/components/addresses/AddressInputSelect.d.ts +1 -1
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -1
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
- package/lib/esm/components/addresses/SaveAddressesButton.d.ts +1 -1
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +1 -1
- package/lib/esm/components/customers/CustomerContainer.d.ts +1 -1
- package/lib/esm/components/customers/CustomerField.d.ts +1 -1
- package/lib/esm/components/customers/CustomerInput.d.ts +1 -1
- package/lib/esm/components/customers/CustomerPaymentSource.d.ts +1 -1
- package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
- package/lib/esm/components/customers/MyAccountLink.d.ts +1 -1
- package/lib/esm/components/customers/MyIdentityLink.d.ts +1 -1
- package/lib/esm/components/customers/SaveCustomerButton.d.ts +1 -1
- package/lib/esm/components/errors/Errors.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCard.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +2 -2
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -1
- package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemCode.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemField.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemImage.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemName.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemOption.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +1 -1
- package/lib/esm/components/orders/AddToCartButton.d.ts +6 -6
- package/lib/esm/components/orders/AddToCartButton.js +1 -1
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -1
- package/lib/esm/components/orders/CartLink.d.ts +1 -1
- package/lib/esm/components/orders/CheckoutLink.d.ts +1 -1
- package/lib/esm/components/orders/DiscountAmount.d.ts +1 -1
- package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -1
- package/lib/esm/components/orders/OrderContainer.d.ts +1 -1
- package/lib/esm/components/orders/OrderList.d.ts +1 -1
- package/lib/esm/components/orders/OrderListEmpty.d.ts +1 -1
- package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +1 -1
- package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +1 -1
- package/lib/esm/components/orders/OrderStorage.d.ts +1 -1
- package/lib/esm/components/orders/PaymentMethodAmount.d.ts +1 -1
- package/lib/esm/components/orders/PlaceOrderButton.d.ts +6 -6
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/orders/ShippingAmount.d.ts +1 -1
- package/lib/esm/components/orders/SubTotalAmount.d.ts +1 -1
- package/lib/esm/components/orders/TaxesAmount.d.ts +1 -1
- package/lib/esm/components/orders/TotalAmount.d.ts +1 -1
- package/lib/esm/components/parcels/ParcelField.d.ts +1 -1
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +1 -1
- package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +1 -1
- package/lib/esm/components/parcels/ParcelsCount.d.ts +1 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +2 -2
- package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
- package/lib/esm/components/payment_source/AdyenPayment.d.ts +10 -74
- package/lib/esm/components/payment_source/AdyenPayment.js +1 -1
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +2 -2
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/ExternalPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/KlarnaPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSource.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +1 -1
- package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
- package/lib/esm/components/payment_source/StripePayment.d.ts +3 -3
- package/lib/esm/components/prices/Price.d.ts +2 -2
- package/lib/esm/components/prices/PricesContainer.d.ts +2 -2
- package/lib/esm/components/shipments/ShipmentField.d.ts +1 -1
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/esm/components/skus/SkuField.d.ts +1 -1
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +1 -1
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/esm/components/utils/BaseInput.d.ts +1 -1
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +2 -2
- package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
- package/lib/esm/components/utils/GenericFieldComponent.d.ts +6 -6
- package/lib/esm/components/utils/Parent.d.ts +1 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +3 -3
- package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
- package/lib/esm/components/utils/getAllErrors.d.ts +3 -3
- package/lib/esm/context/AddressChildrenContext.d.ts +1 -1
- package/lib/esm/context/AddressContext.d.ts +1 -1
- package/lib/esm/context/BillingAddressContext.d.ts +1 -1
- package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/esm/context/CustomerAddressFormContext.d.ts +2 -2
- package/lib/esm/context/CustomerContext.d.ts +1 -1
- package/lib/esm/context/CustomerPaymentSourceContext.d.ts +1 -1
- package/lib/esm/context/GiftCardContext.d.ts +1 -1
- package/lib/esm/context/InStockSubscriptionContext.d.ts +1 -1
- package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/esm/context/LineItemContext.d.ts +2 -2
- package/lib/esm/context/OrderContext.d.ts +2 -2
- package/lib/esm/context/OrderListChildrenContext.d.ts +3 -3
- package/lib/esm/context/PaymentMethodChildrenContext.d.ts +1 -1
- package/lib/esm/context/ShippingAddressContext.d.ts +1 -1
- package/lib/esm/context/ShippingAddressFormContext.d.ts +1 -1
- package/lib/esm/context/ShippingMethodChildrenContext.d.ts +1 -1
- package/lib/esm/context/SkuChildrenContext.d.ts +1 -1
- package/lib/esm/context/SkuContext.d.ts +1 -1
- package/lib/esm/context/StockTransferChildrenContext.d.ts +1 -1
- package/lib/esm/hooks/useCommerceLayer.d.ts +1 -1
- package/lib/esm/hooks/useCustomerContainer.d.ts +1 -1
- package/lib/esm/hooks/useOrderContainer.d.ts +1 -1
- package/lib/esm/reducers/AddressReducer.d.ts +9 -9
- package/lib/esm/reducers/AvailabilityReducer.d.ts +5 -5
- package/lib/esm/reducers/BillingAddressReducer.d.ts +4 -4
- package/lib/esm/reducers/CustomerReducer.d.ts +4 -4
- package/lib/esm/reducers/GiftCardReducer.d.ts +6 -6
- package/lib/esm/reducers/InStockSubscriptionReducer.d.ts +3 -3
- package/lib/esm/reducers/LineItemReducer.d.ts +6 -6
- package/lib/esm/reducers/OrderReducer.d.ts +6 -6
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +26 -26
- package/lib/esm/reducers/PlaceOrderReducer.d.ts +11 -11
- package/lib/esm/reducers/PriceReducer.d.ts +5 -5
- package/lib/esm/reducers/ShipmentReducer.d.ts +5 -5
- package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
- package/lib/esm/reducers/SkuListsReducer.d.ts +2 -2
- package/lib/esm/reducers/SkuReducer.d.ts +4 -4
- package/lib/esm/typings/errors.d.ts +1 -1
- package/lib/esm/typings/index.d.ts +2 -2
- package/lib/esm/utils/addressesManager.d.ts +3 -3
- package/lib/esm/utils/baseReducer.d.ts +1 -1
- package/lib/esm/utils/canPlaceOrder.d.ts +1 -1
- package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
- package/lib/esm/utils/customMessages.d.ts +1 -1
- package/lib/esm/utils/expressPaymentHelper.d.ts +8 -8
- package/lib/esm/utils/expressPaymentHelper.js +1 -1
- package/lib/esm/utils/filterChildren.d.ts +1 -1
- package/lib/esm/utils/formCleaner.d.ts +1 -1
- package/lib/esm/utils/getCardDetails.d.ts +3 -3
- package/lib/esm/utils/getErrors.d.ts +2 -2
- package/lib/esm/utils/getLoaderComponent.d.ts +1 -1
- package/lib/esm/utils/getPaymentAttributes.d.ts +2 -2
- package/lib/esm/utils/getPrices.d.ts +1 -1
- package/lib/esm/utils/getSdk.d.ts +1 -1
- package/lib/esm/utils/getSkus.d.ts +1 -1
- package/lib/esm/utils/hasSubscriptions.d.ts +1 -1
- package/lib/esm/utils/organization.d.ts +4 -4
- package/lib/esm/utils/organization.js +1 -1
- package/lib/esm/utils/payment-methods/sortPaymentMethods.d.ts +2 -2
- package/lib/esm/utils/shipments.d.ts +1 -1
- package/lib/esm/utils/triggerAttributeHelper.d.ts +2 -2
- package/lib/esm/utils/updateOrderSubscriptionCustomerPaymentSource.d.ts +2 -2
- package/lib/esm/utils/validateFormFields.d.ts +5 -5
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +41 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseInputComponentProps } from '../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
4
4
|
export declare function MetadataInput(props: Props): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ReactNode, JSX } from 'react';
|
|
2
|
+
import type { ChildrenFunction } from '../typings/index';
|
|
3
3
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
4
4
|
}
|
|
5
5
|
interface Props extends Omit<JSX.IntrinsicElements['button'], 'children' | 'ref'> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { Address as AddressType } from '@commercelayer/sdk';
|
|
3
3
|
import { type AddressCardsTemplateChildren } from '../utils/AddressCardsTemplate';
|
|
4
4
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
5
5
|
interface Props extends Omit<JSX.IntrinsicElements['div'], 'children' | 'onSelect'> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseSelectComponentProps } from '../../typings/index';
|
|
3
3
|
import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
4
4
|
import { type Country } from '../../utils/countryStateCity';
|
|
5
5
|
type TCountryFieldName = 'billing_address_country_code' | 'shipping_address_country_code' | 'customer_address_country_code';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode, type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { AddressFieldView } from '../../reducers/AddressReducer';
|
|
3
3
|
import type { Address } from '@commercelayer/sdk';
|
|
4
|
-
import {
|
|
4
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
5
5
|
interface ChildrenProps extends Omit<Props, 'children' | 'name'> {
|
|
6
6
|
address: Address;
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseInputComponentProps, AddressInputName } from '../../typings/index';
|
|
3
3
|
import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
4
4
|
type Props = {
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseSelectComponentProps } from '../../typings/index';
|
|
3
3
|
import { type AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
4
4
|
type SelectFieldName = `billing_address_${`metadata_${string}`}` | `shipping_address_${`metadata_${string}`}`;
|
|
5
5
|
interface Props extends Omit<BaseSelectComponentProps, 'name'>, Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { AddressStateSelectName, BaseSelectComponentProps } from '../../typings/index';
|
|
3
3
|
import { type States } from '../../utils/countryStateCity';
|
|
4
4
|
type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
|
|
5
5
|
name: AddressStateSelectName;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { CustomFieldMessageError } from '../../reducers/AddressReducer';
|
|
3
3
|
interface Props extends Omit<JSX.IntrinsicElements['form'], 'onSubmit'> {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
reset?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
3
|
-
import {
|
|
3
|
+
import type { QueryPageSize } from '@commercelayer/sdk';
|
|
4
4
|
interface Props {
|
|
5
5
|
children: DefaultChildrenType;
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ConditionalElement } from '../../typings/index';
|
|
2
2
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
3
3
|
import type { JSX } from "react";
|
|
4
4
|
type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['Customer']>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import type { CodeErrorType } from '../../typings/errors';
|
|
3
|
-
import {
|
|
3
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
4
4
|
export type TResourceError = 'addresses' | 'billing_address' | 'gift_cards' | 'gift_card_or_coupon_code' | 'line_items' | 'orders' | 'payment_methods' | 'prices' | 'shipments' | 'shipping_address' | 'customer_address' | 'sku_options' | 'variant' | 'in_stock_subscriptions';
|
|
5
5
|
type ErrorChildrenComponentProps = ChildrenFunction<Omit<TErrorComponent, 'children'> & {
|
|
6
6
|
errors: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RefObject, type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseState } from '../../typings/index';
|
|
3
3
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
4
4
|
interface Props extends Omit<JSX.IntrinsicElements['form'], 'children' | 'ref'> {
|
|
5
5
|
children: DefaultChildrenType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
3
|
import type { CodeType } from '../../reducers/OrderReducer';
|
|
4
4
|
interface ChildrenProps extends Omit<Props, 'children' | 'type'> {
|
|
5
5
|
code?: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { BaseInputComponentProps } from '../../typings/index';
|
|
3
|
+
import type { OrderCodeType } from '../../reducers/OrderReducer';
|
|
4
4
|
type FieldName = 'gift_card_code' | 'coupon_code';
|
|
5
5
|
type Props = {
|
|
6
6
|
name?: FieldName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode, type JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
import type { CodeType, OrderCodeType } from '../../reducers/OrderReducer';
|
|
4
4
|
import type { Order } from '@commercelayer/sdk';
|
|
5
5
|
interface ChildrenProps extends Omit<Props, 'children' | 'onClick'> {
|
|
6
6
|
codeType?: OrderCodeType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ReactNode, JSX } from 'react';
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
3
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
4
4
|
}
|
|
5
5
|
interface Props extends Omit<JSX.IntrinsicElements['button'], 'children'> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { LineItem } from '@commercelayer/sdk';
|
|
3
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
4
4
|
export interface TLineItemCode extends Omit<Props, 'children'> {
|
|
5
5
|
lineItem: LineItem;
|
|
6
6
|
skuCode: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ConditionalElement } from '../../typings/index';
|
|
2
2
|
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
3
3
|
import type { JSX } from "react";
|
|
4
4
|
type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { LineItem } from '@commercelayer/sdk';
|
|
3
3
|
import type { ChildrenFunction } from '../../typings/index';
|
|
4
|
-
import {
|
|
4
|
+
import type { TLineItem } from './LineItem';
|
|
5
5
|
export interface TLineItemImage extends Omit<Props, 'children'> {
|
|
6
6
|
src: string;
|
|
7
7
|
lineItem: LineItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import type { LineItem } from '@commercelayer/sdk';
|
|
3
|
-
import {
|
|
3
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
4
4
|
export interface TLineItemName extends Omit<Props, 'children'> {
|
|
5
5
|
label: string;
|
|
6
6
|
lineItem: LineItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties, type JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { LineItemOption as LineItemOptionType } from '@commercelayer/sdk';
|
|
3
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
4
4
|
export interface TLineItemOption extends Omit<Props, 'children'> {
|
|
5
5
|
lineItemOption: LineItemOptionType;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
import type { LineItem } from '@commercelayer/sdk';
|
|
4
4
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
5
5
|
quantity: number;
|
|
6
6
|
handleChange: (event: React.MouseEvent<HTMLSelectElement>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PropsWithoutRef, type JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
import type { LineItem } from '@commercelayer/sdk';
|
|
4
4
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
5
5
|
handleRemove: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
6
6
|
label?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import { type TypeAccepted } from '../../utils/getLineItemsCount';
|
|
3
|
-
import {
|
|
3
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
4
4
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
5
5
|
quantity: number;
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type PropsWithoutRef, type JSX } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
interface TAddToCartButton extends Omit<Props,
|
|
1
|
+
import { type PropsWithoutRef, type JSX } from "react";
|
|
2
|
+
import type { ChildrenFunction } from "../../typings/index";
|
|
3
|
+
import type { AddToCartReturn, CustomLineItem, LineItemOption } from "../../reducers/OrderReducer";
|
|
4
|
+
interface TAddToCartButton extends Omit<Props, "children"> {
|
|
5
5
|
handleClick: () => AddToCartReturn;
|
|
6
6
|
}
|
|
7
7
|
type BuyNowMode = {
|
|
@@ -29,13 +29,13 @@ type THostedCart = {
|
|
|
29
29
|
/**
|
|
30
30
|
* If you have a self-hosted cart, you can pass the protocol to redirect to it.
|
|
31
31
|
*/
|
|
32
|
-
protocol?:
|
|
32
|
+
protocol?: "http" | "https";
|
|
33
33
|
} | {
|
|
34
34
|
redirectToHostedCart?: false;
|
|
35
35
|
hostedCartUrl?: never;
|
|
36
36
|
protocol?: never;
|
|
37
37
|
};
|
|
38
|
-
type TButton = PropsWithoutRef<Omit<JSX.IntrinsicElements[
|
|
38
|
+
type TButton = PropsWithoutRef<Omit<JSX.IntrinsicElements["button"], "children">>;
|
|
39
39
|
type Props = {
|
|
40
40
|
/**
|
|
41
41
|
* Code of a bundle
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AddToCartButton=AddToCartButton;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),SkuListsContext_1=tslib_1.__importDefault(require("../../context/SkuListsContext")),ExternalFunctionContext_1=tslib_1.__importDefault(require("../../context/ExternalFunctionContext")),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),getDomain_1=require("../../utils/getDomain"),events_1=require("../../utils/events"),organization_1=require("../../utils/organization");function AddToCartButton(props){var _a;const{label="Add to cart",children,skuCode,bundleCode,skuListId,lineItem,buyNowMode=!1,checkoutUrl,redirectToHostedCart,hostedCartUrl,quantity,lineItemOption,protocol="https"}=props,p=tslib_1.__rest(props,["label","children","skuCode","bundleCode","skuListId","lineItem","buyNowMode","checkoutUrl","redirectToHostedCart","hostedCartUrl","quantity","lineItemOption","protocol"]),{accessToken,endpoint}=(0,useCustomContext_1.default)({context:CommerceLayerContext_1.default,contextComponentName:"CommerceLayer",currentComponentName:"AddToCartButton",key:"accessToken"}),{addToCart,orderId,getOrder,setOrderErrors}=(0,useCustomContext_1.default)({context:OrderContext_1.default,contextComponentName:"OrderContainer",currentComponentName:"AddToCartButton",key:"addToCart"}),{url,callExternalFunction}=(0,react_1.useContext)(ExternalFunctionContext_1.default),{skuLists}=(0,react_1.useContext)(SkuListsContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),sCode=(_a=sku?.code)!==null&&_a!==void 0?_a:skuCode,handleClick=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2,_b,_c;const qty=quantity!=null?parseInt(quantity):1;if(skuLists!=null&&skuListId&&url&&skuListId in skuLists){const lineItems=(_a2=skuLists?.[skuListId])===null||_a2===void 0?void 0:_a2.map(skuCode2=>({skuCode:skuCode2,quantity:qty,_update_quantity:1}));return yield callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems}]}}).then(res=>tslib_1.__awaiter(this,void 0,void 0,function*(){return getOrder&&orderId&&(yield getOrder(orderId)),buyNowMode||(0,events_1.publish)("open-cart"),res})).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}if(!url&&addToCart!=null){const res=yield addToCart({bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl});if(redirectToHostedCart&&accessToken!=null&&endpoint!=null){const{slug,domain}=(0,getDomain_1.getDomain)(endpoint),orderId2=res?.orderId;if(hostedCartUrl&&orderId2)location.href=`${protocol}://${hostedCartUrl}/${orderId2}?accessToken=${accessToken}`;else if(orderId2&&slug){const config=yield(0,organization_1.getOrganizationConfig)({accessToken,endpoint,params:{orderId:orderId2,accessToken,slug}});location.href=(_c=(_b=config?.links)===null||_b===void 0?void 0:_b.cart)!==null&&_c!==void 0?_c:(0,getApplicationLink_1.getApplicationLink)({orderId:orderId2,slug,accessToken,domain,applicationType:"cart"})}}return res}else if(url)return yield callExternalFunction({url,data:{bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl}}).then(res=>tslib_1.__awaiter(this,void 0,void 0,function*(){return getOrder&&orderId&&(yield getOrder(orderId)),buyNowMode||(0,events_1.publish)("open-cart"),res})).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}),parentProps=Object.assign({handleClick,label},props);return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("button",Object.assign({},p,{onClick:()=>{handleClick()},children:label}))}exports.default=AddToCartButton;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AddToCartButton=AddToCartButton;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),SkuListsContext_1=tslib_1.__importDefault(require("../../context/SkuListsContext")),ExternalFunctionContext_1=tslib_1.__importDefault(require("../../context/ExternalFunctionContext")),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext")),getApplicationLink_1=require("../../utils/getApplicationLink"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),getDomain_1=require("../../utils/getDomain"),events_1=require("../../utils/events"),organization_1=require("../../utils/organization");function AddToCartButton(props){var _a;const{label="Add to cart",children,skuCode,bundleCode,skuListId,lineItem,buyNowMode=!1,checkoutUrl,redirectToHostedCart,hostedCartUrl,quantity,lineItemOption,protocol="https"}=props,p=tslib_1.__rest(props,["label","children","skuCode","bundleCode","skuListId","lineItem","buyNowMode","checkoutUrl","redirectToHostedCart","hostedCartUrl","quantity","lineItemOption","protocol"]),{accessToken,endpoint}=(0,useCustomContext_1.default)({context:CommerceLayerContext_1.default,contextComponentName:"CommerceLayer",currentComponentName:"AddToCartButton",key:"accessToken"}),{addToCart,orderId,getOrder,setOrderErrors}=(0,useCustomContext_1.default)({context:OrderContext_1.default,contextComponentName:"OrderContainer",currentComponentName:"AddToCartButton",key:"addToCart"}),{url,callExternalFunction}=(0,react_1.useContext)(ExternalFunctionContext_1.default),{skuLists}=(0,react_1.useContext)(SkuListsContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),sCode=(_a=sku?.code)!==null&&_a!==void 0?_a:skuCode,handleClick=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2,_b,_c;const qty=quantity!=null?Number.parseInt(quantity):1;if(skuLists!=null&&skuListId&&url&&skuListId in skuLists){const lineItems=(_a2=skuLists?.[skuListId])===null||_a2===void 0?void 0:_a2.map(skuCode2=>({skuCode:skuCode2,quantity:qty,_update_quantity:1}));return yield callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems}]}}).then(res=>tslib_1.__awaiter(this,void 0,void 0,function*(){return getOrder&&orderId&&(yield getOrder(orderId)),buyNowMode||(0,events_1.publish)("open-cart"),res})).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}if(!url&&addToCart!=null){const res=yield addToCart({bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl});if(redirectToHostedCart&&accessToken!=null&&endpoint!=null){const{slug,domain}=(0,getDomain_1.getDomain)(endpoint),orderId2=res?.orderId;if(hostedCartUrl&&orderId2)location.href=`${protocol}://${hostedCartUrl}/${orderId2}?accessToken=${accessToken}`;else if(orderId2&&slug){const config=yield(0,organization_1.getOrganizationConfig)({accessToken,endpoint,params:{orderId:orderId2,accessToken,slug}});location.href=(_c=(_b=config?.links)===null||_b===void 0?void 0:_b.cart)!==null&&_c!==void 0?_c:(0,getApplicationLink_1.getApplicationLink)({orderId:orderId2,slug,accessToken,domain,applicationType:"cart"})}}return res}else if(url)return yield callExternalFunction({url,data:{bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl}}).then(res=>tslib_1.__awaiter(this,void 0,void 0,function*(){return getOrder&&orderId&&(yield getOrder(orderId)),buyNowMode||(0,events_1.publish)("open-cart"),res})).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}),parentProps=Object.assign({handleClick,label},props);return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("button",Object.assign({},p,{onClick:()=>{handleClick()},children:label}))}exports.default=AddToCartButton;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseAmountComponent } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
export declare function AdjustmentAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
4
|
export default AdjustmentAmount;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MouseEvent, type ReactNode, type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
3
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
4
4
|
/**
|
|
5
5
|
* The url of the cart
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseAmountComponent } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
export declare function DiscountAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
4
|
export default DiscountAmount;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseAmountComponent } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
export declare function GiftCardAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
4
|
export default GiftCardAmount;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseMetadataObject } from '../../typings/index';
|
|
3
3
|
import type { OrderCreate, Order } from '@commercelayer/sdk';
|
|
4
4
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
5
5
|
interface Props {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type OrderListPaginationContext as TOrderListPaginationContext } from '../../context/OrderListPaginationContext';
|
|
2
|
-
import {
|
|
2
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
3
3
|
import type { JSX } from "react";
|
|
4
4
|
interface PaginationButton extends Omit<JSX.IntrinsicElements['button'], 'children' | 'disabled'> {
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChildrenFunction } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
type TAsComponent = keyof Pick<JSX.IntrinsicElements, 'p' | 'span' | 'div'>;
|
|
4
4
|
type ChildrenProps<A extends TAsComponent> = Omit<Props<A>, 'children'> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseAmountComponent } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
export declare function PaymentMethodAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
4
|
export default PaymentMethodAmount;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type ReactNode, type JSX } from
|
|
2
|
-
import {
|
|
3
|
-
import type { BaseError } from
|
|
4
|
-
import type { Order } from
|
|
5
|
-
interface ChildrenProps extends Omit<Props,
|
|
1
|
+
import { type ReactNode, type JSX } from "react";
|
|
2
|
+
import type { ChildrenFunction } from "../../typings/index";
|
|
3
|
+
import type { BaseError } from "../../typings/errors";
|
|
4
|
+
import type { Order } from "@commercelayer/sdk";
|
|
5
|
+
interface ChildrenProps extends Omit<Props, "children"> {
|
|
6
6
|
/**
|
|
7
7
|
* Callback function to place the order
|
|
8
8
|
*/
|
|
9
9
|
handleClick: () => Promise<void>;
|
|
10
10
|
}
|
|
11
|
-
interface Props extends Omit<JSX.IntrinsicElements[
|
|
11
|
+
interface Props extends Omit<JSX.IntrinsicElements["button"], "children" | "onClick"> {
|
|
12
12
|
children?: ChildrenFunction<ChildrenProps>;
|
|
13
13
|
/**
|
|
14
14
|
* The label of the button
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlaceOrderButton=PlaceOrderButton;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),retrievePaymentIntent_1=require("../../utils/stripe/retrievePaymentIntent");function PlaceOrderButton(props){var _a,_b,_c,_d;const ref=(0,react_1.useRef)(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick}=props,p=tslib_1.__rest(props,["children","label","loadingLabel","autoPlaceOrder","disabled","onClick"]),{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus,status}=(0,react_1.useContext)(PlaceOrderContext_1.default),[notPermitted,setNotPermitted]=(0,react_1.useState)(!0),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled),[isLoading,setIsLoading]=(0,react_1.useState)(!1),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),isFree=order?.total_amount_with_taxes_cents===0;(0,react_1.useEffect)(()=>{var _a2;if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,(_a=currentPaymentMethodRef?.current)===null||_a===void 0?void 0:_a.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),(0,react_1.useEffect)(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2;if(paymentType==="stripe_payments"&&(!((_a2=options?.stripe)===null||_a2===void 0)&&_a2.paymentIntentClientSecret)&&(!((_b2=order?.payment_source)===null||_b2===void 0)&&_b2.publishable_key)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.publishable_key,paymentIntentClientSecret=(_d2=options?.stripe)===null||_d2===void 0?void 0:_d2.paymentIntentClientSecret,getPaymentIntent=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){const paymentIntentResult=yield(0,retrievePaymentIntent_1.checkPaymentIntent)({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}});getPaymentIntent()}},[((_b=options?.stripe)===null||_b===void 0?void 0:_b.paymentIntentClientSecret)!=null,paymentType!=null,order?.payment_source!=null]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2,_e,_f,_g,_h,_j,_k,_l,_m;if(order?.status!=null&&["draft","pending"].includes(order?.status)){const resultCode=((_b2=(_a2=order?.payment_source)===null||_a2===void 0?void 0:_a2.payment_response)===null||_b2===void 0?void 0:_b2.resultCode)==="Authorised",paymentDetails=((_d2=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.payment_request_details)===null||_d2===void 0?void 0:_d2.details)!=null;if(paymentType==="adyen_payments"&&(!((_e=options?.adyen)===null||_e===void 0)&&_e.redirectResult)&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:(_f=options?.adyen)===null||_f===void 0?void 0:_f.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{var _a3,_b3,_c3;const resultCode2=(_a3=res?.payment_response)===null||_a3===void 0?void 0:_a3.resultCode,errorCode=(_b3=res?.payment_response)===null||_b3===void 0?void 0:_b3.errorCode,message=(_c3=res?.payment_response)===null||_c3===void 0?void 0:_c3.message;["Authorised","Pending","Received"].includes(resultCode2)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else(paymentType==="adyen_payments"&&(!((_g=options?.adyen)===null||_g===void 0)&&_g.MD)&&(!((_h=options?.adyen)===null||_h===void 0)&&_h.PaRes)&&autoPlaceOrder||paymentType==="adyen_payments"&&resultCode&&((_j=ref?.current)===null||_j===void 0?void 0:_j.disabled)===!1&¤tCustomerPaymentSourceId==null&&autoPlaceOrder&&status==="standby"&&!((_m=(_l=(_k=order?.payment_source)===null||_k===void 0?void 0:_k.payment_response)===null||_l===void 0?void 0:_l.merchantReference)===null||_m===void 0)&&_m.includes(order?.number))&&handleClick()}},[options?.adyen,paymentType,(_d=(_c=order?.payment_source)===null||_c===void 0?void 0:_c.payment_response)===null||_d===void 0?void 0:_d.resultCode]),(0,react_1.useEffect)(()=>{var _a2;paymentType==="checkout_com_payments"&&(!((_a2=options?.checkoutCom)===null||_a2===void 0)&&_a2.session_id)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.checkoutCom,paymentType]),(0,react_1.useEffect)(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=e=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2,_b2,_c2,_d2,_e;e?.preventDefault(),e?.stopPropagation(),setIsLoading(!0);let isValid=!0;setForceDisable(!0);const checkPaymentSource=paymentType!=="stripe_payments"?yield setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&(0,getCardDetails_1.default)({paymentType,customerPayment:{payment_source:checkPaymentSource}});!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit&&[!options?.paypalPayerId,!(!((_b2=options?.adyen)===null||_b2===void 0)&&_b2.MD),!(!((_c2=options?.checkoutCom)===null||_c2===void 0)&&_c2.session_id)].every(Boolean)?(isValid=yield(_d2=currentPaymentMethodRef.current)===null||_d2===void 0?void 0:_d2.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&((_e=checkPaymentSource?.payment_response)===null||_e===void 0?void 0:_e.resultCode)==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0),isValid&&setPlaceOrderStatus!=null&&setPlaceOrderStatus({status:"placing"});const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&(yield setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId}));placed&&setPlaceOrderStatus!=null?placed.placed?(setPlaceOrderStatus({status:"placing"}),onClick
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlaceOrderButton=PlaceOrderButton;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),retrievePaymentIntent_1=require("../../utils/stripe/retrievePaymentIntent");function PlaceOrderButton(props){var _a,_b,_c,_d;const ref=(0,react_1.useRef)(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick}=props,p=tslib_1.__rest(props,["children","label","loadingLabel","autoPlaceOrder","disabled","onClick"]),{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus,status}=(0,react_1.useContext)(PlaceOrderContext_1.default),[notPermitted,setNotPermitted]=(0,react_1.useState)(!0),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled),[isLoading,setIsLoading]=(0,react_1.useState)(!1),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),isFree=order?.total_amount_with_taxes_cents===0;(0,react_1.useEffect)(()=>{var _a2;if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,(_a=currentPaymentMethodRef?.current)===null||_a===void 0?void 0:_a.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),(0,react_1.useEffect)(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2;if(paymentType==="stripe_payments"&&(!((_a2=options?.stripe)===null||_a2===void 0)&&_a2.paymentIntentClientSecret)&&(!((_b2=order?.payment_source)===null||_b2===void 0)&&_b2.publishable_key)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.publishable_key,paymentIntentClientSecret=(_d2=options?.stripe)===null||_d2===void 0?void 0:_d2.paymentIntentClientSecret,getPaymentIntent=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){const paymentIntentResult=yield(0,retrievePaymentIntent_1.checkPaymentIntent)({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}});getPaymentIntent()}},[((_b=options?.stripe)===null||_b===void 0?void 0:_b.paymentIntentClientSecret)!=null,paymentType!=null,order?.payment_source!=null]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2,_e,_f,_g,_h,_j,_k,_l,_m;if(order?.status!=null&&["draft","pending"].includes(order?.status)){const resultCode=((_b2=(_a2=order?.payment_source)===null||_a2===void 0?void 0:_a2.payment_response)===null||_b2===void 0?void 0:_b2.resultCode)==="Authorised",paymentDetails=((_d2=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.payment_request_details)===null||_d2===void 0?void 0:_d2.details)!=null;if(paymentType==="adyen_payments"&&(!((_e=options?.adyen)===null||_e===void 0)&&_e.redirectResult)&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:(_f=options?.adyen)===null||_f===void 0?void 0:_f.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{var _a3,_b3,_c3;const resultCode2=(_a3=res?.payment_response)===null||_a3===void 0?void 0:_a3.resultCode,errorCode=(_b3=res?.payment_response)===null||_b3===void 0?void 0:_b3.errorCode,message=(_c3=res?.payment_response)===null||_c3===void 0?void 0:_c3.message;["Authorised","Pending","Received"].includes(resultCode2)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else(paymentType==="adyen_payments"&&(!((_g=options?.adyen)===null||_g===void 0)&&_g.MD)&&(!((_h=options?.adyen)===null||_h===void 0)&&_h.PaRes)&&autoPlaceOrder||paymentType==="adyen_payments"&&resultCode&&((_j=ref?.current)===null||_j===void 0?void 0:_j.disabled)===!1&¤tCustomerPaymentSourceId==null&&autoPlaceOrder&&status==="standby"&&!((_m=(_l=(_k=order?.payment_source)===null||_k===void 0?void 0:_k.payment_response)===null||_l===void 0?void 0:_l.merchantReference)===null||_m===void 0)&&_m.includes(order?.number))&&handleClick()}},[options?.adyen,paymentType,(_d=(_c=order?.payment_source)===null||_c===void 0?void 0:_c.payment_response)===null||_d===void 0?void 0:_d.resultCode]),(0,react_1.useEffect)(()=>{order?.status==="placed"&&order?.payment_status==="authorized"&&paymentType==="adyen_payments"&&onClick?.({placed:!0,order})},[order,order?.payment_status,order?.status,paymentType,onClick]),(0,react_1.useEffect)(()=>{var _a2;paymentType==="checkout_com_payments"&&(!((_a2=options?.checkoutCom)===null||_a2===void 0)&&_a2.session_id)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.checkoutCom,paymentType]),(0,react_1.useEffect)(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=e=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2,_b2,_c2,_d2,_e;e?.preventDefault(),e?.stopPropagation(),setIsLoading(!0);let isValid=!0;setForceDisable(!0);const checkPaymentSource=paymentType!=="stripe_payments"?yield setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&(0,getCardDetails_1.default)({paymentType,customerPayment:{payment_source:checkPaymentSource}});!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit&&[!options?.paypalPayerId,!(!((_b2=options?.adyen)===null||_b2===void 0)&&_b2.MD),!(!((_c2=options?.checkoutCom)===null||_c2===void 0)&&_c2.session_id)].every(Boolean)?(isValid=yield(_d2=currentPaymentMethodRef.current)===null||_d2===void 0?void 0:_d2.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&((_e=checkPaymentSource?.payment_response)===null||_e===void 0?void 0:_e.resultCode)==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0),isValid&&setPlaceOrderStatus!=null&&setPlaceOrderStatus({status:"placing"});const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&(yield setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId}));placed&&setPlaceOrderStatus!=null?placed.placed?(setPlaceOrderStatus({status:"placing"}),onClick?.(placed)):(setForceDisable(!1),onClick?.(placed),setIsLoading(!1),setPlaceOrderStatus({status:"standby"})):(setForceDisable(!1),setIsLoading(!1))}),disabledButton=disabled!==void 0?disabled:notPermitted,labelButton=isLoading?loadingLabel:(0,isFunction_1.default)(label)?label():label,parentProps=Object.assign(Object.assign({},p),{label,disabled:disabledButton,handleClick,parentRef:ref,isLoading});return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("button",Object.assign({ref,type:"button",disabled:disabledButton||forceDisable,onClick:e=>{handleClick(e)}},p,{children:labelButton}))}exports.default=PlaceOrderButton;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseAmountComponent } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
export declare function ShippingAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
4
|
export default ShippingAmount;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseAmountComponent } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
export declare function SubTotalAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
4
|
export default SubTotalAmount;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseAmountComponent } from '../../typings/index';
|
|
2
2
|
import type { JSX } from "react";
|
|
3
3
|
export declare function TaxesAmount(props: BaseAmountComponent): JSX.Element;
|
|
4
4
|
export default TaxesAmount;
|