* Filter out patterns with external dependencies
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix test
* Remove excluding patterns by id
* Bring back url
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add the `format` property to the items of the `rows` array in Analytics' Leaderboards API response to indicate how it's formatted.
* Make the `Leaderboard` component within Analytics aware of the currency context and format the numeric columns accordingly.
* Avoid a warning from the test of `Leaderboard` component when running JS tests.
File: client/analytics/components/leaderboard/test/index.js
Ref: https://github.com/woocommerce/woocommerce/blob/9.0.2/packages/js/components/src/pagination/pagination.tsx#L44
* Apply better practice to the test of `Leaderboard` component.
File: client/analytics/components/leaderboard/test/index.js
* Add changelog.
* Make the `Leaderboard` component not create a new function for every `row` rendering.
Address: https://github.com/woocommerce/woocommerce/pull/49097#discussion_r1667009910
* Remove portal and use inline popup
* Allow selecting existing values through , or ENTER
* Add help to taxonomy block
* Provide help attribute to taxonomy block
* Add changelogs
* Remove help text
* Add help text and a11y instructions
* Try to fix unit test
* Add changelog
* Fix E2E test
* Allow navigating up from first list item into the input
* Add scenario for single selection as well
* CYS: Fix color button
* Add colors to the just arrived full hero button
* Add changefile(s) from automation for the following project(s): woocommerce
* fix just arrived full hero on sidebar
* improving name
* reorganize code
* Fix lint errors
---------
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
* Remove `__experimentalLayout` from Product Template block
This commit removes `__experimentalLayout` from Product Template block. This is because we don't want to use `layout` from Gutenberg for now. This change fixes the alignment of the first item in Grid layout.
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Fix linting errors in SCSS file
---------
Co-authored-by: github-actions <github-actions@github.com>
* Expose registerProductCollection in @woocommerce/blocks-registry Package
This commit exposes the `registerProductCollection` function as part of the `@woocommerce/blocks-registry` package. This enhancement facilitates the registration of new product collections by 3PDs, promoting better modularity and extensibility within the WooCommerce Blocks ecosystem.
Changes include:
- Migration of `register-product-collection.tsx` to `packages/checkout/blocks-registry`.
- Export `registerProductCollection` from `@woocommerce/blocks-registry/index.ts`.
- Updated related imports and references to the new path.
This update enables 3PDs to register product collections more seamlessly, enhancing the extensibility of Product Collection block.
* Replace @woocommerce/blocks-checkout with @woocommerce/blocks-registry
* Add __experimental prefix
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Improve registerproductcollection for 3pds
* Set isDefault value to false
* Don't export all the types
* Update changelog
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Add plugin to test __experimentalRegisterProductCollection
* Add E2E tests
* Fix Lint errors
* Improve E2E tests for __experimentalRegisterProductCollection
- Reduced preview timeout from 2000ms to 1000ms.
- Expanded E2E tests to cover new attributes and preview functionalities.
* Refactor code to improve readability and maintainability
- Added a warning comment to indicate that `__experimentalRegisterProductCollection` is an experimental API.
- Refactored variable names and imports in `register-product-collection.tsx` and `index.tsx` for clarity.
- Simplified and reorganized type definitions and imports in `types.ts` and `utils.tsx`.
- Renamed function in `register-product-collection-tester.php` for consistency.
* E2E: Also test the Frontend
* Use alias for import statement
* Don't pass isActive to registerProductCollection
Now it's handle by registerProductCollection itself.
* Update registerproductcollection API structure
Refactored the product collection block to enhance attribute management and ensure consistency in query defaults. This change includes:
- Importing `DEFAULT_QUERY` from constants and using it to set default query attributes.
- Removing `DEFAULT_ATTRIBUTES` from specific collections and directly defining required attributes.
- Ensuring `postType` and `isProductCollectionBlock` are set to default values in the query object.
- Setting `inherit` attribute to `false` by default in all collections.
* Hide inherit control in collections
Ensure the "inherit" control is always hidden, as collections should not be able to change this attribute. This includes:
- Adding `CoreFilterNames.INHERIT` to the `hideControls` set in `register-product-collection.tsx`.
- Adjusting the `hideControls` attribute in individual collection files to remove redundant hiding of the `INHERIT` control.
* Fix: Filters not showing in inspector controls
* Set inherit to false for all collections
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Product Collection: Add validation for `__experimentalRegisterProductCollection` arguments (#48513)
* Add validation for `__experimentalRegisterProductCollection` arguments
Introduced comprehensive validation for the `ProductCollectionConfig` object in `__experimentalRegisterProductCollection` to ensure correct data types and values, enhancing error handling and robustness.
- Added a new function `isValidProductCollectionConfig` to perform various checks on the `ProductCollectionConfig` object.
- Validates properties such as `name`, `title`, `description`, `category`, `keywords`, `icon`, `isDefault`, `innerBlocks`, `example`, `scope`, `isActive`, `attributes`, and `preview`.
- Ensures correct data types and provides detailed console error messages for invalid configurations.
- Updated `__experimentalRegisterProductCollection` to use the validation function before proceeding with the registration process.
**Impact**
- Improves stability and prevents invalid configurations from causing runtime errors.
- Provides clearer error messages for developers, aiding in quicker debugging and development.
* Fix typo
* Refactor: Replace console.error with console.warn
Updated the error logging in the isValidProductCollectionConfig function to use console.warn instead of console.error for invalid configuration properties. This address the feedback from the PR review.
- Replaced console.error with console.warn for various validation checks in isValidProductCollectionConfig.
- Removed redundant return statements after console.warn calls.
- Improved logging messages to better inform about invalid configuration properties without treating them as critical errors.
- Simplified the logic in __experimentalRegisterProductCollection by combining query and attribute properties and ensuring defaults are set properly.
* Refactor: Rename isValidProductCollectionConfig to isValidCollectionConfig
Updated the function name from isValidProductCollectionConfig to isValidCollectionConfig for better clarity and consistency. Also, renamed related variables for improved readability.
* Add validation for name property
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Title is required for new collection
* Update comments
* Fix E2E tests
* Address PR feedback
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add README file for __experimentalRegisterProductCollection
* Add screenshots in README file
* Try to fix lint issue
* Docs: add example for collection with inner blocks
Enhanced the documentation for `__experimentalRegisterProductCollection` to include an example demonstrating how to define a collection with inner blocks. This example shows how to create a custom collection with nested blocks, including a heading and product elements, providing a clear guide for developers.
New content added:
- Example 4: Collection with inner blocks
- Sample code for defining a collection with inner blocks
- Tips and links to further resources on inner blocks and core collection definitions
* Fix Lint errors
* Address PR feedback
* Reduce number of JS files on /shop page
**Problem:** There was increase in number of JS files on /shop page after exposing `registerProductCollection` function in `@woocommerce/blocks-registry` package. This package is loaded on the frontend. For example, previously 45 JS files were loaded on /shop page but now 55 JS files are loaded on /shop page.
**Solution:**
1. After a bit of debugging I found out that constant file which we are importing i.e. `plugins/woocommerce-blocks/assets/js/blocks/product-collection/constants.ts` contain some heavy dependencies & it's not pure. Therefore, I decided to split this file into two files. I moved all the constants that are used in `registerProductCollection` function to a new file i.e. `plugins/woocommerce-blocks/assets/js/blocks/product-collection/constants-register-product-collection.ts`. This way, we don't need to load all the constants on the frontend i.e. /shop page.
- This reduced 4 JS files i.e. 51 JS files are loaded on /shop page.
2. After some more investigation, I found out that importing `registerBlockVariation` function is increasing number of JS files on Frontend. Therefore, I decided to use global `wp` object to call `registerBlockVariation` function. This way, we don't need to import it. This reduced last 6 files i.e. 45 JS files are loaded on /shop page.
This way, I was able to reduce number of JS files on /shop page from 55 to 45, which is same as before this PR.
* Refactor: product collection constants
- Moved constants from `constants-register-product-collection.ts` to `constants.ts`
- Deleted `constants-register-product-collection.ts`
- Updated import paths in relevant files to reflect the changes
- Moved utility functions to `utils.ts`
---------
Co-authored-by: github-actions <github-actions@github.com>
* Parse global context
* Refactor the util to only parse global context, provide the location context to collection children
* cleanup
* Cleanup
* Add changelog
* Make linters happy
* provide context to each inner block recursively
* Fix linters
* Remove debug
* Update plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Rename the provider method
* Fix typo on cart item products
* Use the query context instead
* Lint
* Lint again
* Minor change on docs
* Polish
* Cleanup
---------
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* CYS: fix: Assembler follows admin color schema
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Remove not default patterns
* Add margins
* Include woocommerce patterns from PTK
* Add changefile(s) from automation for the following project(s): woocommerce
* Bring back some patterns
* Bring back footer and headers
* Update snapshots after updating margins
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add the Featured Category Cover Image to Intro category
* Add missing patterns to their categories for the assembler
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Only load product editor styles on WC admin pages
* Manually load interface styles to exclude fullscreen styles
* Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Replace customer account block icon in headers used in the assembler
* Add changefile(s) from automation for the following project(s): woocommerce
* Change icons style for injected blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Include the dotcom reviews patterns
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Make some titles bold on cys patterns
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: fix shuffle feature
* improve types and add comment
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Use createRoot().render() instead of render()
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Remove “ReactDOM.render is no longer supported” checks
* Add “ReactDOM.render is no longer supported” checks again
* Adjust JS unit tests
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: fix not template set correctly
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
This PR is the second attempt to speed up monorepo installation by removing autoloading optimization setting from the configuration and performing the optimization where it is appropriate (composer post-install hooks and when building releases).
In the installation context, the composer post-install hook will execute a background task to dump the optimized autoloading, while the installation process completes other tasks.
In this PR we ar relocating playwright downloads caching into the monorepo action (behind input parameter). That consolidates monorepo-related caching and also reduces the time fetching the cache action in external workflows.
* CYS: fix default intro pattern
* Add changefile(s) from automation for the following project(s): woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Update Revert button text and description
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Add (Classic) as suffix instead of prefix
* Button text should be in center
* Fix: Button text isn't in center
---------
Co-authored-by: github-actions <github-actions@github.com>
* Check if parent order exists
* Add tests for order reports with orphaned refunds
* Add changefile(s) from automation for the following project(s): woocommerce
* Update phpdocs test
* Add method is_valid_order
---------
Co-authored-by: github-actions <github-actions@github.com>
* Move `check_should_use_blockified_product_grid_templates` to `wc-template-functions.php`
* add changelog entry
* alias Blocks/Options as BlocksOptions
* Init `BlockTemplatesController` for block themes only
* Remove the `wc_current_theme_is_fse_theme()` check from BTC
* Streamline the option update logic a tad
* Revert "Streamline the option update logic a tad"
This reverts commit 54a965d9784df253f82533991e03c1112fd386ef.
* init BTC for themes that support block template parts
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* init BTC for themes that support block template parts, p.2
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* move the check to a new OptionsManager class
* make types consistent
* add classic theme with block template parts support
* tmp: add logs for debugging
* Initialize BlockTemplatesController on init
* Remove debugging code
* Prevent duplicate template parts appearing in the Site Editor in classic themes that support template parts
* Update e2e tests for classic themes that support template parts
* Fix Checkout header not being rendered
* Fix PHP tests
* Simplify WC_BLOCK_USE_BLOCKIFIED_PRODUCT_GRID_BLOCK_AS_TEMPLATE logic
* Rename OptionsManager class to TemplateOptions
* Change format of inline comment
* Use wc()->is_store_api_request()
* Update plugins/woocommerce/src/Blocks/TemplateOptions.php
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
* Update testing theme slugs
* Add strict_types to TemplateOptions file
* Refactor check_should_use_blockified_product_grid_templates()
* Don't update 'wc_blocks_use_blockified_product_grid_block_as_template' when switching between block themes
* Add extra unit test to make sure the option is not updated when switching between block themes
* Update strict_types format
* Remove unnecessary theme switch after tests finish running
* Replace .toHaveCount( 0 ) with .toBeHidden() in several tests
* Create a TestUtils to abstract logic to open Mini-Cart block
* Remove unnecessary import
* Replace .toHaveCount( 0 ) with .toBeHidden() in several tests (II)
---------
Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
* CYS: improve copy no blocks placeholder
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: fix toolbar position
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Update Fiverr CTA to reflect latest update in Figma.
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* remove not necessary patterns
* use always template1 for AI flow
* show default patterns homepage
* Add changefile(s) from automation for the following project(s): woocommerce
* remove not used images
* restore changes
* fix e2e test
* fix e2e test
* restore necessary patterns
* add necessary patterns
* add default patterns
* add default pattern
* update tests
* fix logic
* rename images
* Add changefile(s) from automation for the following project(s): woocommerce
* restore deleted patterns
* exclude tt4 patterns
* update image
* update default intro pattern
* not use i18n function
* fix how patterns label are translated
* order patterns in the sidebar
* fix unit test
* simplify function
* Fetch patterns from the private dotcom patterns
* Add changefile(s) from automation for the following project(s): woocommerce
* exclude some default patterns
* fix lint error
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Add accessibility attributes to form login
* Add accessibility attributes to lost password form
* Add accessibility attributes to reset password form
* Bump form login templates
* Add accessibility attributes to register form
* Update login forms with aria-required attribute
* Hide asterisk for screen readers in the register form
* Add changelog file
* Fix for tags overlapping divider line issue in "Filter by product category"
Issue fixed where tags are overlapping divider line in "Filter by product category".
* Fix for tags overlapping divider line issue in "Filter by product category"
Issue fixed where tags are overlapping divider line in "Filter by product category".
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Fetch patterns from the private dotcom patterns
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Avoid the intro cards to get smaller on large screens
* Add changefile(s) from automation for the following project(s): woocommerce
* Add flex wrap
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: open Intro panel when user clicks on Design your homepage
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Reword and reorganise existing account settings
* Disable account creation options if toggled off
* Toggle disabled state of related options
* Update settings crud tests
* changelog
* Hide based on subscriptions checkbox also
* fix doc. improve doc
* disabe `Add` button when not terms nor options
* variant="primary" > isPrimary
* move helpers to utils file. improve jsdoc
* add tests for hasTermsOrOptions helper
* add isAttributeFilledOut unit tests
* changelog
* allow any type in unit tests
* show a toolip with not possible to add attributes
* fix wrong inline code comment
* expect the Add button is initially disabled
* check the `Add attributes` button is enabled
* changelog
* remove obvios jsdoc
* check all terms are accepted
* minor changes
* update tests
* remove console.log to dev purpose
* improve E2E testing remviing attr row
* Add a new icon style to the Customer Account block
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Fix lint errors
* Improve svg margins
---------
Co-authored-by: github-actions <github-actions@github.com>
* Modify Product Filters block to use block variations
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Add dynamic blocks icon and title
* Make Attribute Filter block title dynamic
* Add E2E tests for the Product Filters block
* Remove unnecessary block attribute
* Improve clarity of the comment text
* Add new icons for individual filters
* Dynamically set the title and heading of the block based on the selected attribute
* Add E2E test to check for block title and heading change on selecting an attribute
* Replace custom block variation type by BlockVariation type from @wordpress/blocks
* Replace variation `isActive` function by an array of strings
* Fix heading for each individual filter
* Add a default attribute name when there is no attributes registered in the store
* Fix i18n strings
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: make the entire shuffle section clickable
* Add changefile(s) from automation for the following project(s): woocommerce
* fix import
---------
Co-authored-by: github-actions <github-actions@github.com>
This PR drops composer autoloader optimization for the WooCommerce plugin to speed up the build process. The autoloader still gets optimized in `plugins/woocommerce/bin/build-zip.sh` file.
* CYS: Improve Block Toolbar logic
* CYS: no highlight pattern when it is added
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Tooling: cache pnp deps
* Tooling: try fixing cache errors
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: try to parallelize js builds a bit
* Tooling: added pre-build steps to solve concurrency issues
* Tooling: limit workers
* Tooling: revert to original build command
* Tooling: playwright related tweaks
* Tooling: minor tweaks.
* Tooling: fix caching path.
* Tooling: trigger php builds to test deps caching.
* Tooling: trigger php builds to test deps caching.
* Tooling: lock caching to monorepo setup, so it doesn't slow down build steps.
* Tooling: lock Playwright cache to build, as build is pre-requisite for running tests.
* Tooling: added caching build-folders.
* Tooling: added caching build-folders.
* Tooling: added caching build-folders.
* Revert "Tooling: added caching build-folders."
This reverts commit c57b9dff13.
* Tooling: added caching build-folders.
* Tooling: cleanup sweep.
* Tooling: cleanup sweep.
* Tooling: added a changelog entry.
* Tooling: cleanup.
* Tooling: try speedup live branches build.
* Tooling: try speedup live branches build.
* Tooling: cleanup.
* Tooling: try speedup live branches build.
* Tooling: try speedup live branches build.
* Prevent "woocommerce_new_order" from being triggered on orders with "checkout-draft" status
* Add changefile(s) from automation for the following project(s): woocommerce
* Prevent "woocommerce_new_order" from being triggered on orders with "checkout-draft" status
* Add changefile(s) from automation for the following project(s): woocommerce
* Added ´checkout-draft´ to the list of previous status triggering a new order action for order creation
* Add changefile(s) from automation for the following project(s): @woocommerce/components, woocommerce-blocks, woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
* Added "draft" status on Order creation in HPOS to prevent triggering the new order hook
* Do not fire "woocommerce_new_order" on order creation in CPT that is still in one of the draft statuses.
* Fire "woocommerce_new_order" on order status change from one of the draft statuses, on par with CPT logic
* Removed unnecessary line (duplicate of L2607).
* Updated changelog.
* Add changefile(s) from automation for the following project(s): woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
* Updated comment
* Move data fetch to right before it is needed.
* Reverted moved line, as the $previous_state needs to be get first thing.
* Add changefile(s) from automation for the following project(s): woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
* Changelog change
* Add changefile(s) from automation for the following project(s): woocommerce
* Changelog change
* Unit tests for creating draft orders without triggering new order hook
* Linting
* Unit tests update
* Removed unnecessary draft status from tests
---------
Co-authored-by: github-actions <github-actions@github.com>
* Prevent REST API access to variation product's that don't match the parent product_id
* Rework checks
* Update unit tests
* Add changelog
* Apply suggestions from code review
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
---------
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
* Fix: Show preview label only when Product Collection block is selected
Updated the `ProductCollectionContent` component to display the preview label only when the Product Collection block itself is selected. Previously, the preview label was shown when either the block or any of its inner blocks were selected.
Key Changes:
- Removed the `isSelectedOrInnerBlockSelected` constant and its logic.
- Updated the condition to use `props.isSelected` directly to determine if the block is selected.
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Update E2E tests
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS: fix flickering effect
* Add changefile(s) from automation for the following project(s): woocommerce
* not use hook
---------
Co-authored-by: github-actions <github-actions@github.com>