Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.6.4 #2333

Merged
merged 363 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
363 commits
Select commit Hold shift + click to select a range
9592a80
Refactor get_product_view_query
jorgemd24 Feb 5, 2024
6c1b818
Add UpdateMerchantStatuses Job
jorgemd24 Feb 5, 2024
2657541
Remove unused plugin helper
jorgemd24 Feb 5, 2024
16b27b3
Remove get_offer_id function as we will fetch all products
jorgemd24 Feb 5, 2024
fdaaf30
Rename function convert_aggregated_status_to_mc_status
jorgemd24 Feb 5, 2024
2cfc1f2
Change query not synced products
jorgemd24 Feb 5, 2024
d8da89b
Skip product from status count if it is not sync ready
jorgemd24 Feb 5, 2024
8c6807c
Fix warning undefined index
jorgemd24 Feb 5, 2024
7a13ccc
Add ShoppingContentDateTrait
jorgemd24 Feb 5, 2024
39608de
Rename get_product_view_report method and increase limit size
jorgemd24 Feb 5, 2024
71ba5c5
Refactor calculate product statuses
jorgemd24 Feb 5, 2024
3138785
Rename Update merchant product status job
jorgemd24 Feb 5, 2024
6426ea6
Adjust UpdateMerchantProductStatuses name
jorgemd24 Feb 5, 2024
7d1ef5a
Schedule the job if mc_status is not set
jorgemd24 Feb 5, 2024
ea936e6
Adjust product statiscits controller
jorgemd24 Feb 5, 2024
a68d980
Tweak tests test_find_mc_not_synced_product_ids
jorgemd24 Feb 6, 2024
09ec214
Remove unused ViewReportQuery filter
jorgemd24 Feb 6, 2024
0e92124
Schdule job if force refresh
jorgemd24 Feb 6, 2024
9451680
Remove schedule job from the controller
jorgemd24 Feb 6, 2024
497586b
Remove extra space
jorgemd24 Feb 6, 2024
c0138fa
Remove unused dependency
jorgemd24 Feb 7, 2024
122d684
Remove extra string when logging message
jorgemd24 Feb 7, 2024
930469e
Fix typo DateTime
jorgemd24 Feb 7, 2024
0e90b7d
Move responsability of Merchant Report
jorgemd24 Feb 7, 2024
8b85a6a
Remove unused dependency
jorgemd24 Feb 7, 2024
1cf0178
Add filter product report batch size
jorgemd24 Feb 7, 2024
264cd27
Check if the job is scheduled
jorgemd24 Feb 7, 2024
679b143
Move ShoppingContentDateTrait
jorgemd24 Feb 7, 2024
2123e0b
Update PHPDocs and remove unnecessary $rows variable
jorgemd24 Feb 7, 2024
4c304f3
Show error message when unable to retrieve Product View Report
jorgemd24 Feb 7, 2024
56d20b5
Rename methods
jorgemd24 Feb 7, 2024
319a7a1
Remove ProductMetaHandler::KEY_VISIBILITY from not_synced_product_ids
jorgemd24 Feb 8, 2024
af810b1
Add comment so we can remove ProductMetaHandler::KEY_SYNC_STATUS
jorgemd24 Feb 8, 2024
7b0f3b2
Revert "Merge branch 'feature/google-api-project' into add/product-vi…
jorgemd24 Feb 8, 2024
a29a04e
Merge pull request #2229 from woocommerce/add/product-view-report-query
jorgemd24 Feb 8, 2024
62e9c20
Schedule multiple jobs with next page token
jorgemd24 Feb 11, 2024
1a8f360
Refactor calculation of No sync products
jorgemd24 Feb 11, 2024
4d9e0c8
Remove unused ProductSyncStats and add loading property
jorgemd24 Feb 11, 2024
4656637
Add missing since
jorgemd24 Feb 11, 2024
5133be6
Check if MC is connected before retrieving product status
jorgemd24 Feb 11, 2024
7ecb0f8
Remove find_mc_not_synced_product_ids
jorgemd24 Feb 11, 2024
3e82e15
Remove test from find_mc_not_synced_product_ids
jorgemd24 Feb 11, 2024
be4ffed
Update MerchantStatusesTest
jorgemd24 Feb 11, 2024
38fb6a8
Add UpdateMerchantProductStatusesTest
jorgemd24 Feb 11, 2024
8ea87f9
Test if clear_cache is deleted
jorgemd24 Feb 11, 2024
9b893d9
Unify update_product_stats
jorgemd24 Feb 11, 2024
1beb6b8
Remove unused variables
jorgemd24 Feb 11, 2024
828ca3b
Fix phpcs
jorgemd24 Feb 11, 2024
624a0a9
Rename variable
jorgemd24 Feb 12, 2024
dd39acb
Tweak some phpdocs
jorgemd24 Feb 12, 2024
e3b2831
Replace wp_posts queries with WC Objects
jorgemd24 Feb 12, 2024
43c4028
Add tests for test_update_product_stats
jorgemd24 Feb 12, 2024
fe94543
Add options intermediate count data
jorgemd24 Feb 13, 2024
e2ecf1b
Revert scheduled_sync
jorgemd24 Feb 13, 2024
4b76332
Fix typo
jorgemd24 Feb 13, 2024
2e26242
Query all product types
jorgemd24 Feb 13, 2024
77e1a72
Merge pull request #2255 from woocommerce/add/refactor-merchant-produ…
jorgemd24 Feb 15, 2024
0357daa
Fetch WC Product by batches
jorgemd24 Feb 15, 2024
baee8bd
Reduce the batch size
jorgemd24 Feb 15, 2024
69ace27
Merge branch 'feature/refactor-product-stats' into add/replace-wp-pos…
jorgemd24 Feb 15, 2024
1a1ce7a
Adjust tests
jorgemd24 Feb 15, 2024
7f3571f
Adjust PHPdoc
jorgemd24 Feb 16, 2024
5de10d5
Remove unused field
jorgemd24 Feb 18, 2024
ffec2f1
Fix default value next_page_token
jorgemd24 Feb 18, 2024
502e7be
Add tests for the MerchantReportTest Product View
jorgemd24 Feb 18, 2024
3b403a2
Test exception
jorgemd24 Feb 18, 2024
952207c
Test with a different page size
jorgemd24 Feb 19, 2024
19b4db5
Fix phpcs
jorgemd24 Feb 19, 2024
7b9944a
Remove unnecessary casting
jorgemd24 Feb 19, 2024
21e97e2
Remove unused ksort
jorgemd24 Feb 19, 2024
591599c
Pass products as references and fetch parent products too
jorgemd24 Feb 19, 2024
19c878e
Update tests
jorgemd24 Feb 19, 2024
fbcd45c
Merge branch 'develop' into feature/refactor-product-stats
jorgemd24 Feb 19, 2024
0f9002c
Merge branch 'feature/refactor-product-stats' into add/replace-wp-pos…
jorgemd24 Feb 19, 2024
e15c368
Exclude ProductView from the Proxy reports
jorgemd24 Feb 19, 2024
8fee845
Fix phpcs errors
jorgemd24 Feb 19, 2024
57add89
Save intermediate parent statuses
jorgemd24 Feb 19, 2024
d588aff
Check if product exists before getting parent id
jorgemd24 Feb 19, 2024
8e4b312
Remove unnecessary else statement and adjust tests
jorgemd24 Feb 20, 2024
8470b77
Fix issue with the initial state
jorgemd24 Feb 20, 2024
229167b
Fix phpcs tests
jorgemd24 Feb 20, 2024
9f3556a
Add return type and adjust debug message
jorgemd24 Feb 20, 2024
3e9c708
Merge pull request #2257 from woocommerce/add/replace-wp-posts-functi…
jorgemd24 Feb 20, 2024
71e2c3d
Merge branch 'feature/refactor-product-stats' into add/merchant-cente…
jorgemd24 Feb 20, 2024
6a9a0f9
Move get_merchant_id to setup
jorgemd24 Feb 20, 2024
a0aed9b
Merge pull request #2261 from woocommerce/add/merchant-center-report-…
jorgemd24 Feb 20, 2024
b22b490
Merge branch 'feature/refactor-product-stats' into fix/issue-with-int…
jorgemd24 Feb 20, 2024
1117bc4
Consider the case where the previous parent status is the same as the…
jorgemd24 Feb 20, 2024
d7ecd99
Add tests for updating parent statuses by batches
jorgemd24 Feb 20, 2024
c04fc39
Add handle_failed_mc_statuses_fetching
jorgemd24 Feb 21, 2024
056b0f7
handle errors in UpdateMerchantProductStatuses
jorgemd24 Feb 21, 2024
20698be
Add error field in the response
jorgemd24 Feb 21, 2024
b544a50
Add tests when get_product_view_report throws exception
jorgemd24 Feb 21, 2024
6f441d2
Add tests for product statuses with errors
jorgemd24 Feb 21, 2024
683c6d4
Merge pull request #2263 from woocommerce/fix/issue-with-intermediate…
jorgemd24 Feb 22, 2024
d13c57b
Merge pull request #2271 from woocommerce/add/store-merchant-status-j…
jorgemd24 Feb 22, 2024
b2adf15
Add mc_id to the get_product_view_report response
jorgemd24 Feb 22, 2024
afcd5e5
Refactor product issues
jorgemd24 Feb 22, 2024
19cf5d0
Adjust merchant center report test
jorgemd24 Feb 22, 2024
6466bce
Add delete_stale
jorgemd24 Feb 22, 2024
d50f790
Refactor clear cache product statuses
jorgemd24 Feb 23, 2024
4634d2f
Add tests to refresh product issues
jorgemd24 Feb 23, 2024
d87fb20
Rename function and delete issues if the job fails so we don't have d…
jorgemd24 Feb 23, 2024
6a5fcbe
Fix issue with the comparision
jorgemd24 Feb 23, 2024
5dea916
Add missing phpdoc
jorgemd24 Feb 23, 2024
f4c01b9
Fix phpcs
jorgemd24 Feb 23, 2024
f979216
phpcs tests
jorgemd24 Feb 23, 2024
5417896
Add @var definition
jorgemd24 Feb 23, 2024
6c73cbc
Update PHPDocs
jorgemd24 Mar 4, 2024
907bd4a
Update function description
jorgemd24 Mar 4, 2024
737351e
Revert delete_stale with compare query
jorgemd24 Mar 4, 2024
c75eb4d
Add delete specific product issues
jorgemd24 Mar 4, 2024
7f3e1f5
Adjust tests for test_handle_failed_mc_statuses_fetching
jorgemd24 Mar 4, 2024
62b1c6d
Combine Not synced MC status
jorgemd24 Mar 5, 2024
5c2ab7b
Refactor maybe_refresh_status_data
jorgemd24 Mar 5, 2024
3f644a6
Adjust ProductFeedQueryHelper to work with maybe_refresh_status_data
jorgemd24 Mar 5, 2024
57f74c7
Refresh account and presync issues
jorgemd24 Mar 5, 2024
7993c11
Remove unnecessary mc is connected
jorgemd24 Mar 5, 2024
111d1ad
Adjust tests
jorgemd24 Mar 5, 2024
6848100
Add missing return types
jorgemd24 Mar 5, 2024
f185a48
Add tests for clear_product_statuses_cache_and_issues
jorgemd24 Mar 5, 2024
c06f4e9
Add tests for fetching issues for products with DONT_SYNC_AND_SHOW
jorgemd24 Mar 5, 2024
f1ab4e3
Merge pull request #2277 from woocommerce/add/refactor-product-issues
jorgemd24 Mar 5, 2024
a0469a8
Adjust tests for ProductFeedQueryHelperTest
jorgemd24 Mar 6, 2024
aeed5b6
Update UpdateMerchantProductStatusesTest tests
jorgemd24 Mar 6, 2024
38012d8
Add tests for get_issues
jorgemd24 Mar 6, 2024
19d8ce9
Add loading to the IssuesControllerResponse
jorgemd24 Mar 6, 2024
4801fcf
Fix phpcs
jorgemd24 Mar 6, 2024
9da82ff
phpcs fixes
jorgemd24 Mar 6, 2024
c28ea3d
Merge branch 'feature/refactor-product-stats' into add/refactor-accou…
jorgemd24 Mar 6, 2024
21b1234
Remove extra line
jorgemd24 Mar 6, 2024
edd28a2
Remove unsused dependency
jorgemd24 Mar 8, 2024
6dc97a9
Adjust phpdocs
jorgemd24 Mar 8, 2024
6b7a614
Tweak mcstatus when loading data
jorgemd24 Mar 8, 2024
48939d2
Remove unused method
jorgemd24 Mar 11, 2024
2e37bd8
Simplify process product status
jorgemd24 Mar 11, 2024
e794933
Fix issue with unset active key
jorgemd24 Mar 11, 2024
b40d270
Check if there are productids when deleting product issues
jorgemd24 Mar 11, 2024
72c8ba9
Remove unused dependency
jorgemd24 Mar 11, 2024
f5bd742
Handle the case where there are not products in MC
jorgemd24 Mar 12, 2024
925c3fb
Handle null responses
jorgemd24 Mar 12, 2024
7ca5d6a
Remove test line
jorgemd24 Mar 12, 2024
021b6d7
Revert intermediate status if the job fails
jorgemd24 Mar 12, 2024
6b767b4
Don't update stats for each single batch when updating/deleting all p…
jorgemd24 Mar 12, 2024
f4aaafb
Adjust tests
jorgemd24 Mar 12, 2024
b89c602
Merge pull request #2298 from woocommerce/add/refactor-account-presyn…
jorgemd24 Mar 12, 2024
3d2e060
Fix phpcs
jorgemd24 Mar 12, 2024
cc2ff9b
Add tests for clear cache with bulk sync
jorgemd24 Mar 12, 2024
67f8c56
Add tests for MerchantIssueTableTest
jorgemd24 Mar 12, 2024
476873d
Add DeleteAllProductsTest
jorgemd24 Mar 12, 2024
5d5cefd
Merge branch 'develop' into feature/refactor-product-stats
jorgemd24 Mar 12, 2024
71b864b
Merge branch 'feature/refactor-product-stats' into remove/legacy-issu…
jorgemd24 Mar 12, 2024
1bfd26d
Refactor useMCProductStatistics
jorgemd24 Mar 14, 2024
7d06c5a
Remove useProductFeedPrefetch
jorgemd24 Mar 14, 2024
a568653
Check if hasFinishedResolution in SyncStatus
jorgemd24 Mar 14, 2024
bbe7d2b
Add a app-spinner for SummaryNumber Product Stats
jorgemd24 Mar 14, 2024
f0c8c2d
Fix undefined index error
jorgemd24 Mar 14, 2024
e84dba8
Adjust js tests
jorgemd24 Mar 14, 2024
68f9b7b
Fix issue if invalidating the first call
jorgemd24 Mar 16, 2024
73a242d
Allow to refresh Stats
jorgemd24 Mar 16, 2024
0530ff8
Add SyncMCStatus
jorgemd24 Mar 16, 2024
58d768b
Refactor useEffect
jorgemd24 Mar 17, 2024
87ae0f2
Merge branch 'tweak/frontend-loading-product-statuses' into add/displ…
jorgemd24 Mar 17, 2024
03289c0
Stop the countdown
jorgemd24 Mar 17, 2024
3aa83ae
Merge branch 'tweak/frontend-loading-product-statuses' into add/displ…
jorgemd24 Mar 17, 2024
0975e67
Stop counter if callCount > 0
jorgemd24 Mar 17, 2024
85c8fb8
Use SummaryListPlaceholder instead of AppSpinner
jorgemd24 Mar 17, 2024
f12c225
Add tests for useMCProductStatistics
jorgemd24 Mar 17, 2024
f3cad2f
Add describe
jorgemd24 Mar 17, 2024
5ada0ed
Add tests for Product Statistics
jorgemd24 Mar 17, 2024
24393e8
Show sync in progress when populating the stats
jorgemd24 Mar 17, 2024
99f09af
Update ProductStatistics types
jorgemd24 Mar 17, 2024
22bfa48
Invalidate resolution for getMCProductFeed
jorgemd24 Mar 18, 2024
92852b6
Add test for invalidateResolutionForStoreSelector
jorgemd24 Mar 18, 2024
4a04e96
Update JSDoc
jorgemd24 Mar 18, 2024
0992569
Remove unused caption
jorgemd24 Mar 18, 2024
9c5940a
Cover case where there is no data
jorgemd24 Mar 18, 2024
b2d09da
Add missing caption
jorgemd24 Mar 18, 2024
e23d7b6
Merge branch 'update/ui-loading-product-statuses' into add/display-er…
jorgemd24 Mar 18, 2024
989d225
Rename component to SyncProductStatistics
jorgemd24 Mar 19, 2024
f37e94e
Handle case where failure rate message is too high
jorgemd24 Mar 19, 2024
03ceb65
If no stats sent null instead of an empty array
jorgemd24 Mar 19, 2024
9f5b1c5
Simplify logic conditions and check for data.statistics
jorgemd24 Mar 19, 2024
3ae142c
Simplify logic condition for SyncStatus
jorgemd24 Mar 19, 2024
0edf7c1
Set startCountdown every 15s
jorgemd24 Mar 19, 2024
be52699
Add AppSpinners when loading stats
jorgemd24 Mar 19, 2024
b76e861
Adjust tests for the AppSpinner when loading stats
jorgemd24 Mar 19, 2024
4ea312d
Js linting .scss
jorgemd24 Mar 19, 2024
6629f5b
Merge pull request #2306 from woocommerce/remove/legacy-issue-and-pro…
jorgemd24 Mar 19, 2024
7b0f59e
Merge branch 'update/ui-loading-product-statuses' into add/display-er…
jorgemd24 Mar 19, 2024
05646dc
Only load syncStatus if statistics is loaded
jorgemd24 Mar 19, 2024
8b79fc1
Simplify SummaryNumber value
jorgemd24 Mar 19, 2024
dbf5507
Merge branch 'update/ui-loading-product-statuses' into add/display-er…
jorgemd24 Mar 19, 2024
8ebe1ec
Merge pull request #2323 from woocommerce/trunk
tomalec Mar 19, 2024
3079d4a
Clear cache before job runs so we can delete any stale error
jorgemd24 Mar 19, 2024
762937b
Add tests for clear cache before schedule a job
jorgemd24 Mar 19, 2024
7f3eba4
Add the description for SyncProductStatistics
jorgemd24 Mar 19, 2024
1146e15
Pass the error to SyncProductStatistics
jorgemd24 Mar 19, 2024
24af8c2
Add tests When there is an error
jorgemd24 Mar 19, 2024
c213955
Js linting
jorgemd24 Mar 19, 2024
065ff6d
Add tests for refreshStats
jorgemd24 Mar 19, 2024
77b570f
Adjust jsdoc for startCountdown
jorgemd24 Mar 20, 2024
963a605
Merge pull request #2318 from woocommerce/update/ui-loading-product-s…
jorgemd24 Mar 20, 2024
6b0b4f9
Delete MC statuses
jorgemd24 Mar 20, 2024
6a33e75
Add tests for get_failure_rate_message
jorgemd24 Mar 20, 2024
ef985e8
Tweak response of failure rate and docs
jorgemd24 Mar 20, 2024
0d0b1c1
Add tests for get statistics with failure rate
jorgemd24 Mar 20, 2024
7059c8c
Upgrade `@playwright/test` to ^1.42.0
eason9487 Mar 21, 2024
f4d6ea7
Set the tour of product block editor to not display.
eason9487 Mar 21, 2024
1b1186f
Convert space indentations in test-snippets.php to tabs.
eason9487 Mar 18, 2024
5acf02e
Adjust the product data in tests/e2e/config/default.json to fit with …
eason9487 Mar 19, 2024
a441004
Add new E2E API utils for creating variable and variation products.
eason9487 Mar 19, 2024
84f4ee9
Product block editor E2E test: Prompt to Get Started when not yet fin…
eason9487 Mar 15, 2024
2772aaf
Product block editor E2E test: Hide plugin tab for unsupported produc…
eason9487 Mar 19, 2024
a4eff4a
Product block editor E2E test: Check existence and availability of fi…
eason9487 Mar 18, 2024
b659ed6
Product block editor E2E test: Check existence of fields for variable…
eason9487 Mar 19, 2024
df0d598
Product block editor E2E test: Channel visibility is disabled when hi…
eason9487 Mar 21, 2024
41e5d91
Product block editor E2E test: Change channel visibility and check it…
eason9487 Mar 20, 2024
445d86f
Product block editor E2E test: Custom block - Product select with tex…
eason9487 Mar 20, 2024
15df732
Add delete_stale_mc_statuses method
jorgemd24 Mar 21, 2024
7a055ce
Add tests for delete_stale_mc_statuses
jorgemd24 Mar 21, 2024
a44b5ed
Add manual workflow run
mikkamp Mar 21, 2024
5f219ac
Amend name for when it is skipped
mikkamp Mar 21, 2024
ed6b1c9
Product block editor E2E test: Custom block - Product date and time f…
eason9487 Mar 21, 2024
d2ccccf
Product block editor E2E test: Generic block transformation - Non-neg…
eason9487 Mar 21, 2024
fdb5b2d
Product block editor E2E test: Save all product attributes to simple …
eason9487 Mar 21, 2024
2e8701d
Product block editor E2E test: Save product attributes to variation p…
eason9487 Mar 21, 2024
77022c7
Temporarily enable pull requests to trigger E2E Tests on GitHub Actions.
eason9487 Mar 21, 2024
68e6df3
Update transient time
jorgemd24 Mar 21, 2024
e032768
Adjust tests for clear_product_statuses_cache_and_issues
jorgemd24 Mar 21, 2024
8151319
Merge pull request #2328 from woocommerce/dev/manual-workflow-run-uni…
mikkamp Mar 22, 2024
2a0ff7f
Bump webpack-dev-middleware from 5.3.3 to 5.3.4
dependabot[bot] Mar 22, 2024
8ec00b8
Add missing since
jorgemd24 Mar 22, 2024
345d019
Add useCallback to refresh product stats
jorgemd24 Mar 22, 2024
4aa6426
Use AppButton instead of Button
jorgemd24 Mar 22, 2024
986c6d2
Change error message for the failure rate msg
jorgemd24 Mar 22, 2024
7adeb24
Update tests
jorgemd24 Mar 22, 2024
f526898
Merge pull request #2330 from woocommerce/dependabot/npm_and_yarn/web…
eason9487 Mar 25, 2024
caeefee
Product block editor E2E test: Assert the link path instead of the pa…
eason9487 Mar 25, 2024
44eee48
Revert "Temporarily enable pull requests to trigger E2E Tests on GitH…
eason9487 Mar 25, 2024
a345951
Merge pull request #2327 from woocommerce/dev/e2e-product-block-editor
eason9487 Mar 25, 2024
cbdcba1
Merge pull request #2329 from woocommerce/add/delete-stale-mc-statuses
jorgemd24 Mar 25, 2024
fd022f8
Merge pull request #2324 from woocommerce/add/display-error-job-mc-st…
jorgemd24 Mar 25, 2024
694d244
Merge branch 'develop' into feature/refactor-product-stats
jorgemd24 Mar 25, 2024
4850b85
Merge pull request #2332 from woocommerce/feature/refactor-product-stats
jorgemd24 Mar 25, 2024
5a741ae
Start `release/2.6.4`.
github-actions[bot] Mar 26, 2024
ff17951
Remove older changelog entries from readme.txt
eason9487 Mar 26, 2024
462a767
woorelease: Product version bump update
eason9487 Mar 26, 2024
2f67629
woorelease: Changelog update
eason9487 Mar 26, 2024
f7a8be3
Update hooks documentation from branch.
github-actions[bot] Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,25 @@ on:
- composer.json
- composer.lock
- .github/workflows/php-unit-tests.yml

