@commercelayer/react-components 2.48.3 → 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 +1 -0
  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 +1 -0
  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 +14 -14
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";export const setItemState=(t,e,s)=>{s({type:e.type,payload:{[`${e.key}`]:t}})};export const unsetItemState=t=>{t({type:"setItem",payload:{item:{}}});t({type:"setItems",payload:{items:{}}});t({type:"setQuantity",payload:{quantity:{}}});t({type:"setOption",payload:{option:{}}});t({type:"setCustomLineItems",payload:{lineItems:{}}});t({type:"setCustomLineItem",payload:{lineItem:{}}})};const actionType=["setItem","setItems","setQuantity","setOption","setPrices","setCustomLineItems","setCustomLineItem","setSkuCode"];export const itemInitialState={items:{},item:{},quantity:{},option:{},prices:{},lineItems:{},lineItem:{},skuCode:""};const itemReducer=(t,e)=>baseReducer(t,e,actionType);export default itemReducer;
1
+ import o from"../utils/baseReducer";export const setItemState=(t,e,s)=>{s({type:e.type,payload:{[`${e.key}`]:t}})},unsetItemState=t=>{t({type:"setItem",payload:{item:{}}}),t({type:"setItems",payload:{items:{}}}),t({type:"setQuantity",payload:{quantity:{}}}),t({type:"setOption",payload:{option:{}}}),t({type:"setCustomLineItems",payload:{lineItems:{}}}),t({type:"setCustomLineItem",payload:{lineItem:{}}})};const m=["setItem","setItems","setQuantity","setOption","setPrices","setCustomLineItems","setCustomLineItem","setSkuCode"];export const itemInitialState={items:{},item:{},quantity:{},option:{},prices:{},lineItems:{},lineItem:{},skuCode:""};const i=(t,e)=>o(t,e,m);export default i;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const getLineItems=e=>{const{order:t,dispatch:r,config:s}=e;const o=getSdk(s);let i=[];t&&o.orders.retrieve(t===null||t===void 0?void 0:t.id,{include:["line_items","line_items.line_item_options.sku_option"],fields:{orders:["line_items"]}}).then((e=>{r({type:"setLoading",payload:{loading:false}});const t=e.line_items||[];i=[...i,...t];r({type:"setLineItems",payload:{lineItems:i}})})).catch((e=>{const t=getErrors(e,"line_items");r({type:"setErrors",payload:{errors:t}})}))};export const updateLineItem=async e=>{const{config:t,lineItemId:r,quantity:s,getOrder:o,orderId:i,dispatch:n}=e;const a=getSdk(t);try{await a.line_items.update({id:r,quantity:s});o&&await o(i);n({type:"setErrors",payload:{errors:[]}})}catch(e){const t=getErrors(e,"line_items");n({type:"setErrors",payload:{errors:t}})}};export const deleteLineItem=async e=>{const{config:t,lineItemId:r,getOrder:s,orderId:o,dispatch:i}=e;const n=getSdk(t);try{await n.line_items.delete(r);s&&await s(o);i({type:"setErrors",payload:{errors:[]}})}catch(e){const t=getErrors(e,"line_items");i({type:"setErrors",payload:{errors:t}})}};export const lineItemInitialState={loading:false,lineItems:[],errors:[]};const actionType=["setLineItems","setErrors","setLoading"];const lineItemReducer=(e,t)=>baseReducer(e,t,actionType);export default lineItemReducer;
1
+ import m from"../utils/baseReducer";import l from"../utils/getSdk";import c from"../utils/getErrors";export const getLineItems=s=>{const{order:e,dispatch:o,config:n}=s,a=l(n);let t=[];e&&a.orders.retrieve(e==null?void 0:e.id,{include:["line_items","line_items.line_item_options.sku_option"],fields:{orders:["line_items"]}}).then(r=>{o({type:"setLoading",payload:{loading:!1}});const i=r.line_items||[];t=[...t,...i],o({type:"setLineItems",payload:{lineItems:t}})}).catch(r=>{const i=c(r,"line_items");o({type:"setErrors",payload:{errors:i}})})},updateLineItem=async s=>{const{config:e,lineItemId:o,quantity:n,getOrder:a,orderId:t,dispatch:r}=s,i=l(e);try{await i.line_items.update({id:o,quantity:n}),a&&await a(t),r({type:"setErrors",payload:{errors:[]}})}catch(d){const p=c(d,"line_items");r({type:"setErrors",payload:{errors:p}})}},deleteLineItem=async s=>{const{config:e,lineItemId:o,getOrder:n,orderId:a,dispatch:t}=s,r=l(e);try{await r.line_items.delete(o),n&&await n(a),t({type:"setErrors",payload:{errors:[]}})}catch(i){const d=c(i,"line_items");t({type:"setErrors",payload:{errors:d}})}},lineItemInitialState={loading:!1,lineItems:[],errors:[]};const y=["setLineItems","setErrors","setLoading"],I=(s,e)=>m(s,e,y);export default I;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import{isEmpty,size,map}from"lodash";import getSdk from"../utils/getSdk";import getErrors,{setErrors}from"../utils/getErrors";const actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];export const createOrder=async r=>{if(r){const{persistKey:e,state:t,dispatch:s,config:o,orderMetadata:d,orderAttributes:c={},setLocalOrder:n}=r;if(t===null||t===void 0?void 0:t.orderId)return t.orderId;const a=getSdk(o);try{const r=await(a===null||a===void 0?void 0:a.orders.create(Object.assign({metadata:d},c)));s&&s({type:"setOrderId",payload:{orderId:r===null||r===void 0?void 0:r.id}});e&&n&&n(e,r.id);return r.id}catch(r){const e=getErrors(r,"orders");console.error("Create order",e);if(s)setErrors({currentErrors:t===null||t===void 0?void 0:t.errors,newErrors:e,dispatch:s})}}return""};export const getApiOrder=async r=>{const{id:e,dispatch:t,config:s,clearWhenPlaced:o,persistKey:d,deleteLocalOrder:c,state:n}=r;const a=getSdk(s);try{const r={};if((n===null||n===void 0?void 0:n.include)&&n.include.length>0){r.include=n.include}const s=await a.orders.retrieve(e,r);if(o&&s.status==="placed"||s.status==="approved"||s.status==="cancelled"){d&&c&&c(d);t&&t({type:"setOrder",payload:{order:undefined,orderId:""}})}else{t&&t({type:"setOrder",payload:{order:s,orderId:s.id}})}return s}catch(r){const e=getErrors(r,"orders");console.error("Retrieve order",e);if(t)setErrors({currentErrors:n===null||n===void 0?void 0:n.errors,newErrors:e,dispatch:t});return}};export async function updateOrder({id:r,attributes:e,dispatch:t,config:s,include:o}){const d=getSdk(s);try{const s=Object.assign(Object.assign({},e),{id:r});const c=await d.orders.update(s,{include:o});t&&t({type:"setOrder",payload:{order:c}})}catch(r){const e=getErrors(r,"orders");if(t){setOrderErrors({errors:e,dispatch:t});t({type:"setErrors",payload:{errors:e}})}}}export const setOrder=(r,e)=>{e&&e({type:"setOrder",payload:{order:r}})};export function addResourceToInclude({resourcesIncluded:r=[],dispatch:e,newResource:t}){const s=[...r,...typeof t==="string"?[t]:t];e&&e({type:"setIncludesResource",payload:{include:s}})}export const addToCart=async r=>{const{skuCode:e,bundleCode:t,skuId:s,quantity:o,option:d,config:c,dispatch:n,lineItem:a,state:i,errors:u=[]}=r;try{const p=getSdk(c);const l=await createOrder(r);if(l){const c=p.orders.relationship(l);const y=a===null||a===void 0?void 0:a.name;const f=a===null||a===void 0?void 0:a.imageUrl;const g={order:c,sku_code:e,name:y,image_url:f,quantity:o||1,_update_quantity:true,bundle_code:t};if(s){g["item"]=p.skus.relationship(s)}const m=await p.line_items.create(g);if(!isEmpty(d)){let e=0;map(d,(async t=>{const{options:s,skuOptionId:o}=t;const c=p.sku_options.relationship(o);const n=p.line_items.relationship(m.id);const a={quantity:1,options:s,sku_option:c,line_item:n};await p.line_item_options.create(a);e+=1;if(e===size(d)){await getApiOrder(Object.assign({id:l},r))}}))}else{await getApiOrder(Object.assign(Object.assign({id:l},r),{state:i}))}if(!isEmpty(u)&&n){n({type:"setErrors",payload:{errors:[]}})}return{success:true}}return{success:false}}catch(r){const e=getErrors(r,"orders");console.error("Add to cart",e);if(n)setErrors({currentErrors:i===null||i===void 0?void 0:i.errors,newErrors:e,dispatch:n});return{success:false}}};export const unsetOrderState=r=>{r({type:"setOrderId",payload:{orderId:""}});r({type:"setOrder",payload:{order:undefined}})};export function setOrderErrors({dispatch:r,errors:e}){r&&r({type:"setErrors",payload:{errors:e}});return{success:false}}export const saveAddressToCustomerAddressBook=({type:r,value:e,dispatch:t})=>{const s=`save_${r}_to_customer_book`;const o=`${e}`;localStorage.setItem(s,o);t&&t({type:"setSaveAddressToCustomerAddressBook",payload:{[s]:o}})};export const setGiftCardOrCouponCode=async({code:r,dispatch:e,config:t,order:s})=>{try{if(t&&s&&r&&e){const o=getSdk(t);const d={id:s.id,gift_card_or_coupon_code:r};const c=await o.orders.update(d);e({type:"setErrors",payload:{errors:[],order:c}});return{success:true}}return{success:false}}catch(r){const t=getErrors(r,"gift_card_or_coupon_code");e&&setOrderErrors({errors:t,dispatch:e});return{success:false}}};export const removeGiftCardOrCouponCode=async({codeType:r,dispatch:e,config:t,order:s})=>{try{if(t&&s&&e){const o=getSdk(t);const d={id:s.id,[r]:""};const c=await o.orders.update(d);e({type:"setErrors",payload:{errors:[],order:c}});return{success:true}}return{success:false}}catch(r){const t=getErrors(r,"gift_card_or_coupon_code");console.error("Remove gift card o coupon code",t);e&&setOrderErrors({errors:t,dispatch:e});return{success:false}}};export const orderInitialState={loading:false,orderId:"",order:undefined,errors:[]};const orderReducer=(r,e)=>baseReducer(r,e,actionType);export default orderReducer;
1
+ import R from"../utils/baseReducer";import{isEmpty as _,size as j,map as T}from"lodash";import y from"../utils/getSdk";import f,{setErrors as m}from"../utils/getErrors";const q=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];export const createOrder=async e=>{if(e){const{persistKey:t,state:r,dispatch:o,config:n,orderMetadata:d,orderAttributes:a={},setLocalOrder:s}=e;if(r==null?void 0:r.orderId)return r.orderId;const u=y(n);try{const c=await(u==null?void 0:u.orders.create(Object.assign({metadata:d},a)));return o&&o({type:"setOrderId",payload:{orderId:c==null?void 0:c.id}}),t&&s&&s(t,c.id),c.id}catch(c){const i=f(c,"orders");console.error("Create order",i),o&&m({currentErrors:r==null?void 0:r.errors,newErrors:i,dispatch:o})}}return""},getApiOrder=async e=>{const{id:t,dispatch:r,config:o,clearWhenPlaced:n,persistKey:d,deleteLocalOrder:a,state:s}=e,u=y(o);try{const c={};(s==null?void 0:s.include)&&s.include.length>0&&(c.include=s.include);const i=await u.orders.retrieve(t,c);return n&&i.status==="placed"||i.status==="approved"||i.status==="cancelled"?(d&&a&&a(d),r&&r({type:"setOrder",payload:{order:void 0,orderId:""}})):r&&r({type:"setOrder",payload:{order:i,orderId:i.id}}),i}catch(c){const i=f(c,"orders");console.error("Retrieve order",i),r&&m({currentErrors:s==null?void 0:s.errors,newErrors:i,dispatch:r});return}};export async function updateOrder({id:e,attributes:t,dispatch:r,config:o,include:n}){const d=y(o);try{const a=Object.assign(Object.assign({},t),{id:e}),s=await d.orders.update(a,{include:n});r&&r({type:"setOrder",payload:{order:s}})}catch(a){const s=f(a,"orders");r&&(setOrderErrors({errors:s,dispatch:r}),r({type:"setErrors",payload:{errors:s}}))}}export const setOrder=(e,t)=>{t&&t({type:"setOrder",payload:{order:e}})};export function addResourceToInclude({resourcesIncluded:e=[],dispatch:t,newResource:r}){const o=[...e,...typeof r=="string"?[r]:r];t&&t({type:"setIncludesResource",payload:{include:o}})}export const addToCart=async e=>{const{skuCode:t,bundleCode:r,skuId:o,quantity:n,option:d,config:a,dispatch:s,lineItem:u,state:c,errors:i=[]}=e;try{const l=y(a),p=await createOrder(e);if(p){const g=l.orders.relationship(p),k=u==null?void 0:u.name,I=u==null?void 0:u.imageUrl,v={order:g,sku_code:t,name:k,image_url:I,quantity:n||1,_update_quantity:!0,bundle_code:r};o&&(v.item=l.skus.relationship(o));const C=await l.line_items.create(v);if(_(d))await getApiOrder(Object.assign(Object.assign({id:p},e),{state:c}));else{let O=0;T(d,async E=>{const{options:b,skuOptionId:x}=E,w=l.sku_options.relationship(x),A=l.line_items.relationship(C.id),S={quantity:1,options:b,sku_option:w,line_item:A};await l.line_item_options.create(S),O+=1,O===j(d)&&await getApiOrder(Object.assign({id:p},e))})}return!_(i)&&s&&s({type:"setErrors",payload:{errors:[]}}),{success:!0}}return{success:!1}}catch(l){const p=f(l,"orders");return console.error("Add to cart",p),s&&m({currentErrors:c==null?void 0:c.errors,newErrors:p,dispatch:s}),{success:!1}}},unsetOrderState=e=>{e({type:"setOrderId",payload:{orderId:""}}),e({type:"setOrder",payload:{order:void 0}})};export function setOrderErrors({dispatch:e,errors:t}){return e&&e({type:"setErrors",payload:{errors:t}}),{success:!1}}export const saveAddressToCustomerAddressBook=({type:e,value:t,dispatch:r})=>{const o=`save_${e}_to_customer_book`,n=`${t}`;localStorage.setItem(o,n),r&&r({type:"setSaveAddressToCustomerAddressBook",payload:{[o]:n}})},setGiftCardOrCouponCode=async({code:e,dispatch:t,config:r,order:o})=>{try{if(r&&o&&e&&t){const n=y(r),d={id:o.id,gift_card_or_coupon_code:e},a=await n.orders.update(d);return t({type:"setErrors",payload:{errors:[],order:a}}),{success:!0}}return{success:!1}}catch(n){const d=f(n,"gift_card_or_coupon_code");return t&&setOrderErrors({errors:d,dispatch:t}),{success:!1}}},removeGiftCardOrCouponCode=async({codeType:e,dispatch:t,config:r,order:o})=>{try{if(r&&o&&t){const n=y(r),d={id:o.id,[e]:""},a=await n.orders.update(d);return t({type:"setErrors",payload:{errors:[],order:a}}),{success:!0}}return{success:!1}}catch(n){const d=f(n,"gift_card_or_coupon_code");return console.error("Remove gift card o coupon code",d),t&&setOrderErrors({errors:d,dispatch:t}),{success:!1}}},orderInitialState={loading:!1,orderId:"",order:void 0,errors:[]};const L=(e,t)=>R(e,t,q);export default L;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getErrors,{setErrors}from"../utils/getErrors";import getSdk from"../utils/getSdk";import camelCase from"lodash/camelCase";import has from"lodash/has";import isEmpty from"lodash/isEmpty";export function setLoading({loading:e,dispatch:t}){t&&t({type:"setLoading",payload:{loading:e}})}export const setPaymentRef=({ref:e,dispatch:t})=>{if(e&&t){t({type:"setPaymentRef",payload:{currentPaymentMethodRef:e}})}};export const paymentMethodInitialState={errors:[]};export const setPaymentMethodErrors=(e,t)=>{t&&t({type:"setErrors",payload:{errors:e}})};export const getPaymentMethods=async({order:e,dispatch:t})=>{const r=e.available_payment_methods;const o=e.payment_method;const a=e.payment_source;t({type:"setPaymentMethods",payload:{paymentMethods:r,currentPaymentMethodId:o===null||o===void 0?void 0:o.id,currentPaymentMethodType:o===null||o===void 0?void 0:o.payment_source_type,paymentSource:a}})};export const setPaymentMethod=async({config:e,dispatch:t,order:r,paymentMethodId:o,updateOrder:a,setOrderErrors:s,paymentResource:n})=>{try{if(e&&r&&t&&n){localStorage.removeItem("_save_payment_source_to_customer_wallet");const d=getSdk(e);const c={payment_method:d.payment_methods.relationship(o)};t({type:"setPaymentMethods",payload:{currentPaymentMethodId:o,currentPaymentMethodType:n,errors:[]}});a&&await a({id:r.id,attributes:c});s&&s([])}}catch(e){const t=getErrors(e,"orders");console.error("Set payment method",t)}};export const setPaymentSource=async({config:e,dispatch:t,getOrder:r,attributes:o={},order:a,paymentResource:s,customerPaymentSourceId:n,paymentSourceId:d,updateOrder:c,errors:y})=>{try{if(e&&a){let y;const p=getSdk(e);if(!n){if(!d){const e=Object.assign(Object.assign({},o),{order:p.orders.relationship(a.id)});y=await p[s].create(e)}else{y=await p[s].update(Object.assign({id:d},o))}t&&t({type:"setPaymentSource",payload:{paymentSource:y,errors:[]}});r&&await r(a.id);return y}else{c&&await c({id:a.id,attributes:{_customer_payment_source_id:n}})}}}catch(e){const r=getErrors(e,"payment_methods");console.error("Set payment source:",r);if(t)setErrors({currentErrors:y,newErrors:r,dispatch:t})}return};export const updatePaymentSource=async({id:e,attributes:t,config:r,dispatch:o,paymentResource:a})=>{if(r){try{const s=getSdk(r);const n=await s[a].update(Object.assign({id:e},t));o&&o({type:"setPaymentSource",payload:{paymentSource:n}})}catch(e){console.error("Update payment source:",e)}}};export const destroyPaymentSource=async({paymentSourceId:e,paymentResource:t,dispatch:r})=>{if(e&&t){r&&r({type:"setPaymentSource",payload:{paymentSource:undefined}})}};export const setPaymentMethodConfig=(e,t)=>{t({type:"setPaymentMethodConfig",payload:{config:e}})};export function getPaymentConfig(e,t){const r=camelCase(e).replace("Payments","Payment").replace("Transfers","Transfer");return!isEmpty(t)&&has(t,r)?t[r]:undefined}const type=["setErrors","setPaymentMethodConfig","setPaymentMethods","setPaymentSource","setPaymentRef","setLoading"];const paymentMethodReducer=(e,t)=>baseReducer(e,t,type);export default paymentMethodReducer;
1
+ import P from"../utils/baseReducer";import i,{setErrors as h}from"../utils/getErrors";import d from"../utils/getSdk";import f from"lodash/camelCase";import _ from"lodash/has";import M from"lodash/isEmpty";export function setLoading({loading:t,dispatch:e}){e&&e({type:"setLoading",payload:{loading:t}})}export const setPaymentRef=({ref:t,dispatch:e})=>{t&&e&&e({type:"setPaymentRef",payload:{currentPaymentMethodRef:t}})},paymentMethodInitialState={errors:[]},setPaymentMethodErrors=(t,e)=>{e&&e({type:"setErrors",payload:{errors:t}})},getPaymentMethods=async({order:t,dispatch:e})=>{const o=t.available_payment_methods,r=t.payment_method,a=t.payment_source;e({type:"setPaymentMethods",payload:{paymentMethods:o,currentPaymentMethodId:r==null?void 0:r.id,currentPaymentMethodType:r==null?void 0:r.payment_source_type,paymentSource:a}})},setPaymentMethod=async({config:t,dispatch:e,order:o,paymentMethodId:r,updateOrder:a,setOrderErrors:s,paymentResource:n})=>{try{if(t&&o&&e&&n){localStorage.removeItem("_save_payment_source_to_customer_wallet");const y={payment_method:d(t).payment_methods.relationship(r)};e({type:"setPaymentMethods",payload:{currentPaymentMethodId:r,currentPaymentMethodType:n,errors:[]}}),a&&await a({id:o.id,attributes:y}),s&&s([])}}catch(p){const y=i(p,"orders");console.error("Set payment method",y)}},setPaymentSource=async({config:t,dispatch:e,getOrder:o,attributes:r={},order:a,paymentResource:s,customerPaymentSourceId:n,paymentSourceId:p,updateOrder:y,errors:l})=>{try{if(t&&a){let m;const c=d(t);if(n)y&&await y({id:a.id,attributes:{_customer_payment_source_id:n}});else{if(p)m=await c[s].update(Object.assign({id:p},r));else{const u=Object.assign(Object.assign({},r),{order:c.orders.relationship(a.id)});m=await c[s].create(u)}return e&&e({type:"setPaymentSource",payload:{paymentSource:m,errors:[]}}),o&&await o(a.id),m}}}catch(m){const c=i(m,"payment_methods");console.error("Set payment source:",c),e&&h({currentErrors:l,newErrors:c,dispatch:e})}},updatePaymentSource=async({id:t,attributes:e,config:o,dispatch:r,paymentResource:a})=>{if(o)try{const n=await d(o)[a].update(Object.assign({id:t},e));r&&r({type:"setPaymentSource",payload:{paymentSource:n}})}catch(s){console.error("Update payment source:",s)}},destroyPaymentSource=async({paymentSourceId:t,paymentResource:e,dispatch:o})=>{t&&e&&o&&o({type:"setPaymentSource",payload:{paymentSource:void 0}})},setPaymentMethodConfig=(t,e)=>{e({type:"setPaymentMethodConfig",payload:{config:t}})};export function getPaymentConfig(t,e){const o=f(t).replace("Payments","Payment").replace("Transfers","Transfer");return!M(e)&&_(e,o)?e[o]:void 0}const S=["setErrors","setPaymentMethodConfig","setPaymentMethods","setPaymentSource","setPaymentRef","setLoading"],g=(t,e)=>P(t,e,S);export default g;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import{shipmentsFilled}from"../utils/shipments";import{saveBillingAddress,saveShippingAddress,saveToWallet}from"../utils/customerOrderOptions";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const placeOrderInitialState={errors:[],isPermitted:false};export const setPlaceOrderErrors=(e,t)=>{t&&t({type:"setErrors",payload:{errors:e}})};export const placeOrderPermitted=async({config:e,order:t,dispatch:r,options:s})=>{var a;if(t&&e){let e=true;if(t.privacy_url&&t.terms_url){e=localStorage.getItem("privacy-terms")==="true"}const o=t.billing_address;if(isEmpty(o))e=false;const i=t.shipping_address;if(isEmpty(i))e=false;const d=t.shipments;const p=d&&shipmentsFilled(d);if(!isEmpty(d)&&!p)e=false;const l=t.payment_method;const n=t.payment_source;if(t.total_amount_with_taxes_cents!==0&&isEmpty(l===null||l===void 0?void 0:l.id))e=false;console.log(n);r({type:"setPlaceOrderPermitted",payload:{isPermitted:e,paymentType:l===null||l===void 0?void 0:l.payment_source_type,paymentSecret:n===null||n===void 0?void 0:n.client_secret,paymentId:(a=n===null||n===void 0?void 0:n.options)===null||a===void 0?void 0:a.id,paymentSource:n,options:s}})}};export const setPlaceOrder=async({state:e,order:t,config:r,setOrderErrors:s,paymentSource:a})=>{const o={placed:false};try{debugger;if(e&&t&&r&&a){const i=getSdk(r);const{options:d,paymentType:p}=e;if(p==="paypal_payments"){if(!(d===null||d===void 0?void 0:d.paypalPayerId)&&(a===null||a===void 0?void 0:a.approval_url)){window.location.href=a===null||a===void 0?void 0:a.approval_url;return o}await i.paypal_payments.update({id:a.id,paypal_payer_id:d===null||d===void 0?void 0:d.paypalPayerId})}const l={id:t.id,_place:true};if(saveBillingAddress()){await i.orders.update({id:t.id,_save_billing_address_to_customer_address_book:true})}if(saveShippingAddress()){await i.orders.update({id:t.id,_save_shipping_address_to_customer_address_book:true})}switch(p){case"braintree_payments":if(saveToWallet()){await i.orders.update({id:t.id,_save_payment_source_to_customer_wallet:true})}await i.orders.update(l);s&&s([]);return{placed:true};default:if(saveToWallet()){await i.orders.update({id:t.id,_save_payment_source_to_customer_wallet:true})}await i.orders.update(l);s&&s([]);return{placed:true}}}return o}catch(e){const t=getErrors(e,"orders");s&&s(t);return Object.assign(Object.assign({},o),{errors:t})}};const type=["setErrors","setPlaceOrderPermitted"];const placeOrderReducer=(e,t)=>baseReducer(e,t,type);export default placeOrderReducer;
1
+ import m from"../utils/baseReducer";import c from"lodash/isEmpty";import{shipmentsFilled as v}from"../utils/shipments";import{saveBillingAddress as y,saveShippingAddress as f,saveToWallet as _}from"../utils/customerOrderOptions";import g from"../utils/getSdk";import h from"../utils/getErrors";export const placeOrderInitialState={errors:[],isPermitted:!1},setPlaceOrderErrors=(d,e)=>{e&&e({type:"setErrors",payload:{errors:d}})},placeOrderPermitted=async({config:d,order:e,dispatch:n,options:r})=>{var t;if(e&&d){let a=!0;e.privacy_url&&e.terms_url&&(a=localStorage.getItem("privacy-terms")==="true");const s=e.billing_address;c(s)&&(a=!1);const i=e.shipping_address;c(i)&&(a=!1);const l=e.shipments,u=l&&v(l);!c(l)&&!u&&(a=!1);const p=e.payment_method,o=e.payment_source;e.total_amount_with_taxes_cents!==0&&c(p==null?void 0:p.id)&&(a=!1),n({type:"setPlaceOrderPermitted",payload:{isPermitted:a,paymentType:p==null?void 0:p.payment_source_type,paymentSecret:o==null?void 0:o.client_secret,paymentId:(t=o==null?void 0:o.options)===null||t===void 0?void 0:t.id,paymentSource:o,options:r}})}},setPlaceOrder=async({state:d,order:e,config:n,setOrderErrors:r,paymentSource:t})=>{const a={placed:!1};try{debugger;if(d&&e&&n&&t){const s=g(n),{options:i,paymentType:l}=d;if(l==="paypal_payments"){if(!(i==null?void 0:i.paypalPayerId)&&(t==null?void 0:t.approval_url))return window.location.href=t==null?void 0:t.approval_url,a;await s.paypal_payments.update({id:t.id,paypal_payer_id:i==null?void 0:i.paypalPayerId})}const u={id:e.id,_place:!0};switch(y()&&await s.orders.update({id:e.id,_save_billing_address_to_customer_address_book:!0}),f()&&await s.orders.update({id:e.id,_save_shipping_address_to_customer_address_book:!0}),l){case"braintree_payments":return _()&&await s.orders.update({id:e.id,_save_payment_source_to_customer_wallet:!0}),await s.orders.update(u),r&&r([]),{placed:!0};default:return _()&&await s.orders.update({id:e.id,_save_payment_source_to_customer_wallet:!0}),await s.orders.update(u),r&&r([]),{placed:!0}}}return a}catch(s){const i=h(s,"orders");return r&&r(i),Object.assign(Object.assign({},a),{errors:i})}};const w=["setErrors","setPlaceOrderPermitted"],b=(d,e)=>m(d,e,w);export default b;
@@ -1 +1 @@
1
- import getPrices from"../utils/getPrices";import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const priceInitialState={loading:true,prices:{},skuCodes:[],errors:[]};export const getSkusPrice=(e,{config:t,dispatch:s,setPrices:r,prices:i,perPage:c,filters:o})=>{let a={};const p=getSdk(t);p.prices.list({filters:Object.assign({sku_code_in:e.join(",")},o),pageSize:c}).then((async t=>{const n=getPrices(t);a=Object.assign(Object.assign(Object.assign({},a),i),n);if(r){r(a)}s({type:"setPrices",payload:{prices:a}});s({type:"setLoading",payload:{loading:false}});const g=t.meta;if(g.pageCount>1){for(let t=g.currentPage+1;t<=g.pageCount;t++){const i=await p.prices.list({filters:Object.assign({sku_code_in:e.join(",")},o),pageSize:c,pageNumber:t});const n=getPrices(i);a=Object.assign(Object.assign({},a),n);if(r){r(a)}s({type:"setPrices",payload:{prices:a}})}}})).catch((e=>{const t=getErrors(e,"prices");s({type:"setErrors",payload:{errors:t}})}))};export const unsetPriceState=e=>{e({type:"setPrices",payload:{prices:{}}});e({type:"setLoading",payload:{loading:false}})};const typeAction=["setLoading","setPrices","setSkuCodes","setErrors"];const priceReducer=(e,t)=>baseReducer(e,t,typeAction);export default priceReducer;
1
+ import d from"../utils/getPrices";import f from"../utils/baseReducer";import j from"../utils/getSdk";import m from"../utils/getErrors";export const priceInitialState={loading:!0,prices:{},skuCodes:[],errors:[]},getSkusPrice=(t,{config:o,dispatch:s,setPrices:r,prices:u,perPage:p,filters:g})=>{let e={};const l=j(o);l.prices.list({filters:Object.assign({sku_code_in:t.join(",")},g),pageSize:p}).then(async i=>{const a=d(i);e=Object.assign(Object.assign(Object.assign({},e),u),a),r&&r(e),s({type:"setPrices",payload:{prices:e}}),s({type:"setLoading",payload:{loading:!1}});const c=i.meta;if(c.pageCount>1)for(let n=c.currentPage+1;n<=c.pageCount;n++){const y=await l.prices.list({filters:Object.assign({sku_code_in:t.join(",")},g),pageSize:p,pageNumber:n}),b=d(y);e=Object.assign(Object.assign({},e),b),r&&r(e),s({type:"setPrices",payload:{prices:e}})}}).catch(i=>{const a=m(i,"prices");s({type:"setErrors",payload:{errors:a}})})},unsetPriceState=t=>{t({type:"setPrices",payload:{prices:{}}}),t({type:"setLoading",payload:{loading:!1}})};const O=["setLoading","setPrices","setSkuCodes","setErrors"],S=(t,o)=>f(t,o,O);export default S;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const shipmentInitialState={errors:[]};export const setShipmentErrors=(e,t)=>{t&&t({type:"setErrors",payload:{errors:e}})};export const getShipments=async({order:e,dispatch:t,config:s})=>{try{const i=getSdk(s);const o=e.shipments;const r=await i.delivery_lead_times.list({include:["shipping_method","stock_location"]});t({type:"setShipments",payload:{shipments:o,deliveryLeadTimes:r}})}catch(e){console.error(e)}};export const setShippingMethod=async({config:e,shipmentId:t,shippingMethodId:s,getOrder:i,order:o})=>{try{if(s){const r=getSdk(e);await r.shipments.update({id:t,shipping_method:r.shipping_methods.relationship(s)});if(i&&o)i(o.id)}}catch(e){console.error(e)}};const type=["setErrors","setShipments","setShippingMethod"];const shipmentReducer=(e,t)=>baseReducer(e,t,type);export default shipmentReducer;
1
+ import p from"../utils/baseReducer";import n from"../utils/getSdk";export const shipmentInitialState={errors:[]},setShipmentErrors=(e,t)=>{t&&t({type:"setErrors",payload:{errors:e}})},getShipments=async({order:e,dispatch:t,config:i})=>{try{const s=n(i),r=e.shipments,o=await s.delivery_lead_times.list({include:["shipping_method","stock_location"]});t({type:"setShipments",payload:{shipments:r,deliveryLeadTimes:o}})}catch(s){console.error(s)}},setShippingMethod=async({config:e,shipmentId:t,shippingMethodId:i,getOrder:s,order:r})=>{try{if(i){const o=n(e);await o.shipments.update({id:t,shipping_method:o.shipping_methods.relationship(i)}),s&&r&&s(r.id)}}catch(o){console.error(o)}};const c=["setErrors","setShipments","setShippingMethod"],a=(e,t)=>p(e,t,c);export default a;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const shippingAddressInitialState={_shipping_address_clone_id:""};export const setShippingAddress=async(e,s)=>{try{if(s===null||s===void 0?void 0:s.order){if(s.customerAddressId){const d=getSdk(s.config);const r={id:e,reference:s.customerAddressId};await d.addresses.update(r)}s.dispatch({type:"setShippingAddress",payload:{_shipping_address_clone_id:e}})}}catch(e){console.error(e)}};export const setShippingCustomerAddressId=async({dispatch:e,order:s,setCloneAddress:d})=>{var r;const i=(r=s===null||s===void 0?void 0:s.shipping_address)===null||r===void 0?void 0:r.reference;try{if(i){e({type:"setShippingCustomerAddressId",payload:{shippingCustomerAddressId:i}});d(i,"shipping_address")}}catch(e){console.error("error",e)}};const type=["setShippingAddress","setShippingCustomerAddressId","cleanup"];const shippingAddressReducer=(e,s)=>baseReducer(e,s,type);export default shippingAddressReducer;
1
+ import p from"../utils/baseReducer";import o from"../utils/getSdk";export const shippingAddressInitialState={_shipping_address_clone_id:""},setShippingAddress=async(s,e)=>{try{if(e==null?void 0:e.order){if(e.customerAddressId){const d=o(e.config),r={id:s,reference:e.customerAddressId};await d.addresses.update(r)}e.dispatch({type:"setShippingAddress",payload:{_shipping_address_clone_id:s}})}}catch(d){console.error(d)}},setShippingCustomerAddressId=async({dispatch:s,order:e,setCloneAddress:d})=>{var r;const t=(r=e==null?void 0:e.shipping_address)===null||r===void 0?void 0:r.reference;try{t&&(s({type:"setShippingCustomerAddressId",payload:{shippingCustomerAddressId:t}}),d(t,"shipping_address"))}catch(i){console.error("error",i)}};const c=["setShippingAddress","setShippingCustomerAddressId","cleanup"],n=(s,e)=>p(s,e,c);export default n;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";const actionType=["getSkuList","setSkuList"];export const skuListsInitialState={listIds:[]};export const getSkuList=async({listIds:s,config:t,dispatch:e})=>{const c={};try{const i=getSdk(t);s.forEach((async s=>{const t=await i.sku_lists.retrieve(s,{include:["skus"],fields:{skus:["code"]}});const e=t.skus;c[s]=e}));e({payload:{skuLists:c},type:"getSkuList"})}catch(s){console.error(s)}};const skuListsReducer=(s,t)=>baseReducer(s,t,actionType);export default skuListsReducer;
1
+ import r from"../utils/baseReducer";import k from"../utils/getSdk";const a=["getSkuList","setSkuList"];export const skuListsInitialState={listIds:[]},getSkuList=async({listIds:s,config:t,dispatch:u})=>{const o={};try{const e=k(t);s.forEach(async i=>{const c=(await e.sku_lists.retrieve(i,{include:["skus"],fields:{skus:["code"]}})).skus;o[i]=c}),u({payload:{skuLists:o},type:"getSkuList"})}catch(e){console.error(e)}};const n=(s,t)=>r(s,t,a);export default n;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";export const getSkuOptions=async t=>{const{skuOptions:s,dispatch:e}=t;e({type:"setSkuOptions",payload:{skuOptions:s}})};export const unsetSkuOptionsState=t=>{t({type:"setSkuOptions",payload:{skuOptions:[]}});t({type:"setErrors",payload:{errors:[]}})};const actionType=["setSkuOptions","setErrors"];export const skuOptionsInitialState={skuCode:"",skuOptions:[]};const skuOptionsReducer=(t,s)=>baseReducer(t,s,actionType);export default skuOptionsReducer;
1
+ import e from"../utils/baseReducer";export const getSkuOptions=async t=>{const{skuOptions:s,dispatch:o}=t;o({type:"setSkuOptions",payload:{skuOptions:s}})},unsetSkuOptionsState=t=>{t({type:"setSkuOptions",payload:{skuOptions:[]}}),t({type:"setErrors",payload:{errors:[]}})};const p=["setSkuOptions","setErrors"];export const skuOptionsInitialState={skuCode:"",skuOptions:[]};const n=(t,s)=>e(t,s,p);export default n;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSkus from"../utils/getSkus";import{isEmpty,has}from"lodash";import getSdk from"../utils/getSdk";export const setVariantSkuCodes=({skuCodes:e,dispatch:t,setCustomLineItems:s})=>{const o={};const a=e.map((e=>{if(has(e,"lineItem")){o[e.code]=e.lineItem}return e.code}));if(!isEmpty(o)){s&&s(o)}t({type:"setSkuCodes",payload:{skuCodes:a}})};export const setSkuCode=e=>{const{id:t,code:s,config:o,setItem:a,dispatch:r}=e;if(t){const e=getSdk(o);e.skus.retrieve(t,{include:["sku_options"]}).then((e=>{a&&a({[`${s}`]:e})})).catch((e=>{debugger;r({type:"setErrors",payload:{errors:e}})}))}};export const getVariants=e=>{const{config:t,state:s,skuCode:o,dispatch:a,setItem:r,filters:n}=e;const i=getSdk(t);i.skus.list({filters:Object.assign({code_in:s.skuCodes.join(",")},n)}).then((e=>{const n=getSkus(e,s.skuCodes);if(o){setSkuCode({code:n[o].code,id:n[o].id,config:t,dispatch:a,setItem:r})}a({type:"setVariants",payload:{variants:n}});a({type:"setLoading",payload:{loading:false}})})).catch((e=>{a({type:"setErrors",payload:{errors:e}})}))};export const unsetVariantState=e=>{e({type:"setSkuCode",payload:{skuCode:""}});e({type:"setVariants",payload:{variants:{}}});e({type:"setLoading",payload:{loading:false}})};export const variantInitialState={loading:false,variants:{},skuCodes:[],skuCode:"",errors:[],currentSkuId:"",currentSkuInventory:{available:false,quantity:0,levels:[]},currentQuantity:1,currentPrices:[]};const actionType=["setLoading","setVariants","setSkuCodes","setSkuCode","setCurrentSkuId","setCurrentSkuInventory","setCurrentPrices","setErrors"];const variantReducer=(e,t)=>baseReducer(e,t,actionType);export default variantReducer;
1
+ import l from"../utils/baseReducer";import p from"../utils/getSkus";import{isEmpty as k,has as y}from"lodash";import c from"../utils/getSdk";export const setVariantSkuCodes=({skuCodes:e,dispatch:t,setCustomLineItems:r})=>{const s={},o=e.map(a=>(y(a,"lineItem")&&(s[a.code]=a.lineItem),a.code));k(s)||r&&r(s),t({type:"setSkuCodes",payload:{skuCodes:o}})},setSkuCode=e=>{const{id:t,code:r,config:s,setItem:o,dispatch:a}=e;t&&c(s).skus.retrieve(t,{include:["sku_options"]}).then(n=>{o&&o({[`${r}`]:n})}).catch(n=>{debugger;a({type:"setErrors",payload:{errors:n}})})},getVariants=e=>{const{config:t,state:r,skuCode:s,dispatch:o,setItem:a,filters:u}=e;c(t).skus.list({filters:Object.assign({code_in:r.skuCodes.join(",")},u)}).then(i=>{const d=p(i,r.skuCodes);s&&setSkuCode({code:d[s].code,id:d[s].id,config:t,dispatch:o,setItem:a}),o({type:"setVariants",payload:{variants:d}}),o({type:"setLoading",payload:{loading:!1}})}).catch(i=>{o({type:"setErrors",payload:{errors:i}})})},unsetVariantState=e=>{e({type:"setSkuCode",payload:{skuCode:""}}),e({type:"setVariants",payload:{variants:{}}}),e({type:"setLoading",payload:{loading:!1}})},variantInitialState={loading:!1,variants:{},skuCodes:[],skuCode:"",errors:[],currentSkuId:"",currentSkuInventory:{available:!1,quantity:0,levels:[]},currentQuantity:1,currentPrices:[]};const f=["setLoading","setVariants","setSkuCodes","setSkuCode","setCurrentSkuId","setCurrentSkuInventory","setCurrentPrices","setErrors"],g=(e,t)=>l(e,t,f);export default g;
@@ -1 +1 @@
1
- import PropTypes from"prop-types";const CEType=["EMPTY_ERROR","FILTER_NOT_ALLOWED","FORBIDDEN","INTERNAL_SERVER_ERROR","INVALID_DATA_FORMAT","INVALID_FIELD","INVALID_FIELD_FORMAT","INVALID_FIELD_VALUE","INVALID_FILTERS_SYNTAX","INVALID_FILTER_VALUE","INVALID_INCLUDE","INVALID_LINKS_OBJECT","INVALID_PAGE_OBJECT","INVALID_PAGE_VALUE","INVALID_RESOURCE","INVALID_RESOURCE_ID","INVALID_SORT_CRITERIA","INVALID_TOKEN","KEY_NOT_INCLUDED_IN_URL","KEY_ORDER_MISMATCH","LOCKED","NOT_ACCEPTABLE","PARAM_MISSING","PARAM_NOT_ALLOWED","RECORD_NOT_FOUND","RECORD_NOT_FOUND","RELATION_EXISTS","SAVE_FAILED","TYPE_MISMATCH","UNAUTHORIZED","UNSUPPORTED_MEDIA_TYPE","VALIDATION_ERROR"];export const REType=["gift_cards","line_items","orders","prices","sku_options","variant"];export const BaseErrorObject=PropTypes.shape({code:PropTypes.oneOf(CEType).isRequired,message:PropTypes.string.isRequired,resource:PropTypes.oneOf(REType),field:PropTypes.string,id:PropTypes.string});export const ErrorPropTypes={resource:PropTypes.oneOf(["billing_address","gift_cards","line_items","orders","payment_methods","prices","shipping_address","sku_options","variant"]).isRequired,children:PropTypes.func,field:PropTypes.string};
1
+ import _ from"prop-types";const I=["EMPTY_ERROR","FILTER_NOT_ALLOWED","FORBIDDEN","INTERNAL_SERVER_ERROR","INVALID_DATA_FORMAT","INVALID_FIELD","INVALID_FIELD_FORMAT","INVALID_FIELD_VALUE","INVALID_FILTERS_SYNTAX","INVALID_FILTER_VALUE","INVALID_INCLUDE","INVALID_LINKS_OBJECT","INVALID_PAGE_OBJECT","INVALID_PAGE_VALUE","INVALID_RESOURCE","INVALID_RESOURCE_ID","INVALID_SORT_CRITERIA","INVALID_TOKEN","KEY_NOT_INCLUDED_IN_URL","KEY_ORDER_MISMATCH","LOCKED","NOT_ACCEPTABLE","PARAM_MISSING","PARAM_NOT_ALLOWED","RECORD_NOT_FOUND","RECORD_NOT_FOUND","RELATION_EXISTS","SAVE_FAILED","TYPE_MISMATCH","UNAUTHORIZED","UNSUPPORTED_MEDIA_TYPE","VALIDATION_ERROR"];export const REType=["gift_cards","line_items","orders","prices","sku_options","variant"],BaseErrorObject=_.shape({code:_.oneOf(I).isRequired,message:_.string.isRequired,resource:_.oneOf(REType),field:_.string,id:_.string}),ErrorPropTypes={resource:_.oneOf(["billing_address","gift_cards","line_items","orders","payment_methods","prices","shipping_address","sku_options","variant"]).isRequired,children:_.func,field:_.string};
@@ -1 +1 @@
1
- import PropTypes from"prop-types";export const BC={id:PropTypes.string,className:PropTypes.string,style:PropTypes.object,name:PropTypes.string};export const PTLoader=PropTypes.oneOfType([PropTypes.element,PropTypes.string]);export const BaseSelectComponentPropTypes={children:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,selected:PropTypes.bool}).isRequired).isRequired,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.string.isRequired};export const BaseInputComponentPropTypes={children:PropTypes.func,name:PropTypes.string.isRequired,type:PropTypes.oneOf(["text","email","number","date","checkbox","textarea"]).isRequired,onChange:PropTypes.func,placeholder:PropTypes.string};export const BMObject=PropTypes.objectOf(PropTypes.string);export const baseOrderPricePropTypes=Object.assign({base:PropTypes.string.isRequired,type:PropTypes.string.isRequired,children:PropTypes.func,format:PropTypes.oneOf(["formatted","cents","float"])},BC);export const baseOrderComponentPricePropTypes=Object.assign({children:baseOrderPricePropTypes["children"],format:baseOrderPricePropTypes["format"]},BC);
1
+ import e from"prop-types";export const BC={id:e.string,className:e.string,style:e.object,name:e.string},PTLoader=e.oneOfType([e.element,e.string]),BaseSelectComponentPropTypes={children:e.func,options:e.arrayOf(e.shape({label:e.string.isRequired,value:e.oneOfType([e.string,e.number]).isRequired,selected:e.bool}).isRequired).isRequired,placeholder:e.shape({label:e.string.isRequired,value:e.oneOfType([e.string,e.number]).isRequired}),value:e.string,name:e.string.isRequired},BaseInputComponentPropTypes={children:e.func,name:e.string.isRequired,type:e.oneOf(["text","email","number","date","checkbox","textarea"]).isRequired,onChange:e.func,placeholder:e.string},BMObject=e.objectOf(e.string),baseOrderPricePropTypes=Object.assign({base:e.string.isRequired,type:e.string.isRequired,children:e.func,format:e.oneOf(["formatted","cents","float"])},BC),baseOrderComponentPricePropTypes=Object.assign({children:baseOrderPricePropTypes.children,format:baseOrderPricePropTypes.format},BC);
@@ -1 +1 @@
1
- import{isEmpty}from"lodash";import{fieldsExist}from"./validateFormFields";import{addressFields}from"../reducers/AddressReducer";export const billingAddressController=({billing_address:i,billingAddressId:s,errors:e,requiresBillingInfo:r})=>{let d=!isEmpty(e)||isEmpty(i);if(isEmpty(e)&&!isEmpty(i)){let s=[...addressFields];if(r)s=[...s,"billing_info"];d=!!(i&&fieldsExist(i,s))}if(d&&!isEmpty(s)&&isEmpty(i)){d=false}return d};export const shippingAddressController=({billingDisable:i,errors:s,shipToDifferentAddress:e,shipping_address:r,shippingAddressId:d})=>{let t=!!(!i&&e);if(t&&isEmpty(s)&&!isEmpty(r)){t=!!(r&&fieldsExist(r))}if(t&&!isEmpty(d)&&isEmpty(r)){t=false}return t};export const countryLockController=({addresses:i,billing_address:s,billingAddressId:e,countryCodeLock:r,shipToDifferentAddress:d,shipping_address:t,shippingAddressId:o})=>{if(r&&!isEmpty(i)&&e&&!d){const s=i===null||i===void 0?void 0:i.find((i=>(i.id===e||i.reference===e)&&i.countryCode!==r));if(!isEmpty(s))return true}if(r&&!isEmpty(s)&&!d){return(s===null||s===void 0?void 0:s["country_code"])!==r}if(r&&!isEmpty(t)&&d){return(t===null||t===void 0?void 0:t["country_code"])!==r}if(r&&!isEmpty(i)&&o&&d){const s=i===null||i===void 0?void 0:i.find((i=>(i.id===o||i.reference===o)&&i.countryCode!==r));if(!isEmpty(s))return true}return false};
1
+ import{isEmpty as o}from"lodash";import{fieldsExist as c}from"./validateFormFields";import{addressFields as x}from"../reducers/AddressReducer";export const billingAddressController=({billing_address:t,billingAddressId:r,errors:n,requiresBillingInfo:f})=>{let u=!o(n)||o(t);if(o(n)&&!o(t)){let l=[...x];f&&(l=[...l,"billing_info"]),u=!!(t&&c(t,l))}return u&&!o(r)&&o(t)&&(u=!1),u},shippingAddressController=({billingDisable:t,errors:r,shipToDifferentAddress:n,shipping_address:f,shippingAddressId:u})=>{let l=!!(!t&&n);return l&&o(r)&&!o(f)&&(l=!!(f&&c(f))),l&&!o(u)&&o(f)&&(l=!1),l},countryLockController=({addresses:t,billing_address:r,billingAddressId:n,countryCodeLock:f,shipToDifferentAddress:u,shipping_address:l,shippingAddressId:m})=>{if(f&&!o(t)&&n&&!u){const i=t==null?void 0:t.find(v=>(v.id===n||v.reference===n)&&v.countryCode!==f);if(!o(i))return!0}if(f&&!o(r)&&!u)return(r==null?void 0:r.country_code)!==f;if(f&&!o(l)&&u)return(l==null?void 0:l.country_code)!==f;if(f&&!o(t)&&m&&u){const i=t==null?void 0:t.find(v=>(v.id===m||v.reference===m)&&v.countryCode!==f);if(!o(i))return!0}return!1};
@@ -1 +1 @@
1
- const baseReducer=(e,s,t)=>{const a=t;if(a.indexOf(s.type)!==-1){const t=s.payload;e=Object.assign(Object.assign({},e),t)}return e};export default baseReducer;
1
+ const c=(e,n,s)=>{if(s.indexOf(n.type)!==-1){const a=n.payload;e=Object.assign(Object.assign({},e),a)}return e};export default c;
@@ -1 +1 @@
1
- export default function getBrowserInfo(){const n=window&&window.screen?window.screen.width:"";const e=window&&window.screen?window.screen.height:"";const o=window&&window.screen?window.screen.colorDepth:"";const w=window&&window.navigator?window.navigator.userAgent:"";const t=window&&window.navigator?navigator.javaEnabled():false;let i="";if(window&&window.navigator)i=window.navigator.language;const a=new Date;const r=a.getTimezoneOffset();const d={screenWidth:n,screenHeight:e,colorDepth:o,userAgent:w,timeZoneOffset:r,language:i,javaEnabled:t};return d}
1
+ export default function a(){const e=window&&window.screen?window.screen.width:"",o=window&&window.screen?window.screen.height:"",w=window&&window.screen?window.screen.colorDepth:"",t=window&&window.navigator?window.navigator.userAgent:"",i=window&&window.navigator?navigator.javaEnabled():!1;let n="";window&&window.navigator&&(n=window.navigator.language);const r=new Date().getTimezoneOffset();return{screenWidth:e,screenHeight:o,colorDepth:w,userAgent:t,timeZoneOffset:r,language:n,javaEnabled:i}}
@@ -1 +1 @@
1
- import{isValidElement,Children}from"react";import{isEmpty,isFunction,has,get}from"lodash";import components from"../config/components";const checkChildrenTypes=(e,i,n)=>{let t=null;const s=e[i];const r=n.replace("CL","");if((isEmpty(s)&&typeof s!=="function"||typeof s==="function"&&!s)&&e["isRequired"]){t=new Error(`The prop '${i}' is marked as required in '${r}', but its value is '${s}'.`)}Children.map(s,(e=>{if(t)return t;const n=e.type;const s=get(components,`${r}.permittedChildren`);const o=`Invalid prop '${i}' supplied to ${r}. Only components ${s.join(", ")} are allowed.`;if(isFunction(n)&&has(n,"displayName")){const e=get(n,"displayName");const i=n.name;if(e&&e===`${i}`){if(!s.includes(i)){t=new Error(o)}}}if(!isValidElement(e)){t=new Error(o)}}));return t};const childrenTypes=checkChildrenTypes;childrenTypes["isRequired"]=(e,i,n,t,s)=>checkChildrenTypes(Object.assign(Object.assign({},e),{isRequired:true}),i,n,t,s);export default childrenTypes;
1
+ import{isValidElement as y,Children as h}from"react";import{isEmpty as $,isFunction as g,has as C,get as m}from"lodash";import E from"../config/components";const u=(r,n,o)=>{let e=null;const i=r[n],s=o.replace("CL","");return($(i)&&typeof i!="function"||typeof i=="function"&&!i)&&r.isRequired&&(e=new Error(`The prop '${n}' is marked as required in '${s}', but its value is '${i}'.`)),h.map(i,c=>{if(e)return e;const t=c.type,l=m(E,`${s}.permittedChildren`),p=`Invalid prop '${n}' supplied to ${s}. Only components ${l.join(", ")} are allowed.`;if(g(t)&&C(t,"displayName")){const a=m(t,"displayName"),d=t.name;a&&a===`${d}`&&(l.includes(d)||(e=new Error(p)))}y(c)||(e=new Error(p))}),e},f=u;f.isRequired=(r,n,o,e,i)=>u(Object.assign(Object.assign({},r),{isRequired:!0}),n,o,e,i);export default f;
@@ -1 +1 @@
1
- import{Countries,States}from"countries-states-cities-service";export function getCountries(){return Countries.getCountries({sort:{mode:"alphabetical",key:"name"}}).map((({name:e,iso2:t})=>({label:e,value:t})))}export function getStateOfCountry(e){const t={country_code:e};if(e==="IT")t.is_region=false;return States.getStates({filters:t,sort:{mode:"alphabetical",key:"name"}}).map((({name:e,state_code:t})=>({label:e.replace("Province of",""),value:t})))}export function isValidState(e,t){return States.getStates({filters:{state_code:e,country_code:t}}).length>0}
1
+ import{Countries as n,States as a}from"countries-states-cities-service";export function getCountries(){return n.getCountries({sort:{mode:"alphabetical",key:"name"}}).map(({name:e,iso2:t})=>({label:e,value:t}))}export function getStateOfCountry(e){const t={country_code:e};return e==="IT"&&(t.is_region=!1),a.getStates({filters:t,sort:{mode:"alphabetical",key:"name"}}).map(({name:r,state_code:i})=>({label:r.replace("Province of",""),value:i}))}export function isValidState(e,t){return a.getStates({filters:{state_code:e,country_code:t}}).length>0}
@@ -1 +1 @@
1
- import findIndex from"lodash/findIndex";import pick from"lodash/pick";const customMessages=(e=[],o)=>{const s=findIndex(e,pick(o,["field","code","resource"]));return s!==-1?e[s]:null};export default customMessages;
1
+ import r from"lodash/findIndex";import i from"lodash/pick";const n=(o=[],e)=>{const d=r(o,i(e,["field","code","resource"]));return d!==-1?o[d]:null};export default n;
@@ -1 +1 @@
1
- import{getSaveBillingAddressToAddressBook,getSavePaymentSourceToCustomerWallet,getSaveShippingAddressToAddressBook}from"./localStorage";export function saveToWallet(){return getSavePaymentSourceToCustomerWallet()}export function saveBillingAddress(){return getSaveBillingAddressToAddressBook()}export function saveShippingAddress(){return getSaveShippingAddressToAddressBook()}
1
+ import{getSaveBillingAddressToAddressBook as e,getSavePaymentSourceToCustomerWallet as o,getSaveShippingAddressToAddressBook as r}from"./localStorage";export function saveToWallet(){return o()}export function saveBillingAddress(){return e()}export function saveShippingAddress(){return r()}
@@ -1 +1 @@
1
- import{keys}from"lodash";export default function getAmount(o){const{format:t,type:e,obj:s,base:$}=o;let r;keys(s).map((o=>{const a=o.toLowerCase();const n=`${t}_${e}_${$}`.toLowerCase();const f=`${e}_${$}_${t}`.toLowerCase();const _=`${t}_${$}_${e}`.toLowerCase();const c=`${$}_${e}_${t}`.toLowerCase();if(a===n){r=s[o]}if(a===f){r=s[o]}if(a===_){r=s[o]}if(a===c){r=s[o]}}));return r}
1
+ import{keys as y}from"lodash";export default function i(a){const{format:s,type:r,obj:e,base:$}=a;let o;return y(e).map(t=>{const n=t.toLowerCase(),f=`${s}_${r}_${$}`.toLowerCase(),p=`${r}_${$}_${s}`.toLowerCase(),_=`${s}_${$}_${r}`.toLowerCase(),c=`${$}_${r}_${s}`.toLowerCase();n===f&&(o=e[t]),n===p&&(o=e[t]),n===_&&(o=e[t]),n===c&&(o=e[t])}),o}
@@ -1 +1 @@
1
- import{first,keys}from"lodash";const getCurrentItemKey=e=>first(keys(e))||"";export default getCurrentItemKey;
1
+ import{first as e,keys as r}from"lodash";const o=t=>e(r(t))||"";export default o;
@@ -1 +1 @@
1
- import differenceBy from"lodash/differenceBy";export default function getErrors(r,e){return r.errors.map((r=>Object.assign(Object.assign({},r),{resource:e})))}export function setErrors({currentErrors:r=[],newErrors:e=[],dispatch:o,filterBy:t="code"}){const s=differenceBy(r,e,t);const n=(r===null||r===void 0?void 0:r.length)===0?e:s;const c=[...r||[],...n];if(!o){return c}o({type:"setErrors",payload:{errors:c}})}
1
+ import i from"lodash/differenceBy";export default function d(e,o){return e.errors.map(t=>Object.assign(Object.assign({},t),{resource:o}))}export function setErrors({currentErrors:e=[],newErrors:o=[],dispatch:t,filterBy:r="code"}){const f=i(e,o,r),s=(e==null?void 0:e.length)===0?o:f,n=[...e||[],...s];if(!t)return n;t({type:"setErrors",payload:{errors:n}})}
@@ -1 +1 @@
1
- const getLineItemsCount=(t,e=0)=>{const n=["skus","gift_cards","bundles","adjustments"];t.filter((t=>t.item_type&&n.includes(t.item_type))).forEach((t=>{if(t.quantity)e+=t.quantity}));return e};export default getLineItemsCount;
1
+ const i=(s,e=0)=>{const n=["skus","gift_cards","bundles","adjustments"];return s.filter(t=>t.item_type&&n.includes(t.item_type)).forEach(t=>{t.quantity&&(e+=t.quantity)}),e};export default i;
@@ -1 +1 @@
1
- import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";export default function getLoaderComponent(t){return typeof t==="function"?_jsx(t,{},void 0):_jsx(_Fragment,{children:t},void 0)}
1
+ import{jsx as n,Fragment as e}from"react/jsx-runtime";export default function o(t){return typeof t=="function"?n(t,{},void 0):n(e,{children:t},void 0)}
@@ -1 +1 @@
1
- import{createElement as _createElement}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{isEmpty,first,isArray,has}from"lodash";import PriceTemplate from"../components/utils/PriceTemplate";export const getPriceByCode=(e,t="")=>t?first(e.filter((e=>e.currency_code===t))):first(e);export const getPricesComponent=(e,t)=>{if(isEmpty(e)){return _jsx(PriceTemplate,Object.assign({},t),void 0)}return e.map(((e,r)=>{const o=typeof t.showCompare==="undefined"&&(e===null||e===void 0?void 0:e.compare_at_amount_cents)>(e===null||e===void 0?void 0:e.amount_cents)||t.showCompare;return _createElement(PriceTemplate,Object.assign({},t,{key:r,showCompare:o,formattedAmount:e.formatted_amount,formattedCompare:e.formatted_compare_at_amount}))}))};export default function getPrices(e){const t={};if(isArray(e)){e.forEach((e=>{const r=e.sku_code;if(has(t,r)){t[r].push(e)}else{t[r]=[e]}}))}return t}
1
+ import{createElement as s}from"react";import{jsx as i}from"react/jsx-runtime";import{isEmpty as c,first as a,isArray as u,has as f}from"lodash";import m from"../components/utils/PriceTemplate";export const getPriceByCode=(o,e="")=>e?a(o.filter(t=>t.currency_code===e)):a(o),getPricesComponent=(o,e)=>c(o)?i(m,Object.assign({},e),void 0):o.map((t,r)=>{const n=typeof e.showCompare=="undefined"&&(t==null?void 0:t.compare_at_amount_cents)>(t==null?void 0:t.amount_cents)||e.showCompare;return s(m,Object.assign({},e,{key:r,showCompare:n,formattedAmount:t.formatted_amount,formattedCompare:t.formatted_compare_at_amount}))});export default function d(o){const e={};return u(o)&&o.forEach(t=>{const r=t.sku_code;f(e,r)?e[r].push(t):e[r]=[t]}),e}
@@ -1 +1 @@
1
- import getOrganizationSlug from"./organization";import Sdk from"@commercelayer/sdk";export default function getSdk({endpoint:e,accessToken:n}){const o=getOrganizationSlug(e);return Sdk(Object.assign({accessToken:n},o))}
1
+ import e from"./organization";import n from"@commercelayer/sdk";export default function i({endpoint:o,accessToken:r}){const t=e(o);return n(Object.assign({accessToken:r},t))}
@@ -1 +1 @@
1
- const getSkus=(o,e)=>{const t={};e.forEach((e=>{o.forEach((o=>{if((o===null||o===void 0?void 0:o.code)===e)t[o.code]=o}))}));return t};export default getSkus;
1
+ const r=(o,t)=>{const e={};return t.forEach(d=>{o.forEach(c=>{(c==null?void 0:c.code)===d&&(e[c.code]=c)})}),e};export default r;
@@ -1 +1 @@
1
- const countryLock=["IT","US"];export default function isEmptyStates(t){return!countryLock.includes(t)}
1
+ const n=["IT","US"];export default function c(t){return!n.includes(t)}
@@ -1 +1 @@
1
- export default function isJSON(r){try{JSON.parse(r);return true}catch(r){return false}}
1
+ export default function r(e){try{return JSON.parse(e),!0}catch{return!1}}
@@ -1 +1 @@
1
- import jwtDecode from"jwt-decode";export default function jwt(e){return jwtDecode(e)}
1
+ import e from"jwt-decode";export default function o(t){return e(t)}
@@ -1 +1 @@
1
- export const getLocalOrder=e=>localStorage.getItem(e);export const setLocalOrder=(e,t)=>localStorage.setItem(e,t);export const deleteLocalOrder=e=>{localStorage.removeItem(e)};export const getSavePaymentSourceToCustomerWallet=()=>localStorage.getItem("_save_payment_source_to_customer_wallet")==="true";export const getSaveBillingAddressToAddressBook=()=>localStorage.getItem("_save_billing_address_to_customer_address_book")==="true";export const getSaveShippingAddressToAddressBook=()=>localStorage.getItem("_save_shipping_address_to_customer_address_book")==="true";export function setCustomerOrderParam(e,t){return setLocalOrder(e,t)}
1
+ export const getLocalOrder=e=>localStorage.getItem(e),setLocalOrder=(e,t)=>localStorage.setItem(e,t),deleteLocalOrder=e=>{localStorage.removeItem(e)},getSavePaymentSourceToCustomerWallet=()=>localStorage.getItem("_save_payment_source_to_customer_wallet")==="true",getSaveBillingAddressToAddressBook=()=>localStorage.getItem("_save_billing_address_to_customer_address_book")==="true",getSaveShippingAddressToAddressBook=()=>localStorage.getItem("_save_shipping_address_to_customer_address_book")==="true";export function setCustomerOrderParam(e,t){return setLocalOrder(e,t)}
@@ -1 +1 @@
1
- export default function getOrganizationSlug(e){const o={organization:"",domain:"commercelayer.io"};if(e.search("commercelayer.io")===-1)o.domain="commercelayer.co";o.organization=e.replace("https://","").replace(`.${o.domain}`,"");return o}
1
+ export default function a(o){const e={organization:"",domain:"commercelayer.io"};return o.search("commercelayer.io")===-1&&(e.domain="commercelayer.co"),e.organization=o.replace("https://","").replace(`.${e.domain}`,""),e}
@@ -1 +1 @@
1
- import{getPaymentConfig}from"../reducers/PaymentMethodReducer";import pick from"lodash/pick";export default function getPaypalConfig(e,t){const r=getPaymentConfig(e,t);return r&&pick(r,["return_url","cancel_url"])}
1
+ import{getPaymentConfig as o}from"../reducers/PaymentMethodReducer";import n from"lodash/pick";export default function u(e,r){const t=o(e,r);return t&&n(t,["return_url","cancel_url"])}
@@ -1 +1 @@
1
- import isFunction from"lodash/isFunction";export default function promisify(i,o){return new Promise(((n,e)=>{if(o)i(o,((i,o)=>{if(i)e(i);n(o)}));else if(isFunction(i===null||i===void 0?void 0:i.tokenize)){i===null||i===void 0?void 0:i.tokenize(((i,o)=>{if(i)e(i);n(o)}))}else i(((i,o)=>{if(i)e(i);n(o)}))}))}
1
+ import d from"lodash/isFunction";export default function l(i,u){return new Promise((f,t)=>{u?i(u,(o,n)=>{o&&t(o),f(n)}):d(i==null?void 0:i.tokenize)?i==null||i.tokenize((o,n)=>{o&&t(o),f(n)}):i((o,n)=>{o&&t(o),f(n)})})}
@@ -1 +1 @@
1
- import compact from"lodash/compact";import isEmpty from"lodash/isEmpty";export function shipmentsFilled(t){const m=compact(t.filter((t=>!isEmpty(t.shipping_method))));return!isEmpty(m)}
1
+ import p from"lodash/compact";import t from"lodash/isEmpty";export function shipmentsFilled(o){const i=p(o.filter(m=>!t(m.shipping_method)));return!t(i)}
@@ -1 +1 @@
1
- import isEmpty from"lodash/isEmpty";import isString from"lodash/isString";import without from"lodash/without";import keys from"lodash/keys";import map from"lodash/map";import get from"lodash/get";import{addressFields}from"../reducers/AddressReducer";const EMAIL_PATTERN=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$/;export const validateValue=(e,t,s,a)=>{if(!e){return{field:t,code:"VALIDATION_ERROR",message:`${t} - is required`,resourceType:a}}if(s==="email"&&isString(e)&&!e.match(EMAIL_PATTERN)){return{field:t,code:"VALIDATION_ERROR",message:`${t} - is not valid`,resourceType:a}}return{}};const validateFormFields=(e,t,s)=>{const a=[];let i={metadata:{}};map(e,(e=>{const r=!!get(e,"checked");const n=r?r:e.value==="on"?false:e.value;const o=e.getAttribute("name");if(o&&t.indexOf(o)!==-1||e.required){const t=validateValue(n,e.name,e.type,s);if(!isEmpty(t)){a.push(t)}i=Object.assign(Object.assign({},i),{[`${e.name}`]:n})}if(e.getAttribute("name")){const t=!!e.getAttribute("data-metadata");i=t?Object.assign(Object.assign({},i),{metadata:Object.assign(Object.assign({},i.metadata),{[`${e.name}`]:n})}):Object.assign(Object.assign({},i),{[`${e.name}`]:n})}}));return{errors:a,values:i}};export const fieldsExist=(e,t=addressFields)=>{if(!e["business"]){const s=without(t,"line_2","company");const a=keys(e).filter((e=>s.includes(e)));return s.length>a.length}else{const s=without(t,"first_name","last_name");const a=keys(e).filter((e=>s.includes(e)));return s.length>a.length}};export default validateFormFields;
1
+ import u from"lodash/isEmpty";import f from"lodash/isString";import m from"lodash/without";import c from"lodash/keys";import g from"lodash/map";import p from"lodash/get";import{addressFields as h}from"../reducers/AddressReducer";const O=/[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$/;export const validateValue=(s,a,i,r)=>s?i==="email"&&f(s)&&!s.match(O)?{field:a,code:"VALIDATION_ERROR",message:`${a} - is not valid`,resourceType:r}:{}:{field:a,code:"VALIDATION_ERROR",message:`${a} - is required`,resourceType:r};const b=(s,a,i)=>{const r=[];let e={metadata:{}};return g(s,t=>{const d=!!p(t,"checked"),n=d||(t.value==="on"?!1:t.value),l=t.getAttribute("name");if(l&&a.indexOf(l)!==-1||t.required){const o=validateValue(n,t.name,t.type,i);u(o)||r.push(o),e=Object.assign(Object.assign({},e),{[`${t.name}`]:n})}t.getAttribute("name")&&(e=!!t.getAttribute("data-metadata")?Object.assign(Object.assign({},e),{metadata:Object.assign(Object.assign({},e.metadata),{[`${t.name}`]:n})}):Object.assign(Object.assign({},e),{[`${t.name}`]:n}))}),{errors:r,values:e}};export const fieldsExist=(s,a=h)=>{if(s.business){const i=m(a,"first_name","last_name"),r=c(s).filter(e=>i.includes(e));return i.length>r.length}else{const i=m(a,"line_2","company"),r=c(s).filter(e=>i.includes(e));return i.length>r.length}};export default b;