@shopgate/engage 6.21.0 → 6.22.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/back-in-stock/actions/index.js +14 -0
  2. package/back-in-stock/components/BackInStockButton/connector.js +1 -0
  3. package/back-in-stock/components/BackInStockButton/index.js +13 -0
  4. package/back-in-stock/components/BackInStockButton/style.js +1 -0
  5. package/back-in-stock/components/CharacteristicsButton/connector.js +3 -0
  6. package/back-in-stock/components/CharacteristicsButton/index.js +8 -0
  7. package/back-in-stock/components/ProductInfoBackInStockButton/connector.js +3 -0
  8. package/back-in-stock/components/ProductInfoBackInStockButton/index.js +10 -0
  9. package/back-in-stock/components/Subscriptions/components/List/index.js +4 -0
  10. package/back-in-stock/components/Subscriptions/components/Subscription/connector.js +3 -0
  11. package/back-in-stock/components/Subscriptions/components/Subscription/index.js +7 -0
  12. package/back-in-stock/components/Subscriptions/index.js +4 -0
  13. package/back-in-stock/components/index.js +1 -0
  14. package/back-in-stock/constants/Actions.js +1 -0
  15. package/back-in-stock/constants/Common.js +1 -0
  16. package/back-in-stock/constants/Pipelines.js +1 -0
  17. package/back-in-stock/constants/Portals.js +9 -0
  18. package/back-in-stock/constants/index.js +1 -0
  19. package/back-in-stock/hooks/index.js +4 -0
  20. package/back-in-stock/providers/BackInStockSubscriptionsProvider.connector.js +7 -0
  21. package/back-in-stock/providers/BackInStockSubscriptionsProvider.context.js +1 -0
  22. package/back-in-stock/providers/BackInStockSubscriptionsProvider.js +5 -0
  23. package/back-in-stock/providers/index.js +1 -0
  24. package/back-in-stock/reducers/index.js +5 -0
  25. package/back-in-stock/selectors/index.js +24 -0
  26. package/back-in-stock/streams/index.js +1 -0
  27. package/back-in-stock/subscriptions/index.js +3 -0
  28. package/components/index.js +1 -1
  29. package/core/actions/grantPermissions.js +10 -3
  30. package/core/actions/grantPushPermissions.js +22 -0
  31. package/core/index.js +1 -1
  32. package/package.json +7 -7
  33. package/product/components/Characteristics/Characteristic/components/Sheet/index.js +2 -2
  34. package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +3 -3
  35. package/product/components/Characteristics/Characteristic/components/SheetItem/style.js +1 -1
  36. package/product/index.js +1 -1
  37. package/product/selectors/product.js +5 -1
  38. package/product/selectors/variants.js +2 -2
