From 22ec27f1673f7126f43fa7cac041c90f773ae879 Mon Sep 17 00:00:00 2001 From: aulisius Date: Fri, 26 May 2023 23:14:28 +0530 Subject: [PATCH 1/8] Bump newfold-labs/wp-module-ecommerce to 0.9.1 --- composer.json | 2 +- composer.lock | 58 ++++++++++++++++++++++++++++++++++++++++------- package-lock.json | 10 ++++---- package.json | 2 +- 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 57047d766..342dec15b 100644 --- a/composer.json +++ b/composer.json @@ -72,7 +72,7 @@ "newfold-labs/wp-module-ctb": "^1.0.0", "newfold-labs/wp-module-customer-bluehost": "^1.5.3", "newfold-labs/wp-module-data": "^2.3", - "newfold-labs/wp-module-ecommerce": "0.9.0", + "newfold-labs/wp-module-ecommerce": "0.9.1", "newfold-labs/wp-module-loader": "^1.0.10", "newfold-labs/wp-module-marketplace": "^1.5.1", "newfold-labs/wp-module-notifications": "^1.1.2", diff --git a/composer.lock b/composer.lock index dabaa570e..9384468d5 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": "5773f4cf68161406534aaaa5465234fe", + "content-hash": "886042b49ac41a23488f40608f2f3edc", "packages": [ { "name": "doctrine/inflector", @@ -393,20 +393,23 @@ }, { "name": "newfold-labs/wp-module-ecommerce", - "version": "v0.9.0", + "version": "v0.9.1", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-ecommerce.git", - "reference": "d1be252f9662e48eb00c8d7bc48d32a16c656597" + "reference": "3d60452d65e90f207e9551eeb49e6d944b22ed75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-ecommerce/zipball/d1be252f9662e48eb00c8d7bc48d32a16c656597", - "reference": "d1be252f9662e48eb00c8d7bc48d32a16c656597", + "url": "https://api.github.com/repos/newfold-labs/wp-module-ecommerce/zipball/3d60452d65e90f207e9551eeb49e6d944b22ed75", + "reference": "3d60452d65e90f207e9551eeb49e6d944b22ed75", "shasum": "" }, + "require": { + "newfold-labs/wp-module-installer": "0.0.1" + }, "require-dev": { - "bluehost/wp-php-standards": "@stable", + "newfold-labs/wp-php-standards": "@stable", "wp-cli/i18n-command": "@stable", "wp-cli/wp-cli-bundle": "@stable" }, @@ -441,10 +444,49 @@ ], "description": "Brand Agnostic eCommerce Experience", "support": { - "source": "https://github.com/newfold-labs/wp-module-ecommerce/tree/v0.9.0", + "source": "https://github.com/newfold-labs/wp-module-ecommerce/tree/v0.9.1", "issues": "https://github.com/newfold-labs/wp-module-ecommerce/issues" }, - "time": "2023-05-18T02:13:36+00:00" + "time": "2023-05-26T17:33:09+00:00" + }, + { + "name": "newfold-labs/wp-module-installer", + "version": "0.0.1", + "source": { + "type": "git", + "url": "https://github.com/newfold-labs/wp-module-installer.git", + "reference": "c7e6370f469750e5699f42966d6686049e644c07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/newfold-labs/wp-module-installer/zipball/c7e6370f469750e5699f42966d6686049e644c07", + "reference": "c7e6370f469750e5699f42966d6686049e644c07", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "NewfoldLabs\\WP\\Module\\Installer\\": "includes" + }, + "files": [ + "bootstrap.php" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Micah Wood", + "email": "micah.wood@newfold.com" + } + ], + "description": "An installer for WordPress plugins and themes.", + "support": { + "source": "https://github.com/newfold-labs/wp-module-installer/tree/0.0.1", + "issues": "https://github.com/newfold-labs/wp-module-installer/issues" + }, + "time": "2023-05-26T06:25:08+00:00" }, { "name": "newfold-labs/wp-module-loader", diff --git a/package-lock.json b/package-lock.json index 1d62e7255..26a1abb71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "name": "bluehost-wordpress-plugin", "license": "GPL-2.0-or-later", "dependencies": { - "@newfold-labs/wp-module-ecommerce": "github:newfold-labs/wp-module-ecommerce#v0.9.0", + "@newfold-labs/wp-module-ecommerce": "github:newfold-labs/wp-module-ecommerce#v0.9.1", "@wordpress/a11y": "^3.30.0", "@wordpress/api-fetch": "^3.6.2", "@wordpress/components": "^23.7.0", @@ -3253,8 +3253,8 @@ } }, "node_modules/@newfold-labs/wp-module-ecommerce": { - "version": "0.8.0", - "resolved": "git+ssh://git@github.com/newfold-labs/wp-module-ecommerce.git#d1be252f9662e48eb00c8d7bc48d32a16c656597", + "version": "0.9.1", + "resolved": "git+ssh://git@github.com/newfold-labs/wp-module-ecommerce.git#3d60452d65e90f207e9551eeb49e6d944b22ed75", "license": "GPL-2.0-or-later", "dependencies": { "@reduxjs/toolkit": "1.9.5", @@ -24659,8 +24659,8 @@ } }, "@newfold-labs/wp-module-ecommerce": { - "version": "git+ssh://git@github.com/newfold-labs/wp-module-ecommerce.git#d1be252f9662e48eb00c8d7bc48d32a16c656597", - "from": "@newfold-labs/wp-module-ecommerce@github:newfold-labs/wp-module-ecommerce#v0.9.0", + "version": "git+ssh://git@github.com/newfold-labs/wp-module-ecommerce.git#3d60452d65e90f207e9551eeb49e6d944b22ed75", + "from": "@newfold-labs/wp-module-ecommerce@github:newfold-labs/wp-module-ecommerce#v0.9.1", "requires": { "@reduxjs/toolkit": "1.9.5", "@wordpress/api-fetch": "^3.6.2", diff --git a/package.json b/package.json index 5152a7cf2..4f6a9b489 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "npm": ">=7" }, "dependencies": { - "@newfold-labs/wp-module-ecommerce": "github:newfold-labs/wp-module-ecommerce#v0.9.0", + "@newfold-labs/wp-module-ecommerce": "github:newfold-labs/wp-module-ecommerce#v0.9.1", "@wordpress/a11y": "^3.30.0", "@wordpress/api-fetch": "^3.6.2", "@wordpress/components": "^23.7.0", From 742df61f657fc586c00b4c4eee8f21a09e29efae Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Fri, 26 May 2023 14:59:17 -0400 Subject: [PATCH 2/8] Bump version --- bluehost-wordpress-plugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluehost-wordpress-plugin.php b/bluehost-wordpress-plugin.php index 80227335f..dd80479f1 100644 --- a/bluehost-wordpress-plugin.php +++ b/bluehost-wordpress-plugin.php @@ -2,7 +2,7 @@ /** * Plugin Name: The Bluehost Plugin * Description: This plugin integrates your WordPress site with the Bluehost control panel, including performance, security, and update features. - * Version: 2.13.7 + * Version: 2.13.8 * Tested up to: 6.2 * Requires at least: 6.0 * Requires PHP: 7.1 @@ -36,7 +36,7 @@ } // Define constants -define( 'BLUEHOST_PLUGIN_VERSION', '2.13.7' ); +define( 'BLUEHOST_PLUGIN_VERSION', '2.13.8' ); define( 'BLUEHOST_PLUGIN_FILE', __FILE__ ); define( 'BLUEHOST_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'BLUEHOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); From a66a0fb50d2df03373a91840499d4209af29e881 Mon Sep 17 00:00:00 2001 From: wpalani Date: Thu, 12 Oct 2023 13:26:52 -0700 Subject: [PATCH 3/8] Register admin submenu exclusively outside the app --- inc/Admin.php | 21 ++++---- tests/cypress/integration/navigation.cy.js | 58 +++++++++------------- 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/inc/Admin.php b/inc/Admin.php index 0fb3de94c..754b41667 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -90,15 +90,18 @@ public static function page() { 0 ); - foreach ( self::subpages() as $route => $title ) { - \add_submenu_page( - 'bluehost', - $title, - $title, - 'manage_options', - $route, - array( __CLASS__, 'render' ) - ); + // If we're outside of Bluehost, add subpages to Bluehost menu + if ( false === ( isset( $_GET['page'] ) && strpos( filter_input( INPUT_GET, 'page', FILTER_UNSAFE_RAW ), 'bluehost' ) >= 0 ) ) { // phpcs:ignore + foreach ( self::subpages() as $route => $title ) { + \add_submenu_page( + 'bluehost', + $title, + $title, + 'manage_options', + $route, + array( __CLASS__, 'render' ) + ); + } } } diff --git a/tests/cypress/integration/navigation.cy.js b/tests/cypress/integration/navigation.cy.js index 89237d861..c34e1c580 100644 --- a/tests/cypress/integration/navigation.cy.js +++ b/tests/cypress/integration/navigation.cy.js @@ -8,21 +8,17 @@ describe('Navigation', function () { }); + it('Admin submenu shouldn\'t exist inside app', () => { + cy + .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu') + .should('not.exist'); + }); + it('Logo Links to home', () => { cy.get('.wppbh-logo-wrap').click(); cy.wait(500); cy.hash().should('eq', '#/home'); }); - - it('Admin Subnav properly highlights', () => { - cy - .get('#adminmenu #toplevel_page_bluehost') - .should('have.class', 'wp-has-current-submenu'); - cy - .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li.current a') - .should('have.attr', 'href') - .and('match', /home/); - }); // test main nav it('Main nav links properly navigates', () => { @@ -35,10 +31,6 @@ describe('Navigation', function () { cy .get('.wppbh-app-navitem-Marketplace') .should('have.class', 'active'); - cy - .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li.current a') - .should('have.attr', 'href') - .and('match', /marketplace/); cy.get('.wppbh-app-navitem-Performance').click(); cy.wait(500); @@ -49,18 +41,10 @@ describe('Navigation', function () { cy .get('.wppbh-app-navitem-Marketplace') .should('not.have.class', 'active'); - cy - .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li.current a') - .should('have.attr', 'href') - .and('match', /performance/); cy.get('.wppbh-app-navitem-Settings').click(); cy.wait(500); cy.hash().should('eq', '#/settings'); - cy - .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li.current a') - .should('have.attr', 'href') - .and('match', /settings/); }); it('Subnav links properly navigates', () => { @@ -76,10 +60,6 @@ describe('Navigation', function () { cy .get('.wppbh-app-navitem-Marketplace') .should('have.class', 'active'); - cy - .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li.current a') - .should('have.attr', 'href') - .and('match', /marketplace/); cy.get('.wppbh-app-subnavitem-Services').click(); cy.wait(500); @@ -87,10 +67,6 @@ describe('Navigation', function () { cy .get('.wppbh-app-subnavitem-Services') .should('have.class', 'active'); - cy - .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li.current a') - .should('have.attr', 'href') - .and('match', /marketplace/); cy .get('.wppbh-app-navitem-Marketplace') .should('have.class', 'active'); @@ -105,14 +81,10 @@ describe('Navigation', function () { cy .get('.wppbh-app-subnavitem-Services') .should('not.have.class', 'active'); - cy - .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li.current a') - .should('have.attr', 'href') - .and('match', /marketplace/); cy .get('.wppbh-app-navitem-Marketplace') .should('have.class', 'active'); - + cy.get('.wppbh-app-navitem-Performance').click(); cy.wait(500); cy @@ -126,6 +98,22 @@ describe('Navigation', function () { .should('not.have.class', 'active'); }); + it('Admin submenu exist outside the app', () => { + cy.visit('/wp-admin/index.php'); + cy + .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu') + .should('exist'); + cy + .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/home"]') + .should('exist'); + cy + .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/marketplace"]') + .should('exist'); + cy + .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/settings"]') + .should('exist'); + }); + // utility nav is no more, leaving this in place un case we bring it back anytime soon. it.skip('Utility nav links properly navigates', () => { cy From 19e414177014c3174bd4863ea431d49712c926c6 Mon Sep 17 00:00:00 2001 From: wpalani Date: Thu, 12 Oct 2023 14:24:03 -0700 Subject: [PATCH 4/8] Add width and height classes to logo --- src/app/components/app-nav/logo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/app-nav/logo.js b/src/app/components/app-nav/logo.js index d188436ba..a29bc2ca2 100644 --- a/src/app/components/app-nav/logo.js +++ b/src/app/components/app-nav/logo.js @@ -14,7 +14,7 @@ const Mark = () => { }; return (