Skip to content

Commit

Permalink
SEO Upsell: update link to open in help center (#39339)
Browse files Browse the repository at this point in the history
* SEO Upsell: update link to open in help center

* remove debug

* add changelog

* try without localizeUrl

* add localiseUrl to jetpack packages

* revert change to file

* needs yaml file

* remove css changes - not needed

* remove dependency on localiseUrl

* update to use getRedirectUrl

* remove the use of Jetpack redirects - not going to work with help center

* postId not needed
  • Loading branch information
eoigal authored Sep 12, 2024
1 parent 9323ff6 commit 12cd610
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/add-seo-link-help-center
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Open SEO upsell post in help center
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useAnalytics } from '@automattic/jetpack-shared-extension-utils';
import { Button, ExternalLink } from '@wordpress/components';
import { useDispatch } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
import { external } from '@wordpress/icons';
import clsx from 'clsx';
Expand All @@ -15,13 +16,18 @@ const UpsellNotice = ( { requiredPlan } ) => {

const buttonText = __( 'Upgrade now', 'jetpack' );
const supportUrl = 'https://wordpress.com/support/seo-tools/';
const supportLinkTitle = __( 'Learn more about the SEO feature.', 'jetpack' );

const onClickHandler = event => {
event.preventDefault();
tracks.recordEvent( 'jetpack_seo_tools_upsell_click' );
goToCheckoutPage( event );
};

const helpCenterDispatch = useDispatch( 'automattic/help-center' );
const setShowHelpCenter = helpCenterDispatch?.setShowHelpCenter;
const setShowSupportDoc = helpCenterDispatch?.setShowSupportDoc;

return (
<>
<div>
Expand All @@ -33,9 +39,20 @@ const UpsellNotice = ( { requiredPlan } ) => {
</div>

<div className="components-seo-upsell__learn-more">
<ExternalLink href={ supportUrl }>
{ __( 'Learn more about SEO feature.', 'jetpack' ) }
</ExternalLink>
{ setShowHelpCenter ? (
<Button
onClick={ () => {
setShowHelpCenter( true );
setShowSupportDoc( supportUrl );
} }
className="components-seo-upsell__learn-more-link"
variant="link"
>
{ supportLinkTitle }
</Button>
) : (
<ExternalLink href={ supportUrl }>{ supportLinkTitle }</ExternalLink>
) }
</div>

<Button
Expand Down

0 comments on commit 12cd610

Please sign in to comment.