diff --git a/client/components/banner/index.jsx b/client/components/banner/index.jsx index 2b481eb7bd19..bad744ebaf49 100644 --- a/client/components/banner/index.jsx +++ b/client/components/banner/index.jsx @@ -18,7 +18,7 @@ import { connect } from 'react-redux'; import DismissibleCard from 'calypso/blocks/dismissible-card'; import JetpackLogo from 'calypso/components/jetpack-logo'; import TrackComponentView from 'calypso/lib/analytics/track-component-view'; -import { addQueryArgs } from 'calypso/lib/url'; +import { addQueryArgs, toCalypsoHref } from 'calypso/lib/url'; import { recordTracksEvent } from 'calypso/state/analytics/actions'; import { canCurrentUser } from 'calypso/state/selectors/can-current-user'; import isSiteWPForTeams from 'calypso/state/selectors/is-site-wpforteams'; @@ -107,23 +107,27 @@ export class Banner extends Component { getHref() { const { canUserUpgrade, feature, href, plan, siteSlug, customerType } = this.props; + let computedHref = href; + if ( ! href && siteSlug && canUserUpgrade ) { - if ( customerType ) { - return `/plans/${ siteSlug }?customerType=${ customerType }`; - } const baseUrl = `/plans/${ siteSlug }`; - if ( feature || plan ) { - return addQueryArgs( + + if ( customerType ) { + computedHref = `${ baseUrl }?customerType=${ customerType }`; + } else if ( feature || plan ) { + computedHref = addQueryArgs( { feature, plan, }, baseUrl ); + } else { + computedHref = baseUrl; } - return baseUrl; } - return href; + + return toCalypsoHref( computedHref ); } handleClick = ( e ) => { @@ -305,7 +309,7 @@ export class Banner extends Component { { secondaryCallToAction && (