@commercelayer/react-components 4.1.0-beta.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.
Files changed (251) hide show
  1. package/lib/cjs/components/MetadataInput.d.ts +1 -1
  2. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +1 -1
  3. package/lib/cjs/components/addresses/AddressField.d.ts +2 -2
  4. package/lib/cjs/components/addresses/AddressInput.d.ts +1 -1
  5. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -1
  6. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
  7. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
  8. package/lib/cjs/components/customers/CustomerField.d.ts +3 -3
  9. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -1
  10. package/lib/cjs/components/errors/Errors.d.ts +5 -0
  11. package/lib/cjs/components/errors/Errors.js +1 -0
  12. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  13. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -1
  14. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -1
  15. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -1
  16. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  17. package/lib/cjs/components/line_items/LineItem.js +1 -1
  18. package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
  19. package/lib/cjs/components/line_items/LineItemField.d.ts +3 -3
  20. package/lib/cjs/components/line_items/LineItemImage.d.ts +1 -1
  21. package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
  22. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
  23. package/lib/cjs/components/orders/AddToCartButton.d.ts +4 -4
  24. package/lib/cjs/components/orders/OrderList.d.ts +24 -7
  25. package/lib/cjs/components/orders/OrderList.js +1 -1
  26. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +44 -0
  27. package/lib/cjs/components/orders/OrderListPaginationButtons.js +1 -0
  28. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +29 -0
  29. package/lib/cjs/components/orders/OrderListPaginationInfo.js +1 -0
  30. package/lib/cjs/components/orders/OrderListRow.d.ts +3 -0
  31. package/lib/cjs/components/orders/OrderListRow.js +1 -1
  32. package/lib/cjs/components/orders/OrderNumber.d.ts +1 -1
  33. package/lib/cjs/components/parcels/ParcelField.d.ts +3 -3
  34. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +3 -3
  35. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -1
  36. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  37. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  38. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  39. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +2 -2
  40. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -1
  41. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -1
  42. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  43. package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +1 -1
  44. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  45. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
  46. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -3
  47. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +2 -2
  48. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +1 -1
  49. package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +1 -1
  50. package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  51. package/lib/cjs/components/payment_source/PaypalPayment.d.ts +2 -2
  52. package/lib/cjs/components/payment_source/StripePayment.d.ts +2 -2
  53. package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +2 -2
  54. package/lib/cjs/components/shipments/ShipmentField.d.ts +2 -2
  55. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  56. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  57. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -3
  58. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
  59. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +3 -3
  60. package/lib/cjs/components/skus/SkuField.d.ts +3 -3
  61. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +3 -3
  62. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +2 -2
  63. package/lib/cjs/components/utils/BaseField.d.ts +1 -1
  64. package/lib/cjs/components/utils/BaseInput.d.ts +2 -2
  65. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +1 -1
  66. package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
  67. package/lib/cjs/components/utils/GenericFieldComponent.d.ts +3 -3
  68. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +4 -4
  69. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
  70. package/lib/cjs/components/utils/getAllErrors.d.ts +1 -1
  71. package/lib/cjs/context/AddressContext.d.ts +1 -1
  72. package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
  73. package/lib/cjs/context/BillingAddressFormContext.d.ts +1 -1
  74. package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
  75. package/lib/cjs/context/CustomerAddressFormContext.d.ts +1 -1
  76. package/lib/cjs/context/CustomerContext.d.ts +1 -1
  77. package/lib/cjs/context/ExternalFunctionContext.d.ts +1 -1
  78. package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
  79. package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
  80. package/lib/cjs/context/OrderListPaginationContext.d.ts +19 -0
  81. package/lib/cjs/context/OrderListPaginationContext.js +1 -0
  82. package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
  83. package/lib/cjs/context/PaymentSourceContext.d.ts +2 -2
  84. package/lib/cjs/context/PlaceOrderContext.d.ts +1 -1
  85. package/lib/cjs/context/ShipmentContext.d.ts +1 -1
  86. package/lib/cjs/context/ShippingAddressContext.d.ts +1 -1
  87. package/lib/cjs/context/SkuChildrenContext.d.ts +1 -1
  88. package/lib/cjs/context/SkuContext.d.ts +1 -1
  89. package/lib/cjs/index.d.ts +1 -1
  90. package/lib/cjs/index.js +1 -1
  91. package/lib/cjs/reducers/AddressReducer.d.ts +10 -10
  92. package/lib/cjs/reducers/AvailabilityReducer.d.ts +4 -4
  93. package/lib/cjs/reducers/BillingAddressReducer.d.ts +4 -4
  94. package/lib/cjs/reducers/CustomerReducer.d.ts +6 -6
  95. package/lib/cjs/reducers/GiftCardReducer.d.ts +3 -3
  96. package/lib/cjs/reducers/LineItemReducer.d.ts +4 -4
  97. package/lib/cjs/reducers/OrderReducer.d.ts +19 -19
  98. package/lib/cjs/reducers/OrderReducer.js +1 -1
  99. package/lib/cjs/reducers/PaymentMethodReducer.d.ts +17 -17
  100. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +5 -5
  101. package/lib/cjs/reducers/PriceReducer.d.ts +3 -3
  102. package/lib/cjs/reducers/ShipmentReducer.d.ts +6 -6
  103. package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
  104. package/lib/cjs/reducers/SkuListsReducer.d.ts +3 -3
  105. package/lib/cjs/reducers/SkuReducer.d.ts +3 -3
  106. package/lib/cjs/typings/errors.d.ts +3 -3
  107. package/lib/cjs/typings/index.d.ts +24 -24
  108. package/lib/cjs/utils/PropsType.d.ts +4 -4
  109. package/lib/cjs/utils/addressesManager.d.ts +3 -3
  110. package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
  111. package/lib/cjs/utils/compareObjAttribute.d.ts +2 -2
  112. package/lib/cjs/utils/filterChildren.d.ts +8 -0
  113. package/lib/cjs/utils/filterChildren.js +1 -0
  114. package/lib/cjs/utils/getCardDetails.d.ts +2 -2
  115. package/lib/cjs/utils/getCartLink.d.ts +1 -1
  116. package/lib/cjs/utils/getErrors.d.ts +1 -1
  117. package/lib/cjs/utils/getLineItemsCount.d.ts +1 -1
  118. package/lib/cjs/utils/hooks/useCustomContext.js +1 -1
  119. package/lib/cjs/utils/jwt.d.ts +1 -1
  120. package/lib/cjs/utils/localStorage.d.ts +1 -1
  121. package/lib/cjs/utils/omit.d.ts +1 -0
  122. package/lib/cjs/utils/omit.js +1 -0
  123. package/lib/esm/components/MetadataInput.d.ts +1 -1
  124. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +1 -1
  125. package/lib/esm/components/addresses/AddressField.d.ts +2 -2
  126. package/lib/esm/components/addresses/AddressInput.d.ts +1 -1
  127. package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -1
  128. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
  129. package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
  130. package/lib/esm/components/customers/CustomerField.d.ts +3 -3
  131. package/lib/esm/components/customers/CustomerInput.d.ts +1 -1
  132. package/lib/esm/components/errors/Errors.d.ts +5 -0
  133. package/lib/esm/components/errors/Errors.js +1 -0
  134. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  135. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -1
  136. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -1
  137. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -1
  138. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  139. package/lib/esm/components/line_items/LineItem.js +1 -1
  140. package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
  141. package/lib/esm/components/line_items/LineItemField.d.ts +3 -3
  142. package/lib/esm/components/line_items/LineItemImage.d.ts +1 -1
  143. package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
  144. package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
  145. package/lib/esm/components/orders/AddToCartButton.d.ts +4 -4
  146. package/lib/esm/components/orders/OrderList.d.ts +24 -7
  147. package/lib/esm/components/orders/OrderList.js +1 -1
  148. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +44 -0
  149. package/lib/esm/components/orders/OrderListPaginationButtons.js +1 -0
  150. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +29 -0
  151. package/lib/esm/components/orders/OrderListPaginationInfo.js +1 -0
  152. package/lib/esm/components/orders/OrderListRow.d.ts +3 -0
  153. package/lib/esm/components/orders/OrderListRow.js +1 -1
  154. package/lib/esm/components/orders/OrderNumber.d.ts +1 -1
  155. package/lib/esm/components/parcels/ParcelField.d.ts +3 -3
  156. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +3 -3
  157. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -1
  158. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  159. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  160. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  161. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +2 -2
  162. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -1
  163. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -1
  164. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  165. package/lib/esm/components/payment_methods/PaymentMethod.d.ts +1 -1
  166. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  167. package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
  168. package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -3
  169. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +2 -2
  170. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +1 -1
  171. package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +1 -1
  172. package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  173. package/lib/esm/components/payment_source/PaypalPayment.d.ts +2 -2
  174. package/lib/esm/components/payment_source/StripePayment.d.ts +2 -2
  175. package/lib/esm/components/payment_source/WireTransferPayment.d.ts +2 -2
  176. package/lib/esm/components/shipments/ShipmentField.d.ts +2 -2
  177. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  178. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  179. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -3
  180. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
  181. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +3 -3
  182. package/lib/esm/components/skus/SkuField.d.ts +3 -3
  183. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +3 -3
  184. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +2 -2
  185. package/lib/esm/components/utils/BaseField.d.ts +1 -1
  186. package/lib/esm/components/utils/BaseInput.d.ts +2 -2
  187. package/lib/esm/components/utils/BaseOrderPrice.d.ts +1 -1
  188. package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
  189. package/lib/esm/components/utils/GenericFieldComponent.d.ts +3 -3
  190. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +4 -4
  191. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
  192. package/lib/esm/components/utils/getAllErrors.d.ts +1 -1
  193. package/lib/esm/context/AddressContext.d.ts +1 -1
  194. package/lib/esm/context/BillingAddressContext.d.ts +1 -1
  195. package/lib/esm/context/BillingAddressFormContext.d.ts +1 -1
  196. package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
  197. package/lib/esm/context/CustomerAddressFormContext.d.ts +1 -1
  198. package/lib/esm/context/CustomerContext.d.ts +1 -1
  199. package/lib/esm/context/ExternalFunctionContext.d.ts +1 -1
  200. package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
  201. package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
  202. package/lib/esm/context/OrderListPaginationContext.d.ts +19 -0
  203. package/lib/esm/context/OrderListPaginationContext.js +1 -0
  204. package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
  205. package/lib/esm/context/PaymentSourceContext.d.ts +2 -2
  206. package/lib/esm/context/PlaceOrderContext.d.ts +1 -1
  207. package/lib/esm/context/ShipmentContext.d.ts +1 -1
  208. package/lib/esm/context/ShippingAddressContext.d.ts +1 -1
  209. package/lib/esm/context/SkuChildrenContext.d.ts +1 -1
  210. package/lib/esm/context/SkuContext.d.ts +1 -1
  211. package/lib/esm/index.d.ts +1 -1
  212. package/lib/esm/index.js +1 -1
  213. package/lib/esm/reducers/AddressReducer.d.ts +10 -10
  214. package/lib/esm/reducers/AvailabilityReducer.d.ts +4 -4
  215. package/lib/esm/reducers/BillingAddressReducer.d.ts +4 -4
  216. package/lib/esm/reducers/CustomerReducer.d.ts +6 -6
  217. package/lib/esm/reducers/GiftCardReducer.d.ts +3 -3
  218. package/lib/esm/reducers/LineItemReducer.d.ts +4 -4
  219. package/lib/esm/reducers/OrderReducer.d.ts +19 -19
  220. package/lib/esm/reducers/OrderReducer.js +1 -1
  221. package/lib/esm/reducers/PaymentMethodReducer.d.ts +17 -17
  222. package/lib/esm/reducers/PlaceOrderReducer.d.ts +5 -5
  223. package/lib/esm/reducers/PriceReducer.d.ts +3 -3
  224. package/lib/esm/reducers/ShipmentReducer.d.ts +6 -6
  225. package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
  226. package/lib/esm/reducers/SkuListsReducer.d.ts +3 -3
  227. package/lib/esm/reducers/SkuReducer.d.ts +3 -3
  228. package/lib/esm/typings/errors.d.ts +3 -3
  229. package/lib/esm/typings/index.d.ts +24 -24
  230. package/lib/esm/utils/PropsType.d.ts +4 -4
  231. package/lib/esm/utils/addressesManager.d.ts +3 -3
  232. package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
  233. package/lib/esm/utils/compareObjAttribute.d.ts +2 -2
  234. package/lib/esm/utils/filterChildren.d.ts +8 -0
  235. package/lib/esm/utils/filterChildren.js +1 -0
  236. package/lib/esm/utils/getCardDetails.d.ts +2 -2
  237. package/lib/esm/utils/getCartLink.d.ts +1 -1
  238. package/lib/esm/utils/getErrors.d.ts +1 -1
  239. package/lib/esm/utils/getLineItemsCount.d.ts +1 -1
  240. package/lib/esm/utils/hooks/useCustomContext.js +1 -1
  241. package/lib/esm/utils/jwt.d.ts +1 -1
  242. package/lib/esm/utils/localStorage.d.ts +1 -1
  243. package/lib/esm/utils/omit.d.ts +1 -0
  244. package/lib/esm/utils/omit.js +1 -0
  245. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  246. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  247. package/package.json +24 -17
  248. package/lib/cjs/components/Errors.d.ts +0 -5
  249. package/lib/cjs/components/Errors.js +0 -1
  250. package/lib/esm/components/Errors.d.ts +0 -5
  251. package/lib/esm/components/Errors.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import { ChildrenFunction } from './index';
