@commercelayer/react-components 4.3.5 → 4.4.0-beta.4

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 (559) hide show
  1. package/lib/cjs/components/ExternalFunction.d.ts +1 -1
  2. package/lib/cjs/components/ExternalFunction.js +1 -1
  3. package/lib/cjs/components/MetadataInput.d.ts +1 -1
  4. package/lib/cjs/components/MetadataInput.js +1 -1
  5. package/lib/cjs/components/SubmitButton.d.ts +2 -2
  6. package/lib/cjs/components/SubmitButton.js +1 -1
  7. package/lib/cjs/components/addresses/Address.d.ts +1 -1
  8. package/lib/cjs/components/addresses/Address.js +1 -1
  9. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +2 -2
  10. package/lib/cjs/components/addresses/AddressCountrySelector.js +1 -1
  11. package/lib/cjs/components/addresses/AddressField.d.ts +3 -3
  12. package/lib/cjs/components/addresses/AddressField.js +1 -1
  13. package/lib/cjs/components/addresses/AddressInput.d.ts +2 -2
  14. package/lib/cjs/components/addresses/AddressInput.js +1 -1
  15. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -1
  16. package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
  17. package/lib/cjs/components/addresses/AddressesContainer.d.ts +1 -1
  18. package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
  19. package/lib/cjs/components/addresses/AddressesEmpty.d.ts +1 -1
  20. package/lib/cjs/components/addresses/AddressesEmpty.js +1 -1
  21. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
  22. package/lib/cjs/components/addresses/BillingAddressContainer.js +1 -1
  23. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
  24. package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
  25. package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +2 -2
  26. package/lib/cjs/components/addresses/SaveAddressesButton.js +1 -1
  27. package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
  28. package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +1 -1
  29. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
  30. package/lib/cjs/components/auth/CommerceLayer.js +1 -1
  31. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +1 -1
  32. package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
  33. package/lib/cjs/components/customers/CustomerContainer.js +1 -1
  34. package/lib/cjs/components/customers/CustomerField.d.ts +2 -2
  35. package/lib/cjs/components/customers/CustomerField.js +1 -1
  36. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -1
  37. package/lib/cjs/components/customers/CustomerInput.js +1 -1
  38. package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +1 -1
  39. package/lib/cjs/components/customers/CustomerPaymentSource.js +1 -1
  40. package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
  41. package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.js +1 -1
  42. package/lib/cjs/components/customers/SaveCustomerButton.d.ts +2 -2
  43. package/lib/cjs/components/customers/SaveCustomerButton.js +1 -1
  44. package/lib/cjs/components/errors/Errors.d.ts +1 -1
  45. package/lib/cjs/components/errors/Errors.js +1 -1
  46. package/lib/cjs/components/gift_cards/GiftCard.d.ts +1 -1
  47. package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
  48. package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +1 -1
  49. package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
  50. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  51. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
  52. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -1
  53. package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
  54. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
  55. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -1
  56. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
  57. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
  58. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
  59. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
  60. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
  61. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
  62. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
  63. package/lib/cjs/components/line_items/LineItem.js +1 -1
  64. package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
  65. package/lib/cjs/components/line_items/LineItemAmount.js +1 -1
  66. package/lib/cjs/components/line_items/LineItemCode.d.ts +2 -2
  67. package/lib/cjs/components/line_items/LineItemCode.js +1 -1
  68. package/lib/cjs/components/line_items/LineItemField.d.ts +2 -2
  69. package/lib/cjs/components/line_items/LineItemField.js +1 -1
  70. package/lib/cjs/components/line_items/LineItemImage.d.ts +2 -2
  71. package/lib/cjs/components/line_items/LineItemImage.js +1 -1
  72. package/lib/cjs/components/line_items/LineItemName.d.ts +1 -1
  73. package/lib/cjs/components/line_items/LineItemName.js +1 -1
  74. package/lib/cjs/components/line_items/LineItemOption.d.ts +3 -3
  75. package/lib/cjs/components/line_items/LineItemOption.js +1 -1
  76. package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
  77. package/lib/cjs/components/line_items/LineItemOptions.js +1 -1
  78. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
  79. package/lib/cjs/components/line_items/LineItemQuantity.js +1 -1
  80. package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +2 -2
  81. package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -1
  82. package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
  83. package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -1
  84. package/lib/cjs/components/line_items/LineItemsCount.js +1 -1
  85. package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +1 -1
  86. package/lib/cjs/components/line_items/LineItemsEmpty.js +1 -1
  87. package/lib/cjs/components/orders/AddToCartButton.d.ts +3 -3
  88. package/lib/cjs/components/orders/AddToCartButton.js +1 -1
  89. package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -1
  90. package/lib/cjs/components/orders/AdjustmentAmount.js +1 -1
  91. package/lib/cjs/components/orders/CartLink.d.ts +2 -2
  92. package/lib/cjs/components/orders/CartLink.js +1 -1
  93. package/lib/cjs/components/orders/CheckoutLink.d.ts +1 -1
  94. package/lib/cjs/components/orders/CheckoutLink.js +1 -1
  95. package/lib/cjs/components/orders/DiscountAmount.d.ts +1 -1
  96. package/lib/cjs/components/orders/DiscountAmount.js +1 -1
  97. package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -1
  98. package/lib/cjs/components/orders/GiftCardAmount.js +1 -1
  99. package/lib/cjs/components/orders/OrderContainer.d.ts +1 -1
  100. package/lib/cjs/components/orders/OrderContainer.js +1 -1
  101. package/lib/cjs/components/orders/OrderList.d.ts +2 -2
  102. package/lib/cjs/components/orders/OrderList.js +1 -1
  103. package/lib/cjs/components/orders/OrderListEmpty.d.ts +1 -1
  104. package/lib/cjs/components/orders/OrderListEmpty.js +1 -1
  105. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +1 -1
  106. package/lib/cjs/components/orders/OrderListPaginationButtons.js +1 -1
  107. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +1 -1
  108. package/lib/cjs/components/orders/OrderListPaginationInfo.js +1 -1
  109. package/lib/cjs/components/orders/OrderListRow.js +1 -1
  110. package/lib/cjs/components/orders/OrderNumber.d.ts +1 -1
  111. package/lib/cjs/components/orders/OrderNumber.js +1 -1
  112. package/lib/cjs/components/orders/OrderStorage.d.ts +1 -1
  113. package/lib/cjs/components/orders/OrderStorage.js +1 -1
  114. package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +1 -1
  115. package/lib/cjs/components/orders/PaymentMethodAmount.js +1 -1
  116. package/lib/cjs/components/orders/PlaceOrderButton.d.ts +2 -2
  117. package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
  118. package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +2 -2
  119. package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
  120. package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -1
  121. package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.js +1 -1
  122. package/lib/cjs/components/orders/ShippingAmount.d.ts +1 -1
  123. package/lib/cjs/components/orders/ShippingAmount.js +1 -1
  124. package/lib/cjs/components/orders/SubTotalAmount.d.ts +1 -1
  125. package/lib/cjs/components/orders/SubTotalAmount.js +1 -1
  126. package/lib/cjs/components/orders/TaxesAmount.d.ts +1 -1
  127. package/lib/cjs/components/orders/TaxesAmount.js +1 -1
  128. package/lib/cjs/components/orders/TotalAmount.d.ts +1 -1
  129. package/lib/cjs/components/orders/TotalAmount.js +1 -1
  130. package/lib/cjs/components/parcels/ParcelField.d.ts +2 -2
  131. package/lib/cjs/components/parcels/ParcelField.js +1 -1
  132. package/lib/cjs/components/parcels/ParcelLineItem.js +1 -1
  133. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +2 -2
  134. package/lib/cjs/components/parcels/ParcelLineItemField.js +1 -1
  135. package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +1 -1
  136. package/lib/cjs/components/parcels/ParcelLineItemsCount.js +1 -1
  137. package/lib/cjs/components/parcels/Parcels.js +1 -1
  138. package/lib/cjs/components/parcels/ParcelsCount.d.ts +1 -1
  139. package/lib/cjs/components/parcels/ParcelsCount.js +1 -1
  140. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -1
  141. package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
  142. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  143. package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -1
  144. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  145. package/lib/cjs/components/payment_gateways/CheckoutComGateway.js +1 -1
  146. package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +1 -1
  147. package/lib/cjs/components/payment_gateways/ExternalGateway.js +1 -1
  148. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  149. package/lib/cjs/components/payment_gateways/KlarnaGateway.js +1 -1
  150. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +2 -2
  151. package/lib/cjs/components/payment_gateways/PaymentGateway.js +1 -1
  152. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -1
  153. package/lib/cjs/components/payment_gateways/PaypalGateway.js +1 -1
  154. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -1
  155. package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -1
  156. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  157. package/lib/cjs/components/payment_gateways/WireTransferGateway.js +1 -1
  158. package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +14 -1
  159. package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
  160. package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +1 -1
  161. package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -1
  162. package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
  163. package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +1 -1
  164. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +2 -2
  165. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -1
  166. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
  167. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
  168. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
  169. package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
  170. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -5
  171. package/lib/cjs/components/payment_source/BraintreePayment.js +1 -1
  172. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +3 -3
  173. package/lib/cjs/components/payment_source/CheckoutComPayment.js +1 -1
  174. package/lib/cjs/components/payment_source/ExternalPayment.d.ts +2 -2
  175. package/lib/cjs/components/payment_source/ExternalPayment.js +1 -1
  176. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +2 -2
  177. package/lib/cjs/components/payment_source/KlarnaPayment.js +1 -1
  178. package/lib/cjs/components/payment_source/PaymentSource.d.ts +2 -2
  179. package/lib/cjs/components/payment_source/PaymentSource.js +1 -1
  180. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
  181. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +1 -1
  182. package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
  183. package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +1 -1
  184. package/lib/cjs/components/payment_source/PaymentSourceDetail.js +1 -1
  185. package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
  186. package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +1 -1
  187. package/lib/cjs/components/payment_source/PaypalPayment.d.ts +1 -1
  188. package/lib/cjs/components/payment_source/PaypalPayment.js +1 -1
  189. package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +5 -0
  190. package/lib/cjs/components/payment_source/StripeExpressPayment.js +1 -0
  191. package/lib/cjs/components/payment_source/StripePayment.d.ts +8 -5
  192. package/lib/cjs/components/payment_source/StripePayment.js +1 -1
  193. package/lib/cjs/components/payment_source/WireTransferPayment.js +1 -1
  194. package/lib/cjs/components/prices/Price.d.ts +2 -2
  195. package/lib/cjs/components/prices/Price.js +1 -1
  196. package/lib/cjs/components/prices/PricesContainer.d.ts +1 -1
  197. package/lib/cjs/components/prices/PricesContainer.js +1 -1
  198. package/lib/cjs/components/shipments/Shipment.d.ts +1 -1
  199. package/lib/cjs/components/shipments/Shipment.js +1 -1
  200. package/lib/cjs/components/shipments/ShipmentField.d.ts +1 -1
  201. package/lib/cjs/components/shipments/ShipmentField.js +1 -1
  202. package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +1 -1
  203. package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
  204. package/lib/cjs/components/shipments/ShipmentsCount.d.ts +1 -1
  205. package/lib/cjs/components/shipments/ShipmentsCount.js +1 -1
  206. package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +1 -1
  207. package/lib/cjs/components/shipping_methods/ShippingMethod.js +1 -1
  208. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  209. package/lib/cjs/components/shipping_methods/ShippingMethodName.js +1 -1
  210. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  211. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
  212. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  213. package/lib/cjs/components/skus/AvailabilityContainer.d.ts +1 -1
  214. package/lib/cjs/components/skus/AvailabilityContainer.js +1 -1
  215. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
  216. package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -1
  217. package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
  218. package/lib/cjs/components/skus/SkuField.d.ts +2 -2
  219. package/lib/cjs/components/skus/SkuField.js +1 -1
  220. package/lib/cjs/components/skus/SkuList.d.ts +1 -1
  221. package/lib/cjs/components/skus/SkuListsContainer.d.ts +1 -1
  222. package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
  223. package/lib/cjs/components/skus/Skus.d.ts +1 -1
  224. package/lib/cjs/components/skus/Skus.js +1 -1
  225. package/lib/cjs/components/skus/SkusContainer.d.ts +1 -1
  226. package/lib/cjs/components/skus/SkusContainer.js +1 -1
  227. package/lib/cjs/components/stock_transfers/StockTransfer.js +1 -1
  228. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +2 -2
  229. package/lib/cjs/components/stock_transfers/StockTransferField.js +1 -1
  230. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -1
  231. package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
  232. package/lib/cjs/components/utils/BaseField.d.ts +1 -1
  233. package/lib/cjs/components/utils/BaseField.js +1 -1
  234. package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
  235. package/lib/cjs/components/utils/BaseInput.js +1 -1
  236. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +3 -3
  237. package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
  238. package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
  239. package/lib/cjs/components/utils/BaseSelect.js +1 -1
  240. package/lib/cjs/components/utils/ErrorBoundary.d.ts +1 -1
  241. package/lib/cjs/components/utils/ErrorBoundary.js +1 -1
  242. package/lib/cjs/components/utils/GenericFieldComponent.d.ts +7 -7
  243. package/lib/cjs/components/utils/GenericFieldComponent.js +1 -1
  244. package/lib/cjs/components/utils/Parent.d.ts +1 -1
  245. package/lib/cjs/components/utils/Parent.js +1 -1
  246. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +3 -3
  247. package/lib/cjs/components/utils/PaymentCardsTemplate.js +1 -1
  248. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
  249. package/lib/cjs/components/utils/PriceTemplate.js +1 -1
  250. package/lib/cjs/components/utils/getAllErrors.d.ts +3 -3
  251. package/lib/cjs/components/utils/getAllErrors.js +1 -1
  252. package/lib/cjs/context/AddressChildrenContext.d.ts +1 -1
  253. package/lib/cjs/context/AddressContext.d.ts +2 -2
  254. package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
  255. package/lib/cjs/context/BillingAddressFormContext.d.ts +5 -7
  256. package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
  257. package/lib/cjs/context/CustomerAddressFormContext.d.ts +7 -9
  258. package/lib/cjs/context/CustomerContext.d.ts +1 -1
  259. package/lib/cjs/context/CustomerPaymentSourceContext.d.ts +1 -1
  260. package/lib/cjs/context/ExternalFunctionContext.js +1 -1
  261. package/lib/cjs/context/GiftCardContext.d.ts +2 -2
  262. package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
  263. package/lib/cjs/context/LineItemContext.d.ts +2 -2
  264. package/lib/cjs/context/LineItemOptionChildrenContext.d.ts +5 -2
  265. package/lib/cjs/context/OrderContext.d.ts +3 -3
  266. package/lib/cjs/context/OrderContext.js +1 -1
  267. package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
  268. package/lib/cjs/context/OrderListPaginationContext.d.ts +1 -1
  269. package/lib/cjs/context/PaymentMethodChildrenContext.d.ts +2 -1
  270. package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
  271. package/lib/cjs/context/PlaceOrderContext.d.ts +2 -2
  272. package/lib/cjs/context/PricesContext.d.ts +1 -1
  273. package/lib/cjs/context/ShipmentContext.d.ts +1 -1
  274. package/lib/cjs/context/ShippingAddressContext.d.ts +1 -1
  275. package/lib/cjs/context/ShippingAddressFormContext.d.ts +1 -1
  276. package/lib/cjs/context/ShippingMethodChildrenContext.d.ts +1 -1
  277. package/lib/cjs/context/SkuChildrenContext.d.ts +1 -1
  278. package/lib/cjs/context/SkuContext.d.ts +1 -1
  279. package/lib/cjs/context/StockTransferChildrenContext.d.ts +1 -1
  280. package/lib/cjs/hooks/useOrderContainer.js +1 -1
  281. package/lib/cjs/reducers/AddressReducer.d.ts +6 -6
  282. package/lib/cjs/reducers/AddressReducer.js +1 -1
  283. package/lib/cjs/reducers/AvailabilityReducer.d.ts +4 -4
  284. package/lib/cjs/reducers/AvailabilityReducer.js +1 -1
  285. package/lib/cjs/reducers/BillingAddressReducer.d.ts +4 -4
  286. package/lib/cjs/reducers/BillingAddressReducer.js +1 -1
  287. package/lib/cjs/reducers/CustomerReducer.d.ts +4 -4
  288. package/lib/cjs/reducers/CustomerReducer.js +1 -1
  289. package/lib/cjs/reducers/GiftCardReducer.d.ts +6 -6
  290. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  291. package/lib/cjs/reducers/LineItemReducer.d.ts +6 -6
  292. package/lib/cjs/reducers/LineItemReducer.js +1 -1
  293. package/lib/cjs/reducers/OrderReducer.d.ts +6 -6
  294. package/lib/cjs/reducers/OrderReducer.js +1 -1
  295. package/lib/cjs/reducers/PaymentMethodReducer.d.ts +16 -12
  296. package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
  297. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +4 -1
  298. package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
  299. package/lib/cjs/reducers/PriceReducer.d.ts +6 -8
  300. package/lib/cjs/reducers/PriceReducer.js +1 -1
  301. package/lib/cjs/reducers/ShipmentReducer.d.ts +5 -5
  302. package/lib/cjs/reducers/ShipmentReducer.js +1 -1
  303. package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
  304. package/lib/cjs/reducers/ShippingAddressReducer.js +1 -1
  305. package/lib/cjs/reducers/SkuListsReducer.d.ts +2 -2
  306. package/lib/cjs/reducers/SkuListsReducer.js +1 -1
  307. package/lib/cjs/reducers/SkuReducer.d.ts +4 -4
  308. package/lib/cjs/reducers/SkuReducer.js +1 -1
  309. package/lib/cjs/typings/errors.d.ts +1 -1
  310. package/lib/cjs/typings/index.d.ts +7 -11
  311. package/lib/cjs/typings/index.js +1 -1
  312. package/lib/cjs/utils/PropsType.d.ts +2 -2
  313. package/lib/cjs/utils/addressesManager.d.ts +3 -3
  314. package/lib/cjs/utils/baseReducer.d.ts +1 -1
  315. package/lib/cjs/utils/baseReducer.js +1 -1
  316. package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
  317. package/lib/cjs/utils/customMessages.d.ts +1 -1
  318. package/lib/cjs/utils/expressPaymentHelper.d.ts +83 -0
  319. package/lib/cjs/utils/expressPaymentHelper.js +1 -0
  320. package/lib/cjs/utils/filterChildren.d.ts +1 -1
  321. package/lib/cjs/utils/getCardDetails.d.ts +3 -3
  322. package/lib/cjs/utils/getCardDetails.js +1 -1
  323. package/lib/cjs/utils/getErrors.d.ts +4 -3
  324. package/lib/cjs/utils/getErrors.js +1 -1
  325. package/lib/cjs/utils/getLoaderComponent.d.ts +1 -1
  326. package/lib/cjs/utils/getPaymentAttributes.d.ts +3 -3
  327. package/lib/cjs/utils/getPrices.d.ts +2 -2
  328. package/lib/cjs/utils/getPrices.js +1 -1
  329. package/lib/cjs/utils/getSdk.d.ts +1 -1
  330. package/lib/cjs/utils/getSdk.js +1 -1
  331. package/lib/cjs/utils/getSkus.d.ts +1 -1
  332. package/lib/cjs/utils/hooks/useCustomContext.d.ts +1 -1
  333. package/lib/cjs/utils/icons.js +1 -1
  334. package/lib/cjs/utils/isEmpty.d.ts +1 -0
  335. package/lib/cjs/utils/isEmpty.js +1 -0
  336. package/lib/cjs/utils/localStorage.js +1 -1
  337. package/lib/cjs/utils/promisify.js +1 -1
  338. package/lib/cjs/utils/shipments.d.ts +1 -1
  339. package/lib/cjs/utils/shipments.js +1 -1
  340. package/lib/cjs/utils/snakeToCamelCase.js +1 -1
  341. package/lib/cjs/utils/validateFormFields.d.ts +6 -6
  342. package/lib/cjs/utils/validateFormFields.js +1 -1
  343. package/lib/esm/components/ExternalFunction.d.ts +1 -1
  344. package/lib/esm/components/MetadataInput.d.ts +1 -1
  345. package/lib/esm/components/SubmitButton.d.ts +2 -2
  346. package/lib/esm/components/addresses/Address.d.ts +1 -1
  347. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +2 -2
  348. package/lib/esm/components/addresses/AddressField.d.ts +3 -3
  349. package/lib/esm/components/addresses/AddressInput.d.ts +2 -2
  350. package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -1
  351. package/lib/esm/components/addresses/AddressesContainer.d.ts +1 -1
  352. package/lib/esm/components/addresses/AddressesContainer.js +1 -1
  353. package/lib/esm/components/addresses/AddressesEmpty.d.ts +1 -1
  354. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
  355. package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
  356. package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
  357. package/lib/esm/components/addresses/SaveAddressesButton.d.ts +2 -2
  358. package/lib/esm/components/addresses/ShippingAddressForm.d.ts +1 -1
  359. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
  360. package/lib/esm/components/customers/CustomerAddressForm.d.ts +1 -1
  361. package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
  362. package/lib/esm/components/customers/CustomerContainer.js +1 -1
  363. package/lib/esm/components/customers/CustomerField.d.ts +2 -2
  364. package/lib/esm/components/customers/CustomerField.js +1 -1
  365. package/lib/esm/components/customers/CustomerInput.d.ts +1 -1
  366. package/lib/esm/components/customers/CustomerPaymentSource.d.ts +1 -1
  367. package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
  368. package/lib/esm/components/customers/SaveCustomerButton.d.ts +2 -2
  369. package/lib/esm/components/errors/Errors.d.ts +1 -1
  370. package/lib/esm/components/gift_cards/GiftCard.d.ts +1 -1
  371. package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +1 -1
  372. package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
  373. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  374. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -1
  375. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
  376. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
  377. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
  378. package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
  379. package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
  380. package/lib/esm/components/line_items/LineItemCode.d.ts +2 -2
  381. package/lib/esm/components/line_items/LineItemField.d.ts +2 -2
  382. package/lib/esm/components/line_items/LineItemField.js +1 -1
  383. package/lib/esm/components/line_items/LineItemImage.d.ts +2 -2
  384. package/lib/esm/components/line_items/LineItemName.d.ts +1 -1
  385. package/lib/esm/components/line_items/LineItemOption.d.ts +3 -3
  386. package/lib/esm/components/line_items/LineItemOption.js +1 -1
  387. package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
  388. package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
  389. package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +2 -2
  390. package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
  391. package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -1
  392. package/lib/esm/components/line_items/LineItemsEmpty.d.ts +1 -1
  393. package/lib/esm/components/orders/AddToCartButton.d.ts +3 -3
  394. package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -1
  395. package/lib/esm/components/orders/CartLink.d.ts +2 -2
  396. package/lib/esm/components/orders/CheckoutLink.d.ts +1 -1
  397. package/lib/esm/components/orders/DiscountAmount.d.ts +1 -1
  398. package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -1
  399. package/lib/esm/components/orders/OrderContainer.d.ts +1 -1
  400. package/lib/esm/components/orders/OrderContainer.js +1 -1
  401. package/lib/esm/components/orders/OrderList.d.ts +2 -2
  402. package/lib/esm/components/orders/OrderListEmpty.d.ts +1 -1
  403. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +1 -1
  404. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +1 -1
  405. package/lib/esm/components/orders/OrderNumber.d.ts +1 -1
  406. package/lib/esm/components/orders/OrderStorage.d.ts +1 -1
  407. package/lib/esm/components/orders/PaymentMethodAmount.d.ts +1 -1
  408. package/lib/esm/components/orders/PlaceOrderButton.d.ts +2 -2
  409. package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
  410. package/lib/esm/components/orders/PlaceOrderContainer.d.ts +2 -2
  411. package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
  412. package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -1
  413. package/lib/esm/components/orders/ShippingAmount.d.ts +1 -1
  414. package/lib/esm/components/orders/SubTotalAmount.d.ts +1 -1
  415. package/lib/esm/components/orders/TaxesAmount.d.ts +1 -1
  416. package/lib/esm/components/orders/TotalAmount.d.ts +1 -1
  417. package/lib/esm/components/parcels/ParcelField.d.ts +2 -2
  418. package/lib/esm/components/parcels/ParcelField.js +1 -1
  419. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +2 -2
  420. package/lib/esm/components/parcels/ParcelLineItemField.js +1 -1
  421. package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +1 -1
  422. package/lib/esm/components/parcels/ParcelsCount.d.ts +1 -1
  423. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -1
  424. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  425. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  426. package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +1 -1
  427. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  428. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +2 -2
  429. package/lib/esm/components/payment_gateways/PaymentGateway.js +1 -1
  430. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -1
  431. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -1
  432. package/lib/esm/components/payment_gateways/StripeGateway.js +1 -1
  433. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  434. package/lib/esm/components/payment_methods/PaymentMethod.d.ts +14 -1
  435. package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
  436. package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +1 -1
  437. package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
  438. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +2 -2
  439. package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
  440. package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
  441. package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
  442. package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -5
  443. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +3 -3
  444. package/lib/esm/components/payment_source/ExternalPayment.d.ts +2 -2
  445. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +2 -2
  446. package/lib/esm/components/payment_source/KlarnaPayment.js +1 -1
  447. package/lib/esm/components/payment_source/PaymentSource.d.ts +2 -2
  448. package/lib/esm/components/payment_source/PaymentSource.js +1 -1
  449. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
  450. package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
  451. package/lib/esm/components/payment_source/PaymentSourceBrandName.js +1 -1
  452. package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
  453. package/lib/esm/components/payment_source/PaypalPayment.d.ts +1 -1
  454. package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +5 -0
  455. package/lib/esm/components/payment_source/StripeExpressPayment.js +1 -0
  456. package/lib/esm/components/payment_source/StripePayment.d.ts +8 -5
  457. package/lib/esm/components/payment_source/StripePayment.js +1 -1
  458. package/lib/esm/components/prices/Price.d.ts +2 -2
  459. package/lib/esm/components/prices/PricesContainer.d.ts +1 -1
  460. package/lib/esm/components/prices/PricesContainer.js +1 -1
  461. package/lib/esm/components/shipments/Shipment.d.ts +1 -1
  462. package/lib/esm/components/shipments/ShipmentField.d.ts +1 -1
  463. package/lib/esm/components/shipments/ShipmentsContainer.d.ts +1 -1
  464. package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
  465. package/lib/esm/components/shipments/ShipmentsCount.d.ts +1 -1
  466. package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +1 -1
  467. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  468. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  469. package/lib/esm/components/skus/AvailabilityContainer.d.ts +1 -1
  470. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
  471. package/lib/esm/components/skus/SkuField.d.ts +2 -2
  472. package/lib/esm/components/skus/SkuField.js +1 -1
  473. package/lib/esm/components/skus/SkuList.d.ts +1 -1
  474. package/lib/esm/components/skus/SkuListsContainer.d.ts +1 -1
  475. package/lib/esm/components/skus/Skus.d.ts +1 -1
  476. package/lib/esm/components/skus/SkusContainer.d.ts +1 -1
  477. package/lib/esm/components/skus/SkusContainer.js +1 -1
  478. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +2 -2
  479. package/lib/esm/components/stock_transfers/StockTransferField.js +1 -1
  480. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -1
  481. package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
  482. package/lib/esm/components/utils/BaseField.d.ts +1 -1
  483. package/lib/esm/components/utils/BaseInput.d.ts +1 -1
  484. package/lib/esm/components/utils/BaseOrderPrice.d.ts +3 -3
  485. package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
  486. package/lib/esm/components/utils/ErrorBoundary.d.ts +1 -1
  487. package/lib/esm/components/utils/GenericFieldComponent.d.ts +7 -7
  488. package/lib/esm/components/utils/Parent.d.ts +1 -1
  489. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +3 -3
  490. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
  491. package/lib/esm/components/utils/getAllErrors.d.ts +3 -3
  492. package/lib/esm/context/AddressChildrenContext.d.ts +1 -1
  493. package/lib/esm/context/AddressContext.d.ts +2 -2
  494. package/lib/esm/context/BillingAddressContext.d.ts +1 -1
  495. package/lib/esm/context/BillingAddressFormContext.d.ts +5 -7
  496. package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
  497. package/lib/esm/context/CustomerAddressFormContext.d.ts +7 -9
  498. package/lib/esm/context/CustomerContext.d.ts +1 -1
  499. package/lib/esm/context/CustomerPaymentSourceContext.d.ts +1 -1
  500. package/lib/esm/context/GiftCardContext.d.ts +2 -2
  501. package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
  502. package/lib/esm/context/LineItemContext.d.ts +2 -2
  503. package/lib/esm/context/LineItemOptionChildrenContext.d.ts +5 -2
  504. package/lib/esm/context/OrderContext.d.ts +3 -3
  505. package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
  506. package/lib/esm/context/OrderListPaginationContext.d.ts +1 -1
  507. package/lib/esm/context/PaymentMethodChildrenContext.d.ts +2 -1
  508. package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
  509. package/lib/esm/context/PlaceOrderContext.d.ts +2 -2
  510. package/lib/esm/context/PricesContext.d.ts +1 -1
  511. package/lib/esm/context/ShipmentContext.d.ts +1 -1
  512. package/lib/esm/context/ShippingAddressContext.d.ts +1 -1
  513. package/lib/esm/context/ShippingAddressFormContext.d.ts +1 -1
  514. package/lib/esm/context/ShippingMethodChildrenContext.d.ts +1 -1
  515. package/lib/esm/context/SkuChildrenContext.d.ts +1 -1
  516. package/lib/esm/context/SkuContext.d.ts +1 -1
  517. package/lib/esm/context/StockTransferChildrenContext.d.ts +1 -1
  518. package/lib/esm/reducers/AddressReducer.d.ts +6 -6
  519. package/lib/esm/reducers/AvailabilityReducer.d.ts +4 -4
  520. package/lib/esm/reducers/BillingAddressReducer.d.ts +4 -4
  521. package/lib/esm/reducers/CustomerReducer.d.ts +4 -4
  522. package/lib/esm/reducers/GiftCardReducer.d.ts +6 -6
  523. package/lib/esm/reducers/LineItemReducer.d.ts +6 -6
  524. package/lib/esm/reducers/OrderReducer.d.ts +6 -6
  525. package/lib/esm/reducers/PaymentMethodReducer.d.ts +16 -12
  526. package/lib/esm/reducers/PlaceOrderReducer.d.ts +4 -1
  527. package/lib/esm/reducers/PriceReducer.d.ts +6 -8
  528. package/lib/esm/reducers/ShipmentReducer.d.ts +5 -5
  529. package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
  530. package/lib/esm/reducers/SkuListsReducer.d.ts +2 -2
  531. package/lib/esm/reducers/SkuReducer.d.ts +4 -4
  532. package/lib/esm/typings/errors.d.ts +1 -1
  533. package/lib/esm/typings/index.d.ts +7 -11
  534. package/lib/esm/utils/PropsType.d.ts +2 -2
  535. package/lib/esm/utils/addressesManager.d.ts +3 -3
  536. package/lib/esm/utils/baseReducer.d.ts +1 -1
  537. package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
  538. package/lib/esm/utils/customMessages.d.ts +1 -1
  539. package/lib/esm/utils/expressPaymentHelper.d.ts +83 -0
  540. package/lib/esm/utils/expressPaymentHelper.js +1 -0
  541. package/lib/esm/utils/filterChildren.d.ts +1 -1
  542. package/lib/esm/utils/getCardDetails.d.ts +3 -3
  543. package/lib/esm/utils/getCardDetails.js +1 -1
  544. package/lib/esm/utils/getErrors.d.ts +4 -3
  545. package/lib/esm/utils/getLoaderComponent.d.ts +1 -1
  546. package/lib/esm/utils/getPaymentAttributes.d.ts +3 -3
  547. package/lib/esm/utils/getPrices.d.ts +2 -2
  548. package/lib/esm/utils/getSdk.d.ts +1 -1
  549. package/lib/esm/utils/getSkus.d.ts +1 -1
  550. package/lib/esm/utils/hooks/useCustomContext.d.ts +1 -1
  551. package/lib/esm/utils/isEmpty.d.ts +1 -0
  552. package/lib/esm/utils/isEmpty.js +1 -0
  553. package/lib/esm/utils/localStorage.js +1 -1
  554. package/lib/esm/utils/shipments.d.ts +1 -1
  555. package/lib/esm/utils/validateFormFields.d.ts +6 -6
  556. package/lib/esm/utils/validateFormFields.js +1 -1
  557. package/package.json +19 -19
  558. package/lib/tsconfig.prod.esm.tsbuildinfo +0 -1
  559. package/lib/tsconfig.prod.tsbuildinfo +0 -1
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { SkuState } from '../reducers/SkuReducer';
2
+ import { type SkuState } from '../reducers/SkuReducer';
3
3
  export type SkuContextValue = SkuState;
