Skip to content

Commit

Permalink
move check for window object to a function
Browse files Browse the repository at this point in the history
  • Loading branch information
vraja-pro committed Jan 13, 2025
1 parent 4956f17 commit 358d7af
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
4 changes: 1 addition & 3 deletions packages/js/src/integrations-page/helper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import apiFetch from "@wordpress/api-fetch";

const isPremiumInstalled = Boolean( window.wpseoScriptData.isPremium );

/**
* Checks if an integration is active.
*
Expand Down Expand Up @@ -56,7 +54,7 @@ export const getIsMultisiteAvailable = ( integration ) => {
* @returns {bool} True if the integration is available to the user.
*/
export const getIsFreeIntegrationOrPremiumAvailable = ( integration ) => {
return ( integration.isPremium && isPremiumInstalled ) || ! integration.isPremium;
return ( integration.isPremium && Boolean( window.wpseoScriptData.isPremium ) ) || ! integration.isPremium;
};

/* eslint-disable complexity */
Expand Down
4 changes: 0 additions & 4 deletions packages/js/tests/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ global.wpApiSettings = {
root: "http://example.com",
};

global.wpseoScriptData = {
isPremium: 0,
};

/* Mock the IntersectionObserver. */
global.IntersectionObserver = class {
/**
Expand Down

0 comments on commit 358d7af

Please sign in to comment.