1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

[PM-17775] Allow admin to send f4 e sponsorship (#14390)

* Added nav item for f4e in org admin console

* shotgun surgery for adding "useAdminSponsoredFamilies" feature from the org table

* Resolved issue with members nav item also being selected when f4e is selected

* Separated out billing's logic from the org layout component

* Removed unused observable

* Moved logic to existing f4e policy service and added unit tests

* Resolved script typescript error

* Resolved goofy switchMap

* Add changes for the issue orgs

* Added changes for the dialog

* Rename the files properly

* Remove the commented code

* Change the implement to align with design

* Add todo comments

* Remove the comment todo

* Fix the uni test error

* Resolve the unit test

* Resolve the unit test issue

* Resolve the pr comments on any and route

* remove the any

* remove the generic validator

* Resolve the unit test

* add validations for email

* Add changes for the autoscale

* Changes to allow admin to send F4E sponsorship

* Fix the lint errors

* Resolve the lint errors

* Fix the revokeAccount message

* Fix the lint runtime error

* Resolve the lint issues

* Remove unused components

* Changes to add isadminInitiated

* remove the FIXME comment

* Resolve the failing test

* Fix the pr comments

* Resolve the orgkey and other comments

* Resolve the lint error

* Resolve the lint error

* resolve the spelling error

* refactor the getStatus method

* Remove the deprecated method

* Resolve the unusual type casting

* revert the change

---------

Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
This commit is contained in:
cyprain-okeke
2025-05-01 16:36:00 +01:00
committed by GitHub
parent 1b66f0f06b
commit a7d04dc212
17 changed files with 491 additions and 322 deletions

View File

@@ -6,5 +6,6 @@ export class OrganizationSponsorshipCreateRequest {
sponsoredEmail: string;
planSponsorshipType: PlanSponsorshipType;
friendlyName: string;
isAdminInitiated?: boolean;
notes?: string;
}

View File

@@ -0,0 +1,8 @@
import { ListResponse } from "../../../models/response/list.response";
import { OrganizationSponsorshipInvitesResponse } from "../../models/response/organization-sponsorship-invites.response";
export abstract class OrganizationSponsorshipApiServiceAbstraction {
abstract getOrganizationSponsorship(
sponsoredOrgId: string,
): Promise<ListResponse<OrganizationSponsorshipInvitesResponse>>;
}

View File

@@ -0,0 +1,31 @@
import { BaseResponse } from "../../../models/response/base.response";
import { PlanSponsorshipType } from "../../enums";
export class OrganizationSponsorshipInvitesResponse extends BaseResponse {
sponsoringOrganizationUserId: string;
friendlyName: string;
offeredToEmail: string;
planSponsorshipType: PlanSponsorshipType;
lastSyncDate?: Date;
validUntil?: Date;
toDelete = false;
isAdminInitiated: boolean;
notes: string;
statusMessage?: string;
statusClass?: string;
constructor(response: any) {
super(response);
this.sponsoringOrganizationUserId = this.getResponseProperty("SponsoringOrganizationUserId");
this.friendlyName = this.getResponseProperty("FriendlyName");
this.offeredToEmail = this.getResponseProperty("OfferedToEmail");
this.planSponsorshipType = this.getResponseProperty("PlanSponsorshipType");
this.lastSyncDate = this.getResponseProperty("LastSyncDate");
this.validUntil = this.getResponseProperty("ValidUntil");
this.toDelete = this.getResponseProperty("ToDelete") ?? false;
this.isAdminInitiated = this.getResponseProperty("IsAdminInitiated");
this.notes = this.getResponseProperty("Notes");
this.statusMessage = this.getResponseProperty("StatusMessage");
this.statusClass = this.getResponseProperty("StatusClass");
}
}

View File

@@ -0,0 +1,22 @@
import { ApiService } from "../../../abstractions/api.service";
import { ListResponse } from "../../../models/response/list.response";
import { OrganizationSponsorshipApiServiceAbstraction } from "../../abstractions/organizations/organization-sponsorship-api.service.abstraction";
import { OrganizationSponsorshipInvitesResponse } from "../../models/response/organization-sponsorship-invites.response";
export class OrganizationSponsorshipApiService
implements OrganizationSponsorshipApiServiceAbstraction
{
constructor(private apiService: ApiService) {}
async getOrganizationSponsorship(
sponsoredOrgId: string,
): Promise<ListResponse<OrganizationSponsorshipInvitesResponse>> {
const r = await this.apiService.send(
"GET",
"/organization/sponsorship/" + sponsoredOrgId + "/sponsored",
null,
true,
true,
);
return new ListResponse(r, OrganizationSponsorshipInvitesResponse);
}
}