@commercelayer/react-components 2.49.0 → 2.49.1

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 (368) hide show
  1. package/lib/cjs/components/AddToCartButton.js +1 -1
  2. package/lib/cjs/components/Address.js +1 -1
  3. package/lib/cjs/components/AddressCountrySelector.js +1 -1
  4. package/lib/cjs/components/AddressField.js +1 -1
  5. package/lib/cjs/components/AddressInput.js +1 -1
  6. package/lib/cjs/components/AddressStateSelector.js +1 -1
  7. package/lib/cjs/components/AddressesContainer.js +1 -1
  8. package/lib/cjs/components/AdyenPayment.js +1 -1
  9. package/lib/cjs/components/AvailabilityContainer.js +1 -1
  10. package/lib/cjs/components/AvailabilityTemplate.js +1 -1
  11. package/lib/cjs/components/BillingAddressContainer.js +1 -1
  12. package/lib/cjs/components/BillingAddressForm.js +1 -1
  13. package/lib/cjs/components/BraintreePayment.js +1 -1
  14. package/lib/cjs/components/CheckoutLink.js +1 -1
  15. package/lib/cjs/components/CommerceLayer.js +1 -1
  16. package/lib/cjs/components/CustomerContainer.js +1 -1
  17. package/lib/cjs/components/CustomerInput.js +1 -1
  18. package/lib/cjs/components/DeliveryLeadTime.js +1 -1
  19. package/lib/cjs/components/DiscountAmount.js +1 -1
  20. package/lib/cjs/components/Errors.js +1 -1
  21. package/lib/cjs/components/ExternalFunction.js +1 -1
  22. package/lib/cjs/components/GiftCard.js +1 -1
  23. package/lib/cjs/components/GiftCardAmount.js +1 -1
  24. package/lib/cjs/components/GiftCardContainer.js +1 -1
  25. package/lib/cjs/components/GiftCardCurrencySelector.js +1 -1
  26. package/lib/cjs/components/GiftCardInput.js +1 -1
  27. package/lib/cjs/components/GiftCardOrCouponCode.js +1 -1
  28. package/lib/cjs/components/GiftCardOrCouponForm.js +1 -1
  29. package/lib/cjs/components/GiftCardOrCouponInput.js +1 -1
  30. package/lib/cjs/components/GiftCardOrCouponRemoveButton.js +1 -1
  31. package/lib/cjs/components/GiftCardOrCouponSubmit.js +1 -1
  32. package/lib/cjs/components/ItemContainer.js +1 -1
  33. package/lib/cjs/components/LineItem.js +1 -1
  34. package/lib/cjs/components/LineItemAmount.js +1 -1
  35. package/lib/cjs/components/LineItemCode.js +1 -1
  36. package/lib/cjs/components/LineItemImage.js +1 -1
  37. package/lib/cjs/components/LineItemName.js +1 -1
  38. package/lib/cjs/components/LineItemOption.js +1 -1
  39. package/lib/cjs/components/LineItemOptions.js +1 -1
  40. package/lib/cjs/components/LineItemQuantity.js +1 -1
  41. package/lib/cjs/components/LineItemRemoveLink.js +1 -1
  42. package/lib/cjs/components/LineItemsContainer.js +1 -1
  43. package/lib/cjs/components/LineItemsCount.js +1 -1
  44. package/lib/cjs/components/MetadataInput.js +1 -1
  45. package/lib/cjs/components/OrderContainer.js +1 -1
  46. package/lib/cjs/components/OrderNumber.js +1 -1
  47. package/lib/cjs/components/OrderStorage.js +1 -1
  48. package/lib/cjs/components/PaymentGateway.js +1 -1
  49. package/lib/cjs/components/PaymentMethod.js +1 -1
  50. package/lib/cjs/components/PaymentMethodAmount.js +1 -1
  51. package/lib/cjs/components/PaymentMethodName.js +1 -1
  52. package/lib/cjs/components/PaymentMethodPrice.js +1 -1
  53. package/lib/cjs/components/PaymentMethodRadioButton.js +1 -1
  54. package/lib/cjs/components/PaymentMethodsContainer.js +1 -1
  55. package/lib/cjs/components/PaymentSource.js +1 -1
  56. package/lib/cjs/components/PaymentSourceBrandIcon.js +1 -1
  57. package/lib/cjs/components/PaymentSourceBrandName.js +1 -1
  58. package/lib/cjs/components/PaymentSourceDetail.js +1 -1
  59. package/lib/cjs/components/PaymentSourceEditButton.js +1 -1
  60. package/lib/cjs/components/PaypalPayment.js +1 -1
  61. package/lib/cjs/components/PlaceOrderButton.js +1 -1
  62. package/lib/cjs/components/PlaceOrderContainer.js +1 -1
  63. package/lib/cjs/components/Price.js +1 -1
  64. package/lib/cjs/components/PricesContainer.js +1 -1
  65. package/lib/cjs/components/PrivacyAndTermsCheckbox.js +1 -1
  66. package/lib/cjs/components/QuantitySelector.js +1 -1
  67. package/lib/cjs/components/SaveAddressesButton.js +1 -1
  68. package/lib/cjs/components/SaveCustomerButton.js +1 -1
  69. package/lib/cjs/components/Shipment.js +1 -1
  70. package/lib/cjs/components/ShipmentField.js +1 -1
  71. package/lib/cjs/components/ShipmentsContainer.js +1 -1
  72. package/lib/cjs/components/ShippingAddressContainer.js +1 -1
  73. package/lib/cjs/components/ShippingAddressForm.js +1 -1
  74. package/lib/cjs/components/ShippingAmount.js +1 -1
  75. package/lib/cjs/components/ShippingMethod.js +1 -1
  76. package/lib/cjs/components/ShippingMethodName.js +1 -1
  77. package/lib/cjs/components/ShippingMethodPrice.js +1 -1
  78. package/lib/cjs/components/ShippingMethodRadioButton.js +1 -1
  79. package/lib/cjs/components/SkuList.js +1 -1
  80. package/lib/cjs/components/SkuListsContainer.js +1 -1
  81. package/lib/cjs/components/SkuOption.js +1 -1
  82. package/lib/cjs/components/SkuOptionInput.js +1 -1
  83. package/lib/cjs/components/SkuOptionsContainer.js +1 -1
  84. package/lib/cjs/components/StockTransfer.js +1 -1
  85. package/lib/cjs/components/StockTransferField.js +1 -1
  86. package/lib/cjs/components/StripePayment.js +1 -1
  87. package/lib/cjs/components/SubTotalAmount.js +1 -1
  88. package/lib/cjs/components/SubmitButton.js +1 -1
  89. package/lib/cjs/components/TaxesAmount.js +1 -1
  90. package/lib/cjs/components/TotalAmount.js +1 -1
  91. package/lib/cjs/components/VariantSelector.js +1 -1
  92. package/lib/cjs/components/VariantsContainer.js +1 -1
  93. package/lib/cjs/components/WireTransferPayment.js +1 -1
  94. package/lib/cjs/components/gateways/AdyenGateway.js +1 -1
  95. package/lib/cjs/components/gateways/BraintreeGateway.js +1 -1
  96. package/lib/cjs/components/gateways/PaypalGateway.js +1 -1
  97. package/lib/cjs/components/gateways/StripeGateway.js +1 -1
  98. package/lib/cjs/components/gateways/WireTransferGateway.js +1 -1
  99. package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
  100. package/lib/cjs/components/utils/BaseField.js +1 -1
  101. package/lib/cjs/components/utils/BaseInput.js +1 -1
  102. package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
  103. package/lib/cjs/components/utils/BaseSelect.js +1 -1
  104. package/lib/cjs/components/utils/Parent.js +1 -1
  105. package/lib/cjs/components/utils/PaymentCardsTemplate.js +1 -1
  106. package/lib/cjs/components/utils/PriceTemplate.js +1 -1
  107. package/lib/cjs/components/utils/VariantTemplate.js +1 -1
  108. package/lib/cjs/components/utils/getAllErrors.js +1 -1
  109. package/lib/cjs/config/components.js +1 -1
  110. package/lib/cjs/config/currency.js +1 -1
  111. package/lib/cjs/context/AddressChildrenContext.js +1 -1
  112. package/lib/cjs/context/AddressContext.js +1 -1
  113. package/lib/cjs/context/AvailabilityContext.js +1 -1
  114. package/lib/cjs/context/BillingAddressContext.js +1 -1
  115. package/lib/cjs/context/BillingAddressFormContext.js +1 -1
  116. package/lib/cjs/context/CommerceLayerContext.js +1 -1
  117. package/lib/cjs/context/CouponAndGiftCardFormContext.js +1 -1
  118. package/lib/cjs/context/CustomerContext.js +1 -1
  119. package/lib/cjs/context/ExternalFunctionContext.js +1 -1
  120. package/lib/cjs/context/GiftCardContext.js +1 -1
  121. package/lib/cjs/context/ItemContext.js +1 -1
  122. package/lib/cjs/context/LineItemChildrenContext.js +1 -1
  123. package/lib/cjs/context/LineItemContext.js +1 -1
  124. package/lib/cjs/context/LineItemOptionChildrenContext.js +1 -1
  125. package/lib/cjs/context/OrderContext.js +1 -1
  126. package/lib/cjs/context/OrderStorageContext.js +1 -1
  127. package/lib/cjs/context/PaymentMethodChildrenContext.js +1 -1
  128. package/lib/cjs/context/PaymentMethodContext.js +1 -1
  129. package/lib/cjs/context/PaymentSourceContext.js +1 -1
  130. package/lib/cjs/context/PlaceOrderContext.js +1 -1
  131. package/lib/cjs/context/PricesContext.js +1 -1
  132. package/lib/cjs/context/ShipmentChildrenContext.js +1 -1
  133. package/lib/cjs/context/ShipmentContext.js +1 -1
  134. package/lib/cjs/context/ShippingAddressContext.js +1 -1
  135. package/lib/cjs/context/ShippingAddressFormContext.js +1 -1
  136. package/lib/cjs/context/ShippingMethodChildrenContext.js +1 -1
  137. package/lib/cjs/context/SkuListsContext.js +1 -1
  138. package/lib/cjs/context/SkuOptionChildrenContext.js +1 -1
  139. package/lib/cjs/context/SkuOptionsContext.js +1 -1
  140. package/lib/cjs/context/StockTransferChildrenContext.js +1 -1
  141. package/lib/cjs/context/VariantsContext.js +1 -1
  142. package/lib/cjs/index.js +1 -1
  143. package/lib/cjs/reducers/AddressReducer.js +1 -1
  144. package/lib/cjs/reducers/AvailabilityReducer.js +1 -1
  145. package/lib/cjs/reducers/BillingAddressReducer.js +1 -1
  146. package/lib/cjs/reducers/CustomerReducer.js +1 -1
  147. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  148. package/lib/cjs/reducers/ItemReducer.js +1 -1
  149. package/lib/cjs/reducers/LineItemReducer.js +1 -1
  150. package/lib/cjs/reducers/OrderReducer.js +1 -1
  151. package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
  152. package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
  153. package/lib/cjs/reducers/PriceReducer.js +1 -1
  154. package/lib/cjs/reducers/ShipmentReducer.js +1 -1
  155. package/lib/cjs/reducers/ShippingAddressReducer.js +1 -1
  156. package/lib/cjs/reducers/SkuListsReducer.js +1 -1
  157. package/lib/cjs/reducers/SkuOptionsReducer.js +1 -1
  158. package/lib/cjs/reducers/VariantReducer.js +1 -1
  159. package/lib/cjs/typings/errors.js +1 -1
  160. package/lib/cjs/typings/index.js +1 -1
  161. package/lib/cjs/utils/PropsType.js +1 -1
  162. package/lib/cjs/utils/addressesManager.js +1 -1
  163. package/lib/cjs/utils/baseReducer.js +1 -1
  164. package/lib/cjs/utils/browserInfo.js +1 -1
  165. package/lib/cjs/utils/childrenTypes.js +1 -1
  166. package/lib/cjs/utils/countryStateCity.js +1 -1
  167. package/lib/cjs/utils/customMessages.js +1 -1
  168. package/lib/cjs/utils/customerOrderOptions.js +1 -1
  169. package/lib/cjs/utils/getAmount.js +1 -1
  170. package/lib/cjs/utils/getCurrentItemKey.js +1 -1
  171. package/lib/cjs/utils/getErrors.js +1 -1
  172. package/lib/cjs/utils/getLineItemsCount.js +1 -1
  173. package/lib/cjs/utils/getLoaderComponent.js +1 -1
  174. package/lib/cjs/utils/getPrices.js +1 -1
  175. package/lib/cjs/utils/getSdk.js +1 -1
  176. package/lib/cjs/utils/getSkus.js +1 -1
  177. package/lib/cjs/utils/isEmptyStates.js +1 -1
  178. package/lib/cjs/utils/isJSON.js +1 -1
  179. package/lib/cjs/utils/jwt.js +1 -1
  180. package/lib/cjs/utils/localStorage.js +1 -1
  181. package/lib/cjs/utils/organization.js +1 -1
  182. package/lib/cjs/utils/paypalPayment.js +1 -1
  183. package/lib/cjs/utils/promisify.js +1 -1
  184. package/lib/cjs/utils/shipments.js +1 -1
  185. package/lib/cjs/utils/validateFormFields.js +1 -1
  186. package/lib/esm/components/AddToCartButton.js +1 -1
  187. package/lib/esm/components/Address.js +1 -1
  188. package/lib/esm/components/AddressCountrySelector.js +1 -1
  189. package/lib/esm/components/AddressField.js +1 -1
  190. package/lib/esm/components/AddressInput.js +1 -1
  191. package/lib/esm/components/AddressStateSelector.js +1 -1
  192. package/lib/esm/components/AddressesContainer.js +1 -1
  193. package/lib/esm/components/AdyenPayment.js +1 -1
  194. package/lib/esm/components/AvailabilityContainer.js +1 -1
  195. package/lib/esm/components/AvailabilityTemplate.js +1 -1
  196. package/lib/esm/components/BillingAddressContainer.js +1 -1
  197. package/lib/esm/components/BillingAddressForm.js +1 -1
  198. package/lib/esm/components/BraintreePayment.js +1 -1
  199. package/lib/esm/components/CheckoutLink.js +1 -1
  200. package/lib/esm/components/CommerceLayer.js +1 -1
  201. package/lib/esm/components/CustomerContainer.js +1 -1
  202. package/lib/esm/components/CustomerInput.js +1 -1
  203. package/lib/esm/components/DeliveryLeadTime.js +1 -1
  204. package/lib/esm/components/DiscountAmount.js +1 -1
  205. package/lib/esm/components/Errors.js +1 -1
  206. package/lib/esm/components/ExternalFunction.js +1 -1
  207. package/lib/esm/components/GiftCard.js +1 -1
  208. package/lib/esm/components/GiftCardAmount.js +1 -1
  209. package/lib/esm/components/GiftCardContainer.js +1 -1
  210. package/lib/esm/components/GiftCardCurrencySelector.js +1 -1
  211. package/lib/esm/components/GiftCardInput.js +1 -1
  212. package/lib/esm/components/GiftCardOrCouponCode.js +1 -1
  213. package/lib/esm/components/GiftCardOrCouponForm.js +1 -1
  214. package/lib/esm/components/GiftCardOrCouponInput.js +1 -1
  215. package/lib/esm/components/GiftCardOrCouponRemoveButton.js +1 -1
  216. package/lib/esm/components/GiftCardOrCouponSubmit.js +1 -1
  217. package/lib/esm/components/ItemContainer.js +1 -1
  218. package/lib/esm/components/LineItem.js +1 -1
  219. package/lib/esm/components/LineItemAmount.js +1 -1
  220. package/lib/esm/components/LineItemCode.js +1 -1
  221. package/lib/esm/components/LineItemImage.js +1 -1
  222. package/lib/esm/components/LineItemName.js +1 -1
  223. package/lib/esm/components/LineItemOption.js +1 -1
  224. package/lib/esm/components/LineItemOptions.js +1 -1
  225. package/lib/esm/components/LineItemQuantity.js +1 -1
  226. package/lib/esm/components/LineItemRemoveLink.js +1 -1
  227. package/lib/esm/components/LineItemsContainer.js +1 -1
  228. package/lib/esm/components/LineItemsCount.js +1 -1
  229. package/lib/esm/components/MetadataInput.js +1 -1
  230. package/lib/esm/components/OrderContainer.js +1 -1
  231. package/lib/esm/components/OrderNumber.js +1 -1
  232. package/lib/esm/components/OrderStorage.js +1 -1
  233. package/lib/esm/components/PaymentGateway.js +1 -1
  234. package/lib/esm/components/PaymentMethod.js +1 -1
  235. package/lib/esm/components/PaymentMethodAmount.js +1 -1
  236. package/lib/esm/components/PaymentMethodName.js +1 -1
  237. package/lib/esm/components/PaymentMethodPrice.js +1 -1
  238. package/lib/esm/components/PaymentMethodRadioButton.js +1 -1
  239. package/lib/esm/components/PaymentMethodsContainer.js +1 -1
  240. package/lib/esm/components/PaymentSource.js +1 -1
  241. package/lib/esm/components/PaymentSourceBrandIcon.js +1 -1
  242. package/lib/esm/components/PaymentSourceBrandName.js +1 -1
  243. package/lib/esm/components/PaymentSourceDetail.js +1 -1
  244. package/lib/esm/components/PaymentSourceEditButton.js +1 -1
  245. package/lib/esm/components/PaypalPayment.js +1 -1
  246. package/lib/esm/components/PlaceOrderButton.js +1 -1
  247. package/lib/esm/components/PlaceOrderContainer.js +1 -1
  248. package/lib/esm/components/Price.js +1 -1
  249. package/lib/esm/components/PricesContainer.js +1 -1
  250. package/lib/esm/components/PrivacyAndTermsCheckbox.js +1 -1
  251. package/lib/esm/components/QuantitySelector.js +1 -1
  252. package/lib/esm/components/SaveAddressesButton.js +1 -1
  253. package/lib/esm/components/SaveCustomerButton.js +1 -1
  254. package/lib/esm/components/Shipment.js +1 -1
  255. package/lib/esm/components/ShipmentField.js +1 -1
  256. package/lib/esm/components/ShipmentsContainer.js +1 -1
  257. package/lib/esm/components/ShippingAddressContainer.js +1 -1
  258. package/lib/esm/components/ShippingAddressForm.js +1 -1
  259. package/lib/esm/components/ShippingAmount.js +1 -1
  260. package/lib/esm/components/ShippingMethod.js +1 -1
  261. package/lib/esm/components/ShippingMethodName.js +1 -1
  262. package/lib/esm/components/ShippingMethodPrice.js +1 -1
  263. package/lib/esm/components/ShippingMethodRadioButton.js +1 -1
  264. package/lib/esm/components/SkuList.js +1 -1
  265. package/lib/esm/components/SkuListsContainer.js +1 -1
  266. package/lib/esm/components/SkuOption.js +1 -1
  267. package/lib/esm/components/SkuOptionInput.js +1 -1
  268. package/lib/esm/components/SkuOptionsContainer.js +1 -1
  269. package/lib/esm/components/StockTransfer.js +1 -1
  270. package/lib/esm/components/StockTransferField.js +1 -1
  271. package/lib/esm/components/StripePayment.js +1 -1
  272. package/lib/esm/components/SubTotalAmount.js +1 -1
  273. package/lib/esm/components/SubmitButton.js +1 -1
  274. package/lib/esm/components/TaxesAmount.js +1 -1
  275. package/lib/esm/components/TotalAmount.js +1 -1
  276. package/lib/esm/components/VariantSelector.js +1 -1
  277. package/lib/esm/components/VariantsContainer.js +1 -1
  278. package/lib/esm/components/WireTransferPayment.js +1 -1
  279. package/lib/esm/components/gateways/AdyenGateway.js +1 -1
  280. package/lib/esm/components/gateways/BraintreeGateway.js +1 -1
  281. package/lib/esm/components/gateways/PaypalGateway.js +1 -1
  282. package/lib/esm/components/gateways/StripeGateway.js +1 -1
  283. package/lib/esm/components/gateways/WireTransferGateway.js +1 -1
  284. package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
  285. package/lib/esm/components/utils/BaseField.js +1 -1
  286. package/lib/esm/components/utils/BaseInput.js +1 -1
  287. package/lib/esm/components/utils/BaseOrderPrice.js +1 -1
  288. package/lib/esm/components/utils/BaseSelect.js +1 -1
  289. package/lib/esm/components/utils/Parent.js +1 -1
  290. package/lib/esm/components/utils/PaymentCardsTemplate.js +1 -1
  291. package/lib/esm/components/utils/PriceTemplate.js +1 -1
  292. package/lib/esm/components/utils/VariantTemplate.js +1 -1
  293. package/lib/esm/components/utils/getAllErrors.js +1 -1
  294. package/lib/esm/config/components.js +1 -1
  295. package/lib/esm/context/AddressChildrenContext.js +1 -1
  296. package/lib/esm/context/AddressContext.js +1 -1
  297. package/lib/esm/context/AvailabilityContext.js +1 -1
  298. package/lib/esm/context/BillingAddressContext.js +1 -1
  299. package/lib/esm/context/BillingAddressFormContext.js +1 -1
  300. package/lib/esm/context/CommerceLayerContext.js +1 -1
  301. package/lib/esm/context/CouponAndGiftCardFormContext.js +1 -1
  302. package/lib/esm/context/CustomerContext.js +1 -1
  303. package/lib/esm/context/ExternalFunctionContext.js +1 -1
  304. package/lib/esm/context/GiftCardContext.js +1 -1
  305. package/lib/esm/context/ItemContext.js +1 -1
  306. package/lib/esm/context/LineItemChildrenContext.js +1 -1
  307. package/lib/esm/context/LineItemContext.js +1 -1
  308. package/lib/esm/context/LineItemOptionChildrenContext.js +1 -1
  309. package/lib/esm/context/OrderContext.js +1 -1
  310. package/lib/esm/context/OrderStorageContext.js +1 -1
  311. package/lib/esm/context/PaymentMethodChildrenContext.js +1 -1
  312. package/lib/esm/context/PaymentMethodContext.js +1 -1
  313. package/lib/esm/context/PaymentSourceContext.js +1 -1
  314. package/lib/esm/context/PlaceOrderContext.js +1 -1
  315. package/lib/esm/context/PricesContext.js +1 -1
  316. package/lib/esm/context/ShipmentChildrenContext.js +1 -1
  317. package/lib/esm/context/ShipmentContext.js +1 -1
  318. package/lib/esm/context/ShippingAddressContext.js +1 -1
  319. package/lib/esm/context/ShippingAddressFormContext.js +1 -1
  320. package/lib/esm/context/ShippingMethodChildrenContext.js +1 -1
  321. package/lib/esm/context/SkuListsContext.js +1 -1
  322. package/lib/esm/context/SkuOptionChildrenContext.js +1 -1
  323. package/lib/esm/context/SkuOptionsContext.js +1 -1
  324. package/lib/esm/context/StockTransferChildrenContext.js +1 -1
  325. package/lib/esm/context/VariantsContext.js +1 -1
  326. package/lib/esm/reducers/AddressReducer.js +1 -1
  327. package/lib/esm/reducers/AvailabilityReducer.js +1 -1
  328. package/lib/esm/reducers/BillingAddressReducer.js +1 -1
  329. package/lib/esm/reducers/CustomerReducer.js +1 -1
  330. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  331. package/lib/esm/reducers/ItemReducer.js +1 -1
  332. package/lib/esm/reducers/LineItemReducer.js +1 -1
  333. package/lib/esm/reducers/OrderReducer.js +1 -1
  334. package/lib/esm/reducers/PaymentMethodReducer.js +1 -1
  335. package/lib/esm/reducers/PlaceOrderReducer.js +1 -1
  336. package/lib/esm/reducers/PriceReducer.js +1 -1
  337. package/lib/esm/reducers/ShipmentReducer.js +1 -1
  338. package/lib/esm/reducers/ShippingAddressReducer.js +1 -1
  339. package/lib/esm/reducers/SkuListsReducer.js +1 -1
  340. package/lib/esm/reducers/SkuOptionsReducer.js +1 -1
  341. package/lib/esm/reducers/VariantReducer.js +1 -1
  342. package/lib/esm/typings/errors.js +1 -1
  343. package/lib/esm/typings/index.js +1 -1
  344. package/lib/esm/utils/addressesManager.js +1 -1
  345. package/lib/esm/utils/baseReducer.js +1 -1
  346. package/lib/esm/utils/browserInfo.js +1 -1
  347. package/lib/esm/utils/childrenTypes.js +1 -1
  348. package/lib/esm/utils/countryStateCity.js +1 -1
  349. package/lib/esm/utils/customMessages.js +1 -1
  350. package/lib/esm/utils/customerOrderOptions.js +1 -1
  351. package/lib/esm/utils/getAmount.js +1 -1
  352. package/lib/esm/utils/getCurrentItemKey.js +1 -1
  353. package/lib/esm/utils/getErrors.js +1 -1
  354. package/lib/esm/utils/getLineItemsCount.js +1 -1
  355. package/lib/esm/utils/getLoaderComponent.js +1 -1
  356. package/lib/esm/utils/getPrices.js +1 -1
  357. package/lib/esm/utils/getSdk.js +1 -1
  358. package/lib/esm/utils/getSkus.js +1 -1
  359. package/lib/esm/utils/isEmptyStates.js +1 -1
  360. package/lib/esm/utils/isJSON.js +1 -1
  361. package/lib/esm/utils/jwt.js +1 -1
  362. package/lib/esm/utils/localStorage.js +1 -1
  363. package/lib/esm/utils/organization.js +1 -1
  364. package/lib/esm/utils/paypalPayment.js +1 -1
  365. package/lib/esm/utils/promisify.js +1 -1
  366. package/lib/esm/utils/shipments.js +1 -1
  367. package/lib/esm/utils/validateFormFields.js +1 -1
  368. package/package.json +3 -3
