1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

[PM-11631] - hide free Bitwarden Families button if user is not eligible (#10971)

* hide  Free Bitwarden Families button if user is not eligible

* use organizationService.canManageSponsorships$ for determining if free bitwarden families is available

* update comment
This commit is contained in:
Jordan Aasen 2024-09-12 18:58:18 -07:00 committed by GitHub
parent bd3863c313
commit 023912c53d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -12,7 +12,7 @@
<i slot="end" class="bwi bwi-angle-right" aria-hidden="true"></i>
</a>
</bit-item>
<bit-item>
<bit-item *ngIf="familySponsorshipAvailable$ | async">
<button type="button" bit-item-content (click)="openFreeBitwardenFamiliesPage()">
{{ "freeBitwardenFamilies" | i18n }}
<i slot="end" class="bwi bwi-external-link" aria-hidden="true"></i>

View File

@ -4,6 +4,7 @@ import { RouterModule } from "@angular/router";
import { Observable, firstValueFrom } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { DialogService, ItemModule } from "@bitwarden/components";
@ -28,13 +29,16 @@ import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page
})
export class MoreFromBitwardenPageV2Component {
canAccessPremium$: Observable<boolean>;
protected familySponsorshipAvailable$: Observable<boolean>;
constructor(
private dialogService: DialogService,
billingAccountProfileStateService: BillingAccountProfileStateService,
private environmentService: EnvironmentService,
private organizationService: OrganizationService,
) {
this.canAccessPremium$ = billingAccountProfileStateService.hasPremiumFromAnySource$;
this.familySponsorshipAvailable$ = this.organizationService.canManageSponsorships$;
}
async openFreeBitwardenFamiliesPage() {

View File

@ -113,6 +113,9 @@ export abstract class OrganizationService {
* https://bitwarden.atlassian.net/browse/AC-2252.
*/
getFromState: (id: string) => Promise<Organization>;
/**
* Emits true if the user can create or manage a Free Bitwarden Families sponsorship.
*/
canManageSponsorships$: Observable<boolean>;
hasOrganizations: () => Promise<boolean>;
get$: (id: string) => Observable<Organization | undefined>;