4
4
  declare const SkuContext: import("react").Context<Partial<{
5
5
  skus: import("@commercelayer/sdk/lib/cjs/resources/skus").Sku[];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { StockTransfer } from '@commercelayer/sdk';
2
+ import { type StockTransfer } from '@commercelayer/sdk';
3
3
  export interface InitialStockTransferContext {
4
4
  stockTransfer?: StockTransfer;
5
5
  }
@@ -1,10 +1,10 @@
1
- import { Dispatch } from 'react';
2
- import { BaseError } from '../typings/errors';
3
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
1
+ import { type Dispatch } from 'react';
2
+ import { type BaseError } from '../typings/errors';
3
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
4
4
  import type { Address, AddressCreate, Order } from '@commercelayer/sdk';
5
- import { updateOrder } from './OrderReducer';
6
- import { TCustomerAddress } from './CustomerReducer';
7
- import { TResourceError } from '../components/errors/Errors';
5
+ import { type updateOrder } from './OrderReducer';
6
+ import { type TCustomerAddress } from './CustomerReducer';
7
+ import { type TResourceError } from '../components/errors/Errors';
8
8
  export type AddressActionType = 'setErrors' | 'setAddress' | 'setShipToDifferentAddress' | 'setCloneAddress' | 'cleanup';
9
9
  export type AddressField = 'city' | 'company' | 'country_code' | 'first_name' | 'last_name' | 'line_1' | 'line_2' | 'phone' | 'state_code' | 'zip_code' | 'billing_info';
10
10
  export type AddressFieldView = AddressField | 'full_address' | 'full_name';
@@ -1,7 +1,7 @@
1
- import { BaseError } from '../typings/errors';
2
- import { Sku } from '@commercelayer/sdk';
3
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
4
- import { Dispatch } from 'react';
1
+ import { type BaseError } from '../typings/errors';
2
+ import { type Sku } from '@commercelayer/sdk';
3
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
4
+ import { type Dispatch } from 'react';
5
5
  export interface DeliveryLeadTime {
6
6
  shipping_method: {
7
7
  name: string;
@@ -1,7 +1,7 @@
1
- import { Dispatch } from 'react';
2
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
3
- import { Order } from '@commercelayer/sdk';
4
- import { AddressResource } from './AddressReducer';
1
+ import { type Dispatch } from 'react';
2
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
3
+ import { type Order } from '@commercelayer/sdk';
4
+ import { type AddressResource } from './AddressReducer';
5
5
  export type BillingAddressActionType = 'setBillingAddress' | 'setBillingCustomerAddressId' | 'cleanup';
6
6
  export interface BillingAddressActionPayload {
7
7
  _billing_address_clone_id: string;
@@ -1,8 +1,8 @@
1
- import { Dispatch } from 'react';
2
- import { BaseError } from '../typings/errors';
1
+ import { type Dispatch } from 'react';
2
+ import { type BaseError } from '../typings/errors';
3
3
  import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSource, Order } from '@commercelayer/sdk';
4
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
5
- import { updateOrder } from './OrderReducer';
4
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
5
+ import { type updateOrder } from './OrderReducer';
6
6
  export type CustomerActionType = 'setErrors' | 'setCustomerEmail' | 'setAddresses' | 'setPayments' | 'setOrders';
7
7
  export interface CustomerActionPayload {
8
8
  addresses: Address[] | null;
@@ -1,9 +1,9 @@
1
- import { Customer, Market, GiftCardRecipient, GiftCardRecipientCreate, Order } from '@commercelayer/sdk';
2
- import { BaseMetadata } from '../typings/index';
3
- import { Dispatch } from 'react';
4
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
5
- import { BaseError } from '../typings/errors';
6
- import { CreateOrder, getOrderContext } from './OrderReducer';
1
+ import { type Customer, type Market, type GiftCardRecipient, type GiftCardRecipientCreate, type Order } from '@commercelayer/sdk';
2
+ import { type BaseMetadata } from '../typings/index';
3
+ import { type Dispatch } from 'react';
4
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
5
+ import { type BaseError } from '../typings/errors';
6
+ import { type CreateOrder, type getOrderContext } from './OrderReducer';
7
7
  export type GiftCardActionType = 'setAvailability' | 'setGiftCardRecipient' | 'setGiftCardErrors' | 'setGiftCardLoading';
8
8
  export interface GiftCardRecipientI {
9
9
  email: string;
@@ -1,9 +1,9 @@
1
- import { Dispatch } from 'react';
2
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
3
- import { getOrderContext } from './OrderReducer';
4
- import { LoaderType } from '../typings/index';
5
- import { BaseError } from '../typings/errors';
6
- import { Order, LineItem } from '@commercelayer/sdk';
1
+ import { type Dispatch } from 'react';
2
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
3
+ import { type getOrderContext } from './OrderReducer';
4
+ import { type LoaderType } from '../typings/index';
5
+ import { type BaseError } from '../typings/errors';
6
+ import { type Order, type LineItem } from '@commercelayer/sdk';
7
7
  export interface UpdateLineItemParams {
8
8
  lineItemId: string;
9
9
  quantity?: number;
@@ -1,9 +1,9 @@
1
- import { Dispatch } from 'react';
2
- import { SetLocalOrder, DeleteLocalOrder } from '../utils/localStorage';
3
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
4
- import { BaseMetadataObject } from '../typings/index';
5
- import { BaseError } from '../typings/errors';
6
- import { AddressResource } from './AddressReducer';
1
+ import { type Dispatch } from 'react';
2
+ import { type SetLocalOrder, type DeleteLocalOrder } from '../utils/localStorage';
3
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
4
+ import { type BaseMetadataObject } from '../typings/index';
5
+ import { type BaseError } from '../typings/errors';
6
+ import { type AddressResource } from './AddressReducer';
7
7
  import type { Order, OrderUpdate } from '@commercelayer/sdk';
8
8
  export type GetOrderParams = Partial<{
9
9
  clearWhenPlaced: boolean;
@@ -1,16 +1,16 @@
1
- import { AdyenPaymentConfig } from '../components/payment_source/AdyenPayment';
2
- import { BraintreeConfig } from '../components/payment_source/BraintreePayment';
3
- import { PaypalConfig } from '../components/payment_source/PaypalPayment';
4
- import { StripeConfig } from '../components/payment_source/StripePayment';
5
- import { WireTransferConfig } from '../components/payment_source/WireTransferPayment';
6
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
7
- import { getOrderContext, updateOrder } from './OrderReducer';
1
+ import { type AdyenPaymentConfig } from '../components/payment_source/AdyenPayment';
2
+ import { type BraintreeConfig } from '../components/payment_source/BraintreePayment';
3
+ import { type PaypalConfig } from '../components/payment_source/PaypalPayment';
4
+ import { type StripeConfig } from '../components/payment_source/StripePayment';
5
+ import { type WireTransferConfig } from '../components/payment_source/WireTransferPayment';
6
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
7
+ import { type getOrderContext, type updateOrder } from './OrderReducer';
8
8
  import type { BaseError } from '../typings/errors';
9
- import { Order, PaymentMethod, StripePayment, WireTransfer, AdyenPayment, BraintreePayment, CheckoutComPayment, ExternalPayment, PaypalPayment, KlarnaPayment } from '@commercelayer/sdk';
10
- import { Dispatch, MutableRefObject } from 'react';
11
- import { CheckoutComConfig } from '../components/payment_source/CheckoutComPayment';
12
- import { ExternalPaymentConfig } from '../components/payment_source/ExternalPayment';
13
- import { ResourceKeys } from '../utils/getPaymentAttributes';
9
+ import { type Order, type PaymentMethod, type StripePayment, type WireTransfer, type AdyenPayment, type BraintreePayment, type CheckoutComPayment, type ExternalPayment, type PaypalPayment, type KlarnaPayment } from '@commercelayer/sdk';
10
+ import { type Dispatch, type MutableRefObject } from 'react';
11
+ import { type CheckoutComConfig } from '../components/payment_source/CheckoutComPayment';
12
+ import { type ExternalPaymentConfig } from '../components/payment_source/ExternalPayment';
13
+ import { type ResourceKeys } from '../utils/getPaymentAttributes';
14
14
  export type PaymentSourceType = AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer;
15
15
  interface Card {
16
16
  type: string;
@@ -41,6 +41,10 @@ export interface PaymentSourceObject {
41
41
  options?: {
42
42
  card: Card;
43
43
  };
44
+ payment_method?: {
45
+ card: Card;
46
+ type: string | 'klarna' | 'card';
47
+ };
44
48
  };
45
49
  wire_transfers: WireTransfer;
46
50
  checkout_com_payments: CheckoutComPayment & {
@@ -2,7 +2,7 @@ import type { Dispatch, RefObject } from 'react';
2
2
  import type { CommerceLayerConfig } from '../context/CommerceLayerContext';
3
3
  import type { BaseError } from '../typings/errors';
4
4
  import type { Order } from '@commercelayer/sdk';
5
- import { PaymentResource, PaymentSourceType } from './PaymentMethodReducer';
5
+ import { type PaymentResource, type PaymentSourceType } from './PaymentMethodReducer';
6
6
  export type PlaceOrderActionType = 'setErrors' | 'setPlaceOrderPermitted' | 'setButtonRef';
7
7
  export interface PlaceOrderOptions {
8
8
  paypalPayerId?: string;
@@ -14,6 +14,9 @@ export interface PlaceOrderOptions {
14
14
  checkoutCom?: {
15
15
  session_id: string;
16
16
  };
17
+ stripe?: {
18
+ redirectStatus: string;
19
+ };
17
20
  }
18
21
  export interface PlaceOrderActionPayload {
19
22
  errors: BaseError[];
@@ -1,11 +1,9 @@
1
- import { BaseAction, LoaderType } from '../typings/index';
2
- import { Price } from '@commercelayer/sdk';
3
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
4
- import { Dispatch } from 'react';
5
- import { BaseError } from '../typings/errors';
6
- export interface Prices {
7
- [key: string]: Price | Price[];
8
- }
1
+ import { type BaseAction, type LoaderType } from '../typings/index';
2
+ import { type Price } from '@commercelayer/sdk';
3
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
4
+ import { type Dispatch } from 'react';
5
+ import { type BaseError } from '../typings/errors';
6
+ export type Prices = Record<string, Price | Price[]>;
9
7
  type SkuCodesPrice = string[];
10
8
  export interface PriceState {
11
9
  loading: boolean;
@@ -1,8 +1,8 @@
1
- import { Dispatch } from 'react';
2
- import { BaseError } from '../typings/errors';
3
- import { DeliveryLeadTime, LineItem, Order, Shipment } from '@commercelayer/sdk';
4
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
5
- import { getOrderContext } from './OrderReducer';
1
+ import { type Dispatch } from 'react';
2
+ import { type BaseError } from '../typings/errors';
3
+ import { type DeliveryLeadTime, type LineItem, type Order, type Shipment } from '@commercelayer/sdk';
4
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
5
+ import { type getOrderContext } from './OrderReducer';
6
6
  export type ShipmentActionType = 'setErrors' | 'setShipments' | 'setShippingMethod';
7
7
  export type ShipmentLineItem = LineItem & {
8
8
  line_item: LineItem;
@@ -1,8 +1,8 @@
1
- import { Dispatch } from 'react';
2
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
1
+ import { type Dispatch } from 'react';
2
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
3
3
  import type { Order } from '@commercelayer/sdk';
4
- import { getOrderContext } from './OrderReducer';
5
- import { AddressResource } from './AddressReducer';
4
+ import { type getOrderContext } from './OrderReducer';
5
+ import { type AddressResource } from './AddressReducer';
6
6
  export type ShippingAddressActionType = 'setShippingAddress' | 'setShippingCustomerAddressId' | 'cleanup';
7
7
  export interface ShippingAddressActionPayload {
8
8
  _shipping_address_clone_id: string;
@@ -1,5 +1,5 @@
1
- import { Dispatch } from 'react';
2
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
1
+ import { type Dispatch } from 'react';
2
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
3
3
  type SkuListsActionType = 'getSkuList' | 'setSkuList';
4
4
  export type SkuListsState = Partial<{
5
5
  listIds: string[];
@@ -1,7 +1,7 @@
1
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
2
- import { BaseAction } from '../typings/index';
3
- import { QueryParamsList, Sku } from '@commercelayer/sdk';
4
- import { Dispatch } from 'react';
1
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
2
+ import { type BaseAction } from '../typings/index';
3
+ import { type QueryParamsList, type Sku } from '@commercelayer/sdk';
4
+ import { type Dispatch } from 'react';
5
5
  type SkuActionType = 'getSkus' | 'setLoading';
6
6
  type SkuAction = BaseAction<SkuActionType, SkuState>;
7
7
  export type SkuState = Partial<{
@@ -1,4 +1,4 @@
1
- import { TResourceError } from '../components/errors/Errors';
1
+ import { type TResourceError } from '../components/errors/Errors';
2
2
  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';
3
3
  export interface BaseError {
4
4
  code: CodeErrorType;
@@ -1,6 +1,6 @@
1
- import { Dispatch, ForwardedRef, Ref } from 'react';
2
- import PropTypes, { InferProps } from 'prop-types';
3
- import { BaseError } from './errors';
1
+ import { type Dispatch, type ForwardedRef, type Ref } from 'react';
2
+ import PropTypes, { type InferProps } from 'prop-types';
3
+ import { type BaseError } from './errors';
4
4
  export declare const BC: {
5
5
  id: PropTypes.Requireable<string>;
6
6
  className: PropTypes.Requireable<string>;
@@ -58,9 +58,7 @@ export type LoaderType = string | JSX.Element;
58
58
  export declare const BMObject: PropTypes.Requireable<{
59
59
  [x: string]: string | null | undefined;
60
60
  }>;
61
- export interface BaseMetadataObject {
62
- [key: string]: string | undefined | null;
63
- }
61
+ export type BaseMetadataObject = Record<string, string | undefined | null>;
64
62
  export type TimeFormat = 'days' | 'hours';
65
63
  export type BaseComponent = InferProps<typeof BC>;
66
64
  export interface BaseAction<A = string, P = Record<string, any>> {
@@ -75,9 +73,7 @@ export type BaseActionType<T = string> = T[];
75
73
  export type BFSetStateContainer<T> = <P extends T>(param: P) => void;
76
74
  export type BaseReducer = <S extends BaseState, A extends BaseAction, T extends BaseActionType>(state: S, action: A, type: T) => S;
77
75
  export type BaseUnsetState<A> = (dispatch: Dispatch<A>) => void;
78
- export interface BaseMetadata {
79
- [key: string]: string | undefined | null;
80
- }
76
+ export type BaseMetadata = Record<string, string | undefined | null>;
81
77
  export type BaseFormatPrice = 'formatted' | 'cents' | 'float';
82
78
  export declare const baseOrderPricePropTypes: {
83
79
  id: PropTypes.Requireable<string>;
@@ -112,9 +108,9 @@ export type ExcludeTag<T extends keyof JSX.IntrinsicElements> = Exclude<keyof JS
112
108
  export type ExtractTag<T extends keyof JSX.IntrinsicElements> = Extract<keyof JSX.IntrinsicElements, T>;
113
109
  export type ConditionalElement<E> = ({
114
110
  attribute: Extract<keyof E, 'image_url'>;
115
- tagElement: ExtractTag<'img'>;
111
+ tagElement?: ExtractTag<'img'>;
116
112
  } & JSX.IntrinsicElements['img']) | ({
117
113
  attribute: Exclude<keyof E, 'image_url'>;
118
- tagElement: ExcludeTag<'img'>;
114
+ tagElement?: ExcludeTag<'img'>;
119
115
  } & Omit<JSX.IntrinsicElements[ExcludeTag<'img'>], 'children'>);
120
116
  export {};
@@ -1,4 +1,4 @@
1
- import PropTypes from 'prop-types';
1
+ import type PropTypes from 'prop-types';
2
2
  type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
3
3
  type Defined<T> = T extends undefined ? never : T;
4
4
  /**
@@ -29,5 +29,5 @@ type WithDefaultProps<P, DP> = Omit<P, keyof DP> & {
29
29
  * type Props = PropsType<typeof propTypes, typeof defaultProps>;
30
30
  * ```
31
31
  */
32
- export type PropsType<PT, DP = {}> = WithDefaultProps<PropTypes.InferProps<PT>, DP>;
32
+ export type PropsType<PT, DP> = WithDefaultProps<PropTypes.InferProps<PT>, DP>;
33
33
  export {};
@@ -1,6 +1,6 @@
1
- import { BaseError } from '../typings/errors';
2
- import { Address, AddressCreate } from '@commercelayer/sdk';
3
- import { TCustomerAddress } from '../reducers/CustomerReducer';
1
+ import { type BaseError } from '../typings/errors';
2
+ import { type Address, type AddressCreate } from '@commercelayer/sdk';
3
+ import { type TCustomerAddress } from '../reducers/CustomerReducer';
4
4
  type BillingAddressController = (params: {
5
5
  billing_address?: AddressCreate;
6
6
  billingAddressId?: string;
@@ -1,3 +1,3 @@
1
- import { BaseReducer } from '../typings/index';
1
+ import { type BaseReducer } from '../typings/index';
2
2
  declare const baseReducer: BaseReducer;
3
3
  export default baseReducer;
@@ -1,4 +1,4 @@
1
- import { ResourceIncluded } from '../reducers/OrderReducer';
1
+ import { type ResourceIncluded } from '../reducers/OrderReducer';
2
2
  import type { Order } from '@commercelayer/sdk';
3
3
  interface Params {
4
4
  order: Order;
@@ -1,2 +1,2 @@
1
- import { BaseError } from '../typings/errors';
1
+ import { type BaseError } from '../typings/errors';
2
2
  export default function customMessages(messages: BaseError[] | undefined, v: BaseError): null | BaseError | undefined;
@@ -0,0 +1,83 @@
1
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
2
+ import { type Order, type PaymentMethod, type QueryParamsRetrieve, type AddressCreate } from '@commercelayer/sdk';
3
+ import { type PaymentRequestShippingOption } from '@stripe/stripe-js';
4
+ import { type PaymentResource } from '../reducers/PaymentMethodReducer';
5
+ export declare function getAvailableExpressPayments(paymentMethods: PaymentMethod[]): PaymentMethod[];
6
+ interface TFakeAddressParams {
7
+ /**
8
+ * The order id
9
+ */
10
+ orderId: string;
11
+ /**
12
+ * The Commerce Layer config
13
+ */
14
+ config: Required<CommerceLayerConfig>;
15
+ /**
16
+ * The address resource
17
+ */
18
+ address: AddressCreate;
19
+ /**
20
+ * The customer email
21
+ */
22
+ email?: string;
23
+ }
24
+ export declare function setExpressFakeAddress({ orderId, config, address, email }: TFakeAddressParams): Promise<Order>;
25
+ export declare function getExpressShippingMethods(order: Order): PaymentRequestShippingOption[] | null;
26
+ type TSetExpressShippingMethodParams = {
27
+ /**
28
+ * The Commerce Layer config
29
+ */
30
+ config: CommerceLayerConfig;
31
+ /**
32
+ * The order id
33
+ */
34
+ orderId: string;
35
+ /**
36
+ * The query params
37
+ */
38
+ params?: QueryParamsRetrieve;
39
+ } & ({
40
+ /**
41
+ * Select the first shipping method
42
+ */
43
+ selectFirst: false;
44
+ /**
45
+ * The selected shipping method id
46
+ */
47
+ selectedShippingMethodId?: string;
48
+ } | {
49
+ selectFirst?: true;
50
+ selectedShippingMethodId?: never;
51
+ });
52
+ export declare function setExpressShippingMethod({ config, orderId, selectFirst, selectedShippingMethodId, params }: TSetExpressShippingMethodParams): Promise<Order>;
53
+ export interface TSetExpressPlaceOrderParams {
54
+ /**
55
+ * The Commerce Layer config
56
+ */
57
+ config: CommerceLayerConfig;
58
+ /**
59
+ * The order id
60
+ */
61
+ orderId: string;
62
+ /**
63
+ * The payment resource
64
+ */
65
+ paymentResource: PaymentResource;
66
+ /**
67
+ * The payment source id
68
+ */
69
+ paymentSourceId: string;
70
+ }
71
+ export declare function setExpressPlaceOrder({ config, orderId, paymentResource, paymentSourceId }: TSetExpressPlaceOrderParams): Promise<Order>;
72
+ interface TExpressRedirectUrlParams {
73
+ /**
74
+ * Order resource
75
+ */
76
+ order: Order;
77
+ /**
78
+ * The Commerce Layer config
79
+ */
80
+ config: CommerceLayerConfig;
81
+ }
82
+ export declare function expressRedirectUrl({ order, config: { accessToken, endpoint } }: TExpressRedirectUrlParams): void;
83
+ export {};
@@ -0,0 +1 @@
1
+ import getSdk from"./getSdk";const availablePaymentMethods=["stripe_payments"];export function getAvailableExpressPayments(paymentMethods){return paymentMethods.filter(payment=>payment.payment_source_type?availablePaymentMethods.includes(payment.payment_source_type):!1)}export async function setExpressFakeAddress({orderId,config,address,email}){const params={include:["shipments.available_shipping_methods"]},sdk=getSdk(config),fakeAddress=await sdk.addresses.create(address),resource={id:orderId,billing_address:sdk.addresses.relationship(fakeAddress.id),_shipping_address_same_as_billing:!0};return email!=null&&(resource.customer_email=email),await sdk.orders.update(resource,params),await sdk.orders.retrieve(orderId,params)}export function getExpressShippingMethods(order){const isSingleShipment=order?.shipments?.length===1,shippingMethods=order?.shipments?.map(shipment=>shipment.available_shipping_methods);if(isSingleShipment)return shippingMethods==null?null:shippingMethods.flat().map(method=>({id:method?.id??"",label:method?.name??"",amount:method?.price_amount_for_shipment_cents??0,detail:""}));{if(shippingMethods==null)return null;const shippingOptionsAmount=[];return shippingMethods.forEach(methods=>{if(methods!=null){const[firstMethod]=methods;firstMethod!=null&&shippingOptionsAmount.push(firstMethod.price_amount_for_shipment_cents??0)}}),[{id:"shipping",label:"Shipping",amount:shippingOptionsAmount.reduce((a,b)=>a+b,0),detail:""}]}}export async function setExpressShippingMethod({config,orderId,selectFirst=!0,selectedShippingMethodId,params}){const sdk=getSdk(config),order=await sdk.orders.retrieve(orderId,params),shippingMethods=getExpressShippingMethods(order);if(order?.shipments==null)throw new Error("No shipments found");const isSingleShipment=order.shipments.length===1,[shipmentId]=order.shipments.map(shipment=>shipment.id);if(shipmentId==null)throw new Error("No shipment found");if(shippingMethods==null||shippingMethods?.length===0)throw new Error("No shipping methods found");if(isSingleShipment)if(selectFirst){const[firstShippingMethodId]=shippingMethods.map(method=>method.id);firstShippingMethodId!=null&&await sdk.shipments.update({id:shipmentId,shipping_method:sdk.shipping_methods.relationship(firstShippingMethodId)})}else selectedShippingMethodId!=null&&await sdk.shipments.update({id:shipmentId,shipping_method:sdk.shipping_methods.relationship(selectedShippingMethodId)});else for(const shipment of order?.shipments??[]){const[firstShippingMethodId]=shipment?.available_shipping_methods?.map(method=>method.id)??[];firstShippingMethodId!=null&&await sdk.shipments.update({id:shipment.id,shipping_method:sdk.shipping_methods.relationship(firstShippingMethodId)})}return await sdk.orders.retrieve(order.id,params)}export async function setExpressPlaceOrder({config,orderId,paymentResource,paymentSourceId}){const sdk=getSdk(config);return await sdk.orders.retrieve(orderId,{include:["shipments.shipping_method","payment_source","payment_method"]}),await sdk[paymentResource].update({id:paymentSourceId,order:sdk.orders.relationship(orderId)}),await sdk.orders.update({id:orderId,payment_source:sdk[paymentResource].relationship(paymentSourceId)}),await sdk.orders.update({id:orderId,_place:!0})}export function expressRedirectUrl({order,config:{accessToken,endpoint}}){if(accessToken==null)throw new Error("No access token found");if(endpoint==null)throw new Error("No endpoint found");const[slug]=endpoint.split(".commercelayer");if(slug==null)throw new Error("No slug found");const href=order?.checkout_url!=null?order?.checkout_url:`${slug}.commercelayer.app/checkout/${order.id}?accessToken=${accessToken}`;window.location.pathname.includes("/checkout")||window.location.pathname.includes(`/${order.id}`)?window.location.reload():window.location.href=href}
@@ -1,4 +1,4 @@
1
- import { DefaultChildrenType } from '../typings/globals';
1
+ import { type DefaultChildrenType } from '../typings/globals';
2
2
  interface Props<T> {
3
3
  children: DefaultChildrenType;
4
4
  filterBy: T[];
@@ -1,6 +1,6 @@
1
- import { IconBrand } from '../context/PaymentSourceContext';
2
- import { PaymentResource } from '../reducers/PaymentMethodReducer';
3
- import { CustomerPaymentSource } from '@commercelayer/sdk';
1
+ import { type IconBrand } from '../context/PaymentSourceContext';
2
+ import { type PaymentResource } from '../reducers/PaymentMethodReducer';
3
+ import { type CustomerPaymentSource } from '@commercelayer/sdk';
4
4
  interface CardDetails {
5
5
  brand: IconBrand | string;
6
6
  last4: string;
@@ -1 +1 @@
1
- export default function getCardDetails({paymentType,customerPayment}){switch(paymentType){case"checkout_com_payments":{const source=customerPayment.payment_source?.payment_response?.source;if(source)return{brand:source.scheme.toLowerCase(),exp_month:source.expiry_month,exp_year:source.expiry_year,last4:source.last4};break}case"stripe_payments":case"braintree_payments":{const source=customerPayment.payment_source?.options?.card;if(source)return{...source};break}case"adyen_payments":{const ps=customerPayment.payment_source,source=ps?.payment_request_data?.payment_method,authorized=ps?.payment_response?.resultCode==="Authorised";if(source&&authorized){const brand=source.type==="scheme"?source.brand??"credit-card":source.type.replace("_account","");return{...source,brand}}break}default:{const source=customerPayment.payment_source?.metadata?.card;if(source)return{...source};break}}return{brand:"",exp_month:"**",exp_year:"**",last4:"****"}}
1
+ export default function getCardDetails({paymentType,customerPayment}){switch(paymentType){case"checkout_com_payments":{const source=customerPayment.payment_source?.payment_response?.source;if(source)return{brand:source.scheme.toLowerCase(),exp_month:source.expiry_month,exp_year:source.expiry_year,last4:source.last4};break}case"stripe_payments":{const ps=customerPayment.payment_source,source=ps?.options?.card??ps?.payment_method?.card;if(source)return{...source};break}case"braintree_payments":{const source=customerPayment.payment_source?.options?.card;if(source)return{...source};break}case"adyen_payments":{const ps=customerPayment.payment_source,source=ps?.payment_request_data?.payment_method,authorized=ps?.payment_response?.resultCode==="Authorised";if(source&&authorized){const brand=source.type==="scheme"?source.brand??"credit-card":source.type.replace("_account","");return{...source,brand}}break}default:{const source=customerPayment.payment_source?.metadata?.card;if(source)return{...source};break}}return{brand:"",exp_month:"**",exp_year:"**",last4:"****"}}
@@ -1,6 +1,7 @@
1
- import { TResourceError } from '../components/errors/Errors';
1
+ import { type TResourceError } from '../components/errors/Errors';
2
2
  import type { BaseError, TAPIError } from '../typings/errors';
3
- import { Dispatch } from 'react';
3
+ import type { ValueIteratee } from 'lodash';
4
+ import { type Dispatch } from 'react';
4
5
  interface GetErrorsParams {
5
6
  error: TAPIError;
6
7
  resource: TResourceError;
@@ -12,7 +13,7 @@ interface SetErrorsArgs<D> {
12
13
  currentErrors?: BaseError[];
13
14
  newErrors?: BaseError[];
14
15
  dispatch?: D;
15
- filterBy?: string;
16
+ filterBy?: ValueIteratee<BaseError>;
16
17
  }
17
18
  export declare function setErrors<D extends Dispatch<any>>({ currentErrors, newErrors, dispatch, filterBy }: SetErrorsArgs<D>): BaseError[];
18
19
  export {};
@@ -1,2 +1,2 @@
1
- import { LoaderType } from '../typings/index';
1
+ import { type LoaderType } from '../typings/index';
2
2
  export default function getLoaderComponent(loader: LoaderType): JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import type { PaypalConfig } from '../components/payment_source/PaypalPayment';
2
2
  import { type PaymentMethodConfig, type PaymentResource } from '../reducers/PaymentMethodReducer';
3
- import { ExternalPayment } from '@commercelayer/sdk';
4
- import { StringReplace } from './replace';
5
- import { SnakeToCamelCase } from './snakeToCamelCase';
3
+ import { type ExternalPayment } from '@commercelayer/sdk';
4
+ import { type StringReplace } from './replace';
5
+ import { type SnakeToCamelCase } from './snakeToCamelCase';
6
6
  interface Params<R extends PaymentResource, C extends PaymentMethodConfig> {
7
7
  resource: R;
8
8
  config: C;
@@ -1,5 +1,5 @@
1
- import { Price } from '@commercelayer/sdk';
2
- import { PTemplateProps } from '../components/utils/PriceTemplate';
1
+ import { type Price } from '@commercelayer/sdk';
2
+ import { type PTemplateProps } from '../components/utils/PriceTemplate';
3
3
  export declare function getPriceByCode(skuPrices: Price[], code?: string): Price | undefined;
4
4
  export declare function getPricesComponent(skuPrices: Price[], props: PTemplateProps): JSX.Element[] | JSX.Element;
5
5
  export default function getPrices<P extends Price>(prices: P[]): Record<string, P[]>;
@@ -1,3 +1,3 @@
1
1
  import Sdk from '@commercelayer/sdk';
2
- import { CommerceLayerConfig } from '../context/CommerceLayerContext';
2
+ import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
3
3
  export default function getSdk({ endpoint, accessToken }: CommerceLayerConfig): ReturnType<typeof Sdk>;
@@ -1,3 +1,3 @@
1
- import { Sku } from '@commercelayer/sdk';
1
+ import { type Sku } from '@commercelayer/sdk';
2
2
  declare const getSkus: (skus: Sku[], sortBy: string[]) => Record<string, any>;
3
3
  export default getSkus;
@@ -1,4 +1,4 @@
1
- import { Context } from 'react';
1
+ import { type Context } from 'react';
2
2
  interface TParams<C> {
3
3
  /**
4
4
  * Context to check
@@ -0,0 +1 @@
1
+ export declare function isEmpty<V>(value: V): boolean;
@@ -0,0 +1 @@
1
+ export function isEmpty(value){if(value==null)return!0;if(Array.isArray(value)||typeof value=="string")return value.length===0;if(typeof value=="object")return Object.keys(value).length===0;throw new Error("Invalid value for isEmpty function")}
@@ -1 +1 @@
1
- export const getLocalOrder=key=>localStorage.getItem(key),setLocalOrder=(key,value)=>localStorage.setItem(key,value),deleteLocalOrder=key=>{localStorage.removeItem(key)},getSavePaymentSourceToCustomerWallet=()=>localStorage.getItem("_save_payment_source_to_customer_wallet")==="true",getSaveBillingAddressToAddressBook=()=>localStorage.getItem("_save_billing_address_to_customer_address_book")==="true",getSaveShippingAddressToAddressBook=()=>localStorage.getItem("_save_shipping_address_to_customer_address_book")==="true";export function setCustomerOrderParam(key,value){return setLocalOrder(key,value)}
1
+ export const getLocalOrder=key=>localStorage.getItem(key),setLocalOrder=(key,value)=>{localStorage.setItem(key,value)},deleteLocalOrder=key=>{localStorage.removeItem(key)},getSavePaymentSourceToCustomerWallet=()=>localStorage.getItem("_save_payment_source_to_customer_wallet")==="true",getSaveBillingAddressToAddressBook=()=>localStorage.getItem("_save_billing_address_to_customer_address_book")==="true",getSaveShippingAddressToAddressBook=()=>localStorage.getItem("_save_shipping_address_to_customer_address_book")==="true";export function setCustomerOrderParam(key,value){setLocalOrder(key,value)}
@@ -1,3 +1,3 @@
1
- import { LineItem, Shipment } from '@commercelayer/sdk';
1
+ import { type LineItem, type Shipment } from '@commercelayer/sdk';
2
2
  export declare function shipmentsFilled(shipments: Shipment[]): boolean;
3
3
  export declare function isDoNotShip(lineItems?: LineItem[]): boolean;
@@ -1,9 +1,9 @@
1
- import { BaseState } from '../typings/index';
2
- import { BaseError } from '../typings/errors';
3
- import { AddressField } from '../reducers/AddressReducer';
4
- import { AddressCreate } from '@commercelayer/sdk';
5
- import { AddressInputName } from '../typings/index';
6
- import { TResourceError } from '../components/errors/Errors';
1
+ import { type BaseState } from '../typings/index';
2
+ import { type BaseError } from '../typings/errors';
3
+ import { type AddressField } from '../reducers/AddressReducer';
4
+ import { type AddressCreate } from '@commercelayer/sdk';
5
+ import { type AddressInputName } from '../typings/index';
6
+ import { type TResourceError } from '../components/errors/Errors';
7
7
  export type ValidateFormFields = <R extends string[]>(fields: HTMLFormControlsCollection, required: R, resourceType: TResourceError) => {
8
8
  errors: BaseError[];
9
9
  values: BaseState;
@@ -1 +1 @@
1
- import isEmpty from"lodash/isEmpty";import isString from"lodash/isString";import without from"lodash/without";import keys from"lodash/keys";import map from"lodash/map";import get from"lodash/get";import{addressFields}from"../reducers/AddressReducer";const EMAIL_PATTERN=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$/;export const validateValue=(val,name,type,resourceType)=>val?type==="email"&&isString(val)&&!val.match(EMAIL_PATTERN)?{field:name,code:"VALIDATION_ERROR",message:`${name} - is not valid`,resourceType}:{}:{field:name,code:"VALIDATION_ERROR",message:`${name} - is required`,resourceType};const validateFormFields=(fields,required,resourceType)=>{const errors=[];let values={metadata:{}};return map(fields,v=>{const val=!!get(v,"checked")||(v.value==="on"?!1:v.value),attrName=v.getAttribute("name");if(attrName&&required.includes(attrName)||v.required){const error=validateValue(val,v.name,v.type,resourceType);isEmpty(error)||errors.push(error),values={...values,[`${v.name}`]:val}}v.getAttribute("name")&&(values=!!v.getAttribute("data-metadata")?{...values,metadata:{...values.metadata,[`${v.name}`]:val}}:{...values,[`${v.name}`]:val})}),{errors,values}};export const fieldsExist=(address,schema=addressFields)=>{if(address.business){const required=without(schema,"first_name","last_name"),validAddress=keys(address).filter(k=>required.includes(k));return required.length>validAddress.length}else{const required=without(schema,"line_2","company"),validAddress=keys(address).filter(k=>required.includes(k));return required.length>validAddress.length}};const businessOptionalFields=["billing_address_first_name","billing_address_last_name","shipping_address_first_name","shipping_address_last_name","first_name","last_name"],customerOptionalFields=["billing_address_company","shipping_address_company","company"];export function businessMandatoryField(fieldName,isBusiness){return!(isBusiness&&businessOptionalFields.includes(fieldName)||!isBusiness&&customerOptionalFields.includes(fieldName))}export default validateFormFields;
1
+ import isEmpty from"lodash/isEmpty";import isString from"lodash/isString";import without from"lodash/without";import keys from"lodash/keys";import map from"lodash/map";import{addressFields}from"../reducers/AddressReducer";const EMAIL_PATTERN=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$/;export const validateValue=(val,name,type,resourceType)=>val?type==="email"&&isString(val)&&!val.match(EMAIL_PATTERN)?{field:name,code:"VALIDATION_ERROR",message:`${name} - is not valid`,resourceType}:{}:{field:name,code:"VALIDATION_ERROR",message:`${name} - is required`,resourceType};const validateFormFields=(fields,required,resourceType)=>{const errors=[];let values={metadata:{}};return map(fields,v=>{const val="checked"in v||(v.value==="on"?!1:v.value),attrName=v.getAttribute("name");if(attrName&&required.includes(attrName)||v.required){const error=validateValue(val,v.name,v.type,resourceType);isEmpty(error)||errors.push(error),values={...values,[`${v.name}`]:val}}v.getAttribute("name")&&(values=!!v.getAttribute("data-metadata")?{...values,metadata:{...values.metadata,[`${v.name}`]:val}}:{...values,[`${v.name}`]:val})}),{errors,values}};export const fieldsExist=(address,schema=addressFields)=>{if(address.business){const required=without(schema,"first_name","last_name"),validAddress=keys(address).filter(k=>required.includes(k));return required.length>validAddress.length}else{const required=without(schema,"line_2","company"),validAddress=keys(address).filter(k=>required.includes(k));return required.length>validAddress.length}};const businessOptionalFields=["billing_address_first_name","billing_address_last_name","shipping_address_first_name","shipping_address_last_name","first_name","last_name"],customerOptionalFields=["billing_address_company","shipping_address_company","company"];export function businessMandatoryField(fieldName,isBusiness){return!(isBusiness&&businessOptionalFields.includes(fieldName)||!isBusiness&&customerOptionalFields.includes(fieldName))}export default validateFormFields;