From dd142c145233cc67e41b546ed4a86301fd6b7de5 Mon Sep 17 00:00:00 2001 From: isra el Date: Sat, 8 Mar 2025 22:56:54 +0300 Subject: [PATCH] chore(web): improve upgrade to pro cta --- .../(components)/upgrade-to-pro-alert.tsx | 53 ++++++++++++++----- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/web/app/(app)/dashboard/(components)/upgrade-to-pro-alert.tsx b/web/app/(app)/dashboard/(components)/upgrade-to-pro-alert.tsx index 07b909a..9c3ed09 100644 --- a/web/app/(app)/dashboard/(components)/upgrade-to-pro-alert.tsx +++ b/web/app/(app)/dashboard/(components)/upgrade-to-pro-alert.tsx @@ -4,6 +4,7 @@ import { ApiEndpoints } from '@/config/api' import httpBrowserClient from '@/lib/httpBrowserClient' import { useQuery } from '@tanstack/react-query' import Link from 'next/link' +import { useMemo } from 'react' export default function UpgradeToProAlert() { const { @@ -18,38 +19,66 @@ export default function UpgradeToProAlert() { .then((res) => res.data), }) + const ctaMessages = useMemo(() => [ + "Upgrade to Pro for exclusive features and benefits!", + "Offer: You are eligible for a 50% discount when upgrading to Pro!", + "Unlock premium features with our Pro plan today!", + "Take your experience to the next level with Pro!", + "Pro users get priority support and advanced features!", + "Limited time offer: Upgrade to Pro and save 50%!", + ], []); + + const buttonTexts = useMemo(() => [ + "Get Pro Now!", + "Upgrade Today!", + "Go Pro!", + "Unlock Pro!", + "Claim Your Discount!", + "Upgrade & Save!", + ], []); + + const randomCta = useMemo(() => { + const randomIndex = Math.floor(Math.random() * ctaMessages.length); + return ctaMessages[randomIndex]; + }, [ctaMessages]); + + const randomButtonText = useMemo(() => { + const randomIndex = Math.floor(Math.random() * buttonTexts.length); + return buttonTexts[randomIndex]; + }, [buttonTexts]); + if (isLoadingSubscription || !currentSubscription || subscriptionError) { return null } - if (['pro', 'custom'].includes(currentSubscription?.plan?.name)) { + if (!['pro', 'custom'].includes(currentSubscription?.plan?.name)) { return null } return ( - - - Upgrade to Pro for exclusive features and benefits! + + + {randomCta} - - Use discount code SAVEBIG50 at checkout for a 50% + + Use discount code SAVEBIG50 at checkout for a 50% discount! -
+