@commercelayer/react-components 2.48.0 → 2.49.0

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 (372) 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.d.ts +5 -1
  11. package/lib/cjs/components/AvailabilityTemplate.js +1 -1
  12. package/lib/cjs/components/BillingAddressContainer.js +1 -1
  13. package/lib/cjs/components/BillingAddressForm.js +1 -1
  14. package/lib/cjs/components/BraintreePayment.js +1 -1
  15. package/lib/cjs/components/CheckoutLink.js +1 -1
  16. package/lib/cjs/components/CommerceLayer.js +1 -1
  17. package/lib/cjs/components/CustomerContainer.js +1 -1
  18. package/lib/cjs/components/CustomerInput.js +1 -1
  19. package/lib/cjs/components/DeliveryLeadTime.js +1 -1
  20. package/lib/cjs/components/DiscountAmount.js +1 -1
  21. package/lib/cjs/components/Errors.js +1 -1
  22. package/lib/cjs/components/ExternalFunction.js +1 -1
  23. package/lib/cjs/components/GiftCard.js +1 -1
  24. package/lib/cjs/components/GiftCardAmount.js +1 -1
  25. package/lib/cjs/components/GiftCardContainer.js +1 -1
  26. package/lib/cjs/components/GiftCardCurrencySelector.js +1 -1
  27. package/lib/cjs/components/GiftCardInput.js +1 -1
  28. package/lib/cjs/components/GiftCardOrCouponCode.js +1 -1
  29. package/lib/cjs/components/GiftCardOrCouponForm.js +1 -1
  30. package/lib/cjs/components/GiftCardOrCouponInput.js +1 -1
  31. package/lib/cjs/components/GiftCardOrCouponRemoveButton.js +1 -1
  32. package/lib/cjs/components/GiftCardOrCouponSubmit.js +1 -1
  33. package/lib/cjs/components/ItemContainer.js +1 -1
  34. package/lib/cjs/components/LineItem.js +1 -1
  35. package/lib/cjs/components/LineItemAmount.js +1 -1
  36. package/lib/cjs/components/LineItemCode.js +1 -1
  37. package/lib/cjs/components/LineItemImage.js +1 -1
  38. package/lib/cjs/components/LineItemName.js +1 -1
  39. package/lib/cjs/components/LineItemOption.js +1 -1
  40. package/lib/cjs/components/LineItemOptions.js +1 -1
  41. package/lib/cjs/components/LineItemQuantity.js +1 -1
  42. package/lib/cjs/components/LineItemRemoveLink.js +1 -1
  43. package/lib/cjs/components/LineItemsContainer.js +1 -1
  44. package/lib/cjs/components/LineItemsCount.js +1 -1
  45. package/lib/cjs/components/MetadataInput.js +1 -1
  46. package/lib/cjs/components/OrderContainer.js +1 -1
  47. package/lib/cjs/components/OrderNumber.js +1 -1
  48. package/lib/cjs/components/OrderStorage.js +1 -1
  49. package/lib/cjs/components/PaymentGateway.js +1 -1
  50. package/lib/cjs/components/PaymentMethod.js +1 -1
  51. package/lib/cjs/components/PaymentMethodAmount.js +1 -1
  52. package/lib/cjs/components/PaymentMethodName.js +1 -1
  53. package/lib/cjs/components/PaymentMethodPrice.js +1 -1
  54. package/lib/cjs/components/PaymentMethodRadioButton.js +1 -1
  55. package/lib/cjs/components/PaymentMethodsContainer.js +1 -1
  56. package/lib/cjs/components/PaymentSource.js +1 -1
  57. package/lib/cjs/components/PaymentSourceBrandIcon.js +1 -1
  58. package/lib/cjs/components/PaymentSourceBrandName.js +1 -1
  59. package/lib/cjs/components/PaymentSourceDetail.js +1 -1
  60. package/lib/cjs/components/PaymentSourceEditButton.js +1 -1
  61. package/lib/cjs/components/PaypalPayment.js +1 -1
  62. package/lib/cjs/components/PlaceOrderButton.js +1 -1
  63. package/lib/cjs/components/PlaceOrderContainer.js +1 -1
  64. package/lib/cjs/components/Price.js +1 -1
  65. package/lib/cjs/components/PricesContainer.js +1 -1
  66. package/lib/cjs/components/PrivacyAndTermsCheckbox.js +1 -1
  67. package/lib/cjs/components/QuantitySelector.js +1 -1
  68. package/lib/cjs/components/SaveAddressesButton.js +1 -1
  69. package/lib/cjs/components/SaveCustomerButton.js +1 -1
  70. package/lib/cjs/components/Shipment.js +1 -1
  71. package/lib/cjs/components/ShipmentField.js +1 -1
  72. package/lib/cjs/components/ShipmentsContainer.js +1 -1
  73. package/lib/cjs/components/ShippingAddressContainer.js +1 -1
  74. package/lib/cjs/components/ShippingAddressForm.js +1 -1
  75. package/lib/cjs/components/ShippingAmount.js +1 -1
  76. package/lib/cjs/components/ShippingMethod.js +1 -1
  77. package/lib/cjs/components/ShippingMethodName.js +1 -1
  78. package/lib/cjs/components/ShippingMethodPrice.js +1 -1
  79. package/lib/cjs/components/ShippingMethodRadioButton.js +1 -1
  80. package/lib/cjs/components/SkuList.js +1 -1
  81. package/lib/cjs/components/SkuListsContainer.js +1 -1
  82. package/lib/cjs/components/SkuOption.js +1 -1
  83. package/lib/cjs/components/SkuOptionInput.js +1 -1
  84. package/lib/cjs/components/SkuOptionsContainer.js +1 -1
  85. package/lib/cjs/components/StockTransfer.js +1 -1
  86. package/lib/cjs/components/StockTransferField.js +1 -1
  87. package/lib/cjs/components/StripePayment.js +1 -1
  88. package/lib/cjs/components/SubTotalAmount.js +1 -1
  89. package/lib/cjs/components/SubmitButton.js +1 -1
  90. package/lib/cjs/components/TaxesAmount.js +1 -1
  91. package/lib/cjs/components/TotalAmount.js +1 -1
  92. package/lib/cjs/components/VariantSelector.js +1 -1
  93. package/lib/cjs/components/VariantsContainer.js +1 -1
  94. package/lib/cjs/components/WireTransferPayment.js +1 -1
  95. package/lib/cjs/components/gateways/AdyenGateway.js +1 -1
  96. package/lib/cjs/components/gateways/BraintreeGateway.js +1 -1
  97. package/lib/cjs/components/gateways/PaypalGateway.js +1 -1
  98. package/lib/cjs/components/gateways/StripeGateway.js +1 -1
  99. package/lib/cjs/components/gateways/WireTransferGateway.js +1 -1
  100. package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
  101. package/lib/cjs/components/utils/BaseField.js +1 -1
  102. package/lib/cjs/components/utils/BaseInput.js +1 -1
  103. package/lib/cjs/components/utils/BaseOrderPrice.js +1 -1
  104. package/lib/cjs/components/utils/BaseSelect.js +1 -1
  105. package/lib/cjs/components/utils/Parent.js +1 -1
  106. package/lib/cjs/components/utils/PaymentCardsTemplate.js +1 -1
  107. package/lib/cjs/components/utils/PriceTemplate.js +1 -1
  108. package/lib/cjs/components/utils/VariantTemplate.js +1 -1
  109. package/lib/cjs/components/utils/getAllErrors.js +1 -1
  110. package/lib/cjs/config/components.js +1 -1
  111. package/lib/cjs/config/currency.js +1 -1
  112. package/lib/cjs/context/AddressChildrenContext.js +1 -1
  113. package/lib/cjs/context/AddressContext.js +1 -1
  114. package/lib/cjs/context/AvailabilityContext.js +1 -1
  115. package/lib/cjs/context/BillingAddressContext.js +1 -1
  116. package/lib/cjs/context/BillingAddressFormContext.js +1 -1
  117. package/lib/cjs/context/CommerceLayerContext.js +1 -1
  118. package/lib/cjs/context/CouponAndGiftCardFormContext.js +1 -1
  119. package/lib/cjs/context/CustomerContext.js +1 -1
  120. package/lib/cjs/context/ExternalFunctionContext.js +1 -1
  121. package/lib/cjs/context/GiftCardContext.js +1 -1
  122. package/lib/cjs/context/ItemContext.js +1 -1
  123. package/lib/cjs/context/LineItemChildrenContext.js +1 -1
  124. package/lib/cjs/context/LineItemContext.js +1 -1
  125. package/lib/cjs/context/LineItemOptionChildrenContext.js +1 -1
  126. package/lib/cjs/context/OrderContext.js +1 -1
  127. package/lib/cjs/context/OrderStorageContext.js +1 -1
  128. package/lib/cjs/context/PaymentMethodChildrenContext.js +1 -1
  129. package/lib/cjs/context/PaymentMethodContext.js +1 -1
  130. package/lib/cjs/context/PaymentSourceContext.js +1 -1
  131. package/lib/cjs/context/PlaceOrderContext.js +1 -1
  132. package/lib/cjs/context/PricesContext.js +1 -1
  133. package/lib/cjs/context/ShipmentChildrenContext.js +1 -1
  134. package/lib/cjs/context/ShipmentContext.js +1 -1
  135. package/lib/cjs/context/ShippingAddressContext.js +1 -1
  136. package/lib/cjs/context/ShippingAddressFormContext.js +1 -1
  137. package/lib/cjs/context/ShippingMethodChildrenContext.js +1 -1
  138. package/lib/cjs/context/SkuListsContext.js +1 -1
  139. package/lib/cjs/context/SkuOptionChildrenContext.js +1 -1
  140. package/lib/cjs/context/SkuOptionsContext.js +1 -1
  141. package/lib/cjs/context/StockTransferChildrenContext.js +1 -1
  142. package/lib/cjs/context/VariantsContext.js +1 -1
  143. package/lib/cjs/index.js +1 -1
  144. package/lib/cjs/reducers/AddressReducer.js +1 -1
  145. package/lib/cjs/reducers/AvailabilityReducer.js +1 -1
  146. package/lib/cjs/reducers/BillingAddressReducer.js +1 -1
  147. package/lib/cjs/reducers/CustomerReducer.js +1 -1
  148. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  149. package/lib/cjs/reducers/ItemReducer.js +1 -1
  150. package/lib/cjs/reducers/LineItemReducer.js +1 -1
  151. package/lib/cjs/reducers/OrderReducer.js +1 -1
  152. package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
  153. package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
  154. package/lib/cjs/reducers/PriceReducer.js +1 -1
  155. package/lib/cjs/reducers/ShipmentReducer.js +1 -1
  156. package/lib/cjs/reducers/ShippingAddressReducer.js +1 -1
  157. package/lib/cjs/reducers/SkuListsReducer.js +1 -1
  158. package/lib/cjs/reducers/SkuOptionsReducer.js +1 -1
  159. package/lib/cjs/reducers/VariantReducer.js +1 -1
  160. package/lib/cjs/typings/errors.js +1 -1
  161. package/lib/cjs/typings/index.js +1 -1
  162. package/lib/cjs/utils/PropsType.js +1 -1
  163. package/lib/cjs/utils/addressesManager.js +1 -1
  164. package/lib/cjs/utils/baseReducer.js +1 -1
  165. package/lib/cjs/utils/browserInfo.js +1 -1
  166. package/lib/cjs/utils/childrenTypes.js +1 -1
  167. package/lib/cjs/utils/countryStateCity.js +1 -1
  168. package/lib/cjs/utils/customMessages.js +1 -1
  169. package/lib/cjs/utils/customerOrderOptions.js +1 -1
  170. package/lib/cjs/utils/getAmount.js +1 -1
  171. package/lib/cjs/utils/getCurrentItemKey.js +1 -1
  172. package/lib/cjs/utils/getErrors.js +1 -1
  173. package/lib/cjs/utils/getLineItemsCount.js +1 -1
  174. package/lib/cjs/utils/getLoaderComponent.js +1 -1
  175. package/lib/cjs/utils/getPrices.js +1 -1
  176. package/lib/cjs/utils/getSdk.js +1 -1
  177. package/lib/cjs/utils/getSkus.js +1 -1
  178. package/lib/cjs/utils/isEmptyStates.js +1 -1
  179. package/lib/cjs/utils/isJSON.js +1 -1
  180. package/lib/cjs/utils/jwt.js +1 -1
  181. package/lib/cjs/utils/localStorage.js +1 -1
  182. package/lib/cjs/utils/organization.js +1 -1
  183. package/lib/cjs/utils/paypalPayment.js +1 -1
  184. package/lib/cjs/utils/promisify.js +1 -1
  185. package/lib/cjs/utils/shipments.js +1 -1
  186. package/lib/cjs/utils/validateFormFields.js +1 -1
  187. package/lib/esm/components/AddToCartButton.js +1 -1
  188. package/lib/esm/components/Address.js +1 -1
  189. package/lib/esm/components/AddressCountrySelector.js +1 -1
  190. package/lib/esm/components/AddressField.js +1 -1
  191. package/lib/esm/components/AddressInput.js +1 -1
  192. package/lib/esm/components/AddressStateSelector.js +1 -1
  193. package/lib/esm/components/AddressesContainer.js +1 -1
  194. package/lib/esm/components/AdyenPayment.js +1 -1
  195. package/lib/esm/components/AvailabilityContainer.js +1 -1
  196. package/lib/esm/components/AvailabilityTemplate.d.ts +5 -1
  197. package/lib/esm/components/AvailabilityTemplate.js +1 -1
  198. package/lib/esm/components/BillingAddressContainer.js +1 -1
  199. package/lib/esm/components/BillingAddressForm.js +1 -1
  200. package/lib/esm/components/BraintreePayment.js +1 -1
  201. package/lib/esm/components/CheckoutLink.js +1 -1
  202. package/lib/esm/components/CommerceLayer.js +1 -1
  203. package/lib/esm/components/CustomerContainer.js +1 -1
  204. package/lib/esm/components/CustomerInput.js +1 -1
  205. package/lib/esm/components/DeliveryLeadTime.js +1 -1
  206. package/lib/esm/components/DiscountAmount.js +1 -1
  207. package/lib/esm/components/Errors.js +1 -1
  208. package/lib/esm/components/ExternalFunction.js +1 -1
  209. package/lib/esm/components/GiftCard.js +1 -1
  210. package/lib/esm/components/GiftCardAmount.js +1 -1
  211. package/lib/esm/components/GiftCardContainer.js +1 -1
  212. package/lib/esm/components/GiftCardCurrencySelector.js +1 -1
  213. package/lib/esm/components/GiftCardInput.js +1 -1
  214. package/lib/esm/components/GiftCardOrCouponCode.js +1 -1
  215. package/lib/esm/components/GiftCardOrCouponForm.js +1 -1
  216. package/lib/esm/components/GiftCardOrCouponInput.js +1 -1
  217. package/lib/esm/components/GiftCardOrCouponRemoveButton.js +1 -1
  218. package/lib/esm/components/GiftCardOrCouponSubmit.js +1 -1
  219. package/lib/esm/components/ItemContainer.js +1 -1
  220. package/lib/esm/components/LineItem.js +1 -1
  221. package/lib/esm/components/LineItemAmount.js +1 -1
  222. package/lib/esm/components/LineItemCode.js +1 -1
  223. package/lib/esm/components/LineItemImage.js +1 -1
  224. package/lib/esm/components/LineItemName.js +1 -1
  225. package/lib/esm/components/LineItemOption.js +1 -1
  226. package/lib/esm/components/LineItemOptions.js +1 -1
  227. package/lib/esm/components/LineItemQuantity.js +1 -1
  228. package/lib/esm/components/LineItemRemoveLink.js +1 -1
  229. package/lib/esm/components/LineItemsContainer.js +1 -1
  230. package/lib/esm/components/LineItemsCount.js +1 -1
  231. package/lib/esm/components/MetadataInput.js +1 -1
  232. package/lib/esm/components/OrderContainer.js +1 -1
  233. package/lib/esm/components/OrderNumber.js +1 -1
  234. package/lib/esm/components/OrderStorage.js +1 -1
  235. package/lib/esm/components/PaymentGateway.js +1 -1
  236. package/lib/esm/components/PaymentMethod.js +1 -1
  237. package/lib/esm/components/PaymentMethodAmount.js +1 -1
  238. package/lib/esm/components/PaymentMethodName.js +1 -1
  239. package/lib/esm/components/PaymentMethodPrice.js +1 -1
  240. package/lib/esm/components/PaymentMethodRadioButton.js +1 -1
  241. package/lib/esm/components/PaymentMethodsContainer.js +1 -1
  242. package/lib/esm/components/PaymentSource.js +1 -1
  243. package/lib/esm/components/PaymentSourceBrandIcon.js +1 -1
  244. package/lib/esm/components/PaymentSourceBrandName.js +1 -1
  245. package/lib/esm/components/PaymentSourceDetail.js +1 -1
  246. package/lib/esm/components/PaymentSourceEditButton.js +1 -1
  247. package/lib/esm/components/PaypalPayment.js +1 -1
  248. package/lib/esm/components/PlaceOrderButton.js +1 -1
  249. package/lib/esm/components/PlaceOrderContainer.js +1 -1
  250. package/lib/esm/components/Price.js +1 -1
  251. package/lib/esm/components/PricesContainer.js +1 -1
  252. package/lib/esm/components/PrivacyAndTermsCheckbox.js +1 -1
  253. package/lib/esm/components/QuantitySelector.js +1 -1
  254. package/lib/esm/components/SaveAddressesButton.js +1 -1
  255. package/lib/esm/components/SaveCustomerButton.js +1 -1
  256. package/lib/esm/components/Shipment.js +1 -1
  257. package/lib/esm/components/ShipmentField.js +1 -1
  258. package/lib/esm/components/ShipmentsContainer.js +1 -1
  259. package/lib/esm/components/ShippingAddressContainer.js +1 -1
  260. package/lib/esm/components/ShippingAddressForm.js +1 -1
  261. package/lib/esm/components/ShippingAmount.js +1 -1
  262. package/lib/esm/components/ShippingMethod.js +1 -1
  263. package/lib/esm/components/ShippingMethodName.js +1 -1
  264. package/lib/esm/components/ShippingMethodPrice.js +1 -1
  265. package/lib/esm/components/ShippingMethodRadioButton.js +1 -1
  266. package/lib/esm/components/SkuList.js +1 -1
  267. package/lib/esm/components/SkuListsContainer.js +1 -1
  268. package/lib/esm/components/SkuOption.js +1 -1
  269. package/lib/esm/components/SkuOptionInput.js +1 -1
  270. package/lib/esm/components/SkuOptionsContainer.js +1 -1
  271. package/lib/esm/components/StockTransfer.js +1 -1
  272. package/lib/esm/components/StockTransferField.js +1 -1
  273. package/lib/esm/components/StripePayment.js +1 -1
  274. package/lib/esm/components/SubTotalAmount.js +1 -1
  275. package/lib/esm/components/SubmitButton.js +1 -1
  276. package/lib/esm/components/TaxesAmount.js +1 -1
  277. package/lib/esm/components/TotalAmount.js +1 -1
  278. package/lib/esm/components/VariantSelector.js +1 -1
  279. package/lib/esm/components/VariantsContainer.js +1 -1
  280. package/lib/esm/components/WireTransferPayment.js +1 -1
  281. package/lib/esm/components/gateways/AdyenGateway.js +1 -1
  282. package/lib/esm/components/gateways/BraintreeGateway.js +1 -1
  283. package/lib/esm/components/gateways/PaypalGateway.js +1 -1
  284. package/lib/esm/components/gateways/StripeGateway.js +1 -1
  285. package/lib/esm/components/gateways/WireTransferGateway.js +1 -1
  286. package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
  287. package/lib/esm/components/utils/BaseField.js +1 -1
  288. package/lib/esm/components/utils/BaseInput.js +1 -1
  289. package/lib/esm/components/utils/BaseOrderPrice.js +1 -1
  290. package/lib/esm/components/utils/BaseSelect.js +1 -1
  291. package/lib/esm/components/utils/Parent.js +1 -1
  292. package/lib/esm/components/utils/PaymentCardsTemplate.js +1 -1
  293. package/lib/esm/components/utils/PriceTemplate.js +1 -1
  294. package/lib/esm/components/utils/VariantTemplate.js +1 -1
  295. package/lib/esm/components/utils/getAllErrors.js +1 -1
  296. package/lib/esm/config/components.js +1 -1
  297. package/lib/esm/context/AddressChildrenContext.js +1 -1
  298. package/lib/esm/context/AddressContext.js +1 -1
  299. package/lib/esm/context/AvailabilityContext.js +1 -1
  300. package/lib/esm/context/BillingAddressContext.js +1 -1
  301. package/lib/esm/context/BillingAddressFormContext.js +1 -1
  302. package/lib/esm/context/CommerceLayerContext.js +1 -1
  303. package/lib/esm/context/CouponAndGiftCardFormContext.js +1 -1
  304. package/lib/esm/context/CustomerContext.js +1 -1
  305. package/lib/esm/context/ExternalFunctionContext.js +1 -1
  306. package/lib/esm/context/GiftCardContext.js +1 -1
  307. package/lib/esm/context/ItemContext.js +1 -1
  308. package/lib/esm/context/LineItemChildrenContext.js +1 -1
  309. package/lib/esm/context/LineItemContext.js +1 -1
  310. package/lib/esm/context/LineItemOptionChildrenContext.js +1 -1
  311. package/lib/esm/context/OrderContext.js +1 -1
  312. package/lib/esm/context/OrderStorageContext.js +1 -1
  313. package/lib/esm/context/PaymentMethodChildrenContext.js +1 -1
  314. package/lib/esm/context/PaymentMethodContext.js +1 -1
  315. package/lib/esm/context/PaymentSourceContext.js +1 -1
  316. package/lib/esm/context/PlaceOrderContext.js +1 -1
  317. package/lib/esm/context/PricesContext.js +1 -1
  318. package/lib/esm/context/ShipmentChildrenContext.js +1 -1
  319. package/lib/esm/context/ShipmentContext.js +1 -1
  320. package/lib/esm/context/ShippingAddressContext.js +1 -1
  321. package/lib/esm/context/ShippingAddressFormContext.js +1 -1
  322. package/lib/esm/context/ShippingMethodChildrenContext.js +1 -1
  323. package/lib/esm/context/SkuListsContext.js +1 -1
  324. package/lib/esm/context/SkuOptionChildrenContext.js +1 -1
  325. package/lib/esm/context/SkuOptionsContext.js +1 -1
  326. package/lib/esm/context/StockTransferChildrenContext.js +1 -1
  327. package/lib/esm/context/VariantsContext.js +1 -1
  328. package/lib/esm/reducers/AddressReducer.js +1 -1
  329. package/lib/esm/reducers/AvailabilityReducer.js +1 -1
  330. package/lib/esm/reducers/BillingAddressReducer.js +1 -1
  331. package/lib/esm/reducers/CustomerReducer.js +1 -1
  332. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  333. package/lib/esm/reducers/ItemReducer.js +1 -1
  334. package/lib/esm/reducers/LineItemReducer.js +1 -1
  335. package/lib/esm/reducers/OrderReducer.js +1 -1
  336. package/lib/esm/reducers/PaymentMethodReducer.js +1 -1
  337. package/lib/esm/reducers/PlaceOrderReducer.js +1 -1
  338. package/lib/esm/reducers/PriceReducer.js +1 -1
  339. package/lib/esm/reducers/ShipmentReducer.js +1 -1
  340. package/lib/esm/reducers/ShippingAddressReducer.js +1 -1
  341. package/lib/esm/reducers/SkuListsReducer.js +1 -1
  342. package/lib/esm/reducers/SkuOptionsReducer.js +1 -1
  343. package/lib/esm/reducers/VariantReducer.js +1 -1
  344. package/lib/esm/typings/errors.js +1 -1
  345. package/lib/esm/typings/index.js +1 -1
  346. package/lib/esm/utils/addressesManager.js +1 -1
  347. package/lib/esm/utils/baseReducer.js +1 -1
  348. package/lib/esm/utils/browserInfo.js +1 -1
  349. package/lib/esm/utils/childrenTypes.js +1 -1
  350. package/lib/esm/utils/countryStateCity.js +1 -1
  351. package/lib/esm/utils/customMessages.js +1 -1
  352. package/lib/esm/utils/customerOrderOptions.js +1 -1
  353. package/lib/esm/utils/getAmount.js +1 -1
  354. package/lib/esm/utils/getCurrentItemKey.js +1 -1
  355. package/lib/esm/utils/getErrors.js +1 -1
  356. package/lib/esm/utils/getLineItemsCount.js +1 -1
  357. package/lib/esm/utils/getLoaderComponent.js +1 -1
  358. package/lib/esm/utils/getPrices.js +1 -1
  359. package/lib/esm/utils/getSdk.js +1 -1
  360. package/lib/esm/utils/getSkus.js +1 -1
  361. package/lib/esm/utils/isEmptyStates.js +1 -1
  362. package/lib/esm/utils/isJSON.js +1 -1
  363. package/lib/esm/utils/jwt.js +1 -1
  364. package/lib/esm/utils/localStorage.js +1 -1
  365. package/lib/esm/utils/organization.js +1 -1
  366. package/lib/esm/utils/paypalPayment.js +1 -1
  367. package/lib/esm/utils/promisify.js +1 -1
  368. package/lib/esm/utils/shipments.js +1 -1
  369. package/lib/esm/utils/validateFormFields.js +1 -1
  370. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  371. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  372. package/package.json +17 -17
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import isEmpty from"lodash/isEmpty";import{setCustomerOrderParam}from"../utils/localStorage";import Parent from"./utils/Parent";import getBrowserInfo from"../utils/browserInfo";import PlaceOrderContext from"../context/PlaceOrderContext";const threeDSConfiguration={challengeWindowSize:"05"};const defaultConfig={};const AdyenPayment=({clientKey:e,config:t,templateCustomerSaveToWallet:n,environment:o="test",locale:a="en_US"})=>{const{cardContainerClassName:r,threeDSecureContainerClassName:s,placeOrderCallback:i,styles:d}=Object.assign(Object.assign({},defaultConfig),t);const[c,l]=useState(false);const[m,u]=useState({});const{setPaymentSource:y,paymentSource:p,setPaymentMethodErrors:_,currentPaymentMethodType:f,setPaymentRef:v}=useContext(PaymentMethodContext);const{setPlaceOrder:h}=useContext(PlaceOrderContext);const g=useRef(null);const C=async(e,t)=>{var n,o,a,r,s,i,d;const c=(o=(n=e===null||e===void 0?void 0:e.elements)===null||n===void 0?void 0:n["save_payment_source_to_customer_wallet"])===null||o===void 0?void 0:o.checked;if(c)setCustomerOrderParam("_save_payment_source_to_customer_wallet",c);const l={_authorize:1};try{const e=p&&await y({paymentSourceId:p.id,paymentResource:"adyen_payments",attributes:l});debugger;const n=(a=e===null||e===void 0?void 0:e.payment_response)===null||a===void 0?void 0:a.action;const o=(r=e===null||e===void 0?void 0:e.payment_response)===null||r===void 0?void 0:r.resultCode;if(n&&o==="IdentifyShopper"){t.createFromAction(n,threeDSConfiguration).mount("#adyen-action")}else if(["Authorised","Pending","Received"].includes(o)){const t=(i=(s=e===null||e===void 0?void 0:e.payment_request_data)===null||s===void 0?void 0:s.payment_method)===null||i===void 0?void 0:i.brand;if(t){const n={metadata:{card:{brand:t}}};await y({paymentSourceId:e===null||e===void 0?void 0:e.id,paymentResource:"adyen_payments",attributes:n})}return true}const c=(d=e===null||e===void 0?void 0:e.payment_response)===null||d===void 0?void 0:d.refusalReason;_([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:f,message:c}]);return false}catch(e){_([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:f,message:e.message}]);return false}};const w=async(e,t,n,o)=>{if(e.isValid){if(g.current){const e=require("@adyen/adyen-web");const t=await e(n);g.current.onsubmit=()=>C(g.current,t);v({ref:g})}let t=getBrowserInfo();const a={payment_request_data:{payment_method:e.data.paymentMethod,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",origin:window.location.origin,return_url:window.location.href,browser_info:Object.assign({acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},t)}};o&&await y({paymentSourceId:o.id,paymentResource:"adyen_payments",attributes:a})}};const P=async(e,t,n)=>{var o,a;const r={payment_request_details:e.data,_details:1};try{const e=p&&await y({paymentSourceId:p.id,paymentResource:"adyen_payments",attributes:r});const t=(o=e===null||e===void 0?void 0:e.payment_response)===null||o===void 0?void 0:o.action;const s=(a=e===null||e===void 0?void 0:e.payment_response)===null||a===void 0?void 0:a.resultCode;const d=require("@adyen/adyen-web");if(t){const e=await d(n);e.createFromAction(t,threeDSConfiguration).mount("#adyen-action")}if(["Authorised","Pending","Received"].includes(s)){const{placed:t}=h&&await h({paymentSource:e})||{placed:false};t&&i&&i({placed:t})}}catch(e){console.error("Adyen additional details error:",e)}};useEffect((()=>{const t=!isEmpty(p===null||p===void 0?void 0:p.payment_methods)?p===null||p===void 0?void 0:p.payment_methods:{};if(isEmpty(t))console.error("Payment methods are not available. Please, check your Adyen configuration.");const n={locale:a,environment:o,clientKey:e,paymentMethodsResponse:t};n.onChange=(e,t)=>w(e,t,n,p);n.onAdditionalDetails=(e,t)=>P(e,t,n);if(!g&&e)setCustomerOrderParam("_save_payment_source_to_customer_wallet","false");if(e&&!c&&!isEmpty(window)){const e=require("@adyen/adyen-web");e(n).then((e=>{const t=e.create("card",{styles:d}).mount("#adyen-card");if(t){u(e);l(true)}}))}return()=>{v({ref:{current:null}});l(false)}}),[e,g]);return!e&&!c&&!m?null:_jsxs("form",Object.assign({ref:g,onSubmit:e=>C(e,m)},{children:[_jsx("div",{className:r,id:"adyen-card"},void 0),n&&_jsx(Parent,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:n}),void 0),_jsx("div",{className:s,id:"adyen-action"},void 0)]}),void 0)};export default AdyenPayment;
1
+ import{jsx as v,jsxs as W}from"react/jsx-runtime";import{useContext as T,useEffect as G,useRef as J,useState as k}from"react";import Q from"../context/PaymentMethodContext";import f from"lodash/isEmpty";import{setCustomerOrderParam as R}from"../utils/localStorage";import X from"./utils/Parent";import Z from"../utils/browserInfo";import $ from"../context/PlaceOrderContext";const j={challengeWindowSize:"05"},K={},ee=({clientKey:u,config:M,templateCustomerSaveToWallet:h,environment:q="test",locale:F="en_US"})=>{const{cardContainerClassName:U,threeDSecureContainerClassName:D,placeOrderCallback:C,styles:H}=Object.assign(Object.assign({},K),M),[g,b]=k(!1),[w,L]=k({}),{setPaymentSource:p,paymentSource:r,setPaymentMethodErrors:A,currentPaymentMethodType:P,setPaymentRef:x}=T(Q),{setPlaceOrder:I}=T($),c=J(null),S=async(n,d)=>{var a,e,s,l,o,i,m;const _=(e=(a=n==null?void 0:n.elements)===null||a===void 0?void 0:a.save_payment_source_to_customer_wallet)===null||e===void 0?void 0:e.checked;_&&R("_save_payment_source_to_customer_wallet",_);const y={_authorize:1};try{const t=r&&await p({paymentSourceId:r.id,paymentResource:"adyen_payments",attributes:y});debugger;const N=(s=t==null?void 0:t.payment_response)===null||s===void 0?void 0:s.action,O=(l=t==null?void 0:t.payment_response)===null||l===void 0?void 0:l.resultCode;if(N&&O==="IdentifyShopper")d.createFromAction(N,j).mount("#adyen-action");else if(["Authorised","Pending","Received"].includes(O)){const E=(i=(o=t==null?void 0:t.payment_request_data)===null||o===void 0?void 0:o.payment_method)===null||i===void 0?void 0:i.brand;if(E){const V={metadata:{card:{brand:E}}};await p({paymentSourceId:t==null?void 0:t.id,paymentResource:"adyen_payments",attributes:V})}return!0}const B=(m=t==null?void 0:t.payment_response)===null||m===void 0?void 0:m.refusalReason;return A([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:P,message:B}]),!1}catch(t){return A([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:P,message:t.message}]),!1}},z=async(n,d,a,e)=>{if(n.isValid){if(c.current){const i=await require("@adyen/adyen-web")(a);c.current.onsubmit=()=>S(c.current,i),x({ref:c})}let s=Z();const l={payment_request_data:{payment_method:n.data.paymentMethod,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",origin:window.location.origin,return_url:window.location.href,browser_info:Object.assign({acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},s)}};e&&await p({paymentSourceId:e.id,paymentResource:"adyen_payments",attributes:l})}},Y=async(n,d,a)=>{var e,s;const l={payment_request_details:n.data,_details:1};try{const o=r&&await p({paymentSourceId:r.id,paymentResource:"adyen_payments",attributes:l}),i=(e=o==null?void 0:o.payment_response)===null||e===void 0?void 0:e.action,m=(s=o==null?void 0:o.payment_response)===null||s===void 0?void 0:s.resultCode,_=require("@adyen/adyen-web");if(i&&(await _(a)).createFromAction(i,j).mount("#adyen-action"),["Authorised","Pending","Received"].includes(m)){const{placed:y}=I&&await I({paymentSource:o})||{placed:!1};y&&C&&C({placed:y})}}catch(o){console.error("Adyen additional details error:",o)}};return G(()=>{const n=f(r==null?void 0:r.payment_methods)?{}:r==null?void 0:r.payment_methods;f(n)&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const d={locale:F,environment:q,clientKey:u,paymentMethodsResponse:n};return d.onChange=(a,e)=>z(a,e,d,r),d.onAdditionalDetails=(a,e)=>Y(a,e,d),!c&&u&&R("_save_payment_source_to_customer_wallet","false"),u&&!g&&!f(window)&&require("@adyen/adyen-web")(d).then(e=>{e.create("card",{styles:H}).mount("#adyen-card")&&(L(e),b(!0))}),()=>{x({ref:{current:null}}),b(!1)}},[u,c]),!u&&!g&&!w?null:W("form",Object.assign({ref:c,onSubmit:n=>S(n,w)},{children:[v("div",{className:U,id:"adyen-card"},void 0),h&&v(X,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:h}),void 0),v("div",{className:D,id:"adyen-action"},void 0)]}),void 0)};export default ee;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useReducer,useEffect}from"react";import availabilityReducer,{availabilityInitialState,getAvailability}from"../reducers/AvailabilityReducer";import AvailabilityContext from"../context/AvailabilityContext";import{isEmpty}from"lodash";import ItemContext from"../context/ItemContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import components from"../config/components";import CommerceLayerContext from"../context/CommerceLayerContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";const propTypes=components.AvailabilityContainer.propTypes;const displayName=components.AvailabilityContainer.displayName;const AvailabilityContainer=t=>{const{children:e,skuCode:i}=t;const{item:o,skuCode:n}=useContext(ItemContext);const{lineItem:a}=useContext(LineItemChildrenContext);const l=useContext(CommerceLayerContext);const[r,s]=useReducer(availabilityReducer,availabilityInitialState);useEffect((()=>{var t,e,r;const m=i||getCurrentItemKey(o)||n||(a===null||a===void 0?void 0:a.sku_code);if(m){const[i]=((e=(t=o[m])===null||t===void 0?void 0:t.inventory)===null||e===void 0?void 0:e.levels)||{quantity:null,delivery_lead_times:[]};if(!isEmpty(i)&&((r=i===null||i===void 0?void 0:i.delivery_lead_times)===null||r===void 0?void 0:r.length)>0){const[t]=i===null||i===void 0?void 0:i.delivery_lead_times;s({type:"setAvailability",payload:Object.assign(Object.assign({},t),{quantity:i===null||i===void 0?void 0:i.quantity})})}else if(l.accessToken){getAvailability({skuCode:m,config:l,dispatch:s})}}return()=>{s({type:"setAvailability",payload:{}})}}),[l.accessToken,o,n]);return _jsx(AvailabilityContext.Provider,Object.assign({value:Object.assign({},r)},{children:e}),void 0)};AvailabilityContainer.propTypes=propTypes;AvailabilityContainer.displayName=displayName;export default AvailabilityContainer;
1
+ import{jsx as x}from"react/jsx-runtime";import{useContext as d,useReducer as b,useEffect as _}from"react";import g,{availabilityInitialState as A,getAvailability as I}from"../reducers/AvailabilityReducer";import h from"../context/AvailabilityContext";import{isEmpty as j}from"lodash";import k from"../context/ItemContext";import T from"../utils/getCurrentItemKey";import v from"../config/components";import L from"../context/CommerceLayerContext";import O from"../context/LineItemChildrenContext";const q=v.AvailabilityContainer.propTypes,N=v.AvailabilityContainer.displayName,m=y=>{const{children:p,skuCode:u}=y,{item:t,skuCode:c}=d(k),{lineItem:i}=d(O),o=d(L),[C,n]=b(g,A);return _(()=>{var l,a,r;const s=u||T(t)||c||(i==null?void 0:i.sku_code);if(s){const[e]=((a=(l=t[s])===null||l===void 0?void 0:l.inventory)===null||a===void 0?void 0:a.levels)||{quantity:null,delivery_lead_times:[]};if(!j(e)&&((r=e==null?void 0:e.delivery_lead_times)===null||r===void 0?void 0:r.length)>0){const[f]=e==null?void 0:e.delivery_lead_times;n({type:"setAvailability",payload:Object.assign(Object.assign({},f),{quantity:e==null?void 0:e.quantity})})}else o.accessToken&&I({skuCode:s,config:o,dispatch:n})}return()=>{n({type:"setAvailability",payload:{}})}},[o.accessToken,t,c]),x(h.Provider,Object.assign({value:Object.assign({},C)},{children:p}),void 0)};m.propTypes=q,m.displayName=N;export default m;
@@ -1,11 +1,15 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { TimeFormat, FunctionChildren } from '../typings/index';
3
3
  import { DeliveryLeadTime } from '../reducers/AvailabilityReducer';
4
- declare type AvailabilityTemplateChildrenProps = FunctionChildren<Omit<AvailabilityTemplateProps, 'children'> & DeliveryLeadTime>;
4
+ declare type AvailabilityTemplateChildrenProps = FunctionChildren<Omit<AvailabilityTemplateProps, 'children'> & DeliveryLeadTime & {
5
+ text: string;
6
+ quantity: number;
7
+ }>;
5
8
  declare type AvailabilityTemplateProps = {
6
9
  children?: AvailabilityTemplateChildrenProps;
7
10
  timeFormat?: TimeFormat;
8
11
  showShippingMethodName?: boolean;
12
+ showShippingMethodPrice?: boolean;
9
13
  } & JSX.IntrinsicElements['p'];
10
14
  declare const AvailabilityTemplate: FunctionComponent<AvailabilityTemplateProps>;
11
15
  export default AvailabilityTemplate;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import AvailabilityContext from"../context/AvailabilityContext";import Parent from"./utils/Parent";import{isEmpty}from"lodash";import components from"../config/components";const propTypes=components.AvailabilityTemplate.propTypes;const defaultProps=components.AvailabilityTemplate.defaultProps;const displayName=components.AvailabilityTemplate.displayName;const AvailabilityTemplate=t=>{const{timeFormat:i,showShippingMethodName:e,children:o}=t,a=__rest(t,["timeFormat","showShippingMethodName","children"]);const{min:s,max:p,shipping_method:l,quantity:n}=useContext(AvailabilityContext);const m=!isEmpty(s)&&i?s===null||s===void 0?void 0:s[i]:"";const r=!isEmpty(p)&&i?p===null||p===void 0?void 0:p[i]:"";const c=[];const d=e&&l?`with ${l.name}`:"";if(n&&n>0){c.push("Available");if(m&&r){c.push(`in ${m} - ${r} ${i} ${d}`)}}else if(n===0){c.push("Out of stock")}const y=Object.assign({min:s,max:p,shipping_method:l,quantity:n},t);return o?_jsx(Parent,Object.assign({},y,{children:o}),void 0):_jsx("p",Object.assign({},a,{children:c.join(" ")}),void 0)};AvailabilityTemplate.propTypes=propTypes;AvailabilityTemplate.defaultProps=defaultProps;AvailabilityTemplate.displayName=displayName;export default AvailabilityTemplate;
1
+ import{__rest as g}from"tslib";import{jsx as d}from"react/jsx-runtime";import{useContext as P}from"react";import j from"../context/AvailabilityContext";import _ from"./utils/Parent";import{isEmpty as h}from"lodash";import m from"../config/components";const A=m.AvailabilityTemplate.propTypes,T=m.AvailabilityTemplate.defaultProps,$=m.AvailabilityTemplate.displayName,s=p=>{const{timeFormat:i,showShippingMethodName:u,showShippingMethodPrice:f,children:r}=p,v=g(p,["timeFormat","showShippingMethodName","showShippingMethodPrice","children"]),{min:o,max:e,shipping_method:t,quantity:a}=P(j),l=!h(o)&&i?o==null?void 0:o[i]:"",c=!h(e)&&i?e==null?void 0:e[i]:"",n=[],y=f&&(t==null?void 0:t.formatted_price_amount)?`(${t==null?void 0:t.formatted_price_amount})`:"",x=u&&t?`with ${t.name}`:"";a&&a>0?(n.push("Available"),l&&c&&n.push(`in ${l} - ${c} ${i} ${x} ${y}`)):a===0&&n.push("Out of stock");const b=Object.assign({min:o,max:e,shipping_method:t,quantity:a,text:n.join(" ")},p);return r?d(_,Object.assign({},b,{children:r}),void 0):d("p",Object.assign({},v,{children:n.join(" ")}),void 0)};s.propTypes=A,s.defaultProps=T,s.displayName=$;export default s;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BillingAddressContext from"../context/BillingAddressContext";import{useContext,useEffect,useReducer}from"react";import billingAddressReducer,{billingAddressInitialState,setBillingAddress,setBillingCustomerAddressId}from"../reducers/BillingAddressReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";const propTypes=components.BillingAddressContainer.propTypes;const BillingAddressContainer=e=>{const{children:s}=e;const[r,t]=useReducer(billingAddressReducer,billingAddressInitialState);const d=useContext(CommerceLayerContext);const{order:n,include:o,addResourceToInclude:i}=useContext(OrderContext);const{shipToDifferentAddress:l,setCloneAddress:c}=useContext(AddressContext);useEffect((()=>{if(!(o===null||o===void 0?void 0:o.includes("billing_address"))){i({newResource:"billing_address"})}if(n&&d){setBillingCustomerAddressId({dispatch:t,order:n,setCloneAddress:c})}return()=>{t({type:"cleanup",payload:{}})}}),[n]);const a=Object.assign(Object.assign({},r),{setBillingAddress:async(e,s)=>{await setBillingAddress(e,{config:d,dispatch:t,order:n,shipToDifferentAddress:l,customerAddressId:s===null||s===void 0?void 0:s.customerAddressId});c(e,"billing_address")}});return _jsx(BillingAddressContext.Provider,Object.assign({value:a},{children:s}),void 0)};BillingAddressContainer.propTypes=propTypes;export default BillingAddressContainer;
1
+ import{jsx as x}from"react/jsx-runtime";import f from"../context/BillingAddressContext";import{useContext as o,useEffect as A,useReducer as C}from"react";import b,{billingAddressInitialState as y,setBillingAddress as B,setBillingCustomerAddressId as v}from"../reducers/BillingAddressReducer";import j from"../context/CommerceLayerContext";import I from"../config/components";import O from"../context/OrderContext";import R from"../context/AddressContext";const T=I.BillingAddressContainer.propTypes,l=c=>{const{children:a}=c,[m,s]=C(b,y),d=o(j),{order:e,include:r,addResourceToInclude:u}=o(O),{shipToDifferentAddress:p,setCloneAddress:n}=o(R);A(()=>((r==null?void 0:r.includes("billing_address"))||u({newResource:"billing_address"}),e&&d&&v({dispatch:s,order:e,setCloneAddress:n}),()=>{s({type:"cleanup",payload:{}})}),[e]);const g=Object.assign(Object.assign({},m),{setBillingAddress:async(i,t)=>{await B(i,{config:d,dispatch:s,order:e,shipToDifferentAddress:p,customerAddressId:t==null?void 0:t.customerAddressId}),n(i,"billing_address")}});return x(f.Provider,Object.assign({value:g},{children:a}),void 0)};l.propTypes=T;export default l;
@@ -1 +1 @@
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 BillingAddressFormContext from"../context/BillingAddressFormContext";import{isEmpty}from"lodash";import components from"../config/components";import OrderContext from"../context/OrderContext";const propTypes=components.BillingAddressForm.propTypes;const BillingAddressForm=e=>{const{children:s,errorClassName:r,autoComplete:o="on",reset:i=false}=e,t=__rest(e,["children","errorClassName","autoComplete","reset"]);const{validation:d,values:l,errors:n,reset:a}=useRapidForm();const{setAddressErrors:c,setAddress:u}=useContext(AddressesContext);const{saveAddressToCustomerAddressBook:m,order:p,include:f,addResourceToInclude:g}=useContext(OrderContext);const _=useRef(null);useEffect((()=>{var e;if(!(f===null||f===void 0?void 0:f.includes("billing_address"))){g({newResource:"billing_address"})}if(!isEmpty(n)){const e=[];for(const s in n){const{code:r,message:o}=n[s];if(["billing_address_state_code"].includes(s)){if(isEmpty(l["state_code"])){delete n[s]}else{e.push({code:r,message:o,resource:"billing_address",field:s})}}else{e.push({code:r,message:o,resource:"billing_address",field:s})}}c(e,"billing_address")}else if(!isEmpty(l)){c([],"billing_address");for(const e in l){const s=l[e];if(s===null||s===void 0?void 0:s.value){l[e.replace("billing_address_","")]=s.value;delete l[e]}if((s===null||s===void 0?void 0:s.type)==="checkbox"){delete l[e];m({type:"billing_address",value:s.checked})}}u({values:l,resource:"billing_address"})}if(i&&(!isEmpty(l)||!isEmpty(n))){m&&m({type:"billing_address",value:false});if(_){(e=_.current)===null||e===void 0?void 0:e.reset();a({target:_.current});c([],"billing_address");u({values:{},resource:"billing_address"})}}}),[n,l,i,f]);const v=(e,s)=>{const r={[e.replace("billing_address_","")]:s};u({values:Object.assign(Object.assign({},l),r),resource:"billing_address"})};const b={values:l,validation:d,setValue:v,errorClassName:r,requiresBillingInfo:(p===null||p===void 0?void 0:p.requires_billing_info)||false,errors:n,resetField:e=>a({currentTarget:_.current},e)};return _jsx(BillingAddressFormContext.Provider,Object.assign({value:b},{children:_jsx("form",Object.assign({ref:_,autoComplete:o},t,{children:s}),void 0)}),void 0)};BillingAddressForm.propTypes=propTypes;export default BillingAddressForm;
1
+ import{__rest as O}from"tslib";import{jsx as _}from"react/jsx-runtime";import T from"../context/AddressContext";import E from"rapid-form";import{useContext as b,useEffect as R,useRef as k}from"react";import N from"../context/BillingAddressFormContext";import{isEmpty as d}from"lodash";import V from"../config/components";import q from"../context/OrderContext";const I=V.BillingAddressForm.propTypes,x=f=>{const{children:C,errorClassName:A,autoComplete:h="on",reset:m=!1}=f,j=O(f,["children","errorClassName","autoComplete","reset"]),{validation:y,values:s,errors:o,reset:p}=E(),{setAddressErrors:n,setAddress:a}=b(T),{saveAddressToCustomerAddressBook:c,order:u,include:t,addResourceToInclude:F}=b(q),l=k(null);R(()=>{var i;if((t==null?void 0:t.includes("billing_address"))||F({newResource:"billing_address"}),d(o)){if(!d(s)){n([],"billing_address");for(const r in s){const e=s[r];(e==null?void 0:e.value)&&(s[r.replace("billing_address_","")]=e.value,delete s[r]),(e==null?void 0:e.type)==="checkbox"&&(delete s[r],c({type:"billing_address",value:e.checked}))}a({values:s,resource:"billing_address"})}}else{const r=[];for(const e in o){const{code:g,message:v}=o[e];["billing_address_state_code"].includes(e)?d(s.state_code)?delete o[e]:r.push({code:g,message:v,resource:"billing_address",field:e}):r.push({code:g,message:v,resource:"billing_address",field:e})}n(r,"billing_address")}m&&(!d(s)||!d(o))&&(c&&c({type:"billing_address",value:!1}),l&&((i=l.current)===null||i===void 0||i.reset(),p({target:l.current}),n([],"billing_address"),a({values:{},resource:"billing_address"})))},[o,s,m,t]);const B={values:s,validation:y,setValue:(i,r)=>{const e={[i.replace("billing_address_","")]:r};a({values:Object.assign(Object.assign({},s),e),resource:"billing_address"})},errorClassName:A,requiresBillingInfo:(u==null?void 0:u.requires_billing_info)||!1,errors:o,resetField:i=>p({currentTarget:l.current},i)};return _(N.Provider,Object.assign({value:B},{children:_("form",Object.assign({ref:l,autoComplete:h},j,{children:C}),void 0)}),void 0)};x.propTypes=I;export default x;
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import isEmpty from"lodash/isEmpty";import OrderContext from"../context/OrderContext";import Parent from"./utils/Parent";import{setCustomerOrderParam}from"../utils/localStorage";import promisify from"../utils/promisify";const defaultConfig={styles:{input:{"font-size":"16px",color:"#3A3A3A"},".number":{"font-family":"monospace"},":focus":{color:"blue"},".valid":{color:"green"},".invalid":{color:"red"},"@media screen and (max-width: 700px)":{input:{"font-size":"14px"}}},fields:{number:{label:"Card Number",selector:"#card-number",placeholder:"4111 1111 1111 1111"},cvv:{label:"CVV",selector:"#cvv",placeholder:"123"},expirationDate:{label:"Expiration Date",selector:"#expiration-date",placeholder:"10/2022"}},submitLabel:"Set payment method"};const BraintreePayment=({authorization:e,config:t,templateCustomerSaveToWallet:o})=>{var a,s,r;const{fields:i,styles:n,containerClassName:l,cardContainerClassName:d,fieldsContainerClassName:c,expDateContainerClassName:m,fieldLabelClassName:u,cvvContainerClassName:v,inputWrapperClassName:f,cardDetailsContainerClassName:p}=Object.assign(Object.assign({},defaultConfig),t);const[_,b]=useState(false);const{setPaymentSource:x,paymentSource:h,setPaymentMethodErrors:y,currentPaymentMethodType:C,setPaymentRef:N}=useContext(PaymentMethodContext);const{order:j}=useContext(OrderContext);const g=useRef(null);const O=async(e,t,o)=>{var a,s;const r=(s=(a=e===null||e===void 0?void 0:e.elements)===null||a===void 0?void 0:a["save_payment_source_to_customer_wallet"])===null||s===void 0?void 0:s.checked;if(r)setCustomerOrderParam("_save_payment_source_to_customer_wallet",r);if(t){try{const e=await promisify(t).then((e=>e));const a=j===null||j===void 0?void 0:j.billing_address;const s={nonce:e.nonce,bin:e.details.bin,amount:j===null||j===void 0?void 0:j.total_amount_with_taxes_float,email:j===null||j===void 0?void 0:j.customer_email,billingAddress:{givenName:a===null||a===void 0?void 0:a.first_name,surname:a===null||a===void 0?void 0:a.last_name,phoneNumber:a===null||a===void 0?void 0:a.phone,streetAddress:a===null||a===void 0?void 0:a.line_1,countryCodeAlpha2:a===null||a===void 0?void 0:a.country_code,postalCode:a===null||a===void 0?void 0:a.zip_code,region:a===null||a===void 0?void 0:a.state_code,locality:a===null||a===void 0?void 0:a.city},onLookupComplete:(e,t)=>{t()}};const r=await o.verifyCard(s);if(r.rawCardinalSDKVerificationData.Validated&&h){h&&await x({paymentSourceId:h.id,paymentResource:"braintree_payments",attributes:{paymentMethodNonce:r.nonce,options:{id:r.nonce,card:{last4:r.details.lastFour,expYear:r.details.expirationYear,expMonth:r.details.expirationMonth,brand:r.details.cardType.toLowerCase()}}}});return true}return false}catch(e){console.error(e);y([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:C,message:e.message}]);return false}}return false};useEffect((()=>{if(!g&&e)setCustomerOrderParam("_save_payment_source_to_customer_wallet","false");if(e&&!_&&!isEmpty(window)){const t=require("braintree-web/client");const o=require("braintree-web/hosted-fields");const a=require("braintree-web/three-d-secure");t.create({authorization:e},((t,s)=>{if(t){console.error(t);return}o.create({client:s,fields:i,styles:n},((t,o)=>{if(t){console.error(t);return}b(true);a.create({authorization:e,version:2},((e,t)=>{if(e){console.error("3DSecure error",e);y([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:C,message:e.message}])}if(g.current){g.current.onsubmit=()=>O(g.current,o,t);N({ref:g})}}))}))}))}return()=>{N({ref:{current:null}});b(false)}}),[e,g]);return!e&&!_?null:_jsx("div",Object.assign({className:l},{children:_jsxs("form",Object.assign({ref:g,id:"braintree-form",onSubmit:O,className:l},{children:[_jsxs("div",Object.assign({className:c},{children:[_jsxs("div",Object.assign({className:d},{children:[_jsx("label",Object.assign({className:u,htmlFor:"card-number"},{children:(a=i===null||i===void 0?void 0:i.number)===null||a===void 0?void 0:a.label}),void 0),_jsx("div",{className:f,id:"card-number"},void 0)]}),void 0),_jsxs("div",Object.assign({className:p},{children:[_jsxs("div",Object.assign({className:m},{children:[_jsx("label",Object.assign({className:u,htmlFor:"expiration-date"},{children:(s=i===null||i===void 0?void 0:i.expirationDate)===null||s===void 0?void 0:s.label}),void 0),_jsx("div",{className:f,id:"expiration-date"},void 0)]}),void 0),_jsxs("div",Object.assign({className:v},{children:[_jsx("label",Object.assign({className:u,htmlFor:"cvv"},{children:(r=i===null||i===void 0?void 0:i.cvv)===null||r===void 0?void 0:r.label}),void 0),_jsx("div",{className:f,id:"cvv"},void 0)]}),void 0)]}),void 0)]}),void 0),_jsx("div",Object.assign({className:c},{children:o&&_jsx(Parent,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:o}),void 0)}),void 0)]}),void 0)}),void 0)};export default BraintreePayment;
1
+ import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useContext as S,useEffect as B,useRef as k,useState as H}from"react";import K from"../context/PaymentMethodContext";import W from"lodash/isEmpty";import G from"../context/OrderContext";import J from"./utils/Parent";import{setCustomerOrderParam as I}from"../utils/localStorage";import Q from"../utils/promisify";const X={styles:{input:{"font-size":"16px",color:"#3A3A3A"},".number":{"font-family":"monospace"},":focus":{color:"blue"},".valid":{color:"green"},".invalid":{color:"red"},"@media screen and (max-width: 700px)":{input:{"font-size":"14px"}}},fields:{number:{label:"Card Number",selector:"#card-number",placeholder:"4111 1111 1111 1111"},cvv:{label:"CVV",selector:"#cvv",placeholder:"123"},expirationDate:{label:"Expiration Date",selector:"#expiration-date",placeholder:"10/2022"}},submitLabel:"Set payment method"},Z=({authorization:n,config:D,templateCustomerSaveToWallet:x})=>{var p,b,f;const{fields:a,styles:L,containerClassName:g,cardContainerClassName:F,fieldsContainerClassName:O,expDateContainerClassName:R,fieldLabelClassName:_,cvvContainerClassName:U,inputWrapperClassName:y,cardDetailsContainerClassName:V}=Object.assign(Object.assign({},X),D),[j,w]=H(!1),{setPaymentSource:Y,paymentSource:N,setPaymentMethodErrors:A,currentPaymentMethodType:T,setPaymentRef:P}=S(K),{order:o}=S(G),i=k(null),E=async(c,v,h)=>{var l,m;const u=(m=(l=c==null?void 0:c.elements)===null||l===void 0?void 0:l.save_payment_source_to_customer_wallet)===null||m===void 0?void 0:m.checked;if(u&&I("_save_payment_source_to_customer_wallet",u),v)try{const r=await Q(v).then(M=>M),e=o==null?void 0:o.billing_address,C={nonce:r.nonce,bin:r.details.bin,amount:o==null?void 0:o.total_amount_with_taxes_float,email:o==null?void 0:o.customer_email,billingAddress:{givenName:e==null?void 0:e.first_name,surname:e==null?void 0:e.last_name,phoneNumber:e==null?void 0:e.phone,streetAddress:e==null?void 0:e.line_1,countryCodeAlpha2:e==null?void 0:e.country_code,postalCode:e==null?void 0:e.zip_code,region:e==null?void 0:e.state_code,locality:e==null?void 0:e.city},onLookupComplete:(M,q)=>{q()}},s=await h.verifyCard(C);return s.rawCardinalSDKVerificationData.Validated&&N?(N&&await Y({paymentSourceId:N.id,paymentResource:"braintree_payments",attributes:{paymentMethodNonce:s.nonce,options:{id:s.nonce,card:{last4:s.details.lastFour,expYear:s.details.expirationYear,expMonth:s.details.expirationMonth,brand:s.details.cardType.toLowerCase()}}}}),!0):!1}catch(r){return console.error(r),A([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:T,message:r.message}]),!1}return!1};return B(()=>{if(!i&&n&&I("_save_payment_source_to_customer_wallet","false"),n&&!j&&!W(window)){const c=require("braintree-web/client"),v=require("braintree-web/hosted-fields"),h=require("braintree-web/three-d-secure");c.create({authorization:n},(l,m)=>{if(l){console.error(l);return}v.create({client:m,fields:a,styles:L},(u,r)=>{if(u){console.error(u);return}w(!0),h.create({authorization:n,version:2},(e,C)=>{e&&(console.error("3DSecure error",e),A([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:T,message:e.message}])),i.current&&(i.current.onsubmit=()=>E(i.current,r,C),P({ref:i}))})})})}return()=>{P({ref:{current:null}}),w(!1)}},[n,i]),!n&&!j?null:t("div",Object.assign({className:g},{children:d("form",Object.assign({ref:i,id:"braintree-form",onSubmit:E,className:g},{children:[d("div",Object.assign({className:O},{children:[d("div",Object.assign({className:F},{children:[t("label",Object.assign({className:_,htmlFor:"card-number"},{children:(p=a==null?void 0:a.number)===null||p===void 0?void 0:p.label}),void 0),t("div",{className:y,id:"card-number"},void 0)]}),void 0),d("div",Object.assign({className:V},{children:[d("div",Object.assign({className:R},{children:[t("label",Object.assign({className:_,htmlFor:"expiration-date"},{children:(b=a==null?void 0:a.expirationDate)===null||b===void 0?void 0:b.label}),void 0),t("div",{className:y,id:"expiration-date"},void 0)]}),void 0),d("div",Object.assign({className:U},{children:[t("label",Object.assign({className:_,htmlFor:"cvv"},{children:(f=a==null?void 0:a.cvv)===null||f===void 0?void 0:f.label}),void 0),t("div",{className:y,id:"cvv"},void 0)]}),void 0)]}),void 0)]}),void 0),t("div",Object.assign({className:O},{children:x&&t(J,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:x}),void 0)}),void 0)]}),void 0)}),void 0)};export default Z;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import OrderContext from"../context/OrderContext";import components from"../config/components";import Parent from"./utils/Parent";const propTypes=components.CheckoutLink.propTypes;const defaultProps=components.CheckoutLink.defaultProps;const displayName=components.CheckoutLink.displayName;const CheckoutLink=o=>{const{label:e,children:t}=o,r=__rest(o,["label","children"]);const{order:n}=useContext(OrderContext);const s=Object.assign({checkoutUrl:n===null||n===void 0?void 0:n.checkout_url,label:e},r);return t?_jsx(Parent,Object.assign({},s,{children:t}),void 0):_jsx("a",Object.assign({href:n===null||n===void 0?void 0:n.checkout_url},r,{children:e}),void 0)};CheckoutLink.propTypes=propTypes;CheckoutLink.defaultProps=defaultProps;CheckoutLink.displayName=displayName;export default CheckoutLink;
1
+ import{__rest as l}from"tslib";import{jsx as i}from"react/jsx-runtime";import{useContext as a}from"react";import d from"../context/OrderContext";import e from"../config/components";import u from"./utils/Parent";const m=e.CheckoutLink.propTypes,f=e.CheckoutLink.defaultProps,h=e.CheckoutLink.displayName,t=r=>{const{label:n,children:s}=r,c=l(r,["label","children"]),{order:o}=a(d),p=Object.assign({checkoutUrl:o==null?void 0:o.checkout_url,label:n},c);return s?i(u,Object.assign({},p,{children:s}),void 0):i("a",Object.assign({href:o==null?void 0:o.checkout_url},c,{children:n}),void 0)};t.propTypes=m,t.defaultProps=f,t.displayName=h;export default t;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";const propTypes=components.CommerceLayer.propTypes;const CommerceLayer=e=>{const{children:r}=e,o=__rest(e,["children"]);return _jsx(CommerceLayerContext.Provider,Object.assign({value:Object.assign({},o)},{children:r}),void 0)};CommerceLayer.propTypes=propTypes;export default CommerceLayer;
1
+ import{__rest as m}from"tslib";import{jsx as n}from"react/jsx-runtime";import c from"../context/CommerceLayerContext";import s from"../config/components";const p=s.CommerceLayer.propTypes,r=e=>{const{children:o}=e,t=m(e,["children"]);return n(c.Provider,Object.assign({value:Object.assign({},t)},{children:o}),void 0)};r.propTypes=p;export default r;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useReducer}from"react";import customerReducer,{customerInitialState,getCustomerAddresses,getCustomerPaymentSources}from"../reducers/CustomerReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{saveCustomerUser}from"../reducers/CustomerReducer";import CustomerContext from"../context/CustomerContext";import{defaultCustomerContext}from"../context/CustomerContext";import{isEmpty}from"lodash";const propTypes=components.CustomerContainer.propTypes;const displayName=components.CustomerContainer.displayName;const CustomerContainer=e=>{const{children:t,isGuest:o=false}=e;const[r,s]=useReducer(customerReducer,customerInitialState);const{order:m,addResourceToInclude:u,include:n,updateOrder:a}=useContext(OrderContext);const c=useContext(CommerceLayerContext);useEffect((()=>{if(!(n===null||n===void 0?void 0:n.includes("available_customer_payment_sources.payment_source"))&&!o){u({newResource:"available_customer_payment_sources.payment_source"})}if(c.accessToken&&isEmpty(r.addresses)&&!o){getCustomerAddresses({config:c,dispatch:s})}if(m&&(n===null||n===void 0?void 0:n.includes("available_customer_payment_sources.payment_source"))&&!o){getCustomerPaymentSources({dispatch:s,order:m})}return()=>{s({type:"setCustomerEmail",payload:{}})}}),[c.accessToken,m,o]);const i=Object.assign(Object.assign({isGuest:o},r),{saveCustomerUser:async e=>{await saveCustomerUser({config:c,customerEmail:e,dispatch:s,updateOrder:a,order:m})},setCustomerErrors:e=>defaultCustomerContext["setCustomerErrors"](e,s),setCustomerEmail:e=>defaultCustomerContext["setCustomerEmail"](e,s),getCustomerPaymentSources:()=>getCustomerPaymentSources({dispatch:s,order:m})});return _jsx(CustomerContext.Provider,Object.assign({value:i},{children:t}),void 0)};CustomerContainer.propTypes=propTypes;CustomerContainer.displayName=displayName;export default CustomerContainer;
1
+ import{jsx as x}from"react/jsx-runtime";import{useContext as c,useEffect as _,useReducer as v}from"react";import g,{customerInitialState as E,getCustomerAddresses as b,getCustomerPaymentSources as u}from"../reducers/CustomerReducer";import j from"../context/OrderContext";import O from"../context/CommerceLayerContext";import i from"../config/components";import{saveCustomerUser as R}from"../reducers/CustomerReducer";import T from"../context/CustomerContext";import{defaultCustomerContext as d}from"../context/CustomerContext";import{isEmpty as h}from"lodash";const N=i.CustomerContainer.propTypes,P=i.CustomerContainer.displayName,n=p=>{const{children:C,isGuest:o=!1}=p,[a,e]=v(g,E),{order:r,addResourceToInclude:l,include:t,updateOrder:f}=c(j),m=c(O);_(()=>(!(t==null?void 0:t.includes("available_customer_payment_sources.payment_source"))&&!o&&l({newResource:"available_customer_payment_sources.payment_source"}),m.accessToken&&h(a.addresses)&&!o&&b({config:m,dispatch:e}),r&&(t==null?void 0:t.includes("available_customer_payment_sources.payment_source"))&&!o&&u({dispatch:e,order:r}),()=>{e({type:"setCustomerEmail",payload:{}})}),[m.accessToken,r,o]);const y=Object.assign(Object.assign({isGuest:o},a),{saveCustomerUser:async s=>{await R({config:m,customerEmail:s,dispatch:e,updateOrder:f,order:r})},setCustomerErrors:s=>d.setCustomerErrors(s,e),setCustomerEmail:s=>d.setCustomerEmail(s,e),getCustomerPaymentSources:()=>u({dispatch:e,order:r})});return x(T.Provider,Object.assign({value:y},{children:C}),void 0)};n.propTypes=N,n.displayName=P;export default n;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseInput from"./utils/BaseInput";import components from"../config/components";import useRapidForm from"rapid-form";import CustomerContext from"../context/CustomerContext";import isEmpty from"lodash/isEmpty";const propTypes=components.CustomerInput.propTypes;const displayName=components.CustomerInput.displayName;const CustomerInput=e=>{const{name:s="customer_email",placeholder:t="",required:r=true,saveOnBlur:o=false,type:a="email",value:m,onBlur:p,className:u,errorClassName:n}=e,i=__rest(e,["name","placeholder","required","saveOnBlur","type","value","onBlur","className","errorClassName"]);const{validation:l,values:c,errors:f}=useRapidForm({fieldEvent:"blur"});const{saveCustomerUser:d,setCustomerErrors:y,setCustomerEmail:C}=useContext(CustomerContext);const[E,v]=useState(false);const x=async()=>{if(o&&isEmpty(f)&&!isEmpty(c)){await d(c[s].value);p&&p()}};useEffect((()=>{if(!isEmpty(f)){const e=[];for(const s in f){const{code:t,message:r}=f[s];e.push({code:t,message:r,resource:"orders",field:s})}if(!isEmpty(e)){v(true);y(e)}}else if(!isEmpty(c)){y([]);C(c[s].value);v(false)}return()=>{v(false)}}),[f]);const I=`${u} ${E?n:""}`;return _jsx(BaseInput,Object.assign({name:s,type:a,ref:l,required:r,placeholder:t,defaultValue:m,onBlur:x,className:I},i),void 0)};CustomerInput.propTypes=propTypes;CustomerInput.displayName=displayName;export default CustomerInput;
1
+ import{__rest as g}from"tslib";import{jsx as q}from"react/jsx-runtime";import{useContext as T,useEffect as $,useState as w}from"react";import F from"./utils/BaseInput";import i from"../config/components";import H from"rapid-form";import R from"../context/CustomerContext";import r from"lodash/isEmpty";const S=i.CustomerInput.propTypes,U=i.CustomerInput.displayName,m=l=>{const{name:o="customer_email",placeholder:c="",required:f=!0,saveOnBlur:d=!1,type:C="email",value:y,onBlur:u,className:v,errorClassName:N}=l,E=g(l,["name","placeholder","required","saveOnBlur","type","value","onBlur","className","errorClassName"]),{validation:x,values:s,errors:e}=H({fieldEvent:"blur"}),{saveCustomerUser:B,setCustomerErrors:n,setCustomerEmail:h}=T(R),[I,t]=w(!1),j=async()=>{d&&r(e)&&!r(s)&&(await B(s[o].value),u&&u())};$(()=>{if(r(e))r(s)||(n([]),h(s[o].value),t(!1));else{const a=[];for(const p in e){const{code:_,message:b}=e[p];a.push({code:_,message:b,resource:"orders",field:p})}r(a)||(t(!0),n(a))}return()=>{t(!1)}},[e]);const O=`${v} ${I?N:""}`;return q(F,Object.assign({name:o,type:C,ref:x,required:f,placeholder:c,defaultValue:y,onBlur:j,className:O},E),void 0)};m.propTypes=S,m.displayName=U;export default m;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.DeliveryLeadTime.propTypes;const displayName=components.DeliveryLeadTime.displayName;const DeliveryLeadTime=e=>{const{type:t}=e,i=__rest(e,["type"]);const[o,r]=useState();const{deliveryLeadTimeForShipment:n}=useContext(ShippingMethodChildrenContext);useEffect((()=>{if(n&&n[t])r(n[t]);return()=>{r("")}}),[n]);const s=Object.assign({text:o},i);return e.children?_jsx(Parent,Object.assign({},s,{children:e.children}),void 0):_jsx("span",Object.assign({},i,{children:o}),void 0)};DeliveryLeadTime.propTypes=propTypes;DeliveryLeadTime.displayName=displayName;export default DeliveryLeadTime;
1
+ import{__rest as c}from"tslib";import{jsx as p}from"react/jsx-runtime";import{useContext as d,useState as l,useEffect as y}from"react";import f from"../context/ShippingMethodChildrenContext";import h from"./utils/Parent";import m from"../config/components";const x=m.DeliveryLeadTime.propTypes,u=m.DeliveryLeadTime.displayName,i=e=>{const{type:r}=e,n=c(e,["type"]),[o,s]=l(),{deliveryLeadTimeForShipment:t}=d(f);y(()=>(t&&t[r]&&s(t[r]),()=>{s("")}),[t]);const a=Object.assign({text:o},n);return e.children?p(h,Object.assign({},a,{children:e.children}),void 0):p("span",Object.assign({},n,{children:o}),void 0)};i.propTypes=x,i.displayName=u;export default i;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.DiscountAmount.propTypes;const defaultProps=components.DiscountAmount.defaultProps;const displayName=components.DiscountAmount.displayName;const DiscountAmount=o=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"discount"},o),void 0);DiscountAmount.propTypes=propTypes;DiscountAmount.defaultProps=defaultProps;DiscountAmount.displayName=displayName;export default DiscountAmount;
1
+ import{jsx as e}from"react/jsx-runtime";import r from"./utils/BaseOrderPrice";import s from"../config/components";const n=s.DiscountAmount.propTypes,p=s.DiscountAmount.defaultProps,i=s.DiscountAmount.displayName,o=t=>e(r,Object.assign({base:"amount",type:"discount"},t),void 0);o.propTypes=n,o.defaultProps=p,o.displayName=i;export default o;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment,useMemo}from"react";import Parent from"./utils/Parent";import GiftCardContext from"../context/GiftCardContext";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";import getAllErrors from"./utils/getAllErrors";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import CustomerContext from"../context/CustomerContext";import PaymentMethodContext from"../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";const propTypes=components.Errors.propTypes;const displayName=components.Errors.displayName;const Errors=t=>{const{children:e,messages:o=[],resource:r,field:n}=t,s=__rest(t,["children","messages","resource","field"]);const{payment:m}=useContext(PaymentMethodChildrenContext);const{errors:i}=useContext(OrderContext);const{errors:d}=useContext(GiftCardContext);const{errors:x}=useContext(LineItemContext);const{errors:C}=useContext(AddressContext);const{errors:c}=useContext(CustomerContext);const{errors:l,currentPaymentMethodType:p,currentPaymentMethodId:a}=useContext(PaymentMethodContext);const{lineItem:u}=useContext(LineItemChildrenContext);const f=useMemo((()=>[...d||[],...i||[],...x||[],...C||[],...c||[],...(l===null||l===void 0?void 0:l.filter((t=>t.field===p&&(m===null||m===void 0?void 0:m.id)===a)))||[]]),[d,i,x,C,c,l]);const h=getAllErrors({allErrors:f,field:n,messages:o,props:s,lineItem:u,resource:r,returnHtml:!e});const y=Object.assign({messages:o,resource:r,field:n,errors:h},s);return e?_jsx(Parent,Object.assign({},y,{children:e}),void 0):_jsx(Fragment,{children:h},void 0)};Errors.propTypes=propTypes;Errors.displayName=displayName;export default Errors;
1
+ import{__rest as v}from"tslib";import{jsx as u}from"react/jsx-runtime";import{useContext as r,Fragment as j,useMemo as A}from"react";import L from"./utils/Parent";import O from"../context/GiftCardContext";import T from"../context/OrderContext";import b from"../context/AddressContext";import N from"./utils/getAllErrors";import _ from"../context/LineItemContext";import G from"../context/LineItemChildrenContext";import h from"../config/components";import F from"../context/CustomerContext";import H from"../context/PaymentMethodContext";import k from"../context/PaymentMethodChildrenContext";const q=h.Errors.propTypes,w=h.Errors.displayName,n=s=>{const{children:e,messages:m=[],resource:i,field:d}=s,c=v(s,["children","messages","resource","field"]),{payment:o}=r(k),{errors:p}=r(T),{errors:l}=r(O),{errors:a}=r(_),{errors:x}=r(b),{errors:C}=r(F),{errors:t,currentPaymentMethodType:y,currentPaymentMethodId:E}=r(H),{lineItem:g}=r(G),P=A(()=>[...l||[],...p||[],...a||[],...x||[],...C||[],...(t==null?void 0:t.filter(I=>I.field===y&&(o==null?void 0:o.id)===E))||[]],[l,p,a,x,C,t]),f=N({allErrors:P,field:d,messages:m,props:c,lineItem:g,resource:i,returnHtml:!e}),M=Object.assign({messages:m,resource:i,field:d,errors:f},c);return e?u(L,Object.assign({},M,{children:e}),void 0):u(j,{children:f},void 0)};n.propTypes=q,n.displayName=w;export default n;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import ExternalFunctionContext,{callExternalFunction}from"../context/ExternalFunctionContext";import components from"../config/components";const propTypes=components.ExternalFunction.propTypes;const displayName=components.ExternalFunction.displayName;const ExternalFunction=({children:n,url:t})=>_jsx(ExternalFunctionContext.Provider,Object.assign({value:{url:t,callExternalFunction:callExternalFunction}},{children:n}),void 0);ExternalFunction.propTypes=propTypes;ExternalFunction.displayName=displayName;export default ExternalFunction;
1
+ import{jsx as r}from"react/jsx-runtime";import a,{callExternalFunction as i}from"../context/ExternalFunctionContext";import t from"../config/components";const p=t.ExternalFunction.propTypes,c=t.ExternalFunction.displayName,n=({children:o,url:e})=>r(a.Provider,Object.assign({value:{url:e,callExternalFunction:i}},{children:o}),void 0);n.propTypes=p,n.displayName=c;export default n;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useRef,useContext}from"react";import validateFormFields from"../utils/validateFormFields";import{isEmpty}from"lodash";import GiftCardContext from"../context/GiftCardContext";import components from"../config/components";const propTypes=components.GiftCard.propTypes;const defaultProps=components.GiftCard.defaultProps;const displayName=components.GiftCard.displayName;const GiftCard=t=>{const{children:e,onSubmit:o}=t;const r="giftCardForm";const s=useRef(null);const{addGiftCard:i,addGiftCardError:n}=useContext(GiftCardContext);const a=t=>{t.preventDefault();const e=s.current;const r=e===null||e===void 0?void 0:e.elements;const{errors:a,values:d}=validateFormFields(r,["currencyCode","balanceCents"],"gift_cards");if(isEmpty(a)){i(d);e===null||e===void 0?void 0:e.reset();if(o){o(d)}}else{n(a)}};return _jsx(Fragment,{children:_jsx("form",Object.assign({name:r,ref:s,onSubmit:a},{children:e}),r)},void 0)};GiftCard.propTypes=propTypes;GiftCard.defaultProps=defaultProps;GiftCard.displayName=displayName;export default GiftCard;
1
+ import{jsx as d}from"react/jsx-runtime";import{Fragment as C,useRef as v,useContext as x}from"react";import y from"../utils/validateFormFields";import{isEmpty as G}from"lodash";import F from"../context/GiftCardContext";import r from"../config/components";const b=r.GiftCard.propTypes,h=r.GiftCard.defaultProps,g=r.GiftCard.displayName,e=m=>{const{children:l,onSubmit:o}=m,n="giftCardForm",s=v(null),{addGiftCard:c,addGiftCardError:f}=x(F);return d(C,{children:d("form",Object.assign({name:n,ref:s,onSubmit:p=>{p.preventDefault();const t=s.current,u=t==null?void 0:t.elements,{errors:i,values:a}=y(u,["currencyCode","balanceCents"],"gift_cards");G(i)?(c(a),t==null||t.reset(),o&&o(a)):f(i)}},{children:l}),n)},void 0)};e.propTypes=b,e.defaultProps=h,e.displayName=g;export default e;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.GiftCardAmount.propTypes;const displayName=components.GiftCardAmount.displayName;const GiftCardAmount=o=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"gift_card"},o),void 0);GiftCardAmount.propTypes=propTypes;GiftCardAmount.displayName=displayName;export default GiftCardAmount;
1
+ import{jsx as e}from"react/jsx-runtime";import s from"./utils/BaseOrderPrice";import t from"../config/components";const p=t.GiftCardAmount.propTypes,a=t.GiftCardAmount.displayName,r=o=>e(s,Object.assign({base:"amount",type:"gift_card"},o),void 0);r.propTypes=p,r.displayName=a;export default r;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../context/GiftCardContext";import CommerceLayerContext from"../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../reducers/GiftCardReducer";import OrderContext from"../context/OrderContext";import components from"../config/components";const propTypes=components.GiftCardContainer.propTypes;const displayName=components.GiftCardContainer.displayName;const GiftCardContainer=t=>{const{children:r}=t;const[e,d]=useReducer(giftCardReducer,giftCardInitialState);const a=useContext(CommerceLayerContext);const{getOrder:o,createOrder:i,order:n}=useContext(OrderContext);const C=Object.assign(Object.assign({},e),{addGiftCardRecipient:t=>addGiftCardRecipient(t,a,d),addGiftCard:t=>addGiftCard(Object.assign({},t),{config:a,dispatch:d,getOrder:o,createOrder:i,order:n}),addGiftCardError:t=>addGiftCardError(t,d),addGiftCardLoading:t=>addGiftCardLoading(t,d)});return _jsx(GiftCardContext.Provider,Object.assign({value:C},{children:r}),void 0)};GiftCardContainer.propTypes=propTypes;GiftCardContainer.displayName=displayName;export default GiftCardContainer;
1
+ import{jsx as m}from"react/jsx-runtime";import{useReducer as x,useContext as a}from"react";import G from"../context/GiftCardContext";import g from"../context/CommerceLayerContext";import u,{giftCardInitialState as l,addGiftCardRecipient as y,addGiftCard as O,addGiftCardError as j,addGiftCardLoading as R}from"../reducers/GiftCardReducer";import b from"../context/OrderContext";import d from"../config/components";const L=d.GiftCardContainer.propTypes,h=d.GiftCardContainer.displayName,e=i=>{const{children:n}=i,[c,r]=x(u,l),o=a(g),{getOrder:s,createOrder:C,order:f}=a(b),p=Object.assign(Object.assign({},c),{addGiftCardRecipient:t=>y(t,o,r),addGiftCard:t=>O(Object.assign({},t),{config:o,dispatch:r,getOrder:s,createOrder:C,order:f}),addGiftCardError:t=>j(t,r),addGiftCardLoading:t=>R(t,r)});return m(G.Provider,Object.assign({value:p},{children:n}),void 0)};e.propTypes=L,e.displayName=h;export default e;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"./utils/BaseSelect";import currencyOptions from"../config/currency";import components from"../config/components";const propTypes=components.GiftCardCurrencySelector.propTypes;const defaultProps=components.GiftCardCurrencySelector.defaultProps;const displayName=components.GiftCardCurrencySelector.displayName;const GiftCardCurrencySelector=e=>_jsx(BaseSelect,Object.assign({options:currencyOptions,name:"currencyCode"},e),void 0);GiftCardCurrencySelector.propTypes=propTypes;GiftCardCurrencySelector.defaultProps=defaultProps;GiftCardCurrencySelector.displayName=displayName;export default GiftCardCurrencySelector;
1
+ import{jsx as t}from"react/jsx-runtime";import c from"./utils/BaseSelect";import s from"../config/currency";import e from"../config/components";const p=e.GiftCardCurrencySelector.propTypes,n=e.GiftCardCurrencySelector.defaultProps,a=e.GiftCardCurrencySelector.displayName,r=o=>t(c,Object.assign({options:s,name:"currencyCode"},o),void 0);r.propTypes=p,r.defaultProps=n,r.displayName=a;export default r;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.GiftCardInput.propTypes;const displayName=components.GiftCardInput.displayName;const GiftCardInput=p=>{const{placeholder:t=""}=p,o=__rest(p,["placeholder"]);return _jsx(BaseInput,Object.assign({placeholder:t},o),void 0)};GiftCardInput.propTypes=propTypes;GiftCardInput.displayName=displayName;export default GiftCardInput;
1
+ import{__rest as s}from"tslib";import{jsx as a}from"react/jsx-runtime";import n from"./utils/BaseInput";import o from"../config/components";const i=o.GiftCardInput.propTypes,m=o.GiftCardInput.displayName,t=p=>{const{placeholder:e=""}=p,r=s(p,["placeholder"]);return a(n,Object.assign({placeholder:e},r),void 0)};t.propTypes=i,t.displayName=m;export default t;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponCode.propTypes;const displayName=components.GiftCardOrCouponCode.displayName;const GiftCardOrCouponCode=o=>{var{children:e,type:t}=o,r=__rest(o,["children","type"]);const{order:s}=useContext(OrderContext);let n=t&&`${t}Code`;if(!t&&s&&has(s,"couponCode")&&!isEmpty(s.coupon_code))n="coupon_code";else if(!t)n="gift_card_code";const p=s&&n?s[n]:"";const i=s&&p?false:true;const d=Object.assign(Object.assign({},r),{code:p,hide:i});return e?_jsx(Parent,Object.assign({},d,{children:e}),void 0):i?null:_jsx("span",Object.assign({},r,{children:p}),void 0)};GiftCardOrCouponCode.propTypes=propTypes;GiftCardOrCouponCode.displayName=displayName;export default GiftCardOrCouponCode;
1
+ import{__rest as f}from"tslib";import{jsx as d}from"react/jsx-runtime";import{useContext as l}from"react";import a from"../config/components";import C from"./utils/Parent";import u from"../context/OrderContext";import{has as y,isEmpty as O}from"lodash";const x=a.GiftCardOrCouponCode.propTypes,h=a.GiftCardOrCouponCode.displayName,s=n=>{var{children:p,type:e}=n,i=f(n,["children","type"]);const{order:o}=l(u);let t=e&&`${e}Code`;!e&&o&&y(o,"couponCode")&&!O(o.coupon_code)?t="coupon_code":e||(t="gift_card_code");const r=o&&t?o[t]:"",c=!(o&&r),m=Object.assign(Object.assign({},i),{code:r,hide:c});return p?d(C,Object.assign({},m,{children:p}),void 0):c?null:d("span",Object.assign({},i,{children:r}),void 0)};s.propTypes=x,s.displayName=h;export default s;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";import OrderContext from"../context/OrderContext";import isEmpty from"lodash/isEmpty";import components from"../config/components";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";const propTypes=components.GiftCardOrCouponForm.propTypes;const GiftCardOrCouponForm=o=>{const{children:r,autoComplete:e="on",reset:t=false,onSubmit:s}=o,n=__rest(o,["children","autoComplete","reset","onSubmit"]);const{validation:i,values:d}=useRapidForm();const{setGiftCardOrCouponCode:a,order:m,errors:p,setOrderErrors:c}=useContext(OrderContext);const f=useRef(null);const u="gift_card_or_coupon_code";useEffect((()=>{var o;if(((o=d[u])===null||o===void 0?void 0:o.value)===""&&findIndex(p,{field:camelCase(u)})!==-1){const o=dropWhile(p,(o=>o.field===camelCase(u)));c({errors:o});s&&s({success:true})}}),[d]);const l=async o=>{o.preventDefault();const r=has(d,u)?d[u].value:undefined;if(r){const{success:e}=await a({code:r});s&&s({success:e});e&&o.target.reset()}};return(m===null||m===void 0?void 0:m.gift_card_or_coupon_code)||isEmpty(m)?null:_jsx(CouponAndGiftCardFormContext.Provider,Object.assign({value:{validation:i}},{children:_jsx("form",Object.assign({ref:f,autoComplete:e,onSubmit:l},n,{children:r}),void 0)}),void 0)};GiftCardOrCouponForm.propTypes=propTypes;export default GiftCardOrCouponForm;
1
+ import{__rest as O}from"tslib";import{jsx as a}from"react/jsx-runtime";import b from"rapid-form";import{useContext as g,useEffect as y,useRef as j}from"react";import F from"../context/CouponAndGiftCardFormContext";import G from"../context/OrderContext";import E from"lodash/isEmpty";import S from"../config/components";import p from"lodash/camelCase";import T from"lodash/dropWhile";import A from"lodash/has";import{findIndex as R}from"lodash";const W=S.GiftCardOrCouponForm.propTypes,c=d=>{const{children:f,autoComplete:l="on",reset:w=!1,onSubmit:e}=d,u=O(d,["children","autoComplete","reset","onSubmit"]),{validation:C,values:t}=b(),{setGiftCardOrCouponCode:h,order:n,errors:m,setOrderErrors:v}=g(G),x=j(null),r="gift_card_or_coupon_code";y(()=>{var o;if(((o=t[r])===null||o===void 0?void 0:o.value)===""&&R(m,{field:p(r)})!==-1){const s=T(m,i=>i.field===p(r));v({errors:s}),e&&e({success:!0})}},[t]);const _=async o=>{o.preventDefault();const s=A(t,r)?t[r].value:void 0;if(s){const{success:i}=await h({code:s});e&&e({success:i}),i&&o.target.reset()}};return(n==null?void 0:n.gift_card_or_coupon_code)||E(n)?null:a(F.Provider,Object.assign({value:{validation:C}},{children:a("form",Object.assign({ref:x,autoComplete:l,onSubmit:_},u,{children:f}),void 0)}),void 0)};c.propTypes=W;export default c;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import BaseInput from"./utils/BaseInput";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";const propTypes=components.GiftCardOrCouponInput.propTypes;const displayName=components.GiftCardOrCouponInput.displayName;const GiftCardOrCouponInput=o=>{const{placeholder:t="",required:e,value:r}=o,p=__rest(o,["placeholder","required","value"]);const{validation:n}=useContext(CouponAndGiftCardFormContext);return _jsx(BaseInput,Object.assign({type:"text",name:"gift_card_or_coupon_code",ref:n,required:e!==undefined?e:true,placeholder:t,defaultValue:r},p),void 0)};GiftCardOrCouponInput.propTypes=propTypes;GiftCardOrCouponInput.displayName=displayName;export default GiftCardOrCouponInput;
1
+ import{__rest as u}from"tslib";import{jsx as d}from"react/jsx-runtime";import{useContext as s}from"react";import r from"../config/components";import m from"./utils/BaseInput";import c from"../context/CouponAndGiftCardFormContext";const f=r.GiftCardOrCouponInput.propTypes,l=r.GiftCardOrCouponInput.displayName,o=t=>{const{placeholder:p="",required:e,value:n}=t,a=u(t,["placeholder","required","value"]),{validation:i}=s(c);return d(m,Object.assign({type:"text",name:"gift_card_or_coupon_code",ref:i,required:e!==void 0?e:!0,placeholder:p,defaultValue:n},a),void 0)};o.propTypes=f,o.displayName=l;export default o;
@@ -1 +1 @@
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 OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponRemoveButton.propTypes;const displayName=components.GiftCardOrCouponRemoveButton.displayName;const GiftCardOrCouponRemoveButton=o=>{const{children:e,label:t="Remove",onClick:n,type:r}=o,s=__rest(o,["children","label","onClick","type"]);const{order:p,removeGiftCardOrCouponCode:i}=useContext(OrderContext);let c=`${r}Code`;if(!r&&p&&has(p,"couponCode")&&!isEmpty(p.coupon_code))c="coupon_code";else if(!r)c="gift_card_code";const a=p&&c?p[c]:"";const d=p&&a?false:true;const m=()=>{i&&i({codeType:c});n&&n()};const l=Object.assign(Object.assign({},s),{label:t,handleClick:m,codeType:c});return e?_jsx(Parent,Object.assign({},l,{children:e}),void 0):d?null:_jsx("button",Object.assign({type:"button",onClick:m},s,{children:t}),void 0)};GiftCardOrCouponRemoveButton.propTypes=propTypes;GiftCardOrCouponRemoveButton.displayName=displayName;export default GiftCardOrCouponRemoveButton;
1
+ import{__rest as y}from"tslib";import{jsx as m}from"react/jsx-runtime";import{useContext as O}from"react";import b from"./utils/Parent";import l from"../config/components";import h from"../context/OrderContext";import{has as x,isEmpty as j}from"lodash";const v=l.GiftCardOrCouponRemoveButton.propTypes,_=l.GiftCardOrCouponRemoveButton.displayName,n=r=>{const{children:s,label:i="Remove",onClick:c,type:t}=r,p=y(r,["children","label","onClick","type"]),{order:o,removeGiftCardOrCouponCode:d}=O(h);let e=`${t}Code`;!t&&o&&x(o,"couponCode")&&!j(o.coupon_code)?e="coupon_code":t||(e="gift_card_code");const u=o&&e?o[e]:"",C=!(o&&u),a=()=>{d&&d({codeType:e}),c&&c()},f=Object.assign(Object.assign({},p),{label:i,handleClick:a,codeType:e});return s?m(b,Object.assign({},f,{children:s}),void 0):C?null:m("button",Object.assign({type:"button",onClick:a},p,{children:i}),void 0)};n.propTypes=v,n.displayName=_;export default n;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.GiftCardOrCouponSubmit.propTypes;const displayName=components.GiftCardOrCouponSubmit.displayName;const GiftCardOrCouponSubmit=t=>{const{children:o,label:r="Submit"}=t,i=__rest(t,["children","label"]);const s=Object.assign(Object.assign({},i),{label:r});return o?_jsx(Parent,Object.assign({},s,{children:o}),void 0):_jsx("button",Object.assign({type:"submit"},i,{children:r}),void 0)};GiftCardOrCouponSubmit.propTypes=propTypes;GiftCardOrCouponSubmit.displayName=displayName;export default GiftCardOrCouponSubmit;
1
+ import{__rest as a}from"tslib";import{jsx as e}from"react/jsx-runtime";import m from"./utils/Parent";import n from"../config/components";const c=n.GiftCardOrCouponSubmit.propTypes,l=n.GiftCardOrCouponSubmit.displayName,t=o=>{const{children:r,label:i="Submit"}=o,s=a(o,["children","label"]),p=Object.assign(Object.assign({},s),{label:i});return r?e(m,Object.assign({},p,{children:r}),void 0):e("button",Object.assign({type:"submit"},s,{children:i}),void 0)};t.propTypes=c,t.displayName=l;export default t;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useEffect}from"react";import ItemContext,{initialItemContext}from"../context/ItemContext";import itemReducer,{itemInitialState,setItemState}from"../reducers/ItemReducer";import components from"../config/components";const propTypes=components.ItemContainer.propTypes;const displayName=components.ItemContainer.displayName;const ItemContainer=t=>{const{children:e,skuCode:s,lineItem:n}=t;const[o,m]=useReducer(itemReducer,itemInitialState);useEffect((()=>{if(s){setItemState(s,{type:"setSkuCode",key:"skuCode"},m)}if(n){setItemState(n,{type:"setCustomLineItem",key:"lineItem"},m)}}),[]);const i=t=>setItemState(t,{type:"setItems",key:"items"},m);const a=t=>setItemState(t,{type:"setItem",key:"item"},m);const r=t=>setItemState(t,{type:"setQuantity",key:"quantity"},m);const p=t=>setItemState(t,{type:"setOption",key:"option"},m);const c=t=>setItemState(t,{type:"setPrices",key:"prices"},m);const I=t=>setItemState(t,{type:"setCustomLineItems",key:"lineItems"},m);const y=Object.assign(Object.assign(Object.assign({},initialItemContext),o),{setItems:i,setItem:a,setQuantity:r,setOption:p,setPrices:c,setCustomLineItems:I});return _jsx(ItemContext.Provider,Object.assign({value:y},{children:e}),void 0)};ItemContainer.propTypes=propTypes;ItemContainer.displayName=displayName;export default ItemContainer;
1
+ import{jsx as f}from"react/jsx-runtime";import{useReducer as k,useEffect as x}from"react";import j,{initialItemContext as O}from"../context/ItemContext";import g,{itemInitialState as b,setItemState as s}from"../reducers/ItemReducer";import m from"../config/components";const h=m.ItemContainer.propTypes,v=m.ItemContainer.displayName,o=r=>{const{children:c,skuCode:i,lineItem:n}=r,[p,t]=k(g,b);x(()=>{i&&s(i,{type:"setSkuCode",key:"skuCode"},t),n&&s(n,{type:"setCustomLineItem",key:"lineItem"},t)},[]);const a=e=>s(e,{type:"setItems",key:"items"},t),y=e=>s(e,{type:"setItem",key:"item"},t),u=e=>s(e,{type:"setQuantity",key:"quantity"},t),I=e=>s(e,{type:"setOption",key:"option"},t),d=e=>s(e,{type:"setPrices",key:"prices"},t),l=e=>s(e,{type:"setCustomLineItems",key:"lineItems"},t),C=Object.assign(Object.assign(Object.assign({},O),p),{setItems:a,setItem:y,setQuantity:u,setOption:I,setPrices:d,setCustomLineItems:l});return f(j.Provider,Object.assign({value:C},{children:c}),void 0)};o.propTypes=h,o.displayName=v;export default o;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import{isEmpty}from"lodash";const propTypes=components.LineItem.propTypes;const displayName=components.LineItem.displayName;const LineItem=e=>{const{type:t="skus",children:n}=e;const{lineItems:o}=useContext(LineItemContext);const{lineItems:i}=useContext(ShipmentChildrenContext);const m=isEmpty(i)?o:i;const r=m&&m.filter((e=>e.item_type===t)).map(((e,t)=>{const o={lineItem:e};return _jsx(LineItemChildrenContext.Provider,Object.assign({value:o},{children:n}),t)}));return _jsx(Fragment,{children:r},void 0)};LineItem.propTypes=propTypes;LineItem.displayName=displayName;export default LineItem;
1
+ import{jsx as i}from"react/jsx-runtime";import{Fragment as h,useContext as m}from"react";import C from"../context/LineItemContext";import f from"../context/LineItemChildrenContext";import r from"../config/components";import I from"../context/ShipmentChildrenContext";import{isEmpty as y}from"lodash";const L=r.LineItem.propTypes,u=r.LineItem.displayName,t=s=>{const{type:p="skus",children:c}=s,{lineItems:l}=m(C),{lineItems:n}=m(I),o=y(n)?l:n,a=o&&o.filter(e=>e.item_type===p).map((e,d)=>{const x={lineItem:e};return i(f.Provider,Object.assign({value:x},{children:c}),d)});return i(h,{children:a},void 0)};t.propTypes=L,t.displayName=u;export default t;
@@ -1 +1 @@
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 LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemAmount.propTypes;const defaultProps=components.LineItemAmount.defaultProps;const displayName=components.LineItemAmount.displayName;const LineItemAmount=t=>{const{format:e="formatted",type:o="total"}=t,n=__rest(t,["format","type"]);const{lineItem:m}=useContext(LineItemChildrenContext);const[s,r]=useState("");useEffect((()=>{if(m){const t=getAmount({base:"amount",type:o,format:e,obj:m});r(t)}return()=>{r("")}}),[m]);const i=Object.assign({price:s},n);return t.children?_jsx(Parent,Object.assign({},i,{children:t.children}),void 0):_jsx("span",Object.assign({},n,{children:s}),void 0)};LineItemAmount.propTypes=propTypes;LineItemAmount.defaultProps=defaultProps;LineItemAmount.displayName=displayName;export default LineItemAmount;
1
+ import{__rest as f}from"tslib";import{jsx as i}from"react/jsx-runtime";import{useState as l,useEffect as d,useContext as x}from"react";import y from"../utils/getAmount";import j from"../context/LineItemChildrenContext";import I from"./utils/Parent";import n from"../config/components";const P=n.LineItemAmount.propTypes,b=n.LineItemAmount.defaultProps,g=n.LineItemAmount.displayName,e=t=>{const{format:a="formatted",type:p="total"}=t,r=f(t,["format","type"]),{lineItem:o}=x(j),[s,m]=l("");d(()=>{if(o){const u=y({base:"amount",type:p,format:a,obj:o});m(u)}return()=>{m("")}},[o]);const c=Object.assign({price:s},r);return t.children?i(I,Object.assign({},c,{children:t.children}),void 0):i("span",Object.assign({},r,{children:s}),void 0)};e.propTypes=P,e.defaultProps=b,e.displayName=g;export default e;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemCode.propTypes;const displayName=components.LineItemCode.displayName;const LineItemCode=e=>{var{type:t="sku_code",children:o}=e,n=__rest(e,["type","children"]);const{lineItem:i}=useContext(LineItemChildrenContext);const s=i===null||i===void 0?void 0:i[t];const r=Object.assign({},n);return o?_jsx(Parent,Object.assign({},r,{children:o}),void 0):_jsx("p",Object.assign({},n,{children:s}),void 0)};LineItemCode.propTypes=propTypes;LineItemCode.displayName=displayName;export default LineItemCode;
1
+ import{__rest as a}from"tslib";import{jsx as i}from"react/jsx-runtime";import{useContext as d}from"react";import l from"../context/LineItemChildrenContext";import f from"./utils/Parent";import s from"../config/components";const x=s.LineItemCode.propTypes,y=s.LineItemCode.displayName,t=o=>{var{type:p="sku_code",children:n}=o,r=a(o,["type","children"]);const{lineItem:e}=d(l),m=e==null?void 0:e[p],c=Object.assign({},r);return n?i(f,Object.assign({},c,{children:n}),void 0):i("p",Object.assign({},r,{children:m}),void 0)};t.propTypes=x,t.displayName=y;export default t;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";const propTypes=components.LineItemImage.propTypes;const displayName=components.LineItemImage.displayName;const LineItemImage=e=>{const{lineItem:t}=useContext(LineItemChildrenContext);const n=t===null||t===void 0?void 0:t.image_url;const o=Object.assign({src:n},e);return e.children?_jsx(Parent,Object.assign({},o,{children:e.children}),void 0):_jsx("img",Object.assign({alt:"",src:n},e),void 0)};LineItemImage.propTypes=propTypes;LineItemImage.displayName=displayName;export default LineItemImage;
1
+ import{jsx as o}from"react/jsx-runtime";import{useContext as s}from"react";import a from"./utils/Parent";import c from"../context/LineItemChildrenContext";import r from"../config/components";const p=r.LineItemImage.propTypes,l=r.LineItemImage.displayName,n=e=>{const{lineItem:t}=s(c),i=t==null?void 0:t.image_url,m=Object.assign({src:i},e);return e.children?o(a,Object.assign({},m,{children:e.children}),void 0):o("img",Object.assign({alt:"",src:i},e),void 0)};n.propTypes=p,n.displayName=l;export default n;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemName.propTypes;const displayName=components.LineItemName.displayName;const LineItemName=e=>{const{lineItem:t}=useContext(LineItemChildrenContext);const n=t===null||t===void 0?void 0:t["name"];const o=Object.assign({label:n},e);return e.children?_jsx(Parent,Object.assign({},o,{children:e.children}),void 0):_jsx("p",Object.assign({},e,{children:n}),void 0)};LineItemName.propTypes=propTypes;LineItemName.displayName=displayName;export default LineItemName;
1
+ import{jsx as i}from"react/jsx-runtime";import{useContext as s}from"react";import a from"../context/LineItemChildrenContext";import c from"./utils/Parent";import m from"../config/components";const p=m.LineItemName.propTypes,l=m.LineItemName.displayName,n=e=>{const{lineItem:t}=s(a),o=t==null?void 0:t.name,r=Object.assign({label:o},e);return e.children?i(c,Object.assign({},r,{children:e.children}),void 0):i("p",Object.assign({},e,{children:o}),void 0)};n.propTypes=p,n.displayName=l;export default n;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext}from"react";import LineItemOptionChildrenContext from"../context/LineItemOptionChildrenContext";import get from"lodash/get";import has from"lodash/has";import map from"lodash/map";import Parent from"./utils/Parent";import components from"../config/components";import isJSON from"../utils/isJSON";const propTypes=components.LineItemOption.propTypes;const displayName=components.LineItemOption.displayName;const LineItemOption=t=>{const{name:e,children:n,valueClassName:s,id:i,key:o,tagElement:a="li",tagContainer:m="ul"}=t,p=__rest(t,["name","children","valueClassName","id","key","tagElement","tagContainer"]);const{lineItemOption:r,showAll:l}=useContext(LineItemOptionChildrenContext);const c=Object.assign(Object.assign({},t),{lineItemOption:r});const d=a;const O=m;const h=l&&isJSON(JSON.stringify(r===null||r===void 0?void 0:r.options))?map(r===null||r===void 0?void 0:r.options,((t,e)=>_jsxs(d,Object.assign({},p,{children:[`${e}:`,_jsx("span",Object.assign({className:s},{children:`${t}`}),void 0)]}),e))):has(r,`options.${e}`)?_jsxs(d,Object.assign({},p,{children:[`${e}:`,_jsx("span",Object.assign({className:s},p,{children:`${get(r,`options.${e}`)}`}),void 0)]}),o):null;return n?_jsx(Parent,Object.assign({},c,{children:t.children}),void 0):_jsx(O,{children:h},void 0)};LineItemOption.propTypes=propTypes;LineItemOption.displayName=displayName;export default LineItemOption;
1
+ import{__rest as x}from"tslib";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useContext as C}from"react";import N from"../context/LineItemOptionChildrenContext";import b from"lodash/get";import y from"lodash/has";import I from"lodash/map";import $ from"./utils/Parent";import p from"../config/components";import L from"../utils/isJSON";const T=p.LineItemOption.propTypes,_=p.LineItemOption.displayName,s=n=>{const{name:o,children:c,valueClassName:a,id:E,key:d,tagElement:g="li",tagContainer:h="ul"}=n,i=x(n,["name","children","valueClassName","id","key","tagElement","tagContainer"]),{lineItemOption:t,showAll:O}=C(N),f=Object.assign(Object.assign({},n),{lineItemOption:t}),r=g,u=h,j=O&&L(JSON.stringify(t==null?void 0:t.options))?I(t==null?void 0:t.options,(v,m)=>l(r,Object.assign({},i,{children:[`${m}:`,e("span",Object.assign({className:a},{children:`${v}`}),void 0)]}),m)):y(t,`options.${o}`)?l(r,Object.assign({},i,{children:[`${o}:`,e("span",Object.assign({className:a},i,{children:`${b(t,`options.${o}`)}`}),void 0)]}),d):null;return c?e($,Object.assign({},f,{children:n.children}),void 0):e(u,{children:j},void 0)};s.propTypes=T,s.displayName=_;export default s;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import LineItemOptionChildrenContext from"../context/LineItemOptionChildrenContext";import{isEmpty}from"lodash";import components from"../config/components";const displayName=components.LineItemOptions.displayName;const LineItemOptions=t=>{const{skuOptionId:e,title:n,children:i,showName:o=true,showAll:s}=t,r=__rest(t,["skuOptionId","title","children","showName","showAll"]);const{lineItem:m}=useContext(LineItemChildrenContext);const l=!isEmpty(m)?(m===null||m===void 0?void 0:m["line_item_options"])||[]:[];const p=l.filter((t=>{if(s)return true;return t.skuOption().id===e})).map(((t,e)=>{const m=o?_jsx("span",Object.assign({},r,{children:n||t.name}),void 0):null;const l={lineItemOption:t,showAll:s};return _jsxs(Fragment,{children:[m,_jsx(LineItemOptionChildrenContext.Provider,Object.assign({value:l},{children:i}),void 0)]},e)}));return _jsx(Fragment,{children:p},void 0)};LineItemOptions.displayName=displayName;export default LineItemOptions;
1
+ import{__rest as I}from"tslib";import{jsx as n,jsxs as O}from"react/jsx-runtime";import{useContext as f,Fragment as s}from"react";import C from"../context/LineItemChildrenContext";import v from"../context/LineItemOptionChildrenContext";import{isEmpty as j}from"lodash";import L from"../config/components";const _=L.LineItemOptions.displayName,r=i=>{const{skuOptionId:m,title:l,children:p,showName:d=!0,showAll:o}=i,c=I(i,["skuOptionId","title","children","showName","showAll"]),{lineItem:t}=f(C),a=(j(t)?[]:(t==null?void 0:t.line_item_options)||[]).filter(e=>o?!0:e.skuOption().id===m).map((e,h)=>{const u=d?n("span",Object.assign({},c,{children:l||e.name}),void 0):null,x={lineItemOption:e,showAll:o};return O(s,{children:[u,n(v.Provider,Object.assign({value:x},{children:p}),void 0)]},h)});return n(s,{children:a},void 0)};r.displayName=_;export default r;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import LineItemContext from"../context/LineItemContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemQuantity.propTypes;const defaultProps=components.LineItemQuantity.defaultProps;const displayName=components.LineItemQuantity.displayName;const LineItemQuantity=t=>{const{max:e=50,readonly:n=false}=t,o=__rest(t,["max","readonly"]);const{lineItem:i}=useContext(LineItemChildrenContext);const{updateLineItem:s}=useContext(LineItemContext);const a=[];for(let t=1;t<=e;t++){a.push(_jsx("option",Object.assign({value:`${t}`},{children:t}),t))}const r=t=>{const e=Number(t.target.value);s&&i&&s(i["id"],e)};const m=i===null||i===void 0?void 0:i["quantity"];const p=Object.assign({handleChange:r,quantity:m},t);return t.children?_jsx(Parent,Object.assign({},p,{children:t.children}),void 0):n?_jsx("span",Object.assign({},o,{children:m}),void 0):_jsx("select",Object.assign({title:i===null||i===void 0?void 0:i.name,value:m,onChange:r},o,{children:a}),void 0)};LineItemQuantity.propTypes=propTypes;LineItemQuantity.defaultProps=defaultProps;LineItemQuantity.displayName=displayName;export default LineItemQuantity;
1
+ import{__rest as x}from"tslib";import{jsx as o}from"react/jsx-runtime";import{useContext as d}from"react";import h from"../context/LineItemChildrenContext";import v from"../context/LineItemContext";import I from"./utils/Parent";import s from"../config/components";const g=s.LineItemQuantity.propTypes,C=s.LineItemQuantity.defaultProps,L=s.LineItemQuantity.displayName,i=n=>{const{max:p=50,readonly:u=!1}=n,r=x(n,["max","readonly"]),{lineItem:t}=d(h),{updateLineItem:m}=d(v),l=[];for(let e=1;e<=p;e++)l.push(o("option",Object.assign({value:`${e}`},{children:e}),e));const c=e=>{const f=Number(e.target.value);m&&t&&m(t.id,f)},a=t==null?void 0:t.quantity,y=Object.assign({handleChange:c,quantity:a},n);return n.children?o(I,Object.assign({},y,{children:n.children}),void 0):u?o("span",Object.assign({},r,{children:a}),void 0):o("select",Object.assign({title:t==null?void 0:t.name,value:a,onChange:c},r,{children:l}),void 0)};i.propTypes=g,i.defaultProps=C,i.displayName=L;export default i;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import LineItemContext from"../context/LineItemContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemRemoveLink.propTypes;const defaultProps=components.LineItemRemoveLink.defaultProps;const displayName=components.LineItemRemoveLink.displayName;const LineItemRemoveLink=e=>{const{label:t="Remove"}=e;const{lineItem:n}=useContext(LineItemChildrenContext);const{deleteLineItem:o}=useContext(LineItemContext);const i=e=>{e.preventDefault();o&&n&&o(n["id"])};const m=Object.assign({handleRemove:i},e);return e.children?_jsx(Parent,Object.assign({},m,{children:e.children}),void 0):_jsx("a",Object.assign({},e,{href:"#",onClick:i},{children:t}),void 0)};LineItemRemoveLink.propTypes=propTypes;LineItemRemoveLink.defaultProps=defaultProps;LineItemRemoveLink.displayName=displayName;export default LineItemRemoveLink;
1
+ import{jsx as r}from"react/jsx-runtime";import{useContext as s}from"react";import p from"../context/LineItemChildrenContext";import d from"../context/LineItemContext";import f from"./utils/Parent";import n from"../config/components";const L=n.LineItemRemoveLink.propTypes,x=n.LineItemRemoveLink.defaultProps,I=n.LineItemRemoveLink.displayName,t=e=>{const{label:c="Remove"}=e,{lineItem:o}=s(p),{deleteLineItem:i}=s(d),m=l=>{l.preventDefault(),i&&o&&i(o.id)},a=Object.assign({handleRemove:m},e);return e.children?r(f,Object.assign({},a,{children:e.children}),void 0):r("a",Object.assign({},e,{href:"#",onClick:m},{children:c}),void 0)};t.propTypes=L,t.defaultProps=x,t.displayName=I;export default t;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import lineItemReducer,{lineItemInitialState,updateLineItem,deleteLineItem}from"../reducers/LineItemReducer";import OrderContext from"../context/OrderContext";import LineItemContext from"../context/LineItemContext";import CommerceLayerContext from"../context/CommerceLayerContext";import{isEmpty}from"lodash";import components from"../config/components";const propTypes=components.LineItemsContainer.propTypes;const defaultProps=components.LineItemsContainer.defaultProps;const displayName=components.LineItemsContainer.displayName;const LineItemsContainer=e=>{const{children:t,loader:n="Loading..."}=e;const{order:o,addResourceToInclude:i,include:r,orderId:s,getOrder:m}=useContext(OrderContext);const d=useContext(CommerceLayerContext);const[a,p]=useReducer(lineItemReducer,lineItemInitialState);useEffect((()=>{if(!(r===null||r===void 0?void 0:r.includes("line_items.line_item_options.sku_option"))){i({newResource:"line_items.line_item_options.sku_option"})}if(!isEmpty(o)&&(o===null||o===void 0?void 0:o.line_items)){p({type:"setLineItems",payload:{lineItems:o.line_items}})}return()=>{if(isEmpty(o)){p({type:"setLineItems",payload:{lineItems:[]}})}}}),[o]);const c=Object.assign(Object.assign({},a),{loader:n,updateLineItem:(e,t=1)=>updateLineItem({lineItemId:e,quantity:t,dispatch:p,config:d,getOrder:m,orderId:s,errors:a.errors}),deleteLineItem:e=>deleteLineItem({lineItemId:e,dispatch:p,config:d,getOrder:m,orderId:s,errors:a.errors})});return _jsx(LineItemContext.Provider,Object.assign({value:c},{children:a.loading?n:t}),void 0)};LineItemsContainer.propTypes=propTypes;LineItemsContainer.defaultProps=defaultProps;LineItemsContainer.displayName=displayName;export default LineItemsContainer;
1
+ import{jsx as y}from"react/jsx-runtime";import{useEffect as C,useReducer as _,useContext as p}from"react";import g,{lineItemInitialState as v,updateLineItem as j,deleteLineItem as O}from"../reducers/LineItemReducer";import R from"../context/OrderContext";import h from"../context/LineItemContext";import P from"../context/CommerceLayerContext";import{isEmpty as c}from"lodash";import s from"../config/components";const T=s.LineItemsContainer.propTypes,b=s.LineItemsContainer.defaultProps,N=s.LineItemsContainer.displayName,r=u=>{const{children:I,loader:m="Loading..."}=u,{order:e,addResourceToInclude:f,include:t,orderId:d,getOrder:a}=p(R),l=p(P),[o,n]=_(g,v);C(()=>((t==null?void 0:t.includes("line_items.line_item_options.sku_option"))?!c(e)&&(e==null?void 0:e.line_items)&&n({type:"setLineItems",payload:{lineItems:e.line_items}}):f({newResource:"line_items.line_item_options.sku_option"}),()=>{c(e)&&n({type:"setLineItems",payload:{lineItems:[]}})}),[e,t]);const L=Object.assign(Object.assign({},o),{loader:m,updateLineItem:(i,x=1)=>j({lineItemId:i,quantity:x,dispatch:n,config:l,getOrder:a,orderId:d,errors:o.errors}),deleteLineItem:i=>O({lineItemId:i,dispatch:n,config:l,getOrder:a,orderId:d,errors:o.errors})});return y(h.Provider,Object.assign({value:L},{children:o.loading?m:I}),void 0)};r.propTypes=T,r.defaultProps=b,r.displayName=N;export default r;
@@ -1 +1 @@
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 getLineItemsCount from"../utils/getLineItemsCount";import{isEmpty}from"lodash";import LineItemContext from"../context/LineItemContext";import components from"../config/components";const propTypes=components.LineItemsCount.propTypes;const displayName=components.LineItemsCount.displayName;const LineItemsCount=t=>{const{children:e}=t,n=__rest(t,["children"]);const{lineItems:s}=useContext(LineItemContext);const[o,i]=useState(0);useEffect((()=>{if(!isEmpty(s)){const t=getLineItemsCount(s||[]);i(t)}return()=>{i(0)}}),[s]);const m=Object.assign({quantity:o},n);return e?_jsx(Parent,Object.assign({},m,{children:e}),void 0):_jsx("span",Object.assign({},n,{children:o}),void 0)};LineItemsCount.propTypes=propTypes;LineItemsCount.displayName=displayName;export default LineItemsCount;
1
+ import{__rest as u}from"tslib";import{jsx as m}from"react/jsx-runtime";import{useContext as f,useState as l,useEffect as d}from"react";import y from"./utils/Parent";import x from"../utils/getLineItemsCount";import{isEmpty as C}from"lodash";import I from"../context/LineItemContext";import p from"../config/components";const L=p.LineItemsCount.propTypes,g=p.LineItemsCount.displayName,e=n=>{const{children:o}=n,s=u(n,["children"]),{lineItems:t}=f(I),[i,r]=l(0);d(()=>{if(!C(t)){const a=x(t||[]);r(a)}return()=>{r(0)}},[t]);const c=Object.assign({quantity:i},s);return o?m(y,Object.assign({},c,{children:o}),void 0):m("span",Object.assign({},s,{children:i}),void 0)};e.propTypes=L,e.displayName=g;export default e;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.MetadataInput.propTypes;const displayName=components.MetadataInput.displayName;const MetadataInput=t=>_jsx(BaseInput,Object.assign({"data-metadata":true},t),void 0);MetadataInput.propTypes=propTypes;MetadataInput.displayName=displayName;export default MetadataInput;
1
+ import{jsx as e}from"react/jsx-runtime";import s from"./utils/BaseInput";import a from"../config/components";const o=a.MetadataInput.propTypes,n=a.MetadataInput.displayName,t=p=>e(s,Object.assign({"data-metadata":!0},p),void 0);t.propTypes=o,t.displayName=n;export default t;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext,useMemo}from"react";import orderReducer,{createOrder,getApiOrder,setOrderErrors,setOrder,orderInitialState}from"../reducers/OrderReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import OrderContext,{defaultOrderContext}from"../context/OrderContext";import{unsetOrderState}from"../reducers/OrderReducer";import components from"../config/components";import OrderStorageContext from"../context/OrderStorageContext";const propTypes=components.OrderContainer.propTypes;const defaultProps=components.OrderContainer.defaultProps;const displayName=components.OrderContainer.displayName;const OrderContainer=e=>{const{orderId:r,children:t,metadata:o,attributes:d}=e;const[s,a]=useReducer(orderReducer,orderInitialState);const n=useContext(CommerceLayerContext);const{persistKey:c,clearWhenPlaced:i,getLocalOrder:p,setLocalOrder:O,deleteLocalOrder:u}=useContext(OrderStorageContext);useEffect((()=>{if(n.accessToken){const e=c?p(c):r;if(e){a({type:"setOrderId",payload:{orderId:e}});if(!s.order){getApiOrder({id:e,dispatch:a,config:n,persistKey:c,clearWhenPlaced:i,deleteLocalOrder:u,state:s})}}}return()=>unsetOrderState(a)}),[n.accessToken,r]);const C=useMemo((()=>Object.assign(Object.assign({},s),{setOrder:e=>setOrder(e,a),getOrder:e=>getApiOrder({id:e,dispatch:a,config:n,state:s}),setOrderErrors:e=>setOrderErrors({dispatch:a,errors:e}),createOrder:async()=>await createOrder({persistKey:c,dispatch:a,config:n,state:s,orderMetadata:o,orderAttributes:d}),addToCart:e=>defaultOrderContext["addToCart"](Object.assign(Object.assign({},e),{persistKey:c,dispatch:a,state:s,config:n,errors:s.errors,orderMetadata:o||{},orderAttributes:d,setLocalOrder:O})),saveAddressToCustomerAddressBook:e=>defaultOrderContext["saveAddressToCustomerAddressBook"](Object.assign(Object.assign({},e),{dispatch:a})),setGiftCardOrCouponCode:({code:e})=>defaultOrderContext["setGiftCardOrCouponCode"]({code:e,dispatch:a,order:s.order,config:n}),removeGiftCardOrCouponCode:({codeType:e})=>defaultOrderContext["removeGiftCardOrCouponCode"]({codeType:e,dispatch:a,order:s.order,config:n}),addResourceToInclude:e=>defaultOrderContext["addResourceToInclude"](Object.assign(Object.assign({},e),{dispatch:a,resourcesIncluded:s.include})),updateOrder:async e=>await defaultOrderContext["updateOrder"](Object.assign(Object.assign({},e),{dispatch:a,config:n,include:s.include}))})),[s]);return _jsx(OrderContext.Provider,Object.assign({value:C},{children:t}),void 0)};OrderContainer.propTypes=propTypes;OrderContainer.defaultProps=defaultProps;OrderContainer.displayName=displayName;export default OrderContainer;
1
+ import{jsx as j}from"react/jsx-runtime";import{useEffect as y,useReducer as T,useContext as O,useMemo as v}from"react";import A,{createOrder as I,getApiOrder as p,setOrderErrors as R,setOrder as L,orderInitialState as P}from"../reducers/OrderReducer";import h from"../context/CommerceLayerContext";import k,{defaultOrderContext as d}from"../context/OrderContext";import{unsetOrderState as G}from"../reducers/OrderReducer";import n from"../config/components";import S from"../context/OrderStorageContext";const E=n.OrderContainer.propTypes,M=n.OrderContainer.defaultProps,N=n.OrderContainer.displayName,a=m=>{const{orderId:c,children:C,metadata:i,attributes:u}=m,[t,r]=T(A,P),o=O(h),{persistKey:s,clearWhenPlaced:l,getLocalOrder:f,setLocalOrder:g,deleteLocalOrder:x}=O(S);y(()=>{if(o.accessToken){const e=s?f(s):c;e&&(r({type:"setOrderId",payload:{orderId:e}}),t.order||p({id:e,dispatch:r,config:o,persistKey:s,clearWhenPlaced:l,deleteLocalOrder:x,state:t}))}return()=>G(r)},[o.accessToken,c]);const b=v(()=>Object.assign(Object.assign({},t),{setOrder:e=>L(e,r),getOrder:e=>p({id:e,dispatch:r,config:o,state:t}),setOrderErrors:e=>R({dispatch:r,errors:e}),createOrder:async()=>await I({persistKey:s,dispatch:r,config:o,state:t,orderMetadata:i,orderAttributes:u}),addToCart:e=>d.addToCart(Object.assign(Object.assign({},e),{persistKey:s,dispatch:r,state:t,config:o,errors:t.errors,orderMetadata:i||{},orderAttributes:u,setLocalOrder:g})),saveAddressToCustomerAddressBook:e=>d.saveAddressToCustomerAddressBook(Object.assign(Object.assign({},e),{dispatch:r})),setGiftCardOrCouponCode:({code:e})=>d.setGiftCardOrCouponCode({code:e,dispatch:r,order:t.order,config:o}),removeGiftCardOrCouponCode:({codeType:e})=>d.removeGiftCardOrCouponCode({codeType:e,dispatch:r,order:t.order,config:o}),addResourceToInclude:e=>d.addResourceToInclude(Object.assign(Object.assign({},e),{dispatch:r,resourcesIncluded:t.include})),updateOrder:async e=>await d.updateOrder(Object.assign(Object.assign({},e),{dispatch:r,config:o,include:t.include}))}),[t]);return j(k.Provider,Object.assign({value:b},{children:C}),void 0)};a.propTypes=E,a.defaultProps=M,a.displayName=N;export default a;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import components from"../config/components";import BaseField from"./utils/BaseField";const propTypes=components.OrderNumber.propTypes;const displayName=components.OrderNumber.displayName;const OrderNumber=e=>_jsx(BaseField,Object.assign({attribute:"number"},e),void 0);OrderNumber.propTypes=propTypes;OrderNumber.displayName=displayName;export default OrderNumber;
1
+ import{jsx as o}from"react/jsx-runtime";import r from"../config/components";import p from"./utils/BaseField";const t=r.OrderNumber.propTypes,m=r.OrderNumber.displayName,e=s=>o(p,Object.assign({attribute:"number"},s),void 0);e.propTypes=t,e.displayName=m;export default e;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderStorageContext from"../context/OrderStorageContext";import components from"../config/components";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../utils/localStorage";const propTypes=components.OrderStorage.propTypes;const displayName=components.OrderStorage.displayName;const OrderStorage=e=>{const{children:r,clearWhenPlaced:o=true}=e,t=__rest(e,["children","clearWhenPlaced"]);return _jsx(OrderStorageContext.Provider,Object.assign({value:Object.assign(Object.assign({},t),{setLocalOrder:setLocalOrder,getLocalOrder:getLocalOrder,deleteLocalOrder:deleteLocalOrder,clearWhenPlaced:o})},{children:r}),void 0)};OrderStorage.propTypes=propTypes;OrderStorage.displayName=displayName;export default OrderStorage;
1
+ import{__rest as c}from"tslib";import{jsx as n}from"react/jsx-runtime";import d from"../context/OrderStorageContext";import t from"../config/components";import{getLocalOrder as i,setLocalOrder as l,deleteLocalOrder as p}from"../utils/localStorage";const m=t.OrderStorage.propTypes,g=t.OrderStorage.displayName,e=r=>{const{children:o,clearWhenPlaced:a=!0}=r,s=c(r,["children","clearWhenPlaced"]);return n(d.Provider,Object.assign({value:Object.assign(Object.assign({},s),{setLocalOrder:l,getLocalOrder:i,deleteLocalOrder:p,clearWhenPlaced:a})},{children:o}),void 0)};e.propTypes=m,e.displayName=g;export default e;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../context/OrderContext";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../context/PaymentMethodContext";import getPaypalConfig from"../utils/paypalPayment";import{useContext,useEffect,useState}from"react";import getLoaderComponent from"../utils/getLoaderComponent";import AdyenGateway from"./gateways/AdyenGateway";import StripeGateway from"./gateways/StripeGateway";import BraintreeGateway from"./gateways/BraintreeGateway";import PaypalGateway from"./gateways/PaypalGateway";import WireTransferGateway from"./gateways/WireTransferGateway";import CustomerContext from"../context/CustomerContext";const PaymentGateway=e=>{var t;var{readonly:a,showCard:o,handleEditClick:r,children:n,templateCustomerCards:s,templateCustomerSaveToWallet:i,onClickCustomerCards:m,show:d,loader:y="Loading..."}=e,l=__rest(e,["readonly","showCard","handleEditClick","children","templateCustomerCards","templateCustomerSaveToWallet","onClickCustomerCards","show","loader"]);const p=getLoaderComponent(y);const[c,C]=useState(true);const{payment:u}=useContext(PaymentMethodChildrenContext);const{order:h}=useContext(OrderContext);const{getCustomerPaymentSources:f}=useContext(CustomerContext);const{currentPaymentMethodId:w,config:x,paymentSource:_,currentPaymentMethodType:v,setPaymentSource:g}=useContext(PaymentMethodContext);const P=a?v:u===null||u===void 0?void 0:u.payment_source_type;useEffect((()=>{var e;if((u===null||u===void 0?void 0:u.id)===w&&P&&((e=h===null||h===void 0?void 0:h.payment_method)===null||e===void 0?void 0:e.payment_source_type)===P){const e=x&&P==="paypal_payments"?getPaypalConfig(P,x):{};if(!_||_.type!==P){g({paymentResource:P,order:h,attributes:e});f&&f()}C(false)}return()=>{C(true)}}),[(t=h===null||h===void 0?void 0:h.payment_method)===null||t===void 0?void 0:t.payment_source_type,d,_]);const G=Object.assign({readonly:a,showCard:o,handleEditClick:r,children:n,templateCustomerCards:s,show:d,loading:c,onClickCustomerCards:m,loaderComponent:p,templateCustomerSaveToWallet:i},l);switch(P){case"stripe_payments":return _jsx(StripeGateway,Object.assign({},G,{children:n}),void 0);case"adyen_payments":return _jsx(AdyenGateway,Object.assign({},G,{children:n}),void 0);case"braintree_payments":return _jsx(BraintreeGateway,Object.assign({},G,{children:n}),void 0);case"wire_transfers":return _jsx(WireTransferGateway,Object.assign({},G,{children:n}),void 0);case"paypal_payments":return _jsx(PaypalGateway,Object.assign({},G,{children:n}),void 0);default:return null}};export default PaymentGateway;
1
+ import{__rest as M}from"tslib";import{jsx as n}from"react/jsx-runtime";import T from"../context/OrderContext";import k from"../context/PaymentMethodChildrenContext";import L from"../context/PaymentMethodContext";import W from"../utils/paypalPayment";import{useContext as s,useEffect as E,useState as A}from"react";import B from"../utils/getLoaderComponent";import I from"./gateways/AdyenGateway";import R from"./gateways/StripeGateway";import q from"./gateways/BraintreeGateway";import z from"./gateways/PaypalGateway";import D from"./gateways/WireTransferGateway";import F from"../context/CustomerContext";const H=y=>{var i,{readonly:l,showCard:f,handleEditClick:h,children:a,templateCustomerCards:w,templateCustomerSaveToWallet:g,onClickCustomerCards:v,show:p,loader:_="Loading..."}=y,x=M(y,["readonly","showCard","handleEditClick","children","templateCustomerCards","templateCustomerSaveToWallet","onClickCustomerCards","show","loader"]);const P=B(_),[G,c]=A(!0),{payment:o}=s(k),{order:e}=s(T),{getCustomerPaymentSources:u}=s(F),{currentPaymentMethodId:b,config:C,paymentSource:m,currentPaymentMethodType:j,setPaymentSource:O}=s(L),t=l?j:o==null?void 0:o.payment_source_type;E(()=>{var d;if((o==null?void 0:o.id)===b&&t&&((d=e==null?void 0:e.payment_method)===null||d===void 0?void 0:d.payment_source_type)===t){const S=C&&t==="paypal_payments"?W(t,C):{};(!m||m.type!==t)&&(O({paymentResource:t,order:e,attributes:S}),u&&u()),c(!1)}return()=>{c(!0)}},[(i=e==null?void 0:e.payment_method)===null||i===void 0?void 0:i.payment_source_type,p,m]);const r=Object.assign({readonly:l,showCard:f,handleEditClick:h,children:a,templateCustomerCards:w,show:p,loading:G,onClickCustomerCards:v,loaderComponent:P,templateCustomerSaveToWallet:g},x);switch(t){case"stripe_payments":return n(R,Object.assign({},r,{children:a}),void 0);case"adyen_payments":return n(I,Object.assign({},r,{children:a}),void 0);case"braintree_payments":return n(q,Object.assign({},r,{children:a}),void 0);case"wire_transfers":return n(D,Object.assign({},r,{children:a}),void 0);case"paypal_payments":return n(z,Object.assign({},r,{children:a}),void 0);default:return null}};export default H;