@shopgate/engage 7.29.1-beta.2 → 7.29.1-beta.3

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 (113) hide show
  1. package/cart/cart.context.js +18 -1
  2. package/cart/cart.hooks.js +5 -3
  3. package/cart/cart.types.js +35 -1
  4. package/cart/components/CartItem/CartItem.js +3 -1
  5. package/cart/components/CartItem/CartItemCoupon.connector.js +8 -2
  6. package/cart/components/CartItem/CartItemCoupon.js +26 -18
  7. package/cart/components/CartItem/CartItemCoupon.types.js +15 -0
  8. package/cart/components/CartItem/CartItemCouponLayout.js +9 -3
  9. package/cart/components/CartItem/CartItemCouponPrice.js +8 -2
  10. package/cart/components/CartItem/CartItemProduct.js +0 -1
  11. package/cart/components/CartItem/CartItemProductLayoutWide.js +0 -1
  12. package/cart/components/CartItem/CartItemProductLayoutWide.style.js +1 -1
  13. package/cart/components/CartItem/CartItemProductLayoutWideFulfillmentLabel.js +1 -2
  14. package/cart/components/CartItem/CartItemProductLayoutWideFulfillmentLabel.style.js +1 -1
  15. package/cart/components/CartItem/CartItemProductLayoutWideOrderDetails.js +1 -1
  16. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +1 -2
  17. package/cart/components/CartItem/CartItemProductOrderDetails.js +1 -1
  18. package/cart/components/CartItem/CartItemProductPriceCaption.js +1 -1
  19. package/cart/components/CartItem/CartItemProductPriceList.js +4 -1
  20. package/cart/components/CartItem/CartItemProductPriceListPromotion.js +3 -1
  21. package/cart/components/CartItem/CartItemProductProvider.connector.js +15 -3
  22. package/cart/components/CartItem/CartItemProductProvider.js +10 -4
  23. package/cart/components/CartItem/CartItemProductProvider.types.js +27 -1
  24. package/cart/components/CartItem/CartItemProvider.js +12 -3
  25. package/cart/components/CartItem/CartItemQuantityPicker.js +25 -24
  26. package/cart/components/CartItem/CartItemSubstitution.js +3 -1
  27. package/cart/components/CartItems/CartItemCard.js +8 -3
  28. package/cart/components/CartItems/CartItemCardReservation.js +4 -3
  29. package/cart/components/CartItems/CartItemCardReservationAccordion.js +5 -4
  30. package/cart/components/CartItems/CartItemCardReservationLabel.js +4 -4
  31. package/cart/components/CartItems/CartItemGroup.js +7 -3
  32. package/cart/components/CartItems/CartItemGroupReservation.js +4 -3
  33. package/cart/components/CartItems/CartItemGroupReservationLabel.js +4 -4
  34. package/cart/components/CartItems/CartItems.js +13 -3
  35. package/cart/components/CartItems/CartItemsHeaderWide.js +10 -3
  36. package/cart/components/CartItems/CartItemsHeaderWide.style.js +1 -1
  37. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +3 -2
  38. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.style.js +1 -1
  39. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +1 -1
  40. package/cart/components/PaymentBar/PaymentBarDiscounts.js +6 -2
  41. package/cart/components/PaymentBar/PaymentBarGrandTotal.js +8 -3
  42. package/cart/components/PaymentBar/PaymentBarReserveButton.js +5 -4
  43. package/cart/components/PaymentBar/PaymentBarShippingCost.js +8 -3
  44. package/cart/components/PaymentBar/PaymentBarSubTotal.js +9 -3
  45. package/cart/components/PaymentBar/PaymentBarTax.js +7 -3
  46. package/cart/index.js +2 -1
  47. package/checkout/paymentMethods/stripe/StripeProvider.js +6 -3
  48. package/checkout/providers/CheckoutProvider.js +41 -10
  49. package/components/SideNavigation/SideNavigation.js +7 -3
  50. package/components/SideNavigation/SideNavigationCategories.js +9 -4
  51. package/components/SideNavigation/SideNavigationCategories.style.js +1 -1
  52. package/components/SideNavigation/SideNavigationCategoriesItem.js +10 -3
  53. package/components/SideNavigation/SideNavigationCategoriesItem.style.js +1 -1
  54. package/components/SideNavigation/SideNavigationCategoriesItemChildren.js +6 -3
  55. package/components/SideNavigation/SideNavigationContent.js +5 -2
  56. package/components/SideNavigation/SideNavigationContent.style.js +1 -1
  57. package/components/SideNavigation/SideNavigationItem.js +14 -4
  58. package/components/SideNavigation/SideNavigationLinksLegal.js +5 -4
  59. package/components/SideNavigation/SideNavigationLinksQuicklinks.js +4 -3
  60. package/components/SideNavigation/SideNavigationNestedItem.js +8 -2
  61. package/components/SideNavigation/SideNavigationProvider.js +12 -3
  62. package/core/config/config.types.js +15 -0
  63. package/core/hooks/useAsyncMemo.js +1 -1
  64. package/i18n/countries.hooks.js +5 -5
  65. package/locations/action-creators/setUserSearchCountryCode.js +11 -4
  66. package/locations/action-creators/setUserSearchPostalCode.js +11 -4
  67. package/locations/components/Cart/CartChangeFulfillmentMethod.connector.js +4 -1
  68. package/locations/components/Cart/CartChangeFulfillmentMethod.js +10 -7
  69. package/locations/components/Cart/CartChangeFulfillmentMethod.types.js +10 -0
  70. package/locations/components/Cart/CartContextMenuChangeFulfillment.js +9 -4
  71. package/locations/components/Cart/CartContextMenuItemChangeLocation.js +7 -6
  72. package/locations/components/Cart/CartItemProductChangeLocation.connector.js +5 -2
  73. package/locations/components/Cart/CartItemProductChangeLocation.js +12 -9
  74. package/locations/components/Cart/CartItemProductChangeLocation.types.js +9 -0
  75. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +6 -3
  76. package/locations/components/FulfillmentPath/FulfillmentPathItem.js +6 -4
  77. package/locations/components/FulfillmentSelector/FulfillmentSelector.connector.js +20 -6
  78. package/locations/components/FulfillmentSelector/FulfillmentSelector.context.js +2 -1
  79. package/locations/components/FulfillmentSelector/FulfillmentSelector.hooks.js +3 -2
  80. package/locations/components/FulfillmentSelector/FulfillmentSelector.js +8 -17
  81. package/locations/components/FulfillmentSelector/FulfillmentSelector.style.js +1 -1
  82. package/locations/components/FulfillmentSelector/FulfillmentSelector.types.js +57 -1
  83. package/locations/components/FulfillmentSelector/FulfillmentSelectorAddToCart.js +5 -8
  84. package/locations/components/FulfillmentSelector/FulfillmentSelectorBOPIS.js +3 -3
  85. package/locations/components/FulfillmentSelector/FulfillmentSelectorDirectShip.js +2 -3
  86. package/locations/components/FulfillmentSelector/FulfillmentSelectorHeader.js +3 -3
  87. package/locations/components/FulfillmentSelector/FulfillmentSelectorHeader.style.js +1 -1
  88. package/locations/components/FulfillmentSelector/FulfillmentSelectorItem.js +9 -5
  89. package/locations/components/FulfillmentSelector/FulfillmentSelectorItem.style.js +1 -1
  90. package/locations/components/ReserveForm/ReserveForm.js +6 -5
  91. package/locations/components/ReserveForm/ReserveForm.style.js +1 -1
  92. package/locations/components/ReserveForm/ReserveFormPhone.connector.js +6 -2
  93. package/locations/components/ReserveForm/ReserveFormPhone.js +8 -3
  94. package/locations/components/ReserveForm/ReserveFormPhone.types.js +11 -0
  95. package/locations/components/StoreFinder/Store.context.js +3 -1
  96. package/locations/components/StoreFinder/StoreFinderLocation.js +1 -1
  97. package/locations/components/StoreList/Store.context.js +3 -1
  98. package/locations/index.js +1 -1
  99. package/locations/locations.context.js +32 -1
  100. package/locations/locations.types.js +130 -1
  101. package/locations/providers/FulfillmentProvider.connector.js +7 -3
  102. package/locations/providers/FulfillmentProvider.js +38 -27
  103. package/locations/providers/FulfillmentProvider.types.js +42 -1
  104. package/locations/providers/StoreFinderProvider.js +1 -1
  105. package/locations/reducers/index.js +3 -1
  106. package/locations/reducers/userFormInput.js +7 -7
  107. package/locations/selectors/index.js +1 -1
  108. package/package.json +7 -7
  109. package/page/widgets/Video/Video.js +1 -1
  110. package/product/product.types.js +32 -0
  111. package/registration/hooks/index.js +1 -1
  112. package/registration/providers/RegistrationProvider.js +12 -2
  113. package/types.js +0 -0
