From 8c058ba5cc33f27cc6d8576a2dd57ef188d5e92e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 17:54:26 +0000 Subject: [PATCH 01/11] NPM Dev(deps-dev): Bump cypress from 13.3.2 to 13.3.3 Bumps [cypress](https://github.com/cypress-io/cypress) from 13.3.2 to 13.3.3. - [Release notes](https://github.com/cypress-io/cypress/releases) - [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md) - [Commits](https://github.com/cypress-io/cypress/compare/v13.3.2...v13.3.3) --- updated-dependencies: - dependency-name: cypress dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7507b137c..bfe85038e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "@testing-library/cypress": "^10.0.1", "@wordpress/env": "^8.10.0", "@wordpress/scripts": "^26.15.0", - "cypress": "^13.3.2", + "cypress": "^13.3.3", "cypress-axe": "^1.5.0", "tailwindcss": "^3.3.3" }, @@ -9144,9 +9144,9 @@ } }, "node_modules/cypress": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.2.tgz", - "integrity": "sha512-ArLmZObcLC+xxCp7zJZZbhby9FUf5CueLej9dUM4+5j37FTS4iMSgHxQLDu01PydFUvDXcNoIVRCYrHHxD7Ybg==", + "version": "13.3.3", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.3.tgz", + "integrity": "sha512-mbdkojHhKB1xbrj7CrKWHi22uFx9P9vQFiR0sYDZZoK99OMp9/ZYN55TO5pjbXmV7xvCJ4JwBoADXjOJK8aCJw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -30160,9 +30160,9 @@ } }, "cypress": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.2.tgz", - "integrity": "sha512-ArLmZObcLC+xxCp7zJZZbhby9FUf5CueLej9dUM4+5j37FTS4iMSgHxQLDu01PydFUvDXcNoIVRCYrHHxD7Ybg==", + "version": "13.3.3", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.3.tgz", + "integrity": "sha512-mbdkojHhKB1xbrj7CrKWHi22uFx9P9vQFiR0sYDZZoK99OMp9/ZYN55TO5pjbXmV7xvCJ4JwBoADXjOJK8aCJw==", "dev": true, "requires": { "@cypress/request": "^3.0.0", diff --git a/package.json b/package.json index b8b915210..2c19d3763 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@testing-library/cypress": "^10.0.1", "@wordpress/env": "^8.10.0", "@wordpress/scripts": "^26.15.0", - "cypress": "^13.3.2", + "cypress": "^13.3.3", "cypress-axe": "^1.5.0", "tailwindcss": "^3.3.3" }, From b1a7e4d10f259970c83a6b1a8b52428779e652de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:57:11 +0000 Subject: [PATCH 02/11] NPM Dev(deps-dev): Bump tailwindcss from 3.3.3 to 3.3.5 Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 3.3.3 to 3.3.5. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v3.3.3...v3.3.5) --- updated-dependencies: - dependency-name: tailwindcss dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 22 +++++++++++----------- package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index bfe85038e..15ef34b87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "@wordpress/scripts": "^26.15.0", "cypress": "^13.3.3", "cypress-axe": "^1.5.0", - "tailwindcss": "^3.3.3" + "tailwindcss": "^3.3.5" }, "engines": { "node": ">=16", @@ -21324,9 +21324,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", - "integrity": "sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -21334,10 +21334,10 @@ "chokidar": "^3.5.3", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.2.12", + "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.18.2", + "jiti": "^1.19.1", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", @@ -39217,9 +39217,9 @@ } }, "tailwindcss": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", - "integrity": "sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", "dev": true, "requires": { "@alloc/quick-lru": "^5.2.0", @@ -39227,10 +39227,10 @@ "chokidar": "^3.5.3", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.2.12", + "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.18.2", + "jiti": "^1.19.1", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", diff --git a/package.json b/package.json index 2c19d3763..9e0804cb4 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@wordpress/scripts": "^26.15.0", "cypress": "^13.3.3", "cypress-axe": "^1.5.0", - "tailwindcss": "^3.3.3" + "tailwindcss": "^3.3.5" }, "scripts": { "build": "NODE_ENV=production wp-scripts build", From 0b025952f5c4a54a3a29bd009e9eea7f2e0d2e38 Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Fri, 27 Oct 2023 16:56:05 -0400 Subject: [PATCH 03/11] Remove old mojo performance code (needs to be done across all brands) --- bootstrap.php | 1 - inc/performance.php | 136 -------------------------------------------- 2 files changed, 137 deletions(-) delete mode 100644 inc/performance.php diff --git a/bootstrap.php b/bootstrap.php index 8d3e6520c..605708cb3 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -199,7 +199,6 @@ function () { require BLUEHOST_PLUGIN_DIR . '/inc/jetpack.php'; require BLUEHOST_PLUGIN_DIR . '/inc/LoginRedirect.php'; require BLUEHOST_PLUGIN_DIR . '/inc/partners.php'; -require BLUEHOST_PLUGIN_DIR . '/inc/performance.php'; require BLUEHOST_PLUGIN_DIR . '/inc/RestApi/CachingController.php'; require BLUEHOST_PLUGIN_DIR . '/inc/RestApi/SettingsController.php'; require BLUEHOST_PLUGIN_DIR . '/inc/RestApi/rest-api.php'; diff --git a/inc/performance.php b/inc/performance.php deleted file mode 100644 index a3e218210..000000000 --- a/inc/performance.php +++ /dev/null @@ -1,136 +0,0 @@ - 'success', - 'message' => 'Cache level updated successfully.', - ); - } else { - $response = array( - 'status' => 'error', - 'message' => 'Unable to update cache level.', - ); - } - } else { - $response = array( - 'status' => 'error', - 'message' => 'Unable to add cache plugin.', - ); - } - - echo wp_json_encode( $response ); - } - die; -} -add_action( 'wp_ajax_mm_cache', __NAMESPACE__ . '\\mojo_cache_toggle' ); - -/** - * Callback for adding caching MU plugins. - * - * @param string|null $type - Type of caching - * @return array - */ -function mojo_cache_add( $type = null ) { - $cache = array(); - if ( ! is_dir( WP_CONTENT_DIR . '/mu-plugins' ) ) { - mkdir( WP_CONTENT_DIR . '/mu-plugins' ); - } - switch ( $type ) { - case 'page': - $cache['code'] = 'https://raw.githubusercontent.com/bluehost/endurance-page-cache/production/endurance-page-cache.php'; - $cache['location'] = WP_CONTENT_DIR . '/mu-plugins/endurance-page-cache.php'; - break; - - case 'object': - if ( class_exists( 'memcached' ) || class_exists( 'memcache' ) ) { - $response = array( - 'status' => 'error', - 'message' => 'Object cache coming soon.', - ); - } else { - $response = array( - 'status' => 'error', - 'message' => 'Object cache not available on your hosting plan.', - ); - } - break; - } - if ( isset( $cache['code'] ) && isset( $cache['location'] ) ) { - $request = wp_remote_get( $cache['code'] ); - if ( ! is_wp_error( $request ) ) { - file_put_contents( $cache['location'], $request['body'] ); // phpcs:ignore - if ( file_exists( $cache['location'] ) ) { - $response = array( - 'status' => 'success', - 'message' => ucfirst( $type ) . ' cache added successfully.', - ); - } - } - } - - if ( ! isset( $response ) ) { - $response = array( - 'status' => 'error', - 'message' => 'Unable to add ' . ucfirst( $type ) . ' cache.', - ); - } - return $response; - -} - -/** - * Callback for removing caching MU plugins. - * - * @param string|null $type - Type of caching - * @return array - */ -function mojo_cache_remove( $type = null ) { - switch ( $type ) { - case 'browser': - // do not remove cache file since it powers both types and the CDN. - break; - case 'page': - // do not remove cache file since it powers both types and the CDN. - break; - case 'object': - $file = WP_CONTENT_DIR . '/object-cache.php'; - break; - } - if ( file_exists( $file ) ) { - if ( unlink( $file ) ) { - $response = array( - 'status' => 'success', - 'message' => ucfirst( $type ) . ' cache removed successfully.', - ); - } else { - $response = array( - 'status' => 'error', - 'message' => 'Could not remove cache file.', - ); - } - } else { - $response = array( - 'status' => 'error', - 'message' => 'Cache file does not exist.', - ); - } - return $response; -} - From 0c534d5a356cac3282e4f81ab62c7337add6675c Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 30 Oct 2023 09:14:21 -0400 Subject: [PATCH 04/11] version bump to 3.5.1 --- bluehost-wordpress-plugin.php | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bluehost-wordpress-plugin.php b/bluehost-wordpress-plugin.php index 9de547fb4..be94239fb 100644 --- a/bluehost-wordpress-plugin.php +++ b/bluehost-wordpress-plugin.php @@ -12,7 +12,7 @@ * Plugin URI: https://bluehost.com * Update URI: https://github.com/bluehost/bluehost-wordpress-plugin * Description: WordPress plugin that integrates a WordPress site with the Bluehost control panel, including performance, security, and update features. - * Version: 3.5.0 + * Version: 3.5.1 * Requires at least: 6.0 * Requires PHP: 7.1 * Tested up to: 6.3.2 @@ -32,7 +32,7 @@ } // Define constants -define( 'BLUEHOST_PLUGIN_VERSION', '3.5.0' ); +define( 'BLUEHOST_PLUGIN_VERSION', '3.5.1' ); define( 'BLUEHOST_PLUGIN_FILE', __FILE__ ); define( 'BLUEHOST_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'BLUEHOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); diff --git a/package-lock.json b/package-lock.json index 15ef34b87..3c7779344 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "bluehost-wordpress-plugin", - "version": "3.5.0", + "version": "3.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "3.5.0", + "version": "3.5.1", "license": "GPL-2.0-or-later", "dependencies": { "@heroicons/react": "^2.0.18", diff --git a/package.json b/package.json index 9e0804cb4..feb45714d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "description": "WordPress plugin that integrates your WordPress site with the Bluehost control panel, including performance, security, and update features.", "license": "GPL-2.0-or-later", - "version": "3.5.0", + "version": "3.5.1", "private": true, "repository": { "type": "git", From 9647e56c848419a29c5697ec6128136969360627 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 30 Oct 2023 09:15:48 -0400 Subject: [PATCH 05/11] update global ctb and performance modules - Upgrading newfold-labs/wp-module-global-ctb (1.0.7 => 1.0.8) - Upgrading newfold-labs/wp-module-performance (1.2.1 => 1.2.2) --- composer.json | 4 ++-- composer.lock | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 48d21bfc8..a5197eeee 100644 --- a/composer.json +++ b/composer.json @@ -62,14 +62,14 @@ "newfold-labs/wp-module-data": "^2.4.9", "newfold-labs/wp-module-deactivation": "^1.0.2", "newfold-labs/wp-module-ecommerce": "^1.3.5", - "newfold-labs/wp-module-global-ctb": "^1.0.7", + "newfold-labs/wp-module-global-ctb": "^1.0.8", "newfold-labs/wp-module-help-center": "1.0.21", "newfold-labs/wp-module-loader": "^1.0.10", "newfold-labs/wp-module-marketplace": "^2.0.2", "newfold-labs/wp-module-notifications": "^1.1.6", "newfold-labs/wp-module-onboarding": "^1.11.5", "newfold-labs/wp-module-patterns": "^0.1.8", - "newfold-labs/wp-module-performance": "^1.2.1", + "newfold-labs/wp-module-performance": "^1.2.2", "newfold-labs/wp-module-runtime": "^1.0.7", "newfold-labs/wp-module-secure-passwords": "^1.1", "newfold-labs/wp-module-sso": "^1.0.4", diff --git a/composer.lock b/composer.lock index 3d64966f0..68307e8ff 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": "c1471b8db88f3ca8098a6a03a1c2e9d2", + "content-hash": "285bc589ca9d941f5f09919bdf5bdfe0", "packages": [ { "name": "doctrine/inflector", @@ -587,16 +587,16 @@ }, { "name": "newfold-labs/wp-module-global-ctb", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-global-ctb.git", - "reference": "d5aab07f1a9d9ddc8759c83310365da1612a8147" + "reference": "45b67e7b42a3d44d0a188263b65c355ef8661fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-global-ctb/zipball/d5aab07f1a9d9ddc8759c83310365da1612a8147", - "reference": "d5aab07f1a9d9ddc8759c83310365da1612a8147", + "url": "https://api.github.com/repos/newfold-labs/wp-module-global-ctb/zipball/45b67e7b42a3d44d0a188263b65c355ef8661fa8", + "reference": "45b67e7b42a3d44d0a188263b65c355ef8661fa8", "shasum": "" }, "require-dev": { @@ -630,10 +630,10 @@ ], "description": "Newfold module for 'Click to Buy' functionality in brand plugins", "support": { - "source": "https://github.com/newfold-labs/wp-module-global-ctb/tree/1.0.7", + "source": "https://github.com/newfold-labs/wp-module-global-ctb/tree/1.0.8", "issues": "https://github.com/newfold-labs/wp-module-global-ctb/issues" }, - "time": "2023-10-17T22:48:10+00:00" + "time": "2023-10-27T22:31:46+00:00" }, { "name": "newfold-labs/wp-module-help-center", @@ -1023,16 +1023,16 @@ }, { "name": "newfold-labs/wp-module-performance", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-performance.git", - "reference": "b341bb7dbdf6a5b9038d670deffc5df1f2029973" + "reference": "f5cf5924aa6aaceebdf0b5d8b5ea7e004eb1d1a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-performance/zipball/b341bb7dbdf6a5b9038d670deffc5df1f2029973", - "reference": "b341bb7dbdf6a5b9038d670deffc5df1f2029973", + "url": "https://api.github.com/repos/newfold-labs/wp-module-performance/zipball/f5cf5924aa6aaceebdf0b5d8b5ea7e004eb1d1a8", + "reference": "f5cf5924aa6aaceebdf0b5d8b5ea7e004eb1d1a8", "shasum": "" }, "require": { @@ -1061,10 +1061,10 @@ ], "description": "A module for managing caching functionality.", "support": { - "source": "https://github.com/newfold-labs/wp-module-performance/tree/1.2.1", + "source": "https://github.com/newfold-labs/wp-module-performance/tree/1.2.2", "issues": "https://github.com/newfold-labs/wp-module-performance/issues" }, - "time": "2023-09-11T18:50:56+00:00" + "time": "2023-10-30T13:02:28+00:00" }, { "name": "newfold-labs/wp-module-runtime", From cf857c28e8184f8536c2b78cf8c61ac9822a98ec Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 30 Oct 2023 11:46:00 -0400 Subject: [PATCH 06/11] remove host-info jarvis check --- bootstrap.php | 53 --------------------------------------------------- inc/Data.php | 1 - 2 files changed, 54 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index 605708cb3..691e68fb3 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -24,50 +24,6 @@ return; } -/** - * Check if platform is Jarvis - * - * @return bool - */ -function bluehost_is_jarvis() { - $is_jarvis = false; - $host = array( - 'dirs' => explode( '/', ABSPATH ), - 'user' => get_current_user(), - 'homedir' => null, - 'info_file' => null, - ); - - // Build host's home directory - foreach ( $host['dirs'] as $dir ) { - if ( ! empty( $dir ) ) { - $host['homedir'] = $host['homedir'] . '/' . $dir; - - if ( $dir === $host['user'] ) { - break; - } - } - } - - // Check for Jarvis .host-info file - if ( file_exists( $host['homedir'] . '/.host-info' ) ) { - $host['info_file'] = file_get_contents( $host['homedir'] . '/.host-info' ); - } - - // Check for Jarvis platform - if ( - null !== $host['info_file'] - && ( - false !== stripos( $host['info_file'], 'platform = jarvis' ) - || false !== stripos( $host['info_file'], 'platform=jarvis' ) - ) - ) { - $is_jarvis = true; - } - - return $is_jarvis; -} - /* * Initialize coming soon module via container */ @@ -100,15 +56,6 @@ function () { 'bluehost' ); -$bluehost_module_container->set( - 'isJarvis', - $bluehost_module_container->computed( - function () { - return bluehost_is_jarvis(); - } - ) -); - // properly get branding links depending on market $wordpress_hosting_page = ( get_option( 'mm_brand' ) === 'Bluehost_India' ) ? 'https://www.bluehost.in?utm_source=coming-soon-template&utm_medium=bluehost_plugin' : 'https://bluehost.com?utm_source=coming-soon-template&utm_medium=bluehost_plugin'; $my_panel = ( get_option( 'mm_brand' ) === 'Bluehost_India' ) ? 'https://my.bluehost.in/web-hosting/cplogin' : 'https://my.bluehost.com/web-hosting/cplogin'; diff --git a/inc/Data.php b/inc/Data.php index 79c07c6d3..33467e8e1 100644 --- a/inc/Data.php +++ b/inc/Data.php @@ -22,7 +22,6 @@ public static function runtime() { global $bluehost_module_container; $runtime = array( - 'isJarvis' => $bluehost_module_container->get('isJarvis'), 'plugin' => array( 'url' => BLUEHOST_BUILD_URL, 'version' => BLUEHOST_PLUGIN_VERSION, From d20a84e6f85d1581addafb76c3db50dcbe24ab3a Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 30 Oct 2023 11:46:29 -0400 Subject: [PATCH 07/11] update app isJarvis checks to use capabilities rather than sdk value for isJarvis --- src/app/pages/home/accountCard.js | 2 +- src/app/util/helpers.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/pages/home/accountCard.js b/src/app/pages/home/accountCard.js index 986575c3f..725207d69 100644 --- a/src/app/pages/home/accountCard.js +++ b/src/app/pages/home/accountCard.js @@ -11,7 +11,7 @@ import { Card, Title } from "@newfold/ui-component-library"; import { addUtmParams, getPlatformPathUrl, getPlatformBaseUrl } from "../../util/helpers"; import classNames from "classnames"; -const isJarvis = NewfoldRuntime.sdk.isJarvis; +const isJarvis = NewfoldRuntime.capabilities.isJarvis; const base = [ { diff --git a/src/app/util/helpers.js b/src/app/util/helpers.js index 7f24dd49f..60e3991db 100644 --- a/src/app/util/helpers.js +++ b/src/app/util/helpers.js @@ -168,7 +168,7 @@ export const addUtmParams = (url, params = {}) => { */ export const getPlatformBaseUrl = ( path = '' ) => { const brand = NewfoldRuntime.sdk.plugin.brand; - const isJarvis = NewfoldRuntime.sdk.isJarvis; + const isJarvis = NewfoldRuntime.capabilities.isJarvis; const baseUrl = () => { if (brand === 'Bluehost_India') { @@ -198,7 +198,7 @@ export const getPlatformBaseUrl = ( path = '' ) => { * // returns https://www.bluehost.com/my-account/home if Jarvis or https://my.bluehost.com/hosting/app#home if legacy */ export const getPlatformPathUrl = ( jarvisPath = '', legacyPath = '' ) => { - const isJarvis = NewfoldRuntime.sdk.isJarvis; + const isJarvis = NewfoldRuntime.capabilities.isJarvis; if (isJarvis) { return getPlatformBaseUrl('/my-account/') + jarvisPath; From 2e950a3901e41c467a5b26723f0da5469fc12def Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 30 Oct 2023 11:50:57 -0400 Subject: [PATCH 08/11] also update other references to values in sdk object in favor of newer values. --- src/app/data/help.js | 2 +- src/app/index.js | 2 +- src/app/util/helpers.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/data/help.js b/src/app/data/help.js index 620e66501..a3b045214 100644 --- a/src/app/data/help.js +++ b/src/app/data/help.js @@ -2,7 +2,7 @@ import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime"; import { getPlatformBaseUrl } from "../util/helpers"; const getSupportPhoneNumber = () => { - const brand = NewfoldRuntime.sdk.plugin.brand; + const brand = NewfoldRuntime.plugin.brand; if ( brand === 'Bluehost_India' ) { return '1800-419-4426'; diff --git a/src/app/index.js b/src/app/index.js index 34fde0533..5a76e57b3 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -71,7 +71,7 @@ const AppBody = ( props ) => { id="wppbh-app-rendered" className={ classnames( 'wpadmin-brand-bluehost', - `wppbh-wp-${ NewfoldRuntime.sdk.wpversion }`, + `wppbh-wp-${ NewfoldRuntime.wpVersion }`, `wppbh-page-${ kebabCase( location.pathname ) }`, props.className, 'nfd-w-full nfd-p-4 min-[783px]:nfd-p-0' diff --git a/src/app/util/helpers.js b/src/app/util/helpers.js index 60e3991db..a36356d92 100644 --- a/src/app/util/helpers.js +++ b/src/app/util/helpers.js @@ -167,7 +167,7 @@ export const addUtmParams = (url, params = {}) => { * @return {string} */ export const getPlatformBaseUrl = ( path = '' ) => { - const brand = NewfoldRuntime.sdk.plugin.brand; + const brand = NewfoldRuntime.plugin.brand; const isJarvis = NewfoldRuntime.capabilities.isJarvis; const baseUrl = () => { From eb83de17472211b9e8f7ad8b9f526207462daf88 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Mon, 30 Oct 2023 16:10:20 -0400 Subject: [PATCH 09/11] create helper method for isJarvis capabilities check and default to true (for local and test envs) --- src/app/pages/home/accountCard.js | 16 +++++++--------- src/app/util/helpers.js | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/app/pages/home/accountCard.js b/src/app/pages/home/accountCard.js index 725207d69..f862cdeec 100644 --- a/src/app/pages/home/accountCard.js +++ b/src/app/pages/home/accountCard.js @@ -8,17 +8,15 @@ import { } from "@heroicons/react/24/outline"; import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime"; import { Card, Title } from "@newfold/ui-component-library"; -import { addUtmParams, getPlatformPathUrl, getPlatformBaseUrl } from "../../util/helpers"; +import { addUtmParams, getPlatformPathUrl, getPlatformBaseUrl, isJarvis } from "../../util/helpers"; import classNames from "classnames"; -const isJarvis = NewfoldRuntime.capabilities.isJarvis; - const base = [ { icon: CpuChipIcon, id: "account_link", href: addUtmParams( getPlatformPathUrl("hosting/list", "app") ), - label: isJarvis + label: isJarvis() ? __("Hosting", "bluehost-wordpress-plugin") : __("Control Panel", "bluehost-wordpress-plugin"), color: "nfd-fill-gray", @@ -27,7 +25,7 @@ const base = [ icon: GiftIcon, id: "products_link", href: addUtmParams( getPlatformPathUrl("renewal-center", "account_center#products") ), - label: isJarvis + label: isJarvis() ? __("Renewal Center", "bluehost-wordpress-plugin") : __("Products", "bluehost-wordpress-plugin"), color: "nfd-fill-primary-dark", @@ -36,7 +34,7 @@ const base = [ icon: CreditCardIcon, id: "billing_link", href: addUtmParams( getPlatformPathUrl("billing-center", "account_center#billing") ), - label: isJarvis + label: isJarvis() ? __("Payment Methods", "bluehost-wordpress-plugin") : __("Billing", "bluehost-wordpress-plugin"), color: "nfd-fill-primary", @@ -45,7 +43,7 @@ const base = [ icon: EnvelopeIcon, id: "mail_link", href: addUtmParams( getPlatformPathUrl("home", "app#/email-office") ), - label: isJarvis + label: isJarvis() ? __("Mail", "bluehost-wordpress-plugin") : __("Mail & Office", "bluehost-wordpress-plugin"), color: "nfd-fill-[#5b5b5b]", @@ -60,10 +58,10 @@ const base = [ { icon: IdentificationIcon, id: "validation_token_link", - href: isJarvis + href: isJarvis() ? addUtmParams( getPlatformPathUrl("account-center") ) : addUtmParams( getPlatformBaseUrl("/cgi/token") ), - label: isJarvis + label: isJarvis() ? __("Profile", "bluehost-wordpress-plugin") : __("Validation Token", "bluehost-wordpress-plugin"), color: "nfd-fill-[#f89c24]", diff --git a/src/app/util/helpers.js b/src/app/util/helpers.js index a36356d92..430fb0851 100644 --- a/src/app/util/helpers.js +++ b/src/app/util/helpers.js @@ -168,14 +168,13 @@ export const addUtmParams = (url, params = {}) => { */ export const getPlatformBaseUrl = ( path = '' ) => { const brand = NewfoldRuntime.plugin.brand; - const isJarvis = NewfoldRuntime.capabilities.isJarvis; const baseUrl = () => { if (brand === 'Bluehost_India') { return 'https://my.bluehost.in'; } - if (isJarvis) { + if (isJarvis()) { return 'https://www.bluehost.com'; } @@ -198,9 +197,8 @@ export const getPlatformBaseUrl = ( path = '' ) => { * // returns https://www.bluehost.com/my-account/home if Jarvis or https://my.bluehost.com/hosting/app#home if legacy */ export const getPlatformPathUrl = ( jarvisPath = '', legacyPath = '' ) => { - const isJarvis = NewfoldRuntime.capabilities.isJarvis; - if (isJarvis) { + if (isJarvis()) { return getPlatformBaseUrl('/my-account/') + jarvisPath; } @@ -225,3 +223,18 @@ export const handleHelpLinksClick = () => { } } }; + +/** + * Check if this is a jarvis site or not. + * Deafults to true in cases where the capabilites are not set such as + * in local and test environments that do not receive capabilities. + * + * @return boolean + */ +export const isJarvis = () => { + if ( NewfoldRuntime.hasCapability( 'isJarvis' ) ) { + return NewfoldRuntime.capabilities.isJarvis; + } else { + return true; + } +}; \ No newline at end of file From 781fdbb4c30e3dca172df1a9a1ff55038abe79a6 Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Tue, 31 Oct 2023 10:41:46 -0400 Subject: [PATCH 10/11] Update roave/security-advisories --- composer.lock | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 68307e8ff..b3237b980 100644 --- a/composer.lock +++ b/composer.lock @@ -2356,12 +2356,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "1c4f2fdd4237e5b1c045cf8851191a770180f5e6" + "reference": "d66cd3b4db7200802bbdd73f3dab535a0aebeee6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/1c4f2fdd4237e5b1c045cf8851191a770180f5e6", - "reference": "1c4f2fdd4237e5b1c045cf8851191a770180f5e6", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/d66cd3b4db7200802bbdd73f3dab535a0aebeee6", + "reference": "d66cd3b4db7200802bbdd73f3dab535a0aebeee6", "shasum": "" }, "conflict": { @@ -2405,7 +2405,7 @@ "barrelstrength/sprout-forms": "<3.9", "barryvdh/laravel-translation-manager": "<0.6.2", "barzahlen/barzahlen-php": "<2.0.1", - "baserproject/basercms": "<4.7.5", + "baserproject/basercms": "<4.8", "bassjobsen/bootstrap-3-typeahead": ">4.0.2", "bigfork/silverstripe-form-capture": ">=3,<3.1.1", "billz/raspap-webgui": "<=2.9.2", @@ -2437,7 +2437,7 @@ "cockpit-hq/cockpit": "<=2.6.3", "codeception/codeception": "<3.1.3|>=4,<4.1.22", "codeigniter/framework": "<3.1.9", - "codeigniter4/framework": "<4.3.5", + "codeigniter4/framework": "<=4.4.2", "codeigniter4/shield": "<1.0.0.0-beta4", "codiad/codiad": "<=2.8.4", "composer/composer": "<1.10.27|>=2,<2.2.22|>=2.3,<2.6.4", @@ -2487,6 +2487,7 @@ "enshrined/svg-sanitize": "<0.15", "erusev/parsedown": "<1.7.2", "ether/logs": "<3.0.4", + "evolutioncms/evolution": "<=3.2.3", "exceedone/exment": "<4.4.3|>=5,<5.0.3", "exceedone/laravel-admin": "<2.2.3|==3", "ezsystems/demobundle": ">=5.4,<5.4.6.1-dev", @@ -2606,7 +2607,7 @@ "kelvinmo/simplexrd": "<3.1.1", "kevinpapst/kimai2": "<1.16.7", "khodakhah/nodcms": "<=3", - "kimai/kimai": "<1.1", + "kimai/kimai": "<=2.1", "kitodo/presentation": "<3.2.3|>=3.3,<3.3.4", "klaviyo/magento2-extension": ">=1,<3", "knplabs/knp-snappy": "<=1.4.2", @@ -2660,6 +2661,7 @@ "mongodb/mongodb": ">=1,<1.9.2", "monolog/monolog": ">=1.8,<1.12", "moodle/moodle": "<4.2.0.0-RC2-dev|==4.2", + "mos/cimage": "<0.7.19", "movim/moxl": ">=0.8,<=0.10", "mpdf/mpdf": "<=7.1.7", "mustache/mustache": ">=2,<2.14.1", @@ -2675,6 +2677,7 @@ "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", "nilsteampassnet/teampass": "<3.0.10", + "nonfiction/nterchange": "<4.1.1", "notrinos/notrinos-erp": "<=0.7", "noumo/easyii": "<=0.9", "nukeviet/nukeviet": "<4.5.02", @@ -2686,6 +2689,7 @@ "october/october": "<=3.4.4", "october/rain": "<1.0.472|>=1.1,<1.1.2", "october/system": "<1.0.476|>=1.1,<1.1.12|>=2,<2.2.34|>=3,<3.0.66", + "omeka/omeka-s": "<4.0.3", "onelogin/php-saml": "<2.10.4", "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", "open-web-analytics/open-web-analytics": "<1.7.4", @@ -3030,7 +3034,7 @@ "type": "tidelift" } ], - "time": "2023-10-19T20:04:24+00:00" + "time": "2023-10-30T16:04:37+00:00" }, { "name": "squizlabs/php_codesniffer", From 9138027bcd00ed0487c3d72a8a7c992ab8a33896 Mon Sep 17 00:00:00 2001 From: wpalani Date: Tue, 31 Oct 2023 13:06:54 -0700 Subject: [PATCH 11/11] Fix `isJarvis` helper method --- src/app/util/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/util/helpers.js b/src/app/util/helpers.js index 430fb0851..6e907e6a9 100644 --- a/src/app/util/helpers.js +++ b/src/app/util/helpers.js @@ -226,14 +226,14 @@ export const handleHelpLinksClick = () => { /** * Check if this is a jarvis site or not. - * Deafults to true in cases where the capabilites are not set such as + * Defaults to true in cases where the capabilites are not set such as * in local and test environments that do not receive capabilities. * * @return boolean */ export const isJarvis = () => { if ( NewfoldRuntime.hasCapability( 'isJarvis' ) ) { - return NewfoldRuntime.capabilities.isJarvis; + return window.NewfoldRuntime.capabilities.isJarvis; } else { return true; }