@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
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { BaseInputComponentProps } from '../../typings/index';
3
+ declare type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
4
+ export declare function SkuOptionInput(props: Props): JSX.Element;
5
+ export declare namespace SkuOptionInput {
6
+ var propTypes: {
7
+ children: import("prop-types").Requireable<(...args: any[]) => any>;
8
+ name: import("prop-types").Validator<string>;
9
+ type: import("prop-types").Validator<import("../../typings/index").BaseInputType>;
10
+ onChange: import("prop-types").Requireable<(...args: any[]) => any>;
11
+ placeholder: import("prop-types").Requireable<string>;
12
+ };
13
+ var displayName: string;
14
+ }
15
+ export default SkuOptionInput;
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import BaseInput from"../utils/BaseInput";import ItemContext from"../../context/ItemContext";import SkuOptionChildrenContext from"../../context/SkuOptionChildrenContext";import has from"lodash/has";import components from"../../config/components";const propTypes=components.SkuOptionInput.propTypes,displayName=components.SkuOptionInput.displayName;export function SkuOptionInput(props){const{name}=props,{option,setOption}=useContext(ItemContext),{skuOption,skuCode}=useContext(SkuOptionChildrenContext);return _jsx(BaseInput,Object.assign({onChange:event=>{var _a,_b;const val=event.target.value,options=has(option,`${skuCode}.${skuOption?.id}`)?(_b=(_a=option[skuCode])===null||_a===void 0?void 0:_a[`${skuOption?.id}`])===null||_b===void 0?void 0:_b.options:{},o={[skuCode]:Object.assign(Object.assign({},option[skuCode]),{[`${skuOption?.id}`]:{skuOptionId:skuOption?.id,options:Object.assign(Object.assign({},options),{[name]:val})}})};setOption&&setOption(o)}},props))}SkuOptionInput.propTypes=propTypes,SkuOptionInput.displayName=displayName;export default SkuOptionInput;
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ declare type Props = {
3
+ children: ReactNode;
4
+ skuCode?: string;
5
+ };
6
+ export declare function SkuOptionsContainer(props: Props): JSX.Element;
7
+ export declare namespace SkuOptionsContainer {
8
+ var propTypes: {
9
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
10
+ skuCode: import("prop-types").Requireable<string>;
11
+ };
12
+ var displayName: string;
13
+ }
14
+ export default SkuOptionsContainer;
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuOptionsContext from"../../context/SkuOptionsContext";import skuOptionsReducer,{skuOptionsInitialState}from"../../reducers/SkuOptionsReducer";import CommerceLayerContext from"../../context/CommerceLayerContext";import{isEmpty}from"lodash";import getCurrentItemKey from"../../utils/getCurrentItemKey";import ItemContext from"../../context/ItemContext";import{getSkuOptions}from"../../reducers/SkuOptionsReducer";import components from"../../config/components";const propTypes=components.SkuOptionsContainer.propTypes,displayName=components.SkuOptionsContainer.displayName;export function SkuOptionsContainer(props){var _a;const{skuCode,children}=props,[state,dispatch]=useReducer(skuOptionsReducer,skuOptionsInitialState),config=useContext(CommerceLayerContext),{item,items}=useContext(ItemContext),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:skuCode||getCurrentItemKey(item),skuOptionsValue=Object.assign(Object.assign({},state),{skuCode:sCode});return useEffect(()=>{var _a2,_b;return sCode&&((_a2=item[sCode])===null||_a2===void 0?void 0:_a2.sku_options)&&getSkuOptions({skuOptions:(_b=item[sCode])===null||_b===void 0?void 0:_b.sku_options,dispatch}),()=>{isEmpty(sCode)&&dispatch({type:"setSkuOptions",payload:{skuOptions:[]}})}},[config,sCode]),_jsx(SkuOptionsContext.Provider,Object.assign({value:skuOptionsValue},{children}))}SkuOptionsContainer.propTypes=propTypes,SkuOptionsContainer.displayName=displayName;export default SkuOptionsContainer;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ declare type Props = {
3
+ children: ReactNode;
4
+ };
5
+ export declare function Skus<P extends Props>({ children }: P): JSX.Element;
6
+ export declare namespace Skus {
7
+ var propTypes: {
8
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
9
+ };
10
+ }
11
+ export default Skus;
@@ -0,0 +1 @@
1
+ import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import components from"../../config/components";import SkuChildrenContext from"../../context/SkuChildrenContext";import SkuContext from"../../context/SkuContext";import{useContext}from"react";export function Skus({children}){const{skus}=useContext(SkuContext),components2=skus&&skus.map((sku,key)=>{const value={sku};return _jsx(SkuChildrenContext.Provider,Object.assign({value},{children}),key)});return _jsx(_Fragment,{children:components2})}Skus.propTypes=components.Skus.propTypes;export default Skus;
@@ -0,0 +1,23 @@
1
+ import type { QueryParamsList } from '@commercelayer/sdk';
2
+ import { ReactNode } from 'react';
3
+ declare type Props = {
4
+ /**
5
+ * An array of skus to display.
6
+ */
7
+ skus: string[];
8
+ /**
9
+ * Accept a React node, [Skus](./Skus.d.ts), and [ItemContainer](../ItemContainer.d.ts) as children to display above the skus.
10
+ */
11
+ children: ReactNode;
12
+ /**
13
+ * An object params to query the skus resource
14
+ */
15
+ queryParams?: QueryParamsList;
16
+ };
17
+ export declare function SkusContainer<P extends Props>(props: P): JSX.Element;
18
+ export declare namespace SkusContainer {
19
+ var propTypes: {
20
+ children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
21
+ };
22
+ }
23
+ export default SkusContainer;
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import components from"../../config/components";import CommerceLayerContext from"../../context/CommerceLayerContext";import SkuContext from"../../context/SkuContext";import skuReducer,{getSku,skuInitialState}from"../../reducers/SkuReducer";import{useContext,useEffect,useMemo,useReducer}from"react";export function SkusContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=useReducer(skuReducer,skuInitialState),config=useContext(CommerceLayerContext),loadSkus=async()=>await getSku({config,dispatch,skus,queryParams});useEffect(()=>(config.accessToken&&state?.skus&&state?.skus.length===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=useMemo(()=>state,[state]);return _jsx(SkuContext.Provider,Object.assign({value:contextValue},{children}))}SkusContainer.propTypes=components.SkusContainer.propTypes;export default SkusContainer;
@@ -11,7 +11,7 @@ export declare type CustomerAddress = Address & {
11
11
  };
12
12
  export declare type AddressCardsTemplateChildren = FunctionChildren<ChildrenProps>;
13
13
  export declare type AddressCardsType = ChildrenProps;
14
- declare type HandleSelect = (k: number, addressId: string, customerAddressId: string, disabled: boolean) => void;
14
+ export declare type HandleSelect = (k: number, addressId: string, customerAddressId: string, disabled: boolean, address: Address) => Promise<void>;
15
15
  declare type Props = {
16
16
  customerAddresses: CustomerAddress[];
17
17
  countryLock?: string;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className} ${deselect?"":selectedClassName}`:className,finalClassName=disabled?`${className} ${disabledClassName}`:addressSelectedClass,customerAddressId=(address==null?void 0:address.reference)||"",onClick=()=>handleSelect(k,address.id,customerAddressId,disabled);return Object.assign(Object.assign({},attributes),{className:finalClassName,onClick})}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,Object.assign({},value,{children}),void 0)}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import AddressChildrenContext from"../../context/AddressChildrenContext";import ShippingAddressContext from"../../context/ShippingAddressContext";export default function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=useContext(ShippingAddressContext),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className} ${deselect?"":selectedClassName}`:className,finalClassName=disabled?`${className} ${disabledClassName}`:addressSelectedClass,customerAddressId=address?.reference||"",onClick=()=>handleSelect(k,address.id,customerAddressId,disabled,address);return Object.assign(Object.assign({},attributes),{className:finalClassName,onClick})}),AddressProvider:AddressChildrenContext.Provider};return _jsx(Parent,Object.assign({},value,{children}))}
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import{useContext,useEffect,useState}from"react";import Parent from"./Parent";const BaseField=_a=>{var{children,attribute}=_a,p=__rest(_a,["children","attribute"]);const{order}=useContext(OrderContext),[field,setField]=useState("");useEffect(()=>(order&&attribute in order&&setField(order[attribute]),()=>{setField("")}),[order]);const parentProps=Object.assign({attribute:field},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("span",Object.assign({},p,{children:field}),void 0)};export default BaseField;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import{useContext,useEffect,useState}from"react";import Parent from"./Parent";const BaseField=_a=>{var{children,attribute}=_a,p=__rest(_a,["children","attribute"]);const{order}=useContext(OrderContext),[field,setField]=useState("");useEffect(()=>(order&&attribute in order&&setField(order[attribute]),()=>{setField("")}),[order]);const parentProps=Object.assign({attribute:field},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("span",Object.assign({},p,{children:field}))};export default BaseField;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { BaseInputComponentProps } from '../../typings/index';
3
3
  export declare type BaseInputProps = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
4
- declare const _default: React.ForwardRefExoticComponent<Pick<BaseInputProps, "children" | "form" | "slot" | "style" | "title" | "pattern" | "type" | "key" | "resource" | "id" | "value" | "placeholder" | "className" | "required" | "name" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "min" | "max" | "disabled" | "width" | "height" | "src" | "list" | "step" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "maxLength" | "minLength" | "multiple" | "readOnly" | "size" | "cols" | "dirName" | "rows" | "wrap"> & React.RefAttributes<any>>;
4
+ declare const _default: React.ForwardRefExoticComponent<Pick<BaseInputProps, "children" | "form" | "slot" | "style" | "title" | "pattern" | "resource" | "id" | "value" | "placeholder" | "className" | "required" | "name" | "onChange" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "min" | "max" | "type" | "list" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "maxLength" | "minLength" | "multiple" | "readOnly" | "size" | "src" | "step" | "width" | "cols" | "dirName" | "rows" | "wrap"> & React.RefAttributes<any>>;
5
5
  export default _default;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";const BaseInput=(props,ref)=>{const{children}=props,p=__rest(props,["children"]),input=props.type==="textarea"?_jsx("textarea",Object.assign({ref},p),void 0):_jsx("input",Object.assign({ref},p),void 0);return children?_jsx(Parent,Object.assign({},p,{children}),void 0):input};export default React.forwardRef(BaseInput);
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";const BaseInput=(props,ref)=>{const{children}=props,p=__rest(props,["children"]),input=props.type==="textarea"?_jsx("textarea",Object.assign({ref},p)):_jsx("input",Object.assign({ref},p));return children?_jsx(Parent,Object.assign({parentRef:ref},p,{children})):input};export default React.forwardRef(BaseInput);
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import getAmount from"../../utils/getAmount";import Parent from"./Parent";import{useState,useEffect,useContext}from"react";import{baseOrderPricePropTypes}from"../../typings/index";import{isEmpty}from"lodash";const BaseOrderPrice=props=>{const{format="formatted",base,type,children}=props,p=__rest(props,["format","base","type","children"]),{order}=useContext(OrderContext),[price,setPrice]=useState(""),[cents,setCents]=useState(0);useEffect(()=>{const p2=getAmount({base,type,format,obj:order||{}}),c=getAmount({base,type,format:"cents",obj:order||{}});return setPrice(p2),setCents(c),()=>{isEmpty(order)&&setPrice("")}},[order]);const parentProps=Object.assign({priceCents:cents,price},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("span",Object.assign({},p,{children:price}),void 0)};BaseOrderPrice.propTypes=baseOrderPricePropTypes;export default BaseOrderPrice;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import OrderContext from"../../context/OrderContext";import getAmount from"../../utils/getAmount";import Parent from"./Parent";import{useState,useEffect,useContext}from"react";import{baseOrderPricePropTypes}from"../../typings/index";import isEmpty from"lodash/isEmpty";const BaseOrderPrice=props=>{const{format="formatted",base,type,children}=props,p=__rest(props,["format","base","type","children"]),{order}=useContext(OrderContext),[price,setPrice]=useState(""),[cents,setCents]=useState(0);useEffect(()=>{const p2=getAmount({base,type,format,obj:order||{}}),c=getAmount({base,type,format:"cents",obj:order||{}});return setPrice(p2),setCents(c),()=>{isEmpty(order)&&setPrice("")}},[order]);const parentProps=Object.assign({priceCents:cents,price},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("span",Object.assign({},p,{children:price}))};BaseOrderPrice.propTypes=baseOrderPricePropTypes;export default BaseOrderPrice;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";import{findIndex}from"lodash";const BaseSelect=(props,ref)=>{const{options=[],children,placeholder={label:"Select an option",value:""},value=""}=props,p=__rest(props,["options","children","placeholder","value"]);findIndex(options,placeholder)===-1?options.unshift(placeholder):options[0]=placeholder;const Options=options.map((o,k)=>{const{label}=o,option=__rest(o,["label"]);return _jsx("option",Object.assign({},option,{children:label}),k)}),parentProps=Object.assign({options,ref},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("select",Object.assign({ref,defaultValue:value},p,{children:Options}),void 0)};export default React.forwardRef(BaseSelect);
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import React from"react";import Parent from"./Parent";import{findIndex}from"lodash";const BaseSelect=(props,ref)=>{const{options=[],children,placeholder={label:"Select an option",value:""},value=""}=props,p=__rest(props,["options","children","placeholder","value"]);findIndex(options,placeholder)===-1?options.unshift(placeholder):options[0]=placeholder;const Options=options.map((o,k)=>{const{label}=o,option=__rest(o,["label"]);return _jsx("option",Object.assign({},option,{children:label}),k)}),parentProps=Object.assign({options,ref},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("select",Object.assign({ref,defaultValue:value},p,{children:Options}))};export default React.forwardRef(BaseSelect);
@@ -0,0 +1,42 @@
1
+ import { InitialSkuContext } from '../../context/SkuChildrenContext';
2
+ import { InitialStockTransferContext } from '../../context/StockTransferChildrenContext';
3
+ import type { Customer, LineItem, Sku } from '@commercelayer/sdk';
4
+ import { InitialLineItemContext } from '../../context/LineItemChildrenContext';
5
+ import { Context } from 'react';
6
+ import { InitialCustomerContext } from '../../context/CustomerContext';
7
+ export declare type TResources = {
8
+ StockTransfer: LineItem & {
9
+ resource: 'stock_transfers';
10
+ };
11
+ Sku: Sku & {
12
+ resource: 'skus';
13
+ };
14
+ LineItem: LineItem & {
15
+ resource: 'line_items';
16
+ };
17
+ Customer: Customer & {
18
+ resource: 'customers';
19
+ };
20
+ };
21
+ export declare type TResourceKey = {
22
+ [K in keyof TResources]: K;
23
+ };
24
+ export declare type TGenericChildrenProps<E extends TResources[keyof TResources]> = Omit<Props<E>, 'children' | 'attribute' | 'context' | 'tagElement'> & {
25
+ attributeValue: E[keyof E];
26
+ };
27
+ declare type ResourceContext = {
28
+ stock_transfers: InitialStockTransferContext;
29
+ skus: InitialSkuContext;
30
+ line_items: InitialLineItemContext;
31
+ customers: InitialCustomerContext;
32
+ };
33
+ declare type GenericContext<K extends keyof ResourceContext> = Context<ResourceContext[K]>;
34
+ declare type Props<E extends TResources[keyof TResources]> = {
35
+ children?: (props: TGenericChildrenProps<E>) => JSX.Element;
36
+ resource: E['resource'];
37
+ attribute: keyof E;
38
+ tagElement: keyof JSX.IntrinsicElements;
39
+ context: GenericContext<E['resource']>;
40
+ };
41
+ export default function GenericFieldComponent<R extends keyof TResources>(props: Props<TResources[R]>): JSX.Element;
42
+ export {};
@@ -0,0 +1 @@
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./Parent";import{useContext}from"react";import{defaultImgUrl}from"../../utils/placeholderImages";export default function GenericFieldComponent(props){const{children,tagElement,attribute,context}=props,p=__rest(props,["children","tagElement","attribute","context"]),resourceContext=useContext(context);let attributeValue="";const keysContext=Object.keys(resourceContext).filter(key=>key===p.resource);if(keysContext.length===1){const[keyResource]=keysContext;keyResource&&attribute&&(attributeValue=resourceContext[keyResource][attribute])}const Tag=tagElement||"span";if(Tag==="img"&&!children)return _jsx("img",Object.assign({alt:"",src:attributeValue||defaultImgUrl},p));const parentProps=Object.assign({attributeValue,tagElement},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx(Tag,Object.assign({},p,{children:attributeValue}))}
@@ -1,8 +1,6 @@
1
- import PropTypes, { InferProps } from 'prop-types';
2
- import { FunctionComponent } from 'react';
3
- declare const PProps: {
4
- children: PropTypes.Requireable<(...args: any[]) => any>;
1
+ import { ForwardedRef, FunctionComponent } from 'react';
2
+ export declare type ParentProps = {
3
+ parentRef?: ForwardedRef<any>;
5
4
  };
6
- export declare type ParentProps = InferProps<typeof PProps>;
7
5
  declare const Parent: FunctionComponent<ParentProps>;
8
6
  export default Parent;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import PropTypes from"prop-types";const PProps={children:PropTypes.func},Parent=props=>{const Child=props.children;return Child?_jsx(Child,Object.assign({},props),void 0):null};Parent.propTypes=PProps;export default Parent;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";const Parent=_a=>{var{children}=_a,p=__rest(_a,["children"]);const Child=children;return Child?_jsx(Child,Object.assign({},p)):null};export default Parent;
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { PaymentResource, PaymentSourceType } from '../../reducers/PaymentMethodReducer';
3
- import PaymentSourceContext, { iconBrand } from '../../context/PaymentSourceContext';
3
+ import PaymentSourceContext, { IconBrand } from '../../context/PaymentSourceContext';
4
4
  import { FunctionChildren } from '../../typings/index';
5
5
  declare type ChildrenProps = Pick<Props, 'customerPayments'> & {
6
6
  PaymentSourceProvider: typeof PaymentSourceContext.Provider;
7
7
  };
8
8
  declare type CustomerPayment = PaymentSourceType & {
9
9
  card?: {
10
- brand?: iconBrand;
10
+ brand?: IconBrand;
11
11
  last4?: string;
12
12
  };
13
13
  handleClick?: () => void;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";export default function PaymentCardsTemplate({customerPayments,children,paymentResource}){const{setPaymentSource}=useContext(PaymentMethodContext),value={customerPayments:customerPayments.map(customerPayment=>{var _a,_b,_c,_d,_e,_f,_g;const attributes=customerPayment,card=((_a=customerPayment==null?void 0:customerPayment.payment_source.options)===null||_a===void 0?void 0:_a.card)||((_c=(_b=customerPayment==null?void 0:customerPayment.payment_source)===null||_b===void 0?void 0:_b.payment_request_data)===null||_c===void 0?void 0:_c.paymentMethod)||((_e=(_d=customerPayment==null?void 0:customerPayment.payment_source)===null||_d===void 0?void 0:_d.payment_method)===null||_e===void 0?void 0:_e.card)||((_g=(_f=customerPayment==null?void 0:customerPayment.payment_source)===null||_f===void 0?void 0:_f.metadata)===null||_g===void 0?void 0:_g.card),handleClick=async e=>{e.stopPropagation(),await setPaymentSource({paymentResource,customerPaymentSourceId:customerPayment.id})};return Object.assign(Object.assign({},attributes),{card,handleClick})}),PaymentSourceProvider:PaymentSourceContext.Provider};return _jsx(Parent,Object.assign({},value,{children}),void 0)}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import{useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import getCardDetails from"../../utils/getCardDetails";export default function PaymentCardsTemplate({customerPayments,children,paymentResource}){const{setPaymentSource}=useContext(PaymentMethodContext),value={customerPayments:customerPayments.map(customerPayment=>{const attributes=customerPayment,card=getCardDetails({customerPayment,paymentType:paymentResource}),handleClick=async e=>{e.stopPropagation(),await setPaymentSource({paymentResource,customerPaymentSourceId:customerPayment.id})};return Object.assign(Object.assign({},attributes),{card,handleClick})}),PaymentSourceProvider:PaymentSourceContext.Provider};return _jsx(Parent,Object.assign({},value,{children}))}
@@ -1,8 +1,8 @@
1
- import { FunctionComponent } from 'react';
1
+ import React from 'react';
2
2
  import { PriceProps } from '../Price';
3
3
  export declare type PTemplateProps = {
4
4
  formattedAmount?: string;
5
5
  formattedCompare?: string;
6
6
  } & Omit<PriceProps, 'children'>;
7
- declare const PriceTemplate: FunctionComponent<PTemplateProps>;
7
+ declare const PriceTemplate: React.FunctionComponent<PTemplateProps>;
8
8
  export default PriceTemplate;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import PropTypes from"prop-types";const propTypes={formattedAmount:PropTypes.string,formattedCompare:PropTypes.string},defaultProps={formattedAmount:"",formattedCompare:""},PriceTemplate=props=>{const{showCompare,formattedCompare,compareClassName,className,formattedAmount,skuCode}=props,p=__rest(props,["showCompare","formattedCompare","compareClassName","className","formattedAmount","skuCode"]);return _jsxs(Fragment,{children:[_jsx("span",Object.assign({className},p,{children:formattedAmount}),void 0),showCompare&&_jsx("span",Object.assign({className:compareClassName||""},p,{children:formattedCompare}),void 0)]},void 0)};PriceTemplate.propTypes=propTypes,PriceTemplate.defaultProps=defaultProps;export default PriceTemplate;
1
+ import{__rest}from"tslib";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import PropTypes from"prop-types";const propTypes={formattedAmount:PropTypes.string,formattedCompare:PropTypes.string},defaultProps={formattedAmount:"",formattedCompare:""},PriceTemplate=props=>{const{showCompare,formattedCompare,compareClassName,className,formattedAmount}=props,p=__rest(props,["showCompare","formattedCompare","compareClassName","className","formattedAmount"]);return delete p.skuCode,_jsxs(_Fragment,{children:[_jsx("span",Object.assign({className},p,{children:formattedAmount})),showCompare&&_jsx("span",Object.assign({className:compareClassName||""},p,{children:formattedCompare}))]})};PriceTemplate.propTypes=propTypes,PriceTemplate.defaultProps=defaultProps;export default PriceTemplate;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Fragment}from"react";import{keys}from"lodash";import PropTypes from"prop-types";export const propTypes={variants:PropTypes.any.isRequired,onChange:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string};const VariantTemplate=props=>{const{id,variants,type,placeholder,options,skuCode,handleChange,handleCallback}=props,prs=__rest(props,["id","variants","type","placeholder","options","skuCode","handleChange","handleCallback"]),vars=keys(variants).map((v,k)=>{const checked=skuCode===v,label=options.length>0?options[k].label:variants[v].name;return type==="select"?_jsx("option",Object.assign({"data-sku-id":variants[v].id,"data-label":label,value:variants[v].code},{children:label}),variants[v].id):_jsxs(Fragment,{children:[_jsx("input",Object.assign({id:id&&`${id}-${k}`,defaultChecked:checked,type:"radio",value:variants[v].code,onChange:e=>{const code=e.target.value;handleChange&&handleChange(code,variants[v].id),handleCallback&&handleCallback({code,label})}},prs),void 0),label]},variants[v].id)});return type==="select"?_jsxs("select",Object.assign({id,title:"Variant selector",onChange:e=>{const v=e.target.value,i=e.target.selectedIndex,id2=e.target[i].dataset.skuId,label=e.target[i].dataset.label;handleChange&&handleChange(v,id2),handleCallback&&handleCallback({code:v,label})},value:skuCode||""},prs,{children:[_jsx("option",Object.assign({disabled:!!skuCode},{children:placeholder}),void 0),vars]}),void 0):_jsx(Fragment,{children:vars},void 0)};VariantTemplate.propTypes=propTypes;export default VariantTemplate;
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{Fragment}from"react";import PropTypes from"prop-types";export const propTypes={variants:PropTypes.any.isRequired,onChange:PropTypes.func,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string};const VariantTemplate=props=>{const{id,variants,type,placeholder,options,skuCode,handleChange,handleCallback}=props,prs=__rest(props,["id","variants","type","placeholder","options","skuCode","handleChange","handleCallback"]),vars=Object.keys(variants).map((v,k)=>{var _a;const checked=skuCode===v,label=options.length>0?(_a=options[k])===null||_a===void 0?void 0:_a.label:variants[v].name;return type==="select"?_jsx("option",Object.assign({"data-sku-id":variants[v].id,"data-label":label,value:variants[v].code},{children:label}),variants[v].id):_jsxs(Fragment,{children:[_jsx("input",Object.assign({id:id&&`${id}-${k}`,defaultChecked:checked,type:"radio",value:variants[v].code,onChange:e=>{const code=e.target.value;handleChange&&handleChange(code,variants[v].id),handleCallback&&handleCallback({code,label})}},prs)),label]},variants[v].id)});return type==="select"?_jsxs("select",Object.assign({id,title:"Variant selector",onChange:e=>{var _a,_b,_c,_d;const v=e.target.value,i=e.target.selectedIndex,id2=(_b=(_a=e.target[i])===null||_a===void 0?void 0:_a.dataset)===null||_b===void 0?void 0:_b.skuId,label=(_d=(_c=e.target[i])===null||_c===void 0?void 0:_c.dataset)===null||_d===void 0?void 0:_d.label;handleChange&&handleChange(v,id2),handleCallback&&handleCallback({code:v,label})},value:skuCode||""},prs,{children:[_jsx("option",Object.assign({disabled:!!skuCode},{children:placeholder})),vars]})):_jsx(_Fragment,{children:vars})};VariantTemplate.propTypes=propTypes;export default VariantTemplate;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import customMessages from"../../utils/customMessages";const getAllErrors=params=>{const{allErrors,messages,field,props,lineItem,resource,returnHtml=!0}=params;return allErrors.map((v,k)=>{const objMsg=customMessages(messages,v),text=(objMsg==null?void 0:objMsg.message)||v.message||`${v.title} - ${v.detail}`;if(field){if(v.resource==="line_items"&&lineItem&&v.id===lineItem.id)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text;if(field===v.field&&resource===v.resource)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text}if(resource===v.resource&&!field)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text})};export default getAllErrors;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import customMessages from"../../utils/customMessages";const getAllErrors=params=>{const{allErrors,messages,field,props,lineItem,resource,returnHtml=!0}=params;return allErrors.map((v,k)=>{var _a;const objMsg=customMessages(messages,v);let text=v?.title&&!(!((_a=v.detail)===null||_a===void 0)&&_a.includes(v.title))?`${v.title} - ${v.detail}`:`${v?.detail||v.message}`;if(objMsg?.message&&(text=objMsg?.message),field){if(v.resource==="line_items"&&lineItem&&v.id===lineItem.id)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text;if(field===v.field&&resource===v.resource)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text}if(resource===v.resource&&!field)return returnHtml?_jsx("span",Object.assign({},props,{children:text}),k):text}).filter(v=>v!==void 0)};export default getAllErrors;