"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useCasesFeatures = void 0; var _react = require("react"); var _use_cases_context = require("../components/cases_context/use_cases_context"); var _use_license = require("./use_license"); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ const useCasesFeatures = () => { const { features } = (0, _use_cases_context.useCasesContext)(); const { isAtLeastPlatinum } = (0, _use_license.useLicense)(); const hasLicenseGreaterThanPlatinum = isAtLeastPlatinum(); const casesFeatures = (0, _react.useMemo)(() => ({ isAlertsEnabled: features.alerts.enabled, /** * If the alerts feature is disabled we will disable everything. * If not, then we honor the sync option. * The sync and enabled option in DEFAULT_FEATURES in x-pack/plugins/cases/common/constants.ts * is defaulted to true. This will help consumers to set the enabled * option to true and get the whole alerts experience without the need * to explicitly set the sync to true */ isSyncAlertsEnabled: !features.alerts.enabled ? false : features.alerts.sync, metricsFeatures: features.metrics, caseAssignmentAuthorized: hasLicenseGreaterThanPlatinum, pushToServiceAuthorized: hasLicenseGreaterThanPlatinum }), [features.alerts.enabled, features.alerts.sync, features.metrics, hasLicenseGreaterThanPlatinum]); return casesFeatures; }; exports.useCasesFeatures = useCasesFeatures;