Commit Graph

65256 Commits

Author SHA1 Message Date
Lucas fa6ea00b3c
Use stricter text selector on test (#50848)
* Use stricter text selector

Removes text ambiguity to avoid errors like "Strict mode violation resolved to 2 elements". For instance, it might search for "Settings", and there might be a menu "Foo Settings" which would resolve to 2 elements. This changes the behavior to match the exact test, instead of a substring.

* Update page-loads.spec.js

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-21 13:25:27 -07:00
Tomek Wytrębowicz 63f96eb5a8
Mark props with defaults as not required (#50816) 2024-08-21 21:59:42 +02:00
Adrian Moldovan e1e628ccf0
[e2e tests] Fix flaky navigation to editor (#50841) 2024-08-21 22:18:20 +03:00
github-actions[bot] 94d3b2e05c
Update changelog.txt from release 9.2.1 (#50851)
* Prep trunk post release 9.2.1

* Add 9.2.0's changelog

---------

Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
Co-authored-by: Jorge Torres <jorge.torres@automattic.com>
2024-08-21 16:12:54 -03:00
Tomek Wytrębowicz d31aae633a
Move `ReportError` to `@woocommerce/components` as `AnalyticsError` (#50108)
Co-authored-by: Eason <eason.su.tw@gmail.com>
2024-08-21 20:12:13 +02:00
Tomek Wytrębowicz 536807ca43
Fix optional param in PHPdoc for WC_Admin_Marketplace_Promotions (#50732)
Co-authored-by: github-actions <github-actions@github.com>
2024-08-21 20:11:16 +02:00
Jorge A. Torres b798b261b3
Update stable tag to 9.2.1 (#50850)
woorelease: Update stable tag to 9.2.1
2024-08-21 15:10:28 -03:00
Corey McKrill b430971093
Avoid fatal in `wc_get_chosen_shipping_method_ids` (#50774)
This ensures the WC() session object is initialized before attempting to
get chosen shipping methods. If it's not initialized,
`wc_get_chosen_shipping_method_ids` will return an empty array.

Fixes #50283
2024-08-21 10:28:54 -07:00
Tomek Wytrębowicz 0322426dce
Reduce duplicated code in Analytics classes (#49425)
- Add code docs to the Analytics classes and make get_order_statuses non-internal.
   Document analytics classes and some methods. Add simple examples of how to use it. Give a brief "why?" and "when?" answers. Add links between related classes.
- Replace `Automattic\WooCommerce\Admin\API\Reports\*\Query` classes with a single `GenericQuery` class.
- Reduce the amount of duplicated code in Analytics `DataStore`s.
- Reduce duplicated code in Analytics controllers
- Add `FilteredGetDataTrait`, `OrderAwareControllerTrait`, and `StatsDataStoreTrait` for extension developers to reuse while creating custom Analytics
- Add a `GenericQuery` to reduce duplicated code in Query classes.
   Also, to expose it to community extensions for reuse.
- Use `GenericQuery` instead of duplicated `Query` classes
- Move caching code to shared `DataStore::get_data`
- Move intervals specific `initialize_queries` to shared Trait
- Move intervals checking logic to shared `StatsDataStoreTrait`
- Reuse `GenericController::prepare_item_for_response` for `Reports\Controller` subclasses
- Reuse `GenericController::get_collection_params` for `Reports\Controller` subclasses.
- Move `get_items` code to shared `GenericStatsController`
- Move shared paginable controllers `get_items` code to the generic class
- Move fields param to `GenericStatsController`
- Separate `OrderAwareControllerTrait` from `ReportController`
   to allow specific Analytics Controllers to extend the `Generic(Stats)Controller` directly, without extending the `ReportController`, which is used to list reports.


It's meant not to change any behavior. However, due to unification, it did tweak a few things mostly from the developer perspective:
- Previously, only some controllers threw an error from `get_items` when the data was missing; some did not. Now controllers the following Controllers changed behavior to also for such an error:
	- Coupons
	- Customers
	- Downloads
	- Orders
	- Products
	- Taxes
- the error has one error code from all controllers:`woocommerce_rest_reports_invalid_response` (previously there were report-specific)
   - `woocommerce_rest_reports_categories_invalid_response` -> `woocommerce_rest_reports_invalid_response`
- In Orders Controller, the `$orders_data['order_number'], $orders_data['total_formatted']` are set in the `prepare_item_for_response` method, not in the `get_items`So `prepare_item_for_response` function is expected to be called with bare data from Query
- In Products Controller extended-info is now sanitized in the `prepare_item_for_response` method, not in the `get_items`
- ⚠️ (breaking) Previosly some Controlers' `prepare_item_for_response` function was getting and expecting first argument to be casted to `object`, while the rest of controllers used data as returned from the Store. This PR unifies this behavior  for
   -  `Coupons\Stats\Controller`
   -  `Taxes\Controller`
   -  `Taxes\Stats\Controller`
   So, if you extend those classes and override `prepare_item_for_response` in a way that expects `object`, you will get an error. (I have not found such cases in the `all-plugins` repo.)
   All `woocommerce_rest_prepare_report_*` filters remain intact and inconsistent for backward compatibility.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mik <mikkamp@users.noreply.github.com>
2024-08-21 19:23:51 +02:00
Adrian Duffell c738aeed17
Update site visibility badge height to 18px (#50792)
* Update badge height to 18px

* Add changelog
2024-08-22 00:23:40 +08:00
Adrian Moldovan cb9912bcf4
[e2e test] Fix strict mode violation in delete variation test (#50838) 2024-08-21 08:57:48 -07:00
piinthecloud 7dd2f11805
Docs/check payment method support (#50845)
* Fixed minor issues with recently added snippets docs

Fixed a few duplicate titles and encoding issues in the docs that were recently added via public resources.

* Create docs-check_payment_method_support

* update manifest

* fix linter errors

---------

Co-authored-by: Yaku <15178758+jacoswan@users.noreply.github.com>
2024-08-21 11:56:26 -04:00
Alba Rincón 796854770c
CYS - Move the `ai/product` endpoint to woocommerce admin API (#50393)
* CYS - Move the ai/store-title endpoint to woocommerce admin api

* Add middleware and callback

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix lint error

* CYS - Move the ai/business-description endpoint to woocommerce admin API

* CYS - Move the ai/store-info endpoint to woocommerce admin API

* Update endpoint

* CYS - Move the ai/images endpoint to woocommerce admin API

* CYS - Move the `ai/patterns` endpoint to woocommerce admin API

* CYS - Move the `ai/product` endpoint to woocommerce admin API

* Add changefile(s) from automation for the following project(s): woocommerce

* Remove import

* Add changefile(s) from automation for the following project(s): woocommerce-beta-tester, woocommerce

* Add changefile(s) from automation for the following project(s): woocommerce

* Add strict types

* Extract AI_CONTENT_GENERATED constant

* Move instance creating to where it's used

* Add try/catch and fix the on Patterns

* Use the base AIEndpoint class

* Fix endpoint

* Update comment return type

* Fix comments

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-21 15:34:12 +02:00
Roy Ho 944d9233ed
Add/clear theme info cache (#50803)
* Add function to clear system status theme info cache to tool page

* Add clear cache tooltip to the template override section

* Add changefile(s) from automation for the following project(s): woocommerce

* Remove extra td

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-21 06:21:14 -07:00
DAnn2012 5690850e47
Fix typo (class-wc-tests-customizing-product-catalog.php) (#50336)
* Update class-wc-tests-customizing-product-catalog.php

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Vedanshu Jain <vedanshu.jain.2012@gmail.com>
2024-08-21 17:39:39 +05:30
Ilyas Foo 20a6327637
Add CSS outline for keyboard accessibility (#50794)
* Add CSS outline for keyboard accessibility

* Changelog
2024-08-21 18:47:33 +08:00
Adrian Duffell e45b59b71f
Update the link color in legal disclaimers on core profiler (#50830)
* Revert t&c link colors in core profiler

* Add changelog
2024-08-21 17:11:07 +08:00
Ilyas Foo 64dcafe29b
Vertically center product meta box elements (#50826)
* Vertically center product meta elements

* Changelog
2024-08-21 14:42:59 +08:00
Gabriel Manussakis b449ca840f
[Accessibility] Announce notice messages after page loads (#50061)
* Update makup of add to cart success message

* Update CSS to position the add to cart success message content

* Focus notice message after page loads

* Add changelog file

* Remove tabindex attribute from add-to-cart success message

* Update tests for the add-to-cart success message

* Remove white space on test

* Increase delay before focusing the error message

* Cobine delay with queue method

* Remove unnecessary woocommerce-notice-content class

* Swap view cart link order in notice

* Remove woocommerce-notice-content wrapper

* Refactor to vanilla JS code that focus on notice message

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
2024-08-21 11:54:58 +05:30
Akeda Bagus 9ef1b72fc1
Set timeout to 2 seconds for helper product-usage-notice-rules endpoint request (#50821) 2024-08-21 11:47:40 +07:00
Moon dac8fa8eba
Coming soon mode - Match shop page when permalink structure is set to plain (#50567)
* Match shop page when permalink structure is set to plain

* Revert uninteded change

* Match post types

* Check for param

* Add test for post_type check

* Fix tests

* Add changefile(s) from automation for the following project(s): woocommerce

* Use wp_parse_url

* Test returning false

* Lint fixes

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-20 19:50:00 -07:00
Jorge A. Torres d07cb35247
Cherry pick PR#50805 into trunk (#50814) 2024-08-20 20:46:07 -03:00
Jorge A. Torres d2104e1079
Cherry pick PR#50804 into trunk (#50812) 2024-08-20 20:45:13 -03:00
Jorge A. Torres 749adf304d
Cherry pick PR#50802 into trunk (#50811) 2024-08-20 20:44:48 -03:00
Thilina Pituwala 28ce18e13a
SDK to control product feature usage (#50218)
* Methods for fetching and caching product feature restrictions.

* DTO for passing product feature rule set to the plugin.

* Main class for handling product feature restriction logic.

* Remove unconnected WCCOM site related restrictions.

* Start with minimalist rule

If `\WC_Product_Usage::get_rules_for_product( 27147 )` returns null it
means no rule set to apply for product with ID 27147. Otherwise, it
returns `\WC_Product_Usage_Rule_Set`.

* Remove unused constant

* Remove underscore prefix on the method name; it's discouraged by the linter

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Akeda Bagus <akeda.bagus@automattic.com>
2024-08-21 06:07:31 +07:00
Jorge A. Torres 7e6125ee76
Cherry pick PR#50801 into trunk (#50813) 2024-08-20 18:35:54 -03:00
Jonathan Lane 02596ba4b0
Fix flaky product variations test (#50807)
Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-08-20 13:35:21 -07:00
Gabriel Manussakis 7e08187671
[Accessibility] Make the matching variations alert a live region (#50132)
* Add aria label to the Clear variation options link

* Make the matching variations alert a live region

* Bump add-to-cart variable template version

* Add changelog file

* Add docblock comment to woocommerce_reset_variations_link filter

* Revert changes for Clear variations button

* Make unavailable product combination message a live region

* Improve no matching variation message for screen readers

* Align variables declaration

* Bump template version

* Add role alert to the parent of the no matching message

* Add empty alt text for pesudo-element content

---------

Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
2024-08-20 18:57:30 +02:00
DAnn2012 d2e9e982ec
Fix typo (wc-template-functions.php) (#50147)
* Update wc-template-functions.php

* Add changefile(s) from automation for the following project(s): woocommerce

* Update plugins/woocommerce/includes/wc-template-functions.php

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Naman Malhotra <naman03malhotra@gmail.com>
2024-08-20 23:29:42 +07:00
Fernando Marichal 771fd00e5d
Featured Product: Fix variable product Selection dropdown (#50633)
* Add hook to SearchListItem

* Add changelog

* Invert is-expanded chevron

* Fix expanded setting

* Fix e2e test

* Add hasChildren and isSelected as dependency
2024-08-20 12:42:35 -03:00
Miguel Pérez Pellicer a883856171
Render GTIN in Product structured data (#50087)
* Add GTIN in structured data

* Changelog

* Add changefile(s) from automation for the following project(s): woocommerce

* Delete plugins/woocommerce/changelog/50087-tweak-add-gtin-ld-json

* Add changefile(s) from automation for the following project(s): woocommerce

* Lint

* Delete plugins/woocommerce/changelog/50087-tweak-add-gtin-ld-json

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-20 18:57:23 +04:00
Gabriel Manussakis c9aa65a22f
[Accessibility] Fix focus order on checkout block page (#49649)
* Render total blocks before fields on checkout

* Reverse checkout total blocks position on desktop

* Add changelog file

* Add conditional styles to reverse checkout blocks order

---------

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2024-08-20 15:42:38 +02:00
Fernando Marichal ce98e51430
[Filter Products by Price]: Update view when changing the min/max value (#50651)
* Use handlePriceChange method

* Fix E2E test

* Add changelog

* Remove onBlur

* Add select when clicked

* Fix comment

* Add functionality to experimental block

* Fix E2E test
2024-08-20 10:20:09 -03:00
Alba Rincón 4e76cb11be
CYS - Move the `ai/patterns` endpoint to woocommerce admin API (#50372)
* CYS - Move the ai/store-title endpoint to woocommerce admin api

* Add middleware and callback

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix lint error

* CYS - Move the ai/business-description endpoint to woocommerce admin API

* CYS - Move the ai/store-info endpoint to woocommerce admin API

* Update endpoint

* CYS - Move the ai/images endpoint to woocommerce admin API

* CYS - Move the `ai/patterns` endpoint to woocommerce admin API

* Add changefile(s) from automation for the following project(s): woocommerce-beta-tester, woocommerce

* Fix duplicated entries

* Use AI endpoint base class

* Remove unnecessary change

* Add strict types

* Remove unnecessary return type

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-20 15:17:27 +02:00
DAnn2012 8387b0a842
Fix typo (1140.md) (#50160)
* Update 1140.md

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Update 1140.md

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2024-08-20 12:37:13 +01:00
piinthecloud 5098bb1169
create block theme folder (#50638)
* create block theme folder

* add changelog

* update titles
2024-08-20 13:19:47 +02:00
RJ 905fe2246f
fix: reduce core profiler sticky footer height (#50788)
* fix: reduce core profiler sticky footer height

* increased height to 120px
2024-08-20 18:48:49 +08:00
Seghir Nadir 2a406c7e8a
Update all blocks to V3 (#48720)
* Update all blocks to V3

* remove explicit version set in shared config blocks

* update styling for Cart/Checkout in iframe

* test: fix block e2e tests

* test: fix attribute filter e2e tests

* test: fix product collection e2e tests

* test: fix product on sale e2e test

* test: fix rating filter e2e tests

* test: fix review e2e tests

* test: fix stock e2e tests

* test: fix preview button test

* fix: product on sale wrapper

* test: fix insertBlockByShortcut in iframe

* test: fix core e2e tests

* chore: changelog

* test: typo

* test: update PC e2e tests

* add test to make sure iframe canvas is loaded

* fix syntax error

* Update plugins/woocommerce-blocks/tests/e2e/tests/basic.block_theme.spec.ts

Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>

---------

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>
2024-08-20 10:14:11 +00:00
RJ d7682504d9
fix: replaced apostrophes for WooCommerce Admin JS strings in Homescreen & Core Profiler (#50776) 2024-08-20 17:13:17 +08:00
Adrian Duffell 6a59fbc111
Add site visibility badge to admin menu (#50775)
* Add admin bar badge

* Remove previous badge

* Update e2e

* Add changelog

* Fix lint issues

* Hide embedded CSS when admin bar is not showing

* lint fix

* Fix copypasta

* Update doc comments

* Fix lys e2e tests

* Remove unused props

* Fix lysTourHidden check

* Update site visibility badge ID in tour and admin bar

* Add hover effects

* Update id in css

---------

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2024-08-20 08:36:20 +00:00
Alba Rincón 071af63f32
CYS - Move the `ai/images` endpoint to woocommerce admin API (#50365)
* CYS - Move the ai/store-title endpoint to woocommerce admin api

* Add middleware and callback

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix lint error

* CYS - Move the ai/business-description endpoint to woocommerce admin API

* CYS - Move the ai/store-info endpoint to woocommerce admin API

* Update endpoint

* Add changefile(s) from automation for the following project(s): woocommerce

* CYS - Move the ai/images endpoint to woocommerce admin API

* Add changefile(s) from automation for the following project(s): woocommerce

* Use constant and normalize site title values

* Add base AI Endpoint class

* Fix lint error

* Use the endpoint base class

* Revert change

* Add changefile(s) from automation for the following project(s): woocommerce

* Use ai endpoint class

* Add strict types

* Fix lint error

* Add strict type

* Fix lint and use ai endpoint base

* Fix lint

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-20 10:34:27 +02:00
Alba Rincón c06190d529
CYS - Move the `ai/store-info` endpoint to woocommerce admin API (#50363)
* CYS - Move the ai/store-title endpoint to woocommerce admin api

* Add middleware and callback

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix lint error

* CYS - Move the ai/business-description endpoint to woocommerce admin API

* CYS - Move the ai/store-info endpoint to woocommerce admin API

* Update endpoint

* Add changefile(s) from automation for the following project(s): woocommerce

* Use constant and normalize site title values

* Add base AI Endpoint class

* Fix lint error

* Use the endpoint base class

* Revert change

* Add changefile(s) from automation for the following project(s): woocommerce

* Use ai endpoint class

* Add strict types

* Fix lint error

* Add strict type

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-20 09:54:57 +02:00
Adrian Duffell ace3169c0a
Remove the "We're here to help" spotlight (#47812)
* Remove tooltip

* Fix lint issues

* lint

* Remove tests

* Add changelog

* Lint fix
2024-08-20 15:51:44 +08:00
Jonathan Lane d5c901e3b7
Update Playwright to 1.46.1 (#50772) 2024-08-20 10:40:46 +03:00
Adrian Moldovan ba6f81c486
[ci-jobs] Adds --list and --json options to save jobs output (#50684) 2024-08-20 10:38:08 +03:00
Alba Rincón 9b1d91c7d2
CYS - Move the `ai/business-description` endpoint to woocommerce admin API (#50359)
* CYS - Move the ai/store-title endpoint to woocommerce admin api

* Add middleware and callback

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix lint error

* CYS - Move the ai/business-description endpoint to woocommerce admin API

* Use constant and normalize site title values

* Add base AI Endpoint class

* Fix lint error

* Use the endpoint base class

* Revert change

* Add changefile(s) from automation for the following project(s): woocommerce

* Add strict types

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-20 09:11:20 +02:00
RJ 6bac54ad82
Revert "Prevent initializing coming soon feature if it's already initialized" (#50783)
Revert "Prevent initializing coming soon feature if it's already initialized …"

This reverts commit bcf1a38a58.
2024-08-20 14:39:13 +08:00
Ilyas Foo ad1b233a9c
Update AdditionalPayments task to use default gateway suggestion (#50674)
* Add new default spec function

* Changelog

* Add a new method to get cached or default

* Add test

* Update comment

* Revert comment

* Update docblock

* Lint

* Typo

* Set specs to default when marketplace suggestion is disabled

* Update tests
2024-08-20 14:22:58 +08:00
RJ 34d40f9a63
dev: see which tests fail when coming soon is enabled (#50344)
* test: see which tests fail when coming soon is enabled

* changelog

* empty commit to trigger CI
2024-08-20 13:57:28 +08:00
Ilyas Foo c7b7805b7e
Site visibility settings add documentation link and copy changes (#50781)
* Add link to title, remove link from a description, minor copy changes

* Changelog

* Update link

* Update test and copies
2024-08-20 13:49:05 +08:00