@@ -0,0 +1,14 @@
1
+ import{PipelineRequest}from'@shopgate/engage/core';import{SHOPGATE_USER_ADD_BACK_IN_STOCK_SUBSCRIPTION,SHOPGATE_USER_DELETE_BACK_IN_STOCK_SUBSCRIPTION,SHOPGATE_USER_GET_BACK_IN_STOCK_SUBSCRIPTIONS,ADD_BACK_IN_STOCK_SUBSCRIPTION,ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR,ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS,REMOVE_BACK_IN_STOCK_SUBSCRIPTION,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS}from'@shopgate/engage/back-in-stock/constants';/**
2
+ * Fetch Back in Stock Subscriptions
3
+ * @returns {Function}
4
+ */export var fetchBackInStockSubscriptions=function fetchBackInStockSubscriptions(){return function(dispatch){dispatch({type:FETCH_BACK_IN_STOCK_SUBSCRIPTIONS});var request=new PipelineRequest(SHOPGATE_USER_GET_BACK_IN_STOCK_SUBSCRIPTIONS).setInput({limit:100,filters:{status:{$in:['active','triggered']}}}).setRetries(0).dispatch();request.then(function(_ref){var subscriptions=_ref.subscriptions;dispatch({type:FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS,subscriptions:subscriptions});})["catch"](function(error){dispatch({type:FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR,error:error});});return request;};};/**
5
+ * Add a Back in Stock Subscription
6
+ * @param {Object} props Props.
7
+ * @param {string} props.productId The product for which the subscription should be added
8
+ * @returns {Function}
9
+ */export var addBackInStockSubscription=function addBackInStockSubscription(_ref2){var productId=_ref2.productId;return function(dispatch){dispatch({type:ADD_BACK_IN_STOCK_SUBSCRIPTION});var request=new PipelineRequest(SHOPGATE_USER_ADD_BACK_IN_STOCK_SUBSCRIPTION).setInput({productCode:productId}).setRetries(0).dispatch();request.then(function(_ref3){var subscriptions=_ref3.subscriptions;dispatch({type:ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,subscriptions:subscriptions});})["catch"](function(error){dispatch({type:ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR,error:error});});return request;};};/**
10
+ * Remove a Back in Stock Subscription
11
+ * @param {Object} props Props.
12
+ * @param {string} props.subscriptionCode The subscription which should be deleted
13
+ * @returns {Function}
14
+ */export var removeBackInStockSubscription=function removeBackInStockSubscription(_ref4){var subscriptionCode=_ref4.subscriptionCode;return function(dispatch){dispatch({type:REMOVE_BACK_IN_STOCK_SUBSCRIPTION});var request=new PipelineRequest(SHOPGATE_USER_DELETE_BACK_IN_STOCK_SUBSCRIPTION).setInput({subscriptionCode:subscriptionCode}).setRetries(0).dispatch();request.then(function(_ref5){var subscriptions=_ref5.subscriptions;dispatch({type:REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,subscriptions:subscriptions});})["catch"](function(error){dispatch({type:REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR,error:error});});return request;};};
@@ -0,0 +1 @@
1
+ import{connect}from'react-redux';import{addBackInStockSubscription}from'@shopgate/engage/back-in-stock/actions';import grantPushPermissions from'@shopgate/engage/core/actions/grantPushPermissions';var mapDispatchToProps={addBackInStockSubscription:addBackInStockSubscription,grantPushPermissions:grantPushPermissions};export default connect(null,mapDispatchToProps);
@@ -0,0 +1,13 @@
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React,{useCallback}from'react';import PropTypes from'prop-types';import{themeConfig}from'@shopgate/engage';import{Link,CheckedIcon,NotificationIcon}from'@shopgate/engage/components';import{BACK_IN_STOCK_PATTERN}from'@shopgate/engage/back-in-stock/constants';import{i18n}from'@shopgate/engage/core';import styles from"./style";import connect from"./connector";var colors=themeConfig.colors;/**
2
+ * This component renders a button to subscribe a product or a hint
3
+ * that the product is already subscribed
4
+ * @param {Object} props The component props
5
+ * @param {boolean} props.isLinkToBackInStockEnabled Whether the link to the back in
6
+ * stock page is active
7
+ * @param {boolean} props.stopPropagation Stop event propagation
8
+ * @param {string} props.productId The product id
9
+ * @param {Object} props.subscription The subscription
10
+ * @param {Function} props.addBackInStockSubscription Add product to back in stock list
11
+ * @param {Function} props.grantPushPermissions Request / Set push permission
12
+ * @return {JSX}
13
+ */var BackInStockButton=function BackInStockButton(_ref){var productId=_ref.productId,_ref$isLinkToBackInSt=_ref.isLinkToBackInStockEnabled,isLinkToBackInStockEnabled=_ref$isLinkToBackInSt===void 0?false:_ref$isLinkToBackInSt,subscription=_ref.subscription,_ref$stopPropagation=_ref.stopPropagation,stopPropagation=_ref$stopPropagation===void 0?false:_ref$stopPropagation,addBackInStockSubscription=_ref.addBackInStockSubscription,grantPushPermissions=_ref.grantPushPermissions;var handleClick=useCallback(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(event){var allowed;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(stopPropagation){event.stopPropagation();}_context.next=3;return grantPushPermissions({rationaleModal:{message:'permissions.back_in_stock_push_notifications.message',confirm:'permissions.back_in_stock_push_notifications.confirm',dismiss:'permissions.back_in_stock_push_notifications.dismiss'}});case 3:allowed=_context.sent;if(allowed){addBackInStockSubscription({productId:productId});}case 5:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}(),[addBackInStockSubscription,grantPushPermissions,productId,stopPropagation]);if((subscription===null||subscription===void 0?void 0:subscription.status)==='active'){return/*#__PURE__*/React.createElement(Link,{href:BACK_IN_STOCK_PATTERN,disabled:!isLinkToBackInStockEnabled,className:styles.backInStockMessageContainer,tag:"span"},/*#__PURE__*/React.createElement(CheckedIcon,{color:colors.success,className:styles.icon}),/*#__PURE__*/React.createElement("span",{className:styles.backInStockMessage},i18n.text('back_in_stock.we_will_remind_you')));}return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("a",{role:"button",onClick:handleClick,className:styles.button},/*#__PURE__*/React.createElement("div",{className:styles.buttonContent},/*#__PURE__*/React.createElement(NotificationIcon,{color:colors.primary}),/*#__PURE__*/React.createElement("span",{className:styles.buttonText},i18n.text('back_in_stock.get_notified')))));};BackInStockButton.defaultProps={stopPropagation:false,isLinkToBackInStockEnabled:false,subscription:null,productId:null};export default connect(BackInStockButton);
@@ -0,0 +1 @@
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/engage';export default{button:css({color:themeConfig.colors.primary}).toString(),buttonContent:css({display:'flex',alignItems:'center'}).toString(),backInStockMessageContainer:css({lineHeight:'20px',display:'flex',alignItems:'center',textAlign:'end',width:'auto'}).toString(),backInStockMessage:css({marginLeft:'4px',verticalAlign:'middle',fontSize:'0.875rem'}).toString(),buttonText:css({marginLeft:'4px',fontSize:'0.875rem',lineHeight:'16.5px'}).toString(),icon:css({verticalAlign:'middle',display:'inline'}).toString()};
@@ -0,0 +1,3 @@
1
+ import{connect}from'react-redux';import{getIsBackInStockEnabled,makeGetSubscriptionByCharacteristics}from'@shopgate/engage/back-in-stock/selectors';import{makeGetProductByCharacteristics}from'@shopgate/engage/product';/**
2
+ * @return {Object} The extended component props.
3
+ */var makeMapStateToProps=function makeMapStateToProps(){var getProductByCharacteristics=makeGetProductByCharacteristics({strict:true});var getSubscriptionByCharacteristics=makeGetSubscriptionByCharacteristics();return function(state,props){var variant=getProductByCharacteristics(state,props)||{};return{variant:variant,subscription:getSubscriptionByCharacteristics(state,props),isBackInStockEnabled:getIsBackInStockEnabled(state,props)};};};export default connect(makeMapStateToProps);
@@ -0,0 +1,8 @@
1
+ import React from'react';import PropTypes from'prop-types';import{BackInStockButton}from'@shopgate/engage/back-in-stock/components';import{withCurrentProduct}from'@shopgate/engage/core';import connect from"./connector";/**
2
+ * The CharacteristicsButton component.
3
+ * @param {Object} props The component props.
4
+ * @param {boolean} props.isBackInStockEnabled Whether the back in stock feature is enabled
5
+ * @param {Object} props.variant The variant for this entry
6
+ * @param {Object} props.subscription The subscription
7
+ * @return {JSX}
8
+ */var CharacteristicsButton=function CharacteristicsButton(_ref){var _variant$stock,_variant$stock2;var isBackInStockEnabled=_ref.isBackInStockEnabled,subscription=_ref.subscription,variant=_ref.variant;var productIsNotAVariant=!variant;var featureIsNotEnabled=!isBackInStockEnabled;var productIsNotAvailable=(variant===null||variant===void 0?void 0:(_variant$stock=variant.stock)===null||_variant$stock===void 0?void 0:_variant$stock.quantity)===0&&(variant===null||variant===void 0?void 0:(_variant$stock2=variant.stock)===null||_variant$stock2===void 0?void 0:_variant$stock2.ignoreQuantity)===false;if(productIsNotAVariant||featureIsNotEnabled||!productIsNotAvailable)return null;return/*#__PURE__*/React.createElement("div",{style:{display:'flex',justifyContent:'end'}},/*#__PURE__*/React.createElement(BackInStockButton,{subscription:subscription,stopPropagation:true,productId:variant.id}));};CharacteristicsButton.defaultProps={variant:{},subscription:null};export default withCurrentProduct(connect(CharacteristicsButton));
@@ -0,0 +1,3 @@
1
+ import{connect}from'react-redux';import{getIsBackInStockEnabled,makeGetSubscriptionByProduct}from'@shopgate/engage/back-in-stock/selectors';import{getProduct}from'@shopgate/engage/product';/**
2
+ * @return {Object} The extended component props.
3
+ */var makeMapStateToProps=function makeMapStateToProps(){var getSubscriptionByProduct=makeGetSubscriptionByProduct();return function(state,props){return{subscription:getSubscriptionByProduct(state,props),isBackInStockEnabled:getIsBackInStockEnabled(state,props),product:getProduct(state,props)};};};export default connect(makeMapStateToProps);
@@ -0,0 +1,10 @@
1
+ import React,{Fragment}from'react';import PropTypes from'prop-types';import{SurroundPortals}from'@shopgate/engage/components';import{PRODUCT_BACK_IN_STOCK}from'@shopgate/engage/back-in-stock/constants';import{BackInStockButton}from'@shopgate/engage/back-in-stock/components';import{withCurrentProduct}from'@shopgate/engage/core';import connect from"./connector";/**
2
+ * The ProductInfoBackInStockButton component.
3
+ * @param {Object} props The component props.
4
+ * @param {boolean} props.isBackInStockEnabled Whether the back in stock feature is enabled
5
+ * @param {string} props.productId The product id
6
+ * @param {string} props.variantId The variant id
7
+ * @param {Object} props.product The product
8
+ * @param {Object} props.subscription The subscription
9
+ * @return {JSX}
10
+ */var ProductInfoBackInStockButton=function ProductInfoBackInStockButton(_ref){var _product$stock,_product$stock2;var productId=_ref.productId,variantId=_ref.variantId,isBackInStockEnabled=_ref.isBackInStockEnabled,subscription=_ref.subscription,product=_ref.product;var productIsAVariant=(product===null||product===void 0?void 0:product.type)!=='parent'&&(product===null||product===void 0?void 0:product.type)!==null;var productIsNotAvailable=(product===null||product===void 0?void 0:(_product$stock=product.stock)===null||_product$stock===void 0?void 0:_product$stock.quantity)===0&&(product===null||product===void 0?void 0:(_product$stock2=product.stock)===null||_product$stock2===void 0?void 0:_product$stock2.ignoreQuantity)===false;var showBackInStockButton=productIsAVariant&&productIsNotAvailable&&isBackInStockEnabled;return/*#__PURE__*/React.createElement(Fragment,null,/*#__PURE__*/React.createElement(SurroundPortals,{portalName:PRODUCT_BACK_IN_STOCK,portalProps:{showBackInStockButton:showBackInStockButton}},showBackInStockButton&&/*#__PURE__*/React.createElement(BackInStockButton,{subscription:subscription,isLinkToBackInStockEnabled:true,productId:variantId!==null&&variantId!==void 0?variantId:productId})));};ProductInfoBackInStockButton.defaultProps={subscription:null,variantId:null,product:null};export default withCurrentProduct(connect(ProductInfoBackInStockButton));
@@ -0,0 +1,4 @@
1
+ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_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,{useCallback}from'react';import{css}from'glamor';import{LoadingIndicator,Accordion,Card}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{useBackInStockSubscriptions}from'@shopgate/engage/back-in-stock/hooks';import Subscription from"../Subscription";var styles={divider:css({height:1,width:'calc(100% + 32px)',backgroundColor:'rgb(234, 234, 234)',marginLeft:-16,marginRight:-16,marginBottom:16}).toString(),emptyText:css({marginBottom:16,textAlign:'center'}).toString(),listTitle:css({fontWeight:'700'}).toString()};/**
2
+ * The Back In Stock Subscriptions List.
3
+ * @returns {JSX}
4
+ */var List=function List(){var _useBackInStockSubscr=useBackInStockSubscriptions(),isInitial=_useBackInStockSubscr.isInitial,groupedSubscriptions=_useBackInStockSubscr.groupedSubscriptions;var _renderLabel=useCallback(function(groupKey){return/*#__PURE__*/React.createElement("div",{className:styles.listTitle},i18n.text("back_in_stock.list_states.".concat(groupKey)));},[]);return/*#__PURE__*/React.createElement("div",null,Object.entries(groupedSubscriptions).map(function(_ref){var _ref2=_slicedToArray(_ref,2),groupKey=_ref2[0],filteredSubscriptions=_ref2[1];return/*#__PURE__*/React.createElement(Card,{className:styles.root,key:groupKey},/*#__PURE__*/React.createElement(Accordion,{className:"",openWithChevron:true,renderLabel:function renderLabel(){return _renderLabel(groupKey);},chevronPosition:"left",startOpened:true},/*#__PURE__*/React.createElement("div",{className:styles.divider}),isInitial?/*#__PURE__*/React.createElement(LoadingIndicator,null):null,!isInitial&&filteredSubscriptions.length===0?/*#__PURE__*/React.createElement("div",{className:styles.emptyText},i18n.text('back_in_stock.empty_list_reminder')):null,!isInitial&&filteredSubscriptions.map(function(subscription,index){return/*#__PURE__*/React.createElement("div",{key:subscription.subscriptionCode},/*#__PURE__*/React.createElement(Subscription,{subscription:subscription,productId:subscription.productCode,key:subscription.subscriptionCode,group:groupKey}),index===filteredSubscriptions.length-1?null:/*#__PURE__*/React.createElement("div",{className:styles.divider}));})));}));};export default List;
@@ -0,0 +1,3 @@
1
+ import{connect}from'react-redux';import{addBackInStockSubscription}from'@shopgate/engage/back-in-stock/actions';import{makeGetSubscriptionByProduct}from'@shopgate/engage/back-in-stock/selectors';/**
2
+ * @return {Object} The extended component props.
3
+ */var makeMapStateToProps=function makeMapStateToProps(){var getSubscriptionByProduct=makeGetSubscriptionByProduct();return function(state,props){return{subscription:getSubscriptionByProduct(state,props)};};};var mapDispatchToProps={addBackInStockSubscription:addBackInStockSubscription};export default connect(makeMapStateToProps,mapDispatchToProps);
@@ -0,0 +1,7 @@
1
+ import React from'react';import{css}from'glamor';import{Link,Ripple,PriceInfo,CrossIcon,PriceStriked,Price,Availability}from'@shopgate/engage/components';import{getProductRoute,ProductImage}from'@shopgate/engage/product';import PropTypes from'prop-types';import classNames from'classnames';import{themeConfig}from'@shopgate/engage';import{BackInStockButton}from'@shopgate/engage/back-in-stock/components';import{getThemeSettings,i18n}from'@shopgate/engage/core';import{useBackInStockSubscriptions}from'@shopgate/engage/back-in-stock/hooks';var variables=themeConfig.variables;var styles={root:css({display:'flex',position:'relative',marginBottom:16}).toString(),imageContainer:css({flex:0.4,maxWidth:170,minWidth:70,paddingRight:'8px'}).toString(),infoContainer:css({flex:1}).toString(),infoContainerRow:css({display:'flex',justifyContent:'space-between'}).toString(),baseContainerRow:css({flexDirection:'column',display:'flex',marginTop:'8px'}).toString(),priceContainerRow:css({flexDirection:'column',display:'flex',alignItems:'end',marginTop:'8px'}).toString(),priceContainer:css({minWidth:100}).toString(),priceInfo:css({wordBreak:'break-word',fontSize:'0.875rem',lineHeight:'0.875rem',color:'var(--color-text-low-emphasis)',padding:"".concat(variables.gap.xsmall,"px 0"),textAlign:'right'}).toString(),titleContainer:css({}).toString(),title:css({fontSize:17,fontWeight:600,flexWrap:'wrap',overflowWrap:'anywhere'}).toString(),removeContainer:css({minWidth:'30px'}).toString(),availabilityText:css({fontSize:'0.875rem',marginBottom:'4px'}).toString(),ripple:css({minWidth:'17px'}).toString()};/**
2
+ * Renders on single Back in Stock subscription
3
+ * @param {Object} props Props.
4
+ * @param {string} props.subscription The subscription which should be rendered
5
+ * @returns {JSX}
6
+ */var Subscription=function Subscription(_ref){var _product$price,_product$price2,_product$price3,_product$price4,_product$availability,_product$availability2;var subscription=_ref.subscription;var subscriptionCode=subscription.subscriptionCode,product=subscription.product;var _useBackInStockSubscr=useBackInStockSubscriptions(),removeBackInStockSubscription=_useBackInStockSubscr.removeBackInStockSubscription;var _ref2=getThemeSettings('AppImages')||{},gridResolutions=_ref2.ListImage;var currency=((_product$price=product.price)===null||_product$price===void 0?void 0:_product$price.currency)||'EUR';var defaultPrice=((_product$price2=product.price)===null||_product$price2===void 0?void 0:_product$price2.unitPrice)||0;var specialPrice=(_product$price3=product.price)===null||_product$price3===void 0?void 0:_product$price3.unitPriceStriked;var hasStrikePrice=((_product$price4=product.price)===null||_product$price4===void 0?void 0:_product$price4.discount)>0;var productLink=getProductRoute(product.id);return/*#__PURE__*/React.createElement("div",{className:styles.root},/*#__PURE__*/React.createElement(Link,{className:styles.imageContainer,component:"div",href:productLink,"aria-hidden":true},/*#__PURE__*/React.createElement(ProductImage,{src:product.featuredImageBaseUrl,resolutions:gridResolutions})),/*#__PURE__*/React.createElement("div",{className:styles.infoContainer},/*#__PURE__*/React.createElement("div",{className:styles.infoContainerRow},/*#__PURE__*/React.createElement(Link,{href:productLink,tag:"span",className:styles.titleContainer},/*#__PURE__*/React.createElement("span",{className:styles.title// eslint-disable-next-line react/no-danger
7
+ ,dangerouslySetInnerHTML:{__html:"".concat(product.name)}})),/*#__PURE__*/React.createElement("div",{className:styles.removeContainer},/*#__PURE__*/React.createElement("button",{onClick:function onClick(){return removeBackInStockSubscription({subscriptionCode:subscriptionCode});},type:"button","aria-label":i18n.text('favorites.remove')},/*#__PURE__*/React.createElement(Ripple,{className:styles.ripple},/*#__PURE__*/React.createElement(CrossIcon,null))))),/*#__PURE__*/React.createElement("div",{className:classNames(styles.baseContainerRow)},/*#__PURE__*/React.createElement(Availability,{text:product===null||product===void 0?void 0:(_product$availability=product.availability)===null||_product$availability===void 0?void 0:_product$availability.text,state:product===null||product===void 0?void 0:(_product$availability2=product.availability)===null||_product$availability2===void 0?void 0:_product$availability2.state,showWhenAvailable:false,className:styles.availabilityText}),/*#__PURE__*/React.createElement(BackInStockButton,{subscription:subscription,onClick:function onClick(){}})),/*#__PURE__*/React.createElement("div",{className:styles.priceContainerRow},hasStrikePrice?/*#__PURE__*/React.createElement(PriceStriked,{value:specialPrice,currency:currency}):null,/*#__PURE__*/React.createElement(Price,{currency:currency,discounted:hasStrikePrice,unitPrice:defaultPrice}),!!product.price.info&&/*#__PURE__*/React.createElement(PriceInfo,{text:product.price.info,className:styles.priceInfo}))));};export default Subscription;
@@ -0,0 +1,4 @@
1
+ import React from'react';import{BackInStockSubscriptionsProvider}from'@shopgate/engage/back-in-stock/providers';import List from"./components/List";/**
2
+ * The Back in Stock Subscriptions component.
3
+ * @returns {JSX}
4
+ */var Subscriptions=function Subscriptions(){return/*#__PURE__*/React.createElement(BackInStockSubscriptionsProvider,null,/*#__PURE__*/React.createElement(List,null));};export default Subscriptions;
@@ -0,0 +1 @@
1
+ export{default as BackInStockButton}from"./BackInStockButton";export{default as BackInStockReminders}from"./Subscriptions";export{default as ProductInfoBackInStockButton}from"./ProductInfoBackInStockButton";export{default as CharacteristicsButton}from"./CharacteristicsButton";
@@ -0,0 +1 @@
1
+ export var FETCH_BACK_IN_STOCK_SUBSCRIPTIONS='FETCH_BACK_IN_STOCK_SUBSCRIPTIONS';export var FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS='FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS';export var FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR='FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR';export var ADD_BACK_IN_STOCK_SUBSCRIPTION='ADD_BACK_IN_STOCK_SUBSCRIPTION';export var ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS='ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS';export var ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR='ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR';export var REMOVE_BACK_IN_STOCK_SUBSCRIPTION='REMOVE_BACK_IN_STOCK_SUBSCRIPTION';export var REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS='REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS';export var REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR='REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR';
@@ -0,0 +1 @@
1
+ export var BACK_IN_STOCK_PATTERN='/back-in-stock';
@@ -0,0 +1 @@
1
+ export var SHOPGATE_USER_GET_BACK_IN_STOCK_SUBSCRIPTIONS='shopgate.user.getBackInStockSubscriptions';export var SHOPGATE_USER_ADD_BACK_IN_STOCK_SUBSCRIPTION='shopgate.user.addBackInStockSubscription';export var SHOPGATE_USER_DELETE_BACK_IN_STOCK_SUBSCRIPTION='shopgate.user.removeBackInStockSubscription';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2017-present, Shopgate, Inc. All rights reserved.
3
+ *
4
+ * This source code is licensed under the Apache 2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */ // FEATURES
7
+ var NAV_MENU='nav-menu';var PRODUCT='product';// CONTENTS
8
+ var BACK_IN_STOCK='back-in-stock';// POSITIONS
9
+ var BEFORE='before';var AFTER='after';export var NAV_MENU_BACK_IN_STOCK_BEFORE="".concat(NAV_MENU,".").concat(BACK_IN_STOCK,".").concat(BEFORE);export var NAV_MENU_BACK_IN_STOCK="".concat(NAV_MENU,".").concat(BACK_IN_STOCK);export var NAV_MENU_BACK_IN_STOCK_AFTER="".concat(NAV_MENU,".").concat(BACK_IN_STOCK,".").concat(AFTER);export var PRODUCT_BACK_IN_STOCK_BEFORE="".concat(PRODUCT,".").concat(BACK_IN_STOCK,".").concat(BEFORE);export var PRODUCT_BACK_IN_STOCK="".concat(PRODUCT,".").concat(BACK_IN_STOCK);export var PRODUCT_BACK_IN_STOCK_AFTER="".concat(PRODUCT,".").concat(BACK_IN_STOCK,".").concat(AFTER);
@@ -0,0 +1 @@
1
+ export*from"./Actions";export*from"./Common";export*from"./Pipelines";export*from"./Portals";
@@ -0,0 +1,4 @@
1
+ import React from'react';import{BackInStockSubscriptionsProviderContext}from'@shopgate/engage/back-in-stock/providers';/**
2
+ * Gives access to the values which the context BackInStockSubscriptionsProvider provide
3
+ * @returns {JSX}
4
+ */export var useBackInStockSubscriptions=function useBackInStockSubscriptions(){return React.useContext(BackInStockSubscriptionsProviderContext);};
@@ -0,0 +1,7 @@
1
+ import{connect}from'react-redux';import{getBackInStockSubscriptions,getBackInStockSubscriptionsFetching,getBackInStockSubscriptionsInitial}from'@shopgate/engage/back-in-stock/selectors';import{addBackInStockSubscription,removeBackInStockSubscription}from'@shopgate/engage/back-in-stock/actions';/**
2
+ * @return {Function} The extended component props.
3
+ */function makeMapStateToProps(){/**
4
+ * @param {Object} state The application state.
5
+ * @param {Object} props The component props
6
+ * @returns {Object}
7
+ */return function(state,props){return{subscriptions:getBackInStockSubscriptions(state,props),isFetching:getBackInStockSubscriptionsFetching(state,props),isInitial:getBackInStockSubscriptionsInitial(state,props)};};}var mapDispatchToProps={addBackInStockSubscription:addBackInStockSubscription,removeBackInStockSubscription:removeBackInStockSubscription};export default connect(makeMapStateToProps,mapDispatchToProps);
@@ -0,0 +1 @@
1
+ import React from'react';var initialContext={};export default/*#__PURE__*/React.createContext(initialContext);
@@ -0,0 +1,5 @@
1
+ import React,{useMemo}from'react';import PropTypes from'prop-types';import Context from"./BackInStockSubscriptionsProvider.context";import connect from"./BackInStockSubscriptionsProvider.connector";/**
2
+ * Back in Stock Provider
3
+ * @returns {JSX}
4
+ */var BackInStockSubscriptionsProvider=function BackInStockSubscriptionsProvider(_ref){var subscriptions=_ref.subscriptions,children=_ref.children,addBackInStockSubscription=_ref.addBackInStockSubscription,isFetching=_ref.isFetching,isInitial=_ref.isInitial,removeBackInStockSubscription=_ref.removeBackInStockSubscription;var groupedSubscriptions=useMemo(function(){return subscriptions.reduce(function(acc,subscription){var status=subscription.status;var groupingStatus=status==='inactive'||status==='triggered'?'past':status;acc[groupingStatus].push(subscription);return acc;},{active:[],past:[]});},[subscriptions]);// Create memoized context value.
5
+ var value=useMemo(function(){return{subscriptions:subscriptions,groupedSubscriptions:groupedSubscriptions,addBackInStockSubscription:addBackInStockSubscription,removeBackInStockSubscription:removeBackInStockSubscription,isFetching:isFetching,isInitial:isInitial};},[addBackInStockSubscription,groupedSubscriptions,isFetching,isInitial,removeBackInStockSubscription,subscriptions]);return/*#__PURE__*/React.createElement(Context.Provider,{value:value},children);};BackInStockSubscriptionsProvider.defaultProps={children:null,isFetching:false,isInitial:true};export default connect(BackInStockSubscriptionsProvider);
@@ -0,0 +1 @@
1
+ export{default as BackInStockSubscriptionsProviderContext}from"./BackInStockSubscriptionsProvider.context";export{default as BackInStockSubscriptionsProvider}from"./BackInStockSubscriptionsProvider";
@@ -0,0 +1,5 @@
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{ADD_BACK_IN_STOCK_SUBSCRIPTION,ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR,ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS,REMOVE_BACK_IN_STOCK_SUBSCRIPTION,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS}from'@shopgate/engage/back-in-stock/constants';var initialState={isFetching:false,isInitial:true,subscriptions:[]};/**
2
+ * @param {Object} state The application state.
3
+ * @param {Object} action The redux action.
4
+ * @returns {Object}
5
+ */export default(function(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:initialState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case FETCH_BACK_IN_STOCK_SUBSCRIPTIONS:{return _extends({},state,{isFetching:true});}case FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS:{return _extends({},state,{isInitial:false,isFetching:false,subscriptions:action.subscriptions});}case FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR:{return _extends({},state,{isFetching:false});}case ADD_BACK_IN_STOCK_SUBSCRIPTION:{return _extends({},state,{isFetching:true});}case ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS:{return _extends({},state,{isFetching:false});}case ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR:{return _extends({},state,{isFetching:false});}case REMOVE_BACK_IN_STOCK_SUBSCRIPTION:{return _extends({},state,{isFetching:true});}case REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS:{return _extends({},state,{isFetching:false});}case REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR:{return _extends({},state,{isFetching:false});}default:return state;}});
@@ -0,0 +1,24 @@
1
+ import{createSelector}from'reselect';import{makeGetProductByCharacteristics}from'@shopgate/engage/product';import{appConfig}from'@shopgate/engage';/**
2
+ * @param {Object} state The application state.
3
+ * @returns {Object}
4
+ */export var getBackInStockSubscriptions=function getBackInStockSubscriptions(state){return state.backInStock.subscriptions;};/**
5
+ * @param {Object} state The application state.
6
+ * @returns {Object}
7
+ */export var getBackInStockSubscriptionsFetching=function getBackInStockSubscriptionsFetching(state){return state.backInStock.isFetching;};/**
8
+ * @param {Object} state The application state.
9
+ * @returns {Object}
10
+ */export var getBackInStockSubscriptionsInitial=function getBackInStockSubscriptionsInitial(state){return state.backInStock.isInitial;};/**
11
+ * Creates a selector that retrieves the subscription of
12
+ * a product / variant or null by its variantId / productId
13
+ * @returns {Function}
14
+ */export var makeGetSubscriptionByProduct=function makeGetSubscriptionByProduct(){return createSelector(function(state){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return props.variantId?props.variantId:props.productId;},getBackInStockSubscriptions,function(requestedProductCode,subscriptions){if(!requestedProductCode){return false;}return subscriptions.find(function(_ref){var productCode=_ref.productCode;return productCode===requestedProductCode;})||null;});};/**
15
+ * Creates a selector that retrieves the subscription of
16
+ * a product / variant by its characteristics
17
+ * @returns {Function}
18
+ */export var makeGetSubscriptionByCharacteristics=function makeGetSubscriptionByCharacteristics(){var getProductByCharacteristics=makeGetProductByCharacteristics();return createSelector(getProductByCharacteristics,getBackInStockSubscriptions,function(product,subscriptions){if(!product){return null;}return subscriptions.find(function(_ref2){var productCode=_ref2.productCode;return productCode===product.id;})||null;});};/**
19
+ * Returns if the back in stock feature is enabled
20
+ * @returns {Function}
21
+ */export var getIsBackInStockEnabled=function getIsBackInStockEnabled(){return(appConfig===null||appConfig===void 0?void 0:appConfig.showBackInStock)||false;};/**
22
+ * Returns if subscription list is in use
23
+ * @returns {Function}
24
+ */export var getHasBackInStockSubscriptions=createSelector(getBackInStockSubscriptions,function(subscriptions){return!!subscriptions.length;});
@@ -0,0 +1 @@
1
+ import{appDidStart$,main$,routeDidEnter$}from'@shopgate/engage/core';import{productWillEnter$}from'@shopgate/engage/product';import{ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,BACK_IN_STOCK_PATTERN}from'@shopgate/engage/back-in-stock/constants';export var backInStockRemindersDidEnter$=routeDidEnter$.filter(function(_ref){var action=_ref.action;return action.route.pattern===BACK_IN_STOCK_PATTERN;});export var addBackInStockReminderSuccess$=main$.filter(function(_ref2){var action=_ref2.action;return action.type===ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS;});export var removeBackInStockReminderSuccess$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS;});export var backInStockReminderNeedsFetch$=addBackInStockReminderSuccess$.merge(appDidStart$,removeBackInStockReminderSuccess$,backInStockRemindersDidEnter$,productWillEnter$);
@@ -0,0 +1,3 @@
1
+ import showModal from'@shopgate/pwa-common/actions/modal/showModal';import{fetchBackInStockSubscriptions}from'@shopgate/engage/back-in-stock/actions';import{addBackInStockReminderSuccess$,backInStockReminderNeedsFetch$}from'@shopgate/engage/back-in-stock/streams';/**
2
+ * @param {Function} subscribe The subscribe function.
3
+ */export default function backInStock(subscribe){subscribe(backInStockReminderNeedsFetch$,function(_ref){var dispatch=_ref.dispatch;dispatch(fetchBackInStockSubscriptions());});subscribe(addBackInStockReminderSuccess$,function(_ref2){var dispatch=_ref2.dispatch;dispatch(showModal({title:'back_in_stock.add_back_in_stock_success_modal.title',message:'back_in_stock.add_back_in_stock_success_modal.message',confirm:'modal.confirm',dismiss:null}));});}
@@ -8,5 +8,5 @@ export{default as Accordion}from'@shopgate/pwa-ui-material/Accordion';export{def
8
8
  export{default as AccordionContainer}from'@shopgate/pwa-ui-shared/AccordionContainer';export{default as ActionButton}from'@shopgate/pwa-ui-shared/ActionButton';export{default as AddToCartButton}from'@shopgate/pwa-ui-shared/AddToCartButton';export{default as Availability}from'@shopgate/pwa-ui-shared/Availability';export{default as Button}from'@shopgate/pwa-ui-shared/Button';export{default as ButtonLink}from'@shopgate/pwa-ui-shared/ButtonLink';export{default as Card}from'@shopgate/pwa-ui-shared/Card';export{default as CardList}from'@shopgate/pwa-ui-shared/CardList';export{default as CartTotalLine}from'@shopgate/pwa-ui-shared/CartTotalLine';export{default as Chip}from'@shopgate/pwa-ui-shared/Chip';export{default as ClientInformation}from'@shopgate/pwa-ui-shared/ClientInformation';export{default as ContextMenu}from'@shopgate/pwa-ui-shared/ContextMenu';export{default as Dialog}from'@shopgate/pwa-ui-shared/Dialog';export{default as DiscountBadge}from'@shopgate/pwa-ui-shared/DiscountBadge';export{default as FavoritesButton}from'@shopgate/pwa-ui-shared/FavoritesButton';export{default as Checkbox}from'@shopgate/pwa-ui-shared/Form/Checkbox';export{default as Password}from'@shopgate/pwa-ui-shared/Form/Password';export{default as RadioGroup}from'@shopgate/pwa-ui-shared/Form/RadioGroup';export{default as Select}from'@shopgate/pwa-ui-shared/Form/Select';export{default as TextField}from'@shopgate/pwa-ui-shared/Form/TextField';export{default as FormElement}from'@shopgate/pwa-ui-shared/FormElement';export{default as Glow}from'@shopgate/pwa-ui-shared/Glow';export{default as IndicatorCircle}from'@shopgate/pwa-ui-shared/IndicatorCircle';export{default as LoadingIndicator}from'@shopgate/pwa-ui-shared/LoadingIndicator';export{default as Manufacturer}from'@shopgate/pwa-ui-shared/Manufacturer';export{default as MessageBar}from"./MessageBar";export{default as NoResults}from'@shopgate/pwa-ui-shared/NoResults';export{default as Placeholder}from'@shopgate/pwa-ui-shared/Placeholder';export{default as PlaceholderLabel}from'@shopgate/pwa-ui-shared/PlaceholderLabel';export{default as PlaceholderParagraph}from'@shopgate/pwa-ui-shared/PlaceholderParagraph';export{default as Price}from'@shopgate/pwa-ui-shared/Price';export{default as PriceInfo}from'@shopgate/pwa-ui-shared/PriceInfo';export{default as PriceStriked}from'@shopgate/pwa-ui-shared/PriceStriked';export{default as ProductProperties}from'@shopgate/pwa-ui-shared/ProductProperties';export{default as ProgressBar}from'@shopgate/pwa-ui-shared/ProgressBar';export{default as RadioButton}from'@shopgate/pwa-ui-shared/RadioButton';export{default as RatingNumber}from'@shopgate/pwa-ui-shared/RatingNumber';export{default as RatingStars}from'@shopgate/pwa-ui-shared/RatingStars';export{default as Ripple}from'@shopgate/pwa-ui-shared/Ripple';export{default as RippleButton}from'@shopgate/pwa-ui-shared/RippleButton';export{default as ScannerOverlay}from'@shopgate/pwa-ui-shared/ScannerOverlay';export{default as Sheet,SHEET_EVENTS}from'@shopgate/pwa-ui-shared/Sheet';export{default as TaxDisclaimer}from'@shopgate/pwa-ui-shared/TaxDisclaimer';export{default as ToggleIcon}from'@shopgate/pwa-ui-shared/ToggleIcon';// ICONS IOS
9
9
  export{default as CartIconIOS}from'@shopgate/pwa-ui-ios/icons/CartIcon';export{default as FilterIconIOS}from'@shopgate/pwa-ui-ios/icons/FilterIcon';export{default as HomeIconIOS}from'@shopgate/pwa-ui-ios/icons/HomeIcon';export{default as ShareIconIOS}from'@shopgate/pwa-ui-ios/icons/ShareIcon';// ICONS ANDROID
10
10
  export{default as ShareIconAndroid}from'@shopgate/pwa-ui-material/icons/ShareIcon';// ICONS SHARED
11
- export{default as AccountBoxIcon}from'@shopgate/pwa-ui-shared/icons/AccountBoxIcon';export{default as AddMoreIcon}from'@shopgate/pwa-ui-shared/icons/AddMoreIcon';export{default as ArrowDropIcon}from'@shopgate/pwa-ui-shared/icons/ArrowDropIcon';export{default as ArrowIcon}from'@shopgate/pwa-ui-shared/icons/ArrowIcon';export{default as BarcodeScannerIcon}from'@shopgate/pwa-ui-shared/icons/BarcodeScannerIcon';export{default as BoxIcon}from'@shopgate/pwa-ui-shared/icons/BoxIcon';export{default as BrowseIcon}from'@shopgate/pwa-ui-shared/icons/BrowseIcon';export{default as BurgerIcon}from'@shopgate/pwa-ui-shared/icons/BurgerIcon';export{default as CartIcon}from'@shopgate/pwa-ui-shared/icons/CartIcon';export{default as CartPlusIcon}from'@shopgate/pwa-ui-shared/icons/CartPlusIcon';export{default as CartCouponIcon}from'@shopgate/pwa-ui-shared/icons/CartCouponIcon';export{default as CheckedIcon}from'@shopgate/pwa-ui-shared/icons/CheckedIcon';export{default as CheckIcon}from'@shopgate/pwa-ui-shared/icons/CheckIcon';export{default as ChevronIcon}from'@shopgate/pwa-ui-shared/icons/ChevronIcon';export{default as CreditCardIcon}from'@shopgate/pwa-ui-shared/icons/CreditCardIcon';export{default as CrossIcon}from'@shopgate/pwa-ui-shared/icons/CrossIcon';export{default as DescriptionIcon}from'@shopgate/pwa-ui-shared/icons/DescriptionIcon';export{default as FilterIcon}from'@shopgate/pwa-ui-shared/icons/FilterIcon';export{default as FlashEnabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashEnabledIcon';export{default as FlashDisabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashDisabledIcon';export{default as GridIcon}from'@shopgate/pwa-ui-shared/icons/GridIcon';export{default as HeartIcon}from'@shopgate/pwa-ui-shared/icons/HeartIcon';export{default as HeartOutlineIcon}from'@shopgate/pwa-ui-shared/icons/HeartOutlineIcon';export{default as HomeIcon}from'@shopgate/pwa-ui-shared/icons/HomeIcon';export{default as InfoIcon}from'@shopgate/pwa-ui-shared/icons/InfoIcon';export{default as InfoOutlineIcon}from'@shopgate/pwa-ui-shared/icons/InfoOutlineIcon';export{default as ListIcon}from'@shopgate/pwa-ui-shared/icons/ListIcon';export{default as LocalShippingIcon}from'@shopgate/pwa-ui-shared/icons/LocalShippingIcon';export{default as LockIcon}from'@shopgate/pwa-ui-shared/icons/LockIcon';export{default as LogoutIcon}from'@shopgate/pwa-ui-shared/icons/LogoutIcon';export{default as MagnifierIcon}from'@shopgate/pwa-ui-shared/icons/MagnifierIcon';export{default as MoreIcon}from'@shopgate/pwa-ui-shared/icons/MoreIcon';export{default as MoreVertIcon}from'@shopgate/pwa-ui-shared/icons/MoreVertIcon';export{default as PlaceholderIcon}from'@shopgate/pwa-ui-shared/icons/PlaceholderIcon';export{default as RadioCheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';export{default as RadioUncheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';export{default as SecurityIcon}from'@shopgate/pwa-ui-shared/icons/SecurityIcon';export{default as ShoppingCartIcon}from'@shopgate/pwa-ui-shared/icons/ShoppingCartIcon';export{default as SortIcon}from'@shopgate/pwa-ui-shared/icons/SortIcon';export{default as StarHalfIcon}from'@shopgate/pwa-ui-shared/icons/StarHalfIcon';export{default as StarIcon}from'@shopgate/pwa-ui-shared/icons/StarIcon';export{default as StarOutlineIcon}from'@shopgate/pwa-ui-shared/icons/StarOutlineIcon';export{default as TickIcon}from'@shopgate/pwa-ui-shared/icons/TickIcon';export{default as TrashIcon}from'@shopgate/pwa-ui-shared/icons/TrashIcon';export{default as UncheckedIcon}from'@shopgate/pwa-ui-shared/icons/UncheckedIcon';export{default as ViewListIcon}from'@shopgate/pwa-ui-shared/icons/ViewListIcon';export{default as VisibilityIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityIcon';export{default as VisibilityOffIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityOffIcon';// LOCAL
11
+ export{default as AccountBoxIcon}from'@shopgate/pwa-ui-shared/icons/AccountBoxIcon';export{default as AddMoreIcon}from'@shopgate/pwa-ui-shared/icons/AddMoreIcon';export{default as ArrowDropIcon}from'@shopgate/pwa-ui-shared/icons/ArrowDropIcon';export{default as ArrowIcon}from'@shopgate/pwa-ui-shared/icons/ArrowIcon';export{default as BarcodeScannerIcon}from'@shopgate/pwa-ui-shared/icons/BarcodeScannerIcon';export{default as BoxIcon}from'@shopgate/pwa-ui-shared/icons/BoxIcon';export{default as BrowseIcon}from'@shopgate/pwa-ui-shared/icons/BrowseIcon';export{default as BurgerIcon}from'@shopgate/pwa-ui-shared/icons/BurgerIcon';export{default as CartIcon}from'@shopgate/pwa-ui-shared/icons/CartIcon';export{default as CartPlusIcon}from'@shopgate/pwa-ui-shared/icons/CartPlusIcon';export{default as CartCouponIcon}from'@shopgate/pwa-ui-shared/icons/CartCouponIcon';export{default as CheckedIcon}from'@shopgate/pwa-ui-shared/icons/CheckedIcon';export{default as CheckIcon}from'@shopgate/pwa-ui-shared/icons/CheckIcon';export{default as ChevronIcon}from'@shopgate/pwa-ui-shared/icons/ChevronIcon';export{default as CreditCardIcon}from'@shopgate/pwa-ui-shared/icons/CreditCardIcon';export{default as CrossIcon}from'@shopgate/pwa-ui-shared/icons/CrossIcon';export{default as DescriptionIcon}from'@shopgate/pwa-ui-shared/icons/DescriptionIcon';export{default as FilterIcon}from'@shopgate/pwa-ui-shared/icons/FilterIcon';export{default as FlashEnabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashEnabledIcon';export{default as FlashDisabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashDisabledIcon';export{default as GridIcon}from'@shopgate/pwa-ui-shared/icons/GridIcon';export{default as HeartIcon}from'@shopgate/pwa-ui-shared/icons/HeartIcon';export{default as HeartOutlineIcon}from'@shopgate/pwa-ui-shared/icons/HeartOutlineIcon';export{default as HomeIcon}from'@shopgate/pwa-ui-shared/icons/HomeIcon';export{default as InfoIcon}from'@shopgate/pwa-ui-shared/icons/InfoIcon';export{default as InfoOutlineIcon}from'@shopgate/pwa-ui-shared/icons/InfoOutlineIcon';export{default as ListIcon}from'@shopgate/pwa-ui-shared/icons/ListIcon';export{default as LocalShippingIcon}from'@shopgate/pwa-ui-shared/icons/LocalShippingIcon';export{default as LockIcon}from'@shopgate/pwa-ui-shared/icons/LockIcon';export{default as LogoutIcon}from'@shopgate/pwa-ui-shared/icons/LogoutIcon';export{default as MagnifierIcon}from'@shopgate/pwa-ui-shared/icons/MagnifierIcon';export{default as MoreIcon}from'@shopgate/pwa-ui-shared/icons/MoreIcon';export{default as MoreVertIcon}from'@shopgate/pwa-ui-shared/icons/MoreVertIcon';export{default as PlaceholderIcon}from'@shopgate/pwa-ui-shared/icons/PlaceholderIcon';export{default as RadioCheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';export{default as RadioUncheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';export{default as SecurityIcon}from'@shopgate/pwa-ui-shared/icons/SecurityIcon';export{default as ShoppingCartIcon}from'@shopgate/pwa-ui-shared/icons/ShoppingCartIcon';export{default as SortIcon}from'@shopgate/pwa-ui-shared/icons/SortIcon';export{default as StarHalfIcon}from'@shopgate/pwa-ui-shared/icons/StarHalfIcon';export{default as StarIcon}from'@shopgate/pwa-ui-shared/icons/StarIcon';export{default as StarOutlineIcon}from'@shopgate/pwa-ui-shared/icons/StarOutlineIcon';export{default as TickIcon}from'@shopgate/pwa-ui-shared/icons/TickIcon';export{default as TrashIcon}from'@shopgate/pwa-ui-shared/icons/TrashIcon';export{default as UncheckedIcon}from'@shopgate/pwa-ui-shared/icons/UncheckedIcon';export{default as ViewListIcon}from'@shopgate/pwa-ui-shared/icons/ViewListIcon';export{default as VisibilityIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityIcon';export{default as VisibilityOffIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityOffIcon';export{default as NotificationIcon}from'@shopgate/pwa-ui-shared/icons/NotificationIcon';// LOCAL
12
12
  export{default as NavigationHandler}from"./NavigationHandler";export{default as TimeBoundary}from"./TimeBoundary";export{default as IntersectionVisibility}from"./IntersectionVisibility";export{default as VideoPlayer}from"./VideoPlayer";export{default as SheetDrawer}from"./SheetDrawer";export{default as SheetList}from"./SheetList";export{default as NullComponent}from"./NullComponent";export{default as View,ViewContext}from"./View";export{Form}from"./Form";export{FormBuilder}from"./Form";export{Footer}from"./Footer";export{default as ScrollHeader}from"./ScrollHeader";export{default as ChipLayout}from"./ChipLayout";export{default as Logo}from"./Logo";export{default as SnackBarContainer}from"./SnackBarContainer";export{default as PickerUtilize}from"./PickerUtilize";export{default as QuantityInput}from"./QuantityInput";export{default as ConditionalWrapper}from"./ConditionalWrapper";
@@ -1,4 +1,4 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_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;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import event from'@shopgate/pwa-core/classes/Event';import{APP_EVENT_APPLICATION_WILL_ENTER_FOREGROUND}from'@shopgate/pwa-core/constants/AppEvents';import openAppSettings from'@shopgate/pwa-core/commands/openAppSettings';import showModal from'@shopgate/pwa-common/actions/modal/showModal';import{STATUS_DENIED,STATUS_GRANTED,STATUS_NOT_DETERMINED,STATUS_NOT_SUPPORTED,availablePermissionsIds}from'@shopgate/pwa-core/constants/AppPermissions';import{getAppPermissions,requestAppPermissions}from'@shopgate/pwa-core/commands/appPermissions';import{logger}from'@shopgate/pwa-core/helpers';/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_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;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import event from'@shopgate/pwa-core/classes/Event';import{APP_EVENT_APPLICATION_WILL_ENTER_FOREGROUND}from'@shopgate/pwa-core/constants/AppEvents';import openAppSettings from'@shopgate/pwa-core/commands/openAppSettings';import{showModal}from'@shopgate/engage/core';import{STATUS_DENIED,STATUS_GRANTED,STATUS_NOT_DETERMINED,STATUS_NOT_SUPPORTED,availablePermissionsIds}from'@shopgate/pwa-core/constants/AppPermissions';import{getAppPermissions,requestAppPermissions}from'@shopgate/pwa-core/commands/appPermissions';import{logger}from'@shopgate/pwa-core/helpers';/**
2
2
  * Determines the current state of a specific permission for an app feature. If not already
3
3
  * happened, the user will be prompted to grant permissions.
4
4
  * The action returns a promise which resolves with a boolean value, that indicates the state.
@@ -6,6 +6,13 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _slicedToAr
6
6
  * @param {string} options.permissionId The id of the permission to request.
7
7
  * @param {boolean} [options.useSettingsModal=false] Whether in case of declined permissions a modal
8
8
  * shall be presented, which redirects to the app settings.
9
+ * @param {boolean} [options.useRationaleModal=false] Whether a rational modal should be shown
10
+ * @param {Object} [options.rationaleModal={}] Options for the rationale modal.
11
+ * @param {string} options.rationaleModal.title Modal title.
12
+ * @param {string} options.rationaleModal.message Modal message.
13
+ * @param {string} options.rationaleModal.confirm Label for the confirm button.
14
+ * @param {string} options.rationaleModal.dismiss Label for the dismiss button.
15
+ * @param {Object} options.rationaleModal.params Additional parameters for i18n strings.
9
16
  * @param {Object} [options.modal={}] Options for the settings modal.
10
17
  * @param {string} options.modal.title Modal title.
11
18
  * @param {string} options.modal.message Modal message.
@@ -13,10 +20,10 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _slicedToAr
13
20
  * @param {string} options.modal.dismiss Label for the dismiss button.
14
21
  * @param {Object} options.modal.params Additional parameters for i18n strings.
15
22
  * @return { Function } A redux thunk.
16
- */var grantPermissions=function grantPermissions(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(dispatch){return new Promise(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve){var permissionId,_options$useSettingsM,useSettingsModal,_options$modal,modalOptions,status,_yield$getAppPermissi,_yield$getAppPermissi2,_yield$requestAppPerm,_yield$requestAppPerm2,openSettings,handler;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:permissionId=options.permissionId,_options$useSettingsM=options.useSettingsModal,useSettingsModal=_options$useSettingsM===void 0?false:_options$useSettingsM,_options$modal=options.modal,modalOptions=_options$modal===void 0?{}:_options$modal;if(availablePermissionsIds.includes(permissionId)){_context2.next=5;break;}logger.error('grandPermissions: %s is no valid permission id',permissionId);resolve(false);return _context2.abrupt("return");case 5:_context2.next=7;return getAppPermissions([permissionId]);case 7:_yield$getAppPermissi=_context2.sent;_yield$getAppPermissi2=_slicedToArray(_yield$getAppPermissi,1);status=_yield$getAppPermissi2[0].status;if(!(status===STATUS_NOT_SUPPORTED)){_context2.next=13;break;}resolve(false);return _context2.abrupt("return");case 13:if(!(status===STATUS_NOT_DETERMINED)){_context2.next=22;break;}_context2.next=16;return requestAppPermissions([{permissionId:permissionId}]);case 16:_yield$requestAppPerm=_context2.sent;_yield$requestAppPerm2=_slicedToArray(_yield$requestAppPerm,1);status=_yield$requestAppPerm2[0].status;if(![STATUS_DENIED,STATUS_NOT_DETERMINED].includes(status)){_context2.next=22;break;}resolve(false);return _context2.abrupt("return");case 22:if(!(status===STATUS_GRANTED)){_context2.next=25;break;}resolve(true);return _context2.abrupt("return");case 25:if(!(status===STATUS_DENIED)){_context2.next=38;break;}if(useSettingsModal){_context2.next=29;break;}resolve(false);return _context2.abrupt("return");case 29:_context2.next=31;return dispatch(showModal({title:modalOptions.title||null,message:modalOptions.message,confirm:modalOptions.confirm,dismiss:modalOptions.dismiss,params:modalOptions.params}));case 31:openSettings=_context2.sent;if(openSettings){_context2.next=35;break;}resolve(false);return _context2.abrupt("return");case 35:/**
23
+ */var grantPermissions=function grantPermissions(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(dispatch){return new Promise(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve){var permissionId,_options$useSettingsM,useSettingsModal,_options$useRationale,useRationaleModal,_options$rationaleMod,rationaleModalOptions,_options$modal,modalOptions,status,_yield$getAppPermissi,_yield$getAppPermissi2,requestAllowed,_yield$requestAppPerm,_yield$requestAppPerm2,openSettings,handler;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:permissionId=options.permissionId,_options$useSettingsM=options.useSettingsModal,useSettingsModal=_options$useSettingsM===void 0?false:_options$useSettingsM,_options$useRationale=options.useRationaleModal,useRationaleModal=_options$useRationale===void 0?false:_options$useRationale,_options$rationaleMod=options.rationaleModal,rationaleModalOptions=_options$rationaleMod===void 0?{}:_options$rationaleMod,_options$modal=options.modal,modalOptions=_options$modal===void 0?{}:_options$modal;if(availablePermissionsIds.includes(permissionId)){_context2.next=5;break;}logger.error('grandPermissions: %s is no valid permission id',permissionId);resolve(false);return _context2.abrupt("return");case 5:_context2.next=7;return getAppPermissions([permissionId]);case 7:_yield$getAppPermissi=_context2.sent;_yield$getAppPermissi2=_slicedToArray(_yield$getAppPermissi,1);status=_yield$getAppPermissi2[0].status;if(!(status===STATUS_NOT_SUPPORTED)){_context2.next=13;break;}resolve(false);return _context2.abrupt("return");case 13:if(!(status===STATUS_NOT_DETERMINED)){_context2.next=29;break;}if(!useRationaleModal){_context2.next=21;break;}_context2.next=17;return dispatch(showModal({message:rationaleModalOptions.message||'',confirm:rationaleModalOptions.confirm||'',dismiss:rationaleModalOptions.dismiss||'',params:rationaleModalOptions.params||''}));case 17:requestAllowed=_context2.sent;if(!(requestAllowed===false)){_context2.next=21;break;}resolve(false);return _context2.abrupt("return");case 21:_context2.next=23;return requestAppPermissions([{permissionId:permissionId}]);case 23:_yield$requestAppPerm=_context2.sent;_yield$requestAppPerm2=_slicedToArray(_yield$requestAppPerm,1);status=_yield$requestAppPerm2[0].status;if(![STATUS_DENIED,STATUS_NOT_DETERMINED].includes(status)){_context2.next=29;break;}resolve(false);return _context2.abrupt("return");case 29:if(!(status===STATUS_GRANTED)){_context2.next=32;break;}resolve(true);return _context2.abrupt("return");case 32:if(!(status===STATUS_DENIED)){_context2.next=45;break;}if(useSettingsModal){_context2.next=36;break;}resolve(false);return _context2.abrupt("return");case 36:_context2.next=38;return dispatch(showModal({title:modalOptions.title||null,message:modalOptions.message,confirm:modalOptions.confirm,dismiss:modalOptions.dismiss,params:modalOptions.params}));case 38:openSettings=_context2.sent;if(openSettings){_context2.next=42;break;}resolve(false);return _context2.abrupt("return");case 42:/**
17
24
  * Handler for the app event.
18
25
  */handler=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var _yield$getAppPermissi3,_yield$getAppPermissi4;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:event.removeCallback(APP_EVENT_APPLICATION_WILL_ENTER_FOREGROUND,handler);_context.next=3;return getAppPermissions([permissionId]);case 3:_yield$getAppPermissi3=_context.sent;_yield$getAppPermissi4=_slicedToArray(_yield$getAppPermissi3,1);status=_yield$getAppPermissi4[0].status;resolve(status===STATUS_GRANTED);case 7:case"end":return _context.stop();}}},_callee);}));return function handler(){return _ref2.apply(this,arguments);};}();/**
19
26
  * Register an event handler, so that we can perform the permissions check again,
20
27
  * when the user comes back from the settings.
21
28
  */event.addCallback(APP_EVENT_APPLICATION_WILL_ENTER_FOREGROUND,handler);// Open the settings (protected by a timeout, so that the modal closes before the app is left).
22
- setTimeout(function(){openAppSettings();},0);case 38:case"end":return _context2.stop();}}},_callee2);}));return function(_x){return _ref.apply(this,arguments);};}());};};export default grantPermissions;
29
+ setTimeout(function(){openAppSettings();},0);case 45:case"end":return _context2.stop();}}},_callee2);}));return function(_x){return _ref.apply(this,arguments);};}());};};export default grantPermissions;
@@ -0,0 +1,22 @@
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{PERMISSION_ID_PUSH}from'@shopgate/pwa-core/constants/AppPermissions';import grantPermissions from"./grantPermissions";/**
2
+ * Determines the current state of the push permissions.
3
+ * If not already happened, the user will be prompted to grant permissions.
4
+ * The action returns a promise which resolves with a boolean value, that indicates the state.
5
+ * @param {Object} options Action options.
6
+ * @param {boolean} [options.useSettingsModal=false] Whether in case of declined permissions a modal
7
+ * shall be presented, which redirects to the app settings.
8
+ * @param {boolean} [options.useRationaleModal=true] Whether a rational modal should be shown
9
+ * @param {Object} [options.rationaleModal={}] Options for the rationale modal.
10
+ * @param {string} options.rationaleModal.title Modal title.
11
+ * @param {string} options.rationaleModal.message Modal message.
12
+ * @param {string} options.rationaleModal.confirm Label for the confirm button.
13
+ * @param {string} options.rationaleModal.dismiss Label for the dismiss button.
14
+ * @param {Object} options.rationaleModal.params Additional parameters for i18n strings.
15
+ * @param {Object} [options.modal={}] Options for the settings modal.
16
+ * @param {string} options.modal.title Modal title.
17
+ * @param {string} options.modal.message Modal message.
18
+ * @param {string} options.modal.confirm Label for the confirm button.
19
+ * @param {string} options.modal.dismiss Label for the dismiss button.
20
+ * @param {Object} options.modal.params Additional parameters for i18n strings.
21
+ * @return { Function } A redux thunk.
22
+ */var grantPushPermissions=function grantPushPermissions(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(dispatch){var _options$useSettingsM=options.useSettingsModal,useSettingsModal=_options$useSettingsM===void 0?true:_options$useSettingsM,_options$useRationale=options.useRationaleModal,useRationaleModal=_options$useRationale===void 0?true:_options$useRationale,_options$modal=options.modal,modal=_options$modal===void 0?{}:_options$modal,_options$rationaleMod=options.rationaleModal,rationaleModal=_options$rationaleMod===void 0?{}:_options$rationaleMod;return dispatch(grantPermissions({permissionId:PERMISSION_ID_PUSH,useSettingsModal:useSettingsModal,useRationaleModal:useRationaleModal,modal:_extends({title:null,message:'permissions.access_denied.push_message',confirm:'permissions.access_denied.settings_button'},modal),rationaleModal:rationaleModal}));};};export default grantPushPermissions;
package/core/index.js CHANGED
@@ -16,7 +16,7 @@ export { default as routePortals } from '@shopgate/pwa-common/helpers/portals/ro
16
16
  */export*from'@shopgate/pwa-common/helpers/redux';export*from'@shopgate/pwa-common/helpers/style';export*from'@shopgate/pwa-common/helpers/tracking';export*from'@shopgate/pwa-common/helpers/validation';// STREAMS
