Commit Graph

19876 Commits

Author SHA1 Message Date
Sam Seay 5ecea1b8c2
Support testing many variants of a block at runtime via dynamically generated templates (#44223) 2024-02-17 01:00:36 +13:00
Manish Menaria e210302e8a
Product Collection: Add loading indicator for client-side pagination (#44571)
* Add animation for client-side pagination

This includes:
- Addition of animation state management in the frontend file to control the visual transition between pagination states.
- Introduction of new SCSS rules for the start and finish animations, ensuring a seamless and visually appealing pagination experience.
- Modification of the PHP logic to inject necessary HTML for the animation to be applied.

These updates aim to provide a more engaging and responsive interface for users navigating through product collection.

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

* Allow user clicks under product collection's loading animation

This commit enhances the user experience of the loading animation for the product collection block. Changes include:

- Specifying `transform-origin: 0% 0%;` directly within the block's initial style to indicate the animation should start from the left
- Adding `pointer-events: none;` to allow user interactions with elements underneath the loading animation, thus improving usability by not blocking clicks.

Additionally, redundant `transform-origin` properties were removed from the `@keyframes` declaration to clean up the code and avoid unnecessary repetition. This simplification contributes to both the maintainability and readability of the stylesheet.

* Fix linting errors in SCSS file

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-16 15:43:58 +05:30
Chi-Hsuan Huang eb2b1fef1d
Add checks and unit tests to rule processors (#44448)
* Add checks and unit tests to rule processors

* Add checks and unit tests to PluginsActivatedRuleProcessor

* Add checks and unit tests to PluginsVersionRuleProcessor

* Add checks and unit tests to PublishAfterTimeRuleProcessor

* Add checks and unit tests to PublishBeforeTimeRuleProcessor and fix PublishAfterTimeRuleProcessor

* Add checks and unit tests to WCAdminActiveForRuleProcessor

* Add unit tests and refactor TotalPaymentsVolumeProcessor

* Fix unit tests

* Add changelog

* Fix unit tests

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/base-location-state-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/wcadmin-active-for-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/wcadmin-active-for-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/wcadmin-active-for-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/wcadmin-active-for-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/total-payments-volume-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/is-woo-express-rule-processer.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/is-woo-express-rule-processer.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Use Throwable instead

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/total-payments-volume-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/src/Admin/RemoteInboxNotifications/BaseLocationCountryRuleProcessor.php

Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>

* Update plugins/woocommerce/src/Admin/RemoteInboxNotifications/PluginsActivatedRuleProcessor.php

Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/plugin-version-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-after-time-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-before-time-rule-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/total-payments-volume-processor.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Address PR feedback

---------

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>
2024-02-16 10:10:15 +00:00
Tung Du 0425857b7f
[Experimental] Fix Active Filter chips style (#44682) 2024-02-16 10:09:49 +00:00
Chi-Hsuan Huang 75118fbe40
Add checks and unit tests to Transformers (#44634)
* Add checks and unit tests to Transformers

* Add changelog

* Update docs

* Fix test

* Set the default value to an empty array

* Set default value to array() for ArrayColumn
2024-02-16 16:51:09 +08:00
Ilyas Foo 0ea64cf93b
Add error handling and tests for ShippingPartnerSuggestions (#44641)
* Add error handling and tests for ShippingPartnerSuggestions, add missed generic error handling for RemoteFreeExtension evaluator

* Changelog
2024-02-16 15:18:30 +08:00
Vedanshu Jain 1d91b89d16
Dont render attribution metabox for non-supported order types. (#44680)
* Dont render attribution metabox for non-supported order types.

* Use a screen check instead of order type check for better compat.

* phpcs fix

* Remove unnecessary call.
2024-02-16 12:39:25 +05:30
Manish Menaria 017b5e249a
Product Collection: Handle empty block content in process_pagination_links method (#44575)
* Handle empty block content in process_pagination_links method

This commit introduces a check for empty block content in the `process_pagination_links` method of the `ProductCollection` class. This change ensures that if the block content is empty, the method will immediately return the original content without attempting further processing. This enhancement prevents potential errors or unnecessary processing steps on empty content.

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-16 11:35:59 +05:30
Sam Seay f513ce7c25
[Experimental] Refresh product collections that don't support the interactivity API (#44631) 2024-02-16 15:51:42 +13:00
ericmulder 4cf4868855
fix fatal string to array conversion error in get_full_size_image_dim… (#40395)
Ensures that even if `wp_get_attachment_metadata` returns an unexpected value due to a filter, the `get_full_size_image_dimensions` method will handle it correctly and not throw an error.

Fixes #40393

---------

Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>
2024-02-15 15:45:10 -08:00
Adrian Moldovan ddf908d7fb
[e2e tests] Enhance product reviews tests (#44644)
* Rename test

* Updated tests to use work with more reviews

* Add changelog

* Add new test: can filter the reviews by product

* Fix lint errors and warnings
2024-02-15 13:30:47 -08:00
Jonathan Lane fce80c40c0
E2e/customer emails (#44622)
* Adds tests for user account emails

* Add changelog

* Fix linting issues (code formatting)

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-02-15 13:07:31 -08:00
nigeljamesstevenson a0b72b0546
Cherry-pick #301 into trunk (#44667)
Checkout changes from #293

Co-authored-by: Rodel Calasagsag <rodel.calasagsag@automattic.com>
2024-02-15 21:06:37 +00:00
nigeljamesstevenson 45fd1ab3f0
Cherry-pick #298 into trunk (#44666)
* add wc_get_valid_product_statuses

* add support for sku

* add unit tests for the `product_page` shortcode

* add `woocommerce_shortcode_product_page_override_read_permissions_unpublished` filter

* keep a list of invalid statuses instead of valid ones and allow overriding it

* move deprecation notice handling into methods

* appease the linter

* remove `visibility` attribute

* ensure we remove the filters that we add in a test

* allow overriding read permissions in both directions (or not at all)

* add sku-based tests and remove some superfluous testing data and asserts

* add back in missing variable

* remove superfluous `hidden` visibilities

* add changelog file

---------

Co-authored-by: Leif Singer <git@singer.sh>
2024-02-15 21:06:25 +00:00
nigeljamesstevenson 58781b796c
Cherry-pick #295 into trunk (#44665)
* Prevent file-sniffing through the product editor's downloadable files UI.

Before now, files that do not exist and files that exist outside an approved directory led to different error messages. This meant the latter could be taken as an indicator that a given file exists.

* Correct initial indent.

---------

Co-authored-by: barryhughes <3594411+barryhughes@users.noreply.github.com>
2024-02-15 21:06:14 +00:00
Ron Rennick 5ec07c1e5f
update states, expected plugins in api tests (#44650)
* update states, expected plugins in api tests

* add changelog

---------

Co-authored-by: Ron Rennick <ronald.rennick@automattic.com>
2024-02-15 14:22:24 -04:00
Jonathan Lane 2812adc5af
Add sharding to Blocks e2e tests (#44440)
* Add sharding to Blocks e2e tests

* Changelog

* Push a change to Blocks README to trigger tests

* Fix syntax

* Fixed again

* Try again

* Trying to get the shard number

* Shard names

* fix E2E test

* complete all the jobs

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2024-02-15 09:27:17 -08:00
Alexandre Lara 452c522b95
[DOC] Resolve incorrect branch references in Gutenberg links (#44566)
* Fix Gutenberg links in the docs pointing to the wrong branch

* Add changefile(s) from automation for the following project(s): @woocommerce/notices, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/components, woocommerce-blocks, woocommerce-beta-tester, woo-ai

* Fix markdown lint errors

* Fix wrong link in the docs

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-15 14:13:28 -03:00
Jorge A. Torres f79bf3a340
Add `wc hpos backfill` tool to backfill from/to either datastore (#44281)
* Fix docblock

* First pass at backfill CLI tool

* Use ‘posts’ instead of ‘cpt’ in legacy data handler

* Include posts to HPOS migrator in LegacyDataHandler

* Add backfill method to legacy data handler

* Add tests

* Add changelog

* Appease linter

* Rename <id> to <order_id> in WP-CLI docblock

* Make from/to datastore argument mandatory

* Improve handling of invalid order types

* PHPCS fixes
2024-02-15 08:13:23 -08:00
Thomas Roberts c7eb05ac5e
Remove Additional Checkout Fields entry from 8.5 changelog (#44642) 2024-02-15 06:46:48 -08:00
Alba Rincón 7440082381
[CYS on Core] Update image to have a better resolution (#44611)
* Update image to have a better resolution

* Add changelog
2024-02-15 14:28:24 +01:00
Alba Rincón c9fe049934
[CYS - Core] Update the subheading copy of the transitional page (#44603)
* Update the subheading copy of the transitional page

* Add changelog
2024-02-15 13:59:43 +01:00
Justin Palmer b439a01cd5
Add mobile app order attribution source (#44519)
* Add mobile_app order attribution source
2024-02-15 13:44:02 +01:00
Fernando Marichal f09bc85875
Fix pre-publish modal styles (#44562)
* Fix pre-publish modal styles

* Improve styles

* Add changelog

* Add vars to styles

# Conflicts:
#	packages/js/product-editor/src/components/prepublish-panel/style.scss

* Fix sidebar styles

* Add changelog

* add overflow auto

* Fix quotes
2024-02-15 09:36:59 -03:00
Justin Palmer 406dcac669
Order attribution - avoid attributing AJAX-checkouts to Web Admin (#44219)
* Ensure is_admin AND ! wp_doing_ajax for setting Web admin source

* Better control to permit possible wp-admin ajax order creation
2024-02-15 12:38:09 +01:00
Albert Juhé Lluveras dd56a3ba61
Clean up block templates after running e2e tests (#44600)
* Clean up block templates after running e2e tests

* Add changelog entry

* Fix linting
2024-02-15 08:17:12 +01:00
Viktor Szépe 49557b3229
Fix reference to WC_API_Server (#37054)
* Fix reference to WC_API_Server

* Add changelog
2024-02-15 07:14:36 +00:00
RJ 141c2e4399
add/explat experiment name validation (#44535) 2024-02-15 12:35:23 +08:00
Barry Hughes 94c0578029
Session handler: restore use of _table property, for consistency with other methods. (#44517)
* Restore use of _table property, for consistency with other methods.

* Ignore interpolated/unprepared variable warning (we're referencing a table name).
2024-02-14 19:22:53 -08:00
Chi-Hsuan Huang a5711d03ca
Improve remote specifications transient handling and error management (#44384)
* Add set_specs_transient helper method

* Store default specs into transient when spec rules fails

* Add changelog

* Fix automatic conversion of false to array is deprecated

* Update plugins/woocommerce/src/Admin/DataSourcePoller.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Use set_specs_transient

* Handle evaluation error properly

* Add unit tests

* Update init

* Update changelog

* Update changelog

* Update plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/EvaluateSuggestion.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Change expires time compare operator to <= for safety

---------

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2024-02-15 11:00:36 +08:00
Kazuto Takeshita 71b6e74615
Make the structured data price of group products refer to the latest child product price (#42808)
* Changed Make the structured data price of group products refer to the latest child product price.

* Add changelog

* PHPCS fixes

---------

Co-authored-by: Jorge Torres <jorge.torres@automattic.com>
2024-02-15 02:58:21 +00:00
Jonathan Lane c3b355a53f
Remove test publishing (#44592) 2024-02-14 16:41:11 -08:00
nigeljamesstevenson 83fc7a88f3
Update Action Scheduler to 3.7.2 (#44628)
* Update Action Scheduler to 3.7.2
2024-02-14 16:28:02 -08:00
Paul Sealock 0f27449454
Update states.php -> Add Morocco regions (#41769)
Add regions for Morocco according to CLDR.
2024-02-14 16:17:09 -08:00
Christopher Allford eb543f564f
Fixed `@woocomerce/classic-assets` Watch Command (#44627)
The `watch:build` setup in this package does not conform to
the expects format and so the build command was not being
run. This fixes that and ensures it gets executed correctly.
2024-02-14 15:53:14 -08:00
Thomas Roberts 1ddd904b26
Add additional checkout fields documentation (#43782)
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-02-14 13:48:03 -08:00
Mike Jolley b94c14e745
[Experiment] Fix additional address field validation notices (#44615) 2024-02-14 10:02:30 -08:00
Matt Sherman d279466eb3
[Product Editor] Fix blank editor flash when loading product (#43840)
* EditorLoadingContext

* Use EditorLoadingContext

* Remove fallbacks

* Make sure metadata exists before using it

* Add header loading state

* Do not return skeleton

* Use EditorLoadingContext

* Update editor loading state

* Remove ProductPageSkeleton

* Remove unused import

* Remove unused import

* Handle undefined variationId and parentId in VariationSwitcherFooter

* Remove ProductPageSkeleton

* Include productId in determination of whether editor is loading

* Handle variation loading

* Fix rebase merge conflict mistakes

* Fix layout margins

* Show welcome tour and feedback bar after editor has loaded

* Changelogs

* Make loading context experimental
2024-02-14 09:57:17 -05:00
Bart Kalisz 2432b3b22e
[E2E] Update the blocks E2E setup guide (#44468)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2024-02-14 16:00:52 +02:00
nigeljamesstevenson fd24ff80e0
Delete plugins/woocommerce/changelog/kevinbates-patch-1-1
File removed as part of actioning CFE pf59Ax-L1-p2
2024-02-14 13:36:42 +00:00
Alba Rincón bf938b0bd3
[CYS] Update `Hero product chessboard` pattern (#44553)
* Reduce the `woocommerce-customize-store-banner-content` width to better fit the copy

* Add changelog

* Remove the image placeholder and improve margins

* Add changelog
2024-02-14 14:28:40 +01:00
Ilyas Foo c0804827a4
Improve tasklist performance, add prop to track (#44442)
* Improve tasklist performance, add prop to track

* Changelog

* Lint
2024-02-14 21:17:08 +08:00
Ilyas Foo 8ba2942099
Fix type handling and default value for remote API transformers (#44418)
* Add default value check and parameter, change transformer behaviour around defaults and types, update and add tests

* Changelog
2024-02-14 21:16:39 +08:00
Alba Rincón e5e641180b
Update the `Product gallery` pattern title (#44604)
* Update the product gallery title

* Add changlog
2024-02-14 13:55:33 +01:00
github-actions[bot] e00f49a0b1
Delete changelog files based on PR 44526 (#44608)
Delete changelog files for 44526

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-14 13:19:22 +01:00
github-actions[bot] d12cc1a770
Delete changelog files based on PR 44318 (#44606)
Delete changelog files for 44318

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-14 11:46:04 +00:00
Alba Rincón 0e1239867a
[CYS] Reduce the width of the "Design your own" text box on the Intro screen (#44546)
* Reduce the `woocommerce-customize-store-banner-content` width to better fit the copy

* Add changelog

* Increase the width to fit the sentence in one line
2024-02-14 11:44:41 +01:00
Justin Palmer 754779e00e
Simplify Customer history calculation (#44318)
* Only show customer history box if WooCommerce Analytics are enabled

* Use requests to /reports/customers endpoint for customer history data

* Don't reinvent the wheel - use customer analytics data for Cust. Hist.

* Remove Customer Order Count from tracks data

* Simplify the customer history process

* Omit Customer history content when adding a new order in wp-admin

* Early return to reduce complexity

Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>

* Simplify matching customers

Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>

* Remove unnecessary method

* Use Customers Query directly to get customer history data

* Template version bump

* Move the customers query to CustomerHistory

* Only show customer history box if WooCommerce Analytics are enabled

* Use requests to /reports/customers endpoint for customer history data

* Don't reinvent the wheel - use customer analytics data for Cust. Hist.

* Remove Customer Order Count from tracks data

* Simplify the customer history process

* Style and legibility fixes

* Template version bump

* Add changelog

* Omit Customer history content when adding a new order in wp-admin

* Early return to reduce complexity

Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>

* Simplify matching customers

Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>

* Remove unnecessary method

* Use Customers Query directly to get customer history data

* Template version bump

* Move the customers query to CustomerHistory

* Match default params

* Simplify Customer Query params (cache key match with API is much harder)

---------

Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>
2024-02-14 11:38:10 +01:00
Albert Juhé Lluveras 13ded5be76
Minor typo and text styling fixes (#44583)
* Fix typos in PHP comments

* Fix styling of tests/README.md

* Other linting fixes

* Add changelog file
2024-02-14 11:13:28 +01:00
Luigi Teschio cb1ae99a77
Core - CYS: fix fonts not loaded on the font picker iframes (#44586)
* Core - CYS: fix fonts not loaded on the font picker iframes

* add changelog

* fix lint error
2024-02-14 10:30:18 +01:00
Alba Rincón 0f198da833
[CYS] Update "Start customizing your store" task description on Core (#44584)
* Update customized store task description on Core

* Add changelog
2024-02-14 09:08:16 +01:00
Alba Rincón da8fee41aa
[CYS] Update the "Change your homepage" description on Core (#44579)
* Update the "Change your homepage" description on Core

* Add changelog
2024-02-14 09:07:55 +01:00
Corey McKrill b2d9d6f118
Logging: Add filter to modify the list of expired logs to be deleted (#44380)
* Logging: Add filter to modify the list of expired logs to be deleted

This provides a way for extensions to ensure that some log files are
retained for a different time period than the normal
retention period setting.

* phpcs cleanup

* Add changelog file

* Add note to settings view when hook has filter on it

Also remove the note about retention days from the log entry that's
generated when expired log files are deleted
2024-02-13 12:42:38 -08:00
Matt Sherman a619aba5ee
Product Editor: load translations (#44520)
* Clarify when the custom message is used in useConfirmUnsavedChanges

* Changelog

* Load translations for wc-navigation and wc-product-editor scripts

* Changelog
2024-02-13 15:38:04 -05:00
Mike Jolley 51a9da9f2c
[Experiment] Additional field extensible sanitisation and validation handling (#44463)
* Fix field saving in account area

* Check for error notices in core form handler

* Tidy up additional field saving in api

* sanitize_additional_fields does not expect request

* Validate fields with extra context

* Revert "Tidy up additional field saving in api"

This reverts commit 872c8f4afb.

* Tidy update_customer_from_request

* validate_field docs

* Validation and sanitization hooks

* Address schema validates fields and address location

* Validate locations

* Frontend validation

* Remove empty error response

* Document account details hook

* field_key

* Improve validation routine

* Changelog

* Swap key and value in woocommerce_blocks_validate_additional_field hook

* woocommerce_blocks_validate_location_X_fields

* Validation and sanitization callbacks

* Update try catch blocks
2024-02-13 19:40:55 +01:00
Mike Jolley cea1c10122
Fix coupon codes containing apostrophes (#40998)
* Use wp_kses_post to sanitize coupon codes

* Fix notice (php 8)

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

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

* Remove duplicate changelog entry

* Try alternative wp_kses function

* Account for unfiltered_html

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2024-02-13 17:01:49 +00:00
Alba Rincón a48e2111b8
[CYS] Add title to the "Product Gallery" pattern (#44556)
* Add title to the "Product Gallery" pattern

* Add changelog
2024-02-13 14:40:49 +01:00
Luigi Teschio 69728b70e9
CYS - Core: catch error when font installation fails (#44559)
* CYS - Core: catch error when font installation fails

* add changelog

* reduce the requests number
2024-02-13 13:15:52 +00:00
Luigi Teschio a2d35b0563
CYS - Core: install fonts only when the tracking is enabled (#44558)
* CYS - Core: install fonts only when the tracking is enabled

* add a parameter to reduce the response payload

* add changelog
2024-02-13 14:03:06 +01:00
Chris Lilitsas 8d5c0dae83
Ensure proper handling of product-related taxonomies in filtering logic (#44230)
* Fix product-related whitelisting in Product Query and Collection blocks

* Fix Product Query Utility

* Remove store-api related fix

* Changelog
2024-02-13 13:59:02 +02:00
Adrian Moldovan e863c02551
[e2e tests] Add tests for managing product images in block editor (#44470) 2024-02-13 01:20:48 +02:00
Karol Manijak 2750e79224
Getting the Product Collection location/context (#43997)
* Early implementation of getting the Product Collection location/context

* Solve the problem of async fetch in the hook

* Improve typing

* Import core data store instead of hardcoding store name

* Recognise Product Category and Product Tag

* Remove attr property from archive location data

* Unify states naming

* Add TODO entry

* Display the info about the location of Product Collection

* Improve the typing

* Recognise if Product Collection is nested in Single Product block

* Improve cases descriptions and add some defaults to potentially undefined values

* Change the taxonomies sourceData

* Recognise Mini Cart as Cart context

* Recognise attribute as archive contect but no taxonomy

* Refactor the function into single useEffect and clean it up

* Fix typo

* Remove unnecessary import

* Stop rendering the output in Editor (it was for demo purposes)

* Pass location data to Product Template query in Editor

* Replace templateSlugs literal strings with object reference

* Rename parseResponse function to more specific name getIdFromResponse

* Add dpeendency array to useEffect

* Refactor templates detection

* Use full taxonomy names instead of shortcuts

* Write down scenarios to test

* Working scenario

* Change the verification way for more robust

* Add more robust methods to include Single Product block

* Add test Product Collection in Single Product block in a Single Product Template

* Imprvoe the order of veryfing the requests

* Fix linter issues. Although that makes code less readable

* Improve the useGetLocation typing so it's more generic

* Rework the E2E tests regarding location of Product Collection and limit their number

* Bring back necessary eslint-disable

* Remove unused imports

* Uncomment line required for other tests

* Add changelog

* Rename constant from BLOCK_NAME to BLOCK_SLUG as it's a slug

* Add a BLOCK_NAME constant and replace the literal block name usages in E2E tests

* Fix post merge issues

* Fix test after merge

* Adjust the tests to kick off waiting for request before action that triggers them
2024-02-12 20:59:40 +01:00
Karol Manijak cc0d7368e9
Add missing Beta label to Product Filters E2E tests (#44564)
* Add missing Beta label to Product Filters E2E tests

* Add changelog
2024-02-12 20:26:19 +01:00
Néstor Soriano 60cc3df264
Fix for the dependency injection container resolution by tag (#44496)
* Fix for the DI container resolution by tag.

This fixes an issue that arises when using service providers inheriting
from AbstractInterfaceServiceProvider: if one of these providers
registers classes both by name and by tag, and one of its registered
classes is requested with 'get' by name before a list of classes is
requested by tag, then that service provider gets locked as the only one
providing that tag, and the others get ignored. This is due to the fact
that container definitions are created "on the fly" as needed and the
base 'get' method won't try to register additional providers if the
requested tag is already provided by at least one of the already
existing definitions.

* Add changelog file

* Add a unit test for the fix
2024-02-12 10:21:51 -08:00
Luigi Teschio 79ff29138c
CYS - Core: fix fonts not loaded after the setup (#44550)
* CYS - Core: fix fonts not loaded after the setup

* add changelog
2024-02-12 18:33:19 +01:00
Luigi Teschio 3919b8361d
CYS - Core: Add async font installation (#44473)
* CYS - Core: Ensure that the bodoni font is loaded

* CYS-Core: install fonts via async job

* ensure that the font are installed only when the Font Library is installed

* improve documentation and validation

* add changelog

* remove unused class

* remove not necessary changes

* improve documentation

* improving naming

* improve documentation

* fix PHP linter

* fix phpdoc comment
2024-02-12 16:23:21 +00:00
Luigi Teschio 738a57fe98
Core - CYS: fix inter font not applied (#44544)
* Core - CYS: fix inter font not applied

* remove logs

* add changelog
2024-02-12 14:09:04 +00:00
Sam Seay 143388dae8
[Experimental] Add (Beta) suffix to block name of new filter blocks (#44487) 2024-02-12 11:15:49 +00:00
Manish Menaria 4ae60196ea
Product Collection: Make attributes available in rest_product_query hook (#44150)
* Make attributes available in rest_product_query hook

This commit introduces the 'includeInQueryContext' attribute to the 'woocommerce/product-collection' block and updates the 'woocommerce/product-template' block to consume this new attribute.

Key Changes:
1. `woocommerce/product-collection` Block:
   - A new attribute 'includeInQueryContext' is added in `block.json`. This attribute is designed to hold a list of attribute names relevant for the query context.
   - The 'includeInQueryContext' attribute is included in the `providesContext` field to ensure its availability to child blocks.
   - In `constants.ts`, default values for 'includeInQueryContext' are defined, specifying 'collection' and 'id' as initial attributes.
   - The `types.ts` file is updated with a comment explaining the purpose of 'includeInQueryContext'.

2. `woocommerce/product-template` Block:
   - Modified `block.json` to utilize the 'includeInQueryContext' context provided by the parent `woocommerce/product-collection` block.
   - The `edit.tsx` file is updated to handle the new context. It uses a newly added utility function `useProductCollectionBlockAttributes` from `utils.tsx` to access parent block attributes.
   - The `utils.tsx` file is introduced, containing the `useProductCollectionBlockAttributes` hook. This hook is responsible for finding the parent 'woocommerce/product-collection' block and returning its attributes.
   - Within `edit.tsx`, logic is added to create a query context object based on the attributes specified in 'includeInQueryContext', enhancing the block's ability to dynamically adapt to changes.

* Remove commented code

* Rename query context attribute and optimize parent block detection

This commit introduces two significant changes aimed at improving code readability and efficiency.

1. **Renaming of Query Context Attribute:**
   - The attribute `includeInQueryContext` has been renamed to `queryContextIncludes` across various files, including block JSON configurations and TypeScript definitions. This change makes the attribute's purpose more intuitive, indicating it specifies which attributes to include in the query context.

2. **Optimized Parent Block Detection:**
   - Replaced the use of `getBlockParents` with `getBlockParentsByBlockName` in utility functions to find the closest Product Collection block. This optimization allows for a more direct and efficient way to identify the relevant parent block by specifying the block name, reducing unnecessary iterations and improving code performance.

* Streamline query context construction in product template

Key Changes:
- **Introduction of `useProductCollectionQueryContext` Hook:** This new hook takes the `clientId` and `queryContextIncludes` as inputs and returns a query context object. It encapsulates the logic for fetching parent product collection block attributes and constructing the query context accordingly. This abstraction simplifies the edit component's logic, focusing on the essentials and improving code readability.
- **Optimization of Parent Block Detection:** The hook uses `getBlockParentsByBlockName` to accurately and efficiently find the closest parent `Product Collection` block, minimizing the overhead previously associated with traversing the block hierarchy.

* Always include `collection` and `id` in query context

* Minor refactor

* Enhance query context handling for more maintainable code

- Introduced `DEFAULT_QUERY_CONTEXT_ATTRIBUTES` in `edit.tsx` to maintain a clear list of default query context attributes.
- Modified `ProductTemplateEdit` to automatically include these default attributes in `queryContextIncludes`, ensuring they are always part of the query context without manual initialization.
- Simplified `useProductCollectionQueryContext` in `utils.tsx` by removing static initialization of 'collection' and 'id', relying instead on the dynamic addition of necessary attributes from `queryContextIncludes`.

This refactor enhances the maintainability and clarity of the code, ensuring a solid foundation for future enhancements and features.

* Add E2E tests for Product Collection query context

- Added a new test suite 'Query Context in Editor' to validate the correctness of query context parameters when the Product Collection block is used. This suite ensures that:
  - For the 'Product Catalog', only the ID is sent in the query context, confirming that collection-specific parameters are excluded when not relevant.
  - For collections such as 'On Sale', the collection name is correctly passed in the query context, validating that the block dynamically adjusts query parameters based on its settings.

- Introduced a new utility method `setupAndFetchQueryContextURL` in `product-collection.page.ts`. This method automates the setup of a post with the Product Collection block and fetches the URL with query context parameters, facilitating the validation of query context handling.

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

* Fix edge case when `queryContextIncludes` is not defined

- Initializing `queryContextIncludes` with a default empty array directly in the destructuring assignment of the component's props. This approach ensures that `queryContextIncludes` is always an array, simplifying downstream logic.
- Creating a new constant `queryContextIncludesWithDefaults` to hold the combination of `queryContextIncludes` and `DEFAULT_QUERY_CONTEXT_ATTRIBUTES`. This step avoids directly mutating the `queryContextIncludes` prop, aligning with best practices for functional purity and making the code easier to understand and debug.
- Updating the `useProductCollectionQueryContext` hook call to use `queryContextIncludesWithDefaults`. This ensures that the default query context attributes are consistently included without altering the original prop.

These adjustments not only enhance the code's maintainability but also ensure more predictable behavior by avoiding side effects related to parameter mutation.

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-12 14:15:24 +05:30
Karol Manijak 96f3e3c98b
Remove global pageObject action from Product Collection tests and add it as before each for specific tests (#44407)
* Remove global pageObject action from Product Collection tests and add it as before all for specific tests

* Replace beforeAll with beforeEach

* Adjust the beforeEach usage

* Add changelog

* Refresh locators when adding Single Product block as it's not initialised in pageObject

* Change method dedicated to templates to one dedicated to posts
2024-02-12 09:44:02 +01:00
Alba Rincón 7f8b1e201c
[CYS] Ensure the font family for buttons match the one assigned for the content, not the title (#44458)
* Fix select font for buttons

* Add changelog
2024-02-12 09:25:36 +01:00
github-actions[bot] cd43dd1116
Delete changelog files based on PR 44494 (#44534)
Delete changelog files for 44494

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-12 10:11:14 +08:00
kevinbates abc6993678
Update woocommerce.php (#44527)
* Update woocommerce.php

* Add changelog file
2024-02-09 17:27:18 -08:00
kevinbates 578f711730
Update readme.txt (#44526)
* Update readme.txt

Removing Woo Express section
Correcting eCommerce -> ecommerce

* Add changelog file
2024-02-09 17:26:57 -08:00
Fernando Marichal 30f66aa94f
[Product editor block]: Rename the Add button to Publish (#44461)
* Rename Publish button

* Fix e2e tests

* Add changelog

* Add WC changelog

* Modify "Product published" copy
2024-02-09 15:19:35 -03:00
Albert Juhé Lluveras 2f5eaa1f4c
BlockTemplateUtils cleanup (#44256)
* Remove 'get_block_template' backwards compatibility check

* Add back get_block_template as a deprecated function

* Deprecate BlockTemplateUtils::filter_block_templates_by_feature_flag()

* Replace 'default template' with 'fallback template'

* Only load BlockTemplatesController in block themes

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

* Remove unnecessary WP version comparison

* Revert "Only load BlockTemplatesController in block themes"

This reverts commit 8e1ed347d61b7ae5e8b8b96fa73b410565570f01.

* Remove deprecated functions, as they are marked as internal

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-09 18:50:08 +01:00
nigeljamesstevenson c8f8299f02
Remove WooCommerce Blocks entry from the WooCommerce status page (#44412)
* Remove WooCommerce Blocks entry from the WooCommerce status page

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-09 17:44:14 +00:00
Alexandre Lara 7ec1b7f3a1
Product Gallery block: Add logic to trap keyboard focus within the Product Gallery Pop-Up (#44439)
* Add logic to trap keyboard focus inside the Product Gallery Pop-Up

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

* Remove unnecessary condition

* Fix issue with keyboard focus trap not working within the Pop-Up

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-09 13:43:51 -03:00
Bartosz Budzanowski 8eea9f77ff
Update marketplace suggestion wording. (#44494)
* Update description wording for Marketplace Suggestions, Show Suggestions setting.

* Add changelog file.

* Update tests.
2024-02-09 15:37:39 +00:00
Hicham Boushaba a903aa8633
Revert the override of the Jetpack data endpoint (#44390)
Revert PR #38987
2024-02-09 07:22:51 -08:00
Álvaro Thomas accbf30da5
[e2e] Can Edit and Delete Product Review (#44411)
* Update product-review

Add test to edit a product review and another test to delete it

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

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

* Added test data in fixture and changelog extra line

Change test data use from constants at the top to test data created in a fixture for each test. Also, added extra line to the changelog file.

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

* Update changelog

Fixed mixed lines on previous commit.

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

* Update plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js

Remove edited timestamp

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>

* Update plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js

Update hover action to review id.

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>

* Update plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js

Change Quick Edit button to reach review identifier

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>

* Update plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js

Replace updated review check to single line assert

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>

* Update plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js

Hover to edit on review identifier

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>

* Update plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js

Point to trash a review to its identifier.

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>

* Update plugins/woocommerce/tests/e2e-pw/tests/merchant/product-reviews.spec.js

Point to trash a review to its identifier.

Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>

* Added Review Edit test

Added Review Edit test apart from Quick Edit test. Included assertions to verify that the review has been edited and can be seen both in the reviews list and the shop's page.

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
2024-02-09 16:12:16 +01:00
Alexandre Lara 74c6fcad2d
Product Gallery block > Pop-Up: Fix overlay sizing issue (#44479)
* Fix overlay issue when Product Gallery Pop-Up is open

* Fix stylelint error

* Add changelog

* Fix e2e tests for Product Gallery Pop-Up
2024-02-09 11:38:41 -03:00
Luigi Teschio b91762be69
CYS - Core: Ensure that the Bodoni font is loaded (#44464)
* CYS - Core: Ensure that the bodoni font is loaded

* add changelog
2024-02-09 15:13:38 +01:00
Corey McKrill 1af675e502
Logging: Add check for file key when parsing backtrace (#44486)
Ensures that no undefined index warnings are thrown while parsing
the backtrace to determine a log's source.

Fixes #44475
2024-02-09 18:06:50 +05:30
Albert Juhé Lluveras 1905534fb8
Improve password-protected Single Product block template to verify correct template is displayed after correct password is introduced (#44452)
* Improve password-protected Single Product block template to verify correct template is displayed after correct password is introduced

* Add changelog entry
2024-02-09 10:53:27 +01:00
Karol Manijak db082421ad
Product Collection: fix assymmetrical padding in Editor (#44403)
* Import editor.scss styles of Product Templayte and increase specificity

* Add changelog

* Add ts ignore

* Revert changing eslint-disable as it conficts with another rule creating more errors
2024-02-09 09:42:29 +01:00
Albert Juhé Lluveras f65a7e45a5
Fix e2e tests due to duplicate rows when clearing customizations (#44454)
* Fix e2e tests due to duplicate rows when clearing customizations

* Add changelog entry
2024-02-08 23:15:11 +01:00
Christopher Allford 8b4efc9c03
Added Missing Blocks Linting Change Trigger (#44233)
* Added Missing LInting Changes

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

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-02-08 13:48:03 -08:00
Fernando Marichal a89d2572f0
Product Editor: Subsection block (#43725)
* Add SubsectionInterface

* Replace use of add_section inside sections

* Add Subsection class

* Add subsection block component

* Add subsection-description block

* Update deprecation note

* Add changelogs

* Fix lint

* Add get_subsection_by_id

* Add tests

* Fix ProductFormTemplate lint

* Fix CustomProductFormTemplateTest lint

* fix readme

* Fix lint

* Replace add_section with add_subsection

* Fix readme

* Fix markdown file multiple headings duplication
2024-02-08 15:44:49 -03:00
Vedanshu Jain 4daa3f31f1
Build path info directly instead of loading REST API. (#44080)
* Build path directly instead of directly loading REST API.

* Add changelog.

* Make shapes of routes array consistent with whats returned in API.

* Add doc comment.

* Fix missing slash typo

* Make linter happy.

* Add doc block for filter.

* Short hydration logic to use controller directly.

* Rename _get_path to get_path_regex for accuracy and lint.

* Restore nonce check bypass for internal hydration requests.

* Restore cache notice check to allow controllers to start from clean slate.

* Update since tag.
2024-02-08 16:36:21 +00:00
Luigi Teschio abdf0c3f8a
CYS - Core: ensure that the the default font pair and color pair are selected (#44309)
* CYS - Core: ensure that the default font and color are selected

* remove console.log

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

* add comment

* add changelog

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-08 15:08:38 +00:00
Mike Jolley 509ac4ffd7
Fix deprecation notices for legacy order item keys. (#44362)
* Declare legacy variables to prevent PHP notices

* changelog
2024-02-08 12:51:34 +00:00
Alba Rincón 5af5f9b235
[CYS on Core] Ensure the size of fonts is not affected by the font family changes (#44424)
* Fix fonts affecting the size of each other

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

* Remove log

* Removae old typography settings before applying new ones

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-08 13:38:20 +01:00
Jonathan Lane d15bd09c39
Update daily workflow to sharding (#44330)
Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-02-08 11:45:03 +02:00
Albert Juhé Lluveras e0f4ed8509
Add automated tests to verify specific product block templates are rendered (#44363)
* Add automated tests to verify specific product templates are rendered

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-08 10:18:33 +01:00
Chris Lilitsas 60c17eb126
Include the selected collection in the product collection block context (#43247)
* Include collection attribute in the block context

* add 'collection' to useContext for Product Template

* Changelog

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
2024-02-08 10:55:05 +02:00
Adrian Moldovan 035eb2dade
[e2e tests] Add new tests for up-sells and cross-sells (#44154)
* Add tests skeleton

* Add up-sell test

* Add changelog

* Add test for cross-sells

* Renamed spec file

* Add tests for remove up-sells and remove cross-sells

* Update the viewport

* Extract the update product action into a function

* Fix the expect for up-sells

* Add a poll mechanism when checking that up-sells were removed.

* * Use backspace to remove linked items

* Add a check for up-sells before removing them to prevent a false negative result

* Uncomment cleanup code

* Revert viewport height
2024-02-07 14:28:56 -08:00
Alexandre Lara f7b92e8b6b
Product Gallery block: Focus should return to trigger element when closing pop-up (#44414)
* Return focus to trigger element when closing pop-up

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

* Fix php cs error

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-07 17:18:41 -03:00
Fernando Marichal 19a78cd176
Add pre-publish sidebar (#44331)
* Add prepublish sidebar

* Add openPrepublishSidebar to store

* Add changelog

* Rename modal and small refactor

* Add feature flag

* Move prepublish sidebar

* change import path

* Rename classes

* Fix width

* Fix styles

* Rename prepublish panel

* Rename div class

* Remove onSuccess from PublishButton

* Fix panel position

* Use actions instead of sidebar

* Add wc-admin changelog

* Move changelog

* Fix lint
2024-02-07 15:30:33 -03:00
Adrian Moldovan 2628a52385
[e2e tests] New tests for product edit in block editor (#44272)
* Add new test with a product name edit

* Add changelog

* Update price and description

* Check product summary update

* Remove unnecessary interpolation
2024-02-07 09:46:19 -04:00
Néstor Soriano f730e4edb7
Simplify the applied coupon data that gets stored as line item meta (#44113)
Previously, a 'coupon_data' line item meta entru was being stored
when a coupon was applied to an order. Now a much shorter
'coupon_reapply_info' entry is stored instead, containing just
coupon id, code, discount type, amount, and whether the coupon
grants free shipping.
2024-02-07 12:23:23 +01:00
Veljko V 28bfa5465f
Improve existing E2E shopper product description & images test (#44365)
* Improve existing simple product test

* Add missing changelog
2024-02-07 11:33:18 +01:00
Karol Manijak 67dda736d4
Improve flaky Product Collection E2E test when nested in Single Product block (#44404)
* Improve Product Collection test when nested in Single Product block, previous version was flakyu

* Add changelog

* Move the priovate method below the comment starting private methods

* Remove unnecessary wait
2024-02-07 07:53:48 +01:00
Alexandre Lara 0654fa1997
Product Gallery block: Announce Pop-Up Opening with Voiceovers (#44332)
* Add aria attributes to product gallery pop-up

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

* Fix Interactivity API store import

* Announce Dialog opening with VoiceOver

* fix php cs lint error

* Remove unnecessary data-wc-watch directive from Product Gallery block

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-06 14:28:33 -03:00
Mike Jolley 45923dc5f3
[Experiment] Handle customer session meta data (#44181)
* Update data store to bail if there is no customer ID

* Use WC_Data meta functions

* Save and load meta in session class

* Customer session handling

* CheckoutFields - only persist customer data to accounts

* Inline docs for session handling

* Handle meta data in session

* Document wc->customer inline

* Store only additional fields in session

* Prevent notice in WC_Data

* Organise keys and remove duplicates

* Correctly save fields to account

* Fix notices on checkout

* Remove unnecessary diff

* Changelog

* Go back to previous way to loading session handler to avoid 3rd party breakage

* No need to track is_session

* white space

* Remove changes to customer data store

* Update class-wc-customer-data-store.php

* Populate client from additional values from api

* Additional fields in session

* Add woocommerce_customer_allowed_session_meta_keys hook

* Put back legacy keys for tests

* Remove key fixes

* Don't save additional fields to customer object

* Remove duplicate init call

* Only persist contact fields
2024-02-06 15:16:00 +00:00
Alba Rincón fa9d68eed6
[CYS] Fix - Add back parent machine to the `designWithNoAiStateMachineDefinition` child machine option (#44397)
* Add back parent machine to the designWithoutAi child machine option

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-06 14:28:22 +01:00
github-actions[bot] e373a69209
Delete changelog files based on PR 43834 (#44399)
Delete changelog files for 43834

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-06 20:33:57 +08:00
Albert Juhé Lluveras fa9d42be4f
Add template title and description on 'get_block_template' hook (#44254)
* Simplify add template title and description

* Add template title and description on 'get_block_template' hook. Fixes #42221

* Add tests

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

* Fix test in template parts

* Use BlockTemplateUtils::template_has_title when possible

* Add test also when saving the default WooCommerce template

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-06 13:33:38 +01:00
Alexandre Lara b4928ed46a
Product Gallery block: Enable keyboard navigation for thumbnails (#44236)
* Add ability to select thumbnails using keyboard

* Add ability to open the Product Gallery pop up using the keyboard

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

* Fix outline border not showing on Thumbnails on some browsers

* Prevent firefox browser from focusing on UL tag of the Large Image block

* Enable usage of 'Space' and 'NumpadEnter' keys to navigate between the thumbnails

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-06 08:55:03 -03:00
github-actions[bot] a0980a1178
Delete changelog files based on PR 44359 (#44396)
Delete changelog files for 44359

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-06 19:52:11 +08:00
Mike Jolley 35630bb52b
Update combobox validation message to be more generic (#44229)
* Update combobox validation message

* Changelog
2024-02-06 11:51:09 +00:00
Luigi Teschio 159d47434b
[CYS - Core] Before installing the fonts, ensure that the font library is available (#44358)
* Avoid duplicating the `/onboarding/themes/recommended` request

* Use `fetchActiveThemeHasMods` in the `fetchIntroData` function

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

* WIP

* WIP

* WIP

* WIP

* Move the `activeThemeHasMods` to outside the `intro` key, since it's used also in other places

Refactor, add comments and cleanup

* Remove unnecessary log

* Set the `activeThemeHasMods` on the parent window to true after the design step to avoid having to fetch it again

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

* Remove unused import

* Add comment and ref to the new issue

* CYS - Core: fix flow when Font Library is not installed

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

* improve naming

---------

Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-02-06 11:28:26 +01:00
Sam Seay 5f00e2f87a
[Experimental] Add e2e tests for the rating filter block (#44192) 2024-02-06 23:22:21 +13:00
Christopher Allford a90b044e73
Updated PNPM Lock File (#44382)
* Updated Lock File

* Add changefile(s) from automation for the following project(s): woo-ai

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-06 09:33:58 +00:00
Alexandre Lara 560f0e933d
Product Gallery block: Prevent block error when a user inputs a decimal number for the Number of Thumbnails setting (#44282)
* fix error on decimal input for the Number of Thumbnails setting

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-05 15:17:35 -03:00
github-actions[bot] b764167f11
Delete changelog files based on PR 44283 (#44368)
Delete changelog files for 44283

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-06 00:44:36 +08:00
Mike Jolley fa01e1b541
[Experimental] Add option to `show_in_order_confirmation` for additional checkout fields (#44314)
* Improve readability of register_checkout_field

* show_in_order_confirmation

* changelog
2024-02-05 16:19:34 +00:00
Justin Palmer cd7f429bc1
Remove Customer Order Count from Order Attribution checkout data (#44359)
* Remove Customer Order Count from Checkout Tracks data
2024-02-05 16:06:49 +01:00
Alba Rincón a943de24fa
[CYS] Avoid duplicating requests during the CYS flow (#44179)
* Avoid duplicating the `/onboarding/themes/recommended` request

* Use `fetchActiveThemeHasMods` in the `fetchIntroData` function

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

* WIP

* WIP

* WIP

* WIP

* Move the `activeThemeHasMods` to outside the `intro` key, since it's used also in other places

Refactor, add comments and cleanup

* Remove unnecessary log

* Set the `activeThemeHasMods` on the parent window to true after the design step to avoid having to fetch it again

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

* Remove unused import

* Add comment and ref to the new issue

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2024-02-05 12:36:33 +01:00
Mike Jolley d858d22930
[Experimental] Surface custom fields in My Account pages (#43823)
* Get default attributes on front end

* Remove console log

* Show notice about 0 registered fields in editor

* Do not show block in editor if no fields are registered

* Wrapper block

* Update webpack config

* Wrapper block type definition

* Separate fields from the hook block

* Hide when no custom fields exist

* Address and contact fields

* Shared form fields in settings

* Revert render_content to original

* Allow definition of unchecked value which includes a hidden field

* Move woocommerce_edit_account_form above password section, which should be last.

* My Account hooks

* Move account handling to service class

* Show fields in order details

* Remove unused prop

* remove comment

* Hook docblocks

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

* Add note about nonce verification

* wp_kses_post for label

* fix nonce linting

* Add docblock to hook

* Bump template version

* Persist contact fields to customer

* Change action name

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

* Changelog

* Margin fix on order confirmation for older core themes

* Bump version tags

---------

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-02-05 10:59:17 +00:00
Thomas Roberts 877a16096c
Update notice templates display logic to show updated templates in block themes only (#44283)
* WIP

* Add e2e tests for regular and custom templates

* Allow theme *.zip files for testing purposes

* Bump template versions

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

* Update comments in bash script

* Remove child themes - they will be installed from the zip

* Fix lint error re spacing

* Bump template versions

* Update PHP unit tests for classic style notices

* Revert "Remove child themes - they will be installed from the zip"

This reverts commit 98b1036616.

* Remove classic cart check in test

* Revert "Add e2e tests for regular and custom templates"

This reverts commit ef531854f9.

* Revert test-related changes

* Remove report

* Prevent phpcs warning for not escaped output

It is escaped in the wc_get_notice_data_attr function

* Revert notice changes to core E2E tests

* Update shopper add to cart e2e test to use correct notice class

* Update checkout block E2E test to use correct notice class

* Fix typo

* Update test to check for correct notice classes

* Update notice comment

* Re-apply block template overrides

* Consistent notice check with other templates

---------

Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: github-actions <github-actions@github.com>
2024-02-05 11:50:15 +01:00
Albert Juhé Lluveras 097bd5c8f5
Add e2e tests for password-protected Single Product block template (#44304)
* Add e2e tests for password-protected Single Product block template

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

* Fix tests

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-05 10:47:18 +01:00
Sam Seay 497d4b8a25
Remove class scoping and just use text to find elements (#44289) 2024-02-05 14:27:54 +13:00
Hsing-yu Flowers 24ea7a1848
Move the guest should verify email logic to the order class (#43834)
* Move the guest should verify email logic to the order class

* Refactor for readability and remove redundant code

* Use billing email variable

* Remove white space

* Rename and move email_is_valid to users utils

* Use global WC_DateTime and WC_Session classes

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-02 18:03:07 -08:00
Damián Suárez f1236696d9
[Product Block Editor]: use Textarea block in the variation description field (#44151)
* use text-area for variation desctiption field

* changelog

* tweak // Translators string

* use var to define textarea border color

* remove optional from description label
2024-02-02 15:50:36 -04:00
Jonathan Lane f93dcc292c
Misc e2e test fixes (#44325)
* Change local workers to 1

* Add helpers for adding shipping

* Add shipping zone before order

* Fix tax assertion

* Fix assertion

* Tightened up locators

* Dismiss tour if visible

* Back to function

* Update tax label

* Enable shipping

* Update locator

* Changelog

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-02-02 10:17:32 -08:00
Thomas Roberts 8ac959f4e7
[Experimental] Prevent string-based sanitization on non-string field types in additional checkout fields (#43999)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-02 10:16:02 -08:00
Luigi Teschio 5937b3dec1
CYS - Core: Font Library: disable the installation of the fonts (#44311)
* avoid crash when Gutenberg is not installed

* add issue link

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-02 16:34:33 +01:00
Álvaro Thomas 5fd4176ad0
[e2e tests] Check email for completed order (#44186)
* Add completed order email test

Add test structure to verify completed order email arrival and content

* Verify Email JSON Content

Parse email content in JSON format

* Record email content in JSON

Record email content in JSON

* Update emails completed order checks

Added checks to verify the content of completed order's emails

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

* Update email content const & remove duplicated test

Updated with a new const to record email content const and removed duplicated assertion.

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-02 16:13:16 +01:00
Maikel Perez eaa791f7da
Hide Downloads section under Toggle for product variations (#44152)
* Create DownloadableProductTrait for common downloadable blocks creation

* Use DownloadableProductTrait in SimpleProductTemplate

* Use DownloadableProductTrait in ProductVariationTemplate

* Remeber downloadable files in product variations

* Add changelog file

* Fix php linter error

* Unlink downloads and downloadable product props so they can be managed separately

* Remove invalid margin bottom from the uploader label

* Add changelog file
2024-02-02 10:04:42 -03:00
github-actions[bot] f383284ba6
Delete changelog files based on PR 44207 (#44302)
Delete changelog files for 44207

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-02 12:31:53 +01:00
github-actions[bot] 11daa0d5ee
Delete changelog files based on PR 44178 (#44300)
Delete changelog files for 44178

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-02 11:45:54 +01:00
github-actions[bot] d7a294cb32
Delete changelog files based on PR 44174 (#44293)
Delete changelog files for 44174

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-02-02 09:58:46 +01:00
Jorge A. Torres ececdf0c1b
Add background HPOS cleanup process (#43293)
* Make legacy data cleanup more performant

* Add legacy data cleanup processor

* Make legacy cleanup available in the UI

* Add some validation around data synchronizer / data cleanup settings

* Add some error handling

* Add changelog

* Make CI happy

* Improve option handling

* Add unit tests

* Partially revert “real time” cleanup

* Re-schedule cleanup on ‘shutdown’ if necessary

* Revert CSS changes for HPOS settings screen

* Revert JS changes for HPOS settings screen

* Allow tools to display a status text

* Move order cleanup to Tools

* PHPCS fixes

* Extend bail early protection to other batch processing functions

* Log and stop cleanup when a full batch fails

* Make PHPCS happy
2024-02-02 12:09:08 +05:30
Manish Menaria 1d8007b822
Product Collection: Return to top after page change (#43817)
* Initial working version

* Update scrolling behavior in product collection block frontend

This commit updates the scrolling behavior in the product collection block's frontend script.

Previously, the code focused on the first anchor or button within a product collection block. This approach was taken to maintain accessibility and ensure that the focused element was scrolled into view. However, this behavior has been changed to improve the user experience.

The updated code now directly scrolls to the first product in the collection. This is achieved by selecting the product using a new selector that targets the `.wc-block-product` class within the `.wc-block-product-template` of the specified `data-wc-navigation-id`. Once the product is selected, the `scrollIntoView` method is used with smooth behavior and start block alignment, offering a more visually appealing scroll effect.

This change enhances the user experience by smoothly directing attention to the beginning of the product collection, making it easier for users to browse products.

* Remove code related to animation

* Fix the issue related to pagination block rendering

- I have improved the code by breaking it into smaller functions
- Added unique `data-wc-key` to each anchor tag

* Enhance Product Collection Block with Interactive Prefetching

* Refine Prefetch Logic & other improvements

This commit further refines the prefetch logic and interactivity in the Product Collection block. It focuses on enhancing code clarity and improving the prefetch behavior based on user interactions.

Key changes include:
1. Renamed 'isPrefetchNextAndPreviousLink' to 'isPrefetchNextOrPreviousLink' in ProductCollectionStoreContext for better readability and accuracy.
2. Modified the scrollToFirstProductIfNotVisible function to accept a wcNavigationId as a parameter instead of a reference
3. Introduced checks for the existence of wcNavigationId in scrollToFirstProductIfNotVisible to prevent unnecessary executions.
4. Updated comments throughout frontend.tsx for enhanced clarity, explaining the prefetch logic and its triggers in detail.
5. Adjusted the logic in the navigate and prefetch functions to align with the new context structure and prefetch strategy.
6. In ProductCollection.php, updated data attributes to align with the revised prefetch strategy.
7. Refined the attribute setting in process_pagination_links function to correctly implement the updated interactivity and prefetch logic.

These changes aim to optimize the prefetch functionality, reduce unnecessary prefetching on initial page load, and ensure a smoother and more efficient navigation experience within the Product Collection block.

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

* Improve comments

* Use wp_json_encode for data-wc-interactive attribute

This commit updates the `ProductCollection` class to use `wp_json_encode` for setting the `data-wc-interactive` attribute value. Previously, the attribute value was hardcoded as a JSON string. Now, by utilizing `wp_json_encode`, we ensure the JSON encoding is handled correctly by WordPress standards, enhancing readability and maintainability of the code.

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-02 12:07:29 +05:30
Sam Seay 6da45f6bed
[Experimental] Add e2e tests for the new active filter block (#44190) 2024-02-02 15:08:01 +13:00
Barry Hughes ded33b7049
Update JS Cookie library to v3.0.5. (#43686) 2024-02-01 11:36:12 -08:00
Luigi Teschio ae1503f588
CYS - AI flow: fix regression - no fonts visible (#44280)
* CYS - AI flow: fix regression - no fonts visible

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

* Trigger Build

* fix lint error

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-01 18:44:28 +00:00
Luigi Teschio e0972ef6ea
[WIP] CYS - Core: add integration with the font library (#44004)
* CYS - Core: add integration with the font library

* install font only when necessary

* refactor logic

* add try catch

* renaming font

* refactor some code

* refactor some logic

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

* remove not used import

* avoid mutability

* improve performance

* update name variable

* fix naming

* fix endpoints after font collection rest controller improvements

* use promise.all into the map

* improve performance

* fix lint error

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-01 17:16:12 +00:00
Karol Manijak 84f2de633d
Fix incorrect product data displayed in Product Collection in context of Single Product block (#44123)
* Initial approach to fix incorrect product data displayed in Product Collection in context of Single Product block

* Remove the BlockCOntextProvider

* Add Block context for title and summary

* Add changelog

* Improve typing

* Add E2E test with Product Collection inside Single Product block

* Improve insertBLock function description

* Make productPrices selector in Product Collectionmore specific

* Extract components props into a types
2024-02-01 17:55:38 +01:00
Maikel Perez 861cc7cc02
Add common options to the variations options empty state (#44001)
* Always show Variation options and Variations sections within the Variations tab

* Remove woocommerce/product-variations-fields block since it's not needed anymore

* Create ProductTShirt image for variation options empty state

* Add renderCustomEmptyState to the attribute control component to be able to set a not default empty state

* Render a custom empty state for variation options

* Adds defaultSearch prop to NewAttributeModal so it can be used to start searching right after the modal is shown

* Let the empty state adds an attribute that matches a given text

* Add changelog files

* Fix linter errors
2024-02-01 11:18:23 -03:00
Luigi Teschio 42a2d00cba
CYS - Core - Check the Font Library availability (#44206)
* Ensure that the Font Library is available

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

* fix iframe issue

* improve comment

* don't return any object

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-01 11:30:50 +00:00
Thomas Roberts 1130380f73
[Experimental] Allow Additional Information block to be moved but not removed (#44193)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-01 02:58:05 -08:00
Thomas Roberts 77d2dd9453
Make combobox suggestions have same border as main input (#44183)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-01 02:57:57 -08:00
Albert Juhé Lluveras d936e4afee
Merge Checkout Header and Mini-Cart template parts tests into parameterized test files (#44176)
* Rename block template customization test files

* Move Checkout Header template part tests to parameterized tests

* Make it so 'userText' in tests is different in each template, so prevent false positives

* Move Mini-Cart template part tests to parameterized tests

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

* Make sure there are products in cart before going to the Checkout template

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-01 11:43:33 +01:00
Vedanshu Jain 4c0f7605b3
Fix refund props not updating properly with HPOS (#44214) 2024-02-01 11:38:17 +01:00
Alfredo Sumaran 9bb7cd7b8b
Apply Rector suggestions for PHP 8.1 (#41482)
* Apply Rector suggestions

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

* Restore false positive

$missing_tables will always be an array

* Restore false positive.

Rector issue: AddDefaultValueForUndefinedVariableRector.

This time the early return is valid so there’s no need to move the $process_limit assignment to the top.

* Ask if $orders is an array

$orders is used as an array lines below. Add `is_array` just in case the “paginate” param is used which would change $orders to an object.

* Check if variable is array

Simplifies variable check given that they are used as an array lines below.

* Restore code as taxes is always an array

* Restore false positive

In the previous loop the $data variable is being built as an array of arrays. Then $value in this loop will allways be array.

* Restore false positive

get_children’s method. of a WC_Product instance will always return an array.

* Simplify variable check

Ask if varialbe is array since it only can be array or false.

* Restore false positive

WC_Blocks_Utils::get_blocks_from_page() will always return an array.

* Restore false positive

There’s a check asking if $existing_meta_data[ $meta_data->key ] is array.

* Restore false positive

$child_ids will always be an array.

* Restore false positives

WC_Product->get_visible_children() will always return an array.

* Restore false positives

WC_Product->get_children() will always return an array.

* Restore false positive

WC_Product->get_visible_children() will always return an array.

* Restore false positive

WC_Order->get_items() will always return an array.

* Restore false positive

The get_matching_rates private method will always return an array.

Updated the @return declaration to be an array instead of boolean.

* Remove unnecessary array type casting.

* Restore false positive

$this->get_children() will always return an array.

* Fix lint issues

* Remove unnecessary default assignment

* Remove unnecessary is_array check

* Remove unnecessary is_array check

* Remove unnecessary is_array check

* Change default value from null to false

* Remove unnecessary is_array check

* Update changelog entry

* Update changelog entry

* Update changelog entry

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

* Update changelog entry

* Use self for consistency

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-02-01 10:06:12 +00:00
Christopher Allford 7f556d07b2
Removed Unnecessary `@woocommerce/plugin-woocommerce` Asset Copy Caching (#44234) 2024-01-31 16:12:00 -08:00
Jonathan Lane 9c00c2676b
Improve flaky e2e tests (#44208)
* Fix flaky guest checkout tests

* Removed a couple of extra assertions (not needed)

* Enable payment gateway

* Add changelog

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-01-31 10:08:11 -08:00
Veljko V 7c4dca8348
Rename and move test Cart & Checkout Tax Calculation out of isolation and update some locators to use getBy (#44115)
* Move test out of isolation and update it

* Add changelog file
2024-01-31 08:31:33 -08:00