1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +00:00

Revert "[AC-1423] Switch to AddonProductType enum instead of boolean"

This reverts commit 204f64b4e7.
This commit is contained in:
Shane Melton
2023-06-22 09:08:31 -07:00
parent 204f64b4e7
commit 6dd1616b5a
4 changed files with 13 additions and 23 deletions

View File

@@ -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 ? "&times;" + i.quantity : "" }} @
{{ i.amount | currency : "$" }}
</td>

View File

@@ -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;
}