workflow_dispatch:
inputs:
php-version:
description: 'PHP Version'
default: '8.2'
wp-rc-version:
description: 'WordPress version for Release Candidate (ex. 6.5-RC3)'
default: 'latest'
wc-rc-version:
description: 'WooCommerce version for Release Candidate (ex. 8.7.0-rc.1)'
default: 'latest'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
GetMatrix:
if: github.event_name != 'workflow_dispatch'
name: Get WP and WC version Matrix
runs-on: ubuntu-latest
outputs:
Expand All @@ -42,12 +54,14 @@ jobs:
slug: woocommerce

UnitTests:
if: github.event_name != 'workflow_dispatch'
name: PHP unit tests - PHP ${{ matrix.php }}, WP ${{ matrix.wp-version || 'latest' }}, WC ${{ matrix.wc-versions || 'latest' }}
needs: GetMatrix
runs-on: ubuntu-latest
env:
WP_CORE_DIR: "/tmp/wordpress/src"
WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit"
generate_coverage: 'false'
strategy:
matrix:
php: [ 8.2 ]
Expand Down Expand Up @@ -96,3 +110,30 @@ jobs:
files: tests/php-coverage/report.xml
flags: php-unit-tests
name: php-coverage-report

ReleaseCandidateUnitTests:
if: github.event_name == 'workflow_dispatch'
name: PHP unit tests (for Release Candidates)
runs-on: ubuntu-latest
env:
WP_CORE_DIR: "/tmp/wordpress/src"
WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit"

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
with:
php-version: "${{ inputs.php-version }}"

