@commercelayer/react-components 4.0.0-alpha.2 → 4.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (570) hide show
  1. package/lib/cjs/components/Errors.js +1 -1
  2. package/lib/cjs/components/ExternalFunction.d.ts +1 -1
  3. package/lib/cjs/components/MetadataInput.d.ts +1 -1
  4. package/lib/cjs/components/SubmitButton.d.ts +1 -1
  5. package/lib/cjs/components/addresses/Address.d.ts +1 -1
  6. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +2 -2
  7. package/lib/cjs/components/addresses/AddressField.d.ts +4 -4
  8. package/lib/cjs/components/addresses/AddressField.js +1 -1
  9. package/lib/cjs/components/addresses/AddressInput.d.ts +2 -2
  10. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +2 -2
  11. package/lib/cjs/components/addresses/AddressesContainer.d.ts +1 -1
  12. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +6 -0
  13. package/lib/cjs/components/addresses/BillingAddressContainer.js +1 -0
  14. package/lib/{esm/components → cjs/components/addresses}/BillingAddressForm.d.ts +1 -1
  15. package/lib/cjs/components/addresses/BillingAddressForm.js +1 -0
  16. package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +11 -0
  17. package/lib/cjs/components/addresses/SaveAddressesButton.js +1 -0
  18. package/lib/{esm/components → cjs/components/addresses}/ShippingAddressContainer.d.ts +1 -1
  19. package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -0
  20. package/lib/cjs/components/{ShippingAddressForm.d.ts → addresses/ShippingAddressForm.d.ts} +1 -1
  21. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -0
  22. package/lib/cjs/components/auth/CommerceLayer.d.ts +1 -1
  23. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +1 -1
  24. package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
  25. package/lib/cjs/components/customers/SaveCustomerButton.d.ts +13 -0
  26. package/lib/cjs/components/{SaveCustomerButton.js → customers/SaveCustomerButton.js} +1 -1
  27. package/lib/cjs/components/{GiftCard.d.ts → gift_cards/GiftCard.d.ts} +2 -2
  28. package/lib/cjs/components/gift_cards/GiftCard.js +1 -0
  29. package/lib/{esm/components → cjs/components/gift_cards}/GiftCardContainer.d.ts +1 -1
  30. package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -0
  31. package/lib/cjs/components/{GiftCardCurrencySelector.d.ts → gift_cards/GiftCardCurrencySelector.d.ts} +2 -2
  32. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -0
  33. package/lib/{esm/components → cjs/components/gift_cards}/GiftCardInput.d.ts +3 -3
  34. package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -0
  35. package/lib/cjs/components/{GiftCardOrCouponCode.d.ts → gift_cards/GiftCardOrCouponCode.d.ts} +2 -2
  36. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -0
  37. package/lib/{esm/components → cjs/components/gift_cards}/GiftCardOrCouponForm.d.ts +1 -1
  38. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -0
  39. package/lib/cjs/components/{GiftCardOrCouponInput.d.ts → gift_cards/GiftCardOrCouponInput.d.ts} +2 -2
  40. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -0
  41. package/lib/cjs/components/{GiftCardOrCouponRemoveButton.d.ts → gift_cards/GiftCardOrCouponRemoveButton.d.ts} +3 -3
  42. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -0
  43. package/lib/cjs/components/{GiftCardOrCouponSubmit.d.ts → gift_cards/GiftCardOrCouponSubmit.d.ts} +2 -2
  44. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +1 -0
  45. package/lib/cjs/components/{GiftCardRecipient.d.ts → gift_cards/GiftCardRecipient.d.ts} +0 -0
  46. package/lib/cjs/components/{GiftCardRecipient.js → gift_cards/GiftCardRecipient.js} +0 -0
  47. package/lib/cjs/components/{GiftCardRecipientInput.d.ts → gift_cards/GiftCardRecipientInput.d.ts} +0 -0
  48. package/lib/cjs/components/{GiftCardRecipientInput.js → gift_cards/GiftCardRecipientInput.js} +0 -0
  49. package/lib/{esm/components → cjs/components/line_items}/LineItem.d.ts +2 -2
  50. package/lib/cjs/components/line_items/LineItem.js +1 -0
  51. package/lib/{esm/components → cjs/components/line_items}/LineItemAmount.d.ts +2 -2
  52. package/lib/cjs/components/line_items/LineItemAmount.js +1 -0
  53. package/lib/cjs/components/{LineItemCode.d.ts → line_items/LineItemCode.d.ts} +2 -2
  54. package/lib/cjs/components/line_items/LineItemCode.js +1 -0
  55. package/lib/cjs/components/{LineItemImage.d.ts → line_items/LineItemImage.d.ts} +3 -3
  56. package/lib/cjs/components/line_items/LineItemImage.js +1 -0
  57. package/lib/cjs/components/{LineItemName.d.ts → line_items/LineItemName.d.ts} +2 -2
  58. package/lib/cjs/components/line_items/LineItemName.js +1 -0
  59. package/lib/cjs/components/{LineItemOption.d.ts → line_items/LineItemOption.d.ts} +1 -1
  60. package/lib/cjs/components/line_items/LineItemOption.js +1 -0
  61. package/lib/cjs/components/{LineItemOptions.d.ts → line_items/LineItemOptions.d.ts} +0 -0
  62. package/lib/cjs/components/line_items/LineItemOptions.js +1 -0
  63. package/lib/{esm/components → cjs/components/line_items}/LineItemQuantity.d.ts +1 -1
  64. package/lib/cjs/components/line_items/LineItemQuantity.js +1 -0
  65. package/lib/cjs/components/{LineItemRemoveLink.d.ts → line_items/LineItemRemoveLink.d.ts} +1 -1
  66. package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -0
  67. package/lib/{esm/components → cjs/components/line_items}/LineItemsContainer.d.ts +2 -2
  68. package/lib/cjs/components/line_items/LineItemsContainer.js +1 -0
  69. package/lib/{esm/components → cjs/components/line_items}/LineItemsCount.d.ts +2 -2
  70. package/lib/cjs/components/line_items/LineItemsCount.js +1 -0
  71. package/lib/cjs/components/{LineItemsEmpty.d.ts → line_items/LineItemsEmpty.d.ts} +1 -1
  72. package/lib/cjs/components/line_items/LineItemsEmpty.js +1 -0
  73. package/lib/cjs/components/orders/AddToCartButton.d.ts +3 -3
  74. package/lib/cjs/components/orders/AddToCartButton.js +1 -1
  75. package/lib/cjs/components/orders/AdjustmentAmount.d.ts +2 -16
  76. package/lib/cjs/components/orders/AdjustmentAmount.js +1 -1
  77. package/lib/cjs/components/orders/CartLink.js +1 -1
  78. package/lib/cjs/components/{CheckoutLink.d.ts → orders/CheckoutLink.d.ts} +1 -11
  79. package/lib/cjs/components/orders/CheckoutLink.js +1 -0
  80. package/lib/cjs/components/{DiscountAmount.d.ts → orders/DiscountAmount.d.ts} +3 -3
  81. package/lib/cjs/components/orders/DiscountAmount.js +1 -0
  82. package/lib/{esm/components → cjs/components/orders}/ItemContainer.d.ts +1 -1
  83. package/lib/cjs/components/orders/ItemContainer.js +1 -0
  84. package/lib/cjs/components/orders/OrderContainer.d.ts +1 -1
  85. package/lib/cjs/components/orders/OrderList.d.ts +1 -1
  86. package/lib/cjs/components/orders/OrderListRow.d.ts +2 -2
  87. package/lib/cjs/components/orders/OrderStorage.d.ts +1 -1
  88. package/lib/cjs/components/orders/PlaceOrderButton.d.ts +1 -1
  89. package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
  90. package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +1 -1
  91. package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
  92. package/lib/{esm/components → cjs/components/orders}/ShippingAmount.d.ts +2 -2
  93. package/lib/cjs/components/orders/ShippingAmount.js +1 -0
  94. package/lib/cjs/components/{gateways → payment_gateways}/AdyenGateway.d.ts +1 -1
  95. package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -0
  96. package/lib/{esm/components/gateways → cjs/components/payment_gateways}/BraintreeGateway.d.ts +1 -1
  97. package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -0
  98. package/lib/cjs/components/{gateways → payment_gateways}/CheckoutComGateway.d.ts +1 -1
  99. package/lib/cjs/components/payment_gateways/CheckoutComGateway.js +1 -0
  100. package/lib/{esm/components/gateways → cjs/components/payment_gateways}/KlarnaGateway.d.ts +1 -1
  101. package/lib/cjs/components/payment_gateways/KlarnaGateway.js +1 -0
  102. package/lib/cjs/components/{PaymentGateway.d.ts → payment_gateways/PaymentGateway.d.ts} +2 -2
  103. package/lib/cjs/components/payment_gateways/PaymentGateway.js +1 -0
  104. package/lib/cjs/components/{gateways → payment_gateways}/PaypalGateway.d.ts +1 -1
  105. package/lib/cjs/components/payment_gateways/PaypalGateway.js +1 -0
  106. package/lib/cjs/components/{gateways → payment_gateways}/StripeGateway.d.ts +1 -1
  107. package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -0
  108. package/lib/cjs/components/{gateways → payment_gateways}/WireTransferGateway.d.ts +1 -1
  109. package/lib/cjs/components/payment_gateways/WireTransferGateway.js +1 -0
  110. package/lib/cjs/components/{PaymentMethod.d.ts → payment_methods/PaymentMethod.d.ts} +8 -3
  111. package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -0
  112. package/lib/cjs/components/{PaymentMethodAmount.d.ts → payment_methods/PaymentMethodAmount.d.ts} +3 -3
  113. package/lib/cjs/components/payment_methods/PaymentMethodAmount.js +1 -0
  114. package/lib/{esm/components → cjs/components/payment_methods}/PaymentMethodName.d.ts +2 -2
  115. package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -0
  116. package/lib/cjs/components/{PaymentMethodPrice.d.ts → payment_methods/PaymentMethodPrice.d.ts} +2 -2
  117. package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +1 -0
  118. package/lib/cjs/components/{PaymentMethodRadioButton.d.ts → payment_methods/PaymentMethodRadioButton.d.ts} +2 -2
  119. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -0
  120. package/lib/{esm/components → cjs/components/payment_methods}/PaymentMethodsContainer.d.ts +2 -2
  121. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -0
  122. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +55 -0
  123. package/lib/cjs/components/payment_source/AdyenPayment.js +1 -0
  124. package/lib/cjs/components/{BraintreePayment.d.ts → payment_source/BraintreePayment.d.ts} +0 -0
  125. package/lib/cjs/components/payment_source/BraintreePayment.js +1 -0
  126. package/lib/{esm/components → cjs/components/payment_source}/CheckoutComPayment.d.ts +1 -1
  127. package/lib/cjs/components/payment_source/CheckoutComPayment.js +1 -0
  128. package/lib/cjs/components/{KlarnaPayment.d.ts → payment_source/KlarnaPayment.d.ts} +1 -1
  129. package/lib/cjs/components/payment_source/KlarnaPayment.js +1 -0
  130. package/lib/cjs/components/{PaymentSource.d.ts → payment_source/PaymentSource.d.ts} +4 -4
  131. package/lib/cjs/components/payment_source/PaymentSource.js +1 -0
  132. package/lib/{esm/components → cjs/components/payment_source}/PaymentSourceBrandIcon.d.ts +2 -2
  133. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +1 -0
  134. package/lib/{esm/components → cjs/components/payment_source}/PaymentSourceBrandName.d.ts +2 -2
  135. package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +1 -0
  136. package/lib/{esm/components → cjs/components/payment_source}/PaymentSourceDetail.d.ts +2 -2
  137. package/lib/cjs/components/payment_source/PaymentSourceDetail.js +1 -0
  138. package/lib/cjs/components/{PaymentSourceEditButton.d.ts → payment_source/PaymentSourceEditButton.d.ts} +2 -2
  139. package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +1 -0
  140. package/lib/cjs/components/{PaypalPayment.d.ts → payment_source/PaypalPayment.d.ts} +0 -0
  141. package/lib/cjs/components/payment_source/PaypalPayment.js +1 -0
  142. package/lib/cjs/components/{StripePayment.d.ts → payment_source/StripePayment.d.ts} +1 -1
  143. package/lib/cjs/components/payment_source/StripePayment.js +1 -0
  144. package/lib/cjs/components/{WireTransferPayment.d.ts → payment_source/WireTransferPayment.d.ts} +3 -1
  145. package/lib/cjs/components/payment_source/WireTransferPayment.js +1 -0
  146. package/lib/cjs/components/{Price.d.ts → prices/Price.d.ts} +1 -1
  147. package/lib/cjs/components/prices/Price.js +1 -0
  148. package/lib/{esm/components → cjs/components/prices}/PricesContainer.d.ts +3 -3
  149. package/lib/cjs/components/prices/PricesContainer.js +1 -0
  150. package/lib/cjs/components/shipments/Shipment.d.ts +1 -1
  151. package/lib/cjs/components/shipments/ShipmentField.d.ts +3 -3
  152. package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +1 -1
  153. package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +1 -1
  154. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +2 -2
  155. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +2 -2
  156. package/lib/cjs/components/{AvailabilityContainer.d.ts → skus/AvailabilityContainer.d.ts} +1 -1
  157. package/lib/cjs/components/skus/AvailabilityContainer.js +1 -0
  158. package/lib/{esm/components → cjs/components/skus}/AvailabilityTemplate.d.ts +2 -2
  159. package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -0
  160. package/lib/{esm/components → cjs/components/skus}/DeliveryLeadTime.d.ts +3 -3
  161. package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -0
  162. package/lib/cjs/components/{QuantitySelector.d.ts → skus/QuantitySelector.d.ts} +1 -1
  163. package/lib/cjs/components/skus/QuantitySelector.js +1 -0
  164. package/lib/cjs/components/skus/SkuList.d.ts +1 -1
  165. package/lib/cjs/components/skus/SkuListsContainer.d.ts +1 -1
  166. package/lib/cjs/components/skus/SkuOption.d.ts +1 -1
  167. package/lib/cjs/components/skus/SkuOptionInput.d.ts +1 -1
  168. package/lib/cjs/components/skus/SkuOptionsContainer.d.ts +1 -1
  169. package/lib/cjs/components/skus/Skus.d.ts +1 -1
  170. package/lib/cjs/components/skus/SkusContainer.d.ts +0 -5
  171. package/lib/cjs/components/skus/SkusContainer.js +1 -1
  172. package/lib/cjs/components/{VariantSelector.d.ts → skus/VariantSelector.d.ts} +6 -6
  173. package/lib/cjs/components/skus/VariantSelector.js +1 -0
  174. package/lib/cjs/components/{VariantsContainer.d.ts → skus/VariantsContainer.d.ts} +1 -1
  175. package/lib/cjs/components/skus/VariantsContainer.js +1 -0
  176. package/lib/{esm/components → cjs/components/stock_transfers}/StockTransfer.d.ts +1 -1
  177. package/lib/cjs/components/stock_transfers/StockTransfer.js +1 -0
  178. package/lib/{esm/components → cjs/components/stock_transfers}/StockTransferField.d.ts +2 -2
  179. package/lib/cjs/components/stock_transfers/StockTransferField.js +1 -0
  180. package/lib/cjs/components/utils/BaseField.d.ts +2 -2
  181. package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
  182. package/lib/cjs/components/utils/Parent.d.ts +5 -5
  183. package/lib/cjs/components/utils/Parent.js +1 -1
  184. package/lib/cjs/components/utils/PriceTemplate.d.ts +1 -1
  185. package/lib/cjs/components/utils/VariantTemplate.d.ts +3 -3
  186. package/lib/cjs/components/utils/VariantTemplate.js +1 -1
  187. package/lib/cjs/components/utils/getAllErrors.d.ts +2 -2
  188. package/lib/cjs/config/components.d.ts +66 -66
  189. package/lib/cjs/context/OrderListChildrenContext.d.ts +3 -3
  190. package/lib/cjs/context/PlaceOrderContext.d.ts +2 -1
  191. package/lib/cjs/index.d.ts +55 -55
  192. package/lib/cjs/index.js +1 -1
  193. package/lib/cjs/reducers/AddressReducer.d.ts +1 -0
  194. package/lib/cjs/reducers/PaymentMethodReducer.d.ts +7 -6
  195. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +7 -4
  196. package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
  197. package/lib/cjs/reducers/VariantReducer.d.ts +1 -1
  198. package/lib/cjs/typings/errors.d.ts +2 -2
  199. package/lib/cjs/typings/index.d.ts +10 -10
  200. package/lib/cjs/utils/childrenTypes.d.ts +1 -1
  201. package/lib/cjs/utils/getCardDetails.js +1 -1
  202. package/lib/cjs/utils/getLoaderComponent.js +1 -1
  203. package/lib/cjs/utils/paypalPayment.d.ts +1 -1
  204. package/lib/esm/components/Errors.js +1 -1
  205. package/lib/esm/components/ExternalFunction.d.ts +1 -1
  206. package/lib/esm/components/MetadataInput.d.ts +1 -1
  207. package/lib/esm/components/SubmitButton.d.ts +1 -1
  208. package/lib/esm/components/addresses/Address.d.ts +1 -1
  209. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +2 -2
  210. package/lib/esm/components/addresses/AddressField.d.ts +4 -4
  211. package/lib/esm/components/addresses/AddressField.js +1 -1
  212. package/lib/esm/components/addresses/AddressInput.d.ts +2 -2
  213. package/lib/esm/components/addresses/AddressStateSelector.d.ts +2 -2
  214. package/lib/esm/components/addresses/AddressesContainer.d.ts +1 -1
  215. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +6 -0
  216. package/lib/esm/components/addresses/BillingAddressContainer.js +1 -0
  217. package/lib/{cjs/components → esm/components/addresses}/BillingAddressForm.d.ts +1 -1
  218. package/lib/esm/components/addresses/BillingAddressForm.js +1 -0
  219. package/lib/esm/components/addresses/SaveAddressesButton.d.ts +11 -0
  220. package/lib/esm/components/addresses/SaveAddressesButton.js +1 -0
  221. package/lib/{cjs/components → esm/components/addresses}/ShippingAddressContainer.d.ts +1 -1
  222. package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -0
  223. package/lib/esm/components/{ShippingAddressForm.d.ts → addresses/ShippingAddressForm.d.ts} +1 -1
  224. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -0
  225. package/lib/esm/components/auth/CommerceLayer.d.ts +1 -1
  226. package/lib/esm/components/customers/CustomerAddressForm.d.ts +1 -1
  227. package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
  228. package/lib/esm/components/customers/SaveCustomerButton.d.ts +13 -0
  229. package/lib/esm/components/customers/SaveCustomerButton.js +1 -0
  230. package/lib/esm/components/{GiftCard.d.ts → gift_cards/GiftCard.d.ts} +2 -2
  231. package/lib/esm/components/gift_cards/GiftCard.js +1 -0
  232. package/lib/{cjs/components → esm/components/gift_cards}/GiftCardContainer.d.ts +1 -1
  233. package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -0
  234. package/lib/esm/components/{GiftCardCurrencySelector.d.ts → gift_cards/GiftCardCurrencySelector.d.ts} +2 -2
  235. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -0
  236. package/lib/{cjs/components → esm/components/gift_cards}/GiftCardInput.d.ts +3 -3
  237. package/lib/esm/components/gift_cards/GiftCardInput.js +1 -0
  238. package/lib/esm/components/{GiftCardOrCouponCode.d.ts → gift_cards/GiftCardOrCouponCode.d.ts} +2 -2
  239. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.js +1 -0
  240. package/lib/{cjs/components → esm/components/gift_cards}/GiftCardOrCouponForm.d.ts +1 -1
  241. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -0
  242. package/lib/esm/components/{GiftCardOrCouponInput.d.ts → gift_cards/GiftCardOrCouponInput.d.ts} +2 -2
  243. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -0
  244. package/lib/esm/components/{GiftCardOrCouponRemoveButton.d.ts → gift_cards/GiftCardOrCouponRemoveButton.d.ts} +3 -3
  245. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -0
  246. package/lib/esm/components/{GiftCardOrCouponSubmit.d.ts → gift_cards/GiftCardOrCouponSubmit.d.ts} +2 -2
  247. package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.js +1 -0
  248. package/lib/esm/components/{GiftCardRecipient.d.ts → gift_cards/GiftCardRecipient.d.ts} +0 -0
  249. package/lib/esm/components/{GiftCardRecipient.js → gift_cards/GiftCardRecipient.js} +0 -0
  250. package/lib/esm/components/{GiftCardRecipientInput.d.ts → gift_cards/GiftCardRecipientInput.d.ts} +0 -0
  251. package/lib/esm/components/{GiftCardRecipientInput.js → gift_cards/GiftCardRecipientInput.js} +0 -0
  252. package/lib/{cjs/components → esm/components/line_items}/LineItem.d.ts +2 -2
  253. package/lib/esm/components/line_items/LineItem.js +1 -0
  254. package/lib/{cjs/components → esm/components/line_items}/LineItemAmount.d.ts +2 -2
  255. package/lib/esm/components/line_items/LineItemAmount.js +1 -0
  256. package/lib/esm/components/{LineItemCode.d.ts → line_items/LineItemCode.d.ts} +2 -2
  257. package/lib/esm/components/line_items/LineItemCode.js +1 -0
  258. package/lib/esm/components/{LineItemImage.d.ts → line_items/LineItemImage.d.ts} +3 -3
  259. package/lib/esm/components/line_items/LineItemImage.js +1 -0
  260. package/lib/esm/components/{LineItemName.d.ts → line_items/LineItemName.d.ts} +2 -2
  261. package/lib/esm/components/line_items/LineItemName.js +1 -0
  262. package/lib/esm/components/{LineItemOption.d.ts → line_items/LineItemOption.d.ts} +1 -1
  263. package/lib/esm/components/line_items/LineItemOption.js +1 -0
  264. package/lib/esm/components/{LineItemOptions.d.ts → line_items/LineItemOptions.d.ts} +0 -0
  265. package/lib/esm/components/line_items/LineItemOptions.js +1 -0
  266. package/lib/{cjs/components → esm/components/line_items}/LineItemQuantity.d.ts +1 -1
  267. package/lib/esm/components/line_items/LineItemQuantity.js +1 -0
  268. package/lib/esm/components/{LineItemRemoveLink.d.ts → line_items/LineItemRemoveLink.d.ts} +1 -1
  269. package/lib/esm/components/line_items/LineItemRemoveLink.js +1 -0
  270. package/lib/{cjs/components → esm/components/line_items}/LineItemsContainer.d.ts +2 -2
  271. package/lib/esm/components/line_items/LineItemsContainer.js +1 -0
  272. package/lib/{cjs/components → esm/components/line_items}/LineItemsCount.d.ts +2 -2
  273. package/lib/esm/components/line_items/LineItemsCount.js +1 -0
  274. package/lib/esm/components/{LineItemsEmpty.d.ts → line_items/LineItemsEmpty.d.ts} +1 -1
  275. package/lib/esm/components/line_items/LineItemsEmpty.js +1 -0
  276. package/lib/esm/components/orders/AddToCartButton.d.ts +3 -3
  277. package/lib/esm/components/orders/AddToCartButton.js +1 -1
  278. package/lib/esm/components/orders/AdjustmentAmount.d.ts +2 -16
  279. package/lib/esm/components/orders/AdjustmentAmount.js +1 -1
  280. package/lib/esm/components/orders/CartLink.js +1 -1
  281. package/lib/esm/components/{CheckoutLink.d.ts → orders/CheckoutLink.d.ts} +1 -11
  282. package/lib/esm/components/orders/CheckoutLink.js +1 -0
  283. package/lib/esm/components/{DiscountAmount.d.ts → orders/DiscountAmount.d.ts} +3 -3
  284. package/lib/esm/components/orders/DiscountAmount.js +1 -0
  285. package/lib/{cjs/components → esm/components/orders}/ItemContainer.d.ts +1 -1
  286. package/lib/esm/components/orders/ItemContainer.js +1 -0
  287. package/lib/esm/components/orders/OrderContainer.d.ts +1 -1
  288. package/lib/esm/components/orders/OrderList.d.ts +1 -1
  289. package/lib/esm/components/orders/OrderListRow.d.ts +2 -2
  290. package/lib/esm/components/orders/OrderStorage.d.ts +1 -1
  291. package/lib/esm/components/orders/PlaceOrderButton.d.ts +1 -1
  292. package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
  293. package/lib/esm/components/orders/PlaceOrderContainer.d.ts +1 -1
  294. package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
  295. package/lib/{cjs/components → esm/components/orders}/ShippingAmount.d.ts +2 -2
  296. package/lib/esm/components/orders/ShippingAmount.js +1 -0
  297. package/lib/esm/components/{gateways → payment_gateways}/AdyenGateway.d.ts +1 -1
  298. package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -0
  299. package/lib/{cjs/components/gateways → esm/components/payment_gateways}/BraintreeGateway.d.ts +1 -1
  300. package/lib/esm/components/payment_gateways/BraintreeGateway.js +1 -0
  301. package/lib/esm/components/{gateways → payment_gateways}/CheckoutComGateway.d.ts +1 -1
  302. package/lib/esm/components/payment_gateways/CheckoutComGateway.js +1 -0
  303. package/lib/{cjs/components/gateways → esm/components/payment_gateways}/KlarnaGateway.d.ts +1 -1
  304. package/lib/esm/components/payment_gateways/KlarnaGateway.js +1 -0
  305. package/lib/esm/components/{PaymentGateway.d.ts → payment_gateways/PaymentGateway.d.ts} +2 -2
  306. package/lib/esm/components/payment_gateways/PaymentGateway.js +1 -0
  307. package/lib/esm/components/{gateways → payment_gateways}/PaypalGateway.d.ts +1 -1
  308. package/lib/esm/components/payment_gateways/PaypalGateway.js +1 -0
  309. package/lib/esm/components/{gateways → payment_gateways}/StripeGateway.d.ts +1 -1
  310. package/lib/esm/components/payment_gateways/StripeGateway.js +1 -0
  311. package/lib/esm/components/{gateways → payment_gateways}/WireTransferGateway.d.ts +1 -1
  312. package/lib/esm/components/payment_gateways/WireTransferGateway.js +1 -0
  313. package/lib/esm/components/{PaymentMethod.d.ts → payment_methods/PaymentMethod.d.ts} +8 -3
  314. package/lib/esm/components/payment_methods/PaymentMethod.js +1 -0
  315. package/lib/esm/components/{PaymentMethodAmount.d.ts → payment_methods/PaymentMethodAmount.d.ts} +3 -3
  316. package/lib/esm/components/payment_methods/PaymentMethodAmount.js +1 -0
  317. package/lib/{cjs/components → esm/components/payment_methods}/PaymentMethodName.d.ts +2 -2
  318. package/lib/esm/components/payment_methods/PaymentMethodName.js +1 -0
  319. package/lib/esm/components/{PaymentMethodPrice.d.ts → payment_methods/PaymentMethodPrice.d.ts} +2 -2
  320. package/lib/esm/components/payment_methods/PaymentMethodPrice.js +1 -0
  321. package/lib/esm/components/{PaymentMethodRadioButton.d.ts → payment_methods/PaymentMethodRadioButton.d.ts} +2 -2
  322. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.js +1 -0
  323. package/lib/{cjs/components → esm/components/payment_methods}/PaymentMethodsContainer.d.ts +2 -2
  324. package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -0
  325. package/lib/esm/components/payment_source/AdyenPayment.d.ts +55 -0
  326. package/lib/esm/components/payment_source/AdyenPayment.js +1 -0
  327. package/lib/esm/components/{BraintreePayment.d.ts → payment_source/BraintreePayment.d.ts} +0 -0
  328. package/lib/esm/components/payment_source/BraintreePayment.js +1 -0
  329. package/lib/{cjs/components → esm/components/payment_source}/CheckoutComPayment.d.ts +1 -1
  330. package/lib/esm/components/payment_source/CheckoutComPayment.js +1 -0
  331. package/lib/esm/components/{KlarnaPayment.d.ts → payment_source/KlarnaPayment.d.ts} +1 -1
  332. package/lib/esm/components/payment_source/KlarnaPayment.js +1 -0
  333. package/lib/esm/components/{PaymentSource.d.ts → payment_source/PaymentSource.d.ts} +4 -4
  334. package/lib/esm/components/payment_source/PaymentSource.js +1 -0
  335. package/lib/{cjs/components → esm/components/payment_source}/PaymentSourceBrandIcon.d.ts +2 -2
  336. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.js +1 -0
  337. package/lib/{cjs/components → esm/components/payment_source}/PaymentSourceBrandName.d.ts +2 -2
  338. package/lib/esm/components/payment_source/PaymentSourceBrandName.js +1 -0
  339. package/lib/{cjs/components → esm/components/payment_source}/PaymentSourceDetail.d.ts +2 -2
  340. package/lib/esm/components/payment_source/PaymentSourceDetail.js +1 -0
  341. package/lib/esm/components/{PaymentSourceEditButton.d.ts → payment_source/PaymentSourceEditButton.d.ts} +2 -2
  342. package/lib/esm/components/payment_source/PaymentSourceEditButton.js +1 -0
  343. package/lib/esm/components/{PaypalPayment.d.ts → payment_source/PaypalPayment.d.ts} +0 -0
  344. package/lib/esm/components/payment_source/PaypalPayment.js +1 -0
  345. package/lib/esm/components/{StripePayment.d.ts → payment_source/StripePayment.d.ts} +1 -1
  346. package/lib/esm/components/payment_source/StripePayment.js +1 -0
  347. package/lib/esm/components/{WireTransferPayment.d.ts → payment_source/WireTransferPayment.d.ts} +3 -1
  348. package/lib/esm/components/payment_source/WireTransferPayment.js +1 -0
  349. package/lib/esm/components/{Price.d.ts → prices/Price.d.ts} +1 -1
  350. package/lib/esm/components/prices/Price.js +1 -0
  351. package/lib/{cjs/components → esm/components/prices}/PricesContainer.d.ts +3 -3
  352. package/lib/esm/components/prices/PricesContainer.js +1 -0
  353. package/lib/esm/components/shipments/Shipment.d.ts +1 -1
  354. package/lib/esm/components/shipments/ShipmentField.d.ts +3 -3
  355. package/lib/esm/components/shipments/ShipmentsContainer.d.ts +1 -1
  356. package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +1 -1
  357. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +2 -2
  358. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +2 -2
  359. package/lib/esm/components/{AvailabilityContainer.d.ts → skus/AvailabilityContainer.d.ts} +1 -1
  360. package/lib/esm/components/skus/AvailabilityContainer.js +1 -0
  361. package/lib/{cjs/components → esm/components/skus}/AvailabilityTemplate.d.ts +2 -2
  362. package/lib/esm/components/skus/AvailabilityTemplate.js +1 -0
  363. package/lib/{cjs/components → esm/components/skus}/DeliveryLeadTime.d.ts +3 -3
  364. package/lib/esm/components/skus/DeliveryLeadTime.js +1 -0
  365. package/lib/esm/components/{QuantitySelector.d.ts → skus/QuantitySelector.d.ts} +1 -1
  366. package/lib/esm/components/skus/QuantitySelector.js +1 -0
  367. package/lib/esm/components/skus/SkuList.d.ts +1 -1
  368. package/lib/esm/components/skus/SkuListsContainer.d.ts +1 -1
  369. package/lib/esm/components/skus/SkuOption.d.ts +1 -1
  370. package/lib/esm/components/skus/SkuOptionInput.d.ts +1 -1
  371. package/lib/esm/components/skus/SkuOptionsContainer.d.ts +1 -1
  372. package/lib/esm/components/skus/Skus.d.ts +1 -1
  373. package/lib/esm/components/skus/SkusContainer.d.ts +0 -5
  374. package/lib/esm/components/skus/SkusContainer.js +1 -1
  375. package/lib/esm/components/{VariantSelector.d.ts → skus/VariantSelector.d.ts} +6 -6
  376. package/lib/esm/components/skus/VariantSelector.js +1 -0
  377. package/lib/esm/components/{VariantsContainer.d.ts → skus/VariantsContainer.d.ts} +1 -1
  378. package/lib/esm/components/skus/VariantsContainer.js +1 -0
  379. package/lib/{cjs/components → esm/components/stock_transfers}/StockTransfer.d.ts +1 -1
  380. package/lib/esm/components/stock_transfers/StockTransfer.js +1 -0
  381. package/lib/{cjs/components → esm/components/stock_transfers}/StockTransferField.d.ts +2 -2
  382. package/lib/esm/components/stock_transfers/StockTransferField.js +1 -0
  383. package/lib/esm/components/utils/BaseField.d.ts +2 -2
  384. package/lib/esm/components/utils/BaseOrderPrice.js +1 -1
  385. package/lib/esm/components/utils/Parent.d.ts +5 -5
  386. package/lib/esm/components/utils/Parent.js +1 -1
  387. package/lib/esm/components/utils/PriceTemplate.d.ts +1 -1
  388. package/lib/esm/components/utils/VariantTemplate.d.ts +3 -3
  389. package/lib/esm/components/utils/VariantTemplate.js +1 -1
  390. package/lib/esm/components/utils/getAllErrors.d.ts +2 -2
  391. package/lib/esm/config/components.d.ts +66 -66
  392. package/lib/esm/context/OrderListChildrenContext.d.ts +3 -3
  393. package/lib/esm/context/PlaceOrderContext.d.ts +2 -1
  394. package/lib/esm/index.d.ts +55 -55
  395. package/lib/esm/index.js +1 -1
  396. package/lib/esm/reducers/AddressReducer.d.ts +1 -0
  397. package/lib/esm/reducers/PaymentMethodReducer.d.ts +7 -6
  398. package/lib/esm/reducers/PlaceOrderReducer.d.ts +7 -4
  399. package/lib/esm/reducers/PlaceOrderReducer.js +1 -1
  400. package/lib/esm/reducers/VariantReducer.d.ts +1 -1
  401. package/lib/esm/typings/errors.d.ts +2 -2
  402. package/lib/esm/typings/index.d.ts +10 -10
  403. package/lib/esm/utils/childrenTypes.d.ts +1 -1
  404. package/lib/esm/utils/getCardDetails.js +1 -1
  405. package/lib/esm/utils/getLoaderComponent.js +1 -1
  406. package/lib/esm/utils/paypalPayment.d.ts +1 -1
  407. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  408. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  409. package/package.json +76 -20
  410. package/lib/cjs/components/AdjustmentAmount.d.ts +0 -4
  411. package/lib/cjs/components/AdjustmentAmount.js +0 -1
  412. package/lib/cjs/components/AdyenPayment.d.ts +0 -25
  413. package/lib/cjs/components/AdyenPayment.js +0 -1
  414. package/lib/cjs/components/AvailabilityContainer.js +0 -1
  415. package/lib/cjs/components/AvailabilityTemplate.js +0 -1
  416. package/lib/cjs/components/BillingAddressContainer.d.ts +0 -11
  417. package/lib/cjs/components/BillingAddressContainer.js +0 -1
  418. package/lib/cjs/components/BillingAddressForm.js +0 -1
  419. package/lib/cjs/components/BraintreePayment.js +0 -1
  420. package/lib/cjs/components/CartLink.d.ts +0 -12
  421. package/lib/cjs/components/CartLink.js +0 -1
  422. package/lib/cjs/components/CheckoutComPayment.js +0 -1
  423. package/lib/cjs/components/CheckoutLink.js +0 -1
  424. package/lib/cjs/components/DeliveryLeadTime.js +0 -1
  425. package/lib/cjs/components/DiscountAmount.js +0 -1
  426. package/lib/cjs/components/GiftCard.js +0 -1
  427. package/lib/cjs/components/GiftCardContainer.js +0 -1
  428. package/lib/cjs/components/GiftCardCurrencySelector.js +0 -1
  429. package/lib/cjs/components/GiftCardInput.js +0 -1
  430. package/lib/cjs/components/GiftCardOrCouponCode.js +0 -1
  431. package/lib/cjs/components/GiftCardOrCouponForm.js +0 -1
  432. package/lib/cjs/components/GiftCardOrCouponInput.js +0 -1
  433. package/lib/cjs/components/GiftCardOrCouponRemoveButton.js +0 -1
  434. package/lib/cjs/components/GiftCardOrCouponSubmit.js +0 -1
  435. package/lib/cjs/components/ItemContainer.js +0 -1
  436. package/lib/cjs/components/KlarnaPayment.js +0 -1
  437. package/lib/cjs/components/LineItem.js +0 -1
  438. package/lib/cjs/components/LineItemAmount.js +0 -1
  439. package/lib/cjs/components/LineItemCode.js +0 -1
  440. package/lib/cjs/components/LineItemImage.js +0 -1
  441. package/lib/cjs/components/LineItemName.js +0 -1
  442. package/lib/cjs/components/LineItemOption.js +0 -1
  443. package/lib/cjs/components/LineItemOptions.js +0 -1
  444. package/lib/cjs/components/LineItemQuantity.js +0 -1
  445. package/lib/cjs/components/LineItemRemoveLink.js +0 -1
  446. package/lib/cjs/components/LineItemsContainer.js +0 -1
  447. package/lib/cjs/components/LineItemsCount.js +0 -1
  448. package/lib/cjs/components/LineItemsEmpty.js +0 -1
  449. package/lib/cjs/components/PaymentGateway.js +0 -1
  450. package/lib/cjs/components/PaymentMethod.js +0 -1
  451. package/lib/cjs/components/PaymentMethodAmount.js +0 -1
  452. package/lib/cjs/components/PaymentMethodName.js +0 -1
  453. package/lib/cjs/components/PaymentMethodPrice.js +0 -1
  454. package/lib/cjs/components/PaymentMethodRadioButton.js +0 -1
  455. package/lib/cjs/components/PaymentMethodsContainer.js +0 -1
  456. package/lib/cjs/components/PaymentSource.js +0 -1
  457. package/lib/cjs/components/PaymentSourceBrandIcon.js +0 -1
  458. package/lib/cjs/components/PaymentSourceBrandName.js +0 -1
  459. package/lib/cjs/components/PaymentSourceDetail.js +0 -1
  460. package/lib/cjs/components/PaymentSourceEditButton.js +0 -1
  461. package/lib/cjs/components/PaypalPayment.js +0 -1
  462. package/lib/cjs/components/Price.js +0 -1
  463. package/lib/cjs/components/PricesContainer.js +0 -1
  464. package/lib/cjs/components/QuantitySelector.js +0 -1
  465. package/lib/cjs/components/SaveAddressesButton.d.ts +0 -23
  466. package/lib/cjs/components/SaveAddressesButton.js +0 -1
  467. package/lib/cjs/components/SaveCustomerButton.d.ts +0 -24
  468. package/lib/cjs/components/ShippingAddressContainer.js +0 -1
  469. package/lib/cjs/components/ShippingAddressForm.js +0 -1
  470. package/lib/cjs/components/ShippingAmount.js +0 -1
  471. package/lib/cjs/components/SkuField.d.ts +0 -10
  472. package/lib/cjs/components/SkuField.js +0 -1
  473. package/lib/cjs/components/Skus.d.ts +0 -11
  474. package/lib/cjs/components/Skus.js +0 -1
  475. package/lib/cjs/components/SkusContainer.d.ts +0 -14
  476. package/lib/cjs/components/SkusContainer.js +0 -1
  477. package/lib/cjs/components/StockTransfer.js +0 -1
  478. package/lib/cjs/components/StockTransferField.js +0 -1
  479. package/lib/cjs/components/StripePayment.js +0 -1
  480. package/lib/cjs/components/VariantSelector.js +0 -1
  481. package/lib/cjs/components/VariantsContainer.js +0 -1
  482. package/lib/cjs/components/WireTransferPayment.js +0 -1
  483. package/lib/cjs/components/gateways/AdyenGateway.js +0 -1
  484. package/lib/cjs/components/gateways/BraintreeGateway.js +0 -1
  485. package/lib/cjs/components/gateways/CheckoutComGateway.js +0 -1
  486. package/lib/cjs/components/gateways/KlarnaGateway.js +0 -1
  487. package/lib/cjs/components/gateways/PaypalGateway.js +0 -1
  488. package/lib/cjs/components/gateways/StripeGateway.js +0 -1
  489. package/lib/cjs/components/gateways/WireTransferGateway.js +0 -1
  490. package/lib/esm/components/AdjustmentAmount.d.ts +0 -4
  491. package/lib/esm/components/AdjustmentAmount.js +0 -1
  492. package/lib/esm/components/AdyenPayment.d.ts +0 -25
  493. package/lib/esm/components/AdyenPayment.js +0 -1
  494. package/lib/esm/components/AvailabilityContainer.js +0 -1
  495. package/lib/esm/components/AvailabilityTemplate.js +0 -1
  496. package/lib/esm/components/BillingAddressContainer.d.ts +0 -11
  497. package/lib/esm/components/BillingAddressContainer.js +0 -1
  498. package/lib/esm/components/BillingAddressForm.js +0 -1
  499. package/lib/esm/components/BraintreePayment.js +0 -1
  500. package/lib/esm/components/CartLink.d.ts +0 -12
  501. package/lib/esm/components/CartLink.js +0 -1
  502. package/lib/esm/components/CheckoutComPayment.js +0 -1
  503. package/lib/esm/components/CheckoutLink.js +0 -1
  504. package/lib/esm/components/DeliveryLeadTime.js +0 -1
  505. package/lib/esm/components/DiscountAmount.js +0 -1
  506. package/lib/esm/components/GiftCard.js +0 -1
  507. package/lib/esm/components/GiftCardContainer.js +0 -1
  508. package/lib/esm/components/GiftCardCurrencySelector.js +0 -1
  509. package/lib/esm/components/GiftCardInput.js +0 -1
  510. package/lib/esm/components/GiftCardOrCouponCode.js +0 -1
  511. package/lib/esm/components/GiftCardOrCouponForm.js +0 -1
  512. package/lib/esm/components/GiftCardOrCouponInput.js +0 -1
  513. package/lib/esm/components/GiftCardOrCouponRemoveButton.js +0 -1
  514. package/lib/esm/components/GiftCardOrCouponSubmit.js +0 -1
  515. package/lib/esm/components/ItemContainer.js +0 -1
  516. package/lib/esm/components/KlarnaPayment.js +0 -1
  517. package/lib/esm/components/LineItem.js +0 -1
  518. package/lib/esm/components/LineItemAmount.js +0 -1
  519. package/lib/esm/components/LineItemCode.js +0 -1
  520. package/lib/esm/components/LineItemImage.js +0 -1
  521. package/lib/esm/components/LineItemName.js +0 -1
  522. package/lib/esm/components/LineItemOption.js +0 -1
  523. package/lib/esm/components/LineItemOptions.js +0 -1
  524. package/lib/esm/components/LineItemQuantity.js +0 -1
  525. package/lib/esm/components/LineItemRemoveLink.js +0 -1
  526. package/lib/esm/components/LineItemsContainer.js +0 -1
  527. package/lib/esm/components/LineItemsCount.js +0 -1
  528. package/lib/esm/components/LineItemsEmpty.js +0 -1
  529. package/lib/esm/components/PaymentGateway.js +0 -1
  530. package/lib/esm/components/PaymentMethod.js +0 -1
  531. package/lib/esm/components/PaymentMethodAmount.js +0 -1
  532. package/lib/esm/components/PaymentMethodName.js +0 -1
  533. package/lib/esm/components/PaymentMethodPrice.js +0 -1
  534. package/lib/esm/components/PaymentMethodRadioButton.js +0 -1
  535. package/lib/esm/components/PaymentMethodsContainer.js +0 -1
  536. package/lib/esm/components/PaymentSource.js +0 -1
  537. package/lib/esm/components/PaymentSourceBrandIcon.js +0 -1
  538. package/lib/esm/components/PaymentSourceBrandName.js +0 -1
  539. package/lib/esm/components/PaymentSourceDetail.js +0 -1
  540. package/lib/esm/components/PaymentSourceEditButton.js +0 -1
  541. package/lib/esm/components/PaypalPayment.js +0 -1
  542. package/lib/esm/components/Price.js +0 -1
  543. package/lib/esm/components/PricesContainer.js +0 -1
  544. package/lib/esm/components/QuantitySelector.js +0 -1
  545. package/lib/esm/components/SaveAddressesButton.d.ts +0 -23
  546. package/lib/esm/components/SaveAddressesButton.js +0 -1
  547. package/lib/esm/components/SaveCustomerButton.d.ts +0 -24
  548. package/lib/esm/components/SaveCustomerButton.js +0 -1
  549. package/lib/esm/components/ShippingAddressContainer.js +0 -1
  550. package/lib/esm/components/ShippingAddressForm.js +0 -1
  551. package/lib/esm/components/ShippingAmount.js +0 -1
  552. package/lib/esm/components/SkuField.d.ts +0 -10
  553. package/lib/esm/components/SkuField.js +0 -1
  554. package/lib/esm/components/Skus.d.ts +0 -11
  555. package/lib/esm/components/Skus.js +0 -1
  556. package/lib/esm/components/SkusContainer.d.ts +0 -14
  557. package/lib/esm/components/SkusContainer.js +0 -1
  558. package/lib/esm/components/StockTransfer.js +0 -1
  559. package/lib/esm/components/StockTransferField.js +0 -1
  560. package/lib/esm/components/StripePayment.js +0 -1
  561. package/lib/esm/components/VariantSelector.js +0 -1
  562. package/lib/esm/components/VariantsContainer.js +0 -1
  563. package/lib/esm/components/WireTransferPayment.js +0 -1
  564. package/lib/esm/components/gateways/AdyenGateway.js +0 -1
  565. package/lib/esm/components/gateways/BraintreeGateway.js +0 -1
  566. package/lib/esm/components/gateways/CheckoutComGateway.js +0 -1
  567. package/lib/esm/components/gateways/KlarnaGateway.js +0 -1
  568. package/lib/esm/components/gateways/PaypalGateway.js +0 -1
  569. package/lib/esm/components/gateways/StripeGateway.js +0 -1
  570. package/lib/esm/components/gateways/WireTransferGateway.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/react-components",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.4",
