diff --git a/packages/web/src/components/CheckoutCompletedAlert/index.ee.jsx b/packages/web/src/components/CheckoutCompletedAlert/index.ee.jsx index 2bc213e8..a1b75643 100644 --- a/packages/web/src/components/CheckoutCompletedAlert/index.ee.jsx +++ b/packages/web/src/components/CheckoutCompletedAlert/index.ee.jsx @@ -1,15 +1,15 @@ import * as React from 'react'; -import { useLocation } from 'react-router-dom'; import Alert from '@mui/material/Alert'; import Typography from '@mui/material/Typography'; import useFormatMessage from 'hooks/useFormatMessage'; +import useSubscription from 'hooks/useSubscription.ee'; export default function CheckoutCompletedAlert() { const formatMessage = useFormatMessage(); - const location = useLocation(); - const state = location.state; - const checkoutCompleted = state?.checkoutCompleted; - if (!checkoutCompleted) return ; + const subscription = useSubscription(); + + if (subscription?.data?.status !== 'active') return ; + return ( ; + if (subscription?.data?.status === 'active' || trial.hasTrial) + return ; + + const cancellationEffectiveDateObject = DateTime.fromISO( + subscription?.data?.cancellationEffectiveDate, + ); return ( - {subscription.message} + {formatMessage('subscriptionCancelledAlert.text', { + date: cancellationEffectiveDateObject.toFormat('DDD'), + })} ); diff --git a/packages/web/src/components/UsageDataInformation/index.ee.jsx b/packages/web/src/components/UsageDataInformation/index.ee.jsx index 9b737f59..c0809e5b 100644 --- a/packages/web/src/components/UsageDataInformation/index.ee.jsx +++ b/packages/web/src/components/UsageDataInformation/index.ee.jsx @@ -15,7 +15,6 @@ import TrialOverAlert from 'components/TrialOverAlert/index.ee'; import SubscriptionCancelledAlert from 'components/SubscriptionCancelledAlert/index.ee'; import CheckoutCompletedAlert from 'components/CheckoutCompletedAlert/index.ee'; import * as URLS from 'config/urls'; -import useBillingAndUsageData from 'hooks/useBillingAndUsageData.ee'; import useFormatMessage from 'hooks/useFormatMessage'; import usePlanAndUsage from 'hooks/usePlanAndUsage'; import useSubscription from 'hooks/useSubscription.ee'; @@ -62,13 +61,13 @@ function Action(props) { if (action.startsWith('http')) { return ( - ); } else if (action.startsWith('/')) { return ( - ); @@ -83,7 +82,6 @@ function Action(props) { export default function UsageDataInformation() { const formatMessage = useFormatMessage(); - const billingAndUsageData = useBillingAndUsageData(); const queryClient = useQueryClient(); const { data } = usePlanAndUsage(); const planAndUsage = data?.data; @@ -239,7 +237,7 @@ export default function UsageDataInformation() { {/* free plan has `null` status so that we can show the upgrade button */} - {subscription?.status === null && ( + {subscription?.status === undefined && (