@commercelayer/react-components 4.3.5 → 4.4.0-beta.2
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 +2 -2
- package/lib/cjs/components/addresses/AddressField.d.ts +3 -3
- package/lib/cjs/components/addresses/AddressInput.d.ts +2 -2
- package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressesContainer.d.ts +1 -1
- package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +1 -1
- package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
- package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
- package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +1 -1
- package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/cjs/components/customers/CustomerAddressForm.d.ts +1 -1
- package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
- package/lib/cjs/components/customers/CustomerContainer.js +1 -1
- package/lib/cjs/components/customers/CustomerField.d.ts +2 -2
- 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/SaveCustomerButton.d.ts +2 -2
- 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/GiftCardContainer.d.ts +1 -1
- package/lib/cjs/components/gift_cards/GiftCardContainer.js +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 +3 -3
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
- 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 +2 -2
- 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 +3 -3
- package/lib/cjs/components/line_items/LineItemOption.js +1 -1
- package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
- 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 +3 -3
- package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -1
- package/lib/cjs/components/orders/CartLink.d.ts +2 -2
- 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/OrderContainer.js +1 -1
- package/lib/cjs/components/orders/OrderList.d.ts +2 -2
- 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/OrderNumber.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 +2 -2
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +2 -2
- package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +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 +2 -2
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +2 -2
- 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/StripeGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.js +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 +2 -2
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
- package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -5
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +3 -3
- 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/KlarnaPayment.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSource.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
- package/lib/cjs/components/payment_source/PaypalPayment.d.ts +1 -1
- package/lib/cjs/components/payment_source/StripePayment.d.ts +7 -5
- package/lib/cjs/components/payment_source/StripePayment.js +1 -1
- package/lib/cjs/components/prices/Price.d.ts +2 -2
- package/lib/cjs/components/prices/PricesContainer.d.ts +1 -1
- package/lib/cjs/components/prices/PricesContainer.js +1 -1
- package/lib/cjs/components/shipments/Shipment.d.ts +1 -1
- package/lib/cjs/components/shipments/ShipmentField.d.ts +1 -1
- package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +1 -1
- package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/cjs/components/shipments/ShipmentsCount.d.ts +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethod.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/AvailabilityContainer.d.ts +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/cjs/components/skus/SkuField.d.ts +2 -2
- package/lib/cjs/components/skus/SkuList.d.ts +1 -1
- package/lib/cjs/components/skus/SkuListsContainer.d.ts +1 -1
- package/lib/cjs/components/skus/Skus.d.ts +1 -1
- package/lib/cjs/components/skus/SkusContainer.d.ts +1 -1
- package/lib/cjs/components/skus/SkusContainer.js +1 -1
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +2 -2
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/cjs/components/utils/BaseField.d.ts +1 -1
- package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +3 -3
- package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
- package/lib/cjs/components/utils/ErrorBoundary.d.ts +1 -1
- package/lib/cjs/components/utils/GenericFieldComponent.d.ts +7 -7
- 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 +2 -2
- package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
- package/lib/cjs/context/BillingAddressFormContext.d.ts +5 -7
- package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/cjs/context/CustomerAddressFormContext.d.ts +7 -9
- 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 +2 -2
- package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/cjs/context/LineItemContext.d.ts +2 -2
- package/lib/cjs/context/LineItemOptionChildrenContext.d.ts +5 -2
- package/lib/cjs/context/OrderContext.d.ts +3 -3
- package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
- package/lib/cjs/context/OrderListPaginationContext.d.ts +1 -1
- package/lib/cjs/context/PaymentMethodChildrenContext.d.ts +1 -1
- package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
- package/lib/cjs/context/PlaceOrderContext.d.ts +2 -2
- package/lib/cjs/context/PricesContext.d.ts +1 -1
- package/lib/cjs/context/ShipmentContext.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/reducers/AddressReducer.d.ts +6 -6
- package/lib/cjs/reducers/AvailabilityReducer.d.ts +4 -4
- 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/LineItemReducer.d.ts +6 -6
- package/lib/cjs/reducers/OrderReducer.d.ts +6 -6
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +16 -12
- package/lib/cjs/reducers/PlaceOrderReducer.d.ts +4 -1
- package/lib/cjs/reducers/PriceReducer.d.ts +6 -8
- 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 +5 -9
- package/lib/cjs/utils/PropsType.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/checkIncludeResource.d.ts +1 -1
- package/lib/cjs/utils/customMessages.d.ts +1 -1
- package/lib/cjs/utils/filterChildren.d.ts +1 -1
- package/lib/cjs/utils/getCardDetails.d.ts +3 -3
- package/lib/cjs/utils/getCardDetails.js +1 -1
- package/lib/cjs/utils/getErrors.d.ts +4 -3
- package/lib/cjs/utils/getLoaderComponent.d.ts +1 -1
- package/lib/cjs/utils/getPaymentAttributes.d.ts +3 -3
- package/lib/cjs/utils/getPrices.d.ts +2 -2
- package/lib/cjs/utils/getSdk.d.ts +1 -1
- package/lib/cjs/utils/getSkus.d.ts +1 -1
- package/lib/cjs/utils/hooks/useCustomContext.d.ts +1 -1
- package/lib/cjs/utils/localStorage.js +1 -1
- package/lib/cjs/utils/shipments.d.ts +1 -1
- package/lib/cjs/utils/validateFormFields.d.ts +6 -6
- package/lib/cjs/utils/validateFormFields.js +1 -1
- 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 +2 -2
- package/lib/esm/components/addresses/AddressField.d.ts +3 -3
- package/lib/esm/components/addresses/AddressInput.d.ts +2 -2
- package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -1
- package/lib/esm/components/addresses/AddressesContainer.d.ts +1 -1
- package/lib/esm/components/addresses/AddressesContainer.js +1 -1
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
- package/lib/esm/components/addresses/SaveAddressesButton.d.ts +2 -2
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +1 -1
- package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerAddressForm.d.ts +1 -1
- package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerContainer.js +1 -1
- package/lib/esm/components/customers/CustomerField.d.ts +2 -2
- 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/SaveCustomerButton.d.ts +2 -2
- 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/GiftCardContainer.d.ts +1 -1
- package/lib/esm/components/gift_cards/GiftCardContainer.js +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 +3 -3
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
- 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 +2 -2
- 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 +3 -3
- package/lib/esm/components/line_items/LineItemOption.js +1 -1
- package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
- 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 +3 -3
- package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -1
- package/lib/esm/components/orders/CartLink.d.ts +2 -2
- 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/OrderContainer.js +1 -1
- package/lib/esm/components/orders/OrderList.d.ts +2 -2
- 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/OrderNumber.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 +2 -2
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/orders/PlaceOrderContainer.d.ts +2 -2
- package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
- package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +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 +2 -2
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +2 -2
- 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/StripeGateway.js +1 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethod.js +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 +2 -2
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
- package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
- package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -5
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +3 -3
- 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/KlarnaPayment.js +1 -1
- package/lib/esm/components/payment_source/PaymentSource.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
- package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
- package/lib/esm/components/payment_source/PaypalPayment.d.ts +1 -1
- package/lib/esm/components/payment_source/StripePayment.d.ts +7 -5
- package/lib/esm/components/payment_source/StripePayment.js +1 -1
- package/lib/esm/components/prices/Price.d.ts +2 -2
- package/lib/esm/components/prices/PricesContainer.d.ts +1 -1
- package/lib/esm/components/prices/PricesContainer.js +1 -1
- package/lib/esm/components/shipments/Shipment.d.ts +1 -1
- package/lib/esm/components/shipments/ShipmentField.d.ts +1 -1
- package/lib/esm/components/shipments/ShipmentsContainer.d.ts +1 -1
- package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/esm/components/shipments/ShipmentsCount.d.ts +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethod.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/AvailabilityContainer.d.ts +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/esm/components/skus/SkuField.d.ts +2 -2
- package/lib/esm/components/skus/SkuList.d.ts +1 -1
- package/lib/esm/components/skus/SkuListsContainer.d.ts +1 -1
- package/lib/esm/components/skus/Skus.d.ts +1 -1
- package/lib/esm/components/skus/SkusContainer.d.ts +1 -1
- package/lib/esm/components/skus/SkusContainer.js +1 -1
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +2 -2
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -1
- package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
- package/lib/esm/components/utils/BaseField.d.ts +1 -1
- package/lib/esm/components/utils/BaseInput.d.ts +1 -1
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +3 -3
- package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
- package/lib/esm/components/utils/ErrorBoundary.d.ts +1 -1
- package/lib/esm/components/utils/GenericFieldComponent.d.ts +7 -7
- 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 +2 -2
- package/lib/esm/context/BillingAddressContext.d.ts +1 -1
- package/lib/esm/context/BillingAddressFormContext.d.ts +5 -7
- package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/esm/context/CustomerAddressFormContext.d.ts +7 -9
- 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 +2 -2
- package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/esm/context/LineItemContext.d.ts +2 -2
- package/lib/esm/context/LineItemOptionChildrenContext.d.ts +5 -2
- package/lib/esm/context/OrderContext.d.ts +3 -3
- package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
- package/lib/esm/context/OrderListPaginationContext.d.ts +1 -1
- package/lib/esm/context/PaymentMethodChildrenContext.d.ts +1 -1
- package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
- package/lib/esm/context/PlaceOrderContext.d.ts +2 -2
- package/lib/esm/context/PricesContext.d.ts +1 -1
- package/lib/esm/context/ShipmentContext.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/reducers/AddressReducer.d.ts +6 -6
- package/lib/esm/reducers/AvailabilityReducer.d.ts +4 -4
- 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/LineItemReducer.d.ts +6 -6
- package/lib/esm/reducers/OrderReducer.d.ts +6 -6
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +16 -12
- package/lib/esm/reducers/PlaceOrderReducer.d.ts +4 -1
- package/lib/esm/reducers/PriceReducer.d.ts +6 -8
- 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 +5 -9
- package/lib/esm/utils/PropsType.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/checkIncludeResource.d.ts +1 -1
- package/lib/esm/utils/customMessages.d.ts +1 -1
- package/lib/esm/utils/filterChildren.d.ts +1 -1
- package/lib/esm/utils/getCardDetails.d.ts +3 -3
- package/lib/esm/utils/getCardDetails.js +1 -1
- package/lib/esm/utils/getErrors.d.ts +4 -3
- package/lib/esm/utils/getLoaderComponent.d.ts +1 -1
- package/lib/esm/utils/getPaymentAttributes.d.ts +3 -3
- package/lib/esm/utils/getPrices.d.ts +2 -2
- package/lib/esm/utils/getSdk.d.ts +1 -1
- package/lib/esm/utils/getSkus.d.ts +1 -1
- package/lib/esm/utils/hooks/useCustomContext.d.ts +1 -1
- package/lib/esm/utils/localStorage.js +1 -1
- package/lib/esm/utils/shipments.d.ts +1 -1
- package/lib/esm/utils/validateFormFields.d.ts +6 -6
- package/lib/esm/utils/validateFormFields.js +1 -1
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
1
|
+
import { type ChangeEvent } from 'react';
|
|
2
2
|
import type { Order, PaymentMethod } from '@commercelayer/sdk';
|
|
3
|
-
import { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
import { type ChildrenFunction } from '../../typings/index';
|
|
4
4
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
5
5
|
checked: boolean;
|
|
6
6
|
handleOnChange: (event: ChangeEvent<HTMLInputElement>) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
3
3
|
interface Props {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
config?: PaymentMethodConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext,{defaultPaymentMethodContext}from"../../context/PaymentMethodContext";import{useContext,useEffect,useReducer,useMemo}from"react";import paymentMethodReducer,{paymentMethodInitialState,getPaymentMethods,setPaymentMethodConfig,setPaymentRef}from"../../reducers/PaymentMethodReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";import useCustomContext from"../../utils/hooks/useCustomContext";export function PaymentMethodsContainer(props){const{children,config}=props,[state,dispatch]=useReducer(paymentMethodReducer,paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"PaymentMethodsContainer",key:"order"}),credentials=useContext(CommerceLayerContext);async function getPayMethods(){order&&await getPaymentMethods({order,dispatch})}useEffect(()=>{include?.includes("available_payment_methods")?includeLoaded?.available_payment_methods||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0,"line_items.item":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option","line_items.item"]}),config&&isEmpty(state.config)&&setPaymentMethodConfig(config,dispatch),credentials&&order&&!state.paymentMethods&&getPayMethods(),order?.payment_source&&dispatch({type:"setPaymentSource",payload:{paymentSource:order?.payment_source}}),order?.payment_source===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include?.length,Object.keys(includeLoaded??[]).length]);const contextValue=useMemo(()=>({...state,setLoading:({loading})=>defaultPaymentMethodContext.setLoading({loading,dispatch}),setPaymentRef:({ref})=>setPaymentRef({ref,dispatch}),setPaymentMethodErrors:errors=>defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch),setPaymentMethod:async args=>await defaultPaymentMethodContext.setPaymentMethod({...args,config:credentials,updateOrder,order,dispatch,setOrderErrors}),setPaymentSource:async args=>await defaultPaymentMethodContext.setPaymentSource({...state,...args,config:credentials,dispatch,getOrder,updateOrder,order}),updatePaymentSource:async args=>await defaultPaymentMethodContext.updatePaymentSource({...args,config:credentials,dispatch}),destroyPaymentSource:async args=>await defaultPaymentMethodContext.destroyPaymentSource({...args,dispatch,config:credentials,updateOrder,orderId:order?.id})}),[state]);return _jsx(PaymentMethodContext.Provider,{value:contextValue,children})}export default PaymentMethodsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext,{defaultPaymentMethodContext}from"../../context/PaymentMethodContext";import{useContext,useEffect,useReducer,useMemo}from"react";import paymentMethodReducer,{paymentMethodInitialState,getPaymentMethods,setPaymentMethodConfig,setPaymentRef}from"../../reducers/PaymentMethodReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";import useCustomContext from"../../utils/hooks/useCustomContext";export function PaymentMethodsContainer(props){const{children,config}=props,[state,dispatch]=useReducer(paymentMethodReducer,paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"PaymentMethodsContainer",key:"order"}),credentials=useContext(CommerceLayerContext);async function getPayMethods(){order&&await getPaymentMethods({order,dispatch})}useEffect(()=>{include?.includes("available_payment_methods")?includeLoaded?.available_payment_methods||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0,"line_items.item":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option","line_items.item"]}),config&&isEmpty(state.config)&&setPaymentMethodConfig(config,dispatch),credentials&&order&&!state.paymentMethods&&getPayMethods(),order?.payment_source&&dispatch({type:"setPaymentSource",payload:{paymentSource:order?.payment_source}}),order?.payment_source===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include?.length,Object.keys(includeLoaded??[]).length]);const contextValue=useMemo(()=>({...state,setLoading:({loading})=>{defaultPaymentMethodContext.setLoading({loading,dispatch})},setPaymentRef:({ref})=>{setPaymentRef({ref,dispatch})},setPaymentMethodErrors:errors=>{defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch)},setPaymentMethod:async args=>await defaultPaymentMethodContext.setPaymentMethod({...args,config:credentials,updateOrder,order,dispatch,setOrderErrors}),setPaymentSource:async args=>await defaultPaymentMethodContext.setPaymentSource({...state,...args,config:credentials,dispatch,getOrder,updateOrder,order}),updatePaymentSource:async args=>{await defaultPaymentMethodContext.updatePaymentSource({...args,config:credentials,dispatch})},destroyPaymentSource:async args=>{await defaultPaymentMethodContext.destroyPaymentSource({...args,dispatch,config:credentials,updateOrder,orderId:order?.id})}}),[state]);return _jsx(PaymentMethodContext.Provider,{value:contextValue,children})}export default PaymentMethodsContainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
import { PaymentSourceProps } from './PaymentSource';
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import { type PaymentSourceProps } from './PaymentSource';
|
|
3
3
|
type Styles = Partial<{
|
|
4
4
|
base: CSSProperties;
|
|
5
5
|
error: CSSProperties;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HostedFieldFieldOptions } from 'braintree-web/modules/hosted-fields';
|
|
2
|
-
import { PaymentSourceProps } from './PaymentSource';
|
|
1
|
+
import { type HostedFieldFieldOptions } from 'braintree-web/modules/hosted-fields';
|
|
2
|
+
import { type PaymentSourceProps } from './PaymentSource';
|
|
3
3
|
type BraintreeHostedFields<Type> = {
|
|
4
4
|
[Property in keyof Type]: {
|
|
5
5
|
label?: string;
|
|
@@ -15,9 +15,7 @@ export interface BraintreeConfig {
|
|
|
15
15
|
fieldLabelClassName?: string;
|
|
16
16
|
inputWrapperClassName?: string;
|
|
17
17
|
fields?: BraintreeHostedFields<HostedFieldFieldOptions>;
|
|
18
|
-
styles?:
|
|
19
|
-
[key: string]: Record<string, string>;
|
|
20
|
-
};
|
|
18
|
+
styles?: Record<string, Record<string, string>>;
|
|
21
19
|
}
|
|
22
20
|
interface Props {
|
|
23
21
|
authorization: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
2
|
-
import { PaymentSourceProps } from './PaymentSource';
|
|
3
|
-
import { FramesStyle } from 'frames-react';
|
|
1
|
+
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
2
|
+
import { type PaymentSourceProps } from './PaymentSource';
|
|
3
|
+
import { type FramesStyle } from 'frames-react';
|
|
4
4
|
export interface CheckoutComConfig {
|
|
5
5
|
containerClassName?: string;
|
|
6
6
|
hintLabel?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChildrenFunction } from '../../typings/index';
|
|
1
|
+
import { type ChildrenFunction } from '../../typings/index';
|
|
2
2
|
import type { StripeElementLocale } from '@stripe/stripe-js';
|
|
3
|
-
import { PaymentSourceProps } from './PaymentSource';
|
|
3
|
+
import { type PaymentSourceProps } from './PaymentSource';
|
|
4
4
|
export interface ExternalPaymentConfig {
|
|
5
5
|
/**
|
|
6
6
|
* Show the component. Default is false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
2
|
-
import { PaymentSourceProps } from './PaymentSource';
|
|
1
|
+
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
2
|
+
import { type PaymentSourceProps } from './PaymentSource';
|
|
3
3
|
type KlarnaPaymentProps = PaymentMethodConfig['klarnaPayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
|
|
4
4
|
show?: boolean;
|
|
5
5
|
clientToken: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical";case"payment_methods":default:return null}}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({clientToken,placeOrderCallback,locale="EN",...p}){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,...divProps}=p;useEffect(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),useEffect(()=>(ref.current&&paymentSource&¤tPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=async()=>await handleClick(klarna),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=async kl=>{const[first]=paymentSource?.payment_methods||void 0,paymentMethodCategory=first?.identifier,billingAddress={given_name:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:null,organization_name:null,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shippingAddress={given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,email:order?.customer_email,street_address:order?.shipping_address?.line_1,street_address2:null,postal_code:order?.shipping_address?.zip_code,organization_name:null,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code},klarnaData={merchant_data:order?.id,purchase_country:order?.country_code,purchase_currency:order?.currency_code,locale,shipping_address:shippingAddress,billing_address:billingAddress,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items)};try{kl.Payments.load({container:"#klarna-payments-container",payment_method_category:paymentMethodCategory},{billing_address:billingAddress,shipping_address:shippingAddress},async function({show_form}){if(show_form)try{await kl.Payments.authorize({payment_method_category:paymentMethodCategory},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:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:order?.billing_address?.line_2,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shipping_address:{given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,street_address:order?.shipping_address?.line_1,street_address2:order?.shipping_address?.line_2,postal_code:order?.shipping_address?.zip_code,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code}})}return _jsx("form",{ref,children:_jsx("div",{className:containerClassName,...divProps,children:_jsx("div",{id:"klarna-payments-container"})})})}
|
|
1
|
+
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"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical";case"payment_methods":default:return null}}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({clientToken,placeOrderCallback,locale="EN",...p}){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,...divProps}=p;useEffect(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),useEffect(()=>(ref.current&&paymentSource&¤tPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=async()=>{await handleClick(klarna)},setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=async kl=>{const[first]=paymentSource?.payment_methods||void 0,paymentMethodCategory=first?.identifier,billingAddress={given_name:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:null,organization_name:null,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shippingAddress={given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,email:order?.customer_email,street_address:order?.shipping_address?.line_1,street_address2:null,postal_code:order?.shipping_address?.zip_code,organization_name:null,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code},klarnaData={merchant_data:order?.id,purchase_country:order?.country_code,purchase_currency:order?.currency_code,locale,shipping_address:shippingAddress,billing_address:billingAddress,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items)};try{kl.Payments.load({container:"#klarna-payments-container",payment_method_category:paymentMethodCategory},{billing_address:billingAddress,shipping_address:shippingAddress},async function({show_form}){if(show_form)try{await kl.Payments.authorize({payment_method_category:paymentMethodCategory},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:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:order?.billing_address?.line_2,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shipping_address:{given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,street_address:order?.shipping_address?.line_1,street_address2:order?.shipping_address?.line_2,postal_code:order?.shipping_address?.zip_code,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code}})}return _jsx("form",{ref,children:_jsx("div",{className:containerClassName,...divProps,children:_jsx("div",{id:"klarna-payments-container"})})})}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoaderType } from '../../typings/index';
|
|
2
|
-
import { CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
|
|
1
|
+
import { type LoaderType } from '../../typings/index';
|
|
2
|
+
import { type CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
|
|
3
3
|
export interface CustomerCardsProps {
|
|
4
4
|
handleClick: () => void;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IconBrand } from '../../context/PaymentSourceContext';
|
|
2
|
-
import { ChildrenFunction } from '../../typings/index';
|
|
1
|
+
import { type IconBrand } from '../../context/PaymentSourceContext';
|
|
2
|
+
import { type ChildrenFunction } from '../../typings/index';
|
|
3
3
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
4
4
|
brand: IconBrand;
|
|
5
5
|
defaultSrc: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IconBrand } from '../../context/PaymentSourceContext';
|
|
2
|
-
import { ChildrenFunction } from '../../typings/index';
|
|
1
|
+
import { type IconBrand } from '../../context/PaymentSourceContext';
|
|
2
|
+
import { type ChildrenFunction } from '../../typings/index';
|
|
3
3
|
interface CustomComponent extends Omit<Props, 'children'> {
|
|
4
4
|
brand: IconBrand;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ChildrenFunction } from '../../typings/index';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ChildrenFunction } from '../../typings/index';
|
|
3
3
|
interface CustomComponent extends Omit<Props, 'children'> {
|
|
4
4
|
}
|
|
5
5
|
type Props = {
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
3
|
-
import { PaymentSourceProps } from './PaymentSource';
|
|
1
|
+
import { type StripeElementLocale, type StripeElementsOptions, type StripePaymentElementOptions } from '@stripe/stripe-js';
|
|
2
|
+
import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
|
|
3
|
+
import { type PaymentSourceProps } from './PaymentSource';
|
|
4
4
|
export interface StripeConfig {
|
|
5
5
|
containerClassName?: string;
|
|
6
6
|
hintLabel?: string;
|
|
7
7
|
name?: string;
|
|
8
|
-
options?:
|
|
8
|
+
options?: StripePaymentElementOptions;
|
|
9
|
+
appearance?: StripeElementsOptions['appearance'];
|
|
9
10
|
[key: string]: any;
|
|
10
11
|
}
|
|
11
12
|
type Props = PaymentMethodConfig['stripePayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
|
|
12
13
|
show?: boolean;
|
|
13
14
|
publishableKey: string;
|
|
14
15
|
locale?: StripeElementLocale;
|
|
16
|
+
clientSecret: string;
|
|
15
17
|
};
|
|
16
|
-
export declare function StripePayment({ publishableKey, show, options, locale, ...p }: Props): JSX.Element | null;
|
|
18
|
+
export declare function StripePayment({ publishableKey, show, options, clientSecret, locale, ...p }: Props): JSX.Element | null;
|
|
17
19
|
export default StripePayment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{Elements,PaymentElement,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"../utils/Parent";import{setCustomerOrderParam}from"../../utils/localStorage";import OrderContext from"../../context/OrderContext";const defaultOptions={layout:{type:"accordion",defaultCollapsed:!1,radios:!0,spacedAccordionItems:!1},fields:{billingDetails:"never"}},defaultAppearance={theme:"stripe",variables:{colorText:"#32325d",fontFamily:'"Helvetica Neue", Helvetica, sans-serif'}};function StripePaymentForm({options=defaultOptions,templateCustomerSaveToWallet}){const ref=useRef(null),{currentPaymentMethodType,setPaymentMethodErrors,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),stripe=useStripe(),elements=useElements();useEffect(()=>(ref.current&&stripe&&elements&&(ref.current.onsubmit=async()=>await onSubmit({event:ref.current,stripe,elements}),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,stripe,elements]);const onSubmit=async({event,stripe:stripe2,elements:elements2})=>{if(!stripe2)return!1;const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;if(savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),elements2!=null){const billingInfo=order?.billing_address,email=order?.customer_email,billingDetails={name:billingInfo?.full_name,email,phone:billingInfo?.phone,address:{city:billingInfo?.city,country:billingInfo?.country_code,line1:billingInfo?.line_1,line2:billingInfo?.line_2,postal_code:billingInfo?.zip_code,state:billingInfo?.state_code}},{error}=await stripe2.confirmPayment({elements:elements2,confirmParams:{return_url:window.location.href,payment_method_data:{billing_details:billingDetails}}});return error?(console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1):!0}return!1};return _jsxs("form",{ref,children:[_jsx(PaymentElement,{id:"payment-element",options:{...defaultOptions,...options}}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]})}export function StripePayment({publishableKey,show,options,clientSecret,locale="auto",...p}){const[isLoaded,setIsLoaded]=useState(!1),[stripe,setStripe]=useState(null),{containerClassName,templateCustomerSaveToWallet,fonts=[],appearance,...divProps}=p;useEffect(()=>(show&&publishableKey&&import("@stripe/stripe-js").then(({loadStripe})=>{(async()=>{const res=await loadStripe(publishableKey,{locale});res!=null&&(setStripe(res),setIsLoaded(!0))})()}),()=>{setIsLoaded(!1)}),[show,publishableKey]);const elementsOptions={clientSecret,appearance:{...defaultAppearance,...appearance},fonts};return isLoaded&&stripe!=null&&clientSecret!=null?_jsx("div",{className:containerClassName,...divProps,children:_jsx(Elements,{stripe,options:elementsOptions,children:_jsx(StripePaymentForm,{options,templateCustomerSaveToWallet})})}):null}export default StripePayment;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Price as PriceType } from '@commercelayer/sdk';
|
|
2
|
-
import { ChildrenFunction, LoaderType } from '../../typings/index';
|
|
1
|
+
import { type Price as PriceType } from '@commercelayer/sdk';
|
|
2
|
+
import { type ChildrenFunction, type LoaderType } from '../../typings/index';
|
|
3
3
|
interface PriceChildrenProps extends Omit<PriceProps, 'children'> {
|
|
4
4
|
loading: boolean;
|
|
5
5
|
loader: LoaderType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import CommerceLayerContext from"../../context/CommerceLayerContext";import priceReducer,{priceInitialState,getSkusPrice,setSkuCodes}from"../../reducers/PriceReducer";import PricesContext from"../../context/PricesContext";import SkuContext from"../../context/SkuContext";export function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{skuCodes}=useContext(SkuContext);!state.skuCodes.includes(skuCode)&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode??"";useEffect(()=>{state.skuCodes.length===0&&skuCodes!=null&&skuCodes.length>0&&state.setSkuCodes!=null&&state.setSkuCodes({skuCodes,dispatch}),config.accessToken&&(state.skuCodes.length>0||sCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,perPage,filters})},[config.accessToken,sCode,state.skuCodes.length]);const priceValue={...state,skuCode:sCode,loader,setSkuCodes:params=>setSkuCodes({...params,dispatch})};return _jsx(PricesContext.Provider,{value:priceValue,children})}export default PricesContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import CommerceLayerContext from"../../context/CommerceLayerContext";import priceReducer,{priceInitialState,getSkusPrice,setSkuCodes}from"../../reducers/PriceReducer";import PricesContext from"../../context/PricesContext";import SkuContext from"../../context/SkuContext";export function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{skuCodes}=useContext(SkuContext);!state.skuCodes.includes(skuCode)&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode??"";useEffect(()=>{state.skuCodes.length===0&&skuCodes!=null&&skuCodes.length>0&&state.setSkuCodes!=null&&state.setSkuCodes({skuCodes,dispatch}),config.accessToken&&(state.skuCodes.length>0||sCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,perPage,filters})},[config.accessToken,sCode,state.skuCodes.length]);const priceValue={...state,skuCode:sCode,loader,setSkuCodes:params=>{setSkuCodes({...params,dispatch})}};return _jsx(PricesContext.Provider,{value:priceValue,children})}export default PricesContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../../context/ShipmentContext";import{useContext,useEffect,useMemo,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../../reducers/ShipmentReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";export function ShipmentsContainer(props){const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.stock_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0,"shipments.parcels.parcel_line_items":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.stock_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location","shipments.parcels.parcel_line_items"]})},[include?.length,includeLoaded!=null]),useEffect(()=>{order!=null&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order!=null,order?.shipments?.length]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type:itemType})=>itemType==="skus").map(lineItem=>!!(lineItem.item?.do_not_ship||lineItem.item?.do_not_track||lineItem.item?.inventory?.quantity>=lineItem?.quantity)).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order?.shipments]);const contextValue=useMemo(()=>({...state,setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})}),[state]);return _jsx(ShipmentContext.Provider,{value:contextValue,children})}export default ShipmentsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../../context/ShipmentContext";import{useContext,useEffect,useMemo,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../../reducers/ShipmentReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";export function ShipmentsContainer(props){const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.stock_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0,"shipments.parcels.parcel_line_items":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.stock_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location","shipments.parcels.parcel_line_items"]})},[include?.length,includeLoaded!=null]),useEffect(()=>{order!=null&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order!=null,order?.shipments?.length]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type:itemType})=>itemType==="skus").map(lineItem=>!!(lineItem.item?.do_not_ship||lineItem.item?.do_not_track||lineItem.item?.inventory?.quantity>=lineItem?.quantity)).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order?.shipments]);const contextValue=useMemo(()=>({...state,setShipmentErrors:errors=>{defaultShipmentContext.setShipmentErrors(errors,dispatch)},setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})}),[state]);return _jsx(ShipmentContext.Provider,{value:contextValue,children})}export default ShipmentsContainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TimeFormat, ChildrenFunction } from '../../typings/index';
|
|
2
|
-
import { DeliveryLeadTime } from '../../reducers/AvailabilityReducer';
|
|
1
|
+
import { type TimeFormat, type ChildrenFunction } from '../../typings/index';
|
|
2
|
+
import { type DeliveryLeadTime } from '../../reducers/AvailabilityReducer';
|
|
3
3
|
interface AvailabilityTemplateChildrenProps extends Omit<Props, 'children'>, DeliveryLeadTime {
|
|
4
4
|
text: string;
|
|
5
5
|
quantity: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConditionalElement } from '../../typings/index';
|
|
2
|
-
import { TGenericChildrenProps, TResources } from '../utils/GenericFieldComponent';
|
|
1
|
+
import { type ConditionalElement } from '../../typings/index';
|
|
2
|
+
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
3
3
|
type SkuFieldChildrenProps = TGenericChildrenProps<TResources['Sku']>;
|
|
4
4
|
type TCondition = ConditionalElement<Exclude<TResources['Sku'], 'resource'>>;
|
|
5
5
|
type Props = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import SkuContext from"../../context/SkuContext";import skuReducer,{getSku,skuInitialState}from"../../reducers/SkuReducer";import{useContext,useEffect,useMemo,useReducer}from"react";export function SkusContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=useReducer(skuReducer,skuInitialState),config=useContext(CommerceLayerContext),loadSkus=async()=>await getSku({config,dispatch,skus,queryParams});useEffect(()=>(config.accessToken&&state?.skus&&state?.skus.length===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=useMemo(()=>state,[state]);return _jsx(SkuContext.Provider,{value:contextValue,children})}export default SkusContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import SkuContext from"../../context/SkuContext";import skuReducer,{getSku,skuInitialState}from"../../reducers/SkuReducer";import{useContext,useEffect,useMemo,useReducer}from"react";export function SkusContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=useReducer(skuReducer,skuInitialState),config=useContext(CommerceLayerContext),loadSkus=async()=>{await getSku({config,dispatch,skus,queryParams})};useEffect(()=>(config.accessToken&&state?.skus&&state?.skus.length===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=useMemo(()=>state,[state]);return _jsx(SkuContext.Provider,{value:contextValue,children})}export default SkusContainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConditionalElement } from '../../typings/index';
|
|
2
|
-
import { TGenericChildrenProps, TResources } from '../utils/GenericFieldComponent';
|
|
1
|
+
import { type ConditionalElement } from '../../typings/index';
|
|
2
|
+
import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
|
|
3
3
|
type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['StockTransfer']>;
|
|
4
4
|
type TCondition = ConditionalElement<Exclude<TResources['StockTransfer'], 'resource'>>;
|
|
5
5
|
type Props = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from '@commercelayer/sdk';
|
|
2
2
|
import AddressChildrenContext from '../../context/AddressChildrenContext';
|
|
3
|
-
import { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
import { type ChildrenFunction } from '../../typings/index';
|
|
4
4
|
export interface TAddressCards extends Pick<Props, 'customerAddresses' | 'className'> {
|
|
5
5
|
AddressProvider: typeof AddressChildrenContext.Provider;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className??""} ${(deselect?"":selectedClassName)??""}`:className,finalClassName=disabled?`${className??""} ${disabledClassName??""}`:addressSelectedClass,customerAddressId=address?.reference||"";return{...attributes,className:finalClassName,onClick:async()=>await handleSelect(k,address.id,customerAddressId,disabled,address)}}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,{...value,children})}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className??""} ${(deselect?"":selectedClassName)??""}`:className,finalClassName=disabled?`${className??""} ${disabledClassName??""}`:addressSelectedClass,customerAddressId=address?.reference||"";return{...attributes,className:finalClassName,onClick:async()=>{await handleSelect(k,address.id,customerAddressId,disabled,address)}}}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,{...value,children})}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
1
|
+
import { type FunctionComponent } from 'react';
|
|
2
2
|
type BaseFieldChildren = Omit<BaseFieldProps, 'children'>;
|
|
3
3
|
export interface BaseFieldProps extends Omit<JSX.IntrinsicElements['span'], 'children'> {
|
|
4
4
|
attribute: 'number' | 'id';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BaseInputComponentProps } from '../../typings/index';
|
|
2
|
+
import { type BaseInputComponentProps } from '../../typings/index';
|
|
3
3
|
export type BaseInputProps = BaseInputComponentProps & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<Omit<BaseInputProps, "ref"> & React.RefAttributes<any>>;
|
|
5
5
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsType } from '../../utils/PropsType';
|
|
2
|
-
import { baseOrderPricePropTypes } from '../../typings/index';
|
|
3
|
-
export type BaseOrderPriceProps = PropsType<typeof baseOrderPricePropTypes> & Omit<JSX.IntrinsicElements['span'], 'children'>;
|
|
1
|
+
import { type PropsType } from '../../utils/PropsType';
|
|
2
|
+
import { type baseOrderPricePropTypes } from '../../typings/index';
|
|
3
|
+
export type BaseOrderPriceProps = PropsType<typeof baseOrderPricePropTypes, unknown> & Omit<JSX.IntrinsicElements['span'], 'children'>;
|
|
4
4
|
export declare function BaseOrderPrice(props: BaseOrderPriceProps): JSX.Element;
|
|
5
5
|
export default BaseOrderPrice;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BaseSelectComponentProps } from '../../typings/index';
|
|
2
|
+
import { type BaseSelectComponentProps } from '../../typings/index';
|
|
3
3
|
export type BaseSelectProps = BaseSelectComponentProps;
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<BaseSelectComponentProps & React.RefAttributes<any>>;
|
|
5
5
|
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { InitialSkuContext } from '../../context/SkuChildrenContext';
|
|
2
|
-
import { InitialStockTransferContext } from '../../context/StockTransferChildrenContext';
|
|
1
|
+
import { type InitialSkuContext } from '../../context/SkuChildrenContext';
|
|
2
|
+
import { type InitialStockTransferContext } from '../../context/StockTransferChildrenContext';
|
|
3
3
|
import type { Customer, LineItem, Sku, Parcel, ParcelLineItem } from '@commercelayer/sdk';
|
|
4
|
-
import { InitialLineItemContext } from '../../context/LineItemChildrenContext';
|
|
5
|
-
import { Context } from 'react';
|
|
6
|
-
import { InitialCustomerContext } from '../../context/CustomerContext';
|
|
7
|
-
import { InitialParcelContext } from '../../context/ParcelChildrenContext';
|
|
8
|
-
import { InitialParcelLineItemContext } from '../../context/ParcelLineItemChildrenContext';
|
|
4
|
+
import { type InitialLineItemContext } from '../../context/LineItemChildrenContext';
|
|
5
|
+
import { type Context } from 'react';
|
|
6
|
+
import { type InitialCustomerContext } from '../../context/CustomerContext';
|
|
7
|
+
import { type InitialParcelContext } from '../../context/ParcelChildrenContext';
|
|
8
|
+
import { type InitialParcelLineItemContext } from '../../context/ParcelLineItemChildrenContext';
|
|
9
9
|
export interface TResources {
|
|
10
10
|
StockTransfer: LineItem & {
|
|
11
11
|
resource: 'stock_transfers';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PaymentResource, PaymentSourceType } from '../../reducers/PaymentMethodReducer';
|
|
2
|
-
import PaymentSourceContext, { IconBrand } from '../../context/PaymentSourceContext';
|
|
3
|
-
import { ChildrenFunction } from '../../typings/index';
|
|
1
|
+
import { type PaymentResource, type PaymentSourceType } from '../../reducers/PaymentMethodReducer';
|
|
2
|
+
import PaymentSourceContext, { type IconBrand } from '../../context/PaymentSourceContext';
|
|
3
|
+
import { type ChildrenFunction } from '../../typings/index';
|
|
4
4
|
interface ChildrenProps extends Pick<Props, 'customerPayments'> {
|
|
5
5
|
PaymentSourceProvider: typeof PaymentSourceContext.Provider;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LineItem } from '@commercelayer/sdk';
|
|
2
|
-
import { BaseError } from '../../typings/errors';
|
|
3
|
-
import { TResourceError } from '../errors/Errors';
|
|
1
|
+
import { type LineItem } from '@commercelayer/sdk';
|
|
2
|
+
import { type BaseError } from '../../typings/errors';
|
|
3
|
+
import { type TResourceError } from '../errors/Errors';
|
|
4
4
|
export interface AllErrorsParams {
|
|
5
5
|
allErrors: BaseError[];
|
|
6
6
|
messages: BaseError[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AddressState, SetAddress, AddressResource, saveAddresses } from '../reducers/AddressReducer';
|
|
3
|
-
import { BaseError } from '../typings/errors';
|
|
2
|
+
import { type AddressState, type SetAddress, type AddressResource, type saveAddresses } from '../reducers/AddressReducer';
|
|
3
|
+
import { type BaseError } from '../typings/errors';
|
|
4
4
|
type DefaultContext = {
|
|
5
5
|
saveAddresses?: (customerEmail?: string) => ReturnType<typeof saveAddresses>;
|
|
6
6
|
setCloneAddress: (id: string, resource: AddressResource) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { BillingAddressState } from '../reducers/BillingAddressReducer';
|
|
2
|
+
import { type BillingAddressState } from '../reducers/BillingAddressReducer';
|
|
3
3
|
type DefaultContext = {
|
|
4
4
|
setBillingAddress?: (id: string, options?: {
|
|
5
5
|
customerAddressId: string;
|
|
@@ -4,13 +4,11 @@ export type AddressValuesKeys = `${keyof Address}` | `billing_address_${keyof Ad
|
|
|
4
4
|
export interface DefaultContextAddress {
|
|
5
5
|
validation?: void;
|
|
6
6
|
setValue?: (name: AddressValuesKeys, value: string | number | readonly string[]) => void;
|
|
7
|
-
errors?: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
};
|
|
7
|
+
errors?: Record<string, {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
error: boolean;
|
|
11
|
+
}>;
|
|
14
12
|
errorClassName?: string;
|
|
15
13
|
requiresBillingInfo?: boolean;
|
|
16
14
|
resetField?: (name: string) => void;
|