update trial initiation text to only represent the product (#11171)

Co-authored-by: Alec Rippberger <alec@livefront.com>
This commit is contained in:
Nick Krantz 2024-09-20 09:48:44 -05:00 committed by GitHub
parent a2ce4e53c6
commit 0516ca00dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 98 deletions

View File

@ -1,6 +1,6 @@
import { ActivatedRouteSnapshot, RouterStateSnapshot } from "@angular/router"; import { ActivatedRouteSnapshot, RouterStateSnapshot } from "@angular/router";
import { ProductTierType, ProductType } from "@bitwarden/common/billing/enums"; import { ProductType } from "@bitwarden/common/billing/enums";
import { freeTrialTextResolver } from "./free-trial-text.resolver"; import { freeTrialTextResolver } from "./free-trial-text.resolver";
@ -11,48 +11,25 @@ const route = {
const routerStateSnapshot = {} as RouterStateSnapshot; const routerStateSnapshot = {} as RouterStateSnapshot;
describe("freeTrialTextResolver", () => { describe("freeTrialTextResolver", () => {
[ it("shows password manager text", () => {
{ route.queryParams.product = `${ProductType.PasswordManager}`;
param: ProductType.PasswordManager,
keyBase: "startYour7DayFreeTrialOfBitwardenPasswordManager",
},
{
param: ProductType.SecretsManager,
keyBase: "startYour7DayFreeTrialOfBitwardenSecretsManager",
},
{
param: `${ProductType.PasswordManager},${ProductType.SecretsManager}`,
keyBase: "startYour7DayFreeTrialOfBitwarden",
},
].forEach(({ param, keyBase }) => {
describe(`when product is ${param}`, () => {
beforeEach(() => {
route.queryParams.product = `${param}`;
});
it("returns teams trial text", () => { expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(
route.queryParams.productTier = ProductTierType.Teams; "continueSettingUpFreeTrialPasswordManager",
);
});
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(`${keyBase}ForTeams`); it("shows secret manager text", () => {
}); route.queryParams.product = `${ProductType.SecretsManager}`;
it("returns enterprise trial text", () => { expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(
route.queryParams.productTier = ProductTierType.Enterprise; "continueSettingUpFreeTrialSecretsManager",
);
});
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(`${keyBase}ForEnterprise`); it("shows default text", () => {
}); route.queryParams.product = `${ProductType.PasswordManager},${ProductType.SecretsManager}`;
it("returns families trial text", () => { expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe("continueSettingUpFreeTrial");
route.queryParams.productTier = ProductTierType.Families;
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(`${keyBase}ForFamilies`);
});
it("returns default trial text", () => {
route.queryParams.productTier = "";
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(keyBase);
});
});
}); });
}); });

View File

@ -1,43 +1,22 @@
import { ActivatedRouteSnapshot, ResolveFn } from "@angular/router"; import { ActivatedRouteSnapshot, ResolveFn } from "@angular/router";
import { ProductType, ProductTierType } from "@bitwarden/common/billing/enums"; import { ProductType } from "@bitwarden/common/billing/enums";
export const freeTrialTextResolver: ResolveFn<string | null> = ( export const freeTrialTextResolver: ResolveFn<string | null> = (
route: ActivatedRouteSnapshot, route: ActivatedRouteSnapshot,
): string | null => { ): string | null => {
const { product, productTier } = route.queryParams; const { product } = route.queryParams;
const products: ProductType[] = (product ?? "").split(",").map((p: string) => parseInt(p)); const products: ProductType[] = (product ?? "").split(",").map((p: string) => parseInt(p));
const onlyPasswordManager = products.length === 1 && products[0] === ProductType.PasswordManager; const onlyPasswordManager = products.length === 1 && products[0] === ProductType.PasswordManager;
const onlySecretsManager = products.length === 1 && products[0] === ProductType.SecretsManager; const onlySecretsManager = products.length === 1 && products[0] === ProductType.SecretsManager;
const forTeams = parseInt(productTier) === ProductTierType.Teams;
const forEnterprise = parseInt(productTier) === ProductTierType.Enterprise;
const forFamilies = parseInt(productTier) === ProductTierType.Families;
switch (true) { switch (true) {
case onlyPasswordManager && forTeams:
return "startYour7DayFreeTrialOfBitwardenPasswordManagerForTeams";
case onlyPasswordManager && forEnterprise:
return "startYour7DayFreeTrialOfBitwardenPasswordManagerForEnterprise";
case onlyPasswordManager && forFamilies:
return "startYour7DayFreeTrialOfBitwardenPasswordManagerForFamilies";
case onlyPasswordManager: case onlyPasswordManager:
return "startYour7DayFreeTrialOfBitwardenPasswordManager"; return "continueSettingUpFreeTrialPasswordManager";
case onlySecretsManager && forTeams:
return "startYour7DayFreeTrialOfBitwardenSecretsManagerForTeams";
case onlySecretsManager && forEnterprise:
return "startYour7DayFreeTrialOfBitwardenSecretsManagerForEnterprise";
case onlySecretsManager && forFamilies:
return "startYour7DayFreeTrialOfBitwardenSecretsManagerForFamilies";
case onlySecretsManager: case onlySecretsManager:
return "startYour7DayFreeTrialOfBitwardenSecretsManager"; return "continueSettingUpFreeTrialSecretsManager";
case forTeams:
return "startYour7DayFreeTrialOfBitwardenForTeams";
case forEnterprise:
return "startYour7DayFreeTrialOfBitwardenForEnterprise";
case forFamilies:
return "startYour7DayFreeTrialOfBitwardenForFamilies";
default: default:
return "startYour7DayFreeTrialOfBitwarden"; return "continueSettingUpFreeTrial";
} }
}; };

View File

@ -8683,41 +8683,14 @@
"manageBillingFromProviderPortalMessage": { "manageBillingFromProviderPortalMessage": {
"message": "Manage billing from the Provider Portal" "message": "Manage billing from the Provider Portal"
}, },
"startYour7DayFreeTrialOfBitwarden": { "continueSettingUpFreeTrial": {
"message": "Start your 7-Day free trial of Bitwarden" "message": "Continue setting up your free trial of Bitwarden"
}, },
"startYour7DayFreeTrialOfBitwardenForTeams": { "continueSettingUpFreeTrialPasswordManager": {
"message": "Start your 7-Day free trial of Bitwarden for Teams" "message": "Continue setting up your free trial of Bitwarden Password Manager"
}, },
"startYour7DayFreeTrialOfBitwardenForFamilies": { "continueSettingUpFreeTrialSecretsManager": {
"message": "Start your 7-Day free trial of Bitwarden for Families" "message": "Continue setting up your free trial of Bitwarden Secrets Manager"
},
"startYour7DayFreeTrialOfBitwardenForEnterprise": {
"message": "Start your 7-Day free trial of Bitwarden for Enterprise"
},
"startYour7DayFreeTrialOfBitwardenSecretsManager": {
"message": "Start your 7-Day free trial of Bitwarden Secrets Manager"
},
"startYour7DayFreeTrialOfBitwardenSecretsManagerForTeams": {
"message": "Start your 7-Day free trial of Bitwarden Secrets Manager for Teams"
},
"startYour7DayFreeTrialOfBitwardenSecretsManagerForFamilies": {
"message": "Start your 7-Day free trial of Bitwarden Secrets Manager for Families"
},
"startYour7DayFreeTrialOfBitwardenSecretsManagerForEnterprise": {
"message": "Start your 7-Day free trial of Bitwarden Secrets Manager for Enterprise"
},
"startYour7DayFreeTrialOfBitwardenPasswordManager": {
"message": "Start your 7-Day free trial of Bitwarden Password Manager"
},
"startYour7DayFreeTrialOfBitwardenPasswordManagerForTeams": {
"message": "Start your 7-Day free trial of Bitwarden Password Manager for Teams"
},
"startYour7DayFreeTrialOfBitwardenPasswordManagerForFamilies": {
"message": "Start your 7-Day free trial of Bitwarden Password Manager for Families"
},
"startYour7DayFreeTrialOfBitwardenPasswordManagerForEnterprise": {
"message": "Start your 7-Day free trial of Bitwarden Password Manager for Enterprise"
}, },
"enterTeamsOrgInfo": { "enterTeamsOrgInfo": {
"message": "Enter your Teams organization information" "message": "Enter your Teams organization information"