* Make hover status style like active
* Add changelog file
* Update changelog message
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
---------
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* Expose buttonAttributes to the express payment methods
* Add size and label attributes to the express checkout area
* Remove defaultHeight
* default button Label
* Remove the button label attribute
* Remove px from height
* Change large button height to 55px
* Load express checkout block with attributes
* Add toggle and borderRadius controls and remove getting border radius from the theme
* Remove extra border radius text
* Only pass buttonAttributes if toggled on
* Move express payment block attribute logic into a Provider
* Tidy up editor grid and parse attributes into context on frontend
* Add px to border-radius input
* Express payment methods not selectable
* Add a test
* lint fixes
* default button height is 48 not 4
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Update docs
* Add tests for express payment methods
* Center images within the express payment area in the editor
* Apply the buttonAttributes to the li container in the editor regardless of showButtonStyles
* Fix style issue
* fix linting
* fix lint again
* Update manifest
* Update docs manifest
* Resize images in editor
* lint fix
---------
Co-authored-by: github-actions <github-actions@github.com>
* Avoid registering block in the wrong context
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Format json
* Get title and description from the registered block
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Add empty array dep
---------
Co-authored-by: github-actions <github-actions@github.com>
* Dispatch JS event about PC being rendered
* Revert format changes
* Write the callback
* Add functions descriptions
* Add changelog
* Remove empty line
* Add tests
* Rename test cases
* Replace waiting for page load with more reliable expect.poll
* Remove leftover step
Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>
* Fix typo in function name
* Add collection name to default Product Collection block
* Expect collection name in the event
* Expose the collection name through IAPI context
* Send the collection name with the event
* Trigger event also on page change
* Remove unused CUSTOM collection type
* Provide documentation
* Update TOC
* Update tests that verify the event payload
* Improve E2E tests further
* Don't add a Product Catalog collection type to default collection
* Avoid repeating the same piece of code by extracting some function on tag processor
* Rename function to better depict its purpose
* Move the documentation to the right place
* Remove the unused variable
* Add example to dom-events doc
* Update documentation
* Update docs manifest
* Attach default collection name
* Add the default collection context in PHP so it covers all the cases
* Prevent exposing product catalog collection name in event
* Update docs
* Update test
---------
Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>
* wp-env: Update package dependency + add mysqlPort
Starting in v10.1.0, wp-env can take a `mysqlPort` property in both
`env.development` and `env.tests` objects, which allows you to specify
the database connection port. This port is otherwise randomly assigned
every time you start up the containers. This allows for having a more
consistent development environment.
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai
* Further update to pnpm lock file
* Extract the checkbox list option logic into its own component
This allows to generate a dynamic id per option so it never repeats in the entire document.
* Add changelog file
* Move CheckboxListOptionControl to its own file
* Add value to the checkbox control to be aligned with the native input type=checkbox element. And also use it to get the correct checkbox by value in unit tests
* Because checkboxes not longer have fixed ids, now we use their value to lookup for them instead
* Updating snapshots since the checkboxes ids are now autogenerated
* Update "Learn More" docs link for incompatible extensions
* Update links to blocks documentation
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Remove Unnecessary changelog message
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Delete unneeded changelog file
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* update: new simplified markup and style
* add: editor preview
* add: show 15 items initially
* fix: render li class for checked items
* chore: naming
* chore: changelog
* update: set some preview items checked for styling purpose
* fix: only show show more button when the list is long
* chore: lint
* fix: e2e tests
* Customer Account - Maintain the size of the icon in smaller screens
* Hide overflow text
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Compatibility Layer: fix 'woocommerce_before_single_product_summary' hook position
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Remove active shipping zones check for displaying shipping calculator
- Remove active shipping zones check for displaying shipping calculator on Cart Page
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Update 920.md
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* move checkout docs with front matter to main folder (#49186)
* move checkout docs with front matter to main folder
---------
Co-authored-by: Jacklyn Biggin <hi@jacklyn.dev>
* initial commit to reapply changes from PR #49186
* update html tags to unicode and clean up hashlinks
* revert unicode
* remove emoji
* update manifest
* test readme page
* remove avail-filters since it is now redundant with the readme
* update links
* test htmlentity
* pdate links
* typo fix
* update readme with actual doc
* fix links
---------
Co-authored-by: Jacklyn Biggin <hi@jacklyn.dev>
* Allow registering custom collections with various context references
Implemented the registration of product collections with different context references using the `usesReference` property. These custom collections are now registered with specific contexts such as product, cart, order, and archive.
This enhancement allows for more tailored previews and functionality based on the specific context in which the product collection is used.
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Support multiple references for usesReference
* docs: update documentation to include `usesReference`
Enhanced the `register-product-collection` documentation to include details about the new `usesReference` property. This property allows collections to specify required references, enhancing their contextual relevance and preview capabilities.
- Added `usesReference` description to the collection fields section.
- Included examples demonstrating the usage of `usesReference` with single and multiple references.
- Clarified the behavior when required references are unavailable on the editor side but available on the frontend.
This documentation update provides third-party developers with the necessary information to utilize the `usesReference` property effectively in their custom product collections.
* test: add e2e tests for `usesReference`
Added end-to-end tests to verify the functionality of the `usesReference` property in product collections. These tests ensure that the appropriate preview labels are displayed.
- Created multiple custom product collections with different `usesReference` values: `product`, `cart`, `order`, `archive`, and combinations of these.
- Verified that collections show the correct preview label when the required reference is present.
- Ensured that the preview label is not shown in irrelevant contexts, such as posts or product catalog templates.
This addition enhances test coverage and ensures the robustness of the `usesReference` feature.
* Fixed issue with preview label showing in Specific Product and Archive templates.
* Handle cases when termId or productId is 0
This also improves the readability of the code by using better variable names.
* Make PC use postId context so location can be recognised correctly (#50152)
* Fix TS errors
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
* express checkout buttons have a min-width of 240px
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Fix linting issue
---------
Co-authored-by: github-actions <github-actions@github.com>
* Modify Product Filters Overlay template part
* Add changefile(s) from automation for the following project(s): woocommerce
* Add E2E tests for the Product Filters Overlay template part
---------
Co-authored-by: github-actions <github-actions@github.com>
* Recognize custom category templates as archive ones
* Disable the preview label if termId is recognized
* Fetch the product category template ID
* Prepare util to properly parse product taxonomies
* Utilise the taxonomies util and update the query accordingly
* Add tests
* Update tests to be more specific
* Improve selectors in E2E test
* Add changelog
* Update selectors
* Fix the order of expected products
* Remove unneceessery entries from array that are covered by another entries
* Rename the variable to beytter depict its purpose
* Add validation and empty value to select components
* address feedback
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* remove console log
* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/additional-checkout-fields.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/additional-checkout-fields.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* remove test
* Fix tests
* also move select to parent
* fix tests
* add empty enum to schema
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Use createRoot().render() instead of render()
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Replace `unmountComponentAtNode()` with `createRoot().unmount()`
* Adjust JS unit tests
* Remove obsolete import
* Remove “ReactDOM.render is no longer supported” check
* Update pnpm-lock.yaml
* Migrate JS unit test to React 18
* Revert "Update pnpm-lock.yaml"
This reverts commit 18bfc967aa.
* Migrate JS unit test to React 18
* Migrate JS unit test to React 18
* Minor refactor
* Unskip previously skipped tests
* Fix JS unit test error related to root.unmount()
* Remove obsolete dependency
* Fix failing blocks e2e test
* Fix failing core e2e tests
* Optimise memoisation to prevent “Maximum update depth exceeded” error.
* Fix Filters JS tests in #48796 (#49973)
* Run cleanup in Rating Filter JS tests
* Run cleanup and wait user interactions in Stock Status Filter JS tests
* Rename constant
* Simplify conditional statement
* Introduce TS type
* Address lint error
* Rename TS type
* Optimise multiple TS types
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Sam Seay <samueljseay@gmail.com>
Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
* add: new inspector controls
* update: cleanup the edit component
* chore: remove unused old inspector component
* tweak: add formatting to help text
as Jarek said:
> Here’s the copy. Please mind the formatting.
* add: default attribute id that closest to 30
* update: pass the whole attribute object
* update: use default attribute term in Product Filters template
* add: style settings
* add: sorting and show empty behavior in the editor preview
* tweak: use hideEmpty to align with existing settings
* chore: changelog
* test: add basic e2e tests
* chore: restore previous default value
* add: attribute help text and border support
* chore: lint
* fix: add missing context
* Add Product Filters template part
* Improve Product Filters template part description
* Hide Product Filters block from the inserter
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Add E2E tests
* Fix lint error
* Fix lint error
* add: register variation for unmodified template part
We should move this to abstract class later.
* Fix lint error
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* WIP
* Add empty option for state as well
* Add client-side validation to country select inputs
* Add validation messages for state.
* Clean up redundant destructuring.
* Fix up the validation logic, fix bug where empty select was shown in some cases.
* Remove unused import
* Use import aliases instead of large relative paths
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Fix a typo
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* use SelectOption type
* Also handle when address changes, because we shouldnt validate state when there is an address change
* adjust validation to handle any address change, not just country. translate field validations and use lowercase
* add a lowercase label for the country select as well
* Fix an issue where scroll to would not scroll to invalid select
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Add syncWithFilters attribute to Product Collection
* Add SycnWithFilters Inspector Control to PC
* Minor import adjustments
* Move the controls to Inherit as they share the same labels
* Rename the attirbute to filterable
* Hide control for collections
* Consume the filterable
* Consume filterable attribute so it enables the filtering
* Bring back file format
* Bring back filterable
* Move filterable from attribute to query
* Improve checks
* Fix incorrent function name
* Add changelog
* Set the default filterable value on insert
* Update test selector
* Add E2E tests to #49627 (#49715)
* Remove unnecessary call to create new post
* Fix "Use page context" control tests
* Fix post ↔ template collection sync test
* Fix non-thenable linter errors
* Extend the "Use page context" default setting test
* Add test for filtering in non-archive context
* Add test for combining editor and front-end filters
* Fix lint
* Update plugins/woocommerce-blocks/assets/js/blocks/product-collection/edit/inspector-controls/inherit-query-control.tsx
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Improve query properties access
* Rename inherit-query-control to use-page-context-control to better depict its purpose
* Lint fix
---------
Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Fix tip block syntax in register-product-collection.md
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Field height and label text size adjustments
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Kepe initial height of child element
---------
Co-authored-by: github-actions <github-actions@github.com>
* Spacing adjustments for coupon code
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
In this PR, we are consolidating babel-loader caching and adding Jest caching, improving build/testing times locally and in CI. The improvement comes from cache covering transpile steps in the mentioned processes.
* Inherit the color of the star
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Move icons to @woocommerce/icons package
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Add overlay settings
* Tweak icon size slider
* Add overlay template part link
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Fix scss linting
* Fix php linting
* Remove preview
* Rename setting props to be more clear
* Remove unused import
* Update plugins/woocommerce-blocks/assets/js/blocks/product-filters/editor.scss
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Update plugins/woocommerce-blocks/assets/js/blocks/product-filters/edit.tsx
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Update plugins/woocommerce-blocks/assets/js/blocks/product-filters/types.ts
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Update plugins/woocommerce-blocks/assets/js/blocks/product-filters/edit.tsx
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Move experimental controls to last of list
* Improve typescript code
* Remove unneeded constructor code
* Extract icons into own component
* Moved overlay template part link to the bottom
* Add apply button
* Hide overlay settings when in always mode
* Remove overlay template part from list and put into general area
* Update api version to 3
* Update plugins/woocommerce-blocks/assets/js/icons/library/filter.tsx
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
* Update plugins/woocommerce-blocks/assets/js/icons/library/filter-three-lines.tsx
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
* Fix overlay button link style and clickable
* Remove edit overlay link from never mode
* Add e2e tests for the filters overlay settings
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
* Replace the customer account line logo
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Prevent individual filters from being able to drag outside of parent wrapper
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Update edit address button style
* Add input prop to the ValidatedTextInputHandle type
* Add optional isEditing prop to the AddressFormProps
* Convert edit address link to button
* Focus first input after opening the address form
* Pass along the editing prop to children components in the shipping address block
* Add changelog file
* Clear timeout used to delay the focus on the first input
* Adjust checkout toggler buttons for dark themes
* Get first address field by id
* Fix regression of #48180
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
* Fix one more bug in the dropdown styling (#49585)
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Sam Seay <samueljseay@gmail.com>
* Add validation message and fix rendering when account is required
* Adjust validation so we can change the label in messages with custom callback
* Add and style password meter
* Add validation feedback and zxcvbn support
* changelog
* Accessibility fixes
* Update lock file
* Fix initial state in safari
* Announce strength as you type
* Use React.ReactElement
* update lock file
* Update lock
* Downgrade local pnpm and recreate lock
* Feedback should only be shown when `showError` is true, not `hasError`
* Feedback should default to null
* Add site title to account checkbox
* Add customer_password support to Store API
* Hide password nag if defining own password
* Add woocommerce_registration_generate_password option to block assets
* Change login prompt to just "log in"
* Add default styling to password inputs
* Reset line height for checkbox inputs
* Add customer password to store
* Add password field to contact information block
* Handle customer password in checkout processor
* Styling for new elements
* Update tests so they match new create account label
* Update log in link in tests
* Add e2e tests for password field
* Add validation message and fix rendering when account is required
* Changelog
* Add missing api to tests
* Remove console log
* rerender checkout
* Update log in link in test
* Adjust validation so we can change the label in messages with custom callback
* Use queryByText in test
* Make sure password generation is on in tests
* Create password if provided password is empty
* Skip "Place order" button translation test
* Revert "Skip "Place order" button translation test"
This reverts commit 7aed6137e88cdb3577f74f6f0c05258b531ed534.
* Update plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-contact-information-block/block.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update plugins/woocommerce-blocks/assets/js/data/checkout/reducers.ts
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Comment empty condition
* Update CSS classnames
* Return null in CreateAccountUI if nothing to display
* Linting: Return return param
* Document $password param
---------
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update the customer icon for the line style
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Import Circle and Path and fix attribute case
---------
Co-authored-by: github-actions <github-actions@github.com>
* Export pre-formatted SITE_CURRENCY object from settings
* Fallback to SITE_CURRENCY
* Changelog
* Fix typedef
* Update mocks
* Inject site currency into cart preview data
* Update test
* Add currency formatting to preview data
* Mock currency in tests
* More currency mocking
* move checkout docs with front matter to main folder
* add manifest
* add core changelog
* Remove emojis, unsupported links and table of contents
* pr comments
* update folder name and remove toc
* title fix
---------
Co-authored-by: Jacklyn Biggin <hi@jacklyn.dev>
* Render an aria-label for the initial mini cart html
* FIx mini-cart items not visible when zoomed in
* Add changelog
* Fix linting issues
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Kick the GH actions
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* delete duplicate changelog file
* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce
* Delete plugins/woocommerce/changelog/48384-fix-43639-zoom-mini-cart
---------
Co-authored-by: github-actions <github-actions@github.com>
* Updated Collection Selection Buttons
Rather than using normal buttons we're going to replace these with cards
that we want to use instead.
* Reworked Product Catalog Creation
* Added Dropdown Collection Option
* Changelog
* Added Collection Dashicon Support
* Fixed Collection Change Modal
This is going to get replaced soon but it may as well look nicer than it
does right now.
* Type Fix
* Fixed `:focus` Hover Border
* Simplified Click Handler
* Style Fixes
* Gutenberg Style Fixes
* E2E Fixes
* Fixed E2E Test
* Added Dropdown Inserter E2E Support
* Logging
* Fixed Default Insertion Options
* Prevent Premature Rendering
* E2E Fix Attempt
* Lint Fix
* E2E Fix
* Fix test chaking if custom registred collections are available in the collection chooser
* Improve logic of choosing collection to cover both dropdown and placeholder
---------
Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.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>
* 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>
* 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>