Commit Graph

2649 Commits

Author SHA1 Message Date
Roy Ho 255f1ff919
Product gallery/legacy/transform (#42719)
* Product Image Gallery: Add transform to Product Gallery block

* Single Product Template: Transform to blocks with new Product Gallery block

* Ensure we first check for block existance

* Add changelog

* Add/delete changelog file
2023-12-14 05:47:48 -08:00
Mike Jolley 2abd0422a8 Allow HTML in built in payment method descriptions 2023-12-13 14:37:21 +00:00
Christopher Allford ec9b7852f9
Fixed Blocks Linting Errors (#42727) 2023-12-12 15:05:20 -08:00
Ron Rennick 4fddface47
update text domain in plugins/woocommerce-blocks (#42717)
Co-authored-by: Ron Rennick <ronald.rennick@automattic.com>
2023-12-12 14:12:36 -08:00
Christopher Allford e34361695d Fixed Image Asset Paths 2023-12-09 21:26:49 -08:00
Christopher Allford cf357e809b Fixed Blocks Asset Constant Path 2023-12-09 21:20:21 -08:00
Christopher Allford 1d056b3b37 Update Blocks Text Domain 2023-12-09 05:44:54 -08:00
Arsany Benyamine 0672f73723 replace old props with variant prop (https://github.com/woocommerce/woocommerce-blocks/pull/11933)
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-12-09 00:30:33 +01:00
Tarun Vijwani 62dbd8f70d Convert PaymentMethodErrorBoundary to Class component (https://github.com/woocommerce/woocommerce-blocks/pull/12088)
* Convert PaymentMethodErrorBoundary to class component

* Remove unused expressPaymentMethodId variable
2023-12-08 16:28:55 +00:00
Mike Jolley 1535caac84 Update product category controls to use typescript (https://github.com/woocommerce/woocommerce-blocks/pull/11909)
* ProductControl is now defined in typescript. Remove todo

* Update components to typescript

* Update lifecycle test
2023-12-08 11:39:31 +00:00
Karol Manijak 31905b97f2 Make Featured Category centred horizontally (https://github.com/woocommerce/woocommerce-blocks/pull/12063) 2023-12-08 10:11:34 +01:00
Roy Ho 4992b77e49 Remove styling from sale badge (https://github.com/woocommerce/woocommerce-blocks/pull/12077)
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-12-07 18:24:18 -08:00
Tarun Vijwani 29b4217f15 Update the border colors in the Cart and Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/11474)
* Change border color to Gutenberg 100 for Cart and Checkout blocks

* Change form input color to Gutenberg 900 for Cart and Checkout blocks

* Fix additional border colors of Checkout block

* Update borders and form field colors in Cart Block

* Change border color to $universal-border-light

* Change border color for cart line items to $universal-border-light

* Change  form input fields border color to $universal-border-dark

- Add $universal-border-dark color variable for woocommerce/woocommerce-blocks#1e1e1e on white.

* Fix colors of text area border and form steps

* Change  form input fields border color to $universal-border-dark

- Add $universal-border-dark color variable for woocommerce/woocommerce-blocks#1e1e1e on white.

* Fix form steps

* Update universal dark border rgba value

- Update universal dark border rgba value from rgba(0, 0, 0, 0.882) to rgba(17, 17, 17, .80) to keep it consistent with universal-border colors

* Update $universal-border-light color

* Update the opacity of the borders

* Update the border color to rgba (17, 17, 17, 0.12)

* Roll back $universal-border-light value to the original value: 0.115

* Remove Opacity and pass it as argument in with-translucent-border

- We have with-translucent-border option that accepts border and opacity for pseudo elements.

* Remove additional spaces

* Replace with-translucent-border with normal border

- Since we're are not mixing the opacity to the border color so we don't need to use mixin with-translucent-border.

* Fix applied css and add low contrast Color usage details

-  Fix minor CSS as per the standards.
- Add comments for universal border colors that they're low contrast colors and should be used for decorative elements only

* Fix border gap and double border for multiple shipping packages

* Fix payment method borders and Cart line items borders

- Change border bottom to border-top for cart line items.
- Fix payment method radio control borders.

* Fix local pickup border

- Local pickup was using  with-translucent-borders so it has some opacity, changed it to border-bottom.

* Add border-bottom to cart items

* Remove additional border from Cart items

* Fix radio and checkbox borders as per the design

* Fix shipping method borders and background color as per the design.

* Force align left on the description for the local pickup options.

* Update border color in quantity selector component

* Fix Shipping options radio selection alignment

- Add left padding to wc-block-components-shipping-rates-control__package element.

* Update colors and variables

* Change checkbox and radio button colors

- Change checkbox and radio button colors from  rgba(25, 23, 17, 0.3) to  rgba(25, 23, 17, 0.48).

* Remove bottom property from express payment style
2023-12-07 21:37:48 +04:00
Niels Lange ab766273ff Fix font weight of cart totals title in site editor (https://github.com/woocommerce/woocommerce-blocks/pull/12051)
* Fix font weight of cart totals title in site editor

* Set explicit font-weight for th in cart line items
2023-12-07 15:55:47 +07:00
Mike Jolley 14cdc5e6f5 Use locale in isAddressComplete (https://github.com/woocommerce/woocommerce-blocks/pull/11888) 2023-12-06 16:33:15 +00:00
Karol Manijak 71640ef347 Restructure Product Collection editor files (https://github.com/woocommerce/woocommerce-blocks/pull/11981)
* Move Product Collection editor experience components into /edit directory

* Move Product Collection Inner Blocks structure to constants

* Improve the Product Collection's variations names
2023-12-06 15:50:24 +01:00
Niels Lange 69ef1b96e8 Enable new notice styles for all themes (https://github.com/woocommerce/woocommerce-blocks/pull/12043)
* Enable new notice styles

* Fix Twenty Twenty-One button background color issue
2023-12-06 15:46:22 +07:00
Luigi Teschio 1f410bdd04 fix: Product Collection: Featured Products 5 Columns improve spacing (https://github.com/woocommerce/woocommerce-blocks/pull/12041) 2023-12-06 09:05:49 +01:00
Roy Ho 6df846d11a Product gallery/fix/view all link (https://github.com/woocommerce/woocommerce-blocks/pull/11995)
* Center align view all link

* Add thumbnail count specific styling

* Product Gallery Thumbnails: Improve the responsiveness of the View All overlay text

---------

Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-12-05 16:25:41 +01:00
Albert Juhé Lluveras 9371318292 Revert "Remove unused Add to Cart product element (https://github.com/woocommerce/woocommerce-blocks/pull/11948)" (https://github.com/woocommerce/woocommerce-blocks/pull/12033)
This reverts commit 6a397d65f9.
2023-12-04 17:28:58 +01:00
Darren Ethier 795f008952 Implement the Block Hooks API to automatically inject the Mini-Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/11745)
* Change the default for Mini Cart block

The Block Hooks API currently doesn’t allow for setting the default state of the block injected into content so this ensures the mini-cart block has a better default state for injection. The current default (displaying total value in cart) takes up more width increasing the risk of poor layout.

* Utilize Block Hooks to automatically inject mini-cart block.

* include experimental prefix on filters

* Fix filter name.

* remove experimental prefix.

On thinking about this, I don’t think these need to be experimental. They are intentionally provided as escape hatches for hosts/themes that want to opt-in/out so we’ll have to support them when this is shipped (at least until its no longer needed!)

* fix variable name!

* fix unit tests because of new default

* remove another incorrect text expectation

Defaults for the block affect this expectation.

* fix E2E tests

* Mini Cart Block: improve E2E test

* fix: improve check for the Product Collection block

---------

Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2023-12-04 17:27:27 +01:00
Tung Du 2bc48e4e4a Fix: Ensure new filter blocks work with inherited query context (https://github.com/woocommerce/woocommerce-blocks/pull/12022)
* make the collection filters block available globally

* make query optional

* remove unnecessary editor contextual
2023-12-04 21:05:09 +07:00
Niels Lange 1c7d995e97 Decrease modal width (https://github.com/woocommerce/woocommerce-blocks/pull/12003) 2023-12-02 02:54:39 +00:00
Seghir Nadir 226d7de6d6 import checkbox from single place (https://github.com/woocommerce/woocommerce-blocks/pull/12015) 2023-12-01 19:40:04 +01:00
Seghir Nadir 42ee5522f9 Remove page view tracking in favor of jetpack (https://github.com/woocommerce/woocommerce-blocks/pull/12010) 2023-12-01 08:26:01 -08:00
Paulo Arromba 4e6fb96c8e Update Feedback link on Cart and Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/12006)
* Update feedback link

* Remove default url link, and make the param required
2023-12-01 13:01:42 +00:00
Paulo Arromba a07e3815c1 Update feedback link (https://github.com/woocommerce/woocommerce-blocks/pull/11999) 2023-12-01 10:16:57 +00:00
Manish Menaria 630c79adf7 Product Collection - Fix HTML Entity Decoding in Taxonomy Controls (https://github.com/woocommerce/woocommerce-blocks/pull/11982) 2023-12-01 15:11:41 +05:30
Niels Lange 7ea98576bc Limit number of visible incompatible extensions in sidebar notice (https://github.com/woocommerce/woocommerce-blocks/pull/11972)
* Limit number of visible incompatible extensions in sidebar notice

* Adjust link text

* Ensure text-decoration works in Safari

* Minor CSS tweaks

* Refactor constant names

* Adjust chevron position for opened state

* Revert "Adjust chevron position for opened state"

This reverts commit ff5142427738626837be887dd8d7e5d94c2432d4.
2023-11-30 06:37:19 -08:00
Niels Lange e1efae2fe2 Improve readability of order note (https://github.com/woocommerce/woocommerce-blocks/pull/11944) 2023-11-29 21:39:07 +07:00
Albert Juhé Lluveras a8c44eb4c7 Reviews by Product: fix reviews count not appearing in product selector (https://github.com/woocommerce/woocommerce-blocks/pull/11976) 2023-11-29 11:13:18 +01:00
Sam Seay dea8b734a6 Migrate attribute-filter block to use new interactivity store API (https://github.com/woocommerce/woocommerce-blocks/pull/11911) 2023-11-29 18:27:38 +13:00
Sam Seay 58c6339ac9 Update interactivity price filter block to use latest Interactivity Store API (https://github.com/woocommerce/woocommerce-blocks/pull/11943) 2023-11-29 17:04:35 +13:00
Karol Manijak 6a397d65f9 Remove unused Add to Cart product element (https://github.com/woocommerce/woocommerce-blocks/pull/11948)
* Remove unused Add to Cart product element

* Remove entry about Product Add to Cart product element from MD file
2023-11-28 08:34:12 +01:00
Karol Manijak 2ab440b806 Reorganise Columns controls and fix undefined problem in Product Collection settings (https://github.com/woocommerce/woocommerce-blocks/pull/11937)
* Reorganise Columns controls and fix undefined problem in Product Collection settings

* Remove type condition in hasValue of Columns control

* Adjust the E2E tests locator to new changes
2023-11-28 08:33:31 +01:00
Niels Lange 5f0c4726a8 Investigate E2E CI caching issue (https://github.com/woocommerce/woocommerce-blocks/pull/11874)
* Try env:restart instead of env:start

* Change env:restart to env:start again

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Adjust heading level of cart and checkout template

* Replace button selector with label selector

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Ensure to close welcome guide modal

* Adjust heading level of default template content

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Try env:restart instead of env:start

* Change env:restart to env:start again

* Address existing TS issues

* View template in edit mode

* Keep certain tests skipped

* Fix broken tests after addressing TS issues
2023-11-28 14:16:45 +07:00
Roy Ho 58c130af79 Remove unneeded block type check (https://github.com/woocommerce/woocommerce-blocks/pull/11964) 2023-11-27 13:11:51 -08:00
Mike Jolley 4a13e5faf0 Switch to NoticeBanner component inside Store Notices Block placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/11920) 2023-11-27 13:43:42 +00:00
Arsany Benyamine fa1f2896fb replace Stories root Dir to "External Components" (https://github.com/woocommerce/woocommerce-blocks/pull/11910) 2023-11-27 04:14:58 -08:00
Alba Rincón 1c325c3ea9 Convert to tsx and replace proptypes by ts definitions (https://github.com/woocommerce/woocommerce-blocks/pull/10471)
* Convert to tsx and replace proptypes by ts definitions

* Fix imports

* Fix noReviewsPlaceholder type

* Fix ts errors

* Use createHigherOrderComponent in withReviews

* Revert hoc change

---------

Co-authored-by: Niels Lange <info@nielslange.de>
2023-11-27 12:08:17 +01:00
Manish Menaria 53944beeb3 [Product Collection] Fix: HTML entity decoding for product names in Hand-Picked Products (https://github.com/woocommerce/woocommerce-blocks/pull/11927)
* Add HTML entity decoding for product names in Hand-Picked Products control

In the Hand-Picked Products control within the product-collection inspector controls, a function for decoding HTML entities in product names has been added.

- A new utility function `decodeHTMLEntities` has been implemented. This function decodes HTML entities in a string, ensuring that special characters are correctly displayed in their human-readable form.
- The `transformTokenIntoProductName` function has been updated to utilize `decodeHTMLEntities`. Now, when a product name is fetched (either directly as a token or via a product ID), the HTML entities within the name are decoded.
- This enhancement ensures that product names containing characters like ampersands or other HTML entities are accurately displayed in the UI.

This change improves the readability and accuracy of product names within the Hand-Picked Products control, enhancing the user experience for store managers using WooCommerce Blocks.

* Update label and hide description

This commit updates the `HandPickedProductsControl` component. Specifically, the user-facing label for product selection has been changed from 'Pick some products' to 'Hand-picked Products'. Additionally, the `__experimentalShowHowTo` property has been added with a `false` value, to hide description. Corresponding changes have been made in the E2E test file `product-collection.block_theme.spec.ts`, where the filter name is updated to match the new label.

* Refactor: Replace custom HTML entity decoder with `@wordpress/html-entities`

Rationale:
- The shift to `@wordpress/html-entities` aligns with standard WordPress practices, ensuring consistency across the platform.
- Enhances maintainability by relying on a well-supported library rather than custom code.
- Simplifies the codebase by removing a redundant utility function.

This change enhances the robustness of our code and aligns with best practices in WordPress development.
2023-11-27 12:27:04 +05:30
Sam Seay 1cd4df5b19 Migrate interactivity stock filter to new store API, add improvements and bugfixes (https://github.com/woocommerce/woocommerce-blocks/pull/11827) 2023-11-27 17:26:01 +13:00
Daniel Dudzic 590263543f Product Gallery Thumbnails: Add support for cropping (https://github.com/woocommerce/woocommerce-blocks/pull/11718)
* Product Gallery Thumbnails: Refactor sizing in the editor and the front end

* Product Gallery Thumbnails: Change default vertical alignment to top and better control the width of the thumbnails

* Product Gallery Thumbnails: Fix thumbnails cropping based on the 'Crop images to fit' setting

* Product Gallery Thumbnails: Revert thumbnails styling from woocommerce/woocommerce-blocks#11665

* Product Gallery Thumbnails: Update the default value of the cropImages setting to false
2023-11-24 23:49:44 +01:00
Daniel Dudzic 38b0001735 Product Gallery Thumbnails: Fix overflow issues and improve responsiveness (https://github.com/woocommerce/woocommerce-blocks/pull/11665)
* Product Gallery Thumbnails: Refactor sizing in the editor and the front end

* Product Gallery Thumbnails: Change default vertical alignment to top and better control the width of the thumbnails

* Product Gallery Thumbnails: Restrict the bottom position thumbnails width based on the total number of thumbnails set

* Product Gallery: Remove hardcoded width for Thumbnails and the Large Image and update the width inside of the Dialog

* Product Gallery Thumbnails: Introduce thumbnails scaling based on the number of thumbnails

* Product Gallery Thumbnails: Fix editor thumbnails scaling

* Product Gallery Thumbnails: Remove unused column gap variable

* Product Gallery Thumbnails: Fix styling for vertical images

* Product Gallery: Remove the unused editor.scss file

* Product Gallery: Fix the placement of the Thumbnails block in the block template

* Product Gallery Dialog: Reset changes to the dialog

* update @wordpress/e2e-test-utils-playwright package

* don't update node version

* remove waitForSiteEditorFinishLoading function

* use visitSiteEditor util

* Product Gallery Thumbnails: Add code comments

* Product Gallery Thumbnails E2E: Fix the test checking the default position of the thumbnails

* Product Gallery E2E: Fix the test checking if the cropping setting works correctly

* Product Gallery Thumbnails: Hide the Thumbnails block if there aren't at least 2 thumbnails to display

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2023-11-24 21:31:02 +01:00
Sam Seay 9168b47f33 Translate the prefixes passed to post-terms in product-meta. (https://github.com/woocommerce/woocommerce-blocks/pull/11811) 2023-11-24 17:33:28 +13:00
Albert Juhé Lluveras c422227341 Fix an issue that caused the Order by select in Reviews blocks to always be disabled (https://github.com/woocommerce/woocommerce-blocks/pull/11918) 2023-11-23 12:59:14 +01:00
Karol Manijak b5e91ee460 Enable shrink columns option in Product Collection by default (https://github.com/woocommerce/woocommerce-blocks/pull/11821)
* Enable shrink columns option in Product Collection by default

* Improve tests about responsiveness

* Make regex allowing for floating pixels

* Related products should not use sticky and author attribute or have hardcoded queryId

* Bring back properties for Related Products as it's based on Propducts block, not Product Collection

* Enable shrink columns to fit by default in patterns
2023-11-23 10:10:19 +01:00
Karol Manijak 41d5a4bda6 Prevent shrinkColumns value when switching the layout type of Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/11905) 2023-11-23 08:17:35 +01:00
Roy Ho 82583fa3fb Don't register or unregister if block can't be found (https://github.com/woocommerce/woocommerce-blocks/pull/11872) 2023-11-22 12:50:56 +00:00
Niels Lange a0592778b6 Update notice for default cart and checkout (https://github.com/woocommerce/woocommerce-blocks/pull/11861)
* Update notice for default cart and checkout

* Show full translatable string
2023-11-21 21:23:13 +07:00
Thomas Roberts 409988881b Move `CheckboxControl` to components package and leave alias in checkout package (https://github.com/woocommerce/woocommerce-blocks/pull/11662) 2023-11-21 10:55:42 +00:00
David Arenas 9e9f0341e2 Interactivity API: implement the new `store()` API (https://github.com/woocommerce/woocommerce-blocks/pull/11071)
* Sync Interactivity API code with Gutenberg

* New store() API

* Store raw actions

* Update wc-interactivity-store implementation

* Replace `wc_store` with `wc_initial_state`

* Parse and populate initial state

* Allow store parts in `store()`

* Accept namespaces in directive paths

* Add $$namespace to directives' object values

* Make namespace parsing more robust

* Use DeepPartial type for store parts

* Do not pass `rawStore` to `afterLoad` callbacks

* Simplify `store()` a bit

* Implement `privateStore()`

* Sync context directive with Gutenberg

* Refactor scope and extract getters per scope

* Add namespace to getters and actions

* Remove current privateStore implementation

* Remove `afterLoad` option from `store`

* Use same proxy handlers for ns, getters and actions

* Set scope inside `evaluate`

* Refactor proxy handlers

* Improve types a bit

* Catch errors in async actions

* Implement stacks for scopes and namespaces

* Implement `getElement`

* Change directives object structure

* Remove unnecessary import

* Implement private stores

* Return value from sync actions

* Minor optimizations and improved comments

* Don't use async inside `data-wp-watch`

* Use a single Provider in context directive

* Remove DeepPartial type

* Do not check if element exists

* Add the `current` prop of state inside the scope

* Move getters outside scope

* Fix wc-key assignment

* Fix missing `navigate` in directives

* Fix namespace not being picked in the same element

* Deep merge raw stores instead of proxied ones

* Fix namespace assignment

* Allow forward slashes in namespaces

* Migration of Product Collection and Product Button blocks to the new `store()` API (https://github.com/woocommerce/woocommerce-blocks/pull/11558)

* Refactor Product Button with new store() API

* Use `wc_initial_state` in Product Button

* Fix namespace

* Remove unnecessary state

* Test namespaces in directive paths

* Add test context with namespace

* Simplify woo-test context

* Move addToCart and animations to a file

* Do not pass `rawStore` to `afterLoad` callbacks

* Move callbacks and actions back to the main file

Because the animation was broken.

* Remove selectors in favor of state

* Use default ns in `getContext` for state and actions

* Remove `afterLoad` callback

* Remove unnecessary ns

* Fix getContext in add-to-cart

* Replace namespace and delete unnecessary store

* Pass context types only once

* Use an alternative for requestIdleCallback

* Add previous react code for notices

* Add namespace to Product Collection block

* Replace getTextButton with getButtonText

* Add block name to the ProductCollection namespace

* fix style HTML code

* Remove circular deps error on the Interactivity API

* Product Gallery block: Migrate to new Interactivity API store (https://github.com/woocommerce/woocommerce-blocks/pull/11721)

* Migrate Product Gallery block to new Interactivity API store

* Fix some references

* Add missing data-wc-interactive

* Fix an additional namespace

* Remove unnecessary click handler

* Dialog working

* Refactor action names

* Reindex PHP array

There was some missing indexes, which turned the array into an object in JS.

* Remove unused event handlers

* Move next/previous logic to external function

* Move StorePart util to the types folder

* Rename namespace to `woocommerce/product-gallery`

* Undo product collection namespace renaming

* Remove unnecessary namespace

* Don't hide the large image on page load

* Minor refactorings

* Fix eslint error

* Fix php cs errors with spacing and double arrows alignment

* Disable no-use-before-define rule for eslint

* Disable @typescript-eslint/ban-types rule for eslint

* Fix parsed context error in e2e tests

* Fix context parser for Thumbnail image

* Move store to the top of the frontend file

* Add interactivity api utils to the @woocommerce/utils alias

* Replace deprecated event attribute

---------

Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: roykho <roykho77@gmail.com>

---------

Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>

* Fix error when closing product gallery dialog with keyboard escape key

* use wc_initial_state instead of wc_store

---------

Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>
2023-11-21 11:46:15 +01:00
Tung Du 3b31aa715c add: default template for Collection Filters block (https://github.com/woocommerce/woocommerce-blocks/pull/11805) 2023-11-21 16:25:43 +07:00
Tung Du 182e821539 MVP: Attribute filter block powered interactivity API (https://github.com/woocommerce/woocommerce-blocks/pull/11749)
* Update Interactivity API JS files

* Disable TS checks in the Interactivity API for now

* Add new SSR files

* Replace wp_ prefixes with wc_ ones

* Replace wp- prefix with wc-

* Replace guternberg_ prefix with woocommerce_

* Remove file comments from Gutenberg

* Rename files with `wp` prefix

* Fix code to load Interactivity API php files

* Remove TODO comments

* Replace @wordpress with @woocommerce

* Update Webpack configuration

* Fix directive prefix

* Remove interactivity folder from tsconfig exclude

* Add client-side navigation meta tag code

* Remove unneeded blocks.php file

* Fix store tag id

* Register Interactivity API runtime script

* Fix Interactivity API runtime registering

* Add Simple Price Filter block

* Remove all files related to directive processing in PHP

* Use values directly for SimplePriceFilter SSR

* Reset pages to 0 when changing filter

Note: we also need to do this with `/page/x`

* wip

* phpcs

* register price filter as inner block

* try: render block using save

* add types

* use min range var instead of 0

* inject dynamic data

* query price data in editor

* better injecting interactivity data

* remove rounding

* Product Collection Data endpoint doesn't care about current query so we remove the context for now

* extract data injecting as a method, possbily a trait in the future

* add sidebar setting

* duplicating the markup in php render callback for safety

* remove directive from edit component

* show prices without decimal

* use final class

* use sample collection data response

* prepare for multiple styles support

* use collection data from context

* cleanup props and props passing

* pass only necessary states

* retire heredoc in favor of late escaping

* reorganize style

* inherit style from current price filter react component, pre extract the component for multiple display style support

* keep minPrice smaller than max

* remove unnecessary active handler logic

* update folder structure

* avoid whitespace change

* clean up

* title

* move inspector to component folder, ready to be extracted to inner block

* block icon

* block name

* name

* use inner block for view

* inner block view switcher

* try: process data in Collection Filtes block only

* wip: query collection data from collection filters block only

* provide all context from collection filters block

* simplify context passing

* feat: use default attribute to define filter type of view block

* rename

* remove price block

* rename price slider to price, default price filter should be a slider

* type cleanup

* fix ancestor block name

* only passing the collection data down

* wip

* recusive

* editor preview

* refactor: data fetching, context passing, and code organization

* initial attribute filter block

* feat: attribute selector

* inspector control

* wip

* break the edit into smaller components

* wip: editor component

* extract checkbox list

* wip editor preview

* show count checkbox list

* fix param aggregation for attribute filter blocks

* post merge fix

* fix param aggregation for attribute filters

* fix: set correct selected attribute

* WIP checkbox list

* WIP checkbox list

* avoid action name conflicts

* Checkbox list front end

* phpcs

* update context on input, navigate on change

* fix: attribute selection

* dropdown

* remove isDeepEqual

* add: warning when attribute has no products or no attribute is selected

* update type

* update type

---------

Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
2023-11-21 14:22:20 +07:00
Manish Menaria 26550194d3 Product Collection - New 'No Results' block with default UI (https://github.com/woocommerce/woocommerce-blocks/pull/11783)
* Add custom 'No Results' block for Product Collection

This commit introduces a new 'No Results' block, replacing the default core 'query-no-results' block within product collection block. The 'No Results' block provides a tailored experience for WooCommerce stores, displaying a custom message when no products are found in a query.

Key changes include:
- A new block type 'woocommerce/no-results' is registered with a complete configuration and content structure.
- Edit and save functions are implemented for the block, allowing for custom content and styles within the block editor and on the front end.
- Webpack entries are updated to include the new block in the build process.
- A PHP class NoResults is added for server-side rendering, which only displays the block when the product query returns no results, enhancing performance.
- The ProductCollectionUtils utility class is extended to support the new block's query needs.

The new block enriches the user experience by providing clearer communication when no products match the collection criteria and allows store owners to customize the message and presentation.

* Update description

* Rename 'no-results' block to 'product-collection-no-results'

Changes include:
- Updating the block name in `edit.tsx` within the `product-collection` directory.
- Modifying the block.json file in the `no-results` inner block to reflect the new name.
- Adjusting the className in `edit.tsx` for the `no-results` inner block.
- Altering the webpack entries in `webpack-entries.js` to recognize the new block name.
- Renaming the block in `NoResults.php` to align with this update.

This renaming aims to make the block's purpose more clear and to maintain a consistent naming scheme within our product collection blocks.

* Rename NoResults to ProductCollectionNoResults for clarity

This commit renames the `NoResults` class to `ProductCollectionNoResults`. The change aims to enhance clarity and specificity about the class's purpose, indicating that it specifically handles no-result scenarios within product collections.

Changes made:
- Renamed `NoResults.php` to `ProductCollectionNoResults.php`.
- Updated the class name from `NoResults` to `ProductCollectionNoResults` in the file.
- Modified the reference in `BlockTypesController.php` to use the new class name.

This renaming ensures better readability and understanding of the class's role in the context of product collections. The primary change is the renaming, with no significant alterations in the class functionality.

* Update No-Results Message Formatting in Product Collection Block

This commit simplifies the layout and message content for the 'No results found' message in the product collection block's no-results edit component. The changes include:

1. Removal of the full stop in the 'No results found' string for consistency.
2. Replacing the 'core/group' block with a 'core/paragraph' block.
3. Streamlining the message content to be more concise and integrated into fewer text blocks.
4. Direct links for 'clearing any filters' and navigating to the 'store's home' are now included in the same paragraph.

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-11-20 13:18:59 +00:00
Niels Lange e6a885283b Increase CSS specificity for local pickup address (https://github.com/woocommerce/woocommerce-blocks/pull/11772)
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-11-20 13:07:00 +00:00
Thomas Roberts cc84383730 Move all totals components into components package (https://github.com/woocommerce/woocommerce-blocks/pull/11773)
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-11-20 12:53:41 +00:00
Mike Jolley 1f1808e616 Fix strings in classic-checkout modal window (https://github.com/woocommerce/woocommerce-blocks/pull/11771)
* Fix strings in modal window

* Update assets/js/editor-components/incompatible-extension-notice/modal.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

---------

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2023-11-20 12:36:49 +00:00
dependabot[bot] 471b9a1b60 Bump @wordpress/icons from 6.1.1 to 9.36.0 (https://github.com/woocommerce/woocommerce-blocks/pull/11611)
* Bump @wordpress/icons from 6.1.1 to 9.36.0

Bumps [@wordpress/icons](https://github.com/WordPress/gutenberg/tree/HEAD/packages/icons) from 6.1.1 to 9.36.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/icons/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/icons@9.36.0/packages/icons)

---
updated-dependencies:
- dependency-name: "@wordpress/icons"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add sparkles icon to codebase

* Fix failing JS-unit tests

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
2023-11-16 17:40:53 +00:00
Mike Jolley 377a3d9931 Make "Use same address for billing" visible by default (https://github.com/woocommerce/woocommerce-blocks/pull/11804) 2023-11-16 16:41:52 +00:00
Alexandre Lara c8ef0fb3af Product Gallery block: Restrict block to be available only on the Single Product template or the Product Gallery template part (https://github.com/woocommerce/woocommerce-blocks/pull/11664)
* WIP: experimenting with strategy pattern for block registration

* Add TemplateChangeDetector to BlocksRegistrationManager

* Handle blocks registration

* Fix issue causing blocks to be registered multiple times

* Allow register/unregister blocks when on pages or posts

* Add BlockRegistrationStrategy logic

* Fix import error

* Add doc comments for BlockRegistrationManager class

* Add doc comments to TemplateChangeDetector class

* Fix eslint errors

* Import domReady from @wordpress/dom-ready

* Prevent error when using blockName for registerBlockType function

* Add e2e tests to check for block availability in different contexts

* Add e2e tests to cover block availability on different contexts
2023-11-16 15:03:58 +00:00
Roy Ho 8f3f630522 Product gallery/dialog/enhancement (https://github.com/woocommerce/woocommerce-blocks/pull/11755)
* Hide pager in dialog

* Product Gallery: reset main image when dialog closes

* Product Gallery block: Add product title to dialog

* Align double arrow

* Use H2 to be more semantic

* Use product title block in template part

* Default pager to off

* Remove pager only in dialog

* Remove unused param

* Default pager to off instead of removing
2023-11-15 13:05:51 -08:00
Mike Jolley fd4675aa6a Refactor default editing state for customer address fields (https://github.com/woocommerce/woocommerce-blocks/pull/11765)
* Refactor default editing state for customer address fields

* Exclude email from invalid props check

* Merge conflict
2023-11-15 15:22:36 +00:00
Sam Seay d62b950aae Add a stock filter block powered by the interactivity API (https://github.com/woocommerce/woocommerce-blocks/pull/11663) 2023-11-15 16:50:05 +13:00
Seghir Nadir 49579f4aa0 Move phone to default fields section instead of being handled inline. (https://github.com/woocommerce/woocommerce-blocks/pull/11651)
* Move phone to default fields section

* remove unused files and actions
2023-11-14 18:30:23 +00:00
Alex Florisca 9ad8323851 Move Button, StoreNotice and StoreNoticesContainer components into the components package (https://github.com/woocommerce/woocommerce-blocks/pull/11766)
* Move Button, StoreNotice and StoreNoticesContainer components into the components package

* Delete the button folder and leave alias in index.ts

* Update references from @woocommerce/blocks-checkout to @woocommerce/blocks-components
2023-11-14 16:32:53 +00:00
Thomas Roberts cb468c8ade Move `TextInput`, `ValidatedTextInput` and `ValidationInputError` to the `@woocommerce/blocks-components` package. (https://github.com/woocommerce/woocommerce-blocks/pull/11654) 2023-11-14 14:52:14 +00:00
Caleb Mazalevskis 55f3cededf Fix typo. (https://github.com/woocommerce/woocommerce-blocks/pull/11382) 2023-11-14 13:11:14 +13:00
Mike Jolley c93ee12770 Fix TT4 mobile styling for cart and notes field on checkout (https://github.com/woocommerce/woocommerce-blocks/pull/11742)
* Add box-sizing to textarea

* Fix cart mobile border
2023-11-13 12:52:29 +00:00
Niels Lange 1228e9bf83 Ensure that incompatible notices are displayed in Safari. (https://github.com/woocommerce/woocommerce-blocks/pull/11736) 2023-11-10 21:52:50 +01:00
Thomas Roberts abd32b21c9 Move `Panel` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11698) 2023-11-10 18:56:40 +00:00
Daniel Dudzic ff680940e4 Product Gallery Pager: Remove unnecessary margin (https://github.com/woocommerce/woocommerce-blocks/pull/11287) 2023-11-10 09:40:45 +01:00
Saad Tarhi 2182457673 Fix the Layout for Shipping and Billing Address Forms in the Checkout Block (https://github.com/woocommerce/woocommerce-blocks/pull/11486)
* Fix empty spaces in the address form

* Fix checkout layout for Japan and Hungary

* Added some comments in CSS
2023-11-10 08:07:49 +01:00
Tung Du d881fe208d Fix: different collection data request between editor and front end (https://github.com/woocommerce/woocommerce-blocks/pull/11710) 2023-11-10 11:04:49 +07:00
Roy Ho ec8207e06c Product Gallery: Fix limited images displayed in the dialog (https://github.com/woocommerce/woocommerce-blocks/pull/11716)
* Product Gallery: Fix limited images displayed in the dialog

* Fix linting errors
2023-11-09 14:10:31 -08:00
Mike Jolley daea9f0fdf Fix address block invalidations in the editor and address card display in Firefox (https://github.com/woocommerce/woocommerce-blocks/pull/11714)
* Add checks to see if getCartData finished before rendering address

* Prevent block error due to excessive updates of customValidation

* Do not condense address in admin and handle phone field

* Add missing showPhoneField for billing

---------

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2023-11-09 16:25:28 +00:00
Karol Manijak 955332941e Translate Related Products heading in Single Product template (https://github.com/woocommerce/woocommerce-blocks/pull/11693)
* Create Related Products pattern reused in the Single Product template

That's needed in order to make the Related Products string translatable

* Add margin to Related Products heading

* Add margin to Related Products transformed from classic template

* Simplify the translation

* Change string capitalization so it's the same as the other one and can be transklated
2023-11-09 09:00:23 +01:00
Manish Menaria 033a92d536 Product Collection: Add support for filtering products by featured status (https://github.com/woocommerce/woocommerce-blocks/pull/11522)
* Add support for filtering products by featured status

- Added `featured` attribute to `ProductCollectionQuery` type to enable filtering by featured status.
- Implemented `FeaturedProductsControl` to provide a toggle option in the inspector controls.
- Integrated `FeaturedProductsControl` into `ProductCollectionInspectorControls`.
- Added `get_featured_query` function in `ProductCollection` class to generate query for fetching featured products.
- Updated existing functions and queries in `ProductCollection` class to support featured products filtering.

* Revert changes to composer.lock

* Refactor handling of 'featured' parameter

This commit makes the handling of the 'featured' parameter consistent in the ProductCollection class. Previously, the 'featured' parameter was being type-casted to boolean, which was not necessary and could lead to incorrect results. Now, the 'featured' parameter is used directly without type-casting, and the check for 'featured' products in the get_featured_query method has been updated accordingly. This ensures that the 'featured' parameter is handled consistently and correctly throughout the class.

* Handle undefined 'featured' index

This commit adds null coalescing operator to handle the case when 'featured' index is not set in the $query array. This prevents potential PHP notices or errors that may arise when trying to access an undefined index.
2023-11-08 15:37:32 +05:30
Manish Menaria b177aa9048 Product Collection - Add `Created` filter in inspector controls (https://github.com/woocommerce/woocommerce-blocks/pull/11562)
* Add time frame filter to Product Collection block

This commit introduces the ability to filter products within the Product Collection block by a specified time frame. The changes include:

- A new 'timeFrame' property added to the DEFAULT_QUERY constant in constants.ts, initialized as null, allowing for the storage of time frame data.
- Creation of a new component `CreatedControl` in created-control.tsx that provides UI elements for selecting a time frame filter.
- Inclusion of `CreatedControl` in the Product Collection Inspector Controls.
- Expansion of the ProductCollectionQuery interface in types.ts to include a 'timeFrame' attribute.
- Addition of the 'timeFrame' parameter handling within the ProductCollection PHP class to construct and execute the date query based on the provided time frame.

The addition of the time frame filter offers enhanced flexibility in presenting products and allows users to dynamically segment their product lists based on product creation dates.

* Refactor: Standardize 'timeFrame' to be 'undefined' instead of 'null'

This commit includes a refactoring that changes the initialization and reset values for the `timeFrame` property from `null` to `undefined`. This standardization affects the constants, type definitions, and the handling of the `timeFrame` property in both the inspector controls and the PHP backend.

* Switch date query to use post_date_gmt for DST consistency

This commit changes the column reference in the date query from 'post_date' to 'post_date_gmt'. This update ensures that the product collection filtering is based on Coordinated Universal Time (UTC) rather than local time, which can be affected by Daylight Saving Time (DST) shifts. The modification will lead to more consistent and reliable behavior across different time zones and during DST changes.

* Capitalize toggle group labels

The following adjustments have been made:
- Introduced a constant `uppercaseStyle` to store the `{ textTransform: 'uppercase' }` style.
- Applied `uppercaseStyle` to both the 'IN' and 'NOT IN' toggle options to ensure label text is consistently uppercase.
- Updated the 'Not in' label text to uppercase ('NOT IN') to match the newly applied style.

These changes ensure that the toggle labels align with the design guidelines that call for uppercase styling in control elements.

* Make first letter of first work capital

* Rename to Within & Before

* Update i18n for Product Collection query operators

This commit updates the internationalization (i18n) for the Product Collection query operators in the 'Created' control component of the WooCommerce Blocks plugin. It replaces the '__' function with '_x' for translation and provides context comments for better translation handling. This improvement enhances the localization of the query operators for better multilingual support.
2023-11-08 14:32:49 +05:30
Karol Manijak a2103ed8fd Update Feedback Prompt styles by removing horizontal margin causing scroll to show up (https://github.com/woocommerce/woocommerce-blocks/pull/11619) 2023-11-07 21:54:35 +01:00
Daniel Dudzic 50a224bca3 Product Button: Remove the hardcoded width and padding (https://github.com/woocommerce/woocommerce-blocks/pull/11537)
* Product Button: Remove the hardcoded width in favor of additional margin for :before and :after

* Product Button: Remove :after and :before margin
2023-11-07 17:46:20 +00:00
Alexandre Lara 1f1c252617 Product Gallery block: Disable zoom when hovering the Next/Previous buttons (https://github.com/woocommerce/woocommerce-blocks/pull/11538)
* Disable zoom when hovering next/previous buttons

* Improve logic to disable zoom when not hovering over the large image
2023-11-07 12:34:41 -03:00
Luigi Teschio 948fc1ac53 Filter By Rating: fix overlapping stars (https://github.com/woocommerce/woocommerce-blocks/pull/11644) 2023-11-07 10:59:36 +00:00
Tung Du 73f9b997cc Collection Filters refactor: data fetching, context passing, and code organization (https://github.com/woocommerce/woocommerce-blocks/pull/11476) 2023-11-07 14:55:23 +07:00
Albert Juhé Lluveras 33bc75801e Add to Cart with Options block: fix inconsistency between editor and frontend (https://github.com/woocommerce/woocommerce-blocks/pull/11614)
* Add to Cart with Options block: fix inconsistency between editor and frontend

* Typo

* Use same margin values as block theme stylesheet
2023-11-06 16:30:25 +01:00
Roy Ho 4cdffc3b07 Product Gallery: Add e2e tests for crop image option (https://github.com/woocommerce/woocommerce-blocks/pull/11559) 2023-11-06 07:17:25 -08:00
Tung Du a52234e757 Fix: Make filter block contextual - Editor (https://github.com/woocommerce/woocommerce-blocks/pull/11218) 2023-11-06 14:14:58 +07:00
Mike Jolley 67f341899d Add back missing render-checkout-form hook (https://github.com/woocommerce/woocommerce-blocks/pull/11554) 2023-11-03 16:30:40 +00:00
Albert Juhé Lluveras c902a215d1 Prevent Sale badge overflowing the Product Image in some product grid blocks (https://github.com/woocommerce/woocommerce-blocks/pull/11556) 2023-11-03 09:42:40 +01:00
Daniel Dudzic f74aafe1bf Product Gallery Thumbnails: Add View all overlay (https://github.com/woocommerce/woocommerce-blocks/pull/11087)
* Product Gallery Thumbnails: Add View All link to the last thumbnail (non-interactive)

* Product Gallery Thumbnails: Add interactivity to the View All overlay

* Product Gallery Thumbnails: Refactor View all html to make it more readable

* Product Gallery Thumbnails: Fix woocommerce/woocommerce-blocks#11100 - Load all thumbnails and hide the View all overlay when in Dialog

* Product Gallery Thumbnails: Fix woocommerce/woocommerce-blocks#11099 - Enable the dialog for the View all thumbnails overlay even when the 'Full-screen when clicked' setting is disabled

* Product Gallery Thumbnails: Remove unnecessary concatenation from the View all html

* Product Gallery Thumbnails: Abstract the View All conditions into separate functions for readability

* Product Gallery Thumbnails: Add escaping to the View all plain text string

* E2E: Fix the Sale Badge and Single Product Template tests by selecting the first Sale Badge
2023-11-02 21:05:20 +01:00
Alba Rincón a4e7c4f43d Inherit the line height (https://github.com/woocommerce/woocommerce-blocks/pull/11553) 2023-11-02 16:59:27 +01:00
Mike Jolley ba09750661 Add Notices Documentation to Storybook and upgrade to Storybook 7 (https://github.com/woocommerce/woocommerce-blocks/pull/11524)
* Rename stories

* MDX guidelines

* dedupe and fix dependencies

* Notice Banner Docs

* Fix root elements and icon library docs

* Fix ProductPrice stories

* Organise storybook structure

* Fix error placeholder story

* Snackbar docs

* Missing dotenv dependency

* Update storybook/main.js

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/snackbar-list/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/notice-banner/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/snackbar-list/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/snackbar-list/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/snackbar-list/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/snackbar-list/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/snackbar-list/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update assets/js/base/components/snackbar-list/docs/docs.mdx

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Update package lock

* update snaps

* fix json error check

---------

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2023-11-02 13:01:42 +00:00
Niels Lange 2d144de9fc Introduce hover-effect() mixin (https://github.com/woocommerce/woocommerce-blocks/pull/11526) 2023-11-02 16:16:19 +07:00
Thomas Roberts aba0dfed0a Move `Title` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11383) 2023-11-01 03:40:29 -07:00
Roy Ho 6f9f9b10c5 Product gallery/add crop images (https://github.com/woocommerce/woocommerce-blocks/pull/11482)
* Product Gallery: Add cropped image support

* Product Gallery: Add cropped image support

* Clean up

* Create the crop dimensions based on smallest original image dimension

* Bail if image is not available
2023-10-31 15:23:57 -07:00
Daniel Dudzic 534a0dcd62 All Products: Add cursor pointer when hovering over pagination items (https://github.com/woocommerce/woocommerce-blocks/pull/11502) 2023-10-31 21:18:44 +00:00
Mike Jolley 46063d8fdd match values before looking at labels (https://github.com/woocommerce/woocommerce-blocks/pull/11410) 2023-10-31 15:48:34 +00:00
Lucio Giannotta 084a2acd90 Remove bullet points and unnecessary padding from `SearchListControl` (https://github.com/woocommerce/woocommerce-blocks/pull/11444) 2023-10-30 08:33:19 +01:00
Saad Tarhi 96a291f1b7 Fix products incorrectly marked as discounted (https://github.com/woocommerce/woocommerce-blocks/pull/11386)
* Fix: Remove incorrect discount label

We don't want to mark a product as having a discount when price includes
additional costs

* Add "goToCart" E2E helper function

* Add the CartPage class

* Add the Cart product price E2E tests

* Remove unnecessary comments

* Mark the Cart shopper E2E testing file as a having side effects

* Fix the "Strict mode violation" error

* Try another fix for the "Strict mode violation"
2023-10-27 21:54:13 +01:00
Alexandre Lara 6c69744d26 Product Gallery block: Add support for variation image updates (https://github.com/woocommerce/woocommerce-blocks/pull/11459)
* Add `data-wc-init` directive to Interactivity API

* Add support for variation image updates on the Product Gallery block

* Watch correct form based on the product id

* Fix php cs error

* Fix php cs error

* Prevent adding wc-init to non-variable products
2023-10-27 14:12:32 -03:00
Luigi Teschio 3e17afdbec "Product Collection X Columns" patterns: align "no reviews" text with the star (https://github.com/woocommerce/woocommerce-blocks/pull/11468)
* improve line-height

* use variable
2023-10-27 11:42:17 +02:00
Thomas Roberts 1a4968fa66 Fix for storybook to ensure all components render (https://github.com/woocommerce/woocommerce-blocks/pull/11465) 2023-10-27 02:05:43 -07:00
Alexandre Lara f512ea769a Add `data-wc-init` directive to Interactivity API (https://github.com/woocommerce/woocommerce-blocks/pull/11458) 2023-10-26 22:59:57 -03:00
Thomas Roberts dbcb867141 Move `SortSelect` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11411) 2023-10-26 04:55:34 -07:00
Niels Lange 934c72e28d Improve the data stores documentation (https://github.com/woocommerce/woocommerce-blocks/pull/11336)
* Update data store docs

* Link related docs to /docs/third-party-developers/extensibility/data-store

* Improve data store overview

* Remove obsolete entry

* Update TOC of docs/third-party-developers/extensibility/data-store/store-notices.md

* Update TOCs

* Update link titles

* Replace primary key with import statement

* Optimise Validation Store description

* Keep store IDs in title

* Correct wrong key

* Optimise data store docs overview

* Explain the difference between cart and checkout store

* Add example to Validation Store

* Add example to Validation Store

* Add overview text to collections.md

* Add example to store-notices.md

* Update TOC of store-notices.md

* Update overview description of store-notices.md

* Add code snippets for displaying the validationError message

* Update data store docs

* Link related docs to /docs/third-party-developers/extensibility/data-store

* Improve data store overview

* Remove obsolete entry

* Update TOC of docs/third-party-developers/extensibility/data-store/store-notices.md

* Update TOCs

* Update link titles

* Replace primary key with import statement

* Optimise Validation Store description

* Keep store IDs in title

* Correct wrong key

* Optimise data store docs overview

* Explain the difference between cart and checkout store

* Add example to Validation Store

* Add example to Validation Store

* Add overview text to collections.md

* Add example to store-notices.md

* Update TOC of store-notices.md

* Update overview description of store-notices.md

* Add code snippets for displaying the validationError message

* Mention full link in assets/js/data/cart/README.md

* Changed Store-Notices to Store Notices
2023-10-26 09:37:13 +07:00
Tarun Vijwani 503b2c8dbb Display shipping calculator link for guests shopper (https://github.com/woocommerce/woocommerce-blocks/pull/11442)
* Display shipping calculator when formatted address is present

- Earlier, shipping calculator was getting displayed based on the isAddressComplete value.
- For the scenarios where address was incomplete but formatted address was present shipping calculator was not getting displayed.
- This made shipping calculator not getting displayed for guest shoppers.
- With this, conditions are changed from isAddressComplete to formatShippingAddress to display shipping calculator if formatted address is present.
- Add unit test case for the condition for formatted address.

* Update comments to explain the condition to hide shipping calculator

- Update the comments to add the reason to hide shipping calculator.
- When there is no default customer location in the store and the customer has not entered their address, but there is a default shipping method available for all locations, then we will hide the shipping calculator.
2023-10-25 22:50:13 +04:00
Karol Manijak d74b0423e1 Remove authors filter from Product Collection block (https://github.com/woocommerce/woocommerce-blocks/pull/11427)
* Remove authors filter from Product Collection block

* Remove author filed in query

* Add back the author query argument in the final query builder

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
2023-10-25 19:11:56 +02:00
Thomas Roberts e6272d0aee Move `Textarea` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11384) 2023-10-25 01:53:24 -07:00
Tarun Vijwani d6b802d5c1 Revert "Display shipping calculator when formatted address is present"
This reverts commit 5731a4cc75.
2023-10-25 11:52:49 +04:00
Tarun Vijwani 5731a4cc75 Display shipping calculator when formatted address is present
- Earlier, shipping calculator was getting displayed based on the isAddressComplete value.
- For the scenarios where address was incomplete but formatted address was present shipping calculator was not getting displayed.
- This made shipping calculator not getting displayed for guest shoppers.
- With this, conditions are changed from isAddressComplete to formatShippingAddress to display shipping calculator if formatted address is present.
- Add unit test case for the condition for formatted address.
2023-10-25 11:51:30 +04:00
Thomas Roberts ef2a129502 Move `FormStep` to the components package (https://github.com/woocommerce/woocommerce-blocks/pull/11246) 2023-10-23 08:57:45 -07:00
Alex Florisca e3f378d990 Move `RadioControl`and `RadioControlAccordion` components to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11312)
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2023-10-23 15:59:19 +01:00
Roy Ho 77f371e8d3 Product Gallery: Add keyboard access (https://github.com/woocommerce/woocommerce-blocks/pull/11373)
* Product Gallery: Add keyboard access

* Add optional chaining to guard against undefines and update delay logic

* Use enums for key codes
2023-10-23 07:53:58 -07:00
Karol Manijak 493613a2fe Product Collection - shrink columns to fit (https://github.com/woocommerce/woocommerce-blocks/pull/11320)
* Add Toggle to inspector controls allowing shrinking number of columns

* Add logic to allow columns to shrink in Product Collection

* Rename SCSS variable

* Make sure the value provided to component is a boolean

* Rename onChange callback name to better reflect its purpose
2023-10-23 14:28:17 +02:00
Seghir Nadir 8bf13a7f4f Add Local Pickup event and Cart/Checkout page views events (https://github.com/woocommerce/woocommerce-blocks/pull/11225)
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2023-10-23 10:23:38 +00:00
Thomas Roberts e8e6c3cbe7 Move `Label` component to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11275) 2023-10-20 07:03:00 -07:00
Roy Ho b87aafebe0 Product Gallery: Fix justification not saving correctly (https://github.com/woocommerce/woocommerce-blocks/pull/11324) 2023-10-20 05:42:48 -07:00
Thomas Roberts fc104dad31 Move `Spinner` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11317) 2023-10-20 04:26:09 -07:00
Seghir Nadir 114f0b4059 Copy shipping phone to billing phone if sync is checked (https://github.com/woocommerce/woocommerce-blocks/pull/10603) 2023-10-20 17:41:57 +07:00
Luigi Teschio face8d2b57 Product Gallery: Add animation when large image changes (https://github.com/woocommerce/woocommerce-blocks/pull/11113)
* Add slide animation

* Remove placeholder and pagination (https://github.com/woocommerce/woocommerce-blocks/pull/11145)

* Add titles to patterns and set the aligment to Wide

* Replace product query patterns with product collection ones

* Remove pagination and no results query from product query patterns

* Add aspect ratio to the product image attributes

* Add portrait aspect ratio to product X column and product gallery patterns

* improve animation

* improve naming

* fix regression

* fix css

* improve code style

* remove check on tag image

* align image

* fix crash when zoom is disabled

* fix E2E tests

* improve CSS

---------

Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
2023-10-20 09:42:39 +02:00
Mike Jolley 9ba4f34d31 Cart and Checkout block transforms for classic shortcodes (https://github.com/woocommerce/woocommerce-blocks/pull/11228)
* Add transforms for checkout block

* Block to shortcode switcher in notice

* cart transforms

* Fix target block for switching

* Remove switcher UI for classic cart/checkout

* Set isPreview when generating block preview in switcher

* Onboarding task

* Action on click

* Focus on block after replacement

* Update notice styling and wording

* Undo functionality

* Look for woocommerce/classic-shortcode when determining if task list item should display

* Enable focus on the cart/checkout block when visiting from the task list

* Classic Cart/Checkout Updated Title

* Add missing translations

* Refactor modal content to avoid sprintf

* Improve pickBlockClientId

* Tracks events for switching to classic shortcode block

* TaskList support for non-block themes

* Updated placeholder to work on non-white page backgrounds

* Find blocks using findBlock utility

* Add TabbableContainer for buttons

* Add align to wrapper

* Update modal content

* Update modal usage

* Removed undo link when converting from classic shortcode

* Check if block was selected

* Revert "Removed undo link when converting from classic shortcode"

This reverts commit 2babbab4c1e69861a0371ff745e85d80ff6bbab1.

* update snackbar text
2023-10-19 16:43:43 +01:00
Thomas Roberts 38759c4e84 Move `FormattedMonetaryAmount` to the components package (https://github.com/woocommerce/woocommerce-blocks/pull/11230) 2023-10-18 07:43:34 -07:00
Thomas Roberts c9ae690a0b Move `Chip` and `RemovableChip` to components package (https://github.com/woocommerce/woocommerce-blocks/pull/11223) 2023-10-18 05:08:18 -07:00
Karol Manijak d548852380 Simplify Product Collection query attributes by removing attributes which are never used (https://github.com/woocommerce/woocommerce-blocks/pull/11259)
* Simply Product Collection query attribute by removing sticky and parents which are never used

* Remove parents attribute from migration logic
2023-10-18 12:47:55 +02:00
Tung Du a441329dc8 Fix: Mini-Cart block shows wrong total if theres multiple installs on the same domain (https://github.com/woocommerce/woocommerce-blocks/pull/11257) 2023-10-18 07:21:15 +00:00
Thomas Roberts 766fa1311d Move `CheckboxList` and create new `blocksComponents` package (https://github.com/woocommerce/woocommerce-blocks/pull/11214) 2023-10-17 02:47:34 -07:00
Tung Du 9297d5ee9e Add: `menu-order` orderby option for Product Attribute Terms route (https://github.com/woocommerce/woocommerce-blocks/pull/11232)
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-10-17 04:54:50 +00:00
Karol Manijak 276556a47c Revert woocommerce/woocommerce-blocks#10032 so All Products renders in the frontend (https://github.com/woocommerce/woocommerce-blocks/pull/11263) 2023-10-16 17:16:07 +02:00
Brian ce6c7e460a LocalPickup: fix learn more documentation link (https://github.com/woocommerce/woocommerce-blocks/pull/11241) 2023-10-16 06:26:23 -07:00
Roy Ho 8bb98fd9d9 product gallery block: add preview (https://github.com/woocommerce/woocommerce-blocks/pull/11247) 2023-10-13 11:19:14 -07:00
Mike Jolley c8b8b7232d Checkout Field Padding and Spacing (https://github.com/woocommerce/woocommerce-blocks/pull/11207)
* Spacing values

* Unused opacity rule
2023-10-13 12:13:50 +01:00
Tung Du cd16c0f401 Price Filter powered by Interactivity API (https://github.com/woocommerce/woocommerce-blocks/pull/10730)
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
2023-10-12 04:30:27 +00:00
Niels Lange 113342fc89 Fix inconsistent border focus styles (https://github.com/woocommerce/woocommerce-blocks/pull/11203) 2023-10-12 09:31:55 +07:00
Mike Jolley 0c2f042886 Add universal border radius for form elements and components (https://github.com/woocommerce/woocommerce-blocks/pull/11193)
* Add universal border radius

* Apply radius to checkbox and dropdown
2023-10-11 17:04:45 +01:00
Mike Jolley 2044798af6 Remove Shipping calculator settings and link to the WooCommerce admin settings (https://github.com/woocommerce/woocommerce-blocks/pull/11184)
* Remove block level options in favour of settings

* Remove calculator toggle test

* Update assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/block.tsx

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Remove unused attributes

---------

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2023-10-11 15:09:43 +01:00
Manish Menaria e88fa94026 Product Collection - Fix undefined layout attribute issue in migration (https://github.com/woocommerce/woocommerce-blocks/pull/11196)
This commit addresses an issue where layout attributes could become undefined during the block migration process. Alongside this fix, several updates were made to align the migration logic with the new `ProductCollectionDisplayLayout` types:

- Added logic to handle `undefined` layout attributes, defaulting to `DEFAULT_ATTRIBUTES.displayLayout`.
- Removed `ProductGridLayout` and `ProductGridLayoutTypes` from the types file.
- Imported `LayoutOptions` and `ProductCollectionDisplayLayout` from the product-collection module.
- Updated the `mapLayoutType` and `mapLayoutPropertiesFrom...` functions to use the new layout types.
- Updated transformation functions like `transformProductTemplate` and `transformPostSummary` to use the new types.

These changes not only resolve the issue with undefined layout attributes but also align the codebase with the new layout options, enhancing code maintainability.
2023-10-11 11:00:26 +05:30
Mike Jolley 75bac91787 Ensure validation of fields occurs when collapsing fields (https://github.com/woocommerce/woocommerce-blocks/pull/11199)
* Ensure validation of fields occurs when collapsing fields

* update click for edit button

* turn off pointer events when hidden

* Add visibility rule
2023-10-10 22:07:58 +01:00
Alexandre Lara a6ddae9dc3 Product Gallery block: Move inner block settings around to match the order from the design (https://github.com/woocommerce/woocommerce-blocks/pull/11170)
* Rearrange block settings to correct position

* Remove unnecessary comments

* Remove unused imports

* Fix e2e tests
2023-10-10 14:04:54 +02:00
Thomas Roberts 14b5414c36 Update wording on checkout error message to try to prevent retries (https://github.com/woocommerce/woocommerce-blocks/pull/10888) 2023-10-10 01:16:24 -07:00
Niels Lange cd1f199f1b Increase number of visible products when cart is empty (https://github.com/woocommerce/woocommerce-blocks/pull/11182) 2023-10-09 22:04:19 +07:00
Mike Jolley 3857dc6e04 WIP: Condensed Address Form Implementation (https://github.com/woocommerce/woocommerce-blocks/pull/11167)
* Add address card component

* Condensed shipping address

* Billing address

* Animations

* Fix editing state

* Toggle sections open in tests
2023-10-09 12:49:09 +01:00
Luigi Teschio 924ed3f30b Product Gallery: fix CSS leak (https://github.com/woocommerce/woocommerce-blocks/pull/11111)
* fix CSS leak

* fix css

* fix comment
2023-10-09 10:15:54 +00:00
Mike Jolley 2f9181a514 Icon should use current color (https://github.com/woocommerce/woocommerce-blocks/pull/11127) 2023-10-09 10:36:17 +01:00
Tung Du 758fdb3b46 Making filter block contextual on the front end (https://github.com/woocommerce/woocommerce-blocks/pull/10919) 2023-10-09 08:22:17 +00:00
Mike Jolley 4987a921b1 Force 100% width for combobox (https://github.com/woocommerce/woocommerce-blocks/pull/11133) 2023-10-06 11:03:48 +01:00
Alba Rincón 37623be4f2 Remove placeholder and pagination (https://github.com/woocommerce/woocommerce-blocks/pull/11145)
* Add titles to patterns and set the aligment to Wide

* Replace product query patterns with product collection ones

* Remove pagination and no results query from product query patterns

* Add aspect ratio to the product image attributes

* Add portrait aspect ratio to product X column and product gallery patterns
2023-10-06 10:51:35 +02:00
Alexandre Lara b4f07b7c5f Product Gallery > Next/Previous Buttons block: Add support to Interactivity API (https://github.com/woocommerce/woocommerce-blocks/pull/10938)
* Add interactivity API to the Pager block

* Replace Large Image when clicking on page

* Fix php cs errors

* Fix php cs errors

* Fix php cs errors

* fix php cs errors

* Add support to Interactivity API

* Fix phpcs errors

* Fix phpcs errors

* Remove unnecessary code and fix block classes

* Rename interactivity actions

* Remove unnecessary type conversion

* Fix error when clicking on page in Pager block

* Fix php cs errors

* Fix ProductGalleryUtils import

* fix php cs error

* Fix styles for next/previous buttons

* Fix styles for the next/previous buttons

* Fix php cs errors

* Fix next/previous icons when buttons are outside image

* Fix php cs errors

* Fix php cs errors

* Fix buttons not visible in Editor

* Delete src/SpeciticTemplateController.php

Delete unnecessary file that is causing php cs error
2023-10-05 18:55:52 +02:00
Luigi Teschio ad80598ab8 Pattern: fetch product id on the JS side (https://github.com/woocommerce/woocommerce-blocks/pull/11138)
* Pattern: fetch product id on the frontend side

* fix TS type
2023-10-05 07:30:50 +00:00
Alexandre Lara dec4e4fc75 Product Gallery > Pager block: Add E2E tests for the block (https://github.com/woocommerce/woocommerce-blocks/pull/11001)
* Add e2e tests for Pager block

* Fix e2e tests for Product Gallery Pager

* Fix e2e tests
2023-10-04 19:11:34 +02:00
Luigi Teschio 9dd8dd321f Product Button: use setTimeout when requestIdleCallback isn't available (https://github.com/woocommerce/woocommerce-blocks/pull/11125) 2023-10-04 10:58:23 +02:00