17
17
  export*from'@shopgate/pwa-common/streams/main';export*from'@shopgate/pwa-common/streams/error';// --------------- APP --------------- //
18
18
  // ACTIONS
19
- export{default as handleDeepLink}from'@shopgate/pwa-common/actions/app/handleDeepLink';export{default as handleUniversalLink}from'@shopgate/pwa-common/actions/app/handleUniversalLink';export{default as handleLink}from'@shopgate/pwa-common/actions/app/handleLink';export{default as handlePushNotification}from'@shopgate/pwa-common/actions/app/handlePushNotification';export{default as registerLinkEvents}from'@shopgate/pwa-common/actions/app/registerLinkEvents';export{default as updateStatusBarBackground}from"./actions/updateStatusBarBackground";export{default as grantPermissions}from"./actions/grantPermissions";export{default as grantCameraPermissions}from"./actions/grantCameraPermissions";export{default as grantGeolocationPermissions}from"./actions/grantGeolocationPermissions";export{default as getGeolocation}from"./actions/getGeolocation";// STREAMS
19
+ export{default as handleDeepLink}from'@shopgate/pwa-common/actions/app/handleDeepLink';export{default as handleUniversalLink}from'@shopgate/pwa-common/actions/app/handleUniversalLink';export{default as handleLink}from'@shopgate/pwa-common/actions/app/handleLink';export{default as handlePushNotification}from'@shopgate/pwa-common/actions/app/handlePushNotification';export{default as registerLinkEvents}from'@shopgate/pwa-common/actions/app/registerLinkEvents';export{default as updateStatusBarBackground}from"./actions/updateStatusBarBackground";export{default as grantPermissions}from"./actions/grantPermissions";export{default as grantCameraPermissions}from"./actions/grantCameraPermissions";export{default as grantPushPermissions}from"./actions/grantPushPermissions";export{default as grantGeolocationPermissions}from"./actions/grantGeolocationPermissions";export{default as getGeolocation}from"./actions/getGeolocation";// STREAMS
20
20
  export*from'@shopgate/pwa-common/streams/app';// --------------- STORE --------------- //
