Skip to content

Commit 3eebfb4

Browse files
im-adithya9larsons
andauthored
🐛 Updated Portal to show message when no plans are available (TryGhost#22512)
closes TryGhost#21992 Adds description when plans are not available. Co-authored-by: Steve Larson <9larsons@gmail.com>
1 parent 70776f0 commit 3eebfb4

67 files changed

Lines changed: 113 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/portal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tryghost/portal",
3-
"version": "2.68.58",
3+
"version": "2.68.59",
44
"license": "MIT",
55
"repository": "https://github.com/TryGhost/Ghost",
66
"author": "Ghost Foundation",

apps/portal/src/components/pages/account-plan-page.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,23 @@ const UpgradePlanSection = ({
438438
);
439439
};
440440

441+
// Shown when there are no paid plans to display (e.g. a member reaches the
442+
// plans page via a theme button or deep link while the site has no paid tiers).
443+
const NoPlansAvailableMessage = () => {
444+
return (
445+
<section>
446+
<div className='gh-portal-section'>
447+
<p
448+
className='gh-portal-no-plans-available-notification'
449+
data-testid="no-plans-available-notification-text"
450+
>
451+
{t('Sorry, no paid plans are available.')}
452+
</p>
453+
</div>
454+
</section>
455+
);
456+
};
457+
441458
const PlansContainer = ({
442459
plans, selectedPlan, confirmationPlan, confirmationType, showConfirmation = false,
443460
pendingOffer, onPlanSelect, onPlanCheckout, onConfirm, onCancelSubscription,
@@ -446,6 +463,14 @@ const PlansContainer = ({
446463
const {member} = useContext(AppContext);
447464
// Plan upgrade flow for free, complimentary, or gift members.
448465
if (!isPaidMember({member}) || isComplimentaryMember({member}) || isGiftMember({member})) {
466+
// No paid plans to choose from. This covers the deep-link / theme-button
467+
// entry point (#/portal/account/plans), which cannot be gated in-app,
468+
// where the body would otherwise render blank under the page header.
469+
if (plans.length === 0) {
470+
return (
471+
<NoPlansAvailableMessage />
472+
);
473+
}
449474
return (
450475
<UpgradePlanSection
451476
{...{plans, selectedPlan, onPlanSelect, onPlanCheckout}}

apps/portal/src/components/pages/signup-page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
190190
margin-top: 0;
191191
}
192192
193-
.gh-portal-invite-only-notification, .gh-portal-members-disabled-notification, .gh-portal-paid-members-only-notification {
193+
.gh-portal-invite-only-notification, .gh-portal-members-disabled-notification, .gh-portal-paid-members-only-notification, .gh-portal-no-plans-available-notification {
194194
margin: 8px 32px 24px;
195195
padding: 0;
196196
text-align: center;

apps/portal/test/unit/components/pages/account-plan-page.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ describe('Account Plan Page', () => {
5252
expect(continueBtn).toHaveLength(1);
5353
});
5454

55+
test('shows an informative message when no paid plans are available', () => {
56+
// Reproduces the deep-link / theme-button entry point (#/portal/account/plans)
57+
// on a site with members enabled but no paid plan configured. Without the
58+
// empty state the body renders blank under the "Choose a plan" header.
59+
const siteData = getSiteData({
60+
paidMembersEnabled: false,
61+
products: getProductsData({numOfProducts: 0})
62+
});
63+
const {getByTestId, queryByTestId} = customSetup({site: siteData});
64+
65+
const message = getByTestId('no-plans-available-notification-text');
66+
expect(message).toBeInTheDocument();
67+
expect(message).toHaveTextContent('Sorry, no paid plans are available.');
68+
69+
// The plan selectors should not render in the empty state.
70+
expect(queryByTestId('monthly-switch')).not.toBeInTheDocument();
71+
expect(queryByTestId('yearly-switch')).not.toBeInTheDocument();
72+
});
73+
5574
test('can choose plan and continue', async () => {
5675
const siteData = getSiteData({
5776
products: getProductsData({numOfProducts: 1})

ghost/i18n/locales/af/portal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"Signup error: Invalid link": "Aanmelding fout: Ongeldige skakel",
205205
"Signups from this email domain are currently restricted.": "",
206206
"Something went wrong, please try again later.": "",
207+
"Sorry, no paid plans are available.": "",
207208
"Sorry, no recommendations are available right now.": "",
208209
"Sorry, that didn’t work.": "Jammer, dit het nie gewerk nie.",
209210
"Spam complaints": "Spam klagtes",

ghost/i18n/locales/ar/portal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"Signup error: Invalid link": "خطأ في التسجيل: الرابط غير صالح",
205205
"Signups from this email domain are currently restricted.": "",
206206
"Something went wrong, please try again later.": ".حدث خطأ ما، يرجى المحاولة مرة أخرى لاحقًا",
207+
"Sorry, no paid plans are available.": "",
207208
"Sorry, no recommendations are available right now.": ".عذرًا، لا توجد توصيات متاحة حاليًا",
208209
"Sorry, that didn’t work.": ".عذرًا، لم ينجح ذلك",
209210
"Spam complaints": "شكاوى البريد المزعج",

ghost/i18n/locales/bg/portal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"Signup error: Invalid link": "Грешка при регистрация: Невалиден линк",
205205
"Signups from this email domain are currently restricted.": "Регистрациите от този домейн в момента са ограничени.",
206206
"Something went wrong, please try again later.": "Нещо се обърка, опитайте отново.",
207+
"Sorry, no paid plans are available.": "",
207208
"Sorry, no recommendations are available right now.": "За жалост, в момента няма налични препоръки.",
208209
"Sorry, that didn’t work.": "Жалко, така не се получава.",
209210
"Spam complaints": "Оплаквания от спам",

ghost/i18n/locales/bn/portal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"Signup error: Invalid link": "সাইন আপ ত্রুটি: অবৈধ লিঙ্ক",
205205
"Signups from this email domain are currently restricted.": "",
206206
"Something went wrong, please try again later.": "",
207+
"Sorry, no paid plans are available.": "",
207208
"Sorry, no recommendations are available right now.": "",
208209
"Sorry, that didn’t work.": "দুঃখিত, এটি কাজ করেনি।",
209210
"Spam complaints": "স্প্যাম অভিযোগ",

ghost/i18n/locales/bs/portal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"Signup error: Invalid link": "Greška pri prijavi: Neispravan link",
205205
"Signups from this email domain are currently restricted.": "",
206206
"Something went wrong, please try again later.": "",
207+
"Sorry, no paid plans are available.": "",
207208
"Sorry, no recommendations are available right now.": "",
208209
"Sorry, that didn’t work.": "Žao nam je, to nije uspjelo.",
209210
"Spam complaints": "Pritužbe na spam",

ghost/i18n/locales/ca/portal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"Signup error: Invalid link": "Error de registre: Enllaç no vàlid",
205205
"Signups from this email domain are currently restricted.": "",
206206
"Something went wrong, please try again later.": "Quelcom no ha funcionat. Si-us-plau, torna-ho a intentar més tard.",
207+
"Sorry, no paid plans are available.": "",
207208
"Sorry, no recommendations are available right now.": "Ho sentim, no hi ha cap recomanació ara mateix.",
208209
"Sorry, that didn’t work.": "Em sap greu, però no ha funcionat.",
209210
"Spam complaints": "Queixes de correu brossa",

0 commit comments

Comments
 (0)