File size: 829 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'calypso/state/active-promotions/init';

/**
 * Return WordPress activePromotions getting from state object
 * @param {Object} state - current state object
 * @returns {Array} WordPress activePromotions
 */
export function getActivePromotions( state ) {
	return state.activePromotions.items;
}

/**
 * Return if promotion is active
 * @param {Object} state - current state object
 * @param {string} name - promotion name
 * @returns {boolean} Is promotion active?
 */
export function hasActivePromotion( state, name ) {
	return getActivePromotions( state ).indexOf( name ) !== -1;
}

/**
 * Return requesting state
 * @param {Object} state - current state object
 * @returns {boolean} is activePromotions requesting?
 */
export function isRequestingActivePromotions( state ) {
	return state.activePromotions.requesting;
}