@@ -1 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import p from"./utils/BaseOrderPrice";import t from"../config/components";const r=t.PaymentMethodAmount.propTypes,a=t.PaymentMethodAmount.defaultProps,m=t.PaymentMethodAmount.displayName,e=o=>s(p,Object.assign({base:"amount",type:"paymentMethod"},o),void 0);e.propTypes=r,e.defaultProps=a,e.displayName=m;export default e;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.PaymentMethodAmount.propTypes;const defaultProps=components.PaymentMethodAmount.defaultProps;const displayName=components.PaymentMethodAmount.displayName;const PaymentMethodAmount=e=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"paymentMethod"},e),void 0);PaymentMethodAmount.propTypes=propTypes;PaymentMethodAmount.defaultProps=defaultProps;PaymentMethodAmount.displayName=displayName;export default PaymentMethodAmount;
@@ -1 +1 @@
1
- import{jsx as m}from"react/jsx-runtime";import{useContext as s}from"react";import c from"../context/PaymentMethodChildrenContext";import d from"./utils/Parent";import r from"../config/components";const l=r.PaymentMethodName.propTypes,p=r.PaymentMethodName.displayName,o=t=>{const{payment:e}=s(c),n=e==null?void 0:e.name,a=e==null?void 0:e.payment_source_type,i=Object.assign({htmlFor:a,labelName:n},t);return t.children?m(d,Object.assign({},i,{children:t.children}),void 0):m("label",Object.assign({htmlFor:a},t,{children:n}),void 0)};o.propTypes=l,o.displayName=p;export default o;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.PaymentMethodName.propTypes;const displayName=components.PaymentMethodName.displayName;const PaymentMethodName=e=>{const{payment:t}=useContext(PaymentMethodChildrenContext);const o=t===null||t===void 0?void 0:t["name"];const n=t===null||t===void 0?void 0:t.payment_source_type;const m=Object.assign({htmlFor:n,labelName:o},e);return e.children?_jsx(Parent,Object.assign({},m,{children:e.children}),void 0):_jsx("label",Object.assign({htmlFor:n},e,{children:o}),void 0)};PaymentMethodName.propTypes=propTypes;PaymentMethodName.displayName=displayName;export default PaymentMethodName;
@@ -1 +1 @@
1
- import{__rest as b}from"tslib";import{jsx as p}from"react/jsx-runtime";import{useState as d,useEffect as j,useContext as x}from"react";import l from"../utils/getAmount";import C from"../context/PaymentMethodChildrenContext";import g from"./utils/Parent";import f from"../config/components";const M=f.PaymentMethodPrice.propTypes,F=f.PaymentMethodPrice.displayName,o=e=>{const{format:y="formatted",type:r="amount",labelFree:n="Free"}=e,s=b(e,["format","type","labelFree"]),{payment:t}=x(C),[i,c]=d(""),[a,m]=d(0);j(()=>{if(t){const u=l({base:"price",type:r,format:y,obj:t});c(u);const h=l({base:"price",type:r,format:"cents",obj:t});m(h)}return()=>{c(""),m(0)}},[t]);const P=Object.assign({labelFree:n,price:i,priceCents:a},s);return e.children?p(g,Object.assign({},P,{children:e.children}),void 0):p("span",Object.assign({},s,{children:a===0?n:i}),void 0)};o.propTypes=M,o.displayName=F;export default o;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.PaymentMethodPrice.propTypes;const displayName=components.PaymentMethodPrice.displayName;const PaymentMethodPrice=e=>{const{format:t="formatted",type:o="amount",labelFree:n="Free"}=e,r=__rest(e,["format","type","labelFree"]);const{payment:s}=useContext(PaymentMethodChildrenContext);const[a,m]=useState("");const[i,c]=useState(0);useEffect((()=>{if(s){const e=getAmount({base:"price",type:o,format:t,obj:s});m(e);const n=getAmount({base:"price",type:o,format:"cents",obj:s});c(n)}return()=>{m("");c(0)}}),[s]);const p=Object.assign({labelFree:n,price:a,priceCents:i},r);return e.children?_jsx(Parent,Object.assign({},p,{children:e.children}),void 0):_jsx("span",Object.assign({},r,{children:i===0?n:a}),void 0)};PaymentMethodPrice.propTypes=propTypes;PaymentMethodPrice.displayName=displayName;export default PaymentMethodPrice;
@@ -1 +1 @@
1
- import{__rest as _}from"tslib";import{jsx as l}from"react/jsx-runtime";import{useContext as n}from"react";import j from"../context/PaymentMethodChildrenContext";import O from"./utils/Parent";import y from"../config/components";import b from"../context/PaymentMethodContext";import R from"../context/OrderContext";const k=y.PaymentMethodRadioButton.propTypes,B=y.PaymentMethodRadioButton.displayName,a=e=>{const{onChange:d}=e,h=_(e,["onChange"]),{payment:t,paymentSelected:u,setPaymentSelected:i,clickableContainer:x}=n(j),{order:o}=n(R),{setPaymentMethod:C,setLoading:r}=n(b),P=(o==null?void 0:o.id)||"",g=t==null?void 0:t.payment_source_type,s=t==null?void 0:t.id,v=`payment-${P}`,c=u===(t==null?void 0:t.id),m=async M=>{M.stopPropagation(),i&&i(s),r({loading:!0}),!x&&await C({paymentResource:g,paymentMethodId:s}),d&&d(t),r({loading:!1})},p=t==null?void 0:t.payment_source_type,f=Object.assign({handleOnChange:m,checked:c,id:p,name:v},e);return e.children?l(O,Object.assign({},f,{children:e.children}),void 0):l("input",Object.assign({type:"radio",id:p,onChange:m,checked:c},h),void 0)};a.propTypes=k,a.displayName=B;export default a;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import PaymentMethodContext from"../context/PaymentMethodContext";import OrderContext from"../context/OrderContext";const propTypes=components.PaymentMethodRadioButton.propTypes;const displayName=components.PaymentMethodRadioButton.displayName;const PaymentMethodRadioButton=t=>{const{onChange:e}=t,o=__rest(t,["onChange"]);const{payment:n,paymentSelected:a,setPaymentSelected:d,clickableContainer:i}=useContext(PaymentMethodChildrenContext);const{order:s}=useContext(OrderContext);const{setPaymentMethod:r,setLoading:m}=useContext(PaymentMethodContext);const c=(s===null||s===void 0?void 0:s.id)||"";const p=n===null||n===void 0?void 0:n.payment_source_type;const y=n===null||n===void 0?void 0:n.id;const l=`payment-${c}`;const h=a===(n===null||n===void 0?void 0:n.id);const u=async t=>{t.stopPropagation();d&&d(y);m({loading:true});!i&&await r({paymentResource:p,paymentMethodId:y});e&&e(n);m({loading:false})};const x=n===null||n===void 0?void 0:n.payment_source_type;const C=Object.assign({handleOnChange:u,checked:h,id:x,name:l},t);return t.children?_jsx(Parent,Object.assign({},C,{children:t.children}),void 0):_jsx("input",Object.assign({type:"radio",id:x,onChange:u,checked:h},o),void 0)};PaymentMethodRadioButton.propTypes=propTypes;PaymentMethodRadioButton.displayName=displayName;export default PaymentMethodRadioButton;
@@ -1 +1 @@
1
- import{jsx as P}from"react/jsx-runtime";import M,{defaultPaymentMethodContext as s}from"../context/PaymentMethodContext";import{useContext as i,useEffect as O,useReducer as x,useMemo as j}from"react";import b,{paymentMethodInitialState as C,getPaymentMethods as v,setPaymentMethodConfig as S}from"../reducers/PaymentMethodReducer";import _ from"../context/OrderContext";import R from"../context/CommerceLayerContext";import y from"../config/components";import{isEmpty as E}from"lodash";import{setPaymentRef as L}from"../reducers/PaymentMethodReducer";const T=y.PaymentMethodsContainer.propTypes,N=y.PaymentMethodsContainer.displayName,c=p=>{const{children:u,config:m}=p,[a,o]=x(b,C),{order:t,getOrder:f,setOrderErrors:l,include:r,addResourceToInclude:g,updateOrder:d}=i(_),n=i(R);O(()=>{(r==null?void 0:r.includes("available_payment_methods"))||g({newResource:["available_payment_methods","payment_source","payment_method"]}),m&&E(a.config)&&S(m,o),n&&t&&!a.paymentMethods&&v({order:t,dispatch:o}),n&&(t==null?void 0:t.payment_source)&&o({type:"setPaymentSource",payload:{paymentSource:t==null?void 0:t.payment_source}})},[t,n]);const h=j(()=>Object.assign(Object.assign({},a),{setLoading:({loading:e})=>s.setLoading({loading:e,dispatch:o}),setPaymentRef:({ref:e})=>L({ref:e,dispatch:o}),setPaymentMethodErrors:e=>s.setPaymentMethodErrors(e,o),setPaymentMethod:async e=>await s.setPaymentMethod(Object.assign(Object.assign({},e),{config:n,updateOrder:d,order:t,dispatch:o,setOrderErrors:l})),setPaymentSource:async e=>s.setPaymentSource(Object.assign(Object.assign(Object.assign({},a),e),{config:n,dispatch:o,getOrder:f,updateOrder:d,order:t})),updatePaymentSource:async e=>s.updatePaymentSource(Object.assign(Object.assign({},e),{config:n,dispatch:o})),destroyPaymentSource:async e=>s.destroyPaymentSource(Object.assign(Object.assign({},e),{dispatch:o,config:n}))}),[a]);return P(M.Provider,Object.assign({value:h},{children:u}),void 0)};c.propTypes=T,c.displayName=N;export default c;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext,{defaultPaymentMethodContext}from"../context/PaymentMethodContext";import{useContext,useEffect,useReducer,useMemo}from"react";import paymentMethodReducer,{paymentMethodInitialState,getPaymentMethods,setPaymentMethodConfig}from"../reducers/PaymentMethodReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";import{setPaymentRef}from"../reducers/PaymentMethodReducer";const propTypes=components.PaymentMethodsContainer.propTypes;const displayName=components.PaymentMethodsContainer.displayName;const PaymentMethodsContainer=e=>{const{children:t,config:o}=e;const[n,a]=useReducer(paymentMethodReducer,paymentMethodInitialState);const{order:s,getOrder:r,setOrderErrors:d,include:m,addResourceToInclude:c,updateOrder:i}=useContext(OrderContext);const y=useContext(CommerceLayerContext);useEffect((()=>{if(!(m===null||m===void 0?void 0:m.includes("available_payment_methods"))){c({newResource:["available_payment_methods","payment_source","payment_method"]})}if(o&&isEmpty(n.config))setPaymentMethodConfig(o,a);if(y&&s&&!n.paymentMethods){getPaymentMethods({order:s,dispatch:a})}if(y&&(s===null||s===void 0?void 0:s.payment_source)){a({type:"setPaymentSource",payload:{paymentSource:s===null||s===void 0?void 0:s.payment_source}})}}),[s,y]);const p=useMemo((()=>Object.assign(Object.assign({},n),{setLoading:({loading:e})=>defaultPaymentMethodContext["setLoading"]({loading:e,dispatch:a}),setPaymentRef:({ref:e})=>setPaymentRef({ref:e,dispatch:a}),setPaymentMethodErrors:e=>defaultPaymentMethodContext["setPaymentMethodErrors"](e,a),setPaymentMethod:async e=>await defaultPaymentMethodContext["setPaymentMethod"](Object.assign(Object.assign({},e),{config:y,updateOrder:i,order:s,dispatch:a,setOrderErrors:d})),setPaymentSource:async e=>defaultPaymentMethodContext["setPaymentSource"](Object.assign(Object.assign(Object.assign({},n),e),{config:y,dispatch:a,getOrder:r,updateOrder:i,order:s})),updatePaymentSource:async e=>defaultPaymentMethodContext["updatePaymentSource"](Object.assign(Object.assign({},e),{config:y,dispatch:a})),destroyPaymentSource:async e=>defaultPaymentMethodContext["destroyPaymentSource"](Object.assign(Object.assign({},e),{dispatch:a,config:y}))})),[n]);return _jsx(PaymentMethodContext.Provider,Object.assign({value:p},{children:t}),void 0)};PaymentMethodsContainer.propTypes=propTypes;PaymentMethodsContainer.displayName=displayName;export default PaymentMethodsContainer;
@@ -1 +1 @@
1
- import{jsx as w}from"react/jsx-runtime";import{useContext as p,useState as h,useEffect as M}from"react";import j from"../context/PaymentMethodChildrenContext";import C from"../config/components";import E from"../context/PaymentMethodContext";import R from"lodash/isEmpty";import N from"../context/CustomerContext";import O from"./PaymentGateway";const T=C.PaymentSource.propTypes,q=C.PaymentSource.displayName,c=y=>{const{readonly:d}=y,{payment:t}=p(j),{payments:x}=p(N),{currentPaymentMethodId:v,paymentSource:o,destroyPaymentSource:P}=p(E),[S,e]=h(!1),[f,a]=h(!1);M(()=>{var n,s,i,r,l,m,u;if(d)e(!0),a(!0);else if((t==null?void 0:t.id)===v){e(!0),console.log("paymentSource",o);const b=((n=o==null?void 0:o.options)===null||n===void 0?void 0:n.card)||((s=o==null?void 0:o.metadata)===null||s===void 0?void 0:s.card)||((r=(i=o==null?void 0:o.paymentRequestData)===null||i===void 0?void 0:i.paymentMethod)===null||r===void 0?void 0:r.brand)&&((l=o==null?void 0:o.paymentResponse)===null||l===void 0?void 0:l.resultCode)==="Authorised"&&{brand:(u=(m=o==null?void 0:o.paymentRequestData)===null||m===void 0?void 0:m.paymentMethod)===null||u===void 0?void 0:u.brand};R(b)||a(!0)}else e(!1);return()=>{e(!1),a(!1)}},[v,o,x,t,d]);const _=n=>{n.stopPropagation(),o&&P({paymentSourceId:o==null?void 0:o.id,paymentResource:t==null?void 0:t.payment_source_type}),a(!f),e(!0)},g=Object.assign(Object.assign({},y),{show:S,showCard:f,handleEditClick:_,readonly:d});return w(O,Object.assign({},g),void 0)};c.propTypes=T,c.displayName=q;export default c;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";import components from"../config/components";import PaymentMethodContext from"../context/PaymentMethodContext";import isEmpty from"lodash/isEmpty";import CustomerContext from"../context/CustomerContext";import PaymentGateway from"./PaymentGateway";const propTypes=components.PaymentSource.propTypes;const displayName=components.PaymentSource.displayName;const PaymentSource=e=>{const{readonly:t}=e;const{payment:o}=useContext(PaymentMethodChildrenContext);const{payments:n}=useContext(CustomerContext);const{currentPaymentMethodId:a,paymentSource:s,destroyPaymentSource:d}=useContext(PaymentMethodContext);const[r,i]=useState(false);const[m,l]=useState(false);useEffect((()=>{var e,n,d,r,m,u,p;if(t){i(true);l(true)}else if((o===null||o===void 0?void 0:o.id)===a){i(true);console.log(`paymentSource`,s);const t=((e=s===null||s===void 0?void 0:s.options)===null||e===void 0?void 0:e.card)||((n=s===null||s===void 0?void 0:s.metadata)===null||n===void 0?void 0:n.card)||((r=(d=s===null||s===void 0?void 0:s.paymentRequestData)===null||d===void 0?void 0:d.paymentMethod)===null||r===void 0?void 0:r.brand)&&((m=s===null||s===void 0?void 0:s.paymentResponse)===null||m===void 0?void 0:m.resultCode)==="Authorised"&&{brand:(p=(u=s===null||s===void 0?void 0:s.paymentRequestData)===null||u===void 0?void 0:u.paymentMethod)===null||p===void 0?void 0:p.brand};if(!isEmpty(t))l(true)}else i(false);return()=>{i(false);l(false)}}),[a,s,n,o,t]);const u=e=>{e.stopPropagation();s&&d({paymentSourceId:s===null||s===void 0?void 0:s.id,paymentResource:o===null||o===void 0?void 0:o.payment_source_type});l(!m);i(true)};const p=Object.assign(Object.assign({},e),{show:r,showCard:m,handleEditClick:u,readonly:t});return _jsx(PaymentGateway,Object.assign({},p),void 0)};PaymentSource.propTypes=propTypes;PaymentSource.displayName=displayName;export default PaymentSource;
@@ -1 +1 @@
1
- import{__rest as f}from"tslib";import{jsx as p}from"react/jsx-runtime";import y from"../context/PaymentSourceContext";import{useContext as g,useRef as x}from"react";import P from"./utils/Parent";import d from"../config/components";const h=d.PaymentSourceBrandIcon.propTypes,j=d.PaymentSourceBrandIcon.displayName,e=t=>{var{src:o,width:s=32,children:c}=t,n=f(t,["src","width","children"]);const{brand:a}=g(y),r=x(null),i="//data.commercelayer.app/assets/images/icons/credit-cards/color/credit-card.svg",m=o||`//data.commercelayer.app/assets/images/icons/credit-cards/color/${a}.svg`,l=()=>{r.current&&(r.current.src=i)},u=Object.assign({brand:a,defaultSrc:i,url:m,width:s},n);return c?p(P,Object.assign({},u,{children:c}),void 0):p("img",Object.assign({ref:r,src:m,onError:l,width:s},n),void 0)};e.propTypes=h,e.displayName=j;export default e;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentSourceContext from"../context/PaymentSourceContext";import{useContext,useRef}from"react";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.PaymentSourceBrandIcon.propTypes;const displayName=components.PaymentSourceBrandIcon.displayName;const PaymentSourceBrandIcon=e=>{var{src:r,width:t=32,children:o}=e,n=__rest(e,["src","width","children"]);const{brand:c}=useContext(PaymentSourceContext);const s=useRef(null);const a="//data.commercelayer.app/assets/images/icons/credit-cards/color/credit-card.svg";const m=r?r:`//data.commercelayer.app/assets/images/icons/credit-cards/color/${c}.svg`;const i=()=>{if(s.current)s.current.src=a};const d=Object.assign({brand:c,defaultSrc:a,url:m,width:t},n);return o?_jsx(Parent,Object.assign({},d,{children:o}),void 0):_jsx("img",Object.assign({ref:s,src:m,onError:i,width:t},n),void 0)};PaymentSourceBrandIcon.propTypes=propTypes;PaymentSourceBrandIcon.displayName=displayName;export default PaymentSourceBrandIcon;
@@ -1 +1 @@
1
- import{__rest as d}from"tslib";import{jsx as m}from"react/jsx-runtime";import l from"../context/PaymentSourceContext";import{capitalize as p}from"lodash";import{useContext as y}from"react";import u from"./utils/Parent";import c from"../config/components";const b=c.PaymentSourceBrandName.propTypes,f=c.PaymentSourceBrandName.displayName,e=r=>{var{children:t,label:o}=r,n=d(r,["children","label"]);const{brand:a}=y(l),s=a&&p(a.replace("-"," ")),i=Object.assign({brand:s,label:o},n);return t?m(u,Object.assign({},i,{children:t}),void 0):m("span",Object.assign({},n,{children:o||p(s)}),void 0)};e.propTypes=b,e.displayName=f;export default e;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentSourceContext from"../context/PaymentSourceContext";import{capitalize}from"lodash";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.PaymentSourceBrandName.propTypes;const displayName=components.PaymentSourceBrandName.displayName;const PaymentSourceBrandName=e=>{var{children:t,label:a}=e,o=__rest(e,["children","label"]);const{brand:r}=useContext(PaymentSourceContext);const n=r&&capitalize(r.replace("-"," "));const m=Object.assign({brand:n,label:a},o);return t?_jsx(Parent,Object.assign({},m,{children:t}),void 0):_jsx("span",Object.assign({},o,{children:a||capitalize(n)}),void 0)};PaymentSourceBrandName.propTypes=propTypes;PaymentSourceBrandName.displayName=displayName;export default PaymentSourceBrandName;
@@ -1 +1 @@
1
- import{__rest as m}from"tslib";import{jsx as p}from"react/jsx-runtime";import i from"../config/components";import l from"../context/PaymentSourceContext";import{has as y}from"lodash";import{useContext as d}from"react";import u from"./utils/Parent";const f=i.PaymentSourceDetail.propTypes,x=i.PaymentSourceDetail.displayName,e=o=>{var{type:t,children:r}=o,n=m(o,["type","children"]);const s=d(l),a=y(s,t)?s[t]:t==="last4"?"****":"**",c=Object.assign({type:t,text:a},n);return r?p(u,Object.assign({},c,{children:r}),void 0):p("span",Object.assign({},n,{children:a}),void 0)};e.propTypes=f,e.displayName=x;export default e;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import components from"../config/components";import PaymentSourceContext from"../context/PaymentSourceContext";import{has}from"lodash";import{useContext}from"react";import Parent from"./utils/Parent";const propTypes=components.PaymentSourceDetail.propTypes;const displayName=components.PaymentSourceDetail.displayName;const PaymentSourceDetail=e=>{var{type:t,children:o}=e,n=__rest(e,["type","children"]);const r=useContext(PaymentSourceContext);const s=has(r,t)?r[t]:t==="last4"?"****":"**";const a=Object.assign({type:t,text:s},n);return o?_jsx(Parent,Object.assign({},a,{children:o}),void 0):_jsx("span",Object.assign({},n,{children:s}),void 0)};PaymentSourceDetail.propTypes=propTypes;PaymentSourceDetail.displayName=displayName;export default PaymentSourceDetail;
@@ -1 +1 @@
1
- import{__rest as l}from"tslib";import{jsx as i}from"react/jsx-runtime";import d from"../context/PaymentSourceContext";import{useContext as u}from"react";import y from"./utils/Parent";import a from"../config/components";const f=a.PaymentSourceEditButton.displayName,x=a.PaymentSourceEditButton.propTypes,t=o=>{var{children:e,label:n="Edit"}=o,r=l(o,["children","label"]);const{showCard:c,handleEditClick:s,readonly:p}=u(d),m=Object.assign({showCard:c,label:n,handleEditClick:s},r);return e?i(y,Object.assign({},m,{children:e}),void 0):p?null:i("button",Object.assign({},r,{onClick:s},{children:n}),void 0)};t.propTypes=x,t.displayName=f;export default t;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentSourceContext from"../context/PaymentSourceContext";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";const displayName=components.PaymentSourceEditButton.displayName;const propTypes=components.PaymentSourceEditButton.propTypes;const PaymentSourceEditButton=t=>{var{children:e,label:o="Edit"}=t,n=__rest(t,["children","label"]);const{showCard:r,handleEditClick:s,readonly:a}=useContext(PaymentSourceContext);const i=Object.assign({showCard:r,label:o,handleEditClick:s},n);return e?_jsx(Parent,Object.assign({},i,{children:e}),void 0):!a?_jsx("button",Object.assign({},n,{onClick:s},{children:o}),void 0):null};PaymentSourceEditButton.propTypes=propTypes;PaymentSourceEditButton.displayName=displayName;export default PaymentSourceEditButton;
@@ -1 +1 @@
1
- import{__rest as c}from"tslib";import{jsx as o}from"react/jsx-runtime";import u from"../context/PaymentMethodContext";import m from"lodash/isFunction";import{useContext as f,useEffect as p,useRef as y}from"react";const v="by placing the order, you will be redirected to the PayPal website to sign in and authorize the payment",h=a=>{var{infoMessage:e}=a,s=c(a,["infoMessage"]);const n=y(null),{setPaymentSource:l,paymentSource:t,currentPaymentMethodType:r,setPaymentRef:i}=f(u);p(()=>(n.current&&t&&r&&(t==null?void 0:t.approvalUrl)&&(n.current.onsubmit=()=>d(),i({ref:n})),()=>{i({ref:{current:null}})}),[n,t,r]);const d=async()=>{if(t&&r)try{return await l({paymentSourceId:t.id,paymentResource:r,attributes:{metadata:{card:{id:t.id,brand:"paypal",last4:""}}}}),!0}catch{return!1}return!1};return o("form",Object.assign({ref:n},{children:o("div",Object.assign({},s,{children:o("span",Object.assign({className:e==null?void 0:e.className},{children:m(e==null?void 0:e.text)?e==null?void 0:e.text():(e==null?void 0:e.text)||v}),void 0)}),void 0)}),void 0)};export default h;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext from"../context/PaymentMethodContext";import isFunction from"lodash/isFunction";import{useContext,useEffect,useRef}from"react";const defaultMessage="by placing the order, you will be redirected to the PayPal website to sign in and authorize the payment";const PaypalPayment=e=>{var{infoMessage:t}=e,n=__rest(e,["infoMessage"]);const a=useRef(null);const{setPaymentSource:r,paymentSource:o,currentPaymentMethodType:s,setPaymentRef:i}=useContext(PaymentMethodContext);useEffect((()=>{if(a.current&&o&&s&&(o===null||o===void 0?void 0:o.approvalUrl)){a.current.onsubmit=()=>u();i({ref:a})}return()=>{i({ref:{current:null}})}}),[a,o,s]);const u=async()=>{if(o&&s){try{await r({paymentSourceId:o.id,paymentResource:s,attributes:{metadata:{card:{id:o.id,brand:"paypal",last4:""}}}});return true}catch(e){return false}}return false};return _jsx("form",Object.assign({ref:a},{children:_jsx("div",Object.assign({},n,{children:_jsx("span",Object.assign({className:t===null||t===void 0?void 0:t.className},{children:isFunction(t===null||t===void 0?void 0:t.text)?t===null||t===void 0?void 0:t.text():(t===null||t===void 0?void 0:t.text)||defaultMessage}),void 0)}),void 0)}),void 0)};export default PaypalPayment;
@@ -1 +1 @@
1
- import{__rest as I}from"tslib";import{jsx as k}from"react/jsx-runtime";import{useContext as P,useEffect as S,useState as M}from"react";import D from"./utils/Parent";import b from"../config/components";import A from"../context/PlaceOrderContext";import E from"lodash/isFunction";import R from"../context/PaymentMethodContext";import V from"../context/OrderContext";const q=b.PlaceOrderButton.propTypes,z=b.PlaceOrderButton.defaultProps,G=b.PlaceOrderButton.displayName,c=_=>{var p;const{children:x,label:a="Place order",disabled:v,onClick:O}=_,h=I(_,["children","label","disabled","onClick"]),{isPermitted:C,setPlaceOrder:j,options:o,paymentType:m}=P(A),[N,s]=M(!0),[w,g]=M(v),{currentPaymentMethodRef:e,paymentSource:t,loading:f,currentPaymentMethodType:B}=P(R),{order:u}=P(V);S(()=>{var i,n,d,r,l;return f?s(f):m===B?((u==null?void 0:u.total_amount_with_taxes_cents)===0||((i=e==null?void 0:e.current)===null||i===void 0?void 0:i.onsubmit)||((d=(n=t==null?void 0:t.metadata)===null||n===void 0?void 0:n.card)===null||d===void 0?void 0:d.id)||((r=t==null?void 0:t.options)===null||r===void 0?void 0:r.id)||((l=t==null?void 0:t.payment_response)===null||l===void 0?void 0:l.resultCode)==="Authorised")&&C&&s(!1):s(!0),m==="paypal_payments"&&(o==null?void 0:o.paypalPayerId)&&y(),()=>{s(!0)}},[C,o==null?void 0:o.paypalPayerId,m,(p=e==null?void 0:e.current)===null||p===void 0?void 0:p.onsubmit,t,f,B,u]);const y=async()=>{var i,n,d;let r=!0;g(!0),((i=e==null?void 0:e.current)===null||i===void 0?void 0:i.onsubmit)&&!(o==null?void 0:o.paypalPayerId)?r=await((n=e.current)===null||n===void 0?void 0:n.onsubmit()):((d=t==null?void 0:t.options)===null||d===void 0?void 0:d.id)&&(r=!0);const l=r&&j&&await j({paymentSource:t});g(!1),O&&l&&O(l)},T=v!==void 0?v:N,F=Object.assign(Object.assign({},h),{label:a,disabled:T,handleClick:y});return x?k(D,Object.assign({},F,{children:x}),void 0):k("button",Object.assign({type:"button",disabled:T||w,onClick:y},h,{children:E(a)?a():a}),void 0)};c.propTypes=q,c.defaultProps=z,c.displayName=G;export default c;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import Parent from"./utils/Parent";import components from"../config/components";import PlaceOrderContext from"../context/PlaceOrderContext";import isFunction from"lodash/isFunction";import PaymentMethodContext from"../context/PaymentMethodContext";import OrderContext from"../context/OrderContext";const propTypes=components.PlaceOrderButton.propTypes;const defaultProps=components.PlaceOrderButton.defaultProps;const displayName=components.PlaceOrderButton.displayName;const PlaceOrderButton=t=>{var e;const{children:o,label:n="Place order",disabled:r,onClick:i}=t,d=__rest(t,["children","label","disabled","onClick"]);const{isPermitted:l,setPlaceOrder:s,options:a,paymentType:u}=useContext(PlaceOrderContext);const[c,p]=useState(true);const[m,v]=useState(r);const{currentPaymentMethodRef:f,paymentSource:y,loading:P,currentPaymentMethodType:x}=useContext(PaymentMethodContext);const{order:O}=useContext(OrderContext);useEffect((()=>{var t,e,o,n,r;if(P)p(P);else{if(u===x){if(((O===null||O===void 0?void 0:O.total_amount_with_taxes_cents)===0||((t=f===null||f===void 0?void 0:f.current)===null||t===void 0?void 0:t.onsubmit)||((o=(e=y===null||y===void 0?void 0:y.metadata)===null||e===void 0?void 0:e.card)===null||o===void 0?void 0:o.id)||((n=y===null||y===void 0?void 0:y.options)===null||n===void 0?void 0:n.id)||((r=y===null||y===void 0?void 0:y.payment_response)===null||r===void 0?void 0:r.resultCode)==="Authorised")&&l){p(false)}}else{p(true)}}if(u==="paypal_payments"&&(a===null||a===void 0?void 0:a.paypalPayerId)){b()}return()=>{p(true)}}),[l,a===null||a===void 0?void 0:a.paypalPayerId,u,(e=f===null||f===void 0?void 0:f.current)===null||e===void 0?void 0:e.onsubmit,y,P,x,O]);const b=async()=>{var t,e,o;let n=true;v(true);if(((t=f===null||f===void 0?void 0:f.current)===null||t===void 0?void 0:t.onsubmit)&&!(a===null||a===void 0?void 0:a.paypalPayerId)){n=await((e=f.current)===null||e===void 0?void 0:e.onsubmit())}else if((o=y===null||y===void 0?void 0:y.options)===null||o===void 0?void 0:o.id){n=true}const r=n&&s&&await s({paymentSource:y});v(false);i&&r&&i(r)};const C=r!==undefined?r:c;const h=Object.assign(Object.assign({},d),{label:n,disabled:C,handleClick:b});return o?_jsx(Parent,Object.assign({},h,{children:o}),void 0):_jsx("button",Object.assign({type:"button",disabled:C||m,onClick:b},d,{children:isFunction(n)?n():n}),void 0)};PlaceOrderButton.propTypes=propTypes;PlaceOrderButton.defaultProps=defaultProps;PlaceOrderButton.displayName=displayName;export default PlaceOrderButton;
@@ -1 +1 @@
1
- import{jsx as x}from"react/jsx-runtime";import g from"../context/PlaceOrderContext";import{useContext as d,useEffect as C,useReducer as P}from"react";import h,{placeOrderInitialState as v,placeOrderPermitted as a}from"../reducers/PlaceOrderReducer";import j from"../context/OrderContext";import y from"../context/CommerceLayerContext";import p from"../config/components";import{setPlaceOrder as R}from"../reducers/PlaceOrderReducer";const b=p.PlaceOrderContainer.propTypes,_=p.PlaceOrderContainer.displayName,s=l=>{const{children:m,options:n}=l,[i,c]=P(h,v),{order:r,setOrderErrors:u,include:e,addResourceToInclude:t}=d(j),o=d(y);C(()=>{(e==null?void 0:e.includes("shipments.shipping_method"))||t({newResource:"shipments.shipping_method"}),(e==null?void 0:e.includes("billing_address"))||t({newResource:"billing_address"}),(e==null?void 0:e.includes("shipping_address"))||t({newResource:"shipping_address"}),r&&a({config:o,dispatch:c,order:r,options:Object.assign({},n)})},[r,e]);const O=Object.assign(Object.assign({},i),{setPlaceOrder:({paymentSource:f})=>R({config:o,order:r,state:i,setOrderErrors:u,paymentSource:f}),placeOrderPermitted:()=>a({config:o,dispatch:c,order:r,options:Object.assign({},n)})});return x(g.Provider,Object.assign({value:O},{children:m}),void 0)};s.propTypes=b,s.displayName=_;export default s;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import PlaceOrderContext from"../context/PlaceOrderContext";import{useContext,useEffect,useReducer}from"react";import placeOrderReducer,{placeOrderInitialState,placeOrderPermitted}from"../reducers/PlaceOrderReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{setPlaceOrder}from"../reducers/PlaceOrderReducer";const propTypes=components.PlaceOrderContainer.propTypes;const displayName=components.PlaceOrderContainer.displayName;const PlaceOrderContainer=e=>{const{children:r,options:t}=e;const[o,n]=useReducer(placeOrderReducer,placeOrderInitialState);const{order:s,setOrderErrors:d,include:c,addResourceToInclude:i}=useContext(OrderContext);const a=useContext(CommerceLayerContext);useEffect((()=>{if(!(c===null||c===void 0?void 0:c.includes("shipments.shipping_method"))){i({newResource:"shipments.shipping_method"})}if(!(c===null||c===void 0?void 0:c.includes("billing_address"))){i({newResource:"billing_address"})}if(!(c===null||c===void 0?void 0:c.includes("shipping_address"))){i({newResource:"shipping_address"})}if(s){placeOrderPermitted({config:a,dispatch:n,order:s,options:Object.assign({},t)})}}),[s,c]);const p=Object.assign(Object.assign({},o),{setPlaceOrder:({paymentSource:e})=>setPlaceOrder({config:a,order:s,state:o,setOrderErrors:d,paymentSource:e}),placeOrderPermitted:()=>placeOrderPermitted({config:a,dispatch:n,order:s,options:Object.assign({},t)})});return _jsx(PlaceOrderContext.Provider,Object.assign({value:p},{children:r}),void 0)};PlaceOrderContainer.propTypes=propTypes;PlaceOrderContainer.displayName=displayName;export default PlaceOrderContainer;
@@ -1 +1 @@
1
- import{jsx as f}from"react/jsx-runtime";import{Fragment as g,useState as k,useEffect as y,useContext as h}from"react";import{isEmpty as t,has as j,indexOf as S}from"lodash";import N from"./utils/Parent";import O from"../context/PricesContext";import{getPricesComponent as T}from"../utils/getPrices";import n from"../config/components";const b=n.Price.propTypes,v=n.Price.defaultProps,E=n.Price.displayName,o=r=>{const{children:c,skuCode:P=""}=r,{prices:s,skuCode:C,loading:p,skuCodes:i,setSkuCodes:a,loader:m}=h(O),[d,u]=k([]),e=C||P;y(()=>(!t(s)&&j(s,`${e}`)?u(s[e]):e&&S(i,e)===-1&&(i.push(e),a&&a(i)),()=>{u([])}),[s,e]);const x=Object.assign({loading:p,loader:m},r),l=t(s)||t(d)?null:T(d,r);return c?f(N,Object.assign({},x,{children:c}),void 0):f(g,{children:p||t(l)?m:l},void 0)};o.propTypes=b,o.defaultProps=v,o.displayName=E;export default o;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useState,useEffect,useContext}from"react";import{isEmpty,has,indexOf}from"lodash";import Parent from"./utils/Parent";import PricesContext from"../context/PricesContext";import{getPricesComponent}from"../utils/getPrices";import components from"../config/components";const propTypes=components.Price.propTypes;const defaultProps=components.Price.defaultProps;const displayName=components.Price.displayName;const Price=e=>{const{children:t,skuCode:s=""}=e;const{prices:o,skuCode:r,loading:n,skuCodes:i,setSkuCodes:p,loader:c}=useContext(PricesContext);const[m,a]=useState([]);const d=r||s;useEffect((()=>{if(!isEmpty(o)&&has(o,`${d}`)){a(o[d])}else{if(d&&indexOf(i,d)===-1){i.push(d);p&&p(i)}}return()=>{a([])}}),[o,d]);const l=Object.assign({loading:n,loader:c},e);const u=isEmpty(o)||isEmpty(m)?null:getPricesComponent(m,e);return t?_jsx(Parent,Object.assign({},l,{children:t}),void 0):_jsx(Fragment,{children:n||isEmpty(u)?c:u},void 0)};Price.propTypes=propTypes;Price.defaultProps=defaultProps;Price.displayName=displayName;export default Price;
@@ -1 +1 @@
1
- import{jsx as I}from"react/jsx-runtime";import{useEffect as S,useContext as u,useReducer as T}from"react";import O from"../utils/getPrices";import{isEmpty as n,indexOf as R,has as f}from"lodash";import b from"../context/CommerceLayerContext";import v,{unsetPriceState as L}from"../reducers/PriceReducer";import{priceInitialState as N,getSkusPrice as E}from"../reducers/PriceReducer";import K from"../context/PricesContext";import V from"../utils/getCurrentItemKey";import _ from"../context/ItemContext";import m from"../config/components";const q=m.PricesContainer.propTypes,w=m.PricesContainer.defaultProps,z=m.PricesContainer.displayName,p=C=>{const{children:l,skuCode:s="",loader:P="Loading...",perPage:y=10,filters:x={}}=C,[r,o]=T(v,N),i=u(b),{setPrices:k,prices:c,items:d,item:e,skuCode:g}=u(_);R(r.skuCodes,s)===-1&&s&&r.skuCodes.push(s);const t=V(e)||s||g||"",h=a=>{o({type:"setSkuCodes",payload:{skuCodes:a}})};S(()=>{if(e&&f(c,t)&&o({type:"setPrices",payload:{prices:c}}),!n(d)&&n(e)){const a=O(d);o({type:"setPrices",payload:{prices:a}})}return(i.accessToken&&n(e)||i.accessToken&&!f(c,t))&&(r.skuCodes.length>0||s)&&E(t&&[t]||r.skuCodes,{config:i,dispatch:o,setPrices:k,prices:c,perPage:y,filters:x}),()=>{n(e)&&L(o)}},[i.accessToken,e,t]);const j=Object.assign(Object.assign({},r),{skuCode:t,loader:P,setSkuCodes:h});return I(K.Provider,Object.assign({value:j},{children:l}),void 0)};p.propTypes=q,p.defaultProps=w,p.displayName=z;export default p;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import getPrices from"../utils/getPrices";import{isEmpty,indexOf,has}from"lodash";import CommerceLayerContext from"../context/CommerceLayerContext";import priceReducer,{unsetPriceState}from"../reducers/PriceReducer";import{priceInitialState,getSkusPrice}from"../reducers/PriceReducer";import PricesContext from"../context/PricesContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";const propTypes=components.PricesContainer.propTypes;const defaultProps=components.PricesContainer.defaultProps;const displayName=components.PricesContainer.displayName;const PricesContainer=e=>{const{children:t,skuCode:s="",loader:r="Loading...",perPage:o=10,filters:i={}}=e;const[c,n]=useReducer(priceReducer,priceInitialState);const p=useContext(CommerceLayerContext);const{setPrices:a,prices:m,items:u,item:d,skuCode:C}=useContext(ItemContext);if(indexOf(c.skuCodes,s)===-1&&s)c.skuCodes.push(s);const f=getCurrentItemKey(d)||s||C||"";const P=e=>{n({type:"setSkuCodes",payload:{skuCodes:e}})};useEffect((()=>{if(d&&has(m,f)){n({type:"setPrices",payload:{prices:m}})}if(!isEmpty(u)&&isEmpty(d)){const e=getPrices(u);n({type:"setPrices",payload:{prices:e}})}if(p.accessToken&&isEmpty(d)||p.accessToken&&!has(m,f)){if(c.skuCodes.length>0||s){getSkusPrice(f&&[f]||c.skuCodes,{config:p,dispatch:n,setPrices:a,prices:m,perPage:o,filters:i})}}return()=>{if(isEmpty(d)){unsetPriceState(n)}}}),[p.accessToken,d,f]);const l=Object.assign(Object.assign({},c),{skuCode:f,loader:r,setSkuCodes:P});return _jsx(PricesContext.Provider,Object.assign({value:l},{children:t}),void 0)};PricesContainer.propTypes=propTypes;PricesContainer.defaultProps=defaultProps;PricesContainer.displayName=displayName;export default PricesContainer;
@@ -1 +1 @@
1
- import{jsx as x}from"react/jsx-runtime";import i from"../config/components";import y from"../context/OrderContext";import h from"../context/PlaceOrderContext";import{useContext as d,useEffect as C,useState as l}from"react";import b from"./utils/BaseInput";const g=i.PrivacyAndTermsCheckbox.propTypes,k=i.PrivacyAndTermsCheckbox.displayName,c=m=>{const{order:e}=d(y),{placeOrderPermitted:s}=d(h),[p,a]=l(!0),[o,u]=l(!1),t="privacy-terms",v=f=>{var r;const n=(r=f.target)===null||r===void 0?void 0:r.checked;u(n),localStorage.setItem(t,`${n}`),s&&s()};return C(()=>((e==null?void 0:e.privacy_url)&&(e==null?void 0:e.terms_url)&&a(!1),o||localStorage.setItem(t,`${o}`),()=>{a(!0),localStorage.removeItem(t)}),[e==null?void 0:e.privacy_url,e==null?void 0:e.terms_url]),x(b,Object.assign({type:"checkbox",name:t,disabled:p,onChange:v,checked:o},m),void 0)};c.propTypes=g,c.displayName=k;export default c;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import components from"../config/components";import OrderContext from"../context/OrderContext";import PlaceOrderContext from"../context/PlaceOrderContext";import{useContext,useEffect,useState}from"react";import BaseInput from"./utils/BaseInput";const propTypes=components.PrivacyAndTermsCheckbox.propTypes;const displayName=components.PrivacyAndTermsCheckbox.displayName;const PrivacyAndTermsCheckbox=e=>{const{order:t}=useContext(OrderContext);const{placeOrderPermitted:o}=useContext(PlaceOrderContext);const[r,s]=useState(true);const[n,c]=useState(false);const a="privacy-terms";const i=e=>{var t;const r=(t=e.target)===null||t===void 0?void 0:t.checked;c(r);localStorage.setItem(a,`${r}`);o&&o()};useEffect((()=>{if((t===null||t===void 0?void 0:t.privacy_url)&&(t===null||t===void 0?void 0:t.terms_url))s(false);if(!n)localStorage.setItem(a,`${n}`);return()=>{s(true);localStorage.removeItem(a)}}),[t===null||t===void 0?void 0:t.privacy_url,t===null||t===void 0?void 0:t.terms_url]);return _jsx(BaseInput,Object.assign({type:"checkbox",name:a,disabled:r,onChange:i,checked:n},e),void 0)};PrivacyAndTermsCheckbox.propTypes=propTypes;PrivacyAndTermsCheckbox.displayName=displayName;export default PrivacyAndTermsCheckbox;
@@ -1 +1 @@
1
- import{__rest as V}from"tslib";import{jsx as q}from"react/jsx-runtime";import{useContext as L,useState as Q,useEffect as D}from"react";import w from"./utils/Parent";import{isEmpty as u,has as z}from"lodash";import A from"../utils/getCurrentItemKey";import F from"../context/ItemContext";import x from"../config/components";import G from"../context/SkuListsContext";const H=x.QuantitySelector.propTypes,J=x.QuantitySelector.defaultProps,M=x.QuantitySelector.displayName,d=b=>{var p,f,y;const{skuCode:g,skuListId:o,children:C,min:t=1,max:$}=b,O=V(b,["skuCode","skuListId","children","min","max"]),{item:m,setQuantity:e,items:h,quantity:i,prices:c,skuCode:T}=L(F),{skuLists:k,listIds:B}=L(G),[I,l]=Q(t),[S,v]=Q(!!O.disabled),s=!u(h)&&g?(p=h[g])===null||p===void 0?void 0:p.code:g||A(m)||T,E=u(m)?50:(y=(f=m[s])===null||f===void 0?void 0:f.inventory)===null||y===void 0?void 0:y.quantity,r=$||E;D(()=>{if(l(t),(!c[s]||!s)&&v(!0),o&&v(!1),s){const a=Number(t);e&&e(Object.assign(Object.assign({},i),{[`${s}`]:a})),!u(c)&&z(c,s)&&v(!1)}return()=>{l(t)}},[m,B,c]);const P=a=>{const n=Number(a.target.value),N=Number(n)>=Number(t)&&Number(n)<=Number(r);l(n),!u(k)&&o&&N?e&&e(Object.assign(Object.assign({},i),{[`${o}`]:Number(n)})):s&&N&&e&&e(Object.assign(Object.assign({},i),{[`${s}`]:Number(n)}))},_=a=>{const n=a.target.value;if(!(Number(n)>=Number(t)&&Number(n)<=Number(r))){const j=Number(n)<Number(t)?t:r;l(j),!u(k)&&o?e&&e(Object.assign(Object.assign({},i),{[`${o}`]:Number(j)})):e&&e(Object.assign(Object.assign({},i),{[`${s}`]:Number(j)}))}},K=Object.assign({min:t,max:r,disabled:S,handleChange:P,handleBlur:_,value:I},b);return C?q(w,Object.assign({},K,{children:C}),void 0):q("input",Object.assign({type:"number",max:r,min:t,value:I||"",disabled:S,onChange:P,onBlur:_},O),void 0)};d.propTypes=H,d.defaultProps=J,d.displayName=M;export default d;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"./utils/Parent";import{isEmpty,has}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";const propTypes=components.QuantitySelector.propTypes;const defaultProps=components.QuantitySelector.defaultProps;const displayName=components.QuantitySelector.displayName;const QuantitySelector=t=>{var e,s,n;const{skuCode:o,skuListId:i,children:r,min:a=1,max:u}=t,m=__rest(t,["skuCode","skuListId","children","min","max"]);const{item:c,setQuantity:l,items:p,quantity:d,prices:b,skuCode:y}=useContext(ItemContext);const{skuLists:f,listIds:g}=useContext(SkuListsContext);const[x,N]=useState(a);const[j,C]=useState(!!m.disabled);const v=!isEmpty(p)&&o?(e=p[o])===null||e===void 0?void 0:e.code:o||getCurrentItemKey(c)||y;const S=isEmpty(c)?50:(n=(s=c[v])===null||s===void 0?void 0:s.inventory)===null||n===void 0?void 0:n.quantity;const O=u||S;useEffect((()=>{N(a);if(!b[v]||!v){C(true)}i&&C(false);if(v){const t=Number(a);l&&l(Object.assign(Object.assign({},d),{[`${v}`]:t}));if(!isEmpty(b)&&has(b,v))C(false)}return()=>{N(a)}}),[c,g,b]);const h=t=>{const e=Number(t.target.value);const s=Number(e)>=Number(a)&&Number(e)<=Number(O);N(e);if(!isEmpty(f)&&i&&s){l&&l(Object.assign(Object.assign({},d),{[`${i}`]:Number(e)}))}else if(v&&s){l&&l(Object.assign(Object.assign({},d),{[`${v}`]:Number(e)}))}};const k=t=>{const e=t.target.value;const s=Number(e)>=Number(a)&&Number(e)<=Number(O);if(!s){const t=Number(e)<Number(a)?a:O;N(t);if(!isEmpty(f)&&i){l&&l(Object.assign(Object.assign({},d),{[`${i}`]:Number(t)}))}else{l&&l(Object.assign(Object.assign({},d),{[`${v}`]:Number(t)}))}}};const I=Object.assign({min:a,max:O,disabled:j,handleChange:h,handleBlur:k,value:x},t);return r?_jsx(Parent,Object.assign({},I,{children:r}),void 0):_jsx("input",Object.assign({type:"number",max:O,min:a,value:x||"",disabled:j,onChange:h,onBlur:k},m),void 0)};QuantitySelector.propTypes=propTypes;QuantitySelector.defaultProps=defaultProps;QuantitySelector.displayName=displayName;export default QuantitySelector;
@@ -1 +1 @@
1
- import{__rest as S}from"tslib";import{jsx as h}from"react/jsx-runtime";import{useContext as i,useState as T}from"react";import F from"./utils/Parent";import n from"../config/components";import I from"../context/AddressContext";import{isEmpty as L}from"lodash";import{billingAddressController as N,shippingAddressController as q,countryLockController as E}from"../utils/addressesManager";import w from"../context/OrderContext";import G from"../context/CustomerContext";import M from"lodash/isFunction";const z=n.SaveAddressesButton.propTypes,H=n.SaveAddressesButton.defaultProps,J=n.SaveAddressesButton.displayName,o=d=>{const{children:l,label:s="Continue to delivery",resource:A,disabled:a=!1,onClick:c}=d,p=S(d,["children","label","resource","disabled","onClick"]),{errors:t,billing_address:u,shipToDifferentAddress:m,shipping_address:f,saveAddresses:_,billingAddressId:b,shippingAddressId:C}=i(I),{order:e}=i(w),{addresses:k,isGuest:g}=i(G),[j,y]=T(a),D=(g===!0||typeof g=="undefined")&&!(e==null?void 0:e.customer_email),v=N({billing_address:u,errors:t,billingAddressId:b,requiresBillingInfo:e==null?void 0:e.requires_billing_info}),O=q({billingDisable:v,errors:t,shipToDifferentAddress:m,shipping_address:f,shippingAddressId:C}),P=E({countryCodeLock:e==null?void 0:e.shipping_country_code_lock,addresses:k,shipToDifferentAddress:m,billingAddressId:b,billing_address:u,shipping_address:f,shippingAddressId:C}),r=a||D||v||O||P,x=async()=>{L(t)&&!r&&(y(!0),await _(),y(!1),c&&c())},B=Object.assign(Object.assign({},p),{label:s,resource:A,handleClick:x,disabled:r});return l?h(F,Object.assign({},B,{children:l}),void 0):h("button",Object.assign({type:"button",disabled:r||j,onClick:x},p,{children:M(s)?s():s}),void 0)};o.propTypes=z,o.defaultProps=H,o.displayName=J;export default o;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState}from"react";import Parent from"./utils/Parent";import components from"../config/components";import AddressContext from"../context/AddressContext";import{isEmpty}from"lodash";import{billingAddressController,shippingAddressController,countryLockController}from"../utils/addressesManager";import OrderContext from"../context/OrderContext";import CustomerContext from"../context/CustomerContext";import isFunction from"lodash/isFunction";const propTypes=components.SaveAddressesButton.propTypes;const defaultProps=components.SaveAddressesButton.defaultProps;const displayName=components.SaveAddressesButton.displayName;const SaveAddressesButton=s=>{const{children:e,label:o="Continue to delivery",resource:t,disabled:r=false,onClick:n}=s,d=__rest(s,["children","label","resource","disabled","onClick"]);const{errors:i,billing_address:l,shipToDifferentAddress:a,shipping_address:p,saveAddresses:c,billingAddressId:u,shippingAddressId:m}=useContext(AddressContext);const{order:f}=useContext(OrderContext);const{addresses:C,isGuest:g}=useContext(CustomerContext);const[b,A]=useState(r);const x=!!(!!(g===true||typeof g==="undefined")&&!(f===null||f===void 0?void 0:f.customer_email));const h=billingAddressController({billing_address:l,errors:i,billingAddressId:u,requiresBillingInfo:f===null||f===void 0?void 0:f.requires_billing_info});const _=shippingAddressController({billingDisable:h,errors:i,shipToDifferentAddress:a,shipping_address:p,shippingAddressId:m});const v=countryLockController({countryCodeLock:f===null||f===void 0?void 0:f.shipping_country_code_lock,addresses:C,shipToDifferentAddress:a,billingAddressId:u,billing_address:l,shipping_address:p,shippingAddressId:m});const y=r||x||h||_||v;const S=async()=>{if(isEmpty(i)&&!y){A(true);await c();A(false);n&&n()}};const j=Object.assign(Object.assign({},d),{label:o,resource:t,handleClick:S,disabled:y});return e?_jsx(Parent,Object.assign({},j,{children:e}),void 0):_jsx("button",Object.assign({type:"button",disabled:y||b,onClick:S},d,{children:isFunction(o)?o():o}),void 0)};SaveAddressesButton.propTypes=propTypes;SaveAddressesButton.defaultProps=defaultProps;SaveAddressesButton.displayName=displayName;export default SaveAddressesButton;
@@ -1 +1 @@
1
- import{__rest as y}from"tslib";import{jsx as d}from"react/jsx-runtime";import{useContext as v}from"react";import x from"./utils/Parent";import o from"../config/components";import{isEmpty as s}from"lodash";import j from"../context/CustomerContext";const h=o.SaveCustomerButton.propTypes,P=o.SaveCustomerButton.defaultProps,g=o.SaveCustomerButton.displayName,t=r=>{const{children:n,label:a="Save",resource:u,disabled:b,onClick:i}=r,c=y(r,["children","label","resource","disabled","onClick"]),{errors:m,saveCustomerUser:C,customerEmail:l}=v(j),e=b||!s(m)||s(l),p=async()=>{s(m)&&!e&&(await C(l),i&&i())},f=Object.assign(Object.assign({},c),{label:a,resource:u,handleClick:p,disabled:e});return n?d(x,Object.assign({},f,{children:n}),void 0):d("button",Object.assign({type:"button",disabled:e,onClick:p},c,{children:a}),void 0)};t.propTypes=h,t.defaultProps=P,t.displayName=g;export default t;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import{isEmpty}from"lodash";import CustomerContext from"../context/CustomerContext";const propTypes=components.SaveCustomerButton.propTypes;const defaultProps=components.SaveCustomerButton.defaultProps;const displayName=components.SaveCustomerButton.displayName;const SaveCustomerButton=t=>{const{children:e,label:o="Save",resource:s,disabled:r,onClick:n}=t,a=__rest(t,["children","label","resource","disabled","onClick"]);const{errors:m,saveCustomerUser:i,customerEmail:p}=useContext(CustomerContext);const u=r||!isEmpty(m)||isEmpty(p);const c=async()=>{if(isEmpty(m)&&!u){await i(p);n&&n()}};const l=Object.assign(Object.assign({},a),{label:o,resource:s,handleClick:c,disabled:u});return e?_jsx(Parent,Object.assign({},l,{children:e}),void 0):_jsx("button",Object.assign({type:"button",disabled:u,onClick:c},a,{children:o}),void 0)};SaveCustomerButton.propTypes=propTypes;SaveCustomerButton.defaultProps=defaultProps;SaveCustomerButton.displayName=displayName;export default SaveCustomerButton;
@@ -1 +1 @@
1
- import{jsx as c}from"react/jsx-runtime";import{Fragment as L,useContext as T,useState as b,useEffect as j}from"react";import k from"../context/ShipmentContext";import N from"../context/ShipmentChildrenContext";import l from"../config/components";import q from"../utils/getLoaderComponent";const I=l.Shipment.propTypes,M=l.Shipment.displayName,m=({children:u,loader:v="Loading..."})=>{const[h,a]=b(!0),{shipments:o,deliveryLeadTimes:i}=T(k);j(()=>(o&&a(!1),()=>{a(!0)}),[o]);const f=o&&o.map((e,d)=>{var s;const r=e.shipment_line_items,_=r==null?void 0:r.map(n=>{const t=n.line_item;return t&&(t.quantity=n.quantity),t}),g=e.available_shipping_methods,x=(s=e.shipping_method)===null||s===void 0?void 0:s.id,y=e.stock_transfers,C=i==null?void 0:i.filter(n=>{var t,p;return((t=n.stock_location)===null||t===void 0?void 0:t.id)===((p=e.stock_location)===null||p===void 0?void 0:p.id)}),S={lineItems:_,shippingMethods:g,currentShippingMethodId:x,stockTransfers:y,deliveryLeadTimes:C,shipment:e,keyNumber:d+1};return c(N.Provider,Object.assign({value:S},{children:u}),d)});return h?q(v):c(L,{children:f},void 0)};m.propTypes=I,m.displayName=M;export default m;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useState,useEffect}from"react";import ShipmentContext from"../context/ShipmentContext";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import components from"../config/components";import getLoaderComponent from"../utils/getLoaderComponent";const propTypes=components.Shipment.propTypes;const displayName=components.Shipment.displayName;const Shipment=({children:t,loader:e="Loading..."})=>{const[n,o]=useState(true);const{shipments:i,deliveryLeadTimes:s}=useContext(ShipmentContext);useEffect((()=>{if(i)o(false);return()=>{o(true)}}),[i]);const r=i&&i.map(((e,n)=>{var o;const i=e.shipment_line_items;const r=i===null||i===void 0?void 0:i.map((t=>{const e=t.line_item;if(e)e.quantity=t.quantity;return e}));const p=e.available_shipping_methods;const m=(o=e.shipping_method)===null||o===void 0?void 0:o.id;const d=e.stock_transfers;const a=s===null||s===void 0?void 0:s.filter((t=>{var n,o;return((n=t.stock_location)===null||n===void 0?void 0:n.id)===((o=e.stock_location)===null||o===void 0?void 0:o.id)}));const c={lineItems:r,shippingMethods:p,currentShippingMethodId:m,stockTransfers:d,deliveryLeadTimes:a,shipment:e,keyNumber:n+1};return _jsx(ShipmentChildrenContext.Provider,Object.assign({value:c},{children:t}),n)}));return!n?_jsx(Fragment,{children:r},void 0):getLoaderComponent(e)};Shipment.propTypes=propTypes;Shipment.displayName=displayName;export default Shipment;
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{useContext as a}from"react";import d from"./utils/Parent";import r from"../config/components";import l from"lodash/get";import h from"../context/ShipmentChildrenContext";const x=r.ShipmentField.propTypes,y=r.ShipmentField.displayName,t=e=>{const{name:s}=e,{shipment:n,keyNumber:m}=a(h),o=s,p=o!=="key_number"?l(n,o):m,c=Object.assign({shipment:n},e);return e.children?i(d,Object.assign({},c,{children:e.children}),void 0):i("span",Object.assign({},e,{children:p}),void 0)};t.propTypes=x,t.displayName=y;export default t;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import get from"lodash/get";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";const propTypes=components.ShipmentField.propTypes;const displayName=components.ShipmentField.displayName;const ShipmentField=e=>{const{name:t}=e;const{shipment:n,keyNumber:o}=useContext(ShipmentChildrenContext);const i=t;const p=i!=="key_number"?get(n,i):o;const s=Object.assign({shipment:n},e);return e.children?_jsx(Parent,Object.assign({},s,{children:e.children}),void 0):_jsx("span",Object.assign({},e,{children:p}),void 0)};ShipmentField.propTypes=propTypes;ShipmentField.displayName=displayName;export default ShipmentField;
@@ -1 +1 @@
1
- import{jsx as f}from"react/jsx-runtime";import x,{defaultShipmentContext as C}from"../context/ShipmentContext";import{useContext as r,useEffect as S,useReducer as g}from"react";import _,{shipmentInitialState as y,getShipments as v,setShippingMethod as j}from"../reducers/ShipmentReducer";import O from"../context/OrderContext";import b from"../context/CommerceLayerContext";import p from"../config/components";import{isEmpty as R}from"lodash";const E=p.ShipmentsContainer.propTypes,T=p.ShipmentsContainer.displayName,i=m=>{const{children:c}=m,[a,o]=g(_,y),{order:e,getOrder:h,include:t,addResourceToInclude:d}=r(O),n=r(b);S(()=>{(t==null?void 0:t.includes("shipments.available_shipping_methods"))||d({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers","shipments.stock_location"]}),e&&!R(n)&&v({order:e,dispatch:o,config:n})},[e]);const l=Object.assign(Object.assign({},a),{setShipmentErrors:s=>C.setShipmentErrors(s,o),setShippingMethod:async(s,u)=>await j({shippingMethodId:u,shipmentId:s,config:n,getOrder:h,order:e})});return f(x.Provider,Object.assign({value:l},{children:c}),void 0)};i.propTypes=E,i.displayName=T;export default i;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes;const displayName=components.ShipmentsContainer.displayName;const ShipmentsContainer=e=>{const{children:t}=e;const[n,i]=useReducer(shipmentReducer,shipmentInitialState);const{order:s,getOrder:o,include:r,addResourceToInclude:p}=useContext(OrderContext);const m=useContext(CommerceLayerContext);useEffect((()=>{if(!(r===null||r===void 0?void 0:r.includes("shipments.available_shipping_methods"))){p({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers","shipments.stock_location"]})}if(s&&!isEmpty(m)){getShipments({order:s,dispatch:i,config:m})}}),[s]);const c=Object.assign(Object.assign({},n),{setShipmentErrors:e=>defaultShipmentContext["setShipmentErrors"](e,i),setShippingMethod:async(e,t)=>await setShippingMethod({shippingMethodId:t,shipmentId:e,config:m,getOrder:o,order:s})});return _jsx(ShipmentContext.Provider,Object.assign({value:c},{children:t}),void 0)};ShipmentsContainer.propTypes=propTypes;ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
@@ -1 +1 @@
1
- import{jsx as u}from"react/jsx-runtime";import x from"../context/ShippingAddressContext";import{useContext as o,useEffect as g,useReducer as A}from"react";import C,{setShippingAddress as f,shippingAddressInitialState as h,setShippingCustomerAddressId as l}from"../reducers/ShippingAddressReducer";import S from"../context/CommerceLayerContext";import y from"../config/components";import j from"../context/OrderContext";import O from"../context/AddressContext";const v=y.ShippingAddressContainer.propTypes,i=p=>{const{children:c}=p,[m,t]=A(C,h),s=o(S),{order:e,updateOrder:I}=o(j),{setCloneAddress:n}=o(O);g(()=>(e&&s&&l({dispatch:t,order:e,setCloneAddress:n}),()=>{t({type:"cleanup",payload:{}})}),[s,e]);const a=Object.assign(Object.assign({},m),{setShippingAddress:async(d,r)=>{await f(d,{config:s,dispatch:t,order:e,customerAddressId:r==null?void 0:r.customerAddressId}),n(d,"shipping_address")}});return u(x.Provider,Object.assign({value:a},{children:c}),void 0)};i.propTypes=v;export default i;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import ShippingAddressContext from"../context/ShippingAddressContext";import{useContext,useEffect,useReducer}from"react";import shippingAddressReducer,{setShippingAddress,shippingAddressInitialState,setShippingCustomerAddressId}from"../reducers/ShippingAddressReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";const propTypes=components.ShippingAddressContainer.propTypes;const ShippingAddressContainer=e=>{const{children:s}=e;const[t,r]=useReducer(shippingAddressReducer,shippingAddressInitialState);const d=useContext(CommerceLayerContext);const{order:o,updateOrder:n}=useContext(OrderContext);const{setCloneAddress:i}=useContext(AddressContext);useEffect((()=>{if(o&&d){setShippingCustomerAddressId({dispatch:r,order:o,setCloneAddress:i})}return()=>{r({type:"cleanup",payload:{}})}}),[d,o]);const p=Object.assign(Object.assign({},t),{setShippingAddress:async(e,s)=>{await setShippingAddress(e,{config:d,dispatch:r,order:o,customerAddressId:s===null||s===void 0?void 0:s.customerAddressId});i(e,"shipping_address")}});return _jsx(ShippingAddressContext.Provider,Object.assign({value:p},{children:s}),void 0)};ShippingAddressContainer.propTypes=propTypes;export default ShippingAddressContainer;
@@ -1 +1 @@
1
- import{__rest as O}from"tslib";import{jsx as v}from"react/jsx-runtime";import E from"../context/AddressContext";import R from"rapid-form";import{useContext as _,useEffect as S,useRef as k}from"react";import N from"../context/ShippingAddressFormContext";import{isEmpty as t}from"lodash";import V from"../config/components";import w from"../context/OrderContext";const B=V.ShippingAddressForm.propTypes,x=u=>{const{children:C,errorClassName:A,autoComplete:j="on",reset:m=!1}=u,y=O(u,["children","errorClassName","autoComplete","reset"]),{validation:F,values:s,errors:o,reset:f}=R(),{setAddressErrors:p,setAddress:a,shipToDifferentAddress:c}=_(E),{saveAddressToCustomerAddressBook:l,include:n,addResourceToInclude:T}=_(w),d=k(null);S(()=>{var i;if((n==null?void 0:n.includes("shipping_address"))||T({newResource:"shipping_address"}),t(o)){if(!t(s)&&c){p([],"shipping_address");for(const r in s){const e=s[r];(e==null?void 0:e.value)&&(s[r.replace("shipping_address_","")]=e.value,delete s[r]),(e==null?void 0:e.type)==="checkbox"&&(delete s[r],l({type:"shipping_address",value:e.checked}))}a({values:s,resource:"shipping_address"})}}else{const r=[];for(const e in o){const{code:h,message:g}=o[e];["shipping_address_state_code"].includes(e)?t(s.state_code)?delete o[e]:r.push({code:h,message:g,resource:"shipping_address",field:e}):r.push({code:h,message:g,resource:"shipping_address",field:e})}c&&p(r,"shipping_address")}m&&(!t(s)||!t(o))&&(l&&l({type:"shipping_address",value:!1}),d&&((i=d.current)===null||i===void 0||i.reset(),f({target:d.current}),p([],"shipping_address"),a({values:{},resource:"shipping_address"})))},[s,o,c,m,n]);const b={values:s,validation:F,setValue:(i,r)=>{const e={[i.replace("shipping_address_","")]:r};a({values:Object.assign(Object.assign({},s),e),resource:"shipping_address"})},errorClassName:A,errors:o,resetField:i=>f({currentTarget:d.current},i)};return v(N.Provider,Object.assign({value:b},{children:v("form",Object.assign({ref:d,autoComplete:j},y,{children:C}),void 0)}),void 0)};x.propTypes=B;export default x;
1
+ import{__rest}from"tslib";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 ShippingAddressFormContext from"../context/ShippingAddressFormContext";import{isEmpty}from"lodash";import components from"../config/components";import OrderContext from"../context/OrderContext";const propTypes=components.ShippingAddressForm.propTypes;const ShippingAddressForm=e=>{const{children:s,errorClassName:r,autoComplete:o="on",reset:t=false}=e,i=__rest(e,["children","errorClassName","autoComplete","reset"]);const{validation:d,values:n,errors:p,reset:a}=useRapidForm();const{setAddressErrors:c,setAddress:l,shipToDifferentAddress:m}=useContext(AddressesContext);const{saveAddressToCustomerAddressBook:u,include:f,addResourceToInclude:g}=useContext(OrderContext);const h=useRef(null);useEffect((()=>{var e;if(!(f===null||f===void 0?void 0:f.includes("shipping_address"))){g({newResource:"shipping_address"})}if(!isEmpty(p)){const e=[];for(const s in p){const{code:r,message:o}=p[s];if(["shipping_address_state_code"].includes(s)){if(isEmpty(n["state_code"])){delete p[s]}else{e.push({code:r,message:o,resource:"shipping_address",field:s})}}else{e.push({code:r,message:o,resource:"shipping_address",field:s})}}m&&c(e,"shipping_address")}else if(!isEmpty(n)&&m){c([],"shipping_address");for(const e in n){const s=n[e];if(s===null||s===void 0?void 0:s.value){n[e.replace("shipping_address_","")]=s.value;delete n[e]}if((s===null||s===void 0?void 0:s.type)==="checkbox"){delete n[e];u({type:"shipping_address",value:s.checked})}}l({values:n,resource:"shipping_address"})}if(t&&(!isEmpty(n)||!isEmpty(p))){u&&u({type:"shipping_address",value:false});if(h){(e=h.current)===null||e===void 0?void 0:e.reset();a({target:h.current});c([],"shipping_address");l({values:{},resource:"shipping_address"})}}}),[n,p,m,t,f]);const _=(e,s)=>{const r={[e.replace("shipping_address_","")]:s};l({values:Object.assign(Object.assign({},n),r),resource:"shipping_address"})};const v={values:n,validation:d,setValue:_,errorClassName:r,errors:p,resetField:e=>a({currentTarget:h.current},e)};return _jsx(ShippingAddressFormContext.Provider,Object.assign({value:v},{children:_jsx("form",Object.assign({ref:h,autoComplete:o},i,{children:s}),void 0)}),void 0)};ShippingAddressForm.propTypes=propTypes;export default ShippingAddressForm;
@@ -1 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import i from"./utils/BaseOrderPrice";import o from"../config/components";const r=o.ShippingAmount.propTypes,t=o.ShippingAmount.displayName,p=e=>s(i,Object.assign({base:"amount",type:"shipping"},e),void 0);p.propTypes=r,p.displayName=t;export default p;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.ShippingAmount.propTypes;const displayName=components.ShippingAmount.displayName;const ShippingAmount=p=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"shipping"},p),void 0);ShippingAmount.propTypes=propTypes;ShippingAmount.displayName=displayName;export default ShippingAmount;
@@ -1 +1 @@
1
- import{jsx as m}from"react/jsx-runtime";import{Fragment as M,useContext as T,useEffect as j,useState as I}from"react";import E from"../context/ShippingMethodChildrenContext";import h from"../config/components";import N from"../context/ShipmentChildrenContext";import _ from"lodash/isEmpty";const b=h.ShippingMethod.propTypes,F=h.ShippingMethod.displayName,p=l=>{const{children:a,readonly:c,emptyText:u="There are not any shipping method available"}=l,{shippingMethods:i,currentShippingMethodId:o,deliveryLeadTimes:e,shipment:n}=T(N),[s,f]=I([]);j(()=>{const d=i&&i.filter(t=>c?t.id===o:!0).map((t,y)=>{const[g]=e==null?void 0:e.filter(S=>{var r;const C=(r=S.shipping_method)===null||r===void 0?void 0:r.id;return t.id===C}),x={shipmentId:n==null?void 0:n.id,shippingMethod:t,currentShippingMethodId:o,deliveryLeadTimeForShipment:g};return m(E.Provider,Object.assign({value:x},{children:a}),y)});d&&f(d)},[o,e,i]);const v=!_(s)&&s||u;return m(M,{children:v},void 0)};p.propTypes=b,p.displayName=F;export default p;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import isEmpty from"lodash/isEmpty";const propTypes=components.ShippingMethod.propTypes;const displayName=components.ShippingMethod.displayName;const ShippingMethod=e=>{const{children:t,readonly:i,emptyText:n=`There are not any shipping method available`}=e;const{shippingMethods:o,currentShippingMethodId:p,deliveryLeadTimes:r,shipment:d}=useContext(ShipmentChildrenContext);const[s,h]=useState([]);useEffect((()=>{const e=o&&o.filter((e=>{if(i)return e.id===p;return true})).map(((e,i)=>{const[n]=r===null||r===void 0?void 0:r.filter((t=>{var i;const n=(i=t.shipping_method)===null||i===void 0?void 0:i.id;return e.id===n}));const o={shipmentId:d===null||d===void 0?void 0:d.id,shippingMethod:e,currentShippingMethodId:p,deliveryLeadTimeForShipment:n};return _jsx(ShippingMethodChildrenContext.Provider,Object.assign({value:o},{children:t}),i)}));if(e)h(e)}),[p,r,o]);const m=!isEmpty(s)&&s||n;return _jsx(Fragment,{children:m},void 0)};ShippingMethod.propTypes=propTypes;ShippingMethod.displayName=displayName;export default ShippingMethod;
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useContext as a}from"react";import l from"../context/ShippingMethodChildrenContext";import h from"./utils/Parent";import p from"../config/components";const c=p.ShippingMethodName.propTypes,g=p.ShippingMethodName.displayName,i=t=>{const{shippingMethod:e,deliveryLeadTimeForShipment:r,shipmentId:s}=a(l),m=`shipment-${s}-${e==null?void 0:e.id}`||"",o=e==null?void 0:e.name,d=Object.assign({shippingMethod:e,deliveryLeadTimeForShipment:r,label:o},t);return t.children?n(h,Object.assign({},d,{children:t.children}),void 0):n("label",Object.assign({htmlFor:m},t,{children:o}),void 0)};i.propTypes=c,i.displayName=g;export default i;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.ShippingMethodName.propTypes;const displayName=components.ShippingMethodName.displayName;const ShippingMethodName=e=>{const{shippingMethod:i,deliveryLeadTimeForShipment:o,shipmentId:t}=useContext(ShippingMethodChildrenContext);const n=`shipment-${t}-${i===null||i===void 0?void 0:i.id}`||"";const p=i===null||i===void 0?void 0:i["name"];const s=Object.assign({shippingMethod:i,deliveryLeadTimeForShipment:o,label:p},e);return e.children?_jsx(Parent,Object.assign({},s,{children:e.children}),void 0):_jsx("label",Object.assign({htmlFor:n},e,{children:p}),void 0)};ShippingMethodName.propTypes=propTypes;ShippingMethodName.displayName=displayName;export default ShippingMethodName;
@@ -1 +1 @@
1
- import{__rest as C}from"tslib";import{jsx as a}from"react/jsx-runtime";import{useState as d,useEffect as j,useContext as l}from"react";import f from"../utils/getAmount";import y from"../context/ShippingMethodChildrenContext";import P from"./utils/Parent";import h from"../config/components";import _ from"../context/OrderContext";import{isNumber as M}from"lodash";const S=h.ShippingMethodPrice.propTypes,A=h.ShippingMethodPrice.displayName,r=e=>{const{format:u="formatted",type:n="amount",base:b="price",labelFreeOver:g="Free"}=e,i=C(e,["format","type","base","labelFreeOver"]),{shippingMethod:t}=l(y),{order:o}=l(_),[s,p]=d(""),[c,m]=d(0);j(()=>{if(t){const O=f({base:b,type:n,format:u,obj:t});p(O);const v=f({base:"freeOver",type:n,format:"cents",obj:t});m(v)}return()=>{p(""),m(0)}},[t]);const x=Object.assign({price:s},i);return e.children?a(P,Object.assign({},x,{children:e.children}),void 0):a("span",Object.assign({},i,{children:(o==null?void 0:o.total_amount_cents)&&M(c)&&c<o.total_amount_cents?g:s}),void 0)};r.propTypes=S,r.displayName=A;export default r;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import OrderContext from"../context/OrderContext";import{isNumber}from"lodash";const propTypes=components.ShippingMethodPrice.propTypes;const displayName=components.ShippingMethodPrice.displayName;const ShippingMethodPrice=e=>{const{format:t="formatted",type:o="amount",base:r="price",labelFreeOver:n="Free"}=e,i=__rest(e,["format","type","base","labelFreeOver"]);const{shippingMethod:s}=useContext(ShippingMethodChildrenContext);const{order:p}=useContext(OrderContext);const[m,c]=useState("");const[a,d]=useState(0);useEffect((()=>{if(s){const e=getAmount({base:r,type:o,format:t,obj:s});c(e);const n=getAmount({base:"freeOver",type:o,format:"cents",obj:s});d(n)}return()=>{c("");d(0)}}),[s]);const h=Object.assign({price:m},i);return e.children?_jsx(Parent,Object.assign({},h,{children:e.children}),void 0):_jsx("span",Object.assign({},i,{children:(p===null||p===void 0?void 0:p.total_amount_cents)&&isNumber(a)&&a<p.total_amount_cents?n:m}),void 0)};ShippingMethodPrice.propTypes=propTypes;ShippingMethodPrice.displayName=displayName;export default ShippingMethodPrice;
@@ -1 +1 @@
1
- import{__rest as C}from"tslib";import{jsx as r}from"react/jsx-runtime";import{useContext as a}from"react";import x from"../context/ShippingMethodChildrenContext";import M from"./utils/Parent";import c from"../config/components";import S from"../context/ShipmentContext";const y=c.ShippingMethodRadioButton.propTypes,j=c.ShippingMethodRadioButton.displayName,p=t=>{const{onChange:s}=t,m=C(t,["onChange"]),{shippingMethod:n,currentShippingMethodId:g,shipmentId:o}=a(x),{setShippingMethod:l}=a(S),e=n==null?void 0:n.id,i=`shipment-${o}`,d=`${i}-${e}`,f=e===g,h=async()=>{o&&e&&await l(o,e),n&&s&&s(n)},u=Object.assign({handleOnChange:h,name:i,id:d},t);return t.children?r(M,Object.assign({},u,{children:t.children}),void 0):r("input",Object.assign({type:"radio",name:i,id:d,onChange:h,defaultChecked:f},m),void 0)};p.propTypes=y,p.displayName=j;export default p;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import ShipmentContext from"../context/ShipmentContext";const propTypes=components.ShippingMethodRadioButton.propTypes;const displayName=components.ShippingMethodRadioButton.displayName;const ShippingMethodRadioButton=t=>{const{onChange:n}=t,o=__rest(t,["onChange"]);const{shippingMethod:e,currentShippingMethodId:i,shipmentId:p}=useContext(ShippingMethodChildrenContext);const{setShippingMethod:s}=useContext(ShipmentContext);const d=e===null||e===void 0?void 0:e.id;const h=`shipment-${p}`;const r=`${h}-${d}`;const a=d===i;const c=async()=>{if(p&&d)await s(p,d);if(e&&n)n(e)};const m=Object.assign({handleOnChange:c,name:h,id:r},t);return t.children?_jsx(Parent,Object.assign({},m,{children:t.children}),void 0):_jsx("input",Object.assign({type:"radio",name:h,id:r,onChange:c,defaultChecked:a},o),void 0)};ShippingMethodRadioButton.propTypes=propTypes;ShippingMethodRadioButton.displayName=displayName;export default ShippingMethodRadioButton;
@@ -1 +1 @@
1
- import{jsx as p}from"react/jsx-runtime";import{useContext as r,useEffect as c,Fragment as m}from"react";import u from"../context/SkuListsContext";import e from"../config/components";const a=e.SkuList.propTypes,d=e.SkuList.displayName,s=i=>{const{id:o,children:n}=i,{listIds:t}=r(u);return c(()=>{t&&!t.includes(o)&&t.push(o)},[]),p(m,{children:n},void 0)};s.propTypes=a,s.displayName=d;export default s;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,Fragment}from"react";import SkuListsContext from"../context/SkuListsContext";import components from"../config/components";const propTypes=components.SkuList.propTypes;const displayName=components.SkuList.displayName;const SkuList=t=>{const{id:s,children:e}=t;const{listIds:o}=useContext(SkuListsContext);useEffect((()=>{if(o&&!o.includes(s)){o.push(s)}}),[]);return _jsx(Fragment,{children:e},void 0)};SkuList.propTypes=propTypes;SkuList.displayName=displayName;export default SkuList;
@@ -1 +1 @@
1
- import{jsx as c}from"react/jsx-runtime";import{useReducer as a,useContext as m,useEffect as p}from"react";import u from"../context/SkuListsContext";import d from"../context/CommerceLayerContext";import l,{skuListsInitialState as f,getSkuList as k}from"../reducers/SkuListsReducer";import o from"../config/components";const x=o.SkuListsContainer.propTypes,L=o.SkuListsContainer.displayName,e=i=>{const{children:r}=i,[t,n]=a(l,f),s=m(d);return p(()=>{t.listIds&&t.listIds.length>0&&s.accessToken&&k({listIds:t.listIds,dispatch:n,config:s,state:t})},[s.accessToken]),c(u.Provider,Object.assign({value:t},{children:r}),void 0)};e.propTypes=x,e.displayName=L;export default e;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuListsContext from"../context/SkuListsContext";import CommerceLayerContext from"../context/CommerceLayerContext";import skuListsReducer,{skuListsInitialState,getSkuList}from"../reducers/SkuListsReducer";import components from"../config/components";const propTypes=components.SkuListsContainer.propTypes;const displayName=components.SkuListsContainer.displayName;const SkuListsContainer=t=>{const{children:s}=t;const[e,o]=useReducer(skuListsReducer,skuListsInitialState);const i=useContext(CommerceLayerContext);useEffect((()=>{if(e.listIds&&e.listIds.length>0&&i.accessToken){getSkuList({listIds:e.listIds,dispatch:o,config:i,state:e})}}),[i.accessToken]);return _jsx(SkuListsContext.Provider,Object.assign({value:e},{children:s}),void 0)};SkuListsContainer.propTypes=propTypes;SkuListsContainer.displayName=displayName;export default SkuListsContainer;
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{Fragment as u,useContext as d}from"react";import a from"../context/SkuOptionChildrenContext";import l from"../context/SkuOptionsContext";import r from"../config/components";const x=r.SkuOption.propTypes,k=r.SkuOption.displayName,o=e=>{const{id:p}=e,{skuOptions:n,skuCode:s}=d(l),m=n&&n.filter(t=>t.id===p).map((t,c)=>i(a.Provider,Object.assign({value:{skuOption:t,skuCode:s}},{children:e.children}),c));return i(u,{children:m},void 0)};o.propTypes=x,o.displayName=k;export default o;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import SkuOptionChildrenContext from"../context/SkuOptionChildrenContext";import SkuOptionsContext from"../context/SkuOptionsContext";import components from"../config/components";const propTypes=components.SkuOption.propTypes;const displayName=components.SkuOption.displayName;const SkuOption=t=>{const{id:o}=t;const{skuOptions:n,skuCode:e}=useContext(SkuOptionsContext);const p=n&&n.filter((t=>t.id===o)).map(((o,n)=>_jsx(SkuOptionChildrenContext.Provider,Object.assign({value:{skuOption:o,skuCode:e}},{children:t.children}),n)));return _jsx(Fragment,{children:p},void 0)};SkuOption.propTypes=propTypes;SkuOption.displayName=displayName;export default SkuOption;
@@ -1 +1 @@
1
- import{jsx as l}from"react/jsx-runtime";import{useContext as p}from"react";import O from"./utils/BaseInput";import v from"../context/ItemContext";import x from"../context/SkuOptionChildrenContext";import{has as C}from"lodash";import a from"../config/components";const g=a.SkuOptionInput.propTypes,f=a.SkuOptionInput.displayName,i=s=>{const{name:r}=s,{option:n,setOption:e}=p(v),{skuOption:o,skuCode:t}=p(x);return l(O,Object.assign({onChange:d=>{const m=d.target.value,u=C(n,`${t}.${o==null?void 0:o.id}`)?n[t][`${o==null?void 0:o.id}`].options:{},c={[t]:Object.assign(Object.assign({},n[t]),{[`${o==null?void 0:o.id}`]:{skuOptionId:o==null?void 0:o.id,options:Object.assign(Object.assign({},u),{[r]:m})}})};e&&e(c)}},s),void 0)};i.propTypes=g,i.displayName=f;export default i;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import BaseInput from"./utils/BaseInput";import ItemContext from"../context/ItemContext";import SkuOptionChildrenContext from"../context/SkuOptionChildrenContext";import{has}from"lodash";import components from"../config/components";const propTypes=components.SkuOptionInput.propTypes;const displayName=components.SkuOptionInput.displayName;const SkuOptionInput=t=>{const{name:o}=t;const{option:n,setOption:s}=useContext(ItemContext);const{skuOption:e,skuCode:p}=useContext(SkuOptionChildrenContext);const i=t=>{const i=t.target.value;const u=has(n,`${p}.${e===null||e===void 0?void 0:e.id}`)?n[p][`${e===null||e===void 0?void 0:e.id}`]["options"]:{};const r={[p]:Object.assign(Object.assign({},n[p]),{[`${e===null||e===void 0?void 0:e.id}`]:{skuOptionId:e===null||e===void 0?void 0:e.id,options:Object.assign(Object.assign({},u),{[o]:i})}})};s&&s(r)};return _jsx(BaseInput,Object.assign({onChange:i},t),void 0)};SkuOptionInput.propTypes=propTypes;SkuOptionInput.displayName=displayName;export default SkuOptionInput;
@@ -1 +1 @@
1
- import{jsx as C}from"react/jsx-runtime";import{useReducer as O,useContext as p,useEffect as l}from"react";import x from"../context/SkuOptionsContext";import y,{skuOptionsInitialState as S}from"../reducers/SkuOptionsReducer";import g from"../context/CommerceLayerContext";import{isEmpty as m}from"lodash";import j from"../utils/getCurrentItemKey";import v from"../context/ItemContext";import{getSkuOptions as I}from"../reducers/SkuOptionsReducer";import u from"../config/components";const h=u.SkuOptionsContainer.propTypes,R=u.SkuOptionsContainer.displayName,n=c=>{var o;const{skuCode:e,children:a}=c,[d,r]=O(y,S),k=p(g),{item:s,items:i}=p(v),t=!m(i)&&e?(o=i[e])===null||o===void 0?void 0:o.code:e||j(s),f=Object.assign(Object.assign({},d),{skuCode:t});return l(()=>(t&&s[t].sku_options&&I({skuOptions:s[t].sku_options,dispatch:r}),()=>{m(t)&&r({type:"setSkuOptions",payload:{skuOptions:[]}})}),[k,t]),C(x.Provider,Object.assign({value:f},{children:a}),void 0)};n.propTypes=h,n.displayName=R;export default n;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuOptionsContext from"../context/SkuOptionsContext";import skuOptionsReducer,{skuOptionsInitialState}from"../reducers/SkuOptionsReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import{isEmpty}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import{getSkuOptions}from"../reducers/SkuOptionsReducer";import components from"../config/components";const propTypes=components.SkuOptionsContainer.propTypes;const displayName=components.SkuOptionsContainer.displayName;const SkuOptionsContainer=t=>{var e;const{skuCode:o,children:n}=t;const[s,i]=useReducer(skuOptionsReducer,skuOptionsInitialState);const r=useContext(CommerceLayerContext);const{item:p,items:u}=useContext(ItemContext);const m=!isEmpty(u)&&o?(e=u[o])===null||e===void 0?void 0:e.code:o||getCurrentItemKey(p);const c=Object.assign(Object.assign({},s),{skuCode:m});useEffect((()=>{if(m&&p[m].sku_options){getSkuOptions({skuOptions:p[m].sku_options,dispatch:i})}return()=>{if(isEmpty(m)){i({type:"setSkuOptions",payload:{skuOptions:[]}})}}}),[r,m]);return _jsx(SkuOptionsContext.Provider,Object.assign({value:c},{children:n}),void 0)};SkuOptionsContainer.propTypes=propTypes;SkuOptionsContainer.displayName=displayName;export default SkuOptionsContainer;
@@ -1 +1 @@
1
- import{jsx as r}from"react/jsx-runtime";import{useContext as s,Fragment as l}from"react";import f from"../context/LineItemChildrenContext";import i from"../config/components";import x from"../context/ShipmentChildrenContext";import C from"../context/StockTransferChildrenContext";const h=i.StockTransfer.propTypes,u=i.StockTransfer.displayName,n=c=>{const{children:m}=c,{lineItem:t}=s(f),{stockTransfers:e}=s(x),p=e==null?void 0:e.filter(o=>o.sku_code===(t==null?void 0:t.sku_code)).map((o,a)=>{const d={stockTransfer:o};return r(C.Provider,Object.assign({value:d},{children:m}),a)});return r(l,{children:p},void 0)};n.propTypes=h,n.displayName=u;export default n;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes;const displayName=components.StockTransfer.displayName;const StockTransfer=e=>{const{children:t}=e;const{lineItem:n}=useContext(LineItemChildrenContext);const{stockTransfers:o}=useContext(ShipmentChildrenContext);const r=o===null||o===void 0?void 0:o.filter((e=>e.sku_code===(n===null||n===void 0?void 0:n.sku_code))).map(((e,n)=>{const o={stockTransfer:e};return _jsx(StockTransferChildrenContext.Provider,Object.assign({value:o},{children:t}),n)}));return _jsx(Fragment,{children:r},void 0)};StockTransfer.propTypes=propTypes;StockTransfer.displayName=displayName;export default StockTransfer;
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useContext as a}from"react";import m from"../context/StockTransferChildrenContext";import p from"./utils/Parent";import o from"../config/components";const d=o.StockTransferField.propTypes,l=o.StockTransferField.displayName,e=t=>{const{type:s}=t,{stockTransfer:r}=a(m),c=r?r[s]:"",i=Object.assign({},t);return t.children?n(p,Object.assign({},i,{children:t.children}),void 0):n("p",Object.assign({},t,{children:c}),void 0)};e.propTypes=d,e.displayName=l;export default e;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.StockTransferField.propTypes;const displayName=components.StockTransferField.displayName;const StockTransferField=e=>{const{type:t}=e;const{stockTransfer:r}=useContext(StockTransferChildrenContext);const o=r?r[t]:"";const n=Object.assign({},e);return e.children?_jsx(Parent,Object.assign({},n,{children:e.children}),void 0):_jsx("p",Object.assign({},e,{children:o}),void 0)};StockTransferField.propTypes=propTypes;StockTransferField.displayName=displayName;export default StockTransferField;
@@ -1 +1 @@
1
- import{__rest as C}from"tslib";import{jsx as m,jsxs as M}from"react/jsx-runtime";import{useContext as x,useEffect as O,useRef as A,useState as E}from"react";import R from"../context/PaymentMethodContext";import{CardElement as T,Elements as L,useElements as W,useStripe as z}from"@stripe/react-stripe-js";import F from"./utils/Parent";import K from"../context/OrderContext";import{setCustomerOrderParam as U}from"../utils/localStorage";const w={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode:!0},k=({options:p=w,templateCustomerSaveToWallet:n})=>{const t=A(null),{setPaymentSource:y,paymentSource:s,currentPaymentMethodType:i,setPaymentMethodErrors:b,setPaymentRef:c}=x(R),{order:o}=x(K),a=z(),l=W();O(()=>(t.current&&a&&l&&(t.current.onsubmit=()=>f(t.current,a,l),c({ref:t})),()=>{c({ref:{current:null}})}),[t,a,l]);const f=async(r,d,v)=>{var _,u;if(!d)return!1;const S=(u=(_=r==null?void 0:r.elements)===null||_===void 0?void 0:_.save_payment_source_to_customer_wallet)===null||u===void 0?void 0:u.checked;S&&U("_save_payment_source_to_customer_wallet",S);const h=v&&v.getElement(T);if(h){const e=o==null?void 0:o.billing_address,I=o==null?void 0:o.customer_email,P={name:e==null?void 0:e.full_name,email:I,phone:e==null?void 0:e.phone,address:{city:e==null?void 0:e.city,country:e==null?void 0:e.country_code,line1:e==null?void 0:e.line_1,postal_code:e==null?void 0:e.zip_code,state:e==null?void 0:e.state_code}},{paymentMethod:j}=await d.createPaymentMethod({type:"card",card:h,billing_details:P});if(s==null?void 0:s.client_secret){const{error:g,paymentIntent:N}=await d.confirmCardPayment(s.client_secret,{payment_method:{card:h,billing_details:P}});if(g)console.error(g),b([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:i,message:g.message}]);else if(N&&j&&s&&i)try{return await y({paymentSourceId:s.id,paymentResource:i,attributes:{options:Object.assign(Object.assign({},j),{setup_future_usage:"off_session"})}}),!0}catch{return!1}}}return!1};return M("form",Object.assign({ref:t,onSubmit:r=>f(r,a,l)},{children:[m(T,{options:Object.assign(Object.assign({},w),p)},void 0),n&&m(F,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:n}),void 0)]}),void 0)},q=p=>{var{publishableKey:n,show:t,options:y,locale:s="auto"}=p,i=C(p,["publishableKey","show","options","locale"]);const[b,c]=E(!1),[o,a]=E(null),{containerClassName:l,templateCustomerSaveToWallet:f,fonts:r=[]}=i,d=C(i,["containerClassName","templateCustomerSaveToWallet","fonts"]);return O(()=>{if(t&&n){const{loadStripe:v}=require("@stripe/stripe-js");(async()=>{const u=await v(n,{locale:s});a(u),c(!0)})()}return()=>{c(!1)}},[t,n]),b&&o?m("div",Object.assign({className:l},d,{children:m(L,Object.assign({stripe:o,options:{fonts:r}},{children:m(k,{options:y,templateCustomerSaveToWallet:f},void 0)}),void 0)}),void 0):null};export default q;
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import{CardElement,Elements,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{setCustomerOrderParam}from"../utils/localStorage";const defaultOptions={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode:true};const StripePaymentForm=({options:e=defaultOptions,templateCustomerSaveToWallet:t})=>{const o=useRef(null);const{setPaymentSource:s,paymentSource:n,currentPaymentMethodType:r,setPaymentMethodErrors:a,setPaymentRef:i}=useContext(PaymentMethodContext);const{order:l}=useContext(OrderContext);const c=useStripe();const u=useElements();useEffect((()=>{if(o.current&&c&&u){o.current.onsubmit=()=>d(o.current,c,u);i({ref:o})}return()=>{i({ref:{current:null}})}}),[o,c,u]);const d=async(e,t,o)=>{var i,c;if(!t)return false;const u=(c=(i=e===null||e===void 0?void 0:e.elements)===null||i===void 0?void 0:i["save_payment_source_to_customer_wallet"])===null||c===void 0?void 0:c.checked;if(u)setCustomerOrderParam("_save_payment_source_to_customer_wallet",u);const d=o&&o.getElement(CardElement);if(d){const e=l===null||l===void 0?void 0:l.billing_address;const o=l===null||l===void 0?void 0:l.customer_email;const i={name:e===null||e===void 0?void 0:e.full_name,email:o,phone:e===null||e===void 0?void 0:e.phone,address:{city:e===null||e===void 0?void 0:e.city,country:e===null||e===void 0?void 0:e.country_code,line1:e===null||e===void 0?void 0:e.line_1,postal_code:e===null||e===void 0?void 0:e.zip_code,state:e===null||e===void 0?void 0:e.state_code}};const{paymentMethod:c}=await t.createPaymentMethod({type:"card",card:d,billing_details:i});if(n===null||n===void 0?void 0:n.client_secret){const{error:e,paymentIntent:o}=await t.confirmCardPayment(n.client_secret,{payment_method:{card:d,billing_details:i}});if(e){console.error(e);a([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:r,message:e.message}])}else{if(o&&c&&n&&r){try{await s({paymentSourceId:n.id,paymentResource:r,attributes:{options:Object.assign(Object.assign({},c),{setup_future_usage:"off_session"})}});return true}catch(e){return false}}}}}return false};return _jsxs("form",Object.assign({ref:o,onSubmit:e=>d(e,c,u)},{children:[_jsx(CardElement,{options:Object.assign(Object.assign({},defaultOptions),e)},void 0),t&&_jsx(Parent,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:t}),void 0)]}),void 0)};const StripePayment=e=>{var{publishableKey:t,show:o,options:s,locale:n="auto"}=e,r=__rest(e,["publishableKey","show","options","locale"]);const[a,i]=useState(false);const[l,c]=useState(null);const{containerClassName:u,templateCustomerSaveToWallet:d,fonts:m=[]}=r,p=__rest(r,["containerClassName","templateCustomerSaveToWallet","fonts"]);useEffect((()=>{if(o&&t){const{loadStripe:e}=require("@stripe/stripe-js");const o=async()=>{const o=await e(t,{locale:n});c(o);i(true)};o()}return()=>{i(false)}}),[o,t]);return a&&l?_jsx("div",Object.assign({className:u},p,{children:_jsx(Elements,Object.assign({stripe:l,options:{fonts:m}},{children:_jsx(StripePaymentForm,{options:s,templateCustomerSaveToWallet:d},void 0)}),void 0)}),void 0):null};export default StripePayment;
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import r from"./utils/BaseOrderPrice";import t from"../config/components";const a=t.SubTotalAmount.propTypes,p=t.SubTotalAmount.defaultProps,m=t.SubTotalAmount.displayName,o=s=>e(r,Object.assign({base:"amount",type:"subtotal"},s),void 0);o.propTypes=a,o.defaultProps=p,o.displayName=m;export default o;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.SubTotalAmount.propTypes;const defaultProps=components.SubTotalAmount.defaultProps;const displayName=components.SubTotalAmount.displayName;const SubTotalAmount=o=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"subtotal"},o),void 0);SubTotalAmount.propTypes=propTypes;SubTotalAmount.defaultProps=defaultProps;SubTotalAmount.displayName=displayName;export default SubTotalAmount;
@@ -1 +1 @@
1
- import{__rest as a}from"tslib";import{jsx as r}from"react/jsx-runtime";import m from"./utils/Parent";import s from"../config/components";import c from"lodash/isFunction";const u=s.SubmitButton.propTypes,l=s.SubmitButton.defaultProps,b=s.SubmitButton.displayName,o=n=>{const{children:i,label:t="Submit"}=n,e=a(n,["children","label"]),p=Object.assign(Object.assign({},e),{label:t});return i?r(m,Object.assign({},p,{children:i}),void 0):r("button",Object.assign({type:"submit"},e,{children:c(t)?t():t}),void 0)};o.propTypes=u,o.defaultProps=l,o.displayName=b;export default o;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";import isFunction from"lodash/isFunction";const propTypes=components.SubmitButton.propTypes;const defaultProps=components.SubmitButton.defaultProps;const displayName=components.SubmitButton.displayName;const SubmitButton=t=>{const{children:o,label:s="Submit"}=t,n=__rest(t,["children","label"]);const e=Object.assign(Object.assign({},n),{label:s});return o?_jsx(Parent,Object.assign({},e,{children:o}),void 0):_jsx("button",Object.assign({type:"submit"},n,{children:isFunction(s)?s():s}),void 0)};SubmitButton.propTypes=propTypes;SubmitButton.defaultProps=defaultProps;SubmitButton.displayName=displayName;export default SubmitButton;
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import a from"./utils/BaseOrderPrice";import o from"../config/components";const r=o.TaxesAmount.propTypes,p=o.TaxesAmount.defaultProps,m=o.TaxesAmount.displayName,e=s=>t(a,Object.assign({base:"amount",type:"total_tax"},s),void 0);e.propTypes=r,e.defaultProps=p,e.displayName=m;export default e;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TaxesAmount.propTypes;const defaultProps=components.TaxesAmount.defaultProps;const displayName=components.TaxesAmount.displayName;const TaxesAmount=e=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"total_tax"},e),void 0);TaxesAmount.propTypes=propTypes;TaxesAmount.defaultProps=defaultProps;TaxesAmount.displayName=displayName;export default TaxesAmount;
@@ -1 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import a from"./utils/BaseOrderPrice";import t from"../config/components";const r=t.TotalAmount.propTypes,p=t.TotalAmount.defaultProps,m=t.TotalAmount.displayName,o=e=>s(a,Object.assign({base:"total_amount",type:"with_taxes"},e),void 0);o.propTypes=r,o.defaultProps=p,o.displayName=m;export default o;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TotalAmount.propTypes;const defaultProps=components.TotalAmount.defaultProps;const displayName=components.TotalAmount.displayName;const TotalAmount=o=>_jsx(BaseOrderPrice,Object.assign({base:"total_amount",type:"with_taxes"},o),void 0);TotalAmount.propTypes=propTypes;TotalAmount.defaultProps=defaultProps;TotalAmount.displayName=displayName;export default TotalAmount;
@@ -1 +1 @@
1
- import{__rest as v}from"tslib";import{jsx as e}from"react/jsx-runtime";import{Fragment as c,useContext as x,useEffect as S}from"react";import V from"./utils/VariantTemplate";import j from"./utils/Parent";import P from"../context/VariantsContext";import r from"../config/components";const T=r.VariantSelector.propTypes,b=r.VariantSelector.defaultProps,N=r.VariantSelector.displayName,a=t=>{const{children:s,type:m,placeholder:u,skuCode:f,name:C,options:n}=t,h=v(t,["children","type","placeholder","skuCode","name","options"]),{setSkuCode:i,skuCode:g,loading:d,variants:l,setSkuCodes:o}=x(P);S(()=>(o&&o(n),()=>{o&&o([])}),[n]);const p=g||f||"",y=()=>d?e(c,{children:t.loader||"Loading..."},void 0):e(V,Object.assign({variants:l,type:m,placeholder:u,skuCode:p,options:n,handleChange:i,name:C},h),void 0),k=Object.assign({variants:l,loading:!!d,handleSelect:i,skuCode:p},t);return s?e(j,Object.assign({},k,{children:s}),void 0):e(c,{children:e(y,{},void 0)},void 0)};a.propTypes=T,a.defaultProps=b,a.displayName=N;export default a;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect}from"react";import VariantTemplate from"./utils/VariantTemplate";import Parent from"./utils/Parent";import VariantsContext from"../context/VariantsContext";import components from"../config/components";const propTypes=components.VariantSelector.propTypes;const defaultProps=components.VariantSelector.defaultProps;const displayName=components.VariantSelector.displayName;const VariantSelector=e=>{const{children:t,type:o,placeholder:a,skuCode:n,name:r,options:s}=e,i=__rest(e,["children","type","placeholder","skuCode","name","options"]);const{setSkuCode:p,skuCode:c,loading:l,variants:d,setSkuCodes:m}=useContext(VariantsContext);useEffect((()=>{m&&m(s);return()=>{m&&m([])}}),[s]);const u=c||n||"";const f=()=>l?_jsx(Fragment,{children:e.loader||"Loading..."},void 0):_jsx(VariantTemplate,Object.assign({variants:d,type:o,placeholder:a,skuCode:u,options:s,handleChange:p,name:r},i),void 0);const x=Object.assign({variants:d,loading:!!l,handleSelect:p,skuCode:u},e);return t?_jsx(Parent,Object.assign({},x,{children:t}),void 0):_jsx(Fragment,{children:_jsx(f,{},void 0)},void 0)};VariantSelector.propTypes=propTypes;VariantSelector.defaultProps=defaultProps;VariantSelector.displayName=displayName;export default VariantSelector;