@commercelayer/react-components 4.1.0-beta.1 → 4.1.0-beta.3

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 (270) 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 +2 -2
  5. package/lib/cjs/components/addresses/AddressInput.js +1 -1
  6. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -1
  7. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
  8. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
  9. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
  10. package/lib/cjs/components/customers/CustomerField.d.ts +3 -3
  11. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -1
  12. package/lib/cjs/components/customers/SaveCustomerButton.js +1 -1
  13. package/lib/cjs/components/errors/Errors.d.ts +5 -0
  14. package/lib/cjs/components/errors/Errors.js +1 -0
  15. package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
  16. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  17. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -1
  18. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -1
  19. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -1
  20. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  21. package/lib/cjs/components/line_items/LineItem.js +1 -1
  22. package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
  23. package/lib/cjs/components/line_items/LineItemField.d.ts +3 -3
  24. package/lib/cjs/components/line_items/LineItemImage.d.ts +1 -1
  25. package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
  26. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
  27. package/lib/cjs/components/orders/AddToCartButton.d.ts +4 -4
  28. package/lib/cjs/components/orders/OrderList.d.ts +24 -7
  29. package/lib/cjs/components/orders/OrderList.js +1 -1
  30. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +44 -0
  31. package/lib/cjs/components/orders/OrderListPaginationButtons.js +1 -0
  32. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +29 -0
  33. package/lib/cjs/components/orders/OrderListPaginationInfo.js +1 -0
  34. package/lib/cjs/components/orders/OrderListRow.d.ts +3 -0
  35. package/lib/cjs/components/orders/OrderListRow.js +1 -1
  36. package/lib/cjs/components/orders/OrderNumber.d.ts +1 -1
  37. package/lib/cjs/components/parcels/ParcelField.d.ts +3 -3
  38. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +3 -3
  39. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -1
  40. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  41. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  42. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  43. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +2 -2
  44. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -1
  45. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -1
  46. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  47. package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +1 -1
  48. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  49. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
  50. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
  51. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -3
  52. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +2 -2
  53. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +1 -1
  54. package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +1 -1
  55. package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  56. package/lib/cjs/components/payment_source/PaypalPayment.d.ts +2 -2
  57. package/lib/cjs/components/payment_source/StripePayment.d.ts +2 -2
  58. package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +2 -2
  59. package/lib/cjs/components/shipments/ShipmentField.d.ts +2 -2
  60. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  61. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  62. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -3
  63. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
  64. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +3 -3
  65. package/lib/cjs/components/skus/SkuField.d.ts +3 -3
  66. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +3 -3
  67. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +2 -2
  68. package/lib/cjs/components/utils/BaseField.d.ts +1 -1
  69. package/lib/cjs/components/utils/BaseInput.d.ts +2 -2
  70. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +1 -1
  71. package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
  72. package/lib/cjs/components/utils/GenericFieldComponent.d.ts +3 -3
  73. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +4 -4
  74. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
  75. package/lib/cjs/components/utils/getAllErrors.d.ts +1 -1
  76. package/lib/cjs/context/AddressContext.d.ts +1 -1
  77. package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
  78. package/lib/cjs/context/BillingAddressFormContext.d.ts +1 -1
  79. package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
  80. package/lib/cjs/context/CustomerAddressFormContext.d.ts +1 -1
  81. package/lib/cjs/context/CustomerContext.d.ts +1 -1
  82. package/lib/cjs/context/ExternalFunctionContext.d.ts +1 -1
  83. package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
  84. package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
  85. package/lib/cjs/context/OrderListPaginationContext.d.ts +19 -0
  86. package/lib/cjs/context/OrderListPaginationContext.js +1 -0
  87. package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
  88. package/lib/cjs/context/PaymentSourceContext.d.ts +2 -2
  89. package/lib/cjs/context/PlaceOrderContext.d.ts +1 -1
  90. package/lib/cjs/context/ShipmentContext.d.ts +1 -1
  91. package/lib/cjs/context/ShippingAddressContext.d.ts +1 -1
  92. package/lib/cjs/context/SkuChildrenContext.d.ts +1 -1
  93. package/lib/cjs/context/SkuContext.d.ts +1 -1
  94. package/lib/cjs/index.d.ts +1 -1
  95. package/lib/cjs/index.js +1 -1
  96. package/lib/cjs/reducers/AddressReducer.d.ts +10 -10
  97. package/lib/cjs/reducers/AvailabilityReducer.d.ts +4 -4
  98. package/lib/cjs/reducers/BillingAddressReducer.d.ts +4 -4
  99. package/lib/cjs/reducers/CustomerReducer.d.ts +6 -6
  100. package/lib/cjs/reducers/GiftCardReducer.d.ts +3 -3
  101. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  102. package/lib/cjs/reducers/LineItemReducer.d.ts +4 -4
  103. package/lib/cjs/reducers/OrderReducer.d.ts +19 -19
  104. package/lib/cjs/reducers/OrderReducer.js +1 -1
  105. package/lib/cjs/reducers/PaymentMethodReducer.d.ts +17 -17
  106. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +5 -5
  107. package/lib/cjs/reducers/PriceReducer.d.ts +3 -3
  108. package/lib/cjs/reducers/ShipmentReducer.d.ts +6 -6
  109. package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
  110. package/lib/cjs/reducers/SkuListsReducer.d.ts +3 -3
  111. package/lib/cjs/reducers/SkuReducer.d.ts +3 -3
  112. package/lib/cjs/typings/errors.d.ts +3 -3
  113. package/lib/cjs/typings/index.d.ts +24 -24
  114. package/lib/cjs/utils/PropsType.d.ts +4 -4
  115. package/lib/cjs/utils/addressesManager.d.ts +3 -3
  116. package/lib/cjs/utils/addressesManager.js +1 -1
  117. package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
  118. package/lib/cjs/utils/compareObjAttribute.d.ts +2 -2
  119. package/lib/cjs/utils/customMessages.d.ts +1 -1
  120. package/lib/cjs/utils/filterChildren.d.ts +8 -0
  121. package/lib/cjs/utils/filterChildren.js +1 -0
  122. package/lib/cjs/utils/getCardDetails.d.ts +2 -2
  123. package/lib/cjs/utils/getCartLink.d.ts +1 -1
  124. package/lib/cjs/utils/getErrors.d.ts +1 -1
  125. package/lib/cjs/utils/getLineItemsCount.d.ts +1 -1
  126. package/lib/cjs/utils/hooks/useCustomContext.js +1 -1
  127. package/lib/cjs/utils/jwt.d.ts +1 -1
  128. package/lib/cjs/utils/localStorage.d.ts +1 -1
  129. package/lib/cjs/utils/omit.d.ts +1 -0
  130. package/lib/cjs/utils/omit.js +1 -0
  131. package/lib/cjs/utils/validateFormFields.d.ts +6 -12
  132. package/lib/cjs/utils/validateFormFields.js +1 -1
  133. package/lib/esm/components/MetadataInput.d.ts +1 -1
  134. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +1 -1
  135. package/lib/esm/components/addresses/AddressField.d.ts +2 -2
  136. package/lib/esm/components/addresses/AddressInput.d.ts +2 -2
  137. package/lib/esm/components/addresses/AddressInput.js +1 -1
  138. package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -1
  139. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
  140. package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
  141. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
  142. package/lib/esm/components/customers/CustomerField.d.ts +3 -3
  143. package/lib/esm/components/customers/CustomerInput.d.ts +1 -1
  144. package/lib/esm/components/customers/SaveCustomerButton.js +1 -1
  145. package/lib/esm/components/errors/Errors.d.ts +5 -0
  146. package/lib/esm/components/errors/Errors.js +1 -0
  147. package/lib/esm/components/gift_cards/GiftCard.js +1 -1
  148. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  149. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -1
  150. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -1
  151. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -1
  152. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  153. package/lib/esm/components/line_items/LineItem.js +1 -1
  154. package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
  155. package/lib/esm/components/line_items/LineItemField.d.ts +3 -3
  156. package/lib/esm/components/line_items/LineItemImage.d.ts +1 -1
  157. package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
  158. package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
  159. package/lib/esm/components/orders/AddToCartButton.d.ts +4 -4
  160. package/lib/esm/components/orders/OrderList.d.ts +24 -7
  161. package/lib/esm/components/orders/OrderList.js +1 -1
  162. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +44 -0
  163. package/lib/esm/components/orders/OrderListPaginationButtons.js +1 -0
  164. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +29 -0
  165. package/lib/esm/components/orders/OrderListPaginationInfo.js +1 -0
  166. package/lib/esm/components/orders/OrderListRow.d.ts +3 -0
  167. package/lib/esm/components/orders/OrderListRow.js +1 -1
  168. package/lib/esm/components/orders/OrderNumber.d.ts +1 -1
  169. package/lib/esm/components/parcels/ParcelField.d.ts +3 -3
  170. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +3 -3
  171. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -1
  172. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  173. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  174. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  175. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +2 -2
  176. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -1
  177. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -1
  178. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  179. package/lib/esm/components/payment_methods/PaymentMethod.d.ts +1 -1
  180. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  181. package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
  182. package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
  183. package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -3
  184. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +2 -2
  185. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +1 -1
  186. package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +1 -1
  187. package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  188. package/lib/esm/components/payment_source/PaypalPayment.d.ts +2 -2
  189. package/lib/esm/components/payment_source/StripePayment.d.ts +2 -2
  190. package/lib/esm/components/payment_source/WireTransferPayment.d.ts +2 -2
  191. package/lib/esm/components/shipments/ShipmentField.d.ts +2 -2
  192. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  193. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  194. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -3
  195. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
  196. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +3 -3
  197. package/lib/esm/components/skus/SkuField.d.ts +3 -3
  198. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +3 -3
  199. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +2 -2
  200. package/lib/esm/components/utils/BaseField.d.ts +1 -1
  201. package/lib/esm/components/utils/BaseInput.d.ts +2 -2
  202. package/lib/esm/components/utils/BaseOrderPrice.d.ts +1 -1
  203. package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
  204. package/lib/esm/components/utils/GenericFieldComponent.d.ts +3 -3
  205. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +4 -4
  206. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
  207. package/lib/esm/components/utils/getAllErrors.d.ts +1 -1
  208. package/lib/esm/context/AddressContext.d.ts +1 -1
  209. package/lib/esm/context/BillingAddressContext.d.ts +1 -1
  210. package/lib/esm/context/BillingAddressFormContext.d.ts +1 -1
  211. package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
  212. package/lib/esm/context/CustomerAddressFormContext.d.ts +1 -1
  213. package/lib/esm/context/CustomerContext.d.ts +1 -1
  214. package/lib/esm/context/ExternalFunctionContext.d.ts +1 -1
  215. package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
  216. package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
  217. package/lib/esm/context/OrderListPaginationContext.d.ts +19 -0
  218. package/lib/esm/context/OrderListPaginationContext.js +1 -0
  219. package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
  220. package/lib/esm/context/PaymentSourceContext.d.ts +2 -2
  221. package/lib/esm/context/PlaceOrderContext.d.ts +1 -1
  222. package/lib/esm/context/ShipmentContext.d.ts +1 -1
  223. package/lib/esm/context/ShippingAddressContext.d.ts +1 -1
  224. package/lib/esm/context/SkuChildrenContext.d.ts +1 -1
  225. package/lib/esm/context/SkuContext.d.ts +1 -1
  226. package/lib/esm/index.d.ts +1 -1
  227. package/lib/esm/index.js +1 -1
  228. package/lib/esm/reducers/AddressReducer.d.ts +10 -10
  229. package/lib/esm/reducers/AvailabilityReducer.d.ts +4 -4
  230. package/lib/esm/reducers/BillingAddressReducer.d.ts +4 -4
  231. package/lib/esm/reducers/CustomerReducer.d.ts +6 -6
  232. package/lib/esm/reducers/GiftCardReducer.d.ts +3 -3
  233. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  234. package/lib/esm/reducers/LineItemReducer.d.ts +4 -4
  235. package/lib/esm/reducers/OrderReducer.d.ts +19 -19
  236. package/lib/esm/reducers/OrderReducer.js +1 -1
  237. package/lib/esm/reducers/PaymentMethodReducer.d.ts +17 -17
  238. package/lib/esm/reducers/PlaceOrderReducer.d.ts +5 -5
  239. package/lib/esm/reducers/PriceReducer.d.ts +3 -3
  240. package/lib/esm/reducers/ShipmentReducer.d.ts +6 -6
  241. package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
  242. package/lib/esm/reducers/SkuListsReducer.d.ts +3 -3
  243. package/lib/esm/reducers/SkuReducer.d.ts +3 -3
  244. package/lib/esm/typings/errors.d.ts +3 -3
  245. package/lib/esm/typings/index.d.ts +24 -24
  246. package/lib/esm/utils/PropsType.d.ts +4 -4
  247. package/lib/esm/utils/addressesManager.d.ts +3 -3
  248. package/lib/esm/utils/addressesManager.js +1 -1
  249. package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
  250. package/lib/esm/utils/compareObjAttribute.d.ts +2 -2
  251. package/lib/esm/utils/filterChildren.d.ts +8 -0
  252. package/lib/esm/utils/filterChildren.js +1 -0
  253. package/lib/esm/utils/getCardDetails.d.ts +2 -2
  254. package/lib/esm/utils/getCartLink.d.ts +1 -1
  255. package/lib/esm/utils/getErrors.d.ts +1 -1
  256. package/lib/esm/utils/getLineItemsCount.d.ts +1 -1
  257. package/lib/esm/utils/hooks/useCustomContext.js +1 -1
  258. package/lib/esm/utils/jwt.d.ts +1 -1
  259. package/lib/esm/utils/localStorage.d.ts +1 -1
  260. package/lib/esm/utils/omit.d.ts +1 -0
  261. package/lib/esm/utils/omit.js +1 -0
  262. package/lib/esm/utils/validateFormFields.d.ts +6 -12
  263. package/lib/esm/utils/validateFormFields.js +1 -1
  264. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  265. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  266. package/package.json +24 -17
  267. package/lib/cjs/components/Errors.d.ts +0 -5
  268. package/lib/cjs/components/Errors.js +0 -1
  269. package/lib/esm/components/Errors.d.ts +0 -5
  270. package/lib/esm/components/Errors.js +0 -1
