@commercelayer/react-components 2.49.8 → 2.50.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 (360) hide show
  1. package/lib/cjs/components/AddToCartButton.js +1 -1
  2. package/lib/cjs/components/Address.js +1 -1
  3. package/lib/cjs/components/AddressCountrySelector.js +1 -1
  4. package/lib/cjs/components/AddressField.js +1 -1
  5. package/lib/cjs/components/AddressInput.js +1 -1
  6. package/lib/cjs/components/AddressStateSelector.js +1 -1
  7. package/lib/cjs/components/AddressesContainer.js +1 -1
  8. package/lib/cjs/components/AdyenPayment.js +1 -1
  9. package/lib/cjs/components/AvailabilityContainer.js +1 -1
  10. package/lib/cjs/components/AvailabilityTemplate.js +1 -1
  11. package/lib/cjs/components/BillingAddressContainer.js +1 -1
  12. package/lib/cjs/components/BillingAddressForm.js +1 -1
  13. package/lib/cjs/components/BraintreePayment.js +1 -1
  14. package/lib/cjs/components/CheckoutLink.js +1 -1
  15. package/lib/cjs/components/CommerceLayer.js +1 -1
  16. package/lib/cjs/components/CustomerContainer.js +1 -1
  17. package/lib/cjs/components/CustomerInput.js +1 -1
  18. package/lib/cjs/components/DeliveryLeadTime.js +1 -1
  19. package/lib/cjs/components/DiscountAmount.js +1 -1
  20. package/lib/cjs/components/Errors.js +1 -1
  21. package/lib/cjs/components/ExternalFunction.js +1 -1
  22. package/lib/cjs/components/GiftCard.js +1 -1
  23. package/lib/cjs/components/GiftCardAmount.js +1 -1
  24. package/lib/cjs/components/GiftCardContainer.js +1 -1
  25. package/lib/cjs/components/GiftCardCurrencySelector.js +1 -1
  26. package/lib/cjs/components/GiftCardInput.js +1 -1
  27. package/lib/cjs/components/GiftCardOrCouponCode.js +1 -1
  28. package/lib/cjs/components/GiftCardOrCouponForm.js +1 -1
  29. package/lib/cjs/components/GiftCardOrCouponInput.js +1 -1
  30. package/lib/cjs/components/GiftCardOrCouponRemoveButton.js +1 -1
  31. package/lib/cjs/components/GiftCardOrCouponSubmit.js +1 -1
  32. package/lib/cjs/components/ItemContainer.js +1 -1
  33. package/lib/cjs/components/LineItem.js +1 -1
  34. package/lib/cjs/components/LineItemAmount.js +1 -1
  35. package/lib/cjs/components/LineItemCode.js +1 -1
  36. package/lib/cjs/components/LineItemImage.js +1 -1
  37. package/lib/cjs/components/LineItemName.js +1 -1
  38. package/lib/cjs/components/LineItemOption.js +1 -1
  39. package/lib/cjs/components/LineItemOptions.js +1 -1
  40. package/lib/cjs/components/LineItemQuantity.js +1 -1
  41. package/lib/cjs/components/LineItemRemoveLink.js +1 -1
  42. package/lib/cjs/components/LineItemsContainer.js +1 -1
  43. package/lib/cjs/components/LineItemsCount.js +1 -1
  44. package/lib/cjs/components/MetadataInput.js +1 -1
  45. package/lib/cjs/components/OrderContainer.js +1 -1
  46. package/lib/cjs/components/OrderNumber.js +1 -1
  47. package/lib/cjs/components/OrderStorage.js +1 -1
  48. package/lib/cjs/components/PaymentGateway.js +1 -1
  49. package/lib/cjs/components/PaymentMethod.js +1 -1
  50. package/lib/cjs/components/PaymentMethodAmount.js +1 -1
  51. package/lib/cjs/components/PaymentMethodName.js +1 -1
  52. package/lib/cjs/components/PaymentMethodPrice.js +1 -1
  53. package/lib/cjs/components/PaymentMethodRadioButton.js +1 -1
  54. package/lib/cjs/components/PaymentMethodsContainer.js +1 -1
  55. package/lib/cjs/components/PaymentSource.js +1 -1
  56. package/lib/cjs/components/PaymentSourceBrandIcon.js +1 -1
  57. package/lib/cjs/components/PaymentSourceBrandName.js +1 -1
  58. package/lib/cjs/components/PaymentSourceDetail.js +1 -1
  59. package/lib/cjs/components/PaymentSourceEditButton.js +1 -1
  60. package/lib/cjs/components/PaypalPayment.js +1 -1
  61. package/lib/cjs/components/PlaceOrderButton.js +1 -1
  62. package/lib/cjs/components/PlaceOrderContainer.js +1 -1
  63. package/lib/cjs/components/Price.js +1 -1
  64. package/lib/cjs/components/PricesContainer.js +1 -1
  65. package/lib/cjs/components/PrivacyAndTermsCheckbox.js +1 -1
  66. package/lib/cjs/components/QuantitySelector.js +1 -1
  67. package/lib/cjs/components/SaveAddressesButton.js +1 -1
  68. package/lib/cjs/components/SaveCustomerButton.js +1 -1
  69. package/lib/cjs/components/Shipment.js +1 -1
  70. package/lib/cjs/components/ShipmentField.js +1 -1
  71. package/lib/cjs/components/ShipmentsContainer.js +1 -1
  72. package/lib/cjs/components/ShippingAddressContainer.js +1 -1
  73. package/lib/cjs/components/ShippingAddressForm.js +1 -1
  74. package/lib/cjs/components/ShippingAmount.js +1 -1
  75. package/lib/cjs/components/ShippingMethod.js +1 -1
  76. package/lib/cjs/components/ShippingMethodName.js +1 -1
  77. package/lib/cjs/components/ShippingMethodPrice.js +1 -1
  78. package/lib/cjs/components/ShippingMethodRadioButton.d.ts +8 -4
  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.d.ts +1 -0
  144. package/lib/cjs/index.js +1 -1
  145. package/lib/cjs/reducers/AddressReducer.js +1 -1
  146. package/lib/cjs/reducers/AvailabilityReducer.js +1 -1
  147. package/lib/cjs/reducers/BillingAddressReducer.js +1 -1
  148. package/lib/cjs/reducers/CustomerReducer.js +1 -1
  149. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  150. package/lib/cjs/reducers/ItemReducer.js +1 -1
  151. package/lib/cjs/reducers/LineItemReducer.js +1 -1
  152. package/lib/cjs/reducers/OrderReducer.js +1 -1
  153. package/lib/cjs/reducers/PaymentMethodReducer.js +1 -1
  154. package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
  155. package/lib/cjs/reducers/PriceReducer.js +1 -1
  156. package/lib/cjs/reducers/ShipmentReducer.js +1 -1
  157. package/lib/cjs/reducers/ShippingAddressReducer.js +1 -1
  158. package/lib/cjs/reducers/SkuListsReducer.js +1 -1
  159. package/lib/cjs/reducers/SkuOptionsReducer.js +1 -1
  160. package/lib/cjs/reducers/VariantReducer.js +1 -1
  161. package/lib/cjs/typings/errors.js +1 -1
  162. package/lib/cjs/typings/index.js +1 -1
  163. package/lib/cjs/utils/PropsType.js +1 -1
  164. package/lib/cjs/utils/addressesManager.js +1 -1
  165. package/lib/cjs/utils/baseReducer.js +1 -1
  166. package/lib/cjs/utils/browserInfo.js +1 -1
  167. package/lib/cjs/utils/childrenTypes.js +1 -1
  168. package/lib/cjs/utils/countryStateCity.js +1 -1
  169. package/lib/cjs/utils/customMessages.js +1 -1
  170. package/lib/cjs/utils/customerOrderOptions.js +1 -1
  171. package/lib/cjs/utils/getAmount.js +1 -1
  172. package/lib/cjs/utils/getCurrentItemKey.js +1 -1
  173. package/lib/cjs/utils/getErrors.js +1 -1
  174. package/lib/cjs/utils/getLineItemsCount.js +1 -1
  175. package/lib/cjs/utils/getLoaderComponent.js +1 -1
  176. package/lib/cjs/utils/getPrices.js +1 -1
  177. package/lib/cjs/utils/getSdk.js +1 -1
  178. package/lib/cjs/utils/getSkus.js +1 -1
  179. package/lib/cjs/utils/isEmptyStates.js +1 -1
  180. package/lib/cjs/utils/isJSON.js +1 -1
  181. package/lib/cjs/utils/jwt.js +1 -1
  182. package/lib/cjs/utils/localStorage.js +1 -1
  183. package/lib/cjs/utils/organization.js +1 -1
  184. package/lib/cjs/utils/paypalPayment.js +1 -1
  185. package/lib/cjs/utils/promisify.js +1 -1
  186. package/lib/cjs/utils/shipments.js +1 -1
  187. package/lib/cjs/utils/validateFormFields.js +1 -1
  188. package/lib/esm/components/AddToCartButton.js +1 -1
  189. package/lib/esm/components/Address.js +1 -1
  190. package/lib/esm/components/AddressCountrySelector.js +1 -1
  191. package/lib/esm/components/AddressField.js +1 -1
  192. package/lib/esm/components/AddressInput.js +1 -1
  193. package/lib/esm/components/AddressStateSelector.js +1 -1
  194. package/lib/esm/components/AddressesContainer.js +1 -1
  195. package/lib/esm/components/AdyenPayment.js +1 -1
  196. package/lib/esm/components/AvailabilityContainer.js +1 -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.d.ts +8 -4
  266. package/lib/esm/components/ShippingMethodRadioButton.js +1 -1
  267. package/lib/esm/components/SkuList.js +1 -1
  268. package/lib/esm/components/SkuListsContainer.js +1 -1
  269. package/lib/esm/components/SkuOption.js +1 -1
  270. package/lib/esm/components/SkuOptionInput.js +1 -1
  271. package/lib/esm/components/SkuOptionsContainer.js +1 -1
  272. package/lib/esm/components/StockTransfer.js +1 -1
  273. package/lib/esm/components/StockTransferField.js +1 -1
  274. package/lib/esm/components/StripePayment.js +1 -1
  275. package/lib/esm/components/SubTotalAmount.js +1 -1
  276. package/lib/esm/components/SubmitButton.js +1 -1
  277. package/lib/esm/components/TaxesAmount.js +1 -1
  278. package/lib/esm/components/TotalAmount.js +1 -1
  279. package/lib/esm/components/VariantSelector.js +1 -1
  280. package/lib/esm/components/VariantsContainer.js +1 -1
  281. package/lib/esm/components/WireTransferPayment.js +1 -1
  282. package/lib/esm/components/gateways/AdyenGateway.js +1 -1
  283. package/lib/esm/components/gateways/BraintreeGateway.js +1 -1
  284. package/lib/esm/components/gateways/PaypalGateway.js +1 -1
  285. package/lib/esm/components/gateways/StripeGateway.js +1 -1
  286. package/lib/esm/components/gateways/WireTransferGateway.js +1 -1
  287. package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
  288. package/lib/esm/components/utils/BaseField.js +1 -1
  289. package/lib/esm/components/utils/BaseInput.js +1 -1
  290. package/lib/esm/components/utils/BaseOrderPrice.js +1 -1
  291. package/lib/esm/components/utils/BaseSelect.js +1 -1
  292. package/lib/esm/components/utils/Parent.js +1 -1
  293. package/lib/esm/components/utils/PaymentCardsTemplate.js +1 -1
  294. package/lib/esm/components/utils/PriceTemplate.js +1 -1
  295. package/lib/esm/components/utils/VariantTemplate.js +1 -1
  296. package/lib/esm/components/utils/getAllErrors.js +1 -1
  297. package/lib/esm/config/components.js +1 -1
  298. package/lib/esm/context/AddressChildrenContext.js +1 -1
  299. package/lib/esm/context/AddressContext.js +1 -1
  300. package/lib/esm/context/CommerceLayerContext.js +1 -1
  301. package/lib/esm/context/CustomerContext.js +1 -1
  302. package/lib/esm/context/ExternalFunctionContext.js +1 -1
  303. package/lib/esm/context/LineItemChildrenContext.js +1 -1
  304. package/lib/esm/context/LineItemContext.js +1 -1
  305. package/lib/esm/context/LineItemOptionChildrenContext.js +1 -1
  306. package/lib/esm/context/OrderContext.js +1 -1
  307. package/lib/esm/context/OrderStorageContext.js +1 -1
  308. package/lib/esm/context/PaymentMethodChildrenContext.js +1 -1
  309. package/lib/esm/context/PaymentMethodContext.js +1 -1
  310. package/lib/esm/context/PlaceOrderContext.js +1 -1
  311. package/lib/esm/context/ShipmentChildrenContext.js +1 -1
  312. package/lib/esm/context/ShipmentContext.js +1 -1
  313. package/lib/esm/context/ShippingMethodChildrenContext.js +1 -1
  314. package/lib/esm/context/SkuOptionChildrenContext.js +1 -1
  315. package/lib/esm/context/StockTransferChildrenContext.js +1 -1
  316. package/lib/esm/index.d.ts +1 -0
  317. package/lib/esm/reducers/AddressReducer.js +1 -1
  318. package/lib/esm/reducers/AvailabilityReducer.js +1 -1
  319. package/lib/esm/reducers/BillingAddressReducer.js +1 -1
  320. package/lib/esm/reducers/CustomerReducer.js +1 -1
  321. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  322. package/lib/esm/reducers/ItemReducer.js +1 -1
  323. package/lib/esm/reducers/LineItemReducer.js +1 -1
  324. package/lib/esm/reducers/OrderReducer.js +1 -1
  325. package/lib/esm/reducers/PaymentMethodReducer.js +1 -1
  326. package/lib/esm/reducers/PlaceOrderReducer.js +1 -1
  327. package/lib/esm/reducers/PriceReducer.js +1 -1
  328. package/lib/esm/reducers/ShipmentReducer.js +1 -1
  329. package/lib/esm/reducers/ShippingAddressReducer.js +1 -1
  330. package/lib/esm/reducers/SkuListsReducer.js +1 -1
  331. package/lib/esm/reducers/SkuOptionsReducer.js +1 -1
  332. package/lib/esm/reducers/VariantReducer.js +1 -1
  333. package/lib/esm/typings/errors.js +1 -1
  334. package/lib/esm/typings/index.js +1 -1
  335. package/lib/esm/utils/addressesManager.js +1 -1
  336. package/lib/esm/utils/baseReducer.js +1 -1
  337. package/lib/esm/utils/browserInfo.js +1 -1
  338. package/lib/esm/utils/childrenTypes.js +1 -1
  339. package/lib/esm/utils/countryStateCity.js +1 -1
  340. package/lib/esm/utils/customMessages.js +1 -1
  341. package/lib/esm/utils/getAmount.js +1 -1
  342. package/lib/esm/utils/getCurrentItemKey.js +1 -1
  343. package/lib/esm/utils/getErrors.js +1 -1
  344. package/lib/esm/utils/getLineItemsCount.js +1 -1
  345. package/lib/esm/utils/getLoaderComponent.js +1 -1
  346. package/lib/esm/utils/getPrices.js +1 -1
  347. package/lib/esm/utils/getSdk.js +1 -1
  348. package/lib/esm/utils/getSkus.js +1 -1
  349. package/lib/esm/utils/isEmptyStates.js +1 -1
  350. package/lib/esm/utils/isJSON.js +1 -1
  351. package/lib/esm/utils/jwt.js +1 -1
  352. package/lib/esm/utils/localStorage.js +1 -1
  353. package/lib/esm/utils/organization.js +1 -1
  354. package/lib/esm/utils/paypalPayment.js +1 -1
  355. package/lib/esm/utils/promisify.js +1 -1
  356. package/lib/esm/utils/shipments.js +1 -1
  357. package/lib/esm/utils/validateFormFields.js +1 -1
  358. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  359. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  360. package/package.json +18 -18
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes;const displayName=components.StockTransfer.displayName;const StockTransfer=e=>{const{children:t}=e;const{lineItem:n}=useContext(LineItemChildrenContext);const{stockTransfers:o}=useContext(ShipmentChildrenContext);const r=o===null||o===void 0?void 0:o.filter((e=>e.sku_code===(n===null||n===void 0?void 0:n.sku_code))).map(((e,n)=>{const o={stockTransfer:e};return _jsx(StockTransferChildrenContext.Provider,Object.assign({value:o},{children:t}),n)}));return _jsx(Fragment,{children:r},void 0)};StockTransfer.propTypes=propTypes;StockTransfer.displayName=displayName;export default StockTransfer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes,displayName=components.StockTransfer.displayName,StockTransfer=props=>{const{children}=props,{lineItem}=useContext(LineItemChildrenContext),{stockTransfers}=useContext(ShipmentChildrenContext),components2=stockTransfers==null?void 0:stockTransfers.filter(stock=>stock.sku_code===(lineItem==null?void 0:lineItem.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer};return _jsx(StockTransferChildrenContext.Provider,Object.assign({value:stockTransferProps},{children}),k)});return _jsx(Fragment,{children:components2},void 0)};StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName;export default StockTransfer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.StockTransferField.propTypes;const displayName=components.StockTransferField.displayName;const StockTransferField=e=>{const{type:t}=e;const{stockTransfer:r}=useContext(StockTransferChildrenContext);const o=r?r[t]:"";const n=Object.assign({},e);return e.children?_jsx(Parent,Object.assign({},n,{children:e.children}),void 0):_jsx("p",Object.assign({},e,{children:o}),void 0)};StockTransferField.propTypes=propTypes;StockTransferField.displayName=displayName;export default StockTransferField;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.StockTransferField.propTypes,displayName=components.StockTransferField.displayName,StockTransferField=props=>{const{type}=props,{stockTransfer}=useContext(StockTransferChildrenContext),text=stockTransfer?stockTransfer[type]:"",parentProps=Object.assign({},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("p",Object.assign({},props,{children:text}),void 0)};StockTransferField.propTypes=propTypes,StockTransferField.displayName=displayName;export default StockTransferField;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import{CardElement,Elements,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{setCustomerOrderParam}from"../utils/localStorage";const defaultOptions={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode:true};const StripePaymentForm=({options:e=defaultOptions,templateCustomerSaveToWallet:t})=>{const o=useRef(null);const{setPaymentSource:s,paymentSource:n,currentPaymentMethodType:r,setPaymentMethodErrors:a,setPaymentRef:i}=useContext(PaymentMethodContext);const{order:l}=useContext(OrderContext);const c=useStripe();const u=useElements();useEffect((()=>{if(o.current&&c&&u){o.current.onsubmit=()=>d(o.current,c,u);i({ref:o})}return()=>{i({ref:{current:null}})}}),[o,c,u]);const d=async(e,t,o)=>{var i,c;if(!t)return false;const u=(c=(i=e===null||e===void 0?void 0:e.elements)===null||i===void 0?void 0:i["save_payment_source_to_customer_wallet"])===null||c===void 0?void 0:c.checked;if(u)setCustomerOrderParam("_save_payment_source_to_customer_wallet",u);const d=o&&o.getElement(CardElement);if(d){const e=l===null||l===void 0?void 0:l.billing_address;const o=l===null||l===void 0?void 0:l.customer_email;const i={name:e===null||e===void 0?void 0:e.full_name,email:o,phone:e===null||e===void 0?void 0:e.phone,address:{city:e===null||e===void 0?void 0:e.city,country:e===null||e===void 0?void 0:e.country_code,line1:e===null||e===void 0?void 0:e.line_1,postal_code:e===null||e===void 0?void 0:e.zip_code,state:e===null||e===void 0?void 0:e.state_code}};const{paymentMethod:c}=await t.createPaymentMethod({type:"card",card:d,billing_details:i});if(n===null||n===void 0?void 0:n.client_secret){const{error:e,paymentIntent:o}=await t.confirmCardPayment(n.client_secret,{payment_method:{card:d,billing_details:i}});if(e){console.error(e);a([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:r,message:e.message}])}else{if(o&&c&&n&&r){try{await s({paymentSourceId:n.id,paymentResource:r,attributes:{options:Object.assign(Object.assign({},c),{setup_future_usage:"off_session"})}});return true}catch(e){return false}}}}}return false};return _jsxs("form",Object.assign({ref:o,onSubmit:e=>d(e,c,u)},{children:[_jsx(CardElement,{options:Object.assign(Object.assign({},defaultOptions),e)},void 0),t&&_jsx(Parent,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:t}),void 0)]}),void 0)};const StripePayment=e=>{var{publishableKey:t,show:o,options:s,locale:n="auto"}=e,r=__rest(e,["publishableKey","show","options","locale"]);const[a,i]=useState(false);const[l,c]=useState(null);const{containerClassName:u,templateCustomerSaveToWallet:d,fonts:m=[]}=r,p=__rest(r,["containerClassName","templateCustomerSaveToWallet","fonts"]);useEffect((()=>{if(o&&t){const{loadStripe:e}=require("@stripe/stripe-js");const o=async()=>{const o=await e(t,{locale:n});c(o);i(true)};o()}return()=>{i(false)}}),[o,t]);return a&&l?_jsx("div",Object.assign({className:u},p,{children:_jsx(Elements,Object.assign({stripe:l,options:{fonts:m}},{children:_jsx(StripePaymentForm,{options:s,templateCustomerSaveToWallet:d},void 0)}),void 0)}),void 0):null};export default StripePayment;
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../context/PaymentMethodContext";import{CardElement,Elements,useElements,useStripe}from"@stripe/react-stripe-js";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{setCustomerOrderParam}from"../utils/localStorage";const defaultOptions={style:{base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}},hidePostalCode:!0},StripePaymentForm=({options=defaultOptions,templateCustomerSaveToWallet})=>{const ref=useRef(null),{setPaymentSource,paymentSource,currentPaymentMethodType,setPaymentMethodErrors,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),stripe=useStripe(),elements=useElements();useEffect(()=>(ref.current&&stripe&&elements&&(ref.current.onsubmit=()=>onSubmit(ref.current,stripe,elements),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,stripe,elements]);const onSubmit=async(event,stripe2,elements2)=>{var _a,_b;if(!stripe2)return!1;const savePaymentSourceToCustomerWallet=(_b=(_a=event==null?void 0:event.elements)===null||_a===void 0?void 0:_a.save_payment_source_to_customer_wallet)===null||_b===void 0?void 0:_b.checked;savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet);const cardElement=elements2&&elements2.getElement(CardElement);if(cardElement){const billingInfo=order==null?void 0:order.billing_address,email=order==null?void 0:order.customer_email,billing_details={name:billingInfo==null?void 0:billingInfo.full_name,email,phone:billingInfo==null?void 0:billingInfo.phone,address:{city:billingInfo==null?void 0:billingInfo.city,country:billingInfo==null?void 0:billingInfo.country_code,line1:billingInfo==null?void 0:billingInfo.line_1,postal_code:billingInfo==null?void 0:billingInfo.zip_code,state:billingInfo==null?void 0:billingInfo.state_code}},{paymentMethod}=await stripe2.createPaymentMethod({type:"card",card:cardElement,billing_details});if(paymentSource==null?void 0:paymentSource.client_secret){const{error,paymentIntent}=await stripe2.confirmCardPayment(paymentSource.client_secret,{payment_method:{card:cardElement,billing_details}});if(error)console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]);else if(paymentIntent&&paymentMethod&&paymentSource&&currentPaymentMethodType)try{return await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{options:Object.assign(Object.assign({},paymentMethod),{setup_future_usage:"off_session"})}}),!0}catch{return!1}}}return!1};return _jsxs("form",Object.assign({ref,onSubmit:e=>onSubmit(e,stripe,elements)},{children:[_jsx(CardElement,{options:Object.assign(Object.assign({},defaultOptions),options)},void 0),templateCustomerSaveToWallet&&_jsx(Parent,Object.assign({},{name:"save_payment_source_to_customer_wallet"},{children:templateCustomerSaveToWallet}),void 0)]}),void 0)},StripePayment=_a=>{var{publishableKey,show,options,locale="auto"}=_a,p=__rest(_a,["publishableKey","show","options","locale"]);const[isLoaded,setIsLoaded]=useState(!1),[stripe,setStripe]=useState(null),{containerClassName,templateCustomerSaveToWallet,fonts=[]}=p,divProps=__rest(p,["containerClassName","templateCustomerSaveToWallet","fonts"]);return useEffect(()=>{if(show&&publishableKey){const{loadStripe}=require("@stripe/stripe-js");(async()=>{const res=await loadStripe(publishableKey,{locale});setStripe(res),setIsLoaded(!0)})()}return()=>{setIsLoaded(!1)}},[show,publishableKey]),isLoaded&&stripe?_jsx("div",Object.assign({className:containerClassName},divProps,{children:_jsx(Elements,Object.assign({stripe,options:{fonts}},{children:_jsx(StripePaymentForm,{options,templateCustomerSaveToWallet},void 0)}),void 0)}),void 0):null};export default StripePayment;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.SubTotalAmount.propTypes;const defaultProps=components.SubTotalAmount.defaultProps;const displayName=components.SubTotalAmount.displayName;const SubTotalAmount=o=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"subtotal"},o),void 0);SubTotalAmount.propTypes=propTypes;SubTotalAmount.defaultProps=defaultProps;SubTotalAmount.displayName=displayName;export default SubTotalAmount;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.SubTotalAmount.propTypes,defaultProps=components.SubTotalAmount.defaultProps,displayName=components.SubTotalAmount.displayName,SubTotalAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"subtotal"},props),void 0);SubTotalAmount.propTypes=propTypes,SubTotalAmount.defaultProps=defaultProps,SubTotalAmount.displayName=displayName;export default SubTotalAmount;
@@ -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";import isFunction from"lodash/isFunction";const propTypes=components.SubmitButton.propTypes;const defaultProps=components.SubmitButton.defaultProps;const displayName=components.SubmitButton.displayName;const SubmitButton=t=>{const{children:o,label:s="Submit"}=t,n=__rest(t,["children","label"]);const e=Object.assign(Object.assign({},n),{label:s});return o?_jsx(Parent,Object.assign({},e,{children:o}),void 0):_jsx("button",Object.assign({type:"submit"},n,{children:isFunction(s)?s():s}),void 0)};SubmitButton.propTypes=propTypes;SubmitButton.defaultProps=defaultProps;SubmitButton.displayName=displayName;export default SubmitButton;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";import isFunction from"lodash/isFunction";const propTypes=components.SubmitButton.propTypes,defaultProps=components.SubmitButton.defaultProps,displayName=components.SubmitButton.displayName,SubmitButton=props=>{const{children,label="Submit"}=props,p=__rest(props,["children","label"]),parentProps=Object.assign(Object.assign({},p),{label});return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("button",Object.assign({type:"submit"},p,{children:isFunction(label)?label():label}),void 0)};SubmitButton.propTypes=propTypes,SubmitButton.defaultProps=defaultProps,SubmitButton.displayName=displayName;export default SubmitButton;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TaxesAmount.propTypes;const defaultProps=components.TaxesAmount.defaultProps;const displayName=components.TaxesAmount.displayName;const TaxesAmount=e=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"total_tax"},e),void 0);TaxesAmount.propTypes=propTypes;TaxesAmount.defaultProps=defaultProps;TaxesAmount.displayName=displayName;export default TaxesAmount;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TaxesAmount.propTypes,defaultProps=components.TaxesAmount.defaultProps,displayName=components.TaxesAmount.displayName,TaxesAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"total_tax"},props),void 0);TaxesAmount.propTypes=propTypes,TaxesAmount.defaultProps=defaultProps,TaxesAmount.displayName=displayName;export default TaxesAmount;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TotalAmount.propTypes;const defaultProps=components.TotalAmount.defaultProps;const displayName=components.TotalAmount.displayName;const TotalAmount=o=>_jsx(BaseOrderPrice,Object.assign({base:"total_amount",type:"with_taxes"},o),void 0);TotalAmount.propTypes=propTypes;TotalAmount.defaultProps=defaultProps;TotalAmount.displayName=displayName;export default TotalAmount;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.TotalAmount.propTypes,defaultProps=components.TotalAmount.defaultProps,displayName=components.TotalAmount.displayName,TotalAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"total_amount",type:"with_taxes"},props),void 0);TotalAmount.propTypes=propTypes,TotalAmount.defaultProps=defaultProps,TotalAmount.displayName=displayName;export default TotalAmount;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect}from"react";import VariantTemplate from"./utils/VariantTemplate";import Parent from"./utils/Parent";import VariantsContext from"../context/VariantsContext";import components from"../config/components";const propTypes=components.VariantSelector.propTypes;const defaultProps=components.VariantSelector.defaultProps;const displayName=components.VariantSelector.displayName;const VariantSelector=e=>{const{children:t,type:o,placeholder:a,skuCode:n,name:r,options:s}=e,i=__rest(e,["children","type","placeholder","skuCode","name","options"]);const{setSkuCode:p,skuCode:c,loading:l,variants:d,setSkuCodes:m}=useContext(VariantsContext);useEffect((()=>{m&&m(s);return()=>{m&&m([])}}),[s]);const u=c||n||"";const f=()=>l?_jsx(Fragment,{children:e.loader||"Loading..."},void 0):_jsx(VariantTemplate,Object.assign({variants:d,type:o,placeholder:a,skuCode:u,options:s,handleChange:p,name:r},i),void 0);const x=Object.assign({variants:d,loading:!!l,handleSelect:p,skuCode:u},e);return t?_jsx(Parent,Object.assign({},x,{children:t}),void 0):_jsx(Fragment,{children:_jsx(f,{},void 0)},void 0)};VariantSelector.propTypes=propTypes;VariantSelector.defaultProps=defaultProps;VariantSelector.displayName=displayName;export default VariantSelector;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect}from"react";import VariantTemplate from"./utils/VariantTemplate";import Parent from"./utils/Parent";import VariantsContext from"../context/VariantsContext";import components from"../config/components";const propTypes=components.VariantSelector.propTypes,defaultProps=components.VariantSelector.defaultProps,displayName=components.VariantSelector.displayName,VariantSelector=props=>{const{children,type,placeholder,skuCode,name,options}=props,prs=__rest(props,["children","type","placeholder","skuCode","name","options"]),{setSkuCode,skuCode:variantSkuCode,loading,variants,setSkuCodes}=useContext(VariantsContext);useEffect(()=>(setSkuCodes&&setSkuCodes(options),()=>{setSkuCodes&&setSkuCodes([])}),[options]);const sCode=variantSkuCode||skuCode||"",DefaultTemplate=()=>loading?_jsx(Fragment,{children:props.loader||"Loading..."},void 0):_jsx(VariantTemplate,Object.assign({variants,type,placeholder,skuCode:sCode,options,handleChange:setSkuCode,name},prs),void 0),parentProps=Object.assign({variants,loading:!!loading,handleSelect:setSkuCode,skuCode:sCode},props);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx(Fragment,{children:_jsx(DefaultTemplate,{},void 0)},void 0)};VariantSelector.propTypes=propTypes,VariantSelector.defaultProps=defaultProps,VariantSelector.displayName=displayName;export default VariantSelector;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import variantReducer,{variantInitialState,unsetVariantState,setSkuCode,getVariants}from"../reducers/VariantReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import VariantsContext from"../context/VariantsContext";import{setVariantSkuCodes}from"../reducers/VariantReducer";import{isEmpty,isEqual}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";const propTypes=components.VariantsContainer.propTypes;const defaultProps=components.VariantsContainer.defaultProps;const displayName=components.VariantsContainer.displayName;const VariantsContainer=t=>{const{children:e,skuCode:s="",filters:n={}}=t;const a=useContext(CommerceLayerContext);const{setItem:o,setItems:r,items:i,item:m,setCustomLineItems:c,skuCode:u}=useContext(ItemContext);const[p,d]=useReducer(variantReducer,variantInitialState);const C=getCurrentItemKey(m)||s||p.skuCode||u||"";useEffect((()=>{if(!isEmpty(i)&&!isEmpty(p.variants)){if(!isEqual(i,p.variants)){const t=Object.assign(Object.assign({},i),p.variants);r&&r(t)}}if(p.skuCodes.length>=1&&a.accessToken){d({type:"setLoading",payload:{loading:true}});getVariants({config:a,state:p,dispatch:d,setItem:o,skuCode:C,filters:n})}return()=>unsetVariantState(d)}),[a]);const f=Object.assign(Object.assign({},p),{skuCode:C,setSkuCode:(t,e,s={})=>{if(!isEmpty(s)){c&&c({[t]:s})}setSkuCode({code:t,id:e,config:a,setItem:o,dispatch:d})},setSkuCodes:t=>setVariantSkuCodes({skuCodes:t,dispatch:d,setCustomLineItems:c})});return _jsx(VariantsContext.Provider,Object.assign({value:f},{children:e}),void 0)};VariantsContainer.propTypes=propTypes;VariantsContainer.defaultProps=defaultProps;VariantsContainer.displayName=displayName;export default VariantsContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import variantReducer,{variantInitialState,unsetVariantState,setSkuCode,getVariants}from"../reducers/VariantReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import VariantsContext from"../context/VariantsContext";import{setVariantSkuCodes}from"../reducers/VariantReducer";import{isEmpty,isEqual}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";const propTypes=components.VariantsContainer.propTypes,defaultProps=components.VariantsContainer.defaultProps,displayName=components.VariantsContainer.displayName,VariantsContainer=props=>{const{children,skuCode="",filters={}}=props,config=useContext(CommerceLayerContext),{setItem,setItems,items,item:currentItem,setCustomLineItems,skuCode:itemSkuCode}=useContext(ItemContext),[state,dispatch]=useReducer(variantReducer,variantInitialState),sCode=getCurrentItemKey(currentItem)||skuCode||state.skuCode||itemSkuCode||"";useEffect(()=>{if(!isEmpty(items)&&!isEmpty(state.variants)&&!isEqual(items,state.variants)){const mergeItems=Object.assign(Object.assign({},items),state.variants);setItems&&setItems(mergeItems)}return state.skuCodes.length>=1&&config.accessToken&&(dispatch({type:"setLoading",payload:{loading:!0}}),getVariants({config,state,dispatch,setItem,skuCode:sCode,filters})),()=>unsetVariantState(dispatch)},[config]);const variantValue=Object.assign(Object.assign({},state),{skuCode:sCode,setSkuCode:(code,id,lineItem={})=>{isEmpty(lineItem)||setCustomLineItems&&setCustomLineItems({[code]:lineItem}),setSkuCode({code,id,config,setItem,dispatch})},setSkuCodes:skuCodes=>setVariantSkuCodes({skuCodes,dispatch,setCustomLineItems})});return _jsx(VariantsContext.Provider,Object.assign({value:variantValue},{children}),void 0)};VariantsContainer.propTypes=propTypes,VariantsContainer.defaultProps=defaultProps,VariantsContainer.displayName=displayName;export default VariantsContainer;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext from"../context/PaymentMethodContext";import isFunction from"lodash/isFunction";import{useContext,useEffect,useRef}from"react";const defaultMessage="after placing the order, you will need to manually complete the payment with your bank";const WireTransferPayment=e=>{var{infoMessage:t}=e,n=__rest(e,["infoMessage"]);const r=useRef(null);const{setPaymentSource:s,paymentSource:o,currentPaymentMethodType:a,setPaymentRef:i}=useContext(PaymentMethodContext);useEffect((()=>{if(r.current&&o&&a){r.current.onsubmit=()=>u();i({ref:r})}return()=>{i({ref:{current:null}})}}),[r,o,a]);const u=async()=>{if(o&&a){try{await s({paymentSourceId:o.id,paymentResource:a,attributes:{metadata:{card:{id:o.id,brand:"wire-transfer",last4:""}}}});return true}catch(e){return false}}return false};return _jsx("form",Object.assign({ref:r},{children:_jsx("div",Object.assign({},n,{children:_jsx("span",Object.assign({className:t===null||t===void 0?void 0:t.className},{children:isFunction(t===null||t===void 0?void 0:t.text)?t===null||t===void 0?void 0:t.text():(t===null||t===void 0?void 0:t.text)||defaultMessage}),void 0)}),void 0)}),void 0)};export default WireTransferPayment;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext from"../context/PaymentMethodContext";import isFunction from"lodash/isFunction";import{useContext,useEffect,useRef}from"react";const defaultMessage="after placing the order, you will need to manually complete the payment with your bank",WireTransferPayment=_a=>{var{infoMessage}=_a,p=__rest(_a,["infoMessage"]);const ref=useRef(null),{setPaymentSource,paymentSource,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext);useEffect(()=>(ref.current&&paymentSource&&currentPaymentMethodType&&(ref.current.onsubmit=()=>handleClick(),setPaymentRef({ref})),()=>{setPaymentRef({ref:{current:null}})}),[ref,paymentSource,currentPaymentMethodType]);const handleClick=async()=>{if(paymentSource&&currentPaymentMethodType)try{return await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:currentPaymentMethodType,attributes:{metadata:{card:{id:paymentSource.id,brand:"wire-transfer",last4:""}}}}),!0}catch{return!1}return!1};return _jsx("form",Object.assign({ref},{children:_jsx("div",Object.assign({},p,{children:_jsx("span",Object.assign({className:infoMessage==null?void 0:infoMessage.className},{children:isFunction(infoMessage==null?void 0:infoMessage.text)?infoMessage==null?void 0:infoMessage.text():(infoMessage==null?void 0:infoMessage.text)||defaultMessage}),void 0)}),void 0)}),void 0)};export default WireTransferPayment;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import AdyenPayment from"../AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import jwt from"../../utils/jwt";export default function AdyenGateway(e){var t;const{readonly:o,showCard:n,handleEditClick:r,children:m,templateCustomerCards:a,show:s,loading:i,onClickCustomerCards:d,loaderComponent:l,templateCustomerSaveToWallet:c}=e,C=__rest(e,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]);const{order:y}=useContext(OrderContext);const{accessToken:u}=useContext(CommerceLayerContext);const{payment:p}=useContext(PaymentMethodChildrenContext);const{payments:x,isGuest:v}=useContext(CustomerContext);const{currentPaymentMethodId:h,config:f,paymentSource:P}=useContext(PaymentMethodContext);const _="adyen_payments";const j=y===null||y===void 0?void 0:y.language_code;if(!o&&(p===null||p===void 0?void 0:p.id)!==h)return null;const g=P===null||P===void 0?void 0:P.public_key;const w=jwt(u).test?"test":"live";const E=f?getPaymentConfig(_,f):{};const M=!isEmpty(x)&&x?x.filter((e=>{var t;return((t=e.payment_source)===null||t===void 0?void 0:t.type)==="adyen_payments"})):[];if(o||n){const e=(t=P===null||P===void 0?void 0:P.payment_request_data)===null||t===void 0?void 0:t.payment_method;const a=Object.assign(Object.assign({},e),{showCard:n,handleEditClick:r,readonly:o});return isEmpty(e)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value:a},{children:m}),void 0)}if(!v&&a){return g&&!i&&(P===null||P===void 0?void 0:P.payment_methods)?_jsxs(Fragment,{children:[isEmpty(M)?null:_jsx("div",Object.assign({className:C.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource:_,customerPayments:M},{children:a}),void 0)}),void 0),_jsx(AdyenPayment,{templateCustomerSaveToWallet:c,clientKey:g,locale:j,environment:w,config:E},void 0)]},void 0):l}return g&&!i&&(P===null||P===void 0?void 0:P.payment_methods)?_jsx(AdyenPayment,{clientKey:g,locale:j,config:E},void 0):l}
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import AdyenPayment from"../AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import jwt from"../../utils/jwt";export default function AdyenGateway(props){var _a;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{order}=useContext(OrderContext),{accessToken}=useContext(CommerceLayerContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="adyen_payments",locale=order==null?void 0:order.language_code;if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;const clientKey=paymentSource==null?void 0:paymentSource.public_key,environment=jwt(accessToken).test?"test":"live",adyenConfig=config?getPaymentConfig(paymentResource,config):{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>{var _a2;return((_a2=customerPayment.payment_source)===null||_a2===void 0?void 0:_a2.type)==="adyen_payments"}):[];if(readonly||showCard){const card=(_a=paymentSource==null?void 0:paymentSource.payment_request_data)===null||_a===void 0?void 0:_a.payment_method,value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}return!isGuest&&templateCustomerCards?clientKey&&!loading&&(paymentSource==null?void 0:paymentSource.payment_methods)?_jsxs(Fragment,{children:[isEmpty(customerPayments)?null:_jsx("div",Object.assign({className:p.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource,customerPayments},{children:templateCustomerCards}),void 0)}),void 0),_jsx(AdyenPayment,{templateCustomerSaveToWallet,clientKey,locale,environment,config:adyenConfig},void 0)]},void 0):loaderComponent:clientKey&&!loading&&(paymentSource==null?void 0:paymentSource.payment_methods)?_jsx(AdyenPayment,{clientKey,locale,config:adyenConfig},void 0):loaderComponent}
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import BraintreePayment from"../BraintreePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function BraintreeGateway(t){var e;const{readonly:o,showCard:n,handleEditClick:r,children:a,templateCustomerCards:s,show:i,loading:m,onClickCustomerCards:d,loaderComponent:l,templateCustomerSaveToWallet:c}=t,C=__rest(t,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]);const{order:u}=useContext(OrderContext);const{payment:y}=useContext(PaymentMethodChildrenContext);const{payments:p,isGuest:x}=useContext(CustomerContext);const{currentPaymentMethodId:h,config:v,paymentSource:f}=useContext(PaymentMethodContext);const P="braintree_payments";const g=u===null||u===void 0?void 0:u.language_code;if(!o&&(y===null||y===void 0?void 0:y.id)!==h)return null;const _=f===null||f===void 0?void 0:f.client_token;const j=v?getPaymentConfig(P,v):{};const b=!isEmpty(p)&&p?p.filter((t=>{var e;return((e=t.payment_source)===null||e===void 0?void 0:e.type)==="braintree_payments"})):[];if(o||n){const t=(e=f===null||f===void 0?void 0:f.options)===null||e===void 0?void 0:e.card;const s=Object.assign(Object.assign({},t),{showCard:n,handleEditClick:r,readonly:o});return isEmpty(t)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value:s},{children:a}),void 0)}if(!x&&s){return _&&!m?_jsxs(Fragment,{children:[isEmpty(b)?null:_jsx("div",Object.assign({className:C.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource:P,customerPayments:b},{children:s}),void 0)}),void 0),_jsx(BraintreePayment,{templateCustomerSaveToWallet:c,authorization:_,locale:g,config:j},void 0)]},void 0):l}return _&&!m?_jsx(BraintreePayment,{locale:g,authorization:_,config:j},void 0):l}
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import BraintreePayment from"../BraintreePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function BraintreeGateway(props){var _a;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{order}=useContext(OrderContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="braintree_payments",locale=order==null?void 0:order.language_code;if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;const authorization=paymentSource==null?void 0:paymentSource.client_token,braintreeConfig=config?getPaymentConfig(paymentResource,config):{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>{var _a2;return((_a2=customerPayment.payment_source)===null||_a2===void 0?void 0:_a2.type)==="braintree_payments"}):[];if(readonly||showCard){const card=(_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card,value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}return!isGuest&&templateCustomerCards?authorization&&!loading?_jsxs(Fragment,{children:[isEmpty(customerPayments)?null:_jsx("div",Object.assign({className:p.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource,customerPayments},{children:templateCustomerCards}),void 0)}),void 0),_jsx(BraintreePayment,{templateCustomerSaveToWallet,authorization,locale,config:braintreeConfig},void 0)]},void 0):loaderComponent:authorization&&!loading?_jsx(BraintreePayment,{locale,authorization,config:braintreeConfig},void 0):loaderComponent}
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaypalPayment from"../PaypalPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function PaypalGateway(t){var e,o;const{readonly:n,showCard:a,handleEditClick:r,children:i,templateCustomerCards:d,show:l,loading:m,onClickCustomerCards:s,loaderComponent:C,templateCustomerSaveToWallet:c}=t,u=__rest(t,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]);const{payment:y}=useContext(PaymentMethodChildrenContext);const{currentPaymentMethodId:p,config:h,paymentSource:x}=useContext(PaymentMethodContext);const P="paypal_payments";if(!n&&(y===null||y===void 0?void 0:y.id)!==p)return null;if(n||a){const t=((e=x===null||x===void 0?void 0:x.options)===null||e===void 0?void 0:e.card)||((o=x===null||x===void 0?void 0:x.metadata)===null||o===void 0?void 0:o.card);const d=Object.assign(Object.assign({},t),{showCard:a,handleEditClick:r,readonly:n});return isEmpty(t)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value:d},{children:i}),void 0)}const v=h&&getPaymentConfig(P,h);return _jsx(PaypalPayment,Object.assign({},u,{infoMessage:v===null||v===void 0?void 0:v.infoMessage}),void 0)}
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import PaypalPayment from"../PaypalPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function PaypalGateway(props){var _a,_b;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{payment}=useContext(PaymentMethodChildrenContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="paypal_payments";if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;if(readonly||showCard){const card=((_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card)||((_b=paymentSource==null?void 0:paymentSource.metadata)===null||_b===void 0?void 0:_b.card),value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}const paypalConfig=config&&getPaymentConfig(paymentResource,config);return _jsx(PaypalPayment,Object.assign({},p,{infoMessage:paypalConfig==null?void 0:paypalConfig.infoMessage}),void 0)}
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import StripePayment from"../StripePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function StripeGateway(t){var e;const{readonly:o,showCard:n,handleEditClick:r,children:s,templateCustomerCards:a,show:i,loading:m,onClickCustomerCards:l,loaderComponent:d,templateCustomerSaveToWallet:c}=t,C=__rest(t,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]);const{order:u}=useContext(OrderContext);const{payment:p}=useContext(PaymentMethodChildrenContext);const{payments:y,isGuest:x}=useContext(CustomerContext);const{currentPaymentMethodId:h,config:v,paymentSource:P}=useContext(PaymentMethodContext);const f="stripe_payments";const g=u===null||u===void 0?void 0:u.language_code;if(!o&&(p===null||p===void 0?void 0:p.id)!==h)return null;const j=P===null||P===void 0?void 0:P.publishable_key;const _=v?getPaymentConfig(f,v):{};const b=!isEmpty(y)&&y?y.filter((t=>{var e;return((e=t.payment_source)===null||e===void 0?void 0:e.type)==="stripe_payments"})):[];if(o||n){const t=(e=P===null||P===void 0?void 0:P.options)===null||e===void 0?void 0:e.card;const a=Object.assign(Object.assign({},t),{showCard:n,handleEditClick:r,readonly:o});return isEmpty(t)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value:a},{children:s}),void 0)}if(!x&&a){return _jsxs(Fragment,{children:[isEmpty(b)?null:_jsx("div",Object.assign({className:C.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource:f,customerPayments:b},{children:a}),void 0)}),void 0),_jsx(StripePayment,Object.assign({show:i,templateCustomerSaveToWallet:c,publishableKey:j,locale:g},_),void 0)]},void 0)}return j&&!m?_jsx(StripePayment,Object.assign({show:i,publishableKey:j,locale:g},_),void 0):d}
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import StripePayment from"../StripePayment";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{Fragment,useContext}from"react";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";export default function StripeGateway(props){var _a;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{order}=useContext(OrderContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="stripe_payments",locale=order==null?void 0:order.language_code;if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;const publishableKey=paymentSource==null?void 0:paymentSource.publishable_key,stripeConfig=config?getPaymentConfig(paymentResource,config):{},customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>{var _a2;return((_a2=customerPayment.payment_source)===null||_a2===void 0?void 0:_a2.type)==="stripe_payments"}):[];if(readonly||showCard){const card=(_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card,value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}return!isGuest&&templateCustomerCards?_jsxs(Fragment,{children:[isEmpty(customerPayments)?null:_jsx("div",Object.assign({className:p.className},{children:_jsx(PaymentCardsTemplate,Object.assign({},{paymentResource,customerPayments},{children:templateCustomerCards}),void 0)}),void 0),_jsx(StripePayment,Object.assign({show,templateCustomerSaveToWallet,publishableKey,locale},stripeConfig),void 0)]},void 0):publishableKey&&!loading?_jsx(StripePayment,Object.assign({show,publishableKey,locale},stripeConfig),void 0):loaderComponent}
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import WireTransferPayment from"../WireTransferPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function WireTransferGateway(t){var e,o;const{readonly:n,showCard:r,handleEditClick:a,children:i,templateCustomerCards:d,show:s,loading:m,onClickCustomerCards:l,loaderComponent:C,templateCustomerSaveToWallet:c}=t,u=__rest(t,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]);const{payment:y}=useContext(PaymentMethodChildrenContext);const{currentPaymentMethodId:h,config:p,paymentSource:f}=useContext(PaymentMethodContext);const x="wire_transfers";if(!n&&(y===null||y===void 0?void 0:y.id)!==h)return null;if(n||r){const t=((e=f===null||f===void 0?void 0:f.options)===null||e===void 0?void 0:e.card)||((o=f===null||f===void 0?void 0:f.metadata)===null||o===void 0?void 0:o.card);const d=Object.assign(Object.assign({},t),{showCard:r,handleEditClick:a,readonly:n});return isEmpty(t)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value:d},{children:i}),void 0)}const v=p&&x?getPaymentConfig(x,p):{};return _jsx(WireTransferPayment,Object.assign({},u,v),void 0)}
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import WireTransferPayment from"../WireTransferPayment";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export default function WireTransferGateway(props){var _a,_b;const{readonly,showCard,handleEditClick,children,templateCustomerCards,show,loading,onClickCustomerCards,loaderComponent,templateCustomerSaveToWallet}=props,p=__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","show","loading","onClickCustomerCards","loaderComponent","templateCustomerSaveToWallet"]),{payment}=useContext(PaymentMethodChildrenContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="wire_transfers";if(!readonly&&(payment==null?void 0:payment.id)!==currentPaymentMethodId)return null;if(readonly||showCard){const card=((_a=paymentSource==null?void 0:paymentSource.options)===null||_a===void 0?void 0:_a.card)||((_b=paymentSource==null?void 0:paymentSource.metadata)===null||_b===void 0?void 0:_b.card),value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,Object.assign({value},{children}),void 0)}const wireTransferConfig=config&&paymentResource?getPaymentConfig(paymentResource,config):{};return _jsx(WireTransferPayment,Object.assign({},p,wireTransferConfig),void 0)}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses:e,children:s,deselect:t,countryLock:r,selected:n,selectedClassName:o,className:d,disabledClassName:c,handleSelect:i}){const{setShippingAddress:a}=useContext(ShippingAddressContext);const l=e.map(((e,s)=>{const l=e;const m=a&&r&&r!==e.country_code||false;const p=t?"":o;const x=n===s?`${d} ${p}`:d;const C=m?`${d} ${c}`:x;const u=(e===null||e===void 0?void 0:e.reference)||"";const A=()=>i(s,e.id,u,m);return Object.assign(Object.assign({},l),{className:C,onClick:A})}));const m={customerAddresses:l,AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,Object.assign({},m,{children:s}),void 0)}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className} ${deselect?"":selectedClassName}`:className,finalClassName=disabled?`${className} ${disabledClassName}`:addressSelectedClass,customerAddressId=(address==null?void 0:address.reference)||"",onClick=()=>handleSelect(k,address.id,customerAddressId,disabled);return Object.assign(Object.assign({},attributes),{className:finalClassName,onClick})}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,Object.assign({},value,{children}),void 0)}
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import{useContext,useEffect,useState}from"react";import Parent from"./Parent";const BaseField=t=>{var{children:e,attribute:r}=t,s=__rest(t,["children","attribute"]);const{order:n}=useContext(OrderContext);const[o,i]=useState("");useEffect((()=>{if(n&&r in n)i(n[r]);return()=>{i("")}}),[n]);const a=Object.assign({attribute:o},s);return e?_jsx(Parent,Object.assign({},a,{children:e}),void 0):_jsx("span",Object.assign({},s,{children:o}),void 0)};export default BaseField;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import{useContext,useEffect,useState}from"react";import Parent from"./Parent";const BaseField=_a=>{var{children,attribute}=_a,p=__rest(_a,["children","attribute"]);const{order}=useContext(OrderContext),[field,setField]=useState("");useEffect(()=>(order&&attribute in order&&setField(order[attribute]),()=>{setField("")}),[order]);const parentProps=Object.assign({attribute:field},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("span",Object.assign({},p,{children:field}),void 0)};export default BaseField;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";const BaseInput=(t,e)=>{const{children:r}=t,s=__rest(t,["children"]);const a=t.type==="textarea"?_jsx("textarea",Object.assign({ref:e},s),void 0):_jsx("input",Object.assign({ref:e},s),void 0);return r?_jsx(Parent,Object.assign({},s,{children:r}),void 0):a};export default React.forwardRef(BaseInput);
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";const BaseInput=(props,ref)=>{const{children}=props,p=__rest(props,["children"]),input=props.type==="textarea"?_jsx("textarea",Object.assign({ref},p),void 0):_jsx("input",Object.assign({ref},p),void 0);return children?_jsx(Parent,Object.assign({},p,{children}),void 0):input};export default React.forwardRef(BaseInput);
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import getAmount from"../../utils/getAmount";import Parent from"./Parent";import{useState,useEffect,useContext}from"react";import{baseOrderPricePropTypes}from"../../typings/index";import{isEmpty}from"lodash";const BaseOrderPrice=e=>{const{format:t="formatted",base:r,type:s,children:o}=e,n=__rest(e,["format","base","type","children"]);const{order:i}=useContext(OrderContext);const[a,c]=useState("");const[m,p]=useState(0);useEffect((()=>{const e=getAmount({base:r,type:s,format:t,obj:i||{}});const o=getAmount({base:r,type:s,format:"cents",obj:i||{}});c(e);p(o);return()=>{if(isEmpty(i)){c("")}}}),[i]);const d=Object.assign({priceCents:m,price:a},n);return o?_jsx(Parent,Object.assign({},d,{children:o}),void 0):_jsx("span",Object.assign({},n,{children:a}),void 0)};BaseOrderPrice.propTypes=baseOrderPricePropTypes;export default BaseOrderPrice;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import getAmount from"../../utils/getAmount";import Parent from"./Parent";import{useState,useEffect,useContext}from"react";import{baseOrderPricePropTypes}from"../../typings/index";import{isEmpty}from"lodash";const BaseOrderPrice=props=>{const{format="formatted",base,type,children}=props,p=__rest(props,["format","base","type","children"]),{order}=useContext(OrderContext),[price,setPrice]=useState(""),[cents,setCents]=useState(0);useEffect(()=>{const p2=getAmount({base,type,format,obj:order||{}}),c=getAmount({base,type,format:"cents",obj:order||{}});return setPrice(p2),setCents(c),()=>{isEmpty(order)&&setPrice("")}},[order]);const parentProps=Object.assign({priceCents:cents,price},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("span",Object.assign({},p,{children:price}),void 0)};BaseOrderPrice.propTypes=baseOrderPricePropTypes;export default BaseOrderPrice;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";import{findIndex}from"lodash";const BaseSelect=(e,t)=>{const{options:r=[],children:s,placeholder:o={label:"Select an option",value:""},value:n=""}=e,a=__rest(e,["options","children","placeholder","value"]);if(findIndex(r,o)===-1){r.unshift(o)}else{r[0]=o}const l=r.map(((e,t)=>{const{label:r}=e,s=__rest(e,["label"]);return _jsx("option",Object.assign({},s,{children:r}),t)}));const i=Object.assign({options:r,ref:t},a);return s?_jsx(Parent,Object.assign({},i,{children:s}),void 0):_jsx("select",Object.assign({ref:t,defaultValue:n},a,{children:l}),void 0)};export default React.forwardRef(BaseSelect);
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";import{findIndex}from"lodash";const BaseSelect=(props,ref)=>{const{options=[],children,placeholder={label:"Select an option",value:""},value=""}=props,p=__rest(props,["options","children","placeholder","value"]);findIndex(options,placeholder)===-1?options.unshift(placeholder):options[0]=placeholder;const Options=options.map((o,k)=>{const{label}=o,option=__rest(o,["label"]);return _jsx("option",Object.assign({},option,{children:label}),k)}),parentProps=Object.assign({options,ref},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("select",Object.assign({ref,defaultValue:value},p,{children:Options}),void 0)};export default React.forwardRef(BaseSelect);
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import PropTypes from"prop-types";const PProps={children:PropTypes.func};const Parent=r=>{const s=r.children;return s?_jsx(s,Object.assign({},r),void 0):null};Parent.propTypes=PProps;export default Parent;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import PropTypes from"prop-types";const PProps={children:PropTypes.func},Parent=props=>{const Child=props.children;return Child?_jsx(Child,Object.assign({},props),void 0):null};Parent.propTypes=PProps;export default Parent;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";export default function PaymentCardsTemplate({customerPayments:t,children:e,paymentResource:o}){const{setPaymentSource:n}=useContext(PaymentMethodContext);const r=t.map((t=>{var e,r,a,i,m;const s=t;const c=((e=t===null||t===void 0?void 0:t.payment_source.options)===null||e===void 0?void 0:e.card)||((a=(r=t===null||t===void 0?void 0:t.payment_source)===null||r===void 0?void 0:r.payment_request_data)===null||a===void 0?void 0:a.paymentMethod)||((m=(i=t===null||t===void 0?void 0:t.payment_source)===null||i===void 0?void 0:i.metadata)===null||m===void 0?void 0:m.card);const d=async e=>{e.stopPropagation();await n({paymentResource:o,customerPaymentSourceId:t.id})};return Object.assign(Object.assign({},s),{card:c,handleClick:d})}));const a={customerPayments:r,PaymentSourceProvider:PaymentSourceContext.Provider};return _jsx(Parent,Object.assign({},a,{children:e}),void 0)}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";export default function PaymentCardsTemplate({customerPayments,children,paymentResource}){const{setPaymentSource}=useContext(PaymentMethodContext),value={customerPayments:customerPayments.map(customerPayment=>{var _a,_b,_c,_d,_e,_f,_g;const attributes=customerPayment,card=((_a=customerPayment==null?void 0:customerPayment.payment_source.options)===null||_a===void 0?void 0:_a.card)||((_c=(_b=customerPayment==null?void 0:customerPayment.payment_source)===null||_b===void 0?void 0:_b.payment_request_data)===null||_c===void 0?void 0:_c.paymentMethod)||((_e=(_d=customerPayment==null?void 0:customerPayment.payment_source)===null||_d===void 0?void 0:_d.payment_method)===null||_e===void 0?void 0:_e.card)||((_g=(_f=customerPayment==null?void 0:customerPayment.payment_source)===null||_f===void 0?void 0:_f.metadata)===null||_g===void 0?void 0:_g.card),handleClick=async e=>{e.stopPropagation(),await setPaymentSource({paymentResource,customerPaymentSourceId:customerPayment.id})};return Object.assign(Object.assign({},attributes),{card,handleClick})}),PaymentSourceProvider:PaymentSourceContext.Provider};return _jsx(Parent,Object.assign({},value,{children}),void 0)}
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import PropTypes from"prop-types";const propTypes={formattedAmount:PropTypes.string,formattedCompare:PropTypes.string};const defaultProps={formattedAmount:"",formattedCompare:""};const PriceTemplate=e=>{const{showCompare:s,formattedCompare:r,compareClassName:t,className:o,formattedAmount:a,skuCode:m}=e,p=__rest(e,["showCompare","formattedCompare","compareClassName","className","formattedAmount","skuCode"]);return _jsxs(Fragment,{children:[_jsx("span",Object.assign({className:o},p,{children:a}),void 0),s&&_jsx("span",Object.assign({className:t||""},p,{children:r}),void 0)]},void 0)};PriceTemplate.propTypes=propTypes;PriceTemplate.defaultProps=defaultProps;export default PriceTemplate;
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import PropTypes from"prop-types";const propTypes={formattedAmount:PropTypes.string,formattedCompare:PropTypes.string},defaultProps={formattedAmount:"",formattedCompare:""},PriceTemplate=props=>{const{showCompare,formattedCompare,compareClassName,className,formattedAmount,skuCode}=props,p=__rest(props,["showCompare","formattedCompare","compareClassName","className","formattedAmount","skuCode"]);return _jsxs(Fragment,{children:[_jsx("span",Object.assign({className},p,{children:formattedAmount}),void 0),showCompare&&_jsx("span",Object.assign({className:compareClassName||""},p,{children:formattedCompare}),void 0)]},void 0)};PriceTemplate.propTypes=propTypes,PriceTemplate.defaultProps=defaultProps;export default PriceTemplate;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import{keys}from"lodash";import PropTypes from"prop-types";export const propTypes={variants:PropTypes.any.isRequired,onChange:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string};const VariantTemplate=e=>{const{id:s,variants:t,type:r,placeholder:a,options:o,skuCode:n,handleChange:p,handleCallback:i}=e,l=__rest(e,["id","variants","type","placeholder","options","skuCode","handleChange","handleCallback"]);const d=keys(t).map(((e,a)=>{const d=n===e;const c=o.length>0?o[a].label:t[e].name;return r==="select"?_jsx("option",Object.assign({"data-sku-id":t[e].id,"data-label":c,value:t[e].code},{children:c}),t[e].id):_jsxs(Fragment,{children:[_jsx("input",Object.assign({id:s&&`${s}-${a}`,defaultChecked:d,type:"radio",value:t[e].code,onChange:s=>{const r=s.target.value;p&&p(r,t[e].id);i&&i({code:r,label:c})}},l),void 0),c]},t[e].id)}));if(r==="select"){return _jsxs("select",Object.assign({id:s,title:"Variant selector",onChange:e=>{const s=e.target.value;const t=e.target.selectedIndex;const r=e.target[t].dataset.skuId;const a=e.target[t].dataset.label;p&&p(s,r);i&&i({code:s,label:a})},value:n||""},l,{children:[_jsx("option",Object.assign({disabled:!!n},{children:a}),void 0),d]}),void 0)}return _jsx(Fragment,{children:d},void 0)};VariantTemplate.propTypes=propTypes;export default VariantTemplate;
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import{keys}from"lodash";import PropTypes from"prop-types";export const propTypes={variants:PropTypes.any.isRequired,onChange:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string};const VariantTemplate=props=>{const{id,variants,type,placeholder,options,skuCode,handleChange,handleCallback}=props,prs=__rest(props,["id","variants","type","placeholder","options","skuCode","handleChange","handleCallback"]),vars=keys(variants).map((v,k)=>{const checked=skuCode===v,label=options.length>0?options[k].label:variants[v].name;return type==="select"?_jsx("option",Object.assign({"data-sku-id":variants[v].id,"data-label":label,value:variants[v].code},{children:label}),variants[v].id):_jsxs(Fragment,{children:[_jsx("input",Object.assign({id:id&&`${id}-${k}`,defaultChecked:checked,type:"radio",value:variants[v].code,onChange:e=>{const code=e.target.value;handleChange&&handleChange(code,variants[v].id),handleCallback&&handleCallback({code,label})}},prs),void 0),label]},variants[v].id)});return type==="select"?_jsxs("select",Object.assign({id,title:"Variant selector",onChange:e=>{const v=e.target.value,i=e.target.selectedIndex,id2=e.target[i].dataset.skuId,label=e.target[i].dataset.label;handleChange&&handleChange(v,id2),handleCallback&&handleCallback({code:v,label})},value:skuCode||""},prs,{children:[_jsx("option",Object.assign({disabled:!!skuCode},{children:placeholder}),void 0),vars]}),void 0):_jsx(Fragment,{children:vars},void 0)};VariantTemplate.propTypes=propTypes;export default VariantTemplate;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import customMessages from"../../utils/customMessages";const getAllErrors=s=>{const{allErrors:e,messages:r,field:t,props:i,lineItem:n,resource:o,returnHtml:l=true}=s;return e.map(((s,e)=>{const a=customMessages(r,s);const c=(a===null||a===void 0?void 0:a.message)||s.message||`${s.title} - ${s.detail}`;if(t){if(s.resource==="line_items"){if(n&&s.id===n["id"]){return l?_jsx("span",Object.assign({},i,{children:c}),e):c}}if(t===s.field&&o===s.resource){return l?_jsx("span",Object.assign({},i,{children:c}),e):c}}if(o===s.resource&&!t){return l?_jsx("span",Object.assign({},i,{children:c}),e):c}}))};export default getAllErrors;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import customMessages from"../../utils/customMessages";const getAllErrors=params=>{const{allErrors,messages,field,props,lineItem,resource,returnHtml=!0}=params;return allErrors.map((v,k)=>{const objMsg=customMessages(messages,v),text=(objMsg==null?void 0:objMsg.message)||v.message||`${v.title} - ${v.detail}`;if(field){if(v.resource==="line_items"&&lineItem&&v.id===lineItem.id)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text;if(field===v.field&&resource===v.resource)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text}if(resource===v.resource&&!field)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text})};export default getAllErrors;
@@ -1 +1 @@
1
- import PropTypes from"prop-types";import childrenTypes from"../utils/childrenTypes";import{baseOrderComponentPricePropTypes,PTLoader,BMObject}from"../typings/index";import{ErrorPropTypes}from"../typings/errors";import{BaseInputComponentPropTypes}from"../typings/index";const components={Address:{permittedChildren:["AddressField","ReactNode"],displayName:"Address",propTypes:{children:childrenTypes.isRequired}},AddressCountrySelector:{displayName:"AddressCountrySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_country_code","shipping_address_country_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:true}},AddressStateSelector:{displayName:"AddressStateSelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_state_code","shipping_address_state_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:true}},AddressField:{displayName:"AddressField",propTypes:{children:PropTypes.func}},AddressInput:{displayName:"AddressInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["billing_address_city","billing_address_company","billing_address_email","billing_address_first_name","billing_address_last_name","billing_address_line_1","billing_address_line_2","billing_address_phone","billing_address_state_code","billing_address_zip_code","billing_address_billing_info","billing_address_save_to_customer_book","shipping_address_city","shipping_address_company","shipping_address_email","shipping_address_first_name","shipping_address_last_name","shipping_address_line_1","shipping_address_line_2","shipping_address_phone","shipping_address_state_code","shipping_address_zip_code","shipping_address_save_to_customer_book"]).isRequired,type:PropTypes.oneOf(["checkbox","date","email","number","tel","text","textarea"]).isRequired,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool},defaultProps:{required:true}},AddToCartButton:{displayName:"AddToCartButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),skuCode:PropTypes.string,disabled:PropTypes.bool,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})},defaultProps:{label:"Add to cart"}},AddressesContainer:{displayName:"AddressesContainer",permittedChildren:["BillingAddressForm","BillingAddressContainer","ShippingAddressForm","ShippingAddressContainer","SaveAddressesButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,shipToDifferentAddress:PropTypes.bool}},AvailabilityContainer:{displayName:"AvailabilityContainer",permittedChildren:["AvailabilityTemplate","ReactNode"],propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},AvailabilityTemplate:{displayName:"AvailabilityTemplate",propTypes:{timeFormat:PropTypes.oneOf(["days","hours"]),showShippingMethodName:PropTypes.bool,children:PropTypes.func},defaultProps:{timeFormat:"days",showShippingMethodName:false}},BillingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},BillingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},CheckoutLink:{displayName:"CheckoutLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Checkout"}},CommerceLayer:{permittedChildren:["OrderContainer","OrderStorage","PricesContainer","GiftCardContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,accessToken:PropTypes.string.isRequired,endpoint:PropTypes.string.isRequired}},CustomerContainer:{displayName:"CustomerContainer",permittedChildren:["CustomerInput","SaveCustomerButton","AddressesContainer","PaymentMethodsContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,isGuest:PropTypes.bool}},CustomerInput:{displayName:"CustomerInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["customerEmail"]),type:PropTypes.oneOf(["email"]),placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool,saveOnBlur:PropTypes.bool},defaultProps:{required:true}},DeliveryLeadTime:{displayName:"DeliveryLeadTime",propTypes:{type:PropTypes.oneOf(["max_days","max_hours","min_days","min_hours"]).isRequired,children:PropTypes.func}},DiscountAmount:{displayName:"DiscountAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},Errors:{displayName:"Errors",propTypes:ErrorPropTypes,defaultProps:{messages:[],field:"base"}},ExternalFunction:{displayName:"ExternalFunction",permittedChildren:["AddToCartButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,url:PropTypes.string.isRequired}},GiftCard:{permittedChildren:["GiftCardCurrencySelector","GiftCardInput","Errors","MetadataInput","SubmitButton","ReactNode"],displayName:"GiftCard",propTypes:{children:childrenTypes.isRequired,onSubmit:PropTypes.func},defaultProps:{onSubmit:undefined}},GiftCardAmount:{displayName:"GiftCardAmount",propTypes:baseOrderComponentPricePropTypes},GiftCardContainer:{permittedChildren:["GiftCard","Errors","ReactNode"],displayName:"GiftCardContainer",propTypes:{children:childrenTypes.isRequired}},GiftCardCurrencySelector:{displayName:"GiftCardCurrencySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,label:PropTypes.string.isRequired}),value:PropTypes.string,required:PropTypes.bool},defaultProps:{required:true}},GiftCardInput:{displayName:"GiftCardInput",propTypes:{type:PropTypes.oneOf(["text","email","number","date","checkbox"]).isRequired,name:PropTypes.oneOf(["balanceCents","balanceMaxCents","singleUse","rechargeable","imageUrl","expiresAt","referenceOrigin","email","firstName","lastName","reference"]).isRequired,children:PropTypes.func,placeholder:PropTypes.string}},GiftCardOrCouponForm:{permittedChildren:["GiftCardOrCouponInput","GiftCardOrCouponSubmit","ReactNode"],propTypes:{children:childrenTypes.isRequired}},GiftCardOrCouponInput:{displayName:"GiftCardOrCouponInput",propTypes:{children:PropTypes.func,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool}},GiftCardOrCouponSubmit:{displayName:"GiftCardOrCouponSubmit",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},GiftCardOrCouponCode:{displayName:"GiftCardOrCouponCode",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"])}},GiftCardOrCouponRemoveButton:{displayName:"GiftCardOrCouponRemoveButton",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"]),label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},ItemContainer:{permittedChildren:["PricesContainer","VariantsContainer","SkuOptionContainer","QuantitySelector","AddToCartButton","AvailabilityContainer","SkuListsContainer","ReactNode"],displayName:"ItemContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}},LineItem:{permittedChildren:["AvailabilityContainer","LineItemImage","LineItemName","LineItemOptions","LineItemQuantity","LineItemAmount","LineItemRemoveLink","StockTransfer","Errors","ReactNode"],displayName:"LineItem",propTypes:{children:childrenTypes.isRequired,type:PropTypes.oneOf(["skus","gift_cards","shipments","payment_methods","promotions","adjustments","bundles"])},defaultProps:{type:"skus"}},LineItemAmount:{displayName:"LineItemAmount",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["total","unit","option"])}),defaultProps:{format:"formatted",type:"total"}},LineItemImage:{displayName:"LineItemImage",propTypes:{width:PropTypes.number,children:PropTypes.func}},LineItemName:{displayName:"LineItemName",propTypes:{children:PropTypes.func}},LineItemCode:{displayName:"LineItemCode",propTypes:{children:PropTypes.func}},LineItemOption:{displayName:"LineItemOption",propTypes:{name:PropTypes.string,children:PropTypes.func,valueClassName:PropTypes.string,className:PropTypes.string,id:PropTypes.string,style:PropTypes.object}},LineItemOptions:{permittedChildren:["LineItemOption","ReactNode"],displayName:"LineItemOptions",propTypes:{children:childrenTypes.isRequired,title:PropTypes.string,showName:PropTypes.bool,skuOptionId:PropTypes.string}},LineItemQuantity:{displayName:"LineItemQuantity",propTypes:{children:PropTypes.func,max:PropTypes.number,disabled:PropTypes.bool,readonly:PropTypes.bool},defaultProps:{max:50}},LineItemRemoveLink:{displayName:"LineItemRemoveLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Remove"}},LineItemsContainer:{permittedChildren:["LineItemsCount","LineItem","ReactNode"],displayName:"LineItemsContainer",propTypes:{children:childrenTypes.isRequired,filters:PropTypes.object,loader:PTLoader},defaultProps:{filters:{},loader:"Loading..."}},LineItemsCount:{displayName:"LineItemsCount",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object}},MetadataInput:{displayName:"MetadataInput",propTypes:BaseInputComponentPropTypes},OrderContainer:{permittedChildren:["AddressesContainer","CustomerContainer","ItemContainer","LineItemsContainer","SubTotalAmount","DiscountAmount","ShippingAmount","TaxesAmount","GiftCardAmount","TotalAmount","CheckoutLink","GiftCardContainer","ShipmentsContainer","PaymentMethodsContainer","PaymentMethodAmount","GiftCardOrCouponForm","GiftCardOrCouponCode","GiftCardOrCouponRemoveButton","Errors","OrderNumber","ReactNode"],displayName:"OrderContainer",propTypes:{children:childrenTypes.isRequired,orderId:PropTypes.string,metadata:BMObject,attributes:PropTypes.object},defaultProps:{metadata:{}}},OrderNumber:{displayName:"OrderNumber",propTypes:{className:PropTypes.string},defaultProps:{format:"formatted"}},OrderStorage:{permittedChildren:["OrderContainer","ReactNode"],displayName:"OrderStorage",propTypes:{children:childrenTypes.isRequired,clearWhenPlaced:PropTypes.bool,persistKey:PropTypes.string.isRequired}},PaymentMethod:{permittedChildren:["PaymentMethodName","PaymentMethodRadioButton","PaymentMethodPrice","PaymentSource","ReactNode","Errors"],displayName:"PaymentMethod",propTypes:{children:childrenTypes.isRequired}},PaymentMethodAmount:{displayName:"PaymentMethodAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},PaymentMethodName:{displayName:"PaymentMethodName",propTypes:{children:PropTypes.func}},PaymentMethodPrice:{displayName:"PaymentMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])})},PaymentMethodRadioButton:{displayName:"PaymentMethodRadioButton",propTypes:{children:PropTypes.func}},PaymentMethodsContainer:{displayName:"PaymentMethodsContainer",permittedChildren:["PaymentSource","ReactNode","PlaceOrderContainer"],propTypes:{children:childrenTypes.isRequired}},PaymentSource:{displayName:"PaymentSource",permittedChildren:["PaymentSourceBrandIcon","PaymentSourceBrandName","PaymentSourceEditButton","PaymentSourceDetail","ReactNode"],propTypes:{children:childrenTypes,readonly:PropTypes.bool}},PaymentSourceBrandIcon:{displayName:"PaymentSourceBrandIcon",propTypes:{children:PropTypes.func,width:PropTypes.number,height:PropTypes.number,src:PropTypes.string,className:PropTypes.string}},PaymentSourceBrandName:{displayName:"PaymentSourceBrandName",propTypes:{children:PropTypes.func,label:PropTypes.string}},PaymentSourceEditButton:{displayName:"PaymentSourceEditButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])}},PaymentSourceDetail:{displayName:"PaymentSourceDetail",propTypes:{type:PropTypes.oneOf(["last4","expYear","expMonth"]).isRequired}},PlaceOrderButton:{displayName:"PlaceOrderButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Place order"}},PlaceOrderContainer:{displayName:"PlaceOrderContainer",permittedChildren:["PaymentMethod","PlaceOrderButton","PrivacyAndTermsCheckbox","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Price:{displayName:"Price",propTypes:{children:PropTypes.func,compareClassName:PropTypes.string,skuCode:PropTypes.string,showCompare:PropTypes.bool},defaultProps:{skuCode:""}},PricesContainer:{permittedChildren:["Price","ReactNode"],displayName:"PricesContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,loader:PTLoader,perPage:PropTypes.number,filters:PropTypes.object},defaultProps:{perPage:10,filters:{},loader:"Loading...",skuCode:""}},PrivacyAndTermsCheckbox:{displayName:"PrivacyAndTermsCheckbox",propTypes:{children:PropTypes.func}},QuantitySelector:{displayName:"QuantitySelector",propTypes:{children:PropTypes.func,min:PropTypes.number,max:PropTypes.number,value:PropTypes.string,skuCode:PropTypes.string,disabled:PropTypes.bool},defaultProps:{min:1}},SaveAddressesButton:{displayName:"SaveAddressesButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func,disabled:PropTypes.bool},defaultProps:{label:"Continue to delivery"}},Shipment:{permittedChildren:["LineItemsContainer","LineItem","ShippingMethod","ReactNode"],displayName:"Shipment",propTypes:{children:childrenTypes.isRequired}},ShipmentField:{displayName:"ShipmentField",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["cost_amount_cents","cost_amount_float","currency_code","formatted_cost_amount","number","status","key_number"]).isRequired}},ShipmentsContainer:{displayName:"ShipmentsContainer",permittedChildren:["Shipment","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SaveCustomerButton:{displayName:"SaveCustomerButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func},defaultProps:{label:"Save"}},ShippingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAmount:{displayName:"ShippingAmount",propTypes:baseOrderComponentPricePropTypes},ShippingMethod:{permittedChildren:["ShippingMethodName","ShippingMethodPrice","ShippingMethodRadioButton","DeliveryLeadTime","ReactNode"],displayName:"ShippingMethod",propTypes:{children:childrenTypes.isRequired,readonly:PropTypes.bool}},ShippingMethodName:{displayName:"ShippingMethodName",propTypes:{children:PropTypes.func}},ShippingMethodRadioButton:{displayName:"ShippingMethodRadioButton",propTypes:{children:PropTypes.func}},ShippingMethodPrice:{displayName:"ShippingMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])}),defaultProps:{format:"formatted",type:"amount"}},SkuList:{permittedChildren:["AddToCartButton","QuantitySelector","ReactNode"],displayName:"SkuList",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuListsContainer:{permittedChildren:["SkuList","ReactNode"],displayName:"SkuListsContainer",propTypes:{children:childrenTypes.isRequired}},SkuOption:{permittedChildren:["SkuOptionInput","ReactNode"],displayName:"SkuOption",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuOptionInput:{displayName:"SkuOptionInput",propTypes:BaseInputComponentPropTypes},SkuOptionsContainer:{permittedChildren:["SkuOption","ReactNode"],displayName:"SkuOptionsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},StockTransfer:{permittedChildren:["StockTransferField","ReactNode"],displayName:"StockTransfer",propTypes:{children:childrenTypes.isRequired}},StockTransferField:{displayName:"StockTransferField",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["quantity","sku_code"]).isRequired}},SubmitButton:{displayName:"SubmitButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Submit"}},SubTotalAmount:{displayName:"SubTotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TaxesAmount:{displayName:"TaxesAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TotalAmount:{displayName:"TotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},VariantsContainer:{permittedChildren:["VariantSelector","ReactNode"],displayName:"VariantsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,filters:PropTypes.object},defaultProps:{skuCode:"",filters:{}}},VariantSelector:{displayName:"VariantSelector",propTypes:{options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string},defaultProps:{placeholder:"Select a variant",type:"select"}}};export default components;
1
+ import PropTypes from"prop-types";import childrenTypes from"../utils/childrenTypes";import{baseOrderComponentPricePropTypes,PTLoader,BMObject}from"../typings/index";import{ErrorPropTypes}from"../typings/errors";import{BaseInputComponentPropTypes}from"../typings/index";const components={Address:{permittedChildren:["AddressField","ReactNode"],displayName:"Address",propTypes:{children:childrenTypes.isRequired}},AddressCountrySelector:{displayName:"AddressCountrySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_country_code","shipping_address_country_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressStateSelector:{displayName:"AddressStateSelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_state_code","shipping_address_state_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressField:{displayName:"AddressField",propTypes:{children:PropTypes.func}},AddressInput:{displayName:"AddressInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["billing_address_city","billing_address_company","billing_address_email","billing_address_first_name","billing_address_last_name","billing_address_line_1","billing_address_line_2","billing_address_phone","billing_address_state_code","billing_address_zip_code","billing_address_billing_info","billing_address_save_to_customer_book","shipping_address_city","shipping_address_company","shipping_address_email","shipping_address_first_name","shipping_address_last_name","shipping_address_line_1","shipping_address_line_2","shipping_address_phone","shipping_address_state_code","shipping_address_zip_code","shipping_address_save_to_customer_book"]).isRequired,type:PropTypes.oneOf(["checkbox","date","email","number","tel","text","textarea"]).isRequired,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool},defaultProps:{required:!0}},AddToCartButton:{displayName:"AddToCartButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),skuCode:PropTypes.string,disabled:PropTypes.bool,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})},defaultProps:{label:"Add to cart"}},AddressesContainer:{displayName:"AddressesContainer",permittedChildren:["BillingAddressForm","BillingAddressContainer","ShippingAddressForm","ShippingAddressContainer","SaveAddressesButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,shipToDifferentAddress:PropTypes.bool}},AvailabilityContainer:{displayName:"AvailabilityContainer",permittedChildren:["AvailabilityTemplate","ReactNode"],propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},AvailabilityTemplate:{displayName:"AvailabilityTemplate",propTypes:{timeFormat:PropTypes.oneOf(["days","hours"]),showShippingMethodName:PropTypes.bool,children:PropTypes.func},defaultProps:{timeFormat:"days",showShippingMethodName:!1}},BillingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},BillingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},CheckoutLink:{displayName:"CheckoutLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Checkout"}},CommerceLayer:{permittedChildren:["OrderContainer","OrderStorage","PricesContainer","GiftCardContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,accessToken:PropTypes.string.isRequired,endpoint:PropTypes.string.isRequired}},CustomerContainer:{displayName:"CustomerContainer",permittedChildren:["CustomerInput","SaveCustomerButton","AddressesContainer","PaymentMethodsContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,isGuest:PropTypes.bool}},CustomerInput:{displayName:"CustomerInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["customerEmail"]),type:PropTypes.oneOf(["email"]),placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool,saveOnBlur:PropTypes.bool},defaultProps:{required:!0}},DeliveryLeadTime:{displayName:"DeliveryLeadTime",propTypes:{type:PropTypes.oneOf(["max_days","max_hours","min_days","min_hours"]).isRequired,children:PropTypes.func}},DiscountAmount:{displayName:"DiscountAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},Errors:{displayName:"Errors",propTypes:ErrorPropTypes,defaultProps:{messages:[],field:"base"}},ExternalFunction:{displayName:"ExternalFunction",permittedChildren:["AddToCartButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,url:PropTypes.string.isRequired}},GiftCard:{permittedChildren:["GiftCardCurrencySelector","GiftCardInput","Errors","MetadataInput","SubmitButton","ReactNode"],displayName:"GiftCard",propTypes:{children:childrenTypes.isRequired,onSubmit:PropTypes.func},defaultProps:{onSubmit:void 0}},GiftCardAmount:{displayName:"GiftCardAmount",propTypes:baseOrderComponentPricePropTypes},GiftCardContainer:{permittedChildren:["GiftCard","Errors","ReactNode"],displayName:"GiftCardContainer",propTypes:{children:childrenTypes.isRequired}},GiftCardCurrencySelector:{displayName:"GiftCardCurrencySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,label:PropTypes.string.isRequired}),value:PropTypes.string,required:PropTypes.bool},defaultProps:{required:!0}},GiftCardInput:{displayName:"GiftCardInput",propTypes:{type:PropTypes.oneOf(["text","email","number","date","checkbox"]).isRequired,name:PropTypes.oneOf(["balanceCents","balanceMaxCents","singleUse","rechargeable","imageUrl","expiresAt","referenceOrigin","email","firstName","lastName","reference"]).isRequired,children:PropTypes.func,placeholder:PropTypes.string}},GiftCardOrCouponForm:{permittedChildren:["GiftCardOrCouponInput","GiftCardOrCouponSubmit","ReactNode"],propTypes:{children:childrenTypes.isRequired}},GiftCardOrCouponInput:{displayName:"GiftCardOrCouponInput",propTypes:{children:PropTypes.func,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool}},GiftCardOrCouponSubmit:{displayName:"GiftCardOrCouponSubmit",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},GiftCardOrCouponCode:{displayName:"GiftCardOrCouponCode",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"])}},GiftCardOrCouponRemoveButton:{displayName:"GiftCardOrCouponRemoveButton",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"]),label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},ItemContainer:{permittedChildren:["PricesContainer","VariantsContainer","SkuOptionContainer","QuantitySelector","AddToCartButton","AvailabilityContainer","SkuListsContainer","ReactNode"],displayName:"ItemContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}},LineItem:{permittedChildren:["AvailabilityContainer","LineItemImage","LineItemName","LineItemOptions","LineItemQuantity","LineItemAmount","LineItemRemoveLink","StockTransfer","Errors","ReactNode"],displayName:"LineItem",propTypes:{children:childrenTypes.isRequired,type:PropTypes.oneOf(["skus","gift_cards","shipments","payment_methods","promotions","adjustments","bundles"])},defaultProps:{type:"skus"}},LineItemAmount:{displayName:"LineItemAmount",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["total","unit","option"])}),defaultProps:{format:"formatted",type:"total"}},LineItemImage:{displayName:"LineItemImage",propTypes:{width:PropTypes.number,children:PropTypes.func}},LineItemName:{displayName:"LineItemName",propTypes:{children:PropTypes.func}},LineItemCode:{displayName:"LineItemCode",propTypes:{children:PropTypes.func}},LineItemOption:{displayName:"LineItemOption",propTypes:{name:PropTypes.string,children:PropTypes.func,valueClassName:PropTypes.string,className:PropTypes.string,id:PropTypes.string,style:PropTypes.object}},LineItemOptions:{permittedChildren:["LineItemOption","ReactNode"],displayName:"LineItemOptions",propTypes:{children:childrenTypes.isRequired,title:PropTypes.string,showName:PropTypes.bool,skuOptionId:PropTypes.string}},LineItemQuantity:{displayName:"LineItemQuantity",propTypes:{children:PropTypes.func,max:PropTypes.number,disabled:PropTypes.bool,readonly:PropTypes.bool},defaultProps:{max:50}},LineItemRemoveLink:{displayName:"LineItemRemoveLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Remove"}},LineItemsContainer:{permittedChildren:["LineItemsCount","LineItem","ReactNode"],displayName:"LineItemsContainer",propTypes:{children:childrenTypes.isRequired,filters:PropTypes.object,loader:PTLoader},defaultProps:{filters:{},loader:"Loading..."}},LineItemsCount:{displayName:"LineItemsCount",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object}},MetadataInput:{displayName:"MetadataInput",propTypes:BaseInputComponentPropTypes},OrderContainer:{permittedChildren:["AddressesContainer","CustomerContainer","ItemContainer","LineItemsContainer","SubTotalAmount","DiscountAmount","ShippingAmount","TaxesAmount","GiftCardAmount","TotalAmount","CheckoutLink","GiftCardContainer","ShipmentsContainer","PaymentMethodsContainer","PaymentMethodAmount","GiftCardOrCouponForm","GiftCardOrCouponCode","GiftCardOrCouponRemoveButton","Errors","OrderNumber","ReactNode"],displayName:"OrderContainer",propTypes:{children:childrenTypes.isRequired,orderId:PropTypes.string,metadata:BMObject,attributes:PropTypes.object},defaultProps:{metadata:{}}},OrderNumber:{displayName:"OrderNumber",propTypes:{className:PropTypes.string},defaultProps:{format:"formatted"}},OrderStorage:{permittedChildren:["OrderContainer","ReactNode"],displayName:"OrderStorage",propTypes:{children:childrenTypes.isRequired,clearWhenPlaced:PropTypes.bool,persistKey:PropTypes.string.isRequired}},PaymentMethod:{permittedChildren:["PaymentMethodName","PaymentMethodRadioButton","PaymentMethodPrice","PaymentSource","ReactNode","Errors"],displayName:"PaymentMethod",propTypes:{children:childrenTypes.isRequired}},PaymentMethodAmount:{displayName:"PaymentMethodAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},PaymentMethodName:{displayName:"PaymentMethodName",propTypes:{children:PropTypes.func}},PaymentMethodPrice:{displayName:"PaymentMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])})},PaymentMethodRadioButton:{displayName:"PaymentMethodRadioButton",propTypes:{children:PropTypes.func}},PaymentMethodsContainer:{displayName:"PaymentMethodsContainer",permittedChildren:["PaymentSource","ReactNode","PlaceOrderContainer"],propTypes:{children:childrenTypes.isRequired}},PaymentSource:{displayName:"PaymentSource",permittedChildren:["PaymentSourceBrandIcon","PaymentSourceBrandName","PaymentSourceEditButton","PaymentSourceDetail","ReactNode"],propTypes:{children:childrenTypes,readonly:PropTypes.bool}},PaymentSourceBrandIcon:{displayName:"PaymentSourceBrandIcon",propTypes:{children:PropTypes.func,width:PropTypes.number,height:PropTypes.number,src:PropTypes.string,className:PropTypes.string}},PaymentSourceBrandName:{displayName:"PaymentSourceBrandName",propTypes:{children:PropTypes.func,label:PropTypes.string}},PaymentSourceEditButton:{displayName:"PaymentSourceEditButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])}},PaymentSourceDetail:{displayName:"PaymentSourceDetail",propTypes:{type:PropTypes.oneOf(["last4","expYear","expMonth"]).isRequired}},PlaceOrderButton:{displayName:"PlaceOrderButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Place order"}},PlaceOrderContainer:{displayName:"PlaceOrderContainer",permittedChildren:["PaymentMethod","PlaceOrderButton","PrivacyAndTermsCheckbox","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Price:{displayName:"Price",propTypes:{children:PropTypes.func,compareClassName:PropTypes.string,skuCode:PropTypes.string,showCompare:PropTypes.bool},defaultProps:{skuCode:""}},PricesContainer:{permittedChildren:["Price","ReactNode"],displayName:"PricesContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,loader:PTLoader,perPage:PropTypes.number,filters:PropTypes.object},defaultProps:{perPage:10,filters:{},loader:"Loading...",skuCode:""}},PrivacyAndTermsCheckbox:{displayName:"PrivacyAndTermsCheckbox",propTypes:{children:PropTypes.func}},QuantitySelector:{displayName:"QuantitySelector",propTypes:{children:PropTypes.func,min:PropTypes.number,max:PropTypes.number,value:PropTypes.string,skuCode:PropTypes.string,disabled:PropTypes.bool},defaultProps:{min:1}},SaveAddressesButton:{displayName:"SaveAddressesButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func,disabled:PropTypes.bool},defaultProps:{label:"Continue to delivery"}},Shipment:{permittedChildren:["LineItemsContainer","LineItem","ShippingMethod","ReactNode"],displayName:"Shipment",propTypes:{children:childrenTypes.isRequired}},ShipmentField:{displayName:"ShipmentField",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["cost_amount_cents","cost_amount_float","currency_code","formatted_cost_amount","number","status","key_number"]).isRequired}},ShipmentsContainer:{displayName:"ShipmentsContainer",permittedChildren:["Shipment","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SaveCustomerButton:{displayName:"SaveCustomerButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func},defaultProps:{label:"Save"}},ShippingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAmount:{displayName:"ShippingAmount",propTypes:baseOrderComponentPricePropTypes},ShippingMethod:{permittedChildren:["ShippingMethodName","ShippingMethodPrice","ShippingMethodRadioButton","DeliveryLeadTime","ReactNode"],displayName:"ShippingMethod",propTypes:{children:childrenTypes.isRequired,readonly:PropTypes.bool}},ShippingMethodName:{displayName:"ShippingMethodName",propTypes:{children:PropTypes.func}},ShippingMethodRadioButton:{displayName:"ShippingMethodRadioButton",propTypes:{children:PropTypes.func}},ShippingMethodPrice:{displayName:"ShippingMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])}),defaultProps:{format:"formatted",type:"amount"}},SkuList:{permittedChildren:["AddToCartButton","QuantitySelector","ReactNode"],displayName:"SkuList",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuListsContainer:{permittedChildren:["SkuList","ReactNode"],displayName:"SkuListsContainer",propTypes:{children:childrenTypes.isRequired}},SkuOption:{permittedChildren:["SkuOptionInput","ReactNode"],displayName:"SkuOption",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuOptionInput:{displayName:"SkuOptionInput",propTypes:BaseInputComponentPropTypes},SkuOptionsContainer:{permittedChildren:["SkuOption","ReactNode"],displayName:"SkuOptionsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},StockTransfer:{permittedChildren:["StockTransferField","ReactNode"],displayName:"StockTransfer",propTypes:{children:childrenTypes.isRequired}},StockTransferField:{displayName:"StockTransferField",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["quantity","sku_code"]).isRequired}},SubmitButton:{displayName:"SubmitButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Submit"}},SubTotalAmount:{displayName:"SubTotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TaxesAmount:{displayName:"TaxesAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TotalAmount:{displayName:"TotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},VariantsContainer:{permittedChildren:["VariantSelector","ReactNode"],displayName:"VariantsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,filters:PropTypes.object},defaultProps:{skuCode:"",filters:{}}},VariantSelector:{displayName:"VariantSelector",propTypes:{options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string},defaultProps:{placeholder:"Select a variant",type:"select"}}};export default components;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={address:{}};const AddressChildrenContext=createContext(initial);export default AddressChildrenContext;
1
+ import{createContext}from"react";const initial={address:{}},AddressChildrenContext=createContext(initial);export default AddressChildrenContext;
@@ -1 +1 @@
1
- import{createContext}from"react";import{setAddress}from"../reducers/AddressReducer";export const defaultAddressContext={saveAddresses:()=>{},setCloneAddress:()=>{},setAddress:setAddress,setAddressErrors:()=>{}};const AddressesContext=createContext(defaultAddressContext);export default AddressesContext;
1
+ import{createContext}from"react";import{setAddress}from"../reducers/AddressReducer";export const defaultAddressContext={saveAddresses:()=>{},setCloneAddress:()=>{},setAddress,setAddressErrors:()=>{}};const AddressesContext=createContext(defaultAddressContext);export default AddressesContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={accessToken:"",endpoint:""};const CommerceLayerContext=createContext(initial);export default CommerceLayerContext;
1
+ import{createContext}from"react";const initial={accessToken:"",endpoint:""},CommerceLayerContext=createContext(initial);export default CommerceLayerContext;
@@ -1 +1 @@
1
- import{setCustomerErrors,setCustomerEmail}from"../reducers/CustomerReducer";import{createContext}from"react";export const defaultCustomerContext={saveCustomerUser:async()=>{},getCustomerPaymentSources:async()=>{},setCustomerErrors:setCustomerErrors,setCustomerEmail:setCustomerEmail};const CustomerContext=createContext(defaultCustomerContext);export default CustomerContext;
1
+ import{setCustomerErrors,setCustomerEmail}from"../reducers/CustomerReducer";import{createContext}from"react";export const defaultCustomerContext={saveCustomerUser:async()=>{},getCustomerPaymentSources:async()=>{},setCustomerErrors,setCustomerEmail};const CustomerContext=createContext(defaultCustomerContext);export default CustomerContext;
@@ -1 +1 @@
1
- import{createContext}from"react";import axios from"axios";export const callExternalFunction=async({url:t,data:n})=>axios.post(t,n);const ExternalFunctionContext=createContext({url:null,callExternalFunction:callExternalFunction});export default ExternalFunctionContext;
1
+ import{createContext}from"react";import axios from"axios";export const callExternalFunction=async({url,data})=>axios.post(url,data);const ExternalFunctionContext=createContext({url:null,callExternalFunction});export default ExternalFunctionContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={};const LineItemChildrenContext=createContext(initial);export default LineItemChildrenContext;
1
+ import{createContext}from"react";const initial={},LineItemChildrenContext=createContext(initial);export default LineItemChildrenContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={lineItems:[]};const LineItemContext=createContext(initial);export default LineItemContext;
1
+ import{createContext}from"react";const initial={lineItems:[]},LineItemContext=createContext(initial);export default LineItemContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={lineItemOption:{}};const LineItemOptionChildrenContext=createContext(initial);export default LineItemOptionChildrenContext;
1
+ import{createContext}from"react";const initial={lineItemOption:{}},LineItemOptionChildrenContext=createContext(initial);export default LineItemOptionChildrenContext;
@@ -1 +1 @@
1
- import{createContext}from"react";import{addToCart,setOrderErrors,createOrder,setGiftCardOrCouponCode,removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook,addResourceToInclude,updateOrder}from"../reducers/OrderReducer";export const defaultOrderContext={addToCart:addToCart,createOrder:createOrder,setOrderErrors:setOrderErrors,setGiftCardOrCouponCode:setGiftCardOrCouponCode,removeGiftCardOrCouponCode:removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook:saveAddressToCustomerAddressBook,addResourceToInclude:addResourceToInclude,getOrder:async e=>{},updateOrder:updateOrder};const OrderContext=createContext(defaultOrderContext);export default OrderContext;
1
+ import{createContext}from"react";import{addToCart,setOrderErrors,createOrder,setGiftCardOrCouponCode,removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook,addResourceToInclude,updateOrder}from"../reducers/OrderReducer";export const defaultOrderContext={addToCart,createOrder,setOrderErrors,setGiftCardOrCouponCode,removeGiftCardOrCouponCode,saveAddressToCustomerAddressBook,addResourceToInclude,getOrder:async _id=>{},updateOrder};const OrderContext=createContext(defaultOrderContext);export default OrderContext;
@@ -1 +1 @@
1
- import{createContext}from"react";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../utils/localStorage";const initial={persistKey:"",clearWhenPlaced:true,getLocalOrder:getLocalOrder,setLocalOrder:setLocalOrder,deleteLocalOrder:deleteLocalOrder};const OrderStorageContext=createContext(initial);export default OrderStorageContext;
1
+ import{createContext}from"react";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../utils/localStorage";const initial={persistKey:"",clearWhenPlaced:!0,getLocalOrder,setLocalOrder,deleteLocalOrder},OrderStorageContext=createContext(initial);export default OrderStorageContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={};const PaymentMethodChildrenContext=createContext(initial);export default PaymentMethodChildrenContext;
1
+ import{createContext}from"react";const initial={},PaymentMethodChildrenContext=createContext(initial);export default PaymentMethodChildrenContext;
@@ -1 +1 @@
1
- import{createContext}from"react";import{updatePaymentSource}from"../reducers/PaymentMethodReducer";import{setPaymentMethodErrors,setPaymentSource,setPaymentMethod,destroyPaymentSource,setPaymentRef,setLoading}from"../reducers/PaymentMethodReducer";export const defaultPaymentMethodContext={setPaymentMethodErrors:setPaymentMethodErrors,setPaymentMethod:setPaymentMethod,setPaymentSource:setPaymentSource,setPaymentRef:setPaymentRef,destroyPaymentSource:destroyPaymentSource,updatePaymentSource:updatePaymentSource,setLoading:setLoading};const PaymentMethodContext=createContext(defaultPaymentMethodContext);export default PaymentMethodContext;
1
+ import{createContext}from"react";import{updatePaymentSource}from"../reducers/PaymentMethodReducer";import{setPaymentMethodErrors,setPaymentSource,setPaymentMethod,destroyPaymentSource,setPaymentRef,setLoading}from"../reducers/PaymentMethodReducer";export const defaultPaymentMethodContext={setPaymentMethodErrors,setPaymentMethod,setPaymentSource,setPaymentRef,destroyPaymentSource,updatePaymentSource,setLoading};const PaymentMethodContext=createContext(defaultPaymentMethodContext);export default PaymentMethodContext;
@@ -1 +1 @@
1
- import{createContext}from"react";import{setPlaceOrderErrors}from"../reducers/PlaceOrderReducer";export const defaultPlaceOrderContext={setPlaceOrderErrors:setPlaceOrderErrors};const PlaceOrderContext=createContext(defaultPlaceOrderContext);export default PlaceOrderContext;
1
+ import{createContext}from"react";import{setPlaceOrderErrors}from"../reducers/PlaceOrderReducer";export const defaultPlaceOrderContext={setPlaceOrderErrors};const PlaceOrderContext=createContext(defaultPlaceOrderContext);export default PlaceOrderContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={lineItems:[],shippingMethods:[],stockTransfers:[],keyNumber:0};const ShipmentChildrenContext=createContext(initial);export default ShipmentChildrenContext;
1
+ import{createContext}from"react";const initial={lineItems:[],shippingMethods:[],stockTransfers:[],keyNumber:0},ShipmentChildrenContext=createContext(initial);export default ShipmentChildrenContext;
@@ -1 +1 @@
1
- import{createContext}from"react";import{setShipmentErrors}from"../reducers/ShipmentReducer";export const defaultShipmentContext={setShipmentErrors:setShipmentErrors,setShippingMethod:async()=>{}};const ShipmentContext=createContext(defaultShipmentContext);export default ShipmentContext;
1
+ import{createContext}from"react";import{setShipmentErrors}from"../reducers/ShipmentReducer";export const defaultShipmentContext={setShipmentErrors,setShippingMethod:async()=>{}};const ShipmentContext=createContext(defaultShipmentContext);export default ShipmentContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={};const ShippingMethodChildrenContext=createContext(initial);export default ShippingMethodChildrenContext;
1
+ import{createContext}from"react";const initial={},ShippingMethodChildrenContext=createContext(initial);export default ShippingMethodChildrenContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={skuCode:""};const SkuOptionChildrenContext=createContext(initial);export default SkuOptionChildrenContext;
1
+ import{createContext}from"react";const initial={skuCode:""},SkuOptionChildrenContext=createContext(initial);export default SkuOptionChildrenContext;
@@ -1 +1 @@
1
- import{createContext}from"react";const initial={};const StockTransferChildrenContext=createContext(initial);export default StockTransferChildrenContext;
1
+ import{createContext}from"react";const initial={},StockTransferChildrenContext=createContext(initial);export default StockTransferChildrenContext;
@@ -88,3 +88,4 @@ export { default as VariantsContainer } from './components/VariantsContainer';
88
88
  export type { CustomerCardsTemplate } from './components/utils/PaymentCardsTemplate';