3
- export declare 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 declare 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';
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,7 +24,7 @@ export declare const ErrorPropTypes: {
24
24
  children: PropTypes.Requireable<(...args: any[]) => any>;
25
25
  field: PropTypes.Requireable<string>;
26
26
  };
27
- declare type ErrorChildrenComponentProps = ChildrenFunction<Omit<ErrorComponentProps, 'children'> & {
27
+ type ErrorChildrenComponentProps = ChildrenFunction<Omit<ErrorComponentProps, 'children'> & {
28
28
  errors: string[];
29
29
  }>;
30
30
  export interface ErrorComponentProps {
@@ -22,8 +22,8 @@ export declare const BaseSelectComponentPropTypes: {
22
22
  value: PropTypes.Requireable<string>;
23
23
  name: PropTypes.Validator<string>;
24
24
  };
25
- export declare type SelectPlaceholder = Option;
26
- declare type BaseSelectChildrenComponentProps = Omit<BaseSelectComponentProps, 'children'>;
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
- declare type BaseInputChildrenComponentProps = Omit<BaseInputComponentProps, 'children'> & {
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 declare type LineItemType = 'gift_cards' | 'payment_methods' | 'promotions' | 'shipments' | 'skus' | 'bundles' | 'adjustments';
61
- export declare type GiftCardInputName = 'balanceCents' | 'balanceMaxCents' | 'singleUse' | 'rechargeable' | 'imageUrl' | 'expiresAt' | 'referenceOrigin' | 'email' | 'firstName' | 'lastName' | 'reference';
62
- export declare 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 declare type AddressCountrySelectName = 'billing_address_country_code' | 'shipping_address_country_code' | 'customer_address_country_code';
64
- export declare type AddressStateSelectName = 'billing_address_state_code' | 'shipping_address_state_code' | 'customer_address_state_code';
65
- export declare type BaseInputType = 'checkbox' | 'date' | 'email' | 'number' | 'tel' | 'text' | 'textarea';
66
- export declare type LoaderType = string | ReactNode;
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 declare type TimeFormat = 'days' | 'hours';
74
- export declare type BaseComponent = InferProps<typeof BC>;
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 declare type BaseActionType<T = string> = T[];
84
- export declare type BFSetStateContainer<T> = <P extends T>(param: P) => void;
85
- export declare type BaseReducer = <S extends BaseState, A extends BaseAction, T extends BaseActionType>(state: S, action: A, type: T) => S;
86
- export declare type BaseUnsetState<A> = (dispatch: Dispatch<A>) => void;
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 declare type BaseFormatPrice = 'formatted' | 'cents' | 'float';
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 declare type BasePriceType = 'total' | 'option' | 'unit';
110
- export declare type BaseSelectorType = 'select' | 'radio';
111
- export declare type BaseAmountComponentChildren = Omit<BaseAmountComponent, 'children'>;
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,10 +116,10 @@ export interface BaseAmountComponent extends Omit<JSX.IntrinsicElements['span'],
116
116
  priceCents?: number;
117
117
  labelFree?: string;
118
118
  }
119
- export declare type ChildrenFunction<P = Record<string, any>> = (props: P) => JSX.Element | null;
120
- export declare type ExcludeTag<T extends keyof JSX.IntrinsicElements> = Exclude<keyof JSX.IntrinsicElements, T>;
121
- export declare type ExtractTag<T extends keyof JSX.IntrinsicElements> = Extract<keyof JSX.IntrinsicElements, T>;
122
- export declare type ConditionalElement<E> = ({
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']) | ({
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
- declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
3
- declare type Defined<T> = T extends undefined ? never : T;
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
- declare type WithDefaultProps<P, DP> = Omit<P, keyof DP> & {
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 declare type PropsType<PT, DP = {}> = WithDefaultProps<PropTypes.InferProps<PT>, DP>;
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
- declare type BillingAddressController = (params: {
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
- declare type ShippingAddressController = (params: {
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
- declare type CountryLockController = (params: {
19
+ type CountryLockController = (params: {
20
20
  addresses?: Address[] | null;
21
21
  billing_address?: TCustomerAddress;
22
22
  billingAddressId?: string;
@@ -1,6 +1,6 @@
1
1
  import { ResourceIncluded } from '../reducers/OrderReducer';
2
2
  import type { Order } from '@commercelayer/sdk';
3
- declare type Params = {
3
+ type Params = {
4
4
  order: Order;
5
5
  resourceInclude: ResourceIncluded[];
6
6
  };
@@ -1,5 +1,5 @@
1
- declare type Item = Record<string, any>;
2
- declare type TArgs<A, B> = {
1
+ type Item = Record<string, any>;
2
+ type TArgs<A, B> = {
3
3
  attributes: A;
4
4
  object: B;
5
5
  };
@@ -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
- declare type CardDetails = {
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
- declare type Args = {
10
+ type Args = {
11
11
  paymentType: PaymentResource;
12
12
  customerPayment: Partial<CustomerPaymentSource>;
13
13
  };
@@ -1,4 +1,4 @@
1
- declare type TArgs = {
1
+ type TArgs = {
2
2
  orderId: string;
3
3
  accessToken: string;
4
4
  slug: string;
@@ -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
- declare type SetErrorsArgs<D> = {
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 declare type TypeAccepted = Extract<LineItemType, 'skus' | 'gift_cards' | 'bundles' | 'adjustments'>;
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&&currentContext!=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&&currentContext!=null||currentContext!=null)return currentContext;if(isProduction)console.error(msg);else throw new Error(msg);return currentContext}exports.default=useCustomContext;
@@ -1,4 +1,4 @@
1
- declare type JWT = {
1
+ type JWT = {
2
2
  application: {
3
3
  id: string;
4
4
  kind: 'sales_channel' | 'integration';
@@ -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 declare type CustomerOrderParams = '_save_payment_source_to_customer_wallet' | '_save_billing_address_to_customer_address_book' | '_save_shipping_address_to_customer_address_book';
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,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputComponentProps } from '../typings/index';
3
- declare type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
3
+ type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
4
4
  export declare function MetadataInput(props: Props): JSX.Element;
5
5
  export default MetadataInput;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { AddressCountrySelectName, BaseSelectComponentProps } from '../../typings/index';
3
3
  import { AddressValuesKeys } from '../../context/BillingAddressFormContext';
4
- declare type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
4
+ type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
5
5
  name: Extract<AddressValuesKeys, AddressCountrySelectName>;
6
6
  required?: boolean;
7
7
  disabled?: boolean;
@@ -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
- declare type ChildrenProp = ChildrenFunction<ChildrenProps>;
9
- declare type Props = {
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
- declare type Props = {
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
- declare type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
3
+ type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
4
4
  name: AddressStateSelectName;
5
5
  required?: boolean;
6
6
  disabled?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ type Props = {
3
3
  children: ReactNode;
4
4
  };
5
5
  export declare function BillingAddressContainer(props: Props): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ type Props = {
3
3
  children: ReactNode;
4
4
  reset?: boolean;
5
5
  errorClassName?: string;
@@ -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
- declare type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['Customer']>;
5
- declare type TCondition = ConditionalElement<Exclude<TResources['Customer'], 'resource'>>;
6
- declare type Props = {
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,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputComponentProps } from '../../typings/index';
3
- declare type Props = {
3
+ type Props = {
4
4
  name?: 'customer_email' | string;
5
5
  type?: 'email' | string;
6
6
  saveOnBlur?: boolean;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { ErrorComponentProps } from '../../typings/errors';
3
+ type Props = ErrorComponentProps & Omit<JSX.IntrinsicElements['span'], 'children'>;
4
+ export declare function Errors(props: Props): JSX.Element;
5
+ export default Errors;
@@ -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,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseSelectComponentProps } from '../../typings/index';
3
- declare type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
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;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputComponentProps, GiftCardInputName } from '../../typings/index';
3
- declare type Props = {
3
+ type Props = {
4
4
  name: GiftCardInputName;
5
5
  } & Omit<BaseInputComponentProps, 'name'> & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
6
6
  export declare function GiftCardInput(props: Props): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ type Props = {
3
3
  children: ReactNode;
4
4
  onSubmit?: (response: {
5
5
  success: boolean;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputComponentProps } from '../../typings/index';
3
3
  import { OrderCodeType } from '../../reducers/OrderReducer';
4
- declare type Props = {
4
+ type Props = {
5
5
  name?: 'gift_card_or_coupon_code';
6
6
  type?: 'text';
7
7
  placeholderTranslation?: (codeType: OrderCodeType) => string;
@@ -6,7 +6,7 @@ interface ChildrenProps extends Omit<Props, 'children'> {
6
6
  hide?: boolean;
7
7
  handleClick?: () => void;
8
8
  }
9
- declare type Props = {
9
+ type Props = {
10
10
  type?: CodeType;
11
11
  children?: ChildrenFunction<ChildrenProps>;
12
12
  label?: string | ReactNode;
@@ -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},k)});return _jsx(_Fragment,{children:components})}export default LineItem;
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
- declare type Props = BaseAmountComponent & {
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
- declare type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
5
- declare type TCondition = ConditionalElement<Exclude<TResources['LineItem'], 'resource'>>;
6
- declare type Props = {
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
  /**
@@ -5,7 +5,7 @@ export interface TLineItemImage extends Omit<Props, 'children'> {
5
5
  src: string;
6
6
  lineItem: LineItem;
7
7
  }
8
- declare type Props = {
8
+ type Props = {
9
9
  children?: ChildrenFunction<TLineItemImage>;
10
10
  width?: number;
11
11
  placeholder?: {
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ type Props = {
3
3
  children: ReactNode;
4
4
  title?: string;
5
5
  showName?: boolean;
@@ -4,7 +4,7 @@ interface ChildrenProps extends Omit<Props, 'children'> {
4
4
  quantity: number;
5
5
  handleChange: (event: React.MouseEvent<HTMLSelectElement>) => void;
6
6
  }
7
- declare type Props = {
7
+ type Props = {
8
8
  children?: ChildrenFunction<ChildrenProps>;
9
9
  max?: number;
10
10
  disabled?: boolean;
@@ -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
- declare type BuyNowMode = {
7
+ type BuyNowMode = {
8
8
  buyNowMode: true;
9
9
  checkoutUrl?: string;
10
10
  } | {
11
11
  buyNowMode?: false;
12
12
  checkoutUrl?: never;
13
13
  };
14
- declare type THostedCart = {
14
+ type THostedCart = {
15
15
  redirectToHostedCart: true;
16
16
  hostedCartUrl?: string;
17
17
  } | {
18
18
  redirectToHostedCart?: false;
19
19
  hostedCartUrl?: never;
20
20
  };
21
- declare type TButton = PropsWithoutRef<Omit<JSX.IntrinsicElements['button'], 'children'>>;
22
- declare type Props = {
21
+ type TButton = PropsWithoutRef<Omit<JSX.IntrinsicElements['button'], 'children'>>;
22
+ type Props = {
23
23
  /**
24
24
  * Code of a bundle
25
25
  */
@@ -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 declare type OrderListColumn = Column & {
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
- declare type Props = {
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 the table header
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=table.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})})},[table.prepareRow,table.rows]):table.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}))});return loading&&orders==null?_jsx(_Fragment,{children:LoadingComponent}):orders?.length===0?_jsx(OrderListChildrenContext.Provider,{value:{orders},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})]})}export default OrderList;
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;