Commit Graph

64475 Commits

Author SHA1 Message Date
Néstor Soriano f1399c9d77
Fix the namespace of the RestApiControllerBase class (#49333)
* Fix the namespace of the RestApiControllerBase class

* Add changelog file
2024-07-10 13:10:03 +01:00
github-actions[bot] de9664f922
Prepare Packages for Release (#49334)
Co-authored-by: opr <opr@users.noreply.github.com>
2024-07-10 12:34:32 +01:00
Thomas Roberts b94fd1127d
Register block in PHP and Add default opt in text when saving example block in `@woocommerce/extend-cart-checkout-block` (#48581) 2024-07-10 12:07:02 +01:00
Sam Seay eaf57e9f15
Create a separate bundle for cart and checkout (#48010) 2024-07-10 21:23:17 +12:00
Adrian Moldovan a862dab4f7
Disable Metrics job in CI (#49328) 2024-07-10 11:12:23 +03:00
Alba Rincón fb421397be
CYS - Bring back footer and header borders on hover and selected patterns (#49299)
* Bring back footer and header borders on hover and selected patterns

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

* Fix the selected pattern color

* Fix lint errors

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 09:14:23 +02:00
Alba Rincón 620fd4efed
CYS - Update delete button copy to `Delete` (#49295)
* Update delete button copy to match Dotcom

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 09:13:55 +02:00
Alba Rincón c000a074be
CYS - Fix the intro cards size to match the designs (#49297)
* Fix the intro cards to match the designs

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 09:13:41 +02:00
Matt Sherman 2957458bac
Product Editor Dev Tools: Improved expression evaluation tooling (#48588)
* Refactor to extract ExpressionField

* Move styling of expression and result prefixes to CSS

* Layout expression field with grid

* Add buttons to expression field

* Enter edit mode and cancel

* Hook up editing in textarea

* Allow existing expression to be edited

* Make expression param optional

* Use ExpressionField to add new expression

* Hide cancel button if no callback and add updateLabel prop

* Only show error when dirty

* Placeholder for expression field

* Format result in expression field

* Expression field textarea styling

* Justify expressions at bottom

* Prevent jumping when editing expression

* Revert changes on cancel

* Remove unused CSS

* Extract ExpressionTextArea

* Extract ExpressionResult

* Auto height textarea

* Hover styling for expression

* Result type tag

* Tweak styling

* Update padding in expression field

* Changelog

* Enable scrolling of result when editing expression

* Use smaller close icon

* Fix enabling of add/edit button

* Focus text area when clicking edit button

* Put cursor at the end of text area when focusing it

* Enter edit mode when clicking on text area

* Remove expression in list

* Don't style expressions list as a flex box

* Show full result while editing expression
2024-07-09 14:05:39 -04:00
Mik 5948b0d822
Fix incorrectly escaped HTML (#49195)
* Fix incorrectly escaped HTML

* Add a changelog entry
2024-07-09 17:04:20 +01:00
Alex Florisca 56cc77fcef
Fix the mini cart items not being visible when zoomed in (#48384)
* 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>
2024-07-09 16:47:21 +01:00
Néstor Soriano 99ae453ea3
Improve the handling of the deprecated WC()->api property (#48884)
* Improve the handling of the deprecated WC()->api property:

- When the legacy REST API plugin is not available, set the property
  to an instance of RestApiUtil. This object has the get_endpoint_data
  method that is still used by external plugins.

- Add a new legacy_rest_api_is_available method to WooCommerce class.

- Replace all instances of "is_null(WC()->api)" with (negated) calls to
  the new legacy_rest_api_is_available method.

- Make WC()->api point to an instance of LegacyRestApiStub, instead of RestApiUtil.

---------

Co-authored-by: Naman Malhotra <naman03malhotra@gmail.com>
2024-07-09 17:26:20 +02:00
Matt Sherman ff9656840d
Product Editor: Fix crash and issues with variations (that will cause problems with React 18) (#49248)
* Only request layout template when have an id

* Add setAttributes to useEffect dependency array

* Add ErrorBoundary around Tab inner blocks

* Style Tab ErrorBoundary

* Fix CSS specificity for .woocommerce-attribute-list-item styles

* Remove test CSS

* Add specific error boundary message

* Use variable for error boundary margin

* Changelog

* Tweak error message

* Changelog

* Tweak console error log message
2024-07-09 10:44:41 -04:00
Nathan Silveira fbf464be51
Add improvements to NumberControl, using it in Shipping dimensions and manage download limits (#49205)
* Add inputMode decimal to regular price and sale price fields and useNumberInputProps

* Change min and max numbers for NumberControl

* Allow typing minus in number

* Fix number control CSS issues in modals

* Allow providing elements as label and add onFocus handler

* Migrate manage downloads limits modal to NumberControl

* Migrate shipping dimension fields to NumberControl

* Add changelog

* Avoid passing NaN to onChange

* Move limits to individual fields

* Update max limits and add underscores for readability
2024-07-09 10:51:21 -03:00
jonathansadowski b8c2cf8cde
Update ci.yml to be dispatchable and skippable (#45331)
Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
2024-07-09 16:50:57 +03:00
Chris Lilitsas a4ff1d01b3
[Product Collection] Track block instances and feature usage (#46466)
* add block parser and filters wip

* replace strings with template slugs and do some polish

* Refactor some parts to reused in wc_tracker

* Clean up and introduce snapshot data in the WC_Tracker

* Minor improvements

* Track only fse themes

* Consolidate collection names per context in the WC_Tracker snapshot

* Add changelog

* Separate taxonomy filter usage into specific category and tag usage

* Polish event params values

* Lint

* Remove wc-tracker to simplify the pr

* More cleanup

* Unify location names

* Handle stock status default value

* Renamed order confirm context

* Track price filter fix

* consider 3pd stock statuses in tracking

* Lint

* Consider the woocommerce_hide_out_of_stock_items option when tracking stock filter

* Cleanup empty lines

* Rename single product area flag

* Add docblock

* Avoid drafts and autosaves

* introduce a new class under tracking events

* Cleanup main controller

* Cleanup

* Add docblocks

* Stop recursive process up to 2 levels and cleanup

* Cleanup

* Ensure blocks exist

* Lint

* Normalize keys and values

* Track inherit and order-by usage

* Fix lint

* Add strict types

* add strict again

* Strict types

* Move strict types

* Remove codeblock

* Clean up

* Move directive on separate line

* Cleanup spaces
2024-07-09 16:46:04 +03:00
Christopher Allford 7d71e2235a
Product Collection: Redesigned Collection Insertion Selection (#48911)
* 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>
2024-07-09 13:53:48 +02:00
Tom Cafferkey dacee984fa
Track the newly installed version in wp_options (#49139)
* Add initial install version to database

* Change update_option to add_option

* Add changelog

* Add since annotation

* Change initial_install_version option to initial_installed_version and also set autoload to false

* Add unit test for initial_installed_version

* Add unit test for initial_installed_version
2024-07-09 10:51:24 +01:00
martynmjones ab67891874
Exclude simple products from variations reports by default (#49244)
* Make use of simple products exclusion filter regardless of included products

* Add unit test

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

* Update reports-variations.php: Remove since comment

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-09 10:48:05 +01:00
Albert Juhé Lluveras a5aef5f599
BlockTemplatesController: move all hooks into methods instead of being inline (#49182)
* BlockTemplatesController: move all hooks into methods instead of being inline

* Add changelog file
2024-07-09 11:36:43 +02:00
Vedanshu Jain 6d92aa9ccb
Load controllers only when needed for performance. (#47704)
* Load controllers only when needed for performance.

* Classify controllers based on their namespace and load selectively.

* Enable private namespace along with store api.

* Only prevent route loading when request is known for back compat.

* Lint fixes.

* Remove duplicate inclusion.

* Correctly load feature controller.

* Add since tag.

* Add unit tests.
2024-07-09 09:07:14 +00:00
Luigi Teschio fcb7f6798f
CYS: Fix pattern preview border color (#49206)
* CYS: Fix pattern preview border color when the user hovers the preview; fix pattern preview border color when the pattern is present in the site preview

* Remove the is-added class to avoid marking patterns that are already removed

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

* Fix lint errors

* Fix lint error

---------

Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-07-09 09:12:33 +02:00
Vlad Olaru 0346ca618a
Fix Payments and APMs tasks logic and links (#46017)
* Link Payments task item to Overview if WooPayments is connected

* Link APMs task item to payments task page

* Add changelog for WooCommerce

* If WCPay is connected go to Payments Overview page

It shouldn't matter if the WCPay account is fully or partially onboarded.

* Fix determining if other gateways are enabled besides WCPay ones

Since UPE, WCPay registers multiple payment gateways, all prefixed with woocommerce_payments.

* Fix WooCommercePayments task kick-in logic

The WooCommercePayments task should supersede the general Payments task
when the general Payments task is not completed already and the store is in a
WooPayments supported country. We should not factor in if WooPayments is
just installed but not connected.

* Add changelog

* test: Fix Playwright tests for payment tasks

* test: Fix Playwright tests linting

* test: Further fixes to the Playwright payment setup task
2024-07-09 09:42:50 +03:00
Barry Hughes 97656a907d
Reduce potential for plugin conflict-driven fatal errors during (REST API-based) refund creation (#47918)
Introduce a method to help ensure values that have been filtered are still of the expected type.

Fixes #47601

* Reduce potential for plugin conflict-driven fatal errors during (REST API) refund creation.

* Parcel up return-type-assurance logic into its own reusable helper.

* Generalize the type checking helper.

* Do not replace existing WP_Errors.

* Do not translate logging messages, per current best practices.

Ref: d2bde1368a/docs/extension-development/logging.md (best-practices)

* Add test describing the behaviour of `Types::ensure_instance_of()`.

Note that the exception error code originally specified in the Types class was also removed: if we want this, it needs to be an integer rather than a string. However, we don't have a methodology or centralized registry for handling numeric error codes at present.

* Use ternary shorthand, not null coalescing.

* Add `@since` tag for hook `woocommerce_rest_pre_insert_<POST_TYPE>_object`.

Selected 4.5.0, as this is the point at which the (until then separate) REST API package was merged into WooCommerce Core.

* Avoid short ternaries.

* Strict types.
2024-07-08 16:30:25 -07:00
github-actions[bot] d4017c0700
Delete changelog files based on PR 49243 (#49255)
Delete changelog files for 49243

Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
2024-07-08 23:37:24 +01:00
Jorge A. Torres 5c81b0e5cc
Do not run `BatchProcessingController`'s cleanup after a premature shutdown (#49243)
* Prevent `BatchProcessingController` from running its cleanup function during an abnormal shutdown

* Add changelog

* Use a safer check (we cannot always depend on `as_has_scheduled_action` being available).
For context, please see:

- A problem we faced recently when using modern Action Scheduler functionality, in https://github.com/woocommerce/woocommerce/pull/49243.
- Description of load order concerns https://developer.woocommerce.com/2021/10/12/best-practices-for-deconflicting-different-versions-of-action-scheduler/.

---------

Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
2024-07-08 14:31:39 -07:00
Gabriel Manussakis da0036c12b
[Accessibility] Fix typo in remote specs validation doc (#49207)
* Fix "everyting" typo

* Add changelog file
2024-07-08 15:46:55 -03:00
Gabriel Manussakis 1b9e3601a4
[Accessibility] Fix typo in woo-ai plugin doc (#49208)
* Fix "prequisites" typo

* Add changelog file
2024-07-08 15:44:37 -03:00
Jonathan Lane 07c9d2b7b1
Update Playwright to 1.45.1 (#49202)
* Update Playwright to 1.45.1

* Update lockfile

* Add changelog

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-07-08 15:22:13 -03:00
Alba Rincón a93343dd90
CYS - Fix size of the "no logo" title to match the "logo" title size (#49231)
* Fix size of the no logo title to match the logo title size

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-08 17:36:37 +02:00
Albert Juhé Lluveras 416db85d01
Add srcset to Single Product gallery thumbnail images (#49112)
* Add srcset to Single Product gallery thumbnail images

* Add changelog file
2024-07-08 17:23:07 +02:00
Alba Rincón cecfecdf1f
CYS - Fix assembler styling issues (#49232)
* Fix sidebar bg color

* Fix spacing and title size on patterns section

* Increase space between the section description and the list of patterns

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-08 16:47:30 +02:00
Maikel Perez d849155c59
Change the custom field name component to be an autocomplete (#48949)
* Moving to a Combobox

* Create CustomFieldNameControl component

* Fix combobox styles

* Change Combobox to behave as an Autocomplete

* Integrate CustomFieldNameControl within the CustomFieldCreateModal

* Fix the ref type from CustomFieldNameControl

* Integrate CustomFieldNameControl within CustomFieldEditModal

* Fix CustomFieldNameControl default/focus border style

* Fix custom field value control height to be 36px like other controls

* Add changelog file

* Fix linter errors

* Add ->esc_like to the search criteria when searching for a product custom field name

* Add changelog file

* Add comments explaining why the implamentation was made that way

* Remove non existing classname

* Fix wrong border color when the field is invalid and focused

* Fix linter errors

* Hide props from the internal input element

* Rename comboboxRef with inputElementRef

* Fix invalid empty value when the combobox has a selected value
2024-07-08 09:14:36 -04:00
Adrian Moldovan 7b0f9457cf
[e2e tests] Add Allure reporter to Blocks e2e tests (#49228) 2024-07-08 15:02:31 +03:00
Naman Malhotra 8f98a2a057
Drop Select2 in Backwards compatable manner (#48731)
* init

* added changelog

* Review - point select2 in admin assets
2024-07-08 18:47:59 +07:00
Veljko V 1a94d68d2b
Fix flaky e2e test merchant filling regular price in inventory tab (#49226) 2024-07-08 13:10:40 +03:00
Alba Rincón b83eed8869
CYS - Fix patterns spacing (#49196)
* Fix spacing in patterns

* Fix spacing

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

* Remove metadata

* Remove metadata

* Fix test

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-08 10:52:35 +02:00
Veljko V 05c47d8566
Fix flaky filling SKU and verifying CYS footer e2e tests (#49191) 2024-07-08 11:24:02 +03:00
Alba Rincón c763bdf695
CYS - Filter out patterns with external dependencies (#48618)
* 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>
2024-07-08 08:53:06 +02:00
Vladimir Reznichenko 68532ce433
CI: update linting jobs to skip build step (#49193)
In this PR, we introduce changes to linting and PHPUnit jobs in order to speed them up: skip or minimize the build step.
2024-07-08 08:39:39 +02:00
Eason 6d17019827
Fix the inconsistent formatting of the numeric columns in the Leaderboards on the Analytics > Dashboard page (#49097)
* 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
2024-07-08 11:15:12 +08:00
Nathan Silveira e62f28b3ca
Allow selecting categories through keyboard (#49049)
* 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
2024-07-05 14:20:28 -03:00
Adrian Moldovan 178466aa06
[e2e tests] Tweak Playwright config - retries and test artifacts (#49148) 2024-07-05 15:38:49 +02:00
Luigi Teschio 615513144d
CYS: Fix color button (#49181)
* 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>
2024-07-05 12:41:27 +00:00
Manish Menaria 2d6448d9b4
Product Collection: Fix alignment of the first item in Grid layout for WP 6.6 (#49096)
* 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>
2024-07-05 17:24:27 +05:30
Manish Menaria fa11141726
Expose `__experimentalRegisterProductCollection` in @woocommerce/blocks-registry Package (#48141)
* 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>
2024-07-05 16:55:35 +05:30
Chris Lilitsas d3df046f97
[Product Collection] Parse front-end context (#44145)
* 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>
2024-07-05 13:49:24 +03:00
Mike Jolley be849473e0
Checkout: Update legacy status handling (#48788)
* Allow same status as API expects

* changelog
2024-07-05 11:42:38 +01:00
Luigi Teschio 9fc207b1a6
CYS: fix: Assembler follows admin color schema (#49159)
* 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>
2024-07-05 12:20:49 +02:00
Vladimir Reznichenko 1675c63bba
Monorepo: tweak CodeSniffer rules conflicting with strict types declaration requirements (#49183) 2024-07-05 11:46:30 +02:00