@commercelayer/react-components 4.3.5 → 4.4.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 (399) hide show
  1. package/lib/cjs/components/ExternalFunction.d.ts +1 -1
  2. package/lib/cjs/components/MetadataInput.d.ts +1 -1
  3. package/lib/cjs/components/SubmitButton.d.ts +2 -2
  4. package/lib/cjs/components/addresses/Address.d.ts +1 -1
  5. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +2 -2
  6. package/lib/cjs/components/addresses/AddressField.d.ts +3 -3
  7. package/lib/cjs/components/addresses/AddressInput.d.ts +2 -2
  8. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -1
  9. package/lib/cjs/components/addresses/AddressesContainer.d.ts +1 -1
  10. package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
  11. package/lib/cjs/components/addresses/AddressesEmpty.d.ts +1 -1
  12. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
  13. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
  14. package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
  15. package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +2 -2
  16. package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +1 -1
  17. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
  18. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +1 -1
  19. package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
  20. package/lib/cjs/components/customers/CustomerContainer.js +1 -1
  21. package/lib/cjs/components/customers/CustomerField.d.ts +2 -2
  22. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -1
  23. package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +1 -1
  24. package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
  25. package/lib/cjs/components/customers/SaveCustomerButton.d.ts +2 -2
  26. package/lib/cjs/components/errors/Errors.d.ts +1 -1
  27. package/lib/cjs/components/gift_cards/GiftCard.d.ts +1 -1
  28. package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +1 -1
  29. package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
  30. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  31. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -1
  32. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
  33. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
  34. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
  35. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
  36. package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -1
  37. package/lib/cjs/components/line_items/LineItemCode.d.ts +2 -2
  38. package/lib/cjs/components/line_items/LineItemField.d.ts +2 -2
  39. package/lib/cjs/components/line_items/LineItemImage.d.ts +2 -2
  40. package/lib/cjs/components/line_items/LineItemName.d.ts +1 -1
  41. package/lib/cjs/components/line_items/LineItemOption.d.ts +3 -3
  42. package/lib/cjs/components/line_items/LineItemOption.js +1 -1
  43. package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
  44. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
  45. package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +2 -2
  46. package/lib/cjs/components/line_items/LineItemsContainer.js +1 -1
  47. package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -1
  48. package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +1 -1
  49. package/lib/cjs/components/orders/AddToCartButton.d.ts +3 -3
  50. package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -1
  51. package/lib/cjs/components/orders/CartLink.d.ts +2 -2
  52. package/lib/cjs/components/orders/CheckoutLink.d.ts +1 -1
  53. package/lib/cjs/components/orders/DiscountAmount.d.ts +1 -1
  54. package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -1
  55. package/lib/cjs/components/orders/OrderContainer.d.ts +1 -1
  56. package/lib/cjs/components/orders/OrderContainer.js +1 -1
  57. package/lib/cjs/components/orders/OrderList.d.ts +2 -2
  58. package/lib/cjs/components/orders/OrderListEmpty.d.ts +1 -1
  59. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +1 -1
  60. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +1 -1
  61. package/lib/cjs/components/orders/OrderNumber.d.ts +1 -1
  62. package/lib/cjs/components/orders/OrderStorage.d.ts +1 -1
  63. package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +1 -1
  64. package/lib/cjs/components/orders/PlaceOrderButton.d.ts +2 -2
  65. package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
  66. package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +2 -2
  67. package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
  68. package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -1
  69. package/lib/cjs/components/orders/ShippingAmount.d.ts +1 -1
  70. package/lib/cjs/components/orders/SubTotalAmount.d.ts +1 -1
  71. package/lib/cjs/components/orders/TaxesAmount.d.ts +1 -1
  72. package/lib/cjs/components/orders/TotalAmount.d.ts +1 -1
  73. package/lib/cjs/components/parcels/ParcelField.d.ts +2 -2
  74. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +2 -2
  75. package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +1 -1
  76. package/lib/cjs/components/parcels/ParcelsCount.d.ts +1 -1
  77. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -1
  78. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  79. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  80. package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +1 -1
  81. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  82. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +2 -2
  83. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -1
  84. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -1
  85. package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -1
  86. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  87. package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
  88. package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +1 -1
  89. package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
  90. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +2 -2
  91. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
  92. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -1
  93. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +2 -2
  94. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +3 -5
  95. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +3 -3
  96. package/lib/cjs/components/payment_source/ExternalPayment.d.ts +2 -2
  97. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +2 -2
  98. package/lib/cjs/components/payment_source/KlarnaPayment.js +1 -1
  99. package/lib/cjs/components/payment_source/PaymentSource.d.ts +2 -2
  100. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
  101. package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
  102. package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
  103. package/lib/cjs/components/payment_source/PaypalPayment.d.ts +1 -1
  104. package/lib/cjs/components/payment_source/StripePayment.d.ts +7 -5
  105. package/lib/cjs/components/payment_source/StripePayment.js +1 -1
  106. package/lib/cjs/components/prices/Price.d.ts +2 -2
  107. package/lib/cjs/components/prices/PricesContainer.d.ts +1 -1
  108. package/lib/cjs/components/prices/PricesContainer.js +1 -1
  109. package/lib/cjs/components/shipments/Shipment.d.ts +1 -1
  110. package/lib/cjs/components/shipments/ShipmentField.d.ts +1 -1
  111. package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +1 -1
  112. package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
  113. package/lib/cjs/components/shipments/ShipmentsCount.d.ts +1 -1
  114. package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +1 -1
  115. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  116. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  117. package/lib/cjs/components/skus/AvailabilityContainer.d.ts +1 -1
  118. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -2
  119. package/lib/cjs/components/skus/SkuField.d.ts +2 -2
  120. package/lib/cjs/components/skus/SkuList.d.ts +1 -1
  121. package/lib/cjs/components/skus/SkuListsContainer.d.ts +1 -1
  122. package/lib/cjs/components/skus/Skus.d.ts +1 -1
  123. package/lib/cjs/components/skus/SkusContainer.d.ts +1 -1
  124. package/lib/cjs/components/skus/SkusContainer.js +1 -1
  125. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +2 -2
  126. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -1
  127. package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
  128. package/lib/cjs/components/utils/BaseField.d.ts +1 -1
  129. package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
  130. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +3 -3
  131. package/lib/cjs/components/utils/BaseSelect.d.ts +1 -1
  132. package/lib/cjs/components/utils/ErrorBoundary.d.ts +1 -1
  133. package/lib/cjs/components/utils/GenericFieldComponent.d.ts +7 -7
  134. package/lib/cjs/components/utils/Parent.d.ts +1 -1
  135. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +3 -3
  136. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
  137. package/lib/cjs/components/utils/getAllErrors.d.ts +3 -3
  138. package/lib/cjs/context/AddressChildrenContext.d.ts +1 -1
  139. package/lib/cjs/context/AddressContext.d.ts +2 -2
  140. package/lib/cjs/context/BillingAddressContext.d.ts +1 -1
  141. package/lib/cjs/context/BillingAddressFormContext.d.ts +5 -7
  142. package/lib/cjs/context/CouponAndGiftCardFormContext.d.ts +1 -1
  143. package/lib/cjs/context/CustomerAddressFormContext.d.ts +7 -9
  144. package/lib/cjs/context/CustomerContext.d.ts +1 -1
  145. package/lib/cjs/context/CustomerPaymentSourceContext.d.ts +1 -1
  146. package/lib/cjs/context/GiftCardContext.d.ts +2 -2
  147. package/lib/cjs/context/LineItemChildrenContext.d.ts +1 -1
  148. package/lib/cjs/context/LineItemContext.d.ts +2 -2
  149. package/lib/cjs/context/LineItemOptionChildrenContext.d.ts +5 -2
  150. package/lib/cjs/context/OrderContext.d.ts +3 -3
  151. package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -1
  152. package/lib/cjs/context/OrderListPaginationContext.d.ts +1 -1
  153. package/lib/cjs/context/PaymentMethodChildrenContext.d.ts +1 -1
  154. package/lib/cjs/context/PaymentMethodContext.d.ts +1 -1
  155. package/lib/cjs/context/PlaceOrderContext.d.ts +2 -2
  156. package/lib/cjs/context/PricesContext.d.ts +1 -1
  157. package/lib/cjs/context/ShipmentContext.d.ts +1 -1
  158. package/lib/cjs/context/ShippingAddressContext.d.ts +1 -1
  159. package/lib/cjs/context/ShippingAddressFormContext.d.ts +1 -1
  160. package/lib/cjs/context/ShippingMethodChildrenContext.d.ts +1 -1
  161. package/lib/cjs/context/SkuChildrenContext.d.ts +1 -1
  162. package/lib/cjs/context/SkuContext.d.ts +1 -1
  163. package/lib/cjs/context/StockTransferChildrenContext.d.ts +1 -1
  164. package/lib/cjs/reducers/AddressReducer.d.ts +6 -6
  165. package/lib/cjs/reducers/AvailabilityReducer.d.ts +4 -4
  166. package/lib/cjs/reducers/BillingAddressReducer.d.ts +4 -4
  167. package/lib/cjs/reducers/CustomerReducer.d.ts +4 -4
  168. package/lib/cjs/reducers/GiftCardReducer.d.ts +6 -6
  169. package/lib/cjs/reducers/LineItemReducer.d.ts +6 -6
  170. package/lib/cjs/reducers/OrderReducer.d.ts +6 -6
  171. package/lib/cjs/reducers/PaymentMethodReducer.d.ts +16 -12
  172. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +4 -1
  173. package/lib/cjs/reducers/PriceReducer.d.ts +6 -8
  174. package/lib/cjs/reducers/ShipmentReducer.d.ts +5 -5
  175. package/lib/cjs/reducers/ShippingAddressReducer.d.ts +4 -4
  176. package/lib/cjs/reducers/SkuListsReducer.d.ts +2 -2
  177. package/lib/cjs/reducers/SkuReducer.d.ts +4 -4
  178. package/lib/cjs/typings/errors.d.ts +1 -1
  179. package/lib/cjs/typings/index.d.ts +5 -9
  180. package/lib/cjs/utils/PropsType.d.ts +2 -2
  181. package/lib/cjs/utils/addressesManager.d.ts +3 -3
  182. package/lib/cjs/utils/baseReducer.d.ts +1 -1
  183. package/lib/cjs/utils/checkIncludeResource.d.ts +1 -1
  184. package/lib/cjs/utils/customMessages.d.ts +1 -1
  185. package/lib/cjs/utils/filterChildren.d.ts +1 -1
  186. package/lib/cjs/utils/getCardDetails.d.ts +3 -3
  187. package/lib/cjs/utils/getCardDetails.js +1 -1
  188. package/lib/cjs/utils/getErrors.d.ts +4 -3
  189. package/lib/cjs/utils/getLoaderComponent.d.ts +1 -1
  190. package/lib/cjs/utils/getPaymentAttributes.d.ts +3 -3
  191. package/lib/cjs/utils/getPrices.d.ts +2 -2
  192. package/lib/cjs/utils/getSdk.d.ts +1 -1
  193. package/lib/cjs/utils/getSkus.d.ts +1 -1
  194. package/lib/cjs/utils/hooks/useCustomContext.d.ts +1 -1
  195. package/lib/cjs/utils/localStorage.js +1 -1
  196. package/lib/cjs/utils/shipments.d.ts +1 -1
  197. package/lib/cjs/utils/validateFormFields.d.ts +6 -6
  198. package/lib/cjs/utils/validateFormFields.js +1 -1
  199. package/lib/esm/components/ExternalFunction.d.ts +1 -1
  200. package/lib/esm/components/MetadataInput.d.ts +1 -1
  201. package/lib/esm/components/SubmitButton.d.ts +2 -2
  202. package/lib/esm/components/addresses/Address.d.ts +1 -1
  203. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +2 -2
  204. package/lib/esm/components/addresses/AddressField.d.ts +3 -3
  205. package/lib/esm/components/addresses/AddressInput.d.ts +2 -2
  206. package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -1
  207. package/lib/esm/components/addresses/AddressesContainer.d.ts +1 -1
  208. package/lib/esm/components/addresses/AddressesContainer.js +1 -1
  209. package/lib/esm/components/addresses/AddressesEmpty.d.ts +1 -1
  210. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
  211. package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
  212. package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
  213. package/lib/esm/components/addresses/SaveAddressesButton.d.ts +2 -2
  214. package/lib/esm/components/addresses/ShippingAddressForm.d.ts +1 -1
  215. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
  216. package/lib/esm/components/customers/CustomerAddressForm.d.ts +1 -1
  217. package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
  218. package/lib/esm/components/customers/CustomerContainer.js +1 -1
  219. package/lib/esm/components/customers/CustomerField.d.ts +2 -2
  220. package/lib/esm/components/customers/CustomerInput.d.ts +1 -1
  221. package/lib/esm/components/customers/CustomerPaymentSource.d.ts +1 -1
  222. package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -1
  223. package/lib/esm/components/customers/SaveCustomerButton.d.ts +2 -2
  224. package/lib/esm/components/errors/Errors.d.ts +1 -1
  225. package/lib/esm/components/gift_cards/GiftCard.d.ts +1 -1
  226. package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +1 -1
  227. package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
  228. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -1
  229. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -1
  230. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
  231. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +2 -2
  232. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
  233. package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +2 -2
  234. package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -1
  235. package/lib/esm/components/line_items/LineItemCode.d.ts +2 -2
  236. package/lib/esm/components/line_items/LineItemField.d.ts +2 -2
  237. package/lib/esm/components/line_items/LineItemImage.d.ts +2 -2
  238. package/lib/esm/components/line_items/LineItemName.d.ts +1 -1
  239. package/lib/esm/components/line_items/LineItemOption.d.ts +3 -3
  240. package/lib/esm/components/line_items/LineItemOption.js +1 -1
  241. package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
  242. package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
  243. package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +2 -2
  244. package/lib/esm/components/line_items/LineItemsContainer.js +1 -1
  245. package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -1
  246. package/lib/esm/components/line_items/LineItemsEmpty.d.ts +1 -1
  247. package/lib/esm/components/orders/AddToCartButton.d.ts +3 -3
  248. package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -1
  249. package/lib/esm/components/orders/CartLink.d.ts +2 -2
  250. package/lib/esm/components/orders/CheckoutLink.d.ts +1 -1
  251. package/lib/esm/components/orders/DiscountAmount.d.ts +1 -1
  252. package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -1
  253. package/lib/esm/components/orders/OrderContainer.d.ts +1 -1
  254. package/lib/esm/components/orders/OrderContainer.js +1 -1
  255. package/lib/esm/components/orders/OrderList.d.ts +2 -2
  256. package/lib/esm/components/orders/OrderListEmpty.d.ts +1 -1
  257. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +1 -1
  258. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +1 -1
  259. package/lib/esm/components/orders/OrderNumber.d.ts +1 -1
  260. package/lib/esm/components/orders/OrderStorage.d.ts +1 -1
  261. package/lib/esm/components/orders/PaymentMethodAmount.d.ts +1 -1
  262. package/lib/esm/components/orders/PlaceOrderButton.d.ts +2 -2
  263. package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
  264. package/lib/esm/components/orders/PlaceOrderContainer.d.ts +2 -2
  265. package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
  266. package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -1
  267. package/lib/esm/components/orders/ShippingAmount.d.ts +1 -1
  268. package/lib/esm/components/orders/SubTotalAmount.d.ts +1 -1
  269. package/lib/esm/components/orders/TaxesAmount.d.ts +1 -1
  270. package/lib/esm/components/orders/TotalAmount.d.ts +1 -1
  271. package/lib/esm/components/parcels/ParcelField.d.ts +2 -2
  272. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +2 -2
  273. package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +1 -1
  274. package/lib/esm/components/parcels/ParcelsCount.d.ts +1 -1
  275. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -1
  276. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -1
  277. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -1
  278. package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +1 -1
  279. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -1
  280. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +2 -2
  281. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -1
  282. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -1
  283. package/lib/esm/components/payment_gateways/StripeGateway.js +1 -1
  284. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -1
  285. package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
  286. package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +1 -1
  287. package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +1 -1
  288. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +2 -2
  289. package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +2 -2
  290. package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -1
  291. package/lib/esm/components/payment_source/AdyenPayment.d.ts +2 -2
  292. package/lib/esm/components/payment_source/BraintreePayment.d.ts +3 -5
  293. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +3 -3
  294. package/lib/esm/components/payment_source/ExternalPayment.d.ts +2 -2
  295. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +2 -2
  296. package/lib/esm/components/payment_source/KlarnaPayment.js +1 -1
  297. package/lib/esm/components/payment_source/PaymentSource.d.ts +2 -2
  298. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
  299. package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
  300. package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +2 -2
  301. package/lib/esm/components/payment_source/PaypalPayment.d.ts +1 -1
  302. package/lib/esm/components/payment_source/StripePayment.d.ts +7 -5
  303. package/lib/esm/components/payment_source/StripePayment.js +1 -1
  304. package/lib/esm/components/prices/Price.d.ts +2 -2
  305. package/lib/esm/components/prices/PricesContainer.d.ts +1 -1
  306. package/lib/esm/components/prices/PricesContainer.js +1 -1
  307. package/lib/esm/components/shipments/Shipment.d.ts +1 -1
  308. package/lib/esm/components/shipments/ShipmentField.d.ts +1 -1
  309. package/lib/esm/components/shipments/ShipmentsContainer.d.ts +1 -1
  310. package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
  311. package/lib/esm/components/shipments/ShipmentsCount.d.ts +1 -1
  312. package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +1 -1
  313. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +1 -1
  314. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -1
  315. package/lib/esm/components/skus/AvailabilityContainer.d.ts +1 -1
  316. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -2
  317. package/lib/esm/components/skus/SkuField.d.ts +2 -2
  318. package/lib/esm/components/skus/SkuList.d.ts +1 -1
  319. package/lib/esm/components/skus/SkuListsContainer.d.ts +1 -1
  320. package/lib/esm/components/skus/Skus.d.ts +1 -1
  321. package/lib/esm/components/skus/SkusContainer.d.ts +1 -1
  322. package/lib/esm/components/skus/SkusContainer.js +1 -1
  323. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +2 -2
  324. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -1
  325. package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
  326. package/lib/esm/components/utils/BaseField.d.ts +1 -1
  327. package/lib/esm/components/utils/BaseInput.d.ts +1 -1
  328. package/lib/esm/components/utils/BaseOrderPrice.d.ts +3 -3
  329. package/lib/esm/components/utils/BaseSelect.d.ts +1 -1
  330. package/lib/esm/components/utils/ErrorBoundary.d.ts +1 -1
  331. package/lib/esm/components/utils/GenericFieldComponent.d.ts +7 -7
  332. package/lib/esm/components/utils/Parent.d.ts +1 -1
  333. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +3 -3
  334. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
  335. package/lib/esm/components/utils/getAllErrors.d.ts +3 -3
  336. package/lib/esm/context/AddressChildrenContext.d.ts +1 -1
  337. package/lib/esm/context/AddressContext.d.ts +2 -2
  338. package/lib/esm/context/BillingAddressContext.d.ts +1 -1
  339. package/lib/esm/context/BillingAddressFormContext.d.ts +5 -7
  340. package/lib/esm/context/CouponAndGiftCardFormContext.d.ts +1 -1
  341. package/lib/esm/context/CustomerAddressFormContext.d.ts +7 -9
  342. package/lib/esm/context/CustomerContext.d.ts +1 -1
  343. package/lib/esm/context/CustomerPaymentSourceContext.d.ts +1 -1
  344. package/lib/esm/context/GiftCardContext.d.ts +2 -2
  345. package/lib/esm/context/LineItemChildrenContext.d.ts +1 -1
  346. package/lib/esm/context/LineItemContext.d.ts +2 -2
  347. package/lib/esm/context/LineItemOptionChildrenContext.d.ts +5 -2
  348. package/lib/esm/context/OrderContext.d.ts +3 -3
  349. package/lib/esm/context/OrderListChildrenContext.d.ts +1 -1
  350. package/lib/esm/context/OrderListPaginationContext.d.ts +1 -1
  351. package/lib/esm/context/PaymentMethodChildrenContext.d.ts +1 -1
  352. package/lib/esm/context/PaymentMethodContext.d.ts +1 -1
  353. package/lib/esm/context/PlaceOrderContext.d.ts +2 -2
  354. package/lib/esm/context/PricesContext.d.ts +1 -1
  355. package/lib/esm/context/ShipmentContext.d.ts +1 -1
  356. package/lib/esm/context/ShippingAddressContext.d.ts +1 -1
  357. package/lib/esm/context/ShippingAddressFormContext.d.ts +1 -1
  358. package/lib/esm/context/ShippingMethodChildrenContext.d.ts +1 -1
  359. package/lib/esm/context/SkuChildrenContext.d.ts +1 -1
  360. package/lib/esm/context/SkuContext.d.ts +1 -1
  361. package/lib/esm/context/StockTransferChildrenContext.d.ts +1 -1
  362. package/lib/esm/reducers/AddressReducer.d.ts +6 -6
  363. package/lib/esm/reducers/AvailabilityReducer.d.ts +4 -4
  364. package/lib/esm/reducers/BillingAddressReducer.d.ts +4 -4
  365. package/lib/esm/reducers/CustomerReducer.d.ts +4 -4
  366. package/lib/esm/reducers/GiftCardReducer.d.ts +6 -6
  367. package/lib/esm/reducers/LineItemReducer.d.ts +6 -6
  368. package/lib/esm/reducers/OrderReducer.d.ts +6 -6
  369. package/lib/esm/reducers/PaymentMethodReducer.d.ts +16 -12
  370. package/lib/esm/reducers/PlaceOrderReducer.d.ts +4 -1
  371. package/lib/esm/reducers/PriceReducer.d.ts +6 -8
  372. package/lib/esm/reducers/ShipmentReducer.d.ts +5 -5
  373. package/lib/esm/reducers/ShippingAddressReducer.d.ts +4 -4
  374. package/lib/esm/reducers/SkuListsReducer.d.ts +2 -2
  375. package/lib/esm/reducers/SkuReducer.d.ts +4 -4
  376. package/lib/esm/typings/errors.d.ts +1 -1
  377. package/lib/esm/typings/index.d.ts +5 -9
  378. package/lib/esm/utils/PropsType.d.ts +2 -2
  379. package/lib/esm/utils/addressesManager.d.ts +3 -3
  380. package/lib/esm/utils/baseReducer.d.ts +1 -1
  381. package/lib/esm/utils/checkIncludeResource.d.ts +1 -1
  382. package/lib/esm/utils/customMessages.d.ts +1 -1
  383. package/lib/esm/utils/filterChildren.d.ts +1 -1
  384. package/lib/esm/utils/getCardDetails.d.ts +3 -3
  385. package/lib/esm/utils/getCardDetails.js +1 -1
  386. package/lib/esm/utils/getErrors.d.ts +4 -3
  387. package/lib/esm/utils/getLoaderComponent.d.ts +1 -1
  388. package/lib/esm/utils/getPaymentAttributes.d.ts +3 -3
  389. package/lib/esm/utils/getPrices.d.ts +2 -2
  390. package/lib/esm/utils/getSdk.d.ts +1 -1
  391. package/lib/esm/utils/getSkus.d.ts +1 -1
  392. package/lib/esm/utils/hooks/useCustomContext.d.ts +1 -1
  393. package/lib/esm/utils/localStorage.js +1 -1
  394. package/lib/esm/utils/shipments.d.ts +1 -1
  395. package/lib/esm/utils/validateFormFields.d.ts +6 -6
  396. package/lib/esm/utils/validateFormFields.js +1 -1
  397. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  398. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  399. package/package.json +12 -12