4
4
  "description": "The Official Commerce Layer React Components",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -15,21 +15,45 @@
15
15
  "require": "./lib/cjs/index.js",
16
16
  "import": "./lib/esm/index.js"
17
17
  },
18
+ "./addresses/*": {
19
+ "require": "./lib/cjs/components/addresses/*.js",
20
+ "import": "./lib/esm/components/addresses/*.js"
21
+ },
18
22
  "./auth/*": {
19
23
  "require": "./lib/cjs/components/auth/*.js",
20
24
  "import": "./lib/esm/components/auth/*.js"
21
25
  },
26
+ "./customers/*": {
27
+ "require": "./lib/cjs/components/customers/*.js",
28
+ "import": "./lib/esm/components/customers/*.js"
29
+ },
30
+ "./gift_cards/*": {
31
+ "require": "./lib/cjs/components/gift_cards/*.js",
32
+ "import": "./lib/esm/components/gift_cards/*.js"
33
+ },
34
+ "./line_items/*": {
35
+ "require": "./lib/cjs/components/line_items/*.js",
36
+ "import": "./lib/esm/components/line_items/*.js"
37
+ },
22
38
  "./orders/*": {
23
39
  "require": "./lib/cjs/components/orders/*.js",
24
40
  "import": "./lib/esm/components/orders/*.js"
25
41
  },
