import { i18n } from '@kbn/i18n' ; import { EmbeddableStateWithType } from '../../../../src/plugins/embeddable/common' ; import { IContainer , EmbeddableInput , EmbeddableFactoryDefinition , EmbeddableFactory , } from '../../../../src/plugins/embeddable/public' ; import { SimpleEmbeddable } from './migrations_embeddable' ; import { migration730 } from './migration.7.3.0' ; export const SIMPLE_EMBEDDABLE = 'SIMPLE_EMBEDDABLE' ; export type SimpleEmbeddableInput = EmbeddableInput & { title : string ; value : number ; } ; export type SimpleEmbeddableFactory = EmbeddableFactory ; export class SimpleEmbeddableFactoryDefinition implements EmbeddableFactoryDefinition < SimpleEmbeddableInput > { public readonly type = SIMPLE_EMBEDDABLE ; public readonly migrations = { '7.3.0' : migration730 , } ; public extract ( state ) { return { state , references : [ ] } ; } public inject ( state ) { return state ; } /**
     * In our simple example, we let everyone have permissions to edit this. Most
     * embeddables should check the UI Capabilities service to be sure of
     * the right permissions.
     */ public async isEditable ( ) { return true ; } public async create ( initialInput , parent ? ) { return new SimpleEmbeddable ( initialInput , parent ) ; } public getDisplayName ( ) { return i18n . translate ( 'embeddableExamples.migrations.displayName' , { defaultMessage : 'hello world' , } ) ; } }