mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
[AC-1423] Update Organization subscription line items
- Add product type prefix - Indent addon services like additional storage and service accounts - Show line items for free plans
This commit is contained in:
@@ -63,17 +63,36 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
</dl>
|
</dl>
|
||||||
<ng-container *ngIf="userOrg.canEditSubscription">
|
<ng-container *ngIf="userOrg.canEditSubscription">
|
||||||
<div class="tw-flex-col" *ngIf="subscription">
|
<div class="tw-mb-7 tw-flex-col">
|
||||||
<strong class="tw-mb-1 tw-block">{{ "details" | i18n }}</strong>
|
<strong class="tw-block tw-border-0 tw-border-b tw-border-solid tw-border-secondary-300">{{
|
||||||
|
"details" | i18n
|
||||||
|
}}</strong>
|
||||||
<bit-table>
|
<bit-table>
|
||||||
<ng-template body>
|
<ng-template body>
|
||||||
<tr bitRow *ngFor="let i of subscription.items">
|
<ng-container *ngIf="subscription">
|
||||||
<td bitCell>
|
<tr bitRow *ngFor="let i of lineItems">
|
||||||
|
<td bitCell [ngClass]="{ 'tw-pl-20': i.addonSubscriptionItem }">
|
||||||
|
<span *ngIf="!i.addonSubscriptionItem"
|
||||||
|
>{{ productName(i.bitwardenProduct) }} -</span
|
||||||
|
>
|
||||||
{{ i.name }} {{ i.quantity > 1 ? "×" + i.quantity : "" }} @
|
{{ i.name }} {{ i.quantity > 1 ? "×" + i.quantity : "" }} @
|
||||||
{{ i.amount | currency : "$" }}
|
{{ i.amount | currency : "$" }}
|
||||||
</td>
|
</td>
|
||||||
<td bitCell>{{ i.quantity * i.amount | currency : "$" }} /{{ i.interval | i18n }}</td>
|
<td bitCell class="tw-text-right">
|
||||||
|
{{ i.quantity * i.amount | currency : "$" }} /{{ i.interval | i18n }}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="!subscription && userOrg.isFreeOrg">
|
||||||
|
<tr bitRow *ngIf="userOrg.usePasswordManager">
|
||||||
|
<td bitCell>{{ "passwordManager" | i18n }} - {{ "freeOrganization" | i18n }}</td>
|
||||||
|
<td bitCell class="tw-text-right">{{ "free" | i18n }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr bitRow *ngIf="userOrg.useSecretsManager">
|
||||||
|
<td bitCell>{{ "secretsManager" | i18n }} - {{ "freeOrganization" | i18n }}</td>
|
||||||
|
<td bitCell class="tw-text-right">{{ "free" | i18n }}</td>
|
||||||
|
</tr>
|
||||||
|
</ng-container>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</bit-table>
|
</bit-table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
|
|||||||
import { OrganizationApiKeyType } from "@bitwarden/common/admin-console/enums";
|
import { OrganizationApiKeyType } from "@bitwarden/common/admin-console/enums";
|
||||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||||
import { PlanType } from "@bitwarden/common/billing/enums";
|
import { PlanType } from "@bitwarden/common/billing/enums";
|
||||||
|
import { BitwardenProductType } from "@bitwarden/common/billing/enums/bitwarden-product-type.enum";
|
||||||
import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response";
|
import { OrganizationSubscriptionResponse } from "@bitwarden/common/billing/models/response/organization-subscription.response";
|
||||||
|
import { BillingSubscriptionItemResponse } from "@bitwarden/common/billing/models/response/subscription.response";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
@@ -26,6 +28,7 @@ import {
|
|||||||
})
|
})
|
||||||
export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy {
|
export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy {
|
||||||
sub: OrganizationSubscriptionResponse;
|
sub: OrganizationSubscriptionResponse;
|
||||||
|
lineItems: BillingSubscriptionItemResponse[] = [];
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
userOrg: Organization;
|
userOrg: Organization;
|
||||||
showChangePlan = false;
|
showChangePlan = false;
|
||||||
@@ -68,6 +71,15 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
|||||||
.subscribe();
|
.subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
productName(product: BitwardenProductType) {
|
||||||
|
switch (product) {
|
||||||
|
case BitwardenProductType.PasswordManager:
|
||||||
|
return this.i18nService.t("passwordManager");
|
||||||
|
case BitwardenProductType.SecretsManager:
|
||||||
|
return this.i18nService.t("secretsManager");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.destroy$.next();
|
this.destroy$.next();
|
||||||
this.destroy$.complete();
|
this.destroy$.complete();
|
||||||
@@ -81,6 +93,7 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
|||||||
this.userOrg = this.organizationService.get(this.organizationId);
|
this.userOrg = this.organizationService.get(this.organizationId);
|
||||||
if (this.userOrg.canViewSubscription) {
|
if (this.userOrg.canViewSubscription) {
|
||||||
this.sub = await this.organizationApiService.getSubscription(this.organizationId);
|
this.sub = await this.organizationApiService.getSubscription(this.organizationId);
|
||||||
|
this.lineItems = this.sub?.subscription?.items?.sort(sortSubscriptionItems) ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiKeyResponse = await this.organizationApiService.getApiKeyInformation(
|
const apiKeyResponse = await this.organizationApiService.getApiKeyInformation(
|
||||||
@@ -332,3 +345,21 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
|||||||
return this.subscription == null && this.sub.planType === PlanType.Free && !this.showChangePlan;
|
return this.subscription == null && this.sub.planType === PlanType.Free && !this.showChangePlan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to sort subscription items by product type and then by addon status
|
||||||
|
*/
|
||||||
|
function sortSubscriptionItems(
|
||||||
|
a: BillingSubscriptionItemResponse,
|
||||||
|
b: BillingSubscriptionItemResponse
|
||||||
|
) {
|
||||||
|
if (a.bitwardenProduct == b.bitwardenProduct) {
|
||||||
|
// sort addon items to the bottom
|
||||||
|
return a.addonSubscriptionItem == b.addonSubscriptionItem
|
||||||
|
? 0
|
||||||
|
: a.addonSubscriptionItem
|
||||||
|
? 1
|
||||||
|
: -1;
|
||||||
|
}
|
||||||
|
return a.bitwardenProduct - b.bitwardenProduct;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6610,6 +6610,9 @@
|
|||||||
"changeKdfLoggedOutWarning": {
|
"changeKdfLoggedOutWarning": {
|
||||||
"message": "Proceeding will log you out of all active sessions. You will need to log back in and complete two-step login setup. We recommend exporting your vault before changing your encryption settings to prevent data loss."
|
"message": "Proceeding will log you out of all active sessions. You will need to log back in and complete two-step login setup. We recommend exporting your vault before changing your encryption settings to prevent data loss."
|
||||||
},
|
},
|
||||||
|
"secretsManager": {
|
||||||
|
"message": "Secrets Manager"
|
||||||
|
},
|
||||||
"secretsManagerBeta": {
|
"secretsManagerBeta": {
|
||||||
"message": "Secrets Manager Beta"
|
"message": "Secrets Manager Beta"
|
||||||
},
|
},
|
||||||
@@ -6847,5 +6850,8 @@
|
|||||||
},
|
},
|
||||||
"passwordManager": {
|
"passwordManager": {
|
||||||
"message": "Password Manager"
|
"message": "Password Manager"
|
||||||
|
},
|
||||||
|
"freeOrganization": {
|
||||||
|
"message": "Free Organization"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { BaseResponse } from "../../../models/response/base.response";
|
import { BaseResponse } from "../../../models/response/base.response";
|
||||||
|
import { BitwardenProductType } from "../../enums/bitwarden-product-type.enum";
|
||||||
|
|
||||||
export class SubscriptionResponse extends BaseResponse {
|
export class SubscriptionResponse extends BaseResponse {
|
||||||
storageName: string;
|
storageName: string;
|
||||||
@@ -62,6 +63,8 @@ export class BillingSubscriptionItemResponse extends BaseResponse {
|
|||||||
quantity: number;
|
quantity: number;
|
||||||
interval: string;
|
interval: string;
|
||||||
sponsoredSubscriptionItem: boolean;
|
sponsoredSubscriptionItem: boolean;
|
||||||
|
addonSubscriptionItem: boolean;
|
||||||
|
bitwardenProduct: BitwardenProductType;
|
||||||
|
|
||||||
constructor(response: any) {
|
constructor(response: any) {
|
||||||
super(response);
|
super(response);
|
||||||
@@ -70,6 +73,8 @@ export class BillingSubscriptionItemResponse extends BaseResponse {
|
|||||||
this.quantity = this.getResponseProperty("Quantity");
|
this.quantity = this.getResponseProperty("Quantity");
|
||||||
this.interval = this.getResponseProperty("Interval");
|
this.interval = this.getResponseProperty("Interval");
|
||||||
this.sponsoredSubscriptionItem = this.getResponseProperty("SponsoredSubscriptionItem");
|
this.sponsoredSubscriptionItem = this.getResponseProperty("SponsoredSubscriptionItem");
|
||||||
|
this.addonSubscriptionItem = this.getResponseProperty("AddonSubscriptionItem");
|
||||||
|
this.bitwardenProduct = this.getResponseProperty("BitwardenProduct");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user