2023-01-17 18:04:42 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { State } from './types';
|
|
|
|
|
2023-01-31 16:52:35 +00:00
|
|
|
export const getRegisteredChannels = ( state: State ) => {
|
|
|
|
return state.registeredChannels;
|
2023-01-17 18:04:42 +00:00
|
|
|
};
|
2023-01-19 11:33:51 +00:00
|
|
|
|
|
|
|
export const getRecommendedChannels = ( state: State ) => {
|
|
|
|
return state.recommendedChannels;
|
|
|
|
};
|
2023-02-01 11:02:03 +00:00
|
|
|
|
2023-03-01 19:15:38 +00:00
|
|
|
/**
|
|
|
|
* Get campaigns from state.
|
2023-12-05 03:20:05 +00:00
|
|
|
*
|
|
|
|
* @param state State passed in from the data store.
|
|
|
|
* @param page Page number. First page is `1`.
|
|
|
|
* @param perPage Page size, i.e. number of records in one page.
|
2023-03-01 19:15:38 +00:00
|
|
|
*/
|
2023-12-05 03:20:05 +00:00
|
|
|
export const getCampaigns = ( state: State, page: number, perPage: number ) => {
|
|
|
|
const key = `${ page }-${ perPage }`;
|
|
|
|
return {
|
|
|
|
campaignsPage: state.campaigns.pages[ key ] || null,
|
|
|
|
meta: state.campaigns.meta,
|
|
|
|
};
|
2023-02-01 11:02:03 +00:00
|
|
|
};
|
2023-02-27 16:45:47 +00:00
|
|
|
|
|
|
|
export const getCampaignTypes = ( state: State ) => {
|
|
|
|
return state.campaignTypes;
|
|
|
|
};
|