@@ -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,8 +1,8 @@
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
- } & Omit<BaseInputComponentProps, 'name'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
6
+ } & Omit<BaseInputComponentProps, 'name'> & JSX.IntrinsicElements['input'] & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
7
7
  export declare function AddressInput(props: Props): JSX.Element | null;
8
8
  export default AddressInput;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AddressInput=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),BaseInput_1=tslib_1.__importDefault(require("../utils/BaseInput")),BillingAddressFormContext_1=tslib_1.__importDefault(require("../../context/BillingAddressFormContext")),ShippingAddressFormContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressFormContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),validateFormFields_1=require("../../utils/validateFormFields"),CustomerAddressFormContext_1=tslib_1.__importDefault(require("../../context/CustomerAddressFormContext"));function AddressInput(props){const{placeholder="",required,value,className,...p}=props,billingAddress=(0,react_1.useContext)(BillingAddressFormContext_1.default),shippingAddress=(0,react_1.useContext)(ShippingAddressFormContext_1.default),customerAddress=(0,react_1.useContext)(CustomerAddressFormContext_1.default),[hasError,setHasError]=(0,react_1.useState)(!1);(0,react_1.useEffect)(()=>(value&&billingAddress?.setValue&&billingAddress.setValue(p.name,value),value&&shippingAddress?.setValue&&shippingAddress.setValue(p.name,value),value&&customerAddress?.setValue&&customerAddress.setValue(p.name,value),billingAddress.errors&&billingAddress?.errors?.[p.name]?.error&&setHasError(!0),billingAddress&&(0,isEmpty_1.default)(billingAddress?.errors?.[p.name])&&hasError&&setHasError(!1),customerAddress.errors&&customerAddress?.errors?.[p.name]?.error&&setHasError(!0),(0,isEmpty_1.default)(customerAddress?.errors?.[p.name])&&hasError&&setHasError(!1),shippingAddress.errors&&shippingAddress?.errors?.[p.name]?.error&&setHasError(!0),shippingAddress&&(0,isEmpty_1.default)(shippingAddress?.errors?.[p.name])&&hasError&&setHasError(!1),()=>{setHasError(!1)}),[value,billingAddress?.errors,shippingAddress?.errors]);const mandatoryField=billingAddress?.isBusiness?(0,validateFormFields_1.businessMandatoryField)(p.name,billingAddress.isBusiness):(0,validateFormFields_1.businessMandatoryField)(p.name,shippingAddress.isBusiness),reqField=required!==void 0?required:mandatoryField,errorClassName=billingAddress?.errorClassName||shippingAddress?.errorClassName,classNameComputed=`${className||""} ${hasError&&errorClassName?errorClassName:""}`;return p.name==="billing_address_billing_info"&&!billingAddress.requiresBillingInfo?null:(0,jsx_runtime_1.jsx)(BaseInput_1.default,{ref:billingAddress?.validation||shippingAddress?.validation||customerAddress?.validation,className:classNameComputed,required:reqField,placeholder,defaultValue:value,...p})}exports.AddressInput=AddressInput,exports.default=AddressInput;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AddressInput=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),BaseInput_1=tslib_1.__importDefault(require("../utils/BaseInput")),BillingAddressFormContext_1=tslib_1.__importDefault(require("../../context/BillingAddressFormContext")),ShippingAddressFormContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressFormContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),validateFormFields_1=require("../../utils/validateFormFields"),CustomerAddressFormContext_1=tslib_1.__importDefault(require("../../context/CustomerAddressFormContext"));function AddressInput(props){const{placeholder="",required,value,className,...p}=props,billingAddress=(0,react_1.useContext)(BillingAddressFormContext_1.default),shippingAddress=(0,react_1.useContext)(ShippingAddressFormContext_1.default),customerAddress=(0,react_1.useContext)(CustomerAddressFormContext_1.default),[hasError,setHasError]=(0,react_1.useState)(!1);(0,react_1.useEffect)(()=>(value&&billingAddress?.setValue&&billingAddress.setValue(p.name,value),value&&shippingAddress?.setValue&&shippingAddress.setValue(p.name,value),value&&customerAddress?.setValue&&customerAddress.setValue(p.name,value),billingAddress.errors&&billingAddress?.errors?.[p.name]?.error&&setHasError(!0),billingAddress&&(0,isEmpty_1.default)(billingAddress?.errors?.[p.name])&&hasError&&setHasError(!1),customerAddress.errors&&customerAddress?.errors?.[p.name]?.error&&setHasError(!0),(0,isEmpty_1.default)(customerAddress?.errors?.[p.name])&&hasError&&setHasError(!1),shippingAddress.errors&&shippingAddress?.errors?.[p.name]?.error&&setHasError(!0),shippingAddress&&(0,isEmpty_1.default)(shippingAddress?.errors?.[p.name])&&hasError&&setHasError(!1),()=>{setHasError(!1)}),[value,billingAddress?.errors,shippingAddress?.errors]);const mandatoryField=billingAddress?.isBusiness?(0,validateFormFields_1.businessMandatoryField)(p.name,billingAddress.isBusiness):(0,validateFormFields_1.businessMandatoryField)(p.name,shippingAddress.isBusiness),reqField=required!==void 0?required:mandatoryField,errorClassName=billingAddress?.errorClassName||shippingAddress?.errorClassName,classNameComputed=`${className||""} ${hasError&&errorClassName?errorClassName:""}`;return p.name==="billing_address_billing_info"&&billingAddress.requiresBillingInfo===!1&&required===void 0?null:(0,jsx_runtime_1.jsx)(BaseInput_1.default,{ref:billingAddress?.validation||shippingAddress?.validation||customerAddress?.validation,className:classNameComputed,required:reqField,placeholder,defaultValue:value,...p})}exports.AddressInput=AddressInput,exports.default=AddressInput;