21
21
  export*from'@shopgate/pwa-common/store';// --------------- CLIENT --------------- //
22
22
  // ACTIONS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "6.21.0",
3
+ "version": "6.22.0-beta.1",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -15,12 +15,12 @@
15
15
  "connect"
16
16
  ],
17
17
  "dependencies": {
18
- "@shopgate/pwa-common": "6.21.0",
19
- "@shopgate/pwa-common-commerce": "6.21.0",
20
- "@shopgate/pwa-core": "6.21.0",
21
- "@shopgate/pwa-ui-ios": "6.21.0",
22
- "@shopgate/pwa-ui-material": "6.21.0",
23
- "@shopgate/pwa-ui-shared": "6.21.0",
18
+ "@shopgate/pwa-common": "6.22.0-beta.1",
19
+ "@shopgate/pwa-common-commerce": "6.22.0-beta.1",
20
+ "@shopgate/pwa-core": "6.22.0-beta.1",
21
+ "@shopgate/pwa-ui-ios": "6.22.0-beta.1",
22
+ "@shopgate/pwa-ui-material": "6.22.0-beta.1",
23
+ "@shopgate/pwa-ui-shared": "6.22.0-beta.1",
24
24
  "@virtuous/conductor": "~2.4.0",
25
25
  "babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
26
26
  "babel-plugin-transform-es3-property-literals": "^6.8.0",
@@ -1,8 +1,8 @@
1
1
  function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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}});Object.defineProperty(subClass,"prototype",{writable:false});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 _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}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 _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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,{PureComponent}from'react';import PropTypes from'prop-types';import{SheetDrawer,SheetList}from'@shopgate/engage/components';import{VariantContext,ProductContext}from'@shopgate/engage/product';import{ViewContext}from'@shopgate/engage/components/View';import Item from"../SheetItem";import VariantAvailability from"../VariantAvailability";/**
2
2
  * The CharacteristicSheet component.
3
- */var CharacteristicSheet=/*#__PURE__*/function(_PureComponent){_inherits(CharacteristicSheet,_PureComponent);var _super=_createSuper(CharacteristicSheet);function CharacteristicSheet(){var _this;_classCallCheck(this,CharacteristicSheet);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"firstSelectableItemRef",/*#__PURE__*/React.createRef());_defineProperty(_assertThisInitialized(_this),"onDidOpen",function(){if(_this.firstSelectableItemRef.current){_this.firstSelectableItemRef.current.focus();}_this.props.setViewAriaHidden(true);});_defineProperty(_assertThisInitialized(_this),"onClose",function(e){_this.props.onClose(e);_this.props.setViewAriaHidden(false);});_defineProperty(_assertThisInitialized(_this),"handleItemClick",function(event){event.stopPropagation();_this.props.onSelect(event.target.value);});_defineProperty(_assertThisInitialized(_this),"renderAvailability",function(value){var selection=_extends({},_this.props.selection,_defineProperty({},_this.props.charId,value));return/*#__PURE__*/React.createElement(VariantAvailability,{characteristics:selection,productId:_this.props.productId});});return _this;}_createClass(CharacteristicSheet,[{key:"render",value:/**
3
+ */var CharacteristicSheet=/*#__PURE__*/function(_PureComponent){_inherits(CharacteristicSheet,_PureComponent);var _super=_createSuper(CharacteristicSheet);function CharacteristicSheet(){var _this;_classCallCheck(this,CharacteristicSheet);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"firstSelectableItemRef",/*#__PURE__*/React.createRef());_defineProperty(_assertThisInitialized(_this),"onDidOpen",function(){if(_this.firstSelectableItemRef.current){_this.firstSelectableItemRef.current.focus();}_this.props.setViewAriaHidden(true);});_defineProperty(_assertThisInitialized(_this),"onClose",function(e){_this.props.onClose(e);_this.props.setViewAriaHidden(false);});_defineProperty(_assertThisInitialized(_this),"handleItemClick",function(event,itemId){event.stopPropagation();_this.props.onSelect(itemId);});_defineProperty(_assertThisInitialized(_this),"renderAvailability",function(value){var selection=_extends({},_this.props.selection,_defineProperty({},_this.props.charId,value));return/*#__PURE__*/React.createElement(VariantAvailability,{characteristics:selection,productId:_this.props.productId});});return _this;}_createClass(CharacteristicSheet,[{key:"render",value:/**
4
4
  * @return {JSX}
5
- */function render(){var _this2=this;var _this$props=this.props,items=_this$props.items,label=_this$props.label,open=_this$props.open,selectedValue=_this$props.selectedValue;var selectedIndex;if(selectedValue){selectedIndex=items.findIndex(function(item){return item.id===selectedValue;});}else{selectedIndex=items.findIndex(function(item){return item.selectable;});}return/*#__PURE__*/React.createElement(SheetDrawer,{title:label,isOpen:open,onClose:this.onClose,onDidOpen:this.onDidOpen},/*#__PURE__*/React.createElement(SheetList,{className:"theme__product__characteristic__sheet"},items.map(function(item,index){return/*#__PURE__*/React.createElement(Item,{item:item,key:item.id,onClick:_this2.handleItemClick,rightComponent:function rightComponent(){return _this2.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this2.firstSelectableItemRef:null});})));}}]);return CharacteristicSheet;}(PureComponent);/**
5
+ */function render(){var _this2=this;var _this$props=this.props,items=_this$props.items,label=_this$props.label,open=_this$props.open,selectedValue=_this$props.selectedValue;var selectedIndex;if(selectedValue){selectedIndex=items.findIndex(function(item){return item.id===selectedValue;});}else{selectedIndex=items.findIndex(function(item){return item.selectable;});}return/*#__PURE__*/React.createElement(SheetDrawer,{title:label,isOpen:open,onClose:this.onClose,onDidOpen:this.onDidOpen},/*#__PURE__*/React.createElement(SheetList,{className:"theme__product__characteristic__sheet"},items.map(function(item,index){return/*#__PURE__*/React.createElement(Item,{item:item,key:item.id,onClick:_this2.handleItemClick,rightComponent:function rightComponent(){return _this2.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this2.firstSelectableItemRef:null,characteristics:_extends({},_this2.props.selection,_defineProperty({},_this2.props.charId,item.id))});})));}}]);return CharacteristicSheet;}(PureComponent);/**
6
6
  * @param {Object} props The original component props.
7
7
  * @returns {JSX}
8
8
  */_defineProperty(CharacteristicSheet,"defaultProps",{onClose:function onClose(){},onSelect:function onSelect(){},productId:null,selectedValue:null,selection:null});var SheetComponent=function SheetComponent(props){return/*#__PURE__*/React.createElement(ViewContext.Consumer,null,function(_ref){var setAriaHidden=_ref.setAriaHidden;return/*#__PURE__*/React.createElement(ProductContext.Consumer,null,function(_ref2){var productId=_ref2.productId;return/*#__PURE__*/React.createElement(VariantContext.Consumer,null,function(_ref3){var characteristics=_ref3.characteristics;return/*#__PURE__*/React.createElement(CharacteristicSheet,_extends({productId:productId,selection:characteristics,setViewAriaHidden:setAriaHidden},props));});});});};export default SheetComponent;
