@commercelayer/react-components 4.17.0-beta.0 → 4.17.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/README.md +2 -2
  2. package/lib/cjs/components/ExternalFunction.d.ts +1 -1
  3. package/lib/cjs/components/MetadataInput.d.ts +1 -0
  4. package/lib/cjs/components/SubmitButton.d.ts +2 -2
  5. package/lib/cjs/components/addresses/Address.d.ts +1 -0
  6. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +1 -0
  7. package/lib/cjs/components/addresses/AddressField.d.ts +1 -1
  8. package/lib/cjs/components/addresses/AddressInput.d.ts +1 -0
  9. package/lib/cjs/components/addresses/AddressInputSelect.d.ts +1 -0
  10. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +1 -0
  11. package/lib/cjs/components/addresses/AddressesContainer.d.ts +1 -1
  12. package/lib/cjs/components/addresses/AddressesEmpty.d.ts +1 -0
  13. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +1 -1
  14. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +1 -1
  15. package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +1 -1
  16. package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +1 -0
  17. package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +1 -1
  18. package/lib/cjs/components/auth/CommerceLayer.d.ts +1 -0
  19. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +1 -1
  20. package/lib/cjs/components/customers/CustomerContainer.d.ts +1 -0
  21. package/lib/cjs/components/customers/CustomerField.d.ts +1 -0
  22. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -0
  23. package/lib/cjs/components/customers/CustomerPaymentSource.d.ts +1 -0
  24. package/lib/cjs/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -0
  25. package/lib/cjs/components/customers/MyAccountLink.d.ts +1 -0
  26. package/lib/cjs/components/customers/MyAccountLink.js +1 -1
  27. package/lib/cjs/components/customers/MyIdentityLink.d.ts +1 -0
  28. package/lib/cjs/components/customers/MyIdentityLink.js +1 -1
  29. package/lib/cjs/components/customers/SaveCustomerButton.d.ts +1 -1
  30. package/lib/cjs/components/errors/Errors.d.ts +1 -0
  31. package/lib/cjs/components/gift_cards/GiftCard.d.ts +3 -1
  32. package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
  33. package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +1 -1
  34. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -0
  35. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -0
  36. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -0
  37. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -0
  38. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -0
  39. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  40. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +1 -1
  41. package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -0
  42. package/lib/cjs/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -0
  43. package/lib/cjs/components/line_items/LineItem.d.ts +1 -0
  44. package/lib/cjs/components/line_items/LineItemAmount.d.ts +1 -0
  45. package/lib/cjs/components/line_items/LineItemCode.d.ts +1 -0
  46. package/lib/cjs/components/line_items/LineItemField.d.ts +1 -0
  47. package/lib/cjs/components/line_items/LineItemImage.d.ts +1 -0
  48. package/lib/cjs/components/line_items/LineItemName.d.ts +1 -0
  49. package/lib/cjs/components/line_items/LineItemOption.d.ts +1 -1
  50. package/lib/cjs/components/line_items/LineItemOptions.d.ts +1 -1
  51. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -0
  52. package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +1 -1
  53. package/lib/cjs/components/line_items/LineItemsContainer.d.ts +1 -0
  54. package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -0
  55. package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +1 -0
  56. package/lib/cjs/components/orders/AddToCartButton.d.ts +1 -1
  57. package/lib/cjs/components/orders/AddToCartButton.js +1 -1
  58. package/lib/cjs/components/orders/AdjustmentAmount.d.ts +1 -0
  59. package/lib/cjs/components/orders/CartLink.d.ts +1 -1
  60. package/lib/cjs/components/orders/CartLink.js +1 -1
  61. package/lib/cjs/components/orders/CheckoutLink.d.ts +1 -0
  62. package/lib/cjs/components/orders/CheckoutLink.js +1 -1
  63. package/lib/cjs/components/orders/DiscountAmount.d.ts +1 -0
  64. package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -0
  65. package/lib/cjs/components/orders/HostedCart.d.ts +1 -1
  66. package/lib/cjs/components/orders/HostedCart.js +1 -1
  67. package/lib/cjs/components/orders/OrderContainer.d.ts +1 -0
  68. package/lib/cjs/components/orders/OrderList.d.ts +1 -0
  69. package/lib/cjs/components/orders/OrderListEmpty.d.ts +1 -0
  70. package/lib/cjs/components/orders/OrderListPaginationButtons.d.ts +1 -0
  71. package/lib/cjs/components/orders/OrderListPaginationInfo.d.ts +1 -0
  72. package/lib/cjs/components/orders/OrderListRow.d.ts +1 -0
  73. package/lib/cjs/components/orders/OrderNumber.d.ts +1 -0
  74. package/lib/cjs/components/orders/OrderStorage.d.ts +1 -1
  75. package/lib/cjs/components/orders/PaymentMethodAmount.d.ts +1 -0
  76. package/lib/cjs/components/orders/PlaceOrderButton.d.ts +1 -1
  77. package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +1 -1
  78. package/lib/cjs/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -0
  79. package/lib/cjs/components/orders/ShippingAmount.d.ts +1 -0
  80. package/lib/cjs/components/orders/SubTotalAmount.d.ts +1 -0
  81. package/lib/cjs/components/orders/TaxesAmount.d.ts +1 -0
  82. package/lib/cjs/components/orders/TotalAmount.d.ts +1 -0
  83. package/lib/cjs/components/parcels/ParcelField.d.ts +1 -0
  84. package/lib/cjs/components/parcels/ParcelLineItem.d.ts +1 -0
  85. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +1 -0
  86. package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +1 -0
  87. package/lib/cjs/components/parcels/Parcels.d.ts +1 -0
  88. package/lib/cjs/components/parcels/ParcelsCount.d.ts +1 -0
  89. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +1 -0
  90. package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
  91. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +1 -0
  92. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +1 -0
  93. package/lib/cjs/components/payment_gateways/ExternalGateway.d.ts +1 -0
  94. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +1 -0
  95. package/lib/cjs/components/payment_gateways/PaymentGateway.d.ts +1 -0
  96. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +1 -0
  97. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +1 -0
  98. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +1 -0
  99. package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +1 -0
  100. package/lib/cjs/components/payment_methods/PaymentMethodName.d.ts +1 -0
  101. package/lib/cjs/components/payment_methods/PaymentMethodPrice.d.ts +1 -0
  102. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  103. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +1 -1
  104. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +29 -1
  105. package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
  106. package/lib/cjs/components/payment_source/BraintreePayment.d.ts +1 -0
  107. package/lib/cjs/components/payment_source/CheckoutComPayment.d.ts +1 -0
  108. package/lib/cjs/components/payment_source/ExternalPayment.d.ts +1 -0
  109. package/lib/cjs/components/payment_source/KlarnaPayment.d.ts +1 -0
  110. package/lib/cjs/components/payment_source/PaymentSource.d.ts +1 -0
  111. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -0
  112. package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +1 -0
  113. package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +1 -0
  114. package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  115. package/lib/cjs/components/payment_source/PaypalPayment.d.ts +1 -1
  116. package/lib/cjs/components/payment_source/StripeExpressPayment.d.ts +1 -0
  117. package/lib/cjs/components/payment_source/StripePayment.d.ts +2 -1
  118. package/lib/cjs/components/payment_source/WireTransferPayment.d.ts +1 -0
  119. package/lib/cjs/components/prices/Price.d.ts +2 -1
  120. package/lib/cjs/components/prices/PricesContainer.d.ts +1 -0
  121. package/lib/cjs/components/shipments/Shipment.d.ts +1 -1
  122. package/lib/cjs/components/shipments/ShipmentField.d.ts +2 -1
  123. package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +1 -1
  124. package/lib/cjs/components/shipments/ShipmentsCount.d.ts +2 -1
  125. package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +1 -1
  126. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +2 -1
  127. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +1 -0
  128. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +2 -1
  129. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  130. package/lib/cjs/components/skus/AvailabilityContainer.d.ts +1 -1
  131. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +2 -1
  132. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +3 -2
  133. package/lib/cjs/components/skus/SkuField.d.ts +1 -0
  134. package/lib/cjs/components/skus/SkuList.d.ts +1 -1
  135. package/lib/cjs/components/skus/SkuListsContainer.d.ts +1 -1
  136. package/lib/cjs/components/skus/Skus.d.ts +1 -1
  137. package/lib/cjs/components/skus/SkusContainer.d.ts +1 -1
  138. package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +1 -0
  139. package/lib/cjs/components/stock_transfers/StockTransferField.d.ts +1 -0
  140. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +1 -0
  141. package/lib/cjs/components/utils/BaseField.d.ts +2 -2
  142. package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
  143. package/lib/cjs/components/utils/BaseOrderPrice.d.ts +2 -1
  144. package/lib/cjs/components/utils/ErrorBoundary.d.ts +1 -1
  145. package/lib/cjs/components/utils/GenericFieldComponent.d.ts +1 -1
  146. package/lib/cjs/components/utils/Parent.d.ts +1 -1
  147. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +1 -0
  148. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -0
  149. package/lib/cjs/components/utils/getAllErrors.d.ts +2 -1
  150. package/lib/cjs/context/OrderListChildrenContext.d.ts +1 -0
  151. package/lib/cjs/context/PlaceOrderContext.d.ts +1 -1
  152. package/lib/cjs/reducers/OrderReducer.js +1 -1
  153. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +2 -2
  154. package/lib/cjs/reducers/ShipmentReducer.js +1 -1
  155. package/lib/cjs/typings/globals.d.ts +1 -0
  156. package/lib/cjs/typings/index.d.ts +2 -2
  157. package/lib/cjs/utils/filterChildren.d.ts +1 -0
  158. package/lib/cjs/utils/getLoaderComponent.d.ts +1 -0
  159. package/lib/cjs/utils/getPrices.d.ts +1 -0
  160. package/lib/cjs/utils/organization.js +1 -1
  161. package/lib/esm/components/ExternalFunction.d.ts +1 -1
  162. package/lib/esm/components/MetadataInput.d.ts +1 -0
  163. package/lib/esm/components/SubmitButton.d.ts +2 -2
  164. package/lib/esm/components/addresses/Address.d.ts +1 -0
  165. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +1 -0
  166. package/lib/esm/components/addresses/AddressField.d.ts +1 -1
  167. package/lib/esm/components/addresses/AddressInput.d.ts +1 -0
  168. package/lib/esm/components/addresses/AddressInputSelect.d.ts +1 -0
  169. package/lib/esm/components/addresses/AddressStateSelector.d.ts +1 -0
  170. package/lib/esm/components/addresses/AddressesContainer.d.ts +1 -1
  171. package/lib/esm/components/addresses/AddressesEmpty.d.ts +1 -0
  172. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +1 -1
  173. package/lib/esm/components/addresses/BillingAddressForm.d.ts +1 -1
  174. package/lib/esm/components/addresses/SaveAddressesButton.d.ts +1 -1
  175. package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +1 -0
  176. package/lib/esm/components/addresses/ShippingAddressForm.d.ts +1 -1
  177. package/lib/esm/components/auth/CommerceLayer.d.ts +1 -0
  178. package/lib/esm/components/customers/CustomerAddressForm.d.ts +1 -1
  179. package/lib/esm/components/customers/CustomerContainer.d.ts +1 -0
  180. package/lib/esm/components/customers/CustomerField.d.ts +1 -0
  181. package/lib/esm/components/customers/CustomerInput.d.ts +1 -0
  182. package/lib/esm/components/customers/CustomerPaymentSource.d.ts +1 -0
  183. package/lib/esm/components/customers/CustomerPaymentSourceEmpty.d.ts +1 -0
  184. package/lib/esm/components/customers/MyAccountLink.d.ts +1 -0
  185. package/lib/esm/components/customers/MyAccountLink.js +1 -1
  186. package/lib/esm/components/customers/MyIdentityLink.d.ts +1 -0
  187. package/lib/esm/components/customers/MyIdentityLink.js +1 -1
  188. package/lib/esm/components/customers/SaveCustomerButton.d.ts +1 -1
  189. package/lib/esm/components/errors/Errors.d.ts +1 -0
  190. package/lib/esm/components/gift_cards/GiftCard.d.ts +3 -1
  191. package/lib/esm/components/gift_cards/GiftCard.js +1 -1
  192. package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +1 -1
  193. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +1 -0
  194. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -0
  195. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -0
  196. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +1 -0
  197. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -0
  198. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +1 -1
  199. package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +1 -1
  200. package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionButton.d.ts +1 -0
  201. package/lib/esm/components/in_stock_subscriptions/InStockSubscriptionsContainer.d.ts +1 -0
  202. package/lib/esm/components/line_items/LineItem.d.ts +1 -0
  203. package/lib/esm/components/line_items/LineItemAmount.d.ts +1 -0
  204. package/lib/esm/components/line_items/LineItemCode.d.ts +1 -0
  205. package/lib/esm/components/line_items/LineItemField.d.ts +1 -0
  206. package/lib/esm/components/line_items/LineItemImage.d.ts +1 -0
  207. package/lib/esm/components/line_items/LineItemName.d.ts +1 -0
  208. package/lib/esm/components/line_items/LineItemOption.d.ts +1 -1
  209. package/lib/esm/components/line_items/LineItemOptions.d.ts +1 -1
  210. package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -0
  211. package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +1 -1
  212. package/lib/esm/components/line_items/LineItemsContainer.d.ts +1 -0
  213. package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -0
  214. package/lib/esm/components/line_items/LineItemsEmpty.d.ts +1 -0
  215. package/lib/esm/components/orders/AddToCartButton.d.ts +1 -1
  216. package/lib/esm/components/orders/AddToCartButton.js +1 -1
  217. package/lib/esm/components/orders/AdjustmentAmount.d.ts +1 -0
  218. package/lib/esm/components/orders/CartLink.d.ts +1 -1
  219. package/lib/esm/components/orders/CartLink.js +1 -1
  220. package/lib/esm/components/orders/CheckoutLink.d.ts +1 -0
  221. package/lib/esm/components/orders/CheckoutLink.js +1 -1
  222. package/lib/esm/components/orders/DiscountAmount.d.ts +1 -0
  223. package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -0
  224. package/lib/esm/components/orders/HostedCart.d.ts +1 -1
  225. package/lib/esm/components/orders/HostedCart.js +1 -1
  226. package/lib/esm/components/orders/OrderContainer.d.ts +1 -0
  227. package/lib/esm/components/orders/OrderList.d.ts +1 -0
  228. package/lib/esm/components/orders/OrderListEmpty.d.ts +1 -0
  229. package/lib/esm/components/orders/OrderListPaginationButtons.d.ts +1 -0
  230. package/lib/esm/components/orders/OrderListPaginationInfo.d.ts +1 -0
  231. package/lib/esm/components/orders/OrderListRow.d.ts +1 -0
  232. package/lib/esm/components/orders/OrderNumber.d.ts +1 -0
  233. package/lib/esm/components/orders/OrderStorage.d.ts +1 -1
  234. package/lib/esm/components/orders/PaymentMethodAmount.d.ts +1 -0
  235. package/lib/esm/components/orders/PlaceOrderButton.d.ts +1 -1
  236. package/lib/esm/components/orders/PlaceOrderContainer.d.ts +1 -1
  237. package/lib/esm/components/orders/PrivacyAndTermsCheckbox.d.ts +1 -0
  238. package/lib/esm/components/orders/ShippingAmount.d.ts +1 -0
  239. package/lib/esm/components/orders/SubTotalAmount.d.ts +1 -0
  240. package/lib/esm/components/orders/TaxesAmount.d.ts +1 -0
  241. package/lib/esm/components/orders/TotalAmount.d.ts +1 -0
  242. package/lib/esm/components/parcels/ParcelField.d.ts +1 -0
  243. package/lib/esm/components/parcels/ParcelLineItem.d.ts +1 -0
  244. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +1 -0
  245. package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +1 -0
  246. package/lib/esm/components/parcels/Parcels.d.ts +1 -0
  247. package/lib/esm/components/parcels/ParcelsCount.d.ts +1 -0
  248. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +1 -0
  249. package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -1
  250. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +1 -0
  251. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +1 -0
  252. package/lib/esm/components/payment_gateways/ExternalGateway.d.ts +1 -0
  253. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +1 -0
  254. package/lib/esm/components/payment_gateways/PaymentGateway.d.ts +1 -0
  255. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +1 -0
  256. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +1 -0
  257. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +1 -0
  258. package/lib/esm/components/payment_methods/PaymentMethod.d.ts +1 -0
  259. package/lib/esm/components/payment_methods/PaymentMethodName.d.ts +1 -0
  260. package/lib/esm/components/payment_methods/PaymentMethodPrice.d.ts +1 -0
  261. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.d.ts +1 -1
  262. package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +1 -1
  263. package/lib/esm/components/payment_source/AdyenPayment.d.ts +29 -1
  264. package/lib/esm/components/payment_source/AdyenPayment.js +1 -1
  265. package/lib/esm/components/payment_source/BraintreePayment.d.ts +1 -0
  266. package/lib/esm/components/payment_source/CheckoutComPayment.d.ts +1 -0
  267. package/lib/esm/components/payment_source/ExternalPayment.d.ts +1 -0
  268. package/lib/esm/components/payment_source/KlarnaPayment.d.ts +1 -0
  269. package/lib/esm/components/payment_source/PaymentSource.d.ts +1 -0
  270. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +1 -0
  271. package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +1 -0
  272. package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +1 -0
  273. package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +1 -1
  274. package/lib/esm/components/payment_source/PaypalPayment.d.ts +1 -1
  275. package/lib/esm/components/payment_source/StripeExpressPayment.d.ts +1 -0
  276. package/lib/esm/components/payment_source/StripePayment.d.ts +2 -1
  277. package/lib/esm/components/payment_source/WireTransferPayment.d.ts +1 -0
  278. package/lib/esm/components/prices/Price.d.ts +2 -1
  279. package/lib/esm/components/prices/PricesContainer.d.ts +1 -0
  280. package/lib/esm/components/shipments/Shipment.d.ts +1 -1
  281. package/lib/esm/components/shipments/ShipmentField.d.ts +2 -1
  282. package/lib/esm/components/shipments/ShipmentsContainer.d.ts +1 -1
  283. package/lib/esm/components/shipments/ShipmentsCount.d.ts +2 -1
  284. package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +1 -1
  285. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +2 -1
  286. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +1 -0
  287. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +2 -1
  288. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  289. package/lib/esm/components/skus/AvailabilityContainer.d.ts +1 -1
  290. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +2 -1
  291. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +3 -2
  292. package/lib/esm/components/skus/SkuField.d.ts +1 -0
  293. package/lib/esm/components/skus/SkuList.d.ts +1 -1
  294. package/lib/esm/components/skus/SkuListsContainer.d.ts +1 -1
  295. package/lib/esm/components/skus/Skus.d.ts +1 -1
  296. package/lib/esm/components/skus/SkusContainer.d.ts +1 -1
  297. package/lib/esm/components/stock_transfers/StockTransfer.d.ts +1 -0
  298. package/lib/esm/components/stock_transfers/StockTransferField.d.ts +1 -0
  299. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +1 -0
  300. package/lib/esm/components/utils/BaseField.d.ts +2 -2
  301. package/lib/esm/components/utils/BaseInput.d.ts +1 -1
  302. package/lib/esm/components/utils/BaseOrderPrice.d.ts +2 -1
  303. package/lib/esm/components/utils/ErrorBoundary.d.ts +1 -1
  304. package/lib/esm/components/utils/GenericFieldComponent.d.ts +1 -1
  305. package/lib/esm/components/utils/Parent.d.ts +1 -1
  306. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +1 -0
  307. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -0
  308. package/lib/esm/components/utils/getAllErrors.d.ts +2 -1
  309. package/lib/esm/context/OrderListChildrenContext.d.ts +1 -0
  310. package/lib/esm/context/PlaceOrderContext.d.ts +1 -1
  311. package/lib/esm/reducers/OrderReducer.js +1 -1
  312. package/lib/esm/reducers/PlaceOrderReducer.d.ts +2 -2
  313. package/lib/esm/reducers/ShipmentReducer.js +1 -1
  314. package/lib/esm/typings/globals.d.ts +1 -0
  315. package/lib/esm/typings/index.d.ts +2 -2
  316. package/lib/esm/utils/filterChildren.d.ts +1 -0
  317. package/lib/esm/utils/getLoaderComponent.d.ts +1 -0
  318. package/lib/esm/utils/getPrices.d.ts +1 -0
  319. package/lib/esm/utils/organization.js +1 -1
  320. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  321. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  322. package/package.json +27 -27
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type LineItem } from '@commercelayer/sdk';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  export interface TLineItemCode extends Omit<Props, 'children'> {
@@ -1,5 +1,6 @@
1
1
  import { type ConditionalElement } from '../../typings/index';
2
2
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
+ import type { JSX } from "react";
3
4
  type LineItemFieldChildrenProps = TGenericChildrenProps<TResources['LineItem']>;
4
5
  type TCondition = ConditionalElement<Exclude<TResources['LineItem'], 'resource'>>;
5
6
  type Props = {
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type LineItem } from '@commercelayer/sdk';
2
3
  import type { ChildrenFunction } from '../../typings/index';
3
4
  import { type TLineItem } from './LineItem';
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import type { LineItem } from '@commercelayer/sdk';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  export interface TLineItemName extends Omit<Props, 'children'> {
@@ -1,4 +1,4 @@
1
- import { type CSSProperties } from 'react';
1
+ import { type CSSProperties, type JSX } from 'react';
2
2
  import { type LineItemOption as LineItemOptionType } from '@commercelayer/sdk';
3
3
  import { type ChildrenFunction } from '../../typings/index';
4
4
  export interface TLineItemOption extends Omit<Props, 'children'> {
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type JSX } from 'react';
2
2
  type Props = {
3
3
  children: ReactNode;
4
4
  title?: string;
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  import { type LineItem } from '@commercelayer/sdk';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,4 @@
1
- import { type PropsWithoutRef } from 'react';
1
+ import { type PropsWithoutRef, type JSX } from 'react';
2
2
  import { type ChildrenFunction } from '../../typings/index';
3
3
  import { type LineItem } from '@commercelayer/sdk';
4
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import type { DefaultChildrenType } from '../../typings/globals';
2
3
  interface Props {
3
4
  children: DefaultChildrenType;
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type TypeAccepted } from '../../utils/getLineItemsCount';
2
3
  import { type ChildrenFunction } from '../../typings/index';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface ChildrenProps extends Omit<Props, 'children'> {
3
4
  quantity: number;
@@ -1,4 +1,4 @@
1
- import { type PropsWithoutRef } from 'react';
1
+ import { type PropsWithoutRef, type JSX } from 'react';
2
2
  import { type ChildrenFunction } from '../../typings/index';
3
3
  import { type AddToCartReturn, type CustomLineItem, type LineItemOption } from '../../reducers/OrderReducer';
4
4
  interface TAddToCartButton extends Omit<Props, 'children'> {
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import SkuListsContext from"../../context/SkuListsContext";import ExternalFunctionContext from"../../context/ExternalFunctionContext";import SkuChildrenContext from"../../context/SkuChildrenContext";import{getApplicationLink}from"../../utils/getApplicationLink";import CommerceLayerContext from"../../context/CommerceLayerContext";import useCustomContext from"../../utils/hooks/useCustomContext";import{getDomain}from"../../utils/getDomain";import{publish}from"../../utils/events";import{getOrganizationConfig}from"../../utils/organization";export function AddToCartButton(props){const{label="Add to cart",children,skuCode,bundleCode,skuListId,lineItem,buyNowMode=!1,checkoutUrl,redirectToHostedCart,hostedCartUrl,quantity,lineItemOption,protocol="https",...p}=props,{accessToken,endpoint}=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"AddToCartButton",key:"accessToken"}),{addToCart,orderId,getOrder,setOrderErrors}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"AddToCartButton",key:"addToCart"}),{url,callExternalFunction}=useContext(ExternalFunctionContext),{skuLists}=useContext(SkuListsContext),{sku}=useContext(SkuChildrenContext),sCode=sku?.code??skuCode,handleClick=async()=>{const qty=quantity!=null?parseInt(quantity):1;if(skuLists!=null&&skuListId&&url&&skuListId in skuLists){const lineItems=skuLists?.[skuListId]?.map(skuCode2=>({skuCode:skuCode2,quantity:qty,_update_quantity:1}));return await callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems}]}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),buyNowMode||publish("open-cart"),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}if(!url&&addToCart!=null){const res=await addToCart({bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl});if(redirectToHostedCart&&accessToken!=null&&endpoint!=null){const{slug,domain}=getDomain(endpoint),orderId2=res?.orderId;if(hostedCartUrl&&orderId2)location.href=`${protocol}://${hostedCartUrl}/${orderId2}?accessToken=${accessToken}`;else if(orderId2&&slug){const config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:orderId2,accessToken}});location.href=config?.links?.cart??getApplicationLink({orderId:orderId2,slug,accessToken,domain,applicationType:"cart"})}}return res}else if(url)return await callExternalFunction({url,data:{bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),buyNowMode||publish("open-cart"),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))},parentProps={handleClick,label,...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{...p,onClick:()=>{handleClick()},children:label})}export default AddToCartButton;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import SkuListsContext from"../../context/SkuListsContext";import ExternalFunctionContext from"../../context/ExternalFunctionContext";import SkuChildrenContext from"../../context/SkuChildrenContext";import{getApplicationLink}from"../../utils/getApplicationLink";import CommerceLayerContext from"../../context/CommerceLayerContext";import useCustomContext from"../../utils/hooks/useCustomContext";import{getDomain}from"../../utils/getDomain";import{publish}from"../../utils/events";import{getOrganizationConfig}from"../../utils/organization";export function AddToCartButton(props){const{label="Add to cart",children,skuCode,bundleCode,skuListId,lineItem,buyNowMode=!1,checkoutUrl,redirectToHostedCart,hostedCartUrl,quantity,lineItemOption,protocol="https",...p}=props,{accessToken,endpoint}=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"AddToCartButton",key:"accessToken"}),{addToCart,orderId,getOrder,setOrderErrors}=useCustomContext({context:OrderContext,contextComponentName:"OrderContainer",currentComponentName:"AddToCartButton",key:"addToCart"}),{url,callExternalFunction}=useContext(ExternalFunctionContext),{skuLists}=useContext(SkuListsContext),{sku}=useContext(SkuChildrenContext),sCode=sku?.code??skuCode,handleClick=async()=>{const qty=quantity!=null?parseInt(quantity):1;if(skuLists!=null&&skuListId&&url&&skuListId in skuLists){const lineItems=skuLists?.[skuListId]?.map(skuCode2=>({skuCode:skuCode2,quantity:qty,_update_quantity:1}));return await callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems}]}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),buyNowMode||publish("open-cart"),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}if(!url&&addToCart!=null){const res=await addToCart({bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl});if(redirectToHostedCart&&accessToken!=null&&endpoint!=null){const{slug,domain}=getDomain(endpoint),orderId2=res?.orderId;if(hostedCartUrl&&orderId2)location.href=`${protocol}://${hostedCartUrl}/${orderId2}?accessToken=${accessToken}`;else if(orderId2&&slug){const config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:orderId2,accessToken,slug}});location.href=config?.links?.cart??getApplicationLink({orderId:orderId2,slug,accessToken,domain,applicationType:"cart"})}}return res}else if(url)return await callExternalFunction({url,data:{bundleCode,skuCode:sCode,quantity:qty,lineItemOption,lineItem,buyNowMode,checkoutUrl}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),buyNowMode||publish("open-cart"),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))},parentProps={handleClick,label,...props};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{...p,onClick:()=>{handleClick()},children:label})}export default AddToCartButton;
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function AdjustmentAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default AdjustmentAmount;
@@ -1,4 +1,4 @@
1
- import { type MouseEvent, type ReactNode } from 'react';
1
+ import { type MouseEvent, type ReactNode, type JSX } from 'react';
2
2
  import { type ChildrenFunction } from '../../typings/index';
