@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
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
children:
|
|
4
|
-
};
|
|
5
|
-
export declare function ShippingAddressContainer(props: Props): JSX.Element;
|
|
6
|
-
export declare namespace ShippingAddressContainer {
|
|
7
|
-
var propTypes: {
|
|
8
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
9
|
-
};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
children: JSX.Element[] | JSX.Element;
|
|
10
4
|
}
|
|
5
|
+
export declare function ShippingAddressContainer(props: Props): JSX.Element;
|
|
11
6
|
export default ShippingAddressContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import ShippingAddressContext from"../../context/ShippingAddressContext";import{useContext,useEffect,useReducer}from"react";import shippingAddressReducer,{setShippingAddress,shippingAddressInitialState,setShippingCustomerAddressId}from"../../reducers/ShippingAddressReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import ShippingAddressContext from"../../context/ShippingAddressContext";import{useContext,useEffect,useReducer}from"react";import shippingAddressReducer,{setShippingAddress,shippingAddressInitialState,setShippingCustomerAddressId}from"../../reducers/ShippingAddressReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext from"../../context/OrderContext";import AddressContext from"../../context/AddressContext";export function ShippingAddressContainer(props){const{children}=props,[state,dispatch]=useReducer(shippingAddressReducer,shippingAddressInitialState),config=useContext(CommerceLayerContext),{order}=useContext(OrderContext),{setCloneAddress}=useContext(AddressContext);useEffect(()=>(order&&config&&setShippingCustomerAddressId({dispatch,order,setCloneAddress}),()=>{dispatch({type:"cleanup",payload:{}})}),[config,order]);const contextValue={...state,setShippingAddress:async(id,options)=>{await setShippingAddress(id,{config,dispatch,order,customerAddressId:options?.customerAddressId}),setCloneAddress(id,"shipping_address")}};return _jsx(ShippingAddressContext.Provider,{value:contextValue,children})}export default ShippingAddressContainer;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props extends Omit<JSX.IntrinsicElements['form'], 'onSubmit'> {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
reset?: boolean;
|
|
5
5
|
errorClassName?: string;
|
|
6
|
-
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
7
|
-
export declare function ShippingAddressForm(props: Props): JSX.Element;
|
|
8
|
-
export declare namespace ShippingAddressForm {
|
|
9
|
-
var propTypes: {
|
|
10
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
-
};
|
|
12
6
|
}
|
|
7
|
+
export declare function ShippingAddressForm(props: Props): JSX.Element;
|
|
13
8
|
export default ShippingAddressForm;
|
|
@@ -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 ShippingAddressFormContext from"../../context/ShippingAddressFormContext";import{isEmpty}from"lodash";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 ShippingAddressFormContext from"../../context/ShippingAddressFormContext";import{isEmpty}from"lodash";import OrderContext from"../../context/OrderContext";import{getSaveShippingAddressToAddressBook}from"../../utils/localStorage";import{businessMandatoryField}from"../../utils/validateFormFields";export function ShippingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=useRapidForm(),{setAddressErrors,setAddress,shipToDifferentAddress,isBusiness}=useContext(AddressesContext),{saveAddressToCustomerAddressBook,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),ref=useRef(null);useEffect(()=>{if(include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address"}),isEmpty(errors)){if(!isEmpty(values)&&shipToDifferentAddress){setAddressErrors([],"shipping_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("shipping_address_","")]=field.value,delete values[name]),field?.type==="checkbox"&&(delete values[name],saveAddressToCustomerAddressBook({type:"shipping_address",value:field.checked}))}setAddress({values:{...values,...isBusiness&&{business:isBusiness}},resource:"shipping_address"})}}else{const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message;["shipping_address_state_code"].includes(fieldName)?isEmpty(values.state_code)?delete errors[fieldName]:formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName}):formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName})}shipToDifferentAddress&&setAddressErrors(formErrors,"shipping_address")}const checkboxChecked=ref.current?.querySelector('[name="shipping_address_save_to_customer_book"]')?.checked||getSaveShippingAddressToAddressBook();reset&&(!isEmpty(values)||!isEmpty(errors)||checkboxChecked)&&(saveAddressToCustomerAddressBook&&saveAddressToCustomerAddressBook({type:"shipping_address",value:!1}),ref&&(ref.current?.reset(),resetForm({target:ref.current}),setAddressErrors([],"shipping_address"),setAddress({values:{},resource:"shipping_address"})))},[values,errors,shipToDifferentAddress,reset,include,includeLoaded,isBusiness]);const providerValues={values,validation,setValue:(name,value)=>{const field={[name.replace("shipping_address_","")]:value};setAddress({values:{...values,...field,...isBusiness&&{business:isBusiness}},resource:"shipping_address"})},errorClassName,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return _jsx(ShippingAddressFormContext.Provider,{value:providerValues,children:_jsx("form",{ref,autoComplete,...p,children})})}export default ShippingAddressForm;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props extends Omit<JSX.IntrinsicElements['form'], 'onSubmit'> {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
reset?: boolean;
|
|
5
5
|
errorClassName?: string;
|
|
6
|
-
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
7
|
-
export declare function CustomerAddressForm(props: Props): JSX.Element;
|
|
8
|
-
export declare namespace CustomerAddressForm {
|
|
9
|
-
var propTypes: {
|
|
10
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
-
};
|
|
12
6
|
}
|
|
7
|
+
export declare function CustomerAddressForm(props: Props): JSX.Element;
|
|
13
8
|
export default CustomerAddressForm;
|
|
@@ -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 CustomerAddressFormContext from"../../context/CustomerAddressFormContext";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 CustomerAddressFormContext from"../../context/CustomerAddressFormContext";import OrderContext from"../../context/OrderContext";import isEmptyStates from"../../utils/isEmptyStates";export function CustomerAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=useRapidForm(),{setAddressErrors,setAddress}=useContext(AddressesContext),{order}=useContext(OrderContext),ref=useRef(null);useEffect(()=>{if(Object.keys(errors).length>0){const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message||"";fieldName==="billing_address_state_code"?values.state_code?delete errors[fieldName]:formErrors.push({code,message,resource:"billing_address",field:fieldName}):formErrors.push({code,message,resource:"billing_address",field:fieldName})}setAddressErrors(formErrors,"billing_address")}else if(Object.keys(values).length>0){setAddressErrors([],"billing_address");for(const name in values){const field=values[name];if(field?.value&&(values[name.replace("billing_address_","")]=field.value,delete values[name]),["billing_address_state_code"].includes(name)){const countryCode=values.billing_address_country_code?.value||values.country_code;!isEmptyStates(countryCode)&&!field.value&&delete values.billing_address_state_code}}setAddress({values,resource:"billing_address"})}reset&&(Object.keys(values).length>0||Object.keys(errors).length>0)&&ref&&(ref.current?.reset(),resetForm({target:ref.current}),setAddressErrors([],"billing_address"),setAddress({values:{},resource:"billing_address"}))},[errors,values,reset]);const providerValues={values,validation,setValue:(name,value)=>{const field={[name.replace("billing_address_","")]:value};setAddress({values:{...values,...field},resource:"billing_address"})},errorClassName,requiresBillingInfo:order?.requires_billing_info||!1,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return _jsx(CustomerAddressFormContext.Provider,{value:providerValues,children:_jsx("form",{ref,autoComplete,...p,children})})}export default CustomerAddressForm;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ConditionalElement } from '../../typings/index';
|
|
3
3
|
import { TGenericChildrenProps, TResources } from '../utils/GenericFieldComponent';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['Customer']>;
|
|
5
|
+
type TCondition = ConditionalElement<Exclude<TResources['Customer'], 'resource'>>;
|
|
6
|
+
type Props = {
|
|
7
7
|
children?: (props: StockTransferFieldChildrenProps) => JSX.Element;
|
|
8
8
|
} & TCondition;
|
|
9
9
|
export declare function CustomerField<P extends Props>(props: P): JSX.Element;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseInputComponentProps } from '../../typings/index';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
name?: 'customer_email' | string;
|
|
5
5
|
type?: 'email' | string;
|
|
6
6
|
saveOnBlur?: boolean;
|
|
7
7
|
onBlur?: (email: string) => void;
|
|
8
8
|
errorClassName?: string;
|
|
9
|
-
} & Omit<BaseInputComponentProps, 'name' | 'type' | 'onBlur'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea']
|
|
9
|
+
} & Omit<BaseInputComponentProps, 'name' | 'type' | 'onBlur'> & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
|
|
10
10
|
export declare function CustomerInput(props: Props): JSX.Element;
|
|
11
|
-
export declare namespace CustomerInput {
|
|
12
|
-
var propTypes: {
|
|
13
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
14
|
-
name: import("prop-types").Requireable<string>;
|
|
15
|
-
type: import("prop-types").Requireable<string>;
|
|
16
|
-
placeholder: import("prop-types").Requireable<string>;
|
|
17
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
18
|
-
required: import("prop-types").Requireable<boolean>;
|
|
19
|
-
saveOnBlur: import("prop-types").Requireable<boolean>;
|
|
20
|
-
};
|
|
21
|
-
var displayName: string;
|
|
22
|
-
}
|
|
23
11
|
export default CustomerInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseInput from"../utils/BaseInput";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseInput from"../utils/BaseInput";import{useRapidForm}from"rapid-form";import CustomerContext from"../../context/CustomerContext";export function CustomerInput(props){const{name="customer_email",placeholder="",required=!0,saveOnBlur=!1,type="email",value,onBlur,className,errorClassName,...p}=props,{validation,values,errors}=useRapidForm({fieldEvent:"blur"}),{saveCustomerUser,setCustomerErrors,setCustomerEmail}=useContext(CustomerContext),[hasError,setHasError]=useState(!1),handleOnBlur=async()=>{saveOnBlur&&Object.keys(errors).length===0&&Object.keys(values).length>0&&(saveCustomerUser&&await saveCustomerUser(values[name].value),onBlur&&onBlur(values[name].value))};useEffect(()=>{if(Object.keys(errors).length>0){const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message;formErrors.push({code,message:message||"",resource:"orders",field:fieldName})}formErrors.length>0&&(setHasError(!0),setCustomerErrors&&setCustomerErrors(formErrors))}else Object.keys(values).length>0&&(setCustomerErrors&&setCustomerErrors([]),setCustomerEmail&&setCustomerEmail(values[name].value),setHasError(!1));return()=>{setHasError(!1)}},[errors]);const classNameComputed=`${className??""} ${hasError&&errorClassName?errorClassName:""}`;return _jsx(BaseInput,{name,type,ref:validation,required,placeholder,defaultValue:value,onBlur:()=>{handleOnBlur()},className:classNameComputed,...p})}export default CustomerInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext,useMemo}from"react";import Parent from"../utils/Parent";import GiftCardContext from"../../context/GiftCardContext";import OrderContext from"../../context/OrderContext";import AddressContext from"../../context/AddressContext";import getAllErrors from"../utils/getAllErrors";import LineItemContext from"../../context/LineItemContext";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import CustomerContext from"../../context/CustomerContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import ShipmentContext from"../../context/ShipmentContext";export function Errors(props){const{children,messages=[],resource,field,...p}=props,{payment}=useContext(PaymentMethodChildrenContext),{errors:orderErrors}=useContext(OrderContext),{errors:giftCardErrors}=useContext(GiftCardContext),{errors:lineItemErrors}=useContext(LineItemContext),{errors:addressErrors}=useContext(AddressContext),{errors:customerErrors}=useContext(CustomerContext),{errors:shipmentErrors}=useContext(ShipmentContext),{errors:paymentMethodErrors,currentPaymentMethodType,currentPaymentMethodId}=useContext(PaymentMethodContext),{lineItem}=useContext(LineItemChildrenContext),allErrors=useMemo(()=>[...giftCardErrors||[],...orderErrors||[],...lineItemErrors||[],...addressErrors||[],...customerErrors||[],...shipmentErrors||[],...paymentMethodErrors?.filter(v=>v.field===currentPaymentMethodType&&payment?.id===currentPaymentMethodId)||[]],[giftCardErrors,orderErrors,lineItemErrors,addressErrors,customerErrors,shipmentErrors,paymentMethodErrors]).filter((v,k,a)=>v?.code!==a[k-1]?.code),msgErrors=getAllErrors({allErrors,field,messages,props:p,lineItem,resource,returnHtml:!children}),parentProps={messages,resource,field,errors:msgErrors,...p};return children?_jsx(Parent,{...parentProps,children}):_jsx(_Fragment,{children:msgErrors})}export default Errors;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BaseState } from '../../typings/index';
|
|
3
3
|
interface Props extends Omit<JSX.IntrinsicElements['form'], 'children'> {
|
|
4
|
-
children:
|
|
4
|
+
children: JSX.Element[] | JSX.Element;
|
|
5
5
|
onSubmit?: (values: BaseState) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function GiftCard(props: Props): JSX.Element;
|
|
8
|
-
export declare namespace GiftCard {
|
|
9
|
-
var propTypes: {
|
|
10
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
-
onSubmit: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
12
|
-
};
|
|
13
|
-
var defaultProps: {
|
|
14
|
-
onSubmit: undefined;
|
|
15
|
-
};
|
|
16
|
-
var displayName: string;
|
|
17
|
-
}
|
|
18
8
|
export default GiftCard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useRef,useContext}from"react";import validateFormFields from"../../utils/validateFormFields";import{isEmpty}from"lodash";import GiftCardContext from"../../context/GiftCardContext";export function GiftCard(props){const{children,onSubmit}=props,name="giftCardForm",ref=useRef(null),{addGiftCard,addGiftCardError}=useContext(GiftCardContext);return _jsx(_Fragment,{children:_jsx("form",{name,ref,onSubmit:e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm?.elements,{errors,values}=validateFormFields(elements,["currencyCode","balanceCents"],"gift_cards");isEmpty(errors)?(addGiftCard(values),currentForm?.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)},children},name)})}export default GiftCard;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
};
|
|
5
|
-
export declare function GiftCardContainer(props: Props): JSX.Element;
|
|
6
|
-
export declare namespace GiftCardContainer {
|
|
7
|
-
var propTypes: {
|
|
8
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
9
|
-
};
|
|
10
|
-
var displayName: string;
|
|
11
4
|
}
|
|
5
|
+
export declare function GiftCardContainer(props: Props): JSX.Element;
|
|
12
6
|
export default GiftCardContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../../context/GiftCardContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../../reducers/GiftCardReducer";import OrderContext from"../../context/OrderContext";
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../../context/GiftCardContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../../reducers/GiftCardReducer";import OrderContext from"../../context/OrderContext";export function GiftCardContainer(props){const{children}=props,[state,dispatch]=useReducer(giftCardReducer,giftCardInitialState),config=useContext(CommerceLayerContext),{getOrder,createOrder,order}=useContext(OrderContext),giftCardValue={...state,addGiftCardRecipient:async values=>await addGiftCardRecipient(values,config,dispatch),addGiftCard:async values=>await addGiftCard({...values},{config,dispatch,getOrder,createOrder,order}),addGiftCardError:errors=>addGiftCardError(errors,dispatch),addGiftCardLoading:loading=>addGiftCardLoading(loading,dispatch)};return _jsx(GiftCardContext.Provider,{value:giftCardValue,children})}export default GiftCardContainer;
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseSelectComponentProps } from '../../typings/index';
|
|
3
|
-
|
|
3
|
+
type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
|
|
4
4
|
required?: boolean;
|
|
5
5
|
} & Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'>;
|
|
6
6
|
export declare function GiftCardCurrencySelector(props: Props): JSX.Element;
|
|
7
|
-
export declare namespace GiftCardCurrencySelector {
|
|
8
|
-
var propTypes: {
|
|
9
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
10
|
-
placeholder: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
11
|
-
value: import("prop-types").Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
|
|
12
|
-
label: import("prop-types").Validator<string>;
|
|
13
|
-
}>>;
|
|
14
|
-
value: import("prop-types").Requireable<string>;
|
|
15
|
-
required: import("prop-types").Requireable<boolean>;
|
|
16
|
-
};
|
|
17
|
-
var defaultProps: {
|
|
18
|
-
required: boolean;
|
|
19
|
-
};
|
|
20
|
-
var displayName: string;
|
|
21
|
-
}
|
|
22
7
|
export default GiftCardCurrencySelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"../utils/BaseSelect";import currencyOptions from"../../config/currency";
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"../utils/BaseSelect";import currencyOptions from"../../config/currency";export function GiftCardCurrencySelector(props){return _jsx(BaseSelect,{options:currencyOptions,name:"currencyCode",...props})}export default GiftCardCurrencySelector;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseInputComponentProps, GiftCardInputName } from '../../typings/index';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
name: GiftCardInputName;
|
|
5
|
-
} & Omit<BaseInputComponentProps, 'name'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea']
|
|
5
|
+
} & Omit<BaseInputComponentProps, 'name'> & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
|
|
6
6
|
export declare function GiftCardInput(props: Props): JSX.Element;
|
|
7
|
-
export declare namespace GiftCardInput {
|
|
8
|
-
var propTypes: {
|
|
9
|
-
type: import("prop-types").Validator<NonNullable<import("../../typings/index").BaseInputType>>;
|
|
10
|
-
name: import("prop-types").Validator<NonNullable<GiftCardInputName>>;
|
|
11
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
12
|
-
placeholder: import("prop-types").Requireable<string>;
|
|
13
|
-
};
|
|
14
|
-
var displayName: string;
|
|
15
|
-
}
|
|
16
7
|
export default GiftCardInput;
|
|
@@ -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 GiftCardInput(props){const{placeholder="",...p}=props;return _jsx(BaseInput,{placeholder,...p})}export default GiftCardInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
onSubmit?: (response: {
|
|
5
5
|
success: boolean;
|
|
@@ -7,9 +7,4 @@ declare type Props = {
|
|
|
7
7
|
}) => void;
|
|
8
8
|
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
9
9
|
export declare function GiftCardOrCouponForm(props: Props): JSX.Element | null;
|
|
10
|
-
export declare namespace GiftCardOrCouponForm {
|
|
11
|
-
var propTypes: {
|
|
12
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
10
|
export default GiftCardOrCouponForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef,useState}from"react";import CouponAndGiftCardFormContext from"../../context/CouponAndGiftCardFormContext";import OrderContext from"../../context/OrderContext";import isEmpty from"lodash/isEmpty";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef,useState}from"react";import CouponAndGiftCardFormContext from"../../context/CouponAndGiftCardFormContext";import OrderContext from"../../context/OrderContext";import isEmpty from"lodash/isEmpty";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";export function GiftCardOrCouponForm(props){const{children,autoComplete="on",onSubmit,...p}=props,{validation,values,reset}=useRapidForm(),[codeType,setCodeType]=useState("gift_card_or_coupon_code"),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=useContext(OrderContext),ref=useRef(null),inputName="gift_card_or_coupon_code";useEffect(()=>{if(values[inputName]?.value===""&&findIndex(errors,{field:camelCase(inputName)})!==-1){const err=dropWhile(errors,i=>i.field===camelCase(inputName));setOrderErrors(err),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1})}values[inputName]?.value===""&&(setOrderErrors([]),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1}))},[values]),useEffect(()=>{order?.gift_card_code&&!order?.coupon_code&&setCodeType("coupon_code"),!order?.gift_card_code&&order?.coupon_code&&setCodeType("gift_card_code"),!order?.gift_card_code&&!order?.coupon_code&&setCodeType("gift_card_or_coupon_code")},[order]);const handleSubmit=async e=>{e.preventDefault();const code=has(values,inputName)?values[inputName].value:void 0;if(code){const{success}=await setGiftCardOrCouponCode({code,codeType}),value=values[inputName]?.value;onSubmit&&onSubmit({success,value}),success&&reset(e)}};return order?.gift_card_code&&order?.coupon_code||isEmpty(order)?null:_jsx(CouponAndGiftCardFormContext.Provider,{value:{validation,codeType},children:_jsx("form",{ref,autoComplete,onSubmit:e=>{handleSubmit(e)},...p,children})})}export default GiftCardOrCouponForm;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseInputComponentProps } from '../../typings/index';
|
|
3
3
|
import { OrderCodeType } from '../../reducers/OrderReducer';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
name?: 'gift_card_or_coupon_code';
|
|
6
6
|
type?: 'text';
|
|
7
7
|
placeholderTranslation?: (codeType: OrderCodeType) => string;
|
|
8
|
-
} & Omit<BaseInputComponentProps, 'name' | 'type'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea']
|
|
8
|
+
} & Omit<BaseInputComponentProps, 'name' | 'type'> & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
|
|
9
9
|
export declare function GiftCardOrCouponInput(props: Props): JSX.Element;
|
|
10
|
-
export declare namespace GiftCardOrCouponInput {
|
|
11
|
-
var propTypes: {
|
|
12
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
13
|
-
placeholder: import("prop-types").Requireable<string>;
|
|
14
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
15
|
-
required: import("prop-types").Requireable<boolean>;
|
|
16
|
-
};
|
|
17
|
-
var displayName: string;
|
|
18
|
-
}
|
|
19
10
|
export default GiftCardOrCouponInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import BaseInput from"../utils/BaseInput";import CouponAndGiftCardFormContext from"../../context/CouponAndGiftCardFormContext";export function GiftCardOrCouponInput(props){const{placeholder="",required,value,placeholderTranslation,...p}=props,{validation,codeType}=useContext(CouponAndGiftCardFormContext);let placeholderLabel=placeholder;return placeholderTranslation&&codeType&&(placeholderLabel=placeholderTranslation(codeType)),_jsx(BaseInput,{type:"text",name:"gift_card_or_coupon_code",ref:validation,required:required!==void 0?required:!0,placeholder:placeholderLabel,defaultValue:value,...p})}export default GiftCardOrCouponInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import LineItemContext from"../../context/LineItemContext";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import ShipmentChildrenContext from"../../context/ShipmentChildrenContext";export function LineItem(props){const{type="skus",children}=props,{lineItems}=useContext(LineItemContext),{lineItems:shipmentLineItems}=useContext(ShipmentChildrenContext),components=(shipmentLineItems&&shipmentLineItems?.length>0?shipmentLineItems:lineItems)?.filter(l=>l.item_type===type).map((lineItem,k,check)=>{if(lineItem.item_type==="bundles"&&k>0&&check[k-1]?.bundle_code===lineItem.bundle_code||lineItem.item_type==="gift_cards"&&lineItem?.total_amount_cents&&lineItem?.total_amount_cents<=0)return null;const lineProps={lineItem};return _jsx(LineItemChildrenContext.Provider,{value:lineProps,children},
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import LineItemContext from"../../context/LineItemContext";import LineItemChildrenContext from"../../context/LineItemChildrenContext";import ShipmentChildrenContext from"../../context/ShipmentChildrenContext";export function LineItem(props){const{type="skus",children}=props,{lineItems}=useContext(LineItemContext),{lineItems:shipmentLineItems}=useContext(ShipmentChildrenContext),components=(shipmentLineItems&&shipmentLineItems?.length>0?shipmentLineItems:lineItems)?.filter(l=>l.item_type===type).map((lineItem,k,check)=>{if(lineItem.item_type==="bundles"&&k>0&&check[k-1]?.bundle_code===lineItem.bundle_code||lineItem.item_type==="gift_cards"&&lineItem?.total_amount_cents&&lineItem?.total_amount_cents<=0)return null;const lineProps={lineItem};return _jsx(LineItemChildrenContext.Provider,{value:lineProps,children},lineItem.id)});return _jsx(_Fragment,{children:components})}export default LineItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseAmountComponent, BasePriceType } from '../../typings/index';
|
|
3
|
-
|
|
3
|
+
type Props = BaseAmountComponent & {
|
|
4
4
|
type?: BasePriceType;
|
|
5
5
|
};
|
|
6
6
|
export declare function LineItemAmount(props: Props): JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ConditionalElement } from '../../typings/index';
|
|
3
3
|
import { TGenericChildrenProps, TResources } from '../utils/GenericFieldComponent';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
|
|
5
|
+
type TCondition = ConditionalElement<Exclude<TResources['LineItem'], 'resource'>>;
|
|
6
|
+
type Props = {
|
|
7
7
|
children?: (props: LineItemFieldChildrenProps) => JSX.Element;
|
|
8
8
|
} & TCondition;
|
|
9
9
|
/**
|
|
@@ -4,11 +4,11 @@ interface ChildrenProps extends Omit<Props, 'children'> {
|
|
|
4
4
|
quantity: number;
|
|
5
5
|
handleChange: (event: React.MouseEvent<HTMLSelectElement>) => void;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
type Props = {
|
|
8
8
|
children?: ChildrenFunction<ChildrenProps>;
|
|
9
9
|
max?: number;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
readonly?: boolean;
|
|
12
|
-
} & (
|
|
12
|
+
} & (JSX.IntrinsicElements['select'] & Omit<JSX.IntrinsicElements['span'], 'children'>);
|
|
13
13
|
export declare function LineItemQuantity(props: Props): JSX.Element;
|
|
14
14
|
export default LineItemQuantity;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TypeAccepted } from '../../utils/getLineItemsCount';
|
|
2
|
+
import { type TypeAccepted } from '../../utils/getLineItemsCount';
|
|
3
3
|
import { ChildrenFunction } from '../../typings/index';
|
|
4
4
|
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
5
5
|
quantity: number;
|
|
@@ -4,22 +4,22 @@ import { AddToCartReturn, CustomLineItem, LineItemOption } from '../../reducers/
|
|
|
4
4
|
interface TAddToCartButton extends Omit<Props, 'children'> {
|
|
5
5
|
handleClick: () => AddToCartReturn;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
type BuyNowMode = {
|
|
8
8
|
buyNowMode: true;
|
|
9
9
|
checkoutUrl?: string;
|
|
10
10
|
} | {
|
|
11
11
|
buyNowMode?: false;
|
|
12
12
|
checkoutUrl?: never;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type THostedCart = {
|
|
15
15
|
redirectToHostedCart: true;
|
|
16
16
|
hostedCartUrl?: string;
|
|
17
17
|
} | {
|
|
18
18
|
redirectToHostedCart?: false;
|
|
19
19
|
hostedCartUrl?: never;
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
type TButton = PropsWithoutRef<Omit<JSX.IntrinsicElements['button'], 'children'>>;
|
|
22
|
+
type Props = {
|
|
23
23
|
/**
|
|
24
24
|
* Code of a bundle
|
|
25
25
|
*/
|
|
@@ -3,9 +3,21 @@ import { BaseMetadataObject } from '../../typings/index';
|
|
|
3
3
|
import type { OrderCreate, Order } from '@commercelayer/sdk';
|
|
4
4
|
interface Props {
|
|
5
5
|
children: JSX.Element[] | JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Metadata to add when creates a new order
|
|
8
|
+
*/
|
|
6
9
|
metadata?: BaseMetadataObject;
|
|
10
|
+
/**
|
|
11
|
+
* Attribute to add when creates/updates an order
|
|
12
|
+
*/
|
|
7
13
|
attributes?: OrderCreate;
|
|
14
|
+
/**
|
|
15
|
+
* ID of the order
|
|
16
|
+
*/
|
|
8
17
|
orderId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Callback called when the order is updated
|
|
20
|
+
*/
|
|
9
21
|
fetchOrder?: (order: Order) => void;
|
|
10
22
|
}
|
|
11
23
|
export declare function OrderContainer(props: Props): JSX.Element;
|
|
@@ -2,13 +2,26 @@
|
|
|
2
2
|
import { InitialOrderListContext } from '../../context/OrderListChildrenContext';
|
|
3
3
|
import { Column } from 'react-table';
|
|
4
4
|
import type { Order } from '@commercelayer/sdk';
|
|
5
|
-
export
|
|
5
|
+
export type OrderListColumn = Column & {
|
|
6
6
|
Header: string;
|
|
7
7
|
accessor: keyof Order;
|
|
8
8
|
className?: string;
|
|
9
9
|
titleClassName?: string;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type PaginationProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Show table pagination. Default is false.
|
|
14
|
+
*/
|
|
15
|
+
showPagination: true;
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
} | {
|
|
18
|
+
/**
|
|
19
|
+
* Show table pagination. Default is false.
|
|
20
|
+
*/
|
|
21
|
+
showPagination?: false;
|
|
22
|
+
pageSize?: never;
|
|
23
|
+
};
|
|
24
|
+
type Props = {
|
|
12
25
|
children: JSX.Element[] | JSX.Element;
|
|
13
26
|
/**
|
|
14
27
|
* Columns to show
|
|
@@ -27,15 +40,19 @@ declare type Props = {
|
|
|
27
40
|
*/
|
|
28
41
|
actionsContainerClassName?: string;
|
|
29
42
|
/**
|
|
30
|
-
* Show actions column
|
|
43
|
+
* Show actions column. Default is false.
|
|
31
44
|
*/
|
|
32
45
|
showActions?: boolean;
|
|
33
46
|
/**
|
|
34
|
-
* Class name to assign to
|
|
47
|
+
* Class name to assign to pagination container.
|
|
48
|
+
*/
|
|
49
|
+
paginationContainerClassName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Class name to assign to the table header.
|
|
35
52
|
*/
|
|
36
53
|
theadClassName?: string;
|
|
37
54
|
/**
|
|
38
|
-
* Class name to assign to the table row
|
|
55
|
+
* Class name to assign to the table row.
|
|
39
56
|
*/
|
|
40
57
|
rowTrClassName?: string;
|
|
41
58
|
} & Omit<JSX.IntrinsicElements['table'], 'children'> & ({
|
|
@@ -55,6 +72,6 @@ declare type Props = {
|
|
|
55
72
|
} | {
|
|
56
73
|
infiniteScroll?: false;
|
|
57
74
|
windowOptions?: never;
|
|
58
|
-
});
|
|
59
|
-
export declare function OrderList({ children, columns, loadingElement, showActions, actionsComponent, actionsContainerClassName, infiniteScroll, windowOptions, theadClassName, rowTrClassName, ...p }: Props): JSX.Element;
|
|
75
|
+
}) & PaginationProps;
|
|
76
|
+
export declare function OrderList({ children, columns, loadingElement, showActions, showPagination, pageSize, paginationContainerClassName, actionsComponent, actionsContainerClassName, infiniteScroll, windowOptions, theadClassName, rowTrClassName, ...p }: Props): JSX.Element;
|
|
60
77
|
export default OrderList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as _createElement}from"react";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useContext,useMemo,useState,useEffect,useCallback}from"react";import CustomerContext from"../../context/CustomerContext";import OrderListChildrenContext from"../../context/OrderListChildrenContext";import{useTable,useSortBy,useBlockLayout}from"react-table";import{FixedSizeList}from"react-window";import scrollbarWidth from"../../utils/scrollbarWidth";import{sortDescIcon,sortAscIcon}from"../../utils/icons";export function OrderList({children,columns,loadingElement,showActions=!1,actionsComponent,actionsContainerClassName,infiniteScroll,windowOptions,theadClassName,rowTrClassName,...p}){const[loading,setLoading]=useState(!0),{orders}=useContext(CustomerContext),data=useMemo(()=>orders??[],[orders]),cols=useMemo(()=>columns,[columns]),tablePlugins=[useSortBy];infiniteScroll&&tablePlugins.push(useBlockLayout);const defaultColumn=useMemo(()=>({width:windowOptions?.column||150}),[windowOptions?.column]),table=useTable({data,columns:cols,...infiniteScroll&&{defaultColumn}},...tablePlugins),TableHtmlElement=infiniteScroll?"div":"table",TheadHtmlElement=infiniteScroll?"div":"thead",TbodyHtmlElement=infiniteScroll?"div":"tbody",ThHtmlElement=infiniteScroll?"div":"th",TrHtmlElement=infiniteScroll?"div":"tr";useEffect(()=>(orders!==void 0&&setLoading(!1),()=>{setLoading(!0)}),[orders]);const scrollBarSize=infiniteScroll?useMemo(()=>scrollbarWidth(),[]):0,LoadingComponent=loadingElement||_jsx("div",{children:"Loading..."}),headerComponent=table.headerGroups.map((headerGroup,i)=>{const columns2=headerGroup.headers.map((column,k)=>{const sortLabel=column.isSorted?column.isSortedDesc?"desc":"asc":"";return _createElement(ThHtmlElement,{"data-testid":`thead-${k}`,"data-sort":`${sortLabel}`,className:column?.className,...column.getHeaderProps(column?.getSortByToggleProps&&column?.getSortByToggleProps()),key:k},_jsxs("span",{className:column?.titleClassName,children:[column.render("Header"),column.isSorted?column.isSortedDesc?sortDescIcon:sortAscIcon:""]}))});return _createElement(TrHtmlElement,{...headerGroup.getHeaderGroupProps(),key:i},columns2)}),components=infiniteScroll?useCallback(({index,style})=>{const row=
|
|
1
|
+
import{createElement as _createElement}from"react";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useContext,useMemo,useState,useEffect,useCallback}from"react";import CustomerContext from"../../context/CustomerContext";import OrderListChildrenContext from"../../context/OrderListChildrenContext";import OrderListPagination from"../../context/OrderListPaginationContext";import{useTable,useSortBy,useBlockLayout,usePagination}from"react-table";import{FixedSizeList}from"react-window";import scrollbarWidth from"../../utils/scrollbarWidth";import{sortDescIcon,sortAscIcon}from"../../utils/icons";import filterChildren from"../../utils/filterChildren";const rowComponents=["OrderListRow"],paginationComponents=["OrderListPaginationInfo","OrderListPaginationButtons"];export function OrderList({children,columns,loadingElement,showActions=!1,showPagination=!1,pageSize=10,paginationContainerClassName,actionsComponent,actionsContainerClassName,infiniteScroll,windowOptions,theadClassName,rowTrClassName,...p}){const[loading,setLoading]=useState(!0),{orders}=useContext(CustomerContext),data=useMemo(()=>orders??[],[orders]),cols=useMemo(()=>columns,[columns]),tablePlugins=[useSortBy];infiniteScroll&&tablePlugins.push(useBlockLayout),showPagination&&tablePlugins.push(usePagination);const defaultColumn=useMemo(()=>({width:windowOptions?.column||150}),[windowOptions?.column]),table=useTable({data,columns:cols,...infiniteScroll&&{defaultColumn},...showPagination&&{pageSize}},...tablePlugins),TableHtmlElement=infiniteScroll?"div":"table",TheadHtmlElement=infiniteScroll?"div":"thead",TbodyHtmlElement=infiniteScroll?"div":"tbody",ThHtmlElement=infiniteScroll?"div":"th",TrHtmlElement=infiniteScroll?"div":"tr";useEffect(()=>(orders!==void 0&&setLoading(!1),()=>{setLoading(!0)}),[orders]);const scrollBarSize=infiniteScroll?useMemo(()=>scrollbarWidth(),[]):0,LoadingComponent=loadingElement||_jsx("div",{children:"Loading..."}),headerComponent=table.headerGroups.map((headerGroup,i)=>{const columns2=headerGroup.headers.map((column,k)=>{const sortLabel=column.isSorted?column.isSortedDesc?"desc":"asc":"";return _createElement(ThHtmlElement,{"data-testid":`thead-${k}`,"data-sort":`${sortLabel}`,className:column?.className,...column.getHeaderProps(column?.getSortByToggleProps&&column?.getSortByToggleProps()),key:k},_jsxs("span",{className:column?.titleClassName,children:[column.render("Header"),column.isSorted?column.isSortedDesc?sortDescIcon:sortAscIcon:""]}))});return _createElement(TrHtmlElement,{...headerGroup.getHeaderGroupProps(),key:i},columns2)}),rows=showPagination?table.page:table.rows,rowsComponents=filterChildren({children,filterBy:rowComponents,componentName:"OrderList"}),components=infiniteScroll?useCallback(({index,style})=>{const row=rows[index];row&&table.prepareRow(row);const childProps={orders,order:orders?.[index],row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll};return _jsx(TrHtmlElement,{...row?.getRowProps({style}),className:rowTrClassName,children:_jsx(OrderListChildrenContext.Provider,{value:childProps,children:rowsComponents})})},[table.prepareRow,table.rows]):rows.map((row,i)=>{table.prepareRow(row);const childProps={orders,order:orders?.[i],row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll};return _createElement(TrHtmlElement,{...row.getRowProps(),className:rowTrClassName,key:i},_jsx(OrderListChildrenContext.Provider,{value:childProps,children:rowsComponents}))}),pagComponents=filterChildren({children,filterBy:paginationComponents,componentName:"OrderList"}),Pagination=()=>showPagination?_jsx(OrderListPagination.Provider,{value:{canNextPage:table.canNextPage,canPreviousPage:table.canPreviousPage,gotoPage:table.gotoPage,nextPage:table.nextPage,page:table.page,pageCount:table.pageCount,pageIndex:table.state.pageIndex,pageNumber:table.pageNumber,pageOptions:table.pageOptions,pageSize:table.state.pageSize,previousPage:table.previousPage,setPageSize:table.setPageSize,totalRows:orders?.length??0},children:pagComponents}):null;return loading&&orders==null?_jsx(_Fragment,{children:LoadingComponent}):orders?.length===0?_jsx(OrderListChildrenContext.Provider,{value:{orders},children}):_jsxs(_Fragment,{children:[_jsxs(TableHtmlElement,{...p,...table.getTableProps(),children:[_jsx(TheadHtmlElement,{className:theadClassName,children:headerComponent}),_jsx(TbodyHtmlElement,{...table.getTableBodyProps(),children:infiniteScroll?_jsx(FixedSizeList,{height:windowOptions?.height||400,itemCount:table.rows.length,itemSize:windowOptions?.itemSize||100,width:windowOptions?.width||table.totalColumnsWidth+scrollBarSize,children:components}):components})]}),_jsx("div",{className:paginationContainerClassName,children:_jsx(Pagination,{})})]})}export default OrderList;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type OrderListPaginationContext as TOrderListPaginationContext } from '../../context/OrderListPaginationContext';
|
|
3
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
4
|
+
interface PaginationButton extends Omit<JSX.IntrinsicElements['button'], 'children' | 'disabled'> {
|
|
5
|
+
/**
|
|
6
|
+
* Show or hide the pagination button. Default is true.
|
|
7
|
+
*/
|
|
8
|
+
show: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Label to display
|
|
11
|
+
*/
|
|
12
|
+
label?: string | JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
interface NavigationButtons extends Omit<JSX.IntrinsicElements['button'], 'children'> {
|
|
15
|
+
/**
|
|
16
|
+
* Show or hide the navigation buttons. Default is true.
|
|
17
|
+
*/
|
|
18
|
+
show?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Attach the class name to the current page button
|
|
21
|
+
*/
|
|
22
|
+
activeClassName?: string;
|
|
23
|
+
}
|
|
24
|
+
type ChildrenProps = Omit<Props, 'children'> & TOrderListPaginationContext;
|
|
25
|
+
interface Props extends Omit<JSX.IntrinsicElements['div'], 'children'> {
|
|
26
|
+
children?: ChildrenFunction<ChildrenProps>;
|
|
27
|
+
/**
|
|
28
|
+
* Previous button props
|
|
29
|
+
*/
|
|
30
|
+
previousPageButton?: PaginationButton;
|
|
31
|
+
/**
|
|
32
|
+
* Next button props
|
|
33
|
+
*/
|
|
34
|
+
nextPageButton?: PaginationButton;
|
|
35
|
+
/**
|
|
36
|
+
* Navigation buttons props
|
|
37
|
+
*/
|
|
38
|
+
navigationButtons?: NavigationButtons;
|
|
39
|
+
}
|
|
40
|
+
export declare function OrderListPaginationButtons({ previousPageButton, nextPageButton, navigationButtons, children, ...props }: Props): JSX.Element;
|
|
41
|
+
export declare namespace OrderListPaginationButtons {
|
|
42
|
+
var displayName: string;
|
|
43
|
+
}
|
|
44
|
+
export default OrderListPaginationButtons;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import Parent from"../utils/Parent";import OrderListPaginationContext from"../../context/OrderListPaginationContext";import useCustomContext from"../../utils/hooks/useCustomContext";import omit from"../../utils/omit";export function OrderListPaginationButtons({previousPageButton,nextPageButton,navigationButtons,children,...props}){const{...prevButton}={show:!0,...previousPageButton},{...nextButton}={show:!0,...nextPageButton},{...navButton}={show:!0,...navigationButtons},ctx=useCustomContext({context:OrderListPaginationContext,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationButtons"}),PrevButton=prevButton.show?_jsx("button",{"data-testid":"prev-button",...omit(prevButton,["show"]),disabled:ctx?.canPreviousPage===!1,onClick:()=>ctx?.previousPage(),children:previousPageButton?.label??"<"}):null,NextButton=nextButton.show?_jsx("button",{"data-testid":"next-button",...omit(nextButton,["show"]),disabled:ctx?.canNextPage===!1,onClick:()=>ctx?.nextPage(),children:nextButton?.label??">"}):null,pagesToShow=ctx?.canPreviousPage===!1?ctx?.pageOptions.slice(0,3).map(v=>v+1):ctx?.canNextPage===!1?ctx?.pageOptions.slice(ctx?.pageOptions.length-3,ctx?.pageOptions.length).map(v=>v+1):ctx?.pageOptions.slice(ctx?.pageIndex-1,ctx?.pageIndex+2).map(v=>v+1),NavButtons=navButton.show?pagesToShow?.map(v=>{const className=(ctx?.pageIndex!=null?ctx?.pageIndex+1:1)===v?`${navButton?.className??""} ${navButton?.activeClassName??""}`:navButton?.className;return _jsx("button",{"data-testid":`page-${v}`,...omit(navButton,["show","activeClassName","className"]),className,onClick:()=>ctx?.gotoPage(v-1),children:v},`page-${v}`)}):null,parentProps={navigationButtons,prevButton,nextButton,...ctx,...props};return children==null?_jsxs("div",{...props,children:[PrevButton,NavButtons,NextButton]}):_jsx(Parent,{...parentProps,children})}OrderListPaginationButtons.displayName="OrderListPaginationButtons";export default OrderListPaginationButtons;
|