@@ -1 +1,18 @@
1
- import{createContext}from'react';export var CartContext=createContext({currency:'EUR',config:{},isUserLoggedIn:false,isLoading:false,flags:{},display:'card',hasPromotionCoupons:false});
1
+ import{createContext}from'react';/**
2
+ * @typedef {Object} CartConfig
3
+ * @property {Object} shipping
4
+ * @property {boolean|null} shipping.hideAnonymous
5
+ * @property {string|null} shipping.textForAnonymousUsers
6
+ * @property {Object} tax
7
+ * @property {string|null} tax.text
8
+ * @property {Object<string, any>} [otherProperties] Additional properties from the cart object.
9
+ */ /**
10
+ * @typedef {Object} CartContextProps
11
+ * @property {string} currency
12
+ * @property {CartConfig} config
13
+ * @property {boolean} isUserLoggedIn
14
+ * @property {boolean} isLoading
15
+ * @property {Object<string, any>} flags
16
+ * @property {'line' | 'card'} display
17
+ * @property {boolean} hasPromotionCoupons
18
+ */export var CartContext=createContext(/** @type {CartContextProps} */{currency:'EUR',config:{shipping:{hideAnonymous:null,textForAnonymousUsers:null},tax:{text:null}},isUserLoggedIn:false,isLoading:false,flags:{},display:'card',hasPromotionCoupons:false});
@@ -1,4 +1,6 @@
1
- import*as React from'react';import{CartContext}from"./cart.context";/**
1
+ import{useContext}from'react';import{CartContext}from"./cart.context";/**
2
+ * @typedef {import('./cart.context').CartContextProps} CartContextProps
3
+ */ /**
2
4
  * Returns the cart context.
3
- * @returns {Object}
4
- */export function useCartContext(){return React.useContext(CartContext);}
5
+ * @returns {CartContextProps}
6
+ */export function useCartContext(){return useContext(CartContext);}
@@ -1 +1,35 @@
1
- import{COUPON_TYPE_FIXED,COUPON_TYPE_PERCENTAGE}from'@shopgate/pwa-common-commerce/cart';
1
+ /* eslint-disable max-len */ /**
2
+ * @typedef {import('@shopgate/pwa-common-commerce/cart').COUPON_TYPE_FIXED} COUPON_TYPE_FIXED
3
+ * @typedef {import('@shopgate/pwa-common-commerce/cart').COUPON_TYPE_PERCENTAGE} COUPON_TYPE_PERCENTAGE
4
+ */ /* eslint-enable max-len */ /**
5
+ * @typedef {Object} AddToCartProduct
6
+ * @property {string} productId
7
+ * @property {number} quantity
8
+ * @property {{method: string, location: {code: string, name: string}}} [fulfillment]
9
+ */ /**
10
+ * @typedef {Object} ItemFulfillment
11
+ * @property {string} method
12
+ * @property {{code?: string, name?: string}} location
13
+ */ /**
14
+ * @typedef Item
15
+ * @type {object}
16
+ * @property {string} [cartItemId]
17
+ * @property {string} [id]
18
+ * @property {number} quantity
19
+ * @property {string} [type]
20
+ * @property {ItemFulfillment} [fulfillment]
21
+ * @property {string} [fulfillmentLocationId]
22
+ * @property {string} [fulfillmentMethod]
23
+ * @property {Object.<string, any>} [product]
24
+ * @property {any} [coupon]
25
+ * @property {any[]} [messages]
26
+ */ /**
27
+ * @typedef {Object} SavedPrice
28
+ * @property {COUPON_TYPE_FIXED|COUPON_TYPE_PERCENTAGE} type
29
+ * @property {number} value
30
+ */ /**
31
+ * @typedef {Object} Coupon
32
+ * @property {string} code
33
+ * @property {SavedPrice} [savedPrice]
34
+ * @property {any} [key] - Additional dynamic properties.
35
+ */
@@ -1,7 +1,9 @@
1
- import{hot}from'react-hot-loader/root';import*as React from'react';import{SurroundPortals}from'@shopgate/engage/components';import{CART_ITEM_TYPE_PRODUCT,CART_ITEM_TYPE_COUPON,CART_ITEM}from'@shopgate/pwa-common-commerce/cart';import{ProductListEntryProvider}from'@shopgate/engage/product';import CartItemProduct from"./CartItemProduct";import CartItemCoupon from"./CartItemCoupon";import CartItemProductProvider from"./CartItemProductProvider";/**
1
+ import{hot}from'react-hot-loader/root';import React from'react';import PropTypes from'prop-types';import{SurroundPortals}from'@shopgate/engage/components';import{CART_ITEM_TYPE_PRODUCT,CART_ITEM_TYPE_COUPON,CART_ITEM}from'@shopgate/pwa-common-commerce/cart';import{ProductListEntryProvider}from'@shopgate/engage/product';import CartItemProduct from"./CartItemProduct";import CartItemCoupon from"./CartItemCoupon";import CartItemProductProvider from"./CartItemProductProvider";/**
2
2
  * The cart item component.
3
3
  * @param {Object} props The component props.
4
4
  * @property {Object} props.item The cart item.
5
5
  * @property {Function} props.onFocus A function to indicate when the item has been focussed.
6
+ * @property {boolean} [props.editable] Whether the item is editable.
7
+ * @property {string|null} [props.currencyOverride] The currency to use instead of the default one.
6
8
  * @return {JSX.Element}
7
9
  */function CartItem(_ref){var item=_ref.item,onFocus=_ref.onFocus,editable=_ref.editable,currencyOverride=_ref.currencyOverride;if(item.type!==CART_ITEM_TYPE_PRODUCT&&item.type!==CART_ITEM_TYPE_COUPON){return null;}var props={item:item};var isProduct=item.type===CART_ITEM_TYPE_PRODUCT;if(isProduct){var _item$product;return React.createElement(ProductListEntryProvider,{productId:item===null||item===void 0?void 0:(_item$product=item.product)===null||_item$product===void 0?void 0:_item$product.id},React.createElement(SurroundPortals,{portalName:CART_ITEM,portalProps:props},React.createElement(CartItemProductProvider,{cartItem:item,onFocus:onFocus,isEditable:editable,currencyOverride:currencyOverride},React.createElement(CartItemProduct,null))));}return React.createElement(SurroundPortals,{portalName:CART_ITEM,portalProps:props},React.createElement(CartItemCoupon,{id:item.id,key:item.id,coupon:item.coupon,messages:item.messages,editable:editable}));}CartItem.defaultProps={editable:true,currencyOverride:null};export default hot(React.memo(CartItem));
@@ -1,7 +1,13 @@
1
1
  import{connect}from'react-redux';import deleteCouponsFromCart from'@shopgate/pwa-common-commerce/cart/actions/deleteCouponsFromCart';import{getCurrency}from'@shopgate/pwa-common-commerce/cart/selectors';/**
2
+ * @typedef {import('./CartItemCoupon.types').OwnProps} OwnProps
3
+ * @typedef {import('./CartItemCoupon.types').StateProps} StateProps
4
+ * @typedef {import('./CartItemCoupon.types').DispatchProps} DispatchProps
5
+ */ /**
6
+ * Maps state to props.
2
7
  * @param {Object} state The current application state.
3
- * @return {Object} The extended component props.
8
+ * @returns {StateProps} The extended component props.
4
9
  */var mapStateToProps=function mapStateToProps(state){return{currency:getCurrency(state)};};/**
10
+ * Maps dispatch to props.
5
11
  * @param {Function} dispatch The redux dispatch function.
6
- * @return {Object} The extended component props.
12
+ * @returns {DispatchProps} The extended component props.
7
13
  */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{deleteCoupon:function deleteCoupon(couponCode){return dispatch(deleteCouponsFromCart([couponCode]));}};};export default connect(mapStateToProps,mapDispatchToProps);