@@ -1,5 +1,5 @@
1
- function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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}});Object.defineProperty(subClass,"prototype",{writable:false});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 _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}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 _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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,{PureComponent}from'react';import PropTypes from'prop-types';import{withForwardedRef}from'@shopgate/engage/core';import styles from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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}});Object.defineProperty(subClass,"prototype",{writable:false});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 _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}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 _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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,{PureComponent}from'react';import PropTypes from'prop-types';import{withForwardedRef}from'@shopgate/engage/core';import{CharacteristicsButton}from'@shopgate/engage/back-in-stock/components';import styles from"./style";/**
2
2
  * The SheetItem component.
3
- */var SheetItem=/*#__PURE__*/function(_PureComponent){_inherits(SheetItem,_PureComponent);var _super=_createSuper(SheetItem);function SheetItem(){var _this;_classCallCheck(this,SheetItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"getStyle",function(selectable){var selected=_this.props.selected;if(selected){return styles.buttonSelected;}if(!selectable){return styles.buttonDisabled;}return styles.button;});_defineProperty(_assertThisInitialized(_this),"buildProps",function(){var _this$props=_this.props,item=_this$props.item,onClick=_this$props.onClick,forwardedRef=_this$props.forwardedRef;return _extends({className:"".concat(_this.getStyle(item.selectable).toString()," theme__product__characteristic__option"),key:item.id,ref:forwardedRef,value:item.id,'aria-hidden':!item.selectable},item.selectable&&{onClick:onClick});});return _this;}_createClass(SheetItem,[{key:"render",value:/**
3
+ */var SheetItem=/*#__PURE__*/function(_PureComponent){_inherits(SheetItem,_PureComponent);var _super=_createSuper(SheetItem);function SheetItem(){var _this;_classCallCheck(this,SheetItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"getStyle",function(selectable){var selected=_this.props.selected;if(selected){return styles.buttonSelected;}if(!selectable){return styles.buttonDisabled;}return styles.button;});_defineProperty(_assertThisInitialized(_this),"buildProps",function(){var _this$props=_this.props,item=_this$props.item,_onClick=_this$props.onClick,forwardedRef=_this$props.forwardedRef;return _extends({className:"".concat(_this.getStyle(item.selectable).toString()," theme__product__characteristic__option"),key:item.id,ref:forwardedRef,value:item.id,'aria-hidden':!item.selectable},item.selectable&&{onClick:function onClick(event){return _onClick(event,item.id);}});});return _this;}_createClass(SheetItem,[{key:"render",value:/**
4
4
  * @returns {JSX}
5
- */function render(){var _this$props2=this.props,item=_this$props2.item,Right=_this$props2.rightComponent,selected=_this$props2.selected;return/*#__PURE__*/React.createElement("button",_extends({},this.buildProps(),{"data-test-id":item.label,"aria-selected":selected,role:"option",type:"button"}),item.label,item.selectable&&/*#__PURE__*/React.createElement(Right,null));}}]);return SheetItem;}(PureComponent);_defineProperty(SheetItem,"defaultProps",{forwardedRef:null,onClick:function onClick(){},rightComponent:null,selected:false});export default withForwardedRef(SheetItem);
5
+ */function render(){var _this$props2=this.props,item=_this$props2.item,Right=_this$props2.rightComponent,selected=_this$props2.selected,characteristics=_this$props2.characteristics;var buildProps=this.buildProps();return/*#__PURE__*/React.createElement("button",_extends({},buildProps,{"data-test-id":item.label,"aria-selected":selected,role:"option",type:"button"}),item.label,item.selectable&&/*#__PURE__*/React.createElement(Right,null),item.selectable&&/*#__PURE__*/React.createElement(CharacteristicsButton,{characteristics:characteristics}));}}]);return SheetItem;}(PureComponent);_defineProperty(SheetItem,"defaultProps",{forwardedRef:null,onClick:function onClick(){},rightComponent:null,selected:false});export default withForwardedRef(SheetItem);
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var button=css({outline:0,padding:'16px 16px 16px 0',textAlign:'left',width:'100%'});var buttonDisabled=css(button,{color:colors.shade4});var bgColor=colors.darkGray;var boxShadowOffset=variables.gap.bigger;var buttonSelected=css(button,{background:bgColor,boxShadow:"-".concat(boxShadowOffset,"px 0 0 ").concat(bgColor,", ").concat(boxShadowOffset,"px 0 0 ").concat(bgColor),margin:'-1px 0',paddingTop:17,paddingBottom:17});export default{button:button,buttonDisabled:buttonDisabled,buttonSelected:buttonSelected};
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var button=css({outline:0,padding:'16px 0 16px 0',textAlign:'left',width:'100%'});var buttonDisabled=css(button,{color:colors.shade4});var bgColor=colors.darkGray;var boxShadowOffset=variables.gap.bigger;var buttonSelected=css(button,{background:bgColor,boxShadow:"-".concat(boxShadowOffset,"px 0 0 ").concat(bgColor,", ").concat(boxShadowOffset,"px 0 0 ").concat(bgColor),margin:'-1px 0',paddingTop:17,paddingBottom:17});export default{button:button,buttonDisabled:buttonDisabled,buttonSelected:buttonSelected};
package/product/index.js CHANGED
@@ -4,7 +4,7 @@ export{default as changeSortOrder}from'@shopgate/pwa-common-commerce/product/act
4
4
  export{default as productImageFormats}from'@shopgate/pwa-common-commerce/product/collections/ProductImageFormats';// CONSTANTS
