diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 51a084f4978..f5a18a13ed8 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -9,6 +9,3 @@ contact_links: - name: ā“ Support Question url: https://woo.com/document/woocommerce-self-service-guide/ about: If you have a question please see our docs or use our forums, helpdesk, or Slack community! - - name: WooCommerce Blocks - url: https://github.com/woocommerce/woocommerce-gutenberg-products-block - about: Please report issues for WooCommerce Blocks directly to it's repository. diff --git a/plugins/woocommerce-blocks/.github/automate-team-review-assignment-config.yml b/.github/automate-team-review-assignment-config.yml similarity index 100% rename from plugins/woocommerce-blocks/.github/automate-team-review-assignment-config.yml rename to .github/automate-team-review-assignment-config.yml diff --git a/plugins/woocommerce-blocks/.github/workflows/automate-team-review-assignment-config.yml b/.github/workflows/automate-team-review-assignment-config.yml similarity index 100% rename from plugins/woocommerce-blocks/.github/workflows/automate-team-review-assignment-config.yml rename to .github/workflows/automate-team-review-assignment-config.yml diff --git a/.github/workflows/blocks-e2e.yml b/.github/workflows/blocks-e2e.yml new file mode 100644 index 00000000000..88f000b59da --- /dev/null +++ b/.github/workflows/blocks-e2e.yml @@ -0,0 +1,105 @@ +name: Run Blocks E2E Tests + +on: + pull_request: + paths: + - 'plugins/woocommerce-blocks/**' + - 'plugins/woocommerce/src/Blocks/**' + - 'plugins/woocommerce/templates/**' + - 'plugins/woocommerce/patterns/**' + +jobs: + JSE2EWithGutenberg: + if: ${{ false }} # disable until we've fixed failing tests. + strategy: + fail-fast: false + matrix: + part: [1, 2, 3, 4, 5] + name: JavaScript E2E Tests (WP latest with Gutenberg plugin) + runs-on: ubuntu-latest + defaults: + run: + working-directory: plugins/woocommerce-blocks + steps: + - uses: actions/checkout@v3 + + - name: Setup WooCommerce Monorepo + uses: ./.github/actions/setup-woocommerce-monorepo + with: + install: '@woocommerce/plugin-woocommerce...' + build: '@woocommerce/plugin-woocommerce' + + - name: Install Jest + run: pnpm install -g jest + + - name: E2E Tests (WP latest with Gutenberg plugin) + env: + WOOCOMMERCE_BLOCKS_PHASE: 3 + run: | + node ./bin/wp-env-with-gutenberg.js + npm run wp-env start + npm run wp-env:config && npx cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.config.js --listTests > ~/.jest-e2e-tests + npx cross-env JEST_PUPPETEER_CONFIG=tests/e2e-jest/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) + + - name: Upload artifacts on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v3.1.2 + with: + name: e2e-with-gutenberg-test-report-${{matrix.part}} + path: reports/e2e + + - name: Archive flaky tests report + uses: actions/upload-artifact@v3.1.2 + if: always() + with: + name: flaky-tests-report-${{ matrix.part }} + path: flaky-tests + if-no-files-found: ignore + + JSE2ETests: + name: JavaScript E2E Tests (latest) + strategy: + fail-fast: false + matrix: + part: [1, 2, 3, 4, 5] + runs-on: ubuntu-latest + defaults: + run: + working-directory: plugins/woocommerce-blocks + steps: + - uses: actions/checkout@v3 + + - name: Setup WooCommerce Monorepo + uses: ./.github/actions/setup-woocommerce-monorepo + with: + install: '@woocommerce/plugin-woocommerce...' + build: '@woocommerce/plugin-woocommerce' + + - name: Install Jest + run: pnpm install -g jest + + - name: E2E Tests (WP latest) + env: + WOOCOMMERCE_BLOCKS_PHASE: 3 + run: | + node ./bin/wp-env-with-wp-641.js + pnpm --filter='@woocommerce/block-library' wp-env start + pnpm wp-env:config + pnpm --filter='@woocommerce/block-library' exec cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.config.js --listTests > ~/.jest-e2e-tests + pnpm --filter='@woocommerce/block-library' exec cross-env JEST_PUPPETEER_CONFIG=tests/e2e-jest/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) --listTests + pnpm --filter='@woocommerce/block-library' exec cross-env JEST_PUPPETEER_CONFIG=tests/e2e-jest/config/jest-puppeteer.config.js cross-env NODE_CONFIG_DIR=tests/e2e-jest/config wp-scripts test-e2e --config tests/e2e-jest/config/jest.config.js --runInBand --runTestsByPath $( awk 'NR % 5 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) + + - name: Upload artifacts on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v3.1.2 + with: + name: e2e-test-report-${{matrix.part}} + path: reports/e2e + + - name: Archive flaky tests report + uses: actions/upload-artifact@v3.1.2 # v2.2.2 + if: always() + with: + name: flaky-tests-report-${{ matrix.part }} + path: flaky-tests + if-no-files-found: ignore diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml new file mode 100644 index 00000000000..da5de8e5312 --- /dev/null +++ b/.github/workflows/metrics.yml @@ -0,0 +1,53 @@ +name: Metrics Tracking + +on: + pull_request: + push: + branches: [trunk] + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +permissions: {} + +jobs: + metrics: + name: Run metrics tests + runs-on: ubuntu-20.04 + permissions: + contents: read + env: + WP_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts + + steps: + - uses: actions/checkout@v3 + + - name: Setup WooCommerce Monorepo + uses: ./.github/actions/setup-woocommerce-monorepo + with: + install: '@woocommerce/plugin-woocommerce...' + build: '@woocommerce/plugin-woocommerce' + + - name: Compare performance with trunk + if: github.event_name == 'pull_request' + run: cd tools/compare-perf && pnpm run compare perf $GITHUB_SHA trunk --tests-branch $GITHUB_SHA + + - name: Compare performance with base branch + if: github.event_name == 'push' + # The base hash used here need to be a commit that is compatible with the current WP version + # The current one is 19f3d0884617d7ecdcf37664f648a51e2987cada + # it needs to be updated every time it becomes unsupported by the current wp-env (WP version). + # It is used as a base comparison point to avoid fluctuation in the performance metrics. + run: | + WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' plugins/woocommerce/readme.txt) + IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION" + WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" + cd tools/compare-perf && pnpm run compare perf $GITHUB_SHA 19f3d0884617d7ecdcf37664f648a51e2987cada --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR" + + - name: Archive performance results + if: success() + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: performance-results + path: ${{ env.WP_ARTIFACTS_PATH }}/*.performance-results*.json diff --git a/.gitignore b/.gitignore index 20ffe355176..4dedc16153c 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,8 @@ changes.json # default docs manifest /manifest.json + +# Metrics tests +/artifacts +/plugins/*/artifacts +/tools/*/artifacts diff --git a/.syncpackrc b/.syncpackrc index 6b63e9c6fb0..98d38a0c940 100644 --- a/.syncpackrc +++ b/.syncpackrc @@ -171,6 +171,15 @@ ], "pinVersion": "^8.13.0" }, + { + "dependencies": [ + "@wordpress/e2e-test-utils-playwright" + ], + "packages": [ + "**" + ], + "pinVersion": "wp-6.4" + }, { "dependencies": [ "@wordpress/**" diff --git a/bin/wp-env-with-wp-641.js b/bin/wp-env-with-wp-641.js new file mode 100644 index 00000000000..f22bddcf60a --- /dev/null +++ b/bin/wp-env-with-wp-641.js @@ -0,0 +1,19 @@ +const fs = require( 'fs' ); +const path = require( 'path' ); + +const wpEnvRaw = fs.readFileSync( + path.join( __dirname, '../plugins/woocommerce-blocks/.wp-env.json' ) +); +const wpEnv = JSON.parse( wpEnvRaw ); + +// Pin the core version to 6.2.2 for Jest E2E test so we can keep the test +// passing when new WordPress versions are released. We do this because we're +// moving to Playwright and will abandon the Jest E2E tests once the migration +// is complete. +wpEnv.core = 'WordPress/WordPress#6.4.1'; + +// We write the new file to .wp-env.override.json (https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/#wp-env-override-json) +fs.writeFileSync( + path.join( __dirname, '..', '.wp-env.override.json' ), + JSON.stringify( wpEnv ) +); diff --git a/packages/js/ai/changelog/42802-fix-watch-build-race-condition b/packages/js/ai/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/ai/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/ai/package.json b/packages/js/ai/package.json index 3545fa5cf39..6c9e9e71512 100644 --- a/packages/js/ai/package.json +++ b/packages/js/ai/package.json @@ -176,6 +176,7 @@ "node_modules/@woocommerce/internal-style-build/abstracts", "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/block-templates/changelog/42802-fix-watch-build-race-condition b/packages/js/block-templates/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/block-templates/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/block-templates/package.json b/packages/js/block-templates/package.json index 49ccae76a62..a6e49905ee6 100644 --- a/packages/js/block-templates/package.json +++ b/packages/js/block-templates/package.json @@ -166,6 +166,7 @@ "node_modules/@woocommerce/internal-style-build/abstracts", "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/components/changelog/42802-fix-watch-build-race-condition b/packages/js/components/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/components/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/components/package.json b/packages/js/components/package.json index 22e3ee46038..c374000a367 100644 --- a/packages/js/components/package.json +++ b/packages/js/components/package.json @@ -250,6 +250,7 @@ "node_modules/@woocommerce/internal-style-build/abstracts", "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/csv-export/changelog/42802-fix-watch-build-race-condition b/packages/js/csv-export/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/csv-export/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/csv-export/package.json b/packages/js/csv-export/package.json index d1fe8aaa795..ca297a8d373 100644 --- a/packages/js/csv-export/package.json +++ b/packages/js/csv-export/package.json @@ -126,6 +126,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/currency/changelog/42802-fix-watch-build-race-condition b/packages/js/currency/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/currency/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/currency/package.json b/packages/js/currency/package.json index 1b86ba792fa..e1f68deb3f3 100644 --- a/packages/js/currency/package.json +++ b/packages/js/currency/package.json @@ -129,6 +129,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/customer-effort-score/changelog/42802-fix-watch-build-race-condition b/packages/js/customer-effort-score/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/customer-effort-score/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/customer-effort-score/package.json b/packages/js/customer-effort-score/package.json index d592aa271d9..74b946e9a76 100644 --- a/packages/js/customer-effort-score/package.json +++ b/packages/js/customer-effort-score/package.json @@ -181,6 +181,7 @@ "node_modules/@woocommerce/internal-style-build/abstracts", "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/data/changelog/42802-fix-watch-build-race-condition b/packages/js/data/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/data/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/data/package.json b/packages/js/data/package.json index ea687a2d069..f16f2b5d421 100644 --- a/packages/js/data/package.json +++ b/packages/js/data/package.json @@ -158,6 +158,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/date/changelog/42802-fix-watch-build-race-condition b/packages/js/date/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/date/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/date/package.json b/packages/js/date/package.json index 3503586533e..a51a236a12b 100644 --- a/packages/js/date/package.json +++ b/packages/js/date/package.json @@ -136,6 +136,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/experimental/changelog/42802-fix-watch-build-race-condition b/packages/js/experimental/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/experimental/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/experimental/package.json b/packages/js/experimental/package.json index 214853fc672..3447e0c0c72 100644 --- a/packages/js/experimental/package.json +++ b/packages/js/experimental/package.json @@ -185,6 +185,7 @@ "node_modules/@woocommerce/internal-style-build/abstracts", "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/explat/changelog/42802-fix-watch-build-race-condition b/packages/js/explat/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/explat/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/explat/package.json b/packages/js/explat/package.json index bc27ce9b464..edeba6532e5 100644 --- a/packages/js/explat/package.json +++ b/packages/js/explat/package.json @@ -133,6 +133,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/expression-evaluation/changelog/42802-fix-watch-build-race-condition b/packages/js/expression-evaluation/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/expression-evaluation/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/expression-evaluation/package.json b/packages/js/expression-evaluation/package.json index c176c1a6ad8..3a37b205e50 100644 --- a/packages/js/expression-evaluation/package.json +++ b/packages/js/expression-evaluation/package.json @@ -119,6 +119,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/integrate-plugin/changelog/42802-fix-watch-build-race-condition b/packages/js/integrate-plugin/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/integrate-plugin/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/integrate-plugin/package.json b/packages/js/integrate-plugin/package.json index 7f4566085bd..504b0542e51 100644 --- a/packages/js/integrate-plugin/package.json +++ b/packages/js/integrate-plugin/package.json @@ -130,6 +130,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/navigation/changelog/42802-fix-watch-build-race-condition b/packages/js/navigation/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/navigation/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/navigation/package.json b/packages/js/navigation/package.json index 4f66602a2cd..cdb41f60239 100644 --- a/packages/js/navigation/package.json +++ b/packages/js/navigation/package.json @@ -139,6 +139,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/number/changelog/42802-fix-watch-build-race-condition b/packages/js/number/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/number/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/number/package.json b/packages/js/number/package.json index d13419c6003..80aff4cd2a5 100644 --- a/packages/js/number/package.json +++ b/packages/js/number/package.json @@ -125,6 +125,7 @@ "files": [ "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/onboarding/changelog/42802-fix-watch-build-race-condition b/packages/js/onboarding/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/onboarding/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/onboarding/package.json b/packages/js/onboarding/package.json index 6f276ba0fa7..056ef5797e3 100644 --- a/packages/js/onboarding/package.json +++ b/packages/js/onboarding/package.json @@ -171,6 +171,7 @@ "node_modules/@woocommerce/internal-style-build/abstracts", "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/packages/js/product-editor/changelog/42802-fix-watch-build-race-condition b/packages/js/product-editor/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..28192460e08 --- /dev/null +++ b/packages/js/product-editor/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + diff --git a/packages/js/product-editor/package.json b/packages/js/product-editor/package.json index 708cea934fb..3effca897d1 100644 --- a/packages/js/product-editor/package.json +++ b/packages/js/product-editor/package.json @@ -223,6 +223,7 @@ "node_modules/@woocommerce/internal-style-build/abstracts", "node_modules/@woocommerce/internal-js-tests/build", "node_modules/@woocommerce/internal-js-tests/build-module", + "node_modules/@woocommerce/internal-js-tests/jest-preset.js", "node_modules/@woocommerce/eslint-plugin/configs", "node_modules/@woocommerce/eslint-plugin/rules", "node_modules/@woocommerce/eslint-plugin/index.js", diff --git a/plugins/woocommerce-admin/changelog/42698-cys-update-the-copy-for-the-offline-flow b/plugins/woocommerce-admin/changelog/42698-cys-update-the-copy-for-the-offline-flow new file mode 100644 index 00000000000..0c044b468c7 --- /dev/null +++ b/plugins/woocommerce-admin/changelog/42698-cys-update-the-copy-for-the-offline-flow @@ -0,0 +1,4 @@ +Significance: minor +Type: tweak + +CYS: Update copy diff --git a/plugins/woocommerce-admin/changelog/42802-fix-watch-build-race-condition b/plugins/woocommerce-admin/changelog/42802-fix-watch-build-race-condition new file mode 100644 index 00000000000..c4880137e04 --- /dev/null +++ b/plugins/woocommerce-admin/changelog/42802-fix-watch-build-race-condition @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: Only a change to development tooling. + + diff --git a/plugins/woocommerce-admin/client/customize-store/assembler-hub/onboarding-tour/index.tsx b/plugins/woocommerce-admin/client/customize-store/assembler-hub/onboarding-tour/index.tsx index e001efed5f5..2c3bd22fc9d 100644 --- a/plugins/woocommerce-admin/client/customize-store/assembler-hub/onboarding-tour/index.tsx +++ b/plugins/woocommerce-admin/client/customize-store/assembler-hub/onboarding-tour/index.tsx @@ -52,9 +52,15 @@ export const OnboardingTour = ( { onRequestClose={ skipTour } shouldCloseOnClickOutside={ false } > + + { __( + 'Our AI tool had a few issues generating your content.', + 'woocommerce' + ) } +