26
- "./skus/*": {
27
- "require": "./lib/cjs/components/skus/*.js",
28
- "import": "./lib/esm/components/skus/*.js"
42
+ "./payment_gateways/*": {
43
+ "require": "./lib/cjs/components/payment_gateways/*.js",
44
+ "import": "./lib/esm/components/payment_gateways/*.js"
29
45
  },
30
- "./customers/*": {
31
- "require": "./lib/cjs/components/customers/*.js",
32
- "import": "./lib/esm/components/customers/*.js"
46
+ "./payment_methods/*": {
47
+ "require": "./lib/cjs/components/payment_methods/*.js",
48
+ "import": "./lib/esm/components/payment_methods/*.js"
49
+ },
50
+ "./payment_source/*": {
51
+ "require": "./lib/cjs/components/payment_source/*.js",
52
+ "import": "./lib/esm/components/payment_source/*.js"
53
+ },
54
+ "./prices/*": {
55
+ "require": "./lib/cjs/components/prices/*.js",
56
+ "import": "./lib/esm/components/prices/*.js"
33
57
  },
34
58
  "./shipments/*": {
35
59
  "require": "./lib/cjs/components/shipments/*.js",
@@ -38,27 +62,59 @@
38
62
  "./shipping_methods/*": {
39
63
  "require": "./lib/cjs/components/shipping_methods/*.js",
40
64
  "import": "./lib/esm/components/shipping_methods/*.js"
65
+ },
66
+ "./skus/*": {
67
+ "require": "./lib/cjs/components/skus/*.js",
68
+ "import": "./lib/esm/components/skus/*.js"
69
+ },
70
+ "./stock_transfers/*": {
71
+ "require": "./lib/cjs/components/stock_transfers/*.js",
72
+ "import": "./lib/esm/components/stock_transfers/*.js"
41
73
  }
42
74
  },
43
75
  "typesVersions": {
44
76
  "*": {
77
+ "addresses/*": [
78
+ "lib/esm/components/addresses/*.d.ts"
79
+ ],
45
80
  "auth/*": [
46
81
  "lib/esm/components/auth/*.d.ts"
47
82
  ],
83
+ "customers/*": [
84
+ "lib/esm/components/customers/*.d.ts"
85
+ ],
86
+ "gift_cards/*": [
87
+ "lib/esm/components/gift_cards/*.d.ts"
88
+ ],
89
+ "line_items/*": [
90
+ "lib/esm/components/line_items/*.d.ts"
91
+ ],
48
92
  "orders/*": [
49
93
  "lib/esm/components/orders/*.d.ts"
50
94
  ],
51
- "skus/*": [
52
- "lib/esm/components/skus/*.d.ts"
95
+ "payment_gateways/*": [
96
+ "lib/esm/components/payment_gateways/*.d.ts"
53
97
  ],
54
- "customers/*": [
55
- "lib/esm/components/customers/*.d.ts"
98
+ "payment_methods/*": [
99
+ "lib/esm/components/payment_methods/*.d.ts"
100
+ ],
101
+ "payment_source/*": [
102
+ "lib/esm/components/payment_source/*.d.ts"
103
+ ],
104
+ "prices/*": [
105
+ "lib/esm/components/prices/*.d.ts"
56
106
  ],
57
107
  "shipments/*": [
58
108
  "lib/esm/components/shipments/*.d.ts"
59
109
  ],
60
110
  "shipping_methods/*": [
61
111
  "lib/esm/components/shipping_methods/*.d.ts"
112
+ ],
113
+ "skus/*": [
114
+ "lib/esm/components/skus/*.d.ts"
115
+ ],
116
+ "stock_transfers/*": [
117
+ "lib/esm/components/stock_transfers/*.d.ts"
62
118
  ]
63
119
  }
64
120
  },
@@ -105,10 +161,10 @@
105
161
  "@adyen/adyen-web": "^5.18.0",
106
162
  "@commercelayer/sdk": "^4.15.0",
107
163
  "@stripe/react-stripe-js": "^1.9.0",
108
- "@stripe/stripe-js": "^1.32.0",
164
+ "@stripe/stripe-js": "^1.33.0",
109
165
  "axios": "^0.27.2",
110
- "braintree-web": "^3.85.3",
111
- "frames-react": "^1.0.11",
166
+ "braintree-web": "^3.85.5",
167
+ "frames-react": "^1.0.12",
112
168
  "jwt-decode": "^3.1.2",
113
169
  "lodash": "^4.17.21",
114
170
  "lodash-es": "^4.17.21",
@@ -117,11 +173,11 @@
117
173
  "react-window": "^1.8.7"
118
174
  },
119
175
  "devDependencies": {
120
- "@babel/core": "^7.18.9",
176
+ "@babel/core": "^7.18.10",
121
177
  "@babel/plugin-proposal-class-properties": "^7.18.6",
122
178
  "@babel/plugin-syntax-flow": "^7.18.6",
123
- "@babel/plugin-transform-react-jsx": "^7.18.6",
124
- "@babel/preset-env": "^7.18.9",
179
+ "@babel/plugin-transform-react-jsx": "^7.18.10",
180
+ "@babel/preset-env": "^7.18.10",
125
181
  "@babel/preset-react": "^7.18.6",
126
182
  "@babel/preset-typescript": "^7.18.6",
127
183
  "@commercelayer/js-auth": "^2.3.0",
@@ -148,12 +204,12 @@
148
204
  "@typescript-eslint/eslint-plugin": "^5.30.7",
149
205
  "@typescript-eslint/parser": "^5.30.7",
150
206
  "@zerollup/ts-transform-paths": "^1.7.18",
151
- "autoprefixer": "^10.4.7",
207
+ "autoprefixer": "^10.4.8",
152
208
  "babel-jest": "^28.1.3",
153
209
  "babel-loader": "^8.2.5",
154
210
  "babel-plugin-istanbul": "^6.1.1",
155
211
  "dotenv": "^16.0.1",
156
- "eslint": "^8.20.0",
212
+ "eslint": "^8.21.0",
157
213
  "eslint-config-prettier": "^8.5.0",
158
214
  "eslint-config-react-app": "^7.0.1",
159
215
  "eslint-plugin-react": "^7.30.1",
@@ -171,7 +227,7 @@
171
227
  "react-dom": "^17.0.2",
172
228
  "react-test-renderer": "^17.0.2",
173
229
  "semantic-release": "^19.0.3",
174
- "tailwindcss": "^3.1.6",
230
+ "tailwindcss": "^3.1.8",
175
231
  "ts-jest": "^28.0.7",
176
232
  "ts-loader": "^9.3.1",
177
233
  "tsc-alias": "^1.7.0",
@@ -1,4 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseAmountComponent } from '../typings/index';
3
- declare const AdjustmentAmount: FunctionComponent<BaseAmountComponent>;
4
- export default AdjustmentAmount;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseOrderPrice_1=tslib_1.__importDefault(require("./utils/BaseOrderPrice")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.AdjustmentAmount.propTypes,defaultProps=components_1.default.AdjustmentAmount.defaultProps,displayName=components_1.default.AdjustmentAmount.displayName,AdjustmentAmount=props=>(0,jsx_runtime_1.jsx)(BaseOrderPrice_1.default,{base:"amount",type:"adjustment",...props});AdjustmentAmount.propTypes=propTypes,AdjustmentAmount.defaultProps=defaultProps,AdjustmentAmount.displayName=displayName,exports.default=AdjustmentAmount;
@@ -1,25 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- import { PaymentSourceProps } from './PaymentSource';
3
- declare type Styles = Partial<{
4
- base: CSSProperties;
5
- error: CSSProperties;
6
- placeholder: CSSProperties;
7
- validated: CSSProperties;
8
- }>;
9
- export declare type AdyenPaymentConfig = {
10
- cardContainerClassName?: string;
11
- threeDSecureContainerClassName?: string;
12
- placeOrderCallback?: (response: {
13
- placed: boolean;
14
- }) => void;
15
- styles?: Styles;
16
- };
17
- declare type Props = {
18
- clientKey?: string;
19
- config?: AdyenPaymentConfig;
20
- templateCustomerSaveToWallet?: PaymentSourceProps['templateCustomerSaveToWallet'];
21
- locale?: string;
22
- environment?: string;
23
- };
24
- export declare function AdyenPayment({ clientKey, config, templateCustomerSaveToWallet, environment, locale, }: Props): JSX.Element | null;
25
- export default AdyenPayment;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenPayment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),localStorage_1=require("../utils/localStorage"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),browserInfo_1=tslib_1.__importDefault(require("../utils/browserInfo")),PlaceOrderContext_1=tslib_1.__importDefault(require("../context/PlaceOrderContext")),threeDSConfiguration={challengeWindowSize:"05"},defaultConfig={};function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,placeOrderCallback,styles}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=(0,react_1.useState)(!1),[checkout,setCheckout]=(0,react_1.useState)({}),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=(0,react_1.useContext)(PaymentMethodContext_1.default),{setPlaceOrder}=(0,react_1.useContext)(PlaceOrderContext_1.default),ref=(0,react_1.useRef)(null),handleSubmit=async(e,checkout2)=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet);const attributes={_authorize: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&&["IdentifyShopper","RedirectShopper"].includes(resultCode))checkout2.createFromAction(adyenAction,threeDSConfiguration).mount("#adyen-action");else if(["Authorised","Pending","Received"].includes(resultCode)){const brand=pSource?.payment_request_data?.payment_method?.brand;if(brand){const attributes2={metadata:{card:{brand}}};await setPaymentSource({paymentSourceId:pSource?.id,paymentResource:"adyen_payments",attributes:attributes2})}return!0}const message=pSource?.payment_response?.refusalReason;return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),!1}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}},handleChange=async(state,_component,config2,paySource)=>{if(state.isValid){if(ref.current){const adyenCheckout=await require("@adyen/adyen-web")(config2);ref.current.onsubmit=()=>handleSubmit(ref.current,adyenCheckout),setPaymentRef({ref})}const browserInfo=(0,browserInfo_1.default)(),attributes={payment_request_data:{payment_method:state.data.paymentMethod,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",origin:window.location.origin,return_url:window.location.href,redirect_from_issuer_method:"GET",browser_info:{acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",...browserInfo}}};paySource&&await setPaymentSource({paymentSourceId:paySource.id,paymentResource:"adyen_payments",attributes})}},handleOnAdditionalDetails=async(state,_component,config2)=>{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,AdyenCheckout=require("@adyen/adyen-web");if(adyenAction&&(await AdyenCheckout(config2)).createFromAction(adyenAction,threeDSConfiguration).mount("#adyen-action"),["Authorised","Pending","Received"].includes(resultCode)){const{placed}=setPlaceOrder&&await setPlaceOrder({paymentSource:pSource})||{placed:!1};placed&&placeOrderCallback&&placeOrderCallback({placed})}}catch(error){console.error("Adyen additional details error:",error)}};return(0,react_1.useEffect)(()=>{const paymentMethodsResponse=(0,isEmpty_1.default)(paymentSource?.payment_methods)?{}:paymentSource?.payment_methods;(0,isEmpty_1.default)(paymentMethodsResponse)&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const options={locale,environment,clientKey,paymentMethodsResponse};return options.onChange=(s,c)=>handleChange(s,c,options,paymentSource),options.onAdditionalDetails=(s,c)=>handleOnAdditionalDetails(s,c,options),!ref&&clientKey&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&!(0,isEmpty_1.default)(window)&&require("@adyen/adyen-web")(options).then(adyenCheckout=>{adyenCheckout.create("card",{styles}).mount("#adyen-card")&&(setCheckout(adyenCheckout),setLoadAdyen(!0))}),()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref]),!clientKey&&!loadAdyen&&!checkout?null:(0,jsx_runtime_1.jsxs)("form",{ref,onSubmit:e=>handleSubmit(e,checkout),children:[(0,jsx_runtime_1.jsx)("div",{className:cardContainerClassName,id:"adyen-card"}),templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),(0,jsx_runtime_1.jsx)("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}exports.AdyenPayment=AdyenPayment,exports.default=AdyenPayment;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),AvailabilityReducer_1=tslib_1.__importStar(require("../reducers/AvailabilityReducer")),AvailabilityContext_1=tslib_1.__importDefault(require("../context/AvailabilityContext")),ItemContext_1=tslib_1.__importDefault(require("../context/ItemContext")),getCurrentItemKey_1=tslib_1.__importDefault(require("../utils/getCurrentItemKey")),components_1=tslib_1.__importDefault(require("../config/components")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),SkuChildrenContext_1=tslib_1.__importDefault(require("../context/SkuChildrenContext")),SkuContext_1=tslib_1.__importDefault(require("../context/SkuContext")),isEqual_1=tslib_1.__importDefault(require("lodash/isEqual")),propTypes=components_1.default.AvailabilityContainer.propTypes,displayName=components_1.default.AvailabilityContainer.displayName;function AvailabilityContainer(props){const{children,skuCode}=props,{item,skuCode:itemSkuCode,setItem}=(0,react_1.useContext)(ItemContext_1.default),{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),{skus}=(0,react_1.useContext)(SkuContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default),[state,dispatch]=(0,react_1.useReducer)(AvailabilityReducer_1.default,AvailabilityReducer_1.availabilityInitialState),sCode=skuCode||(0,getCurrentItemKey_1.default)(item)||itemSkuCode||lineItem?.sku_code||sku?.code;return(0,react_1.useEffect)(()=>{if(sCode&&!skus){const available=item[sCode]?.inventory?.available,quantity=item[sCode]?.inventory?.quantity,[level]=item[sCode]?.inventory?.levels||[{quantity:null,delivery_lead_times:[]}];if(level!==void 0&&level?.delivery_lead_times?.length>0){const[delivery]=level.delivery_lead_times;dispatch({type:"setAvailability",payload:{...delivery,quantity:level?.quantity}})}else config.accessToken&&!item?.[sCode]?(0,AvailabilityReducer_1.getAvailability)({skuCode:sCode,config,dispatch,setItem,item}):available||dispatch({type:"setAvailability",payload:{quantity}})}else if(skus&&config.accessToken){const itemKeys=Object.keys(item).sort(),skuCodes=skus.map(s=>s?.code).sort();if(!(0,isEqual_1.default)(skuCodes,itemKeys)){const skusIds=skus.map(s=>s.id);(0,AvailabilityReducer_1.getAvailabilityByIds)({skusIds,config,dispatch,setItem})}}return()=>{dispatch({type:"setAvailability",payload:{}})}},[config.accessToken,item,sCode,skus]),(0,jsx_runtime_1.jsx)(AvailabilityContext_1.default.Provider,{value:{...state},children})}exports.AvailabilityContainer=AvailabilityContainer,AvailabilityContainer.propTypes=propTypes,AvailabilityContainer.displayName=displayName,exports.default=AvailabilityContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityTemplate=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),AvailabilityContext_1=tslib_1.__importDefault(require("../context/AvailabilityContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),lodash_1=require("lodash"),components_1=tslib_1.__importDefault(require("../config/components")),ItemContext_1=tslib_1.__importDefault(require("../context/ItemContext")),SkuChildrenContext_1=tslib_1.__importDefault(require("../context/SkuChildrenContext")),propTypes=components_1.default.AvailabilityTemplate.propTypes,defaultProps=components_1.default.AvailabilityTemplate.defaultProps,displayName=components_1.default.AvailabilityTemplate.displayName;function AvailabilityTemplate(props){const{timeFormat,showShippingMethodName,showShippingMethodPrice,children,...p}=props;let{min,max,shipping_method,quantity}=(0,react_1.useContext)(AvailabilityContext_1.default);const{item}=(0,react_1.useContext)(ItemContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),text=[];if(item&&sku){const code=sku.code,currentItem=item[code];if(currentItem){const[level]=currentItem.inventory?.levels||[],[delivery]=level?.delivery_lead_times||[];delivery&&(min=delivery?.min,max=delivery?.max,shipping_method=delivery?.shipping_method),quantity=currentItem.inventory.quantity}}const mn=!(0,lodash_1.isEmpty)(min)&&timeFormat?min?.[timeFormat]:"",mx=!(0,lodash_1.isEmpty)(max)&&timeFormat?max?.[timeFormat]:"",shippingMethodPrice=showShippingMethodPrice&&shipping_method?.formatted_price_amount?`(${shipping_method?.formatted_price_amount})`:"",name=showShippingMethodName&&shipping_method?`with ${shipping_method.name}`:"";quantity&&quantity>0?(text.push("Available"),mn&&mx&&text.push(`in ${mn} - ${mx} ${timeFormat} ${name} ${shippingMethodPrice}`)):quantity===0&&text.push("Out of stock");const parentProps={min,max,shipping_method,quantity,text:text.join(" "),...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("p",{...p,children:text.join(" ")})}exports.AvailabilityTemplate=AvailabilityTemplate,AvailabilityTemplate.propTypes=propTypes,AvailabilityTemplate.defaultProps=defaultProps,AvailabilityTemplate.displayName=displayName,exports.default=AvailabilityTemplate;
@@ -1,11 +0,0 @@
1
- import { ReactNode } from 'react';
2
- declare type Props = {
3
- children: ReactNode;
4
- };
5
- export declare function BillingAddressContainer(props: Props): JSX.Element;
6
- export declare namespace BillingAddressContainer {
7
- var propTypes: {
8
- children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
9
- };
10
- }
11
- export default BillingAddressContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BillingAddressContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BillingAddressContext_1=tslib_1.__importDefault(require("../context/BillingAddressContext")),react_1=require("react"),BillingAddressReducer_1=tslib_1.__importStar(require("../reducers/BillingAddressReducer")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),components_1=tslib_1.__importDefault(require("../config/components")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),AddressContext_1=tslib_1.__importDefault(require("../context/AddressContext")),propTypes=components_1.default.BillingAddressContainer.propTypes;function BillingAddressContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(BillingAddressReducer_1.default,BillingAddressReducer_1.billingAddressInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default),{order,include,addResourceToInclude}=(0,react_1.useContext)(OrderContext_1.default),{shipToDifferentAddress,setCloneAddress}=(0,react_1.useContext)(AddressContext_1.default);(0,react_1.useEffect)(()=>(include?.includes("billing_address")||addResourceToInclude({newResource:"billing_address",resourcesIncluded:include}),order&&config&&(0,BillingAddressReducer_1.setBillingCustomerAddressId)({dispatch,order,setCloneAddress}),()=>{dispatch({type:"cleanup",payload:{}})}),[order,include]);const contextValue={...state,setBillingAddress:async(id,options)=>{await(0,BillingAddressReducer_1.setBillingAddress)(id,{config,dispatch,order,shipToDifferentAddress,customerAddressId:options?.customerAddressId}),setCloneAddress(id,"billing_address")}};return(0,jsx_runtime_1.jsx)(BillingAddressContext_1.default.Provider,{value:contextValue,children})}exports.BillingAddressContainer=BillingAddressContainer,BillingAddressContainer.propTypes=propTypes,exports.default=BillingAddressContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BillingAddressForm=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),AddressContext_1=tslib_1.__importDefault(require("../context/AddressContext")),rapid_form_1=require("rapid-form"),react_1=require("react"),BillingAddressFormContext_1=tslib_1.__importDefault(require("../context/BillingAddressFormContext")),lodash_1=require("lodash"),components_1=tslib_1.__importDefault(require("../config/components")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),localStorage_1=require("../utils/localStorage"),validateFormFields_1=require("../utils/validateFormFields"),propTypes=components_1.default.BillingAddressForm.propTypes;function BillingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=(0,rapid_form_1.useRapidForm)(),{setAddressErrors,setAddress,isBusiness}=(0,react_1.useContext)(AddressContext_1.default),{saveAddressToCustomerAddressBook,order,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null);(0,react_1.useEffect)(()=>{if(include?.includes("billing_address")?includeLoaded?.billing_address||addResourceToInclude({newResourceLoaded:{billing_address:!0}}):addResourceToInclude({newResource:"billing_address"}),(0,lodash_1.isEmpty)(errors)){if(values&&Object.keys(values).length>0){setAddressErrors([],"billing_address");for(const name in values){const field=values[name];(0,validateFormFields_1.businessMandatoryField)(name,isBusiness)||delete values[name],(field?.value||field?.required===!1&&field?.type!=="checkbox")&&(values[name.replace("billing_address_","")]=field.value,delete values[name]),field?.type==="checkbox"&&(delete values[name],saveAddressToCustomerAddressBook({type:"billing_address",value:field.checked}))}setAddress({values:{...values,...isBusiness&&{business:isBusiness}},resource:"billing_address"})}}else{const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message;["billing_address_state_code"].includes(fieldName)?values?.state_code?formErrors.push({code,message:message||"",resource:"billing_address",field:fieldName}):delete errors[fieldName]:formErrors.push({code,message:message||"",resource:"billing_address",field:fieldName})}setAddressErrors(formErrors,"billing_address")}const checkboxChecked=ref.current?.querySelector('[name="billing_address_save_to_customer_book"]')?.checked||(0,localStorage_1.getSaveBillingAddressToAddressBook)();reset&&(!(0,lodash_1.isEmpty)(values)||!(0,lodash_1.isEmpty)(errors)||checkboxChecked)&&(saveAddressToCustomerAddressBook&&saveAddressToCustomerAddressBook({type:"billing_address",value:!1}),ref&&(ref.current?.reset(),resetForm({target:ref.current}),setAddressErrors([],"billing_address"),setAddress({values:{},resource:"billing_address"})))},[errors,values,reset,include,includeLoaded,isBusiness]);const providerValues={isBusiness,values,validation,setValue:(name,value)=>{const field={[name.replace("billing_address_","")]:value};setAddress({values:{...values,...field,...isBusiness&&{business:isBusiness}},resource:"billing_address"})},errorClassName,requiresBillingInfo:order?.requires_billing_info||!1,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return(0,jsx_runtime_1.jsx)(BillingAddressFormContext_1.default.Provider,{value:providerValues,children:(0,jsx_runtime_1.jsx)("form",{ref,autoComplete,...p,children})})}exports.BillingAddressForm=BillingAddressForm,BillingAddressForm.propTypes=propTypes,exports.default=BillingAddressForm;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BraintreePayment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),localStorage_1=require("../utils/localStorage"),promisify_1=tslib_1.__importDefault(require("../utils/promisify")),defaultConfig={styles:{input:{"font-size":"16px",color:"#3A3A3A"},".number":{"font-family":"monospace"},":focus":{color:"blue"},".valid":{color:"green"},".invalid":{color:"red"},"@media screen and (max-width: 700px)":{input:{"font-size":"14px"}}},fields:{number:{label:"Card Number",selector:"#card-number",placeholder:"4111 1111 1111 1111"},cvv:{label:"CVV",selector:"#cvv",placeholder:"123"},expirationDate:{label:"Expiration Date",selector:"#expiration-date",placeholder:"10/2022"}},submitLabel:"Set payment method"};function BraintreePayment({authorization,config,templateCustomerSaveToWallet}){const{fields,styles,containerClassName,cardContainerClassName,fieldsContainerClassName,expDateContainerClassName,fieldLabelClassName,cvvContainerClassName,inputWrapperClassName,cardDetailsContainerClassName}={...defaultConfig,...config},[loadBraintree,setLoadBraintree]=(0,react_1.useState)(!1),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null),handleSubmitForm=async({event,hostedFieldsInstance,threeDSInstance})=>{const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;if(savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),hostedFieldsInstance)try{const payload=await(0,promisify_1.default)(hostedFieldsInstance).then(payload2=>payload2),billingAddress=order?.billing_address,verifyCardOptions={nonce:payload.nonce,bin:payload.details.bin,amount:order?.total_amount_with_taxes_float,email:order?.customer_email,billingAddress:{givenName:billingAddress?.first_name,surname:billingAddress?.last_name,phoneNumber:billingAddress?.phone,streetAddress:billingAddress?.line_1,countryCodeAlpha2:billingAddress?.country_code,postalCode:billingAddress?.zip_code,region:billingAddress?.state_code,locality:billingAddress?.city},onLookupComplete:(_data,next)=>{next()}},response=await threeDSInstance.verifyCard(verifyCardOptions);return response.rawCardinalSDKVerificationData.Validated&&paymentSource?(paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"braintree_payments",attributes:{payment_method_nonce:response.nonce,options:{id:response.nonce,card:{last4:response.details.lastFour,exp_year:response.details.expirationYear,exp_month:response.details.expirationMonth,brand:response.details.cardType.toLowerCase()}}}}),!0):!1}catch(error){return console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}return!1};return(0,react_1.useEffect)(()=>{if(!ref&&authorization&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","false"),authorization&&!loadBraintree&&!(0,isEmpty_1.default)(window)){const braintreeClient=require("braintree-web/client"),hostedFields=require("braintree-web/hosted-fields"),threeDSecure=require("braintree-web/three-d-secure");braintreeClient.create({authorization},(clientErr,clientInstance)=>{if(clientErr){console.error(clientErr);return}hostedFields.create({client:clientInstance,fields,styles},(hostedFieldsErr,hostedFieldsInstance)=>{if(hostedFieldsErr){console.error(hostedFieldsErr);return}setLoadBraintree(!0),threeDSecure.create({authorization,version:2},(threeDSecureErr,threeDSInstance)=>{threeDSecureErr&&(console.error("3DSecure error",threeDSecureErr),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:threeDSecureErr.message}])),ref.current&&(ref.current.onsubmit=paymentSource2=>handleSubmitForm({event:ref.current,hostedFieldsInstance,threeDSInstance,paymentSource:paymentSource2}),setPaymentRef({ref}))})})})}return()=>{setPaymentRef({ref:{current:null}}),setLoadBraintree(!1)}},[authorization,ref]),!authorization&&!loadBraintree?null:(0,jsx_runtime_1.jsx)("div",{className:containerClassName,children:(0,jsx_runtime_1.jsxs)("form",{ref,id:"braintree-form",onSubmit:handleSubmitForm,className:containerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:fieldsContainerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:cardContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"card-number",children:fields?.number?.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"card-number"})]}),(0,jsx_runtime_1.jsxs)("div",{className:cardDetailsContainerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:expDateContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"expiration-date",children:fields?.expirationDate?.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"expiration-date"})]}),(0,jsx_runtime_1.jsxs)("div",{className:cvvContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"cvv",children:fields?.cvv?.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"cvv"})]})]})]}),(0,jsx_runtime_1.jsx)("div",{className:fieldsContainerClassName,children:templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})})]})})}exports.BraintreePayment=BraintreePayment,exports.default=BraintreePayment;
@@ -1,12 +0,0 @@
1
- import { MouseEvent, ReactNode } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type TChildren = FunctionChildren<Omit<Props, 'children'> & {
4
- href: string;
5
- handleClick?: (e: MouseEvent<HTMLAnchorElement>) => Promise<void>;
6
- }>;
7
- declare type Props = {
8
- children?: TChildren;
9
- label?: string | ReactNode;
10
- } & JSX.IntrinsicElements['a'];
11
- export default function CartLink(props: Props): JSX.Element | null;
12
- export {};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),getCartLink_1=tslib_1.__importDefault(require("../utils/getCartLink"));function CartLink(props){const{label,children,...p}=props,{order,createOrder}=(0,react_1.useContext)(OrderContext_1.default),{accessToken,endpoint}=(0,react_1.useContext)(CommerceLayerContext_1.default),[slug]=endpoint.split(".commercelayer"),href=slug&&order?.id?(0,getCartLink_1.default)({slug,orderId:order?.id,accessToken}):"",handleClick=async event=>{if(event.preventDefault(),order?.id)location.href=href;else{const orderId=await createOrder();slug&&(location.href=(0,getCartLink_1.default)({slug,orderId,accessToken}))}},parentProps={handleClick,label,href,...p};return accessToken?children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("a",{href,...p,onClick:handleClick,children:typeof label=="function"?label():label}):null}exports.default=CartLink;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CheckoutComPayment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),useExternalScript_1=tslib_1.__importDefault(require("../utils/hooks/useExternalScript")),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),frames_react_1=require("frames-react"),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),localStorage_1=require("../utils/localStorage"),scriptUrl="https://cdn.checkout.com/js/framesv2.min.js",systemLanguages=["DE-DE","EN-GB","ES-ES","FR-FR","IT-IT","KR-KR","NL-NL"],defaultOptions={style:{base:{color:"black",fontSize:"18px"},autofill:{backgroundColor:"yellow"},hover:{color:"blue"},focus:{color:"blue"},valid:{color:"green"},invalid:{color:"red"},placeholder:{base:{color:"gray"},focus:{border:"solid 1px blue"}}}};function CheckoutComPayment({publicKey,options=defaultOptions,locale="EN-GB",...p}){const ref=(0,react_1.useRef)(null),loaded=(0,useExternalScript_1.default)(scriptUrl),{setPaymentRef,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{containerClassName,templateCustomerSaveToWallet,success_url=window.location.href,failure_url=window.location.href,show,...divProps}=p,handleSubmit=async()=>{const savePaymentSourceToCustomerWallet=ref?.current?.elements?.save_payment_source_to_customer_wallet?.checked;if(savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),window.Frames){window.Frames.cardholder={name:order?.billing_address?.full_name,billingAddress:{addressLine1:order?.billing_address?.line_1,addressLine2:order?.billing_address?.line_2,zip:order?.billing_address?.zip_code,city:order?.billing_address?.city,state:order?.billing_address?.state_code,country:order?.billing_address?.country_code},phone:order?.billing_address?.phone};try{const data=await window.Frames.submitCard();if(data.token&&paymentSource&&currentPaymentMethodType){const ps=await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{token:data.token,payment_type:"token",success_url,failure_url,_authorize:!0}});ps&&ps.redirect_uri&&(window.location.href=ps.redirect_uri)}}catch(error){console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error?.message}])}}return!1},lang=`${locale.toUpperCase()}-${locale.toUpperCase()}`,localization=systemLanguages.includes(lang)?lang:"EN-GB";return loaded&&show?(0,jsx_runtime_1.jsxs)("form",{ref,children:[(0,jsx_runtime_1.jsx)("div",{className:containerClassName,...divProps,children:(0,jsx_runtime_1.jsxs)(frames_react_1.Frames,{config:{debug:!0,publicKey,localization,...options},cardValidationChanged:e=>{e.isValid&&ref.current&&(ref.current.onsubmit=()=>handleSubmit(),setPaymentRef({ref}))},cardTokenized:data=>data,children:[(0,jsx_runtime_1.jsx)(frames_react_1.CardNumber,{}),(0,jsx_runtime_1.jsx)(frames_react_1.ExpiryDate,{}),(0,jsx_runtime_1.jsx)(frames_react_1.Cvv,{})]})}),templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]}):null}exports.CheckoutComPayment=CheckoutComPayment,exports.default=CheckoutComPayment;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CheckoutLink=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),components_1=tslib_1.__importDefault(require("../config/components")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),propTypes=components_1.default.CheckoutLink.propTypes,defaultProps=components_1.default.CheckoutLink.defaultProps,displayName=components_1.default.CheckoutLink.displayName;function CheckoutLink(props){const{label,hostedCheckout=!0,children,...p}=props,{order}=(0,react_1.useContext)(OrderContext_1.default),{accessToken,endpoint}=(0,react_1.useContext)(CommerceLayerContext_1.default),[slug]=endpoint.split(".commercelayer"),href=hostedCheckout?`${slug}.checkout.commercelayer.app/${order?.id}?accessToken=${accessToken}`:order?.checkout_url,parentProps={checkoutUrl:order?.checkout_url,hostedCheckout,label,href,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("a",{href,...p,children:label})}exports.CheckoutLink=CheckoutLink,CheckoutLink.propTypes=propTypes,CheckoutLink.defaultProps=defaultProps,CheckoutLink.displayName=displayName,exports.default=CheckoutLink;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DeliveryLeadTime=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.DeliveryLeadTime.propTypes,displayName=components_1.default.DeliveryLeadTime.displayName;function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=(0,react_1.useState)(),{deliveryLeadTimeForShipment}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default);(0,react_1.useEffect)(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:text})}exports.DeliveryLeadTime=DeliveryLeadTime,DeliveryLeadTime.propTypes=propTypes,DeliveryLeadTime.displayName=displayName,exports.default=DeliveryLeadTime;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DiscountAmount=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseOrderPrice_1=tslib_1.__importDefault(require("./utils/BaseOrderPrice")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.DiscountAmount.propTypes,defaultProps=components_1.default.DiscountAmount.defaultProps,displayName=components_1.default.DiscountAmount.displayName;function DiscountAmount(props){return(0,jsx_runtime_1.jsx)(BaseOrderPrice_1.default,{base:"amount",type:"discount",...props})}exports.DiscountAmount=DiscountAmount,DiscountAmount.propTypes=propTypes,DiscountAmount.defaultProps=defaultProps,DiscountAmount.displayName=displayName,exports.default=DiscountAmount;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCard=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),validateFormFields_1=tslib_1.__importDefault(require("../utils/validateFormFields")),lodash_1=require("lodash"),GiftCardContext_1=tslib_1.__importDefault(require("../context/GiftCardContext")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.GiftCard.propTypes,defaultProps=components_1.default.GiftCard.defaultProps,displayName=components_1.default.GiftCard.displayName;function GiftCard(props){const{children,onSubmit}=props,name="giftCardForm",ref=(0,react_1.useRef)(null),{addGiftCard,addGiftCardError}=(0,react_1.useContext)(GiftCardContext_1.default),handleSubmit=e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm?.elements,{errors,values}=(0,validateFormFields_1.default)(elements,["currencyCode","balanceCents"],"gift_cards");(0,lodash_1.isEmpty)(errors)?(addGiftCard(values),currentForm?.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)};return(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:(0,jsx_runtime_1.jsx)("form",{name,ref,onSubmit:handleSubmit,children},name)})}exports.GiftCard=GiftCard,GiftCard.propTypes=propTypes,GiftCard.defaultProps=defaultProps,GiftCard.displayName=displayName,exports.default=GiftCard;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),GiftCardContext_1=tslib_1.__importDefault(require("../context/GiftCardContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),GiftCardReducer_1=tslib_1.__importStar(require("../reducers/GiftCardReducer")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.GiftCardContainer.propTypes,displayName=components_1.default.GiftCardContainer.displayName;function GiftCardContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(GiftCardReducer_1.default,GiftCardReducer_1.giftCardInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default),{getOrder,createOrder,order}=(0,react_1.useContext)(OrderContext_1.default),giftCardValue={...state,addGiftCardRecipient:values=>(0,GiftCardReducer_1.addGiftCardRecipient)(values,config,dispatch),addGiftCard:values=>(0,GiftCardReducer_1.addGiftCard)({...values},{config,dispatch,getOrder,createOrder,order}),addGiftCardError:errors=>(0,GiftCardReducer_1.addGiftCardError)(errors,dispatch),addGiftCardLoading:loading=>(0,GiftCardReducer_1.addGiftCardLoading)(loading,dispatch)};return(0,jsx_runtime_1.jsx)(GiftCardContext_1.default.Provider,{value:giftCardValue,children})}exports.GiftCardContainer=GiftCardContainer,GiftCardContainer.propTypes=propTypes,GiftCardContainer.displayName=displayName,exports.default=GiftCardContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardCurrencySelector=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseSelect_1=tslib_1.__importDefault(require("./utils/BaseSelect")),currency_1=tslib_1.__importDefault(require("../config/currency")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.GiftCardCurrencySelector.propTypes,defaultProps=components_1.default.GiftCardCurrencySelector.defaultProps,displayName=components_1.default.GiftCardCurrencySelector.displayName;function GiftCardCurrencySelector(props){return(0,jsx_runtime_1.jsx)(BaseSelect_1.default,{options:currency_1.default,name:"currencyCode",...props})}exports.GiftCardCurrencySelector=GiftCardCurrencySelector,GiftCardCurrencySelector.propTypes=propTypes,GiftCardCurrencySelector.defaultProps=defaultProps,GiftCardCurrencySelector.displayName=displayName,exports.default=GiftCardCurrencySelector;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardInput=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseInput_1=tslib_1.__importDefault(require("./utils/BaseInput")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.GiftCardInput.propTypes,displayName=components_1.default.GiftCardInput.displayName;function GiftCardInput(props){const{placeholder="",...p}=props;return(0,jsx_runtime_1.jsx)(BaseInput_1.default,{placeholder,...p})}exports.GiftCardInput=GiftCardInput,GiftCardInput.propTypes=propTypes,GiftCardInput.displayName=displayName,exports.default=GiftCardInput;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardOrCouponCode=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),components_1=tslib_1.__importDefault(require("../config/components")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),has_1=tslib_1.__importDefault(require("lodash/has")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),propTypes=components_1.default.GiftCardOrCouponCode.propTypes,displayName=components_1.default.GiftCardOrCouponCode.displayName;function GiftCardOrCouponCode({children,type,...props}){const{order}=(0,react_1.useContext)(OrderContext_1.default);let codeType=type&&`${type}_code`;!type&&order&&(0,has_1.default)(order,"coupon_code")&&!(0,isEmpty_1.default)(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),parentProps={...props,code,hide,discountAmountCents:order?.discount_amount_cents,discountAmountFloat:order?.discount_amount_float,formattedDiscountAmount:order?.formatted_discount_amount};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):hide?null:(0,jsx_runtime_1.jsx)("span",{...props,children:code})}exports.GiftCardOrCouponCode=GiftCardOrCouponCode,GiftCardOrCouponCode.propTypes=propTypes,GiftCardOrCouponCode.displayName=displayName,exports.default=GiftCardOrCouponCode;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardOrCouponForm=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),rapid_form_1=require("rapid-form"),react_1=require("react"),CouponAndGiftCardFormContext_1=tslib_1.__importDefault(require("../context/CouponAndGiftCardFormContext")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),components_1=tslib_1.__importDefault(require("../config/components")),camelCase_1=tslib_1.__importDefault(require("lodash/camelCase")),dropWhile_1=tslib_1.__importDefault(require("lodash/dropWhile")),has_1=tslib_1.__importDefault(require("lodash/has")),lodash_1=require("lodash"),propTypes=components_1.default.GiftCardOrCouponForm.propTypes;function GiftCardOrCouponForm(props){const{children,autoComplete="on",onSubmit,...p}=props,{validation,values,reset}=(0,rapid_form_1.useRapidForm)(),[codeType,setCodeType]=(0,react_1.useState)("gift_card_or_coupon_code"),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null),inputName="gift_card_or_coupon_code";(0,react_1.useEffect)(()=>{if(values[inputName]?.value===""&&(0,lodash_1.findIndex)(errors,{field:(0,camelCase_1.default)(inputName)})!==-1){const err=(0,dropWhile_1.default)(errors,i=>i.field===(0,camelCase_1.default)(inputName));setOrderErrors(err),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1})}values[inputName]?.value===""&&(setOrderErrors([]),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1}))},[values]),(0,react_1.useEffect)(()=>{order?.gift_card_code&&!order?.coupon_code&&setCodeType("coupon_code"),!order?.gift_card_code&&order?.coupon_code&&setCodeType("gift_card_code"),!order?.gift_card_code&&!order?.coupon_code&&setCodeType("gift_card_or_coupon_code")},[order]);const handleSubmit=async e=>{e.preventDefault();const code=(0,has_1.default)(values,inputName)?values[inputName].value:void 0;if(code){const{success}=await setGiftCardOrCouponCode({code,codeType}),value=values[inputName]?.value;onSubmit&&onSubmit({success,value}),success&&reset(e)}};return order?.gift_card_code&&order?.coupon_code||(0,isEmpty_1.default)(order)?null:(0,jsx_runtime_1.jsx)(CouponAndGiftCardFormContext_1.default.Provider,{value:{validation,codeType},children:(0,jsx_runtime_1.jsx)("form",{ref,autoComplete,onSubmit:handleSubmit,...p,children})})}exports.GiftCardOrCouponForm=GiftCardOrCouponForm,GiftCardOrCouponForm.propTypes=propTypes,exports.default=GiftCardOrCouponForm;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardOrCouponInput=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),components_1=tslib_1.__importDefault(require("../config/components")),BaseInput_1=tslib_1.__importDefault(require("./utils/BaseInput")),CouponAndGiftCardFormContext_1=tslib_1.__importDefault(require("../context/CouponAndGiftCardFormContext")),propTypes=components_1.default.GiftCardOrCouponInput.propTypes,displayName=components_1.default.GiftCardOrCouponInput.displayName;function GiftCardOrCouponInput(props){const{placeholder="",required,value,placeholderTranslation,...p}=props,{validation,codeType}=(0,react_1.useContext)(CouponAndGiftCardFormContext_1.default);let placeholderLabel=placeholder;return placeholderTranslation&&codeType&&(placeholderLabel=placeholderTranslation(codeType)),(0,jsx_runtime_1.jsx)(BaseInput_1.default,{type:"text",name:"gift_card_or_coupon_code",ref:validation,required:required!==void 0?required:!0,placeholder:placeholderLabel,defaultValue:value,...p})}exports.GiftCardOrCouponInput=GiftCardOrCouponInput,GiftCardOrCouponInput.propTypes=propTypes,GiftCardOrCouponInput.displayName=displayName,exports.default=GiftCardOrCouponInput;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardOrCouponRemoveButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),lodash_1=require("lodash"),propTypes=components_1.default.GiftCardOrCouponRemoveButton.propTypes,displayName=components_1.default.GiftCardOrCouponRemoveButton.displayName;function GiftCardOrCouponRemoveButton(props){const{children,label="Remove",onClick,type,...p}=props,{order,removeGiftCardOrCouponCode}=(0,react_1.useContext)(OrderContext_1.default);let codeType=`${type}_code`;!type&&order&&(0,lodash_1.has)(order,"coupon_code")&&!(0,lodash_1.isEmpty)(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),handleClick=async()=>{const response=removeGiftCardOrCouponCode&&await removeGiftCardOrCouponCode({codeType});onClick&&onClick(response)},parentProps={...p,label,handleClick,codeType};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):hide?null:(0,jsx_runtime_1.jsx)("button",{type:"button",onClick:handleClick,...p,children:label})}exports.GiftCardOrCouponRemoveButton=GiftCardOrCouponRemoveButton,GiftCardOrCouponRemoveButton.propTypes=propTypes,GiftCardOrCouponRemoveButton.displayName=displayName,exports.default=GiftCardOrCouponRemoveButton;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GiftCardOrCouponSubmit=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.GiftCardOrCouponSubmit.propTypes,displayName=components_1.default.GiftCardOrCouponSubmit.displayName;function GiftCardOrCouponSubmit(props){const{children,label="Submit",...p}=props,parentProps={...p,label};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("button",{type:"submit",...p,children:label})}exports.GiftCardOrCouponSubmit=GiftCardOrCouponSubmit,GiftCardOrCouponSubmit.propTypes=propTypes,GiftCardOrCouponSubmit.displayName=displayName,exports.default=GiftCardOrCouponSubmit;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ItemContext_1=tslib_1.__importStar(require("../context/ItemContext")),ItemReducer_1=tslib_1.__importStar(require("../reducers/ItemReducer")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.ItemContainer.propTypes,displayName=components_1.default.ItemContainer.displayName;function ItemContainer(props){const{children,skuCode,lineItem}=props,[state,dispatch]=(0,react_1.useReducer)(ItemReducer_1.default,ItemReducer_1.itemInitialState);(0,react_1.useEffect)(()=>{const code=skuCode;code&&(0,ItemReducer_1.setItemState)(code,{type:"setSkuCode",key:"skuCode"},dispatch),lineItem&&(0,ItemReducer_1.setItemState)(lineItem,{type:"setCustomLineItem",key:"lineItem"},dispatch)},[]);const setItems=items=>(0,ItemReducer_1.setItemState)(items,{type:"setItems",key:"items"},dispatch),setItem=item=>(0,ItemReducer_1.setItemState)(item,{type:"setItem",key:"item"},dispatch),setQuantity=item=>(0,ItemReducer_1.setItemState)(item,{type:"setQuantity",key:"quantity"},dispatch),setOption=item=>(0,ItemReducer_1.setItemState)(item,{type:"setOption",key:"option"},dispatch),setPrices=item=>(0,ItemReducer_1.setItemState)(item,{type:"setPrices",key:"prices"},dispatch),setCustomLineItems=item=>(0,ItemReducer_1.setItemState)(item,{type:"setCustomLineItems",key:"lineItems"},dispatch),setSkuCode=code=>(0,ItemReducer_1.setItemState)(code,{type:"setSkuCode",key:"skuCode"},dispatch),itemValue={...ItemContext_1.initialItemContext,...state,setItems,setItem,setQuantity,setOption,setPrices,setCustomLineItems,setSkuCode};return(0,jsx_runtime_1.jsx)(ItemContext_1.default.Provider,{value:itemValue,children})}exports.ItemContainer=ItemContainer,ItemContainer.propTypes=propTypes,ItemContainer.displayName=displayName,exports.default=ItemContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),useExternalScript_1=tslib_1.__importDefault(require("../utils/hooks/useExternalScript")),PlaceOrderContext_1=tslib_1.__importDefault(require("../context/PlaceOrderContext"));function typeOfLine(lineItemType){switch(lineItemType){case"payment_methods":default:return null;case"percentage_discount_promotions":return"discount";case"shipments":return"shipping_fee";case"skus":return"physical"}}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}}):[]}function KlarnaPayment({clientToken,placeOrderCallback,locale="EN",...p}){const ref=(0,react_1.useRef)(null),{paymentSource,currentPaymentMethodType,setPaymentRef,setPaymentSource,setPaymentMethodErrors}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{setPlaceOrder}=(0,react_1.useContext)(PlaceOrderContext_1.default),loaded=(0,useExternalScript_1.default)("https://x.klarnacdn.net/kp/lib/v1/api.js"),[klarna,setKlarna]=(0,react_1.useState)(),{containerClassName,...divProps}=p;(0,react_1.useEffect)(()=>{loaded&&window?.Klarna!==void 0&&setKlarna(window.Klarna)},[loaded,window.Klarna]),(0,react_1.useEffect)(()=>(ref.current&&paymentSource&&currentPaymentMethodType&&loaded&&klarna&&(ref.current.onsubmit=()=>handleClick(klarna),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType,loaded,klarna]);const handleClick=async kl=>{const[first]=paymentSource?.payment_methods||void 0,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: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},shipping_address={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,billing_address,order_amount:order?.total_amount_cents,order_lines:klarnaOrderLines(order?.line_items)};try{kl.Payments.load({container:"#klarna-payments-container",payment_method_category},{billing_address,shipping_address},async function({show_form}){if(show_form)try{await kl.Payments.authorize({payment_method_category},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(0,jsx_runtime_1.jsx)("form",{ref,children:(0,jsx_runtime_1.jsx)("div",{className:containerClassName,...divProps,children:(0,jsx_runtime_1.jsx)("div",{id:"klarna-payments-container"})})})}exports.default=KlarnaPayment;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItem=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemContext_1=tslib_1.__importDefault(require("../context/LineItemContext")),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),components_1=tslib_1.__importDefault(require("../config/components")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../context/ShipmentChildrenContext")),propTypes=components_1.default.LineItem.propTypes,displayName=components_1.default.LineItem.displayName;function LineItem(props){const{type="skus",children}=props,{lineItems}=(0,react_1.useContext)(LineItemContext_1.default),{lineItems:shipmentLineItems}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),items=shipmentLineItems&&shipmentLineItems?.length>0?shipmentLineItems:lineItems,components=items&&items.filter(l=>l.item_type===type).map((lineItem,k,check)=>{if(lineItem.item_type==="bundles"&&k>0&&check[k-1]?.bundle_code===lineItem.bundle_code||lineItem.item_type==="gift_cards"&&lineItem?.total_amount_cents&&lineItem?.total_amount_cents<=0)return null;const lineProps={lineItem};return(0,jsx_runtime_1.jsx)(LineItemChildrenContext_1.default.Provider,{value:lineProps,children},k)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.LineItem=LineItem,LineItem.propTypes=propTypes,LineItem.displayName=displayName,exports.default=LineItem;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemAmount=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getAmount_1=tslib_1.__importDefault(require("../utils/getAmount")),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemAmount.propTypes,defaultProps=components_1.default.LineItemAmount.defaultProps,displayName=components_1.default.LineItemAmount.displayName;function LineItemAmount(props){const{format="formatted",type="total",...p}=props,{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),[price,setPrice]=(0,react_1.useState)("");(0,react_1.useEffect)(()=>{if(lineItem){const p2=(0,getAmount_1.default)({base:"amount",type,format,obj:lineItem});setPrice(p2)}return()=>{setPrice("")}},[lineItem]);const parentProps={price,...p};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:price})}exports.LineItemAmount=LineItemAmount,LineItemAmount.propTypes=propTypes,LineItemAmount.defaultProps=defaultProps,LineItemAmount.displayName=displayName,exports.default=LineItemAmount;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemCode=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemCode.propTypes,displayName=components_1.default.LineItemCode.displayName;function LineItemCode({type="sku_code",children,...p}){const{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),labelName=lineItem?.[type],parentProps={lineItem,skuCode:labelName,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("p",{...p,children:labelName})}exports.LineItemCode=LineItemCode,LineItemCode.propTypes=propTypes,LineItemCode.displayName=displayName,exports.default=LineItemCode;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemImage=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),components_1=tslib_1.__importDefault(require("../config/components")),placeholderImages_1=require("../utils/placeholderImages"),propTypes=components_1.default.LineItemImage.propTypes,displayName=components_1.default.LineItemImage.displayName;function LineItemImage(props){const{placeholder,children,...p}=props,{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),itemType=lineItem?.item_type;let src=lineItem?.image_url;src||(placeholder?.[itemType]?src=placeholder?.[itemType]:src=itemType==="gift_cards"?placeholderImages_1.defaultGiftCardImgUrl:placeholderImages_1.defaultImgUrl);const parenProps={lineItem,src,placeholder,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parenProps,children}):src?(0,jsx_runtime_1.jsx)("img",{alt:"",src,...p}):null}exports.LineItemImage=LineItemImage,LineItemImage.propTypes=propTypes,LineItemImage.displayName=displayName,exports.default=LineItemImage;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemName=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemName.propTypes,displayName=components_1.default.LineItemName.displayName;function LineItemName(props){const{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),label=lineItem?.name,parentProps={label,lineItem,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("p",{...props,children:label})}exports.LineItemName=LineItemName,LineItemName.propTypes=propTypes,LineItemName.displayName=displayName,exports.default=LineItemName;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemOption=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemOptionChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemOptionChildrenContext")),get_1=tslib_1.__importDefault(require("lodash/get")),has_1=tslib_1.__importDefault(require("lodash/has")),map_1=tslib_1.__importDefault(require("lodash/map")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),isJSON_1=tslib_1.__importDefault(require("../utils/isJSON")),propTypes=components_1.default.LineItemOption.propTypes,displayName=components_1.default.LineItemOption.displayName;function LineItemOption(props){const{name,children,valueClassName,key,tagElement="li",tagContainer="ul",...p}=props,{lineItemOption,showAll}=(0,react_1.useContext)(LineItemOptionChildrenContext_1.default),parentProps={...props,lineItemOption},TagElement=tagElement,TagContainer=tagContainer,components=showAll&&(0,isJSON_1.default)(JSON.stringify(lineItemOption?.options))?(0,map_1.default)(lineItemOption?.options,(value,key2)=>(0,jsx_runtime_1.jsxs)(TagElement,{...p,children:[`${key2}:`,(0,jsx_runtime_1.jsx)("span",{className:valueClassName,children:`${value}`})]},key2)):(0,has_1.default)(lineItemOption,`options.${name}`)?(0,jsx_runtime_1.jsxs)(TagElement,{...p,children:[`${name}:`,(0,jsx_runtime_1.jsx)("span",{className:valueClassName,...p,children:`${(0,get_1.default)(lineItemOption,`options.${name}`)}`})]},key):null;return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)(TagContainer,{children:components})}exports.LineItemOption=LineItemOption,LineItemOption.propTypes=propTypes,LineItemOption.displayName=displayName,exports.default=LineItemOption;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemOptions=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),LineItemOptionChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemOptionChildrenContext")),lodash_1=require("lodash"),components_1=tslib_1.__importDefault(require("../config/components")),displayName=components_1.default.LineItemOptions.displayName;function LineItemOptions(props){const{skuOptionId,title,children,showName=!0,showAll,className,titleTagElement="h6",titleClassName,...p}=props,{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),lineItemOptions=(0,lodash_1.isEmpty)(lineItem)?[]:lineItem?.line_item_options||[],TitleTagElement=titleTagElement,options=lineItemOptions.filter(o=>showAll?!0:o.skuOption().id===skuOptionId).map((o,k)=>{const showTitle=showName?(0,jsx_runtime_1.jsx)(TitleTagElement,{className:titleClassName,children:title||o.name}):null,valueProps={lineItemOption:o,showAll};return(0,jsx_runtime_1.jsxs)("div",{className,...p,children:[showTitle,(0,jsx_runtime_1.jsx)(LineItemOptionChildrenContext_1.default.Provider,{value:valueProps,children})]},k)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:options})}exports.LineItemOptions=LineItemOptions,LineItemOptions.displayName=displayName,exports.default=LineItemOptions;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemQuantity=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),LineItemContext_1=tslib_1.__importDefault(require("../context/LineItemContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemQuantity.propTypes,defaultProps=components_1.default.LineItemQuantity.defaultProps,displayName=components_1.default.LineItemQuantity.displayName;function LineItemQuantity(props){const{max=50,readonly=!1,...p}=props,{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),{updateLineItem}=(0,react_1.useContext)(LineItemContext_1.default),options=[];for(let i=1;i<=max;i++)options.push((0,jsx_runtime_1.jsx)("option",{value:`${i}`,children:i},i));const handleChange=e=>{const quantity2=Number(e.target.value);updateLineItem&&lineItem&&updateLineItem(lineItem.id,quantity2)},quantity=lineItem?.quantity,parentProps={handleChange,quantity,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):readonly?(0,jsx_runtime_1.jsx)("span",{...p,children:quantity}):(0,jsx_runtime_1.jsx)("select",{title:lineItem?.name,value:quantity,onChange:handleChange,...p,children:options})}exports.LineItemQuantity=LineItemQuantity,LineItemQuantity.propTypes=propTypes,LineItemQuantity.defaultProps=defaultProps,LineItemQuantity.displayName=displayName,exports.default=LineItemQuantity;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemRemoveLink=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemChildrenContext_1=tslib_1.__importDefault(require("../context/LineItemChildrenContext")),LineItemContext_1=tslib_1.__importDefault(require("../context/LineItemContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemRemoveLink.propTypes,defaultProps=components_1.default.LineItemRemoveLink.defaultProps,displayName=components_1.default.LineItemRemoveLink.displayName;function LineItemRemoveLink(props){const{label="Remove"}=props,{lineItem}=(0,react_1.useContext)(LineItemChildrenContext_1.default),{deleteLineItem}=(0,react_1.useContext)(LineItemContext_1.default),handleRemove=e=>{e.preventDefault(),deleteLineItem&&lineItem&&deleteLineItem(lineItem.id)},parentProps={handleRemove,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("a",{...props,href:"#",onClick:handleRemove,children:label})}exports.LineItemRemoveLink=LineItemRemoveLink,LineItemRemoveLink.propTypes=propTypes,LineItemRemoveLink.defaultProps=defaultProps,LineItemRemoveLink.displayName=displayName,exports.default=LineItemRemoveLink;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),LineItemReducer_1=tslib_1.__importStar(require("../reducers/LineItemReducer")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),LineItemContext_1=tslib_1.__importDefault(require("../context/LineItemContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemsContainer.propTypes,defaultProps=components_1.default.LineItemsContainer.defaultProps,displayName=components_1.default.LineItemsContainer.displayName;function LineItemsContainer(props){const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default),[state,dispatch]=(0,react_1.useReducer)(LineItemReducer_1.default,LineItemReducer_1.lineItemInitialState);(0,react_1.useEffect)(()=>{include?.includes("line_items.line_item_options.sku_option")?includeLoaded?.["line_items.line_item_options.sku_option"]||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),include?.includes("line_items.item")?includeLoaded?.["line_items.item"]||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]})},[include,includeLoaded]),(0,react_1.useEffect)(()=>{order?.line_items&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}})},[order?.line_items]);const lineItemValue={...state,loader,updateLineItem:(lineItemId,quantity=1)=>(0,LineItemReducer_1.updateLineItem)({lineItemId,quantity,dispatch,config,getOrder,orderId,errors:state.errors}),deleteLineItem:lineItemId=>(0,LineItemReducer_1.deleteLineItem)({lineItemId,dispatch,config,getOrder,orderId,errors:state.errors})};return(0,jsx_runtime_1.jsx)(LineItemContext_1.default.Provider,{value:lineItemValue,children:state.loading?loader:children})}exports.LineItemsContainer=LineItemsContainer,LineItemsContainer.propTypes=propTypes,LineItemsContainer.defaultProps=defaultProps,LineItemsContainer.displayName=displayName,exports.default=LineItemsContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemsCount=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),getLineItemsCount_1=tslib_1.__importDefault(require("../utils/getLineItemsCount")),LineItemContext_1=tslib_1.__importDefault(require("../context/LineItemContext")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemsCount.propTypes,displayName=components_1.default.LineItemsCount.displayName;function LineItemsCount(props){const{children,typeAccepted,...p}=props,{lineItems}=(0,react_1.useContext)(LineItemContext_1.default),[quantity,setQuantity]=(0,react_1.useState)(0);(0,react_1.useEffect)(()=>{if(lineItems&&lineItems.length>0){const qty=(0,getLineItemsCount_1.default)({lineItems:lineItems||[],typeAccepted});setQuantity(qty)}return()=>{setQuantity(0)}},[lineItems,typeAccepted]);const parentProps={quantity,typeAccepted,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("span",{...p,children:quantity})}exports.LineItemsCount=LineItemsCount,LineItemsCount.propTypes=propTypes,LineItemsCount.displayName=displayName,exports.default=LineItemsCount;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LineItemsEmpty=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),getLineItemsCount_1=tslib_1.__importDefault(require("../utils/getLineItemsCount")),LineItemContext_1=tslib_1.__importDefault(require("../context/LineItemContext")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.LineItemsEmpty.propTypes,displayName=components_1.default.LineItemsEmpty.displayName;function LineItemsEmpty(props){const{children,text="Your shopping bag is empty",...p}=props,{lineItems}=(0,react_1.useContext)(LineItemContext_1.default),[quantity,setQuantity]=(0,react_1.useState)(),emptyText=quantity===0?(0,jsx_runtime_1.jsx)("span",{...p,children:text}):null;(0,react_1.useEffect)(()=>{if(lineItems)if(lineItems.length>0){const qty=(0,getLineItemsCount_1.default)({lineItems:lineItems||[]});setQuantity(qty)}else setQuantity(0);return()=>{setQuantity(void 0)}},[lineItems]);const parentProps={quantity,text,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):emptyText}exports.LineItemsEmpty=LineItemsEmpty,LineItemsEmpty.propTypes=propTypes,LineItemsEmpty.displayName=displayName,exports.default=LineItemsEmpty;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),paypalPayment_1=tslib_1.__importDefault(require("../utils/paypalPayment")),react_1=require("react"),getLoaderComponent_1=tslib_1.__importDefault(require("../utils/getLoaderComponent")),CustomerContext_1=tslib_1.__importDefault(require("../context/CustomerContext"));function PaymentGateway({readonly,showCard,handleEditClick,children,templateCustomerCards,templateCustomerSaveToWallet,onClickCustomerCards,show,loader="Loading...",...p}){const loaderComponent=(0,getLoaderComponent_1.default)(loader),[loading,setLoading]=(0,react_1.useState)(!0),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{getCustomerPaymentSources}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,currentPaymentMethodType,setPaymentSource,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource=readonly?currentPaymentMethodType:payment?.payment_source_type;(0,react_1.useEffect)(()=>{if(payment?.id===currentPaymentMethodId&&paymentResource&&order?.payment_method?.payment_source_type===paymentResource){const attributes=config&&paymentResource==="paypal_payments"?(0,paypalPayment_1.default)(paymentResource,config):{},setPaymentSources=async()=>{await setPaymentSource({paymentResource,order,attributes}),getCustomerPaymentSources&&getCustomerPaymentSources()};(!paymentSource&&order?.payment_method.id&&show||!paymentSource||paymentSource.type!==paymentResource)&&setPaymentSources(),paymentSource?.mismatched_amounts&&show&&setPaymentSources(),setLoading(!1)}return()=>{setLoading(!0)}},[order?.payment_method?.id,show,paymentSource]);const gatewayConfig={readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet,...p};switch(paymentResource){case"stripe_payments":return(0,jsx_runtime_1.jsx)(StripeGateway_1.default,{...gatewayConfig,children});case"klarna_payments":return(0,jsx_runtime_1.jsx)(KlarnaGateway_1.default,{...gatewayConfig,children});case"adyen_payments":return(0,jsx_runtime_1.jsx)(AdyenGateway_1.default,{...gatewayConfig,children});case"braintree_payments":return(0,jsx_runtime_1.jsx)(BraintreeGateway_1.default,{...gatewayConfig,children});case"wire_transfers":return(0,jsx_runtime_1.jsx)(WireTransferGateway_1.default,{...gatewayConfig,children});case"paypal_payments":return(0,jsx_runtime_1.jsx)(PaypalGateway_1.default,{...gatewayConfig,children});case"checkout_com_payments":return(0,jsx_runtime_1.jsx)(CheckoutComGateway_1.default,{...gatewayConfig,children});default:return null}}exports.PaymentGateway=PaymentGateway,exports.default=PaymentGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethod=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../context/PaymentMethodChildrenContext")),components_1=tslib_1.__importDefault(require("../config/components")),getLoaderComponent_1=tslib_1.__importDefault(require("../utils/getLoaderComponent")),propTypes=components_1.default.PaymentMethod.propTypes,displayName=components_1.default.PaymentMethod.displayName;function PaymentMethod({children,className,activeClass,loader="Loading...",clickableContainer,onClick,...p}){const[loading,setLoading]=(0,react_1.useState)(!0),[paymentSelected,setPaymentSelected]=(0,react_1.useState)(""),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder}=(0,react_1.useContext)(PaymentMethodContext_1.default);(0,react_1.useEffect)(()=>(paymentMethods&&setLoading(!1),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0)}),[paymentMethods,currentPaymentMethodId]);const components=paymentMethods&&paymentMethods.map((payment,k)=>{const isActive=currentPaymentMethodId===payment?.id,paymentMethodProps={payment,clickableContainer,paymentSelected,setPaymentSelected},paymentResource=payment?.payment_source_type,onClickable=clickableContainer?async e=>{e.stopPropagation(),setLoadingPlaceOrder({loading:!0}),setPaymentSelected(payment.id);const paymentMethodId=payment?.id;await setPaymentMethod({paymentResource,paymentMethodId}),onClick&&onClick(payment),setLoadingPlaceOrder({loading:!1})}:void 0;return(0,jsx_runtime_1.jsx)("div",{"data-test-id":paymentResource,className:`${className} ${isActive?activeClass:""}`,onClick:onClickable,...p,children:(0,jsx_runtime_1.jsx)(PaymentMethodChildrenContext_1.default.Provider,{value:paymentMethodProps,children})},k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:components})}exports.PaymentMethod=PaymentMethod,PaymentMethod.propTypes=propTypes,PaymentMethod.displayName=displayName,exports.default=PaymentMethod;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodAmount=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseOrderPrice_1=tslib_1.__importDefault(require("./utils/BaseOrderPrice")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.PaymentMethodAmount.propTypes,defaultProps=components_1.default.PaymentMethodAmount.defaultProps,displayName=components_1.default.PaymentMethodAmount.displayName;function PaymentMethodAmount(props){return(0,jsx_runtime_1.jsx)(BaseOrderPrice_1.default,{base:"amount",type:"payment_method",...props})}exports.PaymentMethodAmount=PaymentMethodAmount,PaymentMethodAmount.propTypes=propTypes,PaymentMethodAmount.defaultProps=defaultProps,PaymentMethodAmount.displayName=displayName,exports.default=PaymentMethodAmount;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodName=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.PaymentMethodName.propTypes,displayName=components_1.default.PaymentMethodName.displayName;function PaymentMethodName(props){const{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),labelName=payment?.name,htmlFor=payment?.payment_source_type,parentProps={htmlFor,labelName,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("label",{htmlFor,...props,children:labelName})}exports.PaymentMethodName=PaymentMethodName,PaymentMethodName.propTypes=propTypes,PaymentMethodName.displayName=displayName,exports.default=PaymentMethodName;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodPrice=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getAmount_1=tslib_1.__importDefault(require("../utils/getAmount")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.PaymentMethodPrice.propTypes,displayName=components_1.default.PaymentMethodPrice.displayName;function PaymentMethodPrice(props){const{format="formatted",type="amount",labelFree="Free",...p}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),[price,setPrice]=(0,react_1.useState)(""),[priceCents,setPriceCents]=(0,react_1.useState)(0);(0,react_1.useEffect)(()=>{if(payment){const p2=(0,getAmount_1.default)({base:"price",type,format,obj:payment});setPrice(p2);const c=(0,getAmount_1.default)({base:"price",type,format:"cents",obj:payment});setPriceCents(c)}return()=>{setPrice(""),setPriceCents(0)}},[payment]);const parentProps={labelFree,price,priceCents,...p};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:priceCents===0?labelFree:price})}exports.PaymentMethodPrice=PaymentMethodPrice,PaymentMethodPrice.propTypes=propTypes,PaymentMethodPrice.displayName=displayName,exports.default=PaymentMethodPrice;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodRadioButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),propTypes=components_1.default.PaymentMethodRadioButton.propTypes,displayName=components_1.default.PaymentMethodRadioButton.displayName;function PaymentMethodRadioButton(props){const{onChange,...p}=props,{payment,paymentSelected,setPaymentSelected,clickableContainer}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{setPaymentMethod,setLoading}=(0,react_1.useContext)(PaymentMethodContext_1.default),orderId=order?.id||"",paymentResource=payment?.payment_source_type,paymentMethodId=payment?.id,name=`payment-${orderId}`,checked=paymentSelected===payment?.id,handleOnChange=async e=>{e.stopPropagation(),setPaymentSelected&&setPaymentSelected(paymentMethodId),setLoading({loading:!0}),!clickableContainer&&await setPaymentMethod({paymentResource,paymentMethodId}),onChange&&onChange(payment),setLoading({loading:!1})},id=payment?.payment_source_type,parentProps={handleOnChange,checked,id,name,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("input",{title:name,type:"radio",id,onChange:handleOnChange,checked,...p})}exports.PaymentMethodRadioButton=PaymentMethodRadioButton,PaymentMethodRadioButton.propTypes=propTypes,PaymentMethodRadioButton.displayName=displayName,exports.default=PaymentMethodRadioButton;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentMethodContext_1=tslib_1.__importStar(require("../context/PaymentMethodContext")),react_1=require("react"),PaymentMethodReducer_1=tslib_1.__importStar(require("../reducers/PaymentMethodReducer")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),components_1=tslib_1.__importDefault(require("../config/components")),lodash_1=require("lodash"),PaymentMethodReducer_2=require("../reducers/PaymentMethodReducer"),propTypes=components_1.default.PaymentMethodsContainer.propTypes,displayName=components_1.default.PaymentMethodsContainer.displayName;function PaymentMethodsContainer(props){const{children,config}=props,[state,dispatch]=(0,react_1.useReducer)(PaymentMethodReducer_1.default,PaymentMethodReducer_1.paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),credentials=(0,react_1.useContext)(CommerceLayerContext_1.default);async function getPayMethods(){order&&await(0,PaymentMethodReducer_1.getPaymentMethods)({order,dispatch})}(0,react_1.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&&(0,lodash_1.isEmpty)(state.config)&&(0,PaymentMethodReducer_1.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,includeLoaded]);const contextValue=(0,react_1.useMemo)(()=>({...state,setLoading:({loading})=>PaymentMethodContext_1.defaultPaymentMethodContext.setLoading({loading,dispatch}),setPaymentRef:({ref})=>(0,PaymentMethodReducer_2.setPaymentRef)({ref,dispatch}),setPaymentMethodErrors:errors=>PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch),setPaymentMethod:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentMethod({...args,config:credentials,updateOrder,order,dispatch,setOrderErrors}),setPaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.setPaymentSource({...state,...args,config:credentials,dispatch,getOrder,updateOrder,order}),updatePaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.updatePaymentSource({...args,config:credentials,dispatch}),destroyPaymentSource:async args=>await PaymentMethodContext_1.defaultPaymentMethodContext.destroyPaymentSource({...args,dispatch,config:credentials,updateOrder,orderId:order?.id})}),[state]);return(0,jsx_runtime_1.jsx)(PaymentMethodContext_1.default.Provider,{value:contextValue,children})}exports.PaymentMethodsContainer=PaymentMethodsContainer,PaymentMethodsContainer.propTypes=propTypes,PaymentMethodsContainer.displayName=displayName,exports.default=PaymentMethodsContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSource=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../context/PaymentMethodChildrenContext")),components_1=tslib_1.__importDefault(require("../config/components")),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),CustomerContext_1=tslib_1.__importDefault(require("../context/CustomerContext")),PaymentGateway_1=tslib_1.__importDefault(require("./PaymentGateway")),getCardDetails_1=tslib_1.__importDefault(require("../utils/getCardDetails")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),propTypes=components_1.default.PaymentSource.propTypes,displayName=components_1.default.PaymentSource.displayName;function PaymentSource(props){const{readonly}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{payments}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,paymentSource,destroyPaymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),[show,setShow]=(0,react_1.useState)(!1),[showCard,setShowCard]=(0,react_1.useState)(!1);(0,react_1.useEffect)(()=>(readonly?(setShow(!0),setShowCard(!0)):payment?.id===currentPaymentMethodId?(setShow(!0),(0,getCardDetails_1.default)({paymentType:payment?.payment_source_type,customerPayment:{payment_source:paymentSource}}).brand&&setShowCard(!0)):setShow(!1),()=>{setShow(!1),setShowCard(!1)}),[currentPaymentMethodId,paymentSource,payments,payment,readonly,order]);const gatewayProps={...props,show,showCard,handleEditClick:async e=>{if(e.stopPropagation(),paymentSource){const paymentSourceId=paymentSource?.id;await destroyPaymentSource({paymentSourceId,paymentResource:payment?.payment_source_type})}setShowCard(!showCard),setShow(!0)},readonly};return(0,jsx_runtime_1.jsx)(PaymentGateway_1.default,{...gatewayProps})}exports.PaymentSource=PaymentSource,PaymentSource.propTypes=propTypes,PaymentSource.displayName=displayName,exports.default=PaymentSource;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceBrandIcon=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentSourceContext_1=tslib_1.__importDefault(require("../context/PaymentSourceContext")),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.PaymentSourceBrandIcon.propTypes,displayName=components_1.default.PaymentSourceBrandIcon.displayName;function PaymentSourceBrandIcon({src,width=32,children,...p}){const{brand}=(0,react_1.useContext)(PaymentSourceContext_1.default),ref=(0,react_1.useRef)(null),defaultSrc="//data.commercelayer.app/assets/images/icons/credit-cards/color/credit-card.svg",url=src||`//data.commercelayer.app/assets/images/icons/credit-cards/color/${brand}.svg`,handleError=()=>{ref.current&&(ref.current.src=defaultSrc)},parentProps={brand,defaultSrc,url,width,...p};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("img",{ref,src:url,onError:handleError,width,...p})}exports.PaymentSourceBrandIcon=PaymentSourceBrandIcon,PaymentSourceBrandIcon.propTypes=propTypes,PaymentSourceBrandIcon.displayName=displayName,exports.default=PaymentSourceBrandIcon;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceBrandName=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentSourceContext_1=tslib_1.__importDefault(require("../context/PaymentSourceContext")),lodash_1=require("lodash"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.PaymentSourceBrandName.propTypes,displayName=components_1.default.PaymentSourceBrandName.displayName;function PaymentSourceBrandName({children,label,...props}){const{brand}=(0,react_1.useContext)(PaymentSourceContext_1.default),brandName=brand&&(0,lodash_1.capitalize)(brand.replace("-"," ")),parentProps={brand:brandName,label,...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("span",{...props,children:label||(0,lodash_1.capitalize)(brandName)})}exports.PaymentSourceBrandName=PaymentSourceBrandName,PaymentSourceBrandName.propTypes=propTypes,PaymentSourceBrandName.displayName=displayName,exports.default=PaymentSourceBrandName;