@commercelayer/react-components 4.0.0-alpha.1 → 4.0.0-alpha.11

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 (755) 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 +6 -15
  5. package/lib/cjs/components/SubmitButton.js +1 -1
  6. package/lib/cjs/components/addresses/Address.d.ts +4 -9
  7. package/lib/cjs/components/addresses/Address.js +1 -1
  8. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +2 -2
  9. package/lib/cjs/components/addresses/AddressField.d.ts +8 -12
  10. package/lib/cjs/components/addresses/AddressField.js +1 -1
  11. package/lib/cjs/components/addresses/AddressInput.d.ts +0 -11
  12. package/lib/cjs/components/addresses/AddressInput.js +1 -1
  13. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +2 -2
  14. package/lib/cjs/components/addresses/AddressesContainer.d.ts +2 -9
  15. package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
  16. package/lib/cjs/components/addresses/AddressesEmpty.d.ts +14 -0
  17. package/lib/cjs/components/addresses/AddressesEmpty.js +1 -0
  18. package/lib/cjs/components/addresses/BillingAddressContainer.d.ts +6 -0
  19. package/lib/cjs/components/addresses/BillingAddressContainer.js +1 -0
  20. package/lib/{esm/components → cjs/components/addresses}/BillingAddressForm.d.ts +1 -1
  21. package/lib/cjs/components/addresses/BillingAddressForm.js +1 -0
  22. package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +12 -0
  23. package/lib/cjs/components/addresses/SaveAddressesButton.js +1 -0
  24. package/lib/{esm/components → cjs/components/addresses}/ShippingAddressContainer.d.ts +1 -1
  25. package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -0
  26. package/lib/cjs/components/{ShippingAddressForm.d.ts → addresses/ShippingAddressForm.d.ts} +1 -1
  27. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -0
  28. package/lib/cjs/components/auth/CommerceLayer.d.ts +4 -11
  29. package/lib/cjs/components/auth/CommerceLayer.js +1 -1
  30. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +1 -1
  31. package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
  32. package/lib/cjs/components/customers/CustomerContainer.d.ts +2 -2
  33. package/lib/cjs/components/customers/CustomerContainer.js +1 -1
  34. package/lib/cjs/components/customers/SaveCustomerButton.d.ts +12 -0
  35. package/lib/cjs/components/{SaveCustomerButton.js → customers/SaveCustomerButton.js} +1 -1
  36. package/lib/cjs/components/{GiftCard.d.ts → gift_cards/GiftCard.d.ts} +2 -2
  37. package/lib/cjs/components/gift_cards/GiftCard.js +1 -0
  38. package/lib/{esm/components → cjs/components/gift_cards}/GiftCardContainer.d.ts +1 -1
  39. package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -0
  40. package/lib/cjs/components/{GiftCardCurrencySelector.d.ts → gift_cards/GiftCardCurrencySelector.d.ts} +2 -2
  41. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -0
  42. package/lib/{esm/components → cjs/components/gift_cards}/GiftCardInput.d.ts +3 -3
  43. package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -0
  44. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +16 -0
  45. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -0
  46. package/lib/{esm/components → cjs/components/gift_cards}/GiftCardOrCouponForm.d.ts +1 -1
  47. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -0
  48. package/lib/cjs/components/{GiftCardOrCouponInput.d.ts → gift_cards/GiftCardOrCouponInput.d.ts} +2 -2
  49. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -0
  50. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +18 -0
  51. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -0
  52. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +10 -0
  53. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +1 -0
  54. package/lib/cjs/components/{GiftCardRecipient.d.ts → gift_cards/GiftCardRecipient.d.ts} +0 -0
  55. package/lib/cjs/components/{GiftCardRecipient.js → gift_cards/GiftCardRecipient.js} +0 -0
  56. package/lib/cjs/components/{GiftCardRecipientInput.d.ts → gift_cards/GiftCardRecipientInput.d.ts} +0 -0
  57. package/lib/cjs/components/{GiftCardRecipientInput.js → gift_cards/GiftCardRecipientInput.js} +0 -0
  58. package/lib/{esm/components → cjs/components/line_items}/LineItem.d.ts +2 -2
  59. package/lib/cjs/components/line_items/LineItem.js +1 -0
  60. package/lib/{esm/components → cjs/components/line_items}/LineItemAmount.d.ts +2 -2
  61. package/lib/cjs/components/line_items/LineItemAmount.js +1 -0
  62. package/lib/cjs/components/{LineItemCode.d.ts → line_items/LineItemCode.d.ts} +2 -2
  63. package/lib/cjs/components/line_items/LineItemCode.js +1 -0
  64. package/lib/cjs/components/{LineItemImage.d.ts → line_items/LineItemImage.d.ts} +3 -3
  65. package/lib/cjs/components/line_items/LineItemImage.js +1 -0
  66. package/lib/cjs/components/{LineItemName.d.ts → line_items/LineItemName.d.ts} +2 -2
  67. package/lib/cjs/components/line_items/LineItemName.js +1 -0
  68. package/lib/cjs/components/{LineItemOption.d.ts → line_items/LineItemOption.d.ts} +2 -2
  69. package/lib/cjs/components/line_items/LineItemOption.js +1 -0
  70. package/lib/cjs/components/{LineItemOptions.d.ts → line_items/LineItemOptions.d.ts} +0 -0
  71. package/lib/cjs/components/line_items/LineItemOptions.js +1 -0
  72. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +14 -0
  73. package/lib/cjs/components/line_items/LineItemQuantity.js +1 -0
  74. package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +12 -0
  75. package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -0
  76. package/lib/{esm/components → cjs/components/line_items}/LineItemsContainer.d.ts +2 -2
  77. package/lib/cjs/components/line_items/LineItemsContainer.js +1 -0
  78. package/lib/cjs/components/line_items/LineItemsCount.d.ts +12 -0
  79. package/lib/cjs/components/line_items/LineItemsCount.js +1 -0
  80. package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +12 -0
  81. package/lib/cjs/components/line_items/LineItemsEmpty.js +1 -0
  82. package/lib/cjs/components/orders/AddToCartButton.d.ts +12 -11
  83. package/lib/cjs/components/orders/AddToCartButton.js +1 -1
  84. package/lib/cjs/components/orders/AdjustmentAmount.d.ts +2 -16
  85. package/lib/cjs/components/orders/AdjustmentAmount.js +1 -1
  86. package/lib/cjs/components/orders/CartLink.d.ts +6 -6
  87. package/lib/cjs/components/orders/CartLink.js +1 -1
  88. package/lib/cjs/components/orders/CheckoutLink.d.ts +13 -0
  89. package/lib/cjs/components/orders/CheckoutLink.js +1 -0
  90. package/lib/cjs/components/{DiscountAmount.d.ts → orders/DiscountAmount.d.ts} +3 -3
  91. package/lib/cjs/components/orders/DiscountAmount.js +1 -0
  92. package/lib/cjs/components/orders/ItemContainer.d.ts +11 -0
  93. package/lib/cjs/components/orders/ItemContainer.js +1 -0
  94. package/lib/cjs/components/orders/OrderContainer.d.ts +5 -18
  95. package/lib/cjs/components/orders/OrderContainer.js +1 -1
  96. package/lib/cjs/components/orders/OrderList.d.ts +11 -12
  97. package/lib/cjs/components/orders/OrderList.js +1 -1
  98. package/lib/cjs/components/orders/OrderListEmpty.d.ts +14 -0
  99. package/lib/cjs/components/orders/OrderListEmpty.js +1 -0
  100. package/lib/cjs/components/orders/OrderListRow.d.ts +11 -7
  101. package/lib/cjs/components/orders/OrderListRow.js +1 -1
  102. package/lib/cjs/components/orders/OrderStorage.d.ts +1 -1
  103. package/lib/cjs/components/orders/PlaceOrderButton.d.ts +4 -14
  104. package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
  105. package/lib/cjs/components/orders/PlaceOrderContainer.d.ts +1 -1
  106. package/lib/cjs/components/orders/PlaceOrderContainer.js +1 -1
  107. package/lib/{esm/components → cjs/components/orders}/ShippingAmount.d.ts +2 -2
  108. package/lib/cjs/components/orders/ShippingAmount.js +1 -0
  109. package/lib/cjs/components/parcels/ParcelField.d.ts +14 -0
  110. package/lib/cjs/components/parcels/ParcelField.js +1 -0
  111. package/lib/cjs/components/parcels/ParcelLineItem.d.ts +6 -0
  112. package/lib/cjs/components/parcels/ParcelLineItem.js +1 -0
  113. package/lib/cjs/components/parcels/ParcelLineItemField.d.ts +14 -0
  114. package/lib/cjs/components/parcels/ParcelLineItemField.js +1 -0
  115. package/lib/cjs/components/parcels/ParcelLineItemsCount.d.ts +18 -0
  116. package/lib/cjs/components/parcels/ParcelLineItemsCount.js +1 -0
  117. package/lib/cjs/components/parcels/Parcels.d.ts +7 -0
  118. package/lib/cjs/components/parcels/Parcels.js +1 -0
  119. package/lib/cjs/components/parcels/ParcelsCount.d.ts +18 -0
  120. package/lib/cjs/components/parcels/ParcelsCount.js +1 -0
  121. package/lib/cjs/components/payment_gateways/AdyenGateway.d.ts +5 -0
  122. package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -0
  123. package/lib/cjs/components/payment_gateways/BraintreeGateway.d.ts +5 -0
  124. package/lib/cjs/components/payment_gateways/BraintreeGateway.js +1 -0
  125. package/lib/cjs/components/payment_gateways/CheckoutComGateway.d.ts +5 -0
  126. package/lib/cjs/components/payment_gateways/CheckoutComGateway.js +1 -0
  127. package/lib/cjs/components/payment_gateways/KlarnaGateway.d.ts +5 -0
  128. package/lib/cjs/components/payment_gateways/KlarnaGateway.js +1 -0
  129. package/lib/cjs/components/{PaymentGateway.d.ts → payment_gateways/PaymentGateway.d.ts} +2 -2
  130. package/lib/cjs/components/payment_gateways/PaymentGateway.js +1 -0
  131. package/lib/cjs/components/payment_gateways/PaypalGateway.d.ts +5 -0
  132. package/lib/cjs/components/payment_gateways/PaypalGateway.js +1 -0
  133. package/lib/cjs/components/payment_gateways/StripeGateway.d.ts +5 -0
  134. package/lib/cjs/components/payment_gateways/StripeGateway.js +1 -0
  135. package/lib/cjs/components/payment_gateways/WireTransferGateway.d.ts +5 -0
  136. package/lib/cjs/components/payment_gateways/WireTransferGateway.js +1 -0
  137. package/lib/cjs/components/{PaymentMethod.d.ts → payment_methods/PaymentMethod.d.ts} +8 -3
  138. package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -0
  139. package/lib/cjs/components/{PaymentMethodAmount.d.ts → payment_methods/PaymentMethodAmount.d.ts} +3 -3
  140. package/lib/cjs/components/payment_methods/PaymentMethodAmount.js +1 -0
  141. package/lib/{esm/components → cjs/components/payment_methods}/PaymentMethodName.d.ts +2 -2
  142. package/lib/cjs/components/payment_methods/PaymentMethodName.js +1 -0
  143. package/lib/cjs/components/{PaymentMethodPrice.d.ts → payment_methods/PaymentMethodPrice.d.ts} +2 -2
  144. package/lib/cjs/components/payment_methods/PaymentMethodPrice.js +1 -0
  145. package/lib/cjs/components/{PaymentMethodRadioButton.d.ts → payment_methods/PaymentMethodRadioButton.d.ts} +2 -2
  146. package/lib/cjs/components/payment_methods/PaymentMethodRadioButton.js +1 -0
  147. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.d.ts +8 -0
  148. package/lib/cjs/components/payment_methods/PaymentMethodsContainer.js +1 -0
  149. package/lib/cjs/components/payment_source/AdyenPayment.d.ts +55 -0
  150. package/lib/cjs/components/payment_source/AdyenPayment.js +1 -0
  151. package/lib/cjs/components/{BraintreePayment.d.ts → payment_source/BraintreePayment.d.ts} +0 -0
  152. package/lib/cjs/components/payment_source/BraintreePayment.js +1 -0
  153. package/lib/{esm/components → cjs/components/payment_source}/CheckoutComPayment.d.ts +1 -1
  154. package/lib/cjs/components/payment_source/CheckoutComPayment.js +1 -0
  155. package/lib/cjs/components/{KlarnaPayment.d.ts → payment_source/KlarnaPayment.d.ts} +1 -1
  156. package/lib/cjs/components/payment_source/KlarnaPayment.js +1 -0
  157. package/lib/cjs/components/{PaymentSource.d.ts → payment_source/PaymentSource.d.ts} +7 -14
  158. package/lib/cjs/components/payment_source/PaymentSource.js +1 -0
  159. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +15 -0
  160. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +1 -0
  161. package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +12 -0
  162. package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +1 -0
  163. package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +12 -0
  164. package/lib/cjs/components/payment_source/PaymentSourceDetail.js +1 -0
  165. package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +10 -0
  166. package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +1 -0
  167. package/lib/cjs/components/{PaypalPayment.d.ts → payment_source/PaypalPayment.d.ts} +0 -0
  168. package/lib/cjs/components/payment_source/PaypalPayment.js +1 -0
  169. package/lib/cjs/components/{StripePayment.d.ts → payment_source/StripePayment.d.ts} +1 -1
  170. package/lib/cjs/components/payment_source/StripePayment.js +1 -0
  171. package/lib/cjs/components/{WireTransferPayment.d.ts → payment_source/WireTransferPayment.d.ts} +3 -1
  172. package/lib/cjs/components/payment_source/WireTransferPayment.js +1 -0
  173. package/lib/cjs/components/prices/Price.d.ts +16 -0
  174. package/lib/cjs/components/prices/Price.js +1 -0
  175. package/lib/cjs/components/prices/PricesContainer.d.ts +11 -0
  176. package/lib/cjs/components/prices/PricesContainer.js +1 -0
  177. package/lib/cjs/components/shipments/Shipment.d.ts +2 -8
  178. package/lib/cjs/components/shipments/Shipment.js +1 -1
  179. package/lib/cjs/components/shipments/ShipmentField.d.ts +2 -9
  180. package/lib/cjs/components/shipments/ShipmentField.js +1 -1
  181. package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +2 -8
  182. package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
  183. package/lib/cjs/components/shipments/ShipmentsCount.d.ts +18 -0
  184. package/lib/cjs/components/shipments/ShipmentsCount.js +1 -0
  185. package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +2 -9
  186. package/lib/cjs/components/shipping_methods/ShippingMethod.js +1 -1
  187. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +2 -8
  188. package/lib/cjs/components/shipping_methods/ShippingMethodName.js +1 -1
  189. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +2 -2
  190. package/lib/cjs/components/{AvailabilityContainer.d.ts → skus/AvailabilityContainer.d.ts} +1 -1
  191. package/lib/cjs/components/skus/AvailabilityContainer.js +1 -0
  192. package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +15 -0
  193. package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -0
  194. package/lib/{esm/components → cjs/components/skus}/DeliveryLeadTime.d.ts +3 -3
  195. package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -0
  196. package/lib/cjs/components/skus/QuantitySelector.d.ts +17 -0
  197. package/lib/cjs/components/skus/QuantitySelector.js +1 -0
  198. package/lib/cjs/components/skus/SkuList.d.ts +1 -1
  199. package/lib/cjs/components/skus/SkuListsContainer.d.ts +1 -1
  200. package/lib/cjs/components/skus/SkuOption.d.ts +1 -1
  201. package/lib/cjs/components/skus/SkuOptionInput.d.ts +1 -1
  202. package/lib/cjs/components/skus/SkuOptionsContainer.d.ts +1 -1
  203. package/lib/cjs/components/skus/Skus.d.ts +1 -1
  204. package/lib/cjs/components/skus/SkusContainer.d.ts +0 -5
  205. package/lib/cjs/components/skus/SkusContainer.js +1 -1
  206. package/lib/cjs/components/skus/VariantSelector.d.ts +29 -0
  207. package/lib/cjs/components/skus/VariantSelector.js +1 -0
  208. package/lib/cjs/components/{VariantsContainer.d.ts → skus/VariantsContainer.d.ts} +1 -1
  209. package/lib/cjs/components/skus/VariantsContainer.js +1 -0
  210. package/lib/{esm/components → cjs/components/stock_transfers}/StockTransfer.d.ts +1 -1
  211. package/lib/cjs/components/stock_transfers/StockTransfer.js +1 -0
  212. package/lib/{esm/components → cjs/components/stock_transfers}/StockTransferField.d.ts +2 -2
  213. package/lib/cjs/components/stock_transfers/StockTransferField.js +1 -0
  214. package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +8 -8
  215. package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
  216. package/lib/cjs/components/utils/BaseField.d.ts +2 -2
  217. package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
  218. package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
  219. package/lib/cjs/components/utils/ErrorBoundary.d.ts +14 -0
  220. package/lib/cjs/components/utils/ErrorBoundary.js +1 -0
  221. package/lib/cjs/components/utils/GenericFieldComponent.d.ts +17 -7
  222. package/lib/cjs/components/utils/Parent.d.ts +5 -5
  223. package/lib/cjs/components/utils/Parent.js +1 -1
  224. package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +2 -2
  225. package/lib/cjs/components/utils/PriceTemplate.d.ts +3 -3
  226. package/lib/cjs/components/utils/PriceTemplate.js +1 -1
  227. package/lib/cjs/components/utils/VariantTemplate.d.ts +3 -3
  228. package/lib/cjs/components/utils/VariantTemplate.js +1 -1
  229. package/lib/cjs/components/utils/getAllErrors.d.ts +2 -2
  230. package/lib/cjs/config/components.d.ts +66 -66
  231. package/lib/cjs/context/BillingAddressFormContext.d.ts +2 -2
  232. package/lib/cjs/context/CommerceLayerContext.d.ts +2 -2
  233. package/lib/cjs/context/CommerceLayerContext.js +1 -1
  234. package/lib/cjs/context/OrderContext.d.ts +4 -5
  235. package/lib/cjs/context/OrderContext.js +1 -1
  236. package/lib/cjs/context/OrderListChildrenContext.d.ts +11 -3
  237. package/lib/cjs/context/ParcelChildrenContext.d.ts +7 -0
  238. package/lib/cjs/context/ParcelChildrenContext.js +1 -0
  239. package/lib/cjs/context/ParcelLineItemChildrenContext.d.ts +7 -0
  240. package/lib/cjs/context/ParcelLineItemChildrenContext.js +1 -0
  241. package/lib/cjs/context/PlaceOrderContext.d.ts +2 -1
  242. package/lib/cjs/context/ShipmentChildrenContext.d.ts +6 -5
  243. package/lib/cjs/context/ShipmentChildrenContext.js +1 -1
  244. package/lib/cjs/index.d.ts +80 -71
  245. package/lib/cjs/index.js +1 -1
  246. package/lib/cjs/reducers/AddressReducer.d.ts +17 -22
  247. package/lib/cjs/reducers/AddressReducer.js +1 -1
  248. package/lib/cjs/reducers/AvailabilityReducer.d.ts +12 -12
  249. package/lib/cjs/reducers/CustomerReducer.d.ts +18 -20
  250. package/lib/cjs/reducers/CustomerReducer.js +1 -1
  251. package/lib/cjs/reducers/OrderReducer.d.ts +16 -29
  252. package/lib/cjs/reducers/OrderReducer.js +1 -1
  253. package/lib/cjs/reducers/PaymentMethodReducer.d.ts +7 -6
  254. package/lib/cjs/reducers/PlaceOrderReducer.d.ts +7 -4
  255. package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
  256. package/lib/cjs/reducers/ShipmentReducer.d.ts +1 -3
  257. package/lib/cjs/reducers/VariantReducer.d.ts +1 -1
  258. package/lib/cjs/typings/errors.d.ts +4 -4
  259. package/lib/cjs/typings/index.d.ts +17 -25
  260. package/lib/cjs/utils/addressesManager.d.ts +5 -4
  261. package/lib/cjs/utils/childrenTypes.d.ts +1 -1
  262. package/lib/cjs/utils/getCardDetails.js +1 -1
  263. package/lib/cjs/utils/getLineItemsCount.d.ts +3 -3
  264. package/lib/cjs/utils/getLoaderComponent.js +1 -1
  265. package/lib/cjs/utils/getPrices.d.ts +4 -15
  266. package/lib/cjs/utils/getPrices.js +1 -1
  267. package/lib/cjs/utils/getSdk.d.ts +1 -1
  268. package/lib/cjs/utils/getSdk.js +1 -1
  269. package/lib/cjs/utils/organization.d.ts +2 -2
  270. package/lib/cjs/utils/paypalPayment.d.ts +1 -1
  271. package/lib/esm/components/Errors.js +1 -1
  272. package/lib/esm/components/ExternalFunction.d.ts +1 -1
  273. package/lib/esm/components/MetadataInput.d.ts +1 -1
  274. package/lib/esm/components/SubmitButton.d.ts +6 -15
  275. package/lib/esm/components/SubmitButton.js +1 -1
  276. package/lib/esm/components/addresses/Address.d.ts +4 -9
  277. package/lib/esm/components/addresses/Address.js +1 -1
  278. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +2 -2
  279. package/lib/esm/components/addresses/AddressField.d.ts +8 -12
  280. package/lib/esm/components/addresses/AddressField.js +1 -1
  281. package/lib/esm/components/addresses/AddressInput.d.ts +0 -11
  282. package/lib/esm/components/addresses/AddressInput.js +1 -1
  283. package/lib/esm/components/addresses/AddressStateSelector.d.ts +2 -2
  284. package/lib/esm/components/addresses/AddressesContainer.d.ts +2 -9
  285. package/lib/esm/components/addresses/AddressesContainer.js +1 -1
  286. package/lib/esm/components/addresses/AddressesEmpty.d.ts +14 -0
  287. package/lib/esm/components/addresses/AddressesEmpty.js +1 -0
  288. package/lib/esm/components/addresses/BillingAddressContainer.d.ts +6 -0
  289. package/lib/esm/components/addresses/BillingAddressContainer.js +1 -0
  290. package/lib/{cjs/components → esm/components/addresses}/BillingAddressForm.d.ts +1 -1
  291. package/lib/esm/components/addresses/BillingAddressForm.js +1 -0
  292. package/lib/esm/components/addresses/SaveAddressesButton.d.ts +12 -0
  293. package/lib/esm/components/addresses/SaveAddressesButton.js +1 -0
  294. package/lib/{cjs/components → esm/components/addresses}/ShippingAddressContainer.d.ts +1 -1
  295. package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -0
  296. package/lib/esm/components/{ShippingAddressForm.d.ts → addresses/ShippingAddressForm.d.ts} +1 -1
  297. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -0
  298. package/lib/esm/components/auth/CommerceLayer.d.ts +4 -11
  299. package/lib/esm/components/auth/CommerceLayer.js +1 -1
  300. package/lib/esm/components/customers/CustomerAddressForm.d.ts +1 -1
  301. package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
  302. package/lib/esm/components/customers/CustomerContainer.d.ts +2 -2
  303. package/lib/esm/components/customers/CustomerContainer.js +1 -1
  304. package/lib/esm/components/customers/SaveCustomerButton.d.ts +12 -0
  305. package/lib/esm/components/customers/SaveCustomerButton.js +1 -0
  306. package/lib/esm/components/{GiftCard.d.ts → gift_cards/GiftCard.d.ts} +2 -2
  307. package/lib/esm/components/gift_cards/GiftCard.js +1 -0
  308. package/lib/{cjs/components → esm/components/gift_cards}/GiftCardContainer.d.ts +1 -1
  309. package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -0
  310. package/lib/esm/components/{GiftCardCurrencySelector.d.ts → gift_cards/GiftCardCurrencySelector.d.ts} +2 -2
  311. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -0
  312. package/lib/{cjs/components → esm/components/gift_cards}/GiftCardInput.d.ts +3 -3
  313. package/lib/esm/components/gift_cards/GiftCardInput.js +1 -0
  314. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +16 -0
  315. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.js +1 -0
  316. package/lib/{cjs/components → esm/components/gift_cards}/GiftCardOrCouponForm.d.ts +1 -1
  317. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -0
  318. package/lib/esm/components/{GiftCardOrCouponInput.d.ts → gift_cards/GiftCardOrCouponInput.d.ts} +2 -2
  319. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -0
  320. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +18 -0
  321. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -0
  322. package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +10 -0
  323. package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.js +1 -0
  324. package/lib/esm/components/{GiftCardRecipient.d.ts → gift_cards/GiftCardRecipient.d.ts} +0 -0
  325. package/lib/esm/components/{GiftCardRecipient.js → gift_cards/GiftCardRecipient.js} +0 -0
  326. package/lib/esm/components/{GiftCardRecipientInput.d.ts → gift_cards/GiftCardRecipientInput.d.ts} +0 -0
  327. package/lib/esm/components/{GiftCardRecipientInput.js → gift_cards/GiftCardRecipientInput.js} +0 -0
  328. package/lib/{cjs/components → esm/components/line_items}/LineItem.d.ts +2 -2
  329. package/lib/esm/components/line_items/LineItem.js +1 -0
  330. package/lib/{cjs/components → esm/components/line_items}/LineItemAmount.d.ts +2 -2
  331. package/lib/esm/components/line_items/LineItemAmount.js +1 -0
  332. package/lib/esm/components/{LineItemCode.d.ts → line_items/LineItemCode.d.ts} +2 -2
  333. package/lib/esm/components/line_items/LineItemCode.js +1 -0
  334. package/lib/esm/components/{LineItemImage.d.ts → line_items/LineItemImage.d.ts} +3 -3
  335. package/lib/esm/components/line_items/LineItemImage.js +1 -0
  336. package/lib/esm/components/{LineItemName.d.ts → line_items/LineItemName.d.ts} +2 -2
  337. package/lib/esm/components/line_items/LineItemName.js +1 -0
  338. package/lib/esm/components/{LineItemOption.d.ts → line_items/LineItemOption.d.ts} +2 -2
  339. package/lib/esm/components/line_items/LineItemOption.js +1 -0
  340. package/lib/esm/components/{LineItemOptions.d.ts → line_items/LineItemOptions.d.ts} +0 -0
  341. package/lib/esm/components/line_items/LineItemOptions.js +1 -0
  342. package/lib/esm/components/line_items/LineItemQuantity.d.ts +14 -0
  343. package/lib/esm/components/line_items/LineItemQuantity.js +1 -0
  344. package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +12 -0
  345. package/lib/esm/components/line_items/LineItemRemoveLink.js +1 -0
  346. package/lib/{cjs/components → esm/components/line_items}/LineItemsContainer.d.ts +2 -2
  347. package/lib/esm/components/line_items/LineItemsContainer.js +1 -0
  348. package/lib/esm/components/line_items/LineItemsCount.d.ts +12 -0
  349. package/lib/esm/components/line_items/LineItemsCount.js +1 -0
  350. package/lib/esm/components/line_items/LineItemsEmpty.d.ts +12 -0
  351. package/lib/esm/components/line_items/LineItemsEmpty.js +1 -0
  352. package/lib/esm/components/orders/AddToCartButton.d.ts +12 -11
  353. package/lib/esm/components/orders/AddToCartButton.js +1 -1
  354. package/lib/esm/components/orders/AdjustmentAmount.d.ts +2 -16
  355. package/lib/esm/components/orders/AdjustmentAmount.js +1 -1
  356. package/lib/esm/components/orders/CartLink.d.ts +6 -6
  357. package/lib/esm/components/orders/CartLink.js +1 -1
  358. package/lib/esm/components/orders/CheckoutLink.d.ts +13 -0
  359. package/lib/esm/components/orders/CheckoutLink.js +1 -0
  360. package/lib/esm/components/{DiscountAmount.d.ts → orders/DiscountAmount.d.ts} +3 -3
  361. package/lib/esm/components/orders/DiscountAmount.js +1 -0
  362. package/lib/esm/components/orders/ItemContainer.d.ts +11 -0
  363. package/lib/esm/components/orders/ItemContainer.js +1 -0
  364. package/lib/esm/components/orders/OrderContainer.d.ts +5 -18
  365. package/lib/esm/components/orders/OrderContainer.js +1 -1
  366. package/lib/esm/components/orders/OrderList.d.ts +11 -12
  367. package/lib/esm/components/orders/OrderList.js +1 -1
  368. package/lib/esm/components/orders/OrderListEmpty.d.ts +14 -0
  369. package/lib/esm/components/orders/OrderListEmpty.js +1 -0
  370. package/lib/esm/components/orders/OrderListRow.d.ts +11 -7
  371. package/lib/esm/components/orders/OrderListRow.js +1 -1
  372. package/lib/esm/components/orders/OrderStorage.d.ts +1 -1
  373. package/lib/esm/components/orders/PlaceOrderButton.d.ts +4 -14
  374. package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
  375. package/lib/esm/components/orders/PlaceOrderContainer.d.ts +1 -1
  376. package/lib/esm/components/orders/PlaceOrderContainer.js +1 -1
  377. package/lib/{cjs/components → esm/components/orders}/ShippingAmount.d.ts +2 -2
  378. package/lib/esm/components/orders/ShippingAmount.js +1 -0
  379. package/lib/esm/components/parcels/ParcelField.d.ts +14 -0
  380. package/lib/esm/components/parcels/ParcelField.js +1 -0
  381. package/lib/esm/components/parcels/ParcelLineItem.d.ts +6 -0
  382. package/lib/esm/components/parcels/ParcelLineItem.js +1 -0
  383. package/lib/esm/components/parcels/ParcelLineItemField.d.ts +14 -0
  384. package/lib/esm/components/parcels/ParcelLineItemField.js +1 -0
  385. package/lib/esm/components/parcels/ParcelLineItemsCount.d.ts +18 -0
  386. package/lib/esm/components/parcels/ParcelLineItemsCount.js +1 -0
  387. package/lib/esm/components/parcels/Parcels.d.ts +7 -0
  388. package/lib/esm/components/parcels/Parcels.js +1 -0
  389. package/lib/esm/components/parcels/ParcelsCount.d.ts +18 -0
  390. package/lib/esm/components/parcels/ParcelsCount.js +1 -0
  391. package/lib/esm/components/payment_gateways/AdyenGateway.d.ts +5 -0
  392. package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -0
  393. package/lib/esm/components/payment_gateways/BraintreeGateway.d.ts +5 -0
  394. package/lib/esm/components/payment_gateways/BraintreeGateway.js +1 -0
  395. package/lib/esm/components/payment_gateways/CheckoutComGateway.d.ts +5 -0
  396. package/lib/esm/components/payment_gateways/CheckoutComGateway.js +1 -0
  397. package/lib/esm/components/payment_gateways/KlarnaGateway.d.ts +5 -0
  398. package/lib/esm/components/payment_gateways/KlarnaGateway.js +1 -0
  399. package/lib/esm/components/{PaymentGateway.d.ts → payment_gateways/PaymentGateway.d.ts} +2 -2
  400. package/lib/esm/components/payment_gateways/PaymentGateway.js +1 -0
  401. package/lib/esm/components/payment_gateways/PaypalGateway.d.ts +5 -0
  402. package/lib/esm/components/payment_gateways/PaypalGateway.js +1 -0
  403. package/lib/esm/components/payment_gateways/StripeGateway.d.ts +5 -0
  404. package/lib/esm/components/payment_gateways/StripeGateway.js +1 -0
  405. package/lib/esm/components/payment_gateways/WireTransferGateway.d.ts +5 -0
  406. package/lib/esm/components/payment_gateways/WireTransferGateway.js +1 -0
  407. package/lib/esm/components/{PaymentMethod.d.ts → payment_methods/PaymentMethod.d.ts} +8 -3
  408. package/lib/esm/components/payment_methods/PaymentMethod.js +1 -0
  409. package/lib/esm/components/{PaymentMethodAmount.d.ts → payment_methods/PaymentMethodAmount.d.ts} +3 -3
  410. package/lib/esm/components/payment_methods/PaymentMethodAmount.js +1 -0
  411. package/lib/{cjs/components → esm/components/payment_methods}/PaymentMethodName.d.ts +2 -2
  412. package/lib/esm/components/payment_methods/PaymentMethodName.js +1 -0
  413. package/lib/esm/components/{PaymentMethodPrice.d.ts → payment_methods/PaymentMethodPrice.d.ts} +2 -2
  414. package/lib/esm/components/payment_methods/PaymentMethodPrice.js +1 -0
  415. package/lib/esm/components/{PaymentMethodRadioButton.d.ts → payment_methods/PaymentMethodRadioButton.d.ts} +2 -2
  416. package/lib/esm/components/payment_methods/PaymentMethodRadioButton.js +1 -0
  417. package/lib/esm/components/payment_methods/PaymentMethodsContainer.d.ts +8 -0
  418. package/lib/esm/components/payment_methods/PaymentMethodsContainer.js +1 -0
  419. package/lib/esm/components/payment_source/AdyenPayment.d.ts +55 -0
  420. package/lib/esm/components/payment_source/AdyenPayment.js +1 -0
  421. package/lib/esm/components/{BraintreePayment.d.ts → payment_source/BraintreePayment.d.ts} +0 -0
  422. package/lib/esm/components/payment_source/BraintreePayment.js +1 -0
  423. package/lib/{cjs/components → esm/components/payment_source}/CheckoutComPayment.d.ts +1 -1
  424. package/lib/esm/components/payment_source/CheckoutComPayment.js +1 -0
  425. package/lib/esm/components/{KlarnaPayment.d.ts → payment_source/KlarnaPayment.d.ts} +1 -1
  426. package/lib/esm/components/payment_source/KlarnaPayment.js +1 -0
  427. package/lib/esm/components/{PaymentSource.d.ts → payment_source/PaymentSource.d.ts} +7 -14
  428. package/lib/esm/components/payment_source/PaymentSource.js +1 -0
  429. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +15 -0
  430. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.js +1 -0
  431. package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +12 -0
  432. package/lib/esm/components/payment_source/PaymentSourceBrandName.js +1 -0
  433. package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +12 -0
  434. package/lib/esm/components/payment_source/PaymentSourceDetail.js +1 -0
  435. package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +10 -0
  436. package/lib/esm/components/payment_source/PaymentSourceEditButton.js +1 -0
  437. package/lib/esm/components/{PaypalPayment.d.ts → payment_source/PaypalPayment.d.ts} +0 -0
  438. package/lib/esm/components/payment_source/PaypalPayment.js +1 -0
  439. package/lib/esm/components/{StripePayment.d.ts → payment_source/StripePayment.d.ts} +1 -1
  440. package/lib/esm/components/payment_source/StripePayment.js +1 -0
  441. package/lib/esm/components/{WireTransferPayment.d.ts → payment_source/WireTransferPayment.d.ts} +3 -1
  442. package/lib/esm/components/payment_source/WireTransferPayment.js +1 -0
  443. package/lib/esm/components/prices/Price.d.ts +16 -0
  444. package/lib/esm/components/prices/Price.js +1 -0
  445. package/lib/esm/components/prices/PricesContainer.d.ts +11 -0
  446. package/lib/esm/components/prices/PricesContainer.js +1 -0
  447. package/lib/esm/components/shipments/Shipment.d.ts +2 -8
  448. package/lib/esm/components/shipments/Shipment.js +1 -1
  449. package/lib/esm/components/shipments/ShipmentField.d.ts +2 -9
  450. package/lib/esm/components/shipments/ShipmentField.js +1 -1
  451. package/lib/esm/components/shipments/ShipmentsContainer.d.ts +2 -8
  452. package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
  453. package/lib/esm/components/shipments/ShipmentsCount.d.ts +18 -0
  454. package/lib/esm/components/shipments/ShipmentsCount.js +1 -0
  455. package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +2 -9
  456. package/lib/esm/components/shipping_methods/ShippingMethod.js +1 -1
  457. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +2 -8
  458. package/lib/esm/components/shipping_methods/ShippingMethodName.js +1 -1
  459. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +2 -2
  460. package/lib/esm/components/{AvailabilityContainer.d.ts → skus/AvailabilityContainer.d.ts} +1 -1
  461. package/lib/esm/components/skus/AvailabilityContainer.js +1 -0
  462. package/lib/esm/components/skus/AvailabilityTemplate.d.ts +15 -0
  463. package/lib/esm/components/skus/AvailabilityTemplate.js +1 -0
  464. package/lib/{cjs/components → esm/components/skus}/DeliveryLeadTime.d.ts +3 -3
  465. package/lib/esm/components/skus/DeliveryLeadTime.js +1 -0
  466. package/lib/esm/components/skus/QuantitySelector.d.ts +17 -0
  467. package/lib/esm/components/{QuantitySelector.js → skus/QuantitySelector.js} +1 -1
  468. package/lib/esm/components/skus/SkuList.d.ts +1 -1
  469. package/lib/esm/components/skus/SkuListsContainer.d.ts +1 -1
  470. package/lib/esm/components/skus/SkuOption.d.ts +1 -1
  471. package/lib/esm/components/skus/SkuOptionInput.d.ts +1 -1
  472. package/lib/esm/components/skus/SkuOptionsContainer.d.ts +1 -1
  473. package/lib/esm/components/skus/Skus.d.ts +1 -1
  474. package/lib/esm/components/skus/SkusContainer.d.ts +0 -5
  475. package/lib/esm/components/skus/SkusContainer.js +1 -1
  476. package/lib/esm/components/skus/VariantSelector.d.ts +29 -0
  477. package/lib/esm/components/skus/VariantSelector.js +1 -0
  478. package/lib/esm/components/{VariantsContainer.d.ts → skus/VariantsContainer.d.ts} +1 -1
  479. package/lib/esm/components/skus/VariantsContainer.js +1 -0
  480. package/lib/{cjs/components → esm/components/stock_transfers}/StockTransfer.d.ts +1 -1
  481. package/lib/esm/components/stock_transfers/StockTransfer.js +1 -0
  482. package/lib/{cjs/components → esm/components/stock_transfers}/StockTransferField.d.ts +2 -2
  483. package/lib/esm/components/stock_transfers/StockTransferField.js +1 -0
  484. package/lib/esm/components/utils/AddressCardsTemplate.d.ts +8 -8
  485. package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
  486. package/lib/esm/components/utils/BaseField.d.ts +2 -2
  487. package/lib/esm/components/utils/BaseInput.d.ts +1 -1
  488. package/lib/esm/components/utils/BaseOrderPrice.js +1 -1
  489. package/lib/esm/components/utils/ErrorBoundary.d.ts +14 -0
  490. package/lib/esm/components/utils/ErrorBoundary.js +1 -0
  491. package/lib/esm/components/utils/GenericFieldComponent.d.ts +17 -7
  492. package/lib/esm/components/utils/Parent.d.ts +5 -5
  493. package/lib/esm/components/utils/Parent.js +1 -1
  494. package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +2 -2
  495. package/lib/esm/components/utils/PriceTemplate.d.ts +3 -3
  496. package/lib/esm/components/utils/PriceTemplate.js +1 -1
  497. package/lib/esm/components/utils/VariantTemplate.d.ts +3 -3
  498. package/lib/esm/components/utils/VariantTemplate.js +1 -1
  499. package/lib/esm/components/utils/getAllErrors.d.ts +2 -2
  500. package/lib/esm/config/components.d.ts +66 -66
  501. package/lib/esm/context/BillingAddressFormContext.d.ts +2 -2
  502. package/lib/esm/context/CommerceLayerContext.d.ts +2 -2
  503. package/lib/esm/context/CommerceLayerContext.js +1 -1
  504. package/lib/esm/context/OrderContext.d.ts +4 -5
  505. package/lib/esm/context/OrderContext.js +1 -1
  506. package/lib/esm/context/OrderListChildrenContext.d.ts +11 -3
  507. package/lib/esm/context/ParcelChildrenContext.d.ts +7 -0
  508. package/lib/esm/context/ParcelChildrenContext.js +1 -0
  509. package/lib/esm/context/ParcelLineItemChildrenContext.d.ts +7 -0
  510. package/lib/esm/context/ParcelLineItemChildrenContext.js +1 -0
  511. package/lib/esm/context/PlaceOrderContext.d.ts +2 -1
  512. package/lib/esm/context/ShipmentChildrenContext.d.ts +6 -5
  513. package/lib/esm/context/ShipmentChildrenContext.js +1 -1
  514. package/lib/esm/index.d.ts +80 -71
  515. package/lib/esm/index.js +1 -1
  516. package/lib/esm/reducers/AddressReducer.d.ts +17 -22
  517. package/lib/esm/reducers/AddressReducer.js +1 -1
  518. package/lib/esm/reducers/AvailabilityReducer.d.ts +12 -12
  519. package/lib/esm/reducers/CustomerReducer.d.ts +18 -20
  520. package/lib/esm/reducers/CustomerReducer.js +1 -1
  521. package/lib/esm/reducers/OrderReducer.d.ts +16 -29
  522. package/lib/esm/reducers/OrderReducer.js +1 -1
  523. package/lib/esm/reducers/PaymentMethodReducer.d.ts +7 -6
  524. package/lib/esm/reducers/PlaceOrderReducer.d.ts +7 -4
  525. package/lib/esm/reducers/PlaceOrderReducer.js +1 -1
  526. package/lib/esm/reducers/ShipmentReducer.d.ts +1 -3
  527. package/lib/esm/reducers/VariantReducer.d.ts +1 -1
  528. package/lib/esm/typings/errors.d.ts +4 -4
  529. package/lib/esm/typings/index.d.ts +17 -25
  530. package/lib/esm/utils/addressesManager.d.ts +5 -4
  531. package/lib/esm/utils/childrenTypes.d.ts +1 -1
  532. package/lib/esm/utils/getCardDetails.js +1 -1
  533. package/lib/esm/utils/getLineItemsCount.d.ts +3 -3
  534. package/lib/esm/utils/getLoaderComponent.js +1 -1
  535. package/lib/esm/utils/getPrices.d.ts +4 -15
  536. package/lib/esm/utils/getPrices.js +1 -1
  537. package/lib/esm/utils/getSdk.d.ts +1 -1
  538. package/lib/esm/utils/getSdk.js +1 -1
  539. package/lib/esm/utils/organization.d.ts +2 -2
  540. package/lib/esm/utils/paypalPayment.d.ts +1 -1
  541. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  542. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  543. package/package.json +126 -58
  544. package/lib/cjs/components/AdjustmentAmount.d.ts +0 -4
  545. package/lib/cjs/components/AdjustmentAmount.js +0 -1
  546. package/lib/cjs/components/AdyenPayment.d.ts +0 -25
  547. package/lib/cjs/components/AdyenPayment.js +0 -1
  548. package/lib/cjs/components/AvailabilityContainer.js +0 -1
  549. package/lib/cjs/components/AvailabilityTemplate.d.ts +0 -24
  550. package/lib/cjs/components/AvailabilityTemplate.js +0 -1
  551. package/lib/cjs/components/BillingAddressContainer.d.ts +0 -11
  552. package/lib/cjs/components/BillingAddressContainer.js +0 -1
  553. package/lib/cjs/components/BillingAddressForm.js +0 -1
  554. package/lib/cjs/components/BraintreePayment.js +0 -1
  555. package/lib/cjs/components/CartLink.d.ts +0 -12
  556. package/lib/cjs/components/CartLink.js +0 -1
  557. package/lib/cjs/components/CheckoutComPayment.js +0 -1
  558. package/lib/cjs/components/CheckoutLink.d.ts +0 -23
  559. package/lib/cjs/components/CheckoutLink.js +0 -1
  560. package/lib/cjs/components/DeliveryLeadTime.js +0 -1
  561. package/lib/cjs/components/DiscountAmount.js +0 -1
  562. package/lib/cjs/components/GiftCard.js +0 -1
  563. package/lib/cjs/components/GiftCardContainer.js +0 -1
  564. package/lib/cjs/components/GiftCardCurrencySelector.js +0 -1
  565. package/lib/cjs/components/GiftCardInput.js +0 -1
  566. package/lib/cjs/components/GiftCardOrCouponCode.d.ts +0 -24
  567. package/lib/cjs/components/GiftCardOrCouponCode.js +0 -1
  568. package/lib/cjs/components/GiftCardOrCouponForm.js +0 -1
  569. package/lib/cjs/components/GiftCardOrCouponInput.js +0 -1
  570. package/lib/cjs/components/GiftCardOrCouponRemoveButton.d.ts +0 -26
  571. package/lib/cjs/components/GiftCardOrCouponRemoveButton.js +0 -1
  572. package/lib/cjs/components/GiftCardOrCouponSubmit.d.ts +0 -16
  573. package/lib/cjs/components/GiftCardOrCouponSubmit.js +0 -1
  574. package/lib/cjs/components/ItemContainer.d.ts +0 -22
  575. package/lib/cjs/components/ItemContainer.js +0 -1
  576. package/lib/cjs/components/KlarnaPayment.js +0 -1
  577. package/lib/cjs/components/LineItem.js +0 -1
  578. package/lib/cjs/components/LineItemAmount.js +0 -1
  579. package/lib/cjs/components/LineItemCode.js +0 -1
  580. package/lib/cjs/components/LineItemImage.js +0 -1
  581. package/lib/cjs/components/LineItemName.js +0 -1
  582. package/lib/cjs/components/LineItemOption.js +0 -1
  583. package/lib/cjs/components/LineItemOptions.js +0 -1
  584. package/lib/cjs/components/LineItemQuantity.d.ts +0 -26
  585. package/lib/cjs/components/LineItemQuantity.js +0 -1
  586. package/lib/cjs/components/LineItemRemoveLink.d.ts +0 -22
  587. package/lib/cjs/components/LineItemRemoveLink.js +0 -1
  588. package/lib/cjs/components/LineItemsContainer.js +0 -1
  589. package/lib/cjs/components/LineItemsCount.d.ts +0 -22
  590. package/lib/cjs/components/LineItemsCount.js +0 -1
  591. package/lib/cjs/components/LineItemsEmpty.d.ts +0 -23
  592. package/lib/cjs/components/LineItemsEmpty.js +0 -1
  593. package/lib/cjs/components/PaymentGateway.js +0 -1
  594. package/lib/cjs/components/PaymentMethod.js +0 -1
  595. package/lib/cjs/components/PaymentMethodAmount.js +0 -1
  596. package/lib/cjs/components/PaymentMethodName.js +0 -1
  597. package/lib/cjs/components/PaymentMethodPrice.js +0 -1
  598. package/lib/cjs/components/PaymentMethodRadioButton.js +0 -1
  599. package/lib/cjs/components/PaymentMethodsContainer.d.ts +0 -14
  600. package/lib/cjs/components/PaymentMethodsContainer.js +0 -1
  601. package/lib/cjs/components/PaymentSource.js +0 -1
  602. package/lib/cjs/components/PaymentSourceBrandIcon.d.ts +0 -25
  603. package/lib/cjs/components/PaymentSourceBrandIcon.js +0 -1
  604. package/lib/cjs/components/PaymentSourceBrandName.d.ts +0 -19
  605. package/lib/cjs/components/PaymentSourceBrandName.js +0 -1
  606. package/lib/cjs/components/PaymentSourceDetail.d.ts +0 -18
  607. package/lib/cjs/components/PaymentSourceDetail.js +0 -1
  608. package/lib/cjs/components/PaymentSourceEditButton.d.ts +0 -16
  609. package/lib/cjs/components/PaymentSourceEditButton.js +0 -1
  610. package/lib/cjs/components/PaypalPayment.js +0 -1
  611. package/lib/cjs/components/Price.d.ts +0 -28
  612. package/lib/cjs/components/Price.js +0 -1
  613. package/lib/cjs/components/PricesContainer.d.ts +0 -27
  614. package/lib/cjs/components/PricesContainer.js +0 -1
  615. package/lib/cjs/components/QuantitySelector.d.ts +0 -31
  616. package/lib/cjs/components/QuantitySelector.js +0 -1
  617. package/lib/cjs/components/SaveAddressesButton.d.ts +0 -23
  618. package/lib/cjs/components/SaveAddressesButton.js +0 -1
  619. package/lib/cjs/components/SaveCustomerButton.d.ts +0 -24
  620. package/lib/cjs/components/ShippingAddressContainer.js +0 -1
  621. package/lib/cjs/components/ShippingAddressForm.js +0 -1
  622. package/lib/cjs/components/ShippingAmount.js +0 -1
  623. package/lib/cjs/components/SkuField.d.ts +0 -10
  624. package/lib/cjs/components/SkuField.js +0 -1
  625. package/lib/cjs/components/Skus.d.ts +0 -11
  626. package/lib/cjs/components/Skus.js +0 -1
  627. package/lib/cjs/components/SkusContainer.d.ts +0 -14
  628. package/lib/cjs/components/SkusContainer.js +0 -1
  629. package/lib/cjs/components/StockTransfer.js +0 -1
  630. package/lib/cjs/components/StockTransferField.js +0 -1
  631. package/lib/cjs/components/StripePayment.js +0 -1
  632. package/lib/cjs/components/VariantSelector.d.ts +0 -52
  633. package/lib/cjs/components/VariantSelector.js +0 -1
  634. package/lib/cjs/components/VariantsContainer.js +0 -1
  635. package/lib/cjs/components/WireTransferPayment.js +0 -1
  636. package/lib/cjs/components/gateways/AdyenGateway.d.ts +0 -5
  637. package/lib/cjs/components/gateways/AdyenGateway.js +0 -1
  638. package/lib/cjs/components/gateways/BraintreeGateway.d.ts +0 -5
  639. package/lib/cjs/components/gateways/BraintreeGateway.js +0 -1
  640. package/lib/cjs/components/gateways/CheckoutComGateway.d.ts +0 -5
  641. package/lib/cjs/components/gateways/CheckoutComGateway.js +0 -1
  642. package/lib/cjs/components/gateways/KlarnaGateway.d.ts +0 -5
  643. package/lib/cjs/components/gateways/KlarnaGateway.js +0 -1
  644. package/lib/cjs/components/gateways/PaypalGateway.d.ts +0 -5
  645. package/lib/cjs/components/gateways/PaypalGateway.js +0 -1
  646. package/lib/cjs/components/gateways/StripeGateway.d.ts +0 -5
  647. package/lib/cjs/components/gateways/StripeGateway.js +0 -1
  648. package/lib/cjs/components/gateways/WireTransferGateway.d.ts +0 -5
  649. package/lib/cjs/components/gateways/WireTransferGateway.js +0 -1
  650. package/lib/esm/components/AdjustmentAmount.d.ts +0 -4
  651. package/lib/esm/components/AdjustmentAmount.js +0 -1
  652. package/lib/esm/components/AdyenPayment.d.ts +0 -25
  653. package/lib/esm/components/AdyenPayment.js +0 -1
  654. package/lib/esm/components/AvailabilityContainer.js +0 -1
  655. package/lib/esm/components/AvailabilityTemplate.d.ts +0 -24
  656. package/lib/esm/components/AvailabilityTemplate.js +0 -1
  657. package/lib/esm/components/BillingAddressContainer.d.ts +0 -11
  658. package/lib/esm/components/BillingAddressContainer.js +0 -1
  659. package/lib/esm/components/BillingAddressForm.js +0 -1
  660. package/lib/esm/components/BraintreePayment.js +0 -1
  661. package/lib/esm/components/CartLink.d.ts +0 -12
  662. package/lib/esm/components/CartLink.js +0 -1
  663. package/lib/esm/components/CheckoutComPayment.js +0 -1
  664. package/lib/esm/components/CheckoutLink.d.ts +0 -23
  665. package/lib/esm/components/CheckoutLink.js +0 -1
  666. package/lib/esm/components/DeliveryLeadTime.js +0 -1
  667. package/lib/esm/components/DiscountAmount.js +0 -1
  668. package/lib/esm/components/GiftCard.js +0 -1
  669. package/lib/esm/components/GiftCardContainer.js +0 -1
  670. package/lib/esm/components/GiftCardCurrencySelector.js +0 -1
  671. package/lib/esm/components/GiftCardInput.js +0 -1
  672. package/lib/esm/components/GiftCardOrCouponCode.d.ts +0 -24
  673. package/lib/esm/components/GiftCardOrCouponCode.js +0 -1
  674. package/lib/esm/components/GiftCardOrCouponForm.js +0 -1
  675. package/lib/esm/components/GiftCardOrCouponInput.js +0 -1
  676. package/lib/esm/components/GiftCardOrCouponRemoveButton.d.ts +0 -26
  677. package/lib/esm/components/GiftCardOrCouponRemoveButton.js +0 -1
  678. package/lib/esm/components/GiftCardOrCouponSubmit.d.ts +0 -16
  679. package/lib/esm/components/GiftCardOrCouponSubmit.js +0 -1
  680. package/lib/esm/components/ItemContainer.d.ts +0 -22
  681. package/lib/esm/components/ItemContainer.js +0 -1
  682. package/lib/esm/components/KlarnaPayment.js +0 -1
  683. package/lib/esm/components/LineItem.js +0 -1
  684. package/lib/esm/components/LineItemAmount.js +0 -1
  685. package/lib/esm/components/LineItemCode.js +0 -1
  686. package/lib/esm/components/LineItemImage.js +0 -1
  687. package/lib/esm/components/LineItemName.js +0 -1
  688. package/lib/esm/components/LineItemOption.js +0 -1
  689. package/lib/esm/components/LineItemOptions.js +0 -1
  690. package/lib/esm/components/LineItemQuantity.d.ts +0 -26
  691. package/lib/esm/components/LineItemQuantity.js +0 -1
  692. package/lib/esm/components/LineItemRemoveLink.d.ts +0 -22
  693. package/lib/esm/components/LineItemRemoveLink.js +0 -1
  694. package/lib/esm/components/LineItemsContainer.js +0 -1
  695. package/lib/esm/components/LineItemsCount.d.ts +0 -22
  696. package/lib/esm/components/LineItemsCount.js +0 -1
  697. package/lib/esm/components/LineItemsEmpty.d.ts +0 -23
  698. package/lib/esm/components/LineItemsEmpty.js +0 -1
  699. package/lib/esm/components/PaymentGateway.js +0 -1
  700. package/lib/esm/components/PaymentMethod.js +0 -1
  701. package/lib/esm/components/PaymentMethodAmount.js +0 -1
  702. package/lib/esm/components/PaymentMethodName.js +0 -1
  703. package/lib/esm/components/PaymentMethodPrice.js +0 -1
  704. package/lib/esm/components/PaymentMethodRadioButton.js +0 -1
  705. package/lib/esm/components/PaymentMethodsContainer.d.ts +0 -14
  706. package/lib/esm/components/PaymentMethodsContainer.js +0 -1
  707. package/lib/esm/components/PaymentSource.js +0 -1
  708. package/lib/esm/components/PaymentSourceBrandIcon.d.ts +0 -25
  709. package/lib/esm/components/PaymentSourceBrandIcon.js +0 -1
  710. package/lib/esm/components/PaymentSourceBrandName.d.ts +0 -19
  711. package/lib/esm/components/PaymentSourceBrandName.js +0 -1
  712. package/lib/esm/components/PaymentSourceDetail.d.ts +0 -18
  713. package/lib/esm/components/PaymentSourceDetail.js +0 -1
  714. package/lib/esm/components/PaymentSourceEditButton.d.ts +0 -16
  715. package/lib/esm/components/PaymentSourceEditButton.js +0 -1
  716. package/lib/esm/components/PaypalPayment.js +0 -1
  717. package/lib/esm/components/Price.d.ts +0 -28
  718. package/lib/esm/components/Price.js +0 -1
  719. package/lib/esm/components/PricesContainer.d.ts +0 -27
  720. package/lib/esm/components/PricesContainer.js +0 -1
  721. package/lib/esm/components/QuantitySelector.d.ts +0 -31
  722. package/lib/esm/components/SaveAddressesButton.d.ts +0 -23
  723. package/lib/esm/components/SaveAddressesButton.js +0 -1
  724. package/lib/esm/components/SaveCustomerButton.d.ts +0 -24
  725. package/lib/esm/components/SaveCustomerButton.js +0 -1
  726. package/lib/esm/components/ShippingAddressContainer.js +0 -1
  727. package/lib/esm/components/ShippingAddressForm.js +0 -1
  728. package/lib/esm/components/ShippingAmount.js +0 -1
  729. package/lib/esm/components/SkuField.d.ts +0 -10
  730. package/lib/esm/components/SkuField.js +0 -1
  731. package/lib/esm/components/Skus.d.ts +0 -11
  732. package/lib/esm/components/Skus.js +0 -1
  733. package/lib/esm/components/SkusContainer.d.ts +0 -14
  734. package/lib/esm/components/SkusContainer.js +0 -1
  735. package/lib/esm/components/StockTransfer.js +0 -1
  736. package/lib/esm/components/StockTransferField.js +0 -1
  737. package/lib/esm/components/StripePayment.js +0 -1
  738. package/lib/esm/components/VariantSelector.d.ts +0 -52
  739. package/lib/esm/components/VariantSelector.js +0 -1
  740. package/lib/esm/components/VariantsContainer.js +0 -1
  741. package/lib/esm/components/WireTransferPayment.js +0 -1
  742. package/lib/esm/components/gateways/AdyenGateway.d.ts +0 -5
  743. package/lib/esm/components/gateways/AdyenGateway.js +0 -1
  744. package/lib/esm/components/gateways/BraintreeGateway.d.ts +0 -5
  745. package/lib/esm/components/gateways/BraintreeGateway.js +0 -1
  746. package/lib/esm/components/gateways/CheckoutComGateway.d.ts +0 -5
  747. package/lib/esm/components/gateways/CheckoutComGateway.js +0 -1
  748. package/lib/esm/components/gateways/KlarnaGateway.d.ts +0 -5
  749. package/lib/esm/components/gateways/KlarnaGateway.js +0 -1
  750. package/lib/esm/components/gateways/PaypalGateway.d.ts +0 -5
  751. package/lib/esm/components/gateways/PaypalGateway.js +0 -1
  752. package/lib/esm/components/gateways/StripeGateway.d.ts +0 -5
  753. package/lib/esm/components/gateways/StripeGateway.js +0 -1
  754. package/lib/esm/components/gateways/WireTransferGateway.d.ts +0 -5
  755. package/lib/esm/components/gateways/WireTransferGateway.js +0 -1
