Commit Graph

108 Commits

Author SHA1 Message Date
Tung Du 93053f39ed
[Experimental] Product Filters: New and improved blocks structure (#51096) 2024-09-14 00:04:06 +07:00
Mike Jolley b0401ef25d
[Experimental] Delayed Account Creation Block (#50934)
* Add block to templates

* Register block type with php

* Create block type class

* Update webpack

* Move password strength meter component

* Add button styles when disabled

* Move password strength component

* Block WIP

* CSRF token handling

* Put new block behind feature flag

* Add experimental flag docs

* Update icon + description

* Changelog

* Lint errors

* Style controls

* Adjust icon markup

* subsctring match

* More specific import

* Fix test fail caused by layout shift

* Wording changes from Figma

* Check if logged in, not just if the current email is registered

* Use opacity for disabled button text

* Sync order data with customer after account creation

* Add id/fragment to form
2024-09-12 11:18:13 +01:00
Tung Du cd638721f9
[Experimental] Update folder structure for new product filter blocks (#51029) 2024-08-29 15:23:40 +00:00
Albert Juhé Lluveras bd41bd34f6
Remove duplicate Add to Cart Form block from Webpack entries (#50394)
* Remove duplicate Add to Cart Form block from Webpack entries

* Typo

* Add changelog file
2024-08-06 15:57:41 +02:00
Sam Seay eaf57e9f15
Create a separate bundle for cart and checkout (#48010) 2024-07-10 21:23:17 +12:00
Tung Du 185a3d579c
[Experimental] Product Filters Overlay Navigation block (#48677)
* add: block scaffold

* add: block settings and editor preview

* chore: discard change to pnpm lock file

* add navigation block to the template part

* test: add basic E2E tests

* chore: changelog

* fix: no full width button

* test: remove layout check

* tweak: dynamically fetch button styles

* try: fontsizepicker

* remove: FontSizePicker dute to lack of ability to change label

* fix: use correct icon from the design

* address review feedback

* update class to follow naming convention. use explicit value to better indicate the navigation style

* fix: remove unnecessary style that breaks the global style

* fix: remove unnecessary style
2024-06-28 08:16:21 +00:00
Roy Ho c29803dd03
EXPERIMENTAL: Product filters template part + overlay (#48472)
* Add overlay template part

* Add product filters overlay block

* Add changelog

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

* Add e2e tests to ensure the filters overlay template part exists

* Remove heredoc

* Add padding to the preview

* Add inpsector controls settings

* Update plugins/woocommerce-blocks/assets/js/blocks/product-filters-overlay/editor.scss

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

* Add position label

* Remove unneeded panelbody

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2024-06-19 12:11:51 -07:00
Luigi Teschio c3a2e275f1
Revert "Add To Cart Form: Add `Stepper` layout" (#48624)
* Revert "Add To Cart Form: Improve the default style and add the `Stepper` style (#47664)"

This reverts commit 0712c6037b.

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-06-19 16:28:56 +00:00
Karol Manijak 9b3879f7cf
Add "(Experimental)" suffix to experimental blocks (#48071)
* Add (Experimental) suffix to experimental blocks

* Add comments reminding to update feature flags doc

* Update feature flag doc

* Add changelog

* Provide links to all feature flags

* Add JS flag for Product Filter: Rating (Experimental)

* Bring back linting in PHP file

* Update block references

* Update variation names

* Update tests

* Update test

* Add notification that block is not available in inserter to block references doc

* Add missing feature flag

* Remove information about block not being exposed in inserter from block references

* Update block references
2024-06-10 15:12:10 +02:00
Sam Seay 2d4295469d
Remove all usage of WOOCOMMERCE_BLOCKS_PHASE and introduce BUNDLE_EXPERIMENTAL_BLOCKS (#47807) 2024-06-05 20:14:16 +12:00
Luigi Teschio 0712c6037b
Add To Cart Form: Improve the default style and add the `Stepper` style (#47664)
* Add To Cart Form: Improve the default style and add the Stepper style

* fix height button when no variation is selected

* not allow the user to set 0 as value of the input

* format css

* fix padding

* format css

* fix CSS

* unset margin to align with the button
2024-05-31 10:25:04 +02:00
Alexandre Lara 7abb996017
[Experimental] Product Filters Redesign: Add the Product Filters block (#47294)
* Add Product Filters block

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

* Add the blocks template for the Product Filters block

* Dynamically add the highest product count attribute to the block template

* wip: Add E2E tests for the Product Filters block

* Add E2E tests for the Product Filters block

* Add CSS file to Product Filters block

* Fix css error lint

* Fix lint error

* Fix lint errors

* Remove unnecessary styles for the Product Filters block

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-05-15 18:09:48 -03:00
Roy Ho f5dc46a385
Product Filters: add individual clear button (#47101)
* Product Filters: add individual clear button

* Remove unused style.scss

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

* Simplify searching for the tag

* Convert to use button instead of anchor

* Try using iAPI to show/hide clear button

* Use local context instead of global state

* Fix linting error

* Remove unneeded context

* Update clear button block description

* Fix frontend PHP error

* Add e2e tests for attributes filter clear button

* Add e2e tests for price filter clear button

* Add e2e tests for rating filter clear button

* Add e2e tests for stock status filter clear button

* Address feedback and use built in locators

* Address feedback and replace the use of timeouts

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-05-13 15:19:56 -03:00
Sam Seay 97595ce95d
Fix crashes in mini-cart by externalizing the wc types package. (#46814) 2024-04-23 20:18:37 +12:00
Paul Sealock 89c330f03e
[Launch Your Store] Use Block to handle template styles (#46751) 2024-04-23 16:07:56 +12:00
Sam Seay ff102c4921
Add vendor bundling of blocks frontend bundle to improve cart/checkout performance (#45859) 2024-04-04 15:31:02 +13:00
Sam Seay 42e77d4938
[Experimental] Product Filter - Reintroduce Wrapper Block (#43688) 2024-01-23 18:29:24 +13:00
Alexandre Lara 8258919e22
Product Gallery block: Remove the experimental flag from the Product Gallery block (#43586)
* Remove the experimental flag from the Product Gallery block

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-01-16 21:05:47 -03:00
Mike Jolley 1dee94362f
[Experimental] Surface additional checkout fields on Order Confirmation page (#43449)
* Get default attributes on front end

* Remove console log

* Show notice about 0 registered fields in editor

* Do not show block in editor if no fields are registered

* Wrapper block

* Styling/spacing

* Update webpack config

* Register heading pattern

* Wrapper block type definition

* get_fields_for_location return fields in array format

* Use wrapper in default content

* Separate fields from the hook block

* Hide when no custom fields exist

* Address and contact fields

* Shared form fields in settings

* remove info block from wrapper

* Revert render_content to original

* rename block

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

* Update styling

* Create shared get_order_additional_fields_with_values to format values

* Update block names and descriptions

* Show address placeholders

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

* Unused import

---------

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-01-16 13:17:28 +00:00
Sam Seay 5fdbe63530
[Experimental] Rename Collection Filters to Product Filters (#43363)
---------
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2024-01-12 00:27:33 +13:00
Tung Du c651b10b3d
Add: Active Filters block powered by Interactivity API (#42008)
* add: active filters block

* update text domain

* chore: linting

* use template string instead of concat

* add experimental flag to register block type calls

* chore: update comments

* feat: register active rating filter data

* fix: unique navigation id when collection filters are added outside product collection

* fix: active filter rating id

* fix: return the href

* chore: phpcs
2023-12-19 17:29:33 +07:00
Sam Seay 6d4c69850c
Experimental Collection Rating Filter (#41999)
Introduce Experimental Collection Rating Filter, CheckboxList interactivity component.
2023-12-18 22:47:24 +13: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
Karol Manijak ff59efc27f Remove isExperimental flag from product-query module which is not experimental (https://github.com/woocommerce/woocommerce-blocks/pull/10531) 2023-11-24 08:36:30 +01: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
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
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
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
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 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 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
Mike Jolley edf4a95b23 Feature Branch: Blockified Order Confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/10056)
* Main block types for confirmation

* Initial blocks

* Styling and placeholders

* Make blocks experimental

* Update summary icon

* Add name/description for status block and missing text descriptions in the block.

Closes woocommerce/woocommerce-blocks#10057

* Order confirmation: Convert Order Details Templates to Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/10095)

* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon

* Add conversion template (https://github.com/woocommerce/woocommerce-blocks/pull/10077)

* Update inner block name

* Add default title constant

* Revert "Add default title constant"

This reverts commit 1dd3bbfecc1be83c367b1ab064f5032ea58cb678.

* Add global styles for order confirmation status block (https://github.com/woocommerce/woocommerce-blocks/pull/10164)

* Implement style controls

* Prevent link color spilling over onto wrapper

* Add styles and remove class names

* Remove __experimentalWritingMode

* Add global styles for order confirmation summary block (https://github.com/woocommerce/woocommerce-blocks/pull/10179)

* Styles for summary

* Remove __experimentalWritingMode

* Add table styles for order details (https://github.com/woocommerce/woocommerce-blocks/pull/10185)

* Add table styles for order details

* __experimentalFontWeight

* Add link styles

* Handle preview link styles

* Unauthenticated views for Order Confirmation template (https://github.com/woocommerce/woocommerce-blocks/pull/10414)

* Different views by permission

* check user id matches when logged out

* Add order confirmation wrapper block (https://github.com/woocommerce/woocommerce-blocks/pull/10286)

* Add a heading wrapper block

* Register the BillingWrapper Block server side

* Fix exception 'render_content' error

* Add the Billing Wrapper Block to the template

* Fix wrong block name error

* Fix php error

* Conditionally render Billing Address within the Wrapper

* Fix parent rendering

* Clean up code (remove billing address from the template)

* Update titles, descriptions, and icons of the billing Block and inner block

* Fix broken block by removing the "parent" keyword

* Use a user-friendly title and description for the Billing Wrapper

* Update Billing Wrapper Block's title case

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

* Fix PHP failing unit test

---------

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

* Remove "thanks" for authenticated page

* Introduce shipping wrapper based on billing wrapper

Closes woocommerce/woocommerce-blocks#10053

* Order confirmation block: Verify email address for guest customers (https://github.com/woocommerce/woocommerce-blocks/pull/10567)

* Add verify step for guest orders

* Render content to pass through block content

* Revert package changes

* Customer orders cannot use email to verify

* Add style controls for order shipping and billing address blocks (https://github.com/woocommerce/woocommerce-blocks/pull/10633)

* Order confirmation block styling (https://github.com/woocommerce/woocommerce-blocks/pull/10780)

* Add missing heading to order details

* Summary block spacing

* Update css variables

* table styles

* Inherit border styles for cells

* Alignment and address styles

* Add downloads wrapper

* Style controls

* Fix typo

* Update Download Wrapper's Icon

* Fix TS error

* Disable Download Block's server side rendering in the editor

This fixes the loading after each style change from the style controls

* Clean up Downloads render functions

* Fix client side Downloads Block's table border

* Download + Total wrappers and tables styling

* small screen

* Remove server side render for previews

---------

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>

* Shorten template description

* Update test address data

* Avoid leaking order key in permission form

* Remove todo

* Make email form required.

* Remove edit page link

* Remove empty columns from address wrapper

* Remove IIFE

* typo

* Update description to mention billing

* Adjust link scss

* Fix wrapper markup and spacing controls

* Add link preview in editor

* Add initial E2E setup for the Order Confirmation Block (https://github.com/woocommerce/woocommerce-blocks/pull/10840)

* Fix WC_DateTime check

* Move form outside of block markup

* Add additional information block (https://github.com/woocommerce/woocommerce-blocks/pull/10842)

* Add block which contains hooks

* Use skeleton for placeholder instead of illustration

* Remove duplicate methods

* Remove duplicate align tag

* Update meta styles

* Tests for order confirmation conditional blocks (https://github.com/woocommerce/woocommerce-blocks/pull/10972)

* Add tests for conditional blocks

* Move setup into test

* Add E2E to the the Order Confirmation Block (https://github.com/woocommerce/woocommerce-blocks/pull/10863)

* Add editor util functions

* Update editor template E2E test

* Add the "exact" property for consistency

* Skip test

Can't get the element in the page. More investigation needed! Skipping
for now.

* Fix "transformIntoBlocks" logic

* Add tests for logged in user

* Fix "beforeAll" config

* Confirm downloads section is visible when logged in

* Create "verifyOrderConfirmationDetails" util function

* Add logged in test case

* Add Guest user test case

* Fix editor e2e testing

* Apply a proper teardown

* Fix failing tests after logout

* Ensure we are logged in before visiting the editor

* Ensure to have shipping selected

* Wait for changes to be saved on the editor

* Ensure shipping options is selected

* Remove comment

* Ensure we are logged in before going to the admin page

* Mark the Order Confirmation as a side effect test

* OrderConfirmation blocks are not experimental

* resolve merge conflict

* Revert package lock changes

* Fix enqueue_assets

* Fix CSS 404s

* Make template tests more robust

* Fix page URL for default confirmation page

* Try afterEach to log back in

* Skip guest/logout use cases

Login out causes other tests to fail. We will implement these case when
the multiple sign in roles are introduced in the codebase.

* Remove tests requiring login out & add comments

* Remove unused util functions

* Hide confirmation blocks from post editor

---------

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-09-20 13:56:00 +01:00
Sam Seay 767a093b6a Refactor frontend, frontend-container-block (of reviews) to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/10787)
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2023-09-20 04:21:26 +00:00
Daniel Dudzic 67f8476a82 Update experimental blocks in the feature-flags-and-experimental-interfaces doc (https://github.com/woocommerce/woocommerce-blocks/pull/10937)
* Features Flags and Experimental Interfaces doc: Update blocks behind the experimental flag

* Product Gallery Next Previous: Add missing experimental flag
2023-09-19 21:37:00 +00:00
Mike Jolley 68064c115b Refactor Cart and Checkout Page Templates (https://github.com/woocommerce/woocommerce-blocks/pull/10773)
* Rename checkout template slug

* Remove redirect and custom title

* Classic shortcode block for checkout

* Empty title

* WIP placeholder

* Change blockified template

* Prefix cart and checkout templates with "Page: "

* Template migration routine

* Apply same treatment to cart template

* Notices

* Update placeholder text

* Classic shortcodes block

* Page content wrapper for templates

* Update default

* Do not save attributes

* Update templates

* Remove cart classic template

* Reverted endpoints for Cart & Checkout templates. This reverts PR 9406

* Migrate page content wrapper.

* Removed useless method arg. Minor tweaks.

* Skip migration if the theme has a template file for this page.

* Removed impossible condition.

* Migrate page content wrapper.

* Remove TemplateNotice in favour of DefaultNotice

* Documentation links in shortcode placeholder

* Hide cart and checkout page selector when using block themes

* Unused var

* Add tests for template changes

* Revert changes to classic-template

* Allow frontend redirect

* Unused file

* Bump version for updater

* Support x template naming as well as page-x

* Need to add item to cart to test checkout

* Fix header test by fixing utility for adding to cart

* Remove permalink tests

* Click body

* Wait for content to finish loading

* Wait for add to cart response when adding to cart without item name

* Wait for save before visiting frontend

* Set content instead of inserting block

* Perform test in site editor rather than page editor

* Prevent notice to set the default cart/checkout page from showing on the site editor.

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2023-09-19 10:58:18 +01:00
Roy Ho 3c0498e891 Add collection filters block (https://github.com/woocommerce/woocommerce-blocks/pull/10726)
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2023-09-14 11:13:33 +07:00
Tung Du 0cfea936e4 Fix: load blocks style separately for classic themes (https://github.com/woocommerce/woocommerce-blocks/pull/10758)
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2023-09-08 11:15:48 +07:00
Luigi Teschio c126731347 Product Gallery Block: Next/Previous block (https://github.com/woocommerce/woocommerce-blocks/pull/10235)
* Add Product Gallery Next Previous block

* update description

* update registration

* improve style

* use context instead of attributes

* add eslint and ts lint exception

* improve CSS

* E2E Next Previous block (https://github.com/woocommerce/woocommerce-blocks/pull/10329)

* Add E2E tests

* fix e2e tests path after rebase

* add screenshots

* improve E2E test

* improve E2E test

* improve E2E test

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>

* fix webpack conf

* Next Previous Button block - Add layout support (https://github.com/woocommerce/woocommerce-blocks/pull/10668)

* Add layout support

* Product Gallery Next Previous: Fix block crashing in the editor when vertical alignment has not been customized yet

* Product Gallery Next Previous: Position fixes for the Next/Previous button both in the editor and frontend

* add E2E test

* fix import

---------

Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>

* Next Previous Buttons: hide buttons when the product has only one image (https://github.com/woocommerce/woocommerce-blocks/pull/10743)

* Next Previous Buttons: hide buttons when the product has only one image

* update URL

* fix import

* set default value

* fix E2E test

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-08-28 18:32:45 +02:00
Karol Manijak 95fb51be4d Enable Product Collection as a core feature (https://github.com/woocommerce/woocommerce-blocks/pull/10524)
* Enable Product Collection as a core feature

* Fix: disable product query title and summary variations from inserter in favour of Product Collection ones (https://github.com/woocommerce/woocommerce-blocks/pull/10548)

* Limit the scope of Product Query's Product Title and Product Summary

* Add missing piece after refactoring

* Enable manual migration of Products to Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10655)

* Refactor block variation registration in product-collection (https://github.com/woocommerce/woocommerce-blocks/pull/10701)

This commit refactors the product-collection block's variation registration.

Changes:
- The `product-summary` and `product-title` variations have been encapsulated within their own respective functions: `registerProductSummaryVariation` and `registerProductTitleVariation`.
- Imported and invoked these new functions in the main `index.tsx` of the product-collection block, ensuring the variations are registered.

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
2023-08-25 15:58:11 +02:00
Alexandre Lara 47c197d165 Product Gallery block: Add Pager block (https://github.com/woocommerce/woocommerce-blocks/pull/10320)
* Add block foundation

* Add block styles

* Add Dots Pager

* Move icons to the block folder

* Add block settings

* Add Pager to Product Gallery template

* Add setting to change Pager display mode

* Change the block description

* Fix the block icon color when selected

* Fix php cs errors

* Fix php cs errors

* Fix css lint errors

* Fix eslint error

* Move enum to its own file

* Remove unnused call to request context

* Add block template

* Fix php cs errors

* fix php cs errors

* improve docs

* Remove duplicate HTML element and added classnames for single product block (https://github.com/woocommerce/woocommerce-blocks/pull/10374)

* Show only products with rating (https://github.com/woocommerce/woocommerce-blocks/pull/10434)

* Add Product Gallery Thumbnails block (https://github.com/woocommerce/woocommerce-blocks/pull/10442)

* WIP Product Gallery: Add the Thumbnails block

* Product Gallery Thumbnails: Add block settings

* Add template for the Product Gallery block

* Add template for the Product Gallery block. Add the rest of the files.

* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.

* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.

* Product Gallery Thumbnails: Move the static template ouside of the component

* Make sure the context is set before accesing the array values

* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc

* Product Gallery Thumbnails: Fix TS error

* Product Gallery Thumbnails: Remove unused stylesheet

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.

* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically

* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down

* Product Gallery Thumbnails: Fix the eslint dependency error

* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file

* Product Gallery Thumbnails: Update the utils file

* Product Gallery Thumbnails: Update the utils file. Fix comment indentation

* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set

* Product Gallery: Rename clientId to productGalleryClientId

* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies

* Product Gallery Thumbnails: Combine all useEffect code together

* Product Gallery Thumbnails: Add a ThumbnailsPosition enum

* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Add missing dependency

* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block

* Product Gallery: Add crop, zoom and full-screen settings

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Revert back to ts-ignore

* Revert "Product Gallery: Add crop, zoom and full-screen settings"

This reverts commit 840654197619e2611029b81990493387ae0b543d.

* Remove propTypes (https://github.com/woocommerce/woocommerce-blocks/pull/10432)

* Fix badge wrong spacing on the newest arrivals pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10446)

* Product Gallery: Add Crop, Zoom and Full-screen settings (https://github.com/woocommerce/woocommerce-blocks/pull/10445)

* WIP Product Gallery: Add the Thumbnails block

* Product Gallery Thumbnails: Add block settings

* Add template for the Product Gallery block

* Add template for the Product Gallery block. Add the rest of the files.

* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.

* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.

* Product Gallery Thumbnails: Move the static template ouside of the component

* Make sure the context is set before accesing the array values

* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc

* Product Gallery Thumbnails: Fix TS error

* Product Gallery Thumbnails: Remove unused stylesheet

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.

* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically

* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down

* Product Gallery Thumbnails: Fix the eslint dependency error

* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file

* Product Gallery Thumbnails: Update the utils file

* Product Gallery Thumbnails: Update the utils file. Fix comment indentation

* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set

* Product Gallery: Rename clientId to productGalleryClientId

* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies

* Product Gallery Thumbnails: Combine all useEffect code together

* Product Gallery Thumbnails: Add a ThumbnailsPosition enum

* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Add missing dependency

* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block

* Product Gallery: Add crop, zoom and full-screen settings

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Revert back to ts-ignore

* Revert "Product Gallery: Add crop, zoom and full-screen settings"

This reverts commit 840654197619e2611029b81990493387ae0b543d.

* Product Gallery: Add crop, zoom and full-screen settings

* Product Gallery: Remove the redundant React Fragment

* Remove nested filled and empty cart blocks in cart template (https://github.com/woocommerce/woocommerce-blocks/pull/10447)

* improve migration to blockified templates (https://github.com/woocommerce/woocommerce-blocks/pull/10415)

* fix compatibility with WP 6.2 (https://github.com/woocommerce/woocommerce-blocks/pull/10449)

* Add Product Gallery Pager to template

* Add Pager settings to Product Gallery block

* Remove save function and rename icon

* Use nullish coalescing operator for the block context

---------

Co-authored-by: Roy Ho <roykho77@gmail.com>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2023-08-22 16:26:46 -03:00
Luigi Teschio 97474e4040 Create wc-all-block-styles chunk with all the styles for classic themes (https://github.com/woocommerce/woocommerce-blocks/pull/10543) 2023-08-11 14:12:34 +02:00
Luigi Teschio b90e0ffdc9 Interactivity API and Product Button (https://github.com/woocommerce/woocommerce-blocks/pull/10006)
* 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

* Remove all files related to directive processing in PHP

* Move json_encode to Store's render method

* WIP

* WIP

* WIP

* WIP

* Preserve previous context

* Ignore Minicart block on client-side navigation

* Refresh page on store updatRefresh page on store updatee

* Refactor logic

* Add console error when a path is missing

* fix PHP lint error

* WIP store

* use store approach

* update jest configuration

* restore Mini Cart changes

* move cart store subscription to interactivity package

* move interactivity flag

* format HTML

* move addToCartText to the context

* Load product-query stylesheet when rendering the Products block

* update sideEffects array

* fix catch

* rename moreThanOneItem to isThereMoreThanOneItem

* improve how scripts are enqueued

* update default value for the filter woocommerce_blocks_enable_interactivity_api

* Update assets/js/atomic/blocks/product-elements/button/block.json

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

* Update assets/js/interactivity/cart/cart-store.ts

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

* fix block.json

* remove updateStore function

* restore interactivity api changes

* import cart store

* show notice when there is an error

* add logic to dequeue script on classic themes and block themes

* imrpove logic about notice

* Interactivity API: add `afterLoad` callbacks to `store()` function (https://github.com/woocommerce/woocommerce-blocks/pull/10338)

* show notice when there is an error

* Add initial implementation for store callbacks

* Run `afterLoad` callbacks after `init`

* Move cart state subscription to Product button

* Remove cart-store from Interactivity API internals

* Change callbacks with options and save only afterLoad callbacks

* ProductButton: Add animation (https://github.com/woocommerce/woocommerce-blocks/pull/10351)

* implement animation

* improve logic

* refactor logic

* refactor code

* address feedback about code style

* add support for woocommerce_add_to_cart_quantity

* Fix animation flickering

* Introduce wp-effect, reduce the amount of numberOfItem variables to 2 and consolidate animation status

* add support for added class

* Remove unnecessary selector

* Don't fetch cart if it was already fetched

* remove added class

---------

Co-authored-by: Luis Herranz <luisherranz@gmail.com>

---------

Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>

* update deepsignal

* remove added class

* update deepsignal

* Interactivity API and Product Button: Add E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/10036)

* Add FrontendUtils class

* fix conflicts

* use locator

* restore click usage

* Product Button: Add E2E test

* fix util

* fix E2E tests

* remove comment

* Add E2E test to ensure that woocommerce_product_add_to_cart_text works

* update sideEffects array

* add zip and unzip as package

* fix wp-env configuration

* fix E2E test

* add report

* try now

* try now

* try now

* fix E2E test

* E2E: Add documentation for testing actions and filters. Fixes woocommerce/woocommerce-blocks#10135 (https://github.com/woocommerce/woocommerce-blocks/pull/10206)

* update description

* fix label

* rename files

* make requestUtils private

* remove page.goto

* use toHaveCount

* use productsToDisplay variable

* fix E2E tests

* rename class utils

---------

Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>

---------

Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-08-10 14:02:33 +00:00
Daniel Dudzic d6e4dd5eb3 Add Product Gallery Thumbnails block (https://github.com/woocommerce/woocommerce-blocks/pull/10442)
* WIP Product Gallery: Add the Thumbnails block

* Product Gallery Thumbnails: Add block settings

* Add template for the Product Gallery block

* Add template for the Product Gallery block. Add the rest of the files.

* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.

* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.

* Product Gallery Thumbnails: Move the static template ouside of the component

* Make sure the context is set before accesing the array values

* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc

* Product Gallery Thumbnails: Fix TS error

* Product Gallery Thumbnails: Remove unused stylesheet

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.

* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically

* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down

* Product Gallery Thumbnails: Fix the eslint dependency error

* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file

* Product Gallery Thumbnails: Update the utils file

* Product Gallery Thumbnails: Update the utils file. Fix comment indentation

* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set

* Product Gallery: Rename clientId to productGalleryClientId

* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies

* Product Gallery Thumbnails: Combine all useEffect code together

* Product Gallery Thumbnails: Add a ThumbnailsPosition enum

* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Add missing dependency

* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block

* Product Gallery: Add crop, zoom and full-screen settings

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Revert back to ts-ignore

* Revert "Product Gallery: Add crop, zoom and full-screen settings"

This reverts commit 840654197619e2611029b81990493387ae0b543d.
2023-08-02 07:09:51 +00:00
Daniel Dudzic 69f1c53a41 Revert "Add Product Gallery Thumbnails block (https://github.com/woocommerce/woocommerce-blocks/pull/10247)" (https://github.com/woocommerce/woocommerce-blocks/pull/10441)
This reverts commit 51344c3fed.
2023-08-01 19:03:12 +02:00
Daniel Dudzic 51344c3fed Add Product Gallery Thumbnails block (https://github.com/woocommerce/woocommerce-blocks/pull/10247)
* WIP Product Gallery: Add the Thumbnails block

* Product Gallery Thumbnails: Add block settings

* Add template for the Product Gallery block

* Add template for the Product Gallery block. Add the rest of the files.

* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.

* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.

* Product Gallery Thumbnails: Move the static template ouside of the component

* Make sure the context is set before accesing the array values

* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc

* Product Gallery Thumbnails: Fix TS error

* Product Gallery Thumbnails: Remove unused stylesheet

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.

* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically

* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down

* Product Gallery Thumbnails: Fix the eslint dependency error

* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file

* Product Gallery Thumbnails: Update the utils file

* Product Gallery Thumbnails: Update the utils file. Fix comment indentation

* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set

* Product Gallery: Rename clientId to productGalleryClientId

* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies

* Product Gallery Thumbnails: Combine all useEffect code together

* Product Gallery Thumbnails: Add a ThumbnailsPosition enum

* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Fix TS errors

* Product Gallery Thumbnails: Add missing dependency

* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block

* Product Gallery: Add crop, zoom and full-screen settings

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error

* Product Gallery Thumbnails: Revert back to ts-ignore
2023-08-01 12:23:53 +00:00
Patricia Hillebrandt 3ec684818e Fix: WooCommerce Blocks causing malfunction of the navigation block on WordPress 6.3 (https://github.com/woocommerce/woocommerce-blocks/pull/10388)
* Make sure the revert button is registered and enqueued for usage exclusively in the site editor.

* Register and enqueue the styles for the revert button.

* Rename the files.

* Revert "Rename the file renames."

This reverts commit c0330ce70fec20bea1f957eddcf458881e16242c.

* Add plugin-proposal-optional-chaining to the WebPack plugins config.

* Rename the files.

* Remove unnecessary dependencies as those are already provided via : more specifically, get_script_data.

* Address CR.
2023-07-31 07:03:10 +00:00
Alba Rincón b8f798b017 Use the `Single Product` block for the `Product Details Product Listing` pattern (https://github.com/woocommerce/woocommerce-blocks/pull/9978)
* Show alignment toolbar also when the block is in the single product block

* Start using `Single Product` for the `Product Details Product Listing` pattern

* Use counter and stars blocks in the pattern

* Undo button change

* Make the new rating blocks not experimental

* Add Beta to the average rating block

* Add blocks to block types controller
2023-07-24 11:02:24 +02:00
Alexandre Lara f6b84e02e2 Add to Cart Form: Fix broken styles for the block when using inside the Single Product Block (https://github.com/woocommerce/woocommerce-blocks/pull/10282)
* Fix broken styles for Add to Cart Form block

* Fix PHP CS error
2023-07-20 09:28:15 -03:00
Alba Rincón 5eef9bff65 Add new `Product Average Rating` block (https://github.com/woocommerce/woocommerce-blocks/pull/10207)
* Add new Product Average Rating block

* Add new blocks to the feature flag docs

* Translate 'No ratings'

* Fix condition

* Small improvements after review

* Avoid duplication of styles

* Update supports in php class
2023-07-19 11:21:30 +02:00