Skip to content

Commit

Permalink
Revert "21632 refactor is ai feature active property"
Browse files Browse the repository at this point in the history
  • Loading branch information
vraja-pro authored Oct 7, 2024
1 parent 827c263 commit 3aee55b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions inc/class-wpseo-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ public static function get_admin_l10n() {
'postTypeNamePlural' => ( $page_type === 'post' ) ? $label_object->label : $label_object->name,
'postTypeNameSingular' => ( $page_type === 'post' ) ? $label_object->labels->singular_name : $label_object->singular_name,
'isBreadcrumbsDisabled' => WPSEO_Options::get( 'breadcrumbs-enable', false ) !== true && ! current_theme_supports( 'yoast-seo-breadcrumbs' ),
'isAiFeatureActive' => (bool) WPSEO_Options::get( 'enable_ai_generator' ),
];

$additional_entries = apply_filters( 'wpseo_admin_l10n', [] );
Expand Down
5 changes: 3 additions & 2 deletions packages/js/src/components/contentAnalysis/SeoAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class SeoAnalysis extends Component {
const isPremium = getL10nObject().isPremium;

// Don't show the button if the AI feature is not enabled for Yoast SEO Premium users.
if ( ! this.props.isAiFeatureEnabled ) {
if ( isPremium && ! this.props.isAiFeatureEnabled ) {
return;
}

Expand Down Expand Up @@ -324,6 +324,7 @@ export default withSelect( ( select, ownProps ) => {
getMarksButtonStatus,
getResultsForKeyword,
getIsElementorEditor,
getPreference,
} = select( "yoast-seo/editor" );

const keyword = getFocusKeyphrase();
Expand All @@ -333,6 +334,6 @@ export default withSelect( ( select, ownProps ) => {
marksButtonStatus: ownProps.hideMarksButtons ? "disabled" : getMarksButtonStatus(),
keyword,
isElementor: getIsElementorEditor(),
isAiFeatureEnabled: select( "yoast-seo-premium/editor" )?.getIsAiFeatureEnabled(),
isAiFeatureEnabled: getPreference( "isAiFeatureActive", false ),
};
} )( SeoAnalysis );
1 change: 1 addition & 0 deletions packages/js/src/redux/reducers/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function getDefaultState() {
isWincherIntegrationActive: isWincherIntegrationActive(),
isInsightsEnabled: get( window, "wpseoScriptData.metabox.isInsightsEnabled", false ),
isNewsEnabled: get( window, "wpseoScriptData.metabox.isNewsSeoActive", false ),
isAiFeatureActive: Boolean( window.wpseoAdminL10n.isAiFeatureActive ),
isWooCommerceSeoActive: get( window, "wpseoScriptData.metabox.isWooCommerceSeoActive", false ),
isWooCommerceActive: get( window, "wpseoScriptData.metabox.isWooCommerceActive", false ),
};
Expand Down

0 comments on commit 3aee55b

Please sign in to comment.