From 142b29e4cdf258cde25748932a76dcab2886f980 Mon Sep 17 00:00:00 2001 From: ouikhuan Date: Fri, 22 Mar 2024 14:00:34 +0800 Subject: [PATCH] Scheduled Updates: Show Jetpack users migrate upsell banner (#88658) * Show Jetpack users migrate upsell banner * Make sure a jetpack site is not an Atomic site * Add ref to the query string --- .../scheduled-updates-gate/upsell-nudge.tsx | 84 +++++++++++++------ 1 file changed, 60 insertions(+), 24 deletions(-) diff --git a/client/components/scheduled-updates/scheduled-updates-gate/upsell-nudge.tsx b/client/components/scheduled-updates/scheduled-updates-gate/upsell-nudge.tsx index 46a01dc2263cfb..c82d9b813eb2ad 100644 --- a/client/components/scheduled-updates/scheduled-updates-gate/upsell-nudge.tsx +++ b/client/components/scheduled-updates/scheduled-updates-gate/upsell-nudge.tsx @@ -7,35 +7,71 @@ import { addQueryArgs } from '@wordpress/url'; import { useTranslate } from 'i18n-calypso'; import UpsellNudge from 'calypso/blocks/upsell-nudge'; import { useSelector } from 'calypso/state'; -import { getSelectedSiteSlug } from 'calypso/state/ui/selectors'; +import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer'; +import { isJetpackSite } from 'calypso/state/sites/selectors'; +import { getSelectedSiteSlug, getSelectedSiteId } from 'calypso/state/ui/selectors'; const UpsellNudgeNotice = () => { const translate = useTranslate(); const siteSlug = useSelector( getSelectedSiteSlug ); + const siteId = useSelector( getSelectedSiteId ); + const isJetpack = useSelector( ( state ) => isJetpackSite( state, siteId ) ); + const isAtomic = useSelector( ( state ) => isAtomicSite( state, siteId ) ); - const titleText = translate( - 'Upgrade to the %(businessPlanName)s plan to install plugins and manage scheduled updates.', - { - args: { businessPlanName: getPlan( PLAN_BUSINESS )?.getTitle() ?? '' }, - } - ); - - const href = addQueryArgs( `/checkout/${ siteSlug }/business`, { - redirect_to: `/plugins/scheduled-updates/${ siteSlug }`, - } ); - - return ( - - ); + const getWpcomUpgradeNudge = () => { + const titleText = translate( + 'Upgrade to the %(businessPlanName)s plan to install plugins and manage scheduled updates.', + { + args: { businessPlanName: getPlan( PLAN_BUSINESS )?.getTitle() ?? '' }, + } + ); + + const href = addQueryArgs( `/checkout/${ siteSlug }/business`, { + redirect_to: `/plugins/scheduled-updates/${ siteSlug }`, + } ); + + return ( + + ); + }; + + const getJetpackMigrateNudge = () => { + const titleText = translate( + 'Thank you for you interest in scheduling plugin updates. Migrate your site to WordPress.com to get started!' + ); + + const href = addQueryArgs( `/setup/import-hosted-site/import`, { + source: 'scheduled-updates-dashboard', + ref: 'scheduled-updates-dashboard', + } ); + + return ( + + ); + }; + + return isJetpack && ! isAtomic ? getJetpackMigrateNudge() : getWpcomUpgradeNudge(); }; export default UpsellNudgeNotice;