"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useFeature = exports.FeatureGateContextProvider = exports.FeatureGateContext = exports.STANDALONE_DEPLOYMENT_ENABLED_FEATURES = exports.ACM_ENABLED_FEATURES = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
// Hardcoded for ACM
exports.ACM_ENABLED_FEATURES = {
    ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE: false,
};
// Hardcoded outside OCM
exports.STANDALONE_DEPLOYMENT_ENABLED_FEATURES = {
    ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE: false,
};
exports.FeatureGateContext = react_1.default.createContext({
    isFeatureEnabled: () => false,
});
const FeatureGateContextProvider = ({ features, children }) => {
    const featuresWithDefaults = Object.assign({}, features);
    const isFeatureEnabled = (feature) => {
        // Configured via Unleash in the OCM
        return !!featuresWithDefaults[feature];
    };
    return (react_1.default.createElement(exports.FeatureGateContext.Provider, { value: { isFeatureEnabled } }, children));
};
exports.FeatureGateContextProvider = FeatureGateContextProvider;
const useFeature = (feature) => {
    const { isFeatureEnabled } = react_1.default.useContext(exports.FeatureGateContext);
    return isFeatureEnabled(feature);
};
exports.useFeature = useFeature;
//# sourceMappingURL=featureGate.js.map