@@ -15,6 +15,7 @@ import {
1515 Banner ,
1616 BannerVariant ,
1717 formatPlanInterval ,
18+ FreeTrialContent ,
1819 getCardIcon ,
1920 GleanPageView ,
2021 ManageParams ,
@@ -76,6 +77,7 @@ export default async function Manage({
7677 subscriptions,
7778 appleIapSubscriptions,
7879 googleIapSubscriptions,
80+ trialSubscriptions,
7981 } = await getSubManPageContentAction (
8082 session . user ?. id ,
8183 { ...resolvedParams } ,
@@ -192,7 +194,8 @@ export default async function Manage({
192194
193195 { ( subscriptions . length > 0 ||
194196 appleIapSubscriptions . length > 0 ||
195- googleIapSubscriptions . length > 0 ) && (
197+ googleIapSubscriptions . length > 0 ||
198+ trialSubscriptions . length > 0 ) && (
196199 < nav
197200 className = "px-4 tablet:hidden"
198201 aria-labelledby = "mobile-quick-links-menu"
@@ -204,6 +207,26 @@ export default async function Manage({
204207 ) }
205208 </ h2 >
206209 < ul className = "flex flex-col gap-6" >
210+ { trialSubscriptions . length > 0 && (
211+ < li >
212+ < Link
213+ className = "flex items-center justify-between text-blue-500 hover:text-blue-600 cursor-pointer underline"
214+ href = "#free-trial"
215+ >
216+ { l10n . getString (
217+ 'subscription-management-nav-free-trials' ,
218+ 'Free trials'
219+ ) }
220+ < Image
221+ src = { arrowDownIcon }
222+ alt = ""
223+ width = { 12 }
224+ height = { 12 }
225+ aria-hidden = "true"
226+ />
227+ </ Link >
228+ </ li >
229+ ) }
207230 < li >
208231 < Link
209232 className = "flex items-center justify-between text-blue-500 hover:text-blue-600 cursor-pointer underline"
@@ -248,6 +271,94 @@ export default async function Manage({
248271 </ nav >
249272 ) }
250273
274+ { trialSubscriptions . length > 0 && (
275+ < section
276+ id = "free-trial"
277+ className = "scroll-mt-16"
278+ aria-labelledby = "free-trial-heading"
279+ >
280+ < h2
281+ id = "free-trial-heading"
282+ className = "font-bold px-4 pt-8 pb-4 text-lg tablet:px-6"
283+ >
284+ { l10n . getString (
285+ 'subscription-management-free-trial-heading' ,
286+ 'Free trials'
287+ ) }
288+ </ h2 >
289+ < ul
290+ aria-label = { l10n . getString (
291+ 'subscription-management-your-free-trials-aria' ,
292+ 'Your free trials'
293+ ) }
294+ >
295+ { trialSubscriptions . map ( ( trial , index : number ) => (
296+ < li
297+ key = { `${ trial . productName } -${ index } ` }
298+ aria-labelledby = { `${ trial . productName } -trial-information` }
299+ className = "leading-6 pb-4 last:pb-0"
300+ >
301+ < div className = "w-full py-6 text-grey-600 bg-white rounded-xl border border-grey-200 opacity-100 shadow-[0_0_16px_0_rgba(0,0,0,0.08)] tablet:px-6 tablet:py-8" >
302+ < div className = "flex flex-col px-4 tablet:px-0 tablet:flex-row tablet:items-start" >
303+ < div className = "tablet:min-w-[160px]" >
304+ < Image
305+ src = { trial . webIcon }
306+ alt = { trial . productName }
307+ height = { 64 }
308+ width = { 64 }
309+ />
310+ </ div >
311+ < div className = "flex flex-col gap-4 w-full" >
312+ < div className = "flex items-start justify-between mt-4 tablet:mt-0" >
313+ < div >
314+ < h3
315+ id = { `${ trial . productName } -trial-information` }
316+ className = "font-bold text-lg"
317+ >
318+ { trial . productName }
319+ </ h3 >
320+ < p className = "text-grey-500" >
321+ { trial . interval &&
322+ formatPlanInterval ( trial . interval ) }
323+ </ p >
324+ </ div >
325+ < LinkExternal
326+ href = { trial . supportUrl }
327+ className = "text-blue-500 hover:text-blue-600 cursor-pointer overflow-hidden text-ellipsis underline whitespace-nowrap"
328+ aria-label = { l10n . getString (
329+ 'subscription-management-button-support-aria' ,
330+ { productName : trial . productName } ,
331+ `Get help for ${ trial . productName } `
332+ ) }
333+ data-testid = { `link-external-support-${ trial . productName } ` }
334+ >
335+ < span >
336+ { l10n . getString (
337+ 'subscription-management-button-support' ,
338+ 'Get help'
339+ ) }
340+ </ span >
341+ </ LinkExternal >
342+ </ div >
343+ < FreeTrialContent
344+ trial = { trial }
345+ locale = { locale }
346+ userId = { userId }
347+ updatePaymentUrl = {
348+ type === SubPlatPaymentMethodType . PayPal
349+ ? `${ config . paymentsNextHostedUrl } /${ locale } /subscriptions/payments/paypal`
350+ : `${ config . paymentsNextHostedUrl } /${ locale } /subscriptions/payments/stripe`
351+ }
352+ />
353+ </ div >
354+ </ div >
355+ </ div >
356+ </ li >
357+ ) ) }
358+ </ ul >
359+ </ section >
360+ ) }
361+
251362 < section
252363 id = "payment-details"
253364 className = "scroll-mt-16"
0 commit comments