@commercelayer/react-components 3.0.0-beta.8 → 3.1.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 (418) hide show
  1. package/README.md +1 -1
  2. package/{dist → lib}/components/AddToCartButton.d.ts +20 -17
  3. package/lib/components/AddToCartButton.js +1 -0
  4. package/{dist → lib}/components/Address.d.ts +13 -12
  5. package/lib/components/Address.js +1 -0
  6. package/{dist → lib}/components/AddressCountrySelector.d.ts +9 -9
  7. package/lib/components/AddressCountrySelector.js +1 -0
  8. package/{dist → lib}/components/AddressField.d.ts +15 -15
  9. package/lib/components/AddressField.js +1 -0
  10. package/{dist → lib}/components/AddressInput.d.ts +7 -7
  11. package/lib/components/AddressInput.js +1 -0
  12. package/{dist → lib}/components/AddressStateSelector.d.ts +11 -9
  13. package/lib/components/AddressStateSelector.js +1 -0
  14. package/{dist → lib}/components/AddressesContainer.d.ts +8 -7
  15. package/lib/components/AddressesContainer.js +1 -0
  16. package/lib/components/AdjustmentAmount.d.ts +4 -0
  17. package/lib/components/AdjustmentAmount.js +1 -0
  18. package/lib/components/AdyenPayment.d.ts +25 -0
  19. package/lib/components/AdyenPayment.js +1 -0
  20. package/{dist → lib}/components/AvailabilityContainer.d.ts +7 -7
  21. package/lib/components/AvailabilityContainer.js +1 -0
  22. package/{dist → lib}/components/AvailabilityTemplate.d.ts +15 -16
  23. package/lib/components/AvailabilityTemplate.js +1 -0
  24. package/{dist → lib}/components/BillingAddressContainer.d.ts +6 -6
  25. package/lib/components/BillingAddressContainer.js +1 -0
  26. package/{dist → lib}/components/BillingAddressForm.d.ts +8 -8
  27. package/lib/components/BillingAddressForm.js +1 -0
  28. package/{dist → lib}/components/BraintreePayment.d.ts +30 -30
  29. package/lib/components/BraintreePayment.js +1 -0
  30. package/{dist → lib}/components/CheckoutLink.d.ts +11 -11
  31. package/lib/components/CheckoutLink.js +1 -0
  32. package/{dist → lib}/components/CommerceLayer.d.ts +8 -9
  33. package/lib/components/CommerceLayer.js +1 -0
  34. package/{dist → lib}/components/CustomerContainer.d.ts +7 -7
  35. package/lib/components/CustomerContainer.js +1 -0
  36. package/{dist → lib}/components/CustomerInput.d.ts +11 -11
  37. package/lib/components/CustomerInput.js +1 -0
  38. package/{dist → lib}/components/DeliveryLeadTime.d.ts +10 -10
  39. package/lib/components/DeliveryLeadTime.js +1 -0
  40. package/{dist → lib}/components/DiscountAmount.d.ts +4 -4
  41. package/lib/components/DiscountAmount.js +1 -0
  42. package/{dist → lib}/components/Errors.d.ts +5 -5
  43. package/lib/components/Errors.js +1 -0
  44. package/{dist → lib}/components/ExternalFunction.d.ts +7 -7
  45. package/lib/components/ExternalFunction.js +1 -0
  46. package/{dist → lib}/components/GiftCard.d.ts +8 -8
  47. package/lib/components/GiftCard.js +1 -0
  48. package/{dist → lib}/components/GiftCardAmount.d.ts +4 -4
  49. package/lib/components/GiftCardAmount.js +1 -0
  50. package/{dist → lib}/components/GiftCardContainer.d.ts +6 -6
  51. package/lib/components/GiftCardContainer.js +1 -0
  52. package/{dist → lib}/components/GiftCardCurrencySelector.d.ts +7 -7
  53. package/lib/components/GiftCardCurrencySelector.js +1 -0
  54. package/{dist → lib}/components/GiftCardInput.d.ts +7 -7
  55. package/lib/components/GiftCardInput.js +1 -0
  56. package/{dist → lib}/components/GiftCardOrCouponCode.d.ts +13 -13
  57. package/lib/components/GiftCardOrCouponCode.js +1 -0
  58. package/{dist → lib}/components/GiftCardOrCouponForm.d.ts +10 -10
  59. package/lib/components/GiftCardOrCouponForm.js +1 -0
  60. package/{dist → lib}/components/GiftCardOrCouponInput.d.ts +8 -8
  61. package/lib/components/GiftCardOrCouponInput.js +1 -0
  62. package/{dist → lib}/components/GiftCardOrCouponRemoveButton.d.ts +16 -16
  63. package/lib/components/GiftCardOrCouponRemoveButton.js +1 -0
  64. package/{dist → lib}/components/GiftCardOrCouponSubmit.d.ts +9 -9
  65. package/lib/components/GiftCardOrCouponSubmit.js +1 -0
  66. package/{dist → lib}/components/GiftCardRecipient.d.ts +0 -0
  67. package/lib/components/GiftCardRecipient.js +1 -0
  68. package/{dist → lib}/components/GiftCardRecipientInput.d.ts +0 -0
  69. package/lib/components/GiftCardRecipientInput.js +1 -0
  70. package/{dist → lib}/components/ItemContainer.d.ts +11 -11
  71. package/lib/components/ItemContainer.js +1 -0
  72. package/{dist → lib}/components/LineItem.d.ts +8 -8
  73. package/lib/components/LineItem.js +1 -0
  74. package/{dist → lib}/components/LineItemAmount.d.ts +7 -7
  75. package/lib/components/LineItemAmount.js +1 -0
  76. package/lib/components/LineItemCode.d.ts +12 -0
  77. package/lib/components/LineItemCode.js +1 -0
  78. package/lib/components/LineItemImage.d.ts +16 -0
  79. package/lib/components/LineItemImage.js +1 -0
  80. package/lib/components/LineItemName.d.ts +11 -0
  81. package/lib/components/LineItemName.js +1 -0
  82. package/{dist → lib}/components/LineItemOption.d.ts +19 -19
  83. package/lib/components/LineItemOption.js +1 -0
  84. package/{dist → lib}/components/LineItemOptions.d.ts +14 -14
  85. package/lib/components/LineItemOptions.js +1 -0
  86. package/{dist → lib}/components/LineItemQuantity.d.ts +14 -14
  87. package/lib/components/LineItemQuantity.js +1 -0
  88. package/{dist → lib}/components/LineItemRemoveLink.d.ts +12 -12
  89. package/lib/components/LineItemRemoveLink.js +1 -0
  90. package/{dist → lib}/components/LineItemsContainer.d.ts +8 -8
  91. package/lib/components/LineItemsContainer.js +1 -0
  92. package/{dist → lib}/components/LineItemsCount.d.ts +12 -10
  93. package/lib/components/LineItemsCount.js +1 -0
  94. package/lib/components/LineItemsEmpty.d.ts +12 -0
  95. package/lib/components/LineItemsEmpty.js +1 -0
  96. package/{dist → lib}/components/MetadataInput.d.ts +5 -5
  97. package/lib/components/MetadataInput.js +1 -0
  98. package/{dist → lib}/components/OrderContainer.d.ts +11 -10
  99. package/lib/components/OrderContainer.js +1 -0
  100. package/{dist → lib}/components/OrderNumber.d.ts +5 -5
  101. package/lib/components/OrderNumber.js +1 -0
  102. package/{dist → lib}/components/OrderStorage.d.ts +8 -8
  103. package/lib/components/OrderStorage.js +1 -0
  104. package/lib/components/PaymentGateway.d.ts +16 -0
  105. package/lib/components/PaymentGateway.js +1 -0
  106. package/{dist → lib}/components/PaymentMethod.d.ts +16 -16
  107. package/lib/components/PaymentMethod.js +1 -0
  108. package/{dist → lib}/components/PaymentMethodAmount.d.ts +4 -4
  109. package/lib/components/PaymentMethodAmount.js +1 -0
  110. package/{dist → lib}/components/PaymentMethodName.d.ts +9 -9
  111. package/lib/components/PaymentMethodName.js +1 -0
  112. package/{dist → lib}/components/PaymentMethodPrice.d.ts +9 -9
  113. package/lib/components/PaymentMethodPrice.js +1 -0
  114. package/{dist → lib}/components/PaymentMethodRadioButton.d.ts +11 -11
  115. package/lib/components/PaymentMethodRadioButton.js +1 -0
  116. package/{dist → lib}/components/PaymentMethodsContainer.d.ts +8 -8
  117. package/lib/components/PaymentMethodsContainer.js +1 -0
  118. package/{dist → lib}/components/PaymentSource.d.ts +19 -18
  119. package/lib/components/PaymentSource.js +1 -0
  120. package/{dist → lib}/components/PaymentSourceBrandIcon.d.ts +15 -15
  121. package/lib/components/PaymentSourceBrandIcon.js +1 -0
  122. package/{dist → lib}/components/PaymentSourceBrandName.d.ts +12 -12
  123. package/lib/components/PaymentSourceBrandName.js +1 -0
  124. package/{dist → lib}/components/PaymentSourceDetail.d.ts +12 -12
  125. package/lib/components/PaymentSourceDetail.js +1 -0
  126. package/{dist → lib}/components/PaymentSourceEditButton.d.ts +9 -9
  127. package/lib/components/PaymentSourceEditButton.js +1 -0
  128. package/{dist → lib}/components/PaypalPayment.d.ts +12 -12
  129. package/lib/components/PaypalPayment.js +1 -0
  130. package/{dist → lib}/components/PlaceOrderButton.d.ts +12 -12
  131. package/lib/components/PlaceOrderButton.js +1 -0
  132. package/{dist → lib}/components/PlaceOrderContainer.d.ts +8 -8
  133. package/lib/components/PlaceOrderContainer.js +1 -0
  134. package/{dist → lib}/components/Price.d.ts +16 -14
  135. package/lib/components/Price.js +1 -0
  136. package/{dist → lib}/components/PricesContainer.d.ts +11 -11
  137. package/lib/components/PricesContainer.js +1 -0
  138. package/{dist → lib}/components/PrivacyAndTermsCheckbox.d.ts +4 -4
  139. package/lib/components/PrivacyAndTermsCheckbox.js +1 -0
  140. package/{dist → lib}/components/QuantitySelector.d.ts +17 -17
  141. package/lib/components/QuantitySelector.js +1 -0
  142. package/{dist → lib}/components/SaveAddressesButton.d.ts +10 -10
  143. package/lib/components/SaveAddressesButton.js +1 -0
  144. package/{dist → lib}/components/SaveCustomerButton.d.ts +13 -13
  145. package/lib/components/SaveCustomerButton.js +1 -0
  146. package/{dist → lib}/components/Shipment.d.ts +8 -8
  147. package/lib/components/Shipment.js +1 -0
  148. package/{dist → lib}/components/ShipmentField.d.ts +12 -12
  149. package/lib/components/ShipmentField.js +1 -0
  150. package/{dist → lib}/components/ShipmentsContainer.d.ts +6 -6
  151. package/lib/components/ShipmentsContainer.js +1 -0
  152. package/{dist → lib}/components/ShippingAddressContainer.d.ts +6 -6
  153. package/lib/components/ShippingAddressContainer.js +1 -0
  154. package/{dist → lib}/components/ShippingAddressForm.d.ts +8 -8
  155. package/lib/components/ShippingAddressForm.js +1 -0
  156. package/{dist → lib}/components/ShippingAmount.d.ts +4 -4
  157. package/lib/components/ShippingAmount.js +1 -0
  158. package/{dist → lib}/components/ShippingMethod.d.ts +8 -8
  159. package/lib/components/ShippingMethod.js +1 -0
  160. package/{dist → lib}/components/ShippingMethodName.d.ts +11 -7
  161. package/lib/components/ShippingMethodName.js +1 -0
  162. package/{dist → lib}/components/ShippingMethodPrice.d.ts +13 -13
  163. package/lib/components/ShippingMethodPrice.js +1 -0
  164. package/lib/components/ShippingMethodRadioButton.d.ts +13 -0
  165. package/lib/components/ShippingMethodRadioButton.js +1 -0
  166. package/{dist → lib}/components/SkuList.d.ts +7 -7
  167. package/lib/components/SkuList.js +1 -0
  168. package/{dist → lib}/components/SkuListsContainer.d.ts +6 -6
  169. package/lib/components/SkuListsContainer.js +1 -0
  170. package/{dist → lib}/components/SkuOption.d.ts +7 -7
  171. package/lib/components/SkuOption.js +1 -0
  172. package/{dist → lib}/components/SkuOptionInput.d.ts +5 -5
  173. package/lib/components/SkuOptionInput.js +1 -0
  174. package/{dist → lib}/components/SkuOptionsContainer.d.ts +7 -7
  175. package/lib/components/SkuOptionsContainer.js +1 -0
  176. package/{dist → lib}/components/StockTransfer.d.ts +6 -6
  177. package/lib/components/StockTransfer.js +1 -0
  178. package/{dist → lib}/components/StockTransferField.d.ts +9 -9
  179. package/lib/components/StockTransferField.js +1 -0
  180. package/{dist → lib}/components/StripePayment.d.ts +18 -18
  181. package/lib/components/StripePayment.js +1 -0
  182. package/{dist → lib}/components/SubTotalAmount.d.ts +4 -4
  183. package/lib/components/SubTotalAmount.js +1 -0
  184. package/{dist → lib}/components/SubmitButton.d.ts +9 -9
  185. package/lib/components/SubmitButton.js +1 -0
  186. package/{dist → lib}/components/TaxesAmount.d.ts +4 -4
  187. package/lib/components/TaxesAmount.js +1 -0
  188. package/{dist → lib}/components/TotalAmount.d.ts +4 -4
  189. package/lib/components/TotalAmount.js +1 -0
  190. package/{dist → lib}/components/VariantSelector.d.ts +29 -27
  191. package/lib/components/VariantSelector.js +1 -0
  192. package/{dist → lib}/components/VariantsContainer.d.ts +8 -8
  193. package/lib/components/VariantsContainer.js +1 -0
  194. package/{dist → lib}/components/WireTransferPayment.d.ts +10 -10
  195. package/lib/components/WireTransferPayment.js +1 -0
  196. package/lib/components/gateways/AdyenGateway.d.ts +5 -0
  197. package/lib/components/gateways/AdyenGateway.js +1 -0
  198. package/lib/components/gateways/BraintreeGateway.d.ts +5 -0
  199. package/lib/components/gateways/BraintreeGateway.js +1 -0
  200. package/lib/components/gateways/PaypalGateway.d.ts +5 -0
  201. package/lib/components/gateways/PaypalGateway.js +1 -0
  202. package/lib/components/gateways/StripeGateway.d.ts +5 -0
  203. package/lib/components/gateways/StripeGateway.js +1 -0
  204. package/lib/components/gateways/WireTransferGateway.d.ts +5 -0
  205. package/lib/components/gateways/WireTransferGateway.js +1 -0
  206. package/lib/components/utils/AddressCardsTemplate.d.ts +27 -0
  207. package/lib/components/utils/AddressCardsTemplate.js +1 -0
  208. package/{dist → lib}/components/utils/BaseField.d.ts +8 -8
  209. package/lib/components/utils/BaseField.js +1 -0
  210. package/lib/components/utils/BaseInput.d.ts +5 -0
  211. package/lib/components/utils/BaseInput.js +1 -0
  212. package/{dist → lib}/components/utils/BaseOrderPrice.d.ts +6 -6
  213. package/lib/components/utils/BaseOrderPrice.js +1 -0
  214. package/{dist → lib}/components/utils/BaseSelect.d.ts +5 -5
  215. package/lib/components/utils/BaseSelect.js +1 -0
  216. package/{dist → lib}/components/utils/Parent.d.ts +8 -8
  217. package/lib/components/utils/Parent.js +1 -0
  218. package/lib/components/utils/PaymentCardsTemplate.d.ts +23 -0
  219. package/lib/components/utils/PaymentCardsTemplate.js +1 -0
  220. package/{dist → lib}/components/utils/PriceTemplate.d.ts +8 -8
  221. package/lib/components/utils/PriceTemplate.js +1 -0
  222. package/{dist → lib}/components/utils/VariantTemplate.d.ts +36 -34
  223. package/lib/components/utils/VariantTemplate.js +1 -0
  224. package/{dist → lib}/components/utils/getAllErrors.d.ts +17 -17
  225. package/lib/components/utils/getAllErrors.js +1 -0
  226. package/{dist → lib}/config/components.d.ts +892 -881
  227. package/lib/config/components.js +1 -0
  228. package/lib/config/currency.d.ts +5 -0
  229. package/lib/config/currency.js +1 -0
  230. package/{dist → lib}/context/AddressChildrenContext.d.ts +7 -7
  231. package/lib/context/AddressChildrenContext.js +1 -0
  232. package/{dist → lib}/context/AddressContext.d.ts +17 -17
  233. package/lib/context/AddressContext.js +1 -0
  234. package/{dist → lib}/context/AvailabilityContext.d.ts +3 -3
  235. package/lib/context/AvailabilityContext.js +1 -0
  236. package/{dist → lib}/context/BillingAddressContext.d.ts +12 -12
  237. package/lib/context/BillingAddressContext.js +1 -0
  238. package/{dist → lib}/context/BillingAddressFormContext.d.ts +19 -18
  239. package/lib/context/BillingAddressFormContext.js +1 -0
  240. package/{dist → lib}/context/CommerceLayerContext.d.ts +7 -8
  241. package/lib/context/CommerceLayerContext.js +1 -0
  242. package/{dist → lib}/context/CouponAndGiftCardFormContext.d.ts +7 -7
  243. package/lib/context/CouponAndGiftCardFormContext.js +1 -0
  244. package/{dist → lib}/context/CustomerContext.d.ts +16 -14
  245. package/lib/context/CustomerContext.js +1 -0
  246. package/{dist → lib}/context/ExternalFunctionContext.d.ts +12 -12
  247. package/lib/context/ExternalFunctionContext.js +1 -0
  248. package/{dist → lib}/context/GiftCardContext.d.ts +11 -11
  249. package/lib/context/GiftCardContext.js +1 -0
  250. package/{dist → lib}/context/ItemContext.d.ts +13 -13
  251. package/lib/context/ItemContext.js +1 -0
  252. package/lib/context/LineItemChildrenContext.d.ts +9 -0
  253. package/lib/context/LineItemChildrenContext.js +1 -0
  254. package/{dist → lib}/context/LineItemContext.d.ts +8 -8
  255. package/lib/context/LineItemContext.js +1 -0
  256. package/{dist → lib}/context/LineItemOptionChildrenContext.d.ts +8 -8
  257. package/lib/context/LineItemOptionChildrenContext.js +1 -0
  258. package/lib/context/OrderContext.d.ts +26 -0
  259. package/lib/context/OrderContext.js +1 -0
  260. package/{dist → lib}/context/OrderStorageContext.d.ts +11 -11
  261. package/lib/context/OrderStorageContext.js +1 -0
  262. package/{dist → lib}/context/PaymentMethodChildrenContext.d.ts +10 -10
  263. package/lib/context/PaymentMethodChildrenContext.js +1 -0
  264. package/{dist → lib}/context/PaymentMethodContext.d.ts +23 -20
  265. package/lib/context/PaymentMethodContext.js +1 -0
  266. package/{dist → lib}/context/PaymentSourceContext.d.ts +14 -14
  267. package/lib/context/PaymentSourceContext.js +1 -0
  268. package/{dist → lib}/context/PlaceOrderContext.d.ts +16 -16
  269. package/lib/context/PlaceOrderContext.js +1 -0
  270. package/{dist → lib}/context/PricesContext.d.ts +7 -7
  271. package/lib/context/PricesContext.js +1 -0
  272. package/lib/context/ShipmentChildrenContext.d.ts +13 -0
  273. package/lib/context/ShipmentChildrenContext.js +1 -0
  274. package/{dist → lib}/context/ShipmentContext.d.ts +12 -12
  275. package/lib/context/ShipmentContext.js +1 -0
  276. package/{dist → lib}/context/ShippingAddressContext.d.ts +10 -10
  277. package/lib/context/ShippingAddressContext.js +1 -0
  278. package/{dist → lib}/context/ShippingAddressFormContext.d.ts +4 -4
  279. package/lib/context/ShippingAddressFormContext.js +1 -0
  280. package/lib/context/ShippingMethodChildrenContext.d.ts +10 -0
  281. package/lib/context/ShippingMethodChildrenContext.js +1 -0
  282. package/lib/context/SkuListsContext.d.ts +6 -0
  283. package/lib/context/SkuListsContext.js +1 -0
  284. package/{dist → lib}/context/SkuOptionChildrenContext.d.ts +8 -8
  285. package/lib/context/SkuOptionChildrenContext.js +1 -0
  286. package/{dist → lib}/context/SkuOptionsContext.d.ts +3 -3
  287. package/lib/context/SkuOptionsContext.js +1 -0
  288. package/{dist → lib}/context/StockTransferChildrenContext.d.ts +7 -7
  289. package/lib/context/StockTransferChildrenContext.js +1 -0
  290. package/{dist → lib}/context/VariantsContext.d.ts +3 -3
  291. package/lib/context/VariantsContext.js +1 -0
  292. package/lib/index.d.ts +99 -0
  293. package/lib/index.js +1 -0
  294. package/{dist → lib}/reducers/AddressReducer.d.ts +59 -57
  295. package/lib/reducers/AddressReducer.js +1 -0
  296. package/lib/reducers/AvailabilityReducer.d.ts +53 -0
  297. package/lib/reducers/AvailabilityReducer.js +1 -0
  298. package/{dist → lib}/reducers/BillingAddressReducer.d.ts +31 -32
  299. package/lib/reducers/BillingAddressReducer.js +1 -0
  300. package/{dist → lib}/reducers/CustomerReducer.d.ts +50 -60
  301. package/lib/reducers/CustomerReducer.js +1 -0
  302. package/{dist → lib}/reducers/GiftCardReducer.d.ts +76 -75
  303. package/lib/reducers/GiftCardReducer.js +1 -0
  304. package/{dist → lib}/reducers/ItemReducer.d.ts +69 -68
  305. package/lib/reducers/ItemReducer.js +1 -0
  306. package/{dist → lib}/reducers/LineItemReducer.d.ts +52 -52
  307. package/lib/reducers/LineItemReducer.js +1 -0
  308. package/lib/reducers/OrderReducer.d.ts +133 -0
  309. package/lib/reducers/OrderReducer.js +1 -0
  310. package/{dist → lib}/reducers/PaymentMethodReducer.d.ts +105 -95
  311. package/lib/reducers/PaymentMethodReducer.js +1 -0
  312. package/{dist → lib}/reducers/PlaceOrderReducer.d.ts +52 -50
  313. package/lib/reducers/PlaceOrderReducer.js +1 -0
  314. package/{dist → lib}/reducers/PriceReducer.d.ts +44 -45
  315. package/lib/reducers/PriceReducer.js +1 -0
  316. package/{dist → lib}/reducers/ShipmentReducer.d.ts +40 -37
  317. package/lib/reducers/ShipmentReducer.js +1 -0
  318. package/{dist → lib}/reducers/ShippingAddressReducer.d.ts +32 -31
  319. package/lib/reducers/ShippingAddressReducer.js +1 -0
  320. package/{dist → lib}/reducers/SkuListsReducer.d.ts +21 -22
  321. package/lib/reducers/SkuListsReducer.js +1 -0
  322. package/{dist → lib}/reducers/SkuOptionsReducer.d.ts +26 -26
  323. package/lib/reducers/SkuOptionsReducer.js +1 -0
  324. package/{dist → lib}/reducers/VariantReducer.d.ts +71 -71
  325. package/lib/reducers/VariantReducer.js +1 -0
  326. package/{dist → lib}/typings/errors.d.ts +42 -40
  327. package/lib/typings/errors.js +1 -0
  328. package/{dist → lib}/typings/index.d.ts +126 -151
  329. package/lib/typings/index.js +1 -0
  330. package/{dist → lib}/utils/PropsType.d.ts +33 -33
  331. package/lib/utils/PropsType.js +1 -0
  332. package/{dist → lib}/utils/addressesManager.d.ts +28 -27
  333. package/lib/utils/addressesManager.js +1 -0
  334. package/{dist → lib}/utils/baseReducer.d.ts +3 -3
  335. package/lib/utils/baseReducer.js +1 -0
  336. package/lib/utils/browserInfo.d.ts +9 -0
  337. package/lib/utils/browserInfo.js +1 -0
  338. package/{dist → lib}/utils/childrenTypes.d.ts +9 -9
  339. package/lib/utils/childrenTypes.js +1 -0
  340. package/lib/utils/countryStateCity.d.ts +9 -0
  341. package/lib/utils/countryStateCity.js +1 -0
  342. package/{dist → lib}/utils/customMessages.d.ts +8 -8
  343. package/lib/utils/customMessages.js +1 -0
  344. package/lib/utils/customerOrderOptions.d.ts +3 -0
  345. package/lib/utils/customerOrderOptions.js +1 -0
  346. package/{dist → lib}/utils/getAmount.d.ts +9 -9
  347. package/lib/utils/getAmount.js +1 -0
  348. package/{dist → lib}/utils/getCurrentItemKey.d.ts +6 -6
  349. package/lib/utils/getCurrentItemKey.js +1 -0
  350. package/lib/utils/getErrors.d.ts +11 -0
  351. package/lib/utils/getErrors.js +1 -0
  352. package/lib/utils/getLineItemsCount.d.ts +12 -0
  353. package/lib/utils/getLineItemsCount.js +1 -0
  354. package/{dist → lib}/utils/getLoaderComponent.d.ts +3 -3
  355. package/lib/utils/getLoaderComponent.js +1 -0
  356. package/lib/utils/getPrices.d.ts +17 -0
  357. package/lib/utils/getPrices.js +1 -0
  358. package/lib/utils/getSdk.d.ts +3 -0
  359. package/lib/utils/getSdk.js +1 -0
  360. package/lib/utils/getSkus.d.ts +3 -0
  361. package/lib/utils/getSkus.js +1 -0
  362. package/{dist → lib}/utils/isEmptyStates.d.ts +1 -1
  363. package/lib/utils/isEmptyStates.js +1 -0
  364. package/{dist → lib}/utils/isJSON.d.ts +1 -1
  365. package/lib/utils/isJSON.js +1 -0
  366. package/lib/utils/jwt.d.ts +27 -0
  367. package/lib/utils/jwt.js +1 -0
  368. package/{dist → lib}/utils/localStorage.d.ts +17 -18
  369. package/lib/utils/localStorage.js +1 -0
  370. package/lib/utils/organization.d.ts +6 -0
  371. package/lib/utils/organization.js +1 -0
  372. package/lib/utils/paypalPayment.d.ts +3 -0
  373. package/lib/utils/paypalPayment.js +1 -0
  374. package/{dist → lib}/utils/promisify.d.ts +1 -1
  375. package/lib/utils/promisify.js +1 -0
  376. package/lib/utils/shipments.d.ts +2 -0
  377. package/lib/utils/shipments.js +1 -0
  378. package/{dist → lib}/utils/validateFormFields.d.ts +22 -19
  379. package/lib/utils/validateFormFields.js +1 -0
  380. package/package.json +98 -84
  381. package/dist/components/CustomerField.d.ts +0 -10
  382. package/dist/components/LineItemImage.d.ts +0 -10
  383. package/dist/components/LineItemName.d.ts +0 -7
  384. package/dist/components/LineItemSkuCode.d.ts +0 -7
  385. package/dist/components/OrderList.d.ts +0 -28
  386. package/dist/components/OrderListRow.d.ts +0 -14
  387. package/dist/components/PaymentGateway.d.ts +0 -11
  388. package/dist/components/ShippingMethodRadioButton.d.ts +0 -9
  389. package/dist/components/utils/BaseInput.d.ts +0 -5
  390. package/dist/context/LineItemChildrenContext.d.ts +0 -7
  391. package/dist/context/OrderContext.d.ts +0 -4
  392. package/dist/context/OrderListChildrenContext.d.ts +0 -14
  393. package/dist/context/ShipmentChildrenContext.d.ts +0 -13
  394. package/dist/context/ShippingMethodChildrenContext.d.ts +0 -9
  395. package/dist/context/SkuListsContext.d.ts +0 -3
  396. package/dist/index.d.ts +0 -90
  397. package/dist/index.js +0 -8
  398. package/dist/react-components.cjs.development.js +0 -12429
  399. package/dist/react-components.cjs.development.js.map +0 -1
  400. package/dist/react-components.cjs.production.min.js +0 -2
  401. package/dist/react-components.cjs.production.min.js.map +0 -1
  402. package/dist/react-components.esm.js +0 -12332
  403. package/dist/react-components.esm.js.map +0 -1
  404. package/dist/reducers/AvailabilityReducer.d.ts +0 -40
  405. package/dist/reducers/OrderReducer.d.ts +0 -131
  406. package/dist/typings/order.d.ts +0 -120
  407. package/dist/utils/countryStateCity.d.ts +0 -9
  408. package/dist/utils/customerOrderOptions.d.ts +0 -4
  409. package/dist/utils/dynamicNaming.d.ts +0 -5
  410. package/dist/utils/getErrorsByCollection.d.ts +0 -11
  411. package/dist/utils/getLineItemsCount.d.ts +0 -6
  412. package/dist/utils/getPrices.d.ts +0 -18
  413. package/dist/utils/getSkus.d.ts +0 -3
  414. package/dist/utils/icons.d.ts +0 -3
  415. package/dist/utils/isDate.d.ts +0 -1
  416. package/dist/utils/paypalPayment.d.ts +0 -3
  417. package/dist/utils/scrollbarWidth.d.ts +0 -1
  418. package/dist/utils/shipments.d.ts +0 -5
