mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-02 13:23:29 +01:00
Revert "[AC-1423] Switch to AddonProductType enum instead of boolean"
This reverts commit 204f64b4e7
.
This commit is contained in:
parent
204f64b4e7
commit
6dd1616b5a
@ -70,8 +70,10 @@
|
||||
<ng-template body>
|
||||
<ng-container *ngIf="subscription">
|
||||
<tr bitRow *ngFor="let i of lineItems">
|
||||
<td bitCell [ngClass]="{ 'tw-pl-20': i.addonProduct != null }">
|
||||
<span *ngIf="i.addonProduct == null">{{ productName(i.bitwardenProduct) }} -</span>
|
||||
<td bitCell [ngClass]="{ 'tw-pl-20': i.addonSubscriptionItem }">
|
||||
<span *ngIf="!i.addonSubscriptionItem"
|
||||
>{{ productName(i.bitwardenProduct) }} -</span
|
||||
>
|
||||
{{ i.name }} {{ i.quantity > 1 ? "×" + i.quantity : "" }} @
|
||||
{{ i.amount | currency : "$" }}
|
||||
</td>
|
||||
|
@ -349,25 +349,22 @@ export class OrganizationSubscriptionCloudComponent implements OnInit, OnDestroy
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to sort subscription items by product type and then by addon product type
|
||||
* Helper to sort subscription items by product type and then by addon status
|
||||
*/
|
||||
function sortSubscriptionItems(
|
||||
a: BillingSubscriptionItemResponse,
|
||||
b: BillingSubscriptionItemResponse
|
||||
) {
|
||||
if (a.bitwardenProduct == b.bitwardenProduct) {
|
||||
// Both are addon products, sort by enum value
|
||||
if (a.addonProduct != null && b.addonProduct != null) {
|
||||
return a.addonProduct - b.addonProduct;
|
||||
// sort addon items to the bottom
|
||||
if (a.addonSubscriptionItem == b.addonSubscriptionItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 'a' is not an addon product, sort it to the bottom
|
||||
if (a.addonProduct == null) {
|
||||
return -1;
|
||||
if (a.addonSubscriptionItem) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 'a' is an addon product, sort it to the top
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
return a.bitwardenProduct - b.bitwardenProduct;
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Used to identify the various types of "addon" products that can be added
|
||||
* to an existing product subscription.
|
||||
*/
|
||||
export enum AddonProductType {
|
||||
PasswordManager_Storage = 0,
|
||||
SecretsManager_ServiceAccounts = 1,
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
import { BaseResponse } from "../../../models/response/base.response";
|
||||
import { AddonProductType } from "../../enums/addon-product-type.enum";
|
||||
import { BitwardenProductType } from "../../enums/bitwarden-product-type.enum";
|
||||
|
||||
export class SubscriptionResponse extends BaseResponse {
|
||||
@ -64,7 +63,7 @@ export class BillingSubscriptionItemResponse extends BaseResponse {
|
||||
quantity: number;
|
||||
interval: string;
|
||||
sponsoredSubscriptionItem: boolean;
|
||||
addonProduct?: AddonProductType;
|
||||
addonSubscriptionItem: boolean;
|
||||
bitwardenProduct: BitwardenProductType;
|
||||
|
||||
constructor(response: any) {
|
||||
@ -74,7 +73,7 @@ export class BillingSubscriptionItemResponse extends BaseResponse {
|
||||
this.quantity = this.getResponseProperty("Quantity");
|
||||
this.interval = this.getResponseProperty("Interval");
|
||||
this.sponsoredSubscriptionItem = this.getResponseProperty("SponsoredSubscriptionItem");
|
||||
this.addonProduct = this.getResponseProperty("AddonProduct");
|
||||
this.addonSubscriptionItem = this.getResponseProperty("AddonSubscriptionItem");
|
||||
this.bitwardenProduct = this.getResponseProperty("BitwardenProduct");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user