import { Component } from '@angular/core' ; import { BehaviorSubject , Observable , timer } from 'rxjs' ; import { scan , take , takeWhile , throttleTime } from 'rxjs/operators' ; import { MultiFactorAuthService , MultiFactorPanel , } from '../../services/multi-factor-auth-service' ; import { AbstractMFAFormComponent } from '../abstract/abstract-mfa-form.component' ; /**
 * MFA input form for SMS.
 */ @ Component ( { selector : 'm-multiFactorAuth__email' , templateUrl : './email.component.html' , styleUrls : [ '../mfa-panel.component.ng.scss' ] , } ) export class MultiFactorAuthEmailComponent extends AbstractMFAFormComponent { /**
     * Holds timer for Email resend.
     */ public timer$ : Observable < number > ; constructor ( public service ) { super ( service ) ; } returns { BehaviorSubject < MultiFactorPanel > } get activePanel$ ( ) : BehaviorSubject < MultiFactorPanel > { return this . service . activePanel$ ; } returns { void } public onVerifyClick ( ) { this . service . completeMultiFactor ( this . code ) ; } returns { void } public resendTimer ( ) { this . code = '' ; this . service . completeMultiFactor ( null ) ; this . timer$ = timer ( 0 , 1000 ) . pipe ( scan ( acc => -- acc , 30 ) , takeWhile ( x => x >= 0 ) ) ; } }