1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[EC-97] Organization Billing Language / RxJS Warnings (#3688)

* [EC-97] Update copy to use the word members in a few places

* [EC-97] Cleanup RxJS warnings and unused properties in org billing components
This commit is contained in:
Shane Melton
2022-10-07 15:33:47 -07:00
committed by GitHub
parent 4d83b81d82
commit e91106a09f
3 changed files with 57 additions and 35 deletions

View File

@@ -1,5 +1,6 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { concatMap, Subject, takeUntil } from "rxjs";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
import { BillingHistoryResponse } from "@bitwarden/common/models/response/billingHistoryResponse"; import { BillingHistoryResponse } from "@bitwarden/common/models/response/billingHistoryResponse";
@@ -8,25 +9,35 @@ import { BillingHistoryResponse } from "@bitwarden/common/models/response/billin
selector: "app-org-billing-history-view", selector: "app-org-billing-history-view",
templateUrl: "organization-billing-history-view.component.html", templateUrl: "organization-billing-history-view.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil export class OrgBillingHistoryViewComponent implements OnInit, OnDestroy {
export class OrgBillingHistoryViewComponent implements OnInit {
loading = false; loading = false;
firstLoaded = false; firstLoaded = false;
billing: BillingHistoryResponse; billing: BillingHistoryResponse;
organizationId: string; organizationId: string;
private destroy$ = new Subject<void>();
constructor( constructor(
private organizationApiService: OrganizationApiServiceAbstraction, private organizationApiService: OrganizationApiServiceAbstraction,
private route: ActivatedRoute private route: ActivatedRoute
) {} ) {}
async ngOnInit() { async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe this.route.params
this.route.params.subscribe(async (params) => { .pipe(
this.organizationId = params.organizationId; concatMap(async (params) => {
await this.load(); this.organizationId = params.organizationId;
this.firstLoaded = true; await this.load();
}); this.firstLoaded = true;
}),
takeUntil(this.destroy$)
)
.subscribe();
}
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
} }
async load() { async load() {

View File

@@ -1,5 +1,6 @@
import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core"; import { Component, OnDestroy, OnInit, ViewChild, ViewContainerRef } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { concatMap, Subject, takeUntil } from "rxjs";
import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref"; import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref";
import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ModalService } from "@bitwarden/angular/services/modal.service";
@@ -26,17 +27,13 @@ import { BillingSyncApiKeyComponent } from "./billing-sync-api-key.component";
selector: "app-org-subscription", selector: "app-org-subscription",
templateUrl: "organization-subscription.component.html", templateUrl: "organization-subscription.component.html",
}) })
// eslint-disable-next-line rxjs-angular/prefer-takeuntil export class OrganizationSubscriptionComponent implements OnInit, OnDestroy {
export class OrganizationSubscriptionComponent implements OnInit {
@ViewChild("setupBillingSyncTemplate", { read: ViewContainerRef, static: true }) @ViewChild("setupBillingSyncTemplate", { read: ViewContainerRef, static: true })
setupBillingSyncModalRef: ViewContainerRef; setupBillingSyncModalRef: ViewContainerRef;
loading = false; loading = false;
firstLoaded = false; firstLoaded = false;
organizationId: string; organizationId: string;
adjustSeatsAdd = true;
showAdjustSeats = false;
showAdjustSeatAutoscale = false;
adjustStorageAdd = true; adjustStorageAdd = true;
showAdjustStorage = false; showAdjustStorage = false;
showUpdateLicense = false; showUpdateLicense = false;
@@ -58,6 +55,8 @@ export class OrganizationSubscriptionComponent implements OnInit {
billingSyncKeyViewContainerRef: ViewContainerRef; billingSyncKeyViewContainerRef: ViewContainerRef;
billingSyncKeyRef: [ModalRef, BillingSyncKeyComponent]; billingSyncKeyRef: [ModalRef, BillingSyncKeyComponent];
private destroy$ = new Subject<void>();
constructor( constructor(
private apiService: ApiService, private apiService: ApiService,
private platformUtilsService: PlatformUtilsService, private platformUtilsService: PlatformUtilsService,
@@ -73,19 +72,27 @@ export class OrganizationSubscriptionComponent implements OnInit {
} }
async ngOnInit() { async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe this.route.params
this.route.parent.parent.params.subscribe(async (params) => { .pipe(
this.organizationId = params.organizationId; concatMap(async (params) => {
await this.load(); this.organizationId = params.organizationId;
this.firstLoaded = true; await this.load();
}); this.firstLoaded = true;
}),
takeUntil(this.destroy$)
)
.subscribe();
}
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
} }
async load() { async load() {
if (this.loading) { if (this.loading) {
return; return;
} }
this.loading = true; this.loading = true;
this.userOrg = this.organizationService.get(this.organizationId); this.userOrg = this.organizationService.get(this.organizationId);
if (this.userOrg.canManageBilling) { if (this.userOrg.canManageBilling) {
@@ -172,7 +179,7 @@ export class OrganizationSubscriptionComponent implements OnInit {
this.showChangePlan = !this.showChangePlan; this.showChangePlan = !this.showChangePlan;
} }
closeChangePlan(changed: boolean) { closeChangePlan() {
this.showChangePlan = false; this.showChangePlan = false;
} }
@@ -189,10 +196,14 @@ export class OrganizationSubscriptionComponent implements OnInit {
comp.hasBillingToken = this.hasBillingSyncToken; comp.hasBillingToken = this.hasBillingSyncToken;
} }
); );
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe ref.onClosed
ref.onClosed.subscribe(async () => { .pipe(
await this.load(); concatMap(async () => {
}); await this.load();
}),
takeUntil(this.destroy$)
)
.subscribe();
} }
closeDownloadLicense() { closeDownloadLicense() {

View File

@@ -3144,7 +3144,7 @@
"message": "Enter your installation id" "message": "Enter your installation id"
}, },
"limitSubscriptionDesc": { "limitSubscriptionDesc": {
"message": "Set a seat limit for your subscription. Once this limit is reached, you will not be able to invite new users." "message": "Set a seat limit for your subscription. Once this limit is reached, you will not be able to invite new members."
}, },
"maxSeatLimit": { "maxSeatLimit": {
"message": "Maximum Seat Limit (optional)", "message": "Maximum Seat Limit (optional)",
@@ -3165,7 +3165,7 @@
"message": "Adjustments to your subscription will result in prorated changes to your billing totals. If newly invited users exceed your subscription seats, you will immediately receive a prorated charge for the additional users." "message": "Adjustments to your subscription will result in prorated changes to your billing totals. If newly invited users exceed your subscription seats, you will immediately receive a prorated charge for the additional users."
}, },
"subscriptionUserSeats": { "subscriptionUserSeats": {
"message": "Your subscription allows for a total of $COUNT$ users.", "message": "Your subscription allows for a total of $COUNT$ members.",
"placeholders": { "placeholders": {
"count": { "count": {
"content": "$1", "content": "$1",
@@ -3189,10 +3189,10 @@
"message": "For additional help in managing your subscription, please contact Customer Support." "message": "For additional help in managing your subscription, please contact Customer Support."
}, },
"subscriptionUserSeatsUnlimitedAutoscale": { "subscriptionUserSeatsUnlimitedAutoscale": {
"message": "Adjustments to your subscription will result in prorated changes to your billing totals. If newly invited users exceed your subscription seats, you will immediately receive a prorated charge for the additional users." "message": "Adjustments to your subscription will result in prorated changes to your billing totals. If newly invited members exceed your subscription seats, you will immediately receive a prorated charge for the additional members."
}, },
"subscriptionUserSeatsLimitedAutoscale": { "subscriptionUserSeatsLimitedAutoscale": {
"message": "Adjustments to your subscription will result in prorated changes to your billing totals. If newly invited users exceed your subscription seats, you will immediately receive a prorated charge for the additional users until your $MAX$ seat limit is reached.", "message": "Adjustments to your subscription will result in prorated changes to your billing totals. If newly invited members exceed your subscription seats, you will immediately receive a prorated charge for the additional members until your $MAX$ seat limit is reached.",
"placeholders": { "placeholders": {
"max": { "max": {
"content": "$1", "content": "$1",
@@ -3201,7 +3201,7 @@
} }
}, },
"subscriptionFreePlan": { "subscriptionFreePlan": {
"message": "You cannot invite more than $COUNT$ users without upgrading your plan.", "message": "You cannot invite more than $COUNT$ members without upgrading your plan.",
"placeholders": { "placeholders": {
"count": { "count": {
"content": "$1", "content": "$1",
@@ -3210,7 +3210,7 @@
} }
}, },
"subscriptionFamiliesPlan": { "subscriptionFamiliesPlan": {
"message": "You cannot invite more than $COUNT$ users without upgrading your plan. Please contact Customer Support to upgrade.", "message": "You cannot invite more than $COUNT$ members without upgrading your plan. Please contact Customer Support to upgrade.",
"placeholders": { "placeholders": {
"count": { "count": {
"content": "$1", "content": "$1",
@@ -3219,7 +3219,7 @@
} }
}, },
"subscriptionSponsoredFamiliesPlan": { "subscriptionSponsoredFamiliesPlan": {
"message": "Your subscription allows for a total of $COUNT$ users. Your plan is sponsored and billed to an external organization.", "message": "Your subscription allows for a total of $COUNT$ members. Your plan is sponsored and billed to an external organization.",
"placeholders": { "placeholders": {
"count": { "count": {
"content": "$1", "content": "$1",
@@ -3228,7 +3228,7 @@
} }
}, },
"subscriptionMaxReached": { "subscriptionMaxReached": {
"message": "Adjustments to your subscription will result in prorated changes to your billing totals. You cannot invite more than $COUNT$ users without increasing your subscription seats.", "message": "Adjustments to your subscription will result in prorated changes to your billing totals. You cannot invite more than $COUNT$ members without increasing your subscription seats.",
"placeholders": { "placeholders": {
"count": { "count": {
"content": "$1", "content": "$1",