diff --git a/.wp-env.json b/.wp-env.json index b6cc9cdc..ce912a5b 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,5 +1,5 @@ { - "core": "WordPress/WordPress#tags/6.5.3", + "core": "WordPress/WordPress#tags/6.5.4", "config": { "WP_DEBUG": true, "WP_DEBUG_LOG": true, diff --git a/bootstrap.php b/bootstrap.php index 06acd4d9..861254c5 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -11,6 +11,7 @@ use WP_Forge\UpgradeHandler\UpgradeHandler; use NewfoldLabs\WP\ModuleLoader\Container; use NewfoldLabs\WP\ModuleLoader\Plugin; +use NewfoldLabs\WP\Module\Features\Features; use function NewfoldLabs\WP\ModuleLoader\container as setContainer; @@ -173,3 +174,6 @@ function () { if ( is_admin() ) { new Admin(); } + +// Instantiate the Features singleton +Features::getInstance(); diff --git a/composer.json b/composer.json index 20d30712..61a3ab28 100644 --- a/composer.json +++ b/composer.json @@ -73,23 +73,25 @@ "require": { "doctrine/inflector": "1.4.4 as 1.3.1", "newfold-labs/wp-module-activation": "^1.0.2", - "newfold-labs/wp-module-coming-soon": "^1.2.3", - "newfold-labs/wp-module-context": "^1.0", + "newfold-labs/wp-module-atomic": "^1.3", + "newfold-labs/wp-module-coming-soon": "^1.2.4", + "newfold-labs/wp-module-context": "^1.0.1", "newfold-labs/wp-module-data": "^2.5.0", "newfold-labs/wp-module-deactivation": "^1.1.2", "newfold-labs/wp-module-ecommerce": "^1.3.31", + "newfold-labs/wp-module-features": "^1.4.1", "newfold-labs/wp-module-global-ctb": "^1.0.11", - "newfold-labs/wp-module-help-center": "^1.0.25", + "newfold-labs/wp-module-help-center": "^2.0.0", "newfold-labs/wp-module-loader": "^1.0.10", "newfold-labs/wp-module-marketplace": "^2.2.4", "newfold-labs/wp-module-notifications": "^1.3.0", "newfold-labs/wp-module-onboarding": "^2.3.1", - "newfold-labs/wp-module-patterns": "^1.0.0", - "newfold-labs/wp-module-performance": "^1.4.1", + "newfold-labs/wp-module-patterns": "2.0.0 as 1.9.9", + "newfold-labs/wp-module-performance": "2.0.0 as 1.9.9", "newfold-labs/wp-module-runtime": "^1.0.11", "newfold-labs/wp-module-secure-passwords": "^1.1.1", "newfold-labs/wp-module-sso": "^1.0.5", - "newfold-labs/wp-module-staging": "^1.3.3", + "newfold-labs/wp-module-staging": "^2.0.0", "wp-forge/wp-update-handler": "^1.0.2", "wp-forge/wp-upgrade-handler": "^1.0" } diff --git a/composer.lock b/composer.lock index e6dc6970..ef1ba29c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7b1013ea0fcc82051124985daeb05764", + "content-hash": "fa8c079a9cd744f17dcca24fad35ae7b", "packages": [ { "name": "doctrine/inflector", @@ -298,16 +298,16 @@ }, { "name": "newfold-labs/wp-module-ai", - "version": "1.1.8", + "version": "1.1.9", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-ai.git", - "reference": "ffc1c06e69bcaf46e7ad10eda147d10a9574bcea" + "reference": "961dc65294b3b4a2c5cc4d2694bcff521cbd3ef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-ai/zipball/ffc1c06e69bcaf46e7ad10eda147d10a9574bcea", - "reference": "ffc1c06e69bcaf46e7ad10eda147d10a9574bcea", + "url": "https://api.github.com/repos/newfold-labs/wp-module-ai/zipball/961dc65294b3b4a2c5cc4d2694bcff521cbd3ef8", + "reference": "961dc65294b3b4a2c5cc4d2694bcff521cbd3ef8", "shasum": "" }, "require": { @@ -336,23 +336,76 @@ ], "description": "A module for providing artificial intelligence capabilities.", "support": { - "source": "https://github.com/newfold-labs/wp-module-ai/tree/1.1.8", + "source": "https://github.com/newfold-labs/wp-module-ai/tree/1.1.9", "issues": "https://github.com/newfold-labs/wp-module-ai/issues" }, - "time": "2024-04-08T16:04:32+00:00" + "time": "2024-05-20T17:10:20+00:00" + }, + { + "name": "newfold-labs/wp-module-atomic", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-module-atomic.git", + "reference": "8207104d63db8775b4b0c2a22d1bb016df0d82bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-module-atomic/zipball/8207104d63db8775b4b0c2a22d1bb016df0d82bb", + "reference": "8207104d63db8775b4b0c2a22d1bb016df0d82bb", + "shasum": "" + }, + "require": { + "newfold-labs/wp-module-context": "^1.0" + }, + "require-dev": { + "newfold-labs/wp-php-standards": "^1.2.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "NewfoldLabs\\WP\\Module\\Atomic\\": "includes" + }, + "files": [ + "bootstrap.php" + ] + }, + "scripts": { + "fix": [ + "vendor/bin/phpcbf . --standard=phpcs.xml" + ], + "lint": [ + "vendor/bin/phpcs . --standard=phpcs.xml -s" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Evan Mullins", + "homepage": "https://evanmullins.com" + } + ], + "description": "A module to customize a brand plugin for wp cloud environments.", + "support": { + "source": "https://github.com/newfold-labs/wp-module-atomic/tree/1.3.0", + "issues": "https://github.com/newfold-labs/wp-module-atomic/issues" + }, + "time": "2024-05-31T16:25:56+00:00" }, { "name": "newfold-labs/wp-module-coming-soon", - "version": "1.2.3", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-coming-soon.git", - "reference": "335bfe833ebdc072de55ed54cd6eebe0a210e43f" + "reference": "05112a5908bb08ca0aa3aa7d7e7c508d44401b28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-coming-soon/zipball/335bfe833ebdc072de55ed54cd6eebe0a210e43f", - "reference": "335bfe833ebdc072de55ed54cd6eebe0a210e43f", + "url": "https://api.github.com/repos/newfold-labs/wp-module-coming-soon/zipball/05112a5908bb08ca0aa3aa7d7e7c508d44401b28", + "reference": "05112a5908bb08ca0aa3aa7d7e7c508d44401b28", "shasum": "" }, "require": { @@ -390,23 +443,23 @@ ], "description": "Coming Soon module for WordPress sites.", "support": { - "source": "https://github.com/newfold-labs/wp-module-coming-soon/tree/1.2.3", + "source": "https://github.com/newfold-labs/wp-module-coming-soon/tree/1.2.4", "issues": "https://github.com/newfold-labs/wp-module-coming-soon/issues" }, - "time": "2024-02-29T19:54:02+00:00" + "time": "2024-05-31T16:22:17+00:00" }, { "name": "newfold-labs/wp-module-context", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-context.git", - "reference": "0d852f83f353f1631309e5ae7da9cb1e046bc984" + "reference": "fb57e927df45ef33573fe7f429ef1e088b0a6df0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-context/zipball/0d852f83f353f1631309e5ae7da9cb1e046bc984", - "reference": "0d852f83f353f1631309e5ae7da9cb1e046bc984", + "url": "https://api.github.com/repos/newfold-labs/wp-module-context/zipball/fb57e927df45ef33573fe7f429ef1e088b0a6df0", + "reference": "fb57e927df45ef33573fe7f429ef1e088b0a6df0", "shasum": "" }, "require": { @@ -444,26 +497,27 @@ ], "description": "Newfold module to determine context for various brands and platforms.", "support": { - "source": "https://github.com/newfold-labs/wp-module-context/tree/1.0.0", + "source": "https://github.com/newfold-labs/wp-module-context/tree/1.0.1", "issues": "https://github.com/newfold-labs/wp-module-context/issues" }, - "time": "2024-02-22T18:22:13+00:00" + "time": "2024-05-23T20:34:28+00:00" }, { "name": "newfold-labs/wp-module-data", - "version": "2.5.0", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-data.git", - "reference": "42bdfdece373e194b405f6b9a9e2a9e07154dfb9" + "reference": "bd9642c155735fac8f114ea1eb237da4a72eb267" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-data/zipball/42bdfdece373e194b405f6b9a9e2a9e07154dfb9", - "reference": "42bdfdece373e194b405f6b9a9e2a9e07154dfb9", + "url": "https://api.github.com/repos/newfold-labs/wp-module-data/zipball/bd9642c155735fac8f114ea1eb237da4a72eb267", + "reference": "bd9642c155735fac8f114ea1eb237da4a72eb267", "shasum": "" }, "require": { + "ext-json": "*", "newfold-labs/wp-module-loader": "^1.0", "wp-forge/helpers": "^2.0", "wp-forge/wp-query-builder": "^1.0", @@ -493,6 +547,9 @@ "fix": [ "vendor/bin/phpcbf . --standard=phpcs.xml" ], + "cs-changes": [ + "updated_files=$( git status | grep '\\(new file\\|modified\\):\\s.*.php$' | cut -c14- | awk '{ printf(\"%s \", $0) }' ); echo \"\\nChecking\"$(git status | grep '\\(new file\\|modified\\):\\s.*.php$' | tail -n+2 | wc -l)\" files\"; phpcbf $(echo $updated_files); phpcs $(echo $updated_files);" + ], "lint": [ "vendor/bin/phpcs . --standard=phpcs.xml -s" ] @@ -502,10 +559,10 @@ ], "description": "Newfold Data Module", "support": { - "source": "https://github.com/newfold-labs/wp-module-data/tree/2.5.0", + "source": "https://github.com/newfold-labs/wp-module-data/tree/2.5.2", "issues": "https://github.com/newfold-labs/wp-module-data/issues" }, - "time": "2024-05-15T00:31:16+00:00" + "time": "2024-05-30T18:45:12+00:00" }, { "name": "newfold-labs/wp-module-deactivation", @@ -669,6 +726,63 @@ }, "time": "2024-05-03T10:09:41+00:00" }, + { + "name": "newfold-labs/wp-module-features", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-module-features.git", + "reference": "d22ca49d2235ac7797fa6ad315ceaf7edec9bd31" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-module-features/zipball/d22ca49d2235ac7797fa6ad315ceaf7edec9bd31", + "reference": "d22ca49d2235ac7797fa6ad315ceaf7edec9bd31", + "shasum": "" + }, + "require": { + "wp-forge/wp-options": "^1.1.1" + }, + "require-dev": { + "newfold-labs/wp-php-standards": "^1.2.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "NewfoldLabs\\WP\\Module\\Features\\": "includes" + }, + "files": [ + "includes/functions.php" + ] + }, + "scripts": { + "fix": [ + "vendor/bin/phpcbf . --standard=phpcs.xml" + ], + "lint": [ + "vendor/bin/phpcs . --standard=phpcs.xml -s" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "homepage": "https://wpscholar.com" + }, + { + "name": "Evan Mullins", + "homepage": "https://evanmullins.com" + } + ], + "description": "A module for providing an interface for features.", + "support": { + "source": "https://github.com/newfold-labs/wp-module-features/tree/1.4.1", + "issues": "https://github.com/newfold-labs/wp-module-features/issues" + }, + "time": "2024-05-28T18:01:46+00:00" + }, { "name": "newfold-labs/wp-module-global-ctb", "version": "1.0.11", @@ -721,21 +835,22 @@ }, { "name": "newfold-labs/wp-module-help-center", - "version": "1.0.25", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-help-center.git", - "reference": "6ec172715dcc43103b790878be4ac38e4223ce13" + "reference": "da9d0d08d5067285c7d36d31b8db58434af2184e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-help-center/zipball/6ec172715dcc43103b790878be4ac38e4223ce13", - "reference": "6ec172715dcc43103b790878be4ac38e4223ce13", + "url": "https://api.github.com/repos/newfold-labs/wp-module-help-center/zipball/da9d0d08d5067285c7d36d31b8db58434af2184e", + "reference": "da9d0d08d5067285c7d36d31b8db58434af2184e", "shasum": "" }, "require": { - "newfold-labs/wp-module-ai": "^1.1.7", - "newfold-labs/wp-module-data": "^2.3.4" + "newfold-labs/wp-module-ai": "^1.1.9", + "newfold-labs/wp-module-data": "^2.5.0", + "newfold-labs/wp-module-features": "^1.4.1" }, "require-dev": { "newfold-labs/wp-php-standards": "@stable" @@ -760,10 +875,10 @@ ], "description": "HelpCenter", "support": { - "source": "https://github.com/newfold-labs/wp-module-help-center/tree/1.0.25", + "source": "https://github.com/newfold-labs/wp-module-help-center/tree/2.0.0", "issues": "https://github.com/newfold-labs/wp-module-help-center/issues" }, - "time": "2024-04-26T13:58:31+00:00" + "time": "2024-05-29T14:37:29+00:00" }, { "name": "newfold-labs/wp-module-install-checker", @@ -1163,20 +1278,24 @@ }, { "name": "newfold-labs/wp-module-patterns", - "version": "1.0.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-patterns.git", - "reference": "3f41c4cc25b27f1e488a9cc2ffd82f5bc953128a" + "reference": "89c05ae08ebffe28521c876eb839a7bc9b60d02a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-patterns/zipball/3f41c4cc25b27f1e488a9cc2ffd82f5bc953128a", - "reference": "3f41c4cc25b27f1e488a9cc2ffd82f5bc953128a", + "url": "https://api.github.com/repos/newfold-labs/wp-module-patterns/zipball/89c05ae08ebffe28521c876eb839a7bc9b60d02a", + "reference": "89c05ae08ebffe28521c876eb839a7bc9b60d02a", "shasum": "" }, + "require": { + "newfold-labs/wp-module-data": "^2.5.1", + "newfold-labs/wp-module-features": "^1.4" + }, "require-dev": { - "newfold-labs/wp-php-standards": "^1.2" + "newfold-labs/wp-php-standards": "^1.2.2" }, "type": "library", "autoload": { @@ -1206,30 +1325,34 @@ ], "description": "WordPress Cloud Patterns", "support": { - "source": "https://github.com/newfold-labs/wp-module-patterns/tree/1.0.0", + "source": "https://github.com/newfold-labs/wp-module-patterns/tree/2.0.0", "issues": "https://github.com/newfold-labs/wp-module-patterns/issues" }, - "time": "2024-05-01T20:37:14+00:00" + "time": "2024-05-29T16:10:58+00:00" }, { "name": "newfold-labs/wp-module-performance", - "version": "1.4.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-performance.git", - "reference": "5e4c87d404788c61ea55e3c62e29e5df48c36340" + "reference": "91021b0f90e8a778fc7b96e71d1d4b25c1eebdfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-performance/zipball/5e4c87d404788c61ea55e3c62e29e5df48c36340", - "reference": "5e4c87d404788c61ea55e3c62e29e5df48c36340", + "url": "https://api.github.com/repos/newfold-labs/wp-module-performance/zipball/91021b0f90e8a778fc7b96e71d1d4b25c1eebdfb", + "reference": "91021b0f90e8a778fc7b96e71d1d4b25c1eebdfb", "shasum": "" }, "require": { "newfold-labs/wp-module-context": "^1.0", - "wp-forge/collection": "^1.0", + "newfold-labs/wp-module-features": "^1.3", + "wp-forge/collection": "^1.0.2", "wp-forge/wp-htaccess-manager": "^1.0", - "wpscholar/url": "^1.2" + "wpscholar/url": "^1.2.2" + }, + "require-dev": { + "newfold-labs/wp-php-standards": "^1.2.3" }, "type": "library", "autoload": { @@ -1237,6 +1360,7 @@ "NewfoldLabs\\WP\\Module\\Performance\\": "includes" }, "files": [ + "includes/PerformanceFeature.php", "includes/functions.php", "bootstrap.php" ] @@ -1252,10 +1376,10 @@ ], "description": "A module for managing caching functionality.", "support": { - "source": "https://github.com/newfold-labs/wp-module-performance/tree/1.4.1", + "source": "https://github.com/newfold-labs/wp-module-performance/tree/2.0.0", "issues": "https://github.com/newfold-labs/wp-module-performance/issues" }, - "time": "2024-04-22T22:30:42+00:00" + "time": "2024-05-29T15:57:11+00:00" }, { "name": "newfold-labs/wp-module-runtime", @@ -1405,23 +1529,24 @@ }, { "name": "newfold-labs/wp-module-staging", - "version": "1.3.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-staging.git", - "reference": "c464472e3a5886d9639563262e776b33f8135398" + "reference": "dae822eec83521f6538844877ee98e637004514d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-staging/zipball/c464472e3a5886d9639563262e776b33f8135398", - "reference": "c464472e3a5886d9639563262e776b33f8135398", + "url": "https://api.github.com/repos/newfold-labs/wp-module-staging/zipball/dae822eec83521f6538844877ee98e637004514d", + "reference": "dae822eec83521f6538844877ee98e637004514d", "shasum": "" }, "require": { - "newfold-labs/wp-module-context": "^1.0" + "newfold-labs/wp-module-context": "^1.0", + "newfold-labs/wp-module-features": "^1.3.0" }, "require-dev": { - "newfold-labs/wp-php-standards": "^1.2" + "newfold-labs/wp-php-standards": "^1.2.2" }, "type": "library", "autoload": { @@ -1451,10 +1576,10 @@ ], "description": "Newfold module for staging functionality in brand plugins", "support": { - "source": "https://github.com/newfold-labs/wp-module-staging/tree/1.3.3", + "source": "https://github.com/newfold-labs/wp-module-staging/tree/2.0.0", "issues": "https://github.com/newfold-labs/wp-module-staging/issues" }, - "time": "2024-04-10T20:37:51+00:00" + "time": "2024-05-29T14:18:17+00:00" }, { "name": "wp-cli/wp-config-transformer", @@ -3271,6 +3396,18 @@ "version": "1.4.4.0", "alias": "1.3.1", "alias_normalized": "1.3.1.0" + }, + { + "package": "newfold-labs/wp-module-patterns", + "version": "2.0.0.0", + "alias": "1.9.9", + "alias_normalized": "1.9.9.0" + }, + { + "package": "newfold-labs/wp-module-performance", + "version": "2.0.0.0", + "alias": "1.9.9", + "alias_normalized": "1.9.9.0" } ], "minimum-stability": "stable", @@ -3282,5 +3419,5 @@ "platform-overrides": { "php": "7.3.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/inc/Admin.php b/inc/Admin.php index 60a561de..673d8cf3 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -7,6 +7,8 @@ namespace HostGator; +use function NewfoldLabs\WP\Module\Features\isEnabled; + /** * \HostGator\Admin */ @@ -58,15 +60,46 @@ public static function add_to_runtime( $sdk ) { * @return array */ public static function subpages() { - return array( - 'hostgator#/home' => __( 'Home', 'wp-plugin-hostgator' ), + $home = array( + 'hostgator#/home' => __( 'Home', 'wp-plugin-hostgator' ), + ); + $pagesAndPosts = array( 'hostgator#/pages-and-posts' => __( 'Pages & Posts', 'wp-plugin-hostgator' ), - 'hostgator#/store' => __( 'Store', 'wp-plugin-hostgator' ), - 'hostgator#/marketplace' => __( 'Marketplace', 'wp-plugin-hostgator' ), - 'hostgator#/performance' => __( 'Performance', 'wp-plugin-hostgator' ), - 'hostgator#/settings' => __( 'Settings', 'wp-plugin-hostgator' ), - 'hostgator#/staging' => __( 'Staging', 'wp-plugin-hostgator' ), - 'hostgator#/help' => __( 'Help', 'wp-plugin-hostgator' ), + ); + $store = array( + 'hostgator#/store' => __( 'Store', 'wp-plugin-hostgator' ), + ); + $marketplace = array( + 'hostgator#/marketplace' => __( 'Marketplace', 'wp-plugin-hostgator' ), + ); + // add performance if enabled + $performance = isEnabled( 'performance' ) + ? array( + 'hostgator#/performance' => __( 'Performance', 'wp-plugin-hostgator' ), + ) + : array(); + $settings = array( + 'hostgator#/settings' => __( 'Settings', 'wp-plugin-hostgator' ), + ); + // add staging if enabled + $staging = isEnabled( 'staging' ) + ? array( + 'hostgator#/staging' => __( 'Staging', 'wp-plugin-hostgator' ), + ) + : array(); + $help = array( + 'hostgator#/help' => __( 'Help', 'wp-plugin-hostgator' ), + ); + + return array_merge( + $home, + $pagesAndPosts, + $store, + $marketplace, + $performance, + $settings, + $staging, + $help, ); } @@ -256,7 +289,7 @@ public static function assets() { \wp_register_script( 'hostgator-script', HOSTGATOR_BUILD_URL . '/index.js', - array_merge( $asset['dependencies'], array( 'nfd-runtime' ) ), + array_merge( $asset['dependencies'], array( 'newfold-features', 'nfd-runtime' ) ), $asset['version'], true ); diff --git a/languages/wp-plugin-hostgator-es_MX-6754b94c301a2874d64de27b8b37f8dd.json b/languages/wp-plugin-hostgator-es_MX-6754b94c301a2874d64de27b8b37f8dd.json index 94d497e6..5219b66d 100644 --- a/languages/wp-plugin-hostgator-es_MX-6754b94c301a2874d64de27b8b37f8dd.json +++ b/languages/wp-plugin-hostgator-es_MX-6754b94c301a2874d64de27b8b37f8dd.json @@ -602,6 +602,33 @@ ], "Edit your homepage and other existing pages or add new pages to your site.": [ "" + ], + "Admin": [ + "" + ], + "Secret page to manage admin features and settings.": [ + "" + ], + "The Help Center provides guided, step-by-step assistance as you build your site.": [ + "" + ], + "Sorry, that is not allowed.": [ + "" + ], + "This feature cannot currently be modified.": [ + "" + ], + "Features": [ + "" + ], + "The performance feature provides improvements to loads faster for visitors including cache settings.": [ + "" + ], + "The staging feature provides a way to copy a site to test new updates, features or content.": [ + "" + ], + "Wonder Blocks provides a library of customizable block patterns and page templates.": [ + "" ] } } diff --git a/languages/wp-plugin-hostgator-es_MX.po b/languages/wp-plugin-hostgator-es_MX.po index 464e457b..e1a7265c 100644 --- a/languages/wp-plugin-hostgator-es_MX.po +++ b/languages/wp-plugin-hostgator-es_MX.po @@ -37,86 +37,86 @@ msgstr "Plugin WordPress que integra un sitio web a WordPress con el panel de co #. Author of the plugin #: wp-plugin-hostgator.php -#: inc/Admin.php:190 -#: inc/Admin.php:191 +#: inc/Admin.php:223 +#: inc/Admin.php:224 msgid "HostGator" msgstr "HostGator" -#: bootstrap.php:22 +#: bootstrap.php:23 msgid "Please install the HostGator Plugin dependencies." msgstr "Instale las dependencias del Plugin HostGator." -#: bootstrap.php:73 +#: bootstrap.php:74 msgid "A New WordPress Site" msgstr "Un Nuevo Sitio Web WordPress" -#: bootstrap.php:74 +#: bootstrap.php:75 msgid "Coming Soon!" msgstr "¡Muy Pronto!" #. translators: %1$s is replaced with opening link tag taking you to hostgator.com/wordpress, %2$s is replaced with closing link tag, %3$s is replaced with opening link tag taking you to login page, %4$s is replaced with closing link tag, %5$s is replaced with opening link tag taking you to portal.hostgator.com, %6$s is replaced with closing link tag. -#: bootstrap.php:87 +#: bootstrap.php:88 msgid "A %1$sHostGator%2$s powered website. Is this your website? Log in to %3$sWordPress%4$s or %5$sHostgator%6$s." msgstr "Un sitio web creado por %1$sHostGator%2$s. ¿Este sitio web es suyo? Inicie sesión en %3$sWordPress%4$s o %5$sHostGator%6$s." #. translators: %s is Blog name -#: bootstrap.php:97 +#: bootstrap.php:98 msgid "%s — Coming Soon" msgstr "¡Muy Pronto!" -#: bootstrap.php:100 +#: bootstrap.php:101 msgid "Coming Soon Active" msgstr "Muy Pronto Activo" #. translators: %1$s is replaced with the opening link tag, %2$s is replaced with the closing link tag, %3$s is the opening link tag to preview the page, %4$s is the closing link tag. -#: bootstrap.php:103 +#: bootstrap.php:104 msgid "Your site is currently displaying a %1$scoming soon page%2$s. Once you are ready, %3$slaunch your site%4$s." msgstr "Su sitio web está mostrando actualmente una %1$spágina de muy pronto%2$s. Una vez que esté listo, %3$slance su sitio web%4$s." -#: bootstrap.php:104 +#: bootstrap.php:105 msgid "Preview the coming soon landing page" msgstr "Obtener una vista previa de la próxima página de destino" -#: inc/Admin.php:62 -#: inc/Admin.php:313 +#: inc/Admin.php:64 +#: inc/Admin.php:346 #: build/2.8.0/index.js:1 msgid "Home" msgstr "Pagina principal" -#: inc/Admin.php:65 +#: inc/Admin.php:73 #: build/2.8.0/index.js:1 msgid "Marketplace" msgstr "Mercado en Línea" -#: inc/Admin.php:66 +#: inc/Admin.php:78 #: build/2.8.0/index.js:1 msgid "Performance" msgstr "Rendimiento" -#: inc/Admin.php:67 -#: inc/Admin.php:314 +#: inc/Admin.php:82 +#: inc/Admin.php:347 #: build/2.8.0/index.js:1 msgid "Settings" msgstr "Configuraciones" -#: inc/Admin.php:69 +#: inc/Admin.php:91 #: build/2.8.0/index.js:1 msgid "Help" msgstr "Ayuda" -#: inc/Admin.php:233 +#: inc/Admin.php:266 msgid "Please update to a newer WordPress version." msgstr "Por favor actualice a una versión más nueva de WordPress." -#: inc/Admin.php:234 +#: inc/Admin.php:267 msgid "There are new WordPress components which this plugin requires in order to render the interface." msgstr "Hay nuevos componentes de WordPress que este plugin requiere para renderizar la interfaz." -#: inc/Admin.php:235 +#: inc/Admin.php:268 msgid "Please update now" msgstr "Por favor actualice ahora" -#: inc/Admin.php:327 +#: inc/Admin.php:360 msgid "Thank you for creating with WordPress and HostGator." msgstr "Gracias por crear con WordPress y HostGator." @@ -632,12 +632,12 @@ msgstr "Controles para revisiones de contenido y con qué frecuencia vaciar la p msgid "This is where you can manage common settings for your website." msgstr "Aquí es donde puedes gestionar las configuraciones comunes para tu sitio web." -#: inc/Admin.php:64 +#: inc/Admin.php:70 #: build/2.8.0/index.js:1 msgid "Store" msgstr "" -#: inc/Admin.php:68 +#: inc/Admin.php:87 #: build/2.8.0/index.js:1 msgid "Staging" msgstr "" @@ -874,19 +874,19 @@ msgstr "" msgid "Working…" msgstr "" -#: bootstrap.php:77 +#: bootstrap.php:78 msgid "How to build your WordPress Website" msgstr "" -#: bootstrap.php:80 +#: bootstrap.php:81 msgid "How to Migrate a Website to Hostgator?" msgstr "" -#: bootstrap.php:83 +#: bootstrap.php:84 msgid "Why choose HostGator for your WordPress site?" msgstr "" -#: inc/Admin.php:63 +#: inc/Admin.php:67 #: build/2.8.0/index.js:1 msgid "Pages & Posts" msgstr "" @@ -958,3 +958,39 @@ msgstr "" #: build/2.8.0/index.js:1 msgid "Edit your homepage and other existing pages or add new pages to your site." msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Admin" +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Secret page to manage admin features and settings." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The Help Center provides guided, step-by-step assistance as you build your site." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Sorry, that is not allowed." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "This feature cannot currently be modified." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Features" +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The performance feature provides improvements to loads faster for visitors including cache settings." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The staging feature provides a way to copy a site to test new updates, features or content." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Wonder Blocks provides a library of customizable block patterns and page templates." +msgstr "" diff --git a/languages/wp-plugin-hostgator-pt_BR-6754b94c301a2874d64de27b8b37f8dd.json b/languages/wp-plugin-hostgator-pt_BR-6754b94c301a2874d64de27b8b37f8dd.json index 5b3fd601..8c4f3ab5 100644 --- a/languages/wp-plugin-hostgator-pt_BR-6754b94c301a2874d64de27b8b37f8dd.json +++ b/languages/wp-plugin-hostgator-pt_BR-6754b94c301a2874d64de27b8b37f8dd.json @@ -602,6 +602,33 @@ ], "Edit your homepage and other existing pages or add new pages to your site.": [ "" + ], + "Admin": [ + "" + ], + "Secret page to manage admin features and settings.": [ + "" + ], + "The Help Center provides guided, step-by-step assistance as you build your site.": [ + "" + ], + "Sorry, that is not allowed.": [ + "" + ], + "This feature cannot currently be modified.": [ + "" + ], + "Features": [ + "" + ], + "The performance feature provides improvements to loads faster for visitors including cache settings.": [ + "" + ], + "The staging feature provides a way to copy a site to test new updates, features or content.": [ + "" + ], + "Wonder Blocks provides a library of customizable block patterns and page templates.": [ + "" ] } } diff --git a/languages/wp-plugin-hostgator-pt_BR.po b/languages/wp-plugin-hostgator-pt_BR.po index 2cdd7178..43fa2052 100644 --- a/languages/wp-plugin-hostgator-pt_BR.po +++ b/languages/wp-plugin-hostgator-pt_BR.po @@ -37,96 +37,96 @@ msgstr "Plugin WordPress que integra um site WordPress com o painel de controle #. Author of the plugin #: wp-plugin-hostgator.php -#: inc/Admin.php:190 -#: inc/Admin.php:191 +#: inc/Admin.php:223 +#: inc/Admin.php:224 msgid "HostGator" msgstr "HostGator" -#: bootstrap.php:22 +#: bootstrap.php:23 msgid "Please install the HostGator Plugin dependencies." msgstr "Por favor instale as dependências do Plugin HostGator." -#: bootstrap.php:73 +#: bootstrap.php:74 msgid "A New WordPress Site" msgstr "Um Novo Site WordPress" -#: bootstrap.php:74 +#: bootstrap.php:75 msgid "Coming Soon!" msgstr "Em Breve!" #. translators: %1$s is replaced with opening link tag taking you to hostgator.com/wordpress, %2$s is replaced with closing link tag, %3$s is replaced with opening link tag taking you to login page, %4$s is replaced with closing link tag, %5$s is replaced with opening link tag taking you to portal.hostgator.com, %6$s is replaced with closing link tag. -#: bootstrap.php:87 +#: bootstrap.php:88 msgid "A %1$sHostGator%2$s powered website. Is this your website? Log in to %3$sWordPress%4$s or %5$sHostgator%6$s." msgstr "Um site alimentado por %1$sHostGator%2$s. Este é o seu site? Inicie sessão em %3$sWordPress%4$s ou %5$sHostgator%6$s." #. translators: %s is Blog name -#: bootstrap.php:97 +#: bootstrap.php:98 msgid "%s — Coming Soon" msgstr "%s — Em Breve" -#: bootstrap.php:100 +#: bootstrap.php:101 msgid "Coming Soon Active" msgstr "Ativo Em Breve" #. translators: %1$s is replaced with the opening link tag, %2$s is replaced with the closing link tag, %3$s is the opening link tag to preview the page, %4$s is the closing link tag. -#: bootstrap.php:103 +#: bootstrap.php:104 msgid "Your site is currently displaying a %1$scoming soon page%2$s. Once you are ready, %3$slaunch your site%4$s." msgstr "Seu site está exibindo uma %1$spágina em breve%2$s. Assim que estiver pronto, %3$slance seu site%4$s." -#: bootstrap.php:104 +#: bootstrap.php:105 msgid "Preview the coming soon landing page" msgstr "Visualize a página de destino em breve" -#: inc/Admin.php:62 -#: inc/Admin.php:313 +#: inc/Admin.php:64 +#: inc/Admin.php:346 #: build/2.8.0/index.js:1 msgid "Home" msgstr "Início" -#: inc/Admin.php:64 +#: inc/Admin.php:70 #: build/2.8.0/index.js:1 msgid "Store" msgstr "Loja" -#: inc/Admin.php:65 +#: inc/Admin.php:73 #: build/2.8.0/index.js:1 msgid "Marketplace" msgstr "Mercado" -#: inc/Admin.php:66 +#: inc/Admin.php:78 #: build/2.8.0/index.js:1 msgid "Performance" msgstr "Desempenho" -#: inc/Admin.php:67 -#: inc/Admin.php:314 +#: inc/Admin.php:82 +#: inc/Admin.php:347 #: build/2.8.0/index.js:1 msgid "Settings" msgstr "Configurações" -#: inc/Admin.php:68 +#: inc/Admin.php:87 #: build/2.8.0/index.js:1 msgid "Staging" msgstr "Encenação" -#: inc/Admin.php:69 +#: inc/Admin.php:91 #: build/2.8.0/index.js:1 msgid "Help" msgstr "Ajuda" -#: inc/Admin.php:233 +#: inc/Admin.php:266 msgid "Please update to a newer WordPress version." msgstr "Por favor, atualize para uma versão mais recente do WordPress." -#: inc/Admin.php:234 +#: inc/Admin.php:267 msgid "There are new WordPress components which this plugin requires in order to render the interface." msgstr "Existem novos componentes do WordPress que este plugin precisa para renderizar a interface." -#: inc/Admin.php:235 +#: inc/Admin.php:268 msgid "Please update now" msgstr "Por favor, atualize agora" -#: inc/Admin.php:327 +#: inc/Admin.php:360 msgid "Thank you for creating with WordPress and HostGator." msgstr "Obrigado por criar com WordPress e HostGator." @@ -874,19 +874,19 @@ msgstr "Vendas & Promoções" msgid "Working…" msgstr "Trabalhando…" -#: bootstrap.php:77 +#: bootstrap.php:78 msgid "How to build your WordPress Website" msgstr "" -#: bootstrap.php:80 +#: bootstrap.php:81 msgid "How to Migrate a Website to Hostgator?" msgstr "" -#: bootstrap.php:83 +#: bootstrap.php:84 msgid "Why choose HostGator for your WordPress site?" msgstr "" -#: inc/Admin.php:63 +#: inc/Admin.php:67 #: build/2.8.0/index.js:1 msgid "Pages & Posts" msgstr "" @@ -958,3 +958,39 @@ msgstr "" #: build/2.8.0/index.js:1 msgid "Edit your homepage and other existing pages or add new pages to your site." msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Admin" +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Secret page to manage admin features and settings." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The Help Center provides guided, step-by-step assistance as you build your site." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Sorry, that is not allowed." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "This feature cannot currently be modified." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Features" +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The performance feature provides improvements to loads faster for visitors including cache settings." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The staging feature provides a way to copy a site to test new updates, features or content." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Wonder Blocks provides a library of customizable block patterns and page templates." +msgstr "" diff --git a/languages/wp-plugin-hostgator.pot b/languages/wp-plugin-hostgator.pot index 63dd1b6d..32bd312f 100644 --- a/languages/wp-plugin-hostgator.pot +++ b/languages/wp-plugin-hostgator.pot @@ -32,113 +32,113 @@ msgstr "" #. Author of the plugin #: wp-plugin-hostgator.php -#: inc/Admin.php:190 -#: inc/Admin.php:191 +#: inc/Admin.php:223 +#: inc/Admin.php:224 msgid "HostGator" msgstr "" -#: bootstrap.php:22 +#: bootstrap.php:23 msgid "Please install the HostGator Plugin dependencies." msgstr "" -#: bootstrap.php:73 +#: bootstrap.php:74 msgid "A New WordPress Site" msgstr "" -#: bootstrap.php:74 +#: bootstrap.php:75 msgid "Coming Soon!" msgstr "" -#: bootstrap.php:77 +#: bootstrap.php:78 msgid "How to build your WordPress Website" msgstr "" -#: bootstrap.php:80 +#: bootstrap.php:81 msgid "How to Migrate a Website to Hostgator?" msgstr "" -#: bootstrap.php:83 +#: bootstrap.php:84 msgid "Why choose HostGator for your WordPress site?" msgstr "" #. translators: %1$s is replaced with opening link tag taking you to hostgator.com/wordpress, %2$s is replaced with closing link tag, %3$s is replaced with opening link tag taking you to login page, %4$s is replaced with closing link tag, %5$s is replaced with opening link tag taking you to portal.hostgator.com, %6$s is replaced with closing link tag. -#: bootstrap.php:87 +#: bootstrap.php:88 msgid "A %1$sHostGator%2$s powered website. Is this your website? Log in to %3$sWordPress%4$s or %5$sHostgator%6$s." msgstr "" #. translators: %s is Blog name -#: bootstrap.php:97 +#: bootstrap.php:98 msgid "%s — Coming Soon" msgstr "" -#: bootstrap.php:100 +#: bootstrap.php:101 msgid "Coming Soon Active" msgstr "" #. translators: %1$s is replaced with the opening link tag, %2$s is replaced with the closing link tag, %3$s is the opening link tag to preview the page, %4$s is the closing link tag. -#: bootstrap.php:103 +#: bootstrap.php:104 msgid "Your site is currently displaying a %1$scoming soon page%2$s. Once you are ready, %3$slaunch your site%4$s." msgstr "" -#: bootstrap.php:104 +#: bootstrap.php:105 msgid "Preview the coming soon landing page" msgstr "" -#: inc/Admin.php:62 -#: inc/Admin.php:313 +#: inc/Admin.php:64 +#: inc/Admin.php:346 #: build/2.8.0/index.js:1 msgid "Home" msgstr "" -#: inc/Admin.php:63 +#: inc/Admin.php:67 #: build/2.8.0/index.js:1 msgid "Pages & Posts" msgstr "" -#: inc/Admin.php:64 +#: inc/Admin.php:70 #: build/2.8.0/index.js:1 msgid "Store" msgstr "" -#: inc/Admin.php:65 +#: inc/Admin.php:73 #: build/2.8.0/index.js:1 msgid "Marketplace" msgstr "" -#: inc/Admin.php:66 +#: inc/Admin.php:78 #: build/2.8.0/index.js:1 msgid "Performance" msgstr "" -#: inc/Admin.php:67 -#: inc/Admin.php:314 +#: inc/Admin.php:82 +#: inc/Admin.php:347 #: build/2.8.0/index.js:1 msgid "Settings" msgstr "" -#: inc/Admin.php:68 +#: inc/Admin.php:87 #: build/2.8.0/index.js:1 msgid "Staging" msgstr "" -#: inc/Admin.php:69 +#: inc/Admin.php:91 #: build/2.8.0/index.js:1 msgid "Help" msgstr "" -#: inc/Admin.php:233 +#: inc/Admin.php:266 msgid "Please update to a newer WordPress version." msgstr "" -#: inc/Admin.php:234 +#: inc/Admin.php:267 msgid "There are new WordPress components which this plugin requires in order to render the interface." msgstr "" -#: inc/Admin.php:235 +#: inc/Admin.php:268 msgid "Please update now" msgstr "" -#: inc/Admin.php:327 +#: inc/Admin.php:360 msgid "Thank you for creating with WordPress and HostGator." msgstr "" @@ -308,6 +308,14 @@ msgstr "" msgid "Store Details" msgstr "" +#: build/2.8.0/index.js:1 +msgid "Admin" +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Secret page to manage admin features and settings." +msgstr "" + #: build/2.8.0/index.js:1 msgid "We are available 24/7 to help answer questions and solve your problems." msgstr "" @@ -770,10 +778,38 @@ msgstr "" msgid "Controls for content revisions and how often to empty the trash." msgstr "" +#: build/2.8.0/index.js:1 +msgid "The Help Center provides guided, step-by-step assistance as you build your site." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Sorry, that is not allowed." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "This feature cannot currently be modified." +msgstr "" + #: build/2.8.0/index.js:1 msgid "This is where you can manage common settings for your website." msgstr "" +#: build/2.8.0/index.js:1 +msgid "Features" +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The performance feature provides improvements to loads faster for visitors including cache settings." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "The staging feature provides a way to copy a site to test new updates, features or content." +msgstr "" + +#: build/2.8.0/index.js:1 +msgid "Wonder Blocks provides a library of customizable block patterns and page templates." +msgstr "" + #: build/2.8.0/index.js:1 msgid "Cancel" msgstr "" diff --git a/phpcs.xml b/phpcs.xml index 32b85cda..b32f2197 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -2,7 +2,7 @@ - + /assets /build diff --git a/src/app/components/app-nav/index.js b/src/app/components/app-nav/index.js index 5d6246c6..d0663a70 100644 --- a/src/app/components/app-nav/index.js +++ b/src/app/components/app-nav/index.js @@ -26,17 +26,20 @@ export const SideNavMenu = () => { const primaryMenu = () => { return (
    - { topRoutes.map( ( page ) => ( - - ) ) } + { topRoutes.map( + ( page ) => + true === page.condition && ( + + ) + ) }
); }; diff --git a/src/app/components/notifications/feed.js b/src/app/components/notifications/index.js similarity index 100% rename from src/app/components/notifications/feed.js rename to src/app/components/notifications/index.js diff --git a/src/app/data/routes.js b/src/app/data/routes.js index 12f78c0f..6e30f07f 100644 --- a/src/app/data/routes.js +++ b/src/app/data/routes.js @@ -12,13 +12,14 @@ import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime'; import { Route, Routes } from 'react-router-dom'; import { __ } from '@wordpress/i18n'; import Home from '../pages/home'; +import PagesAndPosts from '../pages/pages-and-posts'; +import Store from '../pages/ecommerce/page'; import Marketplace from '../pages/marketplace'; import Performance from '../pages/performance'; import Settings from '../pages/settings'; import Staging from '../pages/staging'; import Help from '../pages/help'; -import Store from '../pages/ecommerce/page'; -import PagesAndPosts from '../pages/pages-and-posts'; +import Admin from '../pages/admin'; import { getMarketplaceSubnavRoutes } from '../../../vendor/newfold-labs/wp-module-marketplace/components/marketplaceSubnav'; const addPartialMatch = (prefix, path) => @@ -78,6 +79,7 @@ export const routes = [ title: __('Home', 'wp-plugin-hostgator'), Component: Home, Icon: HomeIcon, + condition: true, }, { name: '/pages-and-posts', @@ -91,6 +93,7 @@ export const routes = [ title: __('Store', 'wp-plugin-hostgator'), Component: Store, Icon: BuildingStorefrontIcon, + condition: true, subRoutes: [ { name: '/store/products', @@ -123,34 +126,45 @@ export const routes = [ Component: Marketplace, Icon: ShoppingBagIcon, subRoutes: await getMarketplaceSubnavRoutes(), + condition: true, }, { name: '/performance', title: __('Performance', 'wp-plugin-hostgator'), Component: Performance, Icon: BoltIcon, + condition: await window.NewfoldFeatures.isEnabled( 'performance' ), }, { name: '/settings', title: __('Settings', 'wp-plugin-hostgator'), Component: Settings, Icon: AdjustmentsHorizontalIcon, + condition: true, }, { name: '/staging', title: __('Staging', 'wp-plugin-hostgator'), Component: Staging, Icon: WrenchScrewdriverIcon, + condition: await window.NewfoldFeatures.isEnabled( 'staging' ), }, { name: '/help', title: __('Help', 'wp-plugin-hostgator'), Component: Help, Icon: QuestionMarkCircleIcon, + condition: true, action: NewfoldRuntime.hasCapability('canAccessHelpCenter') ? HelpCenterAI : false, }, + { + name: '/admin', + title: __( 'Admin', 'wp-plugin-hostgator' ), + Component: Admin, + condition: true, + }, ]; export const topRoutes = _filter(routes, (route) => diff --git a/src/app/data/store.js b/src/app/data/store.js index 470760ce..cfd1941f 100644 --- a/src/app/data/store.js +++ b/src/app/data/store.js @@ -38,7 +38,13 @@ export const AppStoreProvider = ( { children } ) => { if ( false === booted ) { hgApiFetchSettings() .then( ( settings ) => { - setStore( { ...store, ...window.HGWP, ...settings } ); + setStore( { + ...store, + ...window.HGWP, + ...settings, + features: window.NewfoldFeatures.features, + toggleableFeatures: window.NewfoldFeatures.togglable, + } ); setBooted( true ); } ) .catch( ( error ) => { diff --git a/src/app/index.js b/src/app/index.js index 97ee75e9..c903e5de 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -17,7 +17,7 @@ import { store as noticesStore } from '@wordpress/notices'; import { kebabCase, filter } from 'lodash'; import { AppNav } from './components/app-nav'; import { SiteInfoBar } from './components/site-info'; -import { NotificationFeed } from './components/notifications/feed'; +import { NotificationFeed } from 'App/components/notifications'; import { addQueryArgs } from '@wordpress/url'; // component sourced from module @@ -70,7 +70,7 @@ const AppBody = ( props ) => { id="hgwp-app-rendered" className={ classnames( 'wpadmin-brand-hostgator', - `wppbh-wp-${ NewfoldRuntime.sdk.wpversion }`, + `hgwp-wp-${ NewfoldRuntime.sdk.wpversion }`, `hgwp-page-${ kebabCase( location.pathname ) }`, props.className, 'nfd-w-full nfd-p-4 min-[783px]:nfd-p-0' diff --git a/src/app/pages/admin/index.js b/src/app/pages/admin/index.js new file mode 100644 index 00000000..38bbb017 --- /dev/null +++ b/src/app/pages/admin/index.js @@ -0,0 +1,44 @@ +import classNames from 'classnames'; +import HelpCenterSettings from '../settings/helpCenterSettings'; +import WonderBlocksSettings from '../settings/wonderBlocksSettings'; +import StagingFeatureSettings from '../settings/stagingFeatureSettings'; +import PerformanceFeatureSettings from '../settings/performanceFeatureSettings'; +import { Container, Page } from '@newfold/ui-component-library'; + +const Admin = () => { + return ( + + + + + + + +
+ +
+ +
+ +
+
+
+
+ ); +}; + +export default Admin; diff --git a/src/app/pages/ecommerce/page.js b/src/app/pages/ecommerce/page.js index 4ac026d4..852d8a86 100644 --- a/src/app/pages/ecommerce/page.js +++ b/src/app/pages/ecommerce/page.js @@ -1,7 +1,7 @@ import { Page } from '@newfold/ui-component-library'; import { NewfoldECommerce } from '@newfold-labs/wp-module-ecommerce'; import { useNavigate, useLocation, useSearchParams } from 'react-router-dom'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; import AppStore from '../../data/store'; import { useContext } from '@wordpress/element'; import { hostgatorSettingsApiFetch } from '../../util/helpers'; diff --git a/src/app/pages/home/freeAddonsSection.js b/src/app/pages/home/freeAddonsSection.js index c84851c3..c8164b16 100644 --- a/src/app/pages/home/freeAddonsSection.js +++ b/src/app/pages/home/freeAddonsSection.js @@ -1,5 +1,5 @@ import { FreePlugins } from '@newfold-labs/wp-module-ecommerce'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; const FreePluginsSection = () => { const notify = useNotification(); diff --git a/src/app/pages/home/welcomeSection.js b/src/app/pages/home/welcomeSection.js index a1547bdd..6274034d 100644 --- a/src/app/pages/home/welcomeSection.js +++ b/src/app/pages/home/welcomeSection.js @@ -1,5 +1,5 @@ import { OnboardingScreen } from '@newfold-labs/wp-module-ecommerce'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; import AppStore from '../../data/store'; import { useContext } from '@wordpress/element'; import { hostgatorSettingsApiFetch } from '../../util/helpers'; diff --git a/src/app/pages/performance/index.js b/src/app/pages/performance/index.js index 7acfa93d..e00d6734 100644 --- a/src/app/pages/performance/index.js +++ b/src/app/pages/performance/index.js @@ -5,7 +5,7 @@ import apiFetch from '@wordpress/api-fetch'; import classnames from 'classnames'; import { useUpdateEffect } from 'react-use'; import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; import { hostgatorSettingsApiFetch as newfoldSettingsApiFetch, hostgatorPurgeCacheApiFetch as newfoldPurgeCacheApiFetch, diff --git a/src/app/pages/settings/automaticUpdates.js b/src/app/pages/settings/automaticUpdates.js index 1036c459..0111e2d6 100644 --- a/src/app/pages/settings/automaticUpdates.js +++ b/src/app/pages/settings/automaticUpdates.js @@ -3,7 +3,7 @@ import { hostgatorSettingsApiFetch } from '../../util/helpers'; import { useUpdateEffect } from 'react-use'; import { useState } from '@wordpress/element'; import { Alert, Container, ToggleField } from '@newfold/ui-component-library'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; const AutomaticUpdatesAll = ( { setError, notify } ) => { const { store, setStore } = useContext( AppStore ); diff --git a/src/app/pages/settings/comingSoon.js b/src/app/pages/settings/comingSoon.js index 61f8fdbc..581b3aaf 100644 --- a/src/app/pages/settings/comingSoon.js +++ b/src/app/pages/settings/comingSoon.js @@ -6,7 +6,7 @@ import { import { useState } from '@wordpress/element'; import { useUpdateEffect } from 'react-use'; import { Alert, Container, ToggleField } from '@newfold/ui-component-library'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; const ComingSoon = () => { const { store, setStore } = useContext( AppStore ); diff --git a/src/app/pages/settings/commentSettings.js b/src/app/pages/settings/commentSettings.js index 662a1607..50e8f862 100644 --- a/src/app/pages/settings/commentSettings.js +++ b/src/app/pages/settings/commentSettings.js @@ -8,7 +8,7 @@ import { SelectField, ToggleField, } from '@newfold/ui-component-library'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; const OldPostsComments = ( { setError, notify } ) => { const { store, setStore } = useContext( AppStore ); diff --git a/src/app/pages/settings/contentSettings.js b/src/app/pages/settings/contentSettings.js index ab12c4ac..411f7c1f 100644 --- a/src/app/pages/settings/contentSettings.js +++ b/src/app/pages/settings/contentSettings.js @@ -3,7 +3,7 @@ import { hostgatorSettingsApiFetch } from '../../util/helpers'; import { useUpdateEffect } from 'react-use'; import { useState } from '@wordpress/element'; import { Alert, Container, SelectField } from '@newfold/ui-component-library'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; const ContentRevisions = ( { setError, notify } ) => { const { store, setStore } = useContext( AppStore ); diff --git a/src/app/pages/settings/helpCenterSettings.js b/src/app/pages/settings/helpCenterSettings.js new file mode 100644 index 00000000..7af878e3 --- /dev/null +++ b/src/app/pages/settings/helpCenterSettings.js @@ -0,0 +1,104 @@ +import { useState } from '@wordpress/element'; +import { useUpdateEffect } from 'react-use'; +import { Alert, ToggleField } from '@newfold/ui-component-library'; +import AppStore from '../../data/store'; +import { featureToggle, updateUI } from '../../util/helpers'; +import { useNotification } from 'App/components/notifications'; + +const HelpCenterSettings = ( { forceShow = false } ) => { + const { store, setStore } = useContext( AppStore ); + const [ helpCenter, setHelpCenter ] = useState( store.features.helpCenter ); + const [ helpCenterLocked, setHelpCenterLocked ] = useState( + ! store.toggleableFeatures.helpCenter + ); + const [ isError, setError ] = useState( false ); + const notify = useNotification(); + + const getHelpCenterNoticeTitle = () => { + return helpCenter + ? __( 'Help Center Enabled', 'wp-plugin-hostgator' ) + : __( 'Help Center Disabled', 'wp-plugin-hostgator' ); + }; + const getHelpCenterNoticeText = () => { + return helpCenter + ? __( + 'Reload the page to access the Help Center.', + 'wp-plugin-hostgator' + ) + : __( + 'The Help Center will no longer display.', + 'wp-plugin-hostgator' + ); + }; + + const toggleHelpCenter = () => { + featureToggle( 'helpCenter', ( response ) => { + // console.log( response ); + if ( response.success ) { + setHelpCenter( ! helpCenter ); + } else { + setHelpCenterLocked( true ); + setError( true ); + notifyError(); + } + } ); + }; + + const notifyError = () => { + notify.push( 'feature-toggle-notice', { + title: __( 'Sorry, that is not allowed.', 'wp-plugin-hostgator' ), + description: __( + 'This feature cannot currently be modified.', + 'wp-plugin-hostgator' + ), + variant: 'error', + } ); + }; + + const notifySuccess = ( renderTitle, renderDescription ) => { + notify.push( 'feature-toggle-notice', { + title: renderTitle(), + description: renderDescription(), + variant: 'success', + autoDismiss: 5000, + } ); + }; + + useUpdateEffect( () => { + setStore( { + ...store, + helpCenter, + } ); + notifySuccess( getHelpCenterNoticeTitle, getHelpCenterNoticeText ); + updateUI( '#wp-admin-bar-help-center', helpCenter ); + }, [ helpCenter ] ); + + return ( +
+ { ( ! helpCenterLocked || forceShow ) && ( + + ) } + + { isError && ( + + { __( + 'Oops! Something went wrong. Please try again.', + 'wp-plugin-hostgator' + ) } + + ) } +
+ ); +}; + +export default HelpCenterSettings; diff --git a/src/app/pages/settings/index.js b/src/app/pages/settings/index.js index df474659..ff6651e3 100644 --- a/src/app/pages/settings/index.js +++ b/src/app/pages/settings/index.js @@ -1,6 +1,8 @@ import { Container, Page } from '@newfold/ui-component-library'; -import AutomaticUpdates from './automaticUpdates'; import ComingSoon from './comingSoon'; +import AutomaticUpdates from './automaticUpdates'; +import HelpCenterSettings from './helpCenterSettings'; +import WonderBlocksSettings from './wonderBlocksSettings'; import CommentSettings from './commentSettings'; import ContentSettings from './contentSettings'; @@ -24,6 +26,18 @@ const Settings = () => { + + + +
+ +
+ { + const { store, setStore } = useContext( AppStore ); + const [ performance, setPerformance ] = useState( + store.features.performance + ); + const [ performanceLocked, setPerformanceLocked ] = useState( + ! store.toggleableFeatures.performance + ); + const [ isError, setError ] = useState( false ); + const notify = useNotification(); + + const getPerformanceNoticeTitle = () => { + return performance + ? __( 'Performance Enabled', 'wp-plugin-hostgator' ) + : __( 'Performance Disabled', 'wp-plugin-hostgator' ); + }; + + const getPerformanceNoticeText = () => { + return performance + ? __( + 'You need to reload the page to manage Performance.', + 'wp-plugin-hostgator' + ) + : __( 'Performance will no longer display.', 'wp-plugin-hostgator' ); + }; + + const togglePerformance = () => { + featureToggle( 'performance', ( response ) => { + if ( response.success ) { + setPerformance( ! performance ); + } else { + setPerformanceLocked( true ); + setError( true ); + notifyError(); + } + } ); + }; + + const notifySuccess = ( renderTitle, renderDescription ) => { + notify.push( 'feature-toggle-notice', { + title: renderTitle(), + description: renderDescription(), + variant: 'success', + autoDismiss: 5000, + } ); + }; + + const notifyError = () => { + notify.push( 'feature-toggle-notice', { + title: __( 'Sorry, that is not allowed.', 'wp-plugin-hostgator' ), + description: __( + 'This feature cannot currently be modified.', + 'wp-plugin-hostgator' + ), + variant: 'error', + } ); + }; + + useUpdateEffect( () => { + setStore( { + ...store, + performance, + } ); + notifySuccess( getPerformanceNoticeTitle, getPerformanceNoticeText ); + updateUI( '.hgwp-app-navitem-Performance', performance ); + }, [ performance ] ); + + return ( +
+ + + { isError && ( + + { __( + 'Oops! Something went wrong. Please try again.', + 'wp-plugin-hostgator' + ) } + + ) } +
+ ); +}; + +export default PerformanceFeatureSettings; diff --git a/src/app/pages/settings/stagingFeatureSettings.js b/src/app/pages/settings/stagingFeatureSettings.js new file mode 100644 index 00000000..6e95af1a --- /dev/null +++ b/src/app/pages/settings/stagingFeatureSettings.js @@ -0,0 +1,98 @@ +import { useState } from '@wordpress/element'; +import { useUpdateEffect } from 'react-use'; +import { Alert, ToggleField } from '@newfold/ui-component-library'; +import AppStore from '../../data/store'; +import { featureToggle, updateUI } from '../../util/helpers'; +import { useNotification } from 'App/components/notifications'; + +const StagingFeatureSettings = () => { + const { store, setStore } = useContext( AppStore ); + const [ staging, setStaging ] = useState( store.features.staging ); + const [ stagingLocked, setStagingLocked ] = useState( + ! store.toggleableFeatures.staging + ); + const [ isError, setError ] = useState( false ); + const notify = useNotification(); + + const getStagingNoticeTitle = () => { + return staging + ? __( 'Staging Enabled', 'wp-plugin-hostgator' ) + : __( 'Staging Disabled', 'wp-plugin-hostgator' ); + }; + const getStagingNoticeText = () => { + return staging + ? __( + 'You need to reload the page to manage Staging.', + 'wp-plugin-hostgator' + ) + : __( 'Staging will no longer display.', 'wp-plugin-hostgator' ); + }; + + const toggleStaging = () => { + featureToggle( 'staging', ( response ) => { + if ( response.success ) { + setStaging( ! staging ); + } else { + setStagingLocked( true ); + setError( true ); + notifyError(); + } + } ); + }; + + const notifyError = () => { + notify.push( 'feature-toggle-notice', { + title: __( 'Sorry, that is not allowed.', 'wp-plugin-hostgator' ), + description: __( + 'This feature cannot currently be modified.', + 'wp-plugin-hostgator' + ), + variant: 'error', + } ); + }; + + const notifySuccess = ( renderTitle, renderDescription ) => { + notify.push( 'feature-toggle-notice', { + title: renderTitle(), + description: renderDescription(), + variant: 'success', + autoDismiss: 5000, + } ); + }; + + useUpdateEffect( () => { + setStore( { + ...store, + staging, + } ); + notifySuccess( getStagingNoticeTitle, getStagingNoticeText ); + updateUI( '.hgwp-app-navitem-Staging', staging ); + }, [ staging ] ); + + return ( +
+ + + { isError && ( + + { __( + 'Oops! Something went wrong. Please try again.', + 'wp-plugin-hostgator' + ) } + + ) } +
+ ); +}; + +export default StagingFeatureSettings; diff --git a/src/app/pages/settings/wonderBlocksSettings.js b/src/app/pages/settings/wonderBlocksSettings.js new file mode 100644 index 00000000..f5bf452e --- /dev/null +++ b/src/app/pages/settings/wonderBlocksSettings.js @@ -0,0 +1,103 @@ +import { useState } from '@wordpress/element'; +import { useUpdateEffect } from 'react-use'; +import { Alert, ToggleField } from '@newfold/ui-component-library'; +import AppStore from '../../data/store'; +import { featureToggle } from '../../util/helpers'; +import { useNotification } from 'App/components/notifications'; + +const WonderBlocksSettings = () => { + const { store, setStore } = useContext( AppStore ); + const [ wonderBlocks, setWonderBlocks ] = useState( + store.features.patterns + ); + const [ wonderBlocksLocked, setWonderBlocksLocked ] = useState( + ! store.toggleableFeatures.patterns + ); + const [ isError, setError ] = useState( false ); + const notify = useNotification(); + + const getWonderBlocksNoticeTitle = () => { + return wonderBlocks + ? __( 'Wonder Blocks Enabled', 'wp-plugin-hostgator' ) + : __( 'Wonder Blocks Disabled', 'wp-plugin-hostgator' ); + }; + const getWonderBlocksNoticeText = () => { + return wonderBlocks + ? __( + 'Create new content to see Wonder Blocks in action.', + 'wp-plugin-hostgator' + ) + : __( + 'Wonder Blocks will no longer display.', + 'wp-plugin-hostgator' + ); + }; + + const toggleWonderBlocks = () => { + featureToggle( 'patterns', ( response ) => { + // console.log( response ); + if ( response.success ) { + setWonderBlocks( ! wonderBlocks ); + } else { + setWonderBlocksLocked( true ); + setError( true ); + notifyError(); + } + } ); + }; + + const notifyError = () => { + notify.push( 'feature-toggle-notice', { + title: __( 'Sorry, that is not allowed.', 'wp-plugin-hostgator' ), + description: __( + 'This feature cannot currently be modified.', + 'wp-plugin-hostgator' + ), + variant: 'error', + } ); + }; + + const notifySuccess = ( renderTitle, renderDescription ) => { + notify.push( 'feature-toggle-notice', { + title: renderTitle(), + description: renderDescription(), + variant: 'success', + autoDismiss: 5000, + } ); + }; + + useUpdateEffect( () => { + setStore( { + ...store, + wonderBlocks, + } ); + notifySuccess( getWonderBlocksNoticeTitle, getWonderBlocksNoticeText ); + }, [ wonderBlocks ] ); + + return ( +
+ + + { isError && ( + + { __( + 'Oops! Something went wrong. Please try again.', + 'wp-plugin-hostgator' + ) } + + ) } +
+ ); +}; + +export default WonderBlocksSettings; diff --git a/src/app/pages/staging/index.js b/src/app/pages/staging/index.js index 795e2e45..c69a57d9 100644 --- a/src/app/pages/staging/index.js +++ b/src/app/pages/staging/index.js @@ -3,7 +3,7 @@ import { useState, useEffect } from '@wordpress/element'; import apiFetch from '@wordpress/api-fetch'; import classnames from 'classnames'; import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime'; -import { useNotification } from '../../components/notifications/feed'; +import { useNotification } from 'App/components/notifications'; // component sourced from staging module import { default as NewfoldStaging } from '../../../../vendor/newfold-labs/wp-module-staging/components/staging/'; diff --git a/src/app/stylesheet.scss b/src/app/stylesheet.scss index aa6e2c55..0112833b 100644 --- a/src/app/stylesheet.scss +++ b/src/app/stylesheet.scss @@ -248,6 +248,11 @@ body.toplevel_page_hostgator { z-index: -1; } +.nfd-disabled { + opacity: .5; + pointer-events: disabled; +} + .hgwpp { .components-card { diff --git a/src/app/util/helpers.js b/src/app/util/helpers.js index 652cfa56..3a5ede05 100644 --- a/src/app/util/helpers.js +++ b/src/app/util/helpers.js @@ -28,13 +28,61 @@ export const dispatchUpdateSnackbar = ( text = 'Settings Saved' ) => { } ); }; +/** + * Wrapper method for toggling a feature via the features API + * + * @param {string} featureName the name of the feature + * @param {Function} thenCallback method to call in promise then + * @return {Promise} Features API promise with attached then callback + */ +export const featureToggle = async ( featureName, thenCallback ) => { + if ( true === window.NewfoldFeatures.features[ featureName ] ) { + return window.NewfoldFeatures.disable( featureName ).then( + ( response ) => { + thenCallback( response ); + } + ); + } + // else + return window.NewfoldFeatures.enable( featureName ).then( ( response ) => { + thenCallback( response ); + } ); +}; + +/** + * Helper to update UI elements as features are enabled/disabled + * + * @param {string} selector css selector to find the element + * @param {boolean} enabled whether the element is now activated/deactivated + * @param {string} className the css class to add/remove - default 'nfd-disabled' + * @param {boolean} forceReload whether this update requires a forced page reload - default false + */ +export const updateUI = ( + selector, + enabled = true, + className = 'nfd-disabled', + forceReload = false +) => { + const element = document.querySelector( selector ); + if ( element ) { + if ( ! enabled ) { + element.classList.add( className ); + } else { + element.classList.remove( className ); + } + } + if ( forceReload ) { + window.location.reload(); + } +}; + /** * Wrapper method to post setting to hostgator endpoint * - * @param {*} data object of data - * @param passError setter for the error in component - * @param thenCallback method to call in promise then - * @return apiFetch promise + * @param {Object} data object of data + * @param {Function} passError setter for the error in component + * @param {Function} thenCallback method to call in promise then + * @return {Promise} apiFetch promise with attached then and catch callbacks */ export const hostgatorSettingsApiFetch = ( data, passError, thenCallback ) => { return apiFetch( { diff --git a/webpack.config.js b/webpack.config.js index cb36abe7..1ecb0774 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,6 +10,7 @@ const TerserPlugin = require( 'terser-webpack-plugin' ); */ const alias = { App: path.resolve(__dirname, '/src/app/'), + Assets: path.resolve( __dirname, '/assets/' ), Store: path.resolve(__dirname, '/src/app/data/store.js'), Routes: path.resolve(__dirname, '/src/app/data/routes.js'), '@modules': path.resolve( __dirname, '/vendor/newfold-labs/' ), diff --git a/wp-plugin-hostgator.php b/wp-plugin-hostgator.php index 9229299d..66ba25b4 100644 --- a/wp-plugin-hostgator.php +++ b/wp-plugin-hostgator.php @@ -15,7 +15,7 @@ * Version: 2.8.0 * Requires at least: 6.3 * Requires PHP: 7.3 - * Tested up to: 6.5.3 + * Tested up to: 6.5.4 * Author: HostGator * Author URI: https://hostgator.com * Text Domain: wp-plugin-hostgator