Commit Graph

1062 Commits

Author SHA1 Message Date
Seghir Nadir c52825ca7b switch to a permament link in errors (https://github.com/woocommerce/woocommerce-blocks/pull/7205) 2022-09-22 13:17:26 +01:00
Luigi Teschio 84432552a8 Product Query: Fix pagination issue (https://github.com/woocommerce/woocommerce-blocks/pull/7109) 2022-09-15 13:53:56 +02:00
Luigi 1f71891e2d Update version to 8.6.0-dev 2022-09-13 14:32:33 +02:00
github-actions[bot] 4ab8f9c768 Release: 8.5.0 (https://github.com/woocommerce/woocommerce-blocks/pull/7110)
* Empty commit for release pull request

* add changelog - 8.5.0 version

* Add testing instructions

* add missing screenshot

* Fix pills in the Filter by Attribute block dropdown overlapping with the chevron (second attempt) (https://github.com/woocommerce/woocommerce-blocks/pull/7112)

* Fix invisible Reset filter button in some themes (https://github.com/woocommerce/woocommerce-blocks/pull/7111)

* update link zip file

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-09-13 14:29:51 +02:00
Lucio Giannotta 5dd05d7ab2 Improve public-facing texts and labels (https://github.com/woocommerce/woocommerce-blocks/pull/7045)
We noticed that oftentimes our labels and text tend to be overly
technical or unclear. We decided to do a bulk pass to improve
the readability to non-technical users.
2022-09-12 10:39:26 +02:00
Paulo Arromba 0631b04dbe Suppress unnecessary warnings for old namespace aliasing (https://github.com/woocommerce/woocommerce-blocks/pull/7046)
* Aliasing classes in deprecated.php now checks for prior alias declaration to suppress unnecessary warnings.
2022-09-07 13:55:15 +01:00
Luigi Teschio 2dcd9a954a Replace 'gutenberg_build_query_vars_from_query_block' filter with 'query_loop_block_query_vars' filter (https://github.com/woocommerce/woocommerce-blocks/pull/7078) 2022-09-07 14:05:01 +02:00
Tarun Vijwani 6294b0c227 Add steps to retrieve products variations in Store API docs (https://github.com/woocommerce/woocommerce-blocks/pull/7076) 2022-09-07 15:49:10 +05:30
Luigi Teschio 26327264c0 Add default value to parameter woocommerce/woocommerce-blocks#7060 (https://github.com/woocommerce/woocommerce-blocks/pull/7074)
add default value to  parameter
2022-09-06 16:23:15 +02:00
Alba Rincón 5e96759159 Fix php format (https://github.com/woocommerce/woocommerce-blocks/pull/7050) 2022-09-05 11:35:10 +02:00
github-actions[bot] db69fd92fc Release: 8.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/7001)
* Empty commit for release pull request

* Add the changelog to `readme.txt`

* Add testing instructions & release zip

* Fix video tags

* Update feedback document path

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-09-02 18:20:01 +01:00
Luigi Teschio 3ea46e426a Add to the Product Image block the support for the Product Query block (https://github.com/woocommerce/woocommerce-blocks/pull/6911)
* Adds to the Product Image Block the support for the Product Query Block

Adds to the Product Image Block the support for the Product Query Block woocommerce/woocommerce-blocks#6911

* Add to the Product Image Block the support for the Product Query Block

* address feedback

* set grid view and font-size L as default
2022-09-01 15:13:19 +02:00
Saad Tarhi ff48e7d45a Update version to 8.5.0-dev 2022-08-30 12:37:33 +01:00
Seghir Nadir 241350c0c9 only load shipping countries when shipping is needed (https://github.com/woocommerce/woocommerce-blocks/pull/6901) 2022-08-29 09:05:19 +01:00
Tarun Vijwani c0f6aec882 Change Type for shipping_address and billing_address to object (https://github.com/woocommerce/woocommerce-blocks/pull/6974)
* Change Type for shipping_address and billing_address to object

* Fix description
2022-08-29 07:29:50 +01:00
Lucio Giannotta 95963a7bab Fix Product Query block hijacking all Query blocks queries (https://github.com/woocommerce/woocommerce-blocks/pull/6952)
* Fix Product Query block hijacking all Query blocks queries

The Product Query block was adding a filter to Gutenberg's core
Query Loop block. When this filter was added once, it would from
then on apply to all other Query Loop blocks (or variations thereof)
on a page.

This change makes sure that:

1. No filters are added in the first place if our custom `__woocommerceVariationProps`
are not set.
2. The filter only gets run once.
2022-08-25 02:48:36 +02:00
Tomasz Tunik b295689571 Product search block as core/search variation (https://github.com/woocommerce/woocommerce-blocks/pull/6191)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-08-23 23:06:17 +07:00
Luigi Teschio ffbf5823d3 Product Query Block POC (Phase 1) (https://github.com/woocommerce/woocommerce-blocks/pull/6812)
* Move `EditorBlock` to general `type-defs`

`EditorBlock` was scoped under the `featured-items` directory at the time of its creation. It is, however, a useful type that should be shared repo-wide. For this reason, I am moving it into the `blocks` type-defs and updating all the references.

* Define types for the Product Query block

Also defines a more generic `WooCommerceBlockVariation` type which should be also useful in the future to implement a similar pattern.

* Add Product Query utils

Add two utility functions:

 1. `isWooQueryBlockVariation`: is used to check whether a given block is a variation of the core Query Loop block, and also one of the allowed variations within our repo. See: `QueryVariation` enum type.
2. `setCustomQueryAttribute`: is a shorthand to set an attribute within the variation query attribute.

* Refactor and cleanup the JS demo code

Specifically:

1. Creates a `constant.ts` file to store all shared constants. Currently, the default variation attributes.
2. Move the variations to their own directory. One file per variation.
3. Move the inspector controls into own file and create a conditional logic to allow showing only certain settings.

* Update webpack config

* Add ProductQuery class

* Fix `QueryVariation` enum

We had changed the Products on Sale variation slug to something else,
but we had forgotten to update the proper enum.

* Remove unused params from `update_query`

The filter we added to Gutenberg will pass the block and the page,
as we might need them in the future and we want to minimize the
amount of changes we'll have to do upstream.

However, we currently do not use those, so I removed
them from our own inner function.

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-08-18 10:02:21 +02:00
Tarun Vijwani 40ad67d9a1 Update version to 8.4.0-dev 2022-08-17 18:13:00 +05:30
github-actions[bot] d827e8176e Release: 8.3.1 (https://github.com/woocommerce/woocommerce-blocks/pull/6910)
* Add global styles to Product Categories List block in WC core (https://github.com/woocommerce/woocommerce-blocks/pull/6906)

* add side effect to package (https://github.com/woocommerce/woocommerce-blocks/pull/6904)

* Add _blank to terms link (https://github.com/woocommerce/woocommerce-blocks/pull/6908)

* Only show items if there are multiple packages in the cart (https://github.com/woocommerce/woocommerce-blocks/pull/6899)

* Price Filter Block Design update (https://github.com/woocommerce/woocommerce-blocks/pull/6877)

* make toggle control full width

* add inlineInput attribute

* add inlineInput sidebar setting

* add inlineInput help text

* style the filter button

* style price input

* wip: reset button

* clicking on reset button will reset the price query

* support inline input fields

* price text styling update

* fix reset button font size

* add loading placeholder to all elements

* fix filter button style

* update range slider thumb and track style

* fix loading placeholder for non empty query

* move reset button into FilterSubmitButton component

* try: render placeholder serverside

* update filter button label

* Revert "try: render placeholder serverside"

This reverts commit 98f08efdb8048b8f78c7476b774d1128c1d31295.

* remove LoadingPlaceholder component

* remove Price: prefix from the current displayed price range

* update labels

* extract reset button as a dedicated component

* update price text section

* update reset button behavior

* avoid breaking filter submit button style for other filter blocks

* rename block to Filter by Price

* fix e2e test

* remove border support

* adjust padding for elments

* rename panel title

* Make the inline option enabled by default and fix frontend rendering

* Make the `Price Range Selector` uppercase

* Show `Reset` button only when a selection has been made

* Revert the `save` change to avoid the 'Block Recovery Prompt'

Co-authored-by: Alba Rincón <alba.rincon@automattic.com>

* Release: 8.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6897)

* Empty commit for release pull request

* Bump version numbers and add changelog

* Add testing notes

* Add global styles to Product Categories List block in WC core

* add side effect to package

* Update testing instructions

* Empty commit

* Fix linting

* Update zip file with latest changes

* Fix linting

* Update changelog entries

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>

* Update version to 8.4.0-dev

* Empty commit for release pull request

* Add change log

* Add testing instructions

* Fix the version number in testing instructions

* Bumping version strings to new version.

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-08-17 17:32:49 +05:30
Tarun Vijwani fcde655ae5 Bumping version strings to new version. 2022-08-16 21:48:54 +05:30
Thomas Roberts 2285d1d4e2 Include Cart and Checkout Blocks when included in WC Core (https://github.com/woocommerce/woocommerce-blocks/pull/6805)
* Remove all inbox notifications about cart and checkout blocks

* Remove feature flag check from CreateAccount class

* Remove feature plugin check to register PaymentsApi class

* Comment out is_feature_plugin_build function

We might need this later, so keeping it around seems useful.

* Remove feature plugin check when adding resource hints

* Import registerBlockType and use it over registerFeaturePLuginBlockType

* Ensure Cart and Checkout inner blocks register even if not feature plugin

* Comment out registerFeaturePluginBlockType

* Remove duplicate import

* Revert "Comment out registerFeaturePluginBlockType"

This reverts commit bec6ed899b68e26e836bde1c573d6066fb2bcc47.

* Align PHPDoc correctly

* Update feature flag doc to remove Cart and Checkout blocks + PaymentApi
2022-08-15 11:15:15 +05:30
Alba Rincón 5bcabd0361 Register patterns under `patterns` folder and add filters pattern (https://github.com/woocommerce/woocommerce-blocks/pull/6861)
* POC about registering patterns

* POC load patterns from `/patterns` folder

* Change class name and remove unnecessary comment

* Add all four blocks to the filters pattern

* Add all 4 blocks to the block type to allow for transformations

* Add internal

* Improve filters name

* Extract regex to constants

* Add class description

* Rename and move class

* Fix wrong imports

* Address feedback

* Early return from condition

* Fix wrong block type
2022-08-12 13:09:37 +02:00
Tung Du 9253ba0eec Fix: Override the description to prevent infinite loop (https://github.com/woocommerce/woocommerce-blocks/pull/6849) 2022-08-09 16:28:35 +07:00
Daniel W. Robert 02ce62109e Add font-weight option to Mini Cart block text (https://github.com/woocommerce/woocommerce-blocks/pull/6760)
* Add font-weight option to Mini Cart button text.

Need to repeat steps for icon SVG and cart item count.

* Add font-weight controls to mini-cart item count.

* Add better error handling to PHP style output.

Ensure style value is set for style item in the
get_font_weight_class_and_style attributes array before rendering it to
the output.

* Revert font-weight option for quantity badge.

Per conversation with @vivialice, it looks better for now to keep the
font weight adjustment capabilities to just the price and leave the cart
icon and count as-is.

* Move $typography_styles variable into markup fn.

To resolve merge conflicts and get everything in it's proper place, this
commit will move the $typography_styles variable into the
get_cart_price_markup() function from woocommerce/woocommerce-blocks#6796.
2022-08-05 14:15:10 -04:00
Albert Juhé Lluveras d93bb44537 Update version to 8.3.0-dev 2022-08-02 17:24:34 +02:00
github-actions[bot] c8728fb2b5 Release: 8.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6806)
* Empty commit for release pull request

* Update 8.2.0 changelog

* Add 8.2.0 testing steps

* Fix typo in 8.2.0 testing steps

* Ensure package names display correctly if only one item is in package (https://github.com/woocommerce/woocommerce-blocks/pull/6815)

* Check package length >= 1 to show package name

* Check shipping rates length in order shipping packages slot

* Fix TS error where boolean value could be undefined

* Show items if there is more than one shipping rate

* Update 8.2.0 testing zip

* Bumping version strings to new version.

* Remove empty element from changelog

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-08-02 17:22:37 +02:00
Daniel W. Robert fef4d5e597 Add option to hide/show price in Mini Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/6796)
* Add toggle control to sidebar in editor.

Adds a visibility toggle in the Mini Cart block's sidebar editor
settings for the block price.

* Update name of hasVisiblePrice attrubite.

Adjusts the name of the hasVisiblePrice attribute to hasHiddenPrice.
This seems a bit easier to reason about, where we can set the default
state of the visibility toggle to 'off'.

* Add conditional price rendering to server side.

Since this is a dynamic block, need to add the condidional attribute
state to the server-side render callback.

* Add price visibility setting to block frontend.

We need to prevent pricec from rendering when hidden setting is active
after the JS kicks in on the frontend (i.e., when the Mini Cart is
interacted with by the user).

* Fix logic error in frontend rendering conditional.

* Add unit tests for both show/hide price states.
2022-08-02 10:28:52 -04:00
Seghir Nadir 8e2a2636c2 fix proceed to checkout button (https://github.com/woocommerce/woocommerce-blocks/pull/6804) 2022-08-01 16:29:28 +01:00
Saad Tarhi dc97e5af1e Fix missing translations in inspector (https://github.com/woocommerce/woocommerce-blocks/pull/6737)
* Try registering the "cart taxes" inner block

Registering server side. This example isn't working, but I'm pushing to
share it and see what's wrong with this implementation.

* Fix registering the cart taxes inner block issue

* Update translation script loading

* Remove unnecessary JS translation

The translation should work fine by getting the title & description from
the `block.json` file

* Put back the initial code in the 'Cart Taxes' inner block

We didn't provide the correct `block.json` file path server side,
that's why the `metadata` wasn't correctly registered

* Generate `block.json`files for inner blocks

This is the first step on fixing the missing translations of `metadata`
in `block.json` files

* Set the folder name exactly the same as the inner block name

We are doing this first test for the `Cart taxes` inner block.

The `Block` & its containing folder need to have the same name for:
- Consistency
- We use the `Block` name to get the file Path

* Update imports after folder renaming

* Get block name directly from the JSON metadata

Getting the block name from the JSON metadata is less error prone than
extracting it from the file path.

And no need to rename all our `inner-blocks` to get the correct
`block.json` path

* Revert folder naming change of `Cart taxes` inner block

Since we are getting the `block` name directly from the `block.json`
metadata instead of extracting it from the file path, there is no need
to keep their names in sync anymore

* Fix missing translations for the `Cart Subtotal` Block

* Register only the client-side settings on the client

When the block is registered on the server, you only need to register
the client-side settings on the client using the same block’s name.
See [docs](https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#javascript-client-side).

* Add schema validation to `block.json`

Development is improved by using a defined schema definition file.
Supported editors can provide help like tooltips, autocomplete, and
schema validation.

* Use the same `editor_script` as the parent block

This prevents WordPress from generating script tags to inexistant
inner blocks JS files

* Add C&C inner blocks in Cart.php & Checkout.php

This is a refactoring to keep the block types controller file less
overloaded

* Fix all Cart inner blocks missing translations

* Create the "AbstractInnerBlock" class

The "Inner Blocks" will use their parent's script, so no need to create
new scripts for each one of them

And, our "Inner Blocks" should always be registered using the metadata file

* Update the "Inner Blocks" PHP classes

* Fix PHP lint erros & update function description

* Fix missing translations bug for all Checkout Inner Blocks

* Update src/BlockTypes/Checkout.php

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>

* skip lazy loaded scripts

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2022-08-01 15:57:33 +01:00
Seghir Nadir 2ebb166b41 add new action for customer updates (https://github.com/woocommerce/woocommerce-blocks/pull/6792) 2022-08-01 09:56:28 +01:00
Thomas Roberts 82dd8c22db Add comment to prevent linting error on commented out code (https://github.com/woocommerce/woocommerce-blocks/pull/6789) 2022-07-29 04:54:52 -07:00
Alba Rincón ef13f65dc0 Use the archive-product template to render product attributes pages (https://github.com/woocommerce/woocommerce-blocks/pull/6776) 2022-07-28 12:49:13 +02:00
Tung Du c10e91e7e1 Fix: navigate through Mini Cart contents with keyboard (https://github.com/woocommerce/woocommerce-blocks/pull/6731)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-07-25 12:39:47 +07:00
Tung Du 02a3d27de6 Fix: WooCommerce messages don't appear in block themes with Mini Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/6728) 2022-07-22 00:05:52 +07:00
Luigi Teschio c1c2860232 Mini Cart Block: additional class are visible on the frontend page woocommerce/woocommerce-blocks#5581 (https://github.com/woocommerce/woocommerce-blocks/pull/6716)
Mini Cart Block: additional class are visible on the frontend page
2022-07-20 09:57:41 +02:00
Alba Rincón a4077d865c Bump version from 8.1.0 to 8.2.0-dev 2022-07-19 10:59:47 +02:00
github-actions[bot] 8ae71628a1 Release: 8.1.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6693)
* Empty commit for release pull request

* Update readme.txt

* Update versions

* Update WC versions

* Add testing notes and release zip file

* Update testing instructions

* Fix typo in testing instructions

* Remove fix from the testing instructions

* Update readme

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
2022-07-19 10:51:50 +02:00
Michael P. Pfeiffer 1784b525df Update block template descriptions (https://github.com/woocommerce/woocommerce-blocks/pull/6667) 2022-07-15 15:54:04 +02:00
Alba Rincón 5b50d37028 Prevent showing the blockified templates util they are implemented (https://github.com/woocommerce/woocommerce-blocks/pull/6682) 2022-07-14 14:54:25 +02:00
Paulo Arromba 678fa6bff0 Add: Cross-sells for the Store API Cart response. (https://github.com/woocommerce/woocommerce-blocks/pull/6635)
* Added Cross-sells object and schema for the API Cart response.

* Cross-sells are now WC_Product objects that pass through the visibility filter.

* Removed redundant check.

* Updated function doc comment.

* Cleaned up imports.

* Cross-sells item schema (extension of ProductSchema) was removed, and replaced by ProductSchema itself. Cross-sells are direct product representation, and extending this goes out of scope for the task at hand.

* Unit testing for cart response containing cross-sell products.
2022-07-13 15:02:49 +01:00
Luigi Teschio abf7b80576 Mini Cart: Fix loading deps when WordPress is installed in a subdir (https://github.com/woocommerce/woocommerce-blocks/pull/6673)
* Fix loading deps when WordPress is installed in a subdir woocommerce/woocommerce-blocks#6500

Fix loading deps when WordPress is installed in a subdir

* update logic
2022-07-13 12:42:28 +02:00
Tung Du 42453b7582 Fix: Add support to apply filters via URL for All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/6642)
* price-filter: update URL when filtering products of All Products block.

* active-filters: update the URL when removing price filter

* price-filter: prevent update query on PHP templates when changing prices

* active-filters: on PHP templates, remove filter only triggers the page reload

* price-filter: update comments and naming to reflect new URL behavior

* stock-filter: update url when filtering for All Products block

* attribute-filter: update the URL when filtering for All Products block

* attribute-filter: fix: uncheck all filter doesn't clear the URL

* attribute-filter: fix: endless page reload when filtering for PHP template

* attribute-filter: correctly set the defaults and update the filter query from URL

* fix: filter URL containing stock status doesn't work on homepage

* price-filter: fix issue with URL on All Products

The price slider doesn't reset after removing price filter from the Active Filters block if the initial price filter is set from URL

* ref: passing document.title to pushState is unnecessary

* use replaceState to avoid changing browser history

* extract change URL logic
2022-07-11 14:04:19 +07:00
Luigi Teschio 4aaaebe0c0 Disable render blockified Product Grid Block (https://github.com/woocommerce/woocommerce-blocks/pull/6660)
* Disable render blockified Product Grid Block

* try now
2022-07-06 14:16:32 +02:00
Alba Rincón 75184ae22d Add migration strategy and load blockified templates (https://github.com/woocommerce/woocommerce-blocks/pull/6538)
* Increase `schema_version` to add the new `wc_blocks_use_blockified_templates` flag

If the schema version stored on the db is <= 260 means the plugin is being updated
to the new version and we should keep using the old templates, not the blockified ones.

* After the theme is switched we check if we need to update the flag to
start loading the blockified templates or not.

* Get the templates from the blockified folder if the flag is set to true on the db

* Add temporary blockified template for testing purposes

* Inline variable

* Improve comment

* Use blockified templates on new installs with block themes only

* Don't use blockified templates when switching to a non FSE theme

* Fix condition

* Add tests for the option value

* Move the check to use blockified templates

* WIP

* WIP

* Add migration strategy

* Move the blockified templates to the templates folder and filter them depending on the option

* Fix tests and start using the Options constants

* Fix migration, the `should_use_blockified_product_grid_templates` and tests

* Rename tests and move to Utils folder

* add Migration class test

* try

* remove PHP

* add composer

* Replace the blockified templates with a temporary version

* Fix tests

* add comment

* Add feature gating for experimental builds

* Inject the package to the controller

* test

* Change blocks.ini

* debug

* Remove debug info

* fix test

* fix tests

* try now

* using composer cache

* install deps

* test

* Remove unnecessary extra key

* Add cache actions

* Undo tests change

* Fix readme format

Co-authored-by: Luigi <gigitux@gmail.com>
2022-07-06 09:51:39 +02:00
Niels Lange 073392c96a Bump version from 8.0.0 to 8.1.0-dev 2022-07-05 18:48:38 +02:00
github-actions[bot] 4e6da0b80d Release: 8.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6652)
* Empty commit for release pull request

* Empty commit for release pull request

* Update readme.txt

* Update phpcs.xml

* Add testing notes and ZIP for release 8.0.0

* Update testing notes

* Update testing notes

* Revert woocommerce/woocommerce-blocks#6591

* Update testing notes

* Update readme.txt

* Update ZIP for release 8.0.0

* Change version from 8.0.0-dev to 8.0.0

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
2022-07-05 18:41:05 +02:00
Alba Rincón b5b454ad42 Fix condition to allow rendering classic templates (https://github.com/woocommerce/woocommerce-blocks/pull/6643) 2022-06-29 17:35:40 +02:00
Luigi Teschio e7eb8a6dd5 Show classic template in the inserter only for specific templates (https://github.com/woocommerce/woocommerce-blocks/pull/6539)
* Show classic template in the inserter only for specific templates

* add feature gate

* add todo comment

* rename variable

* address feedback

* not register block on post and page editor

* avoid casting
2022-06-29 09:42:02 +02:00
Seghir Nadir 6e9c348cc4 add custom local pick handling (https://github.com/woocommerce/woocommerce-blocks/pull/6631)
This PR fixes an issue in which taxes are calculated against the user address for local pickups orders. A niche issue, but an important one.
2022-06-27 15:52:24 +01:00
Ovidiu Liuta 9796af2fb4 changing tax_query field to term_id (https://github.com/woocommerce/woocommerce-blocks/pull/6585)
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
2022-06-22 12:51:14 +02:00
Nadir Seghir e50b654d69 update version 2022-06-22 10:42:03 +01:00
github-actions[bot] da202ab1e0 Release: 7.9.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6604)
* Empty commit for release pull request

* update readme

* add testing notes

* update link

* Bumping version strings to new version.

* move testing docs

* remove old folder

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-06-22 10:40:03 +01:00
Luigi Teschio 15ee965e48 Fix crash when the user saves Mini Cart Template (https://github.com/woocommerce/woocommerce-blocks/pull/6613) 2022-06-21 18:30:26 +02:00
Tung Du aadb94c012 Fix: Display the correct title for templates from theme (https://github.com/woocommerce/woocommerce-blocks/pull/6452) 2022-06-21 22:26:09 +07:00
Daniel Dudzic 8f00447f2d Add descriptions for all WC templates and refactor Search template hierarchy loading logic (https://github.com/woocommerce/woocommerce-blocks/pull/6345)
* Refactor template title and description loading and search template hierarchy updating

* Remove an unnecessary return

* Fix template descriptions for custom templates

* Fix template description typos

* Move the template description loading logic to mirror the title's

* Remove the descriptions filter and move the search hierarchy code back to a separate file

* Restore the original order of the container registrations

* Restore the product search template slug

* Restore the Product Search Results slug as a constant

Co-authored-by: Luigi <gigitux@gmail.com>
2022-06-20 14:49:18 +01:00
Albert Juhé Lluveras fc956b7f48 Fix images hidden by default in Product grid blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6599) 2022-06-20 14:13:56 +02:00
Albert Juhé Lluveras b543fa2684 Replace instances of wp_is_block_theme() with wc_current_theme_is_fse_theme() (https://github.com/woocommerce/woocommerce-blocks/pull/6590) 2022-06-17 14:51:04 +02:00
Tomasz Tunik 0dfc1ad58b provide span wrapper for category list item name (https://github.com/woocommerce/woocommerce-blocks/pull/6574)
will enable adding text overflow of other effects that user might not want to interfere with the image element
2022-06-15 11:37:21 +02:00
Albert Juhé Lluveras 680ebba7cb Fix an endless loop when using product grid blocks inside product descriptions (https://github.com/woocommerce/woocommerce-blocks/pull/6471)
* Fix an endless loop when using product grid blocks inside product descriptions

* Add array_key_exists protection

* Typo in comment

* 👌IMPROVE: Improve comments - woocommerce/woocommerce-blocks#6416

Co-authored-by: Panos (Panagiotis) Synetos <panos.synetos@automattic.com>
2022-06-14 11:24:48 +03:00
Niels Lange 15a22db4f4 Update README.md 2022-06-13 14:37:05 +02:00
Niels Lange 3208da551b Improve the structure of the WooCommerce Blocks Handbook (https://github.com/woocommerce/woocommerce-blocks/pull/6429)
* Improve the structure of the WooCommerce Blocks Handbook

Co-authored-by: Rania Lang <rania.langouretou@automattic.com>
2022-06-09 17:52:19 +02:00
Niels Lange a748f533a8 Format Markdown files using wp-scripts (https://github.com/woocommerce/woocommerce-blocks/pull/6462)
* Format Markdown files using Prettier

* Format Markdown files using wp-scripts

* Adjust MD linting
2022-06-09 14:43:17 +02:00
Alex Florisca 295184a734 Change Checkout.md to correct mistake (https://github.com/woocommerce/woocommerce-blocks/pull/6541) 2022-06-09 13:18:25 +03:00
Thomas Roberts 0aa3bcd9cb Access correct property of package destination in Store API (https://github.com/woocommerce/woocommerce-blocks/pull/6470)
* Access correct property of package destination

* Check for address_1 first then address
2022-06-09 12:45:00 +03:00
Albert Juhé Lluveras d994f06803 Fix PHP notice in Mini Cart when prices included taxes (https://github.com/woocommerce/woocommerce-blocks/pull/6537) 2022-06-09 09:57:37 +02:00
Luigi Teschio 9a80ad3f6a bump version and update tested up value for WordPress and WooCommerce (https://github.com/woocommerce/woocommerce-blocks/pull/6534) 2022-06-07 15:58:18 +02:00
github-actions[bot] 7a05f8559d Release: 7.8.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6517)
* Empty commit for release pull request

* Add changelog for the 7.8.0 release

* Add testing notes for 7.8.0 release

* move legacy payment processing to its own class (https://github.com/woocommerce/woocommerce-blocks/pull/6519)

* update changelog and testing instructions after the cherry-pick

* add link

* Featured Item: Fix colors from default palette not being applied (https://github.com/woocommerce/woocommerce-blocks/pull/6525)

Gutenberg uses two different attributes for text colors:

* `style.color.text`, and
* `textColor`

However, the second one is used only when a color from the default
palette is selected AND the post is saved and reloaded.

With this fix we use the human readable string from the default palette
as a CSS variable.

Please note that while Gutenberg correctly assigns the appropriate CSS
class to render the right color, the problem is that if the color is
handled by a class, it can be overridden for example by themes.

See woocommerce/woocommerce-blocks#6492

* upload new zip

* update changelog

* Revert "Remove Combobox patch (https://github.com/woocommerce/woocommerce-blocks/pull/6465)" (https://github.com/woocommerce/woocommerce-blocks/pull/6531)

This reverts commit 4976afad58.

* upload new zip

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-06-07 15:40:54 +02:00
Seghir Nadir 87a5e41e05 move legacy payment processing to its own class (https://github.com/woocommerce/woocommerce-blocks/pull/6519) 2022-06-06 13:44:52 +01:00
Tung Du fb84599f42 Fix: Use `register_block_type_from_metadata` function (https://github.com/woocommerce/woocommerce-blocks/pull/6511) 2022-06-03 10:10:08 +07:00
Tung Du 775e149ad7 Fix: All translations related to JS blocks are loaded even if the block is not used (https://github.com/woocommerce/woocommerce-blocks/pull/6478) 2022-05-30 23:00:40 +07:00
Daniel Dudzic b15050909e Mini Cart: Add font size and font family controls (https://github.com/woocommerce/woocommerce-blocks/pull/6396)
* Mini Cart: Add font size and family controls

* Remove redundant property from the path

* Add conditional check for isFeaturePluginBuild
2022-05-30 10:45:15 +02:00
Alba Rincón 7ab9cb214b Refactor: `Featured product` and `Featured category` classes (https://github.com/woocommerce/woocommerce-blocks/pull/6443)
* Add `Fixed/Repeated background` to the `Featured Category` block

* Reorganize `Featured Product` and `Feature Category` before unification

* Add new `FeaturedItem` class with the shared code for `Featured Product/Category`

* Remove space

* Small tweaks after review feedback
2022-05-30 09:08:53 +02:00
Seghir Nadir 3ff8440643 Respect low stock setting (https://github.com/woocommerce/woocommerce-blocks/pull/6444) 2022-05-27 20:55:46 +01:00
Daniel Dudzic 9488b9186d Post-release version bump to 7.8.0-dev 2022-05-26 11:08:20 +02:00
github-actions[bot] 7f32bc4c14 Release: 7.7.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6448)
* Empty commit for release pull request

* Add changelog for the 7.7.0 release

* Add testing notes for the 7.7.0 release

* Fix being able to remove Cart Totals block (https://github.com/woocommerce/woocommerce-blocks/pull/6449)

* Update .zip link for the 7.7.0 release

* Revert changes to webpack build output (https://github.com/woocommerce/woocommerce-blocks/pull/6456)

* revert changes to webpack file

* fix loading of chunks

* revert changes to assets api as well

* include chunks from other blocks

* bail early if there is no build folder

* check if current folder exist (https://github.com/woocommerce/woocommerce-blocks/pull/6460)

* Update the 7.7.0 release .zip file

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2022-05-26 11:03:56 +02:00
Seghir Nadir f031f8f83a check if current folder exist (https://github.com/woocommerce/woocommerce-blocks/pull/6460) 2022-05-26 10:34:29 +02:00
Seghir Nadir d3c2f638fa Revert changes to webpack build output (https://github.com/woocommerce/woocommerce-blocks/pull/6456)
* revert changes to webpack file

* fix loading of chunks

* revert changes to assets api as well

* include chunks from other blocks

* bail early if there is no build folder
2022-05-25 16:59:51 +01:00
Alba Rincón 983a13c8bf Add `Fixed/Repeated background` to the `Featured Category` block (https://github.com/woocommerce/woocommerce-blocks/pull/6440)
* Add `Fixed/Repeated background` to the `Featured Category` block

* Reorganize `Featured Product` and `Feature Category` before unification

* Fix gradient overlay
2022-05-24 16:10:16 +02:00
Seghir Nadir 238ab01ab2 Refactor webpack splitting to fix missing translation (https://github.com/woocommerce/woocommerce-blocks/pull/6420)
* don't splitChunk frontend scripts

* simplfy output folders

* reduce minimum chunk size to 10kb

* add all inner blocks for loading

* better splitChunks

* update translation code

* wait for scripts

* try sleeping

* fix loading translation

* fix tests for mini cart

* simplfy po logic

* automate loading chunks

* rename webpack group file

* rename block.json path
2022-05-23 15:58:13 +01:00
Alba Rincón a18e44e1a7 Convert `Products by Attribute` to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6418)
* Convert `Products by Attribute` block to TS

* Small tweaks after review

* Extract InspectorControls and EditMode into components

* Refactor: move the edit related code to the edit.jsx file

* Remove the `editMode` attribute and control the edit mode inside the edit component

* Remove edit mode

* Change `isEditing` depending on attributes are selected or not

* Improved interfaces/props after review

* Add enum allowed values to `attrOperator` and `orderby` on the `block.json`

* Move `withSpokenMessages` to wrap the whole Edit block
2022-05-23 10:45:54 +02:00
Alba Rincón eec68ed371 Convert `Handpicked Products` block to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6417)
* Convert `Handpicked Products` block to TS

* Extract InspectorControls and EditMode into components

* Refactor edit and remove the `editMode` attribute

* Change `isEditing` default depending on products selected or not

* Improve interfaces/props after review

* Move withSpokenMessages to wrap the whole Edit block
2022-05-23 10:14:51 +02:00
Alba Rincón 3b86ff6b39 Fix padding for the Featured Product block (https://github.com/woocommerce/woocommerce-blocks/pull/6435) 2022-05-20 14:20:57 +02:00
Lucio Giannotta 7fcc561db1 Refactor Featured Category and Featured Product blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6406)
This PR creates a new directory called `featured-items` which includes both blocks.
All the shared code lives at the top level of that directory.

Individual blocks still have their own directories, with their `block.json` and all other relevant configuration.

All the functionalities have been refactored out into their own files, accepting configuration when relevant, but mostly de-duplicating all the code.

Styles have also been refactored using mixins and extends and they mostly live in one place.
2022-05-19 18:16:46 +02:00
Alba Rincón 22e6394d47 Implement `Fixed image` and `Repeated image` media controls for the `Featured Product` (https://github.com/woocommerce/woocommerce-blocks/pull/6344)
* Add `Fixed` and `Repeated` background controls to `Featured Product`

* Add `Repeated background` feature when the toggle is activated

* Extract `get_image_url` function

* Add the styles for rendering the repeated image on the frontend

* Add `hasParallax` and `isRepeated` to the `block.json` file

* Adjust styles

* Remove unused function, improve phpdoc

* Use alt and product name

Fix error rebasing master

* Hide alt if isRepeat is true

When isRepeated is true, the image is a background so it does not
make sense to have an alt attribute.

* Add `Fixed image` behaviour

* Remove unnecessary single quotes

* Remove duplicated const due to rebasing

* Fix focal point getting lost after enabling Fixed bg

* Fix duotone for fixed and repeated images

* Fix duotone for fixed and repeated images on the front end

* Don't allow alt if the image is a bg not an img element
2022-05-18 16:08:32 +02:00
Thomas Roberts 2bfc687093 Bump version numbers following release PR merge 2022-05-10 12:55:02 +01:00
github-actions[bot] 07b201664a Release: 7.6.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6388)
* Empty commit for release pull request

* Bump version numbers and add changelog

* Add testing notes

* Add correct list of blocks to 6302 notes

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-05-10 12:50:11 +01:00
Thomas Roberts f3dc80c6f7 Bump version numbers to 7.7.0-dev 2022-05-10 09:54:22 +01:00
Tom Cafferkey fffe7903d7 Check asset_data_registry keys do not exist before adding them for PHP templates (https://github.com/woocommerce/woocommerce-blocks/pull/6384)
* Check key does not exists before adding it

* Use third param to check if duplicate key exists instead of condition
2022-05-09 11:50:22 +01:00
Daniel Dudzic 0b3acfad27 Add the product image control for all blocks utilizing GridContentControl (https://github.com/woocommerce/woocommerce-blocks/pull/6302) 2022-05-09 12:04:33 +02:00
Tung Du 26fbb3f569 Shop page: Remove the Template panel from the Setting Sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/6366) 2022-05-05 08:08:10 +07:00
Tung Du 217c822b76 Fix: Mini Cart block is not available from the Edit template screen (https://github.com/woocommerce/woocommerce-blocks/pull/6351)
* revert woocommerce/woocommerce-blocks#5653

* remove unused global variable

* fix class name
2022-05-05 07:41:35 +07:00
Daniel Dudzic cd8196fa5f Product Tag Cloud: Hide from Widgets screen in classic themes (https://github.com/woocommerce/woocommerce-blocks/pull/6327)
* Product Tag Cloud: Hide from Widgets screen in classic themes
* Fix code indentation
2022-05-04 16:57:25 +02:00
Tung Du 206672f27e Classic Template: set the default alignment to wide (https://github.com/woocommerce/woocommerce-blocks/pull/6356) 2022-05-04 18:02:42 +07:00
Alba Rincón bdfd1da4c5 Start using the `block.json` metadata file for the `Featured Category` block (https://github.com/woocommerce/woocommerce-blocks/pull/6300)
* Start using the `block.json` metadata file for the `Featured Category` block

* Get default attributes from the `block.json` file

* Remove unnecessary `get_block_metadata_defaults` function

* Add alt attribute to the block.json file

* Remove unused imports
2022-04-28 17:31:59 +02:00
Alba Rincón 0aac2c59ef Start using the `block.json` metadata file for the `Featured Product` block (https://github.com/woocommerce/woocommerce-blocks/pull/6296)
* Start using the `block.json` metadata file for the `Feature Product` block

* Get default attributes from the block.json file

* Add removed comment

* Remove unnecessary `get_block_metadata_defaults` function

* Add alt default to block.json
2022-04-28 17:04:56 +02:00
Alba Rincón 964f6e5965 Add new `alt` attribute to the `Featured Product` media settings (https://github.com/woocommerce/woocommerce-blocks/pull/6308)
* Add new `alt` attribute to Media Settings

Allow to define an alt text for the Feature Product block

* Simplify on change

* Improve alt description and use name instead of short description

Short description can contain html and images, so it's not adequate to use on the alt attribute
2022-04-28 16:28:22 +02:00
Alba Rincón ec73743d0f Add new `alt` attribute to the `Featured Category` media settings (https://github.com/woocommerce/woocommerce-blocks/pull/6341) 2022-04-28 16:28:09 +02:00
Tarun Vijwani 1d0acebfa9 Update to dev version: 7.6.0-dev (https://github.com/woocommerce/woocommerce-blocks/pull/6336)
* update to dev version: 7.6.0-dev
2022-04-27 17:54:51 +04:00
github-actions[bot] a0d7400432 Release: 7.5.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6312)
* Release: 7.5.0
2022-04-27 17:19:21 +04:00
Tom Cafferkey 6fb43ed8cb Deprecate legacy filter widgets with block alternatives (https://github.com/woocommerce/woocommerce-blocks/pull/6299)
* Transform object for woocommerce_price_filter legacy widget to be replaced with block alternative

* Filter products by price transform

* Price Filter formatting

* Set set_filterable_product_data data on the widgets screen

* Prevent rendering the Price Filter block if there are no products to filter

* Prevent Classic Price Filter Widget from being available as a widget

* Transform layered nav classic widget to attribute filter block

* Allow Filter Products by Stock block to be added as a widget

* Allow Active Filters widget to be transformed to Active Filters block

* Set showFilterButton to true and showInputFields to false in the transform of Price Filter to minic widgets more

* Change displayStyle property to be display_type instead of incorrectly using title

* mock @woocommerce/settings for has_filterable_products setting

* try: add All Products block to render that filter on the front end

* Revert "try: add All Products block to render that filter on the front end"

This reverts commit 5ad09e964b77e5c6499b4134cf58d7a6c226424d.

* try: add all product block to bypass has_filterable_products check

* fix: backend e2e test for attribute filter

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-27 08:36:00 +01:00
Tom Cafferkey 781de225da Only set data is_rendering_php_template in Classic Themes on WooCommerce product archive templates where filters are being used. (https://github.com/woocommerce/woocommerce-blocks/pull/6324) 2022-04-26 12:22:43 +01:00
Tung Du e0f140c7e2 Fix: Customizer fatal error for bundled woocommerce-blocks package (https://github.com/woocommerce/woocommerce-blocks/pull/6317) 2022-04-26 15:21:14 +07:00
Seghir Nadir bbd7e53598 graduate draft orders (https://github.com/woocommerce/woocommerce-blocks/pull/6288) 2022-04-25 15:08:37 +01:00
Seghir Nadir bcd490a78f udpate attributes docs (https://github.com/woocommerce/woocommerce-blocks/pull/6272) 2022-04-25 15:08:14 +01:00
Seghir Nadir 162c21a84d show attributes in simple products (https://github.com/woocommerce/woocommerce-blocks/pull/6274) 2022-04-25 15:07:47 +01:00
Harris Papazoglou f46d912cc9 Product Query: pass any product taxonomies existing in the URL parameters. (https://github.com/woocommerce/woocommerce-blocks/pull/6152)
* Product Query: pass any product taxonomies existing in the URL parameters.

* Products API: add custom product taxonomy in docs.

* Docs: fixes type.

* Linting the docs.

* Product Query: add [product-taxonomy]_operator docs.

* Product Query: fixes the taxonomies merge order.

* Product Query: make sure that tax keys are unique and sanitized.

* Product Query: adds `tax_` prefix to docs.

* Product Query: fixes not_in for categories, taxonomies, and tags.

* Product Query: updates attribute operator enum.

* Product query: uses `_unstable_tax_` instead of `tax_` prefix for custom taxonomies.

Co-authored-by: cpap <papazoglou.charalampos@gmail.com>
2022-04-21 15:00:11 +03:00
Luigi Teschio 881c202717 Make Filter Products by Stock block compatible with PHP rendered Classic Template block (https://github.com/woocommerce/woocommerce-blocks/pull/6261)
* Enable Attribute Filter block to work with the PHP rendered Classic Template block

* Check for presence of option before rendering it

* improve filter product by attribute

* fix pagination problem

* fix check when two filter block with same attribute are used

* fix filter by stock for PHP templates

* fix naming and comment

* Update filter key in ClassicTemplate

* Update stock filter block for PHP templates when the filter button is enabled

* Remove unused useEffect and fix ESLint error

* Set active stock filter and track using local state

* ESLint fix

* Remove unncessary dependencies from useEffect

Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
2022-04-21 08:28:41 +01:00
Lucio Giannotta 268d6e1a34 Enable more style options for the Featured Category block (https://github.com/woocommerce/woocommerce-blocks/pull/6276)
* Enable more options for the Featured Category block

* Fix the focal point picker
* Fix the resizeable handle
* Fix the overlay and move to own section
* Enable gradient and duotone
* Add padding and fix min height

* Export ConstrainedResizeable from Featured Product

* Wrap duotone in feature plugin flag

* Add support for `border-radius`

* Change prop order

* Add SSR for new options on Featured Category block

* Optional chaining on border radius

Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>

* Add default to overlay and height

* Optional chaining on border radius for Featured Product block

* Fix gradient persistence and default overlay discrepacies

* Explicitly add box-sizing to the featured-product/category wrapper

Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
2022-04-21 08:20:10 +01:00
Lucio Giannotta 9b6d0e0e0f Fix Featured Product block frontend mismatch (https://github.com/woocommerce/woocommerce-blocks/pull/6263)
If the Featured Product block was added but not modified at all,
the block would not match the editor on the front end.

This was due to the fact that, on the frontend, the
block is SSR and was missing some defaults which
were present in JS.
2022-04-19 15:57:05 +02:00
Tom Cafferkey 0d9348f618 Provide product filter blocks a method to know when to display. (https://github.com/woocommerce/woocommerce-blocks/pull/6270)
* Add has_filterable_products data to the AllProducts block to be used by product filter blocks

* Add has_filterable_products data to the ClassicTemplate block to be used by product filter blocks

* Add ClassicTemplatesCompatibility class which will add necessary data to the front-end of core PHP templates of Classic Themes for filter blocks being used as widgets.

* Update comment of set_php_template_data method on ClassicTemplatesCompatibility class

* Move conditional checking if the current theme is a block theme in ClassicTemplatesCompatibility class
2022-04-19 08:14:09 +01:00
Shendy 19dfae3dcc Call plugin_dir_url() in Package::get_url() instead of from its constructor. (https://github.com/woocommerce/woocommerce-blocks/pull/6260) 2022-04-14 17:28:32 +01:00
Tom Cafferkey 4d3c609a3c Make Attribute Filter block compatible with PHP rendered Classic Template block (https://github.com/woocommerce/woocommerce-blocks/pull/6204)
* Enable Attribute Filter block to work with the PHP rendered Classic Template block

* Check for presence of option before rendering it

* improve filter product by attribute

* fix pagination problem

* fix check when two filter block with same attribute are used

Co-authored-by: Luigi <gigitux@gmail.com>
2022-04-14 14:38:23 +02:00
Saad Tarhi 91ec25424a Post release version bump (7.5.0-dev) 2022-04-14 13:23:29 +00:00
github-actions[bot] 7d96272cf0 Release: 7.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6225)
* Empty commit for release pull request

* Add Changelog to readme.txt

* Update WC tested and required versions

* Add testing notes

* Register missing C&C inner blocks and update fallback template for older C& C versions (https://github.com/woocommerce/woocommerce-blocks/pull/6195)

* Register missing C & C inner blocks and update fallback template for older C & C versions

This will fix the issues with missing order summary inner blocks: Coupons (both in C & C blocks) and the Cart header. The issue was happening because, for example, for Cart the coupons were registred on the on frontend, but it just wasn't forced in the attributes. Because it also wasn't added to the PHP fallback layout, the render function didn't include it. For the Checkout block the coupons inner block wasn't registered at all.

* Revert changes to Checkout.php, we don't need to test for inner blocks

* Revert "Revert changes to Checkout.php, we don't need to test for inner blocks"

This reverts commit fc39535f8476d02e35353374d9434a8723458cfa.

* Fix the returned template for older Checkout block iterations

* Fix Cart and Checkout templates to accommodate the Summary order inner blocks

* Hide coupon form div from inner blocks if coubons are not enabled

* Fix checkout coupon tests in checkout

They have been written for logged in user

* Fix Order Summary Heading inner block's default text

* Update comments with better wording

* Revert "Hide coupon form div from inner blocks if coubons are not enabled"

This reverts commit ab09021b923fad4218b3016e47760ad07f6bc960.

(cherry picked from commit 0b18ff59bd)

* Update the zip file link

* Update testing instructions

* Remove experimental build related PR from testing notes

* Fix/order summary sidebar css (https://github.com/woocommerce/woocommerce-blocks/pull/6231)

* Add box sizing to Totals item

* Add some unit tests for Order summary blocks

* Fix Proceed to checkout button size

(cherry picked from commit d22ce7cd0b)

* Update the WC required/tested versions

* Mini Cart Contents: Use block pattern to make the empty cart message translatable (https://github.com/woocommerce/woocommerce-blocks/pull/6248)

* try: use block pattern to make empty cart message translatable

* Update src/BlockTypes/MiniCart.php

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

* rename function

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Luigi <gigitux@gmail.com>
(cherry picked from commit 93ad72f6ff)

* Update the release's ZIP file

* Update testing notes

In woocommerce/woocommerce-blocks#6065, for Cart only Order Summary Heading & Coupon form can
be removed, and for Checkout only the Coupon form.

* Update the testing notes

Remove woocommerce/woocommerce-blocks#5870 testing notes because they can't be tested as a user

* Update Testing notes

Add screenshots to the woocommerce/woocommerce-blocks#5967 testing notes

* Remove woocommerce/woocommerce-blocks#6166 testing instructions

We reverted this PR

* Revert (https://github.com/woocommerce/woocommerce-blocks/pull/6166) (https://github.com/woocommerce/woocommerce-blocks/pull/6253)

Revert "Prevent Featured Product block from breaking when product is out of stock + hidden
from catalog (https://github.com/woocommerce/woocommerce-blocks/pull/6166)"

This reverts commit 92387e2

(cherry picked from commit c586b1a5f3)

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-14 11:55:33 +00:00
Luigi Teschio bac2c59daa Add Product Search Results Template (https://github.com/woocommerce/woocommerce-blocks/pull/6219)
* Add Search Result Product Template woocommerce/woocommerce-blocks#6218

Add Search Result Product Template

* update title

* add E2E test for Product Search Results template

* renaming class

* update E2E tests
2022-04-14 11:45:00 +02:00
Tung Du 93ad72f6ff Mini Cart Contents: Use block pattern to make the empty cart message translatable (https://github.com/woocommerce/woocommerce-blocks/pull/6248)
* try: use block pattern to make empty cart message translatable

* Update src/BlockTypes/MiniCart.php

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

* rename function

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2022-04-13 17:15:48 +02:00
Lucio Giannotta ebd8774ae6 Enable more style options for the Featured Product block (https://github.com/woocommerce/woocommerce-blocks/pull/6181)
* Add support for overlay color and duotone
* Add support for custom inner padding
* Wrap all block experimental features in `isFeaturePluginBuild`
* Fix resizable container min height

The container now resizes if, e.g., padding is increased, and can't be resized down
with the handle to a height lower than it's minimum size determined by content and
padding box.

* Fix resizable handle not being fully visible

Previously, `overflow: hidden` was needed because the height constraint and
padding could push the content out of the container. Now this should not be
possible.

* Add an option to the block to decide how is the image fitted to the container
2022-04-12 17:16:00 +02:00
Raluca Stan 0b18ff59bd Register missing C&C inner blocks and update fallback template for older C& C versions (https://github.com/woocommerce/woocommerce-blocks/pull/6195)
* Register missing C & C inner blocks and update fallback template for older C & C versions

This will fix the issues with missing order summary inner blocks: Coupons (both in C & C blocks) and the Cart header. The issue was happening because, for example, for Cart the coupons were registred on the on frontend, but it just wasn't forced in the attributes. Because it also wasn't added to the PHP fallback layout, the render function didn't include it. For the Checkout block the coupons inner block wasn't registered at all.

* Revert changes to Checkout.php, we don't need to test for inner blocks

* Revert "Revert changes to Checkout.php, we don't need to test for inner blocks"

This reverts commit fc39535f8476d02e35353374d9434a8723458cfa.

* Fix the returned template for older Checkout block iterations

* Fix Cart and Checkout templates to accommodate the Summary order inner blocks

* Hide coupon form div from inner blocks if coubons are not enabled

* Fix checkout coupon tests in checkout

They have been written for logged in user

* Fix Order Summary Heading inner block's default text

* Update comments with better wording

* Revert "Hide coupon form div from inner blocks if coubons are not enabled"

This reverts commit ab09021b923fad4218b3016e47760ad07f6bc960.
2022-04-12 12:20:22 +01:00
Thomas Roberts ab71adcd4b Pass correct number of arguments to woocommerce_blocks_checkout_update_order_from_request (https://github.com/woocommerce/woocommerce-blocks/pull/6224) 2022-04-12 10:30:27 +01:00
Jamel Noel Reid 64fcdda420 Add Product endpoint to ExtendSchema (https://github.com/woocommerce/woocommerce-blocks/pull/6122)
* Added ProductSchema Identifier

* Updated get_extended_schema & get_item_response

* Test for extensions field on products

* Updated endpoint extend Readme
2022-04-11 17:40:26 +01:00
Tung Du d5503b6e46 Fix: Mini Cart block isn't available in the Customizer > Widget (https://github.com/woocommerce/woocommerce-blocks/pull/6201) 2022-04-08 17:14:25 +07:00
Tung Du 5415c22251 Prepare the Mini Cart block for WC Core release (https://github.com/woocommerce/woocommerce-blocks/pull/6209) 2022-04-08 15:51:21 +07:00
Tarun Vijwani d85e9766a7 Increased Cart product quantity limit to 9999 (https://github.com/woocommerce/woocommerce-blocks/pull/6202)
Increased per item cart limit to 9999
2022-04-08 12:46:48 +04:00
AndrewJDawes fc20c8363e Fix Actions and Filters documentation with broken links woocommerce/woocommerce-blocks#5808 (https://github.com/woocommerce/woocommerce-blocks/pull/6128)
* Fix docs paths for actions and filters source links woocommerce/woocommerce-blocks#5824

* Build docs after fixes for woocommerce/woocommerce-blocks#5824 - see 0c79cb7f4e75fc5c48c9b054cbac6f0344b4048a
2022-04-05 16:22:56 +02:00
Albert Juhé Lluveras 58c649e971 Update Filter Products by Price block to work with PHP templates (https://github.com/woocommerce/woocommerce-blocks/pull/6146)
* Update Filter Products by Price block to work with PHP templates

* Reformat param formatting

* Add check for PHP template

* window guards and comments for context

* Add comment to page reload

* Addressed code review feedback

* Fix setMinPriceQuery and setMaxPriceQuery values

* Remove unnecessary snake_case comment and update newUrl to assign to window.location.href.

* package-lock.json update

Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
2022-04-05 11:52:35 +01:00
Luigi Teschio 54b52c62ca Mini Cart block - fix translations handling woocommerce/woocommerce-blocks#6153 (https://github.com/woocommerce/woocommerce-blocks/pull/6158)
* Mini Cart block - fix translations handling woocommerce/woocommerce-blocks#6153

Mini Cart block - fix translations handling

* Mini Cart block - fix translations handling (https://github.com/woocommerce/woocommerce-blocks/pull/6164)

* loads translations for deps

Co-authored-by: Tung Du <dinhtungdu@gmail.com>

* address code review. load translations close to associated scripts

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-01 10:54:01 +02:00
Tung Du f4d4bed2c1 Mini Cart Contents: Refactor inner blocks styling using `currentColor` (https://github.com/woocommerce/woocommerce-blocks/pull/6130) 2022-03-29 20:48:59 +07:00
tjcafferkey beaefc0bc6 Version bump to 7.4.0-dev 2022-03-28 16:01:04 +01:00
github-actions[bot] b60a7418f1 Release: 7.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6129)
* Empty commit for release pull request

* Updated changelog

* Prepare the Mini Cart block for Feature Plugin (https://github.com/woocommerce/woocommerce-blocks/pull/6127)

* Release notes

* Update plugin url

* Add 730 to README testing

* Remove PR from testing notes and changelog

* Remove PR from testing notes

* Allow memoized filters to re-run if `defaultArg` changes (https://github.com/woocommerce/woocommerce-blocks/pull/6102)

* Check the last defaultArg to decide whether we re-run filters

* Fake commit to make CI run

* Revert change to .gitignore to make CI run

* Update testing instructions

* Update testing instructions

* Update download link

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-03-28 15:58:41 +01:00
Tung Du 3b8d790efe Prepare the Mini Cart block for Feature Plugin (https://github.com/woocommerce/woocommerce-blocks/pull/6127) 2022-03-28 15:42:07 +07:00
Tung Du 6e375408f7 Mini Cart: Fix footer buttons hover style (https://github.com/woocommerce/woocommerce-blocks/pull/6086)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-03-24 22:34:36 +07:00
Tom Cafferkey b3fca9a1b9 Add static keyword to function (https://github.com/woocommerce/woocommerce-blocks/pull/6112) 2022-03-24 09:55:46 +00:00
Tom Cafferkey 7d0c2847f5 Refactor BlockTemplateUtils (https://github.com/woocommerce/woocommerce-blocks/pull/6019)
* Refactor BlockTemplateUtils.php

* Update comments

* Code review feedback

Co-authored-by: Tom Cafferkey <tom@Toms-MBP-2.broadband>
2022-03-23 09:16:07 +00:00
Alba Rincón 13311e7bee Rename Legacy Template block to Classic Template block (https://github.com/woocommerce/woocommerce-blocks/pull/6021)
The internal ID has been kept after a comment by @tjcafferkey. This causes a
bit of inconsistency in the internal code, but it was deemed that it would have
been better as users who have customized templates using this
blocks ID will have saved this in their database, and it would result
in a corrupt block when loaded, and we didn't want to support both IDs at the
moment.

Otherwise, most other references to the legacy template, are now using the word
“classic”.

Co-authored-by: Alba Rincón <alba@albasauatticmbp.home>
2022-03-22 23:34:43 +01:00
Mike Jolley 89e86b4999 Create deprecated_dependency wrapper to log errors conditionally (https://github.com/woocommerce/woocommerce-blocks/pull/6074)
Store Editing  E2E tests are failing because of an upstream regression, not related to this PR
2022-03-22 15:06:14 +01:00
Mike Jolley f68890170a 7.2.0 changelog 2022-03-15 11:33:20 +00:00
Mike Jolley f926b24480 Checkout: Missing country error for virtual orders (edge case) (https://github.com/woocommerce/woocommerce-blocks/pull/6050)
* Make shipping address field optional on checkout routes

* Make update_customer_from_request use billing for shipping if omitted

* making shipping optional when needed

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-03-14 13:53:08 +00:00
Daniel Dudzic 5a8e94d86e Product Ratings: Add Global Styles font size and spacing support (https://github.com/woocommerce/woocommerce-blocks/pull/5927)
* Product Ratings: Add font size and spacing support

* Fix useTypographyProps hook

* Set SkipSerialization for Ratings block props

* Add additional hasSpacingStyleSupport check for the spacing

Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-03-11 16:52:00 +01:00
Mike Jolley 011c4cb6fd Add missing chunk to register_block_type_assets 2022-03-11 15:34:25 +00:00
Mike Jolley 8e057a03f5 Remove X- Prefixes from custom headers (https://github.com/woocommerce/woocommerce-blocks/pull/6020)
* Remove X- Prefixes from custom headers

* Fix docs

* Handle deprecated X-WC-Store-API-Nonce header if received

* Send old nonce until future version removes this

* Add todo and cut off date

* wc_deprecated_argument

* Update todo name

* typo

* Back compat in batch

* Flip Nonce logic to make it easier to support both in client bw compat logic
2022-03-11 12:07:08 +00:00
Luigi Teschio f78b2d8619 Remove not used attributes (https://github.com/woocommerce/woocommerce-blocks/pull/5974)
* Remove not used attributes woocommerce/woocommerce-blocks#5952

remove not used attributes

* remove not necessary jsdoc comments

Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-03-11 12:44:51 +01:00
Luigi Teschio 807720a28d Remove not necessary todo woocommerce/woocommerce-blocks#5827 (https://github.com/woocommerce/woocommerce-blocks/pull/6039)
Remove not necessary todo
2022-03-10 14:53:42 +01:00
Christos Lilitsas 28d647d02c Clear notices session after handling (https://github.com/woocommerce/woocommerce-blocks/pull/5983) 2022-03-10 12:29:58 +00:00
Tomasz Tunik f15d628610 Fix 404 and 500 errors in E2E test logs, editor and front-end. (https://github.com/woocommerce/woocommerce-blocks/pull/5989)
* Change atomic blocks to not use custom webpack build paths

we want to always load lazy loaded components from their default paths
to avoid having to handle importing components in different ways for
regular and atomic component packages

* Add footer parts to test themes

The Site Editor is expecting the footer parts to be there or it will try to
load them anyways and throw a 404. It's not breaking, but it's polluting
the console.

* Use REST API to tear down the templates

Previously, we used a util called `trashAllPosts` which navigated to the post UI
and deleted all the posts to tear down any side-effects of template editing tests.

However, with a [recent change](14e20f72b5),
WP Core removed the UI for those and that made our tests meet a 500 error.

Using the REST API should also make everything faster.

* Remove deprecated pupeteer waitFor usage

was still present in attribute-filter.test.js

* Update package-lock.json

* pin package versions

* Unify all atomic blocks to register on php side

* Remove Atomic Blcoks chunk_translation handling from AllBlocks

Before it was responsible for enabling translations for all the atomic blocks

* Add per atomic block chunk_translation registration

* update @wordpress/e2e-test-utils to 6.0.2

* add optional puppeteer

* pin workflows node version to 16.13.2

* upgrade package-lock

* upgrade package-lock

* set react and react-dom as peerDeps

* remove atomic block registration

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2022-03-10 11:00:23 +01:00
Mike Jolley c3bf23fd4e Prefetch cart and checkout block assets when cart has contents (https://github.com/woocommerce/woocommerce-blocks/pull/5553)
* Prefetch block resources when cart has contents

* Fix error when cart is undefined
2022-03-09 12:25:36 +00:00
Mike Jolley 22e206d00a Remove `internal` comments from Store API file comments (https://github.com/woocommerce/woocommerce-blocks/pull/6005)
* Remove internal comments

* Remove line break

* Notices
2022-03-09 10:20:47 +00:00
Tung Du e735ffe5c2 Refactor: Use an alternative mini cart icon to fix the Mini Cart styling issues (https://github.com/woocommerce/woocommerce-blocks/pull/5985) 2022-03-09 16:13:52 +07:00
Luigi Teschio fc01576a38 Additional classes are visible on frontend page woocommerce/woocommerce-blocks#5881 (https://github.com/woocommerce/woocommerce-blocks/pull/5991)
Additional classes are visible on frontend page
2022-03-08 14:24:52 +01:00
Luigi Teschio 299f5e1bfa Hide Mini Cart Block on Cart and Checkout page (https://github.com/woocommerce/woocommerce-blocks/pull/5996)
* Hide Mini Cart Block on cart and checkout page woocommerce/woocommerce-blocks#5931

hide Mini Cart Block on cart and checkout page

* instead to not render nothing, use visibility hidden
2022-03-07 17:29:06 +01:00
Mike Jolley eae1d75c86 Store API: Consistent error code and hook naming (https://github.com/woocommerce/woocommerce-blocks/pull/5992)
* Update error codes with `woocommerce_rest_` prefixes.

* Update action and filter hooks with woocommerce_store_api_ prefix

* Update hook docs

* Update error code mismatches

* Update hook name in tests

* update hook name in tests

* phpcs
2022-03-07 13:51:07 +00:00
Mike Jolley fd03b79995 StoreAPI: Rename namespace to remove `\Blocks` (https://github.com/woocommerce/woocommerce-blocks/pull/5982)
* Composer config

* Update namespace in deprecated.php

* Bulk update namespace

* Revert rename in deprecated class

* bw compat

* Store API: Add dedicated container and make Store API code self-contained (https://github.com/woocommerce/woocommerce-blocks/pull/5986)

* Move ArrayUtils to StoreApi

* Move PaymentContext/PaymentResult

* Move create account functionality to checkout endpoint. Update tests.

* Move get_routes_from_namespace to blocks

* Move RestApi logic within StoreApi namespace/directory

* StoreAPI Container

* Update functions

* Update extend docs

* Run Doc build script

* Missing container calls for 3rd party extensions

* Fix doc toc
2022-03-04 13:28:37 +00:00
colinleroy 6f8a3b14af Avoid crash in InboxNotifications if woocommerce-admin is entirely disabled. (https://github.com/woocommerce/woocommerce-blocks/pull/5954)
* Avoid calling plugin_dir_url a lot

* Fix crash if woocommerce admin is disabled

With Woocommerce's PR
https://github.com/woocommerce/woocommerce/pull/31991 applied, if
woocommerce admin is disabled via the woocommerce_admin_disabled
filter, the InboxNotifications block could crash.

* Fix coding style

* Simplify code path

* Remove unused initialization
2022-03-02 12:28:18 +00:00
Christos Lilitsas c35bf8ee67 Store API: Refactored validation handling and introduced `woocommerce_store_api_cart_errors` hook (https://github.com/woocommerce/woocommerce-blocks/pull/5904)
* Introduce 'wooocommerce_store_api_validate_cart' action

This action can be used by third party developers to add extra 'errors' in cart route responses. This is meant to function as a replacement of the legacy 'woocommerce_check_cart_items' hook.

* Introduce a new 'wooocommerce_blocks_draft_order_updated' action

The new action can be used to modify the finalized draft order object.
Additionally, developers can use it to throw a RouteException in order to prevent access to the checkout block.

The PR also shuffles some existing code that checks the order instance and sets the draft order ID before the 'woocommerce_blocks_checkout_update_order_meta' gets fired.

* Fix PHPCS

* Revert changes to Checkout route

* Add some extra content to the 'woocommerce_blocks_checkout_update_order_meta' docblock on the effect of exceptions thrown from callbacks

* Add __experimental prefix to 'wooocommerce_store_api_validate_cart' action

* Remove long ooo

* Add example

* Refactor cart error getters as wrappers to the validate functions

* Refactor stock_exceptions_to_wp_errors to return a single wp error.

* Add type hint in custom exception

* Fix namespace versioning and some minor improvements

* Move InvalidCartException catcher from AbstractCartRoute to AbstractRoute

* Introduce the __experimental_woocommerce_store_api_cart_errors filter

* Handle all notices and group them into a single WP_Error instance

* Cleanup doc and update example

* Cleanup NoticeHandler

* Fix doc

* Fix WP_Error namespace

* Update NoticeHandler unit tests

* Fix Unit tests typo

* Add docs to tests to bypass precommit scripts

* Refactor wp error grouping with merge_from

* Remove previous cart getters and refactor the get_cart_errors

* Fix CartSchema error getter and minor fixes

* Revert NoticeHandler exception namespace

* Unit test fix for get_cart_errors

* Switch back to do_action

* Update the example doc

* Duplicate use statement

* Update docblock in validate_cart() method for validation hooks

* Update action docs

* Remove __experimental prefix

Co-authored-by: Manos Psychogyiopoulos <psyx@somewherewarm.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-03-02 12:21:31 +00:00
Luigi Teschio 0f52c23eb4 Add font-style and font-weight support for ProductCategory List woocommerce/woocommerce-blocks#5670 (https://github.com/woocommerce/woocommerce-blocks/pull/5928)
Add font-style and font-weight support for ProductCategory List
2022-03-01 15:50:56 +01:00
Michael P. Pfeiffer cabf4e7db6 Update to dev version 2022-03-01 12:15:30 +01:00
github-actions[bot] 537e0a3536 Release: 7.1.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5959)
* Empty commit for release pull request

* Add Changelog to readme.txt

* Update allow-plugins list as release build doesnt work otherwise

* Add testing instructions

* Update testing instructions

* Update version number in README.md

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>

* Add phpcodesniffer to Composer allow-plugins

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Michael P. Pfeiffer <michael@cssconf.eu>
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-03-01 12:10:42 +01:00
Mike Jolley 49b65c7bcf Refactor ExtendRestApi as ExtendSchema and expose `register_endpoint_data` as a public function (https://github.com/woocommerce/woocommerce-blocks/pull/5941)
* Create Extend class under schema namespace

* ExtendRestApi -> ExtendSchema

* ExtendSchema helper functions

* Move tests

* Fix tests

* Fix docs

* Typos

* Remove invalid param

* phpcs formatting

* Update docs/contributors/documentation-guidelines.md

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

* Update docs/extensibility/filtering-payment-methods.md

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

* Update docs/extensibility/README.md

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

* Update docs/extensibility/available-slot-fills.md

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

* Asserttrue comment

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-03-01 10:34:05 +00:00
Luigi Teschio 6fbb97f043 Add margin support on the Product Image block (https://github.com/woocommerce/woocommerce-blocks/pull/5925)
* Add margin support on the Product Image block woocommerce/woocommerce-blocks#5671

Add margin support on the Product Image block

* fix tests

* more specific selector

* update mixin
2022-02-28 18:41:10 +01:00
Tomasz Tunik 475b50573d Global Styles support for Product Price block (https://github.com/woocommerce/woocommerce-blocks/pull/5950)
* Add Global Styles support to product price block

- This comes sat a cost of losing control over regular vs sale price
- This includes refactor of attribute from align to textAlign
   which is a reserved supports feature attribute and textAlign is
   used across the Gutenberg project

* Add experimentalSelector and register as PHP block

This is required to make the GlobalStyles work inside of
the InnerContent block. Ie. All Products block.

* move sharedConfig supports outside of isFeaturePluginBuild check

* restore regularPriceClassName

* remove douplicated block registration on php side
2022-02-28 12:36:55 +01:00
Lucio Giannotta 8ad1dff1f4 Rename templates to more e-commerce friendly names (https://github.com/woocommerce/woocommerce-blocks/pull/5935) 2022-02-28 08:00:01 +01:00
Tom Cafferkey c1bba93a20 Determine if we need to load the mini-cart from the theme (https://github.com/woocommerce/woocommerce-blocks/pull/5946) 2022-02-25 16:49:25 +00:00
Marko Kaznovac 4a32932469 Change `curl` example calls to use `sh` code block (https://github.com/woocommerce/woocommerce-blocks/pull/5944) 2022-02-25 13:21:50 +00:00
Mike Jolley 528137c3b0 Fix spelling of two action hooks in Store API (https://github.com/woocommerce/woocommerce-blocks/pull/5926)
* Deprecate and rename hooks with incorrect spelling

* Update docs
2022-02-24 15:25:40 +00:00
Luigi Teschio 8caaeec998 Add Global Styles support for the Add To Cart Button block woocommerce/woocommerce-blocks#5666 (https://github.com/woocommerce/woocommerce-blocks/pull/5816)
* Add Global Styles support for the Add To Cart Button block woocommerce/woocommerce-blocks#5666

Add Global Styles support for the Add To Cart Button block

* remove support to font size

* try: fix the style override issue for add to cart button (https://github.com/woocommerce/woocommerce-blocks/pull/5843)

* restore typography support

* fix font weight

* add support for font weight

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-02-24 15:35:23 +01:00
colinleroy 7cb936bb10 Avoid calling plugin_dir_url a lot (https://github.com/woocommerce/woocommerce-blocks/pull/5915) 2022-02-23 12:20:32 +00:00
Mike Jolley a58b2d0ac4 Store API: Introduce API Versioning System (https://github.com/woocommerce/woocommerce-blocks/pull/5911)
* Fix missing dependency

* Min version exceeds required 5.6

* Move exceptions

* Move schemas under V1 namespace

* Move routes to v1

* Move RouteException

* Route versioning

* Update route and schema identifiers/init

* Rework route init to support multiple versions and multiple schema

* Tests for cart routes

* Cart coupons tests

* Batch

* extensions

* Update docs

* Update remaining tests

* woocommerce_store_api_route_version was unused

* Revert unrelated change

* Fix phpcs

* Update src/StoreApi/docs/guiding-principles.md

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

* Update src/StoreApi/docs/cart-items.md

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

* Update src/StoreApi/RoutesController.php

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

* Note about v1 unversioned endpoints

* Remove unused get_route_version

* 409 comment in tests

* Remove copy pasted comments

* Update all usage to v1

* Correct namespace

* More v1 namespaces

* More missing v1

* fix mocks

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-02-23 12:00:45 +00:00
Luigi Teschio a02e79ea38 Fix Global Styles for Product Image, Product Category List and Product Tag List Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5852)
* fix Global Styles for Product Image, Product Category List and Product Tag List blocks

fix Global Styles for Product Image, Product Category List and Product Tag List blocks

* Block style font-size was applying wrong value for fontSize

* Add missing __experimentalSkipSerialization to Category List

Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-02-22 18:06:33 +01:00
Tom Cafferkey 94b2d95693 Change tempalte ID when loading the mini cart template part (https://github.com/woocommerce/woocommerce-blocks/pull/5916) 2022-02-22 10:24:50 +00:00
mrleemon fcaf683fdc Fix typo (https://github.com/woocommerce/woocommerce-blocks/pull/5903) 2022-02-21 14:48:58 +00:00
Luigi Teschio 71bd69ad07 Pre-hydrate Mini Cart Block woocommerce/woocommerce-blocks#5882 (https://github.com/woocommerce/woocommerce-blocks/pull/5892)
* Pre-hydrate Mini Cart Block woocommerce/woocommerce-blocks#5882

Pre-hydrate Mini Cart Block

* try to fix test

* fix wrong behaviour
2022-02-18 14:44:10 +01:00
Raluca Stan 888d3d85b2 Update info about /checkout get endpoint data (https://github.com/woocommerce/woocommerce-blocks/pull/5807) 2022-02-17 10:13:41 +01:00
Lucio Giannotta a9fd133c26 Post release version bump (7.1.0-dev) 2022-02-16 12:23:02 +01:00
github-actions[bot] beb0188116 Release: 7.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5842)
* Fix All Products block pagination not showing up (https://github.com/woocommerce/woocommerce-blocks/pull/5850)
* Fix regression for Twenty Twenty-Two theme with sale prices being underlined (https://github.com/woocommerce/woocommerce-blocks/pull/5851)

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-02-16 12:18:36 +01:00
Luigi Teschio 30e10295c1 Rating Product block: Add support for global style (https://github.com/woocommerce/woocommerce-blocks/pull/5521)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* Rating Product block: add support for global style woocommerce/woocommerce-blocks#4965

Rating Product block: add support for global style

* add feature flag

* fix import after merge

* fix global style css generation

* restore css for classic product rating html element

* don't apply the global style to PHP blocks

* remove registration
2022-02-15 15:48:45 +01:00
Luigi Teschio 481f4c8e8e Sale Product Block: Enable global style (https://github.com/woocommerce/woocommerce-blocks/pull/5565)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965

Featured Category block: Add support for global style

* fix border color

* Sale Product block: enable global style woocommerce/woocommerce-blocks#4965

Sale Product block: enable global style woocommerce/woocommerce-blocks#4965

* add comment
2022-02-14 11:32:13 +01:00
Tom Cafferkey d178761252 Fix reverting customisations by refactoring pre_get_block_file_template (https://github.com/woocommerce/woocommerce-blocks/pull/5746)
* Refactor maybe_return_blocks_template to get_woocommerce_block_file_template

* Remove unused method and rename get_woocommerce_block_file_template to get_block_file_template

* Account for product-archive template fallbacks

* Fix bug with clearing customizations of templates using the deprecated plugin ID
2022-02-10 14:15:09 +00:00
Luigi Teschio a594ea5ef5 Fix Mini Cart doesn't update data (https://github.com/woocommerce/woocommerce-blocks/pull/5741)
* Remove api hydration for the Mini Cart Block woocommerce/woocommerce-blocks#5729

Remove api hydration for the Mini Cart Block

* fix PHP error

* send event when the button is clicked

* fix import order
2022-02-10 10:26:09 +01:00
Tomasz Tunik ee6d1b5ae3 Add to cart button ignored redirect to cart setting (https://github.com/woocommerce/woocommerce-blocks/pull/5708)
* Expose products settings in wcSettings

For the time being we expose only what is used by the blocks
which is `cartRedirectAfterAdd`. In the future more can be added
as needed. Setting is accessible via `getSetting( 'productsSettings' )`.

We namespace the settings under productsSettigns to reflect
the domain and how settings are organised in Woo admin and to
inform that this is an object with more settings within.

This setting normally was available **only** if AJAX add to cart was set
as a js global `wc_add_to_cart_params.cart_redirect_after_add`.
By accessing the option directly we ensure it’s exposed
to blocks regardless of if AJAX option is enabled.

* update AddToCartButton to respect cartRedirectAfterAdd

This adds the redirect directly on the AddToCartButton after succesful
add to cart action. This follows convention that redirects or other side
effects shouldn’t happen as part of the action but rather be part of the
control that triggers such flow.
2022-02-09 09:26:25 +01:00
Mike Jolley e85e610b2a Free order handling (https://github.com/woocommerce/woocommerce-blocks/pull/5720) 2022-02-07 11:21:14 +00:00
Tung Du 4dab187dbe Fix: only allow Mini Cart block in Widgets and Site Editor (https://github.com/woocommerce/woocommerce-blocks/pull/5653)
* fix: exclude Mini Cart from the blocks editor

* fix: explicitly register Mini Cart blocks for Site Editor and Widgets

* add check to loading the block on frontend

* add e2e tests for widget area

* improve test title

Co-authored-by: Luigi <gigitux@gmail.com>
2022-02-07 11:29:22 +01:00
Mike Jolley 81bb982c5e Include issue submission link in the footer of all documention (.md files) (https://github.com/woocommerce/woocommerce-blocks/pull/5655)
* Add links to single routes in main index woocommerce/woocommerce-blocks#4473

* Footer

* Feedback template

* Remove footer from existing MD files

* Add doc footer script

* Apply script to all docs

* Fix examples
2022-02-02 14:27:46 +00:00
Alex Florisca 072115ee75 Update version to 7.0.0-dev (https://github.com/woocommerce/woocommerce-blocks/pull/5705) 2022-02-02 11:57:48 +00:00
github-actions[bot] 8ce88ad3c4 Release: 6.9.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5680)
* Empty commit for release pull request

* Empty commit for release pull request

* Update readme.txt

* Update versions

* Update testing notes and changelog

* Empty commit for release pull request

* Empty commit for release pull request

* Update readme.txt

* Update versions

* Update testing notes and changelog

* Empty commit for release pull request

* Empty commit for release pull request

* Update readme.txt

* Update versions

* Update testing notes and changelog

* Empty commit for release pull request

* Empty commit for release pull request

* REadme.txt update

* new zip for testing

* update zip file

* Add `CopyWebpackPlugin` to ensure `block.json` is copied to `build` (https://github.com/woocommerce/woocommerce-blocks/pull/5692)

* Add CopyWebpackPlugin and add block metadata to build

* Check build directory for block.json

* New zip file

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-02-02 11:40:45 +00:00
Luigi Teschio accce8e024 Fix 404 HTTP error for Product Title, Product Summary, and Product Stock indicator blocks woocommerce/woocommerce-blocks#5468 (https://github.com/woocommerce/woocommerce-blocks/pull/5649)
Fix 404 HTTP error for Product Title, Product Summary, and Product Stock indicator blocks
2022-02-02 10:20:17 +01:00
Thomas Roberts 5e32fb0576 Add `CopyWebpackPlugin` to ensure `block.json` is copied to `build` (https://github.com/woocommerce/woocommerce-blocks/pull/5692)
* Add CopyWebpackPlugin and add block metadata to build

* Check build directory for block.json
2022-02-01 16:42:15 +00:00
Luigi Teschio 9d1464baf3 Featured Product: Enable global style (https://github.com/woocommerce/woocommerce-blocks/pull/5555)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965

Featured Category block: Add support for global style

* fix border color

* Featured Product block: enable global style woocommerce/woocommerce-blocks#4965

Featured Product block: enable global style

* fix border color

* fix eslint error

* fix opacity

* fix border radius

* fix opacity

* disable font-size support

* restore height for featured product and featured category
2022-02-01 15:01:31 +01:00
Thomas Roberts a46f13c6c5 Move Checkout block attributes into metadata (`block.json`) (https://github.com/woocommerce/woocommerce-blocks/pull/5594)
* Add block title to AbstractBlock class

* Add block title to Checkout block

* Include all block.json files in tsconfig

* Add get_block_title method to Checkout.php

* Remove redundant block_title field

* Add block.json and remove static attributes from attributes.ts

* Register block using attributes from block.json

* Add metadata_path to AbstractBlock

* Add function to AssetsApi to get the metadata path from the plugin root

* Register the block using metadata if it's set in the block's class

* Remove get_block_title method

* Only add supports and attributes to the block when not registering with metadata

* Change get_block_metadata to get_block_metadata_path

* Change indentation to tabs in block.json

* Update comment to clarify why attributes and supports are set later

* Check if path to metadata is not empty instead of set and not empty

* Move checkout block out of cart-checkout directory

* Update get_block_metadata_path function to find block.json automatically

* Remove metadata path from AbstractBlock

* Check if there's a metadata file and register blocks with metadata if so

* Move deprecated attributes out of metadata and into attributes.ts

* Re-add deprecated attributes to checkout index

* Move order notes test

* Move test for checkout phone number in edito

* Fix indentation in checkout/block.json

* Move checkout terms tests

* Try forcing storefront theme in e2e tests

* Revert "Try forcing storefront theme in e2e tests"

This reverts commit 5b0fd47a2c39aadb0141a4ed28cbc0e6baa89625.

* Try capturing screenshot on test failures

* Try uploading error in try catch

* Try uploading artefacts on error

* Test uploading artefacts

* Screenshot just before looking for edit post layout

* Revert "Screenshot just before looking for edit post layout"

This reverts commit 61dff027789ce13a0d84e7b6f11e431637c5a450.

* Revert "Test uploading artefacts"

This reverts commit adf5cc55bcdb677f889bf5a62803b4150d98e665.

* Revert "Try uploading artefacts on error"

This reverts commit 7441a832a113a95fef89cc1b8db6dc79271be516.

* Revert "Try uploading error in try catch"

This reverts commit ca412ce505d56286b164f588a201a451f6bceeb6.

* Revert "Try capturing screenshot on test failures"

This reverts commit 0de6e97df19b116091a7bb3b8652713867d2d80f.

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-01-28 16:37:06 +00:00
Tung Du d6e6470937 Fix Mini Cart Edit template link (https://github.com/woocommerce/woocommerce-blocks/pull/5615) 2022-01-27 20:47:35 +07:00
Tung Du 7e67bf62ca Fix: Mini Cart global style is not applied (https://github.com/woocommerce/woocommerce-blocks/pull/5618) 2022-01-27 08:38:49 +07:00
Luigi Teschio 2370ce4378 Featured Category block: add support for global style (https://github.com/woocommerce/woocommerce-blocks/pull/5542)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965

Featured Category block: Add support for global style

* fix border color

* fix opacity

* fix border radius

* fix order rules css
2022-01-26 18:16:50 +01:00
Luigi Teschio e52549208e Enable Mini Cart template-parts only for experimental builds woocommerce/woocommerce-blocks#5598 (https://github.com/woocommerce/woocommerce-blocks/pull/5606)
Enable Mini Cart template-parts only for experimental builds
2022-01-24 09:41:34 +01:00
Tung Du 718f2dbc6f Mini Cart Contents: Support link and text colors (https://github.com/woocommerce/woocommerce-blocks/pull/5566) 2022-01-22 00:39:04 +07:00
Luigi fc9e623079 update version plugin 2022-01-20 14:39:19 +01:00
github-actions[bot] 79f4d10310 Release: 6.8.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5570)
* Empty commit for release pull request

* Update readme.txt with 6.8.0 changelog

* initialize_session if it does not yet exist before calling the session class (https://github.com/woocommerce/woocommerce-blocks/pull/5577)

* Add testing notes for 6.8.0

* update testing release notes

* update testing notes

* Fix default `stockStatusOptions` in tag and attribute blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5590)

* Fix default stockStatusOptions in tag and attribute blocks

These should be an array of keys, not objects.

* Fix stockStatus definition on PHP side

* Swap state to debounce.

* Improve presentation of stock filters

* Remove state usage for display options

* Remove debounce

* Consistent panel titles

* Fix global style for Product Summary block, Product Stock Indicator block, and Product Title block (https://github.com/woocommerce/woocommerce-blocks/pull/5595)

* Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block

Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block

* add feature flag

* fix lint errors

* fix global style bugs on Product Title block

* update testing release notes

* update new build with fixes

* Restore correct font style when the block is loaded in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/5600)

* Restore correct font style when the block is loaded in the editor

Restore correct font style when the block is loaded in the editor

* fix style on Twenty Twenty theme

* update link for download the zip of the new release

* update readme.txt

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-01-20 14:35:47 +01:00
Luigi Teschio 5f37425c90 Fix global style for Product Summary block, Product Stock Indicator block, and Product Title block (https://github.com/woocommerce/woocommerce-blocks/pull/5595)
* Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block

Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block

* add feature flag

* fix lint errors

* fix global style bugs on Product Title block
2022-01-19 15:02:30 +01:00
Mike Jolley c492a97d83 Fix default `stockStatusOptions` in tag and attribute blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5590)
* Fix default stockStatusOptions in tag and attribute blocks

These should be an array of keys, not objects.

* Fix stockStatus definition on PHP side

* Swap state to debounce.

* Improve presentation of stock filters

* Remove state usage for display options

* Remove debounce

* Consistent panel titles
2022-01-19 11:42:21 +00:00
Mike Jolley 0040f2fd0c initialize_session if it does not yet exist before calling the session class (https://github.com/woocommerce/woocommerce-blocks/pull/5577) 2022-01-17 15:20:15 +00:00
Mike Jolley 37bf7a8067 When processing payments, use the woocommerce_hold_stock_minutes option (https://github.com/woocommerce/woocommerce-blocks/pull/5546) 2022-01-17 10:42:27 +01:00
Tung Du 61afd2b6ce Fix: fatal error when page contains edited template or template part (https://github.com/woocommerce/woocommerce-blocks/pull/5558) 2022-01-13 17:52:42 +07:00
Mike Jolley d47c82ed61 remove prepare statement (https://github.com/woocommerce/woocommerce-blocks/pull/5471) 2022-01-11 15:36:43 +00:00
Mike Jolley a1695861f2 Add minimum quantity, maximum quantity, and step (multiple_of) to the Cart Block and Store API (https://github.com/woocommerce/woocommerce-blocks/pull/5406)
* add min and step to Store API

* add min and step support

* typo

* Update assets/js/base/components/quantity-selector/index.tsx

* Update assets/js/base/components/quantity-selector/index.tsx

* Fix debounce callback

* Style qty input to show steps

* Implement quantity_limits in API

* Quantity validation

* Update product API

* Normalize on + -

* Separate add to cart events from cart item events in regards to limits

* Prevent qty change for editable line items

* Unify filters

* Remove step number indicator from buttons ¯\_(ツ)_/¯

* Normalize on mount

* Update docs

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-01-11 11:09:59 +00:00
Mike Jolley e19abbc0c2 Remove Built-in Stripe Integration in favour of Stripe Extension (https://github.com/woocommerce/woocommerce-blocks/pull/5449)
* Remove Stripe from PHP side

* Remove stripe from client

* fix const name in tests

* Update docs
2022-01-11 10:53:38 +00:00
jonny-bull 87cb033cbd Add stock level filter to product blocks (https://github.com/woocommerce/woocommerce-blocks/pull/4943) 2022-01-10 13:39:24 +00:00
Raluca Stan a574e12863 Add back 6.8.0-dev version after 6.7.1 patch 2022-01-07 18:13:49 +01:00
Raluca Stan 9759ccbf0a Merge branch 'release/6.7.0' with 6.7.1 details into trunk 2022-01-07 18:11:25 +01:00
github-actions[bot] b60afb534b Release: 6.7.1 (https://github.com/woocommerce/woocommerce-blocks/pull/5536)
* Force a string token property for the activePaymentMethod

* Empty commit for release pull request

* Update readme.txt with 6.7.1 info

* Add testing notes for 6.7.1

* Bumping version strings to new version.

Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>
2022-01-07 18:00:35 +01:00
Tom Cafferkey 8bee57378b Query legacy and correct plugin slug for WooCommerce block templates (https://github.com/woocommerce/woocommerce-blocks/pull/5519) 2022-01-07 10:17:08 +00:00
Luigi Teschio c54440d0e1 Add wide and full alignment support for legacy template block (https://github.com/woocommerce/woocommerce-blocks/pull/5433)
* add align wide and full support for legacy template block

* fix PHP warning

* add a comment on get_markup_with_classes_by_attributes

* rename function

* add align wide and full support for legacy template block

* fix PHP warning

* add a comment on get_markup_with_classes_by_attributes

* rename function

* fix regex

* update regex

* update regex

* fix code styling
2022-01-07 10:47:48 +01:00
Lucio Giannotta 168984edc2 Move Woo Blocks template directories to latest Gutenberg convention (https://github.com/woocommerce/woocommerce-blocks/pull/5464)
* Align Woo Block template locations with the newest convention

While we now support both the old and new conventions for the templates
paths, our own repo should be aligned with the latest convention.

See: woocommerce/woocommerce-blocks#5455
Fixes: woocommerce/woocommerce-blocks#5343

* Simplify `generate_template_slug_from_path` function
* Change `BlockTemplatesController` constructor to get correct dir names
* Update Mini Cart template path
2022-01-05 19:28:51 +01:00
Luigi Teschio 64696e06df Mini Cart Contents: Fix missing custom background (https://github.com/woocommerce/woocommerce-blocks/pull/5448)
* fix missing custom background mini cart contents

* fix naming
2022-01-05 13:53:12 +01:00
Mike Jolley 7f2af8c1a6 Validate available payment methods before attempting payment or updating order statuses (https://github.com/woocommerce/woocommerce-blocks/pull/5440)
* Make payment method required

* removed unused imports

* Remove PUT method

* Validate available method when updating order

* Enable bacs for tests
2022-01-04 18:04:08 +00:00
Mike Jolley 7cb46eb092 Prevent duplicate hooks in hook docs (https://github.com/woocommerce/woocommerce-blocks/pull/5472)
* Update wp-hooks-generator

* Update inline hook documentation into consistent format

1. Hook docs for the same hook should be identical
2. Prefix with `Hook: ` so the case of the hook is not changed.
3. Use `@see` instead of `@hooked`. Hooked is not a standard PHP Doc tag.

cc @Aljullu

* Update hook doc script to support duplicate hooks across files

* Remove unused variables in function

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2022-01-04 14:12:08 +00:00
Raluca Stan 3fd22f385d Update 6.8.0-dev tag 2022-01-04 12:33:01 +01:00
github-actions[bot] afcd224e73 Release: 6.7.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5478)
* Empty commit for release pull request

* Update readme.txt with 6.7.0 changelog

* Add testing notes for the 6.7.0 release

* Fix typo in testing notes

* Update Testing Notes

* Remove item from testing notes for 6.7.0

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2022-01-04 12:23:10 +01:00
Raluca Stan a07146f501 Bumping version strings to new version. 2022-01-04 11:47:59 +01:00
Luigi Teschio 723eabee80 Add global style for Active Filters block (https://github.com/woocommerce/woocommerce-blocks/pull/5465)
* Enable global style for active filters block

* show blacklisted blocks in full site editing side

* fix test

* --amend

* fix check
2022-01-03 10:41:19 +01:00
Raluca Stan 6eb3f9e17a Account for products without variations in the On Sale Products block (https://github.com/woocommerce/woocommerce-blocks/pull/5470)
* Account for products without variations in the prime_product_variations function

* Update src/BlockTypes/AbstractProductGrid.php

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

* Fix whitespace

* Remove unnecessary variable declaration

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-12-30 14:53:56 +01:00
Niels Lange 17a0325b72 Correct name of lazy loaded translation file (https://github.com/woocommerce/woocommerce-blocks/pull/5453) 2021-12-30 12:23:02 +00:00
Lucio Giannotta 0367117d15 Move block templates and parts directories to the Gutenberg 12.1.0 convention (https://github.com/woocommerce/woocommerce-blocks/pull/5455)
Gutenberg 12.1.0 has changed the convention for the directory paths from
`block-templates` and `block-template-parts` to `templates` and `parts` respectively.

Allow compatibility with themes which follow both conventions and also make sure that
we remain backwards-compatible.

Fixes woocommerce/woocommerce-blocks#5450

Some of this fix has a dependency on WooCore

See: WooCommerce/woocommercewoocommerce/woocommerce-blocks#31522
2021-12-28 23:32:15 +01:00
Lucio Giannotta 4d616d7a76 Fix custom templates with fallback being incorrectly attributed (https://github.com/woocommerce/woocommerce-blocks/pull/5447)
* Fix custom templates with fallback being incorrectly attributed

Category and tags templates can fallback to the generic archive if, e.g., the theme
provides one for the latter but not for the former. However, since Gutenberg is not
aware of this fallback mechanism, it would incorrectly attribute the custom template
to the user instead of the theme.

Here we are explicitly setting the `has_theme_file` to make sure Gutenberg knows
we do, in fact, have a theme fail (if not what it expects).

Also skip the loop if template is duplicate but has no fallback

Fixes woocommerce/woocommerce-blocks#5441
2021-12-24 16:15:19 +01:00
Lucio Giannotta ba9c602006 Remove “Page” suffix from template titles (https://github.com/woocommerce/woocommerce-blocks/pull/5434) 2021-12-23 17:20:52 +01:00
Mike Jolley c1ca93aa0a 6.7.0-dev 2021-12-21 13:59:01 +00:00
github-actions[bot] 5d807a52e1 Release: 6.6.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5422)
* Empty commit for release pull request

* Add changelog and version info

* 6.6.0 testing notes

* Remove mini cart from testing instructions

* Clarify testing instructions

* Remove experimental feature from changelog

* fix not found template for the template editor

* update zip

* Remove test instructions for icon

* Testing steps for 5425

* Link order controller to cart routes

* Remove order controller from checkout route

* Fix PHP warnings in abstract schema

* Fix PHP warnings in abstract route

* Update shipping phone handling

* Includes are handled in core now

* Remove maybe_update_order_from_customer

* Add cart_updated routine to all cart routes

* Remove abstract method

* Remove test for woocommerce_blocks_cart_update_order_from_customer_request

* Remove do_order_callback

* Update readme

* Update tests

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2021-12-21 13:57:01 +00:00
Mike Jolley ecc80e5cff Sync order data with cart data when cart is updated from any route (https://github.com/woocommerce/woocommerce-blocks/pull/5379)
* Link order controller to cart routes

* Remove order controller from checkout route

* Fix PHP warnings in abstract schema

* Fix PHP warnings in abstract route

* Update shipping phone handling

* Includes are handled in core now

* Remove maybe_update_order_from_customer

* Add cart_updated routine to all cart routes

* Remove abstract method

* Remove test for woocommerce_blocks_cart_update_order_from_customer_request

* Remove do_order_callback
2021-12-21 13:11:51 +00:00
Luigi Teschio 14a45a4380 fix not found template for the template editor (https://github.com/woocommerce/woocommerce-blocks/pull/5425) 2021-12-21 11:55:51 +01:00
Tom Cafferkey 13d151fe2a Check for woocommerce as the theme before rendering with a more user friendly plugin name (https://github.com/woocommerce/woocommerce-blocks/pull/5420) 2021-12-20 14:36:26 +00:00
Tom Cafferkey d8dac8bb0a Check if the current theme has a product-archive block template in the absence of a product taxonomy block template. (https://github.com/woocommerce/woocommerce-blocks/pull/5380)
* Add archive-product template into block template hieachy

* Add archive-product condition to product tag block template render method

* Move taxonomy hierarchy filter to WC core

* Undo template amends

* Duplicate the themes archive-product template if it has one for taxonomy block templates

* Review feedback

* Use TextDomain instead of Name

* use correct if/else syntax

* Remove unncessary boolean syntax
2021-12-20 12:53:57 +00:00
Albert Juhé Lluveras 976b158e6f Make it so WooCommerce template names are not editable (https://github.com/woocommerce/woocommerce-blocks/pull/5385)
* Make it so WooCommerce template names is not editable

* Remove source='plugin' from templates
2021-12-20 10:46:41 +00:00
Albert Juhé Lluveras ab061782f2 Fix saving WooCommerce templates in WP 5.9 beta 3 (https://github.com/woocommerce/woocommerce-blocks/pull/5408) 2021-12-20 10:58:11 +01:00
Tung Du 50066455c0 Fix: Mini Cart block: divide contents into three inner blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5386)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-12-20 14:57:55 +07:00
Luigi Teschio 4524799b5e Revert theme name woocommerce/woocommerce-blocks#5411 (https://github.com/woocommerce/woocommerce-blocks/pull/5412)
Revert theme name woocommerce/woocommerce-blocks#5411
2021-12-17 16:58:56 +01:00
Mike Jolley 7d8c184603 Remove the unused get_skeleton_inline_script method (https://github.com/woocommerce/woocommerce-blocks/pull/5361) 2021-12-16 17:32:35 +00:00
Albert Juhé Lluveras 8030e278db Set the origin of custom templates to 'plugin' and fix plugin name on REST requests (https://github.com/woocommerce/woocommerce-blocks/pull/5375)
* Set the origin of custom WC templates to 'plugin'

* Fix plugin name
2021-12-15 11:56:41 +01:00
Tung Du b0623a8b52 Mini Cart: only display the editing link to users with site editing permission (https://github.com/woocommerce/woocommerce-blocks/pull/5372) 2021-12-14 07:54:23 +07:00
Mike Jolley 59c8c88438 Introduce 2 new hooks in Customer Update Route (https://github.com/woocommerce/woocommerce-blocks/pull/5345)
* Introduce woocommerce_blocks_cart_update_customer_from_request hook

* Introduce woocommerce_blocks_cart_update_order_from_customer_request

* Test actions fire

* Update hook docs
2021-12-13 13:57:45 +00:00
Luigi Teschio 13deb1b09e Mini Cart Block: render the empty state set on template parts (https://github.com/woocommerce/woocommerce-blocks/pull/5338)
* add view switcher for mini cart contents block

* editor view switcher

* update mini cart template file

* render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674

render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674

* update selector

* allow empty mini cart block to add all blocks

* fix tests; improve code style

* install @wordpress/block-editor package

* fix warning on frontend side

* block-editor package is not necessary

* merge attributes object

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2021-12-10 12:11:59 +01:00
Tom Cafferkey 34ba6ab937 Load required scripts in LegacyTemplate.php render method (https://github.com/woocommerce/woocommerce-blocks/pull/5346) 2021-12-10 10:51:35 +00:00
Mike Jolley b0f9e524a3 Move Draft Order Handling to Shared Trait (DraftOrderTrait) (https://github.com/woocommerce/woocommerce-blocks/pull/5323)
* Introduce shared trait for draft order handling (DraftOrderTrait)

* Use trait where needed for maybe_release_stock

* Introduce woocommerce_blocks_cart_update_customer_from_request

This hook gets the request data and customer object, and from there, 3rd parties could grab a draft order and manually update it if needed (if the use cases requires this).

* Revert "Introduce woocommerce_blocks_cart_update_customer_from_request"

This reverts commit 6620818eb1e03b87c6eca0d757ec8b78802e3c57.
2021-12-10 10:49:04 +00:00
Albert Juhé Lluveras 29fa0a61e6 Fix Mini Cart template part link on WP 5.9 (https://github.com/woocommerce/woocommerce-blocks/pull/5348)
* Fix link to edit the Mini Cart template part in WP 5.9

* Use wp_is_block_theme() function

* Add protection against overwriting isSiteEditorAvailable setting

* Rename isSiteEditorAvailable to isBlockTheme
2021-12-10 11:23:16 +01:00
Tung Du b3ba90e7e9 Fix: Mini Cart block: Edit template part link doesn't work for themes don't have mini cart template part. (https://github.com/woocommerce/woocommerce-blocks/pull/5347) 2021-12-09 20:58:03 +07:00
Albert Juhé Lluveras 6cbff66977 Fix reverting WC templates (https://github.com/woocommerce/woocommerce-blocks/pull/5342) 2021-12-09 10:35:32 +01:00
Mike Jolley f1b85c6bcb Removes legacy shipping_phone handling (https://github.com/woocommerce/woocommerce-blocks/pull/5326) 2021-12-08 15:05:00 +00:00
Tom Cafferkey 30abe6f3bc Update block theme conditionals in BlockTemplateController (https://github.com/woocommerce/woocommerce-blocks/pull/5335) 2021-12-08 11:21:57 +00:00
Mike Jolley de068d2fc3 Rest API - Namespace error handling (https://github.com/woocommerce/woocommerce-blocks/pull/5319)
* get_routes_from_namespace needs to handle WP_Error responses

* is_request_to_store_api is not static
2021-12-07 15:03:58 +00:00
Mike Jolley 587e3b98d4 Add missing Exception use statement in RoutesController (https://github.com/woocommerce/woocommerce-blocks/pull/5330) 2021-12-07 13:13:48 +00:00
Tom Cafferkey 44aaf67caa Updated version numbers for the next release 2021-12-07 11:51:42 +00:00
github-actions[bot] 212085bbd8 Release: 6.5.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5321)
* Empty commit for release pull request

* Update readme.txt and add 6.5.0 testing notes

* Update build link

* Update CSV link

* Testing instruction titles.

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
2021-12-07 11:47:28 +00:00
Tung Du 66a3ac1d33 Refactor: use StyleAttributesUtils to generate classes and styles (https://github.com/woocommerce/woocommerce-blocks/pull/5307) 2021-12-07 12:21:40 +07:00
Tung Du e3620307df Fix: Mini Cart: don't allow users to create extra template parts in the Mini Cart template part area (https://github.com/woocommerce/woocommerce-blocks/pull/5306) 2021-12-07 12:20:37 +07:00
Luigi Teschio 4a134c7fb5 Set WooCommerce like source of WC templates woocommerce/woocommerce-blocks#5271 (https://github.com/woocommerce/woocommerce-blocks/pull/5320)
Set WooCommerce like source of WC templates woocommerce/woocommerce-blocks#5271
2021-12-06 15:41:00 +01:00
Luigi Teschio 2358c0c90b Mini Cart block: Add label for tax when it should be visible in accordance with WC settings (https://github.com/woocommerce/woocommerce-blocks/pull/5184)
* Mini Cart block: Add label for tax when it should be visible in accordance with WC settings woocommerce/woocommerce-blocks#4849

Mini Cart block: Add label for tax when it should be visible in accordance with WC settings

* improve the tax label handling

* fix code after conflict

* fix tax label handling when it is added the first product

* add another check for avoid PHP error

* rename variables; add test for the function getSettingWithCoercion

* add margin-right for tax-label; add test to check if type guard works correctly
2021-12-03 10:45:06 +01:00
Tom Cafferkey d3f4223510 Refactor BlockTemplateController (https://github.com/woocommerce/woocommerce-blocks/pull/5200)
* Move template slug creation to utility method

* Move theme_has_template to BlockTemplateUtils method
2021-12-02 10:35:39 +00:00
Néstor Soriano 79722aec00 Fix code that causes PHP 8.1 deprecation in BlockTypesController (https://github.com/woocommerce/woocommerce-blocks/pull/5287) 2021-12-01 12:58:56 +00:00
Luigi Teschio dfef363e15 Add global style for Product Categories List block (https://github.com/woocommerce/woocommerce-blocks/pull/5133)
* Add global style for product categories list block woocommerce/woocommerce-blocks#4965

Add global style for product categories list block

* add support for link color

* add feature flag

* fix code style and PHP warning

* update doc comment

* remove empty space

* refactor StyleAttributesUtils (https://github.com/woocommerce/woocommerce-blocks/pull/5277)

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2021-11-30 16:28:45 +01:00
Luigi Teschio 67ad9e4f27 Mini Cart Block: add link to edit template part from sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/5201)
* Mini Cart Block: add link to edit template part from sidebar woocommerce/woocommerce-blocks#5186

Mini Cart Block: add link to edit template part from sidebar

* fix e2e tests
2021-11-30 10:42:07 +01:00
Albert Juhé Lluveras 98d9dbdcf0 Don't run enqueue_assets on REST requests (https://github.com/woocommerce/woocommerce-blocks/pull/5260) 2021-11-29 10:45:53 +01:00
Tom Cafferkey cbdbc6c7a1 Change source value on WooCommerce block templates to be plugin instead of woocommerce (https://github.com/woocommerce/woocommerce-blocks/pull/5215) 2021-11-26 12:40:41 +00:00
Tung Du 0875884304 Fix: When creating a template part for the Mini Cart area, it should be created already containing the Mini Cart Contents block (https://github.com/woocommerce/woocommerce-blocks/pull/5231)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-11-25 00:33:57 +07:00
Tung Du cdddf48184 Add: Mini Cart template part area (https://github.com/woocommerce/woocommerce-blocks/pull/5221) 2021-11-24 17:36:39 +07:00
Albert Juhé Lluveras 2778e62812 Fix Mini Cart block when Gutenberg is not enabled (https://github.com/woocommerce/woocommerce-blocks/pull/5220)
* Fix Mini Cart block when Gutenberg is not enabled

* Escape Mini Cart template part

* Avoid creating $part variable

Co-authored-by: Tung Du <dinhtungdu@gmail.com>

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2021-11-24 11:08:59 +01:00
Albert Juhé Lluveras ddc8fcccd1 Bump version to 6.5.0-dev 2021-11-23 09:03:08 +01:00
github-actions[bot] e7bb6fef28 Release: 6.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5211)
* Empty commit for release pull request

* Add 6.4.0 changelog

* Update supported WC versions

* Add 6.4.0 testing steps

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-11-23 09:00:23 +01:00
Tung Du 1225b2680b Mini Cart block: allow left, right and center alignment (https://github.com/woocommerce/woocommerce-blocks/pull/5171) 2021-11-23 06:40:24 +07:00
Tom Cafferkey 91008a6492 Gate block templates feature for WC 6.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5210) 2021-11-22 11:25:53 +00:00
Niels Lange 62e88757ed Lazy load missing translation files (https://github.com/woocommerce/woocommerce-blocks/pull/5112)
* Lazo load missing translation files

* Lazy load cart translation files
2021-11-22 16:43:13 +07:00
Albert Juhé Lluveras bbaa4d8798 Mini Cart as template part (https://github.com/woocommerce/woocommerce-blocks/pull/5025)
* Fix wrong event prefix in doc comment

* Make className prop in CartLineItemsTableProps optional

* Mini Cart as template part

* Remove BlockTemplatePartsController and instead use BlockTemplatesController

* Remove old code

* Clean up frontend rendering

* Update tests

* Improve if clause

* Fix wrong tests title

* Fix wrong variable name

* Make sure Mini Cart contents block is unmounted whem mini cart closes or unmounts

* Remove unnecessary waitFor

* Fix PaymentMethodDataProvider wrong children type

* TypeScript fixes

* Make comment shorter

* Remove test code

* Fix contant unmounts of Mini Cart contents block

* Fix wrong template_type passed

* Set Template part area to 'uncategorized'

* Set Template part area to the correct value

* Move template dir check outside loop
2021-11-19 12:47:48 +01:00
Seghir Nadir 65233c4e86 Move Checkout i1 -> i2 migration code to registerBlockType (https://github.com/woocommerce/woocommerce-blocks/pull/5140)
* move migration code to registerBlockType

* fix name and account for default value

* check for isset
2021-11-19 11:49:33 +01:00
Mike Jolley 947927eded Add version to doing it wrong calls (https://github.com/woocommerce/woocommerce-blocks/pull/5134) 2021-11-19 10:27:14 +01:00
Tom Cafferkey 51b61552cf Check that functions gutenberg_supports_block_templates and gutenberg_get_block_template exist before usages (https://github.com/woocommerce/woocommerce-blocks/pull/5183) 2021-11-19 08:33:53 +00:00
Tung Du 2b7d906133 Add global style support to Mini Cart (button) (https://github.com/woocommerce/woocommerce-blocks/pull/5100) 2021-11-17 22:39:07 +07:00
Niels Lange af8f5e857c Bump version numbers to 6.4.0-dev 2021-11-17 21:55:48 +07:00
Tom Cafferkey 3adfdd4d3b Hide WooCommmerce block templates from Edit Post template dropdown (https://github.com/woocommerce/woocommerce-blocks/pull/5167)
* Hide WooCommmerce block templates from Edit Post template dropdown

* Add empty post_types value to template and update comments.
2021-11-17 14:40:15 +00:00
github-actions[bot] e891cab38b Release: 6.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5146)
* Empty commit for release pull request

* Update readme.txt with release changelog

* Add testing instructions for 6.3.0 release

* Update testing instructions as MD tables didn't work

* Update testing instructions

* Update testing instructions

* Update testing instructions

* Update readme.txt

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

* Update docs/testing/releases/630.md

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

* Update readme.txt

* Update release zip in testing note

* Update testing instructions

* Remove feature gate condition for Legacy Template block (https://github.com/woocommerce/woocommerce-blocks/pull/5158)

* Update testing instructions

* Update testing instructions

* Update testing instructions

* Update readme.txt

* Update testing instructions

* Update testing instructions

* Update release zip in testing note

* Update testing instructions for SE templates

* Update testing instructions for SE templates II

* Update testing instructions

* Bumping version strings to new version.

* Release: 6.3.1 (https://github.com/woocommerce/woocommerce-blocks/pull/5169)

* Empty commit for release pull request

* Fix state validation to compare state codes, and only validate if a country is given (https://github.com/woocommerce/woocommerce-blocks/pull/5132)

* Only get valid states from wc if there is a country

* Shared validation logic which uses keys

* Fix 'Country is required' error on the Cart block when updating shipping address (https://github.com/woocommerce/woocommerce-blocks/pull/5129)

* Fix  error on the Cart block

* Created a cartIsHydrated variable in useStoreCart hook and used this to update the billing address in the internal state of the useCustomerData hook

* Fix the country is required error on the Cart page using refs

* Separate api calls to update shipping and billingUpdate billing and shipping addresses only when needed in API calls

* Remove redundant check for customerDataToUpdate

* remove use of refs in initial values

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>

* Make order note block removable (https://github.com/woocommerce/woocommerce-blocks/pull/5139)

* unforce order note

* show block in inserter

* Mini Cart block fatal error caused by append_script_and_deps_src (https://github.com/woocommerce/woocommerce-blocks/pull/5142)

* Remove unused use statements

* Fix types for $script

* `get_script_from_handle` might return null so handle this case to prevent errors

* Missing escaping

* Replace do_action_deprecated with the WC equivalent (https://github.com/woocommerce/woocommerce-blocks/pull/5151)

* Remove feature gate condition for Legacy Template block (https://github.com/woocommerce/woocommerce-blocks/pull/5158)

* Update readme.txt

* Update testing instructions

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Alex Florisca <alexflorisca@gmail.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Niels Lange <info@nielslange.de>

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Michael P. Pfeiffer <michael@cssconf.eu>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Alex Florisca <alexflorisca@gmail.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2021-11-17 21:39:02 +07:00
Thomas Roberts 480acdaaac Replace do_action_deprecated with the WC equivalent (https://github.com/woocommerce/woocommerce-blocks/pull/5151) 2021-11-16 20:22:29 +07:00
Mike Jolley 857802aaf3 Mini Cart block fatal error caused by append_script_and_deps_src (https://github.com/woocommerce/woocommerce-blocks/pull/5142)
* Remove unused use statements

* Fix types for $script

* `get_script_from_handle` might return null so handle this case to prevent errors

* Missing escaping
2021-11-16 20:14:00 +07:00
Mike Jolley f9c458b090 Fix state validation to compare state codes, and only validate if a country is given (https://github.com/woocommerce/woocommerce-blocks/pull/5132)
* Only get valid states from wc if there is a country

* Shared validation logic which uses keys
2021-11-16 12:19:56 +01:00
Tom Cafferkey ac317c70eb Remove conditionals around BlockTemplatesController class (https://github.com/woocommerce/woocommerce-blocks/pull/5128) 2021-11-11 14:48:24 +01:00
Tung Du 3d5971ad93 Fix: loading WC Blocks templates content (https://github.com/woocommerce/woocommerce-blocks/pull/5111) 2021-11-11 15:50:29 +07:00
Luigi Teschio b6b275bc26 Add hydration for product data for Single Product block (https://github.com/woocommerce/woocommerce-blocks/pull/5107)
* Add hydration for product data for single product block woocommerce/woocommerce-blocks#2698

Add hydration for product data for single product block

* cast product_id variable

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

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-11-09 13:58:15 +01:00
Albert Juhé Lluveras 3137d60b24 Fix PHP fatal error on Product tag pages (https://github.com/woocommerce/woocommerce-blocks/pull/5104) 2021-11-09 12:03:41 +01:00
Tom Cafferkey 8662368f32 Remove woocommerce_sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/5097) 2021-11-08 16:33:04 +00:00
Thomas Roberts 5f0ab9e94c Allow block templates to be customised and saved (https://github.com/woocommerce/woocommerce-blocks/pull/5062)
* Ensure $template is object before accessing properties

This is necessary because the gutenberg helper functions sometimes turn it into a WP_Block_Template object, and other times it's an array. Because of this it's safer to normalise them both as objects.

* Add Gutenberg utils for processing templates based on a post from the db

When a template is saved it gets saved to the database, we need to handle processing these WooCommerce templates that have been saved in the db and we need to use the gutenberg utils that are private, this is why they've been copied over.

* Force theme to always be WooCommerce

This is because the templates we're dealing with here should always belong to WooCommerce, not the currently selected theme

* Add maybe_return_blocks_template and get_single_block_template funcs

These are needed to get the template from either the DB or the filesystem when saving/retrieving the template.

* Set theme to always be woocommerce when making templates from files

This will ensure the correct slug is used in the gutenberg editor.

* Check if template has been customised and saved in the database first

* Prevent filesystem templates being used if a custom database one exists

* Fix syntax error from rebase

* Remove unnecessary code from BlockTemplateUtils

* Ensure template item is an object containing correct properties

* Prevent warnings from appearing

* Ensure title is added to the template when saving

* Filter templates that don't match the queried slug.

* Remove unused code

* Check if a saved version of the template exists when trying to render

* Rename default_block_template_is_available to block_template_is_available

* Re-hook pre_get_block_template before returning from maybe_return_blocks_template

* Make comment easier to read

* Look for template in woocommerce theme or real theme taxonomy

* Remove duplicated title assignment

* Prevent template being added twice when loading from the db

* Filter templates before returning if slugs are supplied

* Simplify `get_block_templates` function into two functions

* Add function to stop theme templates that are added after db ones showing

* Fix typographical errors
2021-11-05 19:07:34 +00:00
Seghir Nadir ea1e17fc81 Fix sanitization callback (https://github.com/woocommerce/woocommerce-blocks/pull/5060)
* Fix sanitization callback

* Add test case to confirm sanitization callbacks work for nested properties

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-11-05 15:39:08 +00:00
Seghir Nadir 29e3d4ec58 Fix wc-settings not loading when a script that depend on it is in the header (https://github.com/woocommerce/woocommerce-blocks/pull/5059)
* Enqueue in header if required.

* revert scripts change

* Dirty fix for settings dependency

* Also implement in admin

* add console warn

* grammar issues

* increase priority

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-11-05 14:44:57 +01:00
Mike Jolley 53be583cec Fix Duplicate Queries in Product Grids woocommerce/woocommerce-blocks#4695 (https://github.com/woocommerce/woocommerce-blocks/pull/5002)
* Cache variation_meta_data to prevent duplicate queries with multiple grids

* Prime the cache

* Improve existing cache detection

* Expand comment
2021-11-04 11:39:16 +00:00
Mike Jolley 72cf5eade8 Remove hydration hocs in favour of apiFetch Middlewares (https://github.com/woocommerce/woocommerce-blocks/pull/5022)
* Remove withRestApiHydration

* Preload checkout data via setting - server data is required for this block

* Handle cart hydration using createPreloadingMiddleware which removes the need for HOCs

* Rename variable

* Remove withStoreCartApiHydration and timestamp checking

* Empty test file
2021-11-04 11:05:58 +00:00
Michael P. Pfeiffer fa58d34da4 Store Editing Templates v1: add basic taxonomy block templates (https://github.com/woocommerce/woocommerce-blocks/pull/5063)
* Add taxonomy block templates

* Change Category template display name

* Check for product category/tag taxonomy explicitely

* Group archive templates in LegacyTemplate
2021-11-03 17:55:52 +01:00
Tom Cafferkey 2267e21351 Set is_custom property on template and remove redundant code (https://github.com/woocommerce/woocommerce-blocks/pull/5067) 2021-11-03 15:13:39 +00:00
Tom Cafferkey 927af6ea26 Add Single Product Block Template (https://github.com/woocommerce/woocommerce-blocks/pull/5054)
* Add single-product.html template to render core PHP template

* Update placeholder SVG
2021-11-03 09:31:47 +00:00
Michael P. Pfeiffer 5cc32dbfae Store Editing Templates v1: add a basic Product Archive block template (https://github.com/woocommerce/woocommerce-blocks/pull/5049)
* Add the Archive Product block template

* Use template slug if no template title is set

* Add page icon as per design

* Add the basic archive product block template
2021-11-02 15:42:07 +01:00
Tom Cafferkey 17b4363daf Fix Block Templates being rendered correctly (https://github.com/woocommerce/woocommerce-blocks/pull/5048)
* Copy logic from Gutenberg to ensure the correct templates are being included in the get_block_templates query

* Utility function to convert template slugs to template titles

* i18n strings for template names
2021-11-02 12:15:41 +00:00
Thomas Roberts abfa36634c Graduate `__experimental_woocommerce_blocks_checkout_update_order_meta` action to stable (https://github.com/woocommerce/woocommerce-blocks/pull/5017)
* Deprecate __experimental_woocommerce_blocks_checkout_update_order_meta

* Update docs to show new action and remove deprecated one

* Amend deprecated tag and add version numbers

* Resolve conflict where old hook name was included in example docs
2021-11-02 10:15:12 +00:00
Thomas Roberts b0795c8502 Graduate `__experimental_woocommerce_blocks_checkout_update_order_from_request` action to stable (https://github.com/woocommerce/woocommerce-blocks/pull/5015)
* Deprecate __experimental_woocommerce_blocks_checkout_update_order_from_request

* Update docs to show new action and remove deprecated one

* Ensure correct args are passed to deprecated hook and update message

* Amend deprecated tag and add version numbers

* Remove incorrectly updated file from this PR
2021-11-02 09:21:51 +00:00
Thomas Roberts 12045c731a Graduate `__experimental_woocommerce_blocks_checkout_order_processed` action to stable (https://github.com/woocommerce/woocommerce-blocks/pull/5014)
* Deprecate __experimental_woocommerce_blocks_checkout_order_processed

* Update docs to reflect new hook name

I also mentioned this hook is deprecated in the experimental interfaces doc.

* Update deprecated tag in docblock

* Fix typo in deprecated docblock

* Send args to do_action_deprecated in an array

* Amend deprecated tag and add version numbers
2021-11-02 08:46:54 +00:00
Tom Cafferkey 204143c7ec Updated hook (https://github.com/woocommerce/woocommerce-blocks/pull/5038) 2021-10-29 13:29:42 +01:00
Tom Cafferkey 66cc0178eb Add Render Logic to BlockTemplateController (https://github.com/woocommerce/woocommerce-blocks/pull/4984)
* Add render logic to BlockTemplatesController

* Comment out action to test e2e tests

* Add add_action back into initialise render method

* Check function exists before using it

* Change hook from wp to template_redirect

* Update src/BlockTemplatesController.php

Co-authored-by: Tung Du <dinhtungdu@gmail.com>

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2021-10-29 12:44:29 +01:00
Tom Cafferkey be3ce8423e Abstract LegacyTemplate block (https://github.com/woocommerce/woocommerce-blocks/pull/4991)
* Legacy Template block

* Return render_single_product value

* Make placeholder text translatable

* Don't allow removing the block

* Update block title

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-10-29 08:31:50 +01:00
Tung Du 587a7018da Fix: Mini Cart block: update button style (https://github.com/woocommerce/woocommerce-blocks/pull/4907)
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
2021-10-29 09:35:17 +07:00
Tung Du e60405689d Mini Cart block: add footer (subtotal, cart & checkout buttons and payment method icons) (https://github.com/woocommerce/woocommerce-blocks/pull/4982)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-10-28 22:48:39 +07:00