@shopgate/engage
Version:
Shopgate's ENGAGE library.
10 lines • 2.47 kB
JavaScript
import{createSelector}from'reselect';import{MERCHANT_SETTINGS_LOCATION_BASED_SHOPPING_ENABLED,MERCHANT_SETTINGS_SUBSTITUTION_PREFERENCES_ENABLED,MERCHANT_SETTINGS_CUSTOMER_ATTRIBUTES,MERCHANT_SETTINGS_FULFILLMENT_SCHEDULED_ENABLED,MERCHANT_SETTINGS_RESTRICT_MULTI_LOCATION_ORDERS,MERCHANT_SETTINGS_DEFAULT_CURRENCY,MERCHANT_SETTINGS_ENABLE_WEB_INDEXING,MERCHANT_SETTINGS_PRODUCT_SHOW_ALTERNATIVE_LOCATION,MERCHANT_SETTINGS_PRODUCTLIST_SHOW_INVENTORY}from"../constants";/**
* Retrieves the merchantSettings state from the store.
* @param {Object} state The current application state.
* @return {Object} The locations state.
*/var getState=function getState(state){var _state$settings;return(state===null||state===void 0?void 0:(_state$settings=state.settings)===null||_state$settings===void 0?void 0:_state$settings.merchantSettings)||{};};/**
* Creates a selector to retrieve a single merchant setting.
* @param {string} key The key of the merchant setting
* @param {*} [fallback=null] The fallback value when no value can be determined.
* @returns {Function}
*/var makeGetMerchantSettingByKey=function makeGetMerchantSettingByKey(key){var fallback=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return createSelector(getState,function(state){return typeof(state===null||state===void 0?void 0:state[key])!=='undefined'?state===null||state===void 0?void 0:state[key]:fallback;});};export var getIsLocationBasedShopping=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_LOCATION_BASED_SHOPPING_ENABLED,false);export var getSubstitutionPreferencesEnabled=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_SUBSTITUTION_PREFERENCES_ENABLED,false);export var getMerchantCustomerAttributes=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_CUSTOMER_ATTRIBUTES,[]);export var getFulfillmentSchedulingEnabled=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_FULFILLMENT_SCHEDULED_ENABLED,false);export var getRestrictMultiLocationOrders=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_RESTRICT_MULTI_LOCATION_ORDERS,false);export var getDefaultCurrency=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_DEFAULT_CURRENCY);export var getEnableWebIndexing=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_ENABLE_WEB_INDEXING,false);export var getProductShowAlternativeLocation=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_PRODUCT_SHOW_ALTERNATIVE_LOCATION,false);export var getProductListShowInventory=makeGetMerchantSettingByKey(MERCHANT_SETTINGS_PRODUCTLIST_SHOW_INVENTORY,false);