{ __( - "We encountered some issues while generating content with AI. But don't worry ā€” you can still customize the look and feel of your store, including adding your logo, and changing colors and layouts. Take a quick tour to discover what's possible.", + "But don't let that stop you! Start customizing the look and feel of your store by adding your logo and selecting your colors and layout. Take a quick tour to discover what's possible.", 'woocommerce' ) }

diff --git a/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/BusinessInfoDescription.tsx b/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/BusinessInfoDescription.tsx index 2ffd4637686..8444cf12198 100644 --- a/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/BusinessInfoDescription.tsx +++ b/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/BusinessInfoDescription.tsx @@ -65,7 +65,7 @@ export const BusinessInfoDescription = ( {

{ __( - 'The more detail you provide, the better our AI tool can do at creating your content.', + 'The more detail you provide, the better job our AI can do! Try to include:', 'woocommerce' ) }

diff --git a/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/LookAndFeel.tsx b/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/LookAndFeel.tsx index a1fede3bf53..fbe80d313c3 100644 --- a/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/LookAndFeel.tsx +++ b/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/LookAndFeel.tsx @@ -34,7 +34,7 @@ export const LookAndFeel = ( { title: __( 'Contemporary', 'woocommerce' ), key: 'Contemporary' as const, subtitle: __( - 'Clean lines, neutral colors, sleek and modern.', + 'Clean lines, neutral colors, sleek and modern look.', 'woocommerce' ), }, diff --git a/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/ToneOfVoice.tsx b/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/ToneOfVoice.tsx index c177347e9af..bd73a8afe80 100644 --- a/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/ToneOfVoice.tsx +++ b/plugins/woocommerce-admin/client/customize-store/design-with-ai/pages/ToneOfVoice.tsx @@ -42,7 +42,7 @@ export const ToneOfVoice = ( { title: __( 'Neutral', 'woocommerce' ), key: 'Neutral' as const, subtitle: __( - 'Impartial tone with casual expressions and no slang.', + 'Impartial tone with casual expressions without slang.', 'woocommerce' ), }, diff --git a/plugins/woocommerce-admin/client/customize-store/style.scss b/plugins/woocommerce-admin/client/customize-store/style.scss index c50f18a6c80..390c68bb54d 100644 --- a/plugins/woocommerce-admin/client/customize-store/style.scss +++ b/plugins/woocommerce-admin/client/customize-store/style.scss @@ -210,6 +210,11 @@ body.woocommerce-customize-store.js.is-fullscreen-mode { color: #1e1e1e; } + span { + color: #1e1e1e; + font-weight: 700; + } + .woocommerce-customize-store__design-change-warning-modal-footer { display: flex; gap: 12px; diff --git a/plugins/woocommerce-admin/client/marketplace/components/constants.ts b/plugins/woocommerce-admin/client/marketplace/components/constants.ts index eae1a0471ac..97dfffbfcf3 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/constants.ts +++ b/plugins/woocommerce-admin/client/marketplace/components/constants.ts @@ -1,3 +1,8 @@ +/** + * Internal dependencies + */ +import { ADMIN_URL } from '../../utils/admin-settings'; + export const DEFAULT_TAB_KEY = 'discover'; export const MARKETPLACE_HOST = 'https://woo.com'; export const MARKETPLACE_PATH = '/extensions'; @@ -11,3 +16,4 @@ export const MARKETPLACE_CART_PATH = MARKETPLACE_HOST + '/cart/'; export const MARKETPLACE_COLLABORATION_PATH = MARKETPLACE_HOST + '/document/managing-woocommerce-com-subscriptions/#transfer-a-woocommerce-com-subscription'; +export const WP_ADMIN_PLUGIN_LIST_URL = ADMIN_URL + '/plugins.php'; diff --git a/plugins/woocommerce-admin/client/marketplace/components/header-account/header-account.scss b/plugins/woocommerce-admin/client/marketplace/components/header-account/header-account.scss index 0da04a93478..19ba2e9c4d4 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/header-account/header-account.scss +++ b/plugins/woocommerce-admin/client/marketplace/components/header-account/header-account.scss @@ -56,7 +56,12 @@ @media screen and (min-width: $break-small) { .woocommerce-marketplace { &__header-account-modal { - max-width: 350px; + max-width: $modal-min-width; + + &.has-size-medium { + max-width: $modal-width-medium; + width: 100%; + } } } } diff --git a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss index 1b3b298c383..5119c8c6d14 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss +++ b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss @@ -233,9 +233,11 @@ } } -.woocommerce-marketplace__my-subscriptions .components-button.is-link { - text-decoration: none; - padding: 6px 12px; +.woocommerce-marketplace__my-subscriptions .components-button { + &.is-link { + text-decoration: none; + padding: 6px 12px; + } } .woocommerce-marketplace__my-subscriptions @@ -300,6 +302,7 @@ box-shadow: 0 2px 6px 0 rgba($gray-100, 0.05); border: 1px solid var(--gutenberg-gray-100, #f0f0f0); padding-right: $grid-unit-15; + position: relative; &::before { content: ''; @@ -338,3 +341,52 @@ padding: 0; } } + + +.woocommerce-marketplace__header-account-modal-overlay { + .components-modal__header { + padding-bottom: $grid-unit-20; + + .components-modal__header-heading { + font-weight: 400; + font-size: 20px; + line-height: 28px; + } + } + .components-notice { + padding: $grid-unit-15 $grid-unit-20; + border-left: none; + margin: $grid-unit-20 0; + + &.is-warning { + background-color: var(--wp-yellow-yellow-0, #fcf9e8); + align-items: start; + + &::before { + content: ''; + /* stylelint-disable-next-line function-url-quotes */ + background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' stroke='%23614200' stroke-width='1.5'/%3E%3Cpath d='M13 7H11V13H13V7Z' fill='%23614200'/%3E%3Cpath d='M13 15H11V17H13V15Z' fill='%23614200'/%3E%3C/svg%3E"); + margin-right: $grid-unit-15; + width: 24px; + height: 24px; + } + + .components-notice__content { + margin: 0; + } + } + } + + .components-button-group .components-button { + &.is-primary { + box-shadow: none; + } + &.is-secondary { + box-shadow: inset 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9)); + } + } + + .woocommerce-marketplace__product-card { + margin: $grid-unit-20 0; + } +} diff --git a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.tsx b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.tsx index e3e37992456..bb1e5f4f64d 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.tsx +++ b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.tsx @@ -23,6 +23,7 @@ import { import { Subscription } from './types'; import { RefreshButton } from './table/actions/refresh-button'; import Notices from './notices'; +import InstallModal from './table/actions/install-modal'; export default function MySubscriptions(): JSX.Element { const { subscriptions, isLoading } = useContext( SubscriptionsContext ); @@ -58,6 +59,7 @@ export default function MySubscriptions(): JSX.Element { if ( ! wccomSettings?.isConnected ) { return (
+

{ __( 'Manage your subscriptions', 'woocommerce' ) } @@ -77,6 +79,7 @@ export default function MySubscriptions(): JSX.Element { return (
+
diff --git a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/connect-account-button.tsx b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/connect-account-button.tsx new file mode 100644 index 00000000000..d45c9e4f381 --- /dev/null +++ b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/connect-account-button.tsx @@ -0,0 +1,29 @@ +/** + * External dependencies + */ +import { Button } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import { getAdminSetting } from '../../../../../utils/admin-settings'; + +interface RenewProps { + variant?: Button.ButtonVariant; + install?: string; +} + +export default function ConnectAccountButton( props: RenewProps ) { + const wccomSettings = getAdminSetting( 'wccomHelper', {} ); + + const url = new URL( wccomSettings?.connectURL ?? '' ); + if ( props.install ) { + url.searchParams.set( 'install', props.install ); + } + return ( + + ); +} diff --git a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/install-modal.tsx b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/install-modal.tsx new file mode 100644 index 00000000000..98bb8e760ec --- /dev/null +++ b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/install-modal.tsx @@ -0,0 +1,228 @@ +/** + * External dependencies + */ +import { Button, ButtonGroup, Modal, Notice } from '@wordpress/components'; +import { __, sprintf } from '@wordpress/i18n'; +import { getNewPath, navigateTo, useQuery } from '@woocommerce/navigation'; +import { + useCallback, + useContext, + useEffect, + useState, +} from '@wordpress/element'; + +/** + * Internal dependencies + */ +import { Subscription } from '../../types'; +import { getAdminSetting } from '../../../../../utils/admin-settings'; +import Install from './install'; +import { SubscriptionsContext } from '../../../../contexts/subscriptions-context'; +import { MARKETPLACE_PATH, WP_ADMIN_PLUGIN_LIST_URL } from '../../../constants'; +import ConnectAccountButton from './connect-account-button'; +import ProductCard from '../../../product-card/product-card'; +import { addNotice, subscriptionToProduct } from '../../../../utils/functions'; +import { NoticeStatus } from '../../../../contexts/types'; + +export default function InstallModal() { + const query = useQuery(); + const installingProductKey = query?.install; + + const wccomSettings = getAdminSetting( 'wccomHelper', {} ); + const isConnected = !! wccomSettings?.isConnected; + + const [ showModal, setShowModal ] = useState< boolean >( false ); + const [ isInstalled, setIsInstalled ] = useState< boolean >( false ); + + const { subscriptions, isLoading } = useContext( SubscriptionsContext ); + + const subscription: Subscription | undefined = subscriptions.find( + ( s: Subscription ) => s.product_key === installingProductKey + ); + + const removeInstallQuery = useCallback( () => { + navigateTo( { + url: getNewPath( + { + ...query, + install: undefined, + }, + MARKETPLACE_PATH, + {} + ), + } ); + }, [ query ] ); + + useEffect( () => { + if ( isLoading ) { + return; + } + + // If subscriptions loaded, but we don't have a subscription for the product key, show an error. + if ( + installingProductKey && + isConnected && + ! isLoading && + ! subscription + ) { + addNotice( + installingProductKey, + sprintf( + /* translators: %s is the product key */ + __( + 'Could not find subscription with product key %s.', + 'woocommerce' + ), + installingProductKey + ), + NoticeStatus.Error + ); + removeInstallQuery(); + } else { + setShowModal( !! installingProductKey ); + } + }, [ + isConnected, + isLoading, + installingProductKey, + removeInstallQuery, + subscription, + ] ); + + useEffect( () => { + if ( subscription && subscription.local.installed ) { + setIsInstalled( true ); + } + }, [ subscription ] ); + + const onClose = () => { + removeInstallQuery(); + setShowModal( false ); + }; + + const modalTitle = () => { + if ( isInstalled ) { + return __( 'You are ready to go!', 'woocommerce' ); + } + + return __( 'Add to store', 'woocommerce' ); + }; + + const modalContent = () => { + if ( ! isConnected ) { + return ( + + { __( + 'In order to install a product, you need to first connect your account.', + 'woocommerce' + ) } + + ); + } else if ( subscription ) { + const installContent = isInstalled + ? __( + 'Keep the momentum going and start setting up your extension.', + 'woocommerce' + ) + : __( + 'Would you like to install this extension?', + 'woocommerce' + ); + return ( + <> +

+ { installContent } +

+ + + ); + } + }; + const modalButtons = () => { + const buttons = []; + if ( isInstalled ) { + buttons.push( + + ); + buttons.push( + + ); + } else { + buttons.push( + + ); + + if ( ! isConnected ) { + buttons.push( + + ); + } else if ( subscription ) { + buttons.push( + + ); + } + } + return ( + + { buttons } + + ); + }; + + if ( ! showModal ) { + return null; + } + + return ( + + { modalContent() } + { modalButtons() } + + ); +} diff --git a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/install.tsx b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/install.tsx index 9de06cb7101..f57206d9628 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/install.tsx +++ b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/actions/install.tsx @@ -22,6 +22,9 @@ import { NoticeStatus } from '../../../../contexts/types'; interface InstallProps { subscription: Subscription; + variant?: Button.ButtonVariant; + onSuccess?: () => void; + onError?: () => void; } export default function Install( props: InstallProps ) { @@ -76,6 +79,10 @@ export default function Install( props: InstallProps ) { product_id: props.subscription.product_id, product_current_version: props.subscription.version, } ); + + if ( props.onSuccess ) { + props.onSuccess(); + } } ) .catch( ( error ) => { loadSubscriptions( false ).then( () => { @@ -101,19 +108,24 @@ export default function Install( props: InstallProps ) { } ); stopInstall(); + + if ( props.onError ) { + props.onError(); + } } ); recordEvent( 'marketplace_product_install_failed', { product_zip_slug: props.subscription.zip_slug, product_id: props.subscription.product_id, product_current_version: props.subscription.version, + error_message: error?.data?.message, } ); } ); }; return (