@commercelayer/react-components 3.4.4 → 3.5.2

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 (305) hide show
  1. package/lib/components/AddToCartButton.d.ts +1 -20
  2. package/lib/components/AddToCartButton.js +1 -1
  3. package/lib/components/Address.d.ts +1 -13
  4. package/lib/components/Address.js +1 -1
  5. package/lib/components/AddressCountrySelector.d.ts +1 -9
  6. package/lib/components/AddressCountrySelector.js +1 -1
  7. package/lib/components/AddressField.d.ts +1 -15
  8. package/lib/components/AddressField.js +1 -1
  9. package/lib/components/AddressInput.d.ts +1 -7
  10. package/lib/components/AddressInput.js +1 -1
  11. package/lib/components/AddressStateSelector.d.ts +1 -11
  12. package/lib/components/AddressStateSelector.js +1 -1
  13. package/lib/components/AddressesContainer.d.ts +1 -8
  14. package/lib/components/AddressesContainer.js +1 -1
  15. package/lib/components/AdjustmentAmount.d.ts +1 -4
  16. package/lib/components/AdjustmentAmount.js +1 -1
  17. package/lib/components/AdyenPayment.d.ts +1 -25
  18. package/lib/components/AdyenPayment.js +1 -1
  19. package/lib/components/AvailabilityContainer.d.ts +1 -7
  20. package/lib/components/AvailabilityContainer.js +1 -1
  21. package/lib/components/AvailabilityTemplate.d.ts +1 -15
  22. package/lib/components/AvailabilityTemplate.js +1 -1
  23. package/lib/components/BillingAddressContainer.d.ts +1 -6
  24. package/lib/components/BillingAddressContainer.js +1 -1
  25. package/lib/components/BillingAddressForm.d.ts +1 -8
  26. package/lib/components/BillingAddressForm.js +1 -1
  27. package/lib/components/BraintreePayment.d.ts +1 -30
  28. package/lib/components/BraintreePayment.js +1 -1
  29. package/lib/components/CheckoutComPayment.d.ts +1 -23
  30. package/lib/components/CheckoutComPayment.js +1 -1
  31. package/lib/components/CheckoutLink.d.ts +1 -13
  32. package/lib/components/CheckoutLink.js +1 -1
  33. package/lib/components/CommerceLayer.d.ts +1 -8
  34. package/lib/components/CommerceLayer.js +1 -1
  35. package/lib/components/CustomerContainer.d.ts +1 -7
  36. package/lib/components/CustomerContainer.js +1 -1
  37. package/lib/components/CustomerInput.d.ts +1 -11
  38. package/lib/components/CustomerInput.js +1 -1
  39. package/lib/components/DeliveryLeadTime.d.ts +1 -10
  40. package/lib/components/DeliveryLeadTime.js +1 -1
  41. package/lib/components/DiscountAmount.d.ts +1 -4
  42. package/lib/components/DiscountAmount.js +1 -1
  43. package/lib/components/Errors.d.ts +1 -5
  44. package/lib/components/Errors.js +1 -1
  45. package/lib/components/ExternalFunction.d.ts +1 -7
  46. package/lib/components/ExternalFunction.js +1 -1
  47. package/lib/components/GiftCard.d.ts +1 -8
  48. package/lib/components/GiftCard.js +1 -1
  49. package/lib/components/GiftCardAmount.d.ts +1 -4
  50. package/lib/components/GiftCardAmount.js +1 -1
  51. package/lib/components/GiftCardContainer.d.ts +1 -6
  52. package/lib/components/GiftCardContainer.js +1 -1
  53. package/lib/components/GiftCardCurrencySelector.d.ts +1 -7
  54. package/lib/components/GiftCardCurrencySelector.js +1 -1
  55. package/lib/components/GiftCardInput.d.ts +1 -7
  56. package/lib/components/GiftCardInput.js +1 -1
  57. package/lib/components/GiftCardOrCouponCode.d.ts +1 -13
  58. package/lib/components/GiftCardOrCouponCode.js +1 -1
  59. package/lib/components/GiftCardOrCouponForm.d.ts +1 -10
  60. package/lib/components/GiftCardOrCouponForm.js +1 -1
  61. package/lib/components/GiftCardOrCouponInput.d.ts +1 -8
  62. package/lib/components/GiftCardOrCouponInput.js +1 -1
  63. package/lib/components/GiftCardOrCouponRemoveButton.d.ts +1 -16
  64. package/lib/components/GiftCardOrCouponRemoveButton.js +1 -1
  65. package/lib/components/GiftCardOrCouponSubmit.d.ts +1 -9
  66. package/lib/components/GiftCardOrCouponSubmit.js +1 -1
  67. package/lib/components/ItemContainer.d.ts +1 -11
  68. package/lib/components/ItemContainer.js +1 -1
  69. package/lib/components/LineItem.d.ts +1 -8
  70. package/lib/components/LineItem.js +1 -1
  71. package/lib/components/LineItemAmount.d.ts +1 -7
  72. package/lib/components/LineItemAmount.js +1 -1
  73. package/lib/components/LineItemCode.d.ts +1 -12
  74. package/lib/components/LineItemCode.js +1 -1
  75. package/lib/components/LineItemImage.d.ts +1 -16
  76. package/lib/components/LineItemImage.js +1 -1
  77. package/lib/components/LineItemName.d.ts +1 -11
  78. package/lib/components/LineItemName.js +1 -1
  79. package/lib/components/LineItemOption.d.ts +1 -19
  80. package/lib/components/LineItemOption.js +1 -1
  81. package/lib/components/LineItemOptions.d.ts +1 -14
  82. package/lib/components/LineItemOptions.js +1 -1
  83. package/lib/components/LineItemQuantity.d.ts +1 -14
  84. package/lib/components/LineItemQuantity.js +1 -1
  85. package/lib/components/LineItemRemoveLink.d.ts +1 -12
  86. package/lib/components/LineItemRemoveLink.js +1 -1
  87. package/lib/components/LineItemsContainer.d.ts +1 -8
  88. package/lib/components/LineItemsContainer.js +1 -1
  89. package/lib/components/LineItemsCount.d.ts +1 -12
  90. package/lib/components/LineItemsCount.js +1 -1
  91. package/lib/components/LineItemsEmpty.d.ts +1 -12
  92. package/lib/components/LineItemsEmpty.js +1 -1
  93. package/lib/components/MetadataInput.d.ts +1 -5
  94. package/lib/components/MetadataInput.js +1 -1
  95. package/lib/components/OrderContainer.d.ts +1 -11
  96. package/lib/components/OrderContainer.js +1 -1
  97. package/lib/components/OrderNumber.d.ts +1 -5
  98. package/lib/components/OrderNumber.js +1 -1
  99. package/lib/components/OrderStorage.d.ts +1 -8
  100. package/lib/components/OrderStorage.js +1 -1
  101. package/lib/components/PaymentGateway.d.ts +1 -16
  102. package/lib/components/PaymentGateway.js +1 -1
  103. package/lib/components/PaymentMethod.d.ts +1 -16
  104. package/lib/components/PaymentMethod.js +1 -1
  105. package/lib/components/PaymentMethodAmount.d.ts +1 -4
  106. package/lib/components/PaymentMethodAmount.js +1 -1
  107. package/lib/components/PaymentMethodName.d.ts +1 -9
  108. package/lib/components/PaymentMethodName.js +1 -1
  109. package/lib/components/PaymentMethodPrice.d.ts +1 -9
  110. package/lib/components/PaymentMethodPrice.js +1 -1
  111. package/lib/components/PaymentMethodRadioButton.d.ts +1 -11
  112. package/lib/components/PaymentMethodRadioButton.js +1 -1
  113. package/lib/components/PaymentMethodsContainer.d.ts +1 -8
  114. package/lib/components/PaymentMethodsContainer.js +1 -1
  115. package/lib/components/PaymentSource.d.ts +1 -19
  116. package/lib/components/PaymentSource.js +1 -1
  117. package/lib/components/PaymentSourceBrandIcon.d.ts +1 -15
  118. package/lib/components/PaymentSourceBrandIcon.js +1 -1
  119. package/lib/components/PaymentSourceBrandName.d.ts +1 -12
  120. package/lib/components/PaymentSourceBrandName.js +1 -1
  121. package/lib/components/PaymentSourceDetail.d.ts +1 -12
  122. package/lib/components/PaymentSourceDetail.js +1 -1
  123. package/lib/components/PaymentSourceEditButton.d.ts +1 -9
  124. package/lib/components/PaymentSourceEditButton.js +1 -1
  125. package/lib/components/PaypalPayment.d.ts +1 -12
  126. package/lib/components/PaypalPayment.js +1 -1
  127. package/lib/components/PlaceOrderButton.d.ts +1 -12
  128. package/lib/components/PlaceOrderButton.js +1 -1
  129. package/lib/components/PlaceOrderContainer.d.ts +1 -8
  130. package/lib/components/PlaceOrderContainer.js +1 -1
  131. package/lib/components/Price.d.ts +1 -16
  132. package/lib/components/Price.js +1 -1
  133. package/lib/components/PricesContainer.d.ts +1 -11
  134. package/lib/components/PricesContainer.js +1 -1
  135. package/lib/components/PrivacyAndTermsCheckbox.d.ts +1 -4
  136. package/lib/components/PrivacyAndTermsCheckbox.js +1 -1
  137. package/lib/components/QuantitySelector.d.ts +1 -17
  138. package/lib/components/QuantitySelector.js +1 -1
  139. package/lib/components/SaveAddressesButton.d.ts +1 -10
  140. package/lib/components/SaveAddressesButton.js +1 -1
  141. package/lib/components/SaveCustomerButton.d.ts +1 -13
  142. package/lib/components/SaveCustomerButton.js +1 -1
  143. package/lib/components/Shipment.d.ts +1 -8
  144. package/lib/components/Shipment.js +1 -1
  145. package/lib/components/ShipmentField.d.ts +1 -12
  146. package/lib/components/ShipmentField.js +1 -1
  147. package/lib/components/ShipmentsContainer.d.ts +1 -6
  148. package/lib/components/ShipmentsContainer.js +1 -1
  149. package/lib/components/ShippingAddressContainer.d.ts +1 -6
  150. package/lib/components/ShippingAddressContainer.js +1 -1
  151. package/lib/components/ShippingAddressForm.d.ts +1 -8
  152. package/lib/components/ShippingAddressForm.js +1 -1
  153. package/lib/components/ShippingAmount.d.ts +1 -4
  154. package/lib/components/ShippingAmount.js +1 -1
  155. package/lib/components/ShippingMethod.d.ts +1 -8
  156. package/lib/components/ShippingMethod.js +1 -1
  157. package/lib/components/ShippingMethodName.d.ts +1 -11
  158. package/lib/components/ShippingMethodName.js +1 -1
  159. package/lib/components/ShippingMethodPrice.d.ts +1 -13
  160. package/lib/components/ShippingMethodPrice.js +1 -1
  161. package/lib/components/ShippingMethodRadioButton.d.ts +1 -13
  162. package/lib/components/ShippingMethodRadioButton.js +1 -1
  163. package/lib/components/SkuList.d.ts +1 -7
  164. package/lib/components/SkuList.js +1 -1
  165. package/lib/components/SkuListsContainer.d.ts +1 -6
  166. package/lib/components/SkuListsContainer.js +1 -1
  167. package/lib/components/SkuOption.d.ts +1 -7
  168. package/lib/components/SkuOption.js +1 -1
  169. package/lib/components/SkuOptionInput.d.ts +1 -5
  170. package/lib/components/SkuOptionInput.js +1 -1
  171. package/lib/components/SkuOptionsContainer.d.ts +1 -7
  172. package/lib/components/SkuOptionsContainer.js +1 -1
  173. package/lib/components/StockTransfer.d.ts +1 -6
  174. package/lib/components/StockTransfer.js +1 -1
  175. package/lib/components/StockTransferField.d.ts +1 -9
  176. package/lib/components/StockTransferField.js +1 -1
  177. package/lib/components/StripePayment.d.ts +1 -18
  178. package/lib/components/StripePayment.js +1 -1
  179. package/lib/components/SubTotalAmount.d.ts +1 -4
  180. package/lib/components/SubTotalAmount.js +1 -1
  181. package/lib/components/SubmitButton.d.ts +1 -9
  182. package/lib/components/SubmitButton.js +1 -1
  183. package/lib/components/TaxesAmount.d.ts +1 -4
  184. package/lib/components/TaxesAmount.js +1 -1
  185. package/lib/components/TotalAmount.d.ts +1 -4
  186. package/lib/components/TotalAmount.js +1 -1
  187. package/lib/components/VariantSelector.d.ts +1 -29
  188. package/lib/components/VariantSelector.js +1 -1
  189. package/lib/components/VariantsContainer.d.ts +1 -8
  190. package/lib/components/VariantsContainer.js +1 -1
  191. package/lib/components/WireTransferPayment.d.ts +1 -10
  192. package/lib/components/WireTransferPayment.js +1 -1
  193. package/lib/components/gateways/AdyenGateway.d.ts +1 -4
  194. package/lib/components/gateways/AdyenGateway.js +1 -1
  195. package/lib/components/gateways/BraintreeGateway.d.ts +1 -4
  196. package/lib/components/gateways/BraintreeGateway.js +1 -1
  197. package/lib/components/gateways/CheckoutComGateway.d.ts +1 -4
  198. package/lib/components/gateways/CheckoutComGateway.js +1 -1
  199. package/lib/components/gateways/PaypalGateway.d.ts +1 -4
  200. package/lib/components/gateways/PaypalGateway.js +1 -1
  201. package/lib/components/gateways/StripeGateway.d.ts +1 -4
  202. package/lib/components/gateways/StripeGateway.js +1 -1
  203. package/lib/components/gateways/WireTransferGateway.d.ts +1 -4
  204. package/lib/components/gateways/WireTransferGateway.js +1 -1
  205. package/lib/components/utils/AddressCardsTemplate.d.ts +1 -26
  206. package/lib/components/utils/AddressCardsTemplate.js +1 -1
  207. package/lib/components/utils/BaseField.d.ts +1 -8
  208. package/lib/components/utils/BaseField.js +1 -1
  209. package/lib/components/utils/BaseInput.d.ts +1 -5
  210. package/lib/components/utils/BaseInput.js +1 -1
  211. package/lib/components/utils/BaseOrderPrice.d.ts +1 -6
  212. package/lib/components/utils/BaseOrderPrice.js +1 -1
  213. package/lib/components/utils/BaseSelect.d.ts +1 -5
  214. package/lib/components/utils/BaseSelect.js +1 -1
  215. package/lib/components/utils/Parent.d.ts +1 -8
  216. package/lib/components/utils/Parent.js +1 -1
  217. package/lib/components/utils/PaymentCardsTemplate.d.ts +1 -22
  218. package/lib/components/utils/PaymentCardsTemplate.js +1 -1
  219. package/lib/components/utils/PriceTemplate.d.ts +1 -8
  220. package/lib/components/utils/PriceTemplate.js +1 -1
  221. package/lib/components/utils/VariantTemplate.d.ts +1 -36
  222. package/lib/components/utils/VariantTemplate.js +1 -1
  223. package/lib/components/utils/getAllErrors.d.ts +1 -17
  224. package/lib/config/components.d.ts +1 -891
  225. package/lib/config/currency.d.ts +1 -5
  226. package/lib/context/AddressChildrenContext.d.ts +1 -6
  227. package/lib/context/AddressContext.d.ts +1 -16
  228. package/lib/context/AvailabilityContext.d.ts +1 -2
  229. package/lib/context/BillingAddressContext.d.ts +1 -11
  230. package/lib/context/BillingAddressFormContext.d.ts +1 -19
  231. package/lib/context/CommerceLayerContext.d.ts +1 -6
  232. package/lib/context/CouponAndGiftCardFormContext.d.ts +1 -7
  233. package/lib/context/CustomerContext.d.ts +1 -15
  234. package/lib/context/ExternalFunctionContext.d.ts +1 -11
  235. package/lib/context/GiftCardContext.d.ts +1 -10
  236. package/lib/context/ItemContext.d.ts +1 -12
  237. package/lib/context/LineItemChildrenContext.d.ts +1 -8
  238. package/lib/context/LineItemContext.d.ts +1 -7
  239. package/lib/context/LineItemOptionChildrenContext.d.ts +1 -7
  240. package/lib/context/OrderContext.d.ts +1 -25
  241. package/lib/context/OrderStorageContext.d.ts +1 -10
  242. package/lib/context/PaymentMethodChildrenContext.d.ts +1 -9
  243. package/lib/context/PaymentMethodContext.d.ts +1 -22
  244. package/lib/context/PaymentSourceContext.d.ts +1 -13
  245. package/lib/context/PlaceOrderContext.d.ts +1 -17
  246. package/lib/context/PricesContext.d.ts +1 -6
  247. package/lib/context/ShipmentChildrenContext.d.ts +1 -12
  248. package/lib/context/ShipmentContext.d.ts +1 -11
  249. package/lib/context/ShippingAddressContext.d.ts +1 -9
  250. package/lib/context/ShippingAddressFormContext.d.ts +1 -3
  251. package/lib/context/ShippingMethodChildrenContext.d.ts +1 -9
  252. package/lib/context/SkuListsContext.d.ts +1 -5
  253. package/lib/context/SkuOptionChildrenContext.d.ts +1 -7
  254. package/lib/context/SkuOptionsContext.d.ts +1 -2
  255. package/lib/context/StockTransferChildrenContext.d.ts +1 -6
  256. package/lib/context/VariantsContext.d.ts +1 -2
  257. package/lib/index.d.ts +1 -99
  258. package/lib/reducers/AddressReducer.d.ts +1 -59
  259. package/lib/reducers/AvailabilityReducer.d.ts +1 -53
  260. package/lib/reducers/BillingAddressReducer.d.ts +1 -31
  261. package/lib/reducers/CustomerReducer.d.ts +1 -50
  262. package/lib/reducers/GiftCardReducer.d.ts +1 -76
  263. package/lib/reducers/ItemReducer.d.ts +1 -69
  264. package/lib/reducers/LineItemReducer.d.ts +1 -52
  265. package/lib/reducers/OrderReducer.d.ts +2 -121
  266. package/lib/reducers/PaymentMethodReducer.d.ts +1 -145
  267. package/lib/reducers/PlaceOrderReducer.d.ts +1 -57
  268. package/lib/reducers/PriceReducer.d.ts +1 -44
  269. package/lib/reducers/ShipmentReducer.d.ts +1 -40
  270. package/lib/reducers/ShippingAddressReducer.d.ts +1 -32
  271. package/lib/reducers/SkuListsReducer.d.ts +1 -21
  272. package/lib/reducers/SkuOptionsReducer.d.ts +1 -26
  273. package/lib/reducers/VariantReducer.d.ts +1 -71
  274. package/lib/typings/errors.d.ts +1 -42
  275. package/lib/typings/index.d.ts +1 -127
  276. package/lib/utils/PropsType.d.ts +1 -33
  277. package/lib/utils/addressesManager.d.ts +1 -28
  278. package/lib/utils/baseReducer.d.ts +1 -3
  279. package/lib/utils/browserInfo.d.ts +1 -9
  280. package/lib/utils/childrenTypes.d.ts +1 -9
  281. package/lib/utils/countryStateCity.d.ts +1 -9
  282. package/lib/utils/customMessages.d.ts +1 -8
  283. package/lib/utils/customerOrderOptions.d.ts +1 -3
  284. package/lib/utils/getAmount.d.ts +1 -9
  285. package/lib/utils/getCardDetails.d.ts +1 -15
  286. package/lib/utils/getCurrentItemKey.d.ts +1 -6
  287. package/lib/utils/getErrors.d.ts +1 -11
  288. package/lib/utils/getLineItemsCount.d.ts +1 -12
  289. package/lib/utils/getLoaderComponent.d.ts +1 -2
  290. package/lib/utils/getLoaderComponent.js +1 -1
  291. package/lib/utils/getPrices.d.ts +1 -17
  292. package/lib/utils/getPrices.js +1 -1
  293. package/lib/utils/getSdk.d.ts +1 -3
  294. package/lib/utils/getSkus.d.ts +1 -3
  295. package/lib/utils/hooks/useExternalScript.d.ts +1 -1
  296. package/lib/utils/isEmptyStates.d.ts +1 -1
  297. package/lib/utils/isJSON.d.ts +1 -1
  298. package/lib/utils/jwt.d.ts +1 -27
  299. package/lib/utils/localStorage.d.ts +1 -17
  300. package/lib/utils/organization.d.ts +1 -6
  301. package/lib/utils/paypalPayment.d.ts +1 -3
  302. package/lib/utils/promisify.d.ts +1 -1
  303. package/lib/utils/shipments.d.ts +1 -2
  304. package/lib/utils/validateFormFields.d.ts +1 -22
  305. package/package.json +21 -21
