@commercelayer/react-components 2.53.3 → 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +3 -3
  3. package/lib/components/AdyenPayment.d.ts +3 -3
  4. package/lib/components/AdyenPayment.js +1 -1
  5. package/lib/components/AvailabilityContainer.d.ts +10 -3
  6. package/lib/components/AvailabilityContainer.js +1 -1
  7. package/lib/components/AvailabilityTemplate.d.ts +13 -4
  8. package/lib/components/AvailabilityTemplate.js +1 -1
  9. package/lib/components/BillingAddressContainer.d.ts +7 -2
  10. package/lib/components/BillingAddressContainer.js +1 -1
  11. package/lib/components/BillingAddressForm.d.ts +8 -3
  12. package/lib/components/BillingAddressForm.js +1 -1
  13. package/lib/components/BraintreePayment.d.ts +3 -3
  14. package/lib/components/BraintreePayment.js +1 -1
  15. package/lib/components/CheckoutComPayment.d.ts +23 -0
  16. package/lib/components/CheckoutComPayment.js +1 -0
  17. package/lib/components/CheckoutLink.d.ts +16 -4
  18. package/lib/components/CheckoutLink.js +1 -1
  19. package/lib/components/DeliveryLeadTime.d.ts +11 -4
  20. package/lib/components/DeliveryLeadTime.js +1 -1
  21. package/lib/components/DiscountAmount.d.ts +16 -2
  22. package/lib/components/DiscountAmount.js +1 -1
  23. package/lib/components/Errors.d.ts +4 -4
  24. package/lib/components/Errors.js +1 -1
  25. package/lib/components/ExternalFunction.d.ts +9 -2
  26. package/lib/components/ExternalFunction.js +1 -1
  27. package/lib/components/GiftCard.d.ts +13 -3
  28. package/lib/components/GiftCard.js +1 -1
  29. package/lib/components/GiftCardContainer.d.ts +9 -3
  30. package/lib/components/GiftCardContainer.js +1 -1
  31. package/lib/components/GiftCardCurrencySelector.d.ts +18 -3
  32. package/lib/components/GiftCardCurrencySelector.js +1 -1
  33. package/lib/components/GiftCardInput.d.ts +12 -3
  34. package/lib/components/GiftCardInput.js +1 -1
  35. package/lib/components/GiftCardOrCouponCode.d.ts +17 -6
  36. package/lib/components/GiftCardOrCouponCode.js +1 -1
  37. package/lib/components/GiftCardOrCouponForm.d.ts +9 -4
  38. package/lib/components/GiftCardOrCouponForm.js +1 -1
  39. package/lib/components/GiftCardOrCouponInput.d.ts +14 -3
  40. package/lib/components/GiftCardOrCouponInput.js +1 -1
  41. package/lib/components/GiftCardOrCouponRemoveButton.d.ts +15 -5
  42. package/lib/components/GiftCardOrCouponRemoveButton.js +1 -1
  43. package/lib/components/GiftCardOrCouponSubmit.d.ts +11 -4
  44. package/lib/components/GiftCardOrCouponSubmit.js +1 -1
  45. package/lib/components/ItemContainer.d.ts +14 -3
  46. package/lib/components/ItemContainer.js +1 -1
  47. package/lib/components/KlarnaPayment.d.ts +10 -0
  48. package/lib/components/KlarnaPayment.js +1 -0
  49. package/lib/components/LineItem.d.ts +10 -3
  50. package/lib/components/LineItem.js +1 -1
  51. package/lib/components/LineItemAmount.d.ts +16 -3
  52. package/lib/components/LineItemAmount.js +1 -1
  53. package/lib/components/LineItemCode.d.ts +10 -4
  54. package/lib/components/LineItemCode.js +1 -1
  55. package/lib/components/LineItemImage.d.ts +11 -4
  56. package/lib/components/LineItemImage.js +1 -1
  57. package/lib/components/LineItemName.d.ts +11 -5
  58. package/lib/components/LineItemName.js +1 -1
  59. package/lib/components/LineItemOption.d.ts +15 -4
  60. package/lib/components/LineItemOption.js +1 -1
  61. package/lib/components/LineItemOptions.d.ts +8 -3
  62. package/lib/components/LineItemOptions.js +1 -1
  63. package/lib/components/LineItemQuantity.d.ts +16 -4
  64. package/lib/components/LineItemQuantity.js +1 -1
  65. package/lib/components/LineItemRemoveLink.d.ts +15 -5
  66. package/lib/components/LineItemRemoveLink.js +1 -1
  67. package/lib/components/LineItemsContainer.d.ts +15 -3
  68. package/lib/components/LineItemsContainer.js +1 -1
  69. package/lib/components/LineItemsCount.d.ts +14 -4
  70. package/lib/components/LineItemsCount.js +1 -1
  71. package/lib/components/LineItemsEmpty.d.ts +13 -2
  72. package/lib/components/LineItemsEmpty.js +1 -1
  73. package/lib/components/MetadataInput.d.ts +13 -3
  74. package/lib/components/MetadataInput.js +1 -1
  75. package/lib/components/PaymentGateway.d.ts +4 -4
  76. package/lib/components/PaymentGateway.js +1 -1
  77. package/lib/components/PaymentMethod.d.ts +9 -3
  78. package/lib/components/PaymentMethod.js +1 -1
  79. package/lib/components/PaymentMethodAmount.d.ts +16 -2
  80. package/lib/components/PaymentMethodAmount.js +1 -1
  81. package/lib/components/PaymentMethodName.d.ts +10 -4
  82. package/lib/components/PaymentMethodName.js +1 -1
  83. package/lib/components/PaymentMethodPrice.d.ts +15 -4
  84. package/lib/components/PaymentMethodPrice.js +1 -1
  85. package/lib/components/PaymentMethodRadioButton.d.ts +11 -4
  86. package/lib/components/PaymentMethodRadioButton.js +1 -1
  87. package/lib/components/PaymentMethodsContainer.d.ts +9 -3
  88. package/lib/components/PaymentMethodsContainer.js +1 -1
  89. package/lib/components/PaymentSource.d.ts +9 -2
  90. package/lib/components/PaymentSource.js +1 -1
  91. package/lib/components/PaymentSourceBrandIcon.d.ts +14 -4
  92. package/lib/components/PaymentSourceBrandIcon.js +1 -1
  93. package/lib/components/PaymentSourceBrandName.d.ts +11 -4
  94. package/lib/components/PaymentSourceBrandName.js +1 -1
  95. package/lib/components/PaymentSourceDetail.d.ts +8 -2
  96. package/lib/components/PaymentSourceDetail.js +1 -1
  97. package/lib/components/PaymentSourceEditButton.d.ts +9 -2
  98. package/lib/components/PaymentSourceEditButton.js +1 -1
  99. package/lib/components/PaypalPayment.d.ts +2 -2
  100. package/lib/components/PaypalPayment.js +1 -1
  101. package/lib/components/Price.d.ts +15 -3
  102. package/lib/components/Price.js +1 -1
  103. package/lib/components/PricesContainer.d.ts +19 -3
  104. package/lib/components/PricesContainer.js +1 -1
  105. package/lib/components/QuantitySelector.d.ts +19 -5
  106. package/lib/components/QuantitySelector.js +1 -1
  107. package/lib/components/SaveAddressesButton.d.ts +18 -5
  108. package/lib/components/SaveAddressesButton.js +1 -1
  109. package/lib/components/SaveCustomerButton.d.ts +16 -5
  110. package/lib/components/SaveCustomerButton.js +1 -1
  111. package/lib/components/Shipment.d.ts +9 -2
  112. package/lib/components/Shipment.js +1 -1
  113. package/lib/components/ShipmentField.d.ts +11 -4
  114. package/lib/components/ShipmentField.js +1 -1
  115. package/lib/components/ShipmentsContainer.d.ts +9 -3
  116. package/lib/components/ShipmentsContainer.js +1 -1
  117. package/lib/components/ShippingAddressContainer.d.ts +7 -2
  118. package/lib/components/ShippingAddressContainer.js +1 -1
  119. package/lib/components/ShippingAddressForm.d.ts +8 -3
  120. package/lib/components/ShippingAddressForm.js +1 -1
  121. package/lib/components/ShippingAmount.d.ts +13 -2
  122. package/lib/components/ShippingAmount.js +1 -1
  123. package/lib/components/ShippingMethod.d.ts +10 -3
  124. package/lib/components/ShippingMethod.js +1 -1
  125. package/lib/components/ShippingMethodName.d.ts +11 -5
  126. package/lib/components/ShippingMethodName.js +1 -1
  127. package/lib/components/ShippingMethodPrice.d.ts +15 -3
  128. package/lib/components/ShippingMethodPrice.js +1 -1
  129. package/lib/components/ShippingMethodRadioButton.d.ts +11 -5
  130. package/lib/components/ShippingMethodRadioButton.js +1 -1
  131. package/lib/components/StockTransfer.d.ts +9 -3
  132. package/lib/components/StockTransfer.js +1 -1
  133. package/lib/components/StockTransferField.d.ts +9 -8
  134. package/lib/components/StockTransferField.js +1 -1
  135. package/lib/components/StripePayment.d.ts +3 -3
  136. package/lib/components/StripePayment.js +1 -1
  137. package/lib/components/SubmitButton.d.ts +15 -5
  138. package/lib/components/SubmitButton.js +1 -1
  139. package/lib/components/VariantSelector.d.ts +28 -5
  140. package/lib/components/VariantSelector.js +1 -1
  141. package/lib/components/VariantsContainer.d.ts +15 -3
  142. package/lib/components/VariantsContainer.js +1 -1
  143. package/lib/components/WireTransferPayment.d.ts +2 -2
  144. package/lib/components/WireTransferPayment.js +1 -1
  145. package/lib/components/addresses/Address.d.ts +18 -0
  146. package/lib/components/addresses/Address.js +1 -0
  147. package/lib/components/addresses/AddressCountrySelector.d.ts +26 -0
  148. package/lib/components/addresses/AddressCountrySelector.js +1 -0
  149. package/lib/components/addresses/AddressField.d.ts +43 -0
  150. package/lib/components/addresses/AddressField.js +1 -0
  151. package/lib/components/addresses/AddressInput.d.ts +19 -0
  152. package/lib/components/addresses/AddressInput.js +1 -0
  153. package/lib/components/addresses/AddressStateSelector.d.ts +27 -0
  154. package/lib/components/addresses/AddressStateSelector.js +1 -0
  155. package/lib/components/addresses/AddressesContainer.d.ts +15 -0
  156. package/lib/components/addresses/AddressesContainer.js +1 -0
  157. package/lib/components/auth/CommerceLayer.d.ts +15 -0
  158. package/lib/components/auth/CommerceLayer.js +1 -0
  159. package/lib/components/customers/CustomerAddressForm.d.ts +13 -0
  160. package/lib/components/customers/CustomerAddressForm.js +1 -0
  161. package/lib/components/customers/CustomerContainer.d.ts +17 -0
  162. package/lib/components/customers/CustomerContainer.js +1 -0
  163. package/lib/components/customers/CustomerField.d.ts +10 -0
  164. package/lib/components/customers/CustomerField.js +1 -0
  165. package/lib/components/customers/CustomerInput.d.ts +23 -0
  166. package/lib/components/customers/CustomerInput.js +1 -0
  167. package/lib/components/gateways/AdyenGateway.d.ts +2 -2
  168. package/lib/components/gateways/AdyenGateway.js +1 -1
  169. package/lib/components/gateways/BraintreeGateway.d.ts +2 -2
  170. package/lib/components/gateways/BraintreeGateway.js +1 -1
  171. package/lib/components/gateways/CheckoutComGateway.d.ts +5 -0
  172. package/lib/components/gateways/CheckoutComGateway.js +1 -0
  173. package/lib/components/gateways/KlarnaGateway.d.ts +5 -0
  174. package/lib/components/gateways/KlarnaGateway.js +1 -0
  175. package/lib/components/gateways/PaypalGateway.d.ts +3 -3
  176. package/lib/components/gateways/PaypalGateway.js +1 -1
  177. package/lib/components/gateways/StripeGateway.d.ts +2 -2
  178. package/lib/components/gateways/StripeGateway.js +1 -1
  179. package/lib/components/gateways/WireTransferGateway.d.ts +2 -2
  180. package/lib/components/gateways/WireTransferGateway.js +1 -1
  181. package/lib/components/orders/AddToCartButton.d.ts +34 -0
  182. package/lib/components/orders/AddToCartButton.js +1 -0
  183. package/lib/components/orders/AdjustmentAmount.d.ts +18 -0
  184. package/lib/components/orders/AdjustmentAmount.js +1 -0
  185. package/lib/components/orders/CartLink.d.ts +12 -0
  186. package/lib/components/orders/CartLink.js +1 -0
  187. package/lib/components/orders/GiftCardAmount.d.ts +15 -0
  188. package/lib/components/orders/GiftCardAmount.js +1 -0
  189. package/lib/components/orders/OrderContainer.d.ts +26 -0
  190. package/lib/components/orders/OrderContainer.js +1 -0
  191. package/lib/components/orders/OrderList.d.ts +61 -0
  192. package/lib/components/orders/OrderList.js +1 -0
  193. package/lib/components/orders/OrderListRow.d.ts +30 -0
  194. package/lib/components/orders/OrderListRow.js +1 -0
  195. package/lib/components/orders/OrderNumber.d.ts +11 -0
  196. package/lib/components/orders/OrderNumber.js +1 -0
  197. package/lib/components/orders/OrderStorage.d.ts +16 -0
  198. package/lib/components/orders/OrderStorage.js +1 -0
  199. package/lib/components/orders/PlaceOrderButton.d.ts +24 -0
  200. package/lib/components/orders/PlaceOrderButton.js +1 -0
  201. package/lib/components/orders/PlaceOrderContainer.d.ts +14 -0
  202. package/lib/components/orders/PlaceOrderContainer.js +1 -0
  203. package/lib/components/orders/PrivacyAndTermsCheckbox.d.ts +10 -0
  204. package/lib/components/orders/PrivacyAndTermsCheckbox.js +1 -0
  205. package/lib/components/orders/SubTotalAmount.d.ts +18 -0
  206. package/lib/components/orders/SubTotalAmount.js +1 -0
  207. package/lib/components/orders/TaxesAmount.d.ts +18 -0
  208. package/lib/components/orders/TaxesAmount.js +1 -0
  209. package/lib/components/orders/TotalAmount.d.ts +18 -0
  210. package/lib/components/orders/TotalAmount.js +1 -0
  211. package/lib/components/skus/SkuField.d.ts +14 -0
  212. package/lib/components/skus/SkuField.js +1 -0
  213. package/lib/components/skus/SkuList.d.ts +14 -0
  214. package/lib/components/skus/SkuList.js +1 -0
  215. package/lib/components/skus/SkuListsContainer.d.ts +12 -0
  216. package/lib/components/skus/SkuListsContainer.js +1 -0
  217. package/lib/components/skus/SkuOption.d.ts +14 -0
  218. package/lib/components/skus/SkuOption.js +1 -0
  219. package/lib/components/skus/SkuOptionInput.d.ts +15 -0
  220. package/lib/components/skus/SkuOptionInput.js +1 -0
  221. package/lib/components/skus/SkuOptionsContainer.d.ts +14 -0
  222. package/lib/components/skus/SkuOptionsContainer.js +1 -0
  223. package/lib/components/skus/Skus.d.ts +11 -0
  224. package/lib/components/skus/Skus.js +1 -0
  225. package/lib/components/skus/SkusContainer.d.ts +23 -0
  226. package/lib/components/skus/SkusContainer.js +1 -0
  227. package/lib/components/utils/AddressCardsTemplate.d.ts +1 -1
  228. package/lib/components/utils/AddressCardsTemplate.js +1 -1
  229. package/lib/components/utils/BaseField.js +1 -1
  230. package/lib/components/utils/BaseInput.d.ts +1 -1
  231. package/lib/components/utils/BaseInput.js +1 -1
  232. package/lib/components/utils/BaseOrderPrice.js +1 -1
  233. package/lib/components/utils/BaseSelect.js +1 -1
  234. package/lib/components/utils/GenericFieldComponent.d.ts +42 -0
  235. package/lib/components/utils/GenericFieldComponent.js +1 -0
  236. package/lib/components/utils/Parent.d.ts +3 -5
  237. package/lib/components/utils/Parent.js +1 -1
  238. package/lib/components/utils/PaymentCardsTemplate.d.ts +2 -2
  239. package/lib/components/utils/PaymentCardsTemplate.js +1 -1
  240. package/lib/components/utils/PriceTemplate.d.ts +2 -2
  241. package/lib/components/utils/PriceTemplate.js +1 -1
  242. package/lib/components/utils/VariantTemplate.js +1 -1
  243. package/lib/components/utils/getAllErrors.js +1 -1
  244. package/lib/config/components.d.ts +77 -35
  245. package/lib/config/components.js +1 -1
  246. package/lib/context/AddressChildrenContext.d.ts +1 -1
  247. package/lib/context/AddressChildrenContext.js +1 -1
  248. package/lib/context/AddressContext.d.ts +1 -1
  249. package/lib/context/BillingAddressContext.d.ts +2 -4
  250. package/lib/context/BillingAddressContext.js +1 -1
  251. package/lib/context/BillingAddressFormContext.d.ts +17 -10
  252. package/lib/context/CouponAndGiftCardFormContext.d.ts +2 -0
  253. package/lib/context/CustomerAddressFormContext.d.ts +20 -0
  254. package/lib/context/CustomerAddressFormContext.js +1 -0
  255. package/lib/context/CustomerContext.d.ts +17 -11
  256. package/lib/context/CustomerContext.js +1 -1
  257. package/lib/context/OrderContext.d.ts +8 -4
  258. package/lib/context/OrderContext.js +1 -1
  259. package/lib/context/OrderListChildrenContext.d.ts +60 -0
  260. package/lib/context/OrderListChildrenContext.js +1 -0
  261. package/lib/context/PaymentSourceContext.d.ts +4 -4
  262. package/lib/context/PlaceOrderContext.d.ts +4 -2
  263. package/lib/context/ShippingAddressContext.d.ts +1 -1
  264. package/lib/context/SkuChildrenContext.d.ts +9 -0
  265. package/lib/context/SkuChildrenContext.js +1 -0
  266. package/lib/context/SkuContext.d.ts +9 -0
  267. package/lib/context/SkuContext.js +1 -0
  268. package/lib/index.d.ts +101 -90
  269. package/lib/index.js +1 -1
  270. package/lib/reducers/AddressReducer.d.ts +4 -2
  271. package/lib/reducers/AddressReducer.js +1 -1
  272. package/lib/reducers/AvailabilityReducer.d.ts +8 -0
  273. package/lib/reducers/AvailabilityReducer.js +1 -1
  274. package/lib/reducers/BillingAddressReducer.js +1 -1
  275. package/lib/reducers/CustomerReducer.d.ts +98 -17
  276. package/lib/reducers/CustomerReducer.js +1 -1
  277. package/lib/reducers/GiftCardReducer.js +1 -1
  278. package/lib/reducers/LineItemReducer.js +1 -1
  279. package/lib/reducers/OrderReducer.d.ts +24 -8
  280. package/lib/reducers/OrderReducer.js +1 -1
  281. package/lib/reducers/PaymentMethodReducer.d.ts +51 -5
  282. package/lib/reducers/PaymentMethodReducer.js +1 -1
  283. package/lib/reducers/PlaceOrderReducer.d.ts +9 -2
  284. package/lib/reducers/PlaceOrderReducer.js +1 -1
  285. package/lib/reducers/ShipmentReducer.js +1 -1
  286. package/lib/reducers/ShippingAddressReducer.js +1 -1
  287. package/lib/reducers/SkuReducer.d.ts +21 -0
  288. package/lib/reducers/SkuReducer.js +1 -0
  289. package/lib/reducers/VariantReducer.d.ts +1 -0
  290. package/lib/reducers/VariantReducer.js +1 -1
  291. package/lib/typings/errors.d.ts +13 -4
  292. package/lib/typings/errors.js +1 -1
  293. package/lib/typings/index.d.ts +17 -6
  294. package/lib/utils/addressesManager.d.ts +1 -1
  295. package/lib/utils/addressesManager.js +1 -1
  296. package/lib/utils/checkIncludeResource.d.ts +8 -0
  297. package/lib/utils/checkIncludeResource.js +1 -0
  298. package/lib/utils/childrenTypes.d.ts +1 -1
  299. package/lib/utils/childrenTypes.js +1 -1
  300. package/lib/utils/compareObjAttribute.d.ts +7 -0
  301. package/lib/utils/compareObjAttribute.js +1 -0
  302. package/lib/utils/customMessages.d.ts +1 -7
  303. package/lib/utils/customMessages.js +1 -1
  304. package/lib/utils/getCardDetails.d.ts +15 -0
  305. package/lib/utils/getCardDetails.js +1 -0
  306. package/lib/utils/getCartLink.d.ts +7 -0
  307. package/lib/utils/getCartLink.js +1 -0
  308. package/lib/utils/getCurrentItemKey.js +1 -1
  309. package/lib/utils/getErrors.d.ts +1 -1
  310. package/lib/utils/getErrors.js +1 -1
  311. package/lib/utils/getLineItemsCount.d.ts +8 -10
  312. package/lib/utils/getLineItemsCount.js +1 -1
  313. package/lib/utils/getLoaderComponent.js +1 -1
  314. package/lib/utils/getPrices.js +1 -1
  315. package/lib/utils/getSkus.js +1 -1
  316. package/lib/utils/hooks/useExternalScript.d.ts +1 -0
  317. package/lib/utils/hooks/useExternalScript.js +1 -0
  318. package/lib/utils/icons.d.ts +3 -0
  319. package/lib/utils/icons.js +1 -0
  320. package/lib/utils/isDate.d.ts +1 -0
  321. package/lib/utils/isDate.js +1 -0
  322. package/lib/utils/jwt.d.ts +1 -1
  323. package/lib/utils/placeholderImages.d.ts +2 -0
  324. package/lib/utils/placeholderImages.js +1 -0
  325. package/lib/utils/promisify.js +1 -1
  326. package/lib/utils/scrollbarWidth.d.ts +1 -0
  327. package/lib/utils/scrollbarWidth.js +1 -0
  328. package/lib/utils/shipments.d.ts +2 -1
  329. package/lib/utils/shipments.js +1 -1
  330. package/lib/utils/validateFormFields.d.ts +2 -0
  331. package/lib/utils/validateFormFields.js +1 -1
  332. package/package.json +96 -93
  333. package/lib/components/AddToCartButton.d.ts +0 -20
  334. package/lib/components/AddToCartButton.js +0 -1
  335. package/lib/components/Address.d.ts +0 -13
  336. package/lib/components/Address.js +0 -1
  337. package/lib/components/AddressCountrySelector.d.ts +0 -9
  338. package/lib/components/AddressCountrySelector.js +0 -1
  339. package/lib/components/AddressField.d.ts +0 -15
  340. package/lib/components/AddressField.js +0 -1
  341. package/lib/components/AddressInput.d.ts +0 -7
  342. package/lib/components/AddressInput.js +0 -1
  343. package/lib/components/AddressStateSelector.d.ts +0 -11
  344. package/lib/components/AddressStateSelector.js +0 -1
  345. package/lib/components/AddressesContainer.d.ts +0 -7
  346. package/lib/components/AddressesContainer.js +0 -1
  347. package/lib/components/AdjustmentAmount.d.ts +0 -4
  348. package/lib/components/AdjustmentAmount.js +0 -1
  349. package/lib/components/CommerceLayer.d.ts +0 -8
  350. package/lib/components/CommerceLayer.js +0 -1
  351. package/lib/components/CustomerContainer.d.ts +0 -7
  352. package/lib/components/CustomerContainer.js +0 -1
  353. package/lib/components/CustomerInput.d.ts +0 -11
  354. package/lib/components/CustomerInput.js +0 -1
  355. package/lib/components/GiftCardAmount.d.ts +0 -4
  356. package/lib/components/GiftCardAmount.js +0 -1
  357. package/lib/components/OrderContainer.d.ts +0 -11
  358. package/lib/components/OrderContainer.js +0 -1
  359. package/lib/components/OrderNumber.d.ts +0 -5
  360. package/lib/components/OrderNumber.js +0 -1
  361. package/lib/components/OrderStorage.d.ts +0 -8
  362. package/lib/components/OrderStorage.js +0 -1
  363. package/lib/components/PlaceOrderButton.d.ts +0 -12
  364. package/lib/components/PlaceOrderButton.js +0 -1
  365. package/lib/components/PlaceOrderContainer.d.ts +0 -8
  366. package/lib/components/PlaceOrderContainer.js +0 -1
  367. package/lib/components/PrivacyAndTermsCheckbox.d.ts +0 -4
  368. package/lib/components/PrivacyAndTermsCheckbox.js +0 -1
  369. package/lib/components/SkuList.d.ts +0 -7
  370. package/lib/components/SkuList.js +0 -1
  371. package/lib/components/SkuListsContainer.d.ts +0 -6
  372. package/lib/components/SkuListsContainer.js +0 -1
  373. package/lib/components/SkuOption.d.ts +0 -7
  374. package/lib/components/SkuOption.js +0 -1
  375. package/lib/components/SkuOptionInput.d.ts +0 -5
  376. package/lib/components/SkuOptionInput.js +0 -1
  377. package/lib/components/SkuOptionsContainer.d.ts +0 -7
  378. package/lib/components/SkuOptionsContainer.js +0 -1
  379. package/lib/components/SubTotalAmount.d.ts +0 -4
  380. package/lib/components/SubTotalAmount.js +0 -1
  381. package/lib/components/TaxesAmount.d.ts +0 -4
  382. package/lib/components/TaxesAmount.js +0 -1
  383. package/lib/components/TotalAmount.d.ts +0 -4
  384. package/lib/components/TotalAmount.js +0 -1