@@ -1,24 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type ParentProps = {
4
- handleClick: () => any;
5
- };
6
- declare type ChildrenProps = FunctionChildren<Omit<Props & ParentProps, 'children'>>;
7
- declare type Props = {
8
- children?: ChildrenProps;
9
- label?: string | ReactNode;
10
- onClick?: () => void;
11
- } & JSX.IntrinsicElements['button'];
12
- export declare function SaveCustomerButton(props: Props): JSX.Element;
13
- export declare namespace SaveCustomerButton {
14
- var propTypes: {
15
- children: import("prop-types").Requireable<(...args: any[]) => any>;
16
- label: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
17
- onClick: import("prop-types").Requireable<(...args: any[]) => any>;
18
- };
19
- var defaultProps: {
20
- label: string;
21
- };
22
- var displayName: string;
23
- }
24
- export default SaveCustomerButton;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingAddressContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ShippingAddressContext_1=tslib_1.__importDefault(require("../context/ShippingAddressContext")),react_1=require("react"),ShippingAddressReducer_1=tslib_1.__importStar(require("../reducers/ShippingAddressReducer")),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.ShippingAddressContainer.propTypes;function ShippingAddressContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(ShippingAddressReducer_1.default,ShippingAddressReducer_1.shippingAddressInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{setCloneAddress}=(0,react_1.useContext)(AddressContext_1.default);(0,react_1.useEffect)(()=>(order&&config&&(0,ShippingAddressReducer_1.setShippingCustomerAddressId)({dispatch,order,setCloneAddress}),()=>{dispatch({type:"cleanup",payload:{}})}),[config,order]);const contextValue={...state,setShippingAddress:async(id,options)=>{await(0,ShippingAddressReducer_1.setShippingAddress)(id,{config,dispatch,order,customerAddressId:options?.customerAddressId}),setCloneAddress(id,"shipping_address")}};return(0,jsx_runtime_1.jsx)(ShippingAddressContext_1.default.Provider,{value:contextValue,children})}exports.ShippingAddressContainer=ShippingAddressContainer,ShippingAddressContainer.propTypes=propTypes,exports.default=ShippingAddressContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingAddressForm=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"),ShippingAddressFormContext_1=tslib_1.__importDefault(require("../context/ShippingAddressFormContext")),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.ShippingAddressForm.propTypes;function ShippingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=(0,rapid_form_1.useRapidForm)(),{setAddressErrors,setAddress,shipToDifferentAddress,isBusiness}=(0,react_1.useContext)(AddressContext_1.default),{saveAddressToCustomerAddressBook,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null);(0,react_1.useEffect)(()=>{if(include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address"}),(0,lodash_1.isEmpty)(errors)){if(!(0,lodash_1.isEmpty)(values)&&shipToDifferentAddress){setAddressErrors([],"shipping_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("shipping_address_","")]=field.value,delete values[name]),field?.type==="checkbox"&&(delete values[name],saveAddressToCustomerAddressBook({type:"shipping_address",value:field.checked}))}setAddress({values:{...values,...isBusiness&&{business:isBusiness}},resource:"shipping_address"})}}else{const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message;["shipping_address_state_code"].includes(fieldName)?(0,lodash_1.isEmpty)(values.state_code)?delete errors[fieldName]:formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName}):formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName})}shipToDifferentAddress&&setAddressErrors(formErrors,"shipping_address")}const checkboxChecked=ref.current?.querySelector('[name="shipping_address_save_to_customer_book"]')?.checked||(0,localStorage_1.getSaveShippingAddressToAddressBook)();reset&&(!(0,lodash_1.isEmpty)(values)||!(0,lodash_1.isEmpty)(errors)||checkboxChecked)&&(saveAddressToCustomerAddressBook&&saveAddressToCustomerAddressBook({type:"shipping_address",value:!1}),ref&&(ref.current?.reset(),resetForm({target:ref.current}),setAddressErrors([],"shipping_address"),setAddress({values:{},resource:"shipping_address"})))},[values,errors,shipToDifferentAddress,reset,include,includeLoaded,isBusiness]);const providerValues={values,validation,setValue:(name,value)=>{const field={[name.replace("shipping_address_","")]:value};setAddress({values:{...values,...field,...isBusiness&&{business:isBusiness}},resource:"shipping_address"})},errorClassName,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return(0,jsx_runtime_1.jsx)(ShippingAddressFormContext_1.default.Provider,{value:providerValues,children:(0,jsx_runtime_1.jsx)("form",{ref,autoComplete,...p,children})})}exports.ShippingAddressForm=ShippingAddressForm,ShippingAddressForm.propTypes=propTypes,exports.default=ShippingAddressForm;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingAmount=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.ShippingAmount.propTypes,displayName=components_1.default.ShippingAmount.displayName;function ShippingAmount(props){return(0,jsx_runtime_1.jsx)(BaseOrderPrice_1.default,{base:"amount",type:"shipping",...props})}exports.ShippingAmount=ShippingAmount,ShippingAmount.propTypes=propTypes,ShippingAmount.displayName=displayName,exports.default=ShippingAmount;
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { ConditionalElement } from '../typings/index';
3
- import { TGenericChildrenProps, TResources } from './utils/GenericFieldComponent';
4
- declare type SkuFieldChildrenProps = TGenericChildrenProps<TResources['Sku']>;
5
- declare type TCondition = ConditionalElement<Exclude<TResources['Sku'], 'resource'>>;
6
- declare type Props = {
7
- children?: (props: SkuFieldChildrenProps) => JSX.Element;
8
- } & TCondition;
9
- export default function SkuField<P extends Props>(props: P): JSX.Element;
10
- 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"),SkuChildrenContext_1=tslib_1.__importDefault(require("../context/SkuChildrenContext")),GenericFieldComponent_1=tslib_1.__importDefault(require("./utils/GenericFieldComponent"));function SkuField(props){const{attribute,tagElement,children,...p}=props;return(0,jsx_runtime_1.jsx)(GenericFieldComponent_1.default,{resource:"skus",attribute,tagElement,context:SkuChildrenContext_1.default,...p,children})}exports.default=SkuField;
@@ -1,11 +0,0 @@
1
- import { ReactNode } from 'react';
2
- declare type Props = {
3
- children: ReactNode;
4
- };
5
- declare function Skus<P extends Props>({ children }: P): JSX.Element;
6
- declare namespace Skus {
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 Skus;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),components_1=tslib_1.__importDefault(require("../config/components")),SkuChildrenContext_1=tslib_1.__importDefault(require("../context/SkuChildrenContext")),SkuContext_1=tslib_1.__importDefault(require("../context/SkuContext")),react_1=require("react");function Skus({children}){const{skus}=(0,react_1.useContext)(SkuContext_1.default),components=skus&&skus.map((sku,key)=>{const value={sku};return(0,jsx_runtime_1.jsx)(SkuChildrenContext_1.default.Provider,{value,children},key)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.default=Skus,Skus.propTypes=components_1.default.Skus.propTypes;
@@ -1,14 +0,0 @@
1
- import { QueryParamsList } from '@commercelayer/sdk';
2
- import { ReactNode } from 'react';
3
- declare type Props = {
4
- skus: string[];
5
- children: ReactNode;
6
- queryParams?: QueryParamsList;
7
- };
8
- declare function SkusContainer<P extends Props>(props: P): JSX.Element;
9
- declare namespace SkusContainer {
10
- var propTypes: {
11
- children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
12
- };
13
- }
14
- export default SkusContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),components_1=tslib_1.__importDefault(require("../config/components")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),SkuContext_1=tslib_1.__importDefault(require("../context/SkuContext")),SkuReducer_1=tslib_1.__importStar(require("../reducers/SkuReducer")),react_1=require("react");function SkusContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=(0,react_1.useReducer)(SkuReducer_1.default,SkuReducer_1.skuInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default),loadSkus=async()=>await(0,SkuReducer_1.getSku)({config,dispatch,skus,queryParams});(0,react_1.useEffect)(()=>(config.accessToken&&state?.skus&&state?.skus.length===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=(0,react_1.useMemo)(()=>state,[state]);return(0,jsx_runtime_1.jsx)(SkuContext_1.default.Provider,{value:contextValue,children})}exports.default=SkusContainer,SkusContainer.propTypes=components_1.default.SkusContainer.propTypes;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StockTransfer=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")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../context/ShipmentChildrenContext")),StockTransferChildrenContext_1=tslib_1.__importDefault(require("../context/StockTransferChildrenContext")),propTypes=components_1.default.StockTransfer.propTypes,displayName=components_1.default.StockTransfer.displayName;function StockTransfer(props){const{children}=props,{stockTransfers,lineItems}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),components=stockTransfers?.filter(st=>!!lineItems?.find(l=>l.sku_code!==st.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer:stockTransfer.type==="line_items"?stockTransfer:stockTransfer?.line_item};return(0,jsx_runtime_1.jsx)(StockTransferChildrenContext_1.default.Provider,{value:stockTransferProps,children},k)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.StockTransfer=StockTransfer,StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName,exports.default=StockTransfer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StockTransferField=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),StockTransferChildrenContext_1=tslib_1.__importDefault(require("../context/StockTransferChildrenContext")),GenericFieldComponent_1=tslib_1.__importDefault(require("./utils/GenericFieldComponent"));function StockTransferField(props){const{attribute,tagElement,children,...p}=props;return(0,jsx_runtime_1.jsx)(GenericFieldComponent_1.default,{resource:"stock_transfers",attribute,tagElement,context:StockTransferChildrenContext_1.default,...p,children})}exports.StockTransferField=StockTransferField,exports.default=StockTransferField;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StripePayment=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")),react_stripe_js_1=require("@stripe/react-stripe-js"),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),localStorage_1=require("../utils/localStorage"),defaultOptions={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode:!0};function StripePaymentForm({options=defaultOptions,templateCustomerSaveToWallet}){const ref=(0,react_1.useRef)(null),{setPaymentSource,currentPaymentMethodType,setPaymentMethodErrors,setPaymentRef,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),stripe=(0,react_stripe_js_1.useStripe)(),elements=(0,react_stripe_js_1.useElements)();(0,react_1.useEffect)(()=>(ref.current&&stripe&&elements&&paymentSource&&(ref.current.onsubmit=paymentSource2=>onSubmit({event:ref.current,stripe,elements,paymentSource:paymentSource2}),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,stripe,elements,paymentSource]);const onSubmit=async({event,stripe:stripe2,elements:elements2,paymentSource:ps})=>{if(!stripe2)return!1;const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet);const cardElement=elements2&&elements2.getElement(react_stripe_js_1.CardElement);if(cardElement){const billingInfo=order?.billing_address,email=order?.customer_email,billing_details={name:billingInfo?.full_name,email,phone:billingInfo?.phone,address:{city:billingInfo?.city,country:billingInfo?.country_code,line1:billingInfo?.line_1,postal_code:billingInfo?.zip_code,state:billingInfo?.state_code}},{paymentMethod}=await stripe2.createPaymentMethod({type:"card",card:cardElement,billing_details}),clientSecret=ps?.client_secret,paymentSourceId=ps?.id;if(clientSecret){const{error,paymentIntent}=await stripe2.confirmCardPayment(clientSecret,{payment_method:{card:cardElement,billing_details}});if(error)return console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1;if(paymentIntent&&paymentMethod&&paymentSourceId&&currentPaymentMethodType)try{return await setPaymentSource({paymentSourceId,paymentResource:currentPaymentMethodType,attributes:{options:{...paymentMethod,setup_future_usage:"off_session"}}}),!0}catch{return!1}}}return!1};return(0,jsx_runtime_1.jsxs)("form",{ref,children:[(0,jsx_runtime_1.jsx)(react_stripe_js_1.CardElement,{options:{...defaultOptions,...options}}),templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]})}function StripePayment({publishableKey,show,options,locale="auto",...p}){const[isLoaded,setIsLoaded]=(0,react_1.useState)(!1),[stripe,setStripe]=(0,react_1.useState)(null),{containerClassName,templateCustomerSaveToWallet,fonts=[],...divProps}=p;return(0,react_1.useEffect)(()=>{if(show&&publishableKey){const{loadStripe}=require("@stripe/stripe-js");(async()=>{const res=await loadStripe(publishableKey,{locale});setStripe(res),setIsLoaded(!0)})()}return()=>{setIsLoaded(!1)}},[show,publishableKey]),isLoaded&&stripe?(0,jsx_runtime_1.jsx)("div",{className:containerClassName,...divProps,children:(0,jsx_runtime_1.jsx)(react_stripe_js_1.Elements,{stripe,options:{fonts},children:(0,jsx_runtime_1.jsx)(StripePaymentForm,{options,templateCustomerSaveToWallet})})}):null}exports.StripePayment=StripePayment,exports.default=StripePayment;
@@ -1,52 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { VariantHandleCallback } from './utils/VariantTemplate';
3
- import { BaseSelectorType } from '../typings/index';
4
- import { FunctionChildren } from '../typings/index';
5
- import { VariantsObject, SetSkuCode } from '../reducers/VariantReducer';
6
- export interface VariantOption {
7
- label: string;
8
- code: string;
9
- lineItem?: {
10
- name: string;
11
- imageUrl?: string | null;
12
- } | null;
13
- }
14
- declare type ChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
15
- variants: VariantsObject;
16
- handleSelect: SetSkuCode;
17
- loading: boolean;
18
- }>;
19
- declare type Props = {
20
- children?: ChildrenProps;
21
- options: VariantOption[];
22
- type?: BaseSelectorType;
23
- loader?: ReactNode;
24
- placeholder?: string;
25
- skuCode?: string;
26
- handleCallback?: VariantHandleCallback;
27
- } & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['select'];
28
- export declare function VariantSelector(props: Props): JSX.Element;
29
- export declare namespace VariantSelector {
30
- var propTypes: {
31
- options: import("prop-types").Validator<import("prop-types").InferProps<{
32
- label: import("prop-types").Validator<string>;
33
- code: import("prop-types").Validator<string>;
34
- lineItem: import("prop-types").Requireable<import("prop-types").InferProps<{
35
- name: import("prop-types").Validator<string>;
36
- imageUrl: import("prop-types").Requireable<string>;
37
- }>>;
38
- }>[]>;
39
- name: import("prop-types").Requireable<string>;
40
- children: import("prop-types").Requireable<(...args: any[]) => any>;
41
- type: import("prop-types").Requireable<BaseSelectorType>;
42
- loader: import("prop-types").Requireable<import("prop-types").ReactElementLike>;
43
- placeholder: import("prop-types").Requireable<string>;
44
- skuCode: import("prop-types").Requireable<string>;
45
- };
46
- var defaultProps: {
47
- placeholder: string;
48
- type: BaseSelectorType;
49
- };
50
- var displayName: string;
51
- }
52
- export default VariantSelector;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VariantSelector=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),VariantTemplate_1=tslib_1.__importDefault(require("./utils/VariantTemplate")),Parent_1=tslib_1.__importDefault(require("./utils/Parent")),VariantsContext_1=tslib_1.__importDefault(require("../context/VariantsContext")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.VariantSelector.propTypes,defaultProps=components_1.default.VariantSelector.defaultProps,displayName=components_1.default.VariantSelector.displayName;function VariantSelector(props){const{children,type,placeholder,skuCode,name,options,...prs}=props,{setSkuCode,skuCode:variantSkuCode,loading,variants,setSkuCodes}=(0,react_1.useContext)(VariantsContext_1.default);(0,react_1.useEffect)(()=>(setSkuCodes&&setSkuCodes(options),()=>{setSkuCodes&&setSkuCodes([])}),[options]);const sCode=variantSkuCode||skuCode||"",DefaultTemplate=()=>loading?(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:props.loader||"Loading..."}):(0,jsx_runtime_1.jsx)(VariantTemplate_1.default,{variants,type,placeholder,skuCode:sCode,options,handleChange:setSkuCode,name,...prs}),parentProps={variants,loading:!!loading,handleSelect:setSkuCode,skuCode:sCode,...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)(react_1.Fragment,{children:(0,jsx_runtime_1.jsx)(DefaultTemplate,{})})}exports.VariantSelector=VariantSelector,VariantSelector.propTypes=propTypes,VariantSelector.defaultProps=defaultProps,VariantSelector.displayName=displayName,exports.default=VariantSelector;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VariantsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),VariantReducer_1=tslib_1.__importStar(require("../reducers/VariantReducer")),CommerceLayerContext_1=tslib_1.__importDefault(require("../context/CommerceLayerContext")),VariantsContext_1=tslib_1.__importDefault(require("../context/VariantsContext")),VariantReducer_2=require("../reducers/VariantReducer"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),isEqual_1=tslib_1.__importDefault(require("lodash/isEqual")),getCurrentItemKey_1=tslib_1.__importDefault(require("../utils/getCurrentItemKey")),ItemContext_1=tslib_1.__importDefault(require("../context/ItemContext")),components_1=tslib_1.__importDefault(require("../config/components")),propTypes=components_1.default.VariantsContainer.propTypes,defaultProps=components_1.default.VariantsContainer.defaultProps,displayName=components_1.default.VariantsContainer.displayName;function VariantsContainer(props){const{children,skuCode="",filters={}}=props,config=(0,react_1.useContext)(CommerceLayerContext_1.default),{setItem,setItems,items,item:currentItem,setCustomLineItems,skuCode:itemSkuCode,setSkuCode:setItemSkuCode}=(0,react_1.useContext)(ItemContext_1.default),[state,dispatch]=(0,react_1.useReducer)(VariantReducer_1.default,VariantReducer_1.variantInitialState),sCode=(0,getCurrentItemKey_1.default)(currentItem)||skuCode||state.skuCode||itemSkuCode||"";(0,react_1.useEffect)(()=>{if(!(0,isEmpty_1.default)(items)&&!(0,isEmpty_1.default)(state.variants)&&!(0,isEqual_1.default)(items,state.variants)){const mergeItems={...items,...state.variants};setItems&&setItems(mergeItems)}return state.skuCodes.length>=1&&config.accessToken&&(dispatch({type:"setLoading",payload:{loading:!0}}),(0,VariantReducer_1.getVariants)({config,state,dispatch,setItem,skuCode:sCode,filters})),()=>(0,VariantReducer_1.unsetVariantState)(dispatch)},[config.accessToken]);const variantValue={...state,skuCode:sCode,setSkuCode:(code,id,lineItem={})=>{(0,isEmpty_1.default)(lineItem)||setCustomLineItems&&setCustomLineItems({[code]:lineItem}),(0,VariantReducer_1.setSkuCode)({code,id,config,setItem,dispatch,setItemSkuCode})},setSkuCodes:skuCodes=>(0,VariantReducer_2.setVariantSkuCodes)({skuCodes,dispatch,setCustomLineItems})};return(0,jsx_runtime_1.jsx)(VariantsContext_1.default.Provider,{value:variantValue,children})}exports.VariantsContainer=VariantsContainer,VariantsContainer.propTypes=propTypes,VariantsContainer.defaultProps=defaultProps,VariantsContainer.displayName=displayName,exports.default=VariantsContainer;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WireTransferPayment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentMethodContext_1=tslib_1.__importDefault(require("../context/PaymentMethodContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),react_1=require("react"),defaultMessage="after placing the order, you will need to manually complete the payment with your bank";function WireTransferPayment({infoMessage,...p}){const ref=(0,react_1.useRef)(null),{setPaymentSource,paymentSource,currentPaymentMethodType,setPaymentRef}=(0,react_1.useContext)(PaymentMethodContext_1.default);(0,react_1.useEffect)(()=>(ref.current&&paymentSource&&currentPaymentMethodType&&(ref.current.onsubmit=()=>handleClick(),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType]);const handleClick=async()=>{if(paymentSource&&currentPaymentMethodType)try{return await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{metadata:{card:{id:paymentSource.id,brand:"wire-transfer",last4:""}}}}),!0}catch{return!1}return!1};return(0,jsx_runtime_1.jsx)("form",{ref,children:(0,jsx_runtime_1.jsx)("div",{...p,children:(0,jsx_runtime_1.jsx)("span",{className:infoMessage?.className,children:(0,isFunction_1.default)(infoMessage?.text)?infoMessage?.text():infoMessage?.text||defaultMessage})})})}exports.WireTransferPayment=WireTransferPayment,exports.default=WireTransferPayment;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { GatewayBaseType } from '../PaymentGateway';
3
- declare type AdyenGateway = GatewayBaseType;
4
- export declare function AdyenGateway(props: AdyenGateway): JSX.Element | null;
5
- export default AdyenGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),AdyenPayment_1=tslib_1.__importDefault(require("../AdyenPayment")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),jwt_1=tslib_1.__importDefault(require("../../utils/jwt")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails"));function AdyenGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=(0,react_1.useContext)(OrderContext_1.default),{accessToken}=(0,react_1.useContext)(CommerceLayerContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{payments,isGuest}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="adyen_payments",locale=order?.language_code,paymentMethods=paymentSource?.payment_methods;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientKey=paymentSource?.public_key,environment=(0,jwt_1.default)(accessToken).test?"test":"live",adyenConfig=config?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{},customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type==="adyen_payments"):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsxs)(react_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{templateCustomerSaveToWallet,clientKey,locale,environment,config:adyenConfig})]}):loaderComponent:clientKey&&!loading&&paymentMethods?(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{clientKey,locale,config:adyenConfig}):loaderComponent}exports.AdyenGateway=AdyenGateway,exports.default=AdyenGateway;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { GatewayBaseType } from '../PaymentGateway';
3
- declare type BraintreeGateway = GatewayBaseType;
4
- export declare function BraintreeGateway(props: BraintreeGateway): JSX.Element | null;
5
- export default BraintreeGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BraintreeGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BraintreePayment_1=tslib_1.__importDefault(require("../BraintreePayment")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate"));function BraintreeGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=(0,react_1.useContext)(OrderContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{payments,isGuest}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="braintree_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const authorization=paymentSource?.client_token,braintreeConfig=config?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{},customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type==="braintree_payments"):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?authorization&&!loading?(0,jsx_runtime_1.jsxs)(react_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(BraintreePayment_1.default,{templateCustomerSaveToWallet,authorization,locale,config:braintreeConfig})]}):loaderComponent:authorization&&!loading?(0,jsx_runtime_1.jsx)(BraintreePayment_1.default,{locale,authorization,config:braintreeConfig}):loaderComponent}exports.BraintreeGateway=BraintreeGateway,exports.default=BraintreeGateway;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { GatewayBaseType } from '../PaymentGateway';
3
- declare type CheckoutComGateway = GatewayBaseType;
4
- export declare function CheckoutComGateway(props: CheckoutComGateway): JSX.Element | null;
5
- export default CheckoutComGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CheckoutComGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CheckoutComPayment_1=tslib_1.__importDefault(require("../CheckoutComPayment")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=tslib_1.__importDefault(require("react")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails"));function CheckoutComGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=react_1.default.useContext(OrderContext_1.default),{payment}=react_1.default.useContext(PaymentMethodChildrenContext_1.default),{payments,isGuest}=react_1.default.useContext(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=react_1.default.useContext(PaymentMethodContext_1.default),paymentResource="checkout_com_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const publicKey=paymentSource?.public_key,paymentConfig=config?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{},customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type===paymentResource):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return card.brand?(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children}):null}return!isGuest&&templateCustomerCards?publicKey&&!loading?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(CheckoutComPayment_1.default,{show,templateCustomerSaveToWallet,publicKey,locale,...paymentConfig})]}):loaderComponent:publicKey&&!loading?(0,jsx_runtime_1.jsx)(CheckoutComPayment_1.default,{show,publicKey,locale,...paymentConfig}):loaderComponent}exports.CheckoutComGateway=CheckoutComGateway,exports.default=CheckoutComGateway;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { GatewayBaseType } from '../PaymentGateway';
3
- declare type KlarnaGateway = GatewayBaseType;
4
- export declare function KlarnaGateway(props: KlarnaGateway): JSX.Element | null;
5
- export default KlarnaGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KlarnaGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=tslib_1.__importDefault(require("react")),KlarnaPayment_1=tslib_1.__importDefault(require("../KlarnaPayment")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate"));function KlarnaGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,...p}=props,{order}=react_1.default.useContext(OrderContext_1.default),{payment}=react_1.default.useContext(PaymentMethodChildrenContext_1.default),{payments,isGuest}=react_1.default.useContext(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=react_1.default.useContext(PaymentMethodContext_1.default),paymentResource="klarna_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientToken=paymentSource?.client_token,klarnaConfig=config?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{},customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type===paymentResource):[];if(readonly||showCard){const card=paymentSource?.options?.card,value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(KlarnaPayment_1.default,{clientToken,locale,...klarnaConfig})]}):clientToken&&!loading?(0,jsx_runtime_1.jsx)(KlarnaPayment_1.default,{clientToken,locale,...klarnaConfig}):loaderComponent}exports.KlarnaGateway=KlarnaGateway,exports.default=KlarnaGateway;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { GatewayBaseType } from '../PaymentGateway';
3
- declare type PaypalGateway = Partial<GatewayBaseType>;
4
- export declare function PaypalGateway(props: PaypalGateway): JSX.Element | null;
5
- export default PaypalGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaypalGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaypalPayment_1=tslib_1.__importDefault(require("../PaypalPayment")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react");function PaypalGateway(props){const{readonly,showCard,handleEditClick,children,...p}=props,{order}=(0,react_1.useContext)(OrderContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="paypal_payments";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:order?.payment_source||paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}const paypalConfig=config&&(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config);return delete p.show,delete p.templateCustomerCards,delete p.templateCustomerSaveToWallet,delete p.loading,delete p.loaderComponent,delete p.onClickCustomerCards,(0,jsx_runtime_1.jsx)(PaypalPayment_1.default,{...p,infoMessage:paypalConfig?.infoMessage})}exports.PaypalGateway=PaypalGateway,exports.default=PaypalGateway;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { GatewayBaseType } from '../PaymentGateway';
3
- declare type StripeGateway = GatewayBaseType;
4
- export declare function StripeGateway(props: StripeGateway): JSX.Element | null;
5
- export default StripeGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StripeGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),StripePayment_1=tslib_1.__importDefault(require("../StripePayment")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=tslib_1.__importDefault(require("react")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate"));function StripeGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=react_1.default.useContext(OrderContext_1.default),{payment}=react_1.default.useContext(PaymentMethodChildrenContext_1.default),{payments,isGuest}=react_1.default.useContext(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=react_1.default.useContext(PaymentMethodContext_1.default),paymentResource="stripe_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const publishableKey=paymentSource?.publishable_key,paymentSourceId=order?.payment_source?.id||paymentSource?.id,stripeConfig=config?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{},customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type===paymentResource):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}return!isGuest&&templateCustomerCards?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(StripePayment_1.default,{show,templateCustomerSaveToWallet,publishableKey,locale,...stripeConfig})]}):publishableKey&&!loading&&paymentSourceId?(0,jsx_runtime_1.jsx)(StripePayment_1.default,{show,publishableKey,locale,...stripeConfig}):loaderComponent}exports.StripeGateway=StripeGateway,exports.default=StripeGateway;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { GatewayBaseType } from '../PaymentGateway';
3
- declare type WireTransferGateway = GatewayBaseType;
4
- export declare function WireTransferGateway(props: WireTransferGateway): JSX.Element | null;
5
- export default WireTransferGateway;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WireTransferGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),WireTransferPayment_1=tslib_1.__importDefault(require("../WireTransferPayment")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react");function WireTransferGateway(props){const{readonly,showCard,handleEditClick,children,...p}=props,{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="wire_transfers";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly||showCard){const card=paymentSource?.options?.card||paymentSource?.metadata?.card,value={...card,showCard,handleEditClick,readonly};return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}const wireTransferConfig=config&&paymentResource?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{};return(0,jsx_runtime_1.jsx)(WireTransferPayment_1.default,{...p,...wireTransferConfig})}exports.WireTransferGateway=WireTransferGateway,exports.default=WireTransferGateway;
@@ -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
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.AdjustmentAmount.propTypes,defaultProps=components.AdjustmentAmount.defaultProps,displayName=components.AdjustmentAmount.displayName,AdjustmentAmount=props=>_jsx(BaseOrderPrice,{base:"amount",type:"adjustment",...props});AdjustmentAmount.propTypes=propTypes,AdjustmentAmount.defaultProps=defaultProps,AdjustmentAmount.displayName=displayName;export 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
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import isEmpty from"lodash/isEmpty";import{setCustomerOrderParam}from"../utils/localStorage";import Parent from"./utils/Parent";import getBrowserInfo from"../utils/browserInfo";import PlaceOrderContext from"../context/PlaceOrderContext";const threeDSConfiguration={challengeWindowSize:"05"},defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,placeOrderCallback,styles}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState({}),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext),{setPlaceOrder}=useContext(PlaceOrderContext),ref=useRef(null),handleSubmit=async(e,checkout2)=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;savePaymentSourceToCustomerWallet&&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=getBrowserInfo(),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 useEffect(()=>{const paymentMethodsResponse=isEmpty(paymentSource?.payment_methods)?{}:paymentSource?.payment_methods;isEmpty(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&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&!isEmpty(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:_jsxs("form",{ref,onSubmit:e=>handleSubmit(e,checkout),children:[_jsx("div",{className:cardContainerClassName,id:"adyen-card"}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),_jsx("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}export default AdyenPayment;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useReducer,useEffect}from"react";import availabilityReducer,{availabilityInitialState,getAvailability,getAvailabilityByIds}from"../reducers/AvailabilityReducer";import AvailabilityContext from"../context/AvailabilityContext";import ItemContext from"../context/ItemContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import components from"../config/components";import CommerceLayerContext from"../context/CommerceLayerContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import SkuChildrenContext from"../context/SkuChildrenContext";import SkuContext from"../context/SkuContext";import isEqual from"lodash/isEqual";const propTypes=components.AvailabilityContainer.propTypes,displayName=components.AvailabilityContainer.displayName;export function AvailabilityContainer(props){const{children,skuCode}=props,{item,skuCode:itemSkuCode,setItem}=useContext(ItemContext),{lineItem}=useContext(LineItemChildrenContext),{sku}=useContext(SkuChildrenContext),{skus}=useContext(SkuContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(availabilityReducer,availabilityInitialState),sCode=skuCode||getCurrentItemKey(item)||itemSkuCode||lineItem?.sku_code||sku?.code;return 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]?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(!isEqual(skuCodes,itemKeys)){const skusIds=skus.map(s=>s.id);getAvailabilityByIds({skusIds,config,dispatch,setItem})}}return()=>{dispatch({type:"setAvailability",payload:{}})}},[config.accessToken,item,sCode,skus]),_jsx(AvailabilityContext.Provider,{value:{...state},children})}AvailabilityContainer.propTypes=propTypes,AvailabilityContainer.displayName=displayName;export default AvailabilityContainer;
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- import { TimeFormat, FunctionChildren } from '../typings/index';
3
- import { DeliveryLeadTime } from '../reducers/AvailabilityReducer';
4
- declare type AvailabilityTemplateChildrenProps = FunctionChildren<Omit<Props, 'children'> & DeliveryLeadTime & {
5
- text: string;
6
- quantity: number;
7
- }>;
8
- declare type Props = {
9
- children?: AvailabilityTemplateChildrenProps;
10
- timeFormat?: TimeFormat;
11
- showShippingMethodName?: boolean;
12
- showShippingMethodPrice?: boolean;
13
- } & JSX.IntrinsicElements['p'];
14
- export declare function AvailabilityTemplate(props: Props): JSX.Element;
15
- export declare namespace AvailabilityTemplate {
16
- var propTypes: {
17
- timeFormat: import("prop-types").Requireable<TimeFormat>;
18
- showShippingMethodName: import("prop-types").Requireable<boolean>;
19
- children: import("prop-types").Requireable<(...args: any[]) => any>;
20
- };
21
- var defaultProps: Props;
22
- var displayName: string;
23
- }
24
- export default AvailabilityTemplate;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import AvailabilityContext from"../context/AvailabilityContext";import Parent from"./utils/Parent";import{isEmpty}from"lodash";import components from"../config/components";import ItemContext from"../context/ItemContext";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.AvailabilityTemplate.propTypes,defaultProps=components.AvailabilityTemplate.defaultProps,displayName=components.AvailabilityTemplate.displayName;export function AvailabilityTemplate(props){const{timeFormat,showShippingMethodName,showShippingMethodPrice,children,...p}=props;let{min,max,shipping_method,quantity}=useContext(AvailabilityContext);const{item}=useContext(ItemContext),{sku}=useContext(SkuChildrenContext),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=!isEmpty(min)&&timeFormat?min?.[timeFormat]:"",mx=!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?_jsx(Parent,{...parentProps,children}):_jsx("p",{...p,children:text.join(" ")})}AvailabilityTemplate.propTypes=propTypes,AvailabilityTemplate.defaultProps=defaultProps,AvailabilityTemplate.displayName=displayName;export 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
- import{jsx as _jsx}from"react/jsx-runtime";import BillingAddressContext from"../context/BillingAddressContext";import{useContext,useEffect,useReducer}from"react";import billingAddressReducer,{billingAddressInitialState,setBillingAddress,setBillingCustomerAddressId}from"../reducers/BillingAddressReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";const propTypes=components.BillingAddressContainer.propTypes;export function BillingAddressContainer(props){const{children}=props,[state,dispatch]=useReducer(billingAddressReducer,billingAddressInitialState),config=useContext(CommerceLayerContext),{order,include,addResourceToInclude}=useContext(OrderContext),{shipToDifferentAddress,setCloneAddress}=useContext(AddressContext);useEffect(()=>(include?.includes("billing_address")||addResourceToInclude({newResource:"billing_address",resourcesIncluded:include}),order&&config&&setBillingCustomerAddressId({dispatch,order,setCloneAddress}),()=>{dispatch({type:"cleanup",payload:{}})}),[order,include]);const contextValue={...state,setBillingAddress:async(id,options)=>{await setBillingAddress(id,{config,dispatch,order,shipToDifferentAddress,customerAddressId:options?.customerAddressId}),setCloneAddress(id,"billing_address")}};return _jsx(BillingAddressContext.Provider,{value:contextValue,children})}BillingAddressContainer.propTypes=propTypes;export default BillingAddressContainer;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import AddressesContext from"../context/AddressContext";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef}from"react";import BillingAddressFormContext from"../context/BillingAddressFormContext";import{isEmpty}from"lodash";import components from"../config/components";import OrderContext from"../context/OrderContext";import{getSaveBillingAddressToAddressBook}from"../utils/localStorage";import{businessMandatoryField}from"../utils/validateFormFields";const propTypes=components.BillingAddressForm.propTypes;export function BillingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1,...p}=props,{validation,values,errors,reset:resetForm}=useRapidForm(),{setAddressErrors,setAddress,isBusiness}=useContext(AddressesContext),{saveAddressToCustomerAddressBook,order,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),ref=useRef(null);useEffect(()=>{if(include?.includes("billing_address")?includeLoaded?.billing_address||addResourceToInclude({newResourceLoaded:{billing_address:!0}}):addResourceToInclude({newResource:"billing_address"}),isEmpty(errors)){if(values&&Object.keys(values).length>0){setAddressErrors([],"billing_address");for(const name in values){const field=values[name];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||getSaveBillingAddressToAddressBook();reset&&(!isEmpty(values)||!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 _jsx(BillingAddressFormContext.Provider,{value:providerValues,children:_jsx("form",{ref,autoComplete,...p,children})})}BillingAddressForm.propTypes=propTypes;export default BillingAddressForm;
@@ -1 +0,0 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import isEmpty from"lodash/isEmpty";import OrderContext from"../context/OrderContext";import Parent from"./utils/Parent";import{setCustomerOrderParam}from"../utils/localStorage";import promisify from"../utils/promisify";const 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"};export function BraintreePayment({authorization,config,templateCustomerSaveToWallet}){const{fields,styles,containerClassName,cardContainerClassName,fieldsContainerClassName,expDateContainerClassName,fieldLabelClassName,cvvContainerClassName,inputWrapperClassName,cardDetailsContainerClassName}={...defaultConfig,...config},[loadBraintree,setLoadBraintree]=useState(!1),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),ref=useRef(null),handleSubmitForm=async({event,hostedFieldsInstance,threeDSInstance})=>{const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;if(savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),hostedFieldsInstance)try{const payload=await promisify(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 useEffect(()=>{if(!ref&&authorization&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),authorization&&!loadBraintree&&!isEmpty(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:_jsx("div",{className:containerClassName,children:_jsxs("form",{ref,id:"braintree-form",onSubmit:handleSubmitForm,className:containerClassName,children:[_jsxs("div",{className:fieldsContainerClassName,children:[_jsxs("div",{className:cardContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"card-number",children:fields?.number?.label}),_jsx("div",{className:inputWrapperClassName,id:"card-number"})]}),_jsxs("div",{className:cardDetailsContainerClassName,children:[_jsxs("div",{className:expDateContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"expiration-date",children:fields?.expirationDate?.label}),_jsx("div",{className:inputWrapperClassName,id:"expiration-date"})]}),_jsxs("div",{className:cvvContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"cvv",children:fields?.cvv?.label}),_jsx("div",{className:inputWrapperClassName,id:"cvv"})]})]})]}),_jsx("div",{className:fieldsContainerClassName,children:templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})})]})})}export 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
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../context/OrderContext";import Parent from"./utils/Parent";import CommerceLayerContext from"../context/CommerceLayerContext";import getCartLink from"../utils/getCartLink";export default function CartLink(props){const{label,children,...p}=props,{order,createOrder}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext),[slug]=endpoint.split(".commercelayer"),href=slug&&order?.id?getCartLink({slug,orderId:order?.id,accessToken}):"",handleClick=async event=>{if(event.preventDefault(),order?.id)location.href=href;else{const orderId=await createOrder();slug&&(location.href=getCartLink({slug,orderId,accessToken}))}},parentProps={handleClick,label,href,...p};return accessToken?children?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,...p,onClick:handleClick,children:typeof label=="function"?label():label}):null}
@@ -1 +0,0 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useRef}from"react";import useExternalScript from"../utils/hooks/useExternalScript";import PaymentMethodContext from"../context/PaymentMethodContext";import{Frames,CardNumber,ExpiryDate,Cvv}from"frames-react";import OrderContext from"../context/OrderContext";import Parent from"./utils/Parent";import{setCustomerOrderParam}from"../utils/localStorage";const 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"}}}};export function CheckoutComPayment({publicKey,options=defaultOptions,locale="EN-GB",...p}){const ref=useRef(null),loaded=useExternalScript(scriptUrl),{setPaymentRef,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{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&&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?_jsxs("form",{ref,children:[_jsx("div",{className:containerClassName,...divProps,children:_jsxs(Frames,{config:{debug:!0,publicKey,localization,...options},cardValidationChanged:e=>{e.isValid&&ref.current&&(ref.current.onsubmit=()=>handleSubmit(),setPaymentRef({ref}))},cardTokenized:data=>data,children:[_jsx(CardNumber,{}),_jsx(ExpiryDate,{}),_jsx(Cvv,{})]})}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]}):null}export default CheckoutComPayment;
@@ -1,23 +0,0 @@
1
- /// <reference types="react" />
2
- import { FunctionChildren } from '../typings/index';
3
- declare type CheckoutLinkChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
4
- checkoutUrl: string;
5
- href: string;
6
- }>;
7
- declare type Props = {
8
- children?: CheckoutLinkChildrenProps;
9
- label?: string;
10
- hostedCheckout?: boolean;
11
- } & JSX.IntrinsicElements['a'];
12
- export declare function CheckoutLink(props: Props): JSX.Element;
13
- export declare namespace CheckoutLink {
14
- var propTypes: {
15
- children: import("prop-types").Requireable<(...args: any[]) => any>;
16
- label: import("prop-types").Requireable<string>;
17
- };
18
- var defaultProps: {
19
- label: string;
20
- };
21
- var displayName: string;
22
- }
23
- export default CheckoutLink;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../context/OrderContext";import components from"../config/components";import Parent from"./utils/Parent";import CommerceLayerContext from"../context/CommerceLayerContext";const propTypes=components.CheckoutLink.propTypes,defaultProps=components.CheckoutLink.defaultProps,displayName=components.CheckoutLink.displayName;export function CheckoutLink(props){const{label,hostedCheckout=!0,children,...p}=props,{order}=useContext(OrderContext),{accessToken,endpoint}=useContext(CommerceLayerContext),[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?_jsx(Parent,{...parentProps,children}):_jsx("a",{href,...p,children:label})}CheckoutLink.propTypes=propTypes,CheckoutLink.defaultProps=defaultProps,CheckoutLink.displayName=displayName;export default CheckoutLink;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.DeliveryLeadTime.propTypes,displayName=components.DeliveryLeadTime.displayName;export function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=useState(),{deliveryLeadTimeForShipment}=useContext(ShippingMethodChildrenContext);useEffect(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:text})}DeliveryLeadTime.propTypes=propTypes,DeliveryLeadTime.displayName=displayName;export default DeliveryLeadTime;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.DiscountAmount.propTypes,defaultProps=components.DiscountAmount.defaultProps,displayName=components.DiscountAmount.displayName;export function DiscountAmount(props){return _jsx(BaseOrderPrice,{base:"amount",type:"discount",...props})}DiscountAmount.propTypes=propTypes,DiscountAmount.defaultProps=defaultProps,DiscountAmount.displayName=displayName;export default DiscountAmount;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useRef,useContext}from"react";import validateFormFields from"../utils/validateFormFields";import{isEmpty}from"lodash";import GiftCardContext from"../context/GiftCardContext";import components from"../config/components";const propTypes=components.GiftCard.propTypes,defaultProps=components.GiftCard.defaultProps,displayName=components.GiftCard.displayName;export function GiftCard(props){const{children,onSubmit}=props,name="giftCardForm",ref=useRef(null),{addGiftCard,addGiftCardError}=useContext(GiftCardContext);return _jsx(Fragment,{children:_jsx("form",{name,ref,onSubmit:e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm?.elements,{errors,values}=validateFormFields(elements,["currencyCode","balanceCents"],"gift_cards");isEmpty(errors)?(addGiftCard(values),currentForm?.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)},children},name)})}GiftCard.propTypes=propTypes,GiftCard.defaultProps=defaultProps,GiftCard.displayName=displayName;export default GiftCard;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../context/GiftCardContext";import CommerceLayerContext from"../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../reducers/GiftCardReducer";import OrderContext from"../context/OrderContext";import components from"../config/components";const propTypes=components.GiftCardContainer.propTypes,displayName=components.GiftCardContainer.displayName;export function GiftCardContainer(props){const{children}=props,[state,dispatch]=useReducer(giftCardReducer,giftCardInitialState),config=useContext(CommerceLayerContext),{getOrder,createOrder,order}=useContext(OrderContext),giftCardValue={...state,addGiftCardRecipient:values=>addGiftCardRecipient(values,config,dispatch),addGiftCard:values=>addGiftCard({...values},{config,dispatch,getOrder,createOrder,order}),addGiftCardError:errors=>addGiftCardError(errors,dispatch),addGiftCardLoading:loading=>addGiftCardLoading(loading,dispatch)};return _jsx(GiftCardContext.Provider,{value:giftCardValue,children})}GiftCardContainer.propTypes=propTypes,GiftCardContainer.displayName=displayName;export default GiftCardContainer;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"./utils/BaseSelect";import currencyOptions from"../config/currency";import components from"../config/components";const propTypes=components.GiftCardCurrencySelector.propTypes,defaultProps=components.GiftCardCurrencySelector.defaultProps,displayName=components.GiftCardCurrencySelector.displayName;export function GiftCardCurrencySelector(props){return _jsx(BaseSelect,{options:currencyOptions,name:"currencyCode",...props})}GiftCardCurrencySelector.propTypes=propTypes,GiftCardCurrencySelector.defaultProps=defaultProps,GiftCardCurrencySelector.displayName=displayName;export default GiftCardCurrencySelector;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.GiftCardInput.propTypes,displayName=components.GiftCardInput.displayName;export function GiftCardInput(props){const{placeholder="",...p}=props;return _jsx(BaseInput,{placeholder,...p})}GiftCardInput.propTypes=propTypes,GiftCardInput.displayName=displayName;export default GiftCardInput;
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- import { FunctionChildren } from '../typings/index';
3
- import type { CodeType } from '../reducers/OrderReducer';
4
- declare type ChildrenProps = Omit<Props, 'children'> & {
5
- code?: string;
6
- hide?: boolean;
7
- discountAmountCents?: string;
8
- discountAmountFloat?: string;
9
- formattedDiscountAmount?: string;
10
- };
11
- declare type GiftCardOrCouponCodeChildrenProps = FunctionChildren<ChildrenProps>;
12
- declare type Props = {
13
- type?: CodeType;
14
- children?: GiftCardOrCouponCodeChildrenProps;
15
- } & JSX.IntrinsicElements['span'];
16
- export declare function GiftCardOrCouponCode({ children, type, ...props }: Props): JSX.Element | null;
17
- export declare namespace GiftCardOrCouponCode {
18
- var propTypes: {
19
- children: import("prop-types").Requireable<(...args: any[]) => any>;
20
- type: import("prop-types").Requireable<CodeType>;
21
- };
22
- var displayName: string;
23
- }
24
- export default GiftCardOrCouponCode;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import has from"lodash/has";import isEmpty from"lodash/isEmpty";const propTypes=components.GiftCardOrCouponCode.propTypes,displayName=components.GiftCardOrCouponCode.displayName;export function GiftCardOrCouponCode({children,type,...props}){const{order}=useContext(OrderContext);let codeType=type&&`${type}_code`;!type&&order&&has(order,"coupon_code")&&!isEmpty(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?_jsx(Parent,{...parentProps,children}):hide?null:_jsx("span",{...props,children:code})}GiftCardOrCouponCode.propTypes=propTypes,GiftCardOrCouponCode.displayName=displayName;export default GiftCardOrCouponCode;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef,useState}from"react";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";import OrderContext from"../context/OrderContext";import isEmpty from"lodash/isEmpty";import components from"../config/components";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";const propTypes=components.GiftCardOrCouponForm.propTypes;export function GiftCardOrCouponForm(props){const{children,autoComplete="on",onSubmit,...p}=props,{validation,values,reset}=useRapidForm(),[codeType,setCodeType]=useState("gift_card_or_coupon_code"),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=useContext(OrderContext),ref=useRef(null),inputName="gift_card_or_coupon_code";useEffect(()=>{if(values[inputName]?.value===""&&findIndex(errors,{field:camelCase(inputName)})!==-1){const err=dropWhile(errors,i=>i.field===camelCase(inputName));setOrderErrors(err),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1})}values[inputName]?.value===""&&(setOrderErrors([]),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1}))},[values]),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=has(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||isEmpty(order)?null:_jsx(CouponAndGiftCardFormContext.Provider,{value:{validation,codeType},children:_jsx("form",{ref,autoComplete,onSubmit:handleSubmit,...p,children})})}GiftCardOrCouponForm.propTypes=propTypes;export default GiftCardOrCouponForm;