@@ -1,20 +1,28 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import*as React from'react';import PT from'prop-types';import Transition from'react-transition-group/Transition';import{getAbsoluteHeight}from'@shopgate/pwa-common/helpers/dom';import{CART_PATH}from'@shopgate/pwa-common-commerce/cart/constants';import{CART_ITEM_TYPE_COUPON}from'@shopgate/pwa-common-commerce/cart';import{getPageSettings}from'@shopgate/engage/core/config';import{MessageBar,CardList}from'@shopgate/engage/components';import{container,cartItemTransitionDuration as duration,getCartItemTransitionStyle as getTransitionStyle}from"./CartItemCoupon.style";import{messagesContainerCard,messagesCard,messagesContainerLine,messagesLine}from"./CartItem.style";import connect from"./CartItemCoupon.connector";import{CartItemCouponLayout}from"./CartItemCouponLayout";var messageStyles={card:{container:messagesContainerCard,message:messagesCard},line:{container:messagesContainerLine,message:messagesLine}};/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import*as React from'react';import PropTypes from'prop-types';import Transition from'react-transition-group/Transition';import{getAbsoluteHeight}from'@shopgate/pwa-common/helpers/dom';import{CART_PATH}from'@shopgate/pwa-common-commerce/cart/constants';import{CART_ITEM_TYPE_COUPON}from'@shopgate/pwa-common-commerce/cart';import{getPageSettings}from'@shopgate/engage/core/config';import{MessageBar,CardList}from'@shopgate/engage/components';import{container,cartItemTransitionDuration as duration,getCartItemTransitionStyle as getTransitionStyle}from"./CartItemCoupon.style";import{messagesContainerCard,messagesCard,messagesContainerLine,messagesLine}from"./CartItem.style";import connect from"./CartItemCoupon.connector";import{CartItemCouponLayout}from"./CartItemCouponLayout";/**
2
+ * @typedef {import('./CartItemCoupon.types').OwnProps} OwnProps
3
+ * @typedef {import('./CartItemCoupon.types').StateProps} StateProps
4
+ * @typedef {import('./CartItemCoupon.types').DispatchProps} DispatchProps
5
+ * @typedef {OwnProps & StateProps & DispatchProps} Props
6
+ */ /**
7
+ * @typedef {Object} State
8
+ * @property {boolean} visible Whether the coupon is visible.
9
+ */var messageStyles={card:{container:messagesContainerCard,message:messagesCard},line:{container:messagesContainerLine,message:messagesLine}};/**
2
10
  * The Coupon component.
3
- */var CartItemCoupon=/*#__PURE__*/function(_React$Component){/**
4
- * Constructor.
5
- * @param {Object} props The component props.
6
- */function CartItemCoupon(props){var _this2;_classCallCheck(this,CartItemCoupon);_this2=_callSuper(this,CartItemCoupon,[props]);/**
7
- * Sets this coupon to be invisible via its state.
8
- */_defineProperty(_this2,"transitionOut",function(){_this2.setState({visible:false});});/**
9
- * Deletes the coupon from the cart.
10
- */_defineProperty(_this2,"deleteCoupon",function(){_this2.props.deleteCoupon(_this2.props.id);});_this2.state={visible:true};return _this2;}/**
11
- * Expose props to the descendant components to use them for the portals.
12
- * @return {Object}
13
- */_inherits(CartItemCoupon,_React$Component);return _createClass(CartItemCoupon,[{key:"getChildContext",value:function getChildContext(){return{cartItemId:this.props.id,type:CART_ITEM_TYPE_COUPON,editable:this.props.editable};}/**
11
+ */var CartItemCoupon=/*#__PURE__*/function(_React$PureComponent){function CartItemCoupon(){var _this2;_classCallCheck(this,CartItemCoupon);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,CartItemCoupon,[].concat(args));/**
12
+ * @type {State}
13
+ */_defineProperty(_this2,"state",{visible:true});/**
14
+ * Updates transition height on mount/update.
15
+ */_defineProperty(_this2,"updateHeight",function(){if(_this2.transitionElement&&_this2.cardElement){_this2.transitionElement.style.height="".concat(getAbsoluteHeight(_this2.cardElement),"px");}});_defineProperty(_this2,"transitionElement",null);_defineProperty(_this2,"cardElement",null);/**
16
+ * Hides the coupon via transition.
17
+ * @returns {Function}
18
+ */_defineProperty(_this2,"transitionOut",function(){return _this2.setState({visible:false});});/**
19
+ * Removes the coupon from the cart.
20
+ */_defineProperty(_this2,"deleteCoupon",function(){var _this2$props=_this2.props,deleteCoupon=_this2$props.deleteCoupon,id=_this2$props.id;deleteCoupon(id);});return _this2;}_inherits(CartItemCoupon,_React$PureComponent);return _createClass(CartItemCoupon,[{key:"getChildContext",value:/**
21
+ * @returns {Object}
22
+ */function getChildContext(){var _this$props=this.props,id=_this$props.id,editable=_this$props.editable;return{cartItemId:id,type:CART_ITEM_TYPE_COUPON,editable:editable};}/**
23
+ * Updates transition height on mount/update.
24
+ */},{key:"componentDidMount",value:function componentDidMount(){this.updateHeight();}/**
14
25
  * We need to set the element height explicitly so that we can animate it later.
15
- */},{key:"componentDidMount",value:function componentDidMount(){this.transitionElement.style.height="".concat(getAbsoluteHeight(this.cardElement),"px");}/**
16
- * We need to set the element height explicitly so that we can animate it later.
17
- */},{key:"componentDidUpdate",value:function componentDidUpdate(){this.transitionElement.style.height="".concat(getAbsoluteHeight(this.cardElement),"px");}},{key:"render",value:/**
18
- * Render Function.
19
- * @returns {JSX}
20
- */function render(){var _this3=this;var _getPageSettings=getPageSettings(CART_PATH),_getPageSettings$cart=_getPageSettings.cartItemsDisplay,cartItemsDisplay=_getPageSettings$cart===void 0?'line':_getPageSettings$cart;return React.createElement(Transition,{"in":this.state.visible,timeout:duration,onExited:this.deleteCoupon},function(state){return React.createElement("div",{ref:function ref(element){if(element)_this3.transitionElement=element;},key:_this3.props.id,style:getTransitionStyle(state)},React.createElement("div",{className:container,ref:function ref(element){if(element)_this3.cardElement=element;}},React.createElement(CardList.Item,null,_this3.props.messages.length>0&&React.createElement(MessageBar,{messages:_this3.props.messages,classNames:messageStyles[cartItemsDisplay]}),React.createElement(CartItemCouponLayout,{handleDelete:_this3.transitionOut,coupon:_this3.props.coupon,currency:_this3.props.currency}))));});}}]);}(React.Component);_defineProperty(CartItemCoupon,"childContextTypes",{cartItemId:PT.string,type:PT.string,editable:PT.bool});_defineProperty(CartItemCoupon,"defaultProps",{deleteCoupon:function deleteCoupon(){}});CartItemCoupon.defaultProps={editable:true};export default connect(CartItemCoupon);
26
+ */},{key:"componentDidUpdate",value:function componentDidUpdate(){this.updateHeight();}},{key:"render",value:/**
27
+ * @returns {JSX.Element}
28
+ */function render(){var _this3=this;var _this$props2=this.props,coupon=_this$props2.coupon,currency=_this$props2.currency,messages=_this$props2.messages;var visible=this.state.visible;var _getPageSettings=getPageSettings(CART_PATH),_getPageSettings$cart=_getPageSettings.cartItemsDisplay,cartItemsDisplay=_getPageSettings$cart===void 0?'line':_getPageSettings$cart;var messageStyle=messageStyles[cartItemsDisplay];return React.createElement(Transition,{"in":visible,timeout:duration,onExited:this.deleteCoupon},function(state){return React.createElement("div",{ref:function ref(element){_this3.transitionElement=element;},key:_this3.props.id,style:getTransitionStyle(state)},React.createElement("div",{className:container,ref:function ref(el){_this3.cardElement=el;}},React.createElement(CardList.Item,null,!!messages.length&&React.createElement(MessageBar,{messages:messages,classNames:messageStyle}),React.createElement(CartItemCouponLayout,{handleDelete:_this3.transitionOut,coupon:coupon,currency:currency}))));});}}]);}(React.PureComponent);_defineProperty(CartItemCoupon,"childContextTypes",{cartItemId:PropTypes.string,type:PropTypes.string,editable:PropTypes.bool});_defineProperty(CartItemCoupon,"defaultProps",{editable:true,deleteCoupon:function deleteCoupon(){}});export default connect(CartItemCoupon);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @typedef {import('../../../cart/cart.types').Coupon} Coupon
3
+ */ /**
4
+ * @typedef {Object} OwnProps
5
+ * @property {Coupon} coupon The coupon object.
6
+ * @property {string} id The coupon ID.
7
+ * @property {Array<any>} messages The messages associated with the coupon.
8
+ * @property {boolean} [editable] Whether the coupon is editable.
9
+ */ /**
10
+ * @typedef {Object} StateProps
11
+ * @property {string} currency The currency used in the cart.
12
+ */ /**
13
+ * @typedef {Object} DispatchProps
14
+ * @property {(couponCode: string) => Promise<any>} deleteCoupon Function to delete a coupon.
15
+ */
@@ -1,6 +1,12 @@
1
- import*as React from'react';import PT from'prop-types';import{SurroundPortals}from'@shopgate/engage/components';import{CART_ITEM_IMAGE,CART_ITEM_NAME,CART_ITEM_COUPON_CODE,CART_ITEM_PRICE}from'@shopgate/pwa-common-commerce/cart';import Grid from'@shopgate/pwa-common/components/Grid';import{CartItemCouponIcon}from"./CartItemCouponIcon";import{CartItemCouponPrice}from"./CartItemCouponPrice";import{CartItemCouponFreeShipping}from"./CartItemCouponFreeShipping";import{CartItemCouponTitle}from"./CartItemCouponTitle";import{CartItemCouponCode}from"./CartItemCouponCode";import{CartItemCouponDelete}from"./CartItemCouponDelete";import{item,icon,content,contentLast}from"./CartItemCouponLayout.style";/**
1
+ import*as React from'react';import PropTypes from'prop-types';import{SurroundPortals}from'@shopgate/engage/components';import{CART_ITEM_IMAGE,CART_ITEM_NAME,CART_ITEM_COUPON_CODE,CART_ITEM_PRICE}from'@shopgate/pwa-common-commerce/cart';import Grid from'@shopgate/pwa-common/components/Grid';import{CartItemCouponIcon}from"./CartItemCouponIcon";import{CartItemCouponPrice}from"./CartItemCouponPrice";import{CartItemCouponFreeShipping}from"./CartItemCouponFreeShipping";import{CartItemCouponTitle}from"./CartItemCouponTitle";import{CartItemCouponCode}from"./CartItemCouponCode";import{CartItemCouponDelete}from"./CartItemCouponDelete";import{item,icon,content,contentLast}from"./CartItemCouponLayout.style";/**
2
2
  * The CouponLayout component.
3
3
  * @param {Object} props The component properties.
4
+ * @param {Object} props.coupon The coupon details.
5
+ * @param {string} props.currency The currency to display.
6
+ * @param {Function} [props.handleDelete] The delete handler function.
4
7
  * @param {Object} context The component context.
5
- * @returns {JSX}
6
- */export function CartItemCouponLayout(props,context){var coupon=props.coupon,currency=props.currency,handleDelete=props.handleDelete;return React.createElement(Grid,{className:item},React.createElement(Grid.Item,{className:icon},React.createElement(SurroundPortals,{portalName:CART_ITEM_IMAGE,portalProps:context},React.createElement(CartItemCouponIcon,null))),React.createElement(Grid.Item,{className:content,grow:1},React.createElement(SurroundPortals,{portalName:CART_ITEM_NAME,portalProps:context},React.createElement(CartItemCouponTitle,{value:coupon.label})),React.createElement(SurroundPortals,{portalName:CART_ITEM_COUPON_CODE,portalProps:context},React.createElement(CartItemCouponCode,{value:coupon.code}))),React.createElement(Grid.Item,{className:"".concat(content," ").concat(contentLast),grow:1,shrink:0},context.editable&&React.createElement(CartItemCouponDelete,{handleDelete:handleDelete}),React.createElement(CartItemCouponFreeShipping,{freeShipping:!!coupon.freeShipping}),coupon.savedPrice&&coupon.savedPrice.value>0&&React.createElement(SurroundPortals,{portalName:CART_ITEM_PRICE,portalProps:context},React.createElement(CartItemCouponPrice,{currency:currency,savedPrice:coupon.savedPrice}))));}CartItemCouponLayout.defaultProps={handleDelete:function handleDelete(){}};CartItemCouponLayout.contextTypes={cartItemId:PT.string,type:PT.string,editable:PT.bool};
8
+ * @param {string} context.cartItemId The cart item ID.
9
+ * @param {string} context.type The type of the cart item.
10
+ * @param {boolean} [context.editable] Whether the item is editable.
11
+ * @returns {JSX.Element}
12
+ */export function CartItemCouponLayout(props,context){var coupon=props.coupon,currency=props.currency,handleDelete=props.handleDelete;return React.createElement(Grid,{className:item},React.createElement(Grid.Item,{className:icon},React.createElement(SurroundPortals,{portalName:CART_ITEM_IMAGE,portalProps:context},React.createElement(CartItemCouponIcon,null))),React.createElement(Grid.Item,{className:content,grow:1},React.createElement(SurroundPortals,{portalName:CART_ITEM_NAME,portalProps:context},React.createElement(CartItemCouponTitle,{value:coupon.label})),React.createElement(SurroundPortals,{portalName:CART_ITEM_COUPON_CODE,portalProps:context},React.createElement(CartItemCouponCode,{value:coupon.code}))),React.createElement(Grid.Item,{className:"".concat(content," ").concat(contentLast),grow:1,shrink:0},context.editable&&React.createElement(CartItemCouponDelete,{handleDelete:handleDelete}),React.createElement(CartItemCouponFreeShipping,{freeShipping:!!coupon.freeShipping}),coupon.savedPrice&&coupon.savedPrice.value>0&&React.createElement(SurroundPortals,{portalName:CART_ITEM_PRICE,portalProps:context},React.createElement(CartItemCouponPrice,{currency:currency,savedPrice:coupon.savedPrice}))));}CartItemCouponLayout.defaultProps={handleDelete:function handleDelete(){}};CartItemCouponLayout.contextTypes={cartItemId:PropTypes.string.isRequired,type:PropTypes.string.isRequired,editable:PropTypes.bool};
@@ -1,5 +1,11 @@
1
- import*as React from'react';import{COUPON_TYPE_FIXED,COUPON_TYPE_PERCENTAGE}from'@shopgate/pwa-common-commerce/cart';import Price from'@shopgate/pwa-ui-shared/Price';import styles from"./CartItemCouponPrice.style";/**
1
+ import*as React from'react';import PropTypes from'prop-types';import{COUPON_TYPE_FIXED,COUPON_TYPE_PERCENTAGE}from'@shopgate/pwa-common-commerce/cart';import Price from'@shopgate/pwa-ui-shared/Price';import styles from"./CartItemCouponPrice.style";/**
2
+ * @typedef {import('../../cart.types').SavedPrice} SavedPrice
3
+ */ /**
2
4
  * The Coupon Price component.
3
5
  * @param {Object} props The component properties.
4
- * @returns {JSX}
6
+ * @param {string} props.currency The currency to display.
7
+ * @param {SavedPrice} props.savedPrice The saved price details.
8
+ * @param {string} props.savedPrice.type The type of the saved price (fixed or percentage).
9
+ * @param {number} props.savedPrice.value The value of the saved price.
10
+ * @returns {JSX.Element|null}
5
11
  */export var CartItemCouponPrice=React.memo(function(_ref){var currency=_ref.currency,savedPrice=_ref.savedPrice;if(savedPrice.type===COUPON_TYPE_FIXED){return React.createElement(Price,{className:styles,currency:currency,discounted:true,unitPrice:-savedPrice.value});}if(savedPrice.type===COUPON_TYPE_PERCENTAGE){return React.createElement("span",{className:styles},"-".concat(savedPrice.value,"%"));}return null;});