@@ -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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingAddressForm=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),AddressContext_1=tslib_1.__importDefault(require("../../context/AddressContext")),rapid_form_1=require("rapid-form"),react_1=require("react"),ShippingAddressFormContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressFormContext")),lodash_1=require("lodash"),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),localStorage_1=require("../../utils/localStorage"),validateFormFields_1=require("../../utils/validateFormFields");function ShippingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=(0,rapid_form_1.useRapidForm)(),{setAddressErrors,setAddress,shipToDifferentAddress,isBusiness}=(0,react_1.useContext)(AddressContext_1.default),{saveAddressToCustomerAddressBook,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null);(0,react_1.useEffect)(()=>{if(include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address"}),(0,lodash_1.isEmpty)(errors)){if(!(0,lodash_1.isEmpty)(values)&&shipToDifferentAddress){setAddressErrors([],"shipping_address");for(const name in values){const field=values[name];(0,validateFormFields_1.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)?(0,lodash_1.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||(0,localStorage_1.getSaveShippingAddressToAddressBook)();reset&&(!(0,lodash_1.isEmpty)(values)||!(0,lodash_1.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(0,jsx_runtime_1.jsx)(ShippingAddressFormContext_1.default.Provider,{value:providerValues,children:(0,jsx_runtime_1.jsx)("form",{ref,autoComplete,...p,children})})}exports.ShippingAddressForm=ShippingAddressForm,exports.default=ShippingAddressForm;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingAddressForm=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),AddressContext_1=tslib_1.__importDefault(require("../../context/AddressContext")),rapid_form_1=require("rapid-form"),react_1=require("react"),ShippingAddressFormContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressFormContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),localStorage_1=require("../../utils/localStorage"),validateFormFields_1=require("../../utils/validateFormFields");function ShippingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=(0,rapid_form_1.useRapidForm)(),{setAddressErrors,setAddress,shipToDifferentAddress,isBusiness}=(0,react_1.useContext)(AddressContext_1.default),{saveAddressToCustomerAddressBook,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null);(0,react_1.useEffect)(()=>{if(include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address"}),(0,isEmpty_1.default)(errors)){if(!(0,isEmpty_1.default)(values)&&shipToDifferentAddress){setAddressErrors([],"shipping_address");for(const name in values){const field=values[name];(0,validateFormFields_1.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)?(0,isEmpty_1.default)(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||(0,localStorage_1.getSaveShippingAddressToAddressBook)();reset&&(!(0,isEmpty_1.default)(values)||!(0,isEmpty_1.default)(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(0,jsx_runtime_1.jsx)(ShippingAddressFormContext_1.default.Provider,{value:providerValues,children:(0,jsx_runtime_1.jsx)("form",{ref,autoComplete,...p,children})})}exports.ShippingAddressForm=ShippingAddressForm,exports.default=ShippingAddressForm;
@@ -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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SaveCustomerButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),lodash_1=require("lodash"),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext"));function SaveCustomerButton(props){const{children,label="Save",resource,disabled,onClick,...p}=props,{errors,saveCustomerUser,customerEmail}=(0,react_1.useContext)(CustomerContext_1.default),disable=disabled||!(0,lodash_1.isEmpty)(errors)||(0,lodash_1.isEmpty)(customerEmail),handleClick=async()=>{(0,lodash_1.isEmpty)(errors)&&!disable&&(saveCustomerUser&&await saveCustomerUser(customerEmail),onClick&&onClick())},parentProps={...p,label,resource,handleClick,disabled:disable};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("button",{type:"button",disabled:disable,onClick:()=>{handleClick()},...p,children:label})}exports.SaveCustomerButton=SaveCustomerButton,exports.default=SaveCustomerButton;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SaveCustomerButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext"));function SaveCustomerButton(props){const{children,label="Save",resource,disabled,onClick,...p}=props,{errors,saveCustomerUser,customerEmail}=(0,react_1.useContext)(CustomerContext_1.default),disable=disabled||!(0,isEmpty_1.default)(errors)||(0,isEmpty_1.default)(customerEmail),handleClick=async()=>{(0,isEmpty_1.default)(errors)&&!disable&&(saveCustomerUser&&await saveCustomerUser(customerEmail),onClick&&onClick())},parentProps={...p,label,resource,handleClick,disabled:disable};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("button",{type:"button",disabled:disable,onClick:()=>{handleClick()},...p,children:label})}exports.SaveCustomerButton=SaveCustomerButton,exports.default=SaveCustomerButton;
@@ -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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Errors=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),GiftCardContext_1=tslib_1.__importDefault(require("../../context/GiftCardContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),AddressContext_1=tslib_1.__importDefault(require("../../context/AddressContext")),getAllErrors_1=tslib_1.__importDefault(require("../utils/getAllErrors")),LineItemContext_1=tslib_1.__importDefault(require("../../context/LineItemContext")),LineItemChildrenContext_1=tslib_1.__importDefault(require("../../context/LineItemChildrenContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext"));function Errors(props){const{children,messages=[],resource,field,...p}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{errors:orderErrors}=(0,react_1.useContext)(OrderContext_1.default),{errors:giftCardErrors}=(0,react_1.useContext)(GiftCardContext_1.default),{errors:lineItemErrors}=(0,react_1.useContext)(LineItemContext_1.default),{errors:addressErrors}=(0,react_1.useContext)(AddressContext_1.default),{errors:customerErrors}=(0,react_1.useContext)(CustomerContext_1.default),{errors:shipmentErrors}=(0,react_1.useContext)(ShipmentContext_1.default),{errors:paymentMethodErrors,currentPaymentMethodType,currentPaymentMethodId}=(0,react_1.useContext)(PaymentMethodContext_1.default),{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),allErrors=(0,react_1.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=(0,getAllErrors_1.default)({allErrors,field,messages,props:p,lineItem,resource,returnHtml:!children}),parentProps={messages,resource,field,errors:msgErrors,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:msgErrors})}exports.Errors=Errors,exports.default=Errors;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCard=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),validateFormFields_1=tslib_1.__importDefault(require("../../utils/validateFormFields")),lodash_1=require("lodash"),GiftCardContext_1=tslib_1.__importDefault(require("../../context/GiftCardContext"));function GiftCard(props){const{children,onSubmit}=props,name="giftCardForm",ref=(0,react_1.useRef)(null),{addGiftCard,addGiftCardError}=(0,react_1.useContext)(GiftCardContext_1.default),handleSubmit=e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm?.elements,{errors,values}=(0,validateFormFields_1.default)(elements,["currencyCode","balanceCents"],"gift_cards");(0,lodash_1.isEmpty)(errors)?(addGiftCard(values),currentForm?.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)};return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:(0,jsx_runtime_1.jsx)("form",{name,ref,onSubmit:handleSubmit,children},name)})}exports.GiftCard=GiftCard,exports.default=GiftCard;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCard=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),validateFormFields_1=tslib_1.__importDefault(require("../../utils/validateFormFields")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),GiftCardContext_1=tslib_1.__importDefault(require("../../context/GiftCardContext"));function GiftCard(props){const{children,onSubmit}=props,name="giftCardForm",ref=(0,react_1.useRef)(null),{addGiftCard,addGiftCardError}=(0,react_1.useContext)(GiftCardContext_1.default),handleSubmit=e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm?.elements,{errors,values}=(0,validateFormFields_1.default)(elements,["currencyCode","balanceCents"],"gift_cards");(0,isEmpty_1.default)(errors)?(addGiftCard(values),currentForm?.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)};return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:(0,jsx_runtime_1.jsx)("form",{name,ref,onSubmit:handleSubmit,children},name)})}exports.GiftCard=GiftCard,exports.default=GiftCard;
@@ -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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItem=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemContext_1=tslib_1.__importDefault(require("../../context/LineItemContext")),LineItemChildrenContext_1=tslib_1.__importDefault(require("../../context/LineItemChildrenContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext"));function LineItem(props){const{type="skus",children}=props,{lineItems}=(0,react_1.useContext)(LineItemContext_1.default),{lineItems:shipmentLineItems}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),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(0,jsx_runtime_1.jsx)(LineItemChildrenContext_1.default.Provider,{value:lineProps,children},k)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.LineItem=LineItem,exports.default=LineItem;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItem=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemContext_1=tslib_1.__importDefault(require("../../context/LineItemContext")),LineItemChildrenContext_1=tslib_1.__importDefault(require("../../context/LineItemChildrenContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext"));function LineItem(props){const{type="skus",children}=props,{lineItems}=(0,react_1.useContext)(LineItemContext_1.default),{lineItems:shipmentLineItems}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),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(0,jsx_runtime_1.jsx)(LineItemChildrenContext_1.default.Provider,{value:lineProps,children},lineItem.id)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.LineItem=LineItem,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderList=void 0;const tslib_1=require("tslib"),react_1=require("react"),jsx_runtime_1=require("react/jsx-runtime"),react_2=require("react"),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderListChildrenContext_1=tslib_1.__importDefault(require("../../context/OrderListChildrenContext")),react_table_1=require("react-table"),react_window_1=require("react-window"),scrollbarWidth_1=tslib_1.__importDefault(require("../../utils/scrollbarWidth")),icons_1=require("../../utils/icons");function OrderList({children,columns,loadingElement,showActions=!1,actionsComponent,actionsContainerClassName,infiniteScroll,windowOptions,theadClassName,rowTrClassName,...p}){const[loading,setLoading]=(0,react_2.useState)(!0),{orders}=(0,react_2.useContext)(CustomerContext_1.default),data=(0,react_2.useMemo)(()=>orders??[],[orders]),cols=(0,react_2.useMemo)(()=>columns,[columns]),tablePlugins=[react_table_1.useSortBy];infiniteScroll&&tablePlugins.push(react_table_1.useBlockLayout);const defaultColumn=(0,react_2.useMemo)(()=>({width:windowOptions?.column||150}),[windowOptions?.column]),table=(0,react_table_1.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";(0,react_2.useEffect)(()=>(orders!==void 0&&setLoading(!1),()=>{setLoading(!0)}),[orders]);const scrollBarSize=infiniteScroll?(0,react_2.useMemo)(()=>(0,scrollbarWidth_1.default)(),[]):0,LoadingComponent=loadingElement||(0,jsx_runtime_1.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(0,react_1.createElement)(ThHtmlElement,{"data-testid":`thead-${k}`,"data-sort":`${sortLabel}`,className:column?.className,...column.getHeaderProps(column?.getSortByToggleProps&&column?.getSortByToggleProps()),key:k},(0,jsx_runtime_1.jsxs)("span",{className:column?.titleClassName,children:[column.render("Header"),column.isSorted?column.isSortedDesc?icons_1.sortDescIcon:icons_1.sortAscIcon:""]}))});return(0,react_1.createElement)(TrHtmlElement,{...headerGroup.getHeaderGroupProps(),key:i},columns2)}),components=infiniteScroll?(0,react_2.useCallback)(({index,style})=>{const row=table.rows[index];row&&table.prepareRow(row);const childProps={orders,order:orders?.[index],row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll};return(0,jsx_runtime_1.jsx)(TrHtmlElement,{...row?.getRowProps({style}),className:rowTrClassName,children:(0,jsx_runtime_1.jsx)(OrderListChildrenContext_1.default.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(0,react_1.createElement)(TrHtmlElement,{...row.getRowProps(),className:rowTrClassName,key:i},(0,jsx_runtime_1.jsx)(OrderListChildrenContext_1.default.Provider,{value:childProps,children}))});return loading&&orders==null?(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:LoadingComponent}):orders?.length===0?(0,jsx_runtime_1.jsx)(OrderListChildrenContext_1.default.Provider,{value:{orders},children}):(0,jsx_runtime_1.jsxs)(TableHtmlElement,{...p,...table.getTableProps(),children:[(0,jsx_runtime_1.jsx)(TheadHtmlElement,{className:theadClassName,children:headerComponent}),(0,jsx_runtime_1.jsx)(TbodyHtmlElement,{...table.getTableBodyProps(),children:infiniteScroll?(0,jsx_runtime_1.jsx)(react_window_1.FixedSizeList,{height:windowOptions?.height||400,itemCount:table.rows.length,itemSize:windowOptions?.itemSize||100,width:windowOptions?.width||table.totalColumnsWidth+scrollBarSize,children:components}):components})]})}exports.OrderList=OrderList,exports.default=OrderList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderList=void 0;const tslib_1=require("tslib"),react_1=require("react"),jsx_runtime_1=require("react/jsx-runtime"),react_2=require("react"),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderListChildrenContext_1=tslib_1.__importDefault(require("../../context/OrderListChildrenContext")),OrderListPaginationContext_1=tslib_1.__importDefault(require("../../context/OrderListPaginationContext")),react_table_1=require("react-table"),react_window_1=require("react-window"),scrollbarWidth_1=tslib_1.__importDefault(require("../../utils/scrollbarWidth")),icons_1=require("../../utils/icons"),filterChildren_1=tslib_1.__importDefault(require("../../utils/filterChildren")),rowComponents=["OrderListRow"],paginationComponents=["OrderListPaginationInfo","OrderListPaginationButtons"];function OrderList({children,columns,loadingElement,showActions=!1,showPagination=!1,pageSize=10,paginationContainerClassName,actionsComponent,actionsContainerClassName,infiniteScroll,windowOptions,theadClassName,rowTrClassName,...p}){const[loading,setLoading]=(0,react_2.useState)(!0),{orders}=(0,react_2.useContext)(CustomerContext_1.default),data=(0,react_2.useMemo)(()=>orders??[],[orders]),cols=(0,react_2.useMemo)(()=>columns,[columns]),tablePlugins=[react_table_1.useSortBy];infiniteScroll&&tablePlugins.push(react_table_1.useBlockLayout),showPagination&&tablePlugins.push(react_table_1.usePagination);const defaultColumn=(0,react_2.useMemo)(()=>({width:windowOptions?.column||150}),[windowOptions?.column]),table=(0,react_table_1.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";(0,react_2.useEffect)(()=>(orders!==void 0&&setLoading(!1),()=>{setLoading(!0)}),[orders]);const scrollBarSize=infiniteScroll?(0,react_2.useMemo)(()=>(0,scrollbarWidth_1.default)(),[]):0,LoadingComponent=loadingElement||(0,jsx_runtime_1.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(0,react_1.createElement)(ThHtmlElement,{"data-testid":`thead-${k}`,"data-sort":`${sortLabel}`,className:column?.className,...column.getHeaderProps(column?.getSortByToggleProps&&column?.getSortByToggleProps()),key:k},(0,jsx_runtime_1.jsxs)("span",{className:column?.titleClassName,children:[column.render("Header"),column.isSorted?column.isSortedDesc?icons_1.sortDescIcon:icons_1.sortAscIcon:""]}))});return(0,react_1.createElement)(TrHtmlElement,{...headerGroup.getHeaderGroupProps(),key:i},columns2)}),rows=showPagination?table.page:table.rows,rowsComponents=(0,filterChildren_1.default)({children,filterBy:rowComponents,componentName:"OrderList"}),components=infiniteScroll?(0,react_2.useCallback)(({index,style})=>{const row=rows[index];row&&table.prepareRow(row);const childProps={orders,order:orders?.[index],row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll};return(0,jsx_runtime_1.jsx)(TrHtmlElement,{...row?.getRowProps({style}),className:rowTrClassName,children:(0,jsx_runtime_1.jsx)(OrderListChildrenContext_1.default.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(0,react_1.createElement)(TrHtmlElement,{...row.getRowProps(),className:rowTrClassName,key:i},(0,jsx_runtime_1.jsx)(OrderListChildrenContext_1.default.Provider,{value:childProps,children:rowsComponents}))}),pagComponents=(0,filterChildren_1.default)({children,filterBy:paginationComponents,componentName:"OrderList"}),Pagination=()=>showPagination?(0,jsx_runtime_1.jsx)(OrderListPaginationContext_1.default.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?(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:LoadingComponent}):orders?.length===0?(0,jsx_runtime_1.jsx)(OrderListChildrenContext_1.default.Provider,{value:{orders},children}):(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsxs)(TableHtmlElement,{...p,...table.getTableProps(),children:[(0,jsx_runtime_1.jsx)(TheadHtmlElement,{className:theadClassName,children:headerComponent}),(0,jsx_runtime_1.jsx)(TbodyHtmlElement,{...table.getTableBodyProps(),children:infiniteScroll?(0,jsx_runtime_1.jsx)(react_window_1.FixedSizeList,{height:windowOptions?.height||400,itemCount:table.rows.length,itemSize:windowOptions?.itemSize||100,width:windowOptions?.width||table.totalColumnsWidth+scrollBarSize,children:components}):components})]}),(0,jsx_runtime_1.jsx)("div",{className:paginationContainerClassName,children:(0,jsx_runtime_1.jsx)(Pagination,{})})]})}exports.OrderList=OrderList,exports.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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListPaginationButtons=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListPaginationContext_1=tslib_1.__importDefault(require("../../context/OrderListPaginationContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),omit_1=tslib_1.__importDefault(require("../../utils/omit"));function OrderListPaginationButtons({previousPageButton,nextPageButton,navigationButtons,children,...props}){const{...prevButton}={show:!0,...previousPageButton},{...nextButton}={show:!0,...nextPageButton},{...navButton}={show:!0,...navigationButtons},ctx=(0,useCustomContext_1.default)({context:OrderListPaginationContext_1.default,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationButtons"}),PrevButton=prevButton.show?(0,jsx_runtime_1.jsx)("button",{"data-testid":"prev-button",...(0,omit_1.default)(prevButton,["show"]),disabled:ctx?.canPreviousPage===!1,onClick:()=>ctx?.previousPage(),children:previousPageButton?.label??"<"}):null,NextButton=nextButton.show?(0,jsx_runtime_1.jsx)("button",{"data-testid":"next-button",...(0,omit_1.default)(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(0,jsx_runtime_1.jsx)("button",{"data-testid":`page-${v}`,...(0,omit_1.default)(navButton,["show","activeClassName","className"]),className,onClick:()=>ctx?.gotoPage(v-1),children:v},`page-${v}`)}):null,parentProps={navigationButtons,prevButton,nextButton,...ctx,...props};return children==null?(0,jsx_runtime_1.jsxs)("div",{...props,children:[PrevButton,NavButtons,NextButton]}):(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children})}exports.OrderListPaginationButtons=OrderListPaginationButtons,OrderListPaginationButtons.displayName="OrderListPaginationButtons",exports.default=OrderListPaginationButtons;
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { ChildrenFunction } from '../../typings/index';
3
+ type TAsComponent = keyof Pick<JSX.IntrinsicElements, 'p' | 'span' | 'div'>;
4
+ type ChildrenProps<A extends TAsComponent> = Omit<Props<A>, 'children'> & {
5
+ /**
6
+ * Current number of the first page row to display
7
+ */
8
+ firstRow: number;
9
+ /**
10
+ * Current number of the last page row to display
11
+ */
12
+ lastRow: number;
13
+ /**
14
+ * Total number of rows to display
15
+ */
16
+ totRows: number;
17
+ };
18
+ type Props<A extends TAsComponent> = {
19
+ children?: ChildrenFunction<ChildrenProps<A>>;
20
+ /**
21
+ * HTML Tag to display
22
+ */
23
+ as?: TAsComponent;
24
+ } & Omit<JSX.IntrinsicElements[A], 'children' | 'ref'>;
25
+ export declare function OrderListPaginationInfo<A extends TAsComponent = 'span'>({ as, children, ...props }: Props<A>): JSX.Element;
26
+ export declare namespace OrderListPaginationInfo {
27
+ var displayName: string;
28
+ }
29
+ export default OrderListPaginationInfo;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListPaginationInfo=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListPaginationContext_1=tslib_1.__importDefault(require("../../context/OrderListPaginationContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext"));function OrderListPaginationInfo({as="span",children,...props}){const ctx=(0,useCustomContext_1.default)({context:OrderListPaginationContext_1.default,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationInfo"}),TagElement=as,totRows=ctx?.totalRows??0,pageIndex=ctx?.pageIndex??0,pageSize=ctx?.pageSize??10;let firstRow=pageIndex===0?pageIndex+1:pageIndex,lastRow=firstRow*pageSize;ctx?.canPreviousPage===!0&&(firstRow=Math.floor(firstRow*10)+1,lastRow=Math.floor(firstRow+pageSize-1)),ctx?.canNextPage===!1&&(lastRow=totRows);const parentProps={...props,as,firstRow,lastRow,totRows};return children==null?(0,jsx_runtime_1.jsx)(TagElement,{...props,children:`${firstRow} - ${lastRow} of ${totRows}`}):(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children})}exports.OrderListPaginationInfo=OrderListPaginationInfo,OrderListPaginationInfo.displayName="OrderListPaginationInfo",exports.default=OrderListPaginationInfo;
@@ -31,4 +31,7 @@ interface Props extends Omit<JSX.IntrinsicElements['td'], 'children'> {
31
31
  field: keyof Order;
32
32
  }
33
33
  export declare function OrderListRow({ field, children, ...p }: Props): JSX.Element;
34
+ export declare namespace OrderListRow {
35
+ var displayName: string;
36
+ }
34
37
  export default OrderListRow;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListRow=void 0;const tslib_1=require("tslib"),react_1=require("react"),jsx_runtime_1=require("react/jsx-runtime"),react_2=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListChildrenContext_1=tslib_1.__importDefault(require("../../context/OrderListChildrenContext")),isDate_1=tslib_1.__importDefault(require("../../utils/isDate")),last_1=tslib_1.__importDefault(require("lodash/last"));function OrderListRow({field,children,...p}){const{order,row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll}=(0,react_2.useContext)(OrderListChildrenContext_1.default),cell=row?.cells.filter(cell2=>cell2.column.id===field),isLastRow=(0,last_1.default)(row?.cells)?.column.id===field,As=infiniteScroll?"div":"td",ActionRow=()=>showActions&&isLastRow&&actionsComponent&&(0,jsx_runtime_1.jsx)(As,{"data-testid":"action-cell",...p,className:actionsContainerClassName,children:(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:actionsComponent})})||null,parentProps={...p,field,order,row,cell,infiniteScroll};return children?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}),(0,jsx_runtime_1.jsx)(ActionRow,{})]}):(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[cell?.map((cell2,k)=>{const cellValue=cell2.value,value=(0,isDate_1.default)(cellValue)?new Date(Date.parse(cellValue)).toLocaleString():cell2.render("Cell");return(0,react_1.createElement)(As,{"data-testid":`cell-${k}`,...p,...cell2.getCellProps(),key:k},value)}),(0,jsx_runtime_1.jsx)(ActionRow,{})]})}exports.OrderListRow=OrderListRow,exports.default=OrderListRow;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListRow=void 0;const tslib_1=require("tslib"),react_1=require("react"),jsx_runtime_1=require("react/jsx-runtime"),react_2=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListChildrenContext_1=tslib_1.__importDefault(require("../../context/OrderListChildrenContext")),isDate_1=tslib_1.__importDefault(require("../../utils/isDate")),last_1=tslib_1.__importDefault(require("lodash/last"));function OrderListRow({field,children,...p}){const{order,row,showActions,actionsComponent,actionsContainerClassName,infiniteScroll}=(0,react_2.useContext)(OrderListChildrenContext_1.default),cell=row?.cells.filter(cell2=>cell2.column.id===field),isLastRow=(0,last_1.default)(row?.cells)?.column.id===field,As=infiniteScroll?"div":"td",ActionRow=()=>showActions&&isLastRow&&actionsComponent&&(0,jsx_runtime_1.jsx)(As,{"data-testid":"action-cell",...p,className:actionsContainerClassName,children:(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:actionsComponent})})||null,parentProps={...p,field,order,row,cell,infiniteScroll};return children?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}),(0,jsx_runtime_1.jsx)(ActionRow,{})]}):(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[cell?.map((cell2,k)=>{const cellValue=cell2.value,value=(0,isDate_1.default)(cellValue)?new Date(Date.parse(cellValue)).toLocaleString():cell2.render("Cell");return(0,react_1.createElement)(As,{"data-testid":`cell-${k}`,...p,...cell2.getCellProps(),key:k},value)}),(0,jsx_runtime_1.jsx)(ActionRow,{})]})}exports.OrderListRow=OrderListRow,OrderListRow.displayName="OrderListRow",exports.default=OrderListRow;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseFieldProps } from '../utils/BaseField';