- name: Prepare MySQL
uses: woocommerce/grow/prepare-mysql@actions-v1

- name: Install WP tests
run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ inputs.wp-rc-version }} ${{ inputs.wc-rc-version }}

- name: Run PHP unit tests
run: composer test-unit

7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
*** WooCommerce Google Listings and Ads Changelog ***

= 2.6.4 - 2024-03-26 =
* Add - Filter WC REST API responses for gla_syncable param.
* Add - Missing functions for the WPCOM OAuth flow.
* Add - Notify when product changes.
* Dev - Add a manual workflow run for PHP unit tests.
* Update - Refactor Product Stats.

= 2.6.3 - 2024-03-19 =
* Fix - Handle parse JSON exception when Creating Ads Account.
* Fix - Inline Javascript encoding for gtag events.
Expand Down
4 changes: 2 additions & 2 deletions google-listings-and-ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Google Listings and Ads
* Plugin URL: https://wordpress.org/plugins/google-listings-and-ads/
* Description: Native integration with Google that allows merchants to easily display their products across Google’s network.
* Version: 2.6.3
* Version: 2.6.4
* Author: WooCommerce
* Author URI: https://woo.com/
* Text Domain: google-listings-and-ads
Expand All @@ -30,7 +30,7 @@

defined( 'ABSPATH' ) || exit;

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

