diff --git a/jslib b/jslib index f5287e29a2..20622db73c 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit f5287e29a2a135c131d00c4a56a90b18bc4afaab +Subproject commit 20622db73c5c2a56777944bb06f32a21bf2e763f diff --git a/package.json b/package.json index 5b48742394..80ba39f831 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,10 @@ "build:watch": "webpack-serve --config webpack.config.js", "build:prod": "cross-env NODE_ENV=production webpack --config webpack.config.js", "build:prod:watch": "cross-env NODE_ENV=production webpack-serve --config webpack.config.js", + "build:selfhost": "cross-env SELF_HOST=true webpack-serve --config webpack.config.js", + "build:selfhost:watch": "cross-env SELF_HOST=true webpack-serve --config webpack.config.js", + "build:selfhost:prod": "cross-env SELF_HOST=true NODE_ENV=production webpack --config webpack.config.js", + "build:selfhost:prod:watch": "cross-env SELF_HOST=true NODE_ENV=production webpack-serve --config webpack.config.js", "dist": "npm run build:prod && gulp dist", "lint": "tslint src/**/*.ts || true", "lint:fix": "tslint src/**/*.ts --fix" diff --git a/src/app/settings/user-billing.component.html b/src/app/settings/user-billing.component.html index cf7a840e69..30969e35e1 100644 --- a/src/app/settings/user-billing.component.html +++ b/src/app/settings/user-billing.component.html @@ -7,50 +7,63 @@ - - - - {{'subscriptionCanceled' | i18n}} - -

{{'subscriptionPendingCanceled' | i18n}}

- -
-
-
-
-
{{'status' | i18n}}
-
- {{(subscription && subscription.status) || '-'}} - {{'pendingCancellation' | i18n}} -
-
{{'nextCharge' | i18n}}
-
{{nextInvoice ? ((nextInvoice.date | date: 'mediumDate') + ', ' + (nextInvoice.amount | currency:'$')) - : '-'}}
-
-
-
- {{'details' | i18n}} - - - - - - - -
- {{i.name}} {{i.quantity > 1 ? '×' + i.quantity : ''}} @ {{i.amount | currency:'$'}} - - {{(i.quantity * i.amount) | currency:'$'}} /{{i.interval | i18n}} -
-
+ + + {{'subscriptionCanceled' | i18n}} + +

{{'subscriptionPendingCanceled' | i18n}}

+ +
+
+
{{'expiration' | i18n}}
+
{{billing.expiration | date:'mediumDate'}}
+
{{'neverExpires' | i18n}}
+
+
+
+
+
{{'status' | i18n}}
+
+ {{(subscription && subscription.status) || '-'}} + {{'pendingCancellation' | i18n}} +
+
{{'nextCharge' | i18n}}
+
{{nextInvoice ? ((nextInvoice.date | date: 'mediumDate') + ', ' + (nextInvoice.amount | currency:'$')) : + '-'}}
+
+
+ {{'details' | i18n}} + + + + + + + +
+ {{i.name}} {{i.quantity > 1 ? '×' + i.quantity : ''}} @ {{i.amount | currency:'$'}} + + {{(i.quantity * i.amount) | currency:'$'}} /{{i.interval | i18n}} +
+
+
+ + + + {{'manageSubscription' | i18n}} + + +
-
- -

{{'storage' | i18n}}

-

{{'subscriptionStorage' | i18n : billing.maxStorageGb : billing.storageName || '0 MB'}}

-
-
{{(storagePercentage / 100) | percent}}
+

{{'storage' | i18n}}

+

{{'subscriptionStorage' | i18n : billing.maxStorageGb : billing.storageName || '0 MB'}}

+
+
{{(storagePercentage / 100) | percent}}
+
+ +
+ + + + +
- -
- - - - - -
-
-

{{'paymentMethod' | i18n}}

-

{{'noPaymentMethod' | i18n}}

-

- {{'paymentMethod' | i18n}} +

