diff --git a/admin/class-config.php b/admin/class-config.php index 0f8ce558885..58e037db822 100644 --- a/admin/class-config.php +++ b/admin/class-config.php @@ -100,7 +100,6 @@ public function config_page_scripts() { 'isPremium' => YoastSEO()->helpers->product->is_premium(), 'isWooCommerceActive' => $woocommerce_conditional->is_met(), 'currentPromotions' => YoastSEO()->classes->get( Promotion_Manager::class )->get_current_promotions(), - 'webinarIntroSettingsUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-settings' ), 'webinarIntroFirstTimeConfigUrl' => $this->get_webinar_shortlink(), 'linkParams' => WPSEO_Shortlinker::get_query_params(), 'pluginUrl' => plugins_url( '', WPSEO_FILE ), diff --git a/admin/formatter/class-metabox-formatter.php b/admin/formatter/class-metabox-formatter.php index 699bc79b4bf..687361c79ff 100644 --- a/admin/formatter/class-metabox-formatter.php +++ b/admin/formatter/class-metabox-formatter.php @@ -49,7 +49,6 @@ public function get_values() { */ private function get_defaults() { $schema_types = new Schema_Types(); - $host = YoastSEO()->helpers->url->get_url_host( get_site_url() ); $defaults = [ 'author_name' => get_the_author_meta( 'display_name' ), @@ -73,10 +72,6 @@ private function get_defaults() { * @param bool $showMarkers Should the markers being enabled. Default = true. */ 'show_markers' => apply_filters( 'wpseo_enable_assessment_markers', true ), - 'getJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-get-prepublish?domain=' . $host ), - 'upgradeJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-upgrade-prepublish?domain=' . $host ), - 'woocommerceUpsellSchemaLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-schema-metabox' ), - 'woocommerceUpsellGooglePreviewLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-google-preview-metabox' ), ]; $integration_information_repo = YoastSEO()->classes->get( Integration_Information_Repository::class ); diff --git a/packages/js/src/components/JetpackBoost.js b/packages/js/src/components/JetpackBoost.js index b7912626785..37458ddaf98 100644 --- a/packages/js/src/components/JetpackBoost.js +++ b/packages/js/src/components/JetpackBoost.js @@ -36,10 +36,11 @@ const getDescription = ( isJetpackBoostActive ) => { * @returns {JSX.Element} The JetpackBoost element (which is null when dismissed). */ const JetpackBoost = ( { store, isAlertDismissed, onDismissed } ) => { + const host = window.location.host; const isJetpackBoostActive = get( window, "wpseoScriptData.isJetpackBoostActive", "" ) === "1"; const isJetpackBoostNotPremium = get( window, "wpseoScriptData.isJetpackBoostNotPremium", "" ) === "1"; - const getJetpackBoostPrePublishLink = get( window, "wpseoScriptData.metabox.getJetpackBoostPrePublishLink", "" ); - const upgradeJetpackBoostPrePublishLink = get( window, "wpseoScriptData.metabox.upgradeJetpackBoostPrePublishLink", "" ); + const getJetpackBoostPrePublishLink = useSelect( select => select( store ).selectLink( `https://yoa.st/jetpack-boost-get-prepublish?domain=${host}`, [] ) ); + const upgradeJetpackBoostPrePublishLink = useSelect( select => select( store ).selectLink( `https://yoa.st/jetpack-boost-upgrade-prepublish?domain=${host}`, [] ) ); const isPremium = useSelect( select => select( store ).getIsPremium() ); if ( isPremium || isAlertDismissed || ! isJetpackBoostNotPremium ) { diff --git a/packages/js/src/components/SchemaTab.js b/packages/js/src/components/SchemaTab.js index 7b9c147e553..4d2c2c5cf24 100644 --- a/packages/js/src/components/SchemaTab.js +++ b/packages/js/src/components/SchemaTab.js @@ -6,7 +6,6 @@ import interpolateComponents from "interpolate-components"; import PropTypes from "prop-types"; import styled from "styled-components"; import WooCommerceUpsell from "./WooCommerceUpsell"; -import { get } from "lodash"; import { useSelect } from "@wordpress/data"; const NewsLandingPageLink = makeOutboundLink(); @@ -167,7 +166,7 @@ function isNewsArticleType( selectedValue, defaultValue ) { const Content = ( props ) => { const schemaPageTypeOptions = getSchemaTypeOptions( props.pageTypeOptions, props.defaultPageType, props.postTypeName ); const schemaArticleTypeOptions = getSchemaTypeOptions( props.articleTypeOptions, props.defaultArticleType, props.postTypeName ); - const woocommerceUpsellLink = get( window, "wpseoScriptData.metabox.woocommerceUpsellSchemaLink", "" ); + const woocommerceUpsellLink = useSelect( select => select( STORE ).selectLink( "https://yoa.st/product-schema-metabox" ), [] ); const woocommerceUpsell = useSelect( ( select ) => select( STORE ).getIsWooSeoUpsell(), [] ); const [ focusedArticleType, setFocusedArticleType ] = useState( props.schemaArticleTypeSelected ); const woocommerceUpsellText = __( "Want your products stand out in search results with rich results like price, reviews and more?", "wordpress-seo" ); diff --git a/packages/js/src/containers/SnippetEditor.js b/packages/js/src/containers/SnippetEditor.js index b327974e141..1c0cb26ac70 100644 --- a/packages/js/src/containers/SnippetEditor.js +++ b/packages/js/src/containers/SnippetEditor.js @@ -7,7 +7,6 @@ import SnippetPreviewSection from "../components/SnippetPreviewSection"; import { applyReplaceUsingPlugin } from "../helpers/replacementVariableHelpers"; import getMemoizedFindCustomFields from "../helpers/getMemoizedFindCustomFields"; import WooCommerceUpsell from "../components/WooCommerceUpsell"; -import { get } from "lodash"; /** * Process the snippet editor form data before it's being displayed in the snippet preview. @@ -50,7 +49,7 @@ export const mapEditorDataToPreview = function( data, context ) { * @returns {wp.Element} The component. */ const SnippetEditorWrapper = ( props ) => { - const woocommerceUpsellLink = get( window, "wpseoScriptData.metabox.woocommerceUpsellGooglePreviewLink", "" ); + const woocommerceUpsellLink = useSelect( select => select( "yoast-seo/editor" ).selectLink( "https://yoa.st/product-google-preview-metabox" ), [] ); const woocommerceUpsell = useSelect( ( select ) => select( "yoast-seo/editor" ).getIsWooSeoUpsell(), [] ); const woocommerceUpsellText = __( "Want an enhanced Google preview of how your WooCommerce products look in the search results?", "wordpress-seo" ); diff --git a/packages/js/src/elementor/components/fills/ElementorFill.js b/packages/js/src/elementor/components/fills/ElementorFill.js index 4cef58d2909..78e9b4160a1 100644 --- a/packages/js/src/elementor/components/fills/ElementorFill.js +++ b/packages/js/src/elementor/components/fills/ElementorFill.js @@ -1,8 +1,8 @@ // External dependencies. import { Fill } from "@wordpress/components"; import { Fragment, useEffect } from "@wordpress/element"; +import { useSelect } from "@wordpress/data"; import { __ } from "@wordpress/i18n"; -import { get } from "lodash"; import PropTypes from "prop-types"; import { InternalLinkingSuggestionsUpsell } from "../../../components/modals/InternalLinkingSuggestionsUpsell"; @@ -34,7 +34,7 @@ import KeywordUpsell from "../../../components/modals/KeywordUpsell"; * @constructor */ export default function ElementorFill( { isLoading, onLoad, settings } ) { - const webinarIntroUrl = get( window, "wpseoScriptData.webinarIntroElementorUrl", "https://yoa.st/webinar-intro-elementor" ); + const webinarIntroUrl = useSelect( select => select( "yoast-seo/editor" ).selectLink( "https://yoa.st/webinar-intro-elementor" ), [] ); const FirstEligibleNotification = useFirstEligibleNotification( { webinarIntroUrl } ); useEffect( () => { diff --git a/packages/js/src/initializers/settings-header.js b/packages/js/src/initializers/settings-header.js index 5df2552a529..cde18bc1bfc 100644 --- a/packages/js/src/initializers/settings-header.js +++ b/packages/js/src/initializers/settings-header.js @@ -1,4 +1,5 @@ import { get } from "lodash"; +import { useSelect } from "@wordpress/data"; import { render } from "@wordpress/element"; import { ThemeProvider } from "styled-components"; import WebinarPromoNotification from "../components/WebinarPromoNotification"; @@ -13,7 +14,7 @@ import { shouldShowWebinarPromotionNotificationInDashboard } from "../helpers/sh const initSettingsHeader = () => { const reactRoot = document.getElementById( "yst-settings-header-root" ); const isRtl = Boolean( get( window, "wpseoScriptData.isRtl", false ) ); - const webinarIntroSettingsUrl = get( window, "wpseoScriptData.webinarIntroSettingsUrl", "https://yoa.st/webinar-intro-settings" ); + const webinarIntroSettingsUrl = useSelect( select => select( "yoast-seo/editor" ).selectLink( "https://yoa.st/webinar-intro-settings" ), [] ); const isWooCommerce = get( window, "wpseoScriptData.isWooCommerceActive", "" ); if ( reactRoot ) { diff --git a/src/integrations/third-party/elementor.php b/src/integrations/third-party/elementor.php index e2405da7262..18cbc1d5ccc 100644 --- a/src/integrations/third-party/elementor.php +++ b/src/integrations/third-party/elementor.php @@ -14,7 +14,6 @@ use WPSEO_Metabox_Formatter; use WPSEO_Post_Metabox_Formatter; use WPSEO_Replace_Vars; -use WPSEO_Shortlinker; use WPSEO_Utils; use Yoast\WP\SEO\Conditionals\Third_Party\Elementor_Edit_Conditional; use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional; @@ -425,7 +424,6 @@ public function enqueue() { 'plugins' => $plugins_script_data, 'worker' => $worker_script_data, ], - 'webinarIntroElementorUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-elementor' ), 'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage-and-post-types' ), ];