@commercelayer/react-components 4.0.1 → 4.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/lib/cjs/components/ExternalFunction.d.ts +2 -9
  2. package/lib/cjs/components/ExternalFunction.js +1 -1
  3. package/lib/cjs/components/MetadataInput.d.ts +1 -11
  4. package/lib/cjs/components/MetadataInput.js +1 -1
  5. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +1 -17
  6. package/lib/cjs/components/addresses/AddressCountrySelector.js +1 -1
  7. package/lib/cjs/components/addresses/AddressField.d.ts +2 -2
  8. package/lib/cjs/components/addresses/AddressInput.d.ts +1 -1
  9. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -17
  10. package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
  11. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
  12. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -6
  13. package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
  14. package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +4 -9
  15. package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
  16. package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +2 -7
  17. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
  18. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +2 -7
  19. package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
  20. package/lib/cjs/components/customers/CustomerField.d.ts +3 -3
  21. package/lib/cjs/components/customers/CustomerInput.d.ts +2 -14
  22. package/lib/cjs/components/customers/CustomerInput.js +1 -1
  23. package/lib/cjs/components/errors/Errors.d.ts +5 -0
  24. package/lib/cjs/components/errors/Errors.js +1 -0
  25. package/lib/cjs/components/gift_cards/GiftCard.d.ts +2 -12
  26. package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
  27. package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +2 -8
  28. package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
  29. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -16
  30. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
  31. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +2 -11
  32. package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
  33. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -6
  34. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
  35. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -11
  36. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
  37. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  38. package/lib/cjs/components/line_items/LineItem.js +1 -1
  39. package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
  40. package/lib/cjs/components/line_items/LineItemField.d.ts +3 -3
  41. package/lib/cjs/components/line_items/LineItemImage.d.ts +1 -1
  42. package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
  43. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +2 -2
  44. package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -1
  45. package/lib/cjs/components/orders/AddToCartButton.d.ts +4 -4
  46. package/lib/cjs/components/orders/OrderContainer.d.ts +12 -0
  47. package/lib/cjs/components/orders/OrderList.d.ts +24 -7
  48. package/lib/cjs/components/orders/OrderList.js +1 -1
  49. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +44 -0
  50. package/lib/cjs/components/orders/OrderListPaginationButtons.js +1 -0
  51. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +29 -0
  52. package/lib/cjs/components/orders/OrderListPaginationInfo.js +1 -0
  53. package/lib/cjs/components/orders/OrderListRow.d.ts +3 -0
  54. package/lib/cjs/components/orders/OrderListRow.js +1 -1
  55. package/lib/cjs/components/orders/OrderNumber.d.ts +1 -7
  56. package/lib/cjs/components/orders/OrderNumber.js +1 -1
  57. package/lib/cjs/components/orders/OrderStorage.d.ts +2 -10
  58. package/lib/cjs/components/orders/OrderStorage.js +1 -1
  59. package/lib/cjs/components/parcels/ParcelField.d.ts +3 -3
  60. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +3 -3
  61. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -1
  62. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  63. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  64. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  65. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +2 -2
  66. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -1
  67. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -1
  68. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  69. package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +1 -1
  70. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  71. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
  72. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -3
  73. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +2 -2
  74. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +1 -1
  75. package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +1 -1
  76. package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  77. package/lib/cjs/components/payment_source/PaypalPayment.d.ts +2 -2
  78. package/lib/cjs/components/payment_source/StripePayment.d.ts +2 -2
  79. package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +2 -2
  80. package/lib/cjs/components/shipments/ShipmentField.d.ts +2 -2
  81. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  82. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -13
  83. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
  84. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -9
  85. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  86. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
  87. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +3 -10
  88. package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
  89. package/lib/cjs/components/skus/SkuField.d.ts +3 -3
  90. package/lib/cjs/components/skus/SkuList.d.ts +5 -9
  91. package/lib/cjs/components/skus/SkuList.js +1 -1
  92. package/lib/cjs/components/skus/SkuListsContainer.d.ts +2 -8
  93. package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
  94. package/lib/cjs/components/skus/Skus.d.ts +2 -7
  95. package/lib/cjs/components/skus/Skus.js +1 -1
  96. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +3 -3
  97. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +2 -2
  98. package/lib/cjs/components/utils/BaseField.d.ts +1 -1
  99. package/lib/cjs/components/utils/BaseInput.d.ts +2 -2
  100. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +1 -1
  101. package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
  102. package/lib/cjs/components/utils/GenericFieldComponent.d.ts +3 -3
  103. package/lib/cjs/components/utils/Parent.d.ts +1 -1
  104. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +4 -4
  105. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
  106. package/lib/cjs/components/utils/getAllErrors.d.ts +1 -1
  107. package/lib/cjs/context/AddressContext.d.ts +1 -1
  108. package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
  109. package/lib/cjs/context/BillingAddressFormContext.d.ts +1 -1
  110. package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
  111. package/lib/cjs/context/CustomerAddressFormContext.d.ts +1 -1
  112. package/lib/cjs/context/CustomerContext.d.ts +1 -1
  113. package/lib/cjs/context/ExternalFunctionContext.d.ts +1 -1
  114. package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
  115. package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
  116. package/lib/cjs/context/OrderListPaginationContext.d.ts +19 -0
  117. package/lib/cjs/context/OrderListPaginationContext.js +1 -0
  118. package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
  119. package/lib/cjs/context/PaymentSourceContext.d.ts +2 -2
  120. package/lib/cjs/context/PlaceOrderContext.d.ts +1 -1
  121. package/lib/cjs/context/ShipmentContext.d.ts +1 -1
  122. package/lib/cjs/context/ShippingAddressContext.d.ts +1 -1
  123. package/lib/cjs/context/SkuChildrenContext.d.ts +1 -1
  124. package/lib/cjs/context/SkuContext.d.ts +1 -1
  125. package/lib/cjs/hooks/useOrderContainer.d.ts +6 -0
  126. package/lib/cjs/hooks/useOrderContainer.js +1 -0
  127. package/lib/cjs/index.d.ts +1 -1
  128. package/lib/cjs/index.js +1 -1
  129. package/lib/cjs/reducers/AddressReducer.d.ts +10 -10
  130. package/lib/cjs/reducers/AvailabilityReducer.d.ts +4 -4
  131. package/lib/cjs/reducers/BillingAddressReducer.d.ts +4 -4
  132. package/lib/cjs/reducers/CustomerReducer.d.ts +6 -6
  133. package/lib/cjs/reducers/GiftCardReducer.d.ts +12 -22
  134. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  135. package/lib/cjs/reducers/LineItemReducer.d.ts +4 -4
  136. package/lib/cjs/reducers/OrderReducer.d.ts +19 -19
  137. package/lib/cjs/reducers/OrderReducer.js +1 -1
  138. package/lib/cjs/reducers/PaymentMethodReducer.d.ts +17 -17
  139. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +5 -5
  140. package/lib/cjs/reducers/PriceReducer.d.ts +3 -3
  141. package/lib/cjs/reducers/ShipmentReducer.d.ts +6 -6
  142. package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
  143. package/lib/cjs/reducers/SkuListsReducer.d.ts +3 -3
  144. package/lib/cjs/reducers/SkuReducer.d.ts +3 -3
  145. package/lib/cjs/typings/errors.d.ts +5 -5
  146. package/lib/cjs/typings/index.d.ts +25 -25
  147. package/lib/cjs/utils/PropsType.d.ts +4 -4
  148. package/lib/cjs/utils/addressesManager.d.ts +3 -3
  149. package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
  150. package/lib/cjs/utils/compareObjAttribute.d.ts +2 -2
  151. package/lib/cjs/utils/filterChildren.d.ts +8 -0
  152. package/lib/cjs/utils/filterChildren.js +1 -0
  153. package/lib/cjs/utils/getCardDetails.d.ts +2 -2
  154. package/lib/cjs/utils/getCartLink.d.ts +1 -1
  155. package/lib/cjs/utils/getErrors.d.ts +1 -1
  156. package/lib/cjs/utils/getLineItemsCount.d.ts +1 -1
  157. package/lib/cjs/utils/hooks/useCustomContext.js +1 -1
  158. package/lib/cjs/utils/jwt.d.ts +1 -1
  159. package/lib/cjs/utils/localStorage.d.ts +1 -1
  160. package/lib/cjs/utils/omit.d.ts +1 -0
  161. package/lib/cjs/utils/omit.js +1 -0
  162. package/lib/esm/components/ExternalFunction.d.ts +2 -9
  163. package/lib/esm/components/ExternalFunction.js +1 -1
  164. package/lib/esm/components/MetadataInput.d.ts +1 -11
  165. package/lib/esm/components/MetadataInput.js +1 -1
  166. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +1 -17
  167. package/lib/esm/components/addresses/AddressCountrySelector.js +1 -1
  168. package/lib/esm/components/addresses/AddressField.d.ts +2 -2
  169. package/lib/esm/components/addresses/AddressInput.d.ts +1 -1
  170. package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -17
  171. package/lib/esm/components/addresses/AddressStateSelector.js +1 -1
  172. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
  173. package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -6
  174. package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
  175. package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +4 -9
  176. package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -1
  177. package/lib/esm/components/addresses/ShippingAddressForm.d.ts +2 -7
  178. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
  179. package/lib/esm/components/customers/CustomerAddressForm.d.ts +2 -7
  180. package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
  181. package/lib/esm/components/customers/CustomerField.d.ts +3 -3
  182. package/lib/esm/components/customers/CustomerInput.d.ts +2 -14
  183. package/lib/esm/components/customers/CustomerInput.js +1 -1
  184. package/lib/esm/components/errors/Errors.d.ts +5 -0
  185. package/lib/esm/components/errors/Errors.js +1 -0
  186. package/lib/esm/components/gift_cards/GiftCard.d.ts +2 -12
  187. package/lib/esm/components/gift_cards/GiftCard.js +1 -1
  188. package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +2 -8
  189. package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
  190. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -16
  191. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -1
  192. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +2 -11
  193. package/lib/esm/components/gift_cards/GiftCardInput.js +1 -1
  194. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -6
  195. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -1
  196. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -11
  197. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -1
  198. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  199. package/lib/esm/components/line_items/LineItem.js +1 -1
  200. package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
  201. package/lib/esm/components/line_items/LineItemField.d.ts +3 -3
  202. package/lib/esm/components/line_items/LineItemImage.d.ts +1 -1
  203. package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
  204. package/lib/esm/components/line_items/LineItemQuantity.d.ts +2 -2
  205. package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -1
  206. package/lib/esm/components/orders/AddToCartButton.d.ts +4 -4
  207. package/lib/esm/components/orders/OrderContainer.d.ts +12 -0
  208. package/lib/esm/components/orders/OrderList.d.ts +24 -7
  209. package/lib/esm/components/orders/OrderList.js +1 -1
  210. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +44 -0
  211. package/lib/esm/components/orders/OrderListPaginationButtons.js +1 -0
  212. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +29 -0
  213. package/lib/esm/components/orders/OrderListPaginationInfo.js +1 -0
  214. package/lib/esm/components/orders/OrderListRow.d.ts +3 -0
  215. package/lib/esm/components/orders/OrderListRow.js +1 -1
  216. package/lib/esm/components/orders/OrderNumber.d.ts +1 -7
  217. package/lib/esm/components/orders/OrderNumber.js +1 -1
  218. package/lib/esm/components/orders/OrderStorage.d.ts +2 -10
  219. package/lib/esm/components/orders/OrderStorage.js +1 -1
  220. package/lib/esm/components/parcels/ParcelField.d.ts +3 -3
  221. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +3 -3
  222. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -1
  223. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  224. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  225. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  226. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +2 -2
  227. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -1
  228. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -1
  229. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  230. package/lib/esm/components/payment_methods/PaymentMethod.d.ts +1 -1
  231. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  232. package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
  233. package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -3
  234. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +2 -2
  235. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +1 -1
  236. package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +1 -1
  237. package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  238. package/lib/esm/components/payment_source/PaypalPayment.d.ts +2 -2
  239. package/lib/esm/components/payment_source/StripePayment.d.ts +2 -2
  240. package/lib/esm/components/payment_source/WireTransferPayment.d.ts +2 -2
  241. package/lib/esm/components/shipments/ShipmentField.d.ts +2 -2
  242. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  243. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -13
  244. package/lib/esm/components/shipping_methods/ShippingMethodPrice.js +1 -1
  245. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +3 -9
  246. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  247. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
  248. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +3 -10
  249. package/lib/esm/components/skus/DeliveryLeadTime.js +1 -1
  250. package/lib/esm/components/skus/SkuField.d.ts +3 -3
  251. package/lib/esm/components/skus/SkuList.d.ts +5 -9
  252. package/lib/esm/components/skus/SkuList.js +1 -1
  253. package/lib/esm/components/skus/SkuListsContainer.d.ts +2 -8
  254. package/lib/esm/components/skus/SkuListsContainer.js +1 -1
  255. package/lib/esm/components/skus/Skus.d.ts +2 -7
  256. package/lib/esm/components/skus/Skus.js +1 -1
  257. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +3 -3
  258. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +2 -2
  259. package/lib/esm/components/utils/BaseField.d.ts +1 -1
  260. package/lib/esm/components/utils/BaseInput.d.ts +2 -2
  261. package/lib/esm/components/utils/BaseOrderPrice.d.ts +1 -1
  262. package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
  263. package/lib/esm/components/utils/GenericFieldComponent.d.ts +3 -3
  264. package/lib/esm/components/utils/Parent.d.ts +1 -1
  265. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +4 -4
  266. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
  267. package/lib/esm/components/utils/getAllErrors.d.ts +1 -1
  268. package/lib/esm/context/AddressContext.d.ts +1 -1
  269. package/lib/esm/context/BillingAddressContext.d.ts +1 -1
  270. package/lib/esm/context/BillingAddressFormContext.d.ts +1 -1
  271. package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
  272. package/lib/esm/context/CustomerAddressFormContext.d.ts +1 -1
  273. package/lib/esm/context/CustomerContext.d.ts +1 -1
  274. package/lib/esm/context/ExternalFunctionContext.d.ts +1 -1
  275. package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
  276. package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
  277. package/lib/esm/context/OrderListPaginationContext.d.ts +19 -0
  278. package/lib/esm/context/OrderListPaginationContext.js +1 -0
  279. package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
  280. package/lib/esm/context/PaymentSourceContext.d.ts +2 -2
  281. package/lib/esm/context/PlaceOrderContext.d.ts +1 -1
  282. package/lib/esm/context/ShipmentContext.d.ts +1 -1
  283. package/lib/esm/context/ShippingAddressContext.d.ts +1 -1
  284. package/lib/esm/context/SkuChildrenContext.d.ts +1 -1
  285. package/lib/esm/context/SkuContext.d.ts +1 -1
  286. package/lib/esm/hooks/useOrderContainer.d.ts +6 -0
  287. package/lib/esm/hooks/useOrderContainer.js +1 -0
  288. package/lib/esm/index.d.ts +1 -1
  289. package/lib/esm/index.js +1 -1
  290. package/lib/esm/reducers/AddressReducer.d.ts +10 -10
  291. package/lib/esm/reducers/AvailabilityReducer.d.ts +4 -4
  292. package/lib/esm/reducers/BillingAddressReducer.d.ts +4 -4
  293. package/lib/esm/reducers/CustomerReducer.d.ts +6 -6
  294. package/lib/esm/reducers/GiftCardReducer.d.ts +12 -22
  295. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  296. package/lib/esm/reducers/LineItemReducer.d.ts +4 -4
  297. package/lib/esm/reducers/OrderReducer.d.ts +19 -19
  298. package/lib/esm/reducers/OrderReducer.js +1 -1
  299. package/lib/esm/reducers/PaymentMethodReducer.d.ts +17 -17
  300. package/lib/esm/reducers/PlaceOrderReducer.d.ts +5 -5
  301. package/lib/esm/reducers/PriceReducer.d.ts +3 -3
  302. package/lib/esm/reducers/ShipmentReducer.d.ts +6 -6
  303. package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
  304. package/lib/esm/reducers/SkuListsReducer.d.ts +3 -3
  305. package/lib/esm/reducers/SkuReducer.d.ts +3 -3
  306. package/lib/esm/typings/errors.d.ts +5 -5
  307. package/lib/esm/typings/index.d.ts +25 -25
  308. package/lib/esm/utils/PropsType.d.ts +4 -4
  309. package/lib/esm/utils/addressesManager.d.ts +3 -3
  310. package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
  311. package/lib/esm/utils/compareObjAttribute.d.ts +2 -2
  312. package/lib/esm/utils/filterChildren.d.ts +8 -0
  313. package/lib/esm/utils/filterChildren.js +1 -0
  314. package/lib/esm/utils/getCardDetails.d.ts +2 -2
  315. package/lib/esm/utils/getCartLink.d.ts +1 -1
  316. package/lib/esm/utils/getErrors.d.ts +1 -1
  317. package/lib/esm/utils/getLineItemsCount.d.ts +1 -1
  318. package/lib/esm/utils/hooks/useCustomContext.js +1 -1
  319. package/lib/esm/utils/jwt.d.ts +1 -1
  320. package/lib/esm/utils/localStorage.d.ts +1 -1
  321. package/lib/esm/utils/omit.d.ts +1 -0
  322. package/lib/esm/utils/omit.js +1 -0
  323. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  324. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  325. package/package.json +45 -81
  326. package/README.md +0 -302
  327. package/lib/cjs/components/Errors.d.ts +0 -5
  328. package/lib/cjs/components/Errors.js +0 -1
  329. package/lib/cjs/config/components.d.ts +0 -860
  330. package/lib/cjs/config/components.js +0 -1
  331. package/lib/cjs/utils/childrenTypes.d.ts +0 -9
  332. package/lib/cjs/utils/childrenTypes.js +0 -1
  333. package/lib/esm/components/Errors.d.ts +0 -5
  334. package/lib/esm/components/Errors.js +0 -1
  335. package/lib/esm/config/components.d.ts +0 -860
  336. package/lib/esm/config/components.js +0 -1
  337. package/lib/esm/utils/childrenTypes.d.ts +0 -9
  338. package/lib/esm/utils/childrenTypes.js +0 -1
