kibana/x-pack/examples/ui_actions_enhanced_examples/public/mount.tsx
Nathan Reese 80f915f9e3
[embeddable] remove EmbeddableRenderer and embeddable stories (#203007)
PR starts cleaning up legacy embeddable components by removing
EmbeddableRenderer, EmbedddableRoot, and embeddable story books.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Anton Dosov <dosantappdev@gmail.com>
2024-12-10 10:38:28 -07:00

39 lines
1.3 KiB
TypeScript

/*
* 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.
*/
import * as React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { CoreSetup, AppMountParameters } from '@kbn/core/public';
import { StartDependencies, UiActionsEnhancedExamplesStart } from './plugin';
import { UiActionsExampleAppContextValue, context } from './context';
export const mount =
(coreSetup: CoreSetup<StartDependencies, UiActionsEnhancedExamplesStart>) =>
async ({ appBasePath, element }: AppMountParameters) => {
const [
core,
plugins,
{ managerWithoutEmbeddable, managerWithoutEmbeddableSingleButton, managerWithEmbeddable },
] = await coreSetup.getStartServices();
const { App } = await import('./containers/app');
const deps: UiActionsExampleAppContextValue = {
appBasePath,
core,
plugins,
managerWithoutEmbeddable,
managerWithoutEmbeddableSingleButton,
managerWithEmbeddable,
};
const reactElement = (
<context.Provider value={deps}>
<App core={core} />
</context.Provider>
);
render(reactElement, element);
return () => unmountComponentAtNode(element);
};