diff --git a/services/web/frontend/js/features/subscription/components/dashboard/personal-subscription.tsx b/services/web/frontend/js/features/subscription/components/dashboard/personal-subscription.tsx
index 49e5a27ac8..9add8831e9 100644
--- a/services/web/frontend/js/features/subscription/components/dashboard/personal-subscription.tsx
+++ b/services/web/frontend/js/features/subscription/components/dashboard/personal-subscription.tsx
@@ -1,9 +1,9 @@
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { Subscription } from '../../../../../../types/subscription/dashboard/subscription'
-import { ActiveSubsciption } from './states/active/active'
-import { CanceledSubsciption } from './states/canceled'
-import { ExpiredSubsciption } from './states/expired'
+import { ActiveSubscription } from './states/active/active'
+import { CanceledSubscription } from './states/canceled'
+import { ExpiredSubscription } from './states/expired'
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
function PastDueSubscriptionAlert({
@@ -30,19 +30,18 @@ function PastDueSubscriptionAlert({
function PersonalSubscriptionStates({
subscription,
- state,
}: {
subscription: Subscription
- state?: string
}) {
const { t } = useTranslation()
+ const state = subscription?.recurly?.state
if (state === 'active') {
- return
+ return
} else if (state === 'canceled') {
- return
+ return
} else if (state === 'expired') {
- return
+ return
} else {
return <>{t('problem_with_subscription_contact_us')}>
}
@@ -56,7 +55,6 @@ function PersonalSubscription({
const { t } = useTranslation()
const { recurlyLoadError, setRecurlyLoadError } =
useSubscriptionDashboardContext()
- const state = subscription?.recurly?.state
useEffect(() => {
if (typeof window.recurly === 'undefined' || !window.recurly) {
@@ -71,7 +69,7 @@ function PersonalSubscription({
{subscription.recurly.account.has_past_due_invoice._ === 'true' && (
)}
-
+
{recurlyLoadError && (
{t('payment_provider_unreachable_error')}
diff --git a/services/web/frontend/js/features/subscription/components/dashboard/states/active/active.tsx b/services/web/frontend/js/features/subscription/components/dashboard/states/active/active.tsx
index 91b86b5fa8..e8c2792805 100644
--- a/services/web/frontend/js/features/subscription/components/dashboard/states/active/active.tsx
+++ b/services/web/frontend/js/features/subscription/components/dashboard/states/active/active.tsx
@@ -9,7 +9,7 @@ import { PendingPlanChange } from './pending-plan-change'
import { TrialEnding } from './trial-ending'
import { ChangePlan } from './change-plan'
-export function ActiveSubsciption({
+export function ActiveSubscription({
subscription,
}: {
subscription: Subscription
@@ -66,11 +66,20 @@ export function ActiveSubsciption({
)}
- {subscription.pendingPlan && (
-
{t('want_change_to_apply_before_plan_end')}
- )}
+ {/* && personalSubscription.pendingPlan.name != personalSubscription.plan.name */}
+ {subscription.pendingPlan &&
+ subscription.pendingPlan.name !== subscription.plan.name && (
+
{t('want_change_to_apply_before_plan_end')}
+ )}
{/* TODO: groupPlan */}
-
+ {subscription.recurly.trial_ends_at &&
+ subscription.recurly.trialEndsAtFormatted && (
+
+ )}
+
,
diff --git a/services/web/frontend/js/features/subscription/components/dashboard/states/canceled.tsx b/services/web/frontend/js/features/subscription/components/dashboard/states/canceled.tsx
index 99aec25527..067656faf1 100644
--- a/services/web/frontend/js/features/subscription/components/dashboard/states/canceled.tsx
+++ b/services/web/frontend/js/features/subscription/components/dashboard/states/canceled.tsx
@@ -2,7 +2,7 @@ import { useTranslation, Trans } from 'react-i18next'
import { Subscription } from '../../../../../../../types/subscription/dashboard/subscription'
import PremiumFeaturesLink from '../premium-features-link'
-export function CanceledSubsciption({
+export function CanceledSubscription({
subscription,
}: {
subscription: Subscription
diff --git a/services/web/frontend/js/features/subscription/components/dashboard/states/expired.tsx b/services/web/frontend/js/features/subscription/components/dashboard/states/expired.tsx
index ed8130fbc0..86c3e67f81 100644
--- a/services/web/frontend/js/features/subscription/components/dashboard/states/expired.tsx
+++ b/services/web/frontend/js/features/subscription/components/dashboard/states/expired.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
import { Subscription } from '../../../../../../../types/subscription/dashboard/subscription'
-export function ExpiredSubsciption({
+export function ExpiredSubscription({
subscription,
}: {
subscription: Subscription
diff --git a/services/web/test/frontend/features/subscription/components/dashboard/states/active.test.tsx b/services/web/test/frontend/features/subscription/components/dashboard/states/active.test.tsx
index 8e09882e43..b0a10fea74 100644
--- a/services/web/test/frontend/features/subscription/components/dashboard/states/active.test.tsx
+++ b/services/web/test/frontend/features/subscription/components/dashboard/states/active.test.tsx
@@ -1,7 +1,7 @@
import { expect } from 'chai'
import { fireEvent, render, screen } from '@testing-library/react'
import * as eventTracking from '../../../../../../../frontend/js/infrastructure/event-tracking'
-import { ActiveSubsciption } from '../../../../../../../frontend/js/features/subscription/components/dashboard/states/active/active'
+import { ActiveSubscription } from '../../../../../../../frontend/js/features/subscription/components/dashboard/states/active/active'
import { SubscriptionDashboardProvider } from '../../../../../../../frontend/js/features/subscription/context/subscription-dashboard-context'
import { Subscription } from '../../../../../../../types/subscription/dashboard/subscription'
import {
@@ -61,7 +61,7 @@ describe('', function () {
it('renders the dash annual active subscription', function () {
render(
-
+
)
expectedInActiveSubscription(annualActiveSubscription)
@@ -70,7 +70,7 @@ describe('', function () {
it('shows change plan UI when button clicked', function () {
render(
-
+
)
@@ -87,7 +87,7 @@ describe('', function () {
it('notes when user is changing plan at end of current plan term', function () {
render(
-
+
)
@@ -99,12 +99,16 @@ describe('', function () {
screen.getByText(' at the end of the current billing period', {
exact: false,
})
+
+ screen.getByText(
+ 'If you wish this change to apply before the end of your current billing period, please contact us.'
+ )
})
it('does not show "Change plan" option for group plans', function () {
render(
-
+
)
@@ -123,7 +127,7 @@ describe('', function () {
render(
-
+
)
@@ -134,7 +138,7 @@ describe('', function () {
it('shows the pending license change message when plan change is pending', function () {
render(
-
@@ -144,29 +148,23 @@ describe('', function () {
exact: false,
})
- if (
- !groupActiveSubscriptionWithPendingLicenseChange.recurly
- .pendingAdditionalLicenses
- ) {
- throw Error('not expected test data')
- }
screen.getByText(
groupActiveSubscriptionWithPendingLicenseChange.recurly
- .pendingAdditionalLicenses
+ .pendingAdditionalLicenses!
)
screen.getByText('additional license(s) for a total of', { exact: false })
- if (
- !groupActiveSubscriptionWithPendingLicenseChange.recurly
- .pendingTotalLicenses
- ) {
- throw Error('not expected test data')
- }
screen.getByText(
groupActiveSubscriptionWithPendingLicenseChange.recurly
- .pendingTotalLicenses
+ .pendingTotalLicenses!
)
+
+ expect(
+ screen.queryByText(
+ 'If you wish this change to apply before the end of your current billing period, please contact us.'
+ )
+ ).to.be.null
})
it('shows the pending license change message when plan change is not pending', function () {
@@ -178,7 +176,7 @@ describe('', function () {
render(
-
+
)
@@ -186,9 +184,6 @@ describe('', function () {
exact: false,
})
- if (!subscription.recurly.additionalLicenses) {
- throw Error('not expected test data')
- }
screen.getByText(subscription.recurly.additionalLicenses)
screen.getByText('additional license(s) for a total of', { exact: false })
@@ -199,15 +194,13 @@ describe('', function () {
it('shows when trial ends and first payment collected', function () {
render(
-
+
)
screen.getByText('You’re on a free trial which ends on', { exact: false })
- if (!trialSubscription.recurly.trialEndsAtFormatted) {
- throw new Error('not expected test data')
- }
+
const endDate = screen.getAllByText(
- trialSubscription.recurly.trialEndsAtFormatted
+ trialSubscription.recurly.trialEndsAtFormatted!
)
expect(endDate.length).to.equal(2)
})
@@ -215,7 +208,7 @@ describe('', function () {
it('shows cancel UI and sends event', function () {
render(
-
+
)
// before button clicked
diff --git a/services/web/test/frontend/features/subscription/components/dashboard/states/expired.test.tsx b/services/web/test/frontend/features/subscription/components/dashboard/states/expired.test.tsx
index 1fb4838817..59768bb02e 100644
--- a/services/web/test/frontend/features/subscription/components/dashboard/states/expired.test.tsx
+++ b/services/web/test/frontend/features/subscription/components/dashboard/states/expired.test.tsx
@@ -1,8 +1,8 @@
import { render, screen } from '@testing-library/react'
-import { ExpiredSubsciption } from '../../../../../../../frontend/js/features/subscription/components/dashboard/states/expired'
+import { ExpiredSubscription } from '../../../../../../../frontend/js/features/subscription/components/dashboard/states/expired'
import { pastDueExpiredSubscription } from '../../../fixtures/subscriptions'
-describe('', function () {
+describe('', function () {
beforeEach(function () {
window.metaAttributesCache = new Map()
})
@@ -12,7 +12,7 @@ describe('', function () {
})
it('renders the invoices link', function () {
- render()
+ render()
screen.getByText('View Your Invoices', {
exact: false,