@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 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useReducer}from"react";import customerReducer,{customerInitialState,getCustomerAddresses,getCustomerPaymentSources}from"../reducers/CustomerReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{saveCustomerUser}from"../reducers/CustomerReducer";import CustomerContext from"../context/CustomerContext";import{defaultCustomerContext}from"../context/CustomerContext";import{isEmpty}from"lodash";const propTypes=components.CustomerContainer.propTypes,displayName=components.CustomerContainer.displayName,CustomerContainer=props=>{const{children,isGuest=!1}=props,[state,dispatch]=useReducer(customerReducer,customerInitialState),{order,addResourceToInclude,include,updateOrder,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>(!(include==null?void 0:include.includes("available_customer_payment_sources.payment_source"))&&!isGuest?addResourceToInclude({newResource:"available_customer_payment_sources.payment_source"}):!(includeLoaded==null?void 0:includeLoaded["available_customer_payment_sources.payment_source"])&&!isGuest&&addResourceToInclude({newResourceLoaded:{"available_customer_payment_sources.payment_source":!0}}),config.accessToken&&isEmpty(state.addresses)&&!isGuest&&getCustomerAddresses({config,dispatch}),(order==null?void 0:order.available_customer_payment_sources)&&!isGuest&&getCustomerPaymentSources({dispatch,order}),()=>{dispatch({type:"setCustomerEmail",payload:{}})}),[config.accessToken,order,isGuest,include,includeLoaded]);const contextValue=Object.assign(Object.assign({isGuest},state),{saveCustomerUser:async customerEmail=>{await saveCustomerUser({config,customerEmail,dispatch,updateOrder,order})},setCustomerErrors:errors=>defaultCustomerContext.setCustomerErrors(errors,dispatch),setCustomerEmail:customerEmail=>defaultCustomerContext.setCustomerEmail(customerEmail,dispatch),getCustomerPaymentSources:()=>getCustomerPaymentSources({dispatch,order})});return _jsx(CustomerContext.Provider,Object.assign({value:contextValue},{children}),void 0)};CustomerContainer.propTypes=propTypes,CustomerContainer.displayName=displayName;export default CustomerContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useReducer}from"react";import customerReducer,{customerInitialState,getCustomerAddresses,getCustomerPaymentSources}from"../reducers/CustomerReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{saveCustomerUser}from"../reducers/CustomerReducer";import CustomerContext from"../context/CustomerContext";import{defaultCustomerContext}from"../context/CustomerContext";import{isEmpty}from"lodash";const propTypes=components.CustomerContainer.propTypes,displayName=components.CustomerContainer.displayName,CustomerContainer=props=>{const{children,isGuest=!1}=props,[state,dispatch]=useReducer(customerReducer,customerInitialState),{order,addResourceToInclude,include,updateOrder,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>(!(include==null?void 0:include.includes("available_customer_payment_sources.payment_source"))&&!isGuest?addResourceToInclude({newResource:"available_customer_payment_sources.payment_source"}):!(includeLoaded==null?void 0:includeLoaded["available_customer_payment_sources.payment_source"])&&!isGuest&&addResourceToInclude({newResourceLoaded:{"available_customer_payment_sources.payment_source":!0}}),config.accessToken&&isEmpty(state.addresses)&&!isGuest&&getCustomerAddresses({config,dispatch}),(order==null?void 0:order.available_customer_payment_sources)&&!isGuest&&getCustomerPaymentSources({dispatch,order}),()=>{dispatch({type:"setCustomerEmail",payload:{}})}),[config.accessToken,order,isGuest,include,includeLoaded]);const contextValue=Object.assign(Object.assign({isGuest},state),{saveCustomerUser:async customerEmail=>{await saveCustomerUser({config,customerEmail,dispatch,updateOrder,order})},setCustomerErrors:errors=>defaultCustomerContext.setCustomerErrors(errors,dispatch),setCustomerEmail:customerEmail=>defaultCustomerContext.setCustomerEmail(customerEmail,dispatch),getCustomerPaymentSources:()=>getCustomerPaymentSources({dispatch,order})});return _jsx(CustomerContext.Provider,Object.assign({value:contextValue},{children}))};CustomerContainer.propTypes=propTypes,CustomerContainer.displayName=displayName;export default CustomerContainer;
@@ -1,11 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseInputComponentProps } from '../typings/index';
3
- declare type CustomerInputProps = {
4
- name?: 'customer_email' | string;
5
- type?: 'email' | string;
6
- saveOnBlur?: boolean;
7
- onBlur?: (email: string) => void;
8
- errorClassName?: string;
9
- } & Omit<BaseInputComponentProps, 'name' | 'type' | 'onBlur'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
10
- declare const CustomerInput: FunctionComponent<CustomerInputProps>;
11
- export default CustomerInput;
1
+ import{FunctionComponent}from'react';import{BaseInputComponentProps}from'../typings/index';declare type CustomerInputProps={name?:'customer_email'|string;type?:'email'|string;saveOnBlur?:boolean;onBlur?:(email:string)=>void;errorClassName?:string;}&Omit<BaseInputComponentProps,'name'|'type'|'onBlur'>&JSX.IntrinsicElements['input']&JSX.IntrinsicElements['textarea'];declare const CustomerInput:FunctionComponent<CustomerInputProps>;export default CustomerInput;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseInput from"./utils/BaseInput";import components from"../config/components";import useRapidForm from"rapid-form";import CustomerContext from"../context/CustomerContext";import isEmpty from"lodash/isEmpty";const propTypes=components.CustomerInput.propTypes,displayName=components.CustomerInput.displayName,CustomerInput=props=>{const{name="customer_email",placeholder="",required=!0,saveOnBlur=!1,type="email",value,onBlur,className,errorClassName}=props,p=__rest(props,["name","placeholder","required","saveOnBlur","type","value","onBlur","className","errorClassName"]),{validation,values,errors}=useRapidForm({fieldEvent:"blur"}),{saveCustomerUser,setCustomerErrors,setCustomerEmail}=useContext(CustomerContext),[hasError,setHasError]=useState(!1),handleOnBlur=async()=>{saveOnBlur&&isEmpty(errors)&&!isEmpty(values)&&(await saveCustomerUser(values[name].value),onBlur&&onBlur(values[name].value))};useEffect(()=>{if(isEmpty(errors))isEmpty(values)||(setCustomerErrors([]),setCustomerEmail(values[name].value),setHasError(!1));else{const formErrors=[];for(const fieldName in errors){const{code,message}=errors[fieldName];formErrors.push({code,message,resource:"orders",field:fieldName})}isEmpty(formErrors)||(setHasError(!0),setCustomerErrors(formErrors))}return()=>{setHasError(!1)}},[errors]);const classNameComputed=`${className} ${hasError?errorClassName:""}`;return _jsx(BaseInput,Object.assign({name,type,ref:validation,required,placeholder,defaultValue:value,onBlur:handleOnBlur,className:classNameComputed},p),void 0)};CustomerInput.propTypes=propTypes,CustomerInput.displayName=displayName;export default CustomerInput;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseInput from"./utils/BaseInput";import components from"../config/components";import useRapidForm from"rapid-form";import CustomerContext from"../context/CustomerContext";import isEmpty from"lodash/isEmpty";const propTypes=components.CustomerInput.propTypes,displayName=components.CustomerInput.displayName,CustomerInput=props=>{const{name="customer_email",placeholder="",required=!0,saveOnBlur=!1,type="email",value,onBlur,className,errorClassName}=props,p=__rest(props,["name","placeholder","required","saveOnBlur","type","value","onBlur","className","errorClassName"]),{validation,values,errors}=useRapidForm({fieldEvent:"blur"}),{saveCustomerUser,setCustomerErrors,setCustomerEmail}=useContext(CustomerContext),[hasError,setHasError]=useState(!1),handleOnBlur=async()=>{saveOnBlur&&isEmpty(errors)&&!isEmpty(values)&&(await saveCustomerUser(values[name].value),onBlur&&onBlur(values[name].value))};useEffect(()=>{if(isEmpty(errors))isEmpty(values)||(setCustomerErrors([]),setCustomerEmail(values[name].value),setHasError(!1));else{const formErrors=[];for(const fieldName in errors){const{code,message}=errors[fieldName];formErrors.push({code,message,resource:"orders",field:fieldName})}isEmpty(formErrors)||(setHasError(!0),setCustomerErrors(formErrors))}return()=>{setHasError(!1)}},[errors]);const classNameComputed=`${className} ${hasError?errorClassName:""}`;return _jsx(BaseInput,Object.assign({name,type,ref:validation,required,placeholder,defaultValue:value,onBlur:handleOnBlur,className:classNameComputed},p))};CustomerInput.propTypes=propTypes,CustomerInput.displayName=displayName;export default CustomerInput;
@@ -1,10 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- export declare type DeliveryLeadTimeField = 'min_hours' | 'max_hours' | 'min_days' | 'max_days';
3
- export declare type DeliveryLeadTimeComponentChildren = Omit<ShippingMethodPriceProps, 'children'>;
4
- export interface ShippingMethodPriceProps extends Partial<JSX.IntrinsicElements['span']> {
5
- children?: (props: DeliveryLeadTimeComponentChildren) => ReactNode;
6
- type: DeliveryLeadTimeField;
7
- text?: string;
8
- }
9
- declare const DeliveryLeadTime: FunctionComponent<ShippingMethodPriceProps>;
10
- export default DeliveryLeadTime;
1
+ import{FunctionComponent,ReactNode}from'react';export declare type DeliveryLeadTimeField='min_hours'|'max_hours'|'min_days'|'max_days';export declare type DeliveryLeadTimeComponentChildren=Omit<ShippingMethodPriceProps,'children'>;export interface ShippingMethodPriceProps extends Partial<JSX.IntrinsicElements['span']>{children?:(props:DeliveryLeadTimeComponentChildren)=>ReactNode;type:DeliveryLeadTimeField;text?:string;}declare const DeliveryLeadTime:FunctionComponent<ShippingMethodPriceProps>;export default DeliveryLeadTime;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.DeliveryLeadTime.propTypes,displayName=components.DeliveryLeadTime.displayName,DeliveryLeadTime=props=>{const{type}=props,p=__rest(props,["type"]),[text,setText]=useState(),{deliveryLeadTimeForShipment}=useContext(ShippingMethodChildrenContext);useEffect(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps=Object.assign({text},p);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("span",Object.assign({},p,{children:text}),void 0)};DeliveryLeadTime.propTypes=propTypes,DeliveryLeadTime.displayName=displayName;export default DeliveryLeadTime;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../context/ShippingMethodChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.DeliveryLeadTime.propTypes,displayName=components.DeliveryLeadTime.displayName,DeliveryLeadTime=props=>{const{type}=props,p=__rest(props,["type"]),[text,setText]=useState(),{deliveryLeadTimeForShipment}=useContext(ShippingMethodChildrenContext);useEffect(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps=Object.assign({text},p);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("span",Object.assign({},p,{children:text}))};DeliveryLeadTime.propTypes=propTypes,DeliveryLeadTime.displayName=displayName;export default DeliveryLeadTime;
@@ -1,4 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseAmountComponent } from '../typings/index';
3
- declare const DiscountAmount: FunctionComponent<BaseAmountComponent>;
4
- export default DiscountAmount;
1
+ import{FunctionComponent}from'react';import{BaseAmountComponent}from'../typings/index';declare const DiscountAmount:FunctionComponent<BaseAmountComponent>;export default DiscountAmount;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.DiscountAmount.propTypes,defaultProps=components.DiscountAmount.defaultProps,displayName=components.DiscountAmount.displayName,DiscountAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"discount"},props),void 0);DiscountAmount.propTypes=propTypes,DiscountAmount.defaultProps=defaultProps,DiscountAmount.displayName=displayName;export default DiscountAmount;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.DiscountAmount.propTypes,defaultProps=components.DiscountAmount.defaultProps,displayName=components.DiscountAmount.displayName,DiscountAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"discount"},props));DiscountAmount.propTypes=propTypes,DiscountAmount.defaultProps=defaultProps,DiscountAmount.displayName=displayName;export default DiscountAmount;
@@ -1,5 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { ErrorComponentProps } from '../typings/errors';
3
- export declare type ErrorsProps = ErrorComponentProps & JSX.IntrinsicElements['span'];
4
- declare const Errors: FunctionComponent<ErrorsProps>;
5
- export default Errors;
1
+ import{FunctionComponent}from'react';import{ErrorComponentProps}from'../typings/errors';export declare type ErrorsProps=ErrorComponentProps&JSX.IntrinsicElements['span'];declare const Errors:FunctionComponent<ErrorsProps>;export default Errors;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment,useMemo}from"react";import Parent from"./utils/Parent";import GiftCardContext from"../context/GiftCardContext";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";import getAllErrors from"./utils/getAllErrors";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import CustomerContext from"../context/CustomerContext";import PaymentMethodContext from"../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";const propTypes=components.Errors.propTypes,displayName=components.Errors.displayName,Errors=props=>{const{children,messages=[],resource,field}=props,p=__rest(props,["children","messages","resource","field"]),{payment}=useContext(PaymentMethodChildrenContext),{errors:orderErrors}=useContext(OrderContext),{errors:giftCardErrors}=useContext(GiftCardContext),{errors:lineItemErrors}=useContext(LineItemContext),{errors:addressErrors}=useContext(AddressContext),{errors:customerErrors}=useContext(CustomerContext),{errors:paymentMethodErrors,currentPaymentMethodType,currentPaymentMethodId}=useContext(PaymentMethodContext),{lineItem}=useContext(LineItemChildrenContext),allErrors=useMemo(()=>[...giftCardErrors||[],...orderErrors||[],...lineItemErrors||[],...addressErrors||[],...customerErrors||[],...(paymentMethodErrors==null?void 0:paymentMethodErrors.filter(v=>v.field===currentPaymentMethodType&&(payment==null?void 0:payment.id)===currentPaymentMethodId))||[]],[giftCardErrors,orderErrors,lineItemErrors,addressErrors,customerErrors,paymentMethodErrors]),msgErrors=getAllErrors({allErrors,field,messages,props:p,lineItem,resource,returnHtml:!children}),parentProps=Object.assign({messages,resource,field,errors:msgErrors},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx(Fragment,{children:msgErrors},void 0)};Errors.propTypes=propTypes,Errors.displayName=displayName;export default Errors;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment,useMemo}from"react";import Parent from"./utils/Parent";import GiftCardContext from"../context/GiftCardContext";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";import getAllErrors from"./utils/getAllErrors";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import CustomerContext from"../context/CustomerContext";import PaymentMethodContext from"../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";const propTypes=components.Errors.propTypes,displayName=components.Errors.displayName,Errors=props=>{const{children,messages=[],resource,field}=props,p=__rest(props,["children","messages","resource","field"]),{payment}=useContext(PaymentMethodChildrenContext),{errors:orderErrors}=useContext(OrderContext),{errors:giftCardErrors}=useContext(GiftCardContext),{errors:lineItemErrors}=useContext(LineItemContext),{errors:addressErrors}=useContext(AddressContext),{errors:customerErrors}=useContext(CustomerContext),{errors:paymentMethodErrors,currentPaymentMethodType,currentPaymentMethodId}=useContext(PaymentMethodContext),{lineItem}=useContext(LineItemChildrenContext),allErrors=useMemo(()=>[...giftCardErrors||[],...orderErrors||[],...lineItemErrors||[],...addressErrors||[],...customerErrors||[],...(paymentMethodErrors==null?void 0:paymentMethodErrors.filter(v=>v.field===currentPaymentMethodType&&(payment==null?void 0:payment.id)===currentPaymentMethodId))||[]],[giftCardErrors,orderErrors,lineItemErrors,addressErrors,customerErrors,paymentMethodErrors]),msgErrors=getAllErrors({allErrors,field,messages,props:p,lineItem,resource,returnHtml:!children}),parentProps=Object.assign({messages,resource,field,errors:msgErrors},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx(Fragment,{children:msgErrors})};Errors.propTypes=propTypes,Errors.displayName=displayName;export default Errors;
@@ -1,7 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type Props = {
3
- children: ReactNode;
4
- url: string;
5
- };
6
- declare const ExternalFunction: FunctionComponent<Props>;
7
- export default ExternalFunction;
1
+ import{FunctionComponent,ReactNode}from'react';declare type Props={children:ReactNode;url:string;};declare const ExternalFunction:FunctionComponent<Props>;export default ExternalFunction;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import ExternalFunctionContext,{callExternalFunction}from"../context/ExternalFunctionContext";import components from"../config/components";const propTypes=components.ExternalFunction.propTypes,displayName=components.ExternalFunction.displayName,ExternalFunction=({children,url})=>_jsx(ExternalFunctionContext.Provider,Object.assign({value:{url,callExternalFunction}},{children}),void 0);ExternalFunction.propTypes=propTypes,ExternalFunction.displayName=displayName;export default ExternalFunction;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import ExternalFunctionContext,{callExternalFunction}from"../context/ExternalFunctionContext";import components from"../config/components";const propTypes=components.ExternalFunction.propTypes,displayName=components.ExternalFunction.displayName,ExternalFunction=({children,url})=>_jsx(ExternalFunctionContext.Provider,Object.assign({value:{url,callExternalFunction}},{children}));ExternalFunction.propTypes=propTypes,ExternalFunction.displayName=displayName;export default ExternalFunction;
@@ -1,8 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { BaseState } from '../typings/index';
3
- declare type GiftCardProps = {
4
- children: ReactNode;
5
- onSubmit?: (values: BaseState) => void;
6
- } & JSX.IntrinsicElements['form'];
7
- declare const GiftCard: FunctionComponent<GiftCardProps>;
8
- export default GiftCard;
1
+ import{FunctionComponent,ReactNode}from'react';import{BaseState}from'../typings/index';declare type GiftCardProps={children:ReactNode;onSubmit?:(values:BaseState)=>void;}&JSX.IntrinsicElements['form'];declare const GiftCard:FunctionComponent<GiftCardProps>;export default GiftCard;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useRef,useContext}from"react";import validateFormFields from"../utils/validateFormFields";import{isEmpty}from"lodash";import GiftCardContext from"../context/GiftCardContext";import components from"../config/components";const propTypes=components.GiftCard.propTypes,defaultProps=components.GiftCard.defaultProps,displayName=components.GiftCard.displayName,GiftCard=props=>{const{children,onSubmit}=props,name="giftCardForm",ref=useRef(null),{addGiftCard,addGiftCardError}=useContext(GiftCardContext);return _jsx(Fragment,{children:_jsx("form",Object.assign({name,ref,onSubmit:e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm==null?void 0:currentForm.elements,{errors,values}=validateFormFields(elements,["currencyCode","balanceCents"],"gift_cards");isEmpty(errors)?(addGiftCard(values),currentForm==null||currentForm.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)}},{children}),name)},void 0)};GiftCard.propTypes=propTypes,GiftCard.defaultProps=defaultProps,GiftCard.displayName=displayName;export default GiftCard;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useRef,useContext}from"react";import validateFormFields from"../utils/validateFormFields";import{isEmpty}from"lodash";import GiftCardContext from"../context/GiftCardContext";import components from"../config/components";const propTypes=components.GiftCard.propTypes,defaultProps=components.GiftCard.defaultProps,displayName=components.GiftCard.displayName,GiftCard=props=>{const{children,onSubmit}=props,name="giftCardForm",ref=useRef(null),{addGiftCard,addGiftCardError}=useContext(GiftCardContext);return _jsx(Fragment,{children:_jsx("form",Object.assign({name,ref,onSubmit:e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm==null?void 0:currentForm.elements,{errors,values}=validateFormFields(elements,["currencyCode","balanceCents"],"gift_cards");isEmpty(errors)?(addGiftCard(values),currentForm==null||currentForm.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)}},{children}),name)})};GiftCard.propTypes=propTypes,GiftCard.defaultProps=defaultProps,GiftCard.displayName=displayName;export default GiftCard;
@@ -1,4 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseAmountComponent } from '../typings/index';
3
- declare const GiftCardAmount: FunctionComponent<BaseAmountComponent>;
4
- export default GiftCardAmount;
1
+ import{FunctionComponent}from'react';import{BaseAmountComponent}from'../typings/index';declare const GiftCardAmount:FunctionComponent<BaseAmountComponent>;export default GiftCardAmount;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.GiftCardAmount.propTypes,displayName=components.GiftCardAmount.displayName,GiftCardAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"gift_card"},props),void 0);GiftCardAmount.propTypes=propTypes,GiftCardAmount.displayName=displayName;export default GiftCardAmount;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"./utils/BaseOrderPrice";import components from"../config/components";const propTypes=components.GiftCardAmount.propTypes,displayName=components.GiftCardAmount.displayName,GiftCardAmount=props=>_jsx(BaseOrderPrice,Object.assign({base:"amount",type:"gift_card"},props));GiftCardAmount.propTypes=propTypes,GiftCardAmount.displayName=displayName;export default GiftCardAmount;
@@ -1,6 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- export declare type GiftCardContainer = {
3
- children: ReactNode;
4
- };
5
- declare const GiftCardContainer: FunctionComponent<GiftCardContainer>;
6
- export default GiftCardContainer;
1
+ import{FunctionComponent,ReactNode}from'react';export declare type GiftCardContainer={children:ReactNode;};declare const GiftCardContainer:FunctionComponent<GiftCardContainer>;export default GiftCardContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../context/GiftCardContext";import CommerceLayerContext from"../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../reducers/GiftCardReducer";import OrderContext from"../context/OrderContext";import components from"../config/components";const propTypes=components.GiftCardContainer.propTypes,displayName=components.GiftCardContainer.displayName,GiftCardContainer=props=>{const{children}=props,[state,dispatch]=useReducer(giftCardReducer,giftCardInitialState),config=useContext(CommerceLayerContext),{getOrder,createOrder,order}=useContext(OrderContext),giftCardValue=Object.assign(Object.assign({},state),{addGiftCardRecipient:values=>addGiftCardRecipient(values,config,dispatch),addGiftCard:values=>addGiftCard(Object.assign({},values),{config,dispatch,getOrder,createOrder,order}),addGiftCardError:errors=>addGiftCardError(errors,dispatch),addGiftCardLoading:loading=>addGiftCardLoading(loading,dispatch)});return _jsx(GiftCardContext.Provider,Object.assign({value:giftCardValue},{children}),void 0)};GiftCardContainer.propTypes=propTypes,GiftCardContainer.displayName=displayName;export default GiftCardContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../context/GiftCardContext";import CommerceLayerContext from"../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../reducers/GiftCardReducer";import OrderContext from"../context/OrderContext";import components from"../config/components";const propTypes=components.GiftCardContainer.propTypes,displayName=components.GiftCardContainer.displayName,GiftCardContainer=props=>{const{children}=props,[state,dispatch]=useReducer(giftCardReducer,giftCardInitialState),config=useContext(CommerceLayerContext),{getOrder,createOrder,order}=useContext(OrderContext),giftCardValue=Object.assign(Object.assign({},state),{addGiftCardRecipient:values=>addGiftCardRecipient(values,config,dispatch),addGiftCard:values=>addGiftCard(Object.assign({},values),{config,dispatch,getOrder,createOrder,order}),addGiftCardError:errors=>addGiftCardError(errors,dispatch),addGiftCardLoading:loading=>addGiftCardLoading(loading,dispatch)});return _jsx(GiftCardContext.Provider,Object.assign({value:giftCardValue},{children}))};GiftCardContainer.propTypes=propTypes,GiftCardContainer.displayName=displayName;export default GiftCardContainer;
@@ -1,7 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseSelectComponentProps } from '../typings/index';
3
- declare type GiftCardCurrencySelectorProps = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
4
- required?: boolean;
5
- } & Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'>;
6
- declare const GiftCardCurrencySelector: FunctionComponent<GiftCardCurrencySelectorProps>;
7
- export default GiftCardCurrencySelector;
1
+ import{FunctionComponent}from'react';import{BaseSelectComponentProps}from'../typings/index';declare type GiftCardCurrencySelectorProps=Omit<BaseSelectComponentProps,'options'|'name'>&{required?:boolean;}&Pick<JSX.IntrinsicElements['select'],'className'|'id'|'style'>;declare const GiftCardCurrencySelector:FunctionComponent<GiftCardCurrencySelectorProps>;export default GiftCardCurrencySelector;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"./utils/BaseSelect";import currencyOptions from"../config/currency";import components from"../config/components";const propTypes=components.GiftCardCurrencySelector.propTypes,defaultProps=components.GiftCardCurrencySelector.defaultProps,displayName=components.GiftCardCurrencySelector.displayName,GiftCardCurrencySelector=props=>_jsx(BaseSelect,Object.assign({options:currencyOptions,name:"currencyCode"},props),void 0);GiftCardCurrencySelector.propTypes=propTypes,GiftCardCurrencySelector.defaultProps=defaultProps,GiftCardCurrencySelector.displayName=displayName;export default GiftCardCurrencySelector;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"./utils/BaseSelect";import currencyOptions from"../config/currency";import components from"../config/components";const propTypes=components.GiftCardCurrencySelector.propTypes,defaultProps=components.GiftCardCurrencySelector.defaultProps,displayName=components.GiftCardCurrencySelector.displayName,GiftCardCurrencySelector=props=>_jsx(BaseSelect,Object.assign({options:currencyOptions,name:"currencyCode"},props));GiftCardCurrencySelector.propTypes=propTypes,GiftCardCurrencySelector.defaultProps=defaultProps,GiftCardCurrencySelector.displayName=displayName;export default GiftCardCurrencySelector;
@@ -1,7 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseInputComponentProps, GiftCardInputName } from '../typings/index';
3
- export declare type GiftCardInputProps = {
4
- name: GiftCardInputName;
5
- } & Omit<BaseInputComponentProps, 'name'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
6
- declare const GiftCardInput: FunctionComponent<GiftCardInputProps>;
7
- export default GiftCardInput;
1
+ import{FunctionComponent}from'react';import{BaseInputComponentProps,GiftCardInputName}from'../typings/index';export declare type GiftCardInputProps={name:GiftCardInputName;}&Omit<BaseInputComponentProps,'name'>&JSX.IntrinsicElements['input']&JSX.IntrinsicElements['textarea'];declare const GiftCardInput:FunctionComponent<GiftCardInputProps>;export default GiftCardInput;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.GiftCardInput.propTypes,displayName=components.GiftCardInput.displayName,GiftCardInput=props=>{const{placeholder=""}=props,p=__rest(props,["placeholder"]);return _jsx(BaseInput,Object.assign({placeholder},p),void 0)};GiftCardInput.propTypes=propTypes,GiftCardInput.displayName=displayName;export default GiftCardInput;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.GiftCardInput.propTypes,displayName=components.GiftCardInput.displayName,GiftCardInput=props=>{const{placeholder=""}=props,p=__rest(props,["placeholder"]);return _jsx(BaseInput,Object.assign({placeholder},p))};GiftCardInput.propTypes=propTypes,GiftCardInput.displayName=displayName;export default GiftCardInput;
@@ -1,13 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- import { CodeType } from '../reducers/OrderReducer';
4
- declare type GiftCardOrCouponCodeChildrenProps = FunctionChildren<Omit<GiftCardOrCouponCodeProps, 'children'> & {
5
- code?: string;
6
- hide?: boolean;
7
- }>;
8
- declare type GiftCardOrCouponCodeProps = {
9
- type?: CodeType;
10
- children?: GiftCardOrCouponCodeChildrenProps;
11
- } & JSX.IntrinsicElements['span'];
12
- declare const GiftCardOrCouponCode: FunctionComponent<GiftCardOrCouponCodeProps>;
13
- export default GiftCardOrCouponCode;
1
+ import{FunctionComponent}from'react';import{FunctionChildren}from'../typings/index';import{CodeType}from'../reducers/OrderReducer';declare type GiftCardOrCouponCodeChildrenProps=FunctionChildren<Omit<GiftCardOrCouponCodeProps,'children'>&{code?:string;hide?:boolean;}>;declare type GiftCardOrCouponCodeProps={type?:CodeType;children?:GiftCardOrCouponCodeChildrenProps;}&JSX.IntrinsicElements['span'];declare const GiftCardOrCouponCode:FunctionComponent<GiftCardOrCouponCodeProps>;export default GiftCardOrCouponCode;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponCode.propTypes,displayName=components.GiftCardOrCouponCode.displayName,GiftCardOrCouponCode=_a=>{var{children,type}=_a,props=__rest(_a,["children","type"]);const{order}=useContext(OrderContext);let codeType=type&&`${type}_code`;!type&&order&&has(order,"coupon_code")&&!isEmpty(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),parentProps=Object.assign(Object.assign({},props),{code,hide});return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):hide?null:_jsx("span",Object.assign({},props,{children:code}),void 0)};GiftCardOrCouponCode.propTypes=propTypes,GiftCardOrCouponCode.displayName=displayName;export default GiftCardOrCouponCode;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponCode.propTypes,displayName=components.GiftCardOrCouponCode.displayName,GiftCardOrCouponCode=_a=>{var{children,type}=_a,props=__rest(_a,["children","type"]);const{order}=useContext(OrderContext);let codeType=type&&`${type}_code`;!type&&order&&has(order,"coupon_code")&&!isEmpty(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),parentProps=Object.assign(Object.assign({},props),{code,hide});return children?_jsx(Parent,Object.assign({},parentProps,{children})):hide?null:_jsx("span",Object.assign({},props,{children:code}))};GiftCardOrCouponCode.propTypes=propTypes,GiftCardOrCouponCode.displayName=displayName;export default GiftCardOrCouponCode;
@@ -1,10 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type GiftCardOrCouponFormProps = {
3
- children: ReactNode;
4
- reset?: boolean;
5
- onSubmit?: (response: {
6
- success: boolean;
7
- }) => void;
8
- } & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
9
- declare const GiftCardOrCouponForm: FunctionComponent<GiftCardOrCouponFormProps>;
10
- export default GiftCardOrCouponForm;
1
+ import{FunctionComponent,ReactNode}from'react';declare type GiftCardOrCouponFormProps={children:ReactNode;reset?:boolean;onSubmit?:(response:{success:boolean;})=>void;}&Omit<JSX.IntrinsicElements['form'],'onSubmit'>;declare const GiftCardOrCouponForm:FunctionComponent<GiftCardOrCouponFormProps>;export default GiftCardOrCouponForm;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";import OrderContext from"../context/OrderContext";import isEmpty from"lodash/isEmpty";import components from"../config/components";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";const propTypes=components.GiftCardOrCouponForm.propTypes,GiftCardOrCouponForm=props=>{const{children,autoComplete="on",reset=!1,onSubmit}=props,p=__rest(props,["children","autoComplete","reset","onSubmit"]),{validation,values}=useRapidForm(),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=useContext(OrderContext),ref=useRef(null),inputName="gift_card_or_coupon_code";useEffect(()=>{var _a;if(((_a=values[inputName])===null||_a===void 0?void 0:_a.value)===""&&findIndex(errors,{field:camelCase(inputName)})!==-1){const err=dropWhile(errors,i=>i.field===camelCase(inputName));setOrderErrors({errors:err}),onSubmit&&onSubmit({success:!0})}},[values]);const handleSubmit=async e=>{e.preventDefault();const code=has(values,inputName)?values[inputName].value:void 0;if(code){const{success}=await setGiftCardOrCouponCode({code});onSubmit&&onSubmit({success}),success&&e.target.reset()}};return(order==null?void 0:order.gift_card_or_coupon_code)||isEmpty(order)?null:_jsx(CouponAndGiftCardFormContext.Provider,Object.assign({value:{validation}},{children:_jsx("form",Object.assign({ref,autoComplete,onSubmit:handleSubmit},p,{children}),void 0)}),void 0)};GiftCardOrCouponForm.propTypes=propTypes;export default GiftCardOrCouponForm;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import useRapidForm from"rapid-form";import{useContext,useEffect,useRef}from"react";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";import OrderContext from"../context/OrderContext";import isEmpty from"lodash/isEmpty";import components from"../config/components";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";const propTypes=components.GiftCardOrCouponForm.propTypes,GiftCardOrCouponForm=props=>{const{children,autoComplete="on",reset=!1,onSubmit}=props,p=__rest(props,["children","autoComplete","reset","onSubmit"]),{validation,values}=useRapidForm(),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=useContext(OrderContext),ref=useRef(null),inputName="gift_card_or_coupon_code";useEffect(()=>{var _a;if(((_a=values[inputName])===null||_a===void 0?void 0:_a.value)===""&&findIndex(errors,{field:camelCase(inputName)})!==-1){const err=dropWhile(errors,i=>i.field===camelCase(inputName));setOrderErrors({errors:err}),onSubmit&&onSubmit({success:!0})}},[values]);const handleSubmit=async e=>{e.preventDefault();const code=has(values,inputName)?values[inputName].value:void 0;if(code){const{success}=await setGiftCardOrCouponCode({code});onSubmit&&onSubmit({success}),success&&e.target.reset()}};return(order==null?void 0:order.gift_card_or_coupon_code)||isEmpty(order)?null:_jsx(CouponAndGiftCardFormContext.Provider,Object.assign({value:{validation}},{children:_jsx("form",Object.assign({ref,autoComplete,onSubmit:handleSubmit},p,{children}))}))};GiftCardOrCouponForm.propTypes=propTypes;export default GiftCardOrCouponForm;
@@ -1,8 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseInputComponentProps } from '../typings/index';
3
- export declare type GiftCardOrCouponInputProps = {
4
- name?: 'gift_card_or_coupon_code';
5
- type?: 'text';
6
- } & Omit<BaseInputComponentProps, 'name' | 'type'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
7
- declare const GiftCardOrCouponInput: FunctionComponent<GiftCardOrCouponInputProps>;
8
- export default GiftCardOrCouponInput;
1
+ import{FunctionComponent}from'react';import{BaseInputComponentProps}from'../typings/index';export declare type GiftCardOrCouponInputProps={name?:'gift_card_or_coupon_code';type?:'text';}&Omit<BaseInputComponentProps,'name'|'type'>&JSX.IntrinsicElements['input']&JSX.IntrinsicElements['textarea'];declare const GiftCardOrCouponInput:FunctionComponent<GiftCardOrCouponInputProps>;export default GiftCardOrCouponInput;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import BaseInput from"./utils/BaseInput";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";const propTypes=components.GiftCardOrCouponInput.propTypes,displayName=components.GiftCardOrCouponInput.displayName,GiftCardOrCouponInput=props=>{const{placeholder="",required,value}=props,p=__rest(props,["placeholder","required","value"]),{validation}=useContext(CouponAndGiftCardFormContext);return _jsx(BaseInput,Object.assign({type:"text",name:"gift_card_or_coupon_code",ref:validation,required:required!==void 0?required:!0,placeholder,defaultValue:value},p),void 0)};GiftCardOrCouponInput.propTypes=propTypes,GiftCardOrCouponInput.displayName=displayName;export default GiftCardOrCouponInput;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../config/components";import BaseInput from"./utils/BaseInput";import CouponAndGiftCardFormContext from"../context/CouponAndGiftCardFormContext";const propTypes=components.GiftCardOrCouponInput.propTypes,displayName=components.GiftCardOrCouponInput.displayName,GiftCardOrCouponInput=props=>{const{placeholder="",required,value}=props,p=__rest(props,["placeholder","required","value"]),{validation}=useContext(CouponAndGiftCardFormContext);return _jsx(BaseInput,Object.assign({type:"text",name:"gift_card_or_coupon_code",ref:validation,required:required!==void 0?required:!0,placeholder,defaultValue:value},p))};GiftCardOrCouponInput.propTypes=propTypes,GiftCardOrCouponInput.displayName=displayName;export default GiftCardOrCouponInput;
@@ -1,16 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- import { CodeType, OrderCodeType } from '../reducers/OrderReducer';
4
- declare type GiftCardOrCouponRemoveButtonChildrenProps = FunctionChildren<Omit<GiftCardOrCouponRemoveButtonProps, 'children'> & {
5
- codeType?: OrderCodeType;
6
- hide?: boolean;
7
- handleClick?: () => void;
8
- }>;
9
- declare type GiftCardOrCouponRemoveButtonProps = {
10
- type?: CodeType;
11
- children?: GiftCardOrCouponRemoveButtonChildrenProps;
12
- label?: string | ReactNode;
13
- onClick?: () => void;
14
- } & Omit<JSX.IntrinsicElements['button'], 'type'>;
15
- declare const GiftCardOrCouponRemoveButton: FunctionComponent<GiftCardOrCouponRemoveButtonProps>;
16
- export default GiftCardOrCouponRemoveButton;
1
+ import{FunctionComponent,ReactNode}from'react';import{FunctionChildren}from'../typings/index';import{CodeType,OrderCodeType}from'../reducers/OrderReducer';declare type GiftCardOrCouponRemoveButtonChildrenProps=FunctionChildren<Omit<GiftCardOrCouponRemoveButtonProps,'children'>&{codeType?:OrderCodeType;hide?:boolean;handleClick?:()=>void;}>;declare type GiftCardOrCouponRemoveButtonProps={type?:CodeType;children?:GiftCardOrCouponRemoveButtonChildrenProps;label?:string|ReactNode;onClick?:(response:{success:boolean;})=>void;}&Omit<JSX.IntrinsicElements['button'],'type'>;declare const GiftCardOrCouponRemoveButton:FunctionComponent<GiftCardOrCouponRemoveButtonProps>;export default GiftCardOrCouponRemoveButton;
@@ -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 OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponRemoveButton.propTypes,displayName=components.GiftCardOrCouponRemoveButton.displayName,GiftCardOrCouponRemoveButton=props=>{const{children,label="Remove",onClick,type}=props,p=__rest(props,["children","label","onClick","type"]),{order,removeGiftCardOrCouponCode}=useContext(OrderContext);let codeType=`${type}_code`;!type&&order&&has(order,"coupon_code")&&!isEmpty(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),handleClick=()=>{removeGiftCardOrCouponCode&&removeGiftCardOrCouponCode({codeType}),onClick&&onClick()},parentProps=Object.assign(Object.assign({},p),{label,handleClick,codeType});return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):hide?null:_jsx("button",Object.assign({type:"button",onClick:handleClick},p,{children:label}),void 0)};GiftCardOrCouponRemoveButton.propTypes=propTypes,GiftCardOrCouponRemoveButton.displayName=displayName;export default GiftCardOrCouponRemoveButton;
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 OrderContext from"../context/OrderContext";import{has,isEmpty}from"lodash";const propTypes=components.GiftCardOrCouponRemoveButton.propTypes,displayName=components.GiftCardOrCouponRemoveButton.displayName,GiftCardOrCouponRemoveButton=props=>{const{children,label="Remove",onClick,type}=props,p=__rest(props,["children","label","onClick","type"]),{order,removeGiftCardOrCouponCode}=useContext(OrderContext);let codeType=`${type}_code`;!type&&order&&has(order,"coupon_code")&&!isEmpty(order.coupon_code)?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"",hide=!(order&&code),handleClick=async()=>{const response=removeGiftCardOrCouponCode&&await removeGiftCardOrCouponCode({codeType});onClick&&onClick(response)},parentProps=Object.assign(Object.assign({},p),{label,handleClick,codeType});return children?_jsx(Parent,Object.assign({},parentProps,{children})):hide?null:_jsx("button",Object.assign({type:"button",onClick:handleClick},p,{children:label}))};GiftCardOrCouponRemoveButton.propTypes=propTypes,GiftCardOrCouponRemoveButton.displayName=displayName;export default GiftCardOrCouponRemoveButton;
@@ -1,9 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type GiftCardOrCouponSubmitChildrenProps = FunctionChildren<Omit<GiftCardOrCouponSubmitProps, 'children'>>;
4
- declare type GiftCardOrCouponSubmitProps = {
5
- children?: GiftCardOrCouponSubmitChildrenProps;
6
- label?: string | ReactNode;
7
- } & JSX.IntrinsicElements['button'];
8
- declare const GiftCardOrCouponSubmit: FunctionComponent<GiftCardOrCouponSubmitProps>;
9
- export default GiftCardOrCouponSubmit;
1
+ import{FunctionComponent,ReactNode}from'react';import{FunctionChildren}from'../typings/index';declare type GiftCardOrCouponSubmitChildrenProps=FunctionChildren<Omit<GiftCardOrCouponSubmitProps,'children'>>;declare type GiftCardOrCouponSubmitProps={children?:GiftCardOrCouponSubmitChildrenProps;label?:string|ReactNode;}&JSX.IntrinsicElements['button'];declare const GiftCardOrCouponSubmit:FunctionComponent<GiftCardOrCouponSubmitProps>;export default GiftCardOrCouponSubmit;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.GiftCardOrCouponSubmit.propTypes,displayName=components.GiftCardOrCouponSubmit.displayName,GiftCardOrCouponSubmit=props=>{const{children,label="Submit"}=props,p=__rest(props,["children","label"]),parentProps=Object.assign(Object.assign({},p),{label});return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("button",Object.assign({type:"submit"},p,{children:label}),void 0)};GiftCardOrCouponSubmit.propTypes=propTypes,GiftCardOrCouponSubmit.displayName=displayName;export default GiftCardOrCouponSubmit;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.GiftCardOrCouponSubmit.propTypes,displayName=components.GiftCardOrCouponSubmit.displayName,GiftCardOrCouponSubmit=props=>{const{children,label="Submit"}=props,p=__rest(props,["children","label"]),parentProps=Object.assign(Object.assign({},p),{label});return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({type:"submit"},p,{children:label}))};GiftCardOrCouponSubmit.propTypes=propTypes,GiftCardOrCouponSubmit.displayName=displayName;export default GiftCardOrCouponSubmit;
@@ -1,11 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- declare type ItemContainerProps = {
3
- children: ReactNode;
4
- skuCode?: string | null;
5
- lineItem?: {
6
- name: string;
7
- imageUrl?: string | null;
8
- } | null;
9
- };
10
- declare const ItemContainer: FunctionComponent<ItemContainerProps>;
11
- export default ItemContainer;
1
+ import{FunctionComponent,ReactNode}from'react';declare type ItemContainerProps={children:ReactNode;skuCode?:string|null;lineItem?:{name:string;imageUrl?:string|null;}|null;};declare const ItemContainer:FunctionComponent<ItemContainerProps>;export default ItemContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useEffect}from"react";import ItemContext,{initialItemContext}from"../context/ItemContext";import itemReducer,{itemInitialState,setItemState}from"../reducers/ItemReducer";import components from"../config/components";const propTypes=components.ItemContainer.propTypes,displayName=components.ItemContainer.displayName,ItemContainer=props=>{const{children,skuCode,lineItem}=props,[state,dispatch]=useReducer(itemReducer,itemInitialState);useEffect(()=>{skuCode&&setItemState(skuCode,{type:"setSkuCode",key:"skuCode"},dispatch),lineItem&&setItemState(lineItem,{type:"setCustomLineItem",key:"lineItem"},dispatch)},[]);const setItems=items=>setItemState(items,{type:"setItems",key:"items"},dispatch),setItem=item=>setItemState(item,{type:"setItem",key:"item"},dispatch),setQuantity=item=>setItemState(item,{type:"setQuantity",key:"quantity"},dispatch),setOption=item=>setItemState(item,{type:"setOption",key:"option"},dispatch),setPrices=item=>setItemState(item,{type:"setPrices",key:"prices"},dispatch),setCustomLineItems=item=>setItemState(item,{type:"setCustomLineItems",key:"lineItems"},dispatch),itemValue=Object.assign(Object.assign(Object.assign({},initialItemContext),state),{setItems,setItem,setQuantity,setOption,setPrices,setCustomLineItems});return _jsx(ItemContext.Provider,Object.assign({value:itemValue},{children}),void 0)};ItemContainer.propTypes=propTypes,ItemContainer.displayName=displayName;export default ItemContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useEffect}from"react";import ItemContext,{initialItemContext}from"../context/ItemContext";import itemReducer,{itemInitialState,setItemState}from"../reducers/ItemReducer";import components from"../config/components";const propTypes=components.ItemContainer.propTypes,displayName=components.ItemContainer.displayName,ItemContainer=props=>{const{children,skuCode,lineItem}=props,[state,dispatch]=useReducer(itemReducer,itemInitialState);useEffect(()=>{skuCode&&setItemState(skuCode,{type:"setSkuCode",key:"skuCode"},dispatch),lineItem&&setItemState(lineItem,{type:"setCustomLineItem",key:"lineItem"},dispatch)},[]);const setItems=items=>setItemState(items,{type:"setItems",key:"items"},dispatch),setItem=item=>setItemState(item,{type:"setItem",key:"item"},dispatch),setQuantity=item=>setItemState(item,{type:"setQuantity",key:"quantity"},dispatch),setOption=item=>setItemState(item,{type:"setOption",key:"option"},dispatch),setPrices=item=>setItemState(item,{type:"setPrices",key:"prices"},dispatch),setCustomLineItems=item=>setItemState(item,{type:"setCustomLineItems",key:"lineItems"},dispatch),itemValue=Object.assign(Object.assign(Object.assign({},initialItemContext),state),{setItems,setItem,setQuantity,setOption,setPrices,setCustomLineItems});return _jsx(ItemContext.Provider,Object.assign({value:itemValue},{children}))};ItemContainer.propTypes=propTypes,ItemContainer.displayName=displayName;export default ItemContainer;
@@ -1,8 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { LineItemType } from '../typings/index';
3
- declare type LineItemProps = {
4
- children: ReactNode;
5
- type?: LineItemType;
6
- };
7
- declare const LineItem: FunctionComponent<LineItemProps>;
8
- export default LineItem;
1
+ import{FunctionComponent,ReactNode}from'react';import{LineItemType}from'../typings/index';declare type LineItemProps={children:ReactNode;type?:LineItemType;};declare const LineItem:FunctionComponent<LineItemProps>;export default LineItem;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import{isEmpty}from"lodash";const propTypes=components.LineItem.propTypes,displayName=components.LineItem.displayName,LineItem=props=>{const{type="skus",children}=props,{lineItems}=useContext(LineItemContext),{lineItems:shipmentLineItems}=useContext(ShipmentChildrenContext),items=isEmpty(shipmentLineItems)?lineItems:shipmentLineItems,components2=items&&items.filter(l=>l.item_type===type).map((lineItem,k,check)=>{if(lineItem.item_type==="bundles"&&k>0&&check[k-1].bundle_code===lineItem.bundle_code)return null;const lineProps={lineItem};return _jsx(LineItemChildrenContext.Provider,Object.assign({value:lineProps},{children}),k)});return _jsx(Fragment,{children:components2},void 0)};LineItem.propTypes=propTypes,LineItem.displayName=displayName;export default LineItem;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useContext}from"react";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import{isEmpty}from"lodash";const propTypes=components.LineItem.propTypes,displayName=components.LineItem.displayName,LineItem=props=>{const{type="skus",children}=props,{lineItems}=useContext(LineItemContext),{lineItems:shipmentLineItems}=useContext(ShipmentChildrenContext),items=isEmpty(shipmentLineItems)?lineItems:shipmentLineItems,components2=items&&items.filter(l=>l.item_type===type).map((lineItem,k,check)=>{if(lineItem.item_type==="bundles"&&k>0&&check[k-1].bundle_code===lineItem.bundle_code)return null;const lineProps={lineItem};return _jsx(LineItemChildrenContext.Provider,Object.assign({value:lineProps},{children}),k)});return _jsx(Fragment,{children:components2})};LineItem.propTypes=propTypes,LineItem.displayName=displayName;export default LineItem;
@@ -1,7 +1 @@
1
- import { FunctionComponent } from 'react';
2
- import { BaseAmountComponent, BasePriceType } from '../typings/index';
3
- export declare type LineItemAmountProps = BaseAmountComponent & {
4
- type?: BasePriceType;
5
- };
6
- declare const LineItemAmount: FunctionComponent<LineItemAmountProps>;
7
- export default LineItemAmount;
1
+ import{FunctionComponent}from'react';import{BaseAmountComponent,BasePriceType}from'../typings/index';export declare type LineItemAmountProps=BaseAmountComponent&{type?:BasePriceType;};declare const LineItemAmount:FunctionComponent<LineItemAmountProps>;export default LineItemAmount;
@@ -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 LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemAmount.propTypes,defaultProps=components.LineItemAmount.defaultProps,displayName=components.LineItemAmount.displayName,LineItemAmount=props=>{const{format="formatted",type="total"}=props,p=__rest(props,["format","type"]),{lineItem}=useContext(LineItemChildrenContext),[price,setPrice]=useState("");useEffect(()=>{if(lineItem){const p2=getAmount({base:"amount",type,format,obj:lineItem});setPrice(p2)}return()=>{setPrice("")}},[lineItem]);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:price}),void 0)};LineItemAmount.propTypes=propTypes,LineItemAmount.defaultProps=defaultProps,LineItemAmount.displayName=displayName;export default LineItemAmount;
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 LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemAmount.propTypes,defaultProps=components.LineItemAmount.defaultProps,displayName=components.LineItemAmount.displayName,LineItemAmount=props=>{const{format="formatted",type="total"}=props,p=__rest(props,["format","type"]),{lineItem}=useContext(LineItemChildrenContext),[price,setPrice]=useState("");useEffect(()=>{if(lineItem){const p2=getAmount({base:"amount",type,format,obj:lineItem});setPrice(p2)}return()=>{setPrice("")}},[lineItem]);const parentProps=Object.assign({price},p);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("span",Object.assign({},p,{children:price}))};LineItemAmount.propTypes=propTypes,LineItemAmount.defaultProps=defaultProps,LineItemAmount.displayName=displayName;export default LineItemAmount;
@@ -1,12 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { LineItem } from '@commercelayer/sdk';
3
- export declare type LineItemCodeType = Omit<LineItemNameProps, 'children'> & {
4
- lineItem: LineItem;
5
- skuCode: string;
6
- };
7
- declare type LineItemNameProps = {
8
- children?: (props: LineItemCodeType) => ReactNode;
9
- type?: 'sku_code' | 'bundle_code';
10
- } & JSX.IntrinsicElements['p'];
11
- declare const LineItemCode: FunctionComponent<LineItemNameProps>;
12
- export default LineItemCode;
1
+ import{FunctionComponent,ReactNode}from'react';import{LineItem}from'@commercelayer/sdk';export declare type LineItemCodeType=Omit<LineItemNameProps,'children'>&{lineItem:LineItem;skuCode:string;};declare type LineItemNameProps={children?:(props:LineItemCodeType)=>ReactNode;type?:'sku_code'|'bundle_code';}&JSX.IntrinsicElements['p'];declare const LineItemCode:FunctionComponent<LineItemNameProps>;export default LineItemCode;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemCode.propTypes,displayName=components.LineItemCode.displayName,LineItemCode=_a=>{var{type="sku_code",children}=_a,p=__rest(_a,["type","children"]);const{lineItem}=useContext(LineItemChildrenContext),labelName=lineItem==null?void 0:lineItem[type],parentProps=Object.assign({lineItem,skuCode:labelName},p);return children?_jsx(Parent,Object.assign({},parentProps,{children}),void 0):_jsx("p",Object.assign({},p,{children:labelName}),void 0)};LineItemCode.propTypes=propTypes,LineItemCode.displayName=displayName;export default LineItemCode;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemCode.propTypes,displayName=components.LineItemCode.displayName,LineItemCode=_a=>{var{type="sku_code",children}=_a,p=__rest(_a,["type","children"]);const{lineItem}=useContext(LineItemChildrenContext),labelName=lineItem==null?void 0:lineItem[type],parentProps=Object.assign({lineItem,skuCode:labelName},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("p",Object.assign({},p,{children:labelName}))};LineItemCode.propTypes=propTypes,LineItemCode.displayName=displayName;export default LineItemCode;
@@ -1,16 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { LineItem } from '@commercelayer/sdk';
3
- import { LineItemType } from '../typings/index';
4
- export declare type LineItemImageType = Omit<LineItemImageProps, 'children'> & {
5
- src: string;
6
- lineItem: LineItem;
7
- };
8
- declare type LineItemImageProps = {
9
- children?: (props: LineItemImageType) => ReactNode;
10
- width?: number;
11
- placeholder?: {
12
- [K in LineItemType]?: string;
13
- };
14
- } & Omit<JSX.IntrinsicElements['img'], 'src' | 'srcSet' | 'placeholder'>;
15
- declare const LineItemImage: FunctionComponent<LineItemImageProps>;
16
- export default LineItemImage;
1
+ import{FunctionComponent,ReactNode}from'react';import{LineItem}from'@commercelayer/sdk';import{LineItemType}from'../typings/index';export declare type LineItemImageType=Omit<LineItemImageProps,'children'>&{src:string;lineItem:LineItem;};declare type LineItemImageProps={children?:(props:LineItemImageType)=>ReactNode;width?:number;placeholder?:{[K in LineItemType]?:string;};}&Omit<JSX.IntrinsicElements['img'],'src'|'srcSet'|'placeholder'>;declare const LineItemImage:FunctionComponent<LineItemImageProps>;export default LineItemImage;
@@ -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 LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";const defaultImgUrl="https://data.commercelayer.app/assets/images/placeholders/img_placeholder.svg",defaultGiftCardImgUrl="https://data.commercelayer.app/assets/images/placeholders/gift_placeholder.svg",propTypes=components.LineItemImage.propTypes,displayName=components.LineItemImage.displayName,LineItemImage=props=>{const{placeholder,children}=props,p=__rest(props,["placeholder","children"]),{lineItem}=useContext(LineItemChildrenContext),itemType=lineItem==null?void 0:lineItem.item_type;let src=lineItem==null?void 0:lineItem.image_url;src||((placeholder==null?void 0:placeholder[itemType])?src=placeholder==null?void 0:placeholder[itemType]:src=itemType==="gift_cards"?defaultGiftCardImgUrl:defaultImgUrl);const parenProps=Object.assign({lineItem,src,placeholder},p);return children?_jsx(Parent,Object.assign({},parenProps,{children}),void 0):src?_jsx("img",Object.assign({alt:"",src},p),void 0):null};LineItemImage.propTypes=propTypes,LineItemImage.displayName=displayName;export default LineItemImage;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";const defaultImgUrl="https://data.commercelayer.app/assets/images/placeholders/img_placeholder.svg",defaultGiftCardImgUrl="https://data.commercelayer.app/assets/images/placeholders/gift_placeholder.svg",propTypes=components.LineItemImage.propTypes,displayName=components.LineItemImage.displayName,LineItemImage=props=>{const{placeholder,children}=props,p=__rest(props,["placeholder","children"]),{lineItem}=useContext(LineItemChildrenContext),itemType=lineItem==null?void 0:lineItem.item_type;let src=lineItem==null?void 0:lineItem.image_url;src||((placeholder==null?void 0:placeholder[itemType])?src=placeholder==null?void 0:placeholder[itemType]:src=itemType==="gift_cards"?defaultGiftCardImgUrl:defaultImgUrl);const parenProps=Object.assign({lineItem,src,placeholder},p);return children?_jsx(Parent,Object.assign({},parenProps,{children})):src?_jsx("img",Object.assign({alt:"",src},p)):null};LineItemImage.propTypes=propTypes,LineItemImage.displayName=displayName;export default LineItemImage;
@@ -1,11 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { LineItem } from '@commercelayer/sdk';
3
- export declare type LineItemNameType = Omit<LineItemNameProps, 'children'> & {
4
- label: string;
5
- lineItem: LineItem;
6
- };
7
- declare type LineItemNameProps = {
8
- children?: (props: LineItemNameType) => ReactNode;
9
- } & JSX.IntrinsicElements['p'];
10
- declare const LineItemName: FunctionComponent<LineItemNameProps>;
11
- export default LineItemName;
1
+ import{FunctionComponent,ReactNode}from'react';import{LineItem}from'@commercelayer/sdk';export declare type LineItemNameType=Omit<LineItemNameProps,'children'>&{label:string;lineItem:LineItem;};declare type LineItemNameProps={children?:(props:LineItemNameType)=>ReactNode;}&JSX.IntrinsicElements['p'];declare const LineItemName:FunctionComponent<LineItemNameProps>;export default LineItemName;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemName.propTypes,displayName=components.LineItemName.displayName,LineItemName=props=>{const{lineItem}=useContext(LineItemChildrenContext),label=lineItem==null?void 0:lineItem.name,parentProps=Object.assign({label,lineItem},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx("p",Object.assign({},props,{children:label}),void 0)};LineItemName.propTypes=propTypes,LineItemName.displayName=displayName;export default LineItemName;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemName.propTypes,displayName=components.LineItemName.displayName,LineItemName=props=>{const{lineItem}=useContext(LineItemChildrenContext),label=lineItem==null?void 0:lineItem.name,parentProps=Object.assign({label,lineItem},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx("p",Object.assign({},props,{children:label}))};LineItemName.propTypes=propTypes,LineItemName.displayName=displayName;export default LineItemName;
@@ -1,19 +1 @@
1
- import { FunctionComponent, CSSProperties } from 'react';
2
- import { LineItemOption as LineItemOptionType } from '@commercelayer/sdk';
3
- import { FunctionChildren } from '../typings/index';
4
- declare type LineItemOptionChildrenProps = FunctionChildren<Omit<LineItemOptionProps, 'children'> & {
5
- lineItemOption: LineItemOptionType;
6
- }>;
7
- declare type LineItemOptionProps = {
8
- id?: string;
9
- className?: string;
10
- key?: string;
11
- style?: CSSProperties;
12
- children?: LineItemOptionChildrenProps;
13
- name?: string;
14
- valueClassName?: string;
15
- tagElement?: keyof JSX.IntrinsicElements;
16
- tagContainer?: keyof JSX.IntrinsicElements;
17
- };
18
- declare const LineItemOption: FunctionComponent<LineItemOptionProps>;
19
- export default LineItemOption;
1
+ import{FunctionComponent,CSSProperties}from'react';import{LineItemOption as LineItemOptionType}from'@commercelayer/sdk';import{FunctionChildren}from'../typings/index';declare type LineItemOptionChildrenProps=FunctionChildren<Omit<LineItemOptionProps,'children'>&{lineItemOption:LineItemOptionType;}>;declare type LineItemOptionProps={id?:string;className?:string;key?:string;style?:CSSProperties;children?:LineItemOptionChildrenProps;name?:string;valueClassName?:string;tagElement?:keyof JSX.IntrinsicElements;tagContainer?:keyof JSX.IntrinsicElements;};declare const LineItemOption:FunctionComponent<LineItemOptionProps>;export default LineItemOption;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext}from"react";import LineItemOptionChildrenContext from"../context/LineItemOptionChildrenContext";import get from"lodash/get";import has from"lodash/has";import map from"lodash/map";import Parent from"./utils/Parent";import components from"../config/components";import isJSON from"../utils/isJSON";const propTypes=components.LineItemOption.propTypes,displayName=components.LineItemOption.displayName,LineItemOption=props=>{const{name,children,valueClassName,id,key,tagElement="li",tagContainer="ul"}=props,p=__rest(props,["name","children","valueClassName","id","key","tagElement","tagContainer"]),{lineItemOption,showAll}=useContext(LineItemOptionChildrenContext),parentProps=Object.assign(Object.assign({},props),{lineItemOption}),TagElement=tagElement,TagContainer=tagContainer,components2=showAll&&isJSON(JSON.stringify(lineItemOption==null?void 0:lineItemOption.options))?map(lineItemOption==null?void 0:lineItemOption.options,(value,key2)=>_jsxs(TagElement,Object.assign({},p,{children:[`${key2}:`,_jsx("span",Object.assign({className:valueClassName},{children:`${value}`}),void 0)]}),key2)):has(lineItemOption,`options.${name}`)?_jsxs(TagElement,Object.assign({},p,{children:[`${name}:`,_jsx("span",Object.assign({className:valueClassName},p,{children:`${get(lineItemOption,`options.${name}`)}`}),void 0)]}),key):null;return children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):_jsx(TagContainer,{children:components2},void 0)};LineItemOption.propTypes=propTypes,LineItemOption.displayName=displayName;export default LineItemOption;
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext}from"react";import LineItemOptionChildrenContext from"../context/LineItemOptionChildrenContext";import get from"lodash/get";import has from"lodash/has";import map from"lodash/map";import Parent from"./utils/Parent";import components from"../config/components";import isJSON from"../utils/isJSON";const propTypes=components.LineItemOption.propTypes,displayName=components.LineItemOption.displayName,LineItemOption=props=>{const{name,children,valueClassName,id,key,tagElement="li",tagContainer="ul"}=props,p=__rest(props,["name","children","valueClassName","id","key","tagElement","tagContainer"]),{lineItemOption,showAll}=useContext(LineItemOptionChildrenContext),parentProps=Object.assign(Object.assign({},props),{lineItemOption}),TagElement=tagElement,TagContainer=tagContainer,components2=showAll&&isJSON(JSON.stringify(lineItemOption==null?void 0:lineItemOption.options))?map(lineItemOption==null?void 0:lineItemOption.options,(value,key2)=>_jsxs(TagElement,Object.assign({},p,{children:[`${key2}:`,_jsx("span",Object.assign({className:valueClassName},{children:`${value}`}))]}),key2)):has(lineItemOption,`options.${name}`)?_jsxs(TagElement,Object.assign({},p,{children:[`${name}:`,_jsx("span",Object.assign({className:valueClassName},p,{children:`${get(lineItemOption,`options.${name}`)}`}))]}),key):null;return children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):_jsx(TagContainer,{children:components2})};LineItemOption.propTypes=propTypes,LineItemOption.displayName=displayName;export default LineItemOption;
@@ -1,14 +1 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- export declare type LineItemOptionsProps = JSX.IntrinsicElements['span'] & {
3
- children: ReactNode;
4
- title?: string;
5
- showName?: boolean;
6
- } & ({
7
- skuOptionId: string;
8
- showAll?: never;
9
- } | {
10
- skuOptionId?: never;
11
- showAll: true;
12
- });
13
- declare const LineItemOptions: FunctionComponent<LineItemOptionsProps>;
14
- export default LineItemOptions;
1
+ import{FunctionComponent,ReactNode}from'react';export declare type LineItemOptionsProps=JSX.IntrinsicElements['span']&{children:ReactNode;title?:string;showName?:boolean;}&({skuOptionId:string;showAll?:never;}|{skuOptionId?:never;showAll:true;});declare const LineItemOptions:FunctionComponent<LineItemOptionsProps>;export default LineItemOptions;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import LineItemOptionChildrenContext from"../context/LineItemOptionChildrenContext";import{isEmpty}from"lodash";import components from"../config/components";const displayName=components.LineItemOptions.displayName,LineItemOptions=props=>{const{skuOptionId,title,children,showName=!0,showAll}=props,p=__rest(props,["skuOptionId","title","children","showName","showAll"]),{lineItem}=useContext(LineItemChildrenContext),options=(isEmpty(lineItem)?[]:(lineItem==null?void 0:lineItem.line_item_options)||[]).filter(o=>showAll?!0:o.skuOption().id===skuOptionId).map((o,k)=>{const showTitle=showName?_jsx("span",Object.assign({},p,{children:title||o.name}),void 0):null,valueProps={lineItemOption:o,showAll};return _jsxs(Fragment,{children:[showTitle,_jsx(LineItemOptionChildrenContext.Provider,Object.assign({value:valueProps},{children}),void 0)]},k)});return _jsx(Fragment,{children:options},void 0)};LineItemOptions.displayName=displayName;export default LineItemOptions;
1
+ import{__rest}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import LineItemOptionChildrenContext from"../context/LineItemOptionChildrenContext";import{isEmpty}from"lodash";import components from"../config/components";const displayName=components.LineItemOptions.displayName,LineItemOptions=props=>{const{skuOptionId,title,children,showName=!0,showAll}=props,p=__rest(props,["skuOptionId","title","children","showName","showAll"]),{lineItem}=useContext(LineItemChildrenContext),options=(isEmpty(lineItem)?[]:(lineItem==null?void 0:lineItem.line_item_options)||[]).filter(o=>showAll?!0:o.skuOption().id===skuOptionId).map((o,k)=>{const showTitle=showName?_jsx("span",Object.assign({},p,{children:title||o.name})):null,valueProps={lineItemOption:o,showAll};return _jsxs(Fragment,{children:[showTitle,_jsx(LineItemOptionChildrenContext.Provider,Object.assign({value:valueProps},{children}))]},k)});return _jsx(Fragment,{children:options})};LineItemOptions.displayName=displayName;export default LineItemOptions;
@@ -1,14 +1 @@
1
- import React, { FunctionComponent } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type LineItemQuantityChildrenProps = FunctionChildren<Omit<LineItemQuantityProps, 'children'> & {
4
- quantity: number;
5
- handleChange: (event: React.MouseEvent<HTMLSelectElement>) => void;
6
- }>;
7
- declare type LineItemQuantityProps = {
8
- children?: LineItemQuantityChildrenProps;
9
- max?: number;
10
- disabled?: boolean;
11
- readonly?: boolean;
12
- } & (JSX.IntrinsicElements['select'] & JSX.IntrinsicElements['span']);
13
- declare const LineItemQuantity: FunctionComponent<LineItemQuantityProps>;
14
- export default LineItemQuantity;
1
+ import React,{FunctionComponent}from'react';import{FunctionChildren}from'../typings/index';declare type LineItemQuantityChildrenProps=FunctionChildren<Omit<LineItemQuantityProps,'children'>&{quantity:number;handleChange:(event:React.MouseEvent<HTMLSelectElement>)=>void;}>;declare type LineItemQuantityProps={children?:LineItemQuantityChildrenProps;max?:number;disabled?:boolean;readonly?:boolean;}&(JSX.IntrinsicElements['select']&JSX.IntrinsicElements['span']);declare const LineItemQuantity:FunctionComponent<LineItemQuantityProps>;export default LineItemQuantity;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import LineItemContext from"../context/LineItemContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemQuantity.propTypes,defaultProps=components.LineItemQuantity.defaultProps,displayName=components.LineItemQuantity.displayName,LineItemQuantity=props=>{const{max=50,readonly=!1}=props,p=__rest(props,["max","readonly"]),{lineItem}=useContext(LineItemChildrenContext),{updateLineItem}=useContext(LineItemContext),options=[];for(let i=1;i<=max;i++)options.push(_jsx("option",Object.assign({value:`${i}`},{children:i}),i));const handleChange=e=>{const quantity2=Number(e.target.value);updateLineItem&&lineItem&&updateLineItem(lineItem.id,quantity2)},quantity=lineItem==null?void 0:lineItem.quantity,parentProps=Object.assign({handleChange,quantity},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children}),void 0):readonly?_jsx("span",Object.assign({},p,{children:quantity}),void 0):_jsx("select",Object.assign({title:lineItem==null?void 0:lineItem.name,value:quantity,onChange:handleChange},p,{children:options}),void 0)};LineItemQuantity.propTypes=propTypes,LineItemQuantity.defaultProps=defaultProps,LineItemQuantity.displayName=displayName;export default LineItemQuantity;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import LineItemContext from"../context/LineItemContext";import Parent from"./utils/Parent";import components from"../config/components";const propTypes=components.LineItemQuantity.propTypes,defaultProps=components.LineItemQuantity.defaultProps,displayName=components.LineItemQuantity.displayName,LineItemQuantity=props=>{const{max=50,readonly=!1}=props,p=__rest(props,["max","readonly"]),{lineItem}=useContext(LineItemChildrenContext),{updateLineItem}=useContext(LineItemContext),options=[];for(let i=1;i<=max;i++)options.push(_jsx("option",Object.assign({value:`${i}`},{children:i}),i));const handleChange=e=>{const quantity2=Number(e.target.value);updateLineItem&&lineItem&&updateLineItem(lineItem.id,quantity2)},quantity=lineItem==null?void 0:lineItem.quantity,parentProps=Object.assign({handleChange,quantity},props);return props.children?_jsx(Parent,Object.assign({},parentProps,{children:props.children})):readonly?_jsx("span",Object.assign({},p,{children:quantity})):_jsx("select",Object.assign({title:lineItem==null?void 0:lineItem.name,value:quantity,onChange:handleChange},p,{children:options}))};LineItemQuantity.propTypes=propTypes,LineItemQuantity.defaultProps=defaultProps,LineItemQuantity.displayName=displayName;export default LineItemQuantity;
@@ -1,12 +1 @@
1
- import React, { FunctionComponent, PropsWithoutRef } from 'react';
2
- import { FunctionChildren } from '../typings/index';
3
- declare type ChildrenLineItemRemoveLinkProps = FunctionChildren<{
4
- handleRemove: (event: React.MouseEvent<HTMLAnchorElement>) => void;
5
- label?: string;
6
- }>;
7
- declare type LineItemRemoveLinkProps = {
8
- children?: ChildrenLineItemRemoveLinkProps;
9
- label?: string;
10
- } & PropsWithoutRef<JSX.IntrinsicElements['a']>;
11
- declare const LineItemRemoveLink: FunctionComponent<LineItemRemoveLinkProps>;
12
- export default LineItemRemoveLink;
1
+ import React,{FunctionComponent,PropsWithoutRef}from'react';import{FunctionChildren}from'../typings/index';declare type ChildrenLineItemRemoveLinkProps=FunctionChildren<{handleRemove:(event:React.MouseEvent<HTMLAnchorElement>)=>void;label?:string;}>;declare type LineItemRemoveLinkProps={children?:ChildrenLineItemRemoveLinkProps;label?:string;}&PropsWithoutRef<JSX.IntrinsicElements['a']>;declare const LineItemRemoveLink:FunctionComponent<LineItemRemoveLinkProps>;export default LineItemRemoveLink;