Skip to content

Commit

Permalink
Add upgrade paths from growth to complete (#96686)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeyGuyDylan authored Nov 25, 2024
1 parent eaa38b9 commit b6ba26e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/me/purchases/manage-purchase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import {
AKISMET_UPGRADES_PRODUCTS_MAP,
JETPACK_STARTER_UPGRADE_MAP,
is100Year,
isJetpackGrowthPlan,
JETPACK_GROWTH_UPGRADE_MAP,
} from '@automattic/calypso-products';
import page from '@automattic/calypso-router';
import {
Expand Down Expand Up @@ -521,6 +523,14 @@ class ManagePurchase extends Component<
return null;
}

if ( isJetpackGrowthPlan( purchase.productSlug ) ) {
const upgradePlan =
JETPACK_GROWTH_UPGRADE_MAP[
purchase.productSlug as keyof typeof JETPACK_GROWTH_UPGRADE_MAP
];
return `/checkout/${ siteSlug }/${ upgradePlan }`;
}

if ( isJetpackStarterPlan( purchase.productSlug ) ) {
const upgradePlan =
JETPACK_STARTER_UPGRADE_MAP[
Expand Down
6 changes: 6 additions & 0 deletions packages/calypso-products/src/constants/jetpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,12 @@ export const JETPACK_STARTER_UPGRADE_MAP: Record< string, string > = {
[ PLAN_JETPACK_STARTER_MONTHLY ]: PLAN_JETPACK_SECURITY_T1_MONTHLY,
};

export const JETPACK_GROWTH_UPGRADE_MAP: Record< string, string > = {
[ PLAN_JETPACK_GROWTH_BI_YEARLY ]: PLAN_JETPACK_COMPLETE_BI_YEARLY,
[ PLAN_JETPACK_GROWTH_YEARLY ]: PLAN_JETPACK_COMPLETE,
[ PLAN_JETPACK_GROWTH_MONTHLY ]: PLAN_JETPACK_COMPLETE_MONTHLY,
};

// Categories
export const JETPACK_SECURITY_CATEGORY = 'jetpack_security_category';
export const JETPACK_PERFORMANCE_CATEGORY = 'jetpack_performance_category';
Expand Down

0 comments on commit b6ba26e

Please sign in to comment.