11import { CommonModule } from "@angular/common" ;
2- import { AfterViewInit , Component , Inject , OnInit , ViewChild } from "@angular/core" ;
3- import { BehaviorSubject , combineLatest , map } from "rxjs" ;
2+ import { Component , Inject , OnInit , ViewChild } from "@angular/core" ;
3+ import { BehaviorSubject , firstValueFrom } from "rxjs" ;
44
55import {
66 InputPasswordComponent ,
@@ -10,6 +10,7 @@ import {
1010import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction" ;
1111import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options" ;
1212import { AccountService } from "@bitwarden/common/auth/abstractions/account.service" ;
13+ import { getUserId } from "@bitwarden/common/auth/services/account.service" ;
1314import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service" ;
1415import { LogService } from "@bitwarden/common/platform/abstractions/log.service" ;
1516import {
@@ -60,7 +61,7 @@ type EmergencyAccessTakeoverDialogResultType =
6061 InputPasswordComponent ,
6162 ] ,
6263} )
63- export class EmergencyAccessTakeoverDialogComponent implements OnInit , AfterViewInit {
64+ export class EmergencyAccessTakeoverDialogComponent implements OnInit {
6465 @ViewChild ( InputPasswordComponent )
6566 inputPasswordComponent : InputPasswordComponent | undefined = undefined ;
6667
@@ -83,34 +84,18 @@ export class EmergencyAccessTakeoverDialogComponent implements OnInit, AfterView
8384 ) { }
8485
8586 async ngOnInit ( ) {
86- // const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
87- // const grantorPolicies = await this.emergencyAccessService.getGrantorPolicies(
88- // this.dialogData.emergencyAccessId,
89- // );
87+ const activeUserId = await firstValueFrom ( this . accountService . activeAccount$ . pipe ( getUserId ) ) ;
88+ const grantorPolicies = await this . emergencyAccessService . getGrantorPolicies (
89+ this . dialogData . emergencyAccessId ,
90+ ) ;
9091
91- // this.masterPasswordPolicyOptions = await firstValueFrom(
92- // this.policyService.masterPasswordPolicyOptions$(activeUserId, grantorPolicies),
93- // );
92+ this . masterPasswordPolicyOptions = await firstValueFrom (
93+ this . policyService . masterPasswordPolicyOptions$ ( activeUserId , grantorPolicies ) ,
94+ ) ;
9495
9596 this . initializing = false ;
9697 }
9798
98- ngAfterViewInit ( ) {
99- if ( ! this . inputPasswordComponent ) {
100- throw new Error ( "InputPasswordComponent is not initialized" ) ;
101- }
102-
103- this . submitting$ = combineLatest ( [
104- this . submittingBehaviorSubject . asObservable ( ) ,
105- this . inputPasswordComponent . submitting$ ,
106- ] ) . pipe (
107- map (
108- ( [ dialogCompIsSubmitting , inputPasswordCompIsSubmitting ] ) =>
109- dialogCompIsSubmitting || inputPasswordCompIsSubmitting ,
110- ) ,
111- ) ;
112- }
113-
11499 protected handlePrimaryButtonClick = async ( ) => {
115100 if ( ! this . inputPasswordComponent ) {
116101 throw new Error ( "InputPasswordComponent is not initialized" ) ;
0 commit comments