89
89
  export type { AddressCardsTemplate } from './components/utils/AddressCardsTemplate';
90
90
  export type { AddToCartButtonTemplate } from './components/AddToCartButton';
91
+ export type { ShippingMethodRadioButtonTemplate, ShippingMethodRadioButtonOnChange, } from './components/ShippingMethodRadioButton';
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import getSdk from"../utils/getSdk";import camelCase from"lodash/camelCase";export const addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"];export const addressInitialState={errors:[]};export const setAddressErrors=({errors:s,dispatch:e,currentErrors:d=[],resource:i})=>{const r=i==="billing_address"?s.filter((s=>s.resource===i)):d.filter((s=>s.resource==="billing_address"));const t=i==="shipping_address"?s.filter((s=>s.resource===i)):d.filter((s=>s.resource==="shipping_address"));const o=[...r,...t];e&&e({type:"setErrors",payload:{errors:o}})};export const setAddress=({values:s,resource:e,dispatch:d})=>{d&&d({type:"setAddress",payload:{[`${e}`]:s}})};export const setCloneAddress=(s,e,d)=>{d({type:"setCloneAddress",payload:{[`${camelCase(e)}Id`]:s}})};export const saveAddresses=async({config:s,updateOrder:e,order:d,state:i})=>{var r,t,o;const{shipToDifferentAddress:a,billing_address:l,shipping_address:n,billingAddressId:p,shippingAddressId:_}=i;try{const i=getSdk(s);if(d){const s=(r=d===null||d===void 0?void 0:d.billing_address)===null||r===void 0?void 0:r.reference;const c={id:d===null||d===void 0?void 0:d.id,_billing_address_clone_id:p,_shipping_address_clone_id:p};if(s===p){c._billing_address_clone_id=(t=d===null||d===void 0?void 0:d.billing_address)===null||t===void 0?void 0:t.id;c._shipping_address_clone_id=(o=d===null||d===void 0?void 0:d.shipping_address)===null||o===void 0?void 0:o.id}if(!isEmpty(l)&&l){delete c._billing_address_clone_id;delete c._shipping_address_clone_id;c._shipping_address_same_as_billing=true;const s=await i.addresses.create(l);c.billing_address=i.addresses.relationship(s.id)}if(a){delete c._shipping_address_same_as_billing;if(_)c._shipping_address_clone_id=_;if(!isEmpty(n)&&n){delete c._shipping_address_clone_id;const s=await i.addresses.create(n);c.shipping_address=i.addresses.relationship(s.id)}}if(!isEmpty(c)&&e){await e({id:d.id,attributes:c})}}}catch(s){console.error(s)}};const type=["setErrors","setAddress","setShipToDifferentAddress","setCloneAddress","cleanup"];const addressReducer=(s,e)=>baseReducer(s,e,type);export default addressReducer;
1
+ import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import getSdk from"../utils/getSdk";import camelCase from"lodash/camelCase";export const addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"],addressInitialState={errors:[]},setAddressErrors=({errors,dispatch,currentErrors=[],resource})=>{const billingErrors=resource==="billing_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="billing_address"),shippingErrors=resource==="shipping_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="shipping_address"),finalErrors=[...billingErrors,...shippingErrors];dispatch&&dispatch({type:"setErrors",payload:{errors:finalErrors}})},setAddress=({values,resource,dispatch})=>{dispatch&&dispatch({type:"setAddress",payload:{[`${resource}`]:values}})},setCloneAddress=(id,resource,dispatch)=>{dispatch({type:"setCloneAddress",payload:{[`${camelCase(resource)}Id`]:id}})},saveAddresses=async({config,updateOrder,order,state})=>{var _a,_b,_c;const{shipToDifferentAddress,billing_address,shipping_address,billingAddressId,shippingAddressId}=state;try{const sdk=getSdk(config);if(order){const currentBillingAddressRef=(_a=order==null?void 0:order.billing_address)===null||_a===void 0?void 0:_a.reference,orderAttributes={id:order==null?void 0:order.id,_billing_address_clone_id:billingAddressId,_shipping_address_clone_id:billingAddressId};if(currentBillingAddressRef===billingAddressId&&(orderAttributes._billing_address_clone_id=(_b=order==null?void 0:order.billing_address)===null||_b===void 0?void 0:_b.id,orderAttributes._shipping_address_clone_id=(_c=order==null?void 0:order.shipping_address)===null||_c===void 0?void 0:_c.id),!isEmpty(billing_address)&&billing_address){delete orderAttributes._billing_address_clone_id,delete orderAttributes._shipping_address_clone_id,orderAttributes._shipping_address_same_as_billing=!0;const address=await sdk.addresses.create(billing_address);orderAttributes.billing_address=sdk.addresses.relationship(address.id)}if(shipToDifferentAddress&&(delete orderAttributes._shipping_address_same_as_billing,shippingAddressId&&(orderAttributes._shipping_address_clone_id=shippingAddressId),!isEmpty(shipping_address)&&shipping_address)){delete orderAttributes._shipping_address_clone_id;const address=await sdk.addresses.create(shipping_address);orderAttributes.shipping_address=sdk.addresses.relationship(address.id)}!isEmpty(orderAttributes)&&updateOrder&&await updateOrder({id:order.id,attributes:orderAttributes})}}catch(error){console.error(error)}};const type=["setErrors","setAddress","setShipToDifferentAddress","setCloneAddress","cleanup"],addressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default addressReducer;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const availabilityInitialState={quantity:null,min:{days:0,hours:0},max:{days:0,hours:0},errors:[]};export const getAvailability=async({skuCode:t,dispatch:i,config:e})=>{var s;const a=getSdk(e);try{const[e]=await a.skus.list({fields:{skus:["id"]},filters:{code_in:t}});const o=await a.skus.retrieve(e.id,{fields:{skus:["inventory"]}});const[l]=((s=o.inventory)===null||s===void 0?void 0:s.levels)||[];const[r]=(l===null||l===void 0?void 0:l.delivery_lead_times)||[];i({type:"setAvailability",payload:Object.assign(Object.assign({},r),{quantity:o.inventory.quantity})})}catch(t){console.error("Get SKU availability",t)}};const typeAction=["setAvailability","setErrors"];const availabilityReducer=(t,i)=>baseReducer(t,i,typeAction);export default availabilityReducer;
1
+ import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const availabilityInitialState={quantity:null,min:{days:0,hours:0},max:{days:0,hours:0},errors:[]},getAvailability=async({skuCode,dispatch,config})=>{var _a;const sdk=getSdk(config);try{const[sku]=await sdk.skus.list({fields:{skus:["id"]},filters:{code_in:skuCode}}),skuInventory=await sdk.skus.retrieve(sku.id,{fields:{skus:["inventory"]}}),[level]=((_a=skuInventory.inventory)===null||_a===void 0?void 0:_a.levels)||[],[delivery]=(level==null?void 0:level.delivery_lead_times)||[];dispatch({type:"setAvailability",payload:Object.assign(Object.assign({},delivery),{quantity:skuInventory.inventory.quantity})})}catch(error){console.error("Get SKU availability",error)}};const typeAction=["setAvailability","setErrors"],availabilityReducer=(state,reducer)=>baseReducer(state,reducer,typeAction);export default availabilityReducer;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const billingAddressInitialState={_billing_address_clone_id:""};export const setBillingAddress=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:"setBillingAddress",payload:{_billing_address_clone_id:e}})}}catch(e){console.error("Set billing address",e)}};export const setBillingCustomerAddressId=async({dispatch:e,order:s,setCloneAddress:d})=>{var r;const i=(r=s===null||s===void 0?void 0:s.billing_address)===null||r===void 0?void 0:r.reference;try{if(i){e({type:"setBillingCustomerAddressId",payload:{billingCustomerAddressId:i}});d(i,"billing_address")}}catch(e){console.error("error",e)}};const type=["setBillingAddress","setBillingCustomerAddressId","cleanup"];const billingAddressReducer=(e,s)=>baseReducer(e,s,type);export default billingAddressReducer;
1
+ import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";export const billingAddressInitialState={_billing_address_clone_id:""},setBillingAddress=async(id,options)=>{try{if(options==null?void 0:options.order){if(options.customerAddressId){const sdk=getSdk(options.config),attributes={id,reference:options.customerAddressId};await sdk.addresses.update(attributes)}options.dispatch({type:"setBillingAddress",payload:{_billing_address_clone_id:id}})}}catch(error){console.error("Set billing address",error)}},setBillingCustomerAddressId=async({dispatch,order,setCloneAddress})=>{var _a;const customerAddressId=(_a=order==null?void 0:order.billing_address)===null||_a===void 0?void 0:_a.reference;try{customerAddressId&&(dispatch({type:"setBillingCustomerAddressId",payload:{billingCustomerAddressId:customerAddressId}}),setCloneAddress(customerAddressId,"billing_address"))}catch(error){console.error("error",error)}};const type=["setBillingAddress","setBillingCustomerAddressId","cleanup"],billingAddressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default billingAddressReducer;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const saveCustomerUser=async({customerEmail:e,order:s,updateOrder:t})=>{if(s){const r={customer_email:e,id:s.id};await t({id:s.id,attributes:r})}};export const setCustomerErrors=(e,s)=>{s&&s({type:"setErrors",payload:{errors:e}})};export const setCustomerEmail=(e,s)=>{s&&s({type:"setCustomerEmail",payload:{customerEmail:e}})};export const getCustomerAddresses=async({config:e,dispatch:s})=>{try{const t=[];const r=getSdk(e);const o=await r.customer_addresses.list({include:["address"]});o.forEach((e=>{if(e.address)t.push(e.address)}));s({type:"setAddresses",payload:{addresses:t}})}catch(e){const t=getErrors(e,"addresses");s({type:"setErrors",payload:{errors:t}})}};export const getCustomerPaymentSources=async({dispatch:e,order:s})=>{if(s===null||s===void 0?void 0:s.available_customer_payment_sources){e({type:"setPayments",payload:{payments:s.available_customer_payment_sources}})}};export const customerInitialState={errors:[],addresses:[],payments:[]};const type=["setErrors","setCustomerEmail","setAddresses","setPayments"];const customerReducer=(e,s)=>baseReducer(e,s,type);export default customerReducer;
1
+ import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";export const saveCustomerUser=async({customerEmail,order,updateOrder})=>{if(order){const attributes={customer_email:customerEmail,id:order.id};await updateOrder({id:order.id,attributes})}},setCustomerErrors=(errors,dispatch)=>{dispatch&&dispatch({type:"setErrors",payload:{errors}})},setCustomerEmail=(customerEmail,dispatch)=>{dispatch&&dispatch({type:"setCustomerEmail",payload:{customerEmail}})},getCustomerAddresses=async({config,dispatch})=>{try{const addresses=[];(await getSdk(config).customer_addresses.list({include:["address"]})).forEach(customerAddress=>{customerAddress.address&&addresses.push(customerAddress.address)}),dispatch({type:"setAddresses",payload:{addresses}})}catch(error){const errors=getErrors(error,"addresses");dispatch({type:"setErrors",payload:{errors}})}},getCustomerPaymentSources=async({dispatch,order})=>{(order==null?void 0:order.available_customer_payment_sources)&&dispatch({type:"setPayments",payload:{payments:order.available_customer_payment_sources}})},customerInitialState={errors:[],addresses:[],payments:[]};const type=["setErrors","setCustomerEmail","setAddresses","setPayments"],customerReducer=(state,reducer)=>baseReducer(state,reducer,type);export default customerReducer;