Commit Graph

6860 Commits

Author SHA1 Message Date
Roy Ho 63243c57a9
[Experimental] Product filters > Attributes loading state in editor (#51151)
* Fix no products component prematurely being rendered

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

* Use useMemo to memoirize component element on re-renders

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-09-06 05:33:02 -07:00
Karol Manijak a7231863c0
Product Collection: Trigger `wc-blocks_viewed_product` JS event (#51156)
* Define the event

* Add action sending an event in PC store

* Add directives and context to Product Template li element

* Use on--click directive in ProductImage

* Use on--click directive in Product Title

* Use on--click directive in Product Button

* Add changelog

* Add E2E tests

* Update docs

* Update blocks reference and docs manifest

* Update m,anifest

* Fix mistake in docs

* Regenerate docs manifest

* Fix lint

* Extractb new tests to a separate file
2024-09-05 12:52:35 +02:00
Roy Ho b618f81c6d
[Experimental] Product filters - ensure we can add multiple instances (#51051)
* Product filters ensure we can add multiple instances

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

* Add e2e tests to ensure multiple filters can be added

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-09-04 05:39:07 -07:00
Christopher Allford caf9ec635e
Use PHP 7.4 for WooCommerce Blocks' `wp-env` Config (#51075)
This resolves a PHP 7.4 compatibility problem as well as updates the `wp-env` config for the Blocks tests to use 7.4 rather than the latest.
2024-09-03 09:54:22 -07:00
Gabriel Manussakis 57ef5a884e
[Accessibility] Improve Checkout block page accessibility after removing heading level 1 (#50925)
* Add aria-label to checkout form landmark

* Remove aria-hidden from checkout form sub-titles

* Add aria-label to checkout form

* Add changelog file

* Remove aria-hidden from form-step snapshots

* Bump form-checkout template version
2024-09-03 15:42:28 +01:00
Sam Seay 115d4f16c9
Remove the wc combobox component, it is no longer used (#50975) 2024-09-03 09:20:46 +00:00
Manish Menaria 2433664aa8
Product Collection - Show product picker in Editor when collection requires a product but it doesn't exist (#50164)
* Show product picker control in the editor when a product context is required but not provided

Enhanced the Product Collection block by introducing the `selectedReference` attribute and implementing a product picker control. This control appears in the editor when a product context is required but not provided in the current template/page/post.

1. **block.json**: Added `selectedReference` attribute of type `object`.
2. **constants.ts**: Included `selectedReference` in the `queryContextIncludes` array.
3. **EditorProductPicker.tsx**: Created a new component for selecting products within the editor.
4. **editor.scss**: Added styles for the new Editor Product Picker component.
5. **index.tsx**: Updated logic to determine the component to render, incorporating the new Editor Product Picker.
6. **types.ts**: Defined types for `selectedReference` and updated `ProductCollectionAttributes` interface.

This enhancement allows merchants to manually select a product for collections that require a product context, ensuring the block displays correctly even when the product context is not available in the current template/page/post.

- **Product Picker Control**: Utilizes the existing `ProductControl` component for selecting products. This component is displayed in the editor when a collection requires a product context but it doesn't exist in the current template/page/post.

* Update label on ProductControl component

* Implement dynamic UI state management for product collection block

- Introduced `ProductCollectionUIStatesInEditor` enum to define various UI states for the product collection block.
- Added `getProductCollectionUIStateInEditor` utility function to determine the appropriate UI state based on context.
- Updated `Edit` component to use `getProductCollectionUIStateInEditor` for dynamic state management.
- Refactored `ProductCollectionContent` to utilize the new Editor UI state management.

* Fix: Product picker isn't showing

* Fix: Preview label state isn't showing

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

* Refactor WooCommerceBlockLocation type

- Introduced specific interfaces for WooCommerceBlockLocation, including ProductLocation, ArchiveLocation, CartLocation, OrderLocation, and SiteLocation, to improve type safety and code clarity.
- Updated createLocationObject function to return a BaseLocation type.
- Refactored useSetPreviewState hook in product-collection utils:
  - Extracted termId from location.sourceData for cleaner and more readable code.
  - Replaced direct access of location.sourceData?.termId with termId variable.

* Remove fallback to 0 in case there may be a product with id 0

* Use optional chaining to avoid undefined errors

* Rename  to

* Change order of arguments in  function

* Pass boolean prop instead of making further recognition of the UI state in ProductCollectionContent

* Destructure  props in  component

* Rename  to

* Update names in  enum

* Rename  to  and change the structure to single number.

* Rename location to

* Add a method to choose a product in the product picker in Editor

* Add E2E tests

* Fix failing e2e tests by changing location to productCollectionLocation

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

* Don't allow selecting product variations

* Minor code refactoring

* Fix: Product control isn't showing products

**Before**
```tsx
const getRenderItemFunc = () => {
		if ( renderItem ) {
			return renderItem;
		} else if ( showVariations ) {
			return renderItemWithVariations;
		}
    return () => null;
	};
```

As you can see above, `return () => null;` is returning a function which is causing the issue. This will render nothing in the list. I changed this to `return undefined;`. This way, we will use default render item function.

* Translate text in ProductPicker component

* Improve E2E test

* Use createInterpolateElement to safely render strong HTML tag

* Fix E2E tests

* Fix E2E tests

* Product Collection: Inspector control to change selected product (#50590)

* Add Linked Product Control to Product Collection Block Inspector Controls

- Introduced a new `LinkedProductControl` component in the Product Collection block's Inspector Controls.
- This control allows users to link a specific product to the product collection via a dropdown with a search capability.
- Added corresponding styles to `editor.scss`.
- Integrated a `useGetProduct` hook in the `utils.tsx` to fetch and manage the state of the linked product data, including handling loading states and errors.
- Updated the Inspector Controls to include the new Linked Product Control component, enhancing the block's customization options for users.

* Add E2E tests

* Hide product picker when product context is available

* Improve logic to hide Linked Product Control

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

* Remove hasError state from useGetProduct hook

* Rename isShowLinkedProductControl to showLinkedProductControl

* Convert jsxProductButton to ProductButton component

* Refactor jsxPopoverContent to LinkedProductPopoverContent component

* Improve UI of Linked Product Control

* Address PR feedback

* Fix E2E tests

---------

Co-authored-by: github-actions <github-actions@github.com>

* Rename isUsesReferencePreviewMode to isUsingReferencePreviewMode

* Change order of conditions in getProductCollectionUIStateInEditor

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-09-02 12:39:33 +05:30
Fernando Marichal 3def18623e
Fix variation selector display issues on the front end (#51023)
* Add woocommerce class to single-product

* Add changelog

* Fix chevron alignment
2024-08-30 17:47:20 -03:00
Alba Rincón 40cde50879
`Product SKU` improvements (#51033)
* Add new prefix and suffix attributes

* Add editable prefix & suffix rich text fields

* Remove the uppercase style from prefix and suffix

* Render the prefix and suffix in the front end

* Fix lint errors

* Handle old sku block without prefix and suffix

* Improve the editor styles

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

* Use wp_kses_post to filter and format the suffix and perfix

* Address extra space when empty and better escaping

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-30 10:23:28 +02:00
Bart Kalisz ff197207ef
Product Collection: Don't render when empty unless the no results block is present (#50404)
* Disable PC render when content empty unless no results block is present

* Introduce empty PC classname

* Add E2E test

* Add changelog entry

* Ensure the render is preserved as expected

* Do not render empty div

* Update tests

* Try a different logic

* Add hint to the docblock

* Remove obsolete e2e test

* Update render handler name to acknowledge context

* Fix tests failing due to recent v3 update

* Restore block interactivity

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
2024-08-30 08:48:54 +02:00
Karol Manijak 062c4ed76a
Migrate Product Price to `block.json` (#50905)
* Migrate Product Price to block.json

* Add changelog

* Update block references

* Update block references and doc manifest

* Add shared config properties to Product Price block.json

* Update block references and docs manifest
2024-08-30 07:47:03 +02:00
Tung Du cd638721f9
[Experimental] Update folder structure for new product filter blocks (#51029) 2024-08-29 15:23:40 +00:00
Alba Rincón 0a1af26785
Remove extra bottom padding in filters in the editor (#51012)
* Remove filter margins in the editor

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

* Remove small space after + sign

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-29 10:26:11 +02:00
Manish Menaria 055cf09cc1
Change cursor style of preview button to default (#50612)
* Change cursor style of preview button to default

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

* Hover and active state shouldn't change background color of the preview button.

* Remove use of wp-block-woocommerce-product-collection class

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-29 11:16:59 +05:30
Karol Manijak 81ebd85f9e
Migrate Product Image to `block.json` (#50903)
* Migrate Product Image to block.json

* Remove unnecessary property

* Add changelog

* Update block references

* Remove duplicated attributes

* Update block references and doc manifest
2024-08-28 19:56:27 +02:00
Karol Manijak d9a47a15a9
Migrate On Sale Badge to `block.json` (#50908)
* Migrate On Sale Badge to block.json

* Add changelog

* Fix types

* Update block references

* Update block references and doc manifest
2024-08-28 16:26:21 +02:00
Gabriel Manussakis 91b6e972e3
[Accessibility] Fix misspelling in plugins/woocommerce-blocks/docs (#48562)
* Fix "overriden" typo

* Fix "prequisites" typo

* Fix "overriden" typo

* Fix "recieve" typo

* Fix "differnt" typo

* Fix "revew" typo

* Fix "resetted" typo

* Fix "overriden" typo

* Fix "overriden" typo

* Fix "Appearence" typo

* Fix "Producto" typo

* Fix "tha" and "modifed" typos

* Fix "Boundry" typo

* Fix "boths" typo

* Fix "visibile" typo

* Fix "overriden" typo

* Fix "Apperance" typo

* Fix "returing" typo

* Fix "extration" typo

* Fix "brough" typo

* Fix "teh" typo

* Fix "fileds" typo

* Fix "arry" typo

* Add changelog file

* Revert change of "Producto" word

* Revert change of "Producto" word
2024-08-28 10:00:01 -04:00
Alex Florisca 9f79715d06
Small updates to the express checkout area (#50644) 2024-08-28 11:16:55 +01:00
Alba Rincón 1d21197f77
Hide reviews in the frontend when they are disabled at store or product level (#50979)
* Not show reviews in the frontend when they are disabled at store or product level

* Add tests for single product template

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

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

* Fix typo

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-28 10:01:55 +02:00
Fernando Marichal 9ed5a7923b
Convert with-reviews to TS (#50890)
* Convert with-reviews to ts

* Add changelog

* Remove bind
2024-08-27 16:29:44 -03:00
Maikel Perez e5c6477a4e
Blocks E2E: Move register product collection tester e2e tests from product collection file to its own file (#50852)
* Move register product collection tester e2e tests from product collection file to its own file

* Add changelog file

* Remove the unstable allTextContents usage

* Remove page.waitForTimeout because it doesn't validate that the button is hidden after exactly 1 second

* Remove page.waitForTimeout from 'Should display properly in Product Catalog template' e2e test

* Let's use one parent describe per file for good practice

* Keeping the structure flat
2024-08-27 09:37:45 -04:00
Albert Juhé Lluveras 1e650d06a9
Add 'Show tab title' attribute to the Product Details block (#50884)
* Add 'Show tab title' attribute to the Product Details block

* Add tests

* Add changelog file

* Linting

* Use editor.selectBlocks() instead of block.click()
2024-08-27 15:10:49 +02:00
Karol Manijak 5a80d5e1da
Update Block Reference and make it public doc (#50906)
* Update Block References doc

* Move the Block References to public Docs

* Change the place Block Reference is generated to

* Add changelog

* Update docs manifest file

* Update manifest
2024-08-27 09:04:15 +02:00
Roy Ho cc07a5f902
[Experimental] Price filter: fix range slider update (#50935)
* Price filter: fix range slider update

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

* Fix linting error

* Remove unneeded state setter

* Update plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/price-filter/frontend.ts

Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>

* Fix linting error

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2024-08-26 19:57:01 -07:00
Albert Juhé Lluveras 08f724b8d8
Improve the tabs focus style in the Product Details block with Minimal style variation (#50880)
* Improve the tabs focus style in the Product Details block with Minimal style variation

* Add changelog file

* Remove direct child selector
2024-08-26 13:18:28 +02:00
Mike Jolley 6c4a26770d
Order confirmation: Update mobile order summary styling so items appear side by side (#50722)
* Update order confirmation wording

* Style order details inline

* Changelog

* Update test due to change of text
2024-08-23 19:22:59 +01:00
Gabriel Manussakis d773bb483a
[Accessibility] Focus coupon input if it has an error (#48738)
* Focus cupon input if it has errors

* Add changelog file

* Add styles to coupon field with error on cart page

* Make coupon errors accessible on the cart page

* Add styles to coupon field with error on checkout page

* Rename coupon variables on cart

* Focus coupon field with error before updating live region on cart page

* Focus coupon field with error before updating live region on checkout page

* Remove incorrect early return

* Update coupon error notice test

* Improve coupon error message semantics

* Fix coupon errors for block based themes

* Update tests to not look for coupon errors on the notice block

* Rename coupon-error-message to coupon-error-notice

* Fix notice if coupon doesn't exist on tests

* FIx invalid coupon notice on classic theme test

* Update test for coupon inline notice

* Fix code formatting

Co-authored-by: Darin Kotter <darin.kotter@gmail.com>

* Fix code formatting

Co-authored-by: Darin Kotter <darin.kotter@gmail.com>

* Fix code formatting

Co-authored-by: Darin Kotter <darin.kotter@gmail.com>

* Fix code formatting

Co-authored-by: Darin Kotter <darin.kotter@gmail.com>

* Don't clear coupon input if code doesn't exist

* Create coupon error notice mixin

* Update coupon error notice styles

* Coupon error notice T19 compatibility

* Coupon error notice T17 compatibility

* Coupon error notice TT1 compatibility

* Coupon error notice TT compatibility

* Coupon error notice TT2 compatibility

* Coupon error notice TT3 compatibility

* Add spaces around paramenters

Co-authored-by: Darin Kotter <darin.kotter@gmail.com>

* Add spaces around paramenters

Co-authored-by: Darin Kotter <darin.kotter@gmail.com>

* Replace $red SCSS variable with a CSS one

* Keep input with the invalid coupon code after notice appears

* Fix typo in comment

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Fix typo in comment

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Break notice message into two lines

* Break if statement into two lines

---------

Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2024-08-23 19:22:28 +01:00
Caleb Mazalevskis b4fd419f74
Fix typos. (#50047) 2024-08-23 18:26:09 +01:00
Seghir Nadir e66ccf698c
Run Checkout block coupon filter on empty array (#50876)
* Run Checkout block coupon filter on empty array

* fix conditional

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

* remove useless eslint skip

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-23 15:34:57 +00:00
Maikel Perez c09e45a391
Blocks E2E: Move collections e2e tests from product collection file to its own file (#50853)
* Move collections e2e tests from product collection file to its own file

* Add changelog file
2024-08-23 09:26:38 -04:00
Karol Manijak 2f68f9265b
Fix most of lint warnings (#50869)
* Fix number of lint warnings

* Add changelog

* Improve mocking value

* Fix exports

* Fix mock

* Bring back the empty array hook dependency
2024-08-23 14:30:14 +02:00
Mike Jolley 42cdc0e978
Block Checkout: Respect default saved payment method when using tokens (#50481)
* activeSavedToken state is unused

* Select is_default saved token by default

* changelog

* Unused objectHasProp
2024-08-23 12:03:11 +02:00
Maikel Perez a779788a93
Blocks E2E: Move the inspector controls e2e tests from product collection file to its own file (#50849)
* Move the inspector controls e2e tests from product collection file to its own file

* Add changelog file
2024-08-22 10:55:20 -04:00
Roy Ho 320c165cb8
Add additional size units to product image element (#50770)
* Add additional size units to product image element

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-22 06:32:03 -07:00
Sam Seay 35cdc6dc20
Use syncpack to lock pnpm version till we can fix issues (#50828) 2024-08-22 12:34:42 +12:00
Fernando Marichal 771fd00e5d
Featured Product: Fix variable product Selection dropdown (#50633)
* Add hook to SearchListItem

* Add changelog

* Invert is-expanded chevron

* Fix expanded setting

* Fix e2e test

* Add hasChildren and isSelected as dependency
2024-08-20 12:42:35 -03:00
Gabriel Manussakis c9aa65a22f
[Accessibility] Fix focus order on checkout block page (#49649)
* Render total blocks before fields on checkout

* Reverse checkout total blocks position on desktop

* Add changelog file

* Add conditional styles to reverse checkout blocks order

---------

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2024-08-20 15:42:38 +02:00
Fernando Marichal ce98e51430
[Filter Products by Price]: Update view when changing the min/max value (#50651)
* Use handlePriceChange method

* Fix E2E test

* Add changelog

* Remove onBlur

* Add select when clicked

* Fix comment

* Add functionality to experimental block

* Fix E2E test
2024-08-20 10:20:09 -03:00
DAnn2012 8387b0a842
Fix typo (1140.md) (#50160)
* Update 1140.md

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

* Update 1140.md

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2024-08-20 12:37:13 +01:00
piinthecloud 5098bb1169
create block theme folder (#50638)
* create block theme folder

* add changelog

* update titles
2024-08-20 13:19:47 +02:00
Seghir Nadir 2a406c7e8a
Update all blocks to V3 (#48720)
* Update all blocks to V3

* remove explicit version set in shared config blocks

* update styling for Cart/Checkout in iframe

* test: fix block e2e tests

* test: fix attribute filter e2e tests

* test: fix product collection e2e tests

* test: fix product on sale e2e test

* test: fix rating filter e2e tests

* test: fix review e2e tests

* test: fix stock e2e tests

* test: fix preview button test

* fix: product on sale wrapper

* test: fix insertBlockByShortcut in iframe

* test: fix core e2e tests

* chore: changelog

* test: typo

* test: update PC e2e tests

* add test to make sure iframe canvas is loaded

* fix syntax error

* Update plugins/woocommerce-blocks/tests/e2e/tests/basic.block_theme.spec.ts

Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>

---------

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Bart Kalisz <bartlomiej.kalisz@gmail.com>
2024-08-20 10:14:11 +00:00
Jonathan Lane d5c901e3b7
Update Playwright to 1.46.1 (#50772) 2024-08-20 10:40:46 +03:00
Caleb Mazalevskis 50900d9d4e
Fix markdown typos. (#50282)
* Fix markdown typos.

* Re-fix typos.

* Add changelogs (#issuecomment-2296573205).
2024-08-19 14:59:10 -03:00
Alex Florisca cda0f8a3f8
Revert "Add new buttonAttributes API to style express checkout buttons coherently (#47899) (#50763)
* Revert "Add new buttonAttributes API to style express checkout buttons coherently (#47899)"

This reverts commit 006fbc6714.

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

* Update changelog

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-19 18:54:58 +01:00
Matt Sherman 42e943dc0e
Decode HTML entities and strip HTML tags in product names for cart quantity change notifications (#50541)
* Decode cart item names
* Strip HTML tags from product name

---------

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2024-08-19 12:07:11 -04:00
Gabriel Manussakis d7783511ff
[WIP][Accessibility] Fix inline documentation typos in woocommerce-blocks (#50737)
* Fix inline documentation typos in woocommerce-blocks

* Add changelog file

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

* Remove original changelog

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2024-08-19 13:57:38 +01:00
Adrian Duffell a4fe8a6417
Add visual changes to the blueprint slotfill (#50724) 2024-08-16 18:23:05 +00:00
Alexandre Lara 6185185589
[Experimental] Product Filters Redesign > Overlay Navigation: Add Block to the Product Filters Block (#50186)
* Add variation to Product Filters Overlay Navigation

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

* Move Product Filters Overlay Navigation to correct position

* Hide block when it is outside the Product Filters template part

* Display Navigation block in the frontend

* Show the Product Filters Overlay Navigation on the frontend

* Add logic to hide Product Filters Overlay Navigation block on the frontend

* Hide block on the Overlay template part

* Fix eslint errors

* Update the block variation title

* Remove the `isActive` property from the block variations

* Use Product Filters block context

* Replace enum with const

* Remove unnecessary `StyleAttributesUtils`

* Rename context key

* Move BlockOverlayAttribute to the constants.ts file

* fix BlockOverlayAttribute import

* Fix import error

* Improve code for the shouldHideBlock method

* Remove unnecessary attributes property

* Fix error in ProductFiltersOverlay block

* Prevent block from being hidden on Product Filters template part

* Fix inspector controls when block is hidden

* Remove unnecessary import

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-08-15 14:50:45 -03:00
Adrian Moldovan d7909ecb3c
[e2e tests] Add BuildKite reporter to Blocks e2e tests (#50642) 2024-08-15 13:48:44 +01:00
Mike Jolley a932ceb59f
Fix extensionCartUpdates not surfacing errors to cart and checkout (#49762)
* Add context to type

* Clean up notifyerrors helpers

* Notify and clear top level cart errors

* changelog

* Make extensionCartUpdate surface the errors

* No automatic clearing of notice

* Handle generic errors only, add docs

* Rename param

* Fix linting in readme

* Update toc

* test coverage

* Unused import

* We're only dealing with arrays of errors so simplify logic
2024-08-14 15:24:44 +01:00