@@ -1,4 +1,4 @@
1
- import { ChildrenFunction } from '../../typings/index';
1
+ import { type ChildrenFunction } from '../../typings/index';
2
2
  interface ChildrenProps extends Omit<Props, 'children'> {
3
3
  labelName: string;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { BaseAmountComponent } from '../../typings/index';
1
+ import { type BaseAmountComponent } from '../../typings/index';
2
2
  interface Props extends BaseAmountComponent {
3
3
  type?: 'amount';
4
4
  labelFree?: string;
@@ -1,6 +1,6 @@
1
- import { ChangeEvent } from 'react';
1
+ import { type ChangeEvent } from 'react';
2
2
  import type { Order, PaymentMethod } from '@commercelayer/sdk';
3
- import { ChildrenFunction } from '../../typings/index';
3
+ import { type ChildrenFunction } from '../../typings/index';
4
4
  interface ChildrenProps extends Omit<Props, 'children'> {
5
5
  checked: boolean;
6
6
  handleOnChange: (event: ChangeEvent<HTMLInputElement>) => Promise<void>;
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
1
+ import { type ReactNode } from 'react';
2
+ import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
3
3
  interface Props {
4
4
  children: ReactNode;
5
5
  config?: PaymentMethodConfig;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext,{defaultPaymentMethodContext}from"../../context/PaymentMethodContext";import{useContext,useEffect,useReducer,useMemo}from"react";import paymentMethodReducer,{paymentMethodInitialState,getPaymentMethods,setPaymentMethodConfig,setPaymentRef}from"../../reducers/PaymentMethodReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";import useCustomContext from"../../utils/hooks/useCustomContext";export function PaymentMethodsContainer(props){const{children,config}=props,[state,dispatch]=useReducer(paymentMethodReducer,paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"PaymentMethodsContainer",key:"order"}),credentials=useContext(CommerceLayerContext);async function getPayMethods(){order&&await getPaymentMethods({order,dispatch})}useEffect(()=>{include?.includes("available_payment_methods")?includeLoaded?.available_payment_methods||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0,"line_items.item":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option","line_items.item"]}),config&&isEmpty(state.config)&&setPaymentMethodConfig(config,dispatch),credentials&&order&&!state.paymentMethods&&getPayMethods(),order?.payment_source&&dispatch({type:"setPaymentSource",payload:{paymentSource:order?.payment_source}}),order?.payment_source===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include?.length,Object.keys(includeLoaded??[]).length]);const contextValue=useMemo(()=>({...state,setLoading:({loading})=>defaultPaymentMethodContext.setLoading({loading,dispatch}),setPaymentRef:({ref})=>setPaymentRef({ref,dispatch}),setPaymentMethodErrors:errors=>defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch),setPaymentMethod:async args=>await defaultPaymentMethodContext.setPaymentMethod({...args,config:credentials,updateOrder,order,dispatch,setOrderErrors}),setPaymentSource:async args=>await defaultPaymentMethodContext.setPaymentSource({...state,...args,config:credentials,dispatch,getOrder,updateOrder,order}),updatePaymentSource:async args=>await defaultPaymentMethodContext.updatePaymentSource({...args,config:credentials,dispatch}),destroyPaymentSource:async args=>await defaultPaymentMethodContext.destroyPaymentSource({...args,dispatch,config:credentials,updateOrder,orderId:order?.id})}),[state]);return _jsx(PaymentMethodContext.Provider,{value:contextValue,children})}export default PaymentMethodsContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext,{defaultPaymentMethodContext}from"../../context/PaymentMethodContext";import{useContext,useEffect,useReducer,useMemo}from"react";import paymentMethodReducer,{paymentMethodInitialState,getPaymentMethods,setPaymentMethodConfig,setPaymentRef}from"../../reducers/PaymentMethodReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";import useCustomContext from"../../utils/hooks/useCustomContext";export function PaymentMethodsContainer(props){const{children,config}=props,[state,dispatch]=useReducer(paymentMethodReducer,paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"PaymentMethodsContainer",key:"order"}),credentials=useContext(CommerceLayerContext);async function getPayMethods(){order&&await getPaymentMethods({order,dispatch})}useEffect(()=>{include?.includes("available_payment_methods")?includeLoaded?.available_payment_methods||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0,"line_items.item":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option","line_items.item"]}),config&&isEmpty(state.config)&&setPaymentMethodConfig(config,dispatch),credentials&&order&&!state.paymentMethods&&getPayMethods(),order?.payment_source&&dispatch({type:"setPaymentSource",payload:{paymentSource:order?.payment_source}}),order?.payment_source===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include?.length,Object.keys(includeLoaded??[]).length]);const contextValue=useMemo(()=>({...state,setLoading:({loading})=>{defaultPaymentMethodContext.setLoading({loading,dispatch})},setPaymentRef:({ref})=>{setPaymentRef({ref,dispatch})},setPaymentMethodErrors:errors=>{defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch)},setPaymentMethod:async args=>await defaultPaymentMethodContext.setPaymentMethod({...args,config:credentials,updateOrder,order,dispatch,setOrderErrors}),setPaymentSource:async args=>await defaultPaymentMethodContext.setPaymentSource({...state,...args,config:credentials,dispatch,getOrder,updateOrder,order}),updatePaymentSource:async args=>{await defaultPaymentMethodContext.updatePaymentSource({...args,config:credentials,dispatch})},destroyPaymentSource:async args=>{await defaultPaymentMethodContext.destroyPaymentSource({...args,dispatch,config:credentials,updateOrder,orderId:order?.id})}}),[state]);return _jsx(PaymentMethodContext.Provider,{value:contextValue,children})}export default PaymentMethodsContainer;
