1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +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

@@ -24,6 +24,7 @@ import {
} from "../admin-console/models/response/organization-connection.response";
import { OrganizationExportResponse } from "../admin-console/models/response/organization-export.response";
import { OrganizationSponsorshipSyncStatusResponse } from "../admin-console/models/response/organization-sponsorship-sync-status.response";
import { PreValidateSponsorshipResponse } from "../admin-console/models/response/pre-validate-sponsorship.response";
import {
ProviderOrganizationOrganizationDetailsResponse,
ProviderOrganizationResponse,
@@ -490,7 +491,9 @@ export abstract class ApiService {
) => Promise<OrganizationSponsorshipSyncStatusResponse>;
deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise<void>;
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
postPreValidateSponsorshipToken: (sponsorshipToken: string) => Promise<boolean>;
postPreValidateSponsorshipToken: (
sponsorshipToken: string,
) => Promise<PreValidateSponsorshipResponse>;
postRedeemSponsorship: (
sponsorshipToken: string,
request: OrganizationSponsorshipRedeemRequest,

View File

@@ -12,4 +12,5 @@ export enum PolicyType {
DisablePersonalVaultExport = 10, // Disable personal vault export
ActivateAutofill = 11, // Activates autofill with page load on the browser extension
AutomaticAppLogIn = 12, // Enables automatic log in of apps from configured identity provider
FreeFamiliesSponsorshipPolicy = 13, // Disables free families plan for organization
}

View File

@@ -0,0 +1,10 @@
import { BaseResponse } from "../../../models/response/base.response";
export class OrganizationSponsorshipResponse extends BaseResponse {
isPolicyEnabled: string;
constructor(response: any) {
super(response);
this.isPolicyEnabled = this.getResponseProperty("IsPolicyEnabled");
}
}

View File

@@ -0,0 +1,12 @@
import { BaseResponse } from "../../../models/response/base.response";
export class PreValidateSponsorshipResponse extends BaseResponse {
isTokenValid: boolean;
isFreeFamilyPolicyEnabled: boolean;
constructor(response: any) {
super(response);
this.isTokenValid = this.getResponseProperty("IsTokenValid");
this.isFreeFamilyPolicyEnabled = this.getResponseProperty("IsFreeFamilyPolicyEnabled");
}
}

View File

@@ -39,6 +39,7 @@ export enum FeatureFlag {
SecurityTasks = "security-tasks",
NewDeviceVerificationTemporaryDismiss = "new-device-temporary-dismiss",
NewDeviceVerificationPermanentDismiss = "new-device-permanent-dismiss",
DisableFreeFamiliesSponsorship = "PM-12274-disable-free-families-sponsorship",
}
export type AllowedFeatureFlagTypes = boolean | number | string;
@@ -88,6 +89,7 @@ export const DefaultFeatureFlagValue = {
[FeatureFlag.SecurityTasks]: FALSE,
[FeatureFlag.NewDeviceVerificationTemporaryDismiss]: FALSE,
[FeatureFlag.NewDeviceVerificationPermanentDismiss]: FALSE,
[FeatureFlag.DisableFreeFamiliesSponsorship]: FALSE,
} satisfies Record<FeatureFlag, AllowedFeatureFlagTypes>;
export type DefaultFeatureFlagValueType = typeof DefaultFeatureFlagValue;

View File

@@ -29,6 +29,7 @@ import {
} from "../admin-console/models/response/organization-connection.response";
import { OrganizationExportResponse } from "../admin-console/models/response/organization-export.response";
import { OrganizationSponsorshipSyncStatusResponse } from "../admin-console/models/response/organization-sponsorship-sync-status.response";
import { PreValidateSponsorshipResponse } from "../admin-console/models/response/pre-validate-sponsorship.response";
import {
ProviderOrganizationOrganizationDetailsResponse,
ProviderOrganizationResponse,
@@ -1680,8 +1681,10 @@ export class ApiService implements ApiServiceAbstraction {
);
}
async postPreValidateSponsorshipToken(sponsorshipToken: string): Promise<boolean> {
const r = await this.send(
async postPreValidateSponsorshipToken(
sponsorshipToken: string,
): Promise<PreValidateSponsorshipResponse> {
const response = await this.send(
"POST",
"/organization/sponsorship/validate-token?sponsorshipToken=" +
encodeURIComponent(sponsorshipToken),
@@ -1689,7 +1692,8 @@ export class ApiService implements ApiServiceAbstraction {
true,
true,
);
return r as boolean;
return new PreValidateSponsorshipResponse(response);
}
async postRedeemSponsorship(