3
- declare type Props = Omit<BaseFieldProps, 'attribute'>;
3
+ type Props = Omit<BaseFieldProps, 'attribute'>;
4
4
  export declare function OrderNumber(props: Props): JSX.Element;
5
5
  export default OrderNumber;
@@ -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 ParcelFieldChildrenProps = TGenericChildrenProps<TResources['Parcel']>;
5
- declare type TCondition = ConditionalElement<Exclude<TResources['Parcel'], 'resource'>>;
6
- declare type Props = {
4
+ type ParcelFieldChildrenProps = TGenericChildrenProps<TResources['Parcel']>;
5
+ type TCondition = ConditionalElement<Exclude<TResources['Parcel'], 'resource'>>;
6
+ type Props = {
7
7
  children?: (props: ParcelFieldChildrenProps) => JSX.Element;
8
8
  } & TCondition;
9
9
  /**
@@ -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 ParcelLineItemFieldChildrenProps = TGenericChildrenProps<TResources['ParcelLineItem']>;
5
- declare type TCondition = ConditionalElement<Exclude<TResources['ParcelLineItem'], 'resource'>>;
6
- declare type Props = {
4
+ type ParcelLineItemFieldChildrenProps = TGenericChildrenProps<TResources['ParcelLineItem']>;
5
+ type TCondition = ConditionalElement<Exclude<TResources['ParcelLineItem'], 'resource'>>;
6
+ type Props = {
7
7
  children?: (props: ParcelLineItemFieldChildrenProps) => JSX.Element;
8
8
  } & TCondition;
9
9
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
- declare type Props = GatewayBaseType;
3
+ type Props = GatewayBaseType;
4
4
  export declare function AdyenGateway(props: Props): JSX.Element | null;
5
5
  export default AdyenGateway;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
- declare type Props = GatewayBaseType;
3
+ type Props = GatewayBaseType;
4
4
  export declare function BraintreeGateway(props: Props): JSX.Element | null;
5
5
  export default BraintreeGateway;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
- declare type Props = GatewayBaseType;
3
+ type Props = GatewayBaseType;
4
4
  export declare function CheckoutComGateway(props: Props): JSX.Element | null;
5
5
  export default CheckoutComGateway;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
- declare type Props = GatewayBaseType;
3
+ type Props = GatewayBaseType;
4
4
  export declare function KlarnaGateway(props: Props): JSX.Element | null;
5
5
  export default KlarnaGateway;
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { LoaderType } from '../../typings/index';
3
3
  import { PaymentSourceProps } from '../payment_source/PaymentSource';
4
- export declare type GatewayBaseType = Props & {
4
+ export type GatewayBaseType = Props & {
5
5
  show: boolean;
6
6
  loading: boolean;
7
7
  loaderComponent: JSX.Element;
8
8
  };
9
- declare type Props = PaymentSourceProps & {
9
+ type Props = PaymentSourceProps & {
10
10
  showCard: boolean;
11
11
  handleEditClick: (e: MouseEvent) => void;
12
12
  show: boolean;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
- declare type Props = Partial<GatewayBaseType>;
3
+ type Props = Partial<GatewayBaseType>;
4
4
  export declare function PaypalGateway(props: Props): JSX.Element | null;
5
5
  export default PaypalGateway;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GatewayBaseType } from '../payment_gateways/PaymentGateway';
3
- declare type Props = GatewayBaseType;
3
+ type Props = GatewayBaseType;
4
4
  export declare function StripeGateway(props: Props): JSX.Element | null;
5
5
  export default StripeGateway;