billing updates

This commit is contained in:
Kyle Spearrin 2018-07-17 22:49:53 -04:00
parent 4557366154
commit 9a23d5fa97
5 changed files with 20 additions and 9 deletions

View File

@ -63,14 +63,14 @@
<button type="button" class="btn btn-outline-secondary" (click)="updateLicense()">
{{'updateLicense' | i18n}}
</button>
<a href="https://vault.bitwarden.com/#/settings/billing" target="_blank" rel="noopener" class="btn btn-outline-secondary">
<a href="https://vault.bitwarden.com" target="_blank" rel="noopener" class="btn btn-outline-secondary">
{{'manageSubscription' | i18n}}
</a>
</div>
<div class="card mt-3" *ngIf="showUpdateLicense">
<div class="card-body">
<h3 class="card-body-header">{{'updateLicense' | i18n}}</h3>
<app-update-license [user]="false" (onUpdated)="closeUpdateLicense(true)" (onCanceled)="closeUpdateLicense(false)"></app-update-license>
<app-update-license [organizationId]="organizationId" (onUpdated)="closeUpdateLicense(true)" (onCanceled)="closeUpdateLicense(false)"></app-update-license>
</div>
</div>
</ng-container>

View File

@ -1,11 +1,11 @@
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise" ngNativeValidate>
<div class="form-group">
<label for="file">{{'licenseFile' | i18n}}</label>
<label for="file" class="sr-only">{{'licenseFile' | i18n}}</label>
<input type="file" id="file" class="form-control-file" name="file" required>
<small class="form-text text-muted">{{'licenseFileDesc' | i18n : (user ? 'bitwarden_premium_license.json' : 'bitwarden_organization_license.json')}}</small>
</div>
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">
<i class="fa fa-spinner fa-spin"></i>
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}"></i>
<span>{{'submit' | i18n}}</span>
</button>
<button type="button" class="btn btn-outline-secondary" (click)="cancel()">

View File

@ -16,7 +16,7 @@ import { I18nService } from 'jslib/abstractions/i18n.service';
templateUrl: 'update-license.component.html',
})
export class UpdateLicenseComponent {
@Input() user = true;
@Input() organizationId: string;
@Output() onUpdated = new EventEmitter();
@Output() onCanceled = new EventEmitter();
@ -38,10 +38,10 @@ export class UpdateLicenseComponent {
const fd = new FormData();
fd.append('license', files[0]);
if (this.user) {
if (this.organizationId == null) {
this.formPromise = this.apiService.postAccountLicense(fd);
} else {
// TODO
this.formPromise = this.apiService.postOrganizationLicenseUpdate(this.organizationId, fd);
}
await this.formPromise;

View File

@ -17,6 +17,10 @@
<span>{{'reinstateSubscription' | i18n}}</span>
</button>
</app-callout>
<dl>
<dt>{{'subscription' | i18n}}</dt>
<dd>{{'premiumMembership' | i18n}}</dd>
</dl>
<dl *ngIf="selfHosted">
<dt>{{'expiration' | i18n}}</dt>
<dd *ngIf="billing.expiration">{{billing.expiration | date:'mediumDate'}}</dd>
@ -64,7 +68,7 @@
<div class="card mt-3" *ngIf="showUpdateLicense">
<div class="card-body">
<h3 class="card-body-header">{{'updateLicense' | i18n}}</h3>
<app-update-license [user]="true" (onUpdated)="closeUpdateLicense(true)" (onCanceled)="closeUpdateLicense(false)"></app-update-license>
<app-update-license (onUpdated)="closeUpdateLicense(true)" (onCanceled)="closeUpdateLicense(false)"></app-update-license>
</div>
</div>
</ng-container>

View File

@ -1020,7 +1020,8 @@
"message": "Enabled"
},
"premium": {
"message": "Premium"
"message": "Premium",
"description": "Premium Membership"
},
"premiumMembership": {
"message": "Premium Membership"
@ -2294,5 +2295,11 @@
},
"updateEncryptionKeyWarning": {
"message": "After updating your encryption key, you are required to log out and back in to all Bitwarden applications that you are currently using (such as the mobile app or browser extensions). Failure to log out and back in (which downloads your new encryption key) may result in data corruption. We will attempt to log you out automatically, however, it may be delayed."
},
"subscription": {
"message": "Subscription"
},
"loading": {
"message": "Loading"
}
}