Commit Graph

345 Commits

Author SHA1 Message Date
Tung Du cd638721f9
[Experimental] Update folder structure for new product filter blocks (#51029) 2024-08-29 15:23:40 +00:00
Karol Manijak 5a80d5e1da
Update Block Reference and make it public doc (#50906)
* Update Block References doc

* Move the Block References to public Docs

* Change the place Block Reference is generated to

* Add changelog

* Update docs manifest file

* Update manifest
2024-08-27 09:04:15 +02:00
Caleb Mazalevskis b4fd419f74
Fix typos. (#50047) 2024-08-23 18:26:09 +01:00
Gabriel Manussakis d7783511ff
[WIP][Accessibility] Fix inline documentation typos in woocommerce-blocks (#50737)
* Fix inline documentation typos in woocommerce-blocks

* Add changelog file

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

* Remove original changelog

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2024-08-19 13:57:38 +01:00
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
Vladimir Reznichenko 07a71106dc
Monorepo: actualize loaders paths filtering for better Webpack performance. (#49714) 2024-07-29 15:20:17 +02:00
Vladimir Reznichenko 46f952eeb5
Monorepo: enable babel-loader and Jest caching (inc. CI) (#49656)
In this PR, we are consolidating babel-loader caching and adding Jest caching, improving build/testing times locally and in CI. The improvement comes from cache covering transpile steps in the mentioned processes.
2024-07-19 09:40:01 +02:00
Sam Seay 9fa32b4f2b
Migrate StateInput, CountryInput and custom fields to native `<select>` (#48180) 2024-07-12 21:17:54 +00:00
Sam Seay e59decd222
Clean up unused files and dependencies from when WooCommerce Blocks was merged into the monorepo (#49319) 2024-07-12 16:40:07 +12:00
Vladimir Reznichenko 4311640de2
Monorepo: caching deps per target package in GH actions (#49020)
In this PR, we are implementing per-package build and caching, which optimizes build and fetching cached dependencies times across our workflows.
2024-07-10 14:39:49 +02:00
Sam Seay eaf57e9f15
Create a separate bundle for cart and checkout (#48010) 2024-07-10 21:23:17 +12:00
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
Roy Ho b85e1aa402
Use correct AND expression (#48011)
* Use correct AND expression

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

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-05-31 05:23:57 -07: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
Sam Seay 3ef7a01840
Update blocks JS tests to React 18 (#47383) 2024-05-15 21:33:36 +12: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 3a5721c0d8
Replace @wordpress/components Button, Radio, RadioGroup with Ariakit Button (#45974) 2024-05-03 15:28:39 +12:00
Roy Ho d6a48ecaf5
Add autogeneration of block list reference documentation (#46479)
* Add autogeneration of block list reference documentation

* Fix typo

* Revert this change

* Fix typo

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

* Add blanklines to surrounding markdown headings

* Generate blocks references markdown

* Add space to header markdown

* Add ancestor information

* Use native Object.keys instead of lodash

* Remove the use of fast-glob

* Revert pnpm lock file changes

* Update plugins/woocommerce-blocks/bin/gen-block-list-doc.js

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

* Update doc title

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
2024-04-25 06:03:41 -07: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
Ron Rennick 4fa2e3822c
Update the monorepo to node v20 (#45148)
* test bumping node to v18

* remove community contributor condition from review assignment

* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai

* bump node to v20

* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/admin-e2e-tests, packages/php/remote-specs-validation, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai

* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai

* add blocks eslint-plugin-woocommerce to project workspace

* add e2e-environment as a peer to e2e-utils

* restore version on @woocommerce/api

* update lock file

* move e2e-environment to devDependencies

* add undefined location check to admin js test

---------

Co-authored-by: Ron Rennick <ronald.rennick@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-04-12 13:49:55 -03:00
Leif Singer 8ee74ede0e
Update Woo.com references to WooCommerce.com (#46259)
* replace capitalized Woo.com with WooCommerce.com

* replace http URLs

* replace https URLs

* replace developer.woo.com

* add missing version in `@since` tag

* unslash the HTTP_REFERER

* WordPress.Security.ValidatedSanitizedInput.InputNotSanitized

* add changelog file

* add more changelog files

* address linter errors

* address more linter errors

* fix test

* more linter errors
2024-04-09 09:50:15 +01: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
Alexandre Lara 4efd2123a3
[Docs] Update links from WooCommerce.com to Woo.com for the Woo Blocks documentation (#43055)
* Update woocommerce.com URLs in documentation and code files

* Add changelog

* Fix github repository link in extend-rest-api-add-custom-fields.md

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

* Add github reporter (#42974)

* Add github reporter

* Add changelog

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>

* Fix product task redirect to support grouped and external products (#43051)

* Rearrange product redirection logic to better accept grouped and external produc types

* Add changelog

* Modify feedback modal actions (#43005)

* Adapt feedback modal actions

* Add changelogs

* Modify comments

* Fix tests

* Fix test

* Update class-wc-gateway-bacs.php (#43054)

* Update class-wc-gateway-bacs.php

Fix typo in textdomain

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

---------

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

* [Product Block Editor]: Add `Linked product` tab (#43009)

* add linked-products to group IDs

* add Linked Products tab

* tweak hideConditions condition

* changelog

* fix typo in doc comment

* Introduce a product type selection within the new experience (#41823)

* Create a relation between the product type and the product block template

* Add 'patterns' to name the kind of products that can be created for a specific template

* Resolve template using its id as a template query param

* Rename ProductEditPattern to ProductTemplate

* Rename get_patterns hook to woocommerce_product_editor_get_product_templates

* Return the list of templates to the client

* Set layout template events as array

* Register the layout template based on the product template or the post type in case of product variations

* Registering non supported product types

* Create and register the woocommerce/product-details-section-description block

* Add the product type to the section description

* Create product type selector

* Fix menu item style

* Highlight selected menu item

* Set the selected product template

* Set product template title to lowercase in the content description

* Rename blocks by blockTemplates under the AbstractBlockTemplate class

* Rename to woocommerce_product_editor_product_templates filter

* Remove product_template_ prefix from the supported_product_types map

* Rename get_formatted to to_JSON and convert the props to client side like

* Refactor get_product_templates

* Fix icon resolution

* Add a confirmation modal for unsupported product templates

* Add changelog files

* Remove product types using for testing

* Fix redirection when changing to a non supported product template

* Set the change button state to busy when it is saving the product

* Fix php linter errors

* Fix rebase conflict

* Move ProductTemplate to Automattic\WooCommerce\Admin\Features\ProductBlockEditor namespace

* Add the to_json definition to the BlockTemplateInterface

* Create default product template by custom product type if it does not have a template associated yet

* Fix some comments and product template creation validation

* Add support to load the product template icon from an external resource

* Fix php linter

* Fix the changelog description

* [Experimental] Interactivity Dropdown multi-select mode, ratings filter and introduce each directive (#42981)


---------
Co-authored-by: David Arenas <david.arenas@automattic.com>

* Introduce the transient files engine (#42877)

Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>

* Change marketplace install API request to POST instead of GET (#43033)

* Change marketplace install API to using POST instead of GET
* Fix linting error
* Add changefile(s) from automation for the following project(s): woocommerce

---------

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

* Prep trunk for 8.6 cycle (#43021)

Prep trunk for 8.6 cycle with version bump to 8.6.0-dev

Co-authored-by: WooCommerce Bot <no-reply@woo.com>

* Add Playwright tests for All Reviews, Reviews by Product and Reviews by Category blocks (#42903)

* Remove Reviews blocks Puppeteer tests

* Minor code cleanup

* Typos

* Create publishAndVisitPost() editor util

* Fix subcategories when importing products in Playwright and add reviews

* Add Reviews blocks tests in Playwright

* More typos

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

* Create a 'reviews' object in data.ts so we can store reviews data in one single place

* Update test so instead of creating a new post in each test, we go to the already-created post

* Add source comments to reviews data to match it with the script

---------

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

* Release: Remove 8.5 change files (#43022)

Delete changelog files from 8.5 release

Co-authored-by: WooCommerce Bot <no-reply@woo.com>
Co-authored-by: Alex López <alex.lopez@automattic.com>

* Delete changelog files based on PR 43033 (#43079)

Delete changelog files for 43033

Co-authored-by: WooCommerce Bot <no-reply@woo.com>

* Delete changelog files based on PR 43051 (#43081)

Delete changelog files for 43051

Co-authored-by: WooCommerce Bot <no-reply@woo.com>

* Interactive Price Filter: use `context` instead of `state` (#42980)

* feat: use context instead of state

* fix: temporary move the context to inner element for diffing to work

* fix: update context before navigation for optimistic UI

* Load google analytics gtag script asynchronously in WooCommerce Blocks (#43040)

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

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build (#43074)

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build

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

---------

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

* Revert "Fix schedule sales error" (#43094)

Revert "Fix schedule sales error (#42700)"

This reverts commit 9b800aa179.

* [Product Block Editor]: add Linked product sections. First approach. (#43013)

* add Linked products, Upsell section

* changelog

* add Cross-lens section

* add links to the Upsell sections

* changelog

* fix lint issues

* fix lint issus

* fix linting issue :-|

* check whether the linked product group is defined

* [Product Block Editor]: introduce ShoppingBags component (#43042)

* add ShoppingBags component

* Add ShoppingBag story

* changelog

* Fix: Collection data being leaked between Collection Filters blocks (#43044)

* fix: CYS - change heading color (#43076)

* fix: CYS - change heading color

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

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>

* Delete changelog files based on PR 43074 (#43118)

Delete changelog files for 43074

Co-authored-by: WooCommerce Bot <no-reply@woo.com>

* [Product Block Editor]: fix feature flag to hide the Linked products (#43119)

* fix flag to hide/show product editor

* changelog

* Add changelog

---------

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Jonathan Lane <lanej0@users.noreply.github.com>
Co-authored-by: Jon Lane <jon.lane@automattic.com>
Co-authored-by: louwie17 <lourensschep@gmail.com>
Co-authored-by: Fernando Marichal <fernando.marichal@automattic.com>
Co-authored-by: Marc Guay <marc.guay@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Damián Suárez <rdsuarez@gmail.com>
Co-authored-by: Maikel David Pérez Gómez <maikel.perez@automattic.com>
Co-authored-by: Sam Seay <samueljseay@gmail.com>
Co-authored-by: Néstor Soriano <konamiman@konamiman.com>
Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>
Co-authored-by: Kyle Nel <22053773+kdevnel@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: WooCommerce Bot <no-reply@woo.com>
Co-authored-by: Alex López <alex.lopez@automattic.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
2023-12-29 12:28:11 -03: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
Jonathan Lane 8e2e7de7ce
Migrate Puppeteer test action from Blocks repo (#42733)
* Migrate Puppeteer test action from Blocks repo

* Update file path

* Use pnpm

* Use npm

* Updates based on feedback

* Comment out paths for testing

* Fix paths with working directory

* Use pnpm

* Fix missing pnpms

* npm instead

* Do use pnpm

* Update command

* Blocks wp-env config

* Update paths, config files

* Run test commands from blocks

* Config update

* Uncomment paths so that e2e checks only run on Blocks

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
2023-12-13 16:01:34 -08:00
Christopher Allford dc5aa18f35 Wireit Added: `@woocommerce/block-library` 2023-12-09 22:35:11 -08:00
Christopher Allford b4fd0c3b7b Fixed Blocks INI File Path 2023-12-09 21:33:34 -08:00
Christopher Allford 8b6036a30e Changed Blocks Build Output 2023-12-09 18:18:25 -08: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
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 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
Thomas Roberts eaab9950af Update Puppeteer E2E tests to WP 6.4.1 and disable failing ones (https://github.com/woocommerce/woocommerce-blocks/pull/11816)
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2023-11-20 13:06:12 +01: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