Skip to content

Commit

Permalink
Merge pull request #2372 from woocommerce/release/2.6.7
Browse files Browse the repository at this point in the history
Release 2.6.7
  • Loading branch information
ianlin authored Apr 16, 2024
2 parents c6ba7fa + e3d2d26 commit 88d26b6
Show file tree
Hide file tree
Showing 19 changed files with 1,293 additions and 399 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ bin export-ignore
tests export-ignore
js/src export-ignore
js/build-dev export-ignore
docs export-ignore
README.md export-ignore
package.json export-ignore
package-lock.json export-ignore
Expand All @@ -20,6 +21,7 @@ webpack.config.js export-ignore
webpack-development.config.js export-ignore
jest.config.js export-ignore
wordpress_org_assets export-ignore
.codecov.yml export-ignore
.editorconfig export-ignore
.externalized.json export-ignore
.prettierrc.js export-ignore
Expand All @@ -28,5 +30,7 @@ wordpress_org_assets export-ignore
.eslintrc.js export-ignore
.stylelintignore export-ignore
.stylelintrc.json export-ignore
.npmrc export-ignore
.nvmrc export-ignore
.jsdocrc.json export-ignore
.wp-env.json export-ignore
1 change: 1 addition & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"phpVersion": "8.0",
"plugins": [
"https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip",
"https://github.com/WP-API/Basic-Auth/archive/master.zip",
"./tests/e2e/test-data",
"./tests/e2e/test-snippets",
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*** WooCommerce Google Listings and Ads Changelog ***

= 2.6.7 - 2024-04-16 =
* Dev - Add E2E tests for the integration in the classic product editor.
* Dev - Update e2e test environment to install WooCommerce earlier.
* Fix - Exception in request review.

= 2.6.6 - 2024-04-09 =
* Dev - Add snippet to bypass WooCommerce dependency in E2E tests.
* Tweak - WC 8.8 compatibility.
Expand Down
4 changes: 2 additions & 2 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 Listings and Ads
* 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.6.6
* Version: 2.6.7
* Author: WooCommerce
* Author URI: https://woo.com/
* Text Domain: google-listings-and-ads
Expand All @@ -30,7 +30,7 @@

defined( 'ABSPATH' ) || exit;

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

Expand Down
3 changes: 2 additions & 1 deletion js/src/product-feed/review-request/review-request-notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ const ReviewRequestNotice = ( {
<FlexItem className="gla-review-request-notice__button">
{ accountReviewStatus.requestButton &&
( account.cooldown ||
account.reviewEligibleRegions.length > 0 ) && (
Object.keys( account.reviewEligibleRegions )?.length >
0 ) && (
<AppButton
isPrimary
onClick={ onRequestReviewClick }
Expand Down
67 changes: 36 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "google-listings-and-ads",
"title": "Google Listings and Ads",
"version": "2.6.6",
"version": "2.6.7",
"description": "google-listings-and-ads",
"author": "Automattic",
"license": "GPL-3.0-or-later",
Expand Down Expand Up @@ -82,6 +82,9 @@
"engine.io-client": {
"xmlhttprequest-ssl@<1.6.2": "1.6.2",
"ws@<6.2.2": "6.2.2"
},
"socket.io-client": {
"debug@<4.3.1": "4.3.1"
}
},
"scripts": {
Expand Down
11 changes: 6 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Requires at least: 5.9
Tested up to: 6.5
Requires PHP: 7.4
Requires PHP Architecture: 64 Bits
Stable tag: 2.6.6
Stable tag: 2.6.7
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -111,6 +111,11 @@ Yes, you can run both at the same time, and we recommend it! In the US, advertis

== Changelog ==

= 2.6.7 - 2024-04-16 =
* Dev - Add E2E tests for the integration in the classic product editor.
* Dev - Update e2e test environment to install WooCommerce earlier.
* Fix - Exception in request review.

= 2.6.6 - 2024-04-09 =
* Dev - Add snippet to bypass WooCommerce dependency in E2E tests.
* Tweak - WC 8.8 compatibility.
Expand All @@ -119,8 +124,4 @@ Yes, you can run both at the same time, and we recommend it! In the US, advertis
* Dev - Update test proxy port.
* Tweak - Show Review Inbox Notices when 11 clicks and 1 Conversion.

= 2.6.4 - 2024-03-26 =
* Dev - Add a manual workflow run for PHP unit tests.
* Update - Refactor Product Stats.

[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/google-listings-and-ads/trunk/changelog.txt).
3 changes: 2 additions & 1 deletion src/API/Google/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,15 @@ public function account_request_review( $regions ) {
$client = $this->container->get( Client::class );

// For each region we request a new review
foreach ( $regions as $region_code ) {
foreach ( $regions as $region_code => $region_types ) {
$result = $client->post(
$this->get_manager_url( 'account-review-request' ),
[
'body' => json_encode(
[
'accountId' => $this->options->get_merchant_id(),
'regionCode' => $region_code,
'types' => $region_types,
]
),
]
Expand Down
22 changes: 16 additions & 6 deletions src/Google/RequestReviewStatuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function get_statuses_from_response( array $response ) {
$valid_program_states = [ self::ENABLED, self::NO_OFFERS ];
$review_eligible_regions = [];

foreach ( $response as $program_type ) {
foreach ( $response as $program_type_name => $program_type ) {

// In case any Program is with no offers we consider it Onboarding
if ( $program_type['data']['globalState'] === self::NO_OFFERS ) {
Expand All @@ -54,7 +54,7 @@ public function get_statuses_from_response( array $response ) {
$issues = array_merge( $issues, $region_status['reviewIssues'] ?? [] );
$cooldown = $this->maybe_update_cooldown_period( $region_status, $cooldown );
$status = $this->maybe_update_status( $region_status['eligibilityStatus'], $status );
$review_eligible_regions = $this->maybe_load_eligible_region( $region_status, $review_eligible_regions );
$review_eligible_regions = $this->maybe_load_eligible_region( $region_status, $review_eligible_regions, $program_type_name );
}
}

Expand Down Expand Up @@ -120,18 +120,28 @@ private function maybe_update_status( $new_status, $status ) {
/**
* Updates the regions where a request review is allowed.
*
* @param array $region_status Associative array containing the region eligibility.
* @param array $review_eligible_regions Indexed array with the current eligible regions.
* @param array $region_status Associative array containing the region eligibility.
* @param array $review_eligible_regions Indexed array with the current eligible regions.
* @param "freeListingsProgram"|"shoppingAdsProgram" $type The program type.
*
* @return array The (maybe) modified $review_eligible_regions array
*/
private function maybe_load_eligible_region( array $region_status, array $review_eligible_regions ) {
private function maybe_load_eligible_region( array $region_status, array $review_eligible_regions, string $type = 'freeListingsProgram' ) {
if (
! empty( $region_status['regionCodes'] ) &&
isset( $region_status['reviewEligibilityStatus'] ) &&
$region_status['reviewEligibilityStatus'] === self::ELIGIBLE
) {
array_push( $review_eligible_regions, $region_status['regionCodes'][0] );

sort( $region_status['regionCodes'] ); // sometimes the regions come unsorted between the different programs
$region_id = $region_status['regionCodes'][0];

if ( ! isset( $review_eligible_regions[ $region_id ] ) ) {
$review_eligible_regions[ $region_id ] = [];
}

$review_eligible_regions[ $region_id ][] = strtolower( $type ); // lowercase as is how we expect it in WCS

}

return $review_eligible_regions;
Expand Down
Loading

0 comments on commit 88d26b6

Please sign in to comment.