Commit Graph

3018 Commits

Author SHA1 Message Date
Chi-Hsuan Huang 5efefbb71a
Fix coming soon template layout issue with tall images and header spacing (#52726)
* Fix Coming Soon page template style

* Add changelog
2024-11-13 12:14:51 +08:00
Sam Seay 6400e25eca
Checkout: Adjust paddings to align top of page order summary on mobile (#52604) 2024-11-12 23:39:04 +13:00
Roy Ho dd38a6ed2d
[Experimental] Add styling controls (#52598)
* Add alignment controls

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

* Fix justication and orientation layouts

* Move styling settings to inner blocks

* Add e2e tests

* Fix chips not displaying correctly on first load

* Fix security error

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-11-11 13:44:03 -08:00
Manish Menaria d43b3af43f
Product Collection: Add "Related by" setting to Related Products collection (#52580)
* feat: Add related by setting to related products collection

This commit adds a new setting to the related products collection that allows
users to control how products are related. Users can choose to relate products
by categories, tags, or attributes.

* Remove attributes from related by control

This commit removes the attributes option from the related by control in the
Product Collection block. This option was not being used in the backend and
was potentially misleading to users.

Changes made:
- Removed attributes checkbox from RelatedByControl component
- Removed attributes from RelatedBy type definition
- Cleaned up PHP code by using PHP_INT_MAX instead of magic number

* feat: Set default values for related by setting

This commit sets the default values for the relatedBy setting in the Product
Collection block. By default, products will be related by both categories and
tags.

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

* Add tracking for related-by filter

* Add e2e test for "Related by" setting in Related Products collection

* Remove unused import for VStack

* Add optional chaining operator for query.relatedBy

Since relatedBy is an optional prop, add the optional chaining operator to
safely access it and prevent potential undefined property access errors.

* Add tracking for related by changes in Product Collection block

This commit adds tracking for when users change the "Related by" settings in
the Product Collection block inspector controls. It records whether categories
and tags are enabled or disabled.

* Update panel title from "Relate by" to "Related by"

* Remove `blocks_product_collection_inspector_control_related_by_changed` track event

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-11-11 15:12:17 -03:00
Damián Suárez ca8415fe7b
Tweak "Add to Cart" layout also for Variant products (#52702)
* tweak Add to Cart layout for variable products

* changelog
2024-11-11 12:57:19 +00:00
Damián Suárez 713c0c79b2
Tweak the layout of the Add to cart block (#52648)
* gridify input + button add to cart

* changelog

* css hacl to ensure full witdh when no children

* increse the CSS selectors to apply the grid

* avoid apply styles for steppers

* apply styles only to input in block editor context

* hack to align input + button at left

* fit content only for grouped products

* apply high span to align input + button elems

* ensure to define pseudo element

* fix eslint issues

* fix linting issues

* use a var to define whole width in grid
2024-11-11 11:18:49 +00:00
Gabriel Manussakis 7fa6c5aed2
[Accessibility] Add focus indicator to image on product card (#52011)
* Add focus indicator to image on product card

* Add changelog file

* Fix product image focus outline on Storefront theme

* Fix product image focus outline for the T17 theme
2024-11-11 12:01:31 +01:00
Sam Seay 180a266295
Bugfix: Do not repeat rendering the shipping calculator button on the cart page (#52657)
* Do not repeat rendering the shipping calculator button on the cart page.

* Lint fix: remove unused import

* Revert "Ensure local state is not overwritten by server when using `extensionCartUpdate` (#49311)"

This reverts commit 4861ec250e.

* Revert changes that didn't render shipping calc and instead check hasrates before rendering ShippingVia, ShippingAddress

* Revert "Revert "Ensure local state is not overwritten by server when using `extensionCartUpdate` (#49311)""

This reverts commit feec5709c5.

* Remove redunant change in import ordering

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-11-11 10:56:31 +00:00
Mike Jolley d733ca31d3
Local Pickup Settings Screen Fixes (#52644)
* Bump dependencies

* Wrap SVG with span to prevent console error regarding aria-hidden #52400

* Fix toggle alignment #52356

* Add wrapper so pickup locations can be saved after sorting #52357

* changelog
2024-11-11 10:40:46 +00:00
Thomas Roberts 29331f4323
Add flag to enable WC Blocks rendering with React 18 (#52473)
* Revert "Revert update to createRoot in Checkout block. (#51289)"

This reverts commit 96497814e4.

* Add __experimentalUseReact18 setting to AssetDataRegistry

* Render blocks with react 18 if __experimentalUseReact18 is true

* Re-add test console log expects

* Reimplement legacy root rendering for error checking tests

* Add changelog
2024-11-11 10:17:06 +00:00
Fernando Marichal ef50c56bc8
Product Collection Telemetry: Convert Product to Product Collection and revert to Products (#52651)
* Record Products to Product Collection

* Add changelog

* Update plugins/woocommerce-blocks/assets/js/blocks/product-collection/edit/inspector-controls/upgrade-notice.tsx

Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>

* Fix lint

* Rename event name

---------

Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
2024-11-08 13:54:32 -03:00
Mike Jolley e7586fdf00
Delayed Account Creation: Remove experimental flag to enable feature (#52554)
* Remove experimental flags

* changelog

* Check theme is block theme

* adjust test since this setting is only visible with block themes

* Hide dark mode option if password input is disabled
2024-11-08 13:44:01 +00:00
Mike Jolley 9a1d722154
Store API: Normalize cart items on load to ensure quantity limits are respected (#52154)
* Normalize cart on load in Store API

* Remove change notices; this cannot happen with normalised API endpoints

* Add test to verify normalization works

* changelog

* Remove test for removed notices

* Fix test linting

* Check $cart_item['data'] is a product
2024-11-08 12:27:16 +00:00
Karol Manijak 03ec423519
Product Collection: Improve "Sync with current query" control (#52575)
* Revamp the Inherit Query From Template control

* Add changelog

* Update copy of the control

* Code cleanup

* Update E2E tests

* Update E2E tests
2024-11-08 11:56:28 +01:00
Karol Manijak 5eb53aacb0
Product Collection: Rename "Force Page Reload" control to "Reload Full Page" and update copy (#52631)
* Change copy of Force Page Reload control

* Add changelog

* Fix logic marking PC as force page reload
2024-11-08 10:16:01 +01:00
Thomas Roberts 4861ec250e
Ensure local state is not overwritten by server when using `extensionCartUpdate` (#49311)
* Update ExtensionCartUpdateArgs to allow overwriting dirty data

* Set isCustomerDataDirty when updating billing/shipping addresses

* Update docs

* Add e2e test to ensure overwriting dirty state isn't possible

* Organise tests better and add check pushed data isn't overwritten

* Check if data is changing when updating shipping/billing addresses

* Check input values in test

* Add test to ensure data can still be overwritten by extensions

* Add changelog

* Fix lint errors

* Remove rogue console log

* Remove unused import

* Update plugins/woocommerce-blocks/assets/js/data/cart/reducers.ts

* Fix lint error

* Remove unneeded mdlint ignore

* Update test to select a value instead of fill

* Add methods to get/set dirty customer data in local storage

* Push all customer data, not just dirty fields

* Update e2e test

* Update push changes unit test

* Update keys in mock expected arg

* Align localstorage key name with Gutenberg uppercase style

* Fix lost code after merge conflict

* Remove unnecessary metadata set in reducer

* Reimplement TS changes

* Debounce writing to localStorage

* Only update localStorage if billing/shipping changed

* Remove localStorage key when checkout is complete

* Remove unused import
2024-11-07 18:18:57 +01:00
Alexandre Lara 7d5d032145
[Experimental] Product Filters Redesign > Clear Button: Make the block respect the filter settings (#52246)
* Remove clear button when setting is disabled

* Add clear button when setting is enabled

* Move logic to a React hook

* Fix error preventing clear button from being inserted after full page reload

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

* Add e2e test

* Fix ancestor

* Fix clear button settings for the Status filter

* Move hook to the root Product Filters folder

* refactor: divide the logic into multiple functions

* refactor: move util functions to their own files

* feat: add clear button hook to all individual filters

* test: add e2e test to the Product Filter Price block

* fix: block being created with the wrong default attributes

* fix: eslint errors

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-11-07 12:51:50 -03:00
Sam Seay 30cc92fddc
Checkout: Add updated shipping method notice. (#52603) 2024-11-07 18:33:13 +13:00
Luigi Teschio ed4670243b
Add To Cart With Options - Stepper layout: implement feature under feature flag (#52573)
* Add To Cart With Options - Stepper layout: implement feature under feature flag

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

* fix E2E tests

* fix E2E test

* fix E2E test

* use setFeatureFlag across e2e test suite

* use the right feature flag

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-11-06 20:56:13 +01:00
Mike Jolley 7eabbe4ecd
Consistent payment and shipping options empty states (#52192)
* Remove inspector notice

* Replace placeholder with generic version

* Implement new placeholder

* Fix shipping method count so it excludes rows which do not link to installed payment method

* changelog

* Set default so tests pass

* unused vars

* unused import

* Remove return type and fix import warnings
2024-11-06 12:50:50 +00:00
Mike Jolley 71f28210f6
Cart Block: Refactor shipping totals. Separate cart and checkout logic. More clearly distinguish between Collection and Delivery (#52546)
* Refactor shipping totals section

From https://github.com/woocommerce/woocommerce/pull/52313/files

* style

* changelog

* More specific imports
2024-11-06 12:29:15 +00:00
Damián Suárez a1af0608b7
Fix visual issue in the Display Style of the Product Categories List block (#52609)
* export ProductCategoriesEdit default component

* disable importing experimental TS warnings

* set ToggleGroupControl instance like a block

* changelog
2024-11-06 09:25:30 +00:00
Sam Seay fb7dfa2792
[Experimental] Allow disabling product descriptions in the order summary. (#52503) 2024-11-06 17:47:54 +13:00
Tung Du 4223bf28d8
[Experimental] Remove filter overlay blocks (#52599) 2024-11-06 11:32:33 +07:00
Tung Du 7c7895ade9
[Experimental] Rating filter: fix block focus and visibility (#52579) 2024-11-06 10:53:39 +07:00
Damián Suárez 6d74a1576f
[Experimental] Price Slider block: add colors panel (#52507)
* add color block attributes

* add constant to define the color attributes

* centralize Color type

* define color types

* use UpperCase for Edit component

* render colors panel. save color values in attrs

* add a doc about colors validation

* save CSS vars and classes in the block markup

* pick and apply colors to the styles

* update markup with block colors

* firx eslint issue

* changelog

* reset all colors properly

* 80 cols

* set Color type peroperties like optional

* apply color to slider background
2024-11-05 10:49:42 +00:00
Luigi Teschio 7ee8864a33
Add to Cart Form - Stepper Layout: Ensure Compliance with min, max, and step HTML Attributes (#52487)
* Add to Cart Form: Ensure Compliance with min, max, and step HTML Attributes

* add comment

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

* improve fallback value

* remove only

* add aria-label

* remove extra space

* Update plugins/woocommerce/changelog/52487-fix-add-to-cart-form-interactivity-api

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

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

* improve variable naming

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

* Merge branch 'trunk' of github.com:woocommerce/woocommerce into fix/add-to-cart-form-interactivity-api

* improve code style

* improve E2E tests

* improve fallback value

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2024-11-05 10:03:01 +01:00
Luigi Teschio b15b04620a
Add To Cart Form - Stepper Layout: remove flex (#52481)
* Add To Cart Form - Stepper Layout: remove flex

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-11-05 09:06:23 +01:00
Manish Menaria 21934d471b
Fix: Product collection inspector control showing empty section (#52543)
* Fix: Product collection inspector control showing empty section

Previously, the inspector controls were always rendering a PanelBody element even
when the collection type wasn't hand-picked, resulting in an empty section being
displayed. This change moves the PanelBody inside the conditional rendering so
it only appears when hand-picked products are being used.

Also adds missing placeholder text to the Hand-Picked products control to improve
user experience.

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-11-05 12:59:17 +05:30
Tung Du 22070a79ed
[Experimental] Expose filter params through block context (#52492) 2024-11-05 10:35:54 +07:00
Damián Suárez ed2f002f42
Remove duplicate TS definition for currency code (#52545)
* remove duplicate TS definition for currency code

* changelog
2024-11-04 16:59:10 -08:00
Damián Suárez 5238d13632
Fix typo in useSetWraperVisibility function name (#52115)
* fix type in useSetWraperVisibility function name

* changelog
2024-11-04 19:21:34 +00:00
Karol Manijak f5d9b3adaa
Hide AbstractProductGrid blocks from inserter (soft-deprecation) (#52209)
* Hide product grid blocks from inserter

* Expose collections in the inserter

* Arrange collections imports alphabetically and registering by usage

* Add new keywords to collections

* Update tests

* Update block references

* Add changelog

* Update docs manifest

* Fix typo in collection name in test

* MAke adjsutments and cleanup of collections keywords

* Add one more keyword

* Hide Related Products from inserter

* Replace legacy Related Products with collection when transforming classic template into block one

* Replace legacy Related Products with collection in blockified Single Product Template

* Update block references and doc manifest

* Update block references

* Update tests to reflect new collection names

* Bring back pnpm-lock to original state

* Update Related Products E2E tests

* Fix the last Related Products test

* Add default queryId to Related Products pattern

* Regenerate block references and docs manifest
2024-11-04 18:57:51 +01:00
Karol Manijak a38a2052cb
[WordPress 6.7] Fix image aspect ratio in product grid blocks (#52431)
* Override user agent styling in Chrome

* Add changelog

* Change the approach

* Change the approach one more time
2024-11-04 11:38:46 +01:00
Damián Suárez be21e4ce21
Add color helpers for the Product Filters block (#52506)
* move utils.ts to utils/index.ts

* introduce color utils

* changelog

* update changelog desc
2024-11-02 10:48:13 +00:00
Roy Ho 877342cd6d
[Experimental] Product filters/active block new structure (#52268)
* Update product filters active block to new structure

* Build active chips items

* Add changelog

* Remove unneeded line-height

* Fix linting

* Fix e2e tests

* Refactor removeText

* Clean up

* Add clear button even without group

* Fix stock status name in e2e test

* Remove heading block

* Remove unused i18n module

* Remove period

* Add clear button variation description

* Fix typo

* Rename active chips to removable chips

* Extract data items from removable chips to make it reusable

* Fix e2e tests

* Add frontend script loading to null

* Don't render the block if no active filters

* Disable clear button by default

* Clean up

* Hide with iAPI

* Fix linting and e2e

* fix: add hidden tag serverside

---------

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2024-11-01 05:44:46 -07:00
Damián Suárez c0ae9b4a29
Rating Filter: first iteration of Minimum Rating feature (#52484)
* clean obsolete atttribute types

* check properly when showing no product Notice

* add new minRating attribute

* add first implementation of Minimum Rating panel

* introduce setCountVisibility internal helper

* add title to stars label

* rename vars. Simplify getting ratings data

* simplify checking rating_counts prop

* clean jsdoc block

* simpligy creating ratingOptions collection

* sort() > reverse()

* filter rating by minimum rating attr

* tidy process to render rating options

* changelog

* use Flex to layout the labels

* fix changelog typo

* import type explicitely
2024-11-01 10:45:07 +00:00
Tung Du 8bd4f9ea34
Experimental: Product Filters Overlay overhaul (#52279) 2024-11-01 12:16:59 +07:00
Sam Seay a24502fe23
Add separator to "Place order" button and use the block style variations API (#52017) 2024-11-01 05:49:23 +13:00
Sam Seay 601e14a253
Checkout: Collapsible Order Summary in mobile view (#52253) 2024-11-01 05:48:54 +13:00
Manish Menaria 928d523a35
Product Collection: Add "Rating, low to high" and "Rating, high to low" sorting options (#52372)
* Product Collection: Add "Rating, low to high" and "Rating, high to low" sorting options

This commit adds a new sorting option to the Product Collection block that allows
sorting products by rating from low to high. The existing "Top Rated" option has
also been renamed to "Rating, high to low" for consistency.

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-10-31 17:49:27 +05:30
Damián Suárez 90b8770257
Introduce file to define Product Collection types. Improve types handling. (#52458)
* introduce file to define collection data types

* do not define `results` always like an array

* update passing types to useCollection intances

* allow to set the useCollectionData response type

* reuse RatingValues type

* tidy collection types in status filter

* clean types defined in type-defs pck

* change changelog type

* update attribute filter

* move Collection Data types to product-collection folder

* update WCStoreV1ProductsCollectionProps path

* improve defining the results type for the collection

* update path to import product collection types

* fix path to import RatingValues type
2024-10-31 09:30:40 +00:00
Damián Suárez fa6eec988b
[Experimental] Rating Filter: clean code about dropdown mode (#52451)
* remove dropdown mode from InspectorControls

* clean dropdown code from Edit component

* clean block attributes and types

* changelog

* remove unused imported components

* remove unused PreviewDropdown component
2024-10-31 08:04:38 +00:00
Damián Suárez 20d210421d
Rating Filter: introduce RatingStars component (#52468)
* introduce RatingStars component

* changelog

* remove aweful inline style

* set gap zero
2024-10-31 07:33:44 +00:00
Mike Jolley e35c326b8c
Cart Block: Reduce prop drilling in shipping calculator by introducing context (#52380)
* Avoiding shipping calculator prop drilling with context

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

* useCallback for update functions

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-10-30 13:06:07 +00:00
Mike Jolley c218a82b14
Delayed account creation: Prevent duplicate after saving content (#52456)
* Register block hooks on the PHP side

* changelog

* substitute name

* indenting
2024-10-30 12:08:51 +00:00
Karol Manijak 1f03f64e4e
[WordPress 6.7] Make sure Product Image Gallery renders placeholder in Editor (#52432)
* Render placeholder of Product Image Gallery every time

* Add changelog

* Fix lint
2024-10-30 11:22:39 +01:00
Manish Menaria 4b66e42e18
Product Collection: Add "Random" sorting option (#52322)
* Add random sorting option to Product Collection block

This commit introduces a new 'Random' sorting option to the Product Collection block. The changes include:
1. Adding a new option for random sorting in the frontend UI (order-by-control.tsx).
2. Updating the backend to support the new random sorting option (ProductCollection.php).

These changes allow users to display products in a random order, enhancing the flexibility of product presentations in WooCommerce stores.

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

* Add PHP unit tests for random sorting option

* Remove "asc" suffix from random sorting option

The "asc/desc" order is not needed for random sorting. This commit:
- Changes `random/asc` to just `random` in sorting options
- Updates code to handle sorting options without order suffix
- Adds fallback to 'asc' order when no order is specified

* Fix: "order" shouldn't be present in REST API params

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-10-30 15:11:21 +05:30
Paulo Arromba 378172a63f
Renamed Local Pickup options on mock data. (#51716)
* Removed Los Angeles local pickup option from mock data.

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

* Updated js test

* Reverted js test

* Updated mockup pickup locations

* Updated mockup pickup locations

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-10-30 01:12:54 +00:00
Mike Jolley e5ca2eb011
Checkout: Add loading placeholder and payment method toggle (#52044)
* Create loading state for payment methods on block checkout

* Tidy and type fix checkPaymentMethodsCanPay

* Disable place order button before payments are Initialized

* Toggle and loading state

* changelog

* Reduce scope of change in check payment methods

* saved methods are hidden when empty
2024-10-29 11:45:40 +00:00