1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

[PM-13345]Add the new policy (#11894)

* Add the new policy

* Add the free family policy behind flag

* Patch build process

* Revert "Patch build process"

This reverts commit 4024e974b1.

* [PM-13346] Email notification impacts (#11967)

* Changes error notification for disabled offer

* Add the feature to the change

* Add the missing dot

* Remove the authenicated endpoint

* Add the changes for error toast

* Resolve the lint issue

* rename file a correctly

* Remove the floating promise comments

* Delete unwanted comments

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
cyprain-okeke
2024-11-19 17:36:52 +01:00
committed by GitHub
parent 0386b7f068
commit c17f582768
13 changed files with 110 additions and 13 deletions

View File

@@ -1,7 +1,12 @@
import { Component } from "@angular/core";
import { Component, inject } from "@angular/core";
import { Params } from "@angular/router";
import { firstValueFrom } from "rxjs";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
import { OrganizationSponsorshipResponse } from "@bitwarden/common/admin-console/models/response/organization-sponsorship.response";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { ToastService } from "@bitwarden/components";
import { BaseAcceptComponent } from "../../../common/base.accept.component";
/*
@@ -19,17 +24,18 @@ export class AcceptFamilySponsorshipComponent extends BaseAcceptComponent {
requiredParameters = ["email", "token"];
policyResponse!: OrganizationSponsorshipResponse;
policyApiService = inject(PolicyApiServiceAbstraction);
configService = inject(ConfigService);
toastService = inject(ToastService);
async authedHandler(qParams: Params) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.router.navigate(["/setup/families-for-enterprise"], { queryParams: qParams });
await this.router.navigate(["/setup/families-for-enterprise"], { queryParams: qParams });
}
async unauthedHandler(qParams: Params) {
if (!qParams.register) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.router.navigate(["/login"], { queryParams: { email: qParams.email } });
await this.router.navigate(["/login"], { queryParams: { email: qParams.email } });
} else {
// TODO: update logic when email verification flag is removed
let queryParams: Params;

View File

@@ -9,6 +9,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
import { OrganizationUserType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { OrganizationSponsorshipRedeemRequest } from "@bitwarden/common/admin-console/models/request/organization/organization-sponsorship-redeem.request";
import { PreValidateSponsorshipResponse } from "@bitwarden/common/admin-console/models/response/pre-validate-sponsorship.response";
import { PlanSponsorshipType, PlanType, ProductTierType } from "@bitwarden/common/billing/enums";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
@@ -51,6 +52,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
showNewOrganization = false;
_organizationPlansComponent: OrganizationPlansComponent;
preValidateSponsorshipResponse: PreValidateSponsorshipResponse;
_selectedFamilyOrganizationId = "";
private _destroy = new Subject<void>();
@@ -92,7 +94,20 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
this.token = qParams.token;
await this.syncService.fullSync(true);
this.badToken = !(await this.apiService.postPreValidateSponsorshipToken(this.token));
this.preValidateSponsorshipResponse = await this.apiService.postPreValidateSponsorshipToken(
this.token,
);
if (this.preValidateSponsorshipResponse.isFreeFamilyPolicyEnabled) {
this.toastService.showToast({
variant: "error",
title: this.i18nService.t("errorOccured"),
message: this.i18nService.t("offerNoLongerValid"),
});
} else {
this.badToken = !this.preValidateSponsorshipResponse.isTokenValid;
}
this.loading = false;
});

View File

@@ -6376,6 +6376,9 @@
"idpSingleSignOnServiceUrlRequired": {
"message": "Required if Entity ID is not a URL."
},
"offerNoLongerValid": {
"message": "This offer is no longer valid. Contact your organization administrators for more information."
},
"openIdOptionalCustomizations": {
"message": "Optional customizations"
},
@@ -9727,5 +9730,11 @@
},
"deletedSuccessfully": {
"message": "Deleted successfully"
},
"freeFamiliesSponsorship": {
"message": "Remove Free Bitwarden Families sponsorship"
},
"freeFamiliesSponsorshipPolicyDesc": {
"message": "Do not allow members to redeem a Families plan through this organization."
}
}