@@ -1,5 +1,4 @@
1
1
  import React,{Fragment}from'react';import{CART_PATH}from'@shopgate/pwa-common-commerce/cart/constants';import CardListItem from'@shopgate/pwa-ui-shared/CardList/components/Item';import{MessageBar,ResponsiveContainer}from'@shopgate/engage/components';import{getPageSettings}from'@shopgate/engage/core/config';import{messagesContainerCard,messagesCard,messagesContainerLine,messagesLine}from"./CartItem.style";import{CartItemProductLayout}from"./CartItemProductLayout";import{CartItemProductLayoutWide}from"./CartItemProductLayoutWide";import{noGap}from"./CartItemProduct.style";import{useCartItemProduct}from"./CartItem.hooks";import CartItemSubstitution from"./CartItemSubstitution";var messageStyles={card:{container:messagesContainerCard,message:messagesCard},line:{container:messagesContainerLine,message:messagesLine}};/**
2
2
  * The CartProduct component.
3
- * @param {Object} props The component props.
4
3
  * @returns {JSX}
5
4
  */var CartItemProduct=function CartItemProduct(){var _useCartItemProduct=useCartItemProduct(),messages=_useCartItemProduct.messages,cartItemRef=_useCartItemProduct.cartItemRef,isEditable=_useCartItemProduct.isEditable;var _getPageSettings=getPageSettings(CART_PATH),_getPageSettings$cart=_getPageSettings.cartItemsDisplay,cartItemsDisplay=_getPageSettings$cart===void 0?'line':_getPageSettings$cart;return React.createElement(CardListItem,{className:cartItemsDisplay==='card'?noGap:null},React.createElement("div",{ref:cartItemRef,"data-test-id":"cartItem"},React.createElement(ResponsiveContainer,{appAlways:true,breakpoint:"<=xs"},React.createElement(Fragment,null,messages.length>0&&React.createElement(MessageBar,{messages:messages,classNames:messageStyles[cartItemsDisplay]}),React.createElement(CartItemProductLayout,null))),React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},React.createElement(CartItemProductLayoutWide,null)),React.createElement(CartItemSubstitution,{editable:isEditable})));};export default CartItemProduct;
@@ -1,4 +1,3 @@
1
1
  function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Fragment}from'react';import classNames from'classnames';import{TextLink,ProductProperties,QuantityLabel,ConditionalWrapper,MessageBar,SurroundPortals}from'@shopgate/engage/components';import{ProductImage,CartUnitQuantityPicker,PriceInfo,ProductName,ITEM_PATH}from'@shopgate/engage/product';import{CART_ITEM_NAME,CART_ITEM_QUANTITY_PICKER}from'@shopgate/pwa-common-commerce/cart';import{bin2hex}from'@shopgate/engage/core';import{getLineItemActiveStatus}from'@shopgate/engage/orders';import{CartContextMenuChangeFulfillment}from'@shopgate/engage/locations';import CartItemProductPriceList from"./CartItemProductPriceList";import{CartItemProductLayoutWideRemoveItem}from"./CartItemProductLayoutWideRemoveItem";import{CartItemProductLayoutWideFulfillmentLabel}from"./CartItemProductLayoutWideFulfillmentLabel";import CartItemProductLayoutWideOrderDetails from"./CartItemProductLayoutWideOrderDetails";import{CartItemProductPriceCaption}from"./CartItemProductPriceCaption";import{useCartItem,useCartItemProduct}from"./CartItem.hooks";import{container,containerInactive,imageColumn,detailsColumn,priceColumnWide,productName,productProperties,column,quantityPicker,quantityPickerDisabled,price,priceInfo,priceListEntry,priceListPromo,contextMenu,messageContainer,messageContainerRope}from"./CartItemProductLayoutWide.style";/**
2
- * @param {Object} props The component properties.
3
2
  * @returns {JSX}
4
3
  */var CartItemProductLayoutWide=function CartItemProductLayoutWide(){var _useCartItem=useCartItem(),merchantFulfillmentMethodsCount=_useCartItem.merchantFulfillmentMethodsCount,isOrderDetails=_useCartItem.isOrderDetails,cartHasLineItemPromotions=_useCartItem.cartHasLineItemPromotions;var context=useCartItemProduct();var cartItem=context.cartItem,product=context.product,currency=context.currency,handleUpdate=context.handleUpdate,isEditable=context.isEditable,isLinkable=context.isLinkable,allowQuantityChange=context.allowQuantityChange,messages=context.messages;var hasUnitWithDecimals=product.unit&&product.hasCatchWeight||false;var isActive=!isOrderDetails?true:getLineItemActiveStatus(cartItem===null||cartItem===void 0?void 0:cartItem.status,cartItem===null||cartItem===void 0?void 0:cartItem.subStatus);return React.createElement(Fragment,null,React.createElement("div",{className:classNames(container,_defineProperty({},containerInactive,!isActive))},React.createElement("div",{className:imageColumn},React.createElement(ProductImage,{src:product.featuredImageBaseUrl||product.featuredImageUrl})),React.createElement("div",{className:detailsColumn},React.createElement(ConditionalWrapper,{condition:isEditable&&isLinkable,wrapper:function wrapper(children){return React.createElement(TextLink,{href:"".concat(ITEM_PATH,"/").concat(bin2hex(product.id))},children);}},React.createElement(ProductName,{name:product.name,className:productName,portalName:CART_ITEM_NAME,portalProps:context,testId:product.name})),React.createElement(ProductProperties,{className:productProperties,properties:product.properties,lineClamp:2}),!isOrderDetails&&React.createElement(CartItemProductLayoutWideFulfillmentLabel,null)),React.createElement("div",{className:cartHasLineItemPromotions?priceColumnWide:column},React.createElement(CartItemProductPriceList,{cartItem:cartItem,classes:{price:price,priceStriked:price,entry:priceListEntry,promo:priceListPromo}}),React.createElement(PriceInfo,{product:product,currency:currency,className:priceInfo}),React.createElement(CartItemProductPriceCaption,null)),isOrderDetails&&React.createElement(CartItemProductLayoutWideOrderDetails,null),React.createElement("div",{className:column},isEditable&&allowQuantityChange?React.createElement(SurroundPortals,{portalName:CART_ITEM_QUANTITY_PICKER,portalProps:{product:product,cartItem:cartItem,isOrderDetails:isOrderDetails,handleUpdate:handleUpdate,isEditable:isEditable}},React.createElement(CartUnitQuantityPicker,{productId:product.id,value:isOrderDetails?cartItem.orderedQuantity:cartItem.quantity,unit:product.unit,hasCatchWeight:product.hasCatchWeight,onChange:handleUpdate,classNames:{withDecimals:quantityPicker,withoutDecimals:quantityPicker}})):React.createElement(QuantityLabel,{className:quantityPickerDisabled,value:isOrderDetails?cartItem.orderedQuantity:cartItem.quantity,unit:hasUnitWithDecimals?product.unit:null,maxDecimals:hasUnitWithDecimals?2:0}),isEditable&&React.createElement(CartItemProductLayoutWideRemoveItem,null)),React.createElement("div",{className:column},React.createElement(CartItemProductPriceList,{isSubtotal:true,cartItem:cartItem,classes:{price:price,priceStriked:price,entry:priceListEntry,promo:priceListPromo}}),React.createElement(CartItemProductPriceCaption,null)),isEditable&&merchantFulfillmentMethodsCount>1&&React.createElement("div",{className:contextMenu},React.createElement(CartContextMenuChangeFulfillment,{cartItem:cartItem}))),messages.length>0&&React.createElement(MessageBar,{messages:messages,showIcons:true,classNames:{container:cartItem.fulfillment?messageContainerRope:messageContainer}}));};export{CartItemProductLayoutWide};
