mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +01:00
update trial initiation text to only represent the product (#11171)
Co-authored-by: Alec Rippberger <alec@livefront.com>
This commit is contained in:
parent
a2ce4e53c6
commit
0516ca00dc
@ -1,6 +1,6 @@
|
||||
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";
|
||||
|
||||
@ -11,48 +11,25 @@ const route = {
|
||||
const routerStateSnapshot = {} as RouterStateSnapshot;
|
||||
|
||||
describe("freeTrialTextResolver", () => {
|
||||
[
|
||||
{
|
||||
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("shows password manager text", () => {
|
||||
route.queryParams.product = `${ProductType.PasswordManager}`;
|
||||
|
||||
it("returns teams trial text", () => {
|
||||
route.queryParams.productTier = ProductTierType.Teams;
|
||||
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(
|
||||
"continueSettingUpFreeTrialPasswordManager",
|
||||
);
|
||||
});
|
||||
|
||||
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(`${keyBase}ForTeams`);
|
||||
});
|
||||
it("shows secret manager text", () => {
|
||||
route.queryParams.product = `${ProductType.SecretsManager}`;
|
||||
|
||||
it("returns enterprise trial text", () => {
|
||||
route.queryParams.productTier = ProductTierType.Enterprise;
|
||||
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(
|
||||
"continueSettingUpFreeTrialSecretsManager",
|
||||
);
|
||||
});
|
||||
|
||||
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe(`${keyBase}ForEnterprise`);
|
||||
});
|
||||
it("shows default text", () => {
|
||||
route.queryParams.product = `${ProductType.PasswordManager},${ProductType.SecretsManager}`;
|
||||
|
||||
it("returns families trial text", () => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
expect(freeTrialTextResolver(route, routerStateSnapshot)).toBe("continueSettingUpFreeTrial");
|
||||
});
|
||||
});
|
||||
|
@ -1,43 +1,22 @@
|
||||
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> = (
|
||||
route: ActivatedRouteSnapshot,
|
||||
): string | null => {
|
||||
const { product, productTier } = route.queryParams;
|
||||
const { product } = route.queryParams;
|
||||
const products: ProductType[] = (product ?? "").split(",").map((p: string) => parseInt(p));
|
||||
|
||||
const onlyPasswordManager = products.length === 1 && products[0] === ProductType.PasswordManager;
|
||||
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) {
|
||||
case onlyPasswordManager && forTeams:
|
||||
return "startYour7DayFreeTrialOfBitwardenPasswordManagerForTeams";
|
||||
case onlyPasswordManager && forEnterprise:
|
||||
return "startYour7DayFreeTrialOfBitwardenPasswordManagerForEnterprise";
|
||||
case onlyPasswordManager && forFamilies:
|
||||
return "startYour7DayFreeTrialOfBitwardenPasswordManagerForFamilies";
|
||||
case onlyPasswordManager:
|
||||
return "startYour7DayFreeTrialOfBitwardenPasswordManager";
|
||||
case onlySecretsManager && forTeams:
|
||||
return "startYour7DayFreeTrialOfBitwardenSecretsManagerForTeams";
|
||||
case onlySecretsManager && forEnterprise:
|
||||
return "startYour7DayFreeTrialOfBitwardenSecretsManagerForEnterprise";
|
||||
case onlySecretsManager && forFamilies:
|
||||
return "startYour7DayFreeTrialOfBitwardenSecretsManagerForFamilies";
|
||||
return "continueSettingUpFreeTrialPasswordManager";
|
||||
case onlySecretsManager:
|
||||
return "startYour7DayFreeTrialOfBitwardenSecretsManager";
|
||||
case forTeams:
|
||||
return "startYour7DayFreeTrialOfBitwardenForTeams";
|
||||
case forEnterprise:
|
||||
return "startYour7DayFreeTrialOfBitwardenForEnterprise";
|
||||
case forFamilies:
|
||||
return "startYour7DayFreeTrialOfBitwardenForFamilies";
|
||||
return "continueSettingUpFreeTrialSecretsManager";
|
||||
default:
|
||||
return "startYour7DayFreeTrialOfBitwarden";
|
||||
return "continueSettingUpFreeTrial";
|
||||
}
|
||||
};
|
||||
|
@ -8683,41 +8683,14 @@
|
||||
"manageBillingFromProviderPortalMessage": {
|
||||
"message": "Manage billing from the Provider Portal"
|
||||
},
|
||||
"startYour7DayFreeTrialOfBitwarden": {
|
||||
"message": "Start your 7-Day free trial of Bitwarden"
|
||||
"continueSettingUpFreeTrial": {
|
||||
"message": "Continue setting up your free trial of Bitwarden"
|
||||
},
|
||||
"startYour7DayFreeTrialOfBitwardenForTeams": {
|
||||
"message": "Start your 7-Day free trial of Bitwarden for Teams"
|
||||
"continueSettingUpFreeTrialPasswordManager": {
|
||||
"message": "Continue setting up your free trial of Bitwarden Password Manager"
|
||||
},
|
||||
"startYour7DayFreeTrialOfBitwardenForFamilies": {
|
||||
"message": "Start your 7-Day free trial of Bitwarden for Families"
|
||||
},
|
||||
"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"
|
||||
"continueSettingUpFreeTrialSecretsManager": {
|
||||
"message": "Continue setting up your free trial of Bitwarden Secrets Manager"
|
||||
},
|
||||
"enterTeamsOrgInfo": {
|
||||
"message": "Enter your Teams organization information"
|
||||
|
Loading…
Reference in New Issue
Block a user