From bfeffa352dddee7f5222346edf16a36f319292b1 Mon Sep 17 00:00:00 2001 From: elizabeth-ilina Date: Thu, 26 Mar 2026 12:53:59 -0400 Subject: [PATCH] feat(payments-next): Add Free Trial section to Subscription Management page Because: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * We need to add a Free Trials section to the Sub Manage page so that a customer can see what free trials they have. This commit: * Adds a new Free Trial section and component, to be rendered on the Subscription Management page, akin to “Payment details” and “Active subscriptions”, that is only rendered if a user has an active trialing subscription. * If the free trial is active, includes details about their upcoming billing cycle, and the option to cancel their free trial * If the free trial could not be converted due to a failed payment method, includes invoice details, and the option to update their payment info * Implements UI for both Desktop and Mobile views Closes #[PAY-3547](https://mozilla-hub.atlassian.net/browse/PAY-3547) --- .../app/[locale]/subscriptions/manage/en.ftl | 4 + .../[locale]/subscriptions/manage/page.tsx | 113 +++- .../factories/subscriptionContent.factory.ts | 24 + .../subscriptionManagement.service.spec.ts | 493 ++++++++++++++++++ .../src/lib/subscriptionManagement.service.ts | 167 +++++- libs/payments/management/src/lib/types.ts | 20 + libs/payments/ui/src/index.ts | 1 + .../client/components/FreeTrialContent/en.ftl | 46 ++ .../components/FreeTrialContent/index.tsx | 465 +++++++++++++++++ .../GetSubManPageContentActionResult.ts | 66 +++ libs/shared/assets/src/images/infoBlack.svg | 3 + 11 files changed, 1387 insertions(+), 15 deletions(-) create mode 100644 libs/payments/ui/src/lib/client/components/FreeTrialContent/en.ftl create mode 100644 libs/payments/ui/src/lib/client/components/FreeTrialContent/index.tsx create mode 100644 libs/shared/assets/src/images/infoBlack.svg diff --git a/apps/payments/next/app/[locale]/subscriptions/manage/en.ftl b/apps/payments/next/app/[locale]/subscriptions/manage/en.ftl index 1d61eb9ef90..b80ce35e9c2 100644 --- a/apps/payments/next/app/[locale]/subscriptions/manage/en.ftl +++ b/apps/payments/next/app/[locale]/subscriptions/manage/en.ftl @@ -3,8 +3,12 @@ subscription-management-page-banner-warning-title-no-payment-method = No payment method added subscription-management-page-banner-warning-link-no-payment-method = Add a payment method subscription-management-subscriptions-heading = Subscriptions +subscription-management-free-trial-heading = Free trials +subscription-management-your-free-trials-aria = Your free trials + # Heading for mobile only quick links menu subscription-management-jump-to-heading = Jump to +subscription-management-nav-free-trials = Free trials subscription-management-nav-payment-details = Payment details subscription-management-nav-active-subscriptions = Active subscriptions subscription-management-payment-details-heading = Payment details diff --git a/apps/payments/next/app/[locale]/subscriptions/manage/page.tsx b/apps/payments/next/app/[locale]/subscriptions/manage/page.tsx index a8a787d66a1..1fabda07df4 100644 --- a/apps/payments/next/app/[locale]/subscriptions/manage/page.tsx +++ b/apps/payments/next/app/[locale]/subscriptions/manage/page.tsx @@ -15,6 +15,7 @@ import { Banner, BannerVariant, formatPlanInterval, + FreeTrialContent, getCardIcon, GleanPageView, ManageParams, @@ -76,6 +77,7 @@ export default async function Manage({ subscriptions, appleIapSubscriptions, googleIapSubscriptions, + trialSubscriptions, } = await getSubManPageContentAction( session.user?.id, { ...resolvedParams }, @@ -192,7 +194,8 @@ export default async function Manage({ {(subscriptions.length > 0 || appleIapSubscriptions.length > 0 || - googleIapSubscriptions.length > 0) && ( + googleIapSubscriptions.length > 0 || + trialSubscriptions.length > 0) && (