1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-11 10:10:25 +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> <i slot="end" class="bwi bwi-angle-right" aria-hidden="true"></i>
</a> </a>
</bit-item> </bit-item>
<bit-item> <bit-item *ngIf="familySponsorshipAvailable$ | async">
<button type="button" bit-item-content (click)="openFreeBitwardenFamiliesPage()"> <button type="button" bit-item-content (click)="openFreeBitwardenFamiliesPage()">
{{ "freeBitwardenFamilies" | i18n }} {{ "freeBitwardenFamilies" | i18n }}
<i slot="end" class="bwi bwi-external-link" aria-hidden="true"></i> <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 { Observable, firstValueFrom } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module"; 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 { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { DialogService, ItemModule } from "@bitwarden/components"; import { DialogService, ItemModule } from "@bitwarden/components";
@ -28,13 +29,16 @@ import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page
}) })
export class MoreFromBitwardenPageV2Component { export class MoreFromBitwardenPageV2Component {
canAccessPremium$: Observable<boolean>; canAccessPremium$: Observable<boolean>;
protected familySponsorshipAvailable$: Observable<boolean>;
constructor( constructor(
private dialogService: DialogService, private dialogService: DialogService,
billingAccountProfileStateService: BillingAccountProfileStateService, billingAccountProfileStateService: BillingAccountProfileStateService,
private environmentService: EnvironmentService, private environmentService: EnvironmentService,
private organizationService: OrganizationService,
) { ) {
this.canAccessPremium$ = billingAccountProfileStateService.hasPremiumFromAnySource$; this.canAccessPremium$ = billingAccountProfileStateService.hasPremiumFromAnySource$;
this.familySponsorshipAvailable$ = this.organizationService.canManageSponsorships$;
} }
async openFreeBitwardenFamiliesPage() { async openFreeBitwardenFamiliesPage() {

View File

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