Skip to content

Commit

Permalink
Merge pull request #2586 from woocommerce/release/2.8.5
Browse files Browse the repository at this point in the history
Release 2.8.5
  • Loading branch information
martynmjones committed Sep 5, 2024
2 parents aeb4245 + cf3c765 commit 6c6002c
Show file tree
Hide file tree
Showing 44 changed files with 547 additions and 674 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
*** Google for WooCommerce Changelog ***

= 2.8.5 - 2024-09-05 =
* Break - Remove WooCommerce Navigation integration.
* Fix - Issue with syncing shipping rates with more than two decimals.
* Fix - Log exceptions triggered by assets being enqueued before being registered.
* Tweak - Use remote-site-status to check the WPCOM Auth status.
* Tweak - WC 9.3.0 compatibility.

= 2.8.4 - 2024-08-28 =
* Dev - Align namespaces for unit tests.
* Dev - Avoid accidentally using the event object to reset the asset group values in the CampaignAssetsForm component.
Expand Down
6 changes: 3 additions & 3 deletions google-listings-and-ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Google for WooCommerce
* Plugin URL: https://wordpress.org/plugins/google-listings-and-ads/
* Description: Native integration with Google that allows merchants to easily display their products across Google’s network.
* Version: 2.8.4
* Version: 2.8.5
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: google-listings-and-ads
Expand All @@ -13,7 +13,7 @@
* Requires PHP Architecture: 64 bits
* Requires Plugins: woocommerce
* WC requires at least: 6.9
* WC tested up to: 9.2.0
* WC tested up to: 9.3.0
* Woo:
*
* @package WooCommerce\Admin
Expand All @@ -30,7 +30,7 @@

defined( 'ABSPATH' ) || exit;

define( 'WC_GLA_VERSION', '2.8.4' ); // WRCS: DEFINED_VERSION.
define( 'WC_GLA_VERSION', '2.8.5' ); // WRCS: DEFINED_VERSION.
define( 'WC_GLA_MIN_PHP_VER', '7.4' );
define( 'WC_GLA_MIN_WC_VER', '6.9' );