{{'noPaymentMethod' | i18n}}

+

+ - {{paymentSource.description}} -

- - - -

{{'charges' | i18n}}

-

{{'noCharges' | i18n}}

- - - - - - - - - -
{{c.createdDate | date:'mediumDate'}}{{c.paymentSource ? c.paymentSource.description : '-'}}{{c.status}}{{c.amount | currency:'$'}}
- * {{'chargesStatement' | i18n : 'BITWARDEN'}} -
+ {{paymentSource.description}} +

+ + + +

{{'charges' | i18n}}

+

{{'noCharges' | i18n}}

+ + + + + + + + + +
{{c.createdDate | date:'mediumDate'}}{{c.paymentSource ? c.paymentSource.description : '-'}}{{c.status}}{{c.amount | currency:'$'}}
+ * {{'chargesStatement' | i18n : 'BITWARDEN'}} diff --git a/src/app/settings/user-billing.component.ts b/src/app/settings/user-billing.component.ts index 1a559577f2..8a0848b429 100644 --- a/src/app/settings/user-billing.component.ts +++ b/src/app/settings/user-billing.component.ts @@ -15,8 +15,6 @@ import { TokenService } from 'jslib/abstractions/token.service'; import { PaymentMethodType } from 'jslib/enums/paymentMethodType'; -import { AdjustStorageComponent } from './adjust-storage.component'; - @Component({ selector: 'app-user-billing', templateUrl: 'user-billing.component.html', @@ -30,13 +28,16 @@ export class UserBillingComponent implements OnInit { showAdjustPayment = false; billing: BillingResponse; paymentMethodType = PaymentMethodType; + selfHosted = false; cancelPromise: Promise; reinstatePromise: Promise; constructor(private tokenService: TokenService, private apiService: ApiService, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, - private analytics: Angulartics2, private toasterService: ToasterService) { } + private analytics: Angulartics2, private toasterService: ToasterService) { + this.selfHosted = platformUtilsService.isSelfHost(); + } async ngOnInit() { await this.load(); @@ -96,7 +97,7 @@ export class UserBillingComponent implements OnInit { } catch { } } - license() { + downloadLicense() { if (this.loading) { return; } @@ -105,6 +106,12 @@ export class UserBillingComponent implements OnInit { this.platformUtilsService.saveFile(window, licenseString, null, 'bitwarden_premium_license.json'); } + updateLicense() { + if (this.loading) { + return; + } + } + adjustStorage(add: boolean) { this.adjustStorageAdd = add; this.showAdjustStorage = true; diff --git a/src/services/webPlatformUtils.service.ts b/src/services/webPlatformUtils.service.ts index d128758968..a1ff24268e 100644 --- a/src/services/webPlatformUtils.service.ts +++ b/src/services/webPlatformUtils.service.ts @@ -180,6 +180,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService { return process.env.ENV === 'development'; } + isSelfHost(): boolean { + return process.env.SELF_HOST.toString() === 'true'; + } + copyToClipboard(text: string, options?: any): void { const doc = options ? options.doc : window.document; if ((window as any).clipboardData && (window as any).clipboardData.setData) { diff --git a/webpack.config.js b/webpack.config.js index bee4f6985e..00875aed14 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,6 +13,10 @@ if (process.env.NODE_ENV == null) { } const ENV = process.env.ENV = process.env.NODE_ENV; +if (process.env.NODE_ENV == null) { + process.env.NODE_ENV = 'development'; +} + const isVendorModule = (module) => { if (!module.context) { return false; @@ -104,6 +108,7 @@ const plugins = [ new webpack.DefinePlugin({ 'process.env': { 'ENV': JSON.stringify(ENV), + 'SELF_HOST': JSON.stringify(process.env.SELF_HOST === 'true' ? true : false), 'APPLICATION_VERSION': JSON.stringify(pjson.version), 'CACHE_TAG': JSON.stringify(Math.random().toString(36).substring(7)), }