5
5
  export*from'@shopgate/pwa-common-commerce/product/constants/index';export*from'@shopgate/pwa-common-commerce/product/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/product/constants/Portals';export*from"./constants";// HELPERS
6
6
  export*from'@shopgate/pwa-common-commerce/product/helpers';export*from"./helpers/index";export*from"./helpers/redirects";export*from"./components/Media/helpers";// SELECTORS
7
- export*from'@shopgate/pwa-common-commerce/product/selectors/options';export*from'@shopgate/pwa-common-commerce/product/selectors/page';export*from'@shopgate/pwa-common-commerce/product/selectors/price';export*from'@shopgate/pwa-common-commerce/product/selectors/product';export*from'@shopgate/pwa-common-commerce/product/selectors/relations';export*from'@shopgate/pwa-common-commerce/product/selectors/variants';export*from"./selectors/media";export{makeGetProductProperties,makeGetProductEffectivityDates,makeGetProductCharacteristics,makeGetProductFeaturedMedia,makeIsProductActive,makeIsBaseProductActive}from"./selectors/product";export*from"./selectors/price";export*from"./selectors/variants";export*from"./selectors/relations";// STREAMS
7
+ export*from'@shopgate/pwa-common-commerce/product/selectors/options';export*from'@shopgate/pwa-common-commerce/product/selectors/page';export*from'@shopgate/pwa-common-commerce/product/selectors/price';export*from'@shopgate/pwa-common-commerce/product/selectors/product';export*from'@shopgate/pwa-common-commerce/product/selectors/relations';export*from'@shopgate/pwa-common-commerce/product/selectors/variants';export*from"./selectors/media";export{makeGetProductProperties,makeGetProductEffectivityDates,makeGetProductCharacteristics,makeGetProductFeaturedMedia,makeIsProductActive,makeIsBaseProductActive,makeGetProductType}from"./selectors/product";export*from"./selectors/price";export*from"./selectors/variants";export*from"./selectors/relations";// STREAMS
8
8
  export*from'@shopgate/pwa-common-commerce/product/streams';// COMPONENTS
