Skip to content

Commit 7f666c1

Browse files
Reader - fix domain free plan upsell banner. (#102240)
* ensure upsell banner can fallback to most recently selected or primary site * update reader upsell banner to point to correct domain flow * undo commented logic check * update other selectors to use the calculated siteId value
1 parent af165d4 commit 7f666c1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

client/blocks/upsell-nudge/index.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ import Banner from 'calypso/components/banner';
2222
import TrackComponentView from 'calypso/lib/analytics/track-component-view';
2323
import { addQueryArgs } from 'calypso/lib/url';
2424
import { canCurrentUser } from 'calypso/state/selectors/can-current-user';
25+
import getPrimarySiteId from 'calypso/state/selectors/get-primary-site-id';
2526
import getFeaturesBySiteId from 'calypso/state/selectors/get-site-features';
2627
import isSiteAutomatedTransfer from 'calypso/state/selectors/is-site-automated-transfer';
2728
import isSiteWPForTeams from 'calypso/state/selectors/is-site-wpforteams';
2829
import isVipSite from 'calypso/state/selectors/is-vip-site';
2930
import siteHasFeature from 'calypso/state/selectors/site-has-feature';
3031
import { isSiteOnECommerceTrial, isSiteOnWooExpress } from 'calypso/state/sites/plans/selectors';
31-
import { getSite, isJetpackSite } from 'calypso/state/sites/selectors';
32-
import { getSelectedSiteId, getSelectedSiteSlug } from 'calypso/state/ui/selectors';
32+
import { getSite, getSiteSlug, isJetpackSite } from 'calypso/state/sites/selectors';
33+
import { getMostRecentlySelectedSiteId, getSelectedSiteId } from 'calypso/state/ui/selectors';
3334
import type { SiteDetails } from '@automattic/data-stores';
3435
import type { IsEligibleForOneClickCheckoutReturnValue } from 'calypso/my-sites/checkout/purchase-modal/use-is-eligible-for-one-click-checkout';
3536
import type { IAppState } from 'calypso/state/types';
@@ -293,7 +294,10 @@ export const UpsellNudge = ( {
293294
};
294295

295296
const ConnectedUpsellNudge = connect( ( state: IAppState, ownProps: OwnProps ) => {
296-
const siteId = getSelectedSiteId( state );
297+
const siteId =
298+
getSelectedSiteId( state ) ||
299+
getMostRecentlySelectedSiteId( state ) ||
300+
getPrimarySiteId( state );
297301
const siteFeatures = getFeaturesBySiteId( state, siteId || undefined );
298302
const hasFeature =
299303
siteFeatures === null ? null : siteHasFeature( state, siteId, ownProps.feature || '' );
@@ -308,8 +312,8 @@ const ConnectedUpsellNudge = connect( ( state: IAppState, ownProps: OwnProps ) =
308312
isSiteWooExpressOrEcomFreeTrial: siteId
309313
? isSiteOnECommerceTrial( state, siteId ) || isSiteOnWooExpress( state, siteId )
310314
: false,
311-
siteSlug: ownProps.disableHref ? null : getSelectedSiteSlug( state ),
312-
siteIsWPForTeams: isSiteWPForTeams( state, getSelectedSiteId( state ) ) || false,
315+
siteSlug: ownProps.disableHref ? null : getSiteSlug( state, siteId ),
316+
siteIsWPForTeams: isSiteWPForTeams( state, siteId ) || false,
313317
};
314318
} )( UpsellNudge );
315319

client/reader/sidebar/reader-sidebar-nudges/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function renderFreeToPaidPlanNudge( { siteId, siteSlug, translate }, dispatch )
1919
forceHref
2020
callToAction={ translate( 'Upgrade' ) }
2121
compact
22-
href={ '/plans/' + siteSlug }
22+
href={ '/domains/add/' + siteSlug + '?domainAndPlanPackage=true' }
2323
title={ translate( 'Free domain with an annual plan' ) }
2424
onClick={ () => dispatch( clickUpgradeNudge( siteId ) ) }
2525
tracksClickName="calypso_upgrade_nudge_cta_click"

0 commit comments

Comments
 (0)