diff --git a/x-pack/plugins/file_upload/public/get_file_upload_component.ts b/x-pack/plugins/file_upload/public/get_file_upload_component.ts index ad01cdef7ff86d..7232c4126e297f 100644 --- a/x-pack/plugins/file_upload/public/get_file_upload_component.ts +++ b/x-pack/plugins/file_upload/public/get_file_upload_component.ts @@ -4,11 +4,27 @@ * you may not use this file except in compliance with the Elastic License. */ -import { React } from 'react'; +import React from 'react'; +import { FeatureCollection } from 'geojson'; -let lazyLoadPromise: Promise>; +export interface FileUploadComponentProps { + appName: string; + isIndexingTriggered: boolean; + onFileUpload: (geojsonFile: FeatureCollection, name: string) => void; + onFileRemove: () => void; + onIndexReady: (indexReady: boolean) => void; + transformDetails: string; + onIndexingComplete: (indexResponses: { + indexDataResp: unknown; + indexPatternResp: unknown; + }) => void; +} + +let lazyLoadPromise: Promise>; -export async function getFileUploadComponent(): Promise> { +export async function getFileUploadComponent(): Promise< + React.ComponentType +> { if (typeof lazyLoadPromise !== 'undefined') { return lazyLoadPromise; } diff --git a/x-pack/plugins/file_upload/public/index.ts b/x-pack/plugins/file_upload/public/index.ts index 205ceae37d6a11..1e39fb4dc85960 100644 --- a/x-pack/plugins/file_upload/public/index.ts +++ b/x-pack/plugins/file_upload/public/index.ts @@ -9,3 +9,5 @@ import { FileUploadPlugin } from './plugin'; export function plugin() { return new FileUploadPlugin(); } + +export { FileUploadComponentProps } from './get_file_upload_component'; diff --git a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx index 89543cdf9915bc..2db12db33ff272 100644 --- a/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx +++ b/x-pack/plugins/maps/public/classes/layers/file_upload_wizard/wizard.tsx @@ -19,6 +19,7 @@ import { VectorLayer } from '../../layers/vector_layer/vector_layer'; // @ts-expect-error import { createDefaultLayerDescriptor } from '../../sources/es_search_source'; import { RenderWizardArguments } from '../../layers/layer_wizard_registry'; +import { FileUploadComponentProps } from '../../../../../file_upload/public'; export const INDEX_SETUP_STEP_ID = 'INDEX_SETUP_STEP_ID'; export const INDEXING_STEP_ID = 'INDEXING_STEP_ID'; @@ -32,12 +33,13 @@ enum INDEXING_STAGE { interface State { indexingStage: INDEXING_STAGE | null; + fileUploadComponent: React.ComponentType | null; } export class ClientFileCreateSourceEditor extends Component { private _isMounted: boolean = false; - state = { + state: State = { indexingStage: null, fileUploadComponent: null, }; diff --git a/x-pack/plugins/maps/public/kibana_services.d.ts b/x-pack/plugins/maps/public/kibana_services.d.ts index c12c85ecfe32f1..1f3a1cd665366f 100644 --- a/x-pack/plugins/maps/public/kibana_services.d.ts +++ b/x-pack/plugins/maps/public/kibana_services.d.ts @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import React from 'react'; import { DataPublicPluginStart } from 'src/plugins/data/public'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { IndexPatternsService } from 'src/plugins/data/public/index_patterns'; @@ -10,10 +11,11 @@ import { NavigateToAppOptions } from 'kibana/public'; import { MapsConfigType } from '../config'; import { MapsLegacyConfigType } from '../../../../src/plugins/maps_legacy/public'; import { EmbeddableStart } from '../../../../src/plugins/embeddable/public'; +import { FileUploadComponentProps } from '../../file_upload/public'; export function getLicenseId(): any; export function getInspector(): any; -export function getFileUploadComponent(): Promise; +export function getFileUploadComponent(): Promise>; export function getIndexPatternSelectComponent(): any; export function getHttp(): any; export function getTimeFilter(): any;