9
9
  export{default as ProductProperties}from"./components/ProductProperties/ProductProperties";export{default as MapPriceHint}from"./components/MapPriceHint";export{default as OrderQuantityHint}from"./components/OrderQuantityHint";export{default as ProductImage}from"./components/ProductImage";export{default as MediaSlider}from"./components/MediaSlider";export{default as QuantityPicker}from"./components/QuantityPicker";export{default as EffectivityDates}from"./components/EffectivityDates";export{default as PriceDifference}from"./components/PriceDifference";export{FeaturedMedia,MediaImage}from"./components/Media";export{VariantSwatch}from"./components/Swatch";export{Swatches}from"./components/Swatches";export{RelationsSlider}from"./components/RelationsSlider";export{default as ProductCard}from"./components/ProductCard";export{default as ProductGridPrice}from"./components/ProductGridPrice";export{default as ProductCharacteristics}from"./components/ProductCharacteristics";export{default as Description}from"./components/Description";export{default as ProductList}from"./components/ProductList";export{default as ProductSlider}from"./components/ProductSlider";export{default as Options}from"./components/Options";export{default as Characteristics}from"./components/Characteristics";export{default as Rating}from"./components/Rating";export{default as ProductProvider}from"./components/ProductProvider";export{default as ProductBadges}from"./components/ProductBadges";// HOCs