Expand Down
3 changes: 0 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ module.exports = {
'<rootDir>/js/build-dev',
],
globals: {
wcAdminFeatures: {
navigation: false,
},
wcSettings: {
currency: {
code: 'USD',
Expand Down
4 changes: 2 additions & 2 deletions js/src/attribute-mapping/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { __ } from '@wordpress/i18n';
import Section from '.~/wcdl/section';
import AttributeMappingDescription from './attribute-mapping-description';
import AttributeMappingTable from './attribute-mapping-table';
import NavigationClassic from '.~/components/navigation-classic';
import MainTabNav from '.~/components/main-tab-nav';
import RebrandingTour from '.~/components/tours/rebranding-tour';
import './index.scss';

Expand All @@ -21,7 +21,7 @@ import './index.scss';
const AttributeMapping = () => {
return (
<div className="gla-attribute-mapping">
<NavigationClassic />
<MainTabNav />
<RebrandingTour />
<Section
title={ __( 'Manage attributes', 'google-listings-and-ads' ) }
Expand Down
1 change: 1 addition & 0 deletions js/src/components/main-tab-nav/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './main-tab-nav';
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getNewPath, getPath } from '@woocommerce/navigation';
*/
import { glaData } from '.~/constants';
import AppTabNav from '.~/components/app-tab-nav';
import useLegacyMenuEffect from '.~/hooks/useLegacyMenuEffect';
import useMenuEffect from '.~/hooks/useMenuEffect';

let tabs = [
{
Expand Down Expand Up @@ -51,7 +51,7 @@ const getSelectedTabKey = () => {
};

const MainTabNav = () => {
useLegacyMenuEffect();
useMenuEffect();

const selectedKey = getSelectedTabKey();

Expand Down
18 changes: 0 additions & 18 deletions js/src/components/navigation-classic/index.js

This file was deleted.

30 changes: 3 additions & 27 deletions js/src/css/shared/_woocommerce-admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,8 @@
.woocommerce-layout {
padding-top: 0;

// do not set the header to display: none,
// because we want the offsetHeight value
// and set it to wpbody-content margin-top to counter back.
.woocommerce-layout__header {
visibility: hidden;

// only display the top left WC navigation,
// do not display the h1 page title element
// and the top right activity panel.
&-wrapper > *:not(.woocommerce-navigation) {
display: none;
}
display: none;
}

// Hide StoreAlerts.
Expand All @@ -37,28 +27,14 @@
}
}
}

// the following is only applicable when WC Navigation is enabled
// and the page is on a large screen with .is-wc-nav-expanded applied.
&.has-woocommerce-navigation.is-wc-nav-expanded {
.woocommerce-layout__header {
// WC Navigation lies inside woocommerce-layout__header,
// so we need to display this.
display: block;

// width of the WC Navigation sidebar.
width: 240px;
}
}
}

// Used in .~/hooks/useLayout.js
.gla-full-page {
// hack to fix the margin-top when WC Navigation is not enabled
// and width is between 600px and 782px.
// hack to fix the margin-top when width is between 600px and 782px.
// without this, the margin-top would be -32px,
// and there would be a visible small grey gap.
&.is-wp-toolbar-disabled:not(.has-woocommerce-navigation) {
&.is-wp-toolbar-disabled {
@media (min-width: #{ ($break-small) }) and (max-width: #{ ($break-medium) }) {
margin-top: -46px;
}
Expand Down
4 changes: 2 additions & 2 deletions js/src/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getNewPath, getQuery, getHistory } from '@woocommerce/navigation';
*/
import AppButton from '.~/components/app-button';
import DifferentCurrencyNotice from '.~/components/different-currency-notice';
import NavigationClassic from '.~/components/navigation-classic';
import MainTabNav from '.~/components/main-tab-nav';
import CustomerEffortScorePrompt from '.~/components/customer-effort-score-prompt';
import AppDateRangeFilterPicker from './app-date-range-filter-picker';
import SummarySection from './summary-section';
Expand Down Expand Up @@ -88,7 +88,7 @@ const Dashboard = () => {
<>
<div className="gla-dashboard">
<DifferentCurrencyNotice context="dashboard" />
<NavigationClassic />
<MainTabNav />
<RebrandingTour />
<div className="gla-dashboard__filter">
<AppDateRangeFilterPicker
Expand Down
2 changes: 1 addition & 1 deletion js/src/dashboard/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jest.mock( '.~/components/customer-effort-score-prompt', () => () => (
) );

beforeAll( () => {
// Used in the js/src/hooks/useLegacyMenuEffect.js dependency
// Used in the js/src/hooks/useMenuEffect.js dependency
window.wpNavMenuClassChange = jest.fn();
} );

Expand Down
4 changes: 2 additions & 2 deletions js/src/hooks/useLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export default function useLayout( layoutName ) {

const bodyClassList = document.body.classList;
/**
* For WC Navigation, it already has classes applied, for example, "is-wp-toolbar-disabled".
* Here filter existing classes out to avoid them being removed in the cleanup function.
* Here filter potentially already applied classes out
* to avoid them being removed in the cleanup function.
*/
const classNames = classNameDict[ layoutName ].filter(
( name ) => ! bodyClassList.contains( name )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
* External dependencies
*/
import { useEffect } from '@wordpress/element';
/**
* Internal dependencies
*/
import isWCNavigationEnabled from '.~/utils/isWCNavigationEnabled';

/**
* Mocked result of parsing a page entry from {@link /js/src/index.js} by WC-admin's <Route>.
Expand All @@ -18,25 +14,17 @@ const dashboardPage = {
};

/**
* Effect that highlights the GLA Dashboard menu entry in the legacy WC menu.
* Effect that highlights the GLA Dashboard menu entry in the WC menu.
*
* Should be called for every "root page" (`.~/pages/*`) that wants to open the GLA menu.
*
* The hook could be removed once WC Navigation will be always enabled,
* or if we make the plugin fully use the routing feature of WC,
* The hook could be removed once make the plugin fully use the routing feature of WC,
* and let this be done by proper matching of URL matchers from {@link /js/src/index.js}
*
* @see window.wpNavMenuClassChange
*/
export default function useLegacyMenuEffect() {
const navigationEnabled = isWCNavigationEnabled();
export default function useMenuEffect() {
return useEffect( () => {
// Highlight the wp-admin dashboard menu
if ( ! navigationEnabled ) {
window.wpNavMenuClassChange(
dashboardPage,
dashboardPage.match.url
);
}
}, [ navigationEnabled ] );
window.wpNavMenuClassChange( dashboardPage, dashboardPage.match.url );
} );
}
24 changes: 5 additions & 19 deletions js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { getSetting } from '@woocommerce/settings'; // eslint-disable-line impor
import './css/index.scss';
import withAdminPageShell from '.~/components/withAdminPageShell';
import './data';
import isWCNavigationEnabled from './utils/isWCNavigationEnabled';
import { addBaseEventProperties } from '.~/utils/tracks';

const Dashboard = lazy( () =>
Expand Down Expand Up @@ -59,24 +58,11 @@ addFilter(
'woocommerce_admin_pages_list',
'woocommerce/google-listings-and-ads/add-page-routes',
( pages ) => {
const navigationEnabled = isWCNavigationEnabled();
const initialBreadcrumbs = [ [ '', woocommerceTranslation ] ];

/**
* If the WooCommerce Navigation feature is not enabled,
* we want to display the plugin under WC Marketing;
* otherwise, display it under WC Navigation - Extensions.
*/
if ( ! navigationEnabled ) {
initialBreadcrumbs.push( [
'/marketing',
__( 'Marketing', 'google-listings-and-ads' ),
] );
}

initialBreadcrumbs.push(
__( 'Google for WooCommerce', 'google-listings-and-ads' )
);
const initialBreadcrumbs = [
[ '', woocommerceTranslation ],
[ '/marketing', __( 'Marketing', 'google-listings-and-ads' ) ],
__( 'Google for WooCommerce', 'google-listings-and-ads' ),
];

const pluginAdminPages = [
{
Expand Down
4 changes: 2 additions & 2 deletions js/src/product-feed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getQuery } from '@woocommerce/navigation';
/**
* Internal dependencies
*/
import NavigationClassic from '.~/components/navigation-classic';
import MainTabNav from '.~/components/main-tab-nav';
import IssuesTableCard from './issues-table-card';
import ProductFeedTableCard from './product-feed-table-card';
import SubmissionSuccessGuide from './submission-success-guide';
Expand Down Expand Up @@ -47,7 +47,7 @@ const ProductFeed = () => {

return (
<>
<NavigationClassic />
<MainTabNav />
<RebrandingTour />
{ isSubmissionSuccessOpen && <SubmissionSuccessGuide /> }
{ canCESPromptOpen && (
Expand Down
2 changes: 1 addition & 1 deletion js/src/product-feed/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jest.mock( '.~/components/customer-effort-score-prompt', () => () => (
) );

beforeAll( () => {
// Used in the js/src/hooks/useLegacyMenuEffect.js dependency
// Used in the js/src/hooks/useMenuEffect.js dependency
window.wpNavMenuClassChange = jest.fn();
} );

Expand Down
4 changes: 2 additions & 2 deletions js/src/reports/products/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import useMetricsWithFormatter from '../useMetricsWithFormatter';
import useAdsCampaigns from '.~/hooks/useAdsCampaigns';
import AppSpinner from '.~/components/app-spinner';
import DifferentCurrencyNotice from '.~/components/different-currency-notice';
import NavigationClassic from '.~/components/navigation-classic';
import MainTabNav from '.~/components/main-tab-nav';
import ProductsReportFilters from './products-report-filters';
import SummarySection from '../summary-section';
import ChartSection from '../chart-section';
Expand Down Expand Up @@ -123,7 +123,7 @@ const ProductsReportPage = () => {
return (
<>
<DifferentCurrencyNotice context="reports-products" />
<NavigationClassic />
<MainTabNav />
<RebrandingTour />
<ReportsNavigation />
{ loaded ? (
Expand Down
4 changes: 2 additions & 2 deletions js/src/reports/programs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getQuery } from '@woocommerce/navigation';
import useProgramsReport, { usePerformanceReport } from './useProgramsReport';
import useMetricsWithFormatter from '../useMetricsWithFormatter';
import DifferentCurrencyNotice from '.~/components/different-currency-notice';
import NavigationClassic from '.~/components/navigation-classic';
import MainTabNav from '.~/components/main-tab-nav';
import ProgramsReportFilters from './programs-report-filters';
import SummarySection from '../summary-section';
import ChartSection from '../chart-section';
Expand Down Expand Up @@ -103,7 +103,7 @@ const ProgramsReport = () => {
return (
<>
<DifferentCurrencyNotice context={ trackEventId } />
<NavigationClassic />
<MainTabNav />
<RebrandingTour />
<ReportsNavigation />
<ProgramsReportFilters
Expand Down
9 changes: 1 addition & 8 deletions js/src/reports/reports-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { getNewPath } from '@woocommerce/navigation';
/**
* Internal dependencies
*/
import AppTabNav from '.~/components/app-tab-nav';
import isWCNavigationEnabled from '.~/utils/isWCNavigationEnabled';
import AppSubNav from '.~/components/app-sub-nav';
import getSelectedReportKey from '.~/utils/getSelectedReportKey';

Expand All @@ -26,14 +24,9 @@ const tabs = [
];

const ReportsNavigation = () => {
const navigationEnabled = isWCNavigationEnabled();
const reportKey = getSelectedReportKey();

return navigationEnabled ? (
<AppTabNav tabs={ tabs } selectedKey={ reportKey } />
) : (
<AppSubNav tabs={ tabs } selectedKey={ reportKey } />
);
return <AppSubNav tabs={ tabs } selectedKey={ reportKey } />;
};

export default ReportsNavigation;
8 changes: 4 additions & 4 deletions js/src/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getQuery, getHistory } from '@woocommerce/navigation';
* Internal dependencies
*/
import { API_RESPONSE_CODES } from '.~/constants';
import useLegacyMenuEffect from '.~/hooks/useLegacyMenuEffect';
import useMenuEffect from '.~/hooks/useMenuEffect';
import useGoogleAccount from '.~/hooks/useGoogleAccount';
import useUpdateRestAPIAuthorizeStatusByUrlQuery from '.~/hooks/useUpdateRestAPIAuthorizeStatusByUrlQuery';
import { subpaths, getReconnectAccountUrl } from '.~/utils/urls';
Expand All @@ -19,7 +19,7 @@ import ReconnectGoogleAccount from './reconnect-google-account';
import EditStoreAddress from './edit-store-address';
import EditPhoneNumber from './edit-phone-number';
import EnableNewProductSyncNotice from '.~/components/enable-new-product-sync-notice';
import NavigationClassic from '.~/components/navigation-classic';
import MainTabNav from '.~/components/main-tab-nav';
import RebrandingTour from '.~/components/tours/rebranding-tour';
import './index.scss';

Expand All @@ -28,7 +28,7 @@ const pageClassName = 'gla-settings';
const Settings = () => {
const { subpath } = getQuery();
// Make the component highlight GLA entry in the WC legacy menu.
useLegacyMenuEffect();
useMenuEffect();

useUpdateRestAPIAuthorizeStatusByUrlQuery();

Expand Down Expand Up @@ -65,7 +65,7 @@ const Settings = () => {
return (
<div className={ pageClassName }>
<EnableNewProductSyncNotice />
<NavigationClassic />
<MainTabNav />
<RebrandingTour />
<ContactInformationPreview />
<LinkedAccounts />
Expand Down
Loading

0 comments on commit 6c6002c

Please sign in to comment.