Commit Graph

6767 Commits

Author SHA1 Message Date
Tung Du ac5b051fc2
Fix: Make woocommerce/product-price available in the Single Product template (#49906)
* fix: register woocommerce/product-price using registerBlockSingleProductTemplate

* fix: remove unnecessary blockMetadata

* chore: changelog

* Enable Product Price in post editor

---------

Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
2024-07-24 15:58:20 +02:00
Karol Manijak 0824b7e65d
Product Collection: Revert rename of "Sync with current query" option (#49907)
* Revert renaming Sync with current query option

* Add changelog
2024-07-24 14:17:37 +02:00
Karol Manijak dace7ba296
Product Collection: add control to toggle whether block is filterable in non archive context (#49627)
* 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>
2024-07-24 11:51:53 +02:00
Chi-Hsuan Huang f9598fbed1
Deprecate and create new coming soon block version (#49786)
* Migrate coming soon block

* Update coming soon patterns

* Enqueue styles

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

* Fix entire site block

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-24 15:12:38 +08:00
Thomas Roberts afe245fdce
Make the address 2 line visible when a value is autofilled (#49730) 2024-07-23 16:44:20 +01:00
Thomas Roberts ad7a49df4c
Prevent error on Cart Shipping Calculator when using Additional Checkout Fields API (#49685) 2024-07-23 16:38:54 +01:00
Mike Jolley e8d899b6f3
Block Checkout: Fix default shipping selection on toggle pickup (#49718)
* Default selection is blank so it can be selected on mount

* Prevent notice displaying until rate selections are complete

* changelog
2024-07-23 16:25:35 +01:00
Paulo Arromba 3d148e2577
Added Firefox support for making Order Summary sticky when not longer than view (#49744)
* Added getComputedStyle for Firefox support

* Added changelog

* Reverted pnpm-lock.yaml
2024-07-23 15:38:12 +01:00
Manish Menaria 7e54c5a589
Fix tip block syntax in register-product-collection.md (#49785)
* 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>
2024-07-23 13:58:42 +05:30
Karol Manijak d85acc7e09
Product Collection: allow custom collections hiding each of the filters (#49713)
* Allow hiding all of the filter controls in PC block

* Add new test

* Add changelog

* Update documentation with information about hideControls values
2024-07-23 09:03:27 +02:00
Chi-Hsuan Huang 7f23702018
Fix broken coming soon template in dataview (#49749)
* Set coming soon preview body aspect ratio to 1/1 to fix borken template

* Add changelog

* Update plugins/woocommerce/changelog/fix-broken-coming-soon-template

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

---------

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2024-07-23 14:11:32 +08:00
Niels Lange 0c9e33bb7c
Adjust input field height and input label text size (#49636)
* 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>
2024-07-22 12:53:59 +02:00
Niels Lange 2baa82b750
Spacing adjustments for coupon code in the Cart and Checkout blocks (#49603)
* 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>
2024-07-19 12:47:17 +02:00
Bart Kalisz 800cf7e9ed
Blocks E2E: Fix DB snapshot removal step in setup script (#49677) 2024-07-19 12:02:56 +02:00
Vladimir Reznichenko 46f952eeb5
Monorepo: enable babel-loader and Jest caching (inc. CI) (#49656)
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.
2024-07-19 09:40:01 +02:00
Alba Rincón e865e1e4f2
Product rating - Inherit the color of the star when no ratings (#49678)
* 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>
2024-07-19 09:23:24 +02:00
Alexandre Lara 12b701d35c
[Experimental] Product Filters Redesign: Move icons to @woocommerce/icons package (#49646)
* 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>
2024-07-18 15:53:39 -03:00
Roy Ho 038ef3d751
[Experimental] Add Product filters overlay settings (#48732)
* 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>
2024-07-18 11:33:25 -07:00
Bart Kalisz 720c1de6bf
Blocks E2E: Refactor Product Collection vs classic template test for stability (#49638) 2024-07-18 15:50:25 +02:00
Alba Rincón 7f797c041c
Replace the customer account line logo (#49666)
* 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>
2024-07-18 15:47:07 +02:00
Roy Ho 6216408511
Prevent individual filters from being able to drag outside of parent wrapper (#49606)
* 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>
2024-07-17 13:30:59 -07:00
Gabriel Manussakis ece00533e4
[Accessibility] Convert edit address link to a button (#49471)
* 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
2024-07-17 16:54:41 +02:00
Alexandre Lara 7dd0c1a055
[Experimental] Product Filters Redesign: Rename individual inner filter blocks to "Filter Options" (#49579)
* Rename blocks to "Filter Options"

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

* Add icon to Filter Options block

* Remove unused import

* Fix e2e tests

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-17 11:12:32 -03:00
Bart Kalisz 06374b9691
Blocks E2E: Stabilize Product Collection tests where saving fails (#49590) 2024-07-17 09:50:02 +02:00
Niels Lange d3574290b7
Fix regression of #48180 (#49580)
* 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>
2024-07-16 21:46:39 +02:00
Albert Juhé Lluveras 6689e6e0d1
Add tests to verify Featured Product/Category image editor works (#49478)
* Add tests to verify Featured Product/Category image editor works

* Add changelog file
2024-07-16 13:23:09 +02:00
Thomas Roberts a71fb4d7a6
[Enhancement]: Add option to show price on the place order button (#49252) 2024-07-16 10:59:09 +01:00
Mike Jolley 77428b973d
Checkout: Add password strength meter to new field (#49164)
* 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
2024-07-15 16:22:42 +01:00
Mike Jolley 13d3e11d40
Checkout: Add password field to create account form (#48985)
* 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>
2024-07-15 11:43:02 +01:00
Alba Rincón 6baddf6cd1
Update the `Customer Account` block icon for the line style (#49401)
* 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>
2024-07-15 08:53:47 +02:00
Sam Seay 9fa32b4f2b
Migrate StateInput, CountryInput and custom fields to native `<select>` (#48180) 2024-07-12 21:17:54 +00:00
Mike Jolley e0c62dce79
Extensibility: Format currency config so it can be consumed more easily (#48727)
* 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
2024-07-12 14:24:22 +01:00
Sam Seay e59decd222
Clean up unused files and dependencies from when WooCommerce Blocks was merged into the monorepo (#49319) 2024-07-12 16:40:07 +12:00
Adrian Moldovan 7e86b23761
[blocks e2e] Update config for retries and trace retention (#49416)
* Update config for retries and trace retention

* Add changelog

* Update maxFailures
2024-07-11 11:14:14 -07:00
Niels Lange 79786c5443
Revert #46362 (#49404)
* Revert #46262

* Remove pnpm-lock.yaml

* Revert "Remove pnpm-lock.yaml"

This reverts commit df4b87940d.

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

* Revert pnpm-lock.yaml

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-11 19:00:49 +02:00
Albert Juhé Lluveras ec95afc178
Fix sidebar attribute control in Products by Attribute block (#49351)
* Fix sidebar attribute control in Products by Attribute block

* Add changelog file

* Linting
2024-07-11 15:52:57 +02:00
Vladimir Reznichenko 9fef18cd0d
CI: missing jobs on changes in components package. (#49330)
This PR addresses issues in building a CI jobs matrix (resolving dependent packages and running CI jobs for them).
2024-07-11 14:36:56 +02:00
Vladimir Reznichenko f8c0e6e02f
E2E: enable reporting slow blocks test. (#49367) 2024-07-11 12:21:59 +02:00
piinthecloud cae3937ee6
Revert move docs (#49354)
* revert moving docs to main folder ahead of issues with subcategories

* add changelog

* add changelog
2024-07-10 17:33:15 +02:00
piinthecloud ec82b3f08f
move checkout docs with front matter to main folder (#49186)
* 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>
2024-07-10 16:53:52 +02:00
Vladimir Reznichenko 4311640de2
Monorepo: caching deps per target package in GH actions (#49020)
In this PR, we are implementing per-package build and caching, which optimizes build and fetching cached dependencies times across our workflows.
2024-07-10 14:39:49 +02:00
Sam Seay eaf57e9f15
Create a separate bundle for cart and checkout (#48010) 2024-07-10 21:23:17 +12: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
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
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
Adrian Moldovan 7b0f9457cf
[e2e tests] Add Allure reporter to Blocks e2e tests (#49228) 2024-07-08 15:02:31 +03: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
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
Chi-Hsuan Huang e59f4e406d
Fix the Coming Soon Site Page heading color is white after completing the CYS task (#49129)
* Fix site coming soon page heading color

* Add changelog
2024-07-05 10:51:30 +08:00