diff --git a/.eslintrc.js b/.eslintrc.js index 9a833a5872..4e6ab961b0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,14 +43,13 @@ module.exports = { additionalHooks: 'useSelect', }, ], - // When a file imports from both `@wordpress/components` and `extracted/@wordpress/components` - // at the same time, it would get the "no-duplicates" warning. It should be considered a - // false positive when working on the externalization process. So here we temporarily change - // to use "no-duplicate-imports" instead. - // - // TODO: After the externalizations of `@wordpress/*` and `@woocommerce/*` are complete, - // remove the following two lines of rule settings. - 'import/no-duplicates': 'off', - 'no-duplicate-imports': 'warn', }, + overrides: [ + { + files: [ 'tests/e2e/**/*.js' ], + rules: { + 'jest/no-done-callback': [ 'off' ], + }, + }, + ], }; diff --git a/.externalized.json b/.externalized.json index ac718a14a8..f4a68c1e60 100644 --- a/.externalized.json +++ b/.externalized.json @@ -1 +1 @@ -["@woocommerce/components","@woocommerce/customer-effort-score","@woocommerce/data","@woocommerce/navigation","@woocommerce/settings","@wordpress/a11y","@wordpress/api-fetch","@wordpress/data","@wordpress/data-controls","@wordpress/date","@wordpress/deprecated","@wordpress/dom","@wordpress/element","@wordpress/escape-html","@wordpress/hooks","@wordpress/html-entities","@wordpress/i18n","@wordpress/is-shallow-equal","@wordpress/keycodes","@wordpress/priority-queue","@wordpress/rich-text","@wordpress/url","@wordpress/warning","extracted/@wordpress/components","lodash","moment","react","react-dom"] \ No newline at end of file +["@woocommerce/components","@woocommerce/customer-effort-score","@woocommerce/data","@woocommerce/navigation","@woocommerce/settings","@wordpress/api-fetch","@wordpress/components","@wordpress/compose","@wordpress/data","@wordpress/data-controls","@wordpress/date","@wordpress/deprecated","@wordpress/dom","@wordpress/element","@wordpress/hooks","@wordpress/html-entities","@wordpress/i18n","@wordpress/primitives","@wordpress/url","lodash","moment","react","react-dom"] \ No newline at end of file diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 4397e8b5fc..583b7c345e 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -8,6 +8,11 @@ on: branches: - "release/**" workflow_dispatch: + inputs: + wp-rc-version: + description: 'WordPress version for Release Candidate (ex. 6.3-RC3)' + wc-rc-version: + description: 'WooCommerce version for Release Candidate (ex. 8.0.0-rc.1)' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -20,11 +25,6 @@ jobs: env: FORCE_COLOR: 2 steps: - # Needed for Ubuntu 20.04. - - name: Kill mono to free 8084 - run: | - sudo killall mono - - name: Checkout repository uses: actions/checkout@v3 @@ -45,22 +45,32 @@ jobs: npm run build echo "::endgroup::" - - name: Start docker container + - name: Start wp-env container + run: npm run wp-env:up + + - name: Install WP release candidate (optional) + if: github.event.inputs.wp-rc-version != '' run: | - npm run docker:up - sleep 10 + npm run -- wp-env run tests-cli -- wp core update --version=${{ github.event.inputs.wp-rc-version }} + npm run -- wp-env run tests-cli -- wp core update-db - - name: Run tests - env: - WC_E2E_SCREENSHOTS: 1 + - name: Install WC release candidate (optional) + if: github.event.inputs.wc-rc-version != '' run: | - npm run test:e2e + npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=${{ github.event.inputs.wc-rc-version }} + npm run -- wp-env run tests-cli -- wp wc update + + - name: Download and install Chromium browser. + run: npx playwright install chromium + + - name: Run tests + run: npm run test:e2e - - name: Archive e2e test screenshots + - name: Archive e2e failure screenshots if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: e2e-screenshots - path: tests/e2e/screenshots + path: tests/e2e/test-results/report/**/*.png if-no-files-found: ignore retention-days: 5 diff --git a/.github/workflows/php-hook-documentation.yml b/.github/workflows/php-hook-documentation.yml new file mode 100644 index 0000000000..edf23cf7e1 --- /dev/null +++ b/.github/workflows/php-hook-documentation.yml @@ -0,0 +1,58 @@ +name: PHP Hook Documentation Generator + +on: + push: + branches: + - "release/**" + paths: + - "**.php" + - .github/workflows/php-hook-documentation.yml + pull_request: + types: + - opened + branches: + - "release/**" + paths: + - "**.php" + - .github/workflows/php-hook-documentation.yml + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + HookDocumentation: + name: Hook Documentation Generator + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + # Checks out a branch instead of a commit in detached HEAD state + ref: ${{ github.head_ref }} + + # This generates the documentation string. The `id` property is used to reference the output in the next step. + - name: Generate hook documentation + id: generate-hook-docs + uses: woocommerce/grow/hook-documentation@actions-v1 + with: + debug-output: yes + source-directories: src/,views/,google-listings-and-ads.php,uninstall.php + + - name: Commit hook documentation + shell: bash + # Use the github-actions bot account to commit. + # https://api.github.com/users/github-actions%5Bbot%5D + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + echo "${{ steps.generate-hook-docs.outputs.hook-docs }}" > src/Hooks/README.md + git add src/Hooks/README.md + if git diff --cached --quiet; then + echo "*No documentation changes to commit.*" >> $GITHUB_STEP_SUMMARY + else + echo "*Committing documentation changes.*" >> $GITHUB_STEP_SUMMARY + git commit -q -m "Update hooks documentation from ${{ github.head_ref }} branch." + git push + fi diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index 27dab3027a..1a82f0d54c 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -23,20 +23,26 @@ concurrency: jobs: GetMatrix: - name: Get WP version Matrix + name: Get WP and WC version Matrix runs-on: ubuntu-latest outputs: wp-versions: ${{ steps.wp.outputs.versions }} - latest-wp-version: ${{ fromJson(steps.wp.outputs.versions)[0] }} + wc-versions: ${{ steps.wc.outputs.versions }} + latest-wc-version: ${{ fromJson(steps.wc.outputs.versions)[0] }} steps: - name: Get Release versions from Wordpress id: wp uses: woocommerce/grow/get-plugin-releases@actions-v1 with: slug: wordpress + - name: Get Release versions from WooCommerce + id: wc + uses: woocommerce/grow/get-plugin-releases@actions-v1 + with: + slug: woocommerce UnitTests: - name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version }} + name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-versions || 'latest' }} needs: GetMatrix runs-on: ubuntu-latest env: @@ -44,15 +50,19 @@ jobs: WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit" strategy: matrix: - php: [8.0] - wp-version: ${{ fromJson(needs.GetMatrix.outputs.wp-versions) }} + php: [ 8.0 ] + wp-version: [ latest ] + wc-versions: ${{ fromJson(needs.GetMatrix.outputs.wc-versions) }} include: + - php: 8.2 + wp-version: latest + wc-versions: latest - php: 7.4 - wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }} + wp-version: ${{ fromJson(needs.GetMatrix.outputs.wp-versions)[2] }} # L-2 WP Version support + wc-versions: ${{ fromJson(needs.GetMatrix.outputs.wc-versions)[2] }} # L-2 WC Version support - php: 8.1 - wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }} - - php: 8.2 - wp-version: ${{ needs.GetMatrix.outputs.latest-wp-version }} + wp-version: latest + wc-versions: latest steps: - name: Checkout repository @@ -67,9 +77,9 @@ jobs: uses: woocommerce/grow/prepare-mysql@actions-v1 - name: Install WP tests - run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} + run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} ${{ matrix.wc-versions }} - - if: matrix.wp-version == needs.GetMatrix.outputs.latest-wp-version && matrix.php == 8.0 + - if: matrix.wc-versions == needs.GetMatrix.outputs.latest-wc-version && matrix.php == 8.0 name: Set condition to generate coverage report (only on latest versions) run: echo "generate_coverage=true" >> $GITHUB_ENV diff --git a/.github/workflows/post-release-automerge.yml b/.github/workflows/post-release-automerge.yml deleted file mode 100644 index 8555f5c4fa..0000000000 --- a/.github/workflows/post-release-automerge.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: 'Merge the release to develop' -run-name: Merge the released `${{ github.head_ref }}` from `trunk` to `develop` - -# **What it does**: Merges trunk to develop after `release/*` is merged to `trunk`. -# **Why we have it**: To automate the release process and follow git-flow. - -on: - pull_request: - types: - - closed - branches: - - trunk - -jobs: - automerge_trunk: - name: Automerge released trunk - runs-on: ubuntu-latest - steps: - - uses: woocommerce/grow/automerge-released-trunk@actions-v1 diff --git a/.github/workflows/post-release-merge.yml b/.github/workflows/post-release-merge.yml new file mode 100644 index 0000000000..bbdf939fdf --- /dev/null +++ b/.github/workflows/post-release-merge.yml @@ -0,0 +1,18 @@ +name: 'Merge the release to develop' +run-name: Make a PR to merge the released `${{ github.head_ref }}` from `trunk` to `develop` + +# **What it does**: Creates a PR to merge `trunk` to `develop` after `prepare-extension-release`-based release is merged to `trunk`. +# **Why we have it**: To automate the release process and follow the git-flow. + +on: + pull_request: + types: + - closed + branches: + - trunk + +jobs: + MergeTrunkDevelopPR: + runs-on: ubuntu-latest + steps: + - uses: woocommerce/grow/merge-trunk-develop-pr@actions-v1 diff --git a/.gitignore b/.gitignore index 88ae5d5267..4326850f05 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ languages/* coverage tests/php-coverage .phpunit.result.cache -tests/e2e/test-results.json +tests/e2e/test-results # Directories/files that may appear in your environment .DS_Store diff --git a/.wp-env.json b/.wp-env.json index 1476873851..1931f6caf1 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,10 +1,13 @@ { "phpVersion": "8.0", "plugins": [ - "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", "https://github.com/WP-API/Basic-Auth/archive/master.zip", "." ], + "mappings": { + "wp-cli.yml": "./tests/e2e/config/wp-cli.yml", + "wp-content/plugins/test-data.php": "./tests/e2e/bin/test-data.php" + }, "lifecycleScripts": { "afterStart": "./tests/e2e/bin/test-env-setup.sh", "afterClean": "./tests/e2e/bin/test-env-setup.sh" diff --git a/README.md b/README.md index 20ce14e2b0..e30c95363b 100644 --- a/README.md +++ b/README.md @@ -135,11 +135,14 @@ The tests will execute and you'll be presented with a summary. ## E2E Testing -E2E testing uses [@woocommerce/e2e-environment](https://www.npmjs.com/package/@woocommerce/e2e-environment) which requires [Docker](https://www.docker.com/). +E2E testing uses [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) which requires [Docker](https://www.docker.com/). Make sure Docker is running in your machine, and run the following: -`npm run docker:up` - This will automatically download and run WordPress in a Docker container. You can access it at http://localhost:8084 (Username: admin, Password: password). +`npm run wp-env:up` - This will automatically download and run WordPress in a Docker container. You can access it at http://localhost:8889 (Username: admin, Password: password). + +To install the PlayWright browser locally you can run: +`npx playwright install chromium` Run E2E testing: @@ -148,13 +151,31 @@ Run E2E testing: To remove the Docker container and images (this will **delete everything** in the WordPress Docker container): -`npm run docker:down` +`npm run wp-env destroy` :warning: Currently, the E2E testing on GitHub Actions is only run automatically after opening a PR with `release/*` branches or pushing changes to `release/*` branches. To run it manually, please visit [here](../../actions/workflows/e2e-tests.yml) and follow [this instruction](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow?tool=webui) to do so. -### Linux Troubleshooting +### Test other WordPress versions +By default the latest version of WordPress will be installed. `WP_ENV_CORE` can be used to install a specific version. + +``` +WP_ENV_CORE=WordPress/WordPress#6.2.2 npm run wp-env:up +``` + +This does not work with Release Candidate versions as the tag is not available. Instead we can bring the `wp-env:up` with the latest version and then upgrade WordPress through WP CLI. -If you encounter problems starting your `test:e2e`, like `No usable sandbox!` or `UnhandledPromiseRejectionWarning: Error: Page crashed!`, you may try disabling the Chromium sandbox by adding `--no-sandbox` to `launch.args` in [`/tests/e2e/config/jest-puppeteer.config.js#L7`](https://github.com/woocommerce/google-listings-and-ads/blob/develop/tests/e2e/config/jest-puppeteer.config.js#L7). +``` +npm run -- wp-env run tests-cli -- wp core update --version=6.3-RC3 +npm run -- wp-env run tests-cli -- wp core update-db +``` + +### Test other WooCommerce versions +WooCommerce is installed through WP CLI so we can use this to update to a newer version like a release candidate. + +``` +npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version=8.0.0-rc.1 +npm run -- wp-env run tests-cli -- wp wc update +``` ## Docs diff --git a/bin/GoogleAdsCleanupServices.php b/bin/GoogleAdsCleanupServices.php index 8c02bbc9de..0354e1450e 100644 --- a/bin/GoogleAdsCleanupServices.php +++ b/bin/GoogleAdsCleanupServices.php @@ -26,7 +26,7 @@ class GoogleAdsCleanupServices { * * @var string */ - protected $version = 'V13'; + protected $version = 'V14'; /** * @var Event Composer event. diff --git a/bin/HooksDocsGenerator.php b/bin/HooksDocsGenerator.php deleted file mode 100644 index eac13af78e..0000000000 --- a/bin/HooksDocsGenerator.php +++ /dev/null @@ -1,265 +0,0 @@ - $files ) { - $hooks_found = []; - - foreach ( $files as $f ) { - $current_file = $f; - $tokens = token_get_all( file_get_contents( $f ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions - $token_type = false; - $current_class = ''; - $current_function = ''; - - if ( in_array( $current_file, $scanned, true ) ) { - continue; - } - - $scanned[] = $current_file; - - foreach ( $tokens as $index => $token ) { - if ( is_array( $token ) ) { - $trimmed_token_1 = trim( $token[1] ); - if ( T_CLASS === $token[0] ) { - $token_type = 'class'; - } elseif ( T_FUNCTION === $token[0] ) { - $token_type = 'function'; - } elseif ( 'do_action' === $token[1] ) { - $token_type = 'action'; - } elseif ( 'apply_filters' === $token[1] ) { - $token_type = 'filter'; - } elseif ( $token_type && ! empty( $trimmed_token_1 ) ) { - switch ( $token_type ) { - case 'class': - $current_class = $token[1]; - break; - case 'function': - $current_function = $token[1]; - break; - case 'filter': - case 'action': - $hook = trim( $token[1], "'" ); - $hook = str_replace( '_FUNCTION_', strtoupper( $current_function ), $hook ); - $hook = str_replace( '_CLASS_', strtoupper( $current_class ), $hook ); - $hook = str_replace( '$this', strtoupper( $current_class ), $hook ); - $hook = str_replace( [ '.', '{', '}', '"', "'", ' ', ')', '(' ], '', $hook ); - $hook = preg_replace( '/\/\/phpcs:(.*)(\n)/', '', $hook ); - $loop = 0; - - // Keep adding to hook until we find a comma or colon. - while ( 1 ) { - $loop++; - $prev_hook = is_string( $tokens[ $index + $loop - 1 ] ) ? $tokens[ $index + $loop - 1 ] : $tokens[ $index + $loop - 1 ][1]; - $next_hook = is_string( $tokens[ $index + $loop ] ) ? $tokens[ $index + $loop ] : $tokens[ $index + $loop ][1]; - - if ( in_array( $next_hook, [ '.', '{', '}', '"', "'", ' ', ')', '(' ], true ) ) { - continue; - } - - if ( in_array( $next_hook, [ ',', ';' ], true ) ) { - break; - } - - $hook_first = substr( $next_hook, 0, 1 ); - $hook_last = substr( $next_hook, -1, 1 ); - - if ( '{' === $hook_first || '}' === $hook_last || '$' === $hook_first || ')' === $hook_last || '>' === substr( $prev_hook, -1, 1 ) ) { - $next_hook = strtoupper( $next_hook ); - } - - $next_hook = str_replace( [ '.', '{', '}', '"', "'", ' ', ')', '(' ], '', $next_hook ); - - $hook .= $next_hook; - } - - $hook = trim( $hook ); - - if ( isset( $hooks_found[ $hook ] ) ) { - $hooks_found[ $hook ]['files'][] = [ - 'path' => $current_file, - 'line' => $token[2], - ]; - } else { - $hooks_found[ $hook ] = [ - 'files' => [ - [ - 'path' => $current_file, - 'line' => $token[2], - ], - ], - 'class' => $current_class, - 'function' => $current_function, - 'type' => $token_type, - ]; - } - break; - } - $token_type = false; - } - } - } - } - - ksort( $hooks_found ); - - if ( ! empty( $hooks_found ) ) { - $results[ $heading ] = $hooks_found; - } - } - - return $results; - } - - /** - * Get file URL. - * - * @param array $file File data. - * @return string - */ - protected static function get_file_url( array $file ): string { - $url = str_replace( '.php', '.php#L' . $file['line'], $file['path'] ); - return $url; - } - - /** - * Get file link. - * - * @param array $file File data. - * @return string - */ - protected static function get_file_link( array $file ): string { - return '' . basename( $file['path'] ) . "#L{$file['line']}" . ''; - } - - /** - * Get delimited list output. - * - * @param array $hook_list List of hooks. - * @param array $files_to_scan List of files to scan. - */ - protected static function get_delimited_list_output( array $hook_list, array $files_to_scan ): string { - $output = "# Hooks Reference\n\n"; - $output .= "A list of hooks, i.e `actions` and `filters`, that are defined or used in this project.\n\n"; - - foreach ( $hook_list as $hooks ) { - foreach ( $hooks as $hook => $details ) { - $output .= "## {$hook}\n\n"; - $output .= "**Type**: {$details['type']}\n\n"; - $output .= "**Used in**:\n\n"; - $link_list = []; - foreach ( $details['files'] as $file ) { - $link_list[] = '- ' . self::get_file_link( $file ); - } - $output .= implode( "\n", $link_list ); - $output .= "\n\n"; - } - } - - return $output; - } - - /** - * Generate hooks documentation. - */ - public static function generate_hooks_docs() { - $files_to_scan = self::get_files_to_scan(); - $hook_list = self::get_hooks( $files_to_scan ); - - if ( empty( $hook_list ) ) { - return; - } - - // Add hooks reference content. - $output = self::get_delimited_list_output( $hook_list, $files_to_scan ); - - file_put_contents( self::HOOKS_MARKDOWN_OUTPUT, $output ); // phpcs:ignore WordPress.WP.AlternativeFunctions - } -} - -HooksDocsGenerator::generate_hooks_docs(); diff --git a/bin/prefix-vendor-namespace.php b/bin/prefix-vendor-namespace.php index 275e5e7753..9e0630a3cc 100755 --- a/bin/prefix-vendor-namespace.php +++ b/bin/prefix-vendor-namespace.php @@ -125,7 +125,6 @@ 'GuzzleHttp\describe_type', 'GuzzleHttp\HandlerStack::create', 'GuzzleHttp\Message\ResponseInterface)', - 'GuzzleHttp\Promise\promise_for', 'GuzzleHttp\Psr7\Message::bodySummary', 'GuzzleHttp\Psr7\Utils::streamFor', 'GuzzleHttp\Psr7\Utils::tryFopen', diff --git a/changelog.txt b/changelog.txt index c2651030a6..c788470483 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,17 @@ *** WooCommerce Google Listings and Ads Changelog *** += 2.5.3 - 2023-08-22 = +* Dev - Add Action for Hooks Documentation Generator. +* Dev - Allow E2E testing with Release Candidates. +* Dev - Convert E2E tests from Puppeteer to Playwright. +* Dev - Externalize all WordPress JavaScript packages via Dependency Extraction Webpack Plugin (DEWP). +* Dev - Fetch WooCommerce L-1 versions for our tests. +* Dev - Remove legacy HooksDocsGenerator.php file. +* Dev - Use `merge-trunk-develop-pr` action. +* Tweak - Apply consistent admin theme colors to common UI components. +* Update - Google API Client Services package to v0.312. +* Update - Google Ads library to API V14. (package v19.2.0). + = 2.5.2 - 2023-08-08 = * Fix - Remove `add_woocommerce_extended_task_list_item` and `remove_woocommerce_extended_task_list_item` hooks. * Fix - WordPress 6.3 compatibility: The forms and image selector may not work due to "setImmediate" deprecation. diff --git a/composer.json b/composer.json index c0347177d8..8e99acd290 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,8 @@ "automattic/jetpack-config": "^1.4", "automattic/jetpack-connection": "^1.40", "google/apiclient": "^2.15", - "google/apiclient-services": "~0.302", - "googleads/google-ads-php": "^19.1", + "google/apiclient-services": "~0.312", + "googleads/google-ads-php": "^19.2", "league/container": "^3.4", "league/iso3166": "^4.1", "phpseclib/bcmath_compat": "^2.0", @@ -39,8 +39,7 @@ "Automattic\\WooCommerce\\GoogleListingsAndAds\\Util\\": "bin/" }, "files": [ - "vendor/guzzlehttp/guzzle/src/functions_include.php", - "vendor/guzzlehttp/promises/src/functions_include.php" + "vendor/guzzlehttp/guzzle/src/functions_include.php" ] }, "autoload-dev": { @@ -63,7 +62,7 @@ "Google\\Task\\Composer::cleanup", "Automattic\\WooCommerce\\GoogleListingsAndAds\\Util\\SymfonyPolyfillCleanup::remove", "Automattic\\WooCommerce\\GoogleListingsAndAds\\Util\\GoogleAdsCleanupServices::remove", - "composer run-script remove-google-ads-api-version-support -- 10 11 12", + "composer run-script remove-google-ads-api-version-support -- 11 12 13", "php ./bin/prefix-vendor-namespace.php", "bash ./bin/cleanup-vendor-files.sh", "composer dump-autoload" diff --git a/composer.lock b/composer.lock index ceac778cc2..f888707051 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": "350637b12e5b055c29976df3363ac35d", + "content-hash": "e11445388ffb41fd143162a17acf77b8", "packages": [ { "name": "automattic/jetpack-a8c-mc-stats", @@ -442,16 +442,16 @@ }, { "name": "firebase/php-jwt", - "version": "v6.5.0", + "version": "v6.8.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "e94e7353302b0c11ec3cfff7180cd0b1743975d2" + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/e94e7353302b0c11ec3cfff7180cd0b1743975d2", - "reference": "e94e7353302b0c11ec3cfff7180cd0b1743975d2", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26", + "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26", "shasum": "" }, "require": { @@ -499,9 +499,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.5.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.8.1" }, - "time": "2023-05-12T15:47:07+00:00" + "time": "2023-07-14T18:33:00+00:00" }, { "name": "google/apiclient", @@ -574,20 +574,20 @@ }, { "name": "google/apiclient-services", - "version": "v0.302.0", + "version": "v0.312.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "ac872f59a7b4631b12628fe990c167d18a71c783" + "reference": "45d47fed73b28254c511882bc743b1690a99558d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ac872f59a7b4631b12628fe990c167d18a71c783", - "reference": "ac872f59a7b4631b12628fe990c167d18a71c783", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/45d47fed73b28254c511882bc743b1690a99558d", + "reference": "45d47fed73b28254c511882bc743b1690a99558d", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.4||^8.0" }, "require-dev": { "phpunit/phpunit": "^5.7||^8.5.13" @@ -612,9 +612,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.302.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.312.0" }, - "time": "2023-05-16T01:08:12+00:00" + "time": "2023-08-14T00:56:12+00:00" }, { "name": "google/auth", @@ -676,16 +676,16 @@ }, { "name": "google/common-protos", - "version": "v4.1.0", + "version": "v4.2.0", "source": { "type": "git", "url": "https://github.com/googleapis/common-protos-php.git", - "reference": "4c74dd56310b835115b939a561f7c1f0e3b36364" + "reference": "5d9e21141d94329d69d45a8c7a0cdeafd1a143f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/4c74dd56310b835115b939a561f7c1f0e3b36364", - "reference": "4c74dd56310b835115b939a561f7c1f0e3b36364", + "url": "https://api.github.com/repos/googleapis/common-protos-php/zipball/5d9e21141d94329d69d45a8c7a0cdeafd1a143f3", + "reference": "5d9e21141d94329d69d45a8c7a0cdeafd1a143f3", "shasum": "" }, "require": { @@ -722,22 +722,22 @@ ], "support": { "issues": "https://github.com/googleapis/common-protos-php/issues", - "source": "https://github.com/googleapis/common-protos-php/tree/v4.1.0" + "source": "https://github.com/googleapis/common-protos-php/tree/v4.2.0" }, - "time": "2023-05-09T17:34:00+00:00" + "time": "2023-07-25T21:51:55+00:00" }, { "name": "google/gax", - "version": "v1.20.2", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/googleapis/gax-php.git", - "reference": "4f101405b59925ac1d42ba1bbf5ca9fb4336248b" + "reference": "2566bce7081f17e4f4c35a215864c6d4a62f010f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/gax-php/zipball/4f101405b59925ac1d42ba1bbf5ca9fb4336248b", - "reference": "4f101405b59925ac1d42ba1bbf5ca9fb4336248b", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/2566bce7081f17e4f4c35a215864c6d4a62f010f", + "reference": "2566bce7081f17e4f4c35a215864c6d4a62f010f", "shasum": "" }, "require": { @@ -747,7 +747,7 @@ "google/longrunning": "^0.2", "google/protobuf": "^3.21.4", "grpc/grpc": "^1.13", - "guzzlehttp/promises": "^1.3", + "guzzlehttp/promises": "^1.4||^2.0", "guzzlehttp/psr7": "^2.0", "php": ">=7.4" }, @@ -777,9 +777,9 @@ ], "support": { "issues": "https://github.com/googleapis/gax-php/issues", - "source": "https://github.com/googleapis/gax-php/tree/v1.20.2" + "source": "https://github.com/googleapis/gax-php/tree/v1.22.1" }, - "time": "2023-05-12T16:22:50+00:00" + "time": "2023-08-04T14:32:15+00:00" }, { "name": "google/longrunning", @@ -827,16 +827,16 @@ }, { "name": "google/protobuf", - "version": "v3.23.2", + "version": "v3.24.0", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "2349098298b847814e3af4f6452ec43c65c8c4fb" + "reference": "bfa8d627de8464634e6e3b5943f6354baa9cedd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/2349098298b847814e3af4f6452ec43c65c8c4fb", - "reference": "2349098298b847814e3af4f6452ec43c65c8c4fb", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/bfa8d627de8464634e6e3b5943f6354baa9cedd2", + "reference": "bfa8d627de8464634e6e3b5943f6354baa9cedd2", "shasum": "" }, "require": { @@ -865,22 +865,22 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.23.2" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.24.0" }, - "time": "2023-05-25T22:33:09+00:00" + "time": "2023-08-08T21:14:02+00:00" }, { "name": "googleads/google-ads-php", - "version": "v19.1.0", + "version": "v19.2.0", "source": { "type": "git", "url": "https://github.com/googleads/google-ads-php.git", - "reference": "1a45e844d224638f7ff1bb15b0a05331540df3e1" + "reference": "2ae4c1b81bb4792e4711dcf150faddba80e9bdf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleads/google-ads-php/zipball/1a45e844d224638f7ff1bb15b0a05331540df3e1", - "reference": "1a45e844d224638f7ff1bb15b0a05331540df3e1", + "url": "https://api.github.com/repos/googleads/google-ads-php/zipball/2ae4c1b81bb4792e4711dcf150faddba80e9bdf0", + "reference": "2ae4c1b81bb4792e4711dcf150faddba80e9bdf0", "shasum": "" }, "require": { @@ -928,9 +928,9 @@ "homepage": "https://github.com/googleads/google-ads-php", "support": { "issues": "https://github.com/googleads/google-ads-php/issues", - "source": "https://github.com/googleads/google-ads-php/tree/v19.1.0" + "source": "https://github.com/googleads/google-ads-php/tree/v19.2.0" }, - "time": "2023-04-27T18:07:53+00:00" + "time": "2023-06-08T14:17:45+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1060,29 +1060,33 @@ }, { "name": "guzzlehttp/promises", - "version": "1.5.3", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e" + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/67ab6e18aaa14d753cc148911d273f6e6cb6721e", - "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e", + "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\Promise\\": "src/" } @@ -1119,7 +1123,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.3" + "source": "https://github.com/guzzle/promises/tree/2.0.1" }, "funding": [ { @@ -1135,20 +1139,20 @@ "type": "tidelift" } ], - "time": "2023-05-21T12:31:43+00:00" + "time": "2023-08-03T15:11:55+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6" + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", - "reference": "b635f279edd83fc275f822a1188157ffea568ff6", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/8bd7c33a0734ae1c5d074360512beb716bef3f77", + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77", "shasum": "" }, "require": { @@ -1235,7 +1239,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.5.0" + "source": "https://github.com/guzzle/psr7/tree/2.6.0" }, "funding": [ { @@ -1251,7 +1255,7 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:11:26+00:00" + "time": "2023-08-03T15:06:02+00:00" }, { "name": "league/container", @@ -1672,16 +1676,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.19", + "version": "3.0.21", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "cc181005cf548bfd8a4896383bb825d859259f95" + "reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cc181005cf548bfd8a4896383bb825d859259f95", - "reference": "cc181005cf548bfd8a4896383bb825d859259f95", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4580645d3fc05c189024eb3b834c6c1e4f0f30a1", + "reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1", "shasum": "" }, "require": { @@ -1762,7 +1766,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.19" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.21" }, "funding": [ { @@ -1778,7 +1782,7 @@ "type": "tidelift" } ], - "time": "2023-03-05T17:13:09+00:00" + "time": "2023-07-09T15:24:48+00:00" }, { "name": "psr/cache", @@ -5557,5 +5561,5 @@ "platform-overrides": { "php": "7.4.30" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/google-listings-and-ads.php b/google-listings-and-ads.php index 8dd3d58d06..27f327076b 100644 --- a/google-listings-and-ads.php +++ b/google-listings-and-ads.php @@ -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.5.2 + * Version: 2.5.3 * Author: WooCommerce * Author URI: https://woocommerce.com/ * Text Domain: google-listings-and-ads @@ -30,7 +30,7 @@ defined( 'ABSPATH' ) || exit; -define( 'WC_GLA_VERSION', '2.5.2' ); // WRCS: DEFINED_VERSION. +define( 'WC_GLA_VERSION', '2.5.3' ); // WRCS: DEFINED_VERSION. define( 'WC_GLA_MIN_PHP_VER', '7.4' ); define( 'WC_GLA_MIN_WC_VER', '6.9' ); diff --git a/jest.config.js b/jest.config.js index 7482012e22..50f2c6d317 100644 --- a/jest.config.js +++ b/jest.config.js @@ -52,4 +52,5 @@ module.exports = { timeFormat: 'g:i a', }, }, + timers: 'fake', }; diff --git a/js/src/components/app-button/index.js b/js/src/components/app-button/index.js index 1bfe20b44a..b87d3a7e12 100644 --- a/js/src/components/app-button/index.js +++ b/js/src/components/app-button/index.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { Button } from 'extracted/@wordpress/components'; +import { Button } from '@wordpress/components'; import { Spinner } from '@woocommerce/components'; import { recordEvent } from '@woocommerce/tracks'; import classnames from 'classnames'; diff --git a/js/src/components/app-radio-content-control/index.scss b/js/src/components/app-radio-content-control/index.scss index c611fa6025..3f016e69cd 100644 --- a/js/src/components/app-radio-content-control/index.scss +++ b/js/src/components/app-radio-content-control/index.scss @@ -10,6 +10,7 @@ // by placing them on the same brid. .components-radio-control, .components-base-control__field, + .components-base-control__field .components-flex, .components-radio-control__option { display: contents; } diff --git a/js/src/components/app-standalone-toggle-control/index.scss b/js/src/components/app-standalone-toggle-control/index.scss index 79aa17ecc2..4b2fe3e4f5 100644 --- a/js/src/components/app-standalone-toggle-control/index.scss +++ b/js/src/components/app-standalone-toggle-control/index.scss @@ -4,10 +4,12 @@ display: inline-block; // remove the margins specified in ToggleControl component. + .components-base-control { + margin-bottom: 0; + } + .components-toggle-control { .components-base-control__field { - margin-bottom: 0; - .components-form-toggle { margin-right: 0; diff --git a/js/src/components/app-tooltip/index.js b/js/src/components/app-tooltip/index.js index 76fbb7c454..44f9822fc9 100644 --- a/js/src/components/app-tooltip/index.js +++ b/js/src/components/app-tooltip/index.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { Tooltip } from 'extracted/@wordpress/components'; +import { Tooltip } from '@wordpress/components'; import { Children } from '@wordpress/element'; /** diff --git a/js/src/components/dismissible-notice/index.js b/js/src/components/dismissible-notice/index.js deleted file mode 100644 index cfe36be2e0..0000000000 --- a/js/src/components/dismissible-notice/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * External dependencies - */ -import { Notice } from '@wordpress/components'; -import { useState } from '@wordpress/element'; -import { noop } from 'lodash'; - -/** - * Internal dependencies - */ -import localStorage from '.~/utils/localStorage'; - -/** - * Shows dismissible Notice {@link Notice} - * If localStorageKey is provided it will store the dismiss state in the localStorage - * - * - * @param {Object} props React props. - * @param {JSX.Element} props.children Children to render. - * @param {string|null} props.localStorageKey Local Storage Key where is keep the dismiss state. - * @param {Function} props.onRemove Callback when clicking on remove notice - * @param {Object} props.restProps Props to be forwarded to Notice Component. Like className. - * @return {JSX.Element} {@link Notice} Dismissible Notice element - */ -const DismissibleNotice = ( { - children, - localStorageKey = null, - onRemove = noop, - ...rest -} ) => { - const defaultDismissedValue = - localStorage.get( localStorageKey ) === 'true'; - - const [ isDismissed, setIsDismissed ] = useState( defaultDismissedValue ); - - const handleRemove = () => { - if ( localStorageKey ) { - localStorage.set( localStorageKey, true ); - } - - onRemove(); - - setIsDismissed( true ); - }; - - if ( isDismissed ) { - return null; - } - - return ( - - { children } - - ); -}; - -export default DismissibleNotice; diff --git a/js/src/components/dismissible-notice/index.test.js b/js/src/components/dismissible-notice/index.test.js deleted file mode 100644 index 504210ce08..0000000000 --- a/js/src/components/dismissible-notice/index.test.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * External dependencies - */ -import { fireEvent, render } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; - -/** - * Internal dependencies - */ -import DismissibleNotice from '.~/components/dismissible-notice'; -import localStorage from '.~/utils/localStorage'; - -jest.mock( '.~/utils/localStorage', () => { - return { - get: jest.fn(), - set: jest.fn(), - }; -} ); - -describe( 'Dismissible notice', () => { - const onRemove = jest.fn().mockName( 'On remove callback' ); - const localStorageKey = 'myDismissLocalStorageKey'; - - afterEach( () => { - jest.clearAllMocks(); - } ); - - it( 'Rendering Dismissible Notice', () => { - //using spokenMessage='' to avoid accessibility message. - //See https://make.wordpress.org/accessibility/handbook/markup/wp-a11y-speak/#the-generated-output - const { getByText, getByRole, container } = render( - -