10
10
  export{default as withPriceCalculation}from"./hocs/withPriceCalculation";export{default as withProductStock}from"./hocs/withProductStock";export{default as withProductListType}from"./hocs/withProductListType";export{default as withProductListEntry}from"./hocs/withProductListEntry";// HOOKs
@@ -19,4 +19,8 @@ import{createSelector}from'reselect';import{getProductPropertiesState,getProduct
19
19
  */export var makeIsBaseProductActive=function makeIsBaseProductActive(){return createSelector(getBaseProduct,function(baseProduct){if(!baseProduct){return false;}return baseProduct.active||false;});};/**
20
20
  * Creates a selector to get the property of a product based on a given label
21
21
  * @returns {Function}
22
- */export var getCurrentProductPropertyByLabel=createSelector(getProductPropertiesUnfiltered,function(state,props){return props.widgetSettings;},function(currentProductProperties,widgetSettings){if(!currentProductProperties||!widgetSettings||!widgetSettings.propertyLabel){return null;}return currentProductProperties.find(function(_ref){var label=_ref.label;return label===widgetSettings.propertyLabel;});});
22
+ */export var getCurrentProductPropertyByLabel=createSelector(getProductPropertiesUnfiltered,function(state,props){return props.widgetSettings;},function(currentProductProperties,widgetSettings){if(!currentProductProperties||!widgetSettings||!widgetSettings.propertyLabel){return null;}return currentProductProperties.find(function(_ref){var label=_ref.label;return label===widgetSettings.propertyLabel;});});/**
23
+ * Create a selector to retrieve the product type.
24
+ * @returns {Function}
25
+ *
26
+ */export var makeGetProductType=function makeGetProductType(){return createSelector(getProduct,function(product){return product===null||product===void 0?void 0:product.type;});};
@@ -1,7 +1,7 @@
1
- import{createSelector}from'reselect';import find from'lodash/find';import{getProductVariants}from'@shopgate/pwa-common-commerce/product';/**
1
+ import{createSelector}from'reselect';import find from'lodash/find';import{getProductVariants}from'@shopgate/pwa-common-commerce/product';import isEqual from'lodash/isEqual';/**
2
2
  * Creates a selector that retrieves a product by a characteristic.
3
3
  * @returns {Function}
4
- */export function makeGetProductByCharacteristics(){return createSelector(function(_,props){return props.characteristics;},getProductVariants,function(characteristics,variants){if(!characteristics||!variants||!variants.products||variants.products.length===0){return null;}var product=find(variants.products,{characteristics:characteristics});if(!product){return null;}return product;});}/**
4
+ */export function makeGetProductByCharacteristics(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},strict=_ref.strict;return createSelector(function(_,props){return props.characteristics;},getProductVariants,function(characteristics,variants){if(!characteristics||!variants||!variants.products||variants.products.length===0){return null;}var product;if(strict){product=variants.products.find(function(_product){return isEqual(_product.characteristics,characteristics);});}else{product=find(variants.products,{characteristics:characteristics});}if(!product){return null;}return product;});}/**
5
5
  * Creates a selector that retrieves the featured image URL for a selected characteristic.
6
6
  * @returns {Function}
7
7
  */export function makeGetCharacteristicsFeaturedImage(){var getProductByCharacteristics=makeGetProductByCharacteristics();return createSelector(getProductByCharacteristics,function(product){if(!product||!product.featuredImageBaseUrl){return null;}return product.featuredImageBaseUrl;});}/**