3
3
  interface ChildrenProps extends Omit<Props, 'children'> {
4
4
  /**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import{getApplicationLink}from"../../utils/getApplicationLink";import{getDomain}from"../../utils/getDomain";import{publish}from"../../utils/events";import{getOrganizationConfig}from"../../utils/organization";export function CartLink(props){const{label,children,type,customDomain,...p}=props,{order,createOrder}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext);if(accessToken==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");if(endpoint==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");const{domain,slug}=getDomain(endpoint),href=slug&&order?.id?getApplicationLink({slug,orderId:order?.id,accessToken,domain,applicationType:"cart",customDomain}):void 0,handleClick=async event=>{if(event.preventDefault(),type!=="mini")if(order?.id){const config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken}});location.href=config?.links?.cart??href??""}else{const orderId=await createOrder({}),config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken}});slug&&(location.href=config?.links?.cart??getApplicationLink({slug,orderId,accessToken,domain,applicationType:"cart",customDomain}))}else publish("open-cart")},parentProps={handleClick,label,href,orderId:order?.id,accessToken,...p};return accessToken?children?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,onClick:e=>{handleClick(e)},...p,children:label}):null}export default CartLink;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import{getApplicationLink}from"../../utils/getApplicationLink";import{getDomain}from"../../utils/getDomain";import{publish}from"../../utils/events";import{getOrganizationConfig}from"../../utils/organization";export function CartLink(props){const{label,children,type,customDomain,...p}=props,{order,createOrder}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext);if(accessToken==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");if(endpoint==null)throw new Error("Cannot use `CartLink` outside of `CommerceLayer`");const{domain,slug}=getDomain(endpoint),href=slug&&order?.id?getApplicationLink({slug,orderId:order?.id,accessToken,domain,applicationType:"cart",customDomain}):void 0,handleClick=async event=>{if(event.preventDefault(),type!=="mini")if(order?.id){const config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken,slug}});location.href=config?.links?.cart??href??""}else{const orderId=await createOrder({}),config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken,slug}});slug&&(location.href=config?.links?.cart??getApplicationLink({slug,orderId,accessToken,domain,applicationType:"cart",customDomain}))}else publish("open-cart")},parentProps={handleClick,label,href,orderId:order?.id,accessToken,...p};return accessToken?children?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,onClick:e=>{handleClick(e)},...p,children:label}):null}export default CartLink;
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type ChildrenFunction } from '../../typings/index';
2
3
  interface ChildrenProps extends Omit<Props, 'children'> {
3
4
  checkoutUrl: string;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import{getApplicationLink}from"../../utils/getApplicationLink";import{getDomain}from"../../utils/getDomain";import{getOrganizationConfig}from"../../utils/organization";export function CheckoutLink(props){const{label,hostedCheckout=!0,children,onClick,...p}=props,{order}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext);if(accessToken==null||endpoint==null)throw new Error("Cannot use `CheckoutLink` outside of `CommerceLayer`");const{domain,slug}=getDomain(endpoint),href=hostedCheckout&&order?.id?getApplicationLink({slug,orderId:order?.id,accessToken,applicationType:"checkout",domain}):order?.checkout_url??"",parentProps={checkoutUrl:order?.checkout_url,hostedCheckout,label,href,...p};function handleClick(e){e.preventDefault(),e.stopPropagation();const currentHref=e.currentTarget.href;accessToken&&endpoint&&order?.id?getOrganizationConfig({accessToken,endpoint,params:{accessToken,orderId:order?.id}}).then(config=>{config?.links?.checkout?window.open(config.links.checkout,"_top"):window.open(currentHref,"_top")}):window.open(currentHref,"_top")}return children?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,onClick:handleClick,...p,children:label})}export default CheckoutLink;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import{getApplicationLink}from"../../utils/getApplicationLink";import{getDomain}from"../../utils/getDomain";import{getOrganizationConfig}from"../../utils/organization";export function CheckoutLink(props){const{label,hostedCheckout=!0,children,onClick,...p}=props,{order}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext);if(accessToken==null||endpoint==null)throw new Error("Cannot use `CheckoutLink` outside of `CommerceLayer`");const{domain,slug}=getDomain(endpoint),href=hostedCheckout&&order?.id?getApplicationLink({slug,orderId:order?.id,accessToken,applicationType:"checkout",domain}):order?.checkout_url??"",parentProps={checkoutUrl:order?.checkout_url,hostedCheckout,label,href,...p};function handleClick(e){e.preventDefault(),e.stopPropagation();const currentHref=e.currentTarget.href;accessToken&&endpoint&&order?.id?getOrganizationConfig({accessToken,endpoint,params:{accessToken,slug,orderId:order?.id}}).then(config=>{config?.links?.checkout?window.open(config.links.checkout,"_top"):window.open(currentHref,"_top")}):window.open(currentHref,"_top")}return children?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,onClick:handleClick,...p,children:label})}export default CheckoutLink;
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function DiscountAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default DiscountAmount;
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function GiftCardAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default GiftCardAmount;
@@ -1,4 +1,4 @@
1
- import { type CSSProperties } from 'react';
1
+ import { type CSSProperties, type JSX } from 'react';
2
2
  interface Styles {
3
3
  cart?: CSSProperties;
4
4
  container?: CSSProperties;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext from"../../context/OrderContext";import OrderStorageContext from"../../context/OrderStorageContext";import{getApplicationLink}from"../../utils/getApplicationLink";import{getDomain}from"../../utils/getDomain";import useCustomContext from"../../utils/hooks/useCustomContext";import{useContext,useEffect,useState,useRef}from"react";import{iframeResizer}from"iframe-resizer";import{subscribe,unsubscribe}from"../../utils/events";import{getOrganizationConfig}from"../../utils/organization";const defaultIframeStyle={width:"1px",minWidth:"100%",minHeight:"100%",border:"none",paddingLeft:"20px",paddingRight:"20px"},defaultContainerStyle={position:"fixed",top:"0",right:"-25rem",height:"100%",width:"23rem",transition:"right 0.5s ease-in-out",pointerEvents:"none",overflow:"auto"},defaultBackgroundStyle={opacity:"0",position:"fixed",top:"0",left:"0",height:"100%",width:"100vw",transition:"opacity 0.5s ease-in-out",pointerEvents:"none",backgroundColor:"black"},defaultIconStyle={width:"1.25rem",height:"1.25rem"},defaultIconContainer={textAlign:"left",paddingLeft:"20px",paddingTop:"20px",background:"#ffffff",color:"#686E6E"},defaultStyle={cart:defaultIframeStyle,container:defaultContainerStyle,background:defaultBackgroundStyle,icon:defaultIconStyle,iconContainer:defaultIconContainer};export function HostedCart({type,openAdd=!1,style,open=!1,handleOpen,customDomain,...props}){const[isOpen,setOpen]=useState(!1),ref=useRef(null),{accessToken,endpoint}=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"HostedCart",key:"accessToken"}),[src,setSrc]=useState();if(accessToken==null||endpoint==null)return null;const{order,createOrder,getOrder}=useContext(OrderContext),{persistKey}=useContext(OrderStorageContext),{domain,slug}=getDomain(endpoint);async function setOrder(openCart){const orderId=localStorage.getItem(persistKey)??await createOrder({});if(orderId!=null&&accessToken&&endpoint){const config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken}});setSrc(config?.links?.cart??getApplicationLink({slug,orderId,accessToken,domain,applicationType:"cart",customDomain})),openCart&&setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300)}}function onMessage(data){switch(data.message.type){case"update":data.message.payload!=null&&getOrder(data.message.payload.id);break;case"close":type==="mini"&&(handleOpen!=null?handleOpen():setOpen(!1));break;case"blur":type==="mini"&&isOpen&&ref.current?.focus();break}}useEffect(()=>{const orderId=localStorage.getItem(persistKey);let ignore=!1;return open!=null&&open!==isOpen&&setOpen(open),openAdd&&type==="mini"&&subscribe("open-cart",()=>{window.document.body.style.overflow="hidden",src==null&&order?.id==null&&orderId==null?setOrder(!0):(src!=null&&ref.current!=null&&(ref.current.src=src),setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300))}),src==null&&order?.id==null&&orderId==null&&accessToken!=null&&!ignore&&isOpen?setOrder():src==null&&(order?.id!=null||orderId!=null)&&accessToken&&getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken}}).then(config=>{setSrc(config?.links?.cart??getApplicationLink({slug,orderId:order?.id??orderId??"",accessToken,domain,applicationType:"cart"}))}),src!=null&&ref.current!=null&&(ref.current.src=src),()=>{ignore=!0,openAdd&&type==="mini"&&unsubscribe("open-cart",()=>{})}},[src,open,order?.id,accessToken]),useEffect(()=>{ref.current!=null&&iframeResizer({checkOrigin:!1,onMessage},ref.current)},[ref.current!=null]);function onCloseCart(){window.document.body.style.removeProperty("overflow"),handleOpen!=null?handleOpen():setOpen(!1)}return src==null?null:type==="mini"?_jsxs(_Fragment,{children:[_jsx("div",{"aria-hidden":"true",style:{...defaultStyle.background,...style?.background,opacity:isOpen?"0.5":defaultStyle.background?.opacity,pointerEvents:isOpen?"initial":defaultStyle.background?.pointerEvents},onClick:onCloseCart}),_jsxs("div",{style:{...defaultStyle.container,...style?.container,right:isOpen?"0":defaultStyle.container?.right,pointerEvents:isOpen?"initial":defaultStyle.container?.pointerEvents},...props,children:[_jsx("div",{style:{...defaultStyle.iconContainer,...style?.iconContainer},children:_jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:{...defaultStyle.icon,...style?.icon},onClick:onCloseCart,children:_jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),_jsx("iframe",{title:"Cart",ref,style:{...defaultStyle.cart,...style?.cart},src,width:"100%",height:"100%"})]})]}):_jsx("iframe",{title:"Cart",ref,style:{...defaultStyle.cart,...style?.cart},src,width:"100%",height:"100%"})}
2
+ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext from"../../context/OrderContext";import OrderStorageContext from"../../context/OrderStorageContext";import{getApplicationLink}from"../../utils/getApplicationLink";import{getDomain}from"../../utils/getDomain";import useCustomContext from"../../utils/hooks/useCustomContext";import{useContext,useEffect,useState,useRef}from"react";import{iframeResizer}from"iframe-resizer";import{subscribe,unsubscribe}from"../../utils/events";import{getOrganizationConfig}from"../../utils/organization";const defaultIframeStyle={width:"1px",minWidth:"100%",minHeight:"100%",border:"none",paddingLeft:"20px",paddingRight:"20px"},defaultContainerStyle={position:"fixed",top:"0",right:"-25rem",height:"100%",width:"23rem",transition:"right 0.5s ease-in-out",pointerEvents:"none",overflow:"auto"},defaultBackgroundStyle={opacity:"0",position:"fixed",top:"0",left:"0",height:"100%",width:"100vw",transition:"opacity 0.5s ease-in-out",pointerEvents:"none",backgroundColor:"black"},defaultIconStyle={width:"1.25rem",height:"1.25rem"},defaultIconContainer={textAlign:"left",paddingLeft:"20px",paddingTop:"20px",background:"#ffffff",color:"#686E6E"},defaultStyle={cart:defaultIframeStyle,container:defaultContainerStyle,background:defaultBackgroundStyle,icon:defaultIconStyle,iconContainer:defaultIconContainer};export function HostedCart({type,openAdd=!1,style,open=!1,handleOpen,customDomain,...props}){const[isOpen,setOpen]=useState(!1),ref=useRef(null),{accessToken,endpoint}=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"HostedCart",key:"accessToken"}),[src,setSrc]=useState();if(accessToken==null||endpoint==null)return null;const{order,createOrder,getOrder}=useContext(OrderContext),{persistKey}=useContext(OrderStorageContext),{domain,slug}=getDomain(endpoint);async function setOrder(openCart){const orderId=localStorage.getItem(persistKey)??await createOrder({});if(orderId!=null&&accessToken&&endpoint){const config=await getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken,slug}});setSrc(config?.links?.cart??getApplicationLink({slug,orderId,accessToken,domain,applicationType:"cart",customDomain})),openCart&&setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300)}}function onMessage(data){switch(data.message.type){case"update":data.message.payload!=null&&getOrder(data.message.payload.id);break;case"close":type==="mini"&&(handleOpen!=null?handleOpen():setOpen(!1));break;case"blur":type==="mini"&&isOpen&&ref.current?.focus();break}}useEffect(()=>{const orderId=localStorage.getItem(persistKey);let ignore=!1;return open!=null&&open!==isOpen&&setOpen(open),openAdd&&type==="mini"&&subscribe("open-cart",()=>{window.document.body.style.overflow="hidden",src==null&&order?.id==null&&orderId==null?setOrder(!0):(src!=null&&ref.current!=null&&(ref.current.src=src),setTimeout(()=>{handleOpen!=null?handleOpen():setOpen(!0)},300))}),src==null&&order?.id==null&&orderId==null&&accessToken!=null&&!ignore&&isOpen?setOrder():src==null&&(order?.id!=null||orderId!=null)&&accessToken&&getOrganizationConfig({accessToken,endpoint,params:{orderId:order?.id,accessToken,slug}}).then(config=>{setSrc(config?.links?.cart??getApplicationLink({slug,orderId:order?.id??orderId??"",accessToken,domain,applicationType:"cart"}))}),src!=null&&ref.current!=null&&(ref.current.src=src),()=>{ignore=!0,openAdd&&type==="mini"&&unsubscribe("open-cart",()=>{})}},[src,open,order?.id,accessToken]),useEffect(()=>{ref.current!=null&&iframeResizer({checkOrigin:!1,onMessage},ref.current)},[ref.current!=null]);function onCloseCart(){window.document.body.style.removeProperty("overflow"),handleOpen!=null?handleOpen():setOpen(!1)}return src==null?null:type==="mini"?_jsxs(_Fragment,{children:[_jsx("div",{"aria-hidden":"true",style:{...defaultStyle.background,...style?.background,opacity:isOpen?"0.5":defaultStyle.background?.opacity,pointerEvents:isOpen?"initial":defaultStyle.background?.pointerEvents},onClick:onCloseCart}),_jsxs("div",{style:{...defaultStyle.container,...style?.container,right:isOpen?"0":defaultStyle.container?.right,pointerEvents:isOpen?"initial":defaultStyle.container?.pointerEvents},...props,children:[_jsx("div",{style:{...defaultStyle.iconContainer,...style?.iconContainer},children:_jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:{...defaultStyle.icon,...style?.icon},onClick:onCloseCart,children:_jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),_jsx("iframe",{title:"Cart",ref,style:{...defaultStyle.cart,...style?.cart},src,width:"100%",height:"100%"})]})]}):_jsx("iframe",{title:"Cart",ref,style:{...defaultStyle.cart,...style?.cart},src,width:"100%",height:"100%"})}
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type BaseMetadataObject } from '../../typings/index';
2
3
  import type { OrderCreate, Order } from '@commercelayer/sdk';
3
4
  import type { DefaultChildrenType } from '../../typings/globals';
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type TOrderList, type InitialOrderListContext, type OrderListContent } from '../../context/OrderListChildrenContext';
2
3
  import { type ColumnDef, type SortingState } from '@tanstack/react-table';
3
4
  import type { DefaultChildrenType, TRange } from '../../typings/globals';
@@ -1,4 +1,5 @@
1
1
  import { type ChildrenFunction } from '../../typings/index';
2
+ import { type JSX } from 'react';
2
3
  interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
3
4
  /**
4
5
  * Function allow you to customize the component
@@ -1,5 +1,6 @@
1
1
  import { type OrderListPaginationContext as TOrderListPaginationContext } from '../../context/OrderListPaginationContext';
2
2
  import { type ChildrenFunction } from '../../typings/index';
3
+ import type { JSX } from "react";
3
4
  interface PaginationButton extends Omit<JSX.IntrinsicElements['button'], 'children' | 'disabled'> {
4
5
  /**
5
6
  * Show or hide the pagination button. Default is true.
@@ -1,4 +1,5 @@
1
1
  import { type ChildrenFunction } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  type TAsComponent = keyof Pick<JSX.IntrinsicElements, 'p' | 'span' | 'div'>;
3
4
  type ChildrenProps<A extends TAsComponent> = Omit<Props<A>, 'children'> & {
4
5
  /**
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type TOrderList, type OrderListContent, type TableAccessor } from '../../context/OrderListChildrenContext';
2
3
  import { type Row } from '@tanstack/react-table';
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,5 @@
1
1
  import { type BaseFieldProps } from '../utils/BaseField';
2
+ import type { JSX } from "react";
2
3
  type Props = Omit<BaseFieldProps, 'attribute'>;
3
4
  export declare function OrderNumber(props: Props): JSX.Element;
4
5
  export default OrderNumber;
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type JSX } from 'react';
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  /**
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function PaymentMethodAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default PaymentMethodAmount;
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type JSX } from 'react';
2
2
  import { type ChildrenFunction } from '../../typings/index';
3
3
  import type { BaseError } from '../../typings/errors';
4
4
  import type { Order } from '@commercelayer/sdk';
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type JSX } from 'react';
2
2
  import { type PlaceOrderOptions } from '../../reducers/PlaceOrderReducer';
3
3
  interface Props {
4
4
  children: ReactNode;
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type BaseInputProps } from '../utils/BaseInput';
2
3
  export declare function PrivacyAndTermsCheckbox(props: Partial<BaseInputProps>): JSX.Element;
3
4
  export default PrivacyAndTermsCheckbox;
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function ShippingAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default ShippingAmount;
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function SubTotalAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default SubTotalAmount;
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function TaxesAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default TaxesAmount;
@@ -1,3 +1,4 @@
1
1
  import { type BaseAmountComponent } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  export declare function TotalAmount(props: BaseAmountComponent): JSX.Element;
3
4
  export default TotalAmount;
@@ -1,5 +1,6 @@
1
1
  import { type ConditionalElement } from '../../typings/index';
2
2
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
+ import type { JSX } from "react";
3
4
  type ParcelFieldChildrenProps = TGenericChildrenProps<TResources['Parcel']>;
4
5
  type TCondition = ConditionalElement<Exclude<TResources['Parcel'], 'resource'>>;
5
6
  type Props = {
@@ -1,4 +1,5 @@
1
1
  import type { DefaultChildrenType } from '../../typings/globals';
2
+ import { type JSX } from 'react';
2
3
  interface Props {
3
4
  children: DefaultChildrenType;
4
5
  }
@@ -1,5 +1,6 @@
1
1
  import { type ConditionalElement } from '../../typings/index';
2
2
  import { type TGenericChildrenProps, type TResources } from '../utils/GenericFieldComponent';
3
+ import type { JSX } from "react";
3
4
  type ParcelLineItemFieldChildrenProps = TGenericChildrenProps<TResources['ParcelLineItem']>;
4
5
  type TCondition = ConditionalElement<Exclude<TResources['ParcelLineItem'], 'resource'>>;
5
6
  type Props = {
@@ -1,5 +1,6 @@
1
1
  import { type ChildrenFunction } from '../../typings/index';
2
2
  import type { Parcel } from '@commercelayer/sdk';
3
+ import type { JSX } from "react";
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
4
5
  /**
5
6
  * Parcel of the current shipment
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  interface Props {
2
3
  children: JSX.Element | JSX.Element[];
3
4
  filterBy?: string[];
@@ -1,5 +1,6 @@
1
1
  import { type ChildrenFunction } from '../../typings/index';
2
2
  import type { Parcel } from '@commercelayer/sdk';
3
+ import type { JSX } from "react";
3
4
  interface ChildrenProps extends Omit<Props, 'children'> {
4
5
  /**
5
6
  * Shipments of the current order
@@ -1,4 +1,5 @@
1
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
+ import { type JSX } from 'react';
2
3
  type Props = GatewayBaseType;
3
4
  export declare function AdyenGateway(props: Props): JSX.Element | null;
4
5
  export default AdyenGateway;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import isEmpty from"lodash/isEmpty";import{useContext}from"react";import AdyenPayment from"../payment_source/AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import{jwt}from"../../utils/jwt";import getCardDetails from"../../utils/getCardDetails";import{getPaymentAttributes}from"../../utils/getPaymentAttributes";export function AdyenGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=useContext(OrderContext),{accessToken}=useContext(CommerceLayerContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="adyen_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientKey=paymentSource?.public_key,environment=accessToken&&jwt(accessToken).test?"test":"live",paymentConfig=getPaymentAttributes({resource:paymentResource,config:config??{},keys:["adyen_payments"]})?.adyenPayment,customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type==="adyen_payments"||customerPayment.payment_method!=null):[];if(readonly||showCard){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,{value,children})}const hasStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null&&paymentSource?.payment_methods?.storedPaymentMethods.length>0;return!isGuest&&templateCustomerCards?_jsxs(_Fragment,{children:[hasStoredPaymentMethods||isEmpty(customerPayments)?null:_jsx("div",{className:p.className,children:_jsx(PaymentCardsTemplate,{paymentResource,customerPayments,children:templateCustomerCards})}),_jsx(AdyenPayment,{templateCustomerSaveToWallet,clientKey,locale,environment,config:paymentConfig})]}):_jsx(AdyenPayment,{clientKey,locale,config:paymentConfig,environment})}export default AdyenGateway;
2
+ import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import isEmpty from"lodash/isEmpty";import{useContext}from"react";import AdyenPayment from"../payment_source/AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import{jwt}from"../../utils/jwt";import getCardDetails from"../../utils/getCardDetails";import{getPaymentAttributes}from"../../utils/getPaymentAttributes";import{canPlaceOrder}from"../../utils/canPlaceOrder";export function AdyenGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=useContext(OrderContext),{accessToken}=useContext(CommerceLayerContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="adyen_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId&&order!=null&&!canPlaceOrder(order))return null;const clientKey=paymentSource?.public_key,environment=accessToken&&jwt(accessToken).test?"test":"live",paymentConfig=getPaymentAttributes({resource:paymentResource,config:config??{},keys:["adyen_payments"]})?.adyenPayment,customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type==="adyen_payments"||customerPayment.payment_method!=null):[];if(readonly||showCard){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,{value,children})}const hasStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null&&paymentSource?.payment_methods?.storedPaymentMethods.length>0;return!isGuest&&templateCustomerCards?_jsxs(_Fragment,{children:[hasStoredPaymentMethods||isEmpty(customerPayments)?null:_jsx("div",{className:p.className,children:_jsx(PaymentCardsTemplate,{paymentResource,customerPayments,children:templateCustomerCards})}),_jsx(AdyenPayment,{templateCustomerSaveToWallet,clientKey,locale,environment,config:paymentConfig})]}):_jsx(AdyenPayment,{clientKey,locale,config:paymentConfig,environment})}export default AdyenGateway;
@@ -1,4 +1,5 @@
1
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
+ import { type JSX } from 'react';
2
3
  type Props = GatewayBaseType;
3
4
  export declare function BraintreeGateway(props: Props): JSX.Element | null;
4
5
  export default BraintreeGateway;
@@ -1,4 +1,5 @@
1
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
+ import { type JSX } from 'react';
2
3
  type Props = GatewayBaseType;
3
4
  export declare function CheckoutComGateway(props: Props): JSX.Element | null;
4
5
  export default CheckoutComGateway;
@@ -1,4 +1,5 @@
1
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
+ import { type JSX } from 'react';
2
3
  type Props = GatewayBaseType;
3
4
  export declare function ExternalGateway(props: Props): JSX.Element | null;
4
5
  export default ExternalGateway;
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
3
  type Props = GatewayBaseType;
3
4
  export declare function KlarnaGateway(props: Props): JSX.Element | null;
@@ -1,4 +1,5 @@
1
1
  import { type LoaderType } from '../../typings/index';
2
+ import { type JSX } from 'react';
2
3
  import { type PaymentSourceProps } from '../payment_source/PaymentSource';
3
4
  export type GatewayBaseType = Props & {
4
5
  show: boolean;
@@ -1,4 +1,5 @@
1
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
+ import { type JSX } from 'react';
2
3
  type Props = Partial<GatewayBaseType>;
3
4
  export declare function PaypalGateway(props: Props): JSX.Element | null;
4
5
  export default PaypalGateway;
@@ -1,4 +1,5 @@
1
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
+ import { type JSX } from 'react';
2
3
  type Props = GatewayBaseType;
3
4
  export declare function StripeGateway(props: Props): JSX.Element | null;
4
5
  export default StripeGateway;
@@ -1,4 +1,5 @@
1
1
  import { type GatewayBaseType } from '../payment_gateways/PaymentGateway';
2
+ import { type JSX } from 'react';
2
3
  type Props = GatewayBaseType;
3
4
  export declare function WireTransferGateway(props: Props): JSX.Element | null;
4
5
  export default WireTransferGateway;
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import type { LoaderType } from '../../typings/index';
2
3
  import type { Order, PaymentMethod as PaymentMethodType } from '@commercelayer/sdk';
3
4
  import type { PaymentResource } from '../../reducers/PaymentMethodReducer';
@@ -1,4 +1,5 @@
1
1
  import { type ChildrenFunction } from '../../typings/index';
2
+ import type { JSX } from "react";
2
3
  interface ChildrenProps extends Omit<Props, 'children'> {
3
4
  labelName: string;
4
5
  }
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type BaseAmountComponent } from '../../typings/index';
2
3
  interface Props extends BaseAmountComponent {
3
4
  type?: 'amount';
@@ -1,4 +1,4 @@
1
- import { type ChangeEvent } from 'react';
1
+ import { type ChangeEvent, type JSX } from 'react';
2
2
  import type { Order, PaymentMethod } from '@commercelayer/sdk';
3
3
  import { type ChildrenFunction } from '../../typings/index';
4
4
  interface ChildrenProps extends Omit<Props, 'children'> {
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactNode, type JSX } from 'react';
2
2
  import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
3
3
  interface Props {
4
4
  children: ReactNode;
@@ -1,4 +1,4 @@
1
- import { type CSSProperties } from 'react';
1
+ import { type CSSProperties, type JSX } from 'react';
2
2
  import { type PaymentSourceProps } from './PaymentSource';
3
3
  import type { CoreOptions } from '@adyen/adyen-web/dist/types/core/types';
4
4
  type Styles = Partial<{
@@ -37,14 +37,42 @@ interface PaymentMethodsStyle {
37
37
  card?: Styles;
38
38
  paypal?: PaypalStyle;
39
39
  }
40
+ /**
41
+ * Configuration options for the Adyen payment component.
42
+ */
40
43
  export interface AdyenPaymentConfig {
44
+ /**
45
+ * Optional CSS class name for the card container.
46
+ */
41
47
  cardContainerClassName?: string;
48
+ /**
49
+ * Optional CSS class name for the 3D Secure container.
50
+ */
42
51
  threeDSecureContainerClassName?: string;
52
+ /**
53
+ * Callback function to be called when an order is placed.
54
+ * @param response - An object containing the placement status.
55
+ */
43
56
  placeOrderCallback?: (response: {
44
57
  placed: boolean;
45
58
  }) => void;
59
+ /**
60
+ * Optional styles for the payment methods.
61
+ */
46
62
  styles?: PaymentMethodsStyle;
63
+ /**
64
+ * Configuration options for the payment methods.
65
+ */
47
66
  paymentMethodsConfiguration?: CoreOptions['paymentMethodsConfiguration'];
67
+ /**
68
+ * Callback function to disable a stored payment method.
69
+ * @param props - An object containing the recurring detail reference and shopper reference.
70
+ * @returns A promise that resolves to a boolean indicating whether the stored payment method was disabled.
71
+ */
72
+ onDisableStoredPaymentMethod?: (props: {
73
+ recurringDetailReference: string;
74
+ shopperReference: string | undefined;
75
+ }) => Promise<boolean>;
48
76
  }
49
77
  interface Props {
50
78
  clientKey?: string;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{setCustomerOrderParam}from"../../utils/localStorage";import Parent from"../utils/Parent";import browserInfo,{cleanUrlBy}from"../../utils/browserInfo";import PlaceOrderContext from"../../context/PlaceOrderContext";import OrderContext from"../../context/OrderContext";import{getPublicIP}from"../../utils/getPublicIp";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,styles}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{placeOrderButtonRef,setPlaceOrder}=useContext(PlaceOrderContext),ref=useRef(null),handleSubmit=async(e,component)=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;return savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),component?.submit&&component.submit(),!1},handleChange=async(state,component)=>{state.isValid&&ref.current&&(ref.current.onsubmit=async()=>await handleSubmit(ref.current,component),setPaymentRef({ref}))},handleOnAdditionalDetails=async(state,component)=>{const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}),adyenAction=pSource?.payment_response?.action,resultCode=pSource?.payment_response?.resultCode;if(adyenAction&&component)return component.handleAction(adyenAction),!1;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=pSource?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return!1}catch(error){return console.error("Adyen additional details error:",error),!1}},onSubmit=async(state,component)=>{const url=cleanUrlBy(),shopperIp=await getPublicIP();if((await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"}))?.payment_response?.resultCode==="Authorised")return!0;const attributes={payment_request_data:{...state.data,payment_method:state.data.paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",browser_info:{...browserInfo()}}};delete attributes.payment_request_data.paymentMethod;try{await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes});const res=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_authorize:1}}),action=res?.payment_response?.action;if(component&&action)return component.handleAction(action),!1;const resultCode=res?.payment_response?.resultCode,issuerType=res?.payment_instrument?.issuer_type;if(["Authorised","Pending","Received"].includes(resultCode))return["apple pay","google pay"].includes(issuerType)&&setPlaceOrder!=null?(await setPlaceOrder({paymentSource:res,currentCustomerPaymentSourceId}),!0):(placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0);if(["Cancelled","Refused"].includes(resultCode)){const message=res?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}if(res?.payment_response?.errorType)if(res?.payment_response?.errorCode==="14_006")onSubmit(state,component);else{const message=res?.payment_response?.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])}return!1}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}};return useEffect(()=>{const paymentMethodsResponse={paymentMethods:paymentSource?.payment_methods?.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:paymentSource?.payment_methods?.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]},[firstPaymentMethod]=paymentMethodsResponse.paymentMethods,isOnlyCard=paymentMethodsResponse.paymentMethods?.length===1&&firstPaymentMethod.type==="scheme";paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const showStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null,options={locale:order?.language_code??locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,paymentMethodsConfiguration:{showStoredPaymentMethods,paypal:{showPayButton:!0,style:styles?.paypal,...config?.paymentMethodsConfiguration?.paypal},card:{enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1,...config?.paymentMethodsConfiguration?.card},...config?.paymentMethodsConfiguration},onAdditionalDetails:(state,element)=>{handleOnAdditionalDetails(state,element)},onChange:(state,element)=>{handleChange(state,element)},onSubmit:(state,element)=>{onSubmit(state,element)}};return!ref&&clientKey&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout&&import("@adyen/adyen-web").then(({default:AdyenCheckout})=>{const type=isOnlyCard?"card":"dropin";AdyenCheckout(options).then(adyenCheckout=>{const component=adyenCheckout.create(type,{showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],onDisableStoredPaymentMethod:state=>{console.log("onDisableStoredPaymentMethod",state)},onSelect:component2=>{const id=component2._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=async()=>await handleSubmit(ref.current,component2):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");component&&(setCheckout(component),setLoadAdyen(!0))})}),()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:_jsxs("form",{ref,onSubmit:e=>{handleSubmit(e,checkout)},children:[_jsx("div",{className:cardContainerClassName,id:"adyen-dropin"}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),_jsx("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}export default AdyenPayment;
2
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{setCustomerOrderParam}from"../../utils/localStorage";import Parent from"../utils/Parent";import browserInfo,{cleanUrlBy}from"../../utils/browserInfo";import PlaceOrderContext from"../../context/PlaceOrderContext";import OrderContext from"../../context/OrderContext";import{getPublicIP}from"../../utils/getPublicIp";import CustomerContext from"../../context/CustomerContext";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,styles,onDisableStoredPaymentMethod}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{placeOrderButtonRef,setPlaceOrder}=useContext(PlaceOrderContext),{customers}=useContext(CustomerContext),ref=useRef(null),handleSubmit=async(e,component)=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;return savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),component?.submit&&component.submit(),!1},handleChange=async(state,component)=>{state.isValid&&ref.current&&(ref.current.onsubmit=async()=>await handleSubmit(ref.current,component),setPaymentRef({ref}))},handleOnAdditionalDetails=async(state,component)=>{const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}),adyenAction=pSource?.payment_response?.action,resultCode=pSource?.payment_response?.resultCode;if(adyenAction&&component)return component.handleAction(adyenAction),!1;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=pSource?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return!1}catch(error){return console.error("Adyen additional details error:",error),!1}},onSubmit=async(state,component)=>{const url=cleanUrlBy(),shopperIp=await getPublicIP();if((await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"}))?.payment_response?.resultCode==="Authorised")return!0;const attributes={payment_request_data:{...state.data,payment_method:state.data.paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",browser_info:{...browserInfo()}}};delete attributes.payment_request_data.paymentMethod;try{if(await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),order?.id==null)return console.error("Order id is missing"),!1;const res=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_authorize:1}}),action=res?.payment_response?.action;if(component&&action)return component.handleAction(action),!1;const resultCode=res?.payment_response?.resultCode,issuerType=res?.payment_instrument?.issuer_type;if(["Authorised","Pending","Received"].includes(resultCode))return["apple pay","google pay"].includes(issuerType)&&setPlaceOrder!=null?(await setPlaceOrder({paymentSource:res,currentCustomerPaymentSourceId}),!0):(placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0);if(["Cancelled","Refused"].includes(resultCode)){const message=res?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}if(res?.payment_response?.errorType)if(res?.payment_response?.errorCode==="14_006")onSubmit(state,component);else{const message=res?.payment_response?.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])}return!1}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}};return useEffect(()=>{const paymentMethodsResponse={paymentMethods:paymentSource?.payment_methods?.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:paymentSource?.payment_methods?.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]},[firstPaymentMethod]=paymentMethodsResponse.paymentMethods,isOnlyCard=paymentMethodsResponse.paymentMethods?.length===1&&firstPaymentMethod.type==="scheme";paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const showStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null,options={locale:order?.language_code??locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,paymentMethodsConfiguration:{showStoredPaymentMethods,paypal:{showPayButton:!0,style:styles?.paypal,...config?.paymentMethodsConfiguration?.paypal},card:{enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1,...config?.paymentMethodsConfiguration?.card},...config?.paymentMethodsConfiguration},onAdditionalDetails:(state,element)=>{handleOnAdditionalDetails(state,element)},onChange:(state,element)=>{handleChange(state,element)},onSubmit:(state,element)=>{onSubmit(state,element)}};return!ref&&clientKey&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout&&import("@adyen/adyen-web").then(({default:AdyenCheckout})=>{const type=isOnlyCard?"card":"dropin";AdyenCheckout(options).then(adyenCheckout=>{const component=adyenCheckout.create(type,{showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],onDisableStoredPaymentMethod:state=>{const recurringDetailReference=state,shopperReference=customers?.shopper_reference??void 0;onDisableStoredPaymentMethod?.({recurringDetailReference,shopperReference}).then(response=>{response?setPaymentSource({paymentResource:"adyen_payments",order,attributes:{}}):console.error("onDisableStoredPaymentMethod error")})},onSelect:component2=>{const id=component2._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=async()=>await handleSubmit(ref.current,component2):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");component&&(setCheckout(component),setLoadAdyen(!0))})}),()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:_jsxs("form",{ref,onSubmit:e=>{handleSubmit(e,checkout)},children:[_jsx("div",{className:cardContainerClassName,id:"adyen-dropin"}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),_jsx("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}export default AdyenPayment;
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type PaymentSourceProps } from './PaymentSource';
2
3
  import { type HostedFieldFieldOptions } from 'braintree-web';
3
4
  type BraintreeHostedFields<Type> = {
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
2
3
  import { type PaymentSourceProps } from './PaymentSource';
3
4
  import { type FramesStyle } from 'frames-react';
@@ -1,5 +1,6 @@
1
1
  import { type ChildrenFunction } from '../../typings/index';
2
2
  import type { StripeElementLocale } from '@stripe/stripe-js';
3
+ import { type JSX } from 'react';
3
4
  import { type PaymentSourceProps } from './PaymentSource';
4
5
  export interface ExternalPaymentConfig {
5
6
  /**
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type PaymentMethodConfig } from '../../reducers/PaymentMethodReducer';
2
3
  import { type PaymentSourceProps } from './PaymentSource';
3
4
  type KlarnaPaymentProps = PaymentMethodConfig['klarnaPayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
@@ -1,3 +1,4 @@
1
+ import { type JSX } from 'react';
1
2
  import { type LoaderType } from '../../typings/index';
2
3
  import { type CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
3
4
  export interface CustomerCardsProps {