My dismissible notice

-
- ); - - expect( container.firstChild.classList.contains( 'myClassName' ) ).toBe( - true - ); - const noticeContent = getByText( 'My dismissible notice' ); - const removeButton = getByRole( 'button' ); - - expect( noticeContent ).toBeTruthy(); - expect( removeButton ).toBeTruthy(); - } ); - - it( 'Rendering Dismissible Notice with onRemove callback', () => { - const getLocalStorage = localStorage.get.mockImplementation( () => { - return null; - } ); - - const { getByText, getByRole, queryByText } = render( - -

My dismissible notice

-
- ); - - expect( getByText( 'My dismissible notice' ) ).toBeTruthy(); - - const removeButton = getByRole( 'button' ); - expect( removeButton ).toBeTruthy(); - - expect( getLocalStorage ).toHaveBeenCalledTimes( 1 ); - - fireEvent.click( removeButton ); - - expect( onRemove ).toHaveBeenCalledTimes( 1 ); - - expect( queryByText( 'My dismissible notice' ) ).toBeFalsy(); - } ); - - it( 'Rendering Dismissible Notice with localStorageKey', () => { - const getLocalStorage = localStorage.get.mockImplementation( () => { - return null; - } ); - const setLocalStorage = localStorage.set.mockImplementation( () => { - return null; - } ); - - const { getByRole, queryByText } = render( - -

My dismissible notice

-
- ); - - expect( getLocalStorage ).toHaveBeenCalledTimes( 1 ); - expect( getLocalStorage ).toBeCalledWith( localStorageKey ); - - const removeButton = getByRole( 'button' ); - expect( removeButton ).toBeTruthy(); - - fireEvent.click( removeButton ); - - expect( onRemove ).toHaveBeenCalledTimes( 1 ); - expect( setLocalStorage ).toHaveBeenCalledTimes( 1 ); - expect( setLocalStorage ).toBeCalledWith( localStorageKey, true ); - - expect( queryByText( 'My dismissible notice' ) ).toBeFalsy(); - } ); - - it( 'Should not render Dismissible Notice if the dismiss state in the localStorage is set to true', () => { - const getLocalStorage = localStorage.get.mockImplementation( () => { - return 'true'; - } ); - - const { queryByText } = render( - -

My dismissible notice

-
- ); - - expect( queryByText( 'My dismissible notice' ) ).toBeFalsy(); - expect( getLocalStorage ).toHaveBeenCalledTimes( 1 ); - expect( getLocalStorage ).toBeCalledWith( localStorageKey ); - expect( onRemove ).toHaveBeenCalledTimes( 0 ); - } ); -} ); diff --git a/js/src/components/faqs-panel/index.js b/js/src/components/faqs-panel/index.js index 1a2adb8cb1..49cb1f98de 100644 --- a/js/src/components/faqs-panel/index.js +++ b/js/src/components/faqs-panel/index.js @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { Panel, PanelBody, PanelRow } from 'extracted/@wordpress/components'; +import { Panel, PanelBody, PanelRow } from '@wordpress/components'; import { recordEvent } from '@woocommerce/tracks'; import classnames from 'classnames'; diff --git a/js/src/components/google-ads-account-card/connected-google-ads-account-card.js b/js/src/components/google-ads-account-card/connected-google-ads-account-card.js index 6419e94b18..26f2e6fe7a 100644 --- a/js/src/components/google-ads-account-card/connected-google-ads-account-card.js +++ b/js/src/components/google-ads-account-card/connected-google-ads-account-card.js @@ -3,7 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import { useState } from '@wordpress/element'; -import { ExternalLink } from 'extracted/@wordpress/components'; +import { ExternalLink } from '@wordpress/components'; /** * Internal dependencies diff --git a/js/src/components/help-popover/index.js b/js/src/components/help-popover/index.js index f31d8f3a13..bf9c701545 100644 --- a/js/src/components/help-popover/index.js +++ b/js/src/components/help-popover/index.js @@ -3,7 +3,7 @@ */ import classnames from 'classnames'; import { __ } from '@wordpress/i18n'; -import { Popover } from 'extracted/@wordpress/components'; +import { Popover } from '@wordpress/components'; import { useState } from '@wordpress/element'; import GridiconHelpOutline from 'gridicons/dist/help-outline'; import { recordEvent } from '@woocommerce/tracks'; diff --git a/js/src/components/paid-ads/asset-group/final-url-card.js b/js/src/components/paid-ads/asset-group/final-url-card.js index fb2ff1645a..fea2c09394 100644 --- a/js/src/components/paid-ads/asset-group/final-url-card.js +++ b/js/src/components/paid-ads/asset-group/final-url-card.js @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; import { useState } from '@wordpress/element'; -import { ExternalLink } from 'extracted/@wordpress/components'; +import { ExternalLink } from '@wordpress/components'; /** * Internal dependencies diff --git a/js/src/components/paid-ads/assetSpecs.js b/js/src/components/paid-ads/assetSpecs.js index 5e51c832c4..df8eda5dde 100644 --- a/js/src/components/paid-ads/assetSpecs.js +++ b/js/src/components/paid-ads/assetSpecs.js @@ -2,7 +2,7 @@ * External dependencies */ import { __, _x, sprintf } from '@wordpress/i18n'; -import { ExternalLink } from 'extracted/@wordpress/components'; +import { ExternalLink } from '@wordpress/components'; import { Fragment, createInterpolateElement } from '@wordpress/element'; /** diff --git a/js/src/components/paid-ads/audience-section.scss b/js/src/components/paid-ads/audience-section.scss index d32c842c4d..565a4bc70f 100644 --- a/js/src/components/paid-ads/audience-section.scss +++ b/js/src/components/paid-ads/audience-section.scss @@ -3,20 +3,10 @@ // Repeat selector to make it higher priority. .components-input-control__container.components-input-control__container { .components-select-control__input { - min-height: $gla-size-control-height; padding-left: $grid-unit-20; } } - // Adjust labels of imported from @wordpress/components. - // Repeat selector to make it higher priority. - .components-base-control .components-select-control { - .components-input-control__label { - padding-bottom: 0; - margin-bottom: $grid-unit-10; - } - } - // Adjust help text of imported from @wordpress/components. .components-base-control__help { margin: 0; diff --git a/js/src/components/paid-ads/billing-card/billing-setup-card.js b/js/src/components/paid-ads/billing-card/billing-setup-card.js index 463065cd29..ddcaf96f8b 100644 --- a/js/src/components/paid-ads/billing-card/billing-setup-card.js +++ b/js/src/components/paid-ads/billing-card/billing-setup-card.js @@ -3,7 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; -import { ExternalLink } from 'extracted/@wordpress/components'; +import { ExternalLink } from '@wordpress/components'; /** * Internal dependencies diff --git a/js/src/components/pre-launch-check-item/index.js b/js/src/components/pre-launch-check-item/index.js index e4fde4de0d..f3878c7025 100644 --- a/js/src/components/pre-launch-check-item/index.js +++ b/js/src/components/pre-launch-check-item/index.js @@ -2,8 +2,12 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { CheckboxControl } from '@wordpress/components'; -import { Panel, PanelBody, PanelRow } from 'extracted/@wordpress/components'; +import { + Panel, + PanelBody, + PanelRow, + CheckboxControl, +} from '@wordpress/components'; import { recordEvent } from '@woocommerce/tracks'; import { useRef } from '@wordpress/element'; diff --git a/js/src/components/pre-launch-check-item/index.scss b/js/src/components/pre-launch-check-item/index.scss index 62d48b4c57..9576b8a4b4 100644 --- a/js/src/components/pre-launch-check-item/index.scss +++ b/js/src/components/pre-launch-check-item/index.scss @@ -8,13 +8,8 @@ align-items: flex-start; gap: 1em; } - - .components-panel__body-title { - .components-panel__body-toggle.components-button { - color: #007cba; - } - } } + .gla-pre-launch-checklist__checkbox { display: flex; justify-content: stretch; diff --git a/js/src/components/stepper/top-bar/index.js b/js/src/components/stepper/top-bar/index.js index 55d978068c..e32129d106 100644 --- a/js/src/components/stepper/top-bar/index.js +++ b/js/src/components/stepper/top-bar/index.js @@ -23,15 +23,15 @@ const TopBar = ( { title, backHref, helpButton, onBackButtonClick } ) => { return (
- { title } -
{ helpButton }
+ { title } + { helpButton }
); }; diff --git a/js/src/components/stepper/top-bar/index.scss b/js/src/components/stepper/top-bar/index.scss index c9f605e5c9..5677758c06 100644 --- a/js/src/components/stepper/top-bar/index.scss +++ b/js/src/components/stepper/top-bar/index.scss @@ -1,28 +1,22 @@ .gla-stepper-top-bar { display: flex; - align-items: stretch; + align-items: center; min-height: $grid-unit-40 * 2; background-color: $white; box-shadow: 0 -1px 0 0 $gray-400 inset; - .back-button { - display: flex; - align-items: center; + .components-button { + height: auto; + align-self: stretch; + } + + &__back-button { padding: 0 calc(var(--main-gap) / 2); } - .title { - align-self: center; + &__title { flex: 1; font-size: $editor-font-size; - font-weight: 400; - line-height: $gla-line-height-medium-large; letter-spacing: 0; } - - .actions { - .components-button { - height: 100%; - } - } } diff --git a/js/src/css/shared/_gutenberg-components.scss b/js/src/css/shared/_gutenberg-components.scss index 9c0e39243a..60732f4e9f 100644 --- a/js/src/css/shared/_gutenberg-components.scss +++ b/js/src/css/shared/_gutenberg-components.scss @@ -1,12 +1,5 @@ // Scope the old styles of core components to GLA pages to avoid styling conflicts with other non-GLA pages. .gla-admin-page { - // WP 6.1 Compatibility (@wordpress/components 21.0.6 imported by @woocommerce/components) - // The style of `DatePicker` component was significantly changed as per the new implementations. - // This import could be removed after: - // - It's fixed from @woocommerce/components - // - or @wordpress/components is changed to be imported via (WC)DEWP - @import "node_modules/@wordpress/components/src/date-time/date/datepicker"; /* stylelint-disable-line no-invalid-position-at-import-rule */ - .components-button { // Hack to show correct font color for disabled primary destructive button. // The color style is copied from https://github.com/WordPress/gutenberg/blob/%40wordpress/components%4012.0.8/packages/components/src/button/style.scss#L67-L72 @@ -51,35 +44,9 @@ font-size: inherit; } } -} -// hack to fix radio button selected style bug caused by woocommerce-admin. -.components-radio-control__input[type="radio"]:checked::before { - border: none; -} - -// hack to fix InputControl suffix's empty right margin. -.components-input-control__suffix { - margin-right: $grid-unit; -} - -// Hack to fix the Tooltip position of the top-right side close button in a Modal component. -// The follow up can be found here: https://github.com/woocommerce/google-listings-and-ads/issues/203 -.components-modal { - &__screen-overlay { - display: flex; - justify-content: center; - align-items: center; - } - - &__frame { - @include break-small { - transform: initial; - position: relative; - top: 0; - bottom: 0; - left: 0; - right: 0; - } + // Adjust InputControl suffix's empty right margin. + .components-input-control__suffix { + margin-right: $grid-unit; } } diff --git a/js/src/external-components/woocommerce/compare-filter/index.js b/js/src/external-components/woocommerce/compare-filter/index.js index 1a1fa6fa4e..f75d12ddaa 100644 --- a/js/src/external-components/woocommerce/compare-filter/index.js +++ b/js/src/external-components/woocommerce/compare-filter/index.js @@ -9,8 +9,13 @@ */ import { __ } from '@wordpress/i18n'; import { Component } from '@wordpress/element'; -import { Card, CardBody, CardFooter, CardHeader } from '@wordpress/components'; -import { Button } from 'extracted/@wordpress/components'; +import { + Card, + CardBody, + CardFooter, + CardHeader, + Button, +} from '@wordpress/components'; import { isEqual, isFunction } from 'lodash'; import PropTypes from 'prop-types'; import { getIdsFromQuery, updateQueryString } from '@woocommerce/navigation'; diff --git a/js/src/external-components/woocommerce/filter-picker/index.js b/js/src/external-components/woocommerce/filter-picker/index.js index a43723b362..2ba5a422d9 100644 --- a/js/src/external-components/woocommerce/filter-picker/index.js +++ b/js/src/external-components/woocommerce/filter-picker/index.js @@ -8,8 +8,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { Dropdown } from '@wordpress/components'; -import { Button } from 'extracted/@wordpress/components'; +import { Dropdown, Button } from '@wordpress/components'; import { focus } from '@wordpress/dom'; import classnames from 'classnames'; import { Component } from '@wordpress/element'; diff --git a/js/src/external-components/wordpress/guide/finish-button.js b/js/src/external-components/wordpress/guide/finish-button.js index 05c0dabf30..d2dc41f448 100644 --- a/js/src/external-components/wordpress/guide/finish-button.js +++ b/js/src/external-components/wordpress/guide/finish-button.js @@ -9,7 +9,7 @@ * External dependencies */ import { useRef, useLayoutEffect } from '@wordpress/element'; -import { Button } from 'extracted/@wordpress/components'; +import { Button } from '@wordpress/components'; export default function FinishButton( props ) { const ref = useRef(); diff --git a/js/src/external-components/wordpress/guide/icons.js b/js/src/external-components/wordpress/guide/icons.js index 2527d43b82..9ec0c3b04f 100644 --- a/js/src/external-components/wordpress/guide/icons.js +++ b/js/src/external-components/wordpress/guide/icons.js @@ -10,13 +10,8 @@ */ import { SVG, Circle } from '@wordpress/primitives'; -export const PageControlIcon = ( { isSelected } ) => ( +export const PageControlIcon = () => ( - + ); diff --git a/js/src/external-components/wordpress/guide/index.js b/js/src/external-components/wordpress/guide/index.js index 4e249bfb46..de07985dfd 100644 --- a/js/src/external-components/wordpress/guide/index.js +++ b/js/src/external-components/wordpress/guide/index.js @@ -11,14 +11,14 @@ import classnames from 'classnames'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { Modal } from '@wordpress/components'; -import { Button, KeyboardShortcuts } from 'extracted/@wordpress/components'; +import { Modal, Button, KeyboardShortcuts } from '@wordpress/components'; /** * Internal dependencies */ import PageControl from './page-control'; import FinishButton from './finish-button'; +import './index.scss'; /** * @callback renderFinishCallback @@ -89,9 +89,17 @@ export default function Guide( { finishBlock = renderFinish( finishButton ); } + const guideClassName = classnames( + // gla-admin-page is for scoping particular styles to components that are used by + // a GLA admin page and are rendered via ReactDOM.createPortal. + 'gla-admin-page', + 'components-guide', + className + ); + return ( diff --git a/js/src/external-components/wordpress/guide/index.scss b/js/src/external-components/wordpress/guide/index.scss new file mode 100644 index 0000000000..c3d544b099 --- /dev/null +++ b/js/src/external-components/wordpress/guide/index.scss @@ -0,0 +1,7 @@ +.gla-admin-page .components-guide { + &__page-control { + > li[aria-current="step"] .components-button { + color: var(--wp-admin-theme-color); + } + } +} diff --git a/js/src/external-components/wordpress/guide/page-control.js b/js/src/external-components/wordpress/guide/page-control.js index 26cc9f0d29..5eb0f0fe20 100644 --- a/js/src/external-components/wordpress/guide/page-control.js +++ b/js/src/external-components/wordpress/guide/page-control.js @@ -10,7 +10,7 @@ */ import { times } from 'lodash'; import { __, sprintf } from '@wordpress/i18n'; -import { Button } from 'extracted/@wordpress/components'; +import { Button } from '@wordpress/components'; /** * Internal dependencies @@ -35,11 +35,7 @@ export default function PageControl( { >