From 0037e4574027d0abc037d565a7bc743962880e12 Mon Sep 17 00:00:00 2001 From: Jessica Lawshe Date: Thu, 23 Feb 2023 10:51:19 -0600 Subject: [PATCH] Merge pull request #11970 from overleaf/ab-sub-dash-already-have-warning [web] Display a warning on subscription dash when coming from plans page GitOrigin-RevId: 6c6294fbf634a5dcd1a09b94538add6586ebd15b --- .../web/app/views/subscriptions/dashboard-react.pug | 1 + services/web/frontend/extracted-translations.json | 1 + .../components/dashboard/subscription-dashboard.tsx | 9 +++++++++ services/web/locales/en.json | 1 + .../dashboard/subscription-dashboard.test.tsx | 13 +++++++++++++ 5 files changed, 25 insertions(+) diff --git a/services/web/app/views/subscriptions/dashboard-react.pug b/services/web/app/views/subscriptions/dashboard-react.pug index 7d6a7a3bcf..12ea293c41 100644 --- a/services/web/app/views/subscriptions/dashboard-react.pug +++ b/services/web/app/views/subscriptions/dashboard-react.pug @@ -15,6 +15,7 @@ block append meta meta(name="ol-planCodesChangingAtTermEnd" data-type="json", content=planCodesChangingAtTermEnd) meta(name="ol-currentInstitutionsWithLicence" data-type="json" content=currentInstitutionsWithLicence) meta(name="ol-hasSubscription" data-type="boolean" content=hasSubscription) + meta(name="ol-fromPlansPage" data-type="boolean" content=fromPlansPage) meta(name="ol-plans", data-type="json" content=plans) if (personalSubscription && personalSubscription.recurly) meta(name="ol-recurlyApiKey" content=settings.apis.recurly.publicKey) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index ee8b443723..95d7823bce 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -913,6 +913,7 @@ "x_price_per_user": "", "x_price_per_year": "", "year": "", + "you_already_have_a_subscription": "", "you_are_a_manager_and_member_of_x_plan_as_member_of_group_subscription_y_administered_by_z": "", "you_are_a_manager_of_commons_at_institution_x": "", "you_are_a_manager_of_publisher_x": "", diff --git a/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx b/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx index e4e687d6fa..46f48bd3a5 100644 --- a/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx +++ b/services/web/frontend/js/features/subscription/components/dashboard/subscription-dashboard.tsx @@ -8,16 +8,25 @@ import PersonalSubscription from './personal-subscription' import ManagedGroupSubscriptions from './managed-group-subscriptions' import ManagedInstitutions from './managed-institutions' import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context' +import getMeta from '../../../../utils/meta' +import { Alert } from 'react-bootstrap' function SubscriptionDashboard() { const { t } = useTranslation() const { hasDisplayedSubscription, hasSubscription } = useSubscriptionDashboardContext() + const fromPlansPage: boolean = getMeta('ol-fromPlansPage') + return (
+ {fromPlansPage && ( + + {t('you_already_have_a_subscription')} + + )}

{t('your_subscription')}

diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 46a0a1ec71..ca9fc1480c 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -1680,6 +1680,7 @@ "year": "year", "yes_move_me_to_personal_plan": "Yes, move me to the Personal plan", "yes_that_is_correct": "Yes, that’s correct", + "you_already_have_a_subscription": "You already have a subscription", "you_and_collaborators_get_access_to": "You and your project collaborators get access to", "you_and_collaborators_get_access_to_info": "These features are available to you and your collaborators (other Overleaf users that you invite to your projects).", "you_are_a_manager_and_member_of_x_plan_as_member_of_group_subscription_y_administered_by_z": "You are a <1>manager and <1>member of the <0>__planName__ group subscription <1>__groupName__ administered by <1>__adminEmail__", diff --git a/services/web/test/frontend/features/subscription/components/dashboard/subscription-dashboard.test.tsx b/services/web/test/frontend/features/subscription/components/dashboard/subscription-dashboard.test.tsx index 99f3db1b58..3b53f93eca 100644 --- a/services/web/test/frontend/features/subscription/components/dashboard/subscription-dashboard.test.tsx +++ b/services/web/test/frontend/features/subscription/components/dashboard/subscription-dashboard.test.tsx @@ -57,4 +57,17 @@ describe('', function () { }) }) }) + + it('Show a warning when coming from plans page', function () { + renderWithSubscriptionDashContext(, { + metaTags: [ + { + name: 'ol-fromPlansPage', + value: true, + }, + ], + }) + + screen.getByText('You already have a subscription') + }) })