@commercelayer/react-components 4.0.1 → 4.1.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 +2 -9
- package/lib/cjs/components/ExternalFunction.js +1 -1
- package/lib/cjs/components/MetadataInput.d.ts +1 -11
- package/lib/cjs/components/MetadataInput.js +1 -1
- package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +1 -17
- package/lib/cjs/components/addresses/AddressCountrySelector.js +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/AddressStateSelector.d.ts +1 -17
- package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
- package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
- package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -6
- package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
- package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +4 -9
- package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
- package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +2 -7
- package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/cjs/components/customers/CustomerAddressForm.d.ts +2 -7
- package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
- package/lib/cjs/components/customers/CustomerField.d.ts +3 -3
- package/lib/cjs/components/customers/CustomerInput.d.ts +2 -14
- package/lib/cjs/components/customers/CustomerInput.js +1 -1
- package/lib/cjs/components/errors/Errors.d.ts +5 -0
- package/lib/cjs/components/errors/Errors.js +1 -0
- package/lib/cjs/components/gift_cards/GiftCard.d.ts +2 -12
- package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +2 -8
- package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -16
- package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +2 -11
- package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -6
- package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -11
- package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItem.js +1 -1
- package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemField.d.ts +3 -3
- package/lib/cjs/components/line_items/LineItemImage.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -1
- package/lib/cjs/components/orders/AddToCartButton.d.ts +4 -4
- package/lib/cjs/components/orders/OrderContainer.d.ts +12 -0
- package/lib/cjs/components/orders/OrderList.d.ts +24 -7
- package/lib/cjs/components/orders/OrderList.js +1 -1
- package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +44 -0
- package/lib/cjs/components/orders/OrderListPaginationButtons.js +1 -0
- package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +29 -0
- package/lib/cjs/components/orders/OrderListPaginationInfo.js +1 -0
- package/lib/cjs/components/orders/OrderListRow.d.ts +3 -0
- package/lib/cjs/components/orders/OrderListRow.js +1 -1
- package/lib/cjs/components/orders/OrderNumber.d.ts +1 -7
- package/lib/cjs/components/orders/OrderNumber.js +1 -1
- package/lib/cjs/components/orders/OrderStorage.d.ts +2 -10
- package/lib/cjs/components/orders/OrderStorage.js +1 -1
- package/lib/cjs/components/parcels/ParcelField.d.ts +3 -3
- package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +3 -3
- 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/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/PaymentMethod.d.ts +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
- package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -3
- package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
- package/lib/cjs/components/payment_source/PaypalPayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/StripePayment.d.ts +2 -2
- package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +2 -2
- package/lib/cjs/components/shipments/ShipmentField.d.ts +2 -2
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -13
- package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -9
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +3 -10
- package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
- package/lib/cjs/components/skus/SkuField.d.ts +3 -3
- package/lib/cjs/components/skus/SkuList.d.ts +5 -9
- package/lib/cjs/components/skus/SkuList.js +1 -1
- package/lib/cjs/components/skus/SkuListsContainer.d.ts +2 -8
- package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
- package/lib/cjs/components/skus/Skus.d.ts +2 -7
- package/lib/cjs/components/skus/Skus.js +1 -1
- package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +3 -3
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +2 -2
- package/lib/cjs/components/utils/BaseField.d.ts +1 -1
- package/lib/cjs/components/utils/BaseInput.d.ts +2 -2
- package/lib/cjs/components/utils/BaseOrderPrice.d.ts +1 -1
- package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
- package/lib/cjs/components/utils/GenericFieldComponent.d.ts +3 -3
- package/lib/cjs/components/utils/Parent.d.ts +1 -1
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +4 -4
- package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
- package/lib/cjs/components/utils/getAllErrors.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/BillingAddressFormContext.d.ts +1 -1
- package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/cjs/context/CustomerAddressFormContext.d.ts +1 -1
- package/lib/cjs/context/CustomerContext.d.ts +1 -1
- package/lib/cjs/context/ExternalFunctionContext.d.ts +1 -1
- package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
- package/lib/cjs/context/OrderListPaginationContext.d.ts +19 -0
- package/lib/cjs/context/OrderListPaginationContext.js +1 -0
- package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
- package/lib/cjs/context/PaymentSourceContext.d.ts +2 -2
- package/lib/cjs/context/PlaceOrderContext.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/SkuChildrenContext.d.ts +1 -1
- package/lib/cjs/context/SkuContext.d.ts +1 -1
- package/lib/cjs/hooks/useOrderContainer.d.ts +6 -0
- package/lib/cjs/hooks/useOrderContainer.js +1 -0
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/AddressReducer.d.ts +10 -10
- 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 +6 -6
- package/lib/cjs/reducers/GiftCardReducer.d.ts +12 -22
- package/lib/cjs/reducers/GiftCardReducer.js +1 -1
- package/lib/cjs/reducers/LineItemReducer.d.ts +4 -4
- package/lib/cjs/reducers/OrderReducer.d.ts +19 -19
- package/lib/cjs/reducers/OrderReducer.js +1 -1
- package/lib/cjs/reducers/PaymentMethodReducer.d.ts +17 -17
- package/lib/cjs/reducers/PlaceOrderReducer.d.ts +5 -5
- package/lib/cjs/reducers/PriceReducer.d.ts +3 -3
- package/lib/cjs/reducers/ShipmentReducer.d.ts +6 -6
- package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
- package/lib/cjs/reducers/SkuListsReducer.d.ts +3 -3
- package/lib/cjs/reducers/SkuReducer.d.ts +3 -3
- package/lib/cjs/typings/errors.d.ts +5 -5
- package/lib/cjs/typings/index.d.ts +25 -25
- package/lib/cjs/utils/PropsType.d.ts +4 -4
- package/lib/cjs/utils/addressesManager.d.ts +3 -3
- package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
- package/lib/cjs/utils/compareObjAttribute.d.ts +2 -2
- package/lib/cjs/utils/filterChildren.d.ts +8 -0
- package/lib/cjs/utils/filterChildren.js +1 -0
- package/lib/cjs/utils/getCardDetails.d.ts +2 -2
- package/lib/cjs/utils/getCartLink.d.ts +1 -1
- package/lib/cjs/utils/getErrors.d.ts +1 -1
- package/lib/cjs/utils/getLineItemsCount.d.ts +1 -1
- package/lib/cjs/utils/hooks/useCustomContext.js +1 -1
- package/lib/cjs/utils/jwt.d.ts +1 -1
- package/lib/cjs/utils/localStorage.d.ts +1 -1
- package/lib/cjs/utils/omit.d.ts +1 -0
- package/lib/cjs/utils/omit.js +1 -0
- package/lib/esm/components/ExternalFunction.d.ts +2 -9
- package/lib/esm/components/ExternalFunction.js +1 -1
- package/lib/esm/components/MetadataInput.d.ts +1 -11
- package/lib/esm/components/MetadataInput.js +1 -1
- package/lib/esm/components/addresses/AddressCountrySelector.d.ts +1 -17
- package/lib/esm/components/addresses/AddressCountrySelector.js +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/AddressStateSelector.d.ts +1 -17
- package/lib/esm/components/addresses/AddressStateSelector.js +1 -1
- package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
- package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -6
- package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
- package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +4 -9
- package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -1
- package/lib/esm/components/addresses/ShippingAddressForm.d.ts +2 -7
- package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerAddressForm.d.ts +2 -7
- package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
- package/lib/esm/components/customers/CustomerField.d.ts +3 -3
- package/lib/esm/components/customers/CustomerInput.d.ts +2 -14
- package/lib/esm/components/customers/CustomerInput.js +1 -1
- package/lib/esm/components/errors/Errors.d.ts +5 -0
- package/lib/esm/components/errors/Errors.js +1 -0
- package/lib/esm/components/gift_cards/GiftCard.d.ts +2 -12
- package/lib/esm/components/gift_cards/GiftCard.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +2 -8
- package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -16
- package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardInput.d.ts +2 -11
- package/lib/esm/components/gift_cards/GiftCardInput.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -6
- package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -11
- package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
- package/lib/esm/components/line_items/LineItem.js +1 -1
- package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemField.d.ts +3 -3
- package/lib/esm/components/line_items/LineItemImage.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -1
- package/lib/esm/components/orders/AddToCartButton.d.ts +4 -4
- package/lib/esm/components/orders/OrderContainer.d.ts +12 -0
- package/lib/esm/components/orders/OrderList.d.ts +24 -7
- package/lib/esm/components/orders/OrderList.js +1 -1
- package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +44 -0
- package/lib/esm/components/orders/OrderListPaginationButtons.js +1 -0
- package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +29 -0
- package/lib/esm/components/orders/OrderListPaginationInfo.js +1 -0
- package/lib/esm/components/orders/OrderListRow.d.ts +3 -0
- package/lib/esm/components/orders/OrderListRow.js +1 -1
- package/lib/esm/components/orders/OrderNumber.d.ts +1 -7
- package/lib/esm/components/orders/OrderNumber.js +1 -1
- package/lib/esm/components/orders/OrderStorage.d.ts +2 -10
- package/lib/esm/components/orders/OrderStorage.js +1 -1
- package/lib/esm/components/parcels/ParcelField.d.ts +3 -3
- package/lib/esm/components/parcels/ParcelLineItemField.d.ts +3 -3
- 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/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/PaymentMethod.d.ts +1 -1
- package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
- package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -3
- package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/KlarnaPayment.d.ts +1 -1
- package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +1 -1
- package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
- package/lib/esm/components/payment_source/PaypalPayment.d.ts +2 -2
- package/lib/esm/components/payment_source/StripePayment.d.ts +2 -2
- package/lib/esm/components/payment_source/WireTransferPayment.d.ts +2 -2
- package/lib/esm/components/shipments/ShipmentField.d.ts +2 -2
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -13
- package/lib/esm/components/shipping_methods/ShippingMethodPrice.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -9
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
- package/lib/esm/components/skus/DeliveryLeadTime.d.ts +3 -10
- package/lib/esm/components/skus/DeliveryLeadTime.js +1 -1
- package/lib/esm/components/skus/SkuField.d.ts +3 -3
- package/lib/esm/components/skus/SkuList.d.ts +5 -9
- package/lib/esm/components/skus/SkuList.js +1 -1
- package/lib/esm/components/skus/SkuListsContainer.d.ts +2 -8
- package/lib/esm/components/skus/SkuListsContainer.js +1 -1
- package/lib/esm/components/skus/Skus.d.ts +2 -7
- package/lib/esm/components/skus/Skus.js +1 -1
- package/lib/esm/components/stock_transfers/StockTransferField.d.ts +3 -3
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +2 -2
- package/lib/esm/components/utils/BaseField.d.ts +1 -1
- package/lib/esm/components/utils/BaseInput.d.ts +2 -2
- package/lib/esm/components/utils/BaseOrderPrice.d.ts +1 -1
- package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
- package/lib/esm/components/utils/GenericFieldComponent.d.ts +3 -3
- package/lib/esm/components/utils/Parent.d.ts +1 -1
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +4 -4
- package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
- package/lib/esm/components/utils/getAllErrors.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/BillingAddressFormContext.d.ts +1 -1
- package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
- package/lib/esm/context/CustomerAddressFormContext.d.ts +1 -1
- package/lib/esm/context/CustomerContext.d.ts +1 -1
- package/lib/esm/context/ExternalFunctionContext.d.ts +1 -1
- package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
- package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
- package/lib/esm/context/OrderListPaginationContext.d.ts +19 -0
- package/lib/esm/context/OrderListPaginationContext.js +1 -0
- package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
- package/lib/esm/context/PaymentSourceContext.d.ts +2 -2
- package/lib/esm/context/PlaceOrderContext.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/SkuChildrenContext.d.ts +1 -1
- package/lib/esm/context/SkuContext.d.ts +1 -1
- package/lib/esm/hooks/useOrderContainer.d.ts +6 -0
- package/lib/esm/hooks/useOrderContainer.js +1 -0
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/reducers/AddressReducer.d.ts +10 -10
- 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 +6 -6
- package/lib/esm/reducers/GiftCardReducer.d.ts +12 -22
- package/lib/esm/reducers/GiftCardReducer.js +1 -1
- package/lib/esm/reducers/LineItemReducer.d.ts +4 -4
- package/lib/esm/reducers/OrderReducer.d.ts +19 -19
- package/lib/esm/reducers/OrderReducer.js +1 -1
- package/lib/esm/reducers/PaymentMethodReducer.d.ts +17 -17
- package/lib/esm/reducers/PlaceOrderReducer.d.ts +5 -5
- package/lib/esm/reducers/PriceReducer.d.ts +3 -3
- package/lib/esm/reducers/ShipmentReducer.d.ts +6 -6
- package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
- package/lib/esm/reducers/SkuListsReducer.d.ts +3 -3
- package/lib/esm/reducers/SkuReducer.d.ts +3 -3
- package/lib/esm/typings/errors.d.ts +5 -5
- package/lib/esm/typings/index.d.ts +25 -25
- package/lib/esm/utils/PropsType.d.ts +4 -4
- package/lib/esm/utils/addressesManager.d.ts +3 -3
- package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
- package/lib/esm/utils/compareObjAttribute.d.ts +2 -2
- package/lib/esm/utils/filterChildren.d.ts +8 -0
- package/lib/esm/utils/filterChildren.js +1 -0
- package/lib/esm/utils/getCardDetails.d.ts +2 -2
- package/lib/esm/utils/getCartLink.d.ts +1 -1
- package/lib/esm/utils/getErrors.d.ts +1 -1
- package/lib/esm/utils/getLineItemsCount.d.ts +1 -1
- package/lib/esm/utils/hooks/useCustomContext.js +1 -1
- package/lib/esm/utils/jwt.d.ts +1 -1
- package/lib/esm/utils/localStorage.d.ts +1 -1
- package/lib/esm/utils/omit.d.ts +1 -0
- package/lib/esm/utils/omit.js +1 -0
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +45 -81
- package/README.md +0 -302
- package/lib/cjs/components/Errors.d.ts +0 -5
- package/lib/cjs/components/Errors.js +0 -1
- package/lib/cjs/config/components.d.ts +0 -860
- package/lib/cjs/config/components.js +0 -1
- package/lib/cjs/utils/childrenTypes.d.ts +0 -9
- package/lib/cjs/utils/childrenTypes.js +0 -1
- package/lib/esm/components/Errors.d.ts +0 -5
- package/lib/esm/components/Errors.js +0 -1
- package/lib/esm/config/components.d.ts +0 -860
- package/lib/esm/config/components.js +0 -1
- package/lib/esm/utils/childrenTypes.d.ts +0 -9
- package/lib/esm/utils/childrenTypes.js +0 -1
|
@@ -3,8 +3,8 @@ import { BaseError } from '../typings/errors';
|
|
|
3
3
|
import { DeliveryLeadTime, LineItem, Order, Shipment } from '@commercelayer/sdk';
|
|
4
4
|
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
5
|
import { getOrderContext } from './OrderReducer';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type ShipmentActionType = 'setErrors' | 'setShipments' | 'setShippingMethod';
|
|
7
|
+
export type ShipmentLineItem = LineItem & {
|
|
8
8
|
line_item: LineItem;
|
|
9
9
|
};
|
|
10
10
|
export interface ShipmentActionPayload {
|
|
@@ -12,21 +12,21 @@ export interface ShipmentActionPayload {
|
|
|
12
12
|
shipments: Shipment[];
|
|
13
13
|
deliveryLeadTimes: DeliveryLeadTime[];
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type ShipmentState = Partial<ShipmentActionPayload>;
|
|
16
16
|
export interface ShipmentAction {
|
|
17
17
|
type: ShipmentActionType;
|
|
18
18
|
payload: Partial<ShipmentActionPayload>;
|
|
19
19
|
}
|
|
20
20
|
export declare const shipmentInitialState: ShipmentState;
|
|
21
|
-
export
|
|
21
|
+
export type SetShipmentErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<ShipmentAction>) => void;
|
|
22
22
|
export declare const setShipmentErrors: SetShipmentErrors;
|
|
23
|
-
|
|
23
|
+
type GetShipments = (args: {
|
|
24
24
|
order: Order;
|
|
25
25
|
dispatch: Dispatch<ShipmentAction>;
|
|
26
26
|
config: CommerceLayerConfig;
|
|
27
27
|
}) => Promise<void>;
|
|
28
28
|
export declare const getShipments: GetShipments;
|
|
29
|
-
|
|
29
|
+
type SetShippingMethod = (args: {
|
|
30
30
|
config: CommerceLayerConfig;
|
|
31
31
|
shipmentId: string;
|
|
32
32
|
shippingMethodId: string;
|
|
@@ -3,18 +3,18 @@ import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
|
3
3
|
import { Order } from '@commercelayer/sdk';
|
|
4
4
|
import { getOrderContext } from './OrderReducer';
|
|
5
5
|
import { AddressResource } from './AddressReducer';
|
|
6
|
-
export
|
|
6
|
+
export type ShippingAddressActionType = 'setShippingAddress' | 'setShippingCustomerAddressId' | 'cleanup';
|
|
7
7
|
export interface ShippingAddressActionPayload {
|
|
8
8
|
_shipping_address_clone_id: string;
|
|
9
9
|
shippingCustomerAddressId: string;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type ShippingAddressState = Partial<ShippingAddressActionPayload>;
|
|
12
12
|
export interface ShippingAddressAction {
|
|
13
13
|
type: ShippingAddressActionType;
|
|
14
14
|
payload: Partial<ShippingAddressActionPayload>;
|
|
15
15
|
}
|
|
16
16
|
export declare const shippingAddressInitialState: ShippingAddressState;
|
|
17
|
-
export
|
|
17
|
+
export type SetShippingAddress = (id: string, options?: {
|
|
18
18
|
config: CommerceLayerConfig;
|
|
19
19
|
dispatch: Dispatch<ShippingAddressAction>;
|
|
20
20
|
order?: Order | null;
|
|
@@ -22,7 +22,7 @@ export declare type SetShippingAddress = (id: string, options?: {
|
|
|
22
22
|
customerAddressId?: string;
|
|
23
23
|
}) => Promise<void>;
|
|
24
24
|
export declare const setShippingAddress: SetShippingAddress;
|
|
25
|
-
|
|
25
|
+
type SetShippingCustomerAddressId = (args: {
|
|
26
26
|
dispatch: Dispatch<ShippingAddressAction>;
|
|
27
27
|
order: Order;
|
|
28
28
|
setCloneAddress: (id: string, resource: AddressResource) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dispatch } from 'react';
|
|
2
2
|
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
type SkuListsActionType = 'getSkuList' | 'setSkuList';
|
|
4
|
+
export type SkuListsState = Partial<{
|
|
5
5
|
listIds: string[];
|
|
6
6
|
skuLists: Record<string, any>;
|
|
7
7
|
}>;
|
|
@@ -10,7 +10,7 @@ export interface SkuListsAction {
|
|
|
10
10
|
payload: Partial<SkuListsState>;
|
|
11
11
|
type: SkuListsActionType;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type GetSkuList = (params: {
|
|
14
14
|
config: CommerceLayerConfig;
|
|
15
15
|
dispatch: Dispatch<SkuListsAction>;
|
|
16
16
|
listIds: string[];
|
|
@@ -2,9 +2,9 @@ import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
|
2
2
|
import { BaseAction } from '../typings/index';
|
|
3
3
|
import { QueryParamsList, Sku } from '@commercelayer/sdk';
|
|
4
4
|
import { Dispatch } from 'react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
5
|
+
type SkuActionType = 'getSkus' | 'setLoading';
|
|
6
|
+
type SkuAction = BaseAction<SkuActionType, SkuState>;
|
|
7
|
+
export type SkuState = Partial<{
|
|
8
8
|
skus: Sku[];
|
|
9
9
|
loading: boolean;
|
|
10
10
|
skuCodes: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import { ChildrenFunction } from './index';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type CodeErrorType = 'EMPTY_ERROR' | 'FILTER_NOT_ALLOWED' | 'FORBIDDEN' | 'INTERNAL_SERVER_ERROR' | 'INVALID_DATA_FORMAT' | 'INVALID_FIELD' | 'INVALID_FIELD_FORMAT' | 'INVALID_FIELD_VALUE' | 'INVALID_FILTERS_SYNTAX' | 'INVALID_FILTER_VALUE' | 'INVALID_INCLUDE' | 'INVALID_LINKS_OBJECT' | 'INVALID_PAGE_OBJECT' | 'INVALID_PAGE_VALUE' | 'INVALID_RESOURCE' | 'INVALID_RESOURCE_ID' | 'INVALID_SORT_CRITERIA' | 'INVALID_TOKEN' | 'KEY_NOT_INCLUDED_IN_URL' | 'KEY_ORDER_MISMATCH' | 'LOCKED' | 'NOT_ACCEPTABLE' | 'OUT_OF_STOCK' | 'PARAM_MISSING' | 'PARAM_NOT_ALLOWED' | 'PAYMENT_NOT_APPROVED_FOR_EXECUTION' | 'PAYMENT_INTENT_AUTHENTICATION_FAILURE' | 'RECORD_NOT_FOUND' | 'RECORD_NOT_FOUND' | 'RELATION_EXISTS' | 'NO_SHIPPING_METHODS' | 'SAVE_FAILED' | 'TYPE_MISMATCH' | 'UNAUTHORIZED' | 'UNSUPPORTED_MEDIA_TYPE' | 'VALIDATION_ERROR';
|
|
4
|
+
export type ResourceErrorType = 'addresses' | 'billing_address' | 'gift_cards' | 'gift_card_or_coupon_code' | 'line_items' | 'orders' | 'payment_methods' | 'prices' | 'shipments' | 'shipping_address' | 'customer_address' | 'sku_options' | 'variant';
|
|
5
5
|
export interface BaseError {
|
|
6
6
|
code: CodeErrorType;
|
|
7
7
|
message: string;
|
|
@@ -24,17 +24,17 @@ export declare const ErrorPropTypes: {
|
|
|
24
24
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
25
|
field: PropTypes.Requireable<string>;
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
type ErrorChildrenComponentProps = ChildrenFunction<Omit<ErrorComponentProps, 'children'> & {
|
|
28
28
|
errors: string[];
|
|
29
29
|
}>;
|
|
30
30
|
export interface ErrorComponentProps {
|
|
31
31
|
/**
|
|
32
|
-
* Resource which
|
|
32
|
+
* Resource which get the error
|
|
33
33
|
*/
|
|
34
34
|
resource: ResourceErrorType;
|
|
35
35
|
children?: ErrorChildrenComponentProps;
|
|
36
36
|
/**
|
|
37
|
-
* Field which
|
|
37
|
+
* Field which get the error
|
|
38
38
|
*/
|
|
39
39
|
field?: string;
|
|
40
40
|
/**
|
|
@@ -22,8 +22,8 @@ export declare const BaseSelectComponentPropTypes: {
|
|
|
22
22
|
value: PropTypes.Requireable<string>;
|
|
23
23
|
name: PropTypes.Validator<string>;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
26
|
-
|
|
25
|
+
export type SelectPlaceholder = Option;
|
|
26
|
+
type BaseSelectChildrenComponentProps = Omit<BaseSelectComponentProps, 'children'>;
|
|
27
27
|
interface Option {
|
|
28
28
|
label: string;
|
|
29
29
|
value: string | number;
|
|
@@ -46,7 +46,7 @@ export declare const BaseInputComponentPropTypes: {
|
|
|
46
46
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
47
|
placeholder: PropTypes.Requireable<string>;
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
type BaseInputChildrenComponentProps = Omit<BaseInputComponentProps, 'children'> & {
|
|
50
50
|
handleChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
51
51
|
parentRef: ForwardedRef<any>;
|
|
52
52
|
};
|
|
@@ -57,21 +57,21 @@ export interface BaseInputComponentProps {
|
|
|
57
57
|
onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
58
58
|
placeholder?: string;
|
|
59
59
|
}
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export
|
|
63
|
-
export
|
|
64
|
-
export
|
|
65
|
-
export
|
|
66
|
-
export
|
|
60
|
+
export type LineItemType = 'gift_cards' | 'payment_methods' | 'promotions' | 'shipments' | 'skus' | 'bundles' | 'adjustments';
|
|
61
|
+
export type GiftCardInputName = 'balanceCents' | 'balanceMaxCents' | 'singleUse' | 'rechargeable' | 'imageUrl' | 'expiresAt' | 'referenceOrigin' | 'email' | 'firstName' | 'lastName' | 'reference';
|
|
62
|
+
export type AddressInputName = 'billing_address_city' | 'billing_address_company' | 'billing_address_first_name' | 'billing_address_email' | 'billing_address_last_name' | 'billing_address_line_1' | 'billing_address_line_2' | 'billing_address_phone' | 'billing_address_state_code' | 'billing_address_zip_code' | 'billing_address_billing_info' | 'billing_address_save_to_customer_book' | 'customer_address_city' | 'customer_address_company' | 'customer_address_first_name' | 'customer_address_email' | 'customer_address_last_name' | 'customer_address_line_1' | 'customer_address_line_2' | 'customer_address_phone' | 'customer_address_state_code' | 'customer_address_zip_code' | 'customer_address_billing_info' | 'shipping_address_city' | 'shipping_address_company' | 'shipping_address_email' | 'shipping_address_first_name' | 'shipping_address_last_name' | 'shipping_address_line_1' | 'shipping_address_line_2' | 'shipping_address_phone' | 'shipping_address_state_code' | 'shipping_address_zip_code' | 'shipping_address_save_to_customer_book';
|
|
63
|
+
export type AddressCountrySelectName = 'billing_address_country_code' | 'shipping_address_country_code' | 'customer_address_country_code';
|
|
64
|
+
export type AddressStateSelectName = 'billing_address_state_code' | 'shipping_address_state_code' | 'customer_address_state_code';
|
|
65
|
+
export type BaseInputType = 'checkbox' | 'date' | 'email' | 'number' | 'tel' | 'text' | 'textarea';
|
|
66
|
+
export type LoaderType = string | ReactNode;
|
|
67
67
|
export declare const BMObject: PropTypes.Requireable<{
|
|
68
68
|
[x: string]: string | null | undefined;
|
|
69
69
|
}>;
|
|
70
70
|
export interface BaseMetadataObject {
|
|
71
71
|
[key: string]: string | undefined | null;
|
|
72
72
|
}
|
|
73
|
-
export
|
|
74
|
-
export
|
|
73
|
+
export type TimeFormat = 'days' | 'hours';
|
|
74
|
+
export type BaseComponent = InferProps<typeof BC>;
|
|
75
75
|
export interface BaseAction<A = string, P = Record<string, any>> {
|
|
76
76
|
type: A;
|
|
77
77
|
payload: P;
|
|
@@ -80,14 +80,14 @@ export interface BaseState {
|
|
|
80
80
|
[key: string]: any;
|
|
81
81
|
errors?: BaseError[];
|
|
82
82
|
}
|
|
83
|
-
export
|
|
84
|
-
export
|
|
85
|
-
export
|
|
86
|
-
export
|
|
83
|
+
export type BaseActionType<T = string> = T[];
|
|
84
|
+
export type BFSetStateContainer<T> = <P extends T>(param: P) => void;
|
|
85
|
+
export type BaseReducer = <S extends BaseState, A extends BaseAction, T extends BaseActionType>(state: S, action: A, type: T) => S;
|
|
86
|
+
export type BaseUnsetState<A> = (dispatch: Dispatch<A>) => void;
|
|
87
87
|
export interface BaseMetadata {
|
|
88
88
|
[key: string]: string | undefined | null;
|
|
89
89
|
}
|
|
90
|
-
export
|
|
90
|
+
export type BaseFormatPrice = 'formatted' | 'cents' | 'float';
|
|
91
91
|
export declare const baseOrderPricePropTypes: {
|
|
92
92
|
id: PropTypes.Requireable<string>;
|
|
93
93
|
className: PropTypes.Requireable<string>;
|
|
@@ -106,9 +106,9 @@ export declare const baseOrderComponentPricePropTypes: {
|
|
|
106
106
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
107
107
|
format: PropTypes.Requireable<BaseFormatPrice>;
|
|
108
108
|
};
|
|
109
|
-
export
|
|
110
|
-
export
|
|
111
|
-
export
|
|
109
|
+
export type BasePriceType = 'total' | 'option' | 'unit';
|
|
110
|
+
export type BaseSelectorType = 'select' | 'radio';
|
|
111
|
+
export type BaseAmountComponentChildren = Omit<BaseAmountComponent, 'children'>;
|
|
112
112
|
export interface BaseAmountComponent extends Omit<JSX.IntrinsicElements['span'], 'children'> {
|
|
113
113
|
children?: ChildrenFunction<BaseAmountComponentChildren>;
|
|
114
114
|
format?: BaseFormatPrice;
|
|
@@ -116,13 +116,13 @@ export interface BaseAmountComponent extends Omit<JSX.IntrinsicElements['span'],
|
|
|
116
116
|
priceCents?: number;
|
|
117
117
|
labelFree?: string;
|
|
118
118
|
}
|
|
119
|
-
export
|
|
120
|
-
export
|
|
121
|
-
export
|
|
122
|
-
export
|
|
119
|
+
export type ChildrenFunction<P = Record<string, any>> = (props: P) => JSX.Element | null;
|
|
120
|
+
export type ExcludeTag<T extends keyof JSX.IntrinsicElements> = Exclude<keyof JSX.IntrinsicElements, T>;
|
|
121
|
+
export type ExtractTag<T extends keyof JSX.IntrinsicElements> = Extract<keyof JSX.IntrinsicElements, T>;
|
|
122
|
+
export type ConditionalElement<E> = ({
|
|
123
123
|
attribute: Extract<keyof E, 'image_url'>;
|
|
124
124
|
tagElement: ExtractTag<'img'>;
|
|
125
|
-
} &
|
|
125
|
+
} & JSX.IntrinsicElements['img']) | ({
|
|
126
126
|
attribute: Exclude<keyof E, 'image_url'>;
|
|
127
127
|
tagElement: ExcludeTag<'img'>;
|
|
128
128
|
} & Omit<JSX.IntrinsicElements[ExcludeTag<'img'>], 'children'>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
3
|
+
type Defined<T> = T extends undefined ? never : T;
|
|
4
4
|
/**
|
|
5
5
|
* Get the type that represents the props with the defaultProps included.
|
|
6
6
|
*
|
|
@@ -14,7 +14,7 @@ declare type Defined<T> = T extends undefined ? never : T;
|
|
|
14
14
|
* So, instead we take the union type in cases when a property in defaultProps does not extend
|
|
15
15
|
* the corresponding property in the Props declaration.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
type WithDefaultProps<P, DP> = Omit<P, keyof DP> & {
|
|
18
18
|
[K in Extract<keyof DP, keyof P>]: DP[K] extends Defined<P[K]> ? Defined<P[K]> : Defined<P[K]> | DP[K];
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
@@ -29,5 +29,5 @@ declare type WithDefaultProps<P, DP> = Omit<P, keyof DP> & {
|
|
|
29
29
|
* type Props = PropsType<typeof propTypes, typeof defaultProps>;
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type PropsType<PT, DP = {}> = WithDefaultProps<PropTypes.InferProps<PT>, DP>;
|
|
33
33
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BaseError } from '../typings/errors';
|
|
2
2
|
import { Address, AddressCreate } from '@commercelayer/sdk';
|
|
3
3
|
import { TCustomerAddress } from '../reducers/CustomerReducer';
|
|
4
|
-
|
|
4
|
+
type BillingAddressController = (params: {
|
|
5
5
|
billing_address?: AddressCreate;
|
|
6
6
|
billingAddressId?: string;
|
|
7
7
|
errors?: BaseError[];
|
|
8
8
|
requiresBillingInfo?: boolean;
|
|
9
9
|
}) => boolean;
|
|
10
10
|
export declare const billingAddressController: BillingAddressController;
|
|
11
|
-
|
|
11
|
+
type ShippingAddressController = (params: {
|
|
12
12
|
billingDisable?: boolean;
|
|
13
13
|
errors?: BaseError[];
|
|
14
14
|
shipToDifferentAddress?: boolean;
|
|
@@ -16,7 +16,7 @@ declare type ShippingAddressController = (params: {
|
|
|
16
16
|
shippingAddressId?: string;
|
|
17
17
|
}) => boolean;
|
|
18
18
|
export declare const shippingAddressController: ShippingAddressController;
|
|
19
|
-
|
|
19
|
+
type CountryLockController = (params: {
|
|
20
20
|
addresses?: Address[] | null;
|
|
21
21
|
billing_address?: TCustomerAddress;
|
|
22
22
|
billingAddressId?: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props<T> {
|
|
3
|
+
children: JSX.Element | JSX.Element[];
|
|
4
|
+
filterBy: T[];
|
|
5
|
+
componentName: string;
|
|
6
|
+
}
|
|
7
|
+
export default function filterChildren<T = string>({ children, filterBy, componentName }: Props<T>): JSX.Element | JSX.Element[];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function filterChildren({children,filterBy,componentName}){if(Array.isArray(children)?children.filter(child=>typeof child.type=="string").length>0:typeof children.type=="string")throw new Error(`Only library components are allowed into <${componentName}/>`);return Array.isArray(children)?children.filter(child=>filterBy.includes(child.type.displayName)):children}exports.default=filterChildren;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IconBrand } from '../context/PaymentSourceContext';
|
|
2
2
|
import { PaymentResource } from '../reducers/PaymentMethodReducer';
|
|
3
3
|
import { CustomerPaymentSource } from '@commercelayer/sdk';
|
|
4
|
-
|
|
4
|
+
type CardDetails = {
|
|
5
5
|
brand: IconBrand | string;
|
|
6
6
|
last4: string;
|
|
7
7
|
exp_month: number | string;
|
|
8
8
|
exp_year: number | string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type Args = {
|
|
11
11
|
paymentType: PaymentResource;
|
|
12
12
|
customerPayment: Partial<CustomerPaymentSource>;
|
|
13
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseError, ResourceErrorType } from '../typings/errors';
|
|
2
2
|
import { Dispatch } from 'react';
|
|
3
3
|
export default function getErrors(error: any, resource: ResourceErrorType, field?: string): BaseError[];
|
|
4
|
-
|
|
4
|
+
type SetErrorsArgs<D> = {
|
|
5
5
|
currentErrors?: BaseError[];
|
|
6
6
|
newErrors?: BaseError[];
|
|
7
7
|
dispatch?: D;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LineItem } from '@commercelayer/sdk';
|
|
2
2
|
import { LineItemType } from '../typings/index';
|
|
3
|
-
export
|
|
3
|
+
export type TypeAccepted = Extract<LineItemType, 'skus' | 'gift_cards' | 'bundles' | 'adjustments'>;
|
|
4
4
|
interface Args {
|
|
5
5
|
lineItems: LineItem[];
|
|
6
6
|
quantity?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const react_1=require("react");function useCustomContext({context,key,currentComponentName,contextComponentName}){const currentContext=(0,react_1.useContext)(context),isProduction=process.env.NODE_ENV==="production",msg=`Cannot use <${currentComponentName}/> outside of <${contextComponentName}/>`;if(key!=null&&key in currentContext||key==null&¤tContext!=null)return currentContext;if(isProduction)console.error(msg);else throw new Error(msg);return currentContext}exports.default=useCustomContext;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const react_1=require("react");function useCustomContext({context,key,currentComponentName,contextComponentName}){const currentContext=(0,react_1.useContext)(context),isProduction=process.env.NODE_ENV==="production",msg=`Cannot use <${currentComponentName}/> outside of <${contextComponentName}/>`;if(key!=null&&key in currentContext||key==null&¤tContext!=null||currentContext!=null)return currentContext;if(isProduction)console.error(msg);else throw new Error(msg);return currentContext}exports.default=useCustomContext;
|
package/lib/cjs/utils/jwt.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export declare const deleteLocalOrder: DeleteLocalOrder;
|
|
|
13
13
|
export declare const getSavePaymentSourceToCustomerWallet: () => boolean;
|
|
14
14
|
export declare const getSaveBillingAddressToAddressBook: () => boolean;
|
|
15
15
|
export declare const getSaveShippingAddressToAddressBook: () => boolean;
|
|
16
|
-
export
|
|
16
|
+
export type CustomerOrderParams = '_save_payment_source_to_customer_wallet' | '_save_billing_address_to_customer_address_book' | '_save_shipping_address_to_customer_address_book';
|
|
17
17
|
export declare function setCustomerOrderParam<T extends CustomerOrderParams>(key: T, value: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function omit<O extends Record<string, any>, K extends Array<keyof O>>(obj: O, keys: K): Pick<O, Exclude<keyof O, K[number]>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function omit(obj,keys){return Object.fromEntries(Object.entries(obj).filter(([k,_])=>!keys.includes(k)))}exports.default=omit;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
url: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function ExternalFunction({ children, url }: Props): JSX.Element;
|
|
7
|
-
export declare namespace ExternalFunction {
|
|
8
|
-
var propTypes: {
|
|
9
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
10
|
-
url: import("prop-types").Validator<string>;
|
|
11
|
-
};
|
|
12
|
-
var displayName: string;
|
|
13
5
|
}
|
|
6
|
+
export declare function ExternalFunction({ children, url }: Props): JSX.Element;
|
|
14
7
|
export default ExternalFunction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import ExternalFunctionContext,{callExternalFunction}from"../context/ExternalFunctionContext";
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import ExternalFunctionContext,{callExternalFunction}from"../context/ExternalFunctionContext";export function ExternalFunction({children,url}){return _jsx(ExternalFunctionContext.Provider,{value:{url,callExternalFunction},children})}export default ExternalFunction;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseInputComponentProps } from '../typings/index';
|
|
3
|
-
|
|
3
|
+
type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
4
4
|
export declare function MetadataInput(props: Props): JSX.Element;
|
|
5
|
-
export declare namespace MetadataInput {
|
|
6
|
-
var propTypes: {
|
|
7
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
8
|
-
name: import("prop-types").Validator<string>;
|
|
9
|
-
type: import("prop-types").Validator<NonNullable<import("../typings/index").BaseInputType>>;
|
|
10
|
-
onChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
11
|
-
placeholder: import("prop-types").Requireable<string>;
|
|
12
|
-
};
|
|
13
|
-
var displayName: string;
|
|
14
|
-
}
|
|
15
5
|
export default MetadataInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";export function MetadataInput(props){return _jsx(BaseInput,{"data-metadata":!0,...props})}export default MetadataInput;
|
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AddressCountrySelectName, BaseSelectComponentProps } from '../../typings/index';
|
|
3
3
|
import { AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
4
|
-
|
|
4
|
+
type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
|
|
5
5
|
name: Extract<AddressValuesKeys, AddressCountrySelectName>;
|
|
6
6
|
required?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
} & Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'>;
|
|
9
9
|
export declare function AddressCountrySelector(props: Props): JSX.Element;
|
|
10
|
-
export declare namespace AddressCountrySelector {
|
|
11
|
-
var propTypes: {
|
|
12
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
13
|
-
placeholder: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
14
|
-
label: import("prop-types").Validator<string>;
|
|
15
|
-
value: import("prop-types").Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
16
|
-
}>>;
|
|
17
|
-
value: import("prop-types").Requireable<string>;
|
|
18
|
-
name: import("prop-types").Validator<NonNullable<AddressCountrySelectName>>;
|
|
19
|
-
required: import("prop-types").Requireable<boolean>;
|
|
20
|
-
};
|
|
21
|
-
var defaultProps: {
|
|
22
|
-
required: boolean;
|
|
23
|
-
};
|
|
24
|
-
var displayName: string;
|
|
25
|
-
}
|
|
26
10
|
export default AddressCountrySelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseSelect from"../utils/BaseSelect";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseSelect from"../utils/BaseSelect";import BillingAddressFormContext from"../../context/BillingAddressFormContext";import ShippingAddressFormContext from"../../context/ShippingAddressFormContext";import{getCountries}from"../../utils/countryStateCity";import CustomerAddressFormContext from"../../context/CustomerAddressFormContext";export function AddressCountrySelector(props){const{required=!0,value,name,className,...p}=props,billingAddress=useContext(BillingAddressFormContext),shippingAddress=useContext(ShippingAddressFormContext),customerAddress=useContext(CustomerAddressFormContext),[hasError,setHasError]=useState(!1);useEffect(()=>(value&&billingAddress?.setValue&&billingAddress.setValue(name,value),value&&shippingAddress?.setValue&&shippingAddress.setValue(name,value),value&&customerAddress?.setValue&&customerAddress.setValue(name,value),billingAddress.errors&&billingAddress?.errors?.[name]?.error&&setHasError(!0),billingAddress?.errors?.[name]&&hasError&&setHasError(!1),customerAddress.errors&&customerAddress?.errors?.[name]?.error&&setHasError(!0),customerAddress?.errors?.[name]&&hasError&&setHasError(!1),shippingAddress.errors&&shippingAddress?.errors?.[name]?.error&&setHasError(!0),shippingAddress?.errors?.[name]&&hasError&&setHasError(!1),()=>{setHasError(!1)}),[value,billingAddress?.errors,shippingAddress?.errors,customerAddress?.errors]);const errorClassName=billingAddress?.errorClassName||shippingAddress?.errorClassName||customerAddress?.errorClassName,classNameComputed=`${className??""} ${hasError&&errorClassName?errorClassName:""}`;return _jsx(BaseSelect,{className:classNameComputed,ref:billingAddress?.validation||shippingAddress?.validation||customerAddress?.validation,required,options:getCountries(),name,value,...p})}export default AddressCountrySelector;
|
|
@@ -5,8 +5,8 @@ import { ChildrenFunction } from '../../typings/index';
|
|
|
5
5
|
interface ChildrenProps extends Omit<Props, 'children' | 'name'> {
|
|
6
6
|
address: Address;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type ChildrenProp = ChildrenFunction<ChildrenProps>;
|
|
9
|
+
type Props = {
|
|
10
10
|
type?: 'field';
|
|
11
11
|
label?: never;
|
|
12
12
|
onClick?: never;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseInputComponentProps, AddressInputName } from '../../typings/index';
|
|
3
3
|
import { AddressValuesKeys } from '../../context/BillingAddressFormContext';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
name: Extract<AddressValuesKeys, AddressInputName>;
|
|
6
6
|
} & Omit<BaseInputComponentProps, 'name'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
7
7
|
export declare function AddressInput(props: Props): JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AddressStateSelectName, BaseSelectComponentProps } from '../../typings/index';
|
|
3
|
-
|
|
3
|
+
type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
|
|
4
4
|
name: AddressStateSelectName;
|
|
5
5
|
required?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
@@ -8,20 +8,4 @@ declare type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
|
|
|
8
8
|
selectClassName?: string;
|
|
9
9
|
} & Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'>;
|
|
10
10
|
export declare function AddressStateSelector(props: Props): JSX.Element;
|
|
11
|
-
export declare namespace AddressStateSelector {
|
|
12
|
-
var propTypes: {
|
|
13
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
14
|
-
placeholder: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
15
|
-
label: import("prop-types").Validator<string>;
|
|
16
|
-
value: import("prop-types").Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
17
|
-
}>>;
|
|
18
|
-
value: import("prop-types").Requireable<string>;
|
|
19
|
-
name: import("prop-types").Validator<NonNullable<AddressStateSelectName>>;
|
|
20
|
-
required: import("prop-types").Requireable<boolean>;
|
|
21
|
-
};
|
|
22
|
-
var defaultProps: {
|
|
23
|
-
required: boolean;
|
|
24
|
-
};
|
|
25
|
-
var displayName: string;
|
|
26
|
-
}
|
|
27
11
|
export default AddressStateSelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseSelect from"../utils/BaseSelect";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseSelect from"../utils/BaseSelect";import BillingAddressFormContext from"../../context/BillingAddressFormContext";import ShippingAddressFormContext from"../../context/ShippingAddressFormContext";import isEmpty from"lodash/isEmpty";import{getStateOfCountry,isValidState}from"../../utils/countryStateCity";import isEmptyStates from"../../utils/isEmptyStates";import AddressesContext from"../../context/AddressContext";import BaseInput from"../utils/BaseInput";import CustomerAddressFormContext from"../../context/CustomerAddressFormContext";export function AddressStateSelector(props){const{required=!0,value,name,className="",inputClassName="",selectClassName="",...p}=props,billingAddress=useContext(BillingAddressFormContext),shippingAddress=useContext(ShippingAddressFormContext),customerAddress=useContext(CustomerAddressFormContext),{errors:addressErrors}=useContext(AddressesContext),[hasError,setHasError]=useState(!1),[countryCode,setCountryCode]=useState(""),[val,setVal]=useState(value||"");useEffect(()=>{const billingCountryCode=typeof billingAddress?.values?.billing_address_country_code=="string"?billingAddress?.values?.billing_address_country_code:billingAddress?.values?.billing_address_country_code?.value;billingCountryCode&&billingCountryCode!==countryCode&&setCountryCode(billingCountryCode);const shippingCountryCode=typeof shippingAddress?.values?.shipping_address_country_code=="string"?shippingAddress?.values?.shipping_address_country_code:shippingAddress?.values?.shipping_address_country_code?.value;if(shippingCountryCode&&shippingCountryCode!==countryCode&&setCountryCode(shippingCountryCode),[Object.keys(billingAddress).length>0,billingCountryCode,countryCode!==billingCountryCode].every(Boolean)&&billingCountryCode&&!isValidState(val,billingCountryCode)&&!isEmptyStates(billingCountryCode)&&(billingAddress.resetField&&billingAddress?.resetField(name),setVal("")),[!isEmpty(shippingAddress),shippingCountryCode,countryCode!==shippingCountryCode].every(Boolean)&&shippingCountryCode&&!isValidState(val,shippingCountryCode)&&!isEmptyStates(shippingCountryCode)&&(shippingAddress.resetField&&shippingAddress?.resetField(name),setVal("")),!isEmpty(billingAddress)){const fieldError=billingAddress?.errors?.[name]?.error;setHasError(!!fieldError)}if(!isEmpty(customerAddress)){const fieldError=customerAddress?.errors?.[name]?.error;setHasError(!!fieldError)}if(!isEmpty(shippingAddress)){const fieldError=shippingAddress?.errors?.[name]?.error;setHasError(!!fieldError)}return()=>{setHasError(!1)}},[value,billingAddress,shippingAddress,addressErrors,customerAddress]);const errorClassName=billingAddress?.errorClassName||shippingAddress?.errorClassName||customerAddress?.errorClassName||"",classNameComputed=isEmptyStates(countryCode)?`${className} ${inputClassName} ${hasError?errorClassName:""}`:`${className} ${selectClassName} ${hasError?errorClassName:""}`;return isEmptyStates(countryCode)?_jsx(BaseInput,{...p,name,ref:billingAddress?.validation||shippingAddress?.validation||customerAddress?.validation,className:classNameComputed,required,placeholder:p.placeholder?.label||"",defaultValue:val,type:"text"}):_jsx(BaseSelect,{...p,className:classNameComputed,ref:billingAddress?.validation||shippingAddress?.validation||customerAddress?.validation,required,options:getStateOfCountry(countryCode),name,value:val})}export default AddressStateSelector;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
reset?: boolean;
|
|
5
5
|
errorClassName?: string;
|
|
6
6
|
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
7
7
|
export declare function BillingAddressForm(props: Props): JSX.Element;
|
|
8
|
-
export declare namespace BillingAddressForm {
|
|
9
|
-
var propTypes: {
|
|
10
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
8
|
export default BillingAddressForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import AddressesContext from"../../context/AddressContext";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef}from"react";import BillingAddressFormContext from"../../context/BillingAddressFormContext";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import AddressesContext from"../../context/AddressContext";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef}from"react";import BillingAddressFormContext from"../../context/BillingAddressFormContext";import isEmpty from"lodash/isEmpty";import OrderContext from"../../context/OrderContext";import{getSaveBillingAddressToAddressBook}from"../../utils/localStorage";import{businessMandatoryField}from"../../utils/validateFormFields";export function BillingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=useRapidForm(),{setAddressErrors,setAddress,isBusiness}=useContext(AddressesContext),{saveAddressToCustomerAddressBook,order,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),ref=useRef(null);useEffect(()=>{if(include?.includes("billing_address")?includeLoaded?.billing_address||addResourceToInclude({newResourceLoaded:{billing_address:!0}}):addResourceToInclude({newResource:"billing_address"}),isEmpty(errors)){if(values&&Object.keys(values).length>0){setAddressErrors([],"billing_address");for(const name in values){const field=values[name];businessMandatoryField(name,isBusiness)||delete values[name],(field?.value||field?.required===!1&&field?.type!=="checkbox")&&(values[name.replace("billing_address_","")]=field.value,delete values[name]),field?.type==="checkbox"&&(delete values[name],saveAddressToCustomerAddressBook({type:"billing_address",value:field.checked}))}setAddress({values:{...values,...isBusiness&&{business:isBusiness}},resource:"billing_address"})}}else{const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message;["billing_address_state_code"].includes(fieldName)?values?.state_code?formErrors.push({code,message:message||"",resource:"billing_address",field:fieldName}):delete errors[fieldName]:formErrors.push({code,message:message||"",resource:"billing_address",field:fieldName})}setAddressErrors(formErrors,"billing_address")}const checkboxChecked=ref.current?.querySelector('[name="billing_address_save_to_customer_book"]')?.checked||getSaveBillingAddressToAddressBook();reset&&(!isEmpty(values)||!isEmpty(errors)||checkboxChecked)&&(saveAddressToCustomerAddressBook&&saveAddressToCustomerAddressBook({type:"billing_address",value:!1}),ref&&(ref.current?.reset(),resetForm({target:ref.current}),setAddressErrors([],"billing_address"),setAddress({values:{},resource:"billing_address"})))},[errors,values,reset,include,includeLoaded,isBusiness]);const providerValues={isBusiness,values,validation,setValue:(name,value)=>{const field={[name.replace("billing_address_","")]:value};setAddress({values:{...values,...field,...isBusiness&&{business:isBusiness}},resource:"billing_address"})},errorClassName,requiresBillingInfo:order?.requires_billing_info||!1,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return _jsx(BillingAddressFormContext.Provider,{value:providerValues,children:_jsx("form",{ref,autoComplete,...p,children})})}export default BillingAddressForm;
|