2020// @ts -ignore
2121import { CoreSetup , CoreStart , Plugin , PluginInitializerContext } from 'kibana/public' ;
2222// @ts -ignore
23- import { setToasts , setUiSettings , setInjectedVarFunc } from './kibana_services' ;
23+ import { setToasts , setUiSettings , setKibanaVersion , setMapsLegacyConfig } from './kibana_services' ;
2424// @ts -ignore
2525import { ServiceSettings } from './map/service_settings' ;
2626// @ts -ignore
2727import { getPrecision , getZoomPrecision } from './map/precision' ;
28+ // @ts -ignore
29+ import { KibanaMap } from './map/kibana_map' ;
2830import { MapsLegacyConfigType , MapsLegacyPluginSetup , MapsLegacyPluginStart } from './index' ;
2931import { ConfigSchema } from '../config' ;
32+ // @ts -ignore
33+ import { BaseMapsVisualizationProvider } from './map/base_maps_visualization' ;
3034
3135/**
3236 * These are the interfaces with your public contracts. You should export these
3337 * for other plugins to use in _their_ `SetupDeps`/`StartDeps` interfaces.
3438 * @public
3539 */
3640
37- export const bindSetupCoreAndPlugins = ( core : CoreSetup ) => {
41+ export const bindSetupCoreAndPlugins = (
42+ core : CoreSetup ,
43+ config : MapsLegacyConfigType ,
44+ kibanaVersion : string
45+ ) => {
3846 setToasts ( core . notifications . toasts ) ;
3947 setUiSettings ( core . uiSettings ) ;
40- setInjectedVarFunc ( core . injectedMetadata . getInjectedVar ) ;
48+ setKibanaVersion ( kibanaVersion ) ;
49+ setMapsLegacyConfig ( config ) ;
4150} ;
4251
4352// eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -53,15 +62,23 @@ export class MapsLegacyPlugin implements Plugin<MapsLegacyPluginSetup, MapsLegac
5362 }
5463
5564 public setup ( core : CoreSetup , plugins : MapsLegacySetupDependencies ) {
56- bindSetupCoreAndPlugins ( core ) ;
57-
5865 const config = this . _initializerContext . config . get < MapsLegacyConfigType > ( ) ;
66+ const kibanaVersion = this . _initializerContext . env . packageInfo . version ;
67+
68+ bindSetupCoreAndPlugins ( core , config , kibanaVersion ) ;
69+
70+ const serviceSettings = new ServiceSettings ( config , config . tilemap ) ;
71+ const getKibanaMapFactoryProvider = ( ...args : any ) => new KibanaMap ( ...args ) ;
72+ const getBaseMapsVis = ( ) =>
73+ new BaseMapsVisualizationProvider ( getKibanaMapFactoryProvider , serviceSettings ) ;
5974
6075 return {
61- serviceSettings : new ServiceSettings ( config , config . tilemap ) ,
76+ serviceSettings,
6277 getZoomPrecision,
6378 getPrecision,
6479 config,
80+ getKibanaMapFactoryProvider,
81+ getBaseMapsVis,
6582 } ;
6683 }
6784
0 commit comments