Skip to content

Commit

Permalink
Merge pull request #2483 from woocommerce/release/2.8.0
Browse files Browse the repository at this point in the history
Release 2.8.0
  • Loading branch information
puntope authored Jul 31, 2024
2 parents aaa2f5d + d3fc95e commit 1888e70
Show file tree
Hide file tree
Showing 158 changed files with 8,190 additions and 601 deletions.
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contributing

Thanks for your interest in contributing to Google Listings and Ads!
Thanks for your interest in contributing to Google for WooCommerce!

## Guidelines

Like the WooCommerce project, we want to ensure a welcoming environment for everyone. With that in mind, all contributors are expected to follow our [Code of Conduct](./CODE_OF_CONDUCT.md).

If you wish to contribute code, please read the information in the sections below. Then [fork](https://help.github.com/articles/fork-a-repo/) Google Listings and Ads, commit your changes, and [submit a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) 🎉
If you wish to contribute code, please read the information in the sections below. Then [fork](https://help.github.com/articles/fork-a-repo/) Google for WooCommerce, commit your changes, and [submit a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) 🎉

Google Listings and Ads is licensed under the GPLv3+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv3+ license.
Google for WooCommerce is licensed under the GPLv3+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv3+ license.

## Reporting Security Issues

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Google Listings & Ads
# Google for WooCommerce

[![PHP Unit Tests](https://github.com/woocommerce/google-listings-and-ads/actions/workflows/php-unit-tests.yml/badge.svg)](https://github.com/woocommerce/google-listings-and-ads/actions/workflows/php-unit-tests.yml)
[![JavaScript Unit Tests](https://github.com/woocommerce/google-listings-and-ads/actions/workflows/js-unit-tests.yml/badge.svg)](https://github.com/woocommerce/google-listings-and-ads/actions/workflows/js-unit-tests.yml)
Expand All @@ -19,7 +19,7 @@ This repository is not suitable for support. Please don't use our issue tracker

For self help, start with our [user documentation](https://woocommerce.com/document/google-listings-and-ads/).

The best place to get support is the [WordPress.org Google Listings and Ads forum](https://wordpress.org/support/plugin/google-listings-and-ads/).
The best place to get support is the [WordPress.org Google for WooCommerce forum](https://wordpress.org/support/plugin/google-listings-and-ads/).

If you have a WooCommerce.com account, you can [start a chat or open a ticket on WooCommerce.com](https://woocommerce.com/my-account/contact-support/).

Expand Down
10 changes: 7 additions & 3 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
*** WooCommerce Google Listings and Ads Changelog ***
*** Google for WooCommerce Changelog ***

= 2.8.0 - 2024-07-31 =
* Add Google API Pull method.
* Rebranding Google Listings and Ads with Google for WooCommerce.

= 2.7.7 - 2024-07-24 =
* Dev - Fix E2E tests failed with WC 9.1.
Expand Down Expand Up @@ -350,7 +354,7 @@
* Add - Declare compatibility for High Performance Order Storage.
* Dev - Selectively externalize bundled packages.
* Fix - E2E Testing: Reduce the false positive rate and adjust the running events on GitHub Actions.
* Fix - Move the order of Google Listings & Ads below the Coupons in the Marketing menu of WooCommerce admin page.
* Fix - Move the order of Google Listings and Ads below the Coupons in the Marketing menu of WooCommerce admin page.
* Fix - WC 6.9 compatibility: Shipping time settings should not appear after selecting the "complex" shipping option.
* Fix - WC 6.9 compatibility: The free shipping threshold should be cleared after selecting the "No" free shipping option.
* Fix - WC 6.9 compatibility: The selected free shipping option should be reset after setting all shipping rates to 0.
Expand Down Expand Up @@ -560,7 +564,7 @@
= 1.12.0 - 2022-03-29 =
* Add - Additional data points for tracker snapshot.
* Add - Enables merchants to select multiple countries as their audience when creating a Google Ads campaign (Smart Shopping Campaign).
* Add - Google Listings And Ads product attributes icon.
* Add - Google Listings and Ads product attributes icon.
* Add - Integration with WooCommerce Shipping Zone to automatically sync shipping settings to Merchant Center.
* FIx - Show right link and message in Paid Campaigns report when there is no data available.
* Fix - Cleanup synced products locally when disconnecting Merchant Center account.
Expand Down
4 changes: 2 additions & 2 deletions docs/gtag-consent-mode.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Google Analytics (gtag) Consent Mode

Unless you're running the [Google Analytics for WooCommerce](https://woocommerce.com/products/woocommerce-google-analytics/) extension for a more sophisticated configuration, Google Listings and Ads will add Google's `gtag` to help you track some customer behavior.
Unless you're running the [Google Analytics for WooCommerce](https://woocommerce.com/products/woocommerce-google-analytics/) extension for a more sophisticated configuration, Google for WooCommerce will add Google's `gtag` to help you track some customer behavior.

To respect your customers' privacy, we set up the default state of [consent mode](https://support.google.com/analytics/answer/9976101). We set it to deny all the parameters for visitors from the EEA region.

Expand All @@ -12,4 +12,4 @@ After the page loads, the consent for particular parameters can be updated by ot

The extension does not provide any UI, like a cookie banner, to let your visitors grant consent for tracking. However, it's integrated with [WP Consent API](https://wordpress.org/plugins/wp-consent-api/), so you can pick another extension that provides a banner that meets your needs.

Each of those extensions may require additional setup or registration. Usually, the basic default setup works out of the box, but there may be some integration caveats.
Each of those extensions may require additional setup or registration. Usually, the basic default setup works out of the box, but there may be some integration caveats.
6 changes: 3 additions & 3 deletions google-listings-and-ads.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Plugin Name: Google Listings and Ads
* 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.7.7
* Version: 2.8.0
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: google-listings-and-ads
Expand All @@ -30,7 +30,7 @@

defined( 'ABSPATH' ) || exit;

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

Expand Down
2 changes: 2 additions & 0 deletions js/src/attribute-mapping/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Section from '.~/wcdl/section';
import AttributeMappingDescription from './attribute-mapping-description';
import AttributeMappingTable from './attribute-mapping-table';
import NavigationClassic from '.~/components/navigation-classic';
import RebrandingTour from '.~/components/tours/rebranding-tour';
import './index.scss';

/**
Expand All @@ -21,6 +22,7 @@ const AttributeMapping = () => {
return (
<div className="gla-attribute-mapping">
<NavigationClassic />
<RebrandingTour />
<Section
title={ __( 'Manage attributes', 'google-listings-and-ads' ) }
description={ <AttributeMappingDescription /> }
Expand Down
29 changes: 28 additions & 1 deletion js/src/attribute-mapping/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,14 @@ jest.mock( '.~/hooks/usePolling', () => ( {
} ),
} ) );

jest.mock( '.~/components/tours/rebranding-tour', () =>
jest.fn().mockReturnValue( null ).mockName( 'RebrandingTour' )
);

/**
* External dependencies
*/
import { render, fireEvent } from '@testing-library/react';
import { render, fireEvent, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import userEvent from '@testing-library/user-event';

Expand All @@ -153,6 +157,7 @@ import {
} from '.~/data/actions';
import AttributeMappingSync from '.~/attribute-mapping/attribute-mapping-sync';
import usePolling from '.~/hooks/usePolling';
import RebrandingTour from '.~/components/tours/rebranding-tour';

describe( 'Attribute Mapping', () => {
test( 'Renders table', () => {
Expand Down Expand Up @@ -378,4 +383,26 @@ describe( 'Attribute Mapping', () => {
const { queryByText } = render( <AttributeMappingSync /> );
expect( queryByText( 'Scheduled for sync' ) ).toBeTruthy();
} );

describe( 'Rebranding Tour', () => {
test( 'Not rendered in UI', () => {
RebrandingTour.mockImplementation( () => {
return null;
} );

render( <AttributeMapping /> );
const tour = screen.queryByRole( 'dialog', { name: 'tour' } );
expect( tour ).not.toBeInTheDocument();
} );

test( 'Rendered in UI', () => {
RebrandingTour.mockImplementation( () => {
return <div role="dialog" aria-label="tour" />;
} );

render( <AttributeMapping /> );
const tour = screen.queryByRole( 'dialog', { name: 'tour' } );
expect( tour ).toBeInTheDocument();
} );
} );
} );
33 changes: 33 additions & 0 deletions js/src/components/app-notice/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* External dependencies
*/
import classnames from 'classnames';
import { Notice } from '@wordpress/components';

/**
* Internal dependencies
*/
import './index.scss';

/**
* Renders a Notice component with extra props.
*
* It supports all the props from @wordpress/components - Notice Component
*
* ## Usage
*
* ```jsx
* <AppNotice >
* My Notice
* </AppButton>
* ```
*
* @param {*} props Props to be forwarded to {@link Notice}.
*/
const AppNotice = ( props ) => {
const { className, ...rest } = props;
const classes = [ 'app-notice', className ];
return <Notice className={ classnames( ...classes ) } { ...rest } />;
};

export default AppNotice;
6 changes: 6 additions & 0 deletions js/src/components/app-notice/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.app-notice {
border: 0;
font-size: $helptext-font-size;
margin: 0 var(--large-gap) var(--main-gap);
padding: $grid-unit-20;
}
58 changes: 58 additions & 0 deletions js/src/components/enable-new-product-sync-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';
import { useState } from '@wordpress/element';

/**
* Internal dependencies
*/
import AppButton from '.~/components/app-button';
import { glaData } from '.~/constants';
import { API_NAMESPACE } from '.~/data/constants';
import useApiFetchCallback from '.~/hooks/useApiFetchCallback';
import useDispatchCoreNotices from '.~/hooks/useDispatchCoreNotices';

/**
* Button to initiate auth process for WP Rest API
*
* @param {Object} params The component params
* @return {JSX.Element} The button.
*/
const EnableNewProductSyncButton = ( params ) => {
const { createNotice } = useDispatchCoreNotices();
const [ loading, setLoading ] = useState( false );
const nextPageName = glaData.mcSetupComplete ? 'settings' : 'setup-mc';
const query = { next_page_name: nextPageName };
const path = addQueryArgs( `${ API_NAMESPACE }/rest-api/authorize`, query );
const [ fetchRestAPIAuthorize ] = useApiFetchCallback( { path } );
const handleEnableClick = async () => {
try {
setLoading( true );
const d = await fetchRestAPIAuthorize();
setLoading( false );
window.location.href = d.auth_url;
} catch ( error ) {
setLoading( false );
createNotice(
'error',
__(
'Unable to enable new product sync. Please try again later.',
'google-listings-and-ads'
)
);
}
};

return (
<AppButton
isSecondary
loading={ loading }
onClick={ handleEnableClick }
{ ...params }
/>
);
};

export default EnableNewProductSyncButton;
56 changes: 56 additions & 0 deletions js/src/components/enable-new-product-sync-notice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { Notice } from '@wordpress/components';
import { createInterpolateElement } from '@wordpress/element';

/**
* Internal dependencies
*/
import useGoogleMCAccount from '.~/hooks/useGoogleMCAccount';
import EnableNewProductSyncButton from '.~/components/enable-new-product-sync-button';

/**
* Shows info {@link Notice}
* about enabling new product sync when the feature flag is turned on and hasn't switched to new product sync.
*
* @return {JSX.Element} {@link Notice} element with the info message and the button to enable new product sync.
*/
const EnableNewProductSyncNotice = () => {
const {
hasFinishedResolution: hasGoogleMCAccountFinishedResolution,
googleMCAccount,
} = useGoogleMCAccount();

// Do not render if already switch to new product sync.
if (
! hasGoogleMCAccountFinishedResolution ||
! googleMCAccount.notification_service_enabled ||
googleMCAccount.wpcom_rest_api_status
) {
return null;
}

return (
<Notice status="info" isDismissible={ false }>
{ createInterpolateElement(
__(
'<p>We will soon transition to a new and improved method for synchronizing product data with Google.</p><enableButton>Get early access</enableButton>',
'google-listings-and-ads'
),
{
enableButton: (
<EnableNewProductSyncButton
eventName="gla_enable_product_sync_click"
eventProps={ { context: 'banner' } }
/>
),
p: <p />,
}
) }
</Notice>
);
};

export default EnableNewProductSyncNotice;
Loading

0 comments on commit 1888e70

Please sign in to comment.