From 3da6d7ba6811f5bcbbce2ed567560e300eb0ead0 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 13 Apr 2018 13:19:26 -0400 Subject: [PATCH] move premium page to jslib --- jslib | 2 +- src/app/accounts/premium.component.ts | 50 +++++---------------------- src/scss/misc.scss | 2 +- 3 files changed, 10 insertions(+), 44 deletions(-) diff --git a/jslib b/jslib index df9074a0..95cd9153 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit df9074a0e58a1b4a499a0682e964013b546d786f +Subproject commit 95cd9153c9ede6bbecc2b65634ef30505be67558 diff --git a/src/app/accounts/premium.component.ts b/src/app/accounts/premium.component.ts index 21ac2992..b7c1fb14 100644 --- a/src/app/accounts/premium.component.ts +++ b/src/app/accounts/premium.component.ts @@ -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; - - 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); } } diff --git a/src/scss/misc.scss b/src/scss/misc.scss index 2c34b39a..57f9454a 100644 --- a/src/scss/misc.scss +++ b/src/scss/misc.scss @@ -1,4 +1,4 @@ -@import "variables.scss"; +@import "variables.scss"; small { font-size: $font-size-small;