diff --git a/ghost/portal/src/components/common/PlansSection.js b/ghost/portal/src/components/common/PlansSection.js
index d315abd21a..86e40f8078 100644
--- a/ghost/portal/src/components/common/PlansSection.js
+++ b/ghost/portal/src/components/common/PlansSection.js
@@ -382,6 +382,29 @@ function addDiscountToPlans(plans) {
}
}
+function ProductOptions({products, selectedPlan, onPlanSelect, changePlan}) {
+ return products.map(({id, monthlyPrice, yearlyPrice, name}) => {
+ return (
+
+ );
+ });
+}
+
function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) {
const {site} = useContext(AppContext);
const {free_price_name: freePriceName, free_price_description: freePriceDescription} = site;
@@ -430,7 +453,7 @@ function PlanLabel({showLabel}) {
);
}
-function getPlanClassNames({changePlan, cookiesDisabled, plans}) {
+function getPlanClassNames({changePlan, cookiesDisabled, plans = [], showVertical = false}) {
let className = 'gh-portal-plans-container';
if (changePlan) {
className += ' hide-checkbox';
@@ -438,12 +461,29 @@ function getPlanClassNames({changePlan, cookiesDisabled, plans}) {
if (cookiesDisabled) {
className += ' disabled';
}
- if (changePlan || plans.length > 3) {
+ if (changePlan || plans.length > 3 || showVertical) {
className += ' vertical';
}
return className;
}
+export function MultipleProductsPlansSection({products, selectedPlan, onPlanSelect, changePlan = false}) {
+ const cookiesDisabled = isCookiesDisabled();
+ /**Don't allow plans selection if cookies are disabled */
+ if (cookiesDisabled) {
+ onPlanSelect = () => {};
+ }
+
+ const className = getPlanClassNames({cookiesDisabled, changePlan, showVertical: true});
+ return (
+
+ );
+}
+
function PlansSection({plans, showLabel = true, selectedPlan, onPlanSelect, changePlan = false}) {
if (hasOnlyFreePlan({plans})) {
return null;
diff --git a/ghost/portal/src/components/pages/AccountPlanPage.js b/ghost/portal/src/components/pages/AccountPlanPage.js
index 81f104804b..763dc5a880 100644
--- a/ghost/portal/src/components/pages/AccountPlanPage.js
+++ b/ghost/portal/src/components/pages/AccountPlanPage.js
@@ -201,6 +201,30 @@ const ChangePlanSection = ({plans, selectedPlan, onPlanSelect, onCancelSubscript
);
};
+function PlansOrProductSection({showLabel, plans, selectedPlan, onPlanSelect, changePlan}) {
+ const {site, member} = useContext(AppContext);
+ const products = getUpgradeProducts({site, member});
+ if (hasMultipleProducts({site})) {
+ return (
+ onPlanSelect(e, priceId)}
+ />
+ );
+ }
+ return (
+ onPlanSelect(e, priceId)}
+ />
+ );
+}
+
// For free members
const UpgradePlanSection = ({
plans, selectedPlan, onPlanSelect, onPlanCheckout
@@ -214,7 +238,7 @@ const UpgradePlanSection = ({
return (