-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AC-1708] Teams Starter Plan (#6740)
* Added support for the teams starter plan * Plans now respect display sort order. Updated teams starter to be in its own product * Remove upgrade button and show new copy instead -- wip copy * Added upgrade dialog for teams starter plan when adding an 11th user * Updated the add user validator to check if plan is teams starter. Updated to not count duplicated emails in the overall count * Renamed validator to be more descriptive and added additional unit tests * Added validator for org types that require customer support to upgrade * Updated small localization for teams plan to account for new starter plan * Removed invalid tests * Resolved issues around free trial flow for teams starter * Added new layout for teams starter free trial flow * Updated copy following demo. Resolved display issues discovered during demo * Removed temporary copy for testing * Updated the second step of free trial flow to use org display name * Updated invite user modal to display 10 instead of 20 as the invite limit for Teams Starter --------- Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com>
- Loading branch information
1 parent
197059d
commit 9f5226f
Showing
25 changed files
with
417 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...og/validators/org-without-additional-seat-limit-reached-without-upgrade-path.validator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms"; | ||
|
||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; | ||
import { ProductType } from "@bitwarden/common/enums"; | ||
|
||
/** | ||
* If the organization doesn't allow additional seat options, this checks if the seat limit has been reached when adding | ||
* new users | ||
* @param organization An object representing the organization | ||
* @param allOrganizationUserEmails An array of strings with existing user email addresses | ||
* @param errorMessage A localized string to display if validation fails | ||
* @returns A function that validates an `AbstractControl` and returns `ValidationErrors` or `null` | ||
*/ | ||
export function orgWithoutAdditionalSeatLimitReachedWithoutUpgradePathValidator( | ||
organization: Organization, | ||
allOrganizationUserEmails: string[], | ||
errorMessage: string | ||
): ValidatorFn { | ||
return (control: AbstractControl): ValidationErrors | null => { | ||
if (control.value === "" || !control.value) { | ||
return null; | ||
} | ||
|
||
const newEmailsToAdd = Array.from( | ||
new Set( | ||
control.value | ||
.split(",") | ||
.filter( | ||
(newEmailToAdd: string) => | ||
newEmailToAdd && | ||
newEmailToAdd.trim() !== "" && | ||
!allOrganizationUserEmails.some( | ||
(existingEmail) => existingEmail === newEmailToAdd.trim() | ||
) | ||
) | ||
) | ||
); | ||
|
||
return (organization.planProductType === ProductType.Families || | ||
organization.planProductType === ProductType.TeamsStarter) && | ||
allOrganizationUserEmails.length + newEmailsToAdd.length > organization.seats | ||
? { orgSeatLimitReachedWithoutUpgradePath: { message: errorMessage } } | ||
: null; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.