import { CoreSetup , CoreStart , Plugin , PluginInitializerContext , } from 'opensearch-dashboards/public' ; import { CorePluginAPluginSetup } from '../../core_plugin_a/public/plugin' ; declare global { interface Window { env ? : PluginInitializerContext [ 'env' ] ; } } export interface CorePluginBDeps { core_plugin_a : CorePluginAPluginSetup ; } export class CorePluginBPlugin implements Plugin < CorePluginBPluginSetup , CorePluginBPluginStart , CorePluginBDeps > { constructor ( pluginContext ) { window . env = pluginContext . env ; } public setup ( core , deps ) { core . application . register ( { id : 'bar' , title : 'Bar' , async mount ( context , params ) { const { renderApp } = await import ( './application' ) ; return renderApp ( context , params ) ; } , } ) ; return { sayHi ( ) { return `Plugin A said: ${ deps . core_plugin_a . getGreeting ( ) }` ; } , } ; } public async start ( core , deps ) { return { sendSystemRequest : async ( asSystemRequest ) => { const response = await core . http . post < string > ( '/core_plugin_b/system_request' , { asSystemRequest , } ) ; return `/core_plugin_b/system_request says: "${ response }"` ; } , } ; } public stop ( ) { } } export type CorePluginBPluginSetup = ReturnType < CorePluginBPlugin [ 'setup' ] > ; export type CorePluginBPluginStart = ReturnType < CorePluginBPlugin [ 'start' ] > ;