diff --git a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.html b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.html index f6d7886457..20dc22597f 100644 --- a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.html +++ b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.html @@ -70,8 +70,10 @@ - - {{ productName(i.bitwardenProduct) }} - + + {{ productName(i.bitwardenProduct) }} - {{ i.name }} {{ i.quantity > 1 ? "×" + i.quantity : "" }} @ {{ i.amount | currency : "$" }} diff --git a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts index 7e8fed21d7..ae455e6354 100644 --- a/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts +++ b/apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts @@ -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; } diff --git a/libs/common/src/billing/enums/addon-product-type.enum.ts b/libs/common/src/billing/enums/addon-product-type.enum.ts deleted file mode 100644 index 2e93a10f3e..0000000000 --- a/libs/common/src/billing/enums/addon-product-type.enum.ts +++ /dev/null @@ -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, -} diff --git a/libs/common/src/billing/models/response/subscription.response.ts b/libs/common/src/billing/models/response/subscription.response.ts index 216d33b28f..f966a3e9bf 100644 --- a/libs/common/src/billing/models/response/subscription.response.ts +++ b/libs/common/src/billing/models/response/subscription.response.ts @@ -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"); } }