import { Compiler , Injectable , Injector } from '@angular/core' ; import { StackableModalEvent , StackableModalService , } from '../../../services/ux/stackable-modal.service' ; import { InteractionType } from './interactions-modal-data.service' ; import { InteractionsModalComponent } from './interactions-modal.component' ; @ Injectable ( { providedIn : 'root' } ) export class InteractionsModalService { constructor ( private stackableModal , private compiler , private injector ) { } async open ( type , entityGuid ) { const { InteractionsModalModule } = await import ( './interactions-modal.module' ) ; const moduleFactory = await this . compiler . compileModuleAsync ( InteractionsModalModule ) ; const moduleRef = moduleFactory . create ( this . injector ) ; const componentFactory = moduleRef . instance . resolveComponent ( ) ; const evt = await this . stackableModal . present ( InteractionsModalComponent , { type , entityGuid } , { wrapperClass : 'm-modalV2__wrapper' , onComplete : ( result ) => { this . stackableModal . dismiss ( ) ; } , onDismissIntent : ( ) => { this . stackableModal . dismiss ( ) ; } , } ) . toPromise ( ) ; return evt ; } }