import { getFeature, DEFAULT_FEATURES } from "../featureFlags";
export const getAllFeatureFlags = (appLanguage) => {
    const res = {};
    Object.keys(DEFAULT_FEATURES).forEach(k => {
        const key = k;
        const value = getFeature({ key, appLanguage });
        if (value !== null)
            res[key] = value;
    });
    return res;
};
export const formatFlagsData = (data) => {
    let allureData = "";
    for (const [key, value] of Object.entries(data)) {
        if (!value)
            continue;
        if (!value.enabled)
            continue;
        allureData += `FF.${key} = ${value.enabled}\n`;
        const entries = {
            desktop_version: value.desktop_version,
            mobile_version: value.mobile_version,
            enabledOverriddenForCurrentVersion: value.enabledOverriddenForCurrentVersion,
            languages_whitelisted: value.languages_whitelisted?.join(", "),
            languages_blacklisted: value.languages_blacklisted?.join(", "),
            enabledOverriddenForCurrentLanguage: value.enabledOverriddenForCurrentLanguage,
            overridesRemote: value.overridesRemote,
            overriddenByEnv: value.overriddenByEnv,
            params: value.params ? JSON.stringify(value.params) : undefined,
        };
        for (const [field, fieldValue] of Object.entries(entries)) {
            if (fieldValue !== undefined) {
                allureData += `FF.${key}.${field} = ${fieldValue
                    .toString()
                    .replace(/^\{|\}$/g, "")
                    .replace(/"/g, " ")}\n`;
            }
        }
    }
    return allureData;
};
export const formatEnvData = (data) => {
    let allureData = "";
    for (const [key, value] of Object.entries(data)) {
        allureData += `ENV.${key} = ${value}\n`;
    }
    return allureData;
};
//# sourceMappingURL=index.js.map