Skip to content

Commit

Permalink
refactor: change order of execution for woocommerce selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
vraja-pro committed Sep 12, 2024
1 parent ebbd027 commit 2525460
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/js/src/redux/selectors/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@ export const getPreferences = state => state.preferences;
*/
export const getIsKeywordAnalysisActive = state => get( state, "preferences.isKeywordAnalysisActive", false );

/**
* Determines whether the WooCommerce SEO addon is not active in a product page.
*
* @param {Object} state The state.
* @returns {Boolean} Whether the plugin is WooCommerce SEO or not.
*/
export const getIsWooSeoUpsell = ( state ) => {
const isWooSeoActive = getIsWooSeoActive( state );
const isWooCommerceActive = getIsWooCommerceActive( state );
const isProductPage = getIsProduct( state );

return ! isWooSeoActive && isWooCommerceActive && isProductPage;
};

/**
* Get the preference for the isWooCommerceActive.
*
Expand All @@ -59,3 +45,17 @@ export const getIsWooCommerceActive = state => getPreference( state, "isWooComme
* @returns {Boolean} The preference for the isWooSeoActive.
*/
export const getIsWooSeoActive = state => getPreference( state, "isWooCommerceSeoActive", false );

/**
* Determines whether the WooCommerce SEO addon is not active in a product page.
*
* @param {Object} state The state.
* @returns {Boolean} Whether the plugin is WooCommerce SEO or not.
*/
export const getIsWooSeoUpsell = ( state ) => {
const isWooSeoActive = getIsWooSeoActive( state );
const isWooCommerceActive = getIsWooCommerceActive( state );
const isProductPage = getIsProduct( state );

return ! isWooSeoActive && isWooCommerceActive && isProductPage;
};

0 comments on commit 2525460

Please sign in to comment.