Commit Graph

19759 Commits

Author SHA1 Message Date
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
Adrian Moldovan 62101246ca
[e2e tests] Add downloadable product test (#44112) 2024-01-31 17:51:14 +02:00
Karol Manijak a164c8afa9
Fix CI Lint errors (#44228)
* Fix linter issues

* Add changelog
2024-01-31 16:12:30 +01:00
Cem Ünalan f2b77b1ada
Marketplace: Fix the bug hiding connection warning (#44207)
* Marketplace: Fix the bug hiding connection hiding

Actually, this bug causes all modal state to be lost. But since we
check the connection only when the page loads, on a subsequent tries, we can 't show the connection warning.

* Marketplace: update documentation and typos

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-31 12:50:47 +03:00
Paulo Arromba 1e815751ab
Fix/31582 special characters in password on checkout page lead to not working account (#43777)
* Fix registration during checkout

* Added changelog.

* Moved changelog.

* Added correct spacing

* Move password slashing into WC_Checkout:get_posted_data()

* Lint fix
2024-01-31 09:36:58 +00:00
Niels Lange c704ae2cab
Migrate coupon- and shipping-related tests to Playwright (#44108)
* Migrate coupon- and shipping-related tests

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

* Fix prettier issue

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-31 01:23:09 -08:00
Jonathan Lane c96f68e88d
Adds tests to monitor number of JS files included in pages (#44046)
* Adds tests to monitor number of JS files included in pages

* Changelog

* Update file counts

* Changed assertion to LTE

* Revise file counts

* Update numbers

* Increased numbers

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-01-30 14:23:33 -08:00
Thomas Roberts d0b0c4c90b
Set `$plain_text` to false in new email addresses hook (#44178)
Co-authored-by: github-actions <github-actions@github.com>
2024-01-30 10:00:19 -08:00
Mike Jolley 610022150e
Change specificity of date picker rules (#44174)
* Change specificity of date picker rules

* changelog
2024-01-30 17:06:05 +00:00
Luigi Teschio 336abf7a73
Store API - Documentation: Fix broken link (#44180)
* Store API: fix link documentation

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

* fix lint error

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-30 14:23:28 +01:00
Sam Seay 08d5cc05aa
[Experimental] Fix a bug where new attribute filter block flickers in editor. (#44147) 2024-01-31 01:10:12 +13:00
github-actions[bot] 9eff44945a
Prep trunk for 8.7 cycle (#44056)
Prep trunk for 8.7 cycle with version bump to 8.7.0-dev

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
2024-01-30 12:40:10 +01:00
Alba Rincón 1045948487
Update the CYS intro modal copy on Core (#44081)
* Update the CYS intro modal copy on Core

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-30 09:58:51 +01:00
Alba Rincón 595cdeadb0
Create a dedicated survey and tracking events for the CYS flow on core (#43862)
* Create a dedicated survey and tracking events for the CYS flow on core

* Update booleans to show button and survey

* Remove console log

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

* Style required question asterisk and make the questions required

* Fix lint error

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-30 09:58:05 +01:00
Alba Rincón 4ad6b41026
Fix ai status missing on CYS transitional page (#44121)
* Fetch the ai status on the transitional page of the CYS flow

* Only check AI status on WooExpress

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-30 09:54:16 +01:00
Albert Juhé Lluveras 3df7da4bd2
Add theme-customization e2e tests to Cart, Checkout and Order Confirmation templates (#43794)
* Add theme-customization e2e tests to Cart and Checkout templates

* Add theme-customization e2e tests to Order Confirmation template

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

* Update after rebase

* Make it so Order Confirmation template tests are also part of the parameterized tests

* Use CUSTOMIZABLE_WC_TEMPLATES constant instead of defining the templates again

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

* Fix wrong template slug

* Rename 'default' to 'fallback' template

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-30 09:44:42 +01:00
Ilyas Foo 6dd96b3e14
Fix beta test plugin deprecated creation dynamic property (#44109)
* Add plugin_name declaration

* Changelog
2024-01-30 16:12:02 +08:00
Chi-Hsuan Huang 6832a4b249
Update onboarding task documentation & add back `example` command (#44026) 2024-01-30 12:05:46 +08:00