@@ -1,16 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { Price as PriceType } from '@commercelayer/sdk';
3
- import { FunctionChildren, LoaderType } from '../typings/index';
4
- declare type PriceChildrenProps = FunctionChildren<{
5
- loading: boolean;
6
- loader: LoaderType;
7
- prices: PriceType[];
8
- } & Omit<PriceProps, 'children'>>;
9
- export interface PriceProps extends Partial<JSX.IntrinsicElements['span']> {
10
- children?: PriceChildrenProps;
11
- compareClassName?: string;
12
- showCompare?: boolean;
13
- skuCode?: string;
14
- }
15
- declare const Price: FunctionComponent<PriceProps>;
16
- export default Price;
1
+ import{FunctionComponent}from'react';import{Price as PriceType}from'@commercelayer/sdk';import{FunctionChildren,LoaderType}from'../typings/index';declare type PriceChildrenProps=FunctionChildren<{loading:boolean;loader:LoaderType;prices:PriceType[];}&Omit<PriceProps,'children'>>;export interface PriceProps extends Partial<JSX.IntrinsicElements['span']>{children?:PriceChildrenProps;compareClassName?:string;showCompare?:boolean;skuCode?:string;}declare const Price:FunctionComponent<PriceProps>;export default Price;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useState,useEffect,useContext}from"react";import{isEmpty,has,indexOf}from"lodash";import Parent from"./utils/Parent";import PricesContext from"../context/PricesContext";import{getPricesComponent}from"../utils/getPrices";import components from"../config/components";const propTypes=components.Price.propTypes,defaultProps=components.Price.defaultProps,displayName=components.Price.displayName,Price=props=>{const{children,skuCode=""}=props,{prices,skuCode:pricesSkuCode,loading,skuCodes,setSkuCodes,loader}=useContext(PricesContext),[skuPrices,setSkuPrices]=useState([]),sCode=pricesSkuCode||skuCode;useEffect(()=>(!isEmpty(prices)&&has(prices,`${sCode}`)?setSkuPrices(prices[sCode]):sCode&&indexOf(skuCodes,sCode)===-1&&(skuCodes.push(sCode),setSkuCodes&&setSkuCodes(skuCodes)),()=>{setSkuPrices([])}),[prices,sCode]);const parentProps=Object.assign({loading,loader,prices:skuPrices},props),pricesComponent=isEmpty(prices)||isEmpty(skuPrices)?null:getPricesComponent(skuPrices,props);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx(Fragment,{children:loading||isEmpty(pricesComponent)?loader:pricesComponent},void 0)};Price.propTypes=propTypes,Price.defaultProps=defaultProps,Price.displayName=displayName;export default Price;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useState,useEffect,useContext}from"react";import{isEmpty,has,indexOf}from"lodash";import Parent from"./utils/Parent";import PricesContext from"../context/PricesContext";import{getPricesComponent}from"../utils/getPrices";import components from"../config/components";const propTypes=components.Price.propTypes,defaultProps=components.Price.defaultProps,displayName=components.Price.displayName,Price=props=>{const{children,skuCode=""}=props,{prices,skuCode:pricesSkuCode,loading,skuCodes,setSkuCodes,loader}=useContext(PricesContext),[skuPrices,setSkuPrices]=useState([]),sCode=pricesSkuCode||skuCode;useEffect(()=>(!isEmpty(prices)&&has(prices,`${sCode}`)?setSkuPrices(prices[sCode]):sCode&&indexOf(skuCodes,sCode)===-1&&(skuCodes.push(sCode),setSkuCodes&&setSkuCodes(skuCodes)),()=>{setSkuPrices([])}),[prices,sCode]);const parentProps=Object.assign({loading,loader,prices:skuPrices},props),pricesComponent=isEmpty(prices)||isEmpty(skuPrices)?null:getPricesComponent(skuPrices,props);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx(Fragment,{children:loading||isEmpty(pricesComponent)?loader:pricesComponent})};Price.propTypes=propTypes,Price.defaultProps=defaultProps,Price.displayName=displayName;export default Price;
@@ -1,11 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { LoaderType } from '../typings/index';
3
- declare type PricesContainerProps = {
4
- children: ReactNode;
5
- filters?: object;
6
- loader?: LoaderType;
7
- perPage?: number;
8
- skuCode?: string;
9
- };
10
- declare const PricesContainer: FunctionComponent<PricesContainerProps>;
11
- export default PricesContainer;
1
+ import{FunctionComponent,ReactNode}from'react';import{LoaderType}from'../typings/index';declare type PricesContainerProps={children:ReactNode;filters?:object;loader?:LoaderType;perPage?:number;skuCode?:string;};declare const PricesContainer:FunctionComponent<PricesContainerProps>;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,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}))};PricesContainer.propTypes=propTypes,PricesContainer.defaultProps=defaultProps,PricesContainer.displayName=displayName;export default PricesContainer;
@@ -1,4 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseInputProps } from './utils/BaseInput';
3
- declare const PrivacyAndTermsCheckbox: FunctionComponent<Partial<BaseInputProps>>;
4
- export default PrivacyAndTermsCheckbox;
1
+ import{FunctionComponent}from'react';import{BaseInputProps}from'./utils/BaseInput';declare const PrivacyAndTermsCheckbox:FunctionComponent<Partial<BaseInputProps>>;export default PrivacyAndTermsCheckbox;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import components from"../config/components";import OrderContext from"../context/OrderContext";import PlaceOrderContext from"../context/PlaceOrderContext";import{useContext,useEffect,useState}from"react";import BaseInput from"./utils/BaseInput";const propTypes=components.PrivacyAndTermsCheckbox.propTypes,displayName=components.PrivacyAndTermsCheckbox.displayName,PrivacyAndTermsCheckbox=props=>{const{order}=useContext(OrderContext),{placeOrderPermitted}=useContext(PlaceOrderContext),[forceDisabled,setForceDisabled]=useState(!0),[checked,setChecked]=useState(!1),fieldName="privacy-terms",handleChange=e=>{var _a;const v=(_a=e.target)===null||_a===void 0?void 0:_a.checked;setChecked(v),localStorage.setItem(fieldName,`${v}`),placeOrderPermitted&&placeOrderPermitted()};return useEffect(()=>((order==null?void 0:order.privacy_url)&&(order==null?void 0:order.terms_url)&&setForceDisabled(!1),checked||localStorage.setItem(fieldName,`${checked}`),()=>{setForceDisabled(!0),localStorage.removeItem(fieldName)}),[order==null?void 0:order.privacy_url,order==null?void 0:order.terms_url]),_jsx(BaseInput,Object.assign({type:"checkbox",name:fieldName,disabled:forceDisabled,onChange:handleChange,checked},props),void 0)};PrivacyAndTermsCheckbox.propTypes=propTypes,PrivacyAndTermsCheckbox.displayName=displayName;export default PrivacyAndTermsCheckbox;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import components from"../config/components";import OrderContext from"../context/OrderContext";import PlaceOrderContext from"../context/PlaceOrderContext";import{useContext,useEffect,useState}from"react";import BaseInput from"./utils/BaseInput";const propTypes=components.PrivacyAndTermsCheckbox.propTypes,displayName=components.PrivacyAndTermsCheckbox.displayName,PrivacyAndTermsCheckbox=props=>{const{order}=useContext(OrderContext),{placeOrderPermitted}=useContext(PlaceOrderContext),[forceDisabled,setForceDisabled]=useState(!0),[checked,setChecked]=useState(!1),fieldName="privacy-terms",handleChange=e=>{var _a;const v=(_a=e.target)===null||_a===void 0?void 0:_a.checked;setChecked(v),localStorage.setItem(fieldName,`${v}`),placeOrderPermitted&&placeOrderPermitted()};return useEffect(()=>((order==null?void 0:order.privacy_url)&&(order==null?void 0:order.terms_url)&&setForceDisabled(!1),checked||localStorage.setItem(fieldName,`${checked}`),()=>{setForceDisabled(!0),localStorage.removeItem(fieldName)}),[order==null?void 0:order.privacy_url,order==null?void 0:order.terms_url]),_jsx(BaseInput,Object.assign({type:"checkbox",name:fieldName,disabled:forceDisabled,onChange:handleChange,checked},props))};PrivacyAndTermsCheckbox.propTypes=propTypes,PrivacyAndTermsCheckbox.displayName=displayName;export default PrivacyAndTermsCheckbox;
@@ -1,17 +1 @@
1
- import React, { FunctionComponent } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type QuantitySelectorChildrenProps = FunctionChildren<Omit<QuantitySelectorProps, 'children'> & {
4
- handleChange: (event: React.MouseEvent<HTMLInputElement>) => void;
5
- handleBlur: (event: React.MouseEvent<HTMLInputElement>) => void;
6
- }>;
7
- declare type QuantitySelectorProps = {
8
- children?: QuantitySelectorChildrenProps;
9
- disabled?: boolean;
10
- min?: number;
11
- max?: number;
12
- value?: string;
13
- skuCode?: string;
14
- skuListId?: string;
15
- } & JSX.IntrinsicElements['input'];
16
- declare const QuantitySelector: FunctionComponent<QuantitySelectorProps>;
17
- export default QuantitySelector;
1
+ import React,{FunctionComponent}from'react';import{FunctionChildren}from'../typings/index';declare type QuantitySelectorChildrenProps=FunctionChildren<Omit<QuantitySelectorProps,'children'>&{handleChange:(event:React.MouseEvent<HTMLInputElement>)=>void;handleBlur:(event:React.MouseEvent<HTMLInputElement>)=>void;}>;declare type QuantitySelectorProps={children?:QuantitySelectorChildrenProps;disabled?:boolean;min?:number;max?:number;value?:string;skuCode?:string;skuListId?:string;}&JSX.IntrinsicElements['input'];declare const QuantitySelector:FunctionComponent<QuantitySelectorProps>;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{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})):_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 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type SaveAddressesButtonChildrenProps = FunctionChildren<Omit<SaveAddressesButtonProps, 'children'>>;
4
- declare type SaveAddressesButtonProps = {
5
- children?: SaveAddressesButtonChildrenProps;
6
- label?: string | ReactNode;
7
- onClick?: () => void;
8
- } & JSX.IntrinsicElements['button'];
9
- declare const SaveAddressesButton: FunctionComponent<SaveAddressesButtonProps>;
10
- export default SaveAddressesButton;
1
+ import{FunctionComponent,ReactNode}from'react';import{FunctionChildren}from'../typings/index';declare type SaveAddressesButtonChildrenProps=FunctionChildren<Omit<SaveAddressesButtonProps,'children'>>;declare type SaveAddressesButtonProps={children?:SaveAddressesButtonChildrenProps;label?:string|ReactNode;onClick?:()=>void;}&JSX.IntrinsicElements['button'];declare const SaveAddressesButton:FunctionComponent<SaveAddressesButtonProps>;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{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})):_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 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type ParentProps = {
4
- handleClick: () => any;
5
- };
6
- declare type SaveAddressesButtonChildrenProps = FunctionChildren<Omit<SaveCustomerButtonProps & ParentProps, 'children'>>;
7
- declare type SaveCustomerButtonProps = {
8
- children?: SaveAddressesButtonChildrenProps;
9
- label?: string | ReactNode;
10
- onClick?: () => void;
11
- } & JSX.IntrinsicElements['button'];
12
- declare const SaveCustomerButton: FunctionComponent<SaveCustomerButtonProps>;
13
- export default SaveCustomerButton;
1
+ import{FunctionComponent,ReactNode}from'react';import{FunctionChildren}from'../typings/index';declare type ParentProps={handleClick:()=>any;};declare type SaveAddressesButtonChildrenProps=FunctionChildren<Omit<SaveCustomerButtonProps&ParentProps,'children'>>;declare type SaveCustomerButtonProps={children?:SaveAddressesButtonChildrenProps;label?:string|ReactNode;onClick?:()=>void;}&JSX.IntrinsicElements['button'];declare const SaveCustomerButton:FunctionComponent<SaveCustomerButtonProps>;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,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})):_jsx("button",Object.assign({type:"button",disabled:disable,onClick:handleClick},p,{children:label}))};SaveCustomerButton.propTypes=propTypes,SaveCustomerButton.defaultProps=defaultProps,SaveCustomerButton.displayName=displayName;export default SaveCustomerButton;
@@ -1,8 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { LoaderType } from '../typings/index';
3
- declare type ShipmentProps = {
4
- children: ReactNode;
5
- loader?: LoaderType;
6
- };
7
- declare const Shipment: FunctionComponent<ShipmentProps>;
8
- export default Shipment;
1
+ import{FunctionComponent,ReactNode}from'react';import{LoaderType}from'../typings/index';declare type ShipmentProps={children:ReactNode;loader?:LoaderType;};declare const Shipment:FunctionComponent<ShipmentProps>;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}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})};Shipment.propTypes=propTypes,Shipment.displayName=displayName;export default Shipment;
@@ -1,12 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { Shipment } from '@commercelayer/sdk';
3
- declare type ShipmentFieldChildrenProps = Omit<ShipmentFieldProps, 'children'> & {
4
- shipment: Shipment;
5
- };
6
- export declare type ShipmentAttribute = 'number' | 'currency_code' | 'status' | 'cost_amount_cents' | 'cost_amount_float' | 'formatted_cost_amount' | 'key_number';
7
- declare type ShipmentFieldProps = {
8
- children?: (props: ShipmentFieldChildrenProps) => ReactNode;
9
- name: ShipmentAttribute;
10
- } & JSX.IntrinsicElements['span'];
11
- declare const ShipmentField: FunctionComponent<ShipmentFieldProps>;
12
- export default ShipmentField;
1
+ import{FunctionComponent,ReactNode}from'react';import{Shipment}from'@commercelayer/sdk';declare type ShipmentFieldChildrenProps=Omit<ShipmentFieldProps,'children'>&{shipment:Shipment;};export declare type ShipmentAttribute='number'|'currency_code'|'status'|'cost_amount_cents'|'cost_amount_float'|'formatted_cost_amount'|'key_number';declare type ShipmentFieldProps={children?:(props:ShipmentFieldChildrenProps)=>ReactNode;name:ShipmentAttribute;}&JSX.IntrinsicElements['span'];declare const ShipmentField:FunctionComponent<ShipmentFieldProps>;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,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 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type ShipmentsContainerProps = {
3
- children: ReactNode;
4
- };
5
- declare const ShipmentsContainer: FunctionComponent<ShipmentsContainerProps>;
6
- export default ShipmentsContainer;
1
+ import{FunctionComponent,ReactNode}from'react';declare type ShipmentsContainerProps={children:ReactNode;};declare const ShipmentsContainer:FunctionComponent<ShipmentsContainerProps>;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,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}))};ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
@@ -1,6 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type Props = {
3
- children: ReactNode;
4
- };
5
- declare const ShippingAddressContainer: FunctionComponent<Props>;
6
- export default ShippingAddressContainer;
1
+ import{FunctionComponent,ReactNode}from'react';declare type Props={children:ReactNode;};declare const ShippingAddressContainer:FunctionComponent<Props>;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}=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,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==null?void 0:options.customerAddressId}),setCloneAddress(id,"shipping_address")}});return _jsx(ShippingAddressContext.Provider,Object.assign({value:contextValue},{children}))};ShippingAddressContainer.propTypes=propTypes;export default ShippingAddressContainer;
@@ -1,8 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type ShippingAddressFormProps = {
3
- children: ReactNode;
4
- reset?: boolean;
5
- errorClassName?: string;
6
- } & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
7
- declare const ShippingAddressForm: FunctionComponent<ShippingAddressFormProps>;
8
- export default ShippingAddressForm;
1
+ import{FunctionComponent,ReactNode}from'react';declare type ShippingAddressFormProps={children:ReactNode;reset?:boolean;errorClassName?:string;}&Omit<JSX.IntrinsicElements['form'],'onSubmit'>;declare const ShippingAddressForm:FunctionComponent<ShippingAddressFormProps>;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";import{businessMandatoryField}from"../utils/validateFormFields";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,isBusiness}=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];businessMandatoryField(name,isBusiness)||delete 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:Object.assign(Object.assign({},values),isBusiness&&{business:isBusiness}),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,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}),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,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;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];businessMandatoryField(name,isBusiness)||delete 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:Object.assign(Object.assign({},values),isBusiness&&{business:isBusiness}),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,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 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseAmountComponent } from '../typings/index';
3
- declare const ShippingAmount: FunctionComponent<BaseAmountComponent>;
4
- export default ShippingAmount;
1
+ import{FunctionComponent}from'react';import{BaseAmountComponent}from'../typings/index';declare const ShippingAmount:FunctionComponent<BaseAmountComponent>;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,ShippingAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"shipping"},props));ShippingAmount.propTypes=propTypes,ShippingAmount.displayName=displayName;export default ShippingAmount;
@@ -1,8 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type ShippingMethodProps = {
3
- children: ReactNode;
4
- readonly?: boolean;
5
- emptyText?: string;
6
- };
7
- declare const ShippingMethod: FunctionComponent<ShippingMethodProps>;
8
- export default ShippingMethod;
1
+ import{FunctionComponent,ReactNode}from'react';declare type ShippingMethodProps={children:ReactNode;readonly?:boolean;emptyText?:string;};declare const ShippingMethod:FunctionComponent<ShippingMethodProps>;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,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})};ShippingMethod.propTypes=propTypes,ShippingMethod.displayName=displayName;export default ShippingMethod;
@@ -1,11 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { ShippingMethod } from '@commercelayer/sdk';
3
- declare type LineItemNameChildrenProps = Omit<LineItemNameProps, 'children'> & {
4
- label: string;
5
- shippingMethod: ShippingMethod;
6
- };
7
- declare type LineItemNameProps = {
8
- children?: (props: LineItemNameChildrenProps) => ReactNode;
9
- } & JSX.IntrinsicElements['label'];
10
- declare const ShippingMethodName: FunctionComponent<LineItemNameProps>;
11
- export default ShippingMethodName;
1
+ import{FunctionComponent,ReactNode}from'react';import{ShippingMethod}from'@commercelayer/sdk';declare type LineItemNameChildrenProps=Omit<LineItemNameProps,'children'>&{label:string;shippingMethod:ShippingMethod;};declare type LineItemNameProps={children?:(props:LineItemNameChildrenProps)=>ReactNode;}&JSX.IntrinsicElements['label'];declare const ShippingMethodName:FunctionComponent<LineItemNameProps>;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,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})):_jsx("label",Object.assign({htmlFor},props,{children:labelName}))};ShippingMethodName.propTypes=propTypes,ShippingMethodName.displayName=displayName;export default ShippingMethodName;
@@ -1,13 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseAmountComponent } from '../typings/index';
3
- export declare type ShippingMethodPriceProps = BaseAmountComponent & {
4
- labelFreeOver?: string;
5
- } & ({
6
- type?: 'amount';
7
- base?: 'freeOver';
8
- } | {
9
- type?: 'amount' | 'amountForShipment';
10
- base?: 'price';
11
- });
12
- declare const ShippingMethodPrice: FunctionComponent<ShippingMethodPriceProps>;
13
- export default ShippingMethodPrice;
1
+ import{FunctionComponent}from'react';import{BaseAmountComponent}from'../typings/index';export declare type ShippingMethodPriceProps=BaseAmountComponent&{labelFreeOver?:string;}&({type?:'amount';base?:'freeOver';}|{type?:'amount'|'amountForShipment';base?:'price';});declare const ShippingMethodPrice:FunctionComponent<ShippingMethodPriceProps>;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:"free_over",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";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:"free_over",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})):_jsx("span",Object.assign({},p,{children:(order==null?void 0:order.total_amount_cents)&&isNumber(freeOverAmountCents)&&freeOverAmountCents<order.total_amount_cents?labelFreeOver:price}))};ShippingMethodPrice.propTypes=propTypes,ShippingMethodPrice.displayName=displayName;export default ShippingMethodPrice;
@@ -1,13 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { ShippingMethod } from '@commercelayer/sdk';
3
- export declare type ShippingMethodRadioButtonType = Omit<ShippingMethodRadioButtonProps, 'children'> & {
4
- shippingMethod: ShippingMethod;
5
- shipmentId: string;
6
- };
7
- export declare type ShippingMethodRadioButtonOnChangeType = (shippingMethod: ShippingMethod, shipmentId: string) => void;
8
- declare type ShippingMethodRadioButtonProps = {
9
- children?: (props: ShippingMethodRadioButtonType) => ReactNode;
10
- onChange?: ShippingMethodRadioButtonOnChangeType;
11
- } & Omit<JSX.IntrinsicElements['input'], 'onChange'>;
12
- declare const ShippingMethodRadioButton: FunctionComponent<ShippingMethodRadioButtonProps>;
13
- export default ShippingMethodRadioButton;
1
+ import{FunctionComponent,ReactNode}from'react';import{ShippingMethod}from'@commercelayer/sdk';export declare type ShippingMethodRadioButtonType=Omit<ShippingMethodRadioButtonProps,'children'>&{shippingMethod:ShippingMethod;shipmentId:string;};export declare type ShippingMethodRadioButtonOnChangeType=(shippingMethod:ShippingMethod,shipmentId:string)=>void;declare type ShippingMethodRadioButtonProps={children?:(props:ShippingMethodRadioButtonType)=>ReactNode;onChange?:ShippingMethodRadioButtonOnChangeType;}&Omit<JSX.IntrinsicElements['input'],'onChange'>;declare const ShippingMethodRadioButton:FunctionComponent<ShippingMethodRadioButtonProps>;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}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})):_jsx("input",Object.assign({type:"radio",name,id,onChange:handleOnChange,defaultChecked:checked},p))};ShippingMethodRadioButton.propTypes=propTypes,ShippingMethodRadioButton.displayName=displayName;export default ShippingMethodRadioButton;
@@ -1,7 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type SkuListProp = {
3
- children: ReactNode;
4
- id: string;
5
- };
6
- declare const SkuList: FunctionComponent<SkuListProp>;
7
- export default SkuList;
1
+ import{FunctionComponent,ReactNode}from'react';declare type SkuListProp={children:ReactNode;id:string;};declare const SkuList:FunctionComponent<SkuListProp>;export default SkuList;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,Fragment}from"react";import SkuListsContext from"../context/SkuListsContext";import components from"../config/components";const propTypes=components.SkuList.propTypes,displayName=components.SkuList.displayName,SkuList=props=>{const{id,children}=props,{listIds}=useContext(SkuListsContext);return useEffect(()=>{listIds&&!listIds.includes(id)&&listIds.push(id)},[]),_jsx(Fragment,{children},void 0)};SkuList.propTypes=propTypes,SkuList.displayName=displayName;export default SkuList;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,Fragment}from"react";import SkuListsContext from"../context/SkuListsContext";import components from"../config/components";const propTypes=components.SkuList.propTypes,displayName=components.SkuList.displayName,SkuList=props=>{const{id,children}=props,{listIds}=useContext(SkuListsContext);return useEffect(()=>{listIds&&!listIds.includes(id)&&listIds.push(id)},[]),_jsx(Fragment,{children})};SkuList.propTypes=propTypes,SkuList.displayName=displayName;export default SkuList;
@@ -1,6 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type SkuListsContainerProp = {
3
- children: ReactNode;
4
- };
5
- declare const SkuListsContainer: FunctionComponent<SkuListsContainerProp>;
6
- export default SkuListsContainer;
1
+ import{FunctionComponent,ReactNode}from'react';declare type SkuListsContainerProp={children:ReactNode;};declare const SkuListsContainer:FunctionComponent<SkuListsContainerProp>;export default SkuListsContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuListsContext from"../context/SkuListsContext";import CommerceLayerContext from"../context/CommerceLayerContext";import skuListsReducer,{skuListsInitialState,getSkuList}from"../reducers/SkuListsReducer";import components from"../config/components";const propTypes=components.SkuListsContainer.propTypes,displayName=components.SkuListsContainer.displayName,SkuListsContainer=props=>{const{children}=props,[state,dispatch]=useReducer(skuListsReducer,skuListsInitialState),config=useContext(CommerceLayerContext);return useEffect(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&getSkuList({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),_jsx(SkuListsContext.Provider,Object.assign({value:state},{children}),void 0)};SkuListsContainer.propTypes=propTypes,SkuListsContainer.displayName=displayName;export default SkuListsContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuListsContext from"../context/SkuListsContext";import CommerceLayerContext from"../context/CommerceLayerContext";import skuListsReducer,{skuListsInitialState,getSkuList}from"../reducers/SkuListsReducer";import components from"../config/components";const propTypes=components.SkuListsContainer.propTypes,displayName=components.SkuListsContainer.displayName,SkuListsContainer=props=>{const{children}=props,[state,dispatch]=useReducer(skuListsReducer,skuListsInitialState),config=useContext(CommerceLayerContext);return useEffect(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&getSkuList({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),_jsx(SkuListsContext.Provider,Object.assign({value:state},{children}))};SkuListsContainer.propTypes=propTypes,SkuListsContainer.displayName=displayName;export default SkuListsContainer;
@@ -1,7 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- export declare type SkuOptionProps = {
3
- children: ReactNode;
4
- id: string;
5
- };
6
- declare const SkuOption: FunctionComponent<SkuOptionProps>;
7
- export default SkuOption;
1
+ import{FunctionComponent,ReactNode}from'react';export declare type SkuOptionProps={children:ReactNode;id:string;};declare const SkuOption:FunctionComponent<SkuOptionProps>;export default SkuOption;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import SkuOptionChildrenContext from"../context/SkuOptionChildrenContext";import SkuOptionsContext from"../context/SkuOptionsContext";import components from"../config/components";const propTypes=components.SkuOption.propTypes,displayName=components.SkuOption.displayName,SkuOption=props=>{const{id}=props,{skuOptions,skuCode}=useContext(SkuOptionsContext),items=skuOptions&&skuOptions.filter(l=>l.id===id).map((skuOption,k)=>_jsx(SkuOptionChildrenContext.Provider,Object.assign({value:{skuOption,skuCode}},{children:props.children}),k));return _jsx(Fragment,{children:items},void 0)};SkuOption.propTypes=propTypes,SkuOption.displayName=displayName;export default SkuOption;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import SkuOptionChildrenContext from"../context/SkuOptionChildrenContext";import SkuOptionsContext from"../context/SkuOptionsContext";import components from"../config/components";const propTypes=components.SkuOption.propTypes,displayName=components.SkuOption.displayName,SkuOption=props=>{const{id}=props,{skuOptions,skuCode}=useContext(SkuOptionsContext),items=skuOptions&&skuOptions.filter(l=>l.id===id).map((skuOption,k)=>_jsx(SkuOptionChildrenContext.Provider,Object.assign({value:{skuOption,skuCode}},{children:props.children}),k));return _jsx(Fragment,{children:items})};SkuOption.propTypes=propTypes,SkuOption.displayName=displayName;export default SkuOption;
@@ -1,5 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseInputComponentProps } from '../typings/index';
3
- declare type SkuOptionInputProps = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
4
- declare const SkuOptionInput: FunctionComponent<SkuOptionInputProps>;
5
- export default SkuOptionInput;
1
+ import{FunctionComponent}from'react';import{BaseInputComponentProps}from'../typings/index';declare type SkuOptionInputProps=BaseInputComponentProps&JSX.IntrinsicElements['input']&JSX.IntrinsicElements['textarea'];declare const SkuOptionInput:FunctionComponent<SkuOptionInputProps>;export default SkuOptionInput;
@@ -1 +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";import components from"../config/components";const propTypes=components.SkuOptionInput.propTypes,displayName=components.SkuOptionInput.displayName,SkuOptionInput=props=>{const{name}=props,{option,setOption}=useContext(ItemContext),{skuOption,skuCode}=useContext(SkuOptionChildrenContext);return _jsx(BaseInput,Object.assign({onChange:event=>{const val=event.target.value,options=has(option,`${skuCode}.${skuOption==null?void 0:skuOption.id}`)?option[skuCode][`${skuOption==null?void 0:skuOption.id}`].options:{},o={[skuCode]:Object.assign(Object.assign({},option[skuCode]),{[`${skuOption==null?void 0:skuOption.id}`]:{skuOptionId:skuOption==null?void 0:skuOption.id,options:Object.assign(Object.assign({},options),{[name]:val})}})};setOption&&setOption(o)}},props),void 0)};SkuOptionInput.propTypes=propTypes,SkuOptionInput.displayName=displayName;export default SkuOptionInput;
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";import components from"../config/components";const propTypes=components.SkuOptionInput.propTypes,displayName=components.SkuOptionInput.displayName,SkuOptionInput=props=>{const{name}=props,{option,setOption}=useContext(ItemContext),{skuOption,skuCode}=useContext(SkuOptionChildrenContext);return _jsx(BaseInput,Object.assign({onChange:event=>{const val=event.target.value,options=has(option,`${skuCode}.${skuOption==null?void 0:skuOption.id}`)?option[skuCode][`${skuOption==null?void 0:skuOption.id}`].options:{},o={[skuCode]:Object.assign(Object.assign({},option[skuCode]),{[`${skuOption==null?void 0:skuOption.id}`]:{skuOptionId:skuOption==null?void 0:skuOption.id,options:Object.assign(Object.assign({},options),{[name]:val})}})};setOption&&setOption(o)}},props))};SkuOptionInput.propTypes=propTypes,SkuOptionInput.displayName=displayName;export default SkuOptionInput;
@@ -1,7 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type SkuOptionsContainerProp = {
3
- children: ReactNode;
4
- skuCode?: string;
5
- };
6
- declare const SkuOptionsContainer: FunctionComponent<SkuOptionsContainerProp>;
7
- export default SkuOptionsContainer;
1
+ import{FunctionComponent,ReactNode}from'react';declare type SkuOptionsContainerProp={children:ReactNode;skuCode?:string;};declare const SkuOptionsContainer:FunctionComponent<SkuOptionsContainerProp>;export default SkuOptionsContainer;
@@ -1 +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,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(()=>(sCode&&item[sCode].sku_options&&getSkuOptions({skuOptions:item[sCode].sku_options,dispatch}),()=>{isEmpty(sCode)&&dispatch({type:"setSkuOptions",payload:{skuOptions:[]}})}),[config,sCode]),_jsx(SkuOptionsContext.Provider,Object.assign({value:skuOptionsValue},{children}),void 0)};SkuOptionsContainer.propTypes=propTypes,SkuOptionsContainer.displayName=displayName;export default SkuOptionsContainer;
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,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(()=>(sCode&&item[sCode].sku_options&&getSkuOptions({skuOptions:item[sCode].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;
@@ -1,6 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type StockTransferProps = {
3
- children: ReactNode;
4
- } & JSX.IntrinsicElements['p'];
5
- declare const StockTransfer: FunctionComponent<StockTransferProps>;
6
- export default StockTransfer;
1
+ import{FunctionComponent,ReactNode}from'react';declare type StockTransferProps={children:ReactNode;}&JSX.IntrinsicElements['p'];declare const StockTransfer:FunctionComponent<StockTransferProps>;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}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})};StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName;export default StockTransfer;
@@ -1,9 +1 @@
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>;
9
- export default StockTransferField;
1
+ import{FunctionComponent,ReactNode}from'react';declare type StockTransferFieldChildrenProps=Omit<StockTransferFieldProps,'children'>;export declare type StockTransferFieldType='quantity'|'sku_code';declare type StockTransferFieldProps={children?:(props:StockTransferFieldChildrenProps)=>ReactNode;type:StockTransferFieldType;}&JSX.IntrinsicElements['p'];declare const StockTransferField:FunctionComponent<StockTransferFieldProps>;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{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})):_jsx("p",Object.assign({},props,{children:text}))};StockTransferField.propTypes=propTypes,StockTransferField.displayName=displayName;export default StockTransferField;
@@ -1,18 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { StripeCardElementOptions, StripeElementLocale } from '@stripe/stripe-js';
3
- import { PaymentMethodConfig } from '../reducers/PaymentMethodReducer';
4
- import { PaymentSourceProps } from './PaymentSource';
5
- export declare type StripeConfig = {
6
- containerClassName?: string;
7
- hintLabel?: string;
8
- name?: string;
9
- options?: StripeCardElementOptions;
10
- [key: string]: any;
11
- };
12
- declare type StripePaymentProps = PaymentMethodConfig['stripePayment'] & JSX.IntrinsicElements['div'] & Partial<PaymentSourceProps['templateCustomerSaveToWallet']> & {
13
- show?: boolean;
14
- publishableKey: string;
15
- locale?: StripeElementLocale;
16
- };
17
- declare const StripePayment: FunctionComponent<StripePaymentProps>;
18
- export default StripePayment;
1
+ import{FunctionComponent}from'react';import{StripeCardElementOptions,StripeElementLocale}from'@stripe/stripe-js';import{PaymentMethodConfig}from'../reducers/PaymentMethodReducer';import{PaymentSourceProps}from'./PaymentSource';export declare type StripeConfig={containerClassName?:string;hintLabel?:string;name?:string;options?:StripeCardElementOptions;[key:string]:any;};declare type StripePaymentProps=PaymentMethodConfig['stripePayment']&JSX.IntrinsicElements['div']&Partial<PaymentSourceProps['templateCustomerSaveToWallet']>&{show?:boolean;publishableKey:string;locale?:StripeElementLocale;};declare const StripePayment:FunctionComponent<StripePaymentProps>;export default StripePayment;