canceled.tsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { useTranslation, Trans } from 'react-i18next'
  2. import { PaidSubscription } from '../../../../../../../types/subscription/dashboard/subscription'
  3. import {
  4. hasPendingAiAddonCancellation,
  5. ADD_ON_NAME,
  6. } from '../../../data/add-on-codes'
  7. import ReactivateSubscription from '../reactivate-subscription'
  8. import OLButton from '@/shared/components/ol/ol-button'
  9. export function CanceledSubscription({
  10. subscription,
  11. }: {
  12. subscription: PaidSubscription
  13. }) {
  14. const { t } = useTranslation()
  15. const pendingAiAddonCancellation = hasPendingAiAddonCancellation(subscription)
  16. return (
  17. <>
  18. <p>
  19. <Trans
  20. i18nKey="currently_subscribed_to_plan"
  21. values={{
  22. planName: subscription.plan.name,
  23. }}
  24. shouldUnescape
  25. tOptions={{ interpolation: { escapeValue: true } }}
  26. components={[
  27. // eslint-disable-next-line react/jsx-key
  28. <strong />,
  29. ]}
  30. />
  31. </p>
  32. {pendingAiAddonCancellation && (
  33. <p>
  34. <Trans
  35. i18nKey="pending_addon_cancellation"
  36. values={{
  37. addOnName: ADD_ON_NAME,
  38. }}
  39. shouldUnescape
  40. tOptions={{ interpolation: { escapeValue: true } }}
  41. components={{ strong: <strong /> }}
  42. />
  43. </p>
  44. )}
  45. <p>
  46. <Trans
  47. i18nKey="subscription_canceled_and_terminate_on_x"
  48. values={{
  49. terminateDate: subscription.payment.nextPaymentDueAt,
  50. }}
  51. shouldUnescape
  52. tOptions={{ interpolation: { escapeValue: true } }}
  53. components={[
  54. // eslint-disable-next-line react/jsx-key
  55. <strong />,
  56. ]}
  57. />
  58. </p>
  59. <p>
  60. <OLButton
  61. href={subscription.payment.accountManagementLink}
  62. target="_blank"
  63. variant="secondary"
  64. rel="noopener noreferrer"
  65. >
  66. {t('view_your_invoices')}
  67. </OLButton>
  68. </p>
  69. <ReactivateSubscription />
  70. </>
  71. )
  72. }