@shopgate/pwa-common
Version:
Common library for the Shopgate Connect PWA.
11 lines • 715 B
JavaScript
import{createSelector}from'reselect';/**
* Returns modal state (state.modal)
* @param {Object} state The application state.
* @returns {Object}
*/export var getModalState=function getModalState(state){return state.modal||[];};/**
* Returns the first modal of the current modal stack.
* @return {Object|undefined}
*/export var getFirstModal=createSelector(getModalState,function(modals){return modals[0];});/**
* Searches for a modal with a specific id in the current modal stack.
* @return {Object|undefined}
*/export var getModalById=createSelector(getModalState,function(state,modalId){return modalId;},function(modals,modalId){return modals.find(function(_ref){var id=_ref.id;return id===modalId;});});