@@ -1 +1 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({display:'flex',flexDirection:'row',justifyContent:'space-between',padding:variables.gap.big}).toString();export var imageColumn=css({width:120,height:120,marginRight:variables.gap.small,flexShrink:0,flexGrow:0});export var column=css({display:'flex',alignItems:'center',flexDirection:'column',flexShrink:1,flexGrow:1,flexBasis:0,padding:"0 ".concat(variables.gap.small,"px"),':last-child':{paddingRight:0}});export var detailsColumn=css(column,{flexShrink:1,flexGrow:3,alignItems:'flex-start'});export var priceColumnWide=css(column,{flexGrow:4,alignItems:'flex-end'});export var locationColumn=css(column,{fontSize:'1.25rem',lineHeight:'1.625rem',fontWeight:500,flexGrow:2});export var statusColumn=css(column,{fontSize:'1.25rem',lineHeight:'1.625rem'});export var productName=css({fontSize:'1.25rem',lineHeight:'1.5rem',fontWeight:500,wordBreak:['keep-all','break-word'],hyphens:'auto'}).toString();export var productProperties=css({paddingTop:variables.gap.small,color:'var(--color-text-low-emphasis)',fontSize:'1rem'}).toString();export var quantityPicker=css({width:140}).toString();export var quantityPickerDisabled=css({padding:"0 ".concat(variables.gap.small,"px"),textAlign:'center',fontSize:'1.25rem',lineHeight:'1.625rem',height:28,width:'100%',fontWeight:500,color:'var(--color-text-high-emphasis)',whiteSpace:'nowrap'}).toString();export var containerInactive=css(_defineProperty(_defineProperty({color:'var(--color-text-low-emphasis)'}," .".concat(quantityPickerDisabled),{color:'var(--color-text-low-emphasis)'})," .".concat(imageColumn),{opacity:0.7})).toString();export var price=css({fontSize:'1.25rem !important',lineHeight:'1.625rem !important'}).toString();export var priceListEntry=css({flexDirection:'column-reverse !important'}).toString();export var priceListPromo=css({paddingRight:0,alignSelf:'flex-end'}).toString();export var priceInfo=css({wordBreak:'break-word',fontSize:'0.75rem',lineHeight:'0.875rem',color:'var(--color-text-low-emphasis)',padding:"".concat(variables.gap.xsmall,"px 0")}).toString();export var contextMenu=css({marginTop:"-".concat(variables.gap.xsmall*3,"px"),marginRight:"-".concat(variables.gap.big,"px")}).toString();export var messageContainer=css({marginTop:0}).toString();export var messageContainerRope=css({marginTop:0,marginBottom:0}).toString();
1
+ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({display:'flex',flexDirection:'row',justifyContent:'space-between',padding:variables.gap.big}).toString();export var imageColumn=css({width:120,height:120,marginRight:variables.gap.small,flexShrink:0,flexGrow:0});export var column=css({display:'flex',alignItems:'center',flexDirection:'column',flexShrink:1,flexGrow:1,flexBasis:0,padding:"0 ".concat(variables.gap.small,"px"),':last-child':{paddingRight:0}});export var detailsColumn=css(column,{flexShrink:1,flexGrow:3,alignItems:'flex-start'});export var priceColumnWide=css(column,{flexGrow:4,alignItems:'flex-end'});export var locationColumn=css(column,{fontSize:'1.25rem',lineHeight:'1.625rem',fontWeight:500,flexGrow:2}).toString();export var statusColumn=css(column,{fontSize:'1.25rem',lineHeight:'1.625rem'}).toString();export var productName=css({fontSize:'1.25rem',lineHeight:'1.5rem',fontWeight:500,wordBreak:['keep-all','break-word'],hyphens:'auto'}).toString();export var productProperties=css({paddingTop:variables.gap.small,color:'var(--color-text-low-emphasis)',fontSize:'1rem'}).toString();export var quantityPicker=css({width:140}).toString();export var quantityPickerDisabled=css({padding:"0 ".concat(variables.gap.small,"px"),textAlign:'center',fontSize:'1.25rem',lineHeight:'1.625rem',height:28,width:'100%',fontWeight:500,color:'var(--color-text-high-emphasis)',whiteSpace:'nowrap'}).toString();export var containerInactive=css(_defineProperty(_defineProperty({color:'var(--color-text-low-emphasis)'}," .".concat(quantityPickerDisabled),{color:'var(--color-text-low-emphasis)'})," .".concat(imageColumn),{opacity:0.7})).toString();export var price=css({fontSize:'1.25rem !important',lineHeight:'1.625rem !important'}).toString();export var priceListEntry=css({flexDirection:'column-reverse !important'}).toString();export var priceListPromo=css({paddingRight:0,alignSelf:'flex-end'}).toString();export var priceInfo=css({wordBreak:'break-word',fontSize:'0.75rem',lineHeight:'0.875rem',color:'var(--color-text-low-emphasis)',padding:"".concat(variables.gap.xsmall,"px 0")}).toString();export var contextMenu=css({marginTop:"-".concat(variables.gap.xsmall*3,"px"),marginRight:"-".concat(variables.gap.big,"px")}).toString();export var messageContainer=css({marginTop:0}).toString();export var messageContainerRope=css({marginTop:0,marginBottom:0}).toString();
@@ -1,4 +1,3 @@
1
1
  import React from'react';import{BOPIS,ROPIS}from'@shopgate/engage/locations';import{i18n}from'@shopgate/engage/core';import{label}from"./CartItemProductLayoutWideFulfillmentLabel.style";import{useCartItemProduct}from"./CartItem.hooks";/**
2
- * @param {Object} props The component props
3
- * @returns {JSX}
2
+ * @returns {JSX.Element}
4
3
  */var CartItemProductLayoutWideFulfillmentLabel=function CartItemProductLayoutWideFulfillmentLabel(){var _cartItem$fulfillment;var _useCartItemProduct=useCartItemProduct(),cartItem=_useCartItemProduct.cartItem;var fulfillmentMethod=(cartItem===null||cartItem===void 0?void 0:(_cartItem$fulfillment=cartItem.fulfillment)===null||_cartItem$fulfillment===void 0?void 0:_cartItem$fulfillment.method)||null;var suffix='direct_ship';if(fulfillmentMethod===BOPIS){suffix='bopis';}else if(fulfillmentMethod===ROPIS){suffix='ropis';}return React.createElement("div",{className:label},i18n.text("locations.method.".concat(suffix)));};export{CartItemProductLayoutWideFulfillmentLabel};
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;export var label=css({color:"var(--color-secondary, ".concat(colors.accent,")"),fontSize:'0.875rem',marginTop:'auto'});
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;export var label=css({color:"var(--color-secondary, ".concat(colors.accent,")"),fontSize:'0.875rem',marginTop:'auto'}).toString();
@@ -1,3 +1,3 @@
1
1
  import React,{Fragment}from'react';import{QuantityLabel}from'@shopgate/engage/components';import{getTranslatedLineItemStatus}from'@shopgate/engage/orders';import{useCartItem,useCartItemProduct}from"./CartItem.hooks";import{column,locationColumn,statusColumn,quantityPickerDisabled}from"./CartItemProductLayoutWide.style";/**
2
- * @returns {JSX}
2
+ * @returns {JSX.Element}
3
3
  */var CartItemProductLayoutWide=function CartItemProductLayoutWide(){var _useCartItem=useCartItem(),location=_useCartItem.location,cartItem=_useCartItem.cartItem,cartIsDirectShipOnly=_useCartItem.cartIsDirectShipOnly;var _useCartItemProduct=useCartItemProduct(),product=_useCartItemProduct.product;var hasUnitWithDecimals=product.unit&&product.hasCatchWeight||false;return React.createElement(Fragment,null,!cartIsDirectShipOnly?React.createElement("div",{className:locationColumn},location===null||location===void 0?void 0:location.name):null,React.createElement("div",{className:statusColumn},getTranslatedLineItemStatus(cartItem===null||cartItem===void 0?void 0:cartItem.status,cartItem===null||cartItem===void 0?void 0:cartItem.subStatus)),React.createElement("div",{className:column},React.createElement(QuantityLabel,{className:quantityPickerDisabled,value:cartItem.quantity,unit:hasUnitWithDecimals?product.unit:null,maxDecimals:hasUnitWithDecimals?2:0})));};export default CartItemProductLayoutWide;
@@ -1,4 +1,3 @@
1
1
  import React from'react';import{RippleButton,I18n}from'@shopgate/engage/components';import{button,ripple}from"./CartItemProductLayoutWideRemoveItem.style";import{useCartItemProduct}from"./CartItem.hooks";/**
2
- * @param {Object} props The component props
3
- * @returns {JSX}
2
+ * @returns {JSX.Element}
4
3
  */var CartItemProductLayoutWideRemoveItem=function CartItemProductLayoutWideRemoveItem(){var _useCartItemProduct=useCartItemProduct(),handleRemove=_useCartItemProduct.handleRemove;return React.createElement(RippleButton,{onClick:handleRemove,className:button,rippleClassName:ripple,type:"secondary",flat:true},React.createElement(I18n.Text,{string:"cart.remove_item"}));};export{CartItemProductLayoutWideRemoveItem};
@@ -1,3 +1,3 @@
1
1
  import React,{useMemo}from'react';import classNames from'classnames';import{QuantityLabel,I18n,Price}from'@shopgate/engage/components';import{getTranslatedLineItemStatus}from'@shopgate/engage/orders';import{CartItemProductPriceCaption}from"./CartItemProductPriceCaption";import{createCartItemPrices}from"../../cart.helpers";import{useCartItem,useCartItemProduct}from"./CartItem.hooks";import{quantityLabel,label,container,labelValue,fulfillmentLabel}from"./CartItemProductOrderDetails.style";/**
2
- * @returns {JSX}
2
+ * @returns {JSX.Element}
3
3
  */var CartItemProductOrderDetails=function CartItemProductOrderDetails(){var _useCartItem=useCartItem(),location=_useCartItem.location,cartItem=_useCartItem.cartItem,cartIsDirectShipOnly=_useCartItem.cartIsDirectShipOnly;var _useCartItemProduct=useCartItemProduct(),product=_useCartItemProduct.product,currency=_useCartItemProduct.currency;var hasUnitWithDecimals=product.unit&&product.hasCatchWeight||false;var unitPrice=useMemo(function(){var result=createCartItemPrices(cartItem).price;return result.slice(-1)[0].price;},[cartItem]);return React.createElement("ul",{className:container},!cartIsDirectShipOnly&&(location===null||location===void 0?void 0:location.name)?React.createElement("li",null,React.createElement(I18n.Text,{string:"cart.location",className:label}),React.createElement("span",{className:labelValue},location===null||location===void 0?void 0:location.name),React.createElement(CartItemProductPriceCaption,{className:fulfillmentLabel})):null,React.createElement("li",null,React.createElement(I18n.Text,{string:"cart.status",className:label}),React.createElement("span",{className:labelValue},getTranslatedLineItemStatus(cartItem===null||cartItem===void 0?void 0:cartItem.status,cartItem===null||cartItem===void 0?void 0:cartItem.subStatus))),React.createElement("li",null,React.createElement(I18n.Text,{string:"cart.fulfilled_quantity",className:label}),React.createElement(QuantityLabel,{className:classNames(quantityLabel,labelValue),value:cartItem.quantity,unit:hasUnitWithDecimals?product.unit:null,maxDecimals:hasUnitWithDecimals?2:0})),React.createElement("li",null,React.createElement(I18n.Text,{string:"cart.ordered_quantity",className:label}),React.createElement(QuantityLabel,{className:classNames(quantityLabel,labelValue),value:cartItem.orderedQuantity,unit:hasUnitWithDecimals?product.unit:null,maxDecimals:hasUnitWithDecimals?2:0})),React.createElement("li",null,React.createElement(I18n.Text,{string:"cart.price",className:label}),React.createElement(Price,{className:labelValue,currency:currency,taxDisclaimer:true,unitPrice:unitPrice,allowFree:true})));};export default CartItemProductOrderDetails;
