don't display free bitwarden families button
This commit is contained in:
parent
d33e049dd0
commit
832564d705
|
@ -38,7 +38,7 @@ export class MoreFromBitwardenPageV2Component {
|
||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
) {
|
) {
|
||||||
this.canAccessPremium$ = billingAccountProfileStateService.hasPremiumFromAnySource$;
|
this.canAccessPremium$ = billingAccountProfileStateService.hasPremiumFromAnySource$;
|
||||||
this.familySponsorshipAvailable$ = this.organizationService.canManageSponsorships$;
|
this.familySponsorshipAvailable$ = this.organizationService.familySponsorshipAvailable$;
|
||||||
}
|
}
|
||||||
|
|
||||||
async openFreeBitwardenFamiliesPage() {
|
async openFreeBitwardenFamiliesPage() {
|
||||||
|
|
|
@ -117,6 +117,10 @@ export abstract class OrganizationService {
|
||||||
* Emits true if the user can create or manage a Free Bitwarden Families sponsorship.
|
* Emits true if the user can create or manage a Free Bitwarden Families sponsorship.
|
||||||
*/
|
*/
|
||||||
canManageSponsorships$: Observable<boolean>;
|
canManageSponsorships$: Observable<boolean>;
|
||||||
|
/**
|
||||||
|
* Emits true if any of the user's organizations have a Free Bitwarden Families sponsorship available.
|
||||||
|
*/
|
||||||
|
familySponsorshipAvailable$: Observable<boolean>;
|
||||||
hasOrganizations: () => Promise<boolean>;
|
hasOrganizations: () => Promise<boolean>;
|
||||||
get$: (id: string) => Observable<Organization | undefined>;
|
get$: (id: string) => Observable<Organization | undefined>;
|
||||||
get: (id: string) => Promise<Organization>;
|
get: (id: string) => Promise<Organization>;
|
||||||
|
|
|
@ -88,6 +88,10 @@ export class OrganizationService implements InternalOrganizationServiceAbstracti
|
||||||
mapToBooleanHasAnyOrganizations(),
|
mapToBooleanHasAnyOrganizations(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
familySponsorshipAvailable$ = this.organizations$.pipe(
|
||||||
|
map((orgs) => orgs.some((o) => o.familySponsorshipAvailable)),
|
||||||
|
);
|
||||||
|
|
||||||
async hasOrganizations(): Promise<boolean> {
|
async hasOrganizations(): Promise<boolean> {
|
||||||
return await firstValueFrom(this.organizations$.pipe(mapToBooleanHasAnyOrganizations()));
|
return await firstValueFrom(this.organizations$.pipe(mapToBooleanHasAnyOrganizations()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue