{"size": 1674, "ext": "js", "max_stars_repo_path": "selectors/views/dashboard.js", "max_stars_repo_name": "rifflearning/mattermost-webapp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "selectors/views/dashboard.js", "max_issues_repo_name": "rifflearning/mattermost-webapp", "max_issues_repo_issues_event_min_datetime": "2018-12-10T19:24:39.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-20T21:01:13.000Z", "max_forks_repo_path": "selectors/views/dashboard.js", "max_forks_repo_name": "rifflearning/mattermost-webapp", "max_forks_repo_forks_event_min_datetime": "2019-06-14T11:54:30.000Z", "max_forks_repo_forks_event_max_datetime": "2019-06-14T11:54:30.000Z"}
{"max_stars_count": null, "max_issues_count": 89, "max_forks_count": 1, "avg_line_length": 28.3728813559, "max_line_length": 82, "alphanum_fraction": 0.6296296296}
// Copyright (c) 2018-present Riff Learning, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

/* eslint
    header/header: "off",
    "no-underscore-dangle": "off",
*/

import {createSelector} from 'reselect';
import {Datasets} from 'mattermost-redux/constants/user_analytics';

/**
 * internal contains all module internal values used by the exported
 * classes/functions defined in this module. This provides a way to
 * mock these values in unit tests of the exported functions.
 */
const internal = {
};

const getUserAnalytics = (state) => state.entities.users.analytics;

const getUserInteractions = createSelector(
    getUserAnalytics,
    (userAnalytics) => {
        return userAnalytics[Datasets.USER_INTERACTIONS];
    }
);

const getUserLearningGroups = createSelector(
    getUserAnalytics,
    (userAnalytics) => {
        return userAnalytics[Datasets.USER_LEARNING_GROUPS];
    }
);

const getLearningGroupTypes = createSelector(
    getUserAnalytics,
    (userAnalytics) => {
        return userAnalytics[Datasets.LEARNING_GROUP_TYPES];
    }
);

const getCourseStartTime = (state) => state.views.dashboard.courseStartTime;

const getRecommendations = (state) => state.views.dashboard.recommendations;

/* **************************************************************************** *
 * Module exports                                                               *
 * **************************************************************************** */
export {
    getUserAnalytics,
    getUserInteractions,
    getUserLearningGroups,
    getLearningGroupTypes,
    getCourseStartTime,
    getRecommendations,
    internal as _test,
};
