mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 18:03:42 -05:00
Move premium features link outside the subscription block
GitOrigin-RevId: b88d765d859f1bdf1eb1d469131c8f239f327562
This commit is contained in:
parent
64159d7e5c
commit
1cde138160
10 changed files with 31 additions and 34 deletions
|
@ -3,17 +3,14 @@ import { Trans, useTranslation } from 'react-i18next'
|
||||||
import { MemberGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
|
import { MemberGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
|
||||||
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
||||||
import { LEAVE_GROUP_MODAL_ID } from './leave-group-modal'
|
import { LEAVE_GROUP_MODAL_ID } from './leave-group-modal'
|
||||||
import PremiumFeaturesLink from './premium-features-link'
|
|
||||||
import getMeta from '../../../../utils/meta.js'
|
import getMeta from '../../../../utils/meta.js'
|
||||||
|
|
||||||
type GroupSubscriptionMembershipProps = {
|
type GroupSubscriptionMembershipProps = {
|
||||||
subscription: MemberGroupSubscription
|
subscription: MemberGroupSubscription
|
||||||
isLast: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function GroupSubscriptionMembership({
|
export default function GroupSubscriptionMembership({
|
||||||
subscription,
|
subscription,
|
||||||
isLast,
|
|
||||||
}: GroupSubscriptionMembershipProps) {
|
}: GroupSubscriptionMembershipProps) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { handleOpenModal, setLeavingGroupId } =
|
const { handleOpenModal, setLeavingGroupId } =
|
||||||
|
@ -48,7 +45,6 @@ export default function GroupSubscriptionMembership({
|
||||||
<em>{subscription.teamNotice}</em>
|
<em>{subscription.teamNotice}</em>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{isLast && <PremiumFeaturesLink />}
|
|
||||||
{hideLeaveButton ? (
|
{hideLeaveButton ? (
|
||||||
<span>
|
<span>
|
||||||
{' '}
|
{' '}
|
||||||
|
|
|
@ -17,10 +17,9 @@ export default function GroupSubscriptionMemberships() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{memberOnlyGroupSubscriptions.map(
|
{memberOnlyGroupSubscriptions.map(
|
||||||
(subscription: MemberGroupSubscription, index: number) => (
|
(subscription: MemberGroupSubscription) => (
|
||||||
<GroupSubscriptionMembership
|
<GroupSubscriptionMembership
|
||||||
subscription={subscription}
|
subscription={subscription}
|
||||||
isLast={index === memberOnlyGroupSubscriptions.length - 1}
|
|
||||||
key={subscription._id}
|
key={subscription._id}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Trans } from 'react-i18next'
|
import { Trans } from 'react-i18next'
|
||||||
import { Institution } from '../../../../../../types/institution'
|
import { Institution } from '../../../../../../types/institution'
|
||||||
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
||||||
import PremiumFeaturesLink from './premium-features-link'
|
|
||||||
|
|
||||||
function InstitutionMemberships() {
|
function InstitutionMemberships() {
|
||||||
const { institutionMemberships } = useSubscriptionDashboardContext()
|
const { institutionMemberships } = useSubscriptionDashboardContext()
|
||||||
|
@ -44,7 +43,6 @@ function InstitutionMemberships() {
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<PremiumFeaturesLink />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { useTranslation, Trans } from 'react-i18next'
|
import { useTranslation, Trans } from 'react-i18next'
|
||||||
import PremiumFeaturesLink from '../../premium-features-link'
|
|
||||||
import { PriceExceptions } from '../../../shared/price-exceptions'
|
import { PriceExceptions } from '../../../shared/price-exceptions'
|
||||||
import { useSubscriptionDashboardContext } from '../../../../context/subscription-dashboard-context'
|
import { useSubscriptionDashboardContext } from '../../../../context/subscription-dashboard-context'
|
||||||
import { RecurlySubscription } from '../../../../../../../../types/subscription/dashboard/subscription'
|
import { RecurlySubscription } from '../../../../../../../../types/subscription/dashboard/subscription'
|
||||||
|
@ -98,7 +97,6 @@ export function ActiveSubscription({
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
<PremiumFeaturesLink />
|
|
||||||
<PriceExceptions subscription={subscription} />
|
<PriceExceptions subscription={subscription} />
|
||||||
<p>
|
<p>
|
||||||
<a
|
<a
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { useTranslation, Trans } from 'react-i18next'
|
import { useTranslation, Trans } from 'react-i18next'
|
||||||
import { RecurlySubscription } from '../../../../../../../types/subscription/dashboard/subscription'
|
import { RecurlySubscription } from '../../../../../../../types/subscription/dashboard/subscription'
|
||||||
import PremiumFeaturesLink from '../premium-features-link'
|
|
||||||
import ReactivateSubscription from '../reactivate-subscription'
|
import ReactivateSubscription from '../reactivate-subscription'
|
||||||
|
|
||||||
export function CanceledSubscription({
|
export function CanceledSubscription({
|
||||||
|
@ -36,7 +35,6 @@ export function CanceledSubscription({
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
<PremiumFeaturesLink />
|
|
||||||
<p>
|
<p>
|
||||||
<a
|
<a
|
||||||
href={subscription.recurly.accountManagementLink}
|
href={subscription.recurly.accountManagementLink}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import ManagedGroupSubscriptions from './managed-group-subscriptions'
|
||||||
import ManagedInstitutions from './managed-institutions'
|
import ManagedInstitutions from './managed-institutions'
|
||||||
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
||||||
import getMeta from '../../../../utils/meta'
|
import getMeta from '../../../../utils/meta'
|
||||||
|
import PremiumFeaturesLink from './premium-features-link'
|
||||||
|
|
||||||
function SubscriptionDashboard() {
|
function SubscriptionDashboard() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
@ -37,6 +38,7 @@ function SubscriptionDashboard() {
|
||||||
<ManagedPublishers />
|
<ManagedPublishers />
|
||||||
<GroupSubscriptionMemberships />
|
<GroupSubscriptionMemberships />
|
||||||
<InstitutionMemberships />
|
<InstitutionMemberships />
|
||||||
|
{hasDisplayedSubscription && <PremiumFeaturesLink />}
|
||||||
{!hasDisplayedSubscription &&
|
{!hasDisplayedSubscription &&
|
||||||
(hasSubscription ? <ContactSupport /> : <FreePlan />)}
|
(hasSubscription ? <ContactSupport /> : <FreePlan />)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -59,15 +59,4 @@ describe('<InstitutionMemberships />', function () {
|
||||||
'Sorry, something went wrong. Subscription information related to institutional affiliations may not be displayed. Please try again later.'
|
'Sorry, something went wrong. Subscription information related to institutional affiliations may not be displayed. Please try again later.'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders the "Get the most out of your" subscription text when a user has a subscription', function () {
|
|
||||||
renderWithSubscriptionDashContext(<InstitutionMemberships />, {
|
|
||||||
metaTags: [
|
|
||||||
{ name: 'ol-currentInstitutionsWithLicence', value: memberships },
|
|
||||||
],
|
|
||||||
})
|
|
||||||
screen.getByText('Get the most out of your', {
|
|
||||||
exact: false,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -86,11 +86,6 @@ describe('<PersonalSubscription />', function () {
|
||||||
|
|
||||||
screen.getByText('No further payments will be taken.', { exact: false })
|
screen.getByText('No further payments will be taken.', { exact: false })
|
||||||
|
|
||||||
screen.getByText(
|
|
||||||
'Get the most out of your Overleaf subscription by checking out the list of',
|
|
||||||
{ exact: false }
|
|
||||||
)
|
|
||||||
|
|
||||||
screen.getByRole('link', { name: 'View Your Invoices' })
|
screen.getByRole('link', { name: 'View Your Invoices' })
|
||||||
screen.getByRole('button', { name: 'Reactivate your subscription' })
|
screen.getByRole('button', { name: 'Reactivate your subscription' })
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,12 +53,6 @@ describe('<ActiveSubscription />', function () {
|
||||||
})
|
})
|
||||||
expect(dates.length).to.equal(2)
|
expect(dates.length).to.equal(2)
|
||||||
|
|
||||||
// sentence broken up by link
|
|
||||||
screen.getByText(
|
|
||||||
'Get the most out of your Overleaf subscription by checking out the list of',
|
|
||||||
{ exact: false }
|
|
||||||
)
|
|
||||||
|
|
||||||
screen.getByText(
|
screen.getByText(
|
||||||
'* Prices may be subject to additional VAT, depending on your country.'
|
'* Prices may be subject to additional VAT, depending on your country.'
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,12 +5,40 @@ import {
|
||||||
cleanUpContext,
|
cleanUpContext,
|
||||||
renderWithSubscriptionDashContext,
|
renderWithSubscriptionDashContext,
|
||||||
} from '../../helpers/render-with-subscription-dash-context'
|
} from '../../helpers/render-with-subscription-dash-context'
|
||||||
|
import { groupPlans, plans } from '../../fixtures/plans'
|
||||||
|
import { annualActiveSubscription } from '../../fixtures/subscriptions'
|
||||||
|
|
||||||
describe('<SubscriptionDashboard />', function () {
|
describe('<SubscriptionDashboard />', function () {
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
cleanUpContext()
|
cleanUpContext()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('With an active subscription', function () {
|
||||||
|
beforeEach(function () {
|
||||||
|
renderWithSubscriptionDashContext(<SubscriptionDashboard />, {
|
||||||
|
metaTags: [
|
||||||
|
{ name: 'ol-plans', value: plans },
|
||||||
|
{
|
||||||
|
name: 'ol-groupPlans',
|
||||||
|
value: groupPlans,
|
||||||
|
},
|
||||||
|
{ name: 'ol-subscription', value: annualActiveSubscription },
|
||||||
|
{
|
||||||
|
name: 'ol-recommendedCurrency',
|
||||||
|
value: 'USD',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the "Get the most out of your" subscription text', function () {
|
||||||
|
screen.getByText(
|
||||||
|
'Get the most out of your Overleaf subscription by checking out the list of',
|
||||||
|
{ exact: false }
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('Free Plan', function () {
|
describe('Free Plan', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
renderWithSubscriptionDashContext(<SubscriptionDashboard />)
|
renderWithSubscriptionDashContext(<SubscriptionDashboard />)
|
||||||
|
|
Loading…
Reference in a new issue