@@ -4,7 +4,7 @@ import { getOrderContext } from './OrderReducer';
4
4
  import { LoaderType } from '../typings/index';
5
5
  import { BaseError } from '../typings/errors';
6
6
  import { Order, LineItem } from '@commercelayer/sdk';
7
- export declare type UpdateLineItemParams = {
7
+ export type UpdateLineItemParams = {
8
8
  lineItemId: string;
9
9
  quantity?: number;
10
10
  dispatch: Dispatch<LineItemAction>;
@@ -16,11 +16,11 @@ export declare type UpdateLineItemParams = {
16
16
  export interface UpdateLineItem {
17
17
  (params: UpdateLineItemParams): void;
18
18
  }
19
- export declare type DeleteLineItemParam = Record<string, any> & UpdateLineItemParams;
19
+ export type DeleteLineItemParam = Record<string, any> & UpdateLineItemParams;
20
20
  export interface DeleteLineItem {
21
21
  (params: DeleteLineItemParam): void;
22
22
  }
23
- export declare type GetLineItemsParams = {
23
+ export type GetLineItemsParams = {
24
24
  dispatch: Dispatch<LineItemAction>;
25
25
  config: CommerceLayerConfig;
26
26
  order: Order | null;
@@ -47,6 +47,6 @@ export declare const getLineItems: GetLineItems;
47
47
  export declare const updateLineItem: UpdateLineItem;
48
48
  export declare const deleteLineItem: DeleteLineItem;
49
49
  export declare const lineItemInitialState: LineItemState;
50
- export declare type LineItemActionType = 'setLineItems' | 'setErrors' | 'setLoading';
50
+ export type LineItemActionType = 'setLineItems' | 'setErrors' | 'setLoading';
51
51
  declare const lineItemReducer: (state: LineItemState, reducer: LineItemAction) => LineItemState;
52
52
  export default lineItemReducer;
@@ -5,7 +5,7 @@ import { BaseMetadataObject } from '../typings/index';
5
5
  import { BaseError } from '../typings/errors';
6
6
  import { AddressResource } from './AddressReducer';
7
7
  import type { Order, OrderUpdate } from '@commercelayer/sdk';
8
- export declare type GetOrderParams = Partial<{
8
+ export type GetOrderParams = Partial<{
9
9
  clearWhenPlaced: boolean;
10
10
  config: CommerceLayerConfig;
11
11
  deleteLocalOrder: DeleteLocalOrder;
@@ -14,20 +14,20 @@ export declare type GetOrderParams = Partial<{
14
14
  persistKey: string;
15
15
  state: OrderState;
16
16
  }>;
17
- export declare type GetOrder = (params: GetOrderParams) => Promise<undefined | Order>;
18
- declare type CreateOrderParams = Pick<AddToCartParams, 'config' | 'dispatch' | 'persistKey' | 'state' | 'orderMetadata' | 'orderAttributes' | 'setLocalOrder'>;
19
- export declare type CreateOrder = (params?: CreateOrderParams) => Promise<string>;
17
+ export type GetOrder = (params: GetOrderParams) => Promise<undefined | Order>;
18
+ type CreateOrderParams = Pick<AddToCartParams, 'config' | 'dispatch' | 'persistKey' | 'state' | 'orderMetadata' | 'orderAttributes' | 'setLocalOrder'>;
19
+ export type CreateOrder = (params?: CreateOrderParams) => Promise<string>;
20
20
  export interface AddToCartImportParams extends Omit<AddToCartParams, 'skuCode' | 'skuId' | 'quantity' | 'option' | 'lineItem'> {
21
21
  lineItems: CustomLineItem[];
22
22
  }
23
- export declare type AddToCartReturn = Promise<{
23
+ export type AddToCartReturn = Promise<{
24
24
  success: boolean;
25
25
  orderId: string | undefined;
26
26
  }>;
27
- export declare type AddToCartImport = (params: AddToCartImportParams) => AddToCartReturn;
28
- export declare type UnsetOrderState = (dispatch: Dispatch<OrderActions>) => void;
29
- export declare type ResourceIncluded = 'billing_address' | 'shipping_address' | 'line_items.line_item_options.sku_option' | 'line_items.item' | 'available_customer_payment_sources.payment_source' | 'shipments.available_shipping_methods' | 'shipments.stock_transfers' | 'shipments.stock_transfers.line_item' | 'shipments.shipment_line_items.line_item' | 'shipments.shipping_method' | 'shipments.stock_location' | 'shipments.parcels' | 'shipments.parcels.parcel_line_items' | 'payment_source' | 'available_payment_methods' | 'payment_method';
30
- declare type ResourceIncludedLoaded = Partial<Record<ResourceIncluded, boolean>>;
27
+ export type AddToCartImport = (params: AddToCartImportParams) => AddToCartReturn;
28
+ export type UnsetOrderState = (dispatch: Dispatch<OrderActions>) => void;
29
+ export type ResourceIncluded = 'billing_address' | 'shipping_address' | 'line_items.line_item_options.sku_option' | 'line_items.item' | 'available_customer_payment_sources.payment_source' | 'shipments.available_shipping_methods' | 'shipments.stock_transfers' | 'shipments.stock_transfers.line_item' | 'shipments.shipment_line_items.line_item' | 'shipments.shipping_method' | 'shipments.stock_location' | 'shipments.parcels' | 'shipments.parcels.parcel_line_items' | 'payment_source' | 'available_payment_methods' | 'payment_method';
30
+ type ResourceIncludedLoaded = Partial<Record<ResourceIncluded, boolean>>;
31
31
  export interface OrderPayload {
32
32
  loading?: boolean;
33
33
  orderId?: string;
@@ -37,14 +37,14 @@ export interface OrderPayload {
37
37
  includeLoaded?: ResourceIncludedLoaded;
38
38
  withoutIncludes?: boolean;
39
39
  }
40
- export declare type AddToCartImportValues = Pick<AddToCartImportParams, 'lineItems'>;
41
- export declare type getOrderContext = (id: string) => Promise<undefined | Order>;
42
- export declare type OrderState = Partial<OrderPayload>;
40
+ export type AddToCartImportValues = Pick<AddToCartImportParams, 'lineItems'>;
41
+ export type getOrderContext = (id: string) => Promise<undefined | Order>;
42
+ export type OrderState = Partial<OrderPayload>;
43
43
  export interface OrderActions {
44
44
  type: OrderActionType;
45
45
  payload: OrderPayload;
46
46
  }
47
- export declare type OrderActionType = 'setLoading' | 'setOrderId' | 'setOrder' | 'setSingleQuantity' | 'setCurrentSkuCodes' | 'setCurrentSkuPrices' | 'setCurrentItem' | 'setErrors' | 'setSaveAddressToCustomerAddressBook' | 'setGiftCardOrCouponCode' | 'setIncludesResource';
47
+ export type OrderActionType = 'setLoading' | 'setOrderId' | 'setOrder' | 'setSingleQuantity' | 'setCurrentSkuCodes' | 'setCurrentSkuPrices' | 'setCurrentItem' | 'setErrors' | 'setSaveAddressToCustomerAddressBook' | 'setGiftCardOrCouponCode' | 'setIncludesResource';
48
48
  export declare const createOrder: CreateOrder;
49
49
  export declare const getApiOrder: GetOrder;
50
50
  export interface UpdateOrderArgs {
@@ -83,7 +83,7 @@ export interface CustomLineItem {
83
83
  name?: string;
84
84
  imageUrl?: string | null;
85
85
  }
86
- export declare type AddToCartParams = Partial<{
86
+ export type AddToCartParams = Partial<{
87
87
  bundleCode: string;
88
88
  skuCode: string;
89
89
  persistKey: string;
@@ -112,13 +112,13 @@ interface OrderErrors {
112
112
  export declare function setOrderErrors({ dispatch, errors }: OrderErrors): {
113
113
  success: boolean;
114
114
  };
115
- export declare type SaveAddressToCustomerAddressBook = (params: {
115
+ export type SaveAddressToCustomerAddressBook = (params: {
116
116
  dispatch?: Dispatch<OrderActions>;
117
117
  type: AddressResource;
118
118
  value: boolean;
119
119
  }) => void;
120
120
  export declare const saveAddressToCustomerAddressBook: SaveAddressToCustomerAddressBook;
121
- export declare type SetGiftCardOrCouponCode = (args: {
121
+ export type SetGiftCardOrCouponCode = (args: {
122
122
  code: string;
123
123
  codeType: OrderCodeType;
124
124
  dispatch?: Dispatch<OrderActions>;
@@ -130,9 +130,9 @@ export declare type SetGiftCardOrCouponCode = (args: {
130
130
  success: boolean;
131
131
  }>;
132
132
  export declare const setGiftCardOrCouponCode: SetGiftCardOrCouponCode;
133
- export declare type CodeType = 'coupon' | 'gift_card' | 'gift_card_or_coupon';
134
- export declare type OrderCodeType = `${CodeType}_code`;
135
- export declare type RemoveGiftCardOrCouponCode = (args: {
133
+ export type CodeType = 'coupon' | 'gift_card' | 'gift_card_or_coupon';
134
+ export type OrderCodeType = `${CodeType}_code`;
135
+ export type RemoveGiftCardOrCouponCode = (args: {
136
136
  codeType: OrderCodeType;
137
137
  dispatch?: Dispatch<OrderActions>;
138
138
  config?: CommerceLayerConfig;
@@ -1 +1 @@
1
- import{setCustomerOrderParam}from"../utils/localStorage";import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import getSdk from"../utils/getSdk";import getErrors,{setErrors}from"../utils/getErrors";import getOrganizationSlug from"../utils/organization";const actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];export const createOrder=async params=>{if(params){const{persistKey,state,dispatch,config,orderMetadata:metadata,orderAttributes={},setLocalOrder}=params;if(state?.orderId)return state.orderId;const sdk=getSdk(config);try{const o=await sdk?.orders.create({metadata,...orderAttributes});return dispatch&&dispatch({type:"setOrderId",payload:{orderId:o?.id}}),persistKey&&setLocalOrder&&setLocalOrder(persistKey,o.id),o.id}catch(error){const errors=getErrors(error,"orders");console.error("Create order",errors),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors,dispatch})}}return""},getApiOrder=async params=>{const{id,dispatch,config,clearWhenPlaced,persistKey,deleteLocalOrder,state}=params,sdk=getSdk(config);try{const options={};state?.include&&state.include.length>0&&(options.include=state.include);const order=await sdk.orders.retrieve(id,options);return clearWhenPlaced&&order.status==="placed"||clearWhenPlaced&&order.status==="approved"||clearWhenPlaced&&order.status==="cancelled"?(persistKey&&deleteLocalOrder&&deleteLocalOrder(persistKey),dispatch&&dispatch({type:"setOrder",payload:{order:void 0,orderId:""}})):dispatch&&dispatch({type:"setOrder",payload:{order,orderId:order.id}}),order}catch(error){const errors=getErrors(error,"orders");console.error("Retrieve order",errors),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors,dispatch});return}};export async function updateOrder({id,attributes,dispatch,config,include,state}){const sdk=getSdk(config);try{const resource={...attributes,id};await sdk.orders.update(resource,{include});const order=await getApiOrder({id,config,dispatch,state});return dispatch&&order&&dispatch({type:"setOrder",payload:{order}}),{success:!0}}catch(error){const errors=getErrors(error,"orders");return dispatch&&(setOrderErrors({errors,dispatch}),dispatch({type:"setErrors",payload:{errors}})),{success:!1,error}}}export const setOrder=(order,dispatch)=>{dispatch&&dispatch({type:"setOrder",payload:{order}})};export function addResourceToInclude({resourcesIncluded=[],dispatch,newResource,newResourceLoaded,resourceIncludedLoaded}){const payload={include:void 0,includeLoaded:void 0};if(newResource){const resources=typeof newResource=="string"?[newResource]:newResource;payload.include=[...resourcesIncluded,...resources],resources.forEach(resource=>{const includeLoaded={...payload.includeLoaded,[resource]:!0};payload.includeLoaded=includeLoaded})}else delete payload.include;const payloadIncludeLoaded={...resourceIncludedLoaded,...newResourceLoaded,...payload.includeLoaded&&payload.includeLoaded};payload.includeLoaded=payloadIncludeLoaded,dispatch&&dispatch({type:"setIncludesResource",payload:{...payload,withoutIncludes:!1}})}export async function addToCart(params){const{skuCode,bundleCode,quantity,config,dispatch,lineItem,state,errors=[],buyNowMode,checkoutUrl,lineItemOption}=params;try{if(config){const sdk=getSdk(config),id=await createOrder(params);if(id){const order=sdk.orders.relationship(id),name=lineItem?.name,imageUrl=lineItem?.imageUrl;if(buyNowMode)if(state?.order?.line_items)await Promise.all(state?.order?.line_items.map(async lineItem2=>{await sdk.line_items.delete(lineItem2.id)}));else{const{line_items:lineItems}=await sdk.orders.retrieve(id,{fields:["line_items"],include:["line_items"]});lineItems&&lineItems?.length>0&&await Promise.all(lineItems.map(async lineItem2=>{await sdk.line_items.delete(lineItem2.id)}))}const attrs={order,sku_code:skuCode,name,image_url:imageUrl,quantity:quantity??1,_update_quantity:!0,bundle_code:bundleCode},newLineItem=await sdk.line_items.create(attrs);if(lineItemOption!=null){const{skuOptionId,options,quantity:quantity2}=lineItemOption,skuOption=sdk.sku_options.relationship(skuOptionId),lineItemRel=sdk.line_items.relationship(newLineItem.id),lineItemOptionsAttributes={quantity:quantity2??1,options,sku_option:skuOption,line_item:lineItemRel};await sdk.line_item_options.create(lineItemOptionsAttributes),await getApiOrder({id,...params})}else await getApiOrder({id,...params,state});if(!isEmpty(errors)&&dispatch&&dispatch({type:"setErrors",payload:{errors:[]}}),buyNowMode){const{organization}=getOrganizationSlug(config.endpoint??""),params2=`${id}?accessToken=${config.accessToken??""}`,redirectUrl=checkoutUrl?`${checkoutUrl}/${params2}`:`https://${organization}.checkout.commercelayer.app/${params2}`;location.href=redirectUrl}return{success:!0,orderId:id}}}return{success:!1}}catch(error){const errors2=getErrors(error,"orders");return console.error("Add to cart",errors2),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors2,dispatch}),{success:!1}}}export const unsetOrderState=dispatch=>{dispatch({type:"setOrderId",payload:{orderId:""}}),dispatch({type:"setOrder",payload:{order:void 0}})};export function setOrderErrors({dispatch,errors=[]}){return dispatch&&dispatch({type:"setErrors",payload:{errors}}),{success:!1}}export const saveAddressToCustomerAddressBook=({type,value,dispatch})=>{const k=`_save_${type}_to_customer_address_book`,v=`${value.toString()}`;setCustomerOrderParam(k,v),dispatch&&dispatch({type:"setSaveAddressToCustomerAddressBook",payload:{[k]:v}})},setGiftCardOrCouponCode=async({code,codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&code&&dispatch){const attributes={[codeType]:code},{success,error}=await updateOrder({id:order.id,attributes,config,include,dispatch,state});if(!success)throw error;return dispatch({type:"setErrors",payload:{errors:[]}}),{success}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},removeGiftCardOrCouponCode=async({codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&dispatch){const attributes={[codeType]:""};return await updateOrder({id:order.id,attributes,config,include,dispatch,state}),dispatch({type:"setErrors",payload:{errors:[]}}),{success:!0}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return console.error("Remove gift card o coupon code",errors),dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},orderInitialState={loading:!0,orderId:"",order:void 0,errors:[],include:void 0,withoutIncludes:!0};const orderReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default orderReducer;
1
+ import{setCustomerOrderParam}from"../utils/localStorage";import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import getSdk from"../utils/getSdk";import getErrors,{setErrors}from"../utils/getErrors";import getOrganizationSlug from"../utils/organization";const actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];export const createOrder=async params=>{if(params){const{persistKey,state,dispatch,config,orderMetadata:metadata,orderAttributes={},setLocalOrder}=params;if(state?.orderId)return state.orderId;const sdk=getSdk(config);try{const o=await sdk?.orders.create({metadata,...orderAttributes});return dispatch&&dispatch({type:"setOrderId",payload:{orderId:o?.id}}),persistKey&&setLocalOrder&&setLocalOrder(persistKey,o.id),o.id}catch(error){const errors=getErrors(error,"orders");console.error("Create order",errors),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors,dispatch})}}return""},getApiOrder=async params=>{const{id,dispatch,config,clearWhenPlaced,persistKey,deleteLocalOrder,state}=params,sdk=getSdk(config);try{const options={};state?.include&&state.include.length>0&&(options.include=state.include);const order=await sdk.orders.retrieve(id,options);return clearWhenPlaced&&order.editable===!1?(persistKey&&deleteLocalOrder&&deleteLocalOrder(persistKey),dispatch&&dispatch({type:"setOrder",payload:{order:void 0,orderId:""}})):dispatch&&dispatch({type:"setOrder",payload:{order,orderId:order.id}}),order}catch(error){const errors=getErrors(error,"orders");console.error("Retrieve order",errors),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors,dispatch});return}};export async function updateOrder({id,attributes,dispatch,config,include,state}){const sdk=getSdk(config);try{const resource={...attributes,id};await sdk.orders.update(resource,{include});const order=await getApiOrder({id,config,dispatch,state});return dispatch&&order&&dispatch({type:"setOrder",payload:{order}}),{success:!0}}catch(error){const errors=getErrors(error,"orders");return dispatch&&(setOrderErrors({errors,dispatch}),dispatch({type:"setErrors",payload:{errors}})),{success:!1,error}}}export const setOrder=(order,dispatch)=>{dispatch&&dispatch({type:"setOrder",payload:{order}})};export function addResourceToInclude({resourcesIncluded=[],dispatch,newResource,newResourceLoaded,resourceIncludedLoaded}){const payload={include:void 0,includeLoaded:void 0};if(newResource){const resources=typeof newResource=="string"?[newResource]:newResource;payload.include=[...resourcesIncluded,...resources],resources.forEach(resource=>{const includeLoaded={...payload.includeLoaded,[resource]:!0};payload.includeLoaded=includeLoaded})}else delete payload.include;const payloadIncludeLoaded={...resourceIncludedLoaded,...newResourceLoaded,...payload.includeLoaded&&payload.includeLoaded};payload.includeLoaded=payloadIncludeLoaded,dispatch&&dispatch({type:"setIncludesResource",payload:{...payload,withoutIncludes:!1}})}export async function addToCart(params){const{skuCode,bundleCode,quantity,config,dispatch,lineItem,state,errors=[],buyNowMode,checkoutUrl,lineItemOption}=params;try{if(config){const sdk=getSdk(config),id=await createOrder(params);if(id){const order=sdk.orders.relationship(id),name=lineItem?.name,imageUrl=lineItem?.imageUrl;if(buyNowMode)if(state?.order?.line_items)await Promise.all(state?.order?.line_items.map(async lineItem2=>{await sdk.line_items.delete(lineItem2.id)}));else{const{line_items:lineItems}=await sdk.orders.retrieve(id,{fields:["line_items"],include:["line_items"]});lineItems&&lineItems?.length>0&&await Promise.all(lineItems.map(async lineItem2=>{await sdk.line_items.delete(lineItem2.id)}))}const attrs={order,sku_code:skuCode,name,image_url:imageUrl,quantity:quantity??1,_update_quantity:!0,bundle_code:bundleCode},newLineItem=await sdk.line_items.create(attrs);if(lineItemOption!=null){const{skuOptionId,options,quantity:quantity2}=lineItemOption,skuOption=sdk.sku_options.relationship(skuOptionId),lineItemRel=sdk.line_items.relationship(newLineItem.id),lineItemOptionsAttributes={quantity:quantity2??1,options,sku_option:skuOption,line_item:lineItemRel};await sdk.line_item_options.create(lineItemOptionsAttributes),await getApiOrder({id,...params})}else await getApiOrder({id,...params,state});if(!isEmpty(errors)&&dispatch&&dispatch({type:"setErrors",payload:{errors:[]}}),buyNowMode){const{organization}=getOrganizationSlug(config.endpoint??""),params2=`${id}?accessToken=${config.accessToken??""}`,redirectUrl=checkoutUrl?`${checkoutUrl}/${params2}`:`https://${organization}.checkout.commercelayer.app/${params2}`;location.href=redirectUrl}return{success:!0,orderId:id}}}return{success:!1}}catch(error){const errors2=getErrors(error,"orders");return console.error("Add to cart",errors2),dispatch&&setErrors({currentErrors:state?.errors,newErrors:errors2,dispatch}),{success:!1}}}export const unsetOrderState=dispatch=>{dispatch({type:"setOrderId",payload:{orderId:""}}),dispatch({type:"setOrder",payload:{order:void 0}})};export function setOrderErrors({dispatch,errors=[]}){return dispatch&&dispatch({type:"setErrors",payload:{errors}}),{success:!1}}export const saveAddressToCustomerAddressBook=({type,value,dispatch})=>{const k=`_save_${type}_to_customer_address_book`,v=`${value.toString()}`;setCustomerOrderParam(k,v),dispatch&&dispatch({type:"setSaveAddressToCustomerAddressBook",payload:{[k]:v}})},setGiftCardOrCouponCode=async({code,codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&code&&dispatch){const attributes={[codeType]:code},{success,error}=await updateOrder({id:order.id,attributes,config,include,dispatch,state});if(!success)throw error;return dispatch({type:"setErrors",payload:{errors:[]}}),{success}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},removeGiftCardOrCouponCode=async({codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&dispatch){const attributes={[codeType]:""};return await updateOrder({id:order.id,attributes,config,include,dispatch,state}),dispatch({type:"setErrors",payload:{errors:[]}}),{success:!0}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return console.error("Remove gift card o coupon code",errors),dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},orderInitialState={loading:!0,orderId:"",order:void 0,errors:[],include:void 0,withoutIncludes:!0};const orderReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default orderReducer;
@@ -9,7 +9,7 @@ import { BaseError } from '../typings/errors';
9
9
  import { Order, PaymentMethod, StripePayment, WireTransfer, AdyenPayment, BraintreePayment, CheckoutComPayment, ExternalPayment, PaypalPayment, KlarnaPayment } from '@commercelayer/sdk';
10
10
  import { Dispatch, MutableRefObject } from 'react';
11
11
  import { CheckoutComConfig } from '../components/payment_source/CheckoutComPayment';
12
- export declare type PaymentSourceType = AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer;
12
+ export type PaymentSourceType = AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer;
13
13
  interface Card {
14
14
  type: string;
15
15
  brand: string;
@@ -52,8 +52,8 @@ export interface PaymentSourceObject {
52
52
  };
53
53
  klarna_payments: KlarnaPayment;
54
54
  }
55
- export declare type PaymentMethodActionType = 'setErrors' | 'setPaymentMethods' | 'setPaymentMethodConfig' | 'setPaymentSource' | 'setPaymentRef' | 'setLoading';
56
- export declare type PaymentRef = MutableRefObject<null | HTMLFormElement>;
55
+ export type PaymentMethodActionType = 'setErrors' | 'setPaymentMethods' | 'setPaymentMethodConfig' | 'setPaymentSource' | 'setPaymentRef' | 'setLoading';
56
+ export type PaymentRef = MutableRefObject<null | HTMLFormElement>;
57
57
  export interface PaymentMethodActionPayload {
58
58
  errors: BaseError[];
59
59
  paymentMethods: PaymentMethod[];
@@ -68,28 +68,28 @@ export declare function setLoading({ loading, dispatch }: {
68
68
  loading: boolean;
69
69
  dispatch?: Dispatch<PaymentMethodAction>;
70
70
  }): void;
71
- export declare type SetPaymentRef = (args: {
71
+ export type SetPaymentRef = (args: {
72
72
  ref: PaymentRef;
73
73
  dispatch?: Dispatch<PaymentMethodAction>;
74
74
  }) => void;
75
75
  export declare const setPaymentRef: SetPaymentRef;
76
- export declare type PaymentMethodState = Partial<PaymentMethodActionPayload>;
76
+ export type PaymentMethodState = Partial<PaymentMethodActionPayload>;
77
77
  export interface PaymentMethodAction {
78
78
  type: PaymentMethodActionType;
79
79
  payload: Partial<PaymentMethodActionPayload>;
80
80
  }
81
81
  export declare const paymentMethodInitialState: PaymentMethodState;
82
- export declare type SetPaymentMethodErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<PaymentMethodAction>) => void;
82
+ export type SetPaymentMethodErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<PaymentMethodAction>) => void;
83
83
  export declare const setPaymentMethodErrors: SetPaymentMethodErrors;
84
- declare type GetPaymentMethods = (args: {
84
+ type GetPaymentMethods = (args: {
85
85
  order: Order;
86
86
  dispatch: Dispatch<PaymentMethodAction>;
87
87
  }) => Promise<void>;
88
88
  export declare const getPaymentMethods: GetPaymentMethods;
89
- export declare type PaymentResource = keyof PaymentSourceObject;
90
- export declare type PaymentResourceKey = 'braintreePayment' | 'stripePayment' | 'klarnaPayment' | 'wireTransfer' | 'paypalPayment' | 'adyenPayment' | 'checkoutComPayment';
91
- export declare type SDKPaymentResource = 'AdyenPayment' | 'BraintreePayment' | 'ExternalPayment' | 'PaypalPayment' | 'StripePayment' | 'WireTransfer' | 'CheckoutComPayment';
92
- export declare type SetPaymentMethod = (args: {
89
+ export type PaymentResource = keyof PaymentSourceObject;
90
+ export type PaymentResourceKey = 'braintreePayment' | 'stripePayment' | 'klarnaPayment' | 'wireTransfer' | 'paypalPayment' | 'adyenPayment' | 'checkoutComPayment';
91
+ export type SDKPaymentResource = 'AdyenPayment' | 'BraintreePayment' | 'ExternalPayment' | 'PaypalPayment' | 'StripePayment' | 'WireTransfer' | 'CheckoutComPayment';
92
+ export type SetPaymentMethod = (args: {
93
93
  config?: CommerceLayerConfig;
94
94
  dispatch?: Dispatch<PaymentMethodAction>;
95
95
  updateOrder?: typeof updateOrder;
@@ -101,12 +101,12 @@ export declare type SetPaymentMethod = (args: {
101
101
  paymentResource?: PaymentResource;
102
102
  }) => Promise<void>;
103
103
  export declare const setPaymentMethod: SetPaymentMethod;
104
- declare type PaymentSourceTypes = (StripePayment & WireTransfer) | (StripePayment | WireTransfer);
105
- export declare type SetPaymentSourceResponse = {
104
+ type PaymentSourceTypes = (StripePayment & WireTransfer) | (StripePayment | WireTransfer);
105
+ export type SetPaymentSourceResponse = {
106
106
  order: Order;
107
107
  paymentSource: PaymentSourceTypes;
108
108
  } | null;
109
- export declare type SetPaymentSource = (args: {
109
+ export type SetPaymentSource = (args: {
110
110
  config?: CommerceLayerConfig;
111
111
  dispatch?: Dispatch<PaymentMethodAction>;
112
112
  getOrder?: getOrderContext;
@@ -118,7 +118,7 @@ export declare type SetPaymentSource = (args: {
118
118
  updateOrder?: typeof updateOrder;
119
119
  } & PaymentMethodState) => Promise<PaymentSourceType | undefined>;
120
120
  export declare const setPaymentSource: SetPaymentSource;
121
- export declare type UpdatePaymentSource = (args: {
121
+ export type UpdatePaymentSource = (args: {
122
122
  id: string;
123
123
  attributes: Record<string, any>;
124
124
  paymentResource: PaymentResource;
@@ -126,7 +126,7 @@ export declare type UpdatePaymentSource = (args: {
126
126
  dispatch?: Dispatch<PaymentMethodAction>;
127
127
  }) => Promise<void>;
128
128
  export declare const updatePaymentSource: UpdatePaymentSource;
129
- export declare type DestroyPaymentSource = (args: {
129
+ export type DestroyPaymentSource = (args: {
130
130
  paymentSourceId: string;
131
131
  paymentResource: PaymentResource;
132
132
  dispatch?: Dispatch<PaymentMethodAction>;
@@ -143,7 +143,7 @@ export interface PaymentMethodConfig {
143
143
  checkoutComPayment?: CheckoutComConfig;
144
144
  klarnaPayment?: Pick<AdyenPaymentConfig, 'placeOrderCallback'> & Pick<StripeConfig, 'containerClassName'>;
145
145
  }
146
- declare type SetPaymentMethodConfig = (config: PaymentMethodConfig, dispatch: Dispatch<PaymentMethodAction>) => void;
146
+ type SetPaymentMethodConfig = (config: PaymentMethodConfig, dispatch: Dispatch<PaymentMethodAction>) => void;
147
147
  export declare const setPaymentMethodConfig: SetPaymentMethodConfig;
148
148
  export declare function getPaymentConfig<K extends PaymentResourceKey>(paymentResource: PaymentResource, config: PaymentMethodConfig): PaymentMethodConfig[K];
149
149
  declare const paymentMethodReducer: (state: PaymentMethodState, reducer: PaymentMethodAction) => PaymentMethodState;
@@ -4,8 +4,8 @@ import { CommerceLayerConfig } from '../context/CommerceLayerContext';
4
4
  import { Order } from '@commercelayer/sdk';
5
5
  import { PaymentResource } from './PaymentMethodReducer';
6
6
  import { PaymentSourceType } from './PaymentMethodReducer';
7
- export declare type PlaceOrderActionType = 'setErrors' | 'setPlaceOrderPermitted' | 'setButtonRef';
8
- export declare type PlaceOrderOptions = {
7
+ export type PlaceOrderActionType = 'setErrors' | 'setPlaceOrderPermitted' | 'setButtonRef';
8
+ export type PlaceOrderOptions = {
9
9
  paypalPayerId?: string;
10
10
  adyen?: {
11
11
  MD?: string;
@@ -27,7 +27,7 @@ export interface PlaceOrderActionPayload {
27
27
  placeOrderButtonRef?: RefObject<HTMLButtonElement>;
28
28
  }
29
29
  export declare function setButtonRef(ref: RefObject<HTMLButtonElement>, dispatch: Dispatch<PlaceOrderAction>): void;
30
- export declare type PlaceOrderState = Partial<PlaceOrderActionPayload>;
30
+ export type PlaceOrderState = Partial<PlaceOrderActionPayload>;
31
31
  export interface PlaceOrderAction {
32
32
  type: PlaceOrderActionType;
33
33
  payload: Partial<PlaceOrderActionPayload>;
@@ -37,14 +37,14 @@ export interface SetPlaceOrderErrors {
37
37
  <V extends BaseError[]>(errors: V, dispatch?: Dispatch<PlaceOrderAction>): void;
38
38
  }
39
39
  export declare const setPlaceOrderErrors: SetPlaceOrderErrors;
40
- declare type PlaceOrderPermitted = (args: {
40
+ type PlaceOrderPermitted = (args: {
41
41
  config?: CommerceLayerConfig;
42
42
  dispatch: Dispatch<PlaceOrderAction>;
43
43
  order?: Order;
44
44
  options?: PlaceOrderOptions;
45
45
  }) => void;
46
46
  export declare const placeOrderPermitted: PlaceOrderPermitted;
47
- export declare type SetPlaceOrder = (args: {
47
+ export type SetPlaceOrder = (args: {
48
48
  config?: CommerceLayerConfig;
49
49
  order?: Order;
50
50
  state?: PlaceOrderState;
@@ -6,7 +6,7 @@ import { BaseError } from '../typings/errors';
6
6
  export interface Prices {
7
7
  [key: string]: Price | Price[];
8
8
  }
9
- declare type SkuCodesPrice = string[];
9
+ type SkuCodesPrice = string[];
10
10
  export interface PriceState {
11
11
  loading: boolean;
12
12
  prices: Prices;
@@ -30,8 +30,8 @@ export declare function getSkusPrice(skuCodes: SkuCodesPrice, { config, dispatch
30
30
  perPage: number;
31
31
  filters: Record<string, any>;
32
32
  }): void;
33
- export declare type UnsetPriceState = (dispatch: Dispatch<PriceAction>) => void;
33
+ export type UnsetPriceState = (dispatch: Dispatch<PriceAction>) => void;
34
34
  export declare const unsetPriceState: UnsetPriceState;
35
- export declare type PriceActionType = 'setLoading' | 'setPrices' | 'setSkuCodes' | 'setErrors';
35
+ export type PriceActionType = 'setLoading' | 'setPrices' | 'setSkuCodes' | 'setErrors';
36
36
  declare const priceReducer: (state: PriceState, reducer: PriceAction) => PriceState;
37
37
  export default priceReducer;
@@ -3,8 +3,8 @@ import { BaseError } from '../typings/errors';
3
3
  import { DeliveryLeadTime, LineItem, Order, Shipment } from '@commercelayer/sdk';
4
4
  import { CommerceLayerConfig } from '../context/CommerceLayerContext';
5
5
  import { getOrderContext } from './OrderReducer';
6
- export declare type ShipmentActionType = 'setErrors' | 'setShipments' | 'setShippingMethod';
7
- export declare type ShipmentLineItem = LineItem & {
6
+ export type ShipmentActionType = 'setErrors' | 'setShipments' | 'setShippingMethod';
7
+ export type ShipmentLineItem = LineItem & {
8
8
  line_item: LineItem;
9
9
  };
10
10
  export interface ShipmentActionPayload {
@@ -12,21 +12,21 @@ export interface ShipmentActionPayload {
12
12
  shipments: Shipment[];
13
13
  deliveryLeadTimes: DeliveryLeadTime[];
14
14
  }
15
- export declare type ShipmentState = Partial<ShipmentActionPayload>;
15
+ export type ShipmentState = Partial<ShipmentActionPayload>;
16
16
  export interface ShipmentAction {
17
17
  type: ShipmentActionType;
18
18
  payload: Partial<ShipmentActionPayload>;
19
19
  }
20
20
  export declare const shipmentInitialState: ShipmentState;
21
- export declare type SetShipmentErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<ShipmentAction>) => void;
21
+ export type SetShipmentErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<ShipmentAction>) => void;
22
22
  export declare const setShipmentErrors: SetShipmentErrors;
23
- declare type GetShipments = (args: {
23
+ type GetShipments = (args: {
24
24
  order: Order;
25
25
  dispatch: Dispatch<ShipmentAction>;
26
26
  config: CommerceLayerConfig;
27
27
  }) => Promise<void>;
28
28
  export declare const getShipments: GetShipments;
29
- declare type SetShippingMethod = (args: {
29
+ type SetShippingMethod = (args: {
30
30
  config: CommerceLayerConfig;
31
31
  shipmentId: string;
32
32
  shippingMethodId: string;
@@ -3,18 +3,18 @@ import { CommerceLayerConfig } from '../context/CommerceLayerContext';
3
3
  import { Order } from '@commercelayer/sdk';
4
4
  import { getOrderContext } from './OrderReducer';
5
5
  import { AddressResource } from './AddressReducer';
6
- export declare type ShippingAddressActionType = 'setShippingAddress' | 'setShippingCustomerAddressId' | 'cleanup';
6
+ export type ShippingAddressActionType = 'setShippingAddress' | 'setShippingCustomerAddressId' | 'cleanup';
7
7
  export interface ShippingAddressActionPayload {
8
8
  _shipping_address_clone_id: string;
9
9
  shippingCustomerAddressId: string;
10
10
  }
11
- export declare type ShippingAddressState = Partial<ShippingAddressActionPayload>;
11
+ export type ShippingAddressState = Partial<ShippingAddressActionPayload>;
12
12
  export interface ShippingAddressAction {
13
13
  type: ShippingAddressActionType;
14
14
  payload: Partial<ShippingAddressActionPayload>;
15
15
  }
16
16
  export declare const shippingAddressInitialState: ShippingAddressState;
17
- export declare type SetShippingAddress = (id: string, options?: {
17
+ export type SetShippingAddress = (id: string, options?: {
18
18
  config: CommerceLayerConfig;
19
19
  dispatch: Dispatch<ShippingAddressAction>;
20
20
  order?: Order | null;
@@ -22,7 +22,7 @@ export declare type SetShippingAddress = (id: string, options?: {
22
22
  customerAddressId?: string;
23
23
  }) => Promise<void>;
24
24
  export declare const setShippingAddress: SetShippingAddress;
25
- declare type SetShippingCustomerAddressId = (args: {
25
+ type SetShippingCustomerAddressId = (args: {
26
26
  dispatch: Dispatch<ShippingAddressAction>;
27
27
  order: Order;
28
28
  setCloneAddress: (id: string, resource: AddressResource) => void;
@@ -1,7 +1,7 @@
1
1
  import { Dispatch } from 'react';
2
2
  import { CommerceLayerConfig } from '../context/CommerceLayerContext';
3
- declare type SkuListsActionType = 'getSkuList' | 'setSkuList';
4
- export declare type SkuListsState = Partial<{
3
+ type SkuListsActionType = 'getSkuList' | 'setSkuList';
4
+ export type SkuListsState = Partial<{
5
5
  listIds: string[];
6
6
  skuLists: Record<string, any>;
7
7
  }>;
@@ -10,7 +10,7 @@ export interface SkuListsAction {
10
10
  payload: Partial<SkuListsState>;
11
11
  type: SkuListsActionType;
12
12
  }
13
- export declare type GetSkuList = (params: {
13
+ export type GetSkuList = (params: {
14
14
  config: CommerceLayerConfig;
15
15
  dispatch: Dispatch<SkuListsAction>;
16
16
  listIds: string[];
@@ -2,9 +2,9 @@ import { CommerceLayerConfig } from '../context/CommerceLayerContext';
2
2
  import { BaseAction } from '../typings/index';
3
3
  import { QueryParamsList, Sku } from '@commercelayer/sdk';
4
4
  import { Dispatch } from 'react';
5
- declare type SkuActionType = 'getSkus' | 'setLoading';
6
- declare type SkuAction = BaseAction<SkuActionType, SkuState>;
7
- export declare type SkuState = Partial<{
5
+ type SkuActionType = 'getSkus' | 'setLoading';
6
+ type SkuAction = BaseAction<SkuActionType, SkuState>;
7
+ export type SkuState = Partial<{
8
8
  skus: Sku[];
9
9
  loading: boolean;
10
10
  skuCodes: string[];
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import { ChildrenFunction } from './index';
3
- export 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,17 +24,17 @@ 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 {
31
31
  /**
32
- * Resource which caused the error
32
+ * Resource which get the error
33
33
  */
34
34
  resource: ResourceErrorType;
35
35
  children?: ErrorChildrenComponentProps;
36
36
  /**
37
- * Field which caused the error
37
+ * Field which get the error
38
38
  */
39
39
  field?: string;
40
40
  /**
@@ -22,8 +22,8 @@ export declare const BaseSelectComponentPropTypes: {
22
22
  value: PropTypes.Requireable<string>;
23
23
  name: PropTypes.Validator<string>;
24
24
  };
25
- export 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,13 +116,13 @@ 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;
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
- } & Omit<JSX.IntrinsicElements['img'], 'children'>) | ({
125
+ } & JSX.IntrinsicElements['img']) | ({
126
126
  attribute: Exclude<keyof E, 'image_url'>;
127
127
  tagElement: ExcludeTag<'img'>;
128
128
  } & Omit<JSX.IntrinsicElements[ExcludeTag<'img'>], 'children'>);
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
- 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
  };