Expand Down
4 changes: 3 additions & 1 deletion js/src/data/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ import { adaptAdsCampaign } from './adapters';
* @typedef {Object} ProductStatistics
* @property {number} scheduled_sync Number of scheduled jobs which will sync products to Google.
* @property {number} timestamp Timestamp reflecting when the product status statistics were last generated.
* @property {ProductStatisticsDetails} statistics Statistics information of product status on Google Merchant Center.
* @property {boolean} loading Whether the product status statistics are being loaded.
* @property {string | null} error In case of error, it will contain the error message.
* @property {ProductStatisticsDetails | null } statistics Statistics information of product status on Google Merchant Center or null if the stats are loading.
*/

/**
Expand Down
65 changes: 63 additions & 2 deletions js/src/hooks/useMCProductStatistics.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,76 @@
/**
* External dependencies
*/
import { useEffect, useCallback } from '@wordpress/element';

/**
* Internal dependencies
*/
import useAppSelectDispatch from '.~/hooks/useAppSelectDispatch';
import useAppSelectDispatch from './useAppSelectDispatch';
import useCountdown from './useCountdown';
import useApiFetchCallback from '.~/hooks/useApiFetchCallback';
import { useAppDispatch } from '.~/data';

/**
* Call `useAppSelectDispatch` with `"getMCProductStatistics"`.
* If the background process is loading, start a countdown and invalidate the resolution for getMCProductStatistics and getMCProductFeed.
*
* @return {useAppSelectDispatch} Result of useAppSelectDispatch.
*/
const useMCProductStatistics = () => {
return useAppSelectDispatch( 'getMCProductStatistics' );
const { second, callCount, startCountdown } = useCountdown();
const { invalidateResolutionForStoreSelector } = useAppDispatch();
const { data, hasFinishedResolution, invalidateResolution, ...rest } =
useAppSelectDispatch( 'getMCProductStatistics' );

// Weather the AS job is still processing the data.
const isCalculatingStats =
hasFinishedResolution && data?.loading ? true : false;
const hasStats = hasFinishedResolution && data?.statistics ? true : false;

const [ refreshProductStats ] = useApiFetchCallback( {
path: `/wc/gla/mc/product-statistics/refresh`,
method: 'GET',
} );

const refreshStats = useCallback( async () => {
await refreshProductStats();
invalidateResolution();
}, [ refreshProductStats, invalidateResolution ] );

useEffect( () => {
// If the job is still processing the data, start the countdown.
if ( isCalculatingStats && second === 0 ) {
startCountdown( 15 );
// After the countdown started and the job is still processing the data, invalidate the resolution/refetch the data to get the latest status.
if ( callCount > 0 ) {
invalidateResolution();
}
}

// Stop the countdown when the data is loaded.
if ( hasStats && callCount > 0 ) {
startCountdown( 0 );
// Refresh the product feed data so product statuses are updated.
invalidateResolutionForStoreSelector( 'getMCProductFeed' );
}
}, [
second,
callCount,
isCalculatingStats,
hasStats,
invalidateResolution,
invalidateResolutionForStoreSelector,
startCountdown,
] );

return {
data,
invalidateResolution,
hasFinishedResolution,
refreshStats,
...rest,
};
};