@@ -1,11 +1,27 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { LoaderType } from '../typings/index';
3
- declare type PricesContainerProps = {
3
+ declare type Props = {
4
4
  children: ReactNode;
5
5
  filters?: object;
6
6
  loader?: LoaderType;
7
7
  perPage?: number;
8
8
  skuCode?: string;
9
9
  };
10
- declare const PricesContainer: FunctionComponent<PricesContainerProps>;
10
+ export declare function PricesContainer(props: Props): JSX.Element;
11
+ export declare namespace PricesContainer {
12
+ var propTypes: {
13
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
14
+ skuCode: import("prop-types").Requireable<string>;
15
+ loader: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
16
+ perPage: import("prop-types").Requireable<number>;
17
+ filters: import("prop-types").Requireable<object>;
18
+ };
19
+ var defaultProps: {
20
+ perPage: number;
21
+ filters: {};
22
+ loader: string;
23
+ skuCode: string;
24
+ };
25
+ var displayName: string;
26
+ }
11
27
  export default PricesContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import getPrices from"../utils/getPrices";import{isEmpty,indexOf,has}from"lodash";import CommerceLayerContext from"../context/CommerceLayerContext";import priceReducer,{unsetPriceState}from"../reducers/PriceReducer";import{priceInitialState,getSkusPrice}from"../reducers/PriceReducer";import PricesContext from"../context/PricesContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";const propTypes=components.PricesContainer.propTypes,defaultProps=components.PricesContainer.defaultProps,displayName=components.PricesContainer.displayName,PricesContainer=props=>{const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=useContext(ItemContext);indexOf(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=getCurrentItemKey(currentItem)||skuCode||itemSkuCode||"",setSkuCodes=skuCodes=>{dispatch({type:"setSkuCodes",payload:{skuCodes}})};useEffect(()=>{if(currentItem&&has(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!isEmpty(items)&&isEmpty(currentItem)){const p=getPrices(items);dispatch({type:"setPrices",payload:{prices:p}})}return(config.accessToken&&isEmpty(currentItem)||config.accessToken&&!has(prices,sCode))&&(state.skuCodes.length>0||skuCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{isEmpty(currentItem)&&unsetPriceState(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length]);const priceValue=Object.assign(Object.assign({},state),{skuCode:sCode,loader,setSkuCodes});return _jsx(PricesContext.Provider,Object.assign({value:priceValue},{children}),void 0)};PricesContainer.propTypes=propTypes,PricesContainer.defaultProps=defaultProps,PricesContainer.displayName=displayName;export default PricesContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import getPrices from"../utils/getPrices";import isEmpty from"lodash/isEmpty";import has from"lodash/has";import indexOf from"lodash/indexOf";import CommerceLayerContext from"../context/CommerceLayerContext";import priceReducer,{unsetPriceState}from"../reducers/PriceReducer";import{priceInitialState,getSkusPrice}from"../reducers/PriceReducer";import PricesContext from"../context/PricesContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuContext from"../context/SkuContext";const propTypes=components.PricesContainer.propTypes,defaultProps=components.PricesContainer.defaultProps,displayName=components.PricesContainer.displayName;export function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{skuCodes}=useContext(SkuContext),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=useContext(ItemContext);indexOf(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode||getCurrentItemKey(currentItem)||itemSkuCode||"",setSkuCodes=skuCodes2=>{dispatch({type:"setSkuCodes",payload:{skuCodes:skuCodes2}})};useEffect(()=>{if(state.skuCodes.length===0&&skuCodes&&skuCodes.length>0&&setSkuCodes(skuCodes),currentItem&&has(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!isEmpty(items)&&isEmpty(currentItem)){const p=getPrices(items);dispatch({type:"setPrices",payload:{prices:p}})}return config.accessToken&&!has(prices,itemSkuCode||sCode)&&(state.skuCodes.length>0||itemSkuCode||sCode)&&getSkusPrice(sCode&&[itemSkuCode||sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),config.accessToken&&isEmpty(currentItem)&&(state.skuCodes.length>0||skuCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{isEmpty(currentItem)&&unsetPriceState(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length,itemSkuCode]);const priceValue=Object.assign(Object.assign({},state),{skuCode:sCode,loader,setSkuCodes});return _jsx(PricesContext.Provider,Object.assign({value:priceValue},{children}))}PricesContainer.propTypes=propTypes,PricesContainer.defaultProps=defaultProps,PricesContainer.displayName=displayName;export default PricesContainer;
@@ -1,11 +1,11 @@
1
- import React, { FunctionComponent } from 'react';
1
+ /// <reference types="react" />
2
2
  import { FunctionChildren } from '../typings/index';
3
- declare type QuantitySelectorChildrenProps = FunctionChildren<Omit<QuantitySelectorProps, 'children'> & {
3
+ declare type ChildrenProps = FunctionChildren<Omit<Props, 'children'> & {
4
4
  handleChange: (event: React.MouseEvent<HTMLInputElement>) => void;
5
5
  handleBlur: (event: React.MouseEvent<HTMLInputElement>) => void;
6
6
  }>;
7
- declare type QuantitySelectorProps = {
8
- children?: QuantitySelectorChildrenProps;
7
+ declare type Props = {
8
+ children?: ChildrenProps;
9
9
  disabled?: boolean;
10
10
  min?: number;
11
11
  max?: number;
@@ -13,5 +13,19 @@ declare type QuantitySelectorProps = {
13
13
  skuCode?: string;
14
14
  skuListId?: string;
15
15
  } & JSX.IntrinsicElements['input'];
16
- declare const QuantitySelector: FunctionComponent<QuantitySelectorProps>;
16
+ export declare function QuantitySelector(props: Props): JSX.Element;
17
+ export declare namespace QuantitySelector {
18
+ var propTypes: {
19
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
20
+ min: import("prop-types").Requireable<number>;
21
+ max: import("prop-types").Requireable<number>;
22
+ value: import("prop-types").Requireable<string>;
23
+ skuCode: import("prop-types").Requireable<string>;
24
+ disabled: import("prop-types").Requireable<boolean>;
25
+ };
26
+ var defaultProps: {
27
+ min: number;
28
+ };
29
+ var displayName: string;
30
+ }
17
31
  export default QuantitySelector;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"./utils/Parent";import{isEmpty,has}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";const propTypes=components.QuantitySelector.propTypes,defaultProps=components.QuantitySelector.defaultProps,displayName=components.QuantitySelector.displayName,QuantitySelector=props=>{var _a,_b,_c;const{skuCode,skuListId,children,min=1,max}=props,p=__rest(props,["skuCode","skuListId","children","min","max"]),{item,setQuantity,items,quantity,prices,skuCode:itemSkuCode}=useContext(ItemContext),{skuLists,listIds}=useContext(SkuListsContext),[value,setValue]=useState(min),[disabled,setDisabled]=useState(!!p.disabled),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:skuCode||getCurrentItemKey(item)||itemSkuCode,inventory=isEmpty(item)?50:(_c=(_b=item[sCode])===null||_b===void 0?void 0:_b.inventory)===null||_c===void 0?void 0:_c.quantity,maxInv=max||inventory;useEffect(()=>{if(setValue(min),(!prices[sCode]||!sCode)&&setDisabled(!0),skuListId&&setDisabled(!1),sCode){const qty=Number(min);setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:qty})),!isEmpty(prices)&&has(prices,sCode)&&setDisabled(!1)}return()=>{setValue(min)}},[item,listIds,prices]);const handleChange=e=>{const qty=Number(e.target.value),valid=Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv);setValue(qty),!isEmpty(skuLists)&&skuListId&&valid?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(qty)})):sCode&&valid&&setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(qty)}))},handleBlur=e=>{const qty=e.target.value;if(!(Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv))){const resetVal=Number(qty)<Number(min)?min:maxInv;setValue(resetVal),!isEmpty(skuLists)&&skuListId?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(resetVal)})):setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(resetVal)}))}},parentProps=Object.assign({min,max:maxInv,disabled,handleChange,handleBlur,value},props);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("input",Object.assign({type:"number",max:maxInv,min,value:value||"",disabled,onChange:handleChange,onBlur:handleBlur},p),void 0)};QuantitySelector.propTypes=propTypes,QuantitySelector.defaultProps=defaultProps,QuantitySelector.displayName=displayName;export default QuantitySelector;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"./utils/Parent";import has from"lodash/has";import isEmpty from"lodash/isEmpty";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.QuantitySelector.propTypes,defaultProps=components.QuantitySelector.defaultProps,displayName=components.QuantitySelector.displayName;export function QuantitySelector(props){var _a,_b,_c;const{skuCode,skuListId,children,min=1,max}=props,p=__rest(props,["skuCode","skuListId","children","min","max"]),{item,setQuantity,items,quantity,prices,skuCode:itemSkuCode}=useContext(ItemContext),{sku}=useContext(SkuChildrenContext),{skuLists,listIds}=useContext(SkuListsContext),defaultVal=p?.value||min,[value,setValue]=useState(defaultVal),[disabled,setDisabled]=useState(!!p.disabled),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:sku?.code||skuCode||getCurrentItemKey(item)||itemSkuCode,inventory=isEmpty(item)?50:(_c=(_b=item[sCode])===null||_b===void 0?void 0:_b.inventory)===null||_c===void 0?void 0:_c.quantity,maxInv=max||inventory;useEffect(()=>{if(setValue(defaultVal),(!prices[sCode]||!sCode)&&setDisabled(!0),skuListId&&setDisabled(!1),sCode&&!quantity[sCode]){const qty=Number(defaultVal);setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:qty})),!isEmpty(prices)&&has(prices,sCode)&&setDisabled(!1)}return()=>{setValue(defaultVal)}},[item,listIds,prices,quantity]);const handleChange=e=>{const qty=Number(e.target.value),valid=Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv);setValue(qty),!isEmpty(skuLists)&&skuListId&&valid?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(qty)})):sCode&&valid&&setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(qty)}))},handleBlur=e=>{const qty=e.target.value;if(!(Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv))){const resetVal=Number(qty)<Number(min)?min:maxInv;resetVal&&setValue(resetVal),!isEmpty(skuLists)&&skuListId?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(resetVal)})):setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(resetVal)}))}},parentProps=Object.assign({min,max:maxInv,disabled,handleChange,handleBlur,value},props);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("input",Object.assign({type:"number",max:maxInv,min,value:value||"",disabled,onChange:handleChange,onBlur:handleBlur},p))}QuantitySelector.propTypes=propTypes,QuantitySelector.defaultProps=defaultProps,QuantitySelector.displayName=displayName;export default QuantitySelector;
@@ -1,10 +1,23 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { FunctionChildren } from '../typings/index';
3
- declare type SaveAddressesButtonChildrenProps = FunctionChildren<Omit<SaveAddressesButtonProps, 'children'>>;
4
- declare type SaveAddressesButtonProps = {
5
- children?: SaveAddressesButtonChildrenProps;
3
+ declare type ChildrenProps = FunctionChildren<Omit<Props, 'children'>>;
4
+ declare type Props = {
5
+ children?: ChildrenProps;
6
6
  label?: string | ReactNode;
7
7
  onClick?: () => void;
8
+ addressId?: string;
8
9
  } & JSX.IntrinsicElements['button'];
9
- declare const SaveAddressesButton: FunctionComponent<SaveAddressesButtonProps>;
10
+ export declare function SaveAddressesButton(props: Props): JSX.Element;
11
+ export declare namespace SaveAddressesButton {
12
+ var propTypes: {
13
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
14
+ label: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
15
+ onClick: import("prop-types").Requireable<(...args: any[]) => any>;
16
+ disabled: import("prop-types").Requireable<boolean>;
17
+ };
18
+ var defaultProps: {
19
+ label: string;
20
+ };
21
+ var displayName: string;
22
+ }
10
23
  export default SaveAddressesButton;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState}from"react";import Parent from"./utils/Parent";import components from"../config/components";import AddressContext from"../context/AddressContext";import{isEmpty}from"lodash";import{billingAddressController,shippingAddressController,countryLockController}from"../utils/addressesManager";import OrderContext from"../context/OrderContext";import CustomerContext from"../context/CustomerContext";import isFunction from"lodash/isFunction";const propTypes=components.SaveAddressesButton.propTypes,defaultProps=components.SaveAddressesButton.defaultProps,displayName=components.SaveAddressesButton.displayName,SaveAddressesButton=props=>{const{children,label="Continue to delivery",resource,disabled=!1,onClick}=props,p=__rest(props,["children","label","resource","disabled","onClick"]),{errors,billing_address,shipToDifferentAddress,shipping_address,saveAddresses,billingAddressId,shippingAddressId}=useContext(AddressContext),{order}=useContext(OrderContext),{addresses,isGuest}=useContext(CustomerContext),[forceDisable,setForceDisable]=useState(disabled),customerEmail=(isGuest===!0||typeof isGuest=="undefined")&&!(order==null?void 0:order.customer_email),billingDisable=billingAddressController({billing_address,errors,billingAddressId,requiresBillingInfo:order==null?void 0:order.requires_billing_info}),shippingDisable=shippingAddressController({billingDisable,errors,shipToDifferentAddress,shipping_address,shippingAddressId}),countryLockDisable=countryLockController({countryCodeLock:order==null?void 0:order.shipping_country_code_lock,addresses,shipToDifferentAddress,billingAddressId,billing_address,shipping_address,shippingAddressId}),disable=disabled||customerEmail||billingDisable||shippingDisable||countryLockDisable,handleClick=async()=>{isEmpty(errors)&&!disable&&(setForceDisable(!0),await saveAddresses(),setForceDisable(!1),onClick&&onClick())},parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("button",Object.assign({type:"button",disabled:disable||forceDisable,onClick:handleClick},p,{children:isFunction(label)?label():label}),void 0)};SaveAddressesButton.propTypes=propTypes,SaveAddressesButton.defaultProps=defaultProps,SaveAddressesButton.displayName=displayName;export default SaveAddressesButton;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState}from"react";import Parent from"./utils/Parent";import components from"../config/components";import AddressContext from"../context/AddressContext";import{shippingAddressController,countryLockController,billingAddressController}from"../utils/addressesManager";import OrderContext from"../context/OrderContext";import CustomerContext from"../context/CustomerContext";import isFunction from"lodash/isFunction";const propTypes=components.SaveAddressesButton.propTypes,defaultProps=components.SaveAddressesButton.defaultProps,displayName=components.SaveAddressesButton.displayName;export function SaveAddressesButton(props){const{children,label="Continue to delivery",resource,disabled=!1,addressId,onClick}=props,p=__rest(props,["children","label","resource","disabled","addressId","onClick"]),{errors,billing_address,shipToDifferentAddress,shipping_address,saveAddresses,billingAddressId,shippingAddressId}=useContext(AddressContext),{order}=useContext(OrderContext),{addresses,isGuest,createCustomerAddress}=useContext(CustomerContext),[forceDisable,setForceDisable]=useState(disabled),customerEmail=(isGuest===!0||typeof isGuest>"u")&&!order?.customer_email,billingDisable=billingAddressController({billing_address,errors,billingAddressId,requiresBillingInfo:order?.requires_billing_info}),shippingDisable=shippingAddressController({billingDisable,errors,shipToDifferentAddress,shipping_address,shippingAddressId}),countryLockDisable=countryLockController({countryCodeLock:order?.shipping_country_code_lock,addresses,shipToDifferentAddress,billingAddressId,billing_address,shipping_address,shippingAddressId}),disable=disabled||customerEmail||billingDisable||shippingDisable||countryLockDisable,handleClick=()=>{if(errors&&Object.keys(errors).length===0&&!disable){if(setForceDisable(!0),order)saveAddresses(addressId);else if(createCustomerAddress&&billing_address){const address=Object.assign({},billing_address);addressId&&(address.id=addressId),createCustomerAddress(address)}setForceDisable(!1),onClick&&onClick()}},parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({type:"button",disabled:disable||forceDisable,onClick:handleClick},p,{children:isFunction(label)?label():label}))}SaveAddressesButton.propTypes=propTypes,SaveAddressesButton.defaultProps=defaultProps,SaveAddressesButton.displayName=displayName;export default SaveAddressesButton;
@@ -1,13 +1,24 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { FunctionChildren } from '../typings/index';
3
3
  declare type ParentProps = {
4
4
  handleClick: () => any;
5
5
  };
6
- declare type SaveAddressesButtonChildrenProps = FunctionChildren<Omit<SaveCustomerButtonProps & ParentProps, 'children'>>;
7
- declare type SaveCustomerButtonProps = {
8
- children?: SaveAddressesButtonChildrenProps;
6
+ declare type ChildrenProps = FunctionChildren<Omit<Props & ParentProps, 'children'>>;
7
+ declare type Props = {
8
+ children?: ChildrenProps;
9
9
  label?: string | ReactNode;
10
10
  onClick?: () => void;
11
11
  } & JSX.IntrinsicElements['button'];
12
- declare const SaveCustomerButton: FunctionComponent<SaveCustomerButtonProps>;
12
+ export declare function SaveCustomerButton(props: Props): JSX.Element;
13
+ export declare namespace SaveCustomerButton {
14
+ var propTypes: {
15
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
16
+ label: import("prop-types").Requireable<string | import("prop-types").ReactElementLike>;
17
+ onClick: import("prop-types").Requireable<(...args: any[]) => any>;
18
+ };
19
+ var defaultProps: {
20
+ label: string;
21
+ };
22
+ var displayName: string;
23
+ }
13
24
  export default SaveCustomerButton;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import{isEmpty}from"lodash";import CustomerContext from"../context/CustomerContext";const propTypes=components.SaveCustomerButton.propTypes,defaultProps=components.SaveCustomerButton.defaultProps,displayName=components.SaveCustomerButton.displayName,SaveCustomerButton=props=>{const{children,label="Save",resource,disabled,onClick}=props,p=__rest(props,["children","label","resource","disabled","onClick"]),{errors,saveCustomerUser,customerEmail}=useContext(CustomerContext),disable=disabled||!isEmpty(errors)||isEmpty(customerEmail),handleClick=async()=>{isEmpty(errors)&&!disable&&(await saveCustomerUser(customerEmail),onClick&&onClick())},parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("button",Object.assign({type:"button",disabled:disable,onClick:handleClick},p,{children:label}),void 0)};SaveCustomerButton.propTypes=propTypes,SaveCustomerButton.defaultProps=defaultProps,SaveCustomerButton.displayName=displayName;export default SaveCustomerButton;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import{isEmpty}from"lodash";import CustomerContext from"../context/CustomerContext";const propTypes=components.SaveCustomerButton.propTypes,defaultProps=components.SaveCustomerButton.defaultProps,displayName=components.SaveCustomerButton.displayName;export function SaveCustomerButton(props){const{children,label="Save",resource,disabled,onClick}=props,p=__rest(props,["children","label","resource","disabled","onClick"]),{errors,saveCustomerUser,customerEmail}=useContext(CustomerContext),disable=disabled||!isEmpty(errors)||isEmpty(customerEmail),handleClick=async()=>{isEmpty(errors)&&!disable&&(saveCustomerUser&&await saveCustomerUser(customerEmail),onClick&&onClick())},parentProps=Object.assign(Object.assign({},p),{label,resource,handleClick,disabled:disable});return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({type:"button",disabled:disable,onClick:void 0},p,{children:label}))}SaveCustomerButton.propTypes=propTypes,SaveCustomerButton.defaultProps=defaultProps,SaveCustomerButton.displayName=displayName;export default SaveCustomerButton;
@@ -1,8 +1,15 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { LoaderType } from '../typings/index';
3
3
  declare type ShipmentProps = {
4
4
  children: ReactNode;
5
5
  loader?: LoaderType;
6
+ autoSelectSingleShippingMethod?: boolean | (() => void);
6
7
  };
7
- declare const Shipment: FunctionComponent<ShipmentProps>;
8
+ export declare function Shipment({ children, loader, autoSelectSingleShippingMethod, }: ShipmentProps): JSX.Element;
9
+ export declare namespace Shipment {
10
+ var propTypes: {
11
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
12
+ };
13
+ var displayName: string;
14
+ }
8
15
  export default Shipment;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useState,useEffect}from"react";import ShipmentContext from"../context/ShipmentContext";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import components from"../config/components";import getLoaderComponent from"../utils/getLoaderComponent";const propTypes=components.Shipment.propTypes,displayName=components.Shipment.displayName,Shipment=({children,loader="Loading..."})=>{const[loading,setLoading]=useState(!0),{shipments,deliveryLeadTimes}=useContext(ShipmentContext);useEffect(()=>(shipments&&setLoading(!1),()=>{setLoading(!0)}),[shipments]);const components2=shipments&&shipments.map((shipment,k)=>{var _a;const shipmentLineItems=shipment.shipment_line_items,lineItems=shipmentLineItems==null?void 0:shipmentLineItems.map(shipmentLineItem=>{const l=shipmentLineItem.line_item;return l&&(l.quantity=shipmentLineItem.quantity),l}),shippingMethods=shipment.available_shipping_methods,currentShippingMethodId=(_a=shipment.shipping_method)===null||_a===void 0?void 0:_a.id,stockTransfers=shipment.stock_transfers,times=deliveryLeadTimes==null?void 0:deliveryLeadTimes.filter(time=>{var _a2,_b;return((_a2=time.stock_location)===null||_a2===void 0?void 0:_a2.id)===((_b=shipment.stock_location)===null||_b===void 0?void 0:_b.id)}),shipmentProps={lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:k+1};return _jsx(ShipmentChildrenContext.Provider,Object.assign({value:shipmentProps},{children}),k)});return loading?getLoaderComponent(loader):_jsx(Fragment,{children:components2},void 0)};Shipment.propTypes=propTypes,Shipment.displayName=displayName;export default Shipment;
1
+ import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShipmentContext from"../context/ShipmentContext";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import components from"../config/components";import getLoaderComponent from"../utils/getLoaderComponent";const propTypes=components.Shipment.propTypes,displayName=components.Shipment.displayName;export function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=useState(!0),{shipments,deliveryLeadTimes,setShippingMethod}=useContext(ShipmentContext);useEffect(()=>{shipments&&(autoSelectSingleShippingMethod?(async()=>await shipments.forEach(async shipment=>{var _a;const isSingle=((_a=shipment?.available_shipping_methods)===null||_a===void 0?void 0:_a.length)===1;if(!shipment?.shipping_method&&isSingle){const[shippingMethod]=shipment?.available_shipping_methods||[];shippingMethod&&await setShippingMethod(shipment.id,shippingMethod.id),typeof autoSelectSingleShippingMethod=="function"&&autoSelectSingleShippingMethod()}else setTimeout(()=>{setLoading(!1)},200)}))():setLoading(!1))},[shipments]);const components2=shipments&&shipments.map((shipment,k)=>{var _a,_b;const shipmentLineItems=shipment.shipment_line_items,lineItems=shipmentLineItems?.map(shipmentLineItem=>{const l=shipmentLineItem.line_item;return l&&(l.quantity=shipmentLineItem.quantity),l}),shippingMethods=shipment.available_shipping_methods,currentShippingMethodId=autoSelectSingleShippingMethod&&shippingMethods&&shippingMethods.length===1?(_a=shippingMethods[0])===null||_a===void 0?void 0:_a.id:(_b=shipment.shipping_method)===null||_b===void 0?void 0:_b.id,stockTransfers=shipment.stock_transfers,times=deliveryLeadTimes?.filter(time=>{var _a2,_b2;return((_a2=time.stock_location)===null||_a2===void 0?void 0:_a2.id)===((_b2=shipment.stock_location)===null||_b2===void 0?void 0:_b2.id)}),shipmentProps={lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:k+1};return _jsx(ShipmentChildrenContext.Provider,Object.assign({value:shipmentProps},{children}),k)});return loading?getLoaderComponent(loader):_jsx(_Fragment,{children:components2})}Shipment.propTypes=propTypes,Shipment.displayName=displayName;export default Shipment;
@@ -1,12 +1,19 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { Shipment } from '@commercelayer/sdk';
3
- declare type ShipmentFieldChildrenProps = Omit<ShipmentFieldProps, 'children'> & {
3
+ declare type ShipmentFieldChildrenProps = Omit<Props, 'children'> & {
4
4
  shipment: Shipment;
5
5
  };
6
6
  export declare type ShipmentAttribute = 'number' | 'currency_code' | 'status' | 'cost_amount_cents' | 'cost_amount_float' | 'formatted_cost_amount' | 'key_number';
7
- declare type ShipmentFieldProps = {
7
+ declare type Props = {
8
8
  children?: (props: ShipmentFieldChildrenProps) => ReactNode;
9
9
  name: ShipmentAttribute;
10
10
  } & JSX.IntrinsicElements['span'];
11
- declare const ShipmentField: FunctionComponent<ShipmentFieldProps>;
11
+ export declare function ShipmentField(props: Props): JSX.Element;
12
+ export declare namespace ShipmentField {
13
+ var propTypes: {
14
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
15
+ name: import("prop-types").Validator<ShipmentAttribute>;
16
+ };
17
+ var displayName: string;
18
+ }
12
19
  export default ShipmentField;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import get from"lodash/get";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";const propTypes=components.ShipmentField.propTypes,displayName=components.ShipmentField.displayName,ShipmentField=props=>{const{name}=props,{shipment,keyNumber}=useContext(ShipmentChildrenContext),key=name,text=key!=="key_number"?get(shipment,key):keyNumber,parentProps=Object.assign({shipment},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("span",Object.assign({},props,{children:text}),void 0)};ShipmentField.propTypes=propTypes,ShipmentField.displayName=displayName;export default ShipmentField;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";import get from"lodash/get";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";const propTypes=components.ShipmentField.propTypes,displayName=components.ShipmentField.displayName;export function ShipmentField(props){const{name}=props,{shipment,keyNumber}=useContext(ShipmentChildrenContext),key=name,text=key!=="key_number"?get(shipment,key):keyNumber,parentProps=Object.assign({shipment},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("span",Object.assign({},props,{children:text}))}ShipmentField.propTypes=propTypes,ShipmentField.displayName=displayName;export default ShipmentField;
@@ -1,6 +1,12 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type ShipmentsContainerProps = {
1
+ import { ReactNode } from 'react';
2
+ declare type Props = {
3
3
  children: ReactNode;
4
4
  };
5
- declare const ShipmentsContainer: FunctionComponent<ShipmentsContainerProps>;
5
+ export declare function ShipmentsContainer(props: Props): JSX.Element;
6
+ export declare namespace ShipmentsContainer {
7
+ var propTypes: {
8
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
9
+ };
10
+ var displayName: string;
11
+ }
6
12
  export default ShipmentsContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName,ShipmentsContainer=props=>{const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{(include==null?void 0:include.includes("shipments.available_shipping_methods"))?(includeLoaded==null?void 0:includeLoaded["shipments.available_shipping_methods"])||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers","shipments.stock_location"]}),order&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order,include,includeLoaded]);const contextValue=Object.assign(Object.assign({},state),{setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})});return _jsx(ShipmentContext.Provider,Object.assign({value:contextValue},{children}),void 0)};ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName;export function ShipmentsContainer(props){const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),order&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order,include,includeLoaded]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type})=>item_type==="skus").map(lineItem=>{var _a,_b,_c,_d;return!!(((_a=lineItem.item)===null||_a===void 0?void 0:_a.do_not_ship)||((_b=lineItem.item)===null||_b===void 0?void 0:_b.do_not_track)||((_d=(_c=lineItem.item)===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity)>=lineItem?.quantity)}).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order?.shipments]);const contextValue=Object.assign(Object.assign({},state),{setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})});return _jsx(ShipmentContext.Provider,Object.assign({value:contextValue},{children}))}ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
@@ -1,6 +1,11 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  declare type Props = {
3
3
  children: ReactNode;
4
4
  };
5
- declare const ShippingAddressContainer: FunctionComponent<Props>;
5
+ export declare function ShippingAddressContainer(props: Props): JSX.Element;
6
+ export declare namespace ShippingAddressContainer {
7
+ var propTypes: {
8
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
9
+ };
10
+ }
6
11
  export default ShippingAddressContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import ShippingAddressContext from"../context/ShippingAddressContext";import{useContext,useEffect,useReducer}from"react";import shippingAddressReducer,{setShippingAddress,shippingAddressInitialState,setShippingCustomerAddressId}from"../reducers/ShippingAddressReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";const propTypes=components.ShippingAddressContainer.propTypes,ShippingAddressContainer=props=>{const{children}=props,[state,dispatch]=useReducer(shippingAddressReducer,shippingAddressInitialState),config=useContext(CommerceLayerContext),{order,updateOrder}=useContext(OrderContext),{setCloneAddress}=useContext(AddressContext);useEffect(()=>(order&&config&&setShippingCustomerAddressId({dispatch,order,setCloneAddress}),()=>{dispatch({type:"cleanup",payload:{}})}),[config,order]);const contextValue=Object.assign(Object.assign({},state),{setShippingAddress:async(id,options)=>{await setShippingAddress(id,{config,dispatch,order,customerAddressId:options==null?void 0:options.customerAddressId}),setCloneAddress(id,"shipping_address")}});return _jsx(ShippingAddressContext.Provider,Object.assign({value:contextValue},{children}),void 0)};ShippingAddressContainer.propTypes=propTypes;export default ShippingAddressContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import ShippingAddressContext from"../context/ShippingAddressContext";import{useContext,useEffect,useReducer}from"react";import shippingAddressReducer,{setShippingAddress,shippingAddressInitialState,setShippingCustomerAddressId}from"../reducers/ShippingAddressReducer";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";const propTypes=components.ShippingAddressContainer.propTypes;export function ShippingAddressContainer(props){const{children}=props,[state,dispatch]=useReducer(shippingAddressReducer,shippingAddressInitialState),config=useContext(CommerceLayerContext),{order}=useContext(OrderContext),{setCloneAddress}=useContext(AddressContext);useEffect(()=>(order&&config&&setShippingCustomerAddressId({dispatch,order,setCloneAddress}),()=>{dispatch({type:"cleanup",payload:{}})}),[config,order]);const contextValue=Object.assign(Object.assign({},state),{setShippingAddress:async(id,options)=>{await setShippingAddress(id,{config,dispatch,order,customerAddressId:options?.customerAddressId}),setCloneAddress(id,"shipping_address")}});return _jsx(ShippingAddressContext.Provider,Object.assign({value:contextValue},{children}))}ShippingAddressContainer.propTypes=propTypes;export default ShippingAddressContainer;
@@ -1,8 +1,13 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type ShippingAddressFormProps = {
1
+ import { ReactNode } from 'react';
2
+ declare type Props = {
3
3
  children: ReactNode;
4
4
  reset?: boolean;
5
5
  errorClassName?: string;
6
6
  } & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
7
- declare const ShippingAddressForm: FunctionComponent<ShippingAddressFormProps>;
7
+ export declare function ShippingAddressForm(props: Props): JSX.Element;
8
+ export declare namespace ShippingAddressForm {
9
+ var propTypes: {
10
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
11
+ };
12
+ }
8
13
  export default ShippingAddressForm;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import AddressesContext from"../context/AddressContext";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import ShippingAddressFormContext from"../context/ShippingAddressFormContext";import{isEmpty}from"lodash";import components from"../config/components";import OrderContext from"../context/OrderContext";import{getSaveShippingAddressToAddressBook}from"../utils/localStorage";const propTypes=components.ShippingAddressForm.propTypes,ShippingAddressForm=props=>{const{children,errorClassName,autoComplete="on",reset=!1}=props,p=__rest(props,["children","errorClassName","autoComplete","reset"]),{validation,values,errors,reset:resetForm}=useRapidForm(),{setAddressErrors,setAddress,shipToDifferentAddress}=useContext(AddressesContext),{saveAddressToCustomerAddressBook,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),ref=useRef(null);useEffect(()=>{var _a,_b,_c;if((include==null?void 0:include.includes("shipping_address"))?(includeLoaded==null?void 0:includeLoaded.shipping_address)||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address"}),isEmpty(errors)){if(!isEmpty(values)&&shipToDifferentAddress){setAddressErrors([],"shipping_address");for(const name in values){const field=values[name];(field==null?void 0:field.value)&&(values[name.replace("shipping_address_","")]=field.value,delete values[name]),(field==null?void 0:field.type)==="checkbox"&&(delete values[name],saveAddressToCustomerAddressBook({type:"shipping_address",value:field.checked}))}setAddress({values,resource:"shipping_address"})}}else{const formErrors=[];for(const fieldName in errors){const{code,message}=errors[fieldName];["shipping_address_state_code"].includes(fieldName)?isEmpty(values.state_code)?delete errors[fieldName]:formErrors.push({code,message,resource:"shipping_address",field:fieldName}):formErrors.push({code,message,resource:"shipping_address",field:fieldName})}shipToDifferentAddress&&setAddressErrors(formErrors,"shipping_address")}const checkboxChecked=((_b=(_a=ref.current)===null||_a===void 0?void 0:_a.querySelector('[name="shipping_address_save_to_customer_book"]'))===null||_b===void 0?void 0:_b.checked)||getSaveShippingAddressToAddressBook();reset&&(!isEmpty(values)||!isEmpty(errors)||checkboxChecked)&&(saveAddressToCustomerAddressBook&&saveAddressToCustomerAddressBook({type:"shipping_address",value:!1}),ref&&((_c=ref.current)===null||_c===void 0||_c.reset(),resetForm({target:ref.current}),setAddressErrors([],"shipping_address"),setAddress({values:{},resource:"shipping_address"})))},[values,errors,shipToDifferentAddress,reset,include,includeLoaded]);const providerValues={values,validation,setValue:(name,value)=>{const field={[name.replace("shipping_address_","")]:value};setAddress({values:Object.assign(Object.assign({},values),field),resource:"shipping_address"})},errorClassName,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return _jsx(ShippingAddressFormContext.Provider,Object.assign({value:providerValues},{children:_jsx("form",Object.assign({ref,autoComplete},p,{children}),void 0)}),void 0)};ShippingAddressForm.propTypes=propTypes;export default ShippingAddressForm;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import AddressesContext from"../context/AddressContext";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import ShippingAddressFormContext from"../context/ShippingAddressFormContext";import{isEmpty}from"lodash";import components from"../config/components";import OrderContext from"../context/OrderContext";import{getSaveShippingAddressToAddressBook}from"../utils/localStorage";import{businessMandatoryField}from"../utils/validateFormFields";const propTypes=components.ShippingAddressForm.propTypes;export function ShippingAddressForm(props){const{children,errorClassName,autoComplete="on",reset=!1}=props,p=__rest(props,["children","errorClassName","autoComplete","reset"]),{validation,values,errors,reset:resetForm}=useRapidForm(),{setAddressErrors,setAddress,shipToDifferentAddress,isBusiness}=useContext(AddressesContext),{saveAddressToCustomerAddressBook,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),ref=useRef(null);useEffect(()=>{var _a,_b,_c,_d,_e;if(include?.includes("shipping_address")?includeLoaded?.shipping_address||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address"}),isEmpty(errors)){if(!isEmpty(values)&&shipToDifferentAddress){setAddressErrors([],"shipping_address");for(const name in values){const field=values[name];businessMandatoryField(name,isBusiness)||delete values[name],(field?.value||field?.required===!1&&field?.type!=="checkbox")&&(values[name.replace("shipping_address_","")]=field.value,delete values[name]),field?.type==="checkbox"&&(delete values[name],saveAddressToCustomerAddressBook({type:"shipping_address",value:field.checked}))}setAddress({values:Object.assign(Object.assign({},values),isBusiness&&{business:isBusiness}),resource:"shipping_address"})}}else{const formErrors=[];for(const fieldName in errors){const code=(_a=errors[fieldName])===null||_a===void 0?void 0:_a.code,message=(_b=errors[fieldName])===null||_b===void 0?void 0:_b.message;["shipping_address_state_code"].includes(fieldName)?isEmpty(values.state_code)?delete errors[fieldName]:formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName}):formErrors.push({code,message:message||"",resource:"shipping_address",field:fieldName})}shipToDifferentAddress&&setAddressErrors(formErrors,"shipping_address")}const checkboxChecked=((_d=(_c=ref.current)===null||_c===void 0?void 0:_c.querySelector('[name="shipping_address_save_to_customer_book"]'))===null||_d===void 0?void 0:_d.checked)||getSaveShippingAddressToAddressBook();reset&&(!isEmpty(values)||!isEmpty(errors)||checkboxChecked)&&(saveAddressToCustomerAddressBook&&saveAddressToCustomerAddressBook({type:"shipping_address",value:!1}),ref&&((_e=ref.current)===null||_e===void 0||_e.reset(),resetForm({target:ref.current}),setAddressErrors([],"shipping_address"),setAddress({values:{},resource:"shipping_address"})))},[values,errors,shipToDifferentAddress,reset,include,includeLoaded,isBusiness]);const providerValues={values,validation,setValue:(name,value)=>{const field={[name.replace("shipping_address_","")]:value};setAddress({values:Object.assign(Object.assign(Object.assign({},values),field),isBusiness&&{business:isBusiness}),resource:"shipping_address"})},errorClassName,errors,resetField:name=>resetForm({currentTarget:ref.current},name)};return _jsx(ShippingAddressFormContext.Provider,Object.assign({value:providerValues},{children:_jsx("form",Object.assign({ref,autoComplete},p,{children}))}))}ShippingAddressForm.propTypes=propTypes;export default ShippingAddressForm;
@@ -1,4 +1,15 @@
1
- import { FunctionComponent } from 'react';
1
+ /// <reference types="react" />
2
2
  import { BaseAmountComponent } from '../typings/index';
3
- declare const ShippingAmount: FunctionComponent<BaseAmountComponent>;
3
+ export declare function ShippingAmount(props: BaseAmountComponent): JSX.Element;
4
+ export declare namespace ShippingAmount {
5
+ var propTypes: {
6
+ id: import("prop-types").Requireable<string>;
7
+ className: import("prop-types").Requireable<string>;
8
+ style: import("prop-types").Requireable<object>;
9
+ name: import("prop-types").Requireable<string>;
10
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
11
+ format: import("prop-types").Requireable<import("../typings/index").BaseFormatPrice>;
12
+ };
13
+ var displayName: string;
14
+ }
4
15
  export default ShippingAmount;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.ShippingAmount.propTypes,displayName=components.ShippingAmount.displayName,ShippingAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"shipping"},props),void 0);ShippingAmount.propTypes=propTypes,ShippingAmount.displayName=displayName;export default ShippingAmount;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.ShippingAmount.propTypes,displayName=components.ShippingAmount.displayName;export function ShippingAmount(props){return _jsx(BaseOrderPrice,Object.assign({base:"amount",type:"shipping"},props))}ShippingAmount.propTypes=propTypes,ShippingAmount.displayName=displayName;export default ShippingAmount;
@@ -1,8 +1,15 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type ShippingMethodProps = {
1
+ import { ReactNode } from 'react';
2
+ declare type Props = {
3
3
  children: ReactNode;
4
4
  readonly?: boolean;
5
5
  emptyText?: string;
6
6
  };
7
- declare const ShippingMethod: FunctionComponent<ShippingMethodProps>;
7
+ export declare function ShippingMethod(props: Props): JSX.Element;
8
+ export declare namespace ShippingMethod {
9
+ var propTypes: {
10
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
11
+ readonly: import("prop-types").Requireable<boolean>;
12
+ };
13
+ var displayName: string;
14
+ }
8
15
  export default ShippingMethod;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import isEmpty from"lodash/isEmpty";const propTypes=components.ShippingMethod.propTypes,displayName=components.ShippingMethod.displayName,ShippingMethod=props=>{const{children,readonly,emptyText="There are not any shipping method available"}=props,{shippingMethods,currentShippingMethodId,deliveryLeadTimes,shipment}=useContext(ShipmentChildrenContext),[items,setItems]=useState([]);useEffect(()=>{const methods=shippingMethods&&shippingMethods.filter(s=>readonly?s.id===currentShippingMethodId:!0).map((shippingMethod,k)=>{const[deliveryLeadTimeForShipment]=deliveryLeadTimes==null?void 0:deliveryLeadTimes.filter(delivery=>{var _a;const deliveryShippingMethodId=(_a=delivery.shipping_method)===null||_a===void 0?void 0:_a.id;return shippingMethod.id===deliveryShippingMethodId}),shippingProps={shipmentId:shipment==null?void 0:shipment.id,shippingMethod,currentShippingMethodId,deliveryLeadTimeForShipment};return _jsx(ShippingMethodChildrenContext.Provider,Object.assign({value:shippingProps},{children}),k)});methods&&setItems(methods)},[currentShippingMethodId,deliveryLeadTimes,shippingMethods]);const components2=!isEmpty(items)&&items||emptyText;return _jsx(Fragment,{children:components2},void 0)};ShippingMethod.propTypes=propTypes,ShippingMethod.displayName=displayName;export default ShippingMethod;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import isEmpty from"lodash/isEmpty";const propTypes=components.ShippingMethod.propTypes,displayName=components.ShippingMethod.displayName;export function ShippingMethod(props){const{children,readonly,emptyText="There are not any shipping method available"}=props,{shippingMethods,currentShippingMethodId,deliveryLeadTimes,shipment}=useContext(ShipmentChildrenContext),[items,setItems]=useState([]);useEffect(()=>{const methods=shippingMethods&&shippingMethods.filter(s=>readonly?s.id===currentShippingMethodId:!0).map((shippingMethod,k)=>{const[deliveryLeadTimeForShipment]=deliveryLeadTimes?.filter(delivery=>{var _a;const deliveryShippingMethodId=(_a=delivery.shipping_method)===null||_a===void 0?void 0:_a.id;return shippingMethod.id===deliveryShippingMethodId}),shippingProps={shipmentId:shipment?.id,shippingMethod,currentShippingMethodId,deliveryLeadTimeForShipment};return _jsx(ShippingMethodChildrenContext.Provider,Object.assign({value:shippingProps},{children}),k)});methods&&setItems(methods)},[currentShippingMethodId,deliveryLeadTimes,shippingMethods]);const components2=!isEmpty(items)&&items||emptyText;return _jsx(Fragment,{children:components2})}ShippingMethod.propTypes=propTypes,ShippingMethod.displayName=displayName;export default ShippingMethod;
@@ -1,11 +1,17 @@
1
- import { FunctionComponent, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { ShippingMethod } from '@commercelayer/sdk';
3
- declare type LineItemNameChildrenProps = Omit<LineItemNameProps, 'children'> & {
3
+ declare type ChildrenProps = Omit<Props, 'children'> & {
4
4
  label: string;
5
5
  shippingMethod: ShippingMethod;
6
6
  };
7
- declare type LineItemNameProps = {
8
- children?: (props: LineItemNameChildrenProps) => ReactNode;
7
+ declare type Props = {
8
+ children?: (props: ChildrenProps) => ReactNode;
9
9
  } & JSX.IntrinsicElements['label'];
10
- declare const ShippingMethodName: FunctionComponent<LineItemNameProps>;
10
+ export declare function ShippingMethodName(props: Props): JSX.Element;
11
+ export declare namespace ShippingMethodName {
12
+ var propTypes: {
13
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
14
+ };
15
+ var displayName: string;
16
+ }
11
17
  export default ShippingMethodName;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.ShippingMethodName.propTypes,displayName=components.ShippingMethodName.displayName,ShippingMethodName=props=>{const{shippingMethod,deliveryLeadTimeForShipment,shipmentId}=useContext(ShippingMethodChildrenContext),htmlFor=`shipment-${shipmentId}-${shippingMethod==null?void 0:shippingMethod.id}`||"",labelName=shippingMethod==null?void 0:shippingMethod.name,parentProps=Object.assign({shippingMethod,deliveryLeadTimeForShipment,label:labelName,htmlFor},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("label",Object.assign({htmlFor},props,{children:labelName}),void 0)};ShippingMethodName.propTypes=propTypes,ShippingMethodName.displayName=displayName;export default ShippingMethodName;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.ShippingMethodName.propTypes,displayName=components.ShippingMethodName.displayName;export function ShippingMethodName(props){const{shippingMethod,deliveryLeadTimeForShipment,shipmentId}=useContext(ShippingMethodChildrenContext),htmlFor=`shipment-${shipmentId}-${shippingMethod?.id}`||"",labelName=shippingMethod?.name,parentProps=Object.assign({shippingMethod,deliveryLeadTimeForShipment,label:labelName,htmlFor},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("label",Object.assign({htmlFor},props,{children:labelName}))}ShippingMethodName.propTypes=propTypes,ShippingMethodName.displayName=displayName;export default ShippingMethodName;
@@ -1,6 +1,6 @@
1
- import { FunctionComponent } from 'react';
1
+ /// <reference types="react" />
2
2
  import { BaseAmountComponent } from '../typings/index';
3
- export declare type ShippingMethodPriceProps = BaseAmountComponent & {
3
+ declare type Props = BaseAmountComponent & {
4
4
  labelFreeOver?: string;
5
5
  } & ({
6
6
  type?: 'amount';
@@ -9,5 +9,17 @@ export declare type ShippingMethodPriceProps = BaseAmountComponent & {
9
9
  type?: 'amount' | 'amountForShipment';
10
10
  base?: 'price';
11
11
  });
12
- declare const ShippingMethodPrice: FunctionComponent<ShippingMethodPriceProps>;
12
+ export declare function ShippingMethodPrice(props: Props): JSX.Element;
13
+ export declare namespace ShippingMethodPrice {
14
+ var propTypes: {
15
+ type: import("prop-types").Requireable<"amount">;
16
+ id: import("prop-types").Requireable<string>;
17
+ className: import("prop-types").Requireable<string>;
18
+ style: import("prop-types").Requireable<object>;
19
+ name: import("prop-types").Requireable<string>;
20
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
21
+ format: import("prop-types").Requireable<import("../typings/index").BaseFormatPrice>;
22
+ };
23
+ var displayName: string;
24
+ }
13
25
  export default ShippingMethodPrice;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import OrderContext from"../context/OrderContext";import{isNumber}from"lodash";const propTypes=components.ShippingMethodPrice.propTypes,displayName=components.ShippingMethodPrice.displayName,ShippingMethodPrice=props=>{const{format="formatted",type="amount",base="price",labelFreeOver="Free"}=props,p=__rest(props,["format","type","base","labelFreeOver"]),{shippingMethod}=useContext(ShippingMethodChildrenContext),{order}=useContext(OrderContext),[price,setPrice]=useState(""),[freeOverAmountCents,setFreeOverAmountCents]=useState(0);useEffect(()=>{if(shippingMethod){const p2=getAmount({base,type,format,obj:shippingMethod});setPrice(p2);const c=getAmount({base:"freeOver",type,format:"cents",obj:shippingMethod});setFreeOverAmountCents(c)}return()=>{setPrice(""),setFreeOverAmountCents(0)}},[shippingMethod]);const parentProps=Object.assign({price},p);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("span",Object.assign({},p,{children:(order==null?void 0:order.total_amount_cents)&&isNumber(freeOverAmountCents)&&freeOverAmountCents<order.total_amount_cents?labelFreeOver:price}),void 0)};ShippingMethodPrice.propTypes=propTypes,ShippingMethodPrice.displayName=displayName;export default ShippingMethodPrice;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../utils/getAmount";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.ShippingMethodPrice.propTypes,displayName=components.ShippingMethodPrice.displayName;export function ShippingMethodPrice(props){const{base="price_amount",type="for_shipment",format="formatted",labelFreeOver="Free"}=props,p=__rest(props,["base","type","format","labelFreeOver"]),{shippingMethod}=useContext(ShippingMethodChildrenContext),[price,setPrice]=useState(""),[priceCents,setPriceCents]=useState(0);useEffect(()=>{if(shippingMethod){const p2=getAmount({base,type,format,obj:shippingMethod});setPrice(p2);const pCents=getAmount({base:"price_amount",type:"for_shipment",format:"cents",obj:shippingMethod});setPriceCents(pCents)}return()=>{setPrice(""),setPriceCents(0)}},[shippingMethod]);const parentProps=Object.assign({price},p),finalPrice=priceCents===0?labelFreeOver:price;return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("span",Object.assign({},p,{children:finalPrice}))}ShippingMethodPrice.propTypes=propTypes,ShippingMethodPrice.displayName=displayName;export default ShippingMethodPrice;
@@ -1,13 +1,19 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { ShippingMethod } from '@commercelayer/sdk';
3
- export declare type ShippingMethodRadioButtonType = Omit<ShippingMethodRadioButtonProps, 'children'> & {
1
+ import { ReactNode } from 'react';
2
+ import type { ShippingMethod } from '@commercelayer/sdk';
3
+ export declare type ShippingMethodRadioButtonType = Omit<Props, 'children'> & {
4
4
  shippingMethod: ShippingMethod;
5
5
  shipmentId: string;
6
6
  };
7
7
  export declare type ShippingMethodRadioButtonOnChangeType = (shippingMethod: ShippingMethod, shipmentId: string) => void;
8
- declare type ShippingMethodRadioButtonProps = {
8
+ declare type Props = {
9
9
  children?: (props: ShippingMethodRadioButtonType) => ReactNode;
10
10
  onChange?: ShippingMethodRadioButtonOnChangeType;
11
11
  } & Omit<JSX.IntrinsicElements['input'], 'onChange'>;
12
- declare const ShippingMethodRadioButton: FunctionComponent<ShippingMethodRadioButtonProps>;
12
+ export declare function ShippingMethodRadioButton(props: Props): JSX.Element;
13
+ export declare namespace ShippingMethodRadioButton {
14
+ var propTypes: {
15
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
16
+ };
17
+ var displayName: string;
18
+ }
13
19
  export default ShippingMethodRadioButton;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import ShipmentContext from"../context/ShipmentContext";const propTypes=components.ShippingMethodRadioButton.propTypes,displayName=components.ShippingMethodRadioButton.displayName,ShippingMethodRadioButton=props=>{const{onChange}=props,p=__rest(props,["onChange"]),{shippingMethod,currentShippingMethodId,shipmentId}=useContext(ShippingMethodChildrenContext),{setShippingMethod}=useContext(ShipmentContext),shippingMethodId=shippingMethod==null?void 0:shippingMethod.id,name=`shipment-${shipmentId}`,id=`${name}-${shippingMethodId}`,checked=shippingMethodId===currentShippingMethodId,handleOnChange=async()=>{shipmentId&&(shippingMethodId&&await setShippingMethod(shipmentId,shippingMethodId),shippingMethod&&onChange&&onChange(shippingMethod,shipmentId))},parentProps=Object.assign({shippingMethod,shipmentId,handleOnChange,name,id},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("input",Object.assign({type:"radio",name,id,onChange:handleOnChange,defaultChecked:checked},p),void 0)};ShippingMethodRadioButton.propTypes=propTypes,ShippingMethodRadioButton.displayName=displayName;export default ShippingMethodRadioButton;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";import ShipmentContext from"../context/ShipmentContext";const propTypes=components.ShippingMethodRadioButton.propTypes,displayName=components.ShippingMethodRadioButton.displayName;export function ShippingMethodRadioButton(props){const{onChange}=props,p=__rest(props,["onChange"]),[checked,setChecked]=useState(!1),{shippingMethod,currentShippingMethodId,shipmentId}=useContext(ShippingMethodChildrenContext),{setShippingMethod}=useContext(ShipmentContext),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId}`,id=`${name}-${shippingMethodId}`;useEffect(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId]);const handleOnChange=async()=>{shipmentId&&shippingMethodId&&(setChecked(!0),await setShippingMethod(shipmentId,shippingMethodId),shippingMethod&&onChange&&onChange(shippingMethod,shipmentId))},parentProps=Object.assign({shippingMethod,shipmentId,handleOnChange,name,id},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("input",Object.assign({type:"radio",name,id,onChange:handleOnChange,checked},p))}ShippingMethodRadioButton.propTypes=propTypes,ShippingMethodRadioButton.displayName=displayName;export default ShippingMethodRadioButton;
@@ -1,6 +1,12 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type StockTransferProps = {
1
+ import { ReactNode } from 'react';
2
+ declare type Props = {
3
3
  children: ReactNode;
4
4
  } & JSX.IntrinsicElements['p'];
5
- declare const StockTransfer: FunctionComponent<StockTransferProps>;
5
+ export declare function StockTransfer(props: Props): JSX.Element;
6
+ export declare namespace StockTransfer {
7
+ var propTypes: {
8
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
9
+ };
10
+ var displayName: string;
11
+ }
6
12
  export default StockTransfer;
@@ -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,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
+ import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes,displayName=components.StockTransfer.displayName;export function StockTransfer(props){const{children}=props,{stockTransfers,lineItems}=useContext(ShipmentChildrenContext),components2=stockTransfers?.filter(st=>!!lineItems?.find(l=>l.sku_code!==st.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer:stockTransfer.type==="line_items"?stockTransfer:stockTransfer?.line_item};return _jsx(StockTransferChildrenContext.Provider,Object.assign({value:stockTransferProps},{children}),k)});return _jsx(_Fragment,{children:components2})}StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName;export default StockTransfer;
@@ -1,9 +1,10 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type StockTransferFieldChildrenProps = Omit<StockTransferFieldProps, 'children'>;
3
- export declare type StockTransferFieldType = 'quantity' | 'sku_code';
4
- declare type StockTransferFieldProps = {
5
- children?: (props: StockTransferFieldChildrenProps) => ReactNode;
6
- type: StockTransferFieldType;
7
- } & JSX.IntrinsicElements['p'];
8
- declare const StockTransferField: FunctionComponent<StockTransferFieldProps>;
1
+ /// <reference types="react" />
2
+ import { ConditionalElement } from '../typings/index';
3
+ import { TGenericChildrenProps, TResources } from './utils/GenericFieldComponent';
4
+ declare type StockTransferFieldChildrenProps = TGenericChildrenProps<TResources['StockTransfer']>;
5
+ declare type TCondition = ConditionalElement<Exclude<TResources['StockTransfer'], 'resource'>>;
6
+ declare type Props = {
7
+ children?: (props: StockTransferFieldChildrenProps) => JSX.Element;
8
+ } & TCondition;
9
+ export declare function StockTransferField<P extends Props>(props: P): JSX.Element;
9
10
  export default StockTransferField;
@@ -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,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
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import GenericFieldComponent from"./utils/GenericFieldComponent";export function StockTransferField(props){const{attribute,tagElement,children}=props,p=__rest(props,["attribute","tagElement","children"]);return _jsx(GenericFieldComponent,Object.assign({resource:"stock_transfers",attribute,tagElement,context:StockTransferChildrenContext},p,{children}))}export default StockTransferField;
@@ -1,4 +1,4 @@
1
- import { FunctionComponent } from 'react';
1
+ /// <reference types="react" />
2
2
  import { StripeCardElementOptions, StripeElementLocale } from '@stripe/stripe-js';
3
3
  import { PaymentMethodConfig } from '../reducers/PaymentMethodReducer';
4
4
  import { PaymentSourceProps } from './PaymentSource';
@@ -9,10 +9,10 @@ export declare type StripeConfig = {
9
9
  options?: StripeCardElementOptions;
10
10
  [key: string]: any;
11
11
  };
12
- declare type StripePaymentProps = PaymentMethodConfig['stripePayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
12
+ declare type Props = PaymentMethodConfig['stripePayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
13
13
  show?: boolean;
14
14
  publishableKey: string;
15
15
  locale?: StripeElementLocale;
16
16
  };
17
- declare const StripePayment: FunctionComponent<StripePaymentProps>;
17
+ export declare function StripePayment({ publishableKey, show, options, locale, ...p }: Props): JSX.Element | null;
18
18
  export default StripePayment;