"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.upsellingSections = exports.upsellingPages = exports.upsellingMessages = exports.registerUpsellings = void 0; var _common = require("@kbn/security-solution-plugin/common"); var _react = _interopRequireDefault(require("react")); var _endpoint_management = require("./sections/endpoint_management"); var _pli_features = require("../../common/pli/pli_features"); var _investigation_guide_upselling = require("./messages/investigation_guide_upselling"); var _lazy_upselling = require("./lazy_upselling"); /* * 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 registerUpsellings = (upselling, productTypes) => { const enabledPLIsSet = new Set((0, _pli_features.getProductAppFeatures)(productTypes)); const upsellingPagesToRegister = upsellingPages.reduce((pageUpsellings, { pageName, pli, component }) => { if (!enabledPLIsSet.has(pli)) { pageUpsellings[pageName] = component; } return pageUpsellings; }, {}); const upsellingSectionsToRegister = upsellingSections.reduce((sectionUpsellings, { id, pli, component }) => { if (!enabledPLIsSet.has(pli)) { sectionUpsellings[id] = component; } return sectionUpsellings; }, {}); const upsellingMessagesToRegister = upsellingMessages.reduce((messagesUpsellings, { id, pli, message }) => { if (!enabledPLIsSet.has(pli)) { messagesUpsellings[id] = message; } return messagesUpsellings; }, {}); upselling.setPages(upsellingPagesToRegister); upselling.setSections(upsellingSectionsToRegister); upselling.setMessages(upsellingMessagesToRegister); }; // Upsellings for entire pages, linked to a SecurityPageName exports.registerUpsellings = registerUpsellings; const upsellingPages = [ // It is highly advisable to make use of lazy loaded components to minimize bundle size. { pageName: _common.SecurityPageName.threatIntelligence, pli: _common.AppFeatureKey.threatIntelligence, component: () => /*#__PURE__*/_react.default.createElement(_lazy_upselling.ThreatIntelligencePaywallLazy, { requiredPLI: _common.AppFeatureKey.threatIntelligence }) }]; // Upsellings for sections, linked by arbitrary ids exports.upsellingPages = upsellingPages; const upsellingSections = [ // It is highly advisable to make use of lazy loaded components to minimize bundle size. { id: 'osquery_automated_response_actions', pli: _common.AppFeatureKey.osqueryAutomatedResponseActions, component: () => /*#__PURE__*/_react.default.createElement(_lazy_upselling.OsqueryResponseActionsUpsellingSectionLazy, { requiredPLI: _common.AppFeatureKey.osqueryAutomatedResponseActions }) }, { id: 'endpointPolicyProtections', pli: _common.AppFeatureKey.endpointPolicyProtections, component: _endpoint_management.EndpointPolicyProtectionsLazy }]; // Upsellings for sections, linked by arbitrary ids exports.upsellingSections = upsellingSections; const upsellingMessages = [{ id: 'investigation_guide', pli: _common.AppFeatureKey.investigationGuide, message: (0, _investigation_guide_upselling.investigationGuideUpselling)(_common.AppFeatureKey.investigationGuide) }]; exports.upsellingMessages = upsellingMessages;