export default useMCProductStatistics;
183 changes: 183 additions & 0 deletions js/src/hooks/useMCProductStatistics.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
/**
* External dependencies
*/
import { renderHook } from '@testing-library/react-hooks';

/**
* Internal dependencies
*/
import useMCProductStatistics from '.~/hooks/useMCProductStatistics';
import useCountdown from '.~/hooks/useCountdown';
import useAppSelectDispatch from '.~/hooks/useAppSelectDispatch';
import { useAppDispatch } from '.~/data';
import useApiFetchCallback from '.~/hooks/useApiFetchCallback';

jest.mock( '.~/hooks/useAppSelectDispatch' );
jest.mock( '.~/hooks/useCountdown' );
jest.mock( '.~/data' );
jest.mock( '.~/hooks/useApiFetchCallback', () => ( {
__esModule: true,
default: jest.fn().mockImplementation( () => {
return [ jest.fn(), null ];
} ),
} ) );

describe( 'useMCProductStatistics', () => {
const startCountdown = jest.fn();
const invalidateResolution = jest.fn();
const invalidateResolutionForStoreSelector = jest.fn();

useAppDispatch.mockImplementation( () => {
return {
invalidateResolutionForStoreSelector,
};
} );

const statsData = {
loading: false,
statistics: {
active: 10,
expiring: 20,
pending: 30,
disapproved: 2132,
not_synced: 1074,
},
error: null,
};

describe( 'The update_merchant_product_statuses job is completed', () => {
beforeAll( () => {
jest.clearAllMocks();
} );

it( 'The response contains the statistics', () => {
useCountdown.mockImplementation( () => {
return {
second: 0,
callCount: 0,
startCountdown,
};
} );

useAppSelectDispatch.mockImplementation( () => {
return {
hasFinishedResolution: true,
invalidateResolution,
data: statsData,
};
} );

const { result } = renderHook( () => useMCProductStatistics() );

expect( startCountdown ).not.toHaveBeenCalled();
expect( invalidateResolution ).not.toHaveBeenCalled();
expect( result.current.data ).toEqual( statsData );
expect( result.current.hasFinishedResolution ).toEqual( true );
} );
} );

describe( 'Retry two times until the update_merchant_product_statuses job is completed', () => {
beforeAll( () => {
jest.clearAllMocks();

useCountdown.mockImplementation( () => {
return {
second: 0,
callCount: 0,
startCountdown,
};
} );
} );
it( "The first time the job is in progress/scheduled and the response doesn't contains statistics", () => {
useAppSelectDispatch.mockImplementation( () => {
return {
hasFinishedResolution: true,
invalidateResolution,
data: {
loading: true,
statistics: null,
error: null,
},
};
} );

renderHook( () => useMCProductStatistics() );

expect( startCountdown ).toHaveBeenCalledTimes( 1 );
expect( startCountdown ).toHaveBeenCalledWith( 15 );
expect( invalidateResolution ).not.toHaveBeenCalled();
} );
it( 'The countdown is completed, so we invalidate the call and try again', () => {
useCountdown.mockImplementation( () => {
return {
second: 0,
callCount: 1,
startCountdown,
};
} );

renderHook( () => useMCProductStatistics() );

expect( startCountdown ).toHaveBeenCalledTimes( 2 );
expect( startCountdown ).toHaveBeenCalledWith( 15 );
expect( invalidateResolution ).toHaveBeenCalledTimes( 1 );
expect( invalidateResolution ).toHaveBeenCalledWith();
} );
it( 'The third time the job is completed and the response contains the statistics', () => {
useAppSelectDispatch.mockImplementation( () => {
return {
hasFinishedResolution: true,
invalidateResolution,
data: statsData,
};
} );

renderHook( () => useMCProductStatistics() );

expect( startCountdown ).toHaveBeenCalledTimes( 3 );
expect( startCountdown ).toHaveBeenLastCalledWith( 0 );
expect( invalidateResolution ).toHaveBeenCalledTimes( 1 );
expect( invalidateResolution ).toHaveBeenCalledWith();
expect(
invalidateResolutionForStoreSelector
).toHaveBeenCalledTimes( 1 );
expect( invalidateResolutionForStoreSelector ).toHaveBeenCalledWith(
'getMCProductFeed'
);
} );
} );
describe( 'Refresh the product statistics', () => {
beforeAll( () => {
jest.clearAllMocks();
} );
it( 'The user clicks the refresh button', async () => {
const refreshProductStats = jest.fn();
useCountdown.mockImplementation( () => {
return {
second: 0,
callCount: 0,
startCountdown,
};
} );

useAppSelectDispatch.mockImplementation( () => {
return {
hasFinishedResolution: true,
invalidateResolution,
data: statsData,
};
} );

useApiFetchCallback.mockImplementation( () => {
return [ refreshProductStats, null ];
} );

const { result } = renderHook( () => useMCProductStatistics() );

await result.current.refreshStats();

expect( refreshProductStats ).toHaveBeenCalledTimes( 1 );
expect( invalidateResolution ).toHaveBeenCalledTimes( 1 );
} );
} );
} );
Loading
Loading