move premium page to jslib

This commit is contained in:
Kyle Spearrin 2018-04-13 13:19:26 -04:00
parent aa6f92b0f1
commit 3da6d7ba68
3 changed files with 10 additions and 44 deletions

2
jslib

@ -1 +1 @@
Subproject commit df9074a0e58a1b4a499a0682e964013b546d786f
Subproject commit 95cd9153c9ede6bbecc2b65634ef30505be67558

View File

@ -1,7 +1,4 @@
import {
Component,
OnInit,
} from '@angular/core';
import { Component } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@ -11,47 +8,16 @@ import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { TokenService } from 'jslib/abstractions/token.service';
import { PremiumComponent as BasePremiumComponent } from 'jslib/angular/components/premium.component';
@Component({
selector: 'app-premium',
templateUrl: 'premium.component.html',
})
export class PremiumComponent implements OnInit {
isPremium: boolean = false;
price: string = '$10';
refreshPromise: Promise<any>;
constructor(private analytics: Angulartics2, private toasterService: ToasterService,
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
private tokenService: TokenService, private apiService: ApiService) { }
async ngOnInit() {
this.isPremium = this.tokenService.getPremium();
}
async refresh() {
try {
this.refreshPromise = this.apiService.refreshIdentityToken();
await this.refreshPromise;
this.toasterService.popAsync('success', null, this.i18nService.t('refreshComplete'));
this.isPremium = this.tokenService.getPremium();
} catch { }
}
async purchase() {
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumPurchaseAlert'),
this.i18nService.t('premiumPurchase'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
if (confirmed) {
this.analytics.eventTrack.next({ action: 'Clicked Purchase Premium' });
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=purchase');
}
}
async manage() {
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumManageAlert'),
this.i18nService.t('premiumManage'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
if (confirmed) {
this.analytics.eventTrack.next({ action: 'Clicked Manage Membership' });
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=manage');
}
export class PremiumComponent extends BasePremiumComponent {
constructor(analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
tokenService: TokenService, apiService: ApiService) {
super(analytics, toasterService, i18nService, platformUtilsService, tokenService, apiService);
}
}

View File

@ -1,4 +1,4 @@
@import "variables.scss";
@import "variables.scss";
small {
font-size: $font-size-small;