@@ -1,5 +1,5 @@
1
- import { CSSProperties } from 'react';
2
- import { PaymentSourceProps } from './PaymentSource';
1
+ import { type CSSProperties } from 'react';
2
+ import { type PaymentSourceProps } from './PaymentSource';
3
3
  type Styles = Partial<{
4
4
  base: CSSProperties;
5
5
  error: CSSProperties;
@@ -1,5 +1,5 @@
1
- import { HostedFieldFieldOptions } from 'braintree-web/modules/hosted-fields';
2
- import { PaymentSourceProps } from './PaymentSource';
1
+ import { type HostedFieldFieldOptions } from 'braintree-web/modules/hosted-fields';
2
+ import { type PaymentSourceProps } from './PaymentSource';
3
3
  type BraintreeHostedFields<Type> = {
4
4
  [Property in keyof Type]: {
5
5
  label?: string;
@@ -15,9 +15,7 @@ export interface BraintreeConfig {
15
15
  fieldLabelClassName?: string;
16
16
  inputWrapperClassName?: string;
17
17
  fields?: BraintreeHostedFields<HostedFieldFieldOptions>;
18
- styles?: {
19
- [key: string]: Record<string, string>;
20
- };
18
+ styles?: Record<string, Record<string, string>>;
21
19
  }
22
20
  interface Props {
23
21
  authorization: string;
@@ -1,6 +1,6 @@
1
- import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
2
- import { PaymentSourceProps } from './PaymentSource';
3
- import { FramesStyle } from 'frames-react';
1
+ import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
2
+ import { type PaymentSourceProps } from './PaymentSource';
3
+ import { type FramesStyle } from 'frames-react';
4
4
  export interface CheckoutComConfig {
5
5
  containerClassName?: string;
6
6
  hintLabel?: string;
@@ -1,6 +1,6 @@
1
- import { ChildrenFunction } from '../../typings/index';
1
+ import { type ChildrenFunction } from '../../typings/index';
2
2
  import type { StripeElementLocale } from '@stripe/stripe-js';
3
- import { PaymentSourceProps } from './PaymentSource';
3
+ import { type PaymentSourceProps } from './PaymentSource';
4
4
  export interface ExternalPaymentConfig {
5
5
  /**
6
6
  * Show the component. Default is false
@@ -1,5 +1,5 @@
1
- import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
2
- import { PaymentSourceProps } from './PaymentSource';
1
+ import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
2
+ import { type PaymentSourceProps } from './PaymentSource';
3
3
  type KlarnaPaymentProps = PaymentMethodConfig['klarnaPayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
4
4
  show?: boolean;
5
5
  clientToken: string;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import OrderContext from"../../context/OrderContext";import useExternalScript from"../../utils/hooks/useExternalScript";import PlaceOrderContext from"../../context/PlaceOrderContext";function typeOfLine(lineItemType){switch(lineItemType){case"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical";case"payment_methods":default:return null}}function klarnaOrderLines(lineItems){return lineItems?lineItems.map(item=>{const type=item.item_type?typeOfLine(item.item_type):null;return{name:item.name,quantity:item.quantity,total_amount:item.total_amount_cents,unit_price:item.unit_amount_cents,type}}):[]}export default function KlarnaPayment({clientToken,placeOrderCallback,locale="EN",...p}){const ref=useRef(null),{paymentSource,currentPaymentMethodType,setPaymentRef,setPaymentSource,setPaymentMethodErrors}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{setPlaceOrder}=useContext(PlaceOrderContext),loaded=useExternalScript("https://x.klarnacdn.net/kp/lib/v1/api.js"),[klarna,setKlarna]=useState(),{containerClassName,...divProps}=p;useEffect(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),useEffect(()=>(ref.current&&paymentSource&&currentPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=async()=>await handleClick(klarna),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=async kl=>{const[first]=paymentSource?.payment_methods||void 0,paymentMethodCategory=first?.identifier,billingAddress={given_name:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:null,organization_name:null,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shippingAddress={given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,email:order?.customer_email,street_address:order?.shipping_address?.line_1,street_address2:null,postal_code:order?.shipping_address?.zip_code,organization_name:null,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code},klarnaData={merchant_data:order?.id,purchase_country:order?.country_code,purchase_currency:order?.currency_code,locale,shipping_address:shippingAddress,billing_address:billingAddress,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items)};try{kl.Payments.load({container:"#klarna-payments-container",payment_method_category:paymentMethodCategory},{billing_address:billingAddress,shipping_address:shippingAddress},async function({show_form}){if(show_form)try{await kl.Payments.authorize({payment_method_category:paymentMethodCategory},klarnaData,async function(res){if(res.approved&&paymentSource&&currentPaymentMethodType){const ps=await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{auth_token:res.authorization_token}}),{placed}=setPlaceOrder&&ps&&await setPlaceOrder({paymentSource:ps})||{placed:!1};placed&&placeOrderCallback&&placeOrderCallback({placed})}})}catch(e){console.error("e",e),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:"Authorization error"}])}})}catch(e){console.error("Load Klarna libray",e)}};if(klarna&&clientToken){const[first]=paymentSource?.payment_methods||void 0;klarna.Payments.init({client_token:clientToken}),klarna.Payments.load({container:"#klarna-payments-container",payment_method_category:first?.identifier},{billing_address:{given_name:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:order?.billing_address?.line_2,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shipping_address:{given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,street_address:order?.shipping_address?.line_1,street_address2:order?.shipping_address?.line_2,postal_code:order?.shipping_address?.zip_code,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code}})}return _jsx("form",{ref,children:_jsx("div",{className:containerClassName,...divProps,children:_jsx("div",{id:"klarna-payments-container"})})})}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import OrderContext from"../../context/OrderContext";import useExternalScript from"../../utils/hooks/useExternalScript";import PlaceOrderContext from"../../context/PlaceOrderContext";function typeOfLine(lineItemType){switch(lineItemType){case"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical";case"payment_methods":default:return null}}function klarnaOrderLines(lineItems){return lineItems?lineItems.map(item=>{const type=item.item_type?typeOfLine(item.item_type):null;return{name:item.name,quantity:item.quantity,total_amount:item.total_amount_cents,unit_price:item.unit_amount_cents,type}}):[]}export default function KlarnaPayment({clientToken,placeOrderCallback,locale="EN",...p}){const ref=useRef(null),{paymentSource,currentPaymentMethodType,setPaymentRef,setPaymentSource,setPaymentMethodErrors}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{setPlaceOrder}=useContext(PlaceOrderContext),loaded=useExternalScript("https://x.klarnacdn.net/kp/lib/v1/api.js"),[klarna,setKlarna]=useState(),{containerClassName,...divProps}=p;useEffect(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),useEffect(()=>(ref.current&&paymentSource&&currentPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=async()=>{await handleClick(klarna)},setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=async kl=>{const[first]=paymentSource?.payment_methods||void 0,paymentMethodCategory=first?.identifier,billingAddress={given_name:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:null,organization_name:null,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shippingAddress={given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,email:order?.customer_email,street_address:order?.shipping_address?.line_1,street_address2:null,postal_code:order?.shipping_address?.zip_code,organization_name:null,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code},klarnaData={merchant_data:order?.id,purchase_country:order?.country_code,purchase_currency:order?.currency_code,locale,shipping_address:shippingAddress,billing_address:billingAddress,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items)};try{kl.Payments.load({container:"#klarna-payments-container",payment_method_category:paymentMethodCategory},{billing_address:billingAddress,shipping_address:shippingAddress},async function({show_form}){if(show_form)try{await kl.Payments.authorize({payment_method_category:paymentMethodCategory},klarnaData,async function(res){if(res.approved&&paymentSource&&currentPaymentMethodType){const ps=await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{auth_token:res.authorization_token}}),{placed}=setPlaceOrder&&ps&&await setPlaceOrder({paymentSource:ps})||{placed:!1};placed&&placeOrderCallback&&placeOrderCallback({placed})}})}catch(e){console.error("e",e),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:"Authorization error"}])}})}catch(e){console.error("Load Klarna libray",e)}};if(klarna&&clientToken){const[first]=paymentSource?.payment_methods||void 0;klarna.Payments.init({client_token:clientToken}),klarna.Payments.load({container:"#klarna-payments-container",payment_method_category:first?.identifier},{billing_address:{given_name:order?.billing_address?.first_name,family_name:order?.billing_address?.last_name,email:order?.customer_email,street_address:order?.billing_address?.line_1,street_address2:order?.billing_address?.line_2,postal_code:order?.billing_address?.zip_code,city:order?.billing_address?.city,region:order?.billing_address?.state_code,phone:order?.billing_address?.phone,country:order?.billing_address?.country_code},shipping_address:{given_name:order?.shipping_address?.first_name,family_name:order?.shipping_address?.last_name,street_address:order?.shipping_address?.line_1,street_address2:order?.shipping_address?.line_2,postal_code:order?.shipping_address?.zip_code,city:order?.shipping_address?.city,region:order?.shipping_address?.state_code,phone:order?.shipping_address?.phone,country:order?.shipping_address?.country_code}})}return _jsx("form",{ref,children:_jsx("div",{className:containerClassName,...divProps,children:_jsx("div",{id:"klarna-payments-container"})})})}
@@ -1,5 +1,5 @@
1
- import { LoaderType } from '../../typings/index';
2
- import { CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
1
+ import { type LoaderType } from '../../typings/index';
2
+ import { type CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
3
3
  export interface CustomerCardsProps {
4
4
  handleClick: () => void;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { IconBrand } from '../../context/PaymentSourceContext';
2
- import { ChildrenFunction } from '../../typings/index';
1
+ import { type IconBrand } from '../../context/PaymentSourceContext';
2
+ import { type ChildrenFunction } from '../../typings/index';
3
3
  interface ChildrenProps extends Omit<Props, 'children'> {
4
4
  brand: IconBrand;
5
5
  defaultSrc: string;
@@ -1,5 +1,5 @@
1
- import { IconBrand } from '../../context/PaymentSourceContext';
2
- import { ChildrenFunction } from '../../typings/index';
1
+ import { type IconBrand } from '../../context/PaymentSourceContext';
2
+ import { type ChildrenFunction } from '../../typings/index';
3
3
  interface CustomComponent extends Omit<Props, 'children'> {
4
4
  brand: IconBrand;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- import { ChildrenFunction } from '../../typings/index';
1
+ import { type ReactNode } from 'react';
2
+ import { type ChildrenFunction } from '../../typings/index';
3
3
  interface CustomComponent extends Omit<Props, 'children'> {
4
4
  }
5
5
  type Props = {
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  export interface PaypalConfig {
3
3
  return_url: string;
4
4
  cancel_url: string;
@@ -1,17 +1,19 @@
1
- import { StripeCardElementOptions, StripeElementLocale } from '@stripe/stripe-js';
2
- import { PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
3
- import { PaymentSourceProps } from './PaymentSource';
1
+ import { type StripeElementLocale, type StripeElementsOptions, type StripePaymentElementOptions } from '@stripe/stripe-js';
2
+ import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
3
+ import { type PaymentSourceProps } from './PaymentSource';
4
4
  export interface StripeConfig {
5
5
  containerClassName?: string;
6
6
  hintLabel?: string;
7
7
  name?: string;
8
- options?: StripeCardElementOptions;
8
+ options?: StripePaymentElementOptions;
9
+ appearance?: StripeElementsOptions['appearance'];
9
10
  [key: string]: any;
10
11
  }
11
12
  type Props = PaymentMethodConfig['stripePayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
12
13
  show?: boolean;
13
14
  publishableKey: string;
14
15
  locale?: StripeElementLocale;
16
+ clientSecret: string;
15
17
  };
16
- export declare function StripePayment({ publishableKey, show, options, locale, ...p }: Props): JSX.Element | null;
18
+ export declare function StripePayment({ publishableKey, show, options, clientSecret, locale, ...p }: Props): JSX.Element | null;
17
19
  export default StripePayment;
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{CardElement,Elements,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{setCustomerOrderParam}from"../../utils/localStorage";const defaultOptions={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode:!0};function StripePaymentForm({options=defaultOptions,templateCustomerSaveToWallet}){const ref=useRef(null),{setPaymentSource,currentPaymentMethodType,setPaymentMethodErrors,setPaymentRef,paymentSource}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),stripe=useStripe(),elements=useElements();useEffect(()=>(ref.current&&stripe&&elements&&paymentSource&&(ref.current.onsubmit=async paymentSource2=>await onSubmit({event:ref.current,stripe,elements,paymentSource:paymentSource2}),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,stripe,elements,paymentSource]);const onSubmit=async({event,stripe:stripe2,elements:elements2,paymentSource:ps})=>{if(!stripe2)return!1;const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet);const cardElement=elements2?.getElement(CardElement);if(cardElement){const billingInfo=order?.billing_address,email=order?.customer_email,billingDetails={name:billingInfo?.full_name,email,phone:billingInfo?.phone,address:{city:billingInfo?.city,country:billingInfo?.country_code,line1:billingInfo?.line_1,postal_code:billingInfo?.zip_code,state:billingInfo?.state_code}},{paymentMethod}=await stripe2.createPaymentMethod({type:"card",card:cardElement,billing_details:billingDetails}),clientSecret=ps?.client_secret,paymentSourceId=ps?.id;if(clientSecret){const{error,paymentIntent}=await stripe2.confirmCardPayment(clientSecret,{payment_method:{card:cardElement,billing_details:billingDetails}});if(error)return console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1;if(paymentIntent&&paymentMethod&&paymentSourceId&&currentPaymentMethodType)try{return await setPaymentSource({paymentSourceId,paymentResource:currentPaymentMethodType,attributes:{options:{...paymentMethod,setup_future_usage:"off_session"}}}),!0}catch{return!1}}}return!1};return _jsxs("form",{ref,children:[_jsx(CardElement,{options:{...defaultOptions,...options}}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]})}export function StripePayment({publishableKey,show,options,locale="auto",...p}){const[isLoaded,setIsLoaded]=useState(!1),[stripe,setStripe]=useState(null),{containerClassName,templateCustomerSaveToWallet,fonts=[],...divProps}=p;return useEffect(()=>(show&&publishableKey&&import("@stripe/stripe-js").then(({loadStripe})=>{(async()=>{const res=await loadStripe(publishableKey,{locale});res!=null&&(setStripe(res),setIsLoaded(!0))})()}),()=>{setIsLoaded(!1)}),[show,publishableKey]),isLoaded&&stripe?_jsx("div",{className:containerClassName,...divProps,children:_jsx(Elements,{stripe,options:{fonts},children:_jsx(StripePaymentForm,{options,templateCustomerSaveToWallet})})}):null}export default StripePayment;
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{Elements,PaymentElement,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"../utils/Parent";import{setCustomerOrderParam}from"../../utils/localStorage";import OrderContext from"../../context/OrderContext";const defaultOptions={layout:{type:"accordion",defaultCollapsed:!1,radios:!0,spacedAccordionItems:!1},fields:{billingDetails:"never"}},defaultAppearance={theme:"stripe",variables:{colorText:"#32325d",fontFamily:'"Helvetica Neue", Helvetica, sans-serif'}};function StripePaymentForm({options=defaultOptions,templateCustomerSaveToWallet}){const ref=useRef(null),{currentPaymentMethodType,setPaymentMethodErrors,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),stripe=useStripe(),elements=useElements();useEffect(()=>(ref.current&&stripe&&elements&&(ref.current.onsubmit=async()=>await onSubmit({event:ref.current,stripe,elements}),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,stripe,elements]);const onSubmit=async({event,stripe:stripe2,elements:elements2})=>{if(!stripe2)return!1;const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;if(savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),elements2!=null){const billingInfo=order?.billing_address,email=order?.customer_email,billingDetails={name:billingInfo?.full_name,email,phone:billingInfo?.phone,address:{city:billingInfo?.city,country:billingInfo?.country_code,line1:billingInfo?.line_1,line2:billingInfo?.line_2,postal_code:billingInfo?.zip_code,state:billingInfo?.state_code}},{error}=await stripe2.confirmPayment({elements:elements2,confirmParams:{return_url:window.location.href,payment_method_data:{billing_details:billingDetails}}});return error?(console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1):!0}return!1};return _jsxs("form",{ref,children:[_jsx(PaymentElement,{id:"payment-element",options:{...defaultOptions,...options}}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]})}export function StripePayment({publishableKey,show,options,clientSecret,locale="auto",...p}){const[isLoaded,setIsLoaded]=useState(!1),[stripe,setStripe]=useState(null),{containerClassName,templateCustomerSaveToWallet,fonts=[],appearance,...divProps}=p;useEffect(()=>(show&&publishableKey&&import("@stripe/stripe-js").then(({loadStripe})=>{(async()=>{const res=await loadStripe(publishableKey,{locale});res!=null&&(setStripe(res),setIsLoaded(!0))})()}),()=>{setIsLoaded(!1)}),[show,publishableKey]);const elementsOptions={clientSecret,appearance:{...defaultAppearance,...appearance},fonts};return isLoaded&&stripe!=null&&clientSecret!=null?_jsx("div",{className:containerClassName,...divProps,children:_jsx(Elements,{stripe,options:elementsOptions,children:_jsx(StripePaymentForm,{options,templateCustomerSaveToWallet})})}):null}export default StripePayment;
@@ -1,5 +1,5 @@
1
- import { Price as PriceType } from '@commercelayer/sdk';
2
- import { ChildrenFunction, LoaderType } from '../../typings/index';
1
+ import { type Price as PriceType } from '@commercelayer/sdk';
2
+ import { type ChildrenFunction, type LoaderType } from '../../typings/index';
3
3
  interface PriceChildrenProps extends Omit<PriceProps, 'children'> {
4
4
  loading: boolean;
5
5
  loader: LoaderType;
@@ -1,4 +1,4 @@
1
- import { LoaderType } from '../../typings/index';
1
+ import { type LoaderType } from '../../typings/index';
2
2
  interface Props {
3
3
  children: JSX.Element | JSX.Element[];
4
4
  filters?: object;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import CommerceLayerContext from"../../context/CommerceLayerContext";import priceReducer,{priceInitialState,getSkusPrice,setSkuCodes}from"../../reducers/PriceReducer";import PricesContext from"../../context/PricesContext";import SkuContext from"../../context/SkuContext";export function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{skuCodes}=useContext(SkuContext);!state.skuCodes.includes(skuCode)&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode??"";useEffect(()=>{state.skuCodes.length===0&&skuCodes!=null&&skuCodes.length>0&&state.setSkuCodes!=null&&state.setSkuCodes({skuCodes,dispatch}),config.accessToken&&(state.skuCodes.length>0||sCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,perPage,filters})},[config.accessToken,sCode,state.skuCodes.length]);const priceValue={...state,skuCode:sCode,loader,setSkuCodes:params=>setSkuCodes({...params,dispatch})};return _jsx(PricesContext.Provider,{value:priceValue,children})}export default PricesContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import CommerceLayerContext from"../../context/CommerceLayerContext";import priceReducer,{priceInitialState,getSkusPrice,setSkuCodes}from"../../reducers/PriceReducer";import PricesContext from"../../context/PricesContext";import SkuContext from"../../context/SkuContext";export function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{skuCodes}=useContext(SkuContext);!state.skuCodes.includes(skuCode)&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode??"";useEffect(()=>{state.skuCodes.length===0&&skuCodes!=null&&skuCodes.length>0&&state.setSkuCodes!=null&&state.setSkuCodes({skuCodes,dispatch}),config.accessToken&&(state.skuCodes.length>0||sCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,perPage,filters})},[config.accessToken,sCode,state.skuCodes.length]);const priceValue={...state,skuCode:sCode,loader,setSkuCodes:params=>{setSkuCodes({...params,dispatch})}};return _jsx(PricesContext.Provider,{value:priceValue,children})}export default PricesContainer;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  import type { LoaderType } from '../../typings/index';
3
3
  import type { Order } from '@commercelayer/sdk';
4
4
  interface ShipmentProps {
@@ -1,4 +1,4 @@
1
- import { Shipment } from '@commercelayer/sdk';
1
+ import { type Shipment } from '@commercelayer/sdk';
2
2
  type ShipmentFieldChildrenProps = Omit<Props, 'children'> & {
3
3
  shipment: Shipment;
4
4
  };
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  }
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../../context/ShipmentContext";import{useContext,useEffect,useMemo,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../../reducers/ShipmentReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";export function ShipmentsContainer(props){const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.stock_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0,"shipments.parcels.parcel_line_items":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.stock_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location","shipments.parcels.parcel_line_items"]})},[include?.length,includeLoaded!=null]),useEffect(()=>{order!=null&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order!=null,order?.shipments?.length]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type:itemType})=>itemType==="skus").map(lineItem=>!!(lineItem.item?.do_not_ship||lineItem.item?.do_not_track||lineItem.item?.inventory?.quantity>=lineItem?.quantity)).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order?.shipments]);const contextValue=useMemo(()=>({...state,setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})}),[state]);return _jsx(ShipmentContext.Provider,{value:contextValue,children})}export default ShipmentsContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../../context/ShipmentContext";import{useContext,useEffect,useMemo,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../../reducers/ShipmentReducer";import OrderContext from"../../context/OrderContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import isEmpty from"lodash/isEmpty";export function ShipmentsContainer(props){const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.stock_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0,"shipments.parcels.parcel_line_items":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.stock_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location","shipments.parcels.parcel_line_items"]})},[include?.length,includeLoaded!=null]),useEffect(()=>{order!=null&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order!=null,order?.shipments?.length]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type:itemType})=>itemType==="skus").map(lineItem=>!!(lineItem.item?.do_not_ship||lineItem.item?.do_not_track||lineItem.item?.inventory?.quantity>=lineItem?.quantity)).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order?.shipments]);const contextValue=useMemo(()=>({...state,setShipmentErrors:errors=>{defaultShipmentContext.setShipmentErrors(errors,dispatch)},setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})}),[state]);return _jsx(ShipmentContext.Provider,{value:contextValue,children})}export default ShipmentsContainer;
@@ -1,4 +1,4 @@
1
- import { ChildrenFunction } from '../../typings/index';
1
+ import { type ChildrenFunction } from '../../typings/index';
2
2
  import type { Shipment } from '@commercelayer/sdk';
3
3
  interface ChildrenProps extends Omit<Props, 'children'> {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  readonly?: boolean;
@@ -1,4 +1,4 @@
1
- import { ShippingMethod } from '@commercelayer/sdk';
1
+ import { type ShippingMethod } from '@commercelayer/sdk';
2
2
  type ChildrenProps = Omit<Props, 'children'> & {
3
3
  label: string;
4
4
  shippingMethod: ShippingMethod;
@@ -1,4 +1,4 @@
1
- import { BaseAmountComponent } from '../../typings/index';
1
+ import { type BaseAmountComponent } from '../../typings/index';
2
2
  type Props = BaseAmountComponent & {
3
3
  labelFreeOver?: string;
4
4
  } & ({
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  skuCode?: string;
@@ -1,5 +1,5 @@
1
- import { TimeFormat, ChildrenFunction } from '../../typings/index';
2
- import { DeliveryLeadTime } from '../../reducers/AvailabilityReducer';
1
+ import { type TimeFormat, type ChildrenFunction } from '../../typings/index';
2
+ import { type DeliveryLeadTime } from '../../reducers/AvailabilityReducer';
3
3
  interface AvailabilityTemplateChildrenProps extends Omit<Props, 'children'>, DeliveryLeadTime {
4
4
  text: string;
5
5
  quantity: number;
@@ -1,5 +1,5 @@
1
- import { ConditionalElement } from '../../typings/index';
2
- import { TGenericChildrenProps, TResources } from '../utils/GenericFieldComponent';
1
+ import { type ConditionalElement } from '../../typings/index';
2
+ import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
3
  type SkuFieldChildrenProps = TGenericChildrenProps<TResources['Sku']>;
4
4
  type TCondition = ConditionalElement<Exclude<TResources['Sku'], 'resource'>>;
5
5
  type Props = {
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import type { QueryParamsList } from '@commercelayer/sdk';
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  interface Props {
4
4
  /**
5
5
  * An array of skus to display.
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import SkuContext from"../../context/SkuContext";import skuReducer,{getSku,skuInitialState}from"../../reducers/SkuReducer";import{useContext,useEffect,useMemo,useReducer}from"react";export function SkusContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=useReducer(skuReducer,skuInitialState),config=useContext(CommerceLayerContext),loadSkus=async()=>await getSku({config,dispatch,skus,queryParams});useEffect(()=>(config.accessToken&&state?.skus&&state?.skus.length===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=useMemo(()=>state,[state]);return _jsx(SkuContext.Provider,{value:contextValue,children})}export default SkusContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import SkuContext from"../../context/SkuContext";import skuReducer,{getSku,skuInitialState}from"../../reducers/SkuReducer";import{useContext,useEffect,useMemo,useReducer}from"react";export function SkusContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=useReducer(skuReducer,skuInitialState),config=useContext(CommerceLayerContext),loadSkus=async()=>{await getSku({config,dispatch,skus,queryParams})};useEffect(()=>(config.accessToken&&state?.skus&&state?.skus.length===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=useMemo(()=>state,[state]);return _jsx(SkuContext.Provider,{value:contextValue,children})}export default SkusContainer;
@@ -1,5 +1,5 @@
1
- import { ConditionalElement } from '../../typings/index';
2
- import { TGenericChildrenProps, TResources } from '../utils/GenericFieldComponent';
1
+ import { type ConditionalElement } from '../../typings/index';
2
+ import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
3
  type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['StockTransfer']>;
4
4
  type TCondition = ConditionalElement<Exclude<TResources['StockTransfer'], 'resource'>>;
5
5
  type Props = {
@@ -1,6 +1,6 @@
1
1
  import type { Address } from '@commercelayer/sdk';
2
2
  import AddressChildrenContext from '../../context/AddressChildrenContext';
3
- import { ChildrenFunction } from '../../typings/index';
3
+ import { type ChildrenFunction } from '../../typings/index';
4
4
  export interface TAddressCards extends Pick<Props, 'customerAddresses' | 'className'> {
5
5
  AddressProvider: typeof AddressChildrenContext.Provider;
6
6
  }
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className??""} ${(deselect?"":selectedClassName)??""}`:className,finalClassName=disabled?`${className??""} ${disabledClassName??""}`:addressSelectedClass,customerAddressId=address?.reference||"";return{...attributes,className:finalClassName,onClick:async()=>await handleSelect(k,address.id,customerAddressId,disabled,address)}}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,{...value,children})}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className??""} ${(deselect?"":selectedClassName)??""}`:className,finalClassName=disabled?`${className??""} ${disabledClassName??""}`:addressSelectedClass,customerAddressId=address?.reference||"";return{...attributes,className:finalClassName,onClick:async()=>{await handleSelect(k,address.id,customerAddressId,disabled,address)}}}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,{...value,children})}
@@ -1,4 +1,4 @@
1
- import { FunctionComponent } from 'react';
1
+ import { type FunctionComponent } from 'react';
2
2
  type BaseFieldChildren = Omit<BaseFieldProps, 'children'>;
3
3
  export interface BaseFieldProps extends Omit<JSX.IntrinsicElements['span'], 'children'> {
4
4
  attribute: 'number' | 'id';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { BaseInputComponentProps } from '../../typings/index';
2
+ import { type BaseInputComponentProps } from '../../typings/index';
3
3
  export type BaseInputProps = BaseInputComponentProps & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
4
4
  declare const _default: React.ForwardRefExoticComponent<Omit<BaseInputProps, "ref"> & React.RefAttributes<any>>;
5
5
  export default _default;
@@ -1,5 +1,5 @@
1
- import { PropsType } from '../../utils/PropsType';
2
- import { baseOrderPricePropTypes } from '../../typings/index';
3
- export type BaseOrderPriceProps = PropsType<typeof baseOrderPricePropTypes> & Omit<JSX.IntrinsicElements['span'], 'children'>;
1
+ import { type PropsType } from '../../utils/PropsType';
2
+ import { type baseOrderPricePropTypes } from '../../typings/index';
3
+ export type BaseOrderPriceProps = PropsType<typeof baseOrderPricePropTypes, unknown> & Omit<JSX.IntrinsicElements['span'], 'children'>;
4
4
  export declare function BaseOrderPrice(props: BaseOrderPriceProps): JSX.Element;
5
5
  export default BaseOrderPrice;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { BaseSelectComponentProps } from '../../typings/index';
2
+ import { type BaseSelectComponentProps } from '../../typings/index';
3
3
  export type BaseSelectProps = BaseSelectComponentProps;
4
4
  declare const _default: React.ForwardRefExoticComponent<BaseSelectComponentProps & React.RefAttributes<any>>;
5
5
  export default _default;
@@ -1,4 +1,4 @@
1
- import { Component, ErrorInfo } from 'react';
1
+ import { Component, type ErrorInfo } from 'react';
2
2
  interface Props {
3
3
  children: JSX.Element;
4
4
  }
@@ -1,11 +1,11 @@
1
- import { InitialSkuContext } from '../../context/SkuChildrenContext';
2
- import { InitialStockTransferContext } from '../../context/StockTransferChildrenContext';
1
+ import { type InitialSkuContext } from '../../context/SkuChildrenContext';
2
+ import { type InitialStockTransferContext } from '../../context/StockTransferChildrenContext';
3
3
  import type { Customer, LineItem, Sku, Parcel, ParcelLineItem } from '@commercelayer/sdk';
4
- import { InitialLineItemContext } from '../../context/LineItemChildrenContext';
5
- import { Context } from 'react';
6
- import { InitialCustomerContext } from '../../context/CustomerContext';
7
- import { InitialParcelContext } from '../../context/ParcelChildrenContext';
8
- import { InitialParcelLineItemContext } from '../../context/ParcelLineItemChildrenContext';
4
+ import { type InitialLineItemContext } from '../../context/LineItemChildrenContext';
5
+ import { type Context } from 'react';
6
+ import { type InitialCustomerContext } from '../../context/CustomerContext';
7
+ import { type InitialParcelContext } from '../../context/ParcelChildrenContext';
8
+ import { type InitialParcelLineItemContext } from '../../context/ParcelLineItemChildrenContext';
9
9
  export interface TResources {
10
10
  StockTransfer: LineItem & {
11
11
  resource: 'stock_transfers';
@@ -1,4 +1,4 @@
1
- import { Component, ForwardedRef } from 'react';
1
+ import { type Component, type ForwardedRef } from 'react';
2
2
  export interface ParentProps {
3
3
  parentRef?: ForwardedRef<any>;
4
4
  children?: typeof Component | ((P: any) => JSX.Element | null);
@@ -1,6 +1,6 @@
1
- import { PaymentResource, PaymentSourceType } from '../../reducers/PaymentMethodReducer';
2
- import PaymentSourceContext, { IconBrand } from '../../context/PaymentSourceContext';
3
- import { ChildrenFunction } from '../../typings/index';
1
+ import { type PaymentResource, type PaymentSourceType } from '../../reducers/PaymentMethodReducer';
2
+ import PaymentSourceContext, { type IconBrand } from '../../context/PaymentSourceContext';
3
+ import { type ChildrenFunction } from '../../typings/index';
4
4
  interface ChildrenProps extends Pick<Props, 'customerPayments'> {
5
5
  PaymentSourceProvider: typeof PaymentSourceContext.Provider;
6
6
  }
@@ -1,4 +1,4 @@
1
- import { PriceProps } from '../prices/Price';
1
+ import { type PriceProps } from '../prices/Price';
2
2
  export type PTemplateProps = {
3
3
  formattedAmount?: string;
4
4
  formattedCompare?: string;
@@ -1,6 +1,6 @@
1
- import { LineItem } from '@commercelayer/sdk';
2
- import { BaseError } from '../../typings/errors';
3
- import { TResourceError } from '../errors/Errors';
1
+ import { type LineItem } from '@commercelayer/sdk';
2
+ import { type BaseError } from '../../typings/errors';
3
+ import { type TResourceError } from '../errors/Errors';
4
4
  export interface AllErrorsParams {
5
5
  allErrors: BaseError[];
6
6
  messages: BaseError[];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Address } from '@commercelayer/sdk';
2
+ import { type Address } from '@commercelayer/sdk';
3
3
  export interface InitialAddressContext {
4
4
  address: Address | undefined;
5
5
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { AddressState, SetAddress, AddressResource, saveAddresses } from '../reducers/AddressReducer';
3
- import { BaseError } from '../typings/errors';
2
+ import { type AddressState, type SetAddress, type AddressResource, type saveAddresses } from '../reducers/AddressReducer';
3
+ import { type BaseError } from '../typings/errors';
4
4
  type DefaultContext = {
5
5
  saveAddresses?: (customerEmail?: string) => ReturnType<typeof saveAddresses>;
6
6
  setCloneAddress: (id: string, resource: AddressResource) => void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { BillingAddressState } from '../reducers/BillingAddressReducer';
2
+ import { type BillingAddressState } from '../reducers/BillingAddressReducer';
3
3
  type DefaultContext = {
4
4
  setBillingAddress?: (id: string, options?: {
5
5
  customerAddressId: string;
@@ -4,13 +4,11 @@ export type AddressValuesKeys = `${keyof Address}` | `billing_address_${keyof Ad
4
4
  export interface DefaultContextAddress {
5
5
  validation?: void;
6
6
  setValue?: (name: AddressValuesKeys, value: string | number | readonly string[]) => void;
7
- errors?: {
8
- [name: string]: {
9
- code: string;
10
- message: string;
11
- error: boolean;
12
- };
13
- };
7
+ errors?: Record<string, {
8
+ code: string;
9
+ message: string;
10
+ error: boolean;
11
+ }>;
14
12
  errorClassName?: string;
15
13
  requiresBillingInfo?: boolean;
16
14
  resetField?: (name: string) => void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { OrderCodeType } from '../reducers/OrderReducer';
2
+ import { type OrderCodeType } from '../reducers/OrderReducer';
3
3
  interface DefaultContext {
4
4
  validation?: void;
5
5
  setValue?: (name: string, value: string) => void;