import { Injectable } from '@angular/core' ; import { BoostModalComponent } from './boost-modal.component' ; import { LazyLoadingService , ModalLazyLoadService , } from '../../../common/services/modal-lazy-load.service' ; import { BoostableEntity } from './boost-modal.service' ; /**
 * Lazy loads boost modal.
 */ @ Injectable ( { providedIn : 'root' } ) export class BoostModalLazyService implements LazyLoadingService { constructor ( private lazyModal ) { } param { BoostableEntity } entity returns { Promise < any > } public async open ( entity = { } ) { const { BoostModalLazyModule } = await import ( './boost-modal-lazy.module' ) ; try { await this . lazyModal . setComponent ( BoostModalComponent ) . setLazyModule ( BoostModalLazyModule ) . setOpts ( { wrapperClass : 'm-modalV2__wrapper' , entity : entity , onSaveIntent : ( ) => { this . lazyModal . dismiss ( ) ; } , onDismissIntent : ( ) => { this . lazyModal . dismiss ( ) ; } , } ) . open ( ) ; } catch ( e ) { if ( e === 'DismissedModalException' ) { return ; } console . error ( e ) ; } } }