<commit_before>import { IState } from '../app/types';
import { FEATURES_TO_BUTTONS_MAPPING } from '../base/jwt/constants';
import { isJwtFeatureEnabled } from '../base/jwt/functions';

/**
 * Indicates if the audio mute button is disabled or not.
 *
 * @param {IState} state - The state from the Redux store.
 * @returns {boolean}
 */
export function isAudioMuteButtonDisabled(state: IState) {
    const { available, muted, unmuteBlocked } = state['features/base/media'].audio;
    const { startSilent } = state['features/base/config'];

    return Boolean(!available || startSilent || (muted && unmuteBlocked));
}

/**
 * Returns the buttons corresponding to features disabled through jwt.
 *
 * @param {IState} state - The state from the Redux store.
 * @returns {string[]} - The disabled by jwt buttons array.
 */
export function getJwtDisabledButtons(state: IState) {
    return Object.keys(FEATURES_TO_BUTTONS_MAPPING).reduce((acc: string[], current: string) => {
        if (!isJwtFeatureEnabled(state, current, true)) {
            acc.push(current);
        }

        return acc;
    }, []);
}<commit_msg>fix(hide-buttons-on-jwt) Fix getting disabled buttons (#12326)<commit_after>import { IState } from '../app/types';
import { FEATURES_TO_BUTTONS_MAPPING } from '../base/jwt/constants';
import { isJwtFeatureEnabled } from '../base/jwt/functions';

/**
 * Indicates if the audio mute button is disabled or not.
 *
 * @param {IState} state - The state from the Redux store.
 * @returns {boolean}
 */
export function isAudioMuteButtonDisabled(state: IState) {
    const { available, muted, unmuteBlocked } = state['features/base/media'].audio;
    const { startSilent } = state['features/base/config'];

    return Boolean(!available || startSilent || (muted && unmuteBlocked));
}

/**
 * Returns the buttons corresponding to features disabled through jwt.
 *
 * @param {IState} state - The state from the Redux store.
 * @returns {string[]} - The disabled by jwt buttons array.
 */
export function getJwtDisabledButtons(state: IState) {
    return Object.keys(FEATURES_TO_BUTTONS_MAPPING).reduce((acc: string[], current: string) => {
        if (!isJwtFeatureEnabled(state, current, true)) {
            acc.push(FEATURES_TO_BUTTONS_MAPPING[current as keyof typeof FEATURES_TO_BUTTONS_MAPPING]);
        }

        return acc;
    }, []);
}
{'fraction_non_alphanumeric': 0.13361702127659575, 'fraction_numerical': 0.002127659574468085, 'mean_word_length': 3.867494824016563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7544036', 'n_tokens_mistral': 715, 'n_tokens_neox': 711, 'n_words': 193}