@@ -1,151 +1,126 @@
1
- import { Dispatch, ReactNode, RefObject } from 'react';
2
- import PropTypes, { InferProps } from 'prop-types';
3
- import { BaseError } from './errors';
4
- export declare const BC: {
5
- id: PropTypes.Requireable<string>;
6
- className: PropTypes.Requireable<string>;
7
- style: PropTypes.Requireable<object>;
8
- name: PropTypes.Requireable<string>;
9
- };
10
- export declare const PTLoader: PropTypes.Requireable<string | PropTypes.ReactElementLike>;
11
- export declare const BaseSelectComponentPropTypes: {
12
- children: PropTypes.Requireable<(...args: any[]) => any>;
13
- options: PropTypes.Validator<PropTypes.InferProps<{
14
- label: PropTypes.Validator<string>;
15
- value: PropTypes.Validator<string | number>;
16
- selected: PropTypes.Requireable<boolean>;
17
- }>[]>;
18
- placeholder: PropTypes.Requireable<PropTypes.InferProps<{
19
- label: PropTypes.Validator<string>;
20
- value: PropTypes.Validator<string | number>;
21
- }>>;
22
- value: PropTypes.Requireable<string>;
23
- name: PropTypes.Validator<string>;
24
- };
25
- export declare type SelectPlaceholder = Option;
26
- declare type BaseSelectChildrenComponentProps = Omit<BaseSelectComponentProps, 'children'>;
27
- declare type Option = {
28
- label: string;
29
- value: string | number;
30
- disabled?: boolean;
31
- };
32
- export interface BaseSelectComponentProps {
33
- children?: (props: BaseSelectChildrenComponentProps) => ReactNode;
34
- options: Option[];
35
- placeholder?: Option;
36
- value?: string;
37
- className?: string;
38
- required?: boolean;
39
- name: string;
40
- }
41
- export declare const BaseInputComponentPropTypes: {
42
- children: PropTypes.Requireable<(...args: any[]) => any>;
43
- name: PropTypes.Validator<string>;
44
- type: PropTypes.Validator<BaseInputType>;
45
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
46
- placeholder: PropTypes.Requireable<string>;
47
- };
48
- declare type BaseInputChildrenComponentProps = Omit<BaseInputComponentProps, 'children'> & {
49
- handleChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
50
- };
51
- export interface BaseInputComponentProps {
52
- ref?: () => RefObject<any>;
53
- children?: (props: BaseInputChildrenComponentProps) => ReactNode;
54
- name: string;
55
- onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
56
- placeholder?: string;
57
- }
58
- export declare type LineItemType = 'gift_cards' | 'paymentMethods' | 'promotions' | 'shipments' | 'skus';
59
- export declare type GiftCardInputName = 'balanceCents' | 'balanceMaxCents' | 'singleUse' | 'rechargeable' | 'imageUrl' | 'expiresAt' | 'referenceOrigin' | 'email' | 'firstName' | 'lastName' | 'reference';
60
- export declare type AddressInputName = 'billing_address_city' | 'billing_address_company' | 'billing_address_first_name' | 'billing_address_email' | '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';
61
- export declare type AddressCountrySelectName = 'billing_address_country_code' | 'shipping_address_country_code';
62
- export declare type AddressStateSelectName = 'billing_address_state_code' | 'shipping_address_state_code';
63
- export declare type BaseInputType = 'checkbox' | 'date' | 'email' | 'number' | 'tel' | 'text' | 'textarea';
64
- export declare type LoaderType = string | ReactNode;
65
- export declare const BMObject: PropTypes.Requireable<{
66
- [x: string]: string | null | undefined;
67
- }>;
68
- export declare type BaseMetadataObject = {
69
- [key: string]: string | undefined | null;
70
- };
71
- export declare type TimeFormat = 'days' | 'hours';
72
- export declare type BaseComponent = InferProps<typeof BC>;
73
- export interface BaseAction<A = string> {
74
- type: A;
75
- payload: Record<string, any>;
76
- }
77
- export interface BaseState {
78
- [key: string]: any;
79
- errors?: BaseError[];
80
- }
81
- export declare type BaseActionType<T = string> = T[];
82
- export interface BFSetStateContainer<T> {
83
- <P extends T>(param: P): void;
84
- }
85
- export interface BaseReducer {
86
- <S extends BaseState, A extends BaseAction, T extends BaseActionType>(state: S, action: A, type: T): S;
87
- }
88
- export interface BaseUnsetState<A> {
89
- (dispatch: Dispatch<A>): void;
90
- }
91
- export interface BaseMetadata {
92
- [key: string]: string | undefined | null;
93
- }
94
- export declare type BaseFormatPrice = 'formatted' | 'cents' | 'float';
95
- export declare const baseOrderPricePropTypes: {
96
- id: PropTypes.Requireable<string>;
97
- className: PropTypes.Requireable<string>;
98
- style: PropTypes.Requireable<object>;
99
- name: PropTypes.Requireable<string>;
100
- base: PropTypes.Validator<string>;
101
- type: PropTypes.Validator<string>;
102
- children: PropTypes.Requireable<(...args: any[]) => any>;
103
- format: PropTypes.Requireable<BaseFormatPrice>;
104
- };
105
- export declare const baseOrderComponentPricePropTypes: {
106
- id: PropTypes.Requireable<string>;
107
- className: PropTypes.Requireable<string>;
108
- style: PropTypes.Requireable<object>;
109
- name: PropTypes.Requireable<string>;
110
- children: PropTypes.Requireable<(...args: any[]) => any>;
111
- format: PropTypes.Requireable<BaseFormatPrice>;
112
- };
113
- export declare type BasePriceType = 'total' | 'option' | 'unit';
114
- export declare type BaseSelectorType = 'select' | 'radio';
115
- export declare type BaseAmountComponentChildren = Omit<BaseAmountComponent, 'children'>;
116
- export declare type BaseAmountComponent = {
117
- children?: (props: BaseAmountComponentChildren) => ReactNode;
118
- format?: BaseFormatPrice;
119
- price?: string;
120
- priceCents?: number;
121
- labelFree?: string;
122
- } & JSX.IntrinsicElements['span'];
123
- export interface FunctionChildren<P = Record<string, any>> {
124
- (props: P): ReactNode;
125
- }
126
- export declare type Jwt = {
127
- organization: {
128
- id: string;
129
- slug: string;
130
- };
131
- application: {
132
- id: string;
133
- kind: string;
134
- public: boolean;
135
- };
136
- test: boolean;
137
- owner?: {
138
- id: string;
139
- type: string;
140
- };
141
- exp: number;
142
- market: {
143
- id: string[];
144
- price_list_id: string;
145
- stock_location_ids: string[];
146
- geocoder_id: null;
147
- allows_external_prices: boolean;
148
- };
149
- rand: number;
150
- };
151
- export {};
1
+ import { Dispatch, ReactNode, RefObject } from 'react';
2
+ import PropTypes, { InferProps } from 'prop-types';
3
+ import { BaseError } from './errors';
4
+ export declare const BC: {
5
+ id: PropTypes.Requireable<string>;
6
+ className: PropTypes.Requireable<string>;
7
+ style: PropTypes.Requireable<object>;
8
+ name: PropTypes.Requireable<string>;
9
+ };
10
+ export declare const PTLoader: PropTypes.Requireable<string | PropTypes.ReactElementLike>;
11
+ export declare const BaseSelectComponentPropTypes: {
12
+ children: PropTypes.Requireable<(...args: any[]) => any>;
13
+ options: PropTypes.Validator<PropTypes.InferProps<{
14
+ label: PropTypes.Validator<string>;
15
+ value: PropTypes.Validator<string | number>;
16
+ selected: PropTypes.Requireable<boolean>;
17
+ }>[]>;
18
+ placeholder: PropTypes.Requireable<PropTypes.InferProps<{
19
+ label: PropTypes.Validator<string>;
20
+ value: PropTypes.Validator<string | number>;
21
+ }>>;
22
+ value: PropTypes.Requireable<string>;
23
+ name: PropTypes.Validator<string>;
24
+ };
25
+ export declare type SelectPlaceholder = Option;
26
+ declare type BaseSelectChildrenComponentProps = Omit<BaseSelectComponentProps, 'children'>;
27
+ declare type Option = {
28
+ label: string;
29
+ value: string | number;
30
+ disabled?: boolean;
31
+ };
32
+ export interface BaseSelectComponentProps {
33
+ children?: (props: BaseSelectChildrenComponentProps) => ReactNode;
34
+ options: Option[];
35
+ placeholder?: Option;
36
+ value?: string;
37
+ className?: string;
38
+ required?: boolean;
39
+ name: string;
40
+ }
41
+ export declare const BaseInputComponentPropTypes: {
42
+ children: PropTypes.Requireable<(...args: any[]) => any>;
43
+ name: PropTypes.Validator<string>;
44
+ type: PropTypes.Validator<BaseInputType>;
45
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
46
+ placeholder: PropTypes.Requireable<string>;
47
+ };
48
+ declare type BaseInputChildrenComponentProps = Omit<BaseInputComponentProps, 'children'> & {
49
+ handleChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
50
+ };
51
+ export interface BaseInputComponentProps {
52
+ ref?: () => RefObject<any>;
53
+ children?: (props: BaseInputChildrenComponentProps) => ReactNode;
54
+ name: string;
55
+ onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
56
+ placeholder?: string;
57
+ }
58
+ export declare type LineItemType = 'gift_cards' | 'payment_methods' | 'promotions' | 'shipments' | 'skus' | 'bundles' | 'adjustments';
59
+ export declare type GiftCardInputName = 'balanceCents' | 'balanceMaxCents' | 'singleUse' | 'rechargeable' | 'imageUrl' | 'expiresAt' | 'referenceOrigin' | 'email' | 'firstName' | 'lastName' | 'reference';
60
+ export declare type AddressInputName = 'billing_address_city' | 'billing_address_company' | 'billing_address_first_name' | 'billing_address_email' | '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';
61
+ export declare type AddressCountrySelectName = 'billing_address_country_code' | 'shipping_address_country_code';
62
+ export declare type AddressStateSelectName = 'billing_address_state_code' | 'shipping_address_state_code';
63
+ export declare type BaseInputType = 'checkbox' | 'date' | 'email' | 'number' | 'tel' | 'text' | 'textarea';
64
+ export declare type LoaderType = string | ReactNode;
65
+ export declare const BMObject: PropTypes.Requireable<{
66
+ [x: string]: string | null | undefined;
67
+ }>;
68
+ export declare type BaseMetadataObject = {
69
+ [key: string]: string | undefined | null;
70
+ };
71
+ export declare type TimeFormat = 'days' | 'hours';
72
+ export declare type BaseComponent = InferProps<typeof BC>;
73
+ export interface BaseAction<A = string> {
74
+ type: A;
75
+ payload: Record<string, any>;
76
+ }
77
+ export interface BaseState {
78
+ [key: string]: any;
79
+ errors?: BaseError[];
80
+ }
81
+ export declare type BaseActionType<T = string> = T[];
82
+ export interface BFSetStateContainer<T> {
83
+ <P extends T>(param: P): void;
84
+ }
85
+ export interface BaseReducer {
86
+ <S extends BaseState, A extends BaseAction, T extends BaseActionType>(state: S, action: A, type: T): S;
87
+ }
88
+ export interface BaseUnsetState<A> {
89
+ (dispatch: Dispatch<A>): void;
90
+ }
91
+ export interface BaseMetadata {
92
+ [key: string]: string | undefined | null;
93
+ }
94
+ export declare type BaseFormatPrice = 'formatted' | 'cents' | 'float';
95
+ export declare const baseOrderPricePropTypes: {
96
+ id: PropTypes.Requireable<string>;
97
+ className: PropTypes.Requireable<string>;
98
+ style: PropTypes.Requireable<object>;
99
+ name: PropTypes.Requireable<string>;
100
+ base: PropTypes.Validator<string>;
101
+ type: PropTypes.Validator<string>;
102
+ children: PropTypes.Requireable<(...args: any[]) => any>;
103
+ format: PropTypes.Requireable<BaseFormatPrice>;
104
+ };
105
+ export declare const baseOrderComponentPricePropTypes: {
106
+ id: PropTypes.Requireable<string>;
107
+ className: PropTypes.Requireable<string>;
108
+ style: PropTypes.Requireable<object>;
109
+ name: PropTypes.Requireable<string>;
110
+ children: PropTypes.Requireable<(...args: any[]) => any>;
111
+ format: PropTypes.Requireable<BaseFormatPrice>;
112
+ };
113
+ export declare type BasePriceType = 'total' | 'option' | 'unit';
114
+ export declare type BaseSelectorType = 'select' | 'radio';
115
+ export declare type BaseAmountComponentChildren = Omit<BaseAmountComponent, 'children'>;
116
+ export declare type BaseAmountComponent = {
117
+ children?: (props: BaseAmountComponentChildren) => ReactNode;
118
+ format?: BaseFormatPrice;
119
+ price?: string;
120
+ priceCents?: number;
121
+ labelFree?: string;
122
+ } & JSX.IntrinsicElements['span'];
123
+ export interface FunctionChildren<P = Record<string, any>> {
124
+ (props: P): ReactNode;
125
+ }
126
+ export {};
@@ -0,0 +1 @@
1
+ import PropTypes from"prop-types";export const BC={id:PropTypes.string,className:PropTypes.string,style:PropTypes.object,name:PropTypes.string},PTLoader=PropTypes.oneOfType([PropTypes.element,PropTypes.string]),BaseSelectComponentPropTypes={children:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,selected:PropTypes.bool}).isRequired).isRequired,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.string.isRequired},BaseInputComponentPropTypes={children:PropTypes.func,name:PropTypes.string.isRequired,type:PropTypes.oneOf(["text","email","number","date","checkbox","textarea"]).isRequired,onChange:PropTypes.func,placeholder:PropTypes.string},BMObject=PropTypes.objectOf(PropTypes.string),baseOrderPricePropTypes=Object.assign({base:PropTypes.string.isRequired,type:PropTypes.string.isRequired,children:PropTypes.func,format:PropTypes.oneOf(["formatted","cents","float"])},BC),baseOrderComponentPricePropTypes=Object.assign({children:baseOrderPricePropTypes.children,format:baseOrderPricePropTypes.format},BC);
@@ -1,33 +1,33 @@
1
- import PropTypes from 'prop-types';
2
- declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
3
- declare type Defined<T> = T extends undefined ? never : T;
4
- /**
5
- * Get the type that represents the props with the defaultProps included.
6
- *
7
- * Alternatively, we could have done something like this:
8
- * ```
9
- * export type WithDefaultProps<P, DP extends Partial<P>> = Omit<P, keyof DP> &
10
- * Required<Pick<P, Extract<keyof DP, keyof P>>>;
11
- * ```
12
- * But there were usages of `null` in `defaultProps` that would need to be changed to `undefined`
13
- * to meet the `DP extends Partial<P>` constraint.
14
- * So, instead we take the union type in cases when a property in defaultProps does not extend
15
- * the corresponding property in the Props declaration.
16
- */
17
- declare type WithDefaultProps<P, DP> = Omit<P, keyof DP> & {
18
- [K in Extract<keyof DP, keyof P>]: DP[K] extends Defined<P[K]> ? Defined<P[K]> : Defined<P[K]> | DP[K];
19
- };
20
- /**
21
- * Get the props type from propTypes and defaultProps.
22
- *
23
- * Usage:
24
- * ```
25
- * // Without defaultProps
26
- * type Props = PropsType<typeof propTypes>;
27
- *
28
- * // With defaultProps
29
- * type Props = PropsType<typeof propTypes, typeof defaultProps>;
30
- * ```
31
- */
32
- export declare type PropsType<PT, DP = {}> = WithDefaultProps<PropTypes.InferProps<PT>, DP>;
33
- export {};
1
+ import PropTypes from 'prop-types';
2
+ declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
3
+ declare type Defined<T> = T extends undefined ? never : T;
4
+ /**
5
+ * Get the type that represents the props with the defaultProps included.
6
+ *
7
+ * Alternatively, we could have done something like this:
8
+ * ```
9
+ * export type WithDefaultProps<P, DP extends Partial<P>> = Omit<P, keyof DP> &
10
+ * Required<Pick<P, Extract<keyof DP, keyof P>>>;
11
+ * ```
12
+ * But there were usages of `null` in `defaultProps` that would need to be changed to `undefined`
13
+ * to meet the `DP extends Partial<P>` constraint.
14
+ * So, instead we take the union type in cases when a property in defaultProps does not extend
15
+ * the corresponding property in the Props declaration.
16
+ */
17
+ declare type WithDefaultProps<P, DP> = Omit<P, keyof DP> & {
18
+ [K in Extract<keyof DP, keyof P>]: DP[K] extends Defined<P[K]> ? Defined<P[K]> : Defined<P[K]> | DP[K];
19
+ };
20
+ /**
21
+ * Get the props type from propTypes and defaultProps.
22
+ *
23
+ * Usage:
24
+ * ```
25
+ * // Without defaultProps
26
+ * type Props = PropsType<typeof propTypes>;
27
+ *
28
+ * // With defaultProps
29
+ * type Props = PropsType<typeof propTypes, typeof defaultProps>;
30
+ * ```
31
+ */
32
+ export declare type PropsType<PT, DP = {}> = WithDefaultProps<PropTypes.InferProps<PT>, DP>;
33
+ export {};
@@ -0,0 +1 @@
1
+ export{};
@@ -1,27 +1,28 @@
1
- import { BaseError } from "../typings/errors";
2
- declare type BillingAddressController = (params: {
3
- billingAddress?: Record<string, any>;
4
- billingAddressId?: string;
5
- errors?: BaseError[];
6
- requiresBillingInfo?: boolean;
7
- }) => boolean;
8
- export declare const billingAddressController: BillingAddressController;
9
- declare type ShippingAddressController = (params: {
10
- billingDisable: boolean;
11
- errors?: BaseError[];
12
- shipToDifferentAddress?: boolean;
13
- shippingAddress?: Record<string, any>;
14
- shippingAddressId?: string;
15
- }) => boolean;
16
- export declare const shippingAddressController: ShippingAddressController;
17
- declare type CountryLockController = (params: {
18
- addresses?: Record<string, any>[];
19
- billingAddress?: Record<string, any>;
20
- billingAddressId?: string;
21
- countryCodeLock?: string;
22
- shipToDifferentAddress?: boolean;
23
- shippingAddress?: Record<string, any>;
24
- shippingAddressId?: string;
25
- }) => boolean;
26
- export declare const countryLockController: CountryLockController;
27
- export {};
1
+ import { BaseError } from '../typings/errors';
2
+ import { AddressCreate } from '@commercelayer/sdk';
3
+ declare type BillingAddressController = (params: {
4
+ billing_address?: AddressCreate;
5
+ billingAddressId?: string;
6
+ errors?: BaseError[];
7
+ requiresBillingInfo?: boolean;
8
+ }) => boolean;
9
+ export declare const billingAddressController: BillingAddressController;
10
+ declare type ShippingAddressController = (params: {
11
+ billingDisable: boolean;
12
+ errors?: BaseError[];
13
+ shipToDifferentAddress?: boolean;
14
+ shipping_address?: AddressCreate;
15
+ shippingAddressId?: string;
16
+ }) => boolean;
17
+ export declare const shippingAddressController: ShippingAddressController;
18
+ declare type CountryLockController = (params: {
19
+ addresses?: Record<string, any>[];
20
+ billing_address?: Record<string, any>;
21
+ billingAddressId?: string;
22
+ countryCodeLock?: string;
23
+ shipToDifferentAddress?: boolean;
24
+ shipping_address?: Record<string, any>;
25
+ shippingAddressId?: string;
26
+ }) => boolean;
27
+ export declare const countryLockController: CountryLockController;
28
+ export {};
@@ -0,0 +1 @@
1
+ import{isEmpty}from"lodash";import{fieldsExist}from"./validateFormFields";import{addressFields}from"../reducers/AddressReducer";export const billingAddressController=({billing_address,billingAddressId,errors,requiresBillingInfo})=>{let billingDisable=!isEmpty(errors)||isEmpty(billing_address);debugger;if(isEmpty(errors)&&!isEmpty(billing_address)){let billingInfo=[...addressFields];requiresBillingInfo&&(billingInfo=[...billingInfo,"billing_info"]),billingDisable=!!(billing_address&&fieldsExist(billing_address,billingInfo))}return billingDisable&&!isEmpty(billingAddressId)&&isEmpty(billing_address)&&(billingDisable=!1),billingDisable},shippingAddressController=({billingDisable,errors,shipToDifferentAddress,shipping_address,shippingAddressId})=>{let shippingDisable=!!(!billingDisable&&shipToDifferentAddress);return shippingDisable&&isEmpty(errors)&&!isEmpty(shipping_address)&&(shippingDisable=!!(shipping_address&&fieldsExist(shipping_address))),shippingDisable&&!isEmpty(shippingAddressId)&&isEmpty(shipping_address)&&(shippingDisable=!1),shippingDisable},countryLockController=({addresses,billing_address,billingAddressId,countryCodeLock,shipToDifferentAddress,shipping_address,shippingAddressId})=>{if(countryCodeLock&&!isEmpty(addresses)&&billingAddressId&&!shipToDifferentAddress){const addressLocked=addresses==null?void 0:addresses.find(a=>(a.id===billingAddressId||a.reference===billingAddressId)&&a.country_code!==countryCodeLock);if(!isEmpty(addressLocked))return!0}if(countryCodeLock&&!isEmpty(billing_address)&&!shipToDifferentAddress)return(billing_address==null?void 0:billing_address.country_code)!==countryCodeLock;if(countryCodeLock&&!isEmpty(shipping_address)&&shipToDifferentAddress)return(shipping_address==null?void 0:shipping_address.country_code)!==countryCodeLock;if(countryCodeLock&&!isEmpty(addresses)&&shippingAddressId&&shipToDifferentAddress){const addressLocked=addresses==null?void 0:addresses.find(a=>(a.id===shippingAddressId||a.reference===shippingAddressId)&&a.country_code!==countryCodeLock);if(!isEmpty(addressLocked))return!0}return!1};
@@ -1,3 +1,3 @@
1
- import { BaseReducer } from "../typings/index";
2
- declare const baseReducer: BaseReducer;
3
- export default baseReducer;
1
+ import { BaseReducer } from '../typings/index';
2
+ declare const baseReducer: BaseReducer;
3
+ export default baseReducer;
@@ -0,0 +1 @@
1
+ const baseReducer=(state,action,actionTypes)=>{if(actionTypes.indexOf(action.type)!==-1){const data=action.payload;state=Object.assign(Object.assign({},state),data)}return state};export default baseReducer;
@@ -0,0 +1,9 @@
1
+ export default function getBrowserInfo(): {
2
+ screenWidth: string | number;
3
+ screenHeight: string | number;
4
+ colorDepth: string | number;
5
+ userAgent: string;
6
+ timeZoneOffset: number;
7
+ language: string;
8
+ javaEnabled: boolean;
9
+ };
@@ -0,0 +1 @@
1
+ export default function getBrowserInfo(){const screenWidth=window&&window.screen?window.screen.width:"",screenHeight=window&&window.screen?window.screen.height:"",colorDepth=window&&window.screen?window.screen.colorDepth:"",userAgent=window&&window.navigator?window.navigator.userAgent:"",javaEnabled=window&&window.navigator?navigator.javaEnabled():!1;let language="";window&&window.navigator&&(language=window.navigator.language);const timeZoneOffset=new Date().getTimezoneOffset();return{screenWidth,screenHeight,colorDepth,userAgent,timeZoneOffset,language,javaEnabled}}
@@ -1,9 +1,9 @@
1
- import { ReactNode } from 'react';
2
- import { Requireable } from 'prop-types';
3
- export interface CheckChildrenTypes {
4
- (props: {
5
- [key: string]: any;
6
- }, propName: string, componentName: string, location: string, propFullName: string): Error | null;
7
- }
8
- declare const _default: Requireable<ReactNode>;
9
- export default _default;
1
+ import { ReactNode } from 'react';
2
+ import { Requireable } from 'prop-types';
3
+ export interface CheckChildrenTypes {
4
+ (props: {
5
+ [key: string]: any;
6
+ }, propName: string, componentName: string, location: string, propFullName: string): Error | null;
7
+ }
8
+ declare const _default: Requireable<ReactNode>;
9
+ export default _default;
@@ -0,0 +1 @@
1
+ import{isValidElement,Children}from"react";import{isEmpty,isFunction,has,get}from"lodash";import components from"../config/components";const checkChildrenTypes=(props,propName,componentName)=>{let error=null;const children=props[propName],cpName=componentName.replace("CL","");return(isEmpty(children)&&typeof children!="function"||typeof children=="function"&&!children)&&props.isRequired&&(error=new Error(`The prop '${propName}' is marked as required in '${cpName}', but its value is '${children}'.`)),Children.map(children,c=>{if(error)return error;const type=c==null?void 0:c.type,itemTypes=get(components,`${cpName}.permittedChildren`),errorMsg=`Invalid prop '${propName}' supplied to ${cpName}. Only components ${itemTypes.join(", ")} are allowed.`;if(isFunction(type)&&has(type,"displayName")){const displayName=get(type,"displayName"),childComponentName=type.name;displayName&&displayName===`${childComponentName}`&&(itemTypes.includes(childComponentName)||(error=new Error(errorMsg)))}!isValidElement(c)&&c!==null&&(error=new Error(errorMsg))}),error},childrenTypes=checkChildrenTypes;childrenTypes.isRequired=(props,propName,componentName,location,propFullName)=>checkChildrenTypes(Object.assign(Object.assign({},props),{isRequired:!0}),propName,componentName,location,propFullName);export default childrenTypes;
@@ -0,0 +1,9 @@
1
+ export declare function getCountries(): {
2
+ label: string;
3
+ value: string;
4
+ }[];
5
+ export declare function getStateOfCountry(country_code: string): {
6
+ label: string;
7
+ value: string;
8
+ }[];
9
+ export declare function isValidState(state_code: string, country_code: string): boolean;
@@ -0,0 +1 @@
1
+ import{Countries}from"@ac-dev/countries-service";import{States}from"@ac-dev/states-service";export function getCountries(){return Countries.getCountries({sort:{mode:"alphabetical",key:"name"}}).map(({name,iso2})=>({label:name,value:iso2}))}export function getStateOfCountry(country_code){const filters={country_code};return country_code==="IT"&&(filters.is_region=!1),States.getStates({filters,sort:{mode:"alphabetical",key:"name"}}).map(({name,state_code})=>({label:name.replace("Province of",""),value:state_code}))}export function isValidState(state_code,country_code){return States.getStates({filters:{state_code,country_code}}).length>0}
@@ -1,8 +1,8 @@
1
- import { BaseError } from "../typings/errors";
2
- export interface CustomMessages {
3
- (messages: BaseError[], v: BaseError): {
4
- message?: string;
5
- } | null;
6
- }
7
- declare const customMessages: CustomMessages;
8
- export default customMessages;
1
+ import { BaseError } from '../typings/errors';
2
+ export interface CustomMessages {
3
+ (messages: BaseError[], v: BaseError): {
4
+ message?: string;
5
+ } | null;
6
+ }
7
+ declare const customMessages: CustomMessages;
8
+ export default customMessages;
@@ -0,0 +1 @@
1
+ import findIndex from"lodash/findIndex";import pick from"lodash/pick";const customMessages=(messages=[],v)=>{const i=findIndex(messages,pick(v,["field","code","resource"]));return i!==-1?messages[i]:null};export default customMessages;
@@ -0,0 +1,3 @@
1
+ export declare function saveToWallet(): boolean;
2
+ export declare function saveBillingAddress(): boolean;
3
+ export declare function saveShippingAddress(): boolean;
@@ -0,0 +1 @@
1
+ import{getSaveBillingAddressToAddressBook,getSavePaymentSourceToCustomerWallet,getSaveShippingAddressToAddressBook}from"./localStorage";export function saveToWallet(){return getSavePaymentSourceToCustomerWallet()}export function saveBillingAddress(){return getSaveBillingAddressToAddressBook()}export function saveShippingAddress(){return getSaveShippingAddressToAddressBook()}
@@ -1,9 +1,9 @@
1
- export interface GetAmountInterface<T = any> {
2
- (base: string, type: string, format: string, obj: Record<string, any>): T extends number ? number : string;
3
- }
4
- export default function getAmount<T = string>(args: {
5
- base: string;
6
- type: string;
7
- format: string;
8
- obj: Record<string, any>;
9
- }): T extends number ? number : string;
1
+ export interface GetAmountInterface<T = any> {
2
+ (base: string, type: string, format: string, obj: Record<string, any>): T extends number ? number : string;
3
+ }
4
+ export default function getAmount<T = string>(args: {
5
+ base: string;
6
+ type: string;
7
+ format: string;
8
+ obj: Record<string, any>;
9
+ }): T extends number ? number : string;
@@ -0,0 +1 @@
1
+ import{keys}from"lodash";export default function getAmount(args){const{format,type,obj,base}=args;let v;return keys(obj).map(k=>{const key=k.toLowerCase(),typeOne=`${format}_${type}_${base}`.toLowerCase(),typeTwo=`${type}_${base}_${format}`.toLowerCase(),typeThree=`${format}_${base}_${type}`.toLowerCase(),typeFourth=`${base}_${type}_${format}`.toLowerCase();key===typeOne&&(v=obj[k]),key===typeTwo&&(v=obj[k]),key===typeThree&&(v=obj[k]),key===typeFourth&&(v=obj[k])}),v}
@@ -1,6 +1,6 @@
1
- import { Items } from "../reducers/ItemReducer";
2
- export interface GetCurrentItemKey {
3
- (item: Items): string;
4
- }
5
- declare const getCurrentItemKey: GetCurrentItemKey;
6
- export default getCurrentItemKey;
1
+ import { Items } from '../reducers/ItemReducer';
2
+ export interface GetCurrentItemKey {
3
+ (item: Items): string;
4
+ }
5
+ declare const getCurrentItemKey: GetCurrentItemKey;
6
+ export default getCurrentItemKey;
@@ -0,0 +1 @@
1
+ import{first,keys}from"lodash";const getCurrentItemKey=item=>first(keys(item))||"";export default getCurrentItemKey;
@@ -0,0 +1,11 @@
1
+ import { BaseError, ResourceErrorType } from '../typings/errors';
2
+ import { Dispatch } from 'react';
3
+ export default function getErrors(error: any, resource: ResourceErrorType): BaseError[];
4
+ declare type SetErrorsArgs<D> = {
5
+ currentErrors?: BaseError[];
6
+ newErrors?: BaseError[];
7
+ dispatch?: D;
8
+ filterBy?: string;
9
+ };
10
+ export declare function setErrors<D extends Dispatch<any>>({ currentErrors, newErrors, dispatch, filterBy, }: SetErrorsArgs<D>): BaseError[] | void;
11
+ export {};
@@ -0,0 +1 @@
1
+ import differenceBy from"lodash/differenceBy";export default function getErrors(error,resource){var _a;return(_a=error==null?void 0:error.errors)===null||_a===void 0?void 0:_a.map(e=>Object.assign(Object.assign({},e),{resource}))}export function setErrors({currentErrors=[],newErrors=[],dispatch,filterBy="code"}){const errorsDifference=differenceBy(currentErrors,newErrors,filterBy),mergeErrors=(currentErrors==null?void 0:currentErrors.length)===0?newErrors:errorsDifference,errors=[...currentErrors||[],...mergeErrors];if(!dispatch)return errors;dispatch({type:"setErrors",payload:{errors}})}
@@ -0,0 +1,12 @@
1
+ import { LineItem } from '@commercelayer/sdk';
2
+ import { LineItemType } from '../typings/index';
3
+ export interface GetLineItemsCountInterface {
4
+ (args: {
5
+ lineItems: LineItem[];
6
+ quantity?: number;
7
+ typeAccepted?: TypeAccepted[];
8
+ }): number;
9
+ }
10
+ export declare type TypeAccepted = Extract<LineItemType, 'skus' | 'gift_cards' | 'bundles' | 'adjustments'>;
11
+ declare const getLineItemsCount: GetLineItemsCountInterface;
12
+ export default getLineItemsCount;
@@ -0,0 +1 @@
1
+ const getLineItemsCount=({lineItems,quantity=0,typeAccepted=["skus","gift_cards","bundles","adjustments"]})=>(lineItems.filter(l=>l.item_type&&typeAccepted.includes(l.item_type)).forEach(l=>{l.quantity&&(quantity+=l.quantity)}),quantity);export default getLineItemsCount;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- import { LoaderType } from "../typings/index";
3
- export default function getLoaderComponent(Loader: LoaderType): JSX.Element;
1
+ /// <reference types="react" />
2
+ import { LoaderType } from '../typings/index';
3
+ export default function getLoaderComponent(Loader: LoaderType): JSX.Element;
@@ -0,0 +1 @@
1
+ import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";export default function getLoaderComponent(Loader){return typeof Loader=="function"?_jsx(Loader,{},void 0):_jsx(_Fragment,{children:Loader},void 0)}
@@ -0,0 +1,17 @@
1
+ import { Price } from '@commercelayer/sdk';
2
+ import { Prices } from '../reducers/PriceReducer';
3
+ import { Items } from '../reducers/ItemReducer';
4
+ import { ReactNode } from 'react';
5
+ import { PTemplateProps } from '../components/utils/PriceTemplate';
6
+ export interface GetPriceByCode {
7
+ (skuPrices: Price[], code: string): Price | undefined;
8
+ }
9
+ export declare const getPriceByCode: GetPriceByCode;
10
+ export interface GetPricesComponent {
11
+ (skuPrices: Price[], props: PTemplateProps): ReactNode;
12
+ }
13
+ export declare const getPricesComponent: GetPricesComponent;
14
+ export interface GetPrices {
15
+ (prices: Price[] | Items): Prices;
16
+ }
17
+ export default function getPrices<P extends Price>(prices: P[]): Record<string, any>;
@@ -0,0 +1 @@
1
+ import{createElement as _createElement}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{isEmpty,first,isArray,has}from"lodash";import PriceTemplate from"../components/utils/PriceTemplate";export const getPriceByCode=(skuPrices,code="")=>code?first(skuPrices.filter(p=>p.currency_code===code)):first(skuPrices),getPricesComponent=(skuPrices,props)=>isEmpty(skuPrices)?_jsx(PriceTemplate,Object.assign({},props),void 0):skuPrices.map((p,k)=>{const showCompare=typeof props.showCompare=="undefined"&&(p==null?void 0:p.compare_at_amount_cents)>(p==null?void 0:p.amount_cents)||props.showCompare;return _createElement(PriceTemplate,Object.assign({},props,{key:k,showCompare,formattedAmount:p.formatted_amount,formattedCompare:p.formatted_compare_at_amount}))});export default function getPrices(prices){const obj={};return isArray(prices)&&prices.forEach(p=>{const sku=p.sku_code;has(obj,sku)?obj[sku].push(p):obj[sku]=[p]}),obj}