1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

premium and paid org callouts

This commit is contained in:
Kyle Spearrin
2018-07-18 09:21:23 -04:00
parent 1f6dd079cd
commit 1cee1c6e8f
10 changed files with 106 additions and 23 deletions

View File

@@ -8,6 +8,7 @@ import {
} from '@angular/core';
import { ApiService } from 'jslib/abstractions/api.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { TokenService } from 'jslib/abstractions/token.service';
import { TwoFactorProviders } from 'jslib/services/auth.service';
@@ -42,7 +43,7 @@ export class TwoFactorSetupComponent implements OnInit {
private modal: ModalComponent = null;
constructor(private apiService: ApiService, private tokenService: TokenService,
private componentFactoryResolver: ComponentFactoryResolver) { }
private componentFactoryResolver: ComponentFactoryResolver, private messagingService: MessagingService) { }
async ngOnInit() {
this.premium = this.tokenService.getPremium();
@@ -125,6 +126,14 @@ export class TwoFactorSetupComponent implements OnInit {
this.openModal(this.recoveryModalRef, TwoFactorRecoveryComponent);
}
async premiumRequired() {
const premium = await this.tokenService.getPremium();
if (!premium) {
this.messagingService.send('premiumRequired');
return;
}
}
private openModal<T>(ref: ViewContainerRef, type: Type<T>): T {
if (this.modal != null) {
this.modal.close();