import { ChangeDetectionStrategy , Component , EventEmitter , Output , } from '@angular/core' ; import { WireV2Service } from '../../wire-v2.service' ; import { ConfigsService } from '../../../../../common/services/configs.service' ; import { Observable , combineLatest } from 'rxjs' ; import { map , last , first } from 'rxjs/operators' ; /**
 * Bottom toolbar for Wire modal
 */ @ Component ( { selector : 'm-wireCreator__toolbar' , changeDetection : ChangeDetectionStrategy . OnPush , templateUrl : 'toolbar.component.html' , styleUrls : [ 'toolbar.component.ng.scss' ] , } ) export class WireCreatorToolbarComponent { readonly cdnAssetsUrl : string ; disabled : Observable < boolean > = combineLatest ( this . service . validation$ , this . service . inProgress$ , this . service . supportTier$ ) . pipe ( map ( ( [ validation , inProgress , supportTier ] ) => { return Boolean ( ! ( validation && validation . isValid ) || inProgress || ( supportTier && supportTier . subscription_urn ) ) ; } ) ) ; param service constructor ( public service , private configs ) { this . cdnAssetsUrl = this . configs . get ( 'cdn_assets_url' ) ; } /**
     * Submit intent
     */ @ Output ( 'onSubmit' ) onSubmitEmitter : EventEmitter < void > = new EventEmitter < void > ( ) ; param $event async onSubmitClick ( $event ? ) { if ( await this . disabled . pipe ( first ( ) ) . toPromise ( ) ) return ; this . onSubmitEmitter . emit ( ) ; } }