Skip to content

Commit

Permalink
don't display free bitwarden families button
Browse files Browse the repository at this point in the history
  • Loading branch information
jaasen-livefront committed Sep 20, 2024
1 parent 9a89ef9 commit b11f5a7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class MoreFromBitwardenPageV2Component {
private organizationService: OrganizationService,
) {
this.canAccessPremium$ = billingAccountProfileStateService.hasPremiumFromAnySource$;
this.familySponsorshipAvailable$ = this.organizationService.canManageSponsorships$;
this.familySponsorshipAvailable$ = this.organizationService.familySponsorshipAvailable$;

Check warning on line 41 in apps/browser/src/tools/popup/settings/about-page/more-from-bitwarden-page-v2.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/tools/popup/settings/about-page/more-from-bitwarden-page-v2.component.ts#L41

Added line #L41 was not covered by tests
}

async openFreeBitwardenFamiliesPage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export abstract class OrganizationService {
* Emits true if the user can create or manage a Free Bitwarden Families sponsorship.
*/
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>;
get$: (id: string) => Observable<Organization | undefined>;
get: (id: string) => Promise<Organization>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export class OrganizationService implements InternalOrganizationServiceAbstracti
mapToBooleanHasAnyOrganizations(),
);

familySponsorshipAvailable$ = this.organizations$.pipe(
map((orgs) => orgs.some((o) => o.familySponsorshipAvailable)),

Check warning on line 92 in libs/common/src/admin-console/services/organization/organization.service.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/admin-console/services/organization/organization.service.ts#L92

Added line #L92 was not covered by tests
);

async hasOrganizations(): Promise<boolean> {
return await firstValueFrom(this.organizations$.pipe(mapToBooleanHasAnyOrganizations()));
}
Expand Down

0 comments on commit b11f5a7

Please sign in to comment.