@@ -1,4 +1,4 @@
1
1
  function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useMemo}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{ROPIS}from// BOPIS,
2
2
  '@shopgate/engage/locations';import{I18n}from'@shopgate/engage/components';import{useCartItemProduct}from"./CartItem.hooks";import{caption}from"./CartItemProductPriceCaption.style";/**
3
- * @returns {JSX}
3
+ * @returns {JSX.Element}
4
4
  */var CartItemProductPriceCaption=function CartItemProductPriceCaption(_ref){var className=_ref.className;var _useCartItemProduct=useCartItemProduct(),cartItem=_useCartItemProduct.cartItem;var label=useMemo(function(){var _cartItem$fulfillment;var labels=_defineProperty({},ROPIS,'cart.price_caption.reservation');var fulfillmentMethod=(cartItem===null||cartItem===void 0?void 0:(_cartItem$fulfillment=cartItem.fulfillment)===null||_cartItem$fulfillment===void 0?void 0:_cartItem$fulfillment.method)||null;return labels[fulfillmentMethod];},[cartItem]);if(!label){return null;}return React.createElement("span",{className:classNames(caption,className)},"(",React.createElement(I18n.Text,{string:label}),")");};CartItemProductPriceCaption.defaultProps={className:null};export{CartItemProductPriceCaption};
@@ -1,5 +1,8 @@
1
1
  import React,{useMemo}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{css}from'glamor';import Price from'@shopgate/pwa-ui-shared/Price';import PriceStriked from'@shopgate/pwa-ui-shared/PriceStriked';import{useCartItemProduct,useCartItem}from"./CartItem.hooks";import{createCartItemPrices}from"../../cart.helpers";import CartItemProductPriceListPromotion from"./CartItemProductPriceListPromotion";var styles={price:css({fontSize:'1rem',fontWeight:500,marginLeft:'auto'}).toString(),priceStriked:css({fontSize:'.875rem',marginLeft:'auto'}).toString(),priceListEntry:css({display:'flex',flexDirection:'row',justifyContent:'flex-end',alignItems:'center'}).toString()};/**
2
2
  * @param {Object} props The component props
3
- * @returns {JSX}
3
+ * @param {Object} [props.classes] CSS class names
4
+ * @param {boolean} [props.isSubtotal] Whether to show subtotal prices
5
+ * @param {boolean} [props.showLabels] Whether to show promotion labels
6
+ * @returns {JSX.Element}
4
7
  */var CartItemProductPriceList=function CartItemProductPriceList(_ref){var classes=_ref.classes,isSubtotal=_ref.isSubtotal,showLabels=_ref.showLabels;var _useCartItem=useCartItem(),isOrderDetails=_useCartItem.isOrderDetails,isCheckoutConfirmation=_useCartItem.isCheckoutConfirmation;var context=useCartItemProduct();var currency=context.currency,cartItem=context.cartItem;var prices=useMemo(function(){var _result;var result=createCartItemPrices(cartItem)[isSubtotal?'subtotal':'price'];// Not striked prices when the product is free or the cart is used to display an order
5
8
  if(((_result=result[result.length-1])===null||_result===void 0?void 0:_result.price)===0||isOrderDetails||isCheckoutConfirmation){return result.slice(-1);}return result;},[cartItem,isCheckoutConfirmation,isOrderDetails,isSubtotal]);return React.createElement("ul",null,prices.map(function(_ref2,index){var price=_ref2.price,isCoupon=_ref2.isCoupon,isPromo=_ref2.isPromo;var isLast=index===prices.length-1;return(/* eslint-disable react/no-array-index-key */React.createElement("li",{key:"total_".concat(index),className:classNames(styles.priceListEntry,classes===null||classes===void 0?void 0:classes.entry)},(showLabels||!isSubtotal)&&React.createElement(CartItemProductPriceListPromotion,{isCoupon:isCoupon,isPromo:isPromo,className:classes===null||classes===void 0?void 0:classes.promo}),!isLast?React.createElement(PriceStriked,{className:classNames(styles.priceStriked,classes===null||classes===void 0?void 0:classes.priceStriked),value:price,currency:currency}):React.createElement(Price,{className:classNames(styles.price,classes===null||classes===void 0?void 0:classes.price),unitPrice:price,currency:currency,discounted:prices.length>1||price===0,taxDisclaimer:true,allowFree:true}))/* eslint-enable react/no-array-index-key */);}));};CartItemProductPriceList.defaultProps={isSubtotal:false,showLabels:false,classes:{price:null,priceStriked:null}};export default CartItemProductPriceList;
@@ -3,7 +3,9 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
3
3
  * @return {Object} The extended component props.
4
4
  */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{deleteCoupon:function deleteCoupon(couponCode){return dispatch(deleteCouponsFromCart([couponCode]));},showTextModal:function showTextModal(text){return dispatch(showModal({message:text,title:null,confirm:null,dismiss:'modal.ok'}));}};};/**
5
5
  * @param {Object} props The component props
6
- * @returns {JSX}
6
+ * @param {string} props.text The promotional text
7
+ * @param {Function} props.showText The function to show the promotional text
8
+ * @returns {JSX.Element}
7
9
  */var PromotionalTextInfoIcon=function PromotionalTextInfoIcon(_ref){var text=_ref.text,showText=_ref.showText;var _useContext=useContext(CartContext),isLoading=_useContext.isLoading;if(!text){return null;}return React.createElement("span",{onClick:function onClick(){return showText(text);},onKeyDown:function onKeyDown(){return showText(text);},className:classNames(styles.infoIconWrapper,_defineProperty({},styles.loading,isLoading)),role:"button",tabIndex:0},React.createElement(InfoIcon,{className:styles.icon}));};PromotionalTextInfoIcon.defaultProps={text:null};/**
8
10
  * @param {Object} props The component props
9
11
  * @returns {JSX}
@@ -1,9 +1,21 @@
1
1
  import{connect}from'react-redux';import{isAndroid}from'@shopgate/pwa-common/selectors/client';import deleteProductsFromCart from'@shopgate/pwa-common-commerce/cart/actions/deleteProductsFromCart';import updateProductsInCart from'@shopgate/pwa-common-commerce/cart/actions/updateProductsInCart';import{getCurrency}from'@shopgate/pwa-common-commerce/cart/selectors';/**
2
+ * @typedef {import('./CartItemProductProvider.types').OwnProps} OwnProps
3
+ * @typedef {import('./CartItemProductProvider.types').StateProps} StateProps
4
+ */ /**
2
5
  * Maps the contents of the state to the component props.
3
6
  * @param {Object} state The current application state.
4
- * @return {Object} The extended component props.
7
+ * @returns {StateProps} The extended component props.
5
8
  */var mapStateToProps=function mapStateToProps(state){return{isAndroid:isAndroid(state),currency:getCurrency(state)};};/**
6
9
  * Connects the dispatch function to a callable function in the props.
7
10
  * @param {Function} dispatch The redux dispatch function.
8
- * @return {Object} The extended component props.
9
- */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{deleteProduct:function deleteProduct(cartItemId){return dispatch(deleteProductsFromCart([cartItemId]));},updateProduct:function updateProduct(cartItemId,quantity){if(quantity===0){return dispatch(deleteProductsFromCart([cartItemId]));}return dispatch(updateProductsInCart([{cartItemId:cartItemId,quantity:quantity}]));}};};export default connect(mapStateToProps,mapDispatchToProps);
11
+ * @returns {DispatchProps} The extended component props.
12
+ */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{/**
13
+ * Deletes a product from the cart.
14
+ * @param {string} cartItemId The ID of the cart item to delete.
15
+ * @returns {Promise<void>} A promise that resolves when the product is deleted.
16
+ */deleteProduct:function deleteProduct(cartItemId){return dispatch(deleteProductsFromCart([cartItemId]));},/**
17
+ * Updates the quantity of a product in the cart.
18
+ * @param {string} cartItemId The ID of the cart item to update.
19
+ * @param {number} quantity The new quantity.
20
+ * @returns {Promise<void>} A promise that resolves when the product is updated.
21
+ */updateProduct:function updateProduct(cartItemId,quantity){if(quantity===0){return dispatch(deleteProductsFromCart([cartItemId]));}return dispatch(updateProductsInCart([{cartItemId:cartItemId,quantity:quantity}]));}};};export default connect(mapStateToProps,mapDispatchToProps);
@@ -1,7 +1,13 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useMemo,useCallback,useState,useRef}from'react';import{getAbsoluteHeight}from'@shopgate/pwa-common/helpers/dom';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{CART_ITEM_TYPE_PRODUCT}from'@shopgate/pwa-common-commerce/cart/constants';import{CART_INPUT_AUTO_SCROLL_DELAY}from"../../cart.constants";import Context from"./CartItemProductProvider.context";import connect from"./CartItemProductProvider.connector";import CartItemProductProviderLegacy from"./CartItemProductProviderLegacy";var variables=themeConfig.variables;/**
1
+ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useMemo,useCallback,useState,useRef}from'react';import{getAbsoluteHeight}from'@shopgate/pwa-common/helpers/dom';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{CART_ITEM_TYPE_PRODUCT}from'@shopgate/pwa-common-commerce/cart/constants';import PropTypes from'prop-types';import{CART_INPUT_AUTO_SCROLL_DELAY}from"../../cart.constants";import Context from"./CartItemProductProvider.context";import connect from"./CartItemProductProvider.connector";import CartItemProductProviderLegacy from"./CartItemProductProviderLegacy";var variables=themeConfig.variables;/**
2
+ * @typedef {import('./CartItemProductProvider.types').OwnProps} OwnProps
3
+ * @typedef {import('./CartItemProductProvider.types').StateProps} StateProps
4
+ * @typedef {import('./CartItemProductProvider.types').DispatchProps} DispatchProps
5
+ */ /**
6
+ * @typedef {OwnProps & StateProps & DispatchProps} Props
7
+ */ /**
2
8
  * The CartItemProduct Provider
3
- * @param {Object} props The component props.
4
- * @returns {JSX}
9
+ * @param {Props} props The component props.
10
+ * @returns {JSX.Element}
5
11
  */var CartItemProductProvider=function CartItemProductProvider(_ref){var currency=_ref.currency,deleteProduct=_ref.deleteProduct,updateProduct=_ref.updateProduct,onFocus=_ref.onFocus,cartItem=_ref.cartItem,isEditable=_ref.isEditable,children=_ref.children,isAndroid=_ref.isAndroid,currencyOverride=_ref.currencyOverride;var id=cartItem.id,product=cartItem.product,quantity=cartItem.quantity,_cartItem$fulfillment=cartItem.fulfillment,fulfillment=_cartItem$fulfillment===void 0?null:_cartItem$fulfillment,_cartItem$messages=cartItem.messages,messages=_cartItem$messages===void 0?[]:_cartItem$messages,status=cartItem.status,subStatus=cartItem.subStatus,orderedQuantity=cartItem.orderedQuantity,unitPromoAmount=cartItem.unitPromoAmount,unitDiscountAmount=cartItem.unitDiscountAmount,price=cartItem.price,promoAmount=cartItem.promoAmount,discountAmount=cartItem.discountAmount,extendedPrice=cartItem.extendedPrice,appliedPromotions=cartItem.appliedPromotions,_cartItem$flags=cartItem.flags,flags=_cartItem$flags===void 0?{}:_cartItem$flags;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),editMode=_useState2[0],setEditMode=_useState2[1];var cartItemRef=useRef();var handleRemove=useCallback(function(){deleteProduct(id);},[deleteProduct,id]);var handleUpdate=useCallback(function(updatedQuantity){updateProduct(id,updatedQuantity);},[id,updateProduct]);var toggleEditMode=useCallback(function(isEnabled){if(isAndroid&&isEnabled){/**
6
12
  * When the user focuses the quantity input, the keyboard will pop up an overlap the input.
7
13
  * Therefor the input has to be scrolled into the viewport again. Since between the focus and
@@ -9,4 +15,4 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
9
15
  *
10
16
  * This should not happen on iOS devices, since their web views behave different.
11
17
  */setTimeout(function(){var yOffset=-(window.innerHeight/2)+getAbsoluteHeight(cartItemRef.current)+variables.paymentBar.height;if(cartItemRef.current){cartItemRef.current.scrollIntoView({behavior:'smooth',yOffset:yOffset});}},CART_INPUT_AUTO_SCROLL_DELAY);}// Give the keyboard some time to slide out after blur, before further actions are taken.
12
- setTimeout(function(){if(onFocus){onFocus(isEnabled);}},isEnabled?300:0);setEditMode(isEnabled);},[isAndroid,onFocus]);var value=useMemo(function(){var isLinkable=(flags===null||flags===void 0?void 0:flags.disableLink)!==true;var allowQuantityChange=(flags===null||flags===void 0?void 0:flags.disableQuantityField)!==true;return{type:CART_ITEM_TYPE_PRODUCT,currency:currencyOverride||currency,product:product,messages:messages,handleRemove:handleRemove,handleUpdate:handleUpdate,cartItemRef:cartItemRef,toggleEditMode:toggleEditMode,editMode:editMode,isEditable:isEditable,isLinkable:isLinkable,allowQuantityChange:allowQuantityChange,cartItemId:id,cartItem:{id:id,product:product,status:status,subStatus:subStatus,quantity:quantity,orderedQuantity:orderedQuantity,fulfillment:fulfillment,unitPromoAmount:unitPromoAmount,unitDiscountAmount:unitDiscountAmount,price:price,promoAmount:promoAmount,discountAmount:discountAmount,extendedPrice:extendedPrice,appliedPromotions:appliedPromotions}};},[currency,currencyOverride,editMode,fulfillment,handleRemove,handleUpdate,id,isEditable,flags,messages,product,status,subStatus,quantity,orderedQuantity,toggleEditMode,unitPromoAmount,unitDiscountAmount,price,promoAmount,discountAmount,extendedPrice,appliedPromotions]);return React.createElement(Context.Provider,{value:value},React.createElement(CartItemProductProviderLegacy,null,children));};CartItemProductProvider.defaultProps={children:null,isEditable:true,onFocus:function onFocus(){},currencyOverride:null};export default connect(CartItemProductProvider);
18
+ setTimeout(function(){if(onFocus){onFocus(isEnabled);}},isEnabled?300:0);setEditMode(isEnabled);},[isAndroid,onFocus]);var value=useMemo(function(){var isLinkable=(flags===null||flags===void 0?void 0:flags.disableLink)!==true;var allowQuantityChange=(flags===null||flags===void 0?void 0:flags.disableQuantityField)!==true;return{type:CART_ITEM_TYPE_PRODUCT,currency:currencyOverride||currency,product:product,messages:messages,handleRemove:handleRemove,handleUpdate:handleUpdate,cartItemRef:cartItemRef,toggleEditMode:toggleEditMode,editMode:editMode,isEditable:isEditable,isLinkable:isLinkable,allowQuantityChange:allowQuantityChange,cartItemId:id,cartItem:{id:id,product:product,status:status,subStatus:subStatus,quantity:quantity,orderedQuantity:orderedQuantity,fulfillment:fulfillment,unitPromoAmount:unitPromoAmount,unitDiscountAmount:unitDiscountAmount,price:price,promoAmount:promoAmount,discountAmount:discountAmount,extendedPrice:extendedPrice,appliedPromotions:appliedPromotions}};},[currency,currencyOverride,editMode,fulfillment,handleRemove,handleUpdate,id,isEditable,flags,messages,product,status,subStatus,quantity,orderedQuantity,toggleEditMode,unitPromoAmount,unitDiscountAmount,price,promoAmount,discountAmount,extendedPrice,appliedPromotions]);return React.createElement(Context.Provider,{value:value},React.createElement(CartItemProductProviderLegacy,null,children));};CartItemProductProvider.defaultProps={children:null,isEditable:true,onFocus:function onFocus(){},currencyOverride:null,currency:null,isAndroid:false};export default connect(CartItemProductProvider);
@@ -1 +1,27 @@
1
- import*as React from'react';
1
+ /**
2
+ * @typedef {import('../../cart.types').ItemFulfillment} ItemFulfillment
3
+ */ /**
4
+ * @typedef {import('@shopgate/engage/product/product.types').Product} Product
5
+ */ /**
6
+ * @typedef {Object} CartItemProduct
7
+ * @property {string} id
8
+ * @property {Product} product
9
+ * @property {number} quantity
10
+ * @property {any[]} messages
11
+ * @property {ItemFulfillment} [fulfillment]
12
+ */ /**
13
+ * @typedef {Object} OwnProps
14
+ * @property {CartItemProduct} cartItem
15
+ * @property {(isEnabled: boolean) => void} [onToggleFocus]
16
+ * @property {boolean} [isEditable]
17
+ * @property {React.ReactNode} [children]
18
+ * @property {string} [currencyOverride]
19
+ */ /**
20
+ * @typedef {Object} StateProps
21
+ * @property {boolean} [isAndroid]
22
+ * @property {string} [currency]
23
+ */ /**
24
+ * @typedef {Object} DispatchProps
25
+ * @property {(cartItemId: string) => Promise<any>} [deleteProduct]
26
+ * @property {(cartItemId: string, quantity: number) => Promise<any>} [updateProduct]
27
+ */
@@ -1,5 +1,14 @@
1
- import React,{useMemo,useCallback}from'react';import Context from"./CartItemProvider.context";import connect from"./CartItemProvider.connector";/**
1
+ import React,{useMemo,useCallback}from'react';import PropTypes from'prop-types';import Context from"./CartItemProvider.context";import connect from"./CartItemProvider.connector";/* eslint-disable max-len */ /**
2
2
  * The CartItem Provider
3
3
  * @param {Object} props The component props.
4
- * @returns {JSX}
5
- */var CartItemProvider=function CartItemProvider(_ref){var cartItem=_ref.cartItem,location=_ref.location,isEditable=_ref.isEditable,children=_ref.children,enabledFulfillmentMethodsCount=_ref.enabledFulfillmentMethodsCount,isOrderDetails=_ref.isOrderDetails,isCheckoutConfirmation=_ref.isCheckoutConfirmation,cartIsDirectShipOnly=_ref.cartIsDirectShipOnly,cartHasLineItemPromotions=_ref.cartHasLineItemPromotions;var actions=useMemo(function(){return new Map();},[]);var registerFulfillmentAction=useCallback(function(action,callback){actions.set(action,callback);},[actions]);var invokeFulfillmentAction=useCallback(function(action){if(!actions.has(action)){return;}for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}actions.get(action).apply(void 0,args);},[actions]);var value=useMemo(function(){return{registerFulfillmentAction:registerFulfillmentAction,invokeFulfillmentAction:invokeFulfillmentAction,cartItem:cartItem,location:location,isEditable:isEditable,isOrderDetails:isOrderDetails,isCheckoutConfirmation:isCheckoutConfirmation,cartIsDirectShipOnly:cartIsDirectShipOnly,cartHasLineItemPromotions:cartHasLineItemPromotions,merchantFulfillmentMethodsCount:enabledFulfillmentMethodsCount};},[cartItem,location,enabledFulfillmentMethodsCount,invokeFulfillmentAction,isEditable,isOrderDetails,isCheckoutConfirmation,cartIsDirectShipOnly,cartHasLineItemPromotions,registerFulfillmentAction]);return React.createElement(Context.Provider,{value:value},children);};CartItemProvider.defaultProps={children:null,location:null,isEditable:true,isOrderDetails:false,cartIsDirectShipOnly:false,isCheckoutConfirmation:false,cartHasLineItemPromotions:false};export default connect(CartItemProvider);
4
+ * @param {Object} props.cartItem The cart item data.
5
+ * @param {boolean} [props.isEditable=true] Whether the cart item is editable.
6
+ * @param {boolean} [props.isOrderDetails=false] Whether the component is used in order details.
7
+ * @param {boolean} [props.cartIsDirectShipOnly=false] Whether the cart is direct ship only.
8
+ * @param {boolean} [props.isCheckoutConfirmation=false] Whether the component is used in checkout confirmation.
9
+ * @param {boolean} [props.cartHasLineItemPromotions=false] Whether the cart has line item promotions.
10
+ * @param {Object|null} [props.location=null] The location data.
11
+ * @param {React.ReactNode} [props.children=null] Child components.
12
+ * @param {number} props.enabledFulfillmentMethodsCount The count of enabled fulfillment methods.
13
+ * @returns {JSX.Element} The rendered component.
14
+ */var CartItemProvider=function CartItemProvider(_ref){var cartItem=_ref.cartItem,location=_ref.location,isEditable=_ref.isEditable,children=_ref.children,enabledFulfillmentMethodsCount=_ref.enabledFulfillmentMethodsCount,isOrderDetails=_ref.isOrderDetails,isCheckoutConfirmation=_ref.isCheckoutConfirmation,cartIsDirectShipOnly=_ref.cartIsDirectShipOnly,cartHasLineItemPromotions=_ref.cartHasLineItemPromotions;var actions=useMemo(function(){return new Map();},[]);var registerFulfillmentAction=useCallback(function(action,callback){actions.set(action,callback);},[actions]);var invokeFulfillmentAction=useCallback(function(action){if(!actions.has(action)){return;}for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}actions.get(action).apply(void 0,args);},[actions]);var value=useMemo(function(){return{registerFulfillmentAction:registerFulfillmentAction,invokeFulfillmentAction:invokeFulfillmentAction,cartItem:cartItem,location:location,isEditable:isEditable,isOrderDetails:isOrderDetails,isCheckoutConfirmation:isCheckoutConfirmation,cartIsDirectShipOnly:cartIsDirectShipOnly,cartHasLineItemPromotions:cartHasLineItemPromotions,merchantFulfillmentMethodsCount:enabledFulfillmentMethodsCount};},[cartItem,location,enabledFulfillmentMethodsCount,invokeFulfillmentAction,isEditable,isOrderDetails,isCheckoutConfirmation,cartIsDirectShipOnly,cartHasLineItemPromotions,registerFulfillmentAction]);return React.createElement(Context.Provider,{value:value},children);};CartItemProvider.defaultProps={children:null,location:null,isEditable:true,isOrderDetails:false,cartIsDirectShipOnly:false,isCheckoutConfirmation:false,cartHasLineItemPromotions:false};export default connect(CartItemProvider);/* eslint-enable max-len */
@@ -1,31 +1,30 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import*as React from'react';import{i18n}from'@shopgate/engage/core';import QuantityInput from'@shopgate/engage/components/QuantityInput';import{inputStyle}from"./CartItemQuantityPicker.style";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';import QuantityInput from'@shopgate/engage/components/QuantityInput';import{inputStyle}from"./CartItemQuantityPicker.style";/**
2
+ * @typedef {Object} Props
3
+ * @property {boolean} [editMode]
4
+ * @property {function(number):void} [onChange]
5
+ * @property {function(boolean):void} [onToggleEditMode]
6
+ * @property {number} [quantity]
7
+ * @property {string} [unit]
8
+ * @property {boolean} [disabled]
9
+ * @property {boolean} [hasCatchWeight]
10
+ */ /**
2
11
  * The Quantity Picker component.
3
12
  */export var CartItemQuantityPicker=/*#__PURE__*/function(_React$Component){/**
4
13
  * Constructor.
5
14
  * @param {Object} props The component props.
6
- */function CartItemQuantityPicker(props){var _this2;_classCallCheck(this,CartItemQuantityPicker);_this2=_callSuper(this,CartItemQuantityPicker,[props]);/**
7
- * The default quantity.
8
- * @type {number}
9
- */_defineProperty(_this2,"defaultQuantity",1);/**
10
- * Event handler for the the onClick event of the input.
11
- * @param {Object} event The event object.
12
- */_defineProperty(_this2,"handleInputClick",function(event){// Prevent the native focus event ...
13
- event.stopPropagation();event.preventDefault();if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(true);}});/**
14
- * Event handler for the onFocus event of the input.
15
- */_defineProperty(_this2,"handleInputFocus",function(){if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(true);}});/**
16
- * Event handler for the onSubmit event of the form which wraps the input.
17
- * @param {Object} event The event object.
15
+ */function CartItemQuantityPicker(props){var _this2;_classCallCheck(this,CartItemQuantityPicker);_this2=_callSuper(this,CartItemQuantityPicker,[props]);_defineProperty(_this2,"regex",void 0);_defineProperty(_this2,"input",void 0);_defineProperty(_this2,"defaultQuantity",1);/**
16
+ * Handles the input click event.
17
+ * @param {Event} event The click event.
18
+ */_defineProperty(_this2,"handleInputClick",function(event){event.stopPropagation();event.preventDefault();if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(true);}});_defineProperty(_this2,"handleInputFocus",function(){if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(true);}});/**
19
+ * Handles the form submission event.
20
+ * @param {Event} event The submit event.
18
21
  */_defineProperty(_this2,"handleSubmitForm",function(event){event.preventDefault();if(_this2.input.current){_this2.input.current.blur();}});/**
19
- * Event handler for the the onBlur event of the input.
20
- * @param {Object} event The event object.
21
- * @param {number} newQuantity The event object.
22
- */_defineProperty(_this2,"handleInputBlur",function(event,newQuantity){var onChange=_this2.props.onChange;// Deactivate the edit mode
23
- if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(false);}if(_this2.props.quantity!==newQuantity){if(onChange){onChange(newQuantity);}}});_this2.regex=/^([0-9.,]+)$/;_this2.input=React.createRef();return _this2;}/**
22
+ * Handles the input blur event.
23
+ * @param {Event} event The blur event.
24
+ * @param {number} newQuantity The new quantity value.
25
+ */_defineProperty(_this2,"handleInputBlur",function(event,newQuantity){var onChange=_this2.props.onChange;if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(false);}if(_this2.props.quantity!==newQuantity){if(onChange){onChange(newQuantity);}}});_this2.regex=/^([0-9.,]+)$/;_this2.input=React.createRef();return _this2;}/**
24
26
  * Called after mount. Focuses the input if the edit mode is active.
25
- */_inherits(CartItemQuantityPicker,_React$Component);return _createClass(CartItemQuantityPicker,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.editMode&&this.input.current){this.input.current.focus();}if(this.input.current){/**
26
- * Prevent the opening of the context menu when this
27
- * input is focused and the value is selected.
28
- */this.input.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});}}/**
27
+ */_inherits(CartItemQuantityPicker,_React$Component);return _createClass(CartItemQuantityPicker,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.editMode&&this.input.current){this.input.current.focus();}if(this.input.current){this.input.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});}}/**
29
28
  * The componentWillReceiveProps lifecycle hook. I will bring the input into the correct state.
30
29
  * @param {Object} nextProps The next set of props.
31
30
  */},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.input.current){if(nextProps.editMode){this.input.current.focus();}else{this.input.current.blur();}}}},{key:"initialQuantity",get:/**
@@ -34,5 +33,7 @@ if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(false);}if(_this
34
33
  * @return {number}
35
34
  */function get(){if(this.props.quantity&&(this.props.quantity===0||this.props.quantity<this.defaultQuantity)){return this.defaultQuantity;}return this.props.quantity||this.defaultQuantity;}},{key:"render",value:/**
36
35
  * Renders the component.
37
- * @return {JSX}
38
- */function render(){var _this$props=this.props,unit=_this$props.unit,hasCatchWeight=_this$props.hasCatchWeight;var hasCustomUnit=unit&&hasCatchWeight||false;return React.createElement("form",{onSubmit:this.handleSubmitForm,className:"theme__cart__product__quantity-picker"},React.createElement(QuantityInput,{ref:this.input,className:inputStyle.toString(),value:this.props.quantity,onClick:this.handleInputClick,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,unit:hasCustomUnit?unit:null,maxDecimals:hasCustomUnit?2:0,"data-test-id":"quantityPicker",disabled:this.props.disabled,"aria-label":i18n.text('product.quantity')}));}}]);}(React.Component);_defineProperty(CartItemQuantityPicker,"defaultProps",{editMode:false,onChange:function onChange(){},unit:null,quantity:1,onToggleEditMode:function onToggleEditMode(){},disabled:false,hasCatchWeight:false});
36
+ * @return {JSX.Element}
37
+ */function render(){var _this$props=this.props,unit=_this$props.unit,hasCatchWeight=_this$props.hasCatchWeight;var hasCustomUnit=unit&&hasCatchWeight||false;return React.createElement("form",{onSubmit:this.handleSubmitForm,className:"theme__cart__product__quantity-picker"},React.createElement(QuantityInput,{ref:this.input,className:inputStyle.toString(),value:this.props.quantity,onClick:this.handleInputClick,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,unit:hasCustomUnit?unit:null,maxDecimals:hasCustomUnit?2:0,"data-test-id":"quantityPicker",disabled:this.props.disabled,"aria-label":i18n.text('product.quantity')}));}}]);}(React.Component);/**
38
+ * @type {Props}
39
+ */_defineProperty(CartItemQuantityPicker,"defaultProps",{editMode:false,onChange:function onChange(){},unit:null,quantity:1,onToggleEditMode:function onToggleEditMode(){},disabled:false,hasCatchWeight:false});
@@ -1,5 +1,7 @@
1
1
  import React from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';import{BOPIS,ROPIS}from'@shopgate/engage/locations';import connect from"./CartItemSubstitution.connector";import{useCartItem}from"./CartItem.hooks";import Substitution,{SubstitutionWrapper}from"../Substitution";import{root}from"./CartItemSubstitution.style";/**
