Commit Graph

4287 Commits

Author SHA1 Message Date
Manish Menaria c263ba83d4 Adds product query support for Category list block (https://github.com/woocommerce/woocommerce-blocks/pull/7675)
* Adds product query support for Category list block

On the client side, when the Category list block is used within the
product query bloc, the markup will be rendered on the server side -
No javascript related to Category list block will be rendered.

* bot: update checkstyle.xml

* Fix extra space after the category link

I used the solution from following link: https://css-tricks.com/fighting-the-space-between-inline-block-elements/#aa-remove-the-spaces

Here is the content from the above link:

The reason you get the spaces is because, well, you have spaces between the elements (a line break and a few tabs counts as a space, just to be clear). Minimized HTML will solve this problem, or one of these tricks:

```CSS
<ul>
  <li>
   one</li><li>
   two</li><li>
   three</li>
</ul>
```

or

```CSS
<ul>
  <li>one</li
  ><li>two</li
  ><li>three</li>
</ul>
```

or with comments…

```CSS
<ul>
  <li>one</li><!--
  --><li>two</li><!--
  --><li>three</li>
</ul>
```

They’re all pretty funky, but it does the trick.

* Fix custom style doesn't work on the frontend side

For more info, check this comment on the PR:
https://github.com/woocommerce/woocommerce-blocks/pull/7675#pullrequestreview-1179267957

In summary, user can set the custom styles like text color, link color, font size, font weight, line height using the editor sidebar.
These styles weren't showing on the frontend side.

* Add support for additional CSS class(es)

* Fix "custom style -> link color" not working

To understand the issue in more details please check following comment:
https://github.com/woocommerce/woocommerce-blocks/pull/7675#issuecomment-1319822535

* Fix classname undefined issue

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-28 11:47:27 +05:30
Albert Juhé Lluveras 91ff195c07 Rename Active Product Filters block to Active Filters (https://github.com/woocommerce/woocommerce-blocks/pull/7753)
* Rename Active Product Filters block to Active Filters

* Rename wc-block-active-product-filters__placeholder to wc-block-active-filters__placeholder

* Rename active filters fixture
2022-11-25 17:17:45 +01:00
dependabot[bot] 4f18a71899 Bump loader-utils from 1.4.0 to 1.4.2 (https://github.com/woocommerce/woocommerce-blocks/pull/7688)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2022-11-25 11:08:43 -03:00
Alba Rincón 304f2c3c23 Make `Products by category/tag/attribute` fallback to the `Product catalog` template (https://github.com/woocommerce/woocommerce-blocks/pull/7712)
* Add archive-product to the hierarchy

* Fallback to archive-product and get titles from blocks if the templates from theme don't have one

* Rename function

* Fix comment

* Add fallbacks to the db and blocks versions

* Add missing product attribute blockified template

* Update docs

* Add comment and fix comment type on wp_template

* Replate template name if we know the template in blocks

* Add comment and fix linting error

* Fix archive-product template

* Clone the fallback template from db to show them in the template lsit

* Return the fallback template when querying for a single template

* Remove unneeded condition

* Use wp function instead of gutenberg one

* Fix tests

* Fix tests on Product Catalog templates

It was checking a single product for the customization, but it should check the /shop page

* Disable tests related with deleteAllTemplates function
2022-11-24 16:45:39 +01:00
Alex Florisca c9109183b8 Remove CustomerDataContext (https://github.com/woocommerce/woocommerce-blocks/pull/7686)
* Remove CustomerDataContext

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-24 14:20:44 +00:00
Alex Florisca ff414acd63 Add checkout selectors (https://github.com/woocommerce/woocommerce-blocks/pull/7713)
* Add checkout selectors

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-24 14:19:59 +00:00
Luigi Teschio 1b55c5633b Product Query - Add E2E tests for the Filter by Attribute block (https://github.com/woocommerce/woocommerce-blocks/pull/7405)
* Product Query: Fix pagination issue

* Product Query - Add support for the Filter By Price Block woocommerce/woocommerce-blocks#6790

Product Query - Add support for the Filter By Price Block

* fix query relation

* fix on sale query

* Product Query - Add support for the Filter By Attributes block woocommerce/woocommerce-blocks#6790

Product Query - Add support for the Filter By Attributes block

* fix bugged pagination and on-sale filter after refactor

* address feedback

* Product Query - Add e2e tests for the Filter By Price block

* Product Query - Add e2e tests for the Filter By Attribute block

* fix comment

* fix comment

* remove not used import

* remove not used import

* address feedback

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-11-24 14:42:58 +01:00
Lucio Giannotta 55face4338 Product Query: Add order by “Top rated” as a preset (https://github.com/woocommerce/woocommerce-blocks/pull/7715)
* Add safety guard to `extend_rest_query_allowed_params`
2022-11-23 20:28:17 +01:00
Daniel Dudzic 81d0994213 Post 9.0.0 release version bump (https://github.com/woocommerce/woocommerce-blocks/pull/7737) 2022-11-23 18:01:04 +01:00
Manish Menaria 983ecc03d7 Add product query support for Sale badge block (https://github.com/woocommerce/woocommerce-blocks/pull/7709)
* Add product query support for Sale badge block

On the client side, when the Sale badge block is used within the product query block, the markup will be rendered on the server side - No javascript related to Sale badge block will be rendered.

* Add support for additional CSS class(es)

ADDITIONAL CSS CLASS(ES)(available in advanced toggle in sidebar) should be added to the container div

* Convert preset to css variable for padding

We are getting padding value in preset format like this:
"var:preset|spacing|50"
Therefore I added a function to convert it to CSS variable like this:
"var(--wp--preset--spacing--50)"

i.e. "var:preset|spacing|50" -> "var(--wp--preset--spacing--50)"

* Add reference for preset to css variable conversion logic
2022-11-23 17:12:55 +05:30
github-actions[bot] ed192ab48e Release: 9.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/7725)
* Empty commit for release pull request

* Update compatibility sections and add release 9.0.0 changelog

* Add testing instructions for the 9.0.0 release

* Update testing instructions for the 9.0.0 release

* Remove testing instructions for an unmerged PR

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2022-11-23 12:37:31 +01:00
Tung Du 418d33e22e E2E: Change label of product filters from `Product filters` to `Advanced Filters` (https://github.com/woocommerce/woocommerce-blocks/pull/7726)
* E2E: Change label of product filters from `Product filters` to `Advanced
Filters` to match with the updates from woocommerce/woocommerce-blocks#7687

* rename test file and test title to advanced filters

* E2E: Fix flaky test related to `waitForAllProductsBlockLoaded` (https://github.com/woocommerce/woocommerce-blocks/pull/7727)

* explain the reason for try/catch
2022-11-22 15:28:27 +01:00
Lucio Giannotta 04c689b0ff Product Query: Add order by “best selling” as a preset (https://github.com/woocommerce/woocommerce-blocks/pull/7687)
* Add support for “Popular Presets” for PQ block

This commits achieves the following:

* Adds a section in the inspector control called “Popular Presets”,
which contains a dropdown with popular presets.
* Adds support for the first preset: “Best selling products”.
By selecting this, users can sort products by total sales.
* Switches the order of the custom inspector controls and the default
Query Loop inspector controls: our controls will be now on top
as per the latest design spec (see pdnLyh-2By-p2).
* Restricts the allowed Query parameters to the sort orders we want to
allow according to the latest design spec (disabling title and date).
* Removes the core “Order By” dropdown.
* Refactor `setCustomQueryAttribute` to `setQueryAttribute` because
since a few iterations, our custom query attributes are not deeply nested
anymore, and this function can be used for the normal query too.
* Add back-end support for sorting by Best Selling via the Product Query block
* Adds the `popularity` value as an allowed value for `orderby` on
`product` REST API calls.
* Handles the query differently if the `orderby` value is one among the
custom ones.
2022-11-21 19:21:58 +01:00
Tarun Vijwani 482d3e3224 Change action type name for use shipping as billing option (https://github.com/woocommerce/woocommerce-blocks/pull/7695) 2022-11-21 18:04:53 +04:00
Thomas Roberts 7f8be00f74 Add tests to ensure argument passed to `canMakePayment` is correct (https://github.com/woocommerce/woocommerce-blocks/pull/7478)
* Add tests to ensure argument passed to canMakePayment is correct

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Fix import and type after rebase

* bot: update checkstyle.xml

* Trigger Build

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-21 04:13:24 -08:00
Tung Du 8108f42c30 Refactor TypeScripts error monitoring workflow to avoid tracking checkstyle.xml (https://github.com/woocommerce/woocommerce-blocks/pull/7717) 2022-11-21 19:07:23 +07:00
Tung Du 65afb95e35 Product Query E2E tests: Sale and Stock status filters tests (https://github.com/woocommerce/woocommerce-blocks/pull/7684)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-21 08:08:12 +07:00
Luigi Teschio 21beb29442 Product Query - Add e2e tests for the filter by price block (https://github.com/woocommerce/woocommerce-blocks/pull/7351)
* Product Query - Add e2e tests for the Filter By Price block

* fix comment

* remove not used import

* update description

* update functions after merge

* improve check
2022-11-18 16:44:39 +01:00
Niels Lange 11815133d5 Fix various GitHub Actions warnings (https://github.com/woocommerce/woocommerce-blocks/pull/7573)
* Remove git checkout HEAD^2

* Add assertion to Cross-Sells e2e test

* Replace deprecated set-output calls

* bot: update checkstyle.xml

* Remove obsolete eslint-disable comment

* Change “actions/cache@v2” to “actions/cache@v3”

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-18 07:41:30 -08:00
Alex Florisca a73d6af443 Move paymentResult to the payment store (https://github.com/woocommerce/woocommerce-blocks/pull/7692)
* Move paymentResult to the payment store

* bot: update checkstyle.xml

* Update docs

* Fix typerror

* bot: update checkstyle.xml

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
2022-11-18 12:13:00 +00:00
Raluca Stan 98480c4dc2 Update cart.md (https://github.com/woocommerce/woocommerce-blocks/pull/7700)
* Update cart.md

Add information on how to add extra data to the /add-item request

* Update src/StoreApi/docs/cart.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update src/StoreApi/docs/cart.md

Co-authored-by: Niels Lange <info@nielslange.de>
2022-11-18 12:16:26 +01:00
Niels Lange 21e30a2956 Convert product-elements/image to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7572)
* Updated package-lock.json

* fixed method sig

* PHP versions matrix

* removed extra space

* renamed step

* Update E2E and coding standards to use PHP 8.0

* Un-linted unit-tests.yml. Github flows use 4 spaces indent, while our .editorconfig file enforces 2 spaces.

* Refactor unit-tests.yml

* Linted unit-tests.yml to proper 2 space indents

* Removed composer caching

* Test without hacky permissions step

* Concurrency disable.
Jobs renaming.

* Add step to install wp-env for PHP unit tests.

* Another try at fixing perms for wp-env

* Another try at fixing perms for wp-env

* Restore missing steps

* Convert product-elements/image to TypeScript

* bot: update checkstyle.xml

* Refactor edit.tsx

* bot: update checkstyle.xml

* Add interface to attributes.ts

* Convert product-elements/image to TypeScript

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Refactor edit.tsx

* Add interface to attributes.ts

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Solve TS error

* Solve TS error

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Document types

* Adjust TS interface

* Correct merge mistakes

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Fix broken JS unit test

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-18 13:52:37 +07:00
Thomas Roberts 9bc245f006 Add `clearValidationErrors` action to validation data store (https://github.com/woocommerce/woocommerce-blocks/pull/7601)
* Add clearValidationErrors to validation data store actions

* Add reducer case for CLEAR_VALIDATION_ERRORS

* Add tests for CLEAR_VALIDATION_ERRORS

* Add documentation for clearValidationErrors

* Deprecate clearAllValidationErrors in actions.ts

* Remove CLEAR_VALIDATION_ERRORS action and reducer case

* Update reducer test for clearAllValidationErrors

* Make error message in test describe the test better

* Update reducer to handle CLEAR_VALIDATION_ERRORS with no error passed

* Update documentation for validation data store

* Remove unnecessary linebreaks in documentation
2022-11-17 09:19:44 -08:00
Albert Juhé Lluveras f2748f84ee Update Filter by Stock block name in readme.txt (https://github.com/woocommerce/woocommerce-blocks/pull/7599) 2022-11-17 16:08:48 +01:00
Saad Tarhi a5970697ea Fix missing translations in inspector — Cross-Sells Block (https://github.com/woocommerce/woocommerce-blocks/pull/7616)
* Fix CartCrossSellsBlock inspector's translation

* Fix CartCrossSellsProductsBlock inspector's translation

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
2022-11-17 14:41:15 +01:00
Thomas Roberts 8087adc49d Move `StoreNoticesContainer` to `@woocommerce/blocks-checkout` package and add tests (https://github.com/woocommerce/woocommerce-blocks/pull/7558)
* Move StoreNoticesContainer to checkout package & convert to TS

* Update @types/wordpres__notices version

* Export StoreNoticesContainer from checkout package

* Remove PropTypes from StoreNoticesContainer

* Remove store-notices/index file

* Update import of StoreNoticesContainer

* Remove store notices export

* Add docblock to StoreNoticesContainer component

* Add tests for StoreNoticesContainer

* bot: update checkstyle.xml

* Fix typo and incorrect component name

* Update import for StoreNoticesContainer

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-17 05:33:58 -08:00
Alba Rincón 87510929b5 Create the `Products by Attribute` template (https://github.com/woocommerce/woocommerce-blocks/pull/7660)
* Create the `Products by Attribute` template

* bot: update checkstyle.xml

* Fix typo

* Rename template to `taxonomy-product_attribute`

* Rename test template file

* bot: update checkstyle.xml

* Fix test enabling archives for shade attribute

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-16 14:37:41 +01:00
Alex Florisca ddd0cc2300 Move payment utils and delete orderPaymentMethods (https://github.com/woocommerce/woocommerce-blocks/pull/7679)
* Moved all payment utils functions in a utils folder

* Delete  as it's not being used

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Fix TS error

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-16 09:38:48 +00:00
kmanijak 5e1896d98a Fix: skewed placeholder of product image - issuewoocommerce/woocommerce-blocks#7553 (https://github.com/woocommerce/woocommerce-blocks/pull/7651)
* Fix typo in HTML markup of ProductImage block placeholder

Typo caused rendering of incorrect HTML attributes: width and height of Product Image placeholder that were anyway ignored by the browser

* Remove inline styles (width and height) from ImagePlaceholder in ProductElements > Image block

Inline height took precedence over the inherited styles which made the placeholder image skewed (in loading and loaded state). Removal of those styles allows the ImagePlaceholder to adapt the height to the available space keeping the ratio or inherit the styles from the parent

* Remove inline styles (width and height) from placeholder image in ProductImage.php block

Inline styles applied to the placeholder image of ProductImage block were overriden by other styles with higher specificity, which made them redundant. Additionally, corresponding styles were removed from the placeholder image from Editor code as they caused UI glitches. Additional proof that it's safe to remove them is in the first commit in this branch, the purpose of which was to fix those styles as there was a typo which corrupted them and eventually inline width and height were ignored by the browser and not applied to the element

* Add test to check placeholder image renders without width and height inline attributes

This is to prevent adding inline width and height attributes so the sizing of the placeholder image is controlled by the inherited styles or element styles, in the same way as a regular product image

* Fix TypeScript errors in the block test file of Product Image

* Add generic alt text to placeholder image

Alt text added in this commit is a generic text, not description of the actual image. That's because the image itself is set externally through the settings and may change over time

* Revert adding placeholder image alt text and add comments to make the empty alt explicit

After a Github discussion: https://github.com/woocommerce/woocommerce-blocks/pull/7651\#discussion_r1019560494 it was decided the placeholder should NOT have alt text as it serves the purpose of decorative image. According to the guidelines decorative images should not have alt text: https://www.w3.org/WAI/tutorials/images/decorative/. Comments were added also to other places where it happens

* bot: update checkstyle.xml

Co-authored-by: Karol Manijak <karolm@Karols-MacBook-Pro.local>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-16 10:25:40 +01:00
Tung Du e59c931a9b E2E: Fixing failed tests with Gutenberg (https://github.com/woocommerce/woocommerce-blocks/pull/7554)
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-11-16 08:52:51 +07:00
Alexandre Lara da594b87a4 Make loading placeholder colors match the current font color (https://github.com/woocommerce/woocommerce-blocks/pull/7658)
* Make loading placeholder colors match the current font color

Currently, the loading placeholder effect has a default gray color. However, since users can modify their themes with the Site Editor and choose a different set of colors for their websites, it would be interesting to make those placeholders match the color palette.

In this commit, the idea was to modify the `placeholder` mixin to replace the transparent font color with the current color and also modify the background-color and the linear-gradient to match the current font color. Furthermore, transparency was added to the middle color of the linear-gradient so we can keep the loading animation close to what it currently is.

* Add opacity to placeholder mixin

Before our changes, when the font color was dark, we had a lighter placeholder background color. After the changes the color is currently darker than before so the idea for this commit is to change the opacity of the placeholder in a way that the current color blends with the background color set for the theme.

* Change placeholder mixin opacity

After testing different combinations of colors, we decided to change the opacity to 0.15 so when the font color is darker the placeholder will have a lighter background color.

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-15 18:08:44 -03:00
Alex Florisca bf8d56ec72 Refactor the payment status (https://github.com/woocommerce/woocommerce-blocks/pull/7666)
* Add actions and selectors for new paymemt status

* Remove set_complete from reducer

* Replace all usages of getCurrentStatus with specific sepectors

* Replace all `setCurrentStatus` with individual actions

* Update docs

* Removed currentStatus

* bot: update checkstyle.xml

* Update docs/third-party-developers/extensibility/data-store/payment.md

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

* Address Thomas feedback

* Add link to deprecated message

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-11-15 12:27:39 +00:00
Niels Lange 6d60ce501f Convert product-elements/stock-indicator to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7567)
* Convert product-elements/stock-indicator to TypeScript

* bot: update checkstyle.xml

* Add interface for blockAttributes

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-15 06:16:02 +07:00
Niels Lange 94734a968b Bump version number of @types/wordpress__blocks (https://github.com/woocommerce/woocommerce-blocks/pull/7674)
* Bump version number of @types/wordpress__blocks

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-14 18:58:01 +07:00
Alba Rincón 5aae9940cb Merge branch 'release/8.9.0' of github.com:woocommerce/woocommerce-blocks into trunk 2022-11-14 10:22:21 +01:00
github-actions[bot] 8270730298 Release: 8.9.1 (https://github.com/woocommerce/woocommerce-blocks/pull/7670)
* Empty commit for release pull request

* Display correct block template when filtering by attribute (https://github.com/woocommerce/woocommerce-blocks/pull/7640)

* Fix error when trying to access the queried object when it's null (https://github.com/woocommerce/woocommerce-blocks/pull/7664)

* Fix error when trying to access the queried object when it's null.

* Check if the `slug` exists

* Use the taxonomy name instead of the slug, otherwise it returns false

* Update readme changelog

* Add testing notes

* Improve testing notes format

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
2022-11-14 10:08:53 +01:00
Alex Florisca fc44b9fc4d Remove the experimental flag that's used to include thunks in wp.data (https://github.com/woocommerce/woocommerce-blocks/pull/7617)
* Remove the experimental flag that's used to include thunks in wp.data

* bot: update checkstyle.xml

* Fix ts error from previous PR

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-14 09:07:49 +00:00
github-actions cc3c7635eb Empty commit for release pull request 2022-11-14 07:53:36 +00:00
dependabot[bot] 9a7f1e17e1 Bump @woocommerce/eslint-plugin from 2.0.0 to 2.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6837)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-12 02:14:18 +07:00
Alba Rincón 54c65287ed Fix error when trying to access the queried object when it's null (https://github.com/woocommerce/woocommerce-blocks/pull/7664)
* Fix error when trying to access the queried object when it's null.

* Check if the `slug` exists

* Use the taxonomy name instead of the slug, otherwise it returns false
2022-11-11 17:16:40 +01:00
Albert Juhé Lluveras 4c06377e47 Display correct block template when filtering by attribute (https://github.com/woocommerce/woocommerce-blocks/pull/7640) 2022-11-11 11:32:40 +01:00
Daniel W. Robert 37a6b2ef63 Add Product Query Support for Atomic SKU Block (https://github.com/woocommerce/woocommerce-blocks/pull/7385)
* Add attributes, settings, and editor PQ settings.

- Adds isDescendentOfQueryLoop attribute and sets up usage in editor.
- Connects Context (via useContext) in editor.
- Sets up necessary hierarchy in block index file settings.

* Update parent inner blocks config.

Reassign parent array to ancestor array which allows for blocks to be
included with more flexibility - i.e., added within groups that are
children of the ancestor block.

* Add dynamic render function for PQ support.

* Update to use correct classnames on PHP side.

SSR markup was accidentally using rating classname instead of sku so it
was not applying the proper text transform seen in the editor.

* Rename BlockAttributes type to Attributes

This keeps things consistent with the type naming on the other blocks.

* Remove redundant spread of sharedConfig object.

We don't need to spread the `sharedConfig` object into the `blockConfig`
object when defining `blockConfig` since we spread/merge these two
objects when registering the block via `registerExperimentalBlockType`.

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Empty commit to trigger checks.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-10 13:32:07 -05:00
Alex Florisca 9fa34effce Remove paymentStatuses, isDoingExpressPayment and isExpressPaymentMethodActive from the payment store state (https://github.com/woocommerce/woocommerce-blocks/pull/7643)
* Remove isExpressPaymentMethodActive and paymentStatus.isDoingExpressPayment from the payment store

* Remove uneccessary paymentStatuses key from the payments store
2022-11-10 16:15:31 +00:00
Alex Florisca c52dc91f67 Update from deprecated registerStore to register for data stores (https://github.com/woocommerce/woocommerce-blocks/pull/7310)
* Update from deprecated registerStore to register for data stores

* Rollback cart changes

* bot: update checkstyle.xml

* Explain keeping the deprecated "registerStore"

Co-authored-by: Tarun Vijwani <tarun.vijwani@automattic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-11-10 15:37:01 +00:00
Mike Jolley 25b4e18df2 Remove UPDATE_LEGACY_CART_FRAGMENTS (https://github.com/woocommerce/woocommerce-blocks/pull/7644)
* Remove UPDATE_LEGACY_CART_FRAGMENTS

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-10 11:41:00 +00:00
Paulo Arromba 7eeabeea69 Updated rate-limiting example snippet (https://github.com/woocommerce/woocommerce-blocks/pull/7650) 2022-11-10 11:39:46 +00:00
Thomas Roberts 32c402413a Update ValidatedTextInput TypeScript & move to `@woocommerce/blocks-checkout` (https://github.com/woocommerce/woocommerce-blocks/pull/7583)
* Move ValidatedTextInput and ValidationInputError to checkout package

* Include checkout package in tsconfig file

* Remove unnecessary index file

We export these components from packages/checkout/index.js instead

* Import ValidatedTextInput & ValidationInput error from checkout package

* Only add validationError.message when validationError is an object

* Explicitly add undefined to optional props

* Import isObject to test validationError

* Extend the HTML Input element attributes

* Use more performant useDispatch instead of dispatch

* Export component without withInstanceId hoc for testing

* Add tests for ValidatedTextInput

* bot: update checkstyle.xml

* Rename export of unwrapped component to have __

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-10 02:05:41 -08:00
Tarun Vijwani 4f75d12188 Add woocommerce_blocks_loaded hook information to actions doc (https://github.com/woocommerce/woocommerce-blocks/pull/7600)
* Add woocommerce_blocks_loaded hook information to actions doc

* add docs to woocommerce_blocks_loaded hook inline

* fix docs

* Switch to updated wp-hooks/generator package

* Prevent syntax error in doc script from storeapi.php

* Remove footer from internal docs and examples

* Doc footer script should ignore examples and internal developer docs

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-11-10 09:52:04 +01:00
Paulo Arromba f857afae0f Add PHP8 Unit Testing (https://github.com/woocommerce/woocommerce-blocks/pull/7528)
* fixed method sig

* Updated to @wordpress/env@5.5.0 and set default PHP 7.4 for wp-env.

* updated Coding Standards flow to use PHP 8.0

* Added comment to E2E flows explaining what PHP version is used

* Revert "Updated to @wordpress/env@5.5.0 and set default PHP 7.4 for wp-env."

This reverts commit 696cd7f42edc9d9726b777cf4f83a501a6d63936.

* Added comment to Unit test flows explaining what PHP version is used.
Specified PHP version on .wp-env.json

* Fixed composer-lock.json version.

* Updated tests to run on PHP Unit 9.2.6

* Updated tests to run on PHP 8

* Reverted test, mismatched results between local and pipeline

* Removed Todo

* Updated platform overrides

* Update Migrationb tests with Mockery for PHP8 compat

* try at PHP unit flow matrix

* Fix blocks.ini invalid config

* Temp disable E2E

* Downgraded woocommerce/woocommerce-sniffs as it introduced new sniffs we should be handling on a different PR

* re-enable E2E tests

* blocks.ini fix

* revert blocks.ini fix

* Update @wordpress/env

* remove .htaccess mapping

* Fix permissions for tests

* Debug permissions

* Attempt at perm fix

* Attempt at perm fix

* Downgraded @wordpress/env

* Another attempt at upgrade @wordpress/env

* Attempt at cleaning wp-env before run

* Attempt at destroying wp-env before run. Disabled E2E.

* Attempt at destroying wp-env before run.

* debug wp-env data

* attempt at deleting wp-env data (destroy won't work due to prompt)

* re-enable E2E

* Fix deprecation warnings

* Cleaned wp-env data for E2E

* Fix perms for E2E

* Updated RateLimitsTests

* debug

* Force 7.4 for wp-env

* Run sh outside of npm

* Reverted E2E flow

* reverted wp-env-config.sh debug test

* reverted .wp-env.json phpVersion force

* Update tests/php/StoreApi/Utilities/ProductQueryFilters.php

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

* Update tests/php/StoreApi/Routes/CartExtensions.php

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

* Update tests/php/StoreApi/Routes/CartItems.php

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

* Update tests/php/StoreApi/Routes/Products.php

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

* Update tests/php/StoreApi/Routes/ProductCollectionData.php

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

* Update tests/php/StoreApi/Routes/Batch.php

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

* Update tests/php/StoreApi/Routes/Checkout.php

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

* Update tests/php/StoreApi/Routes/CartCoupons.php

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

* Update tests/php/StoreApi/Routes/ProductAttributes.php

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

* Update tests/php/StoreApi/Routes/Cart.php

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

* downgraded @wordpress/env to v4

* Reverted back to reflection class for pivate attribs manipulation on tests

* reverted JS unit testing job name

* Update tests/php/StoreApi/Formatters/TestMoneyFormatter.php

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

* Typo fix

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-11-09 15:28:08 +00:00
Luigi Teschio 4947193eec TS monitor: Update comment instead of create a new one (https://github.com/woocommerce/woocommerce-blocks/pull/7593)
* Monitor TS: Update comment instead of create a new one

* Monitor TS: Update comment instead of create a new one
2022-11-09 15:42:04 +01:00