Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semrush move links and link params to client side and tests #21865

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions admin/class-expose-shortlinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ class WPSEO_Expose_Shortlinks implements WPSEO_WordPress_Integration {
'shortlinks.activate_premium_info' => 'https://yoa.st/activate-subscription',
'shortlinks.upsell.sidebar.morphology_upsell_metabox' => 'https://yoa.st/morphology-upsell-metabox',
'shortlinks.upsell.sidebar.morphology_upsell_sidebar' => 'https://yoa.st/morphology-upsell-sidebar',
'shortlinks.semrush.volume_help' => 'https://yoa.st/3-v',
'shortlinks.semrush.trend_help' => 'https://yoa.st/3-v',
'shortlinks.semrush.prices' => 'https://yoa.st/semrush-prices',
'shortlinks.semrush.premium_landing_page' => 'https://yoa.st/413',
'shortlinks.wincher.seo_performance' => 'https://yoa.st/wincher-integration',
'shortlinks-insights-estimated_reading_time' => 'https://yoa.st/4fd',
'shortlinks-insights-flesch_reading_ease' => 'https://yoa.st/34r',
Expand Down
39 changes: 15 additions & 24 deletions packages/js/src/components/SEMrushRelatedKeyphrasesModalContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,32 @@ export function getUserMessage( props ) {
*/
export default function RelatedKeyphraseModalContent( props ) {
const {
response,
lastRequestKeyphrase,
keyphrase,
response = {},
lastRequestKeyphrase = "",
keyphrase = "",
newRequest,
setCountry,
renderAction,
renderAction = null,
countryCode,
requestLimitReached,
requestLimitReached = false,
setRequestFailed,
setNoResultsFound,
relatedKeyphrases,
relatedKeyphrases = [],
setRequestSucceeded,
setRequestLimitReached,
isPending,
isRtl,
isPremium,
userLocale,
isRtl = false,
isPremium = false,
userLocale = "en_US",
semrushUpsellLink = "",
premiumUpsellLink = "",
} = props;

return (
<Root context={ { isRtl } }>

{ ! requestLimitReached && ! isPremium && <PremiumUpsell
url={ window.wpseoAdminL10n[ "shortlinks.semrush.premium_landing_page" ] }
url={ premiumUpsellLink }
className="yst-mb-4"
/> }

Expand All @@ -114,7 +116,7 @@ export default function RelatedKeyphraseModalContent( props ) {

{ ! isPending && <UserMessage
variant={ getUserMessage( props ) }
upsellLink={ window.wpseoAdminL10n[ "shortlinks.semrush.prices" ] }
upsellLink={ semrushUpsellLink }
/> }

<KeyphrasesTable
Expand Down Expand Up @@ -147,17 +149,6 @@ RelatedKeyphraseModalContent.propTypes = {
userLocale: PropTypes.string,
isPending: PropTypes.bool,
isPremium: PropTypes.bool,
};

RelatedKeyphraseModalContent.defaultProps = {
keyphrase: "",
relatedKeyphrases: [],
renderAction: null,
requestLimitReached: false,
response: {},
lastRequestKeyphrase: "",
isRtl: false,
userLocale: "en_US",
isPending: false,
isPremium: false,
semrushUpsellLink: PropTypes.string,
premiumUpsellLink: PropTypes.string,
};
4 changes: 4 additions & 0 deletions packages/js/src/containers/SEMrushRelatedKeyphrases.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* External dependencies */
import { withDispatch, withSelect } from "@wordpress/data";
import { compose } from "@wordpress/compose";
import { addQueryArgs } from "@wordpress/url";

/* Internal dependencies */
import RelatedKeyphrasesModalContent from "../components/SEMrushRelatedKeyphrasesModalContent";
Expand All @@ -18,6 +19,7 @@ export default compose( [
getSEMrushRequestKeyphrase,
getPreference,
getIsPremium,
selectLinkParams,
} = select( "yoast-seo/editor" );

return {
Expand All @@ -32,6 +34,8 @@ export default compose( [
isRtl: getPreference( "isRtl", false ),
userLocale: getPreference( "userLocale", "en_US" ),
isPremium: getIsPremium(),
semrushUpsellLink: addQueryArgs( "https://yoa.st/semrush-prices", selectLinkParams() ),
premiumUpsellLink: addQueryArgs( "https://yoa.st/413", selectLinkParams() ),
};
} ),
withDispatch( ( dispatch ) => {
Expand Down
Loading
Loading