2
2
  * Renders the cart reservation card label.
3
3
  * @param {Object} props The component props.
4
- * @returns {JSX}
4
+ * @param {Function} props.setSubstitutionAllowed The action to set substitution allowed flag.
5
+ * @param {boolean} props.editable Whether the substitution option is editable.
6
+ * @returns {JSX.Element}
5
7
  */var CartItemSubstitution=function CartItemSubstitution(_ref){var setSubstitutionAllowed=_ref.setSubstitutionAllowed,editable=_ref.editable;var _useCartItem=useCartItem(),_useCartItem$cartItem=_useCartItem.cartItem,_useCartItem$cartItem2=_useCartItem$cartItem===void 0?{}:_useCartItem$cartItem,id=_useCartItem$cartItem2.id,substitutionAllowed=_useCartItem$cartItem2.substitutionAllowed,fulfillment=_useCartItem$cartItem2.fulfillment;if(![ROPIS,BOPIS].includes((fulfillment===null||fulfillment===void 0?void 0:fulfillment.method)||[])){return null;}return React.createElement(SubstitutionWrapper,null,React.createElement(Substitution,{className:root,id:"substitution-".concat(id),label:i18n.text('cart.allow_substitution'),checked:substitutionAllowed,onChange:function onChange(){return setSubstitutionAllowed(id,!substitutionAllowed);},disabled:!editable}));};CartItemSubstitution.defaultProps={editable:false};export default connect(CartItemSubstitution);