Commit Graph

3615 Commits

Author SHA1 Message Date
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
Manos Psychogyiopoulos 62bfed8dec Decode HTML entities when formatting Store API error messages (https://github.com/woocommerce/woocommerce-blocks/pull/5870)
* Decode HTML entities when formatting Store API error messages

* 👌IMPROVE: Code formatting to avoid linting issues - woocommerce/woocommerce-blocks#5869

* 👌IMPROVE: Decode entities directly on the store notices container - woocommerce/woocommerce-blocks#5869

*  REVERT: Revert decode entities directly on the store notices container - woocommerce/woocommerce-blocks#5869

*  REVERT: Revert decode entities directly on the store notices container - woocommerce/woocommerce-blocks#5869

Co-authored-by: Panos (Panagiotis) Synetos <panos.synetos@automattic.com>
2022-04-11 15:11:25 +03:00
Daniel Dudzic 562a1afd56 Remove the ToggleButtonControl in favor of ToggleGroupControl (https://github.com/woocommerce/woocommerce-blocks/pull/5967)
* Remove the ToggleButtonControl in favor of ToggleGroupControl

* Remove ESLint errors. Use experimental feature as this is low risk

* Fix the 'Expected preceding comment block' ESLint error

Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2022-04-11 13:33:46 +02:00
Alex Florisca 5c396c4e26 Tidy up and organise e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/6206)
* rename some things

* Refactor e2e tests

* remove only from checkout test

* Typo in test

* Add --testPathIgnorePatterns performance back into package.json

* Niels feedback and fix a test

* Update import from utils
2022-04-11 11:52:33 +01:00
Alex Florisca 6c2d24e3e5 Fix/e2e tests timeout issue (https://github.com/woocommerce/woocommerce-blocks/pull/6165)
* Increase timeout of translations test to 30000

* Wait for network idle in goToCart and goToCheckout

* Increase timeout to 30000

* fix E2E tests

* try fix

* test

* test

* test

* another test

* fix test

* 60s timeout

* test

* Update product constants

* Simplify orderSummary check

* Go back to page.$

Co-authored-by: Luigi <gigitux@gmail.com>
2022-04-08 14:47:49 +01:00
Alex Florisca 0c7c2db6c0 Update @woocmmerce/eslint-plugin to 2.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6203)
* Update @woocmmerce/eslint-plugin to 2.0.0

* Fixed some eslint errors

* Fix syntax errors

* Fix most linting errors

* Feedback changes

* Fix one more eslint issue
2022-04-08 14:47:19 +01:00
Thomas Roberts cab947bc2b Remove `useStoreNotices` and interact directly with data store instead (https://github.com/woocommerce/woocommerce-blocks/pull/6159)
* Make useStoreNotices interact directly with the store

* Get/set error notices directly in store in paymentMethodDataContext

* Add hasNoticesOfType util

* Remove useStoreNotices and interact directly with data store

* Create/remove notices directly in store

* Remove tests for useStoreNotices

* Add tests for notices util

* Use setIsSuppressed from useStoreNoticesContext

* remove useStoreNotices hook

* Update context typedef to define only isSuppressed and setIsSuppressed

* Remove all values from StoreNoticesContext besides setIsSuppressed

* Wrap Cart and Checkout blocks in StoreNoticesProvider (for isSuppressed)

* Make StoreNoticesContainer a named export

This is required so we can import it from @wooommerce/base-context

* Change addErrorNotice to createErrorNotice to match store action

* Remove unnecessary StoreNoticeProviders and pass only context to container

* Accept a context in StoreNoticesContainer

* Pass relevant context to StoreNoticesContainer

* Add function to remove notices by status

* Prevent checkout from breaking when removing notices during processing

* Prevent TS error about not included path

* Add StoreNoticesContainer to single product block

* Add StoreNoticesContainer to All Products Block

* Ensure errors are shown when using All Products & Single Product Blocks

* Add a context arg to removeNoticesByStatus

* Use correct contexts for all products and single product block

* Update tests to reflect new context argument

* Re-add missing block file for order-summary

* Remove block file for order-summary

* Send context to useStoreCartCoupons to show errors correctly
2022-04-08 13:11:50 +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
Tung Du 1fb7274633 Refactor: Style quantity input dynamically (https://github.com/woocommerce/woocommerce-blocks/pull/6167) 2022-04-08 15:49:27 +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
Alex Florisca e37b787e50 Move mini cart outside cart-checkout folder (https://github.com/woocommerce/woocommerce-blocks/pull/6192)
* Move shared folder to /blocks

* Moved mini-cart block in blocks dir:

* Rename shared folder to cart-checkout-shared

* Remove customDir from mini-cart webpack entry

* Update assets/js/base/context/tsconfig.json

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

* Feedback changes

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-07 14:47:58 +01:00
Thomas Roberts d7a52b6f67 Check for performance file existence before running reporter (https://github.com/woocommerce/woocommerce-blocks/pull/6189)
* Check for performance file existence before running

* check reports/performance-report.json file exists on setup

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-04-06 12:22:51 +01: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
Alex Florisca e15d516163 Revert "Move cart and mini-cart blocks into their own folders (https://github.com/woocommerce/woocommerce-blocks/pull/6126)" (https://github.com/woocommerce/woocommerce-blocks/pull/6190)
This reverts commit d005dbd2cf.
2022-04-05 11:14:32 +01:00
Thomas Roberts 10793e8e18 Try adding performance tests (https://github.com/woocommerce/woocommerce-blocks/pull/6119)
* Add performance script to measure load times of cart and checkout blocks

* Temp commit

* Temp commit

* Temp commit

* Remove specific test from performance e2e command

* Add performance reporter

* Add step to clean performance file before running tests

* Add test report constant & average and logPerformanceResult test utils

* Update uses of product name constant

* Add cart coupon performance test

* Check if report file is empty before parsing

* Limit performance tests to only ones in performance directory

* Round the averages and add a linebreak after each entry in the log

* Fix formatting of report and only output after all tests

* Log each loading metric as an individual data point

* Improve formatting

* Get load times in ms from profiler

* Revert changes to fixtures

* Remove trace.json from git

* Remove checkout test file (tests not implemented)

* Check performance log file exists before truncating it

* Fix checkout coupon test

* Remove console logs

* Revert to use virtual products after rename of constant

* Ignore performance tests when running regular e2e tests

* Feedback changes

* Tidy up

* Fix packag-log.json:

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-04-04 13:30:07 +01:00
Alex Florisca d005dbd2cf Move cart and mini-cart blocks into their own folders (https://github.com/woocommerce/woocommerce-blocks/pull/6126)
* Move cart and mini-cart into their own folders

* Update other references of cart-checkout
2022-04-04 12:34:29 +01:00
Alba Rincón b56097337f Update `Product Title` link settings to match `Post Title` (https://github.com/woocommerce/woocommerce-blocks/pull/6131)
* Rename `Product Title` `Content` panel to `Link settings`

* Rename toggle `Link to Product Page` to `Make title a link`

* Remove help text

* Add `rel` and `linkTarget` to the `Product Title` settings

* Add `rel` and `linkTarget` to the `Product Title` block

* Only add the `target` attribute if the title is rendered as a link

* Keep the `nofollow` in rel as it was before

* Make `linkTarget` and `rel` optional

To not change the html generated for other components also using `ProductName`

* Add tests fotr the `Title` component

* Improve rel condition

* Extract `linkRel` variable

* Remove unnecessary undefined

* Remove the default value for `linkTarget`

Since it is the default behavior of the browsers, we don't need it.

* Remove the `nofollow` rel value

It was decided to remove it since it's a link to internal pages.
See the PR discussion for more context.

* Remove the `rel` option

It does not have much sense to have it since it's always an internal link.
See the PR discussion for more context.

* Clean-up `rel` related code
2022-04-04 09:06:24 +02:00
Saad Tarhi c636cb1bbe Shopper → Checkout → Can apply single-use coupon once (https://github.com/woocommerce/woocommerce-blocks/pull/6174)
* Add "single-use" coupon to the fixture data

* Create a first draft of the coupon e2e test

* Create single use coupon code constant

* Create "applyCouponFromCheckout" function

* Remove the "single-use" coupon from the fixture data

* Setup coupon creation using Woo's Rest API

* Add single-use coupon E2E test

* Move discount XPath definition to the expressions file

* Clean comments

* Remove unnecessary delay function

* Refactor to a more human friendly check

* Clear the setup in the afterAll branch (delete coupon)

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-04-01 23:09:54 +00:00
Mike Jolley eb196226d8 WIP: Add Inner blocks to order summary (https://github.com/woocommerce/woocommerce-blocks/pull/6065)
* Sub/Total/Fee inner blocks

* Row blocks within the inner block

* Update icons

* Resolve stying issues

* Remove old block

* Pin totals row

* Locking logic update

* Heading inner block

* Refactor where inner blocks are defined

* Add todos

* Todo for Consider deprecating OrderMetaSlotFill and DiscountSlotFill in favour of inner block areas.

* Improve frontend registration of components using new entrypoint

* Experiment- external block context

* Revert "Experiment- external block context"

This reverts commit 4b75668ec7eb62f065c6a488cd942a666e26204f.

* Duplicate inner blocks to avoid conflicts with context

* Remove todo

* Rename block dir

* Some test fixes

* Fix import

* fix import

* linting

* Remove unused attributes

* Optional classname

* fix coupons import

* fix shipping mocks

* Styling

* Fix selectors in e2e tests

* Add back the wc-block-components-totals-wrapper class that was used for each segment in the totals Order summary

Because, removing them was:
-  a breaking change for the old structure
- was making it harder to target the inner blocks. Before the class was used to target each segment
- it was making the wc-block-components-totals-item behave as a child or parent depending on the inner block, inconsitency

* Reuse the TotalsWrapper component for C& C blocks inner blocks

This component was removed in this PR, but  we wrap components in the Cart and Checkout sidebar in a TotalsWrapper. This will ensure consistent spacing and borders are applied to items in the sidebar.

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2022-04-01 15:45:18 +02:00
renovate[bot] d6e0db14ef Update dependency @types/lodash to v4.14.181 (https://github.com/woocommerce/woocommerce-blocks/pull/6162)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-01 13:26:59 +01:00
Luigi Teschio 4f2f267cf8 Add tests for the Mini Cart Block when it is added on the FSE editor. (https://github.com/woocommerce/woocommerce-blocks/pull/6000)
* Add tests for the Mini Cart Block when it is added on the FSE editor woocommerce/woocommerce-blocks#5727

Add tests for the Mini Cart Block when it is added on the FSE editor

* not hardcoding selectors

* fix typo

* restore old searchForBlock function

* add export

* Revert "restore old searchForBlock function"

This reverts commit 7049ad85bc2752ad33933eec00da9682943ec35a.

* use searchForBlock from package only for FSE pages

* add fix for GB
2022-04-01 11:23:48 +02: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
Tomasz Tunik d62a126476 Ensure e2e tests work with TS (https://github.com/woocommerce/woocommerce-blocks/pull/6173)
* Cleanup e2e jest config from moduleFileExtensions

moduleFileExtensions by default support js, ts, tsx etc.

* convert legacy-template-blocks e2e test to TS

* clean up jest.config.json moduleFileExtensions

unnecessary defaults override
2022-04-01 10:22:54 +02:00
Alba Rincón 92387e2912 Prevent `Featured Product` block from breaking when product is out of stock + hidden from catalog (https://github.com/woocommerce/woocommerce-blocks/pull/6166)
* Prevent accessing the first element of the `parentProduct` array if empty

* Include all products regardless of their `stock_status`

By default, the `/wc/store/v1/products` endpoint does not return products with
`outofstock` stock status. We want the users to be able to select any product
regardless of its stock status, we need to explicitly request them using the
`stock_status` query param.

* Use the optional chaining operator

Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-03-31 15:24:10 +02:00
Niels Lange 8943629a86 Shopper → Checkout → Can have different shipping and billing addresses (https://github.com/woocommerce/woocommerce-blocks/pull/5860)
* Shopper can have different shipping and billing addresses

* Shopper can have different shipping and billing addresses

* Shopper can have different shipping and billing addresses

* Correct billing field IDs

* Remove unused variable

* Remove unused timeout

* Remove unused commands

* Activate company field using setCheckbox

* Deactivate company field using unsetCheckbox

* Remove obsolete command

* Empty cart before and after each test

* Remove obsolete import

* Check billing and shipping company

* Remove manual code with unsetCheckbox

* Fill company if field exist

* Get checkbox ID from label

* Remove duplicate company field toFill method

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-31 13:10:50 +02:00
Tung Du 77990a5c1b Fix: Shopping Button default hover and focus style (https://github.com/woocommerce/woocommerce-blocks/pull/6157) 2022-03-30 18:38:29 +07:00
Albert Juhé Lluveras eb8bfedcf1 Remove button aligment from Featured Product and Featured Category blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6156) 2022-03-30 10:57:06 +02:00
renovate[bot] 992e84dc58 Update dependency @types/react to v17.0.43 (https://github.com/woocommerce/woocommerce-blocks/pull/6163)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-30 03:36:38 +00:00
dependabot[bot] b560a00acc Bump node-forge from 1.2.1 to 1.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6142)
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 16:06:13 +01:00
dependabot[bot] f2dc23a7b9 Bump plist from 3.0.4 to 3.0.5 (https://github.com/woocommerce/woocommerce-blocks/pull/6143)
Bumps [plist](https://github.com/TooTallNate/node-plist) from 3.0.4 to 3.0.5.
- [Release notes](https://github.com/TooTallNate/node-plist/releases)
- [Changelog](https://github.com/TooTallNate/plist.js/blob/master/History.md)
- [Commits](https://github.com/TooTallNate/node-plist/commits)

---
updated-dependencies:
- dependency-name: plist
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 16:05:47 +01:00
Alex Florisca 1108c9994b Fix E2E Tests on trunk (https://github.com/woocommerce/woocommerce-blocks/pull/6154)
* Fire up CI

* Increase timeout after selector
2022-03-29 16:05:11 +01:00
dependabot[bot] 3201282e1a Bump minimist from 1.2.5 to 1.2.6 (https://github.com/woocommerce/woocommerce-blocks/pull/6141)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 15:58:54 +01: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
Alba Rincón adca9b0c30 Convert Title component to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6115) 2022-03-29 12:16:17 +02:00
Alex Florisca f344d192d9 E2E tests for translated Cart & Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6101)
* Translation tests for Cart & Checkout

* Remove comments
2022-03-28 16:20:59 +01: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
Alex Florisca 2459c05d42 Critical flows: Shopper → Cart/Checkout → Can use express checkout (https://github.com/woocommerce/woocommerce-blocks/pull/6075)
* Test if express payment button is available on cart & checkout

* Remove unused uiUnblocked
2022-03-28 14:48:21 +01:00
Alba Rincón e140901142 Convert `CheckoutOrderNotes` to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6118)
* Convert order-notes to TS

* Rename onChange argument name

To be consistent with the one in the `setOrderNotes` action
2022-03-28 15:44:25 +02:00
Tomasz Tunik f7f1b89dc5 Upgrade @wordpress/scripts and /env packages (https://github.com/woocommerce/woocommerce-blocks/pull/6114)
* upgrade wordpress/scripts to 22.3

* update jest config/setup

* add explicit-exports-references plugin

to handle payment-method-config.tsx spying on external methods
the way code is output now changed and tests like this would not
work anymore as transpilet files were no longer using exports but
local references to methods.

* missing snapshot

* make cart-products E2E test more stable

* surppress eslint error in test file

* fix css stylelint issues

* update eslint-plugin-woocommerce eslint package

* remove temp test:e2e:start script

* re-run

* add stylelint as recommended extension

* remove redundant types (provided by packages now)

* patch update @testing-library/jest-dom
2022-03-28 15:00:20 +02:00
Tomasz Tunik e821983447 Improve goToSiteEditor E2E utils (https://github.com/woocommerce/woocommerce-blocks/pull/6109)
* dry getAllTemplates util

* Improve goToSiteEditor e2e util

It will now properly wait for page to load
and critical parts to be available before
handing control over to the next steps

* adapt site editing tests to new goToSiteEditor API

* try to stabilize the saveTemplate

to early navigation was causing the dreaded
"Expected an Error, but "" was thrown"

* try stabilizing saveTemplate

* contextually group/sort params

* improve clarity of the goToSiteEditor E2E util

- adds goToSiteEditor private helper that hides the temporary need
for handling theme.php and site-editor.php paths
- adds two exported utils goToTemplatesList and goToTemplateEdit
that hide UX details of waiting ofr page to be ready on load including special
case for waitingFor templates list actions to be loaded

* put back page where it belongs 
2022-03-28 14:32:15 +02:00
Thomas Roberts 5cc165d7a8 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
2022-03-28 12:10:36 +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 7d60c8fc66 Fix: Mini Cart: Ability to choose the drawer behavior when user add products to cart (https://github.com/woocommerce/woocommerce-blocks/pull/6052) 2022-03-26 07:32:23 +07:00
Saad Tarhi ba2308f729 Shopper → Checkout → Can see warnings when form is incomplete (https://github.com/woocommerce/woocommerce-blocks/pull/6116)
* Create "isLoggedIn" shopper function

This function checks if a shopper is logged in

* Add "Can see warnings when form is incomplete" test

* Optimize login check and logout process for the test

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-25 18:34:17 +01:00
Daniel Dudzic 070852bf69 Filter Products by Attribute: Fix dropdown search case sensitivity (https://github.com/woocommerce/woocommerce-blocks/pull/6096)
* Filter Products by Attribute: Fix dropdown search case sensitivity handling

* Refactor the dropdown search logic and add an isCaseSensitive option

* Dropdown search: Match against the name rather than value

* Clean up and refactor the search dropdown code
2022-03-25 10:49:17 +01:00
Alba Rincón 88b208ebef Convert Textarea component to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6113) 2022-03-25 10:21:09 +01:00
Tung Du ed83dfbafa Shopper → Mini Cart → Can remove product (https://github.com/woocommerce/woocommerce-blocks/pull/5937) 2022-03-24 22:37:17 +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
Tomasz Tunik fdb8dde033 Fix site editor E2E tests for Gutenberg latest (https://github.com/woocommerce/woocommerce-blocks/pull/6080)
* Add handling of editor context via GUTENBERG_EDITOR_CONTEXT env var
* Fix flaky tests around editing templates
* Wait for save template response to complete
2022-03-23 14:18:00 +01:00
Saad Tarhi f8c5e910d2 Shopper → Cart → Can update product quantity (https://github.com/woocommerce/woocommerce-blocks/pull/6025)
* Add XPath expressions

* Add "setCartQuantity" utility function

* Add "productIsInCart" utility function

* Add "update product qty" e2e test

* Clean up test file

* Fix test on headless mode

* Add Increase/Decrease qty test cases

* Decrease the query chain for better maintainability

* Rename expression functions/file for more clarity

* Resolve conflict with trunk

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-23 13:51:56 +01:00
Niels Lange 9346e723f3 Shopper can place an order as logged in user (https://github.com/woocommerce/woocommerce-blocks/pull/6037)
* Shopper can place an order as logged in user

* Fill billing address for logged in user

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-03-23 13:23:22 +01:00
Niels Lange e4088cc398 Update documentation-guidelines.md 2022-03-23 12:22:06 +01:00
Tarun Vijwani 532952dd31 Critical flows: Shopper → Checkout → Can view empty checkout message (https://github.com/woocommerce/woocommerce-blocks/pull/6042)
* Added new test case for Critical flows: Shopper → Checkout → Can view empty checkout message
2022-03-23 15:17:48 +04:00
Niels Lange 512ae84b09 Shopper → Checkout → Can choose payment option (https://github.com/woocommerce/woocommerce-blocks/pull/5839)
* Shopper can choose payment option

* Empty cart before and after each test

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-03-23 12:01:33 +01: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
renovate[bot] 39b873fe76 Update dependency @types/react-dom to v17.0.14 (https://github.com/woocommerce/woocommerce-blocks/pull/6084)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 09:49:50 +01:00
renovate[bot] 323eca31bc Update dependency @types/gtag.js to v0.0.10 (https://github.com/woocommerce/woocommerce-blocks/pull/6082)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 09:00:13 +01:00
renovate[bot] 630bc9ee99 Pin dependency prettier to 2.0.5 (https://github.com/woocommerce/woocommerce-blocks/pull/6081)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 08:51:15 +01:00
renovate[bot] fa6e6cfb33 Update dependency @types/react to v17.0.41 (https://github.com/woocommerce/woocommerce-blocks/pull/6083)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 08:50:25 +01:00
Tomasz Tunik e1ae6b4552 Update GitHub actions/setup-node and add optionalDependencies handling (https://github.com/woocommerce/woocommerce-blocks/pull/6032)
* Update actions/setup-node to v2 and to use ,nvmrc file

* Fix order of actions for Bundle Size workflow

* Use actions/setup-node cache instead of actions/cache

+ ensure we always install with npm ci

* restore linting setup job to cache npm

* Don't install ndb in CI

Move ndb package to optionalDependencies and update
the CI workflows to not install optional dependencies

* Update actions/setup-node to v3

* Update actions/checkout to v3

* Update download and upload-artifact actions to v3

* Update actions/stale to v5
2022-03-23 08:41:43 +01:00
Tung Du 937bab7688 Fix: Mini Cart Contents: only show the active view (https://github.com/woocommerce/woocommerce-blocks/pull/6053) 2022-03-23 09:58:03 +07:00
Alba Rincón 1f9e4675fc Add `CurrencyCode` type (https://github.com/woocommerce/woocommerce-blocks/pull/6035)
* Create the CurrencyCode and use it for the currency `code` instead of the type `string`

Using the CurrencyCode type, the allowed values for the `code` property are restricted
to the ISO 4217 codes and not any string.

* Add and remove some currency codes to match the ones on WooCommerce

The WooCommerce supported list can be found here: https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/wc-core-functions.php#L475

* Use CurrencyCode type on CurrencyInfo and CurrencyResponse instead of string
2022-03-23 00:30:56 +01:00
Alba Rincón e7a061d56f Show the skeleton only when the slider is loading and disabled (on the first load) (https://github.com/woocommerce/woocommerce-blocks/pull/6078)
It should not be shown when the user changes the input range
2022-03-22 23:38:53 +01: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
Tung Du 9c22f241ca Mini Cart: Improve template part description (https://github.com/woocommerce/woocommerce-blocks/pull/6054) 2022-03-22 08:56:02 +07:00
Tung Du 64ae9330a2 Shopper → Mini Cart → Can see correct tax (https://github.com/woocommerce/woocommerce-blocks/pull/5979)
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-03-22 08:54:06 +07:00
renovate[bot] c735812df9 Update dependency @types/lodash to v4.14.180 (https://github.com/woocommerce/woocommerce-blocks/pull/6058)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 04:49:56 +00:00
renovate[bot] eaabd1eee9 Update dependency @types/gtag.js to v0.0.9 (https://github.com/woocommerce/woocommerce-blocks/pull/6057)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 04:46:20 +00:00
renovate[bot] 6421f80ed2 Update dependency @testing-library/react to v12.1.4 (https://github.com/woocommerce/woocommerce-blocks/pull/6056)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 02:35:25 +00:00
renovate[bot] fad55e9295 Pin dependency @woocommerce/e2e-utils to 0.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6055)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 02:20:32 +00:00
Mike Jolley c299411e28 7.2 testing notes 2022-03-15 11:53:56 +00: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
Mike Jolley c401369e04 Revert "Remove .gitattributes file (https://github.com/woocommerce/woocommerce-blocks/pull/5242)" (https://github.com/woocommerce/woocommerce-blocks/pull/6049)
This reverts commit 6ae286f670.
2022-03-14 12:42:34 +00:00
Thomas Roberts a6bff7e6e8 Change `shippingRatesLoading` to `isLoadingRates` (https://github.com/woocommerce/woocommerce-blocks/pull/5999)
* Change `shippingRatesLoading` to `isLoadingRates`

* Revert isLoadingRates back to old name in payment method interface

* Update docs with correct names returned by usePaymentMethodInterface

* Update TS to name the selectShippingRate method correctly

* Change method name on usePaymentMethodInterface back
2022-03-14 11:29:25 +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
Albert Juhé Lluveras 0819ab2797 Correctly load JS translations from WC core (II) (https://github.com/woocommerce/woocommerce-blocks/pull/6036)
* Correctly load JS translations from WC core (II)

* typo

* empty instead of count

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-03-11 14:18:45 +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
Tomasz Tunik 2ad55b5b9e Fix box-sizing on Global Styles blocks with border width control (https://github.com/woocommerce/woocommerce-blocks/pull/6043)
Set box-sizing to border-box on affected blocks: Featured product, featured category, sale badge.
2022-03-11 13:01:15 +01: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
Tung Du 75bf08d2c9 Fix: Exclude Button block from the Empty Mini Cart Contents block insterter (https://github.com/woocommerce/woocommerce-blocks/pull/6034) 2022-03-11 08:17:37 +07:00
renovate[bot] dcec8f38b5 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/5724)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-10 18:16:25 +01:00
Seghir Nadir d694b9b089 Ignore storybook dist folder when running eslint (https://github.com/woocommerce/woocommerce-blocks/pull/6033)
* ignore storybook dist folder

* Add reports folder to .eslintignore

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-03-10 17:25:29 +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
Mike Jolley 7f512d1c26 Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-gutenberg-products-block into trunk 2022-03-10 13:38:55 +00:00
Mike Jolley bfdd50cb63 7.3.0-dev in package.json 2022-03-10 13:38:52 +00:00
Mike Jolley 5165611e45 Remove deprecated data controls in favour of those from the `@wordpress/data` package (https://github.com/woocommerce/woocommerce-blocks/pull/5574)
* Remove expected warnings from test suite

* Switch dispatch and select usage to `controls`, from `@wordpress/data`

* Wrap render with act

* resolveSelect to wait for resolution

* resolveSelect
2022-03-10 13:22:05 +00: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
Tarun Vijwani 349c668f01 Critical flows: Shopper → Cart → Can view empty cart message (https://github.com/woocommerce/woocommerce-blocks/pull/6024)
* Added test case for Critical flows: Shopper → Cart → Can view empty cart message
2022-03-10 15:50:07 +04:00
Tarun Vijwani 0530048f4c Critical flows: Shopper → Cart → Can remove product (https://github.com/woocommerce/woocommerce-blocks/pull/6015)
* Added test case for Critical flows: Shopper → Cart → Can remove product
2022-03-10 15:47:53 +04: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
Alex Florisca a67876e7d7 Update debug script name (https://github.com/woocommerce/woocommerce-blocks/pull/6014)
* Update debug script name

* rename to test:debug
2022-03-09 15:37:36 +00:00
Mike Jolley 235f260c04 Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-gutenberg-products-block into trunk 2022-03-09 12:26:19 +00:00
Mike Jolley 04df284fe0 7.3.0-dev 2022-03-09 12:26:15 +00: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
Niels Lange d9dd7a0df6 Shopper can choose shipping option (https://github.com/woocommerce/woocommerce-blocks/pull/5844) 2022-03-09 13:23:52 +01: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
Alex Florisca fcadeaa2e1 E2E test improvements and consolidatng (https://github.com/woocommerce/woocommerce-blocks/pull/6013)
* Refactor e2e tests slightly for better efficiency

* Add "proceedToCheckout" shopper method & refactor code

* Use "beforeEach" in case we add more test cases

I've kept the "afterAll" function to reset any side effects at the end
of this file's tests

* Use "beforeEach" in "checkout-place-order-as-guest" file

* Use BASE_URL in shopper.block.goToBlockPage

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-09 10:16:24 +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
renovate[bot] 9503f03f9b Update dependency follow-redirects to v1.14.9 (https://github.com/woocommerce/woocommerce-blocks/pull/6018)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-09 03:07:12 +00:00
renovate[bot] 072c39b269 Update dependency @types/puppeteer to v5.4.5 (https://github.com/woocommerce/woocommerce-blocks/pull/6017)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-09 03:02:53 +00:00
Tung Du 22cdefd3da Cart: Accepted Payment Methods block: Use utility instead of the local function (https://github.com/woocommerce/woocommerce-blocks/pull/6001) 2022-03-09 07:06:32 +07:00
Alex Florisca 2e674dd6c0 Critical flow: Can see correct tax (https://github.com/woocommerce/woocommerce-blocks/pull/5900)
* Tax is displayed correctly e2e test

* Add extra utils to shopper

* add single e2e test script oin package.json

* Feedback changes from Niels

* Test tax is correct on summary page

* Check if CI test passes

* Longer timeout for tax test

* change timeout in jest config

* increate jest timeout

* Test

* Test

* Test

* setTimeout outside of tests to 120000

* Address raluca's feedback and timeout everywheregaa

* Increase timeout on  for search box

* set jest timeout to 120000

* Raluca's suggestions

* Debug

* Increase search timeout to 5000

* Only run Tax e2e tests in CI for quicker debug - REMOVE THIS

* use waitforSelector

* 30s delay for toMatchElement

* Let'shope this works

* Remove toMatchElement

* waitForSelector

* Run debug test only

* Debug tax test

* debug taxes

* shopper using toMatchElement again

* Remove the 30000 timeout delay from toMatchElement

* Run all tests but only once

* Remove tax test

* Revert "Remove tax test"

This reverts commit 7db34120e1e91f4fd26514fdb9525cac2a6066bb.

* Delete the minicart test

* Revert "Revert "Remove tax test""

This reverts commit 31dd654e52f37fcd02ccd25336958248bef495c6.

* Revert "Delete the minicart test"

This reverts commit 5595f0834a975d097a300bc0c7cbf643caa8b764.

* tax test

* block addToCart

* Put back block functions

* Refactor block.addToCart

* mini-cart e2e test uses shopper.block.emptyCart()

* only run shopper tests in CI

* Run frontend and shopper tests and change waitFor -> waitForTimeout

* Run frontend tests in CI

* Run CI e2e tests again

* Skip legacy template blocks

* Skip legacy template test but run all others

* Switch to storefront instead of twentytwentyone after legacy-template-blocks tests finish

* Tidy up

* fix typo

* Fix ESLint issue

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-08 14:50:16 +00:00
Saad Tarhi 1e15672b7b Shopper → Checkout → Can place an order as guest (https://github.com/woocommerce/woocommerce-blocks/pull/6009)
* Add "goToCheckout" method in "shopper.block"

Instead of using "shopper.goToCheckoutBlock" method, it will much easier
to maintain the following structure "shopper.block.goToCheckout"

* Create a constant for billing details

* Create "fillBillingDetails" shopper method

* Add "placeOrder" method to "shopper"

* Enable "Cash on delivery" payment method for our test

* Update "@woocommerce/e2e-utils" package

Some new useful e2e utility functions weren't avaiable in the previous version

* Add E2E test for "Can place an order as guest"

* Fix mini-cart failing E2E tests

In case this fix woocommerce/woocommerce-blocks#6006 isn't merged yet, this commit can be used to pass all
E2E tests

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-08 14:52:40 +01: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
Tung Du 75b5181e0e Shopper → Mini Cart → Can view empty cart message and start shopping button (https://github.com/woocommerce/woocommerce-blocks/pull/5918) 2022-03-08 17:01:27 +07:00
Tomasz Tunik 6e185e0e2b Move __experimentalSelector outside of hasSpacingStyleSupport check (https://github.com/woocommerce/woocommerce-blocks/pull/6011) 2022-03-08 10:38:42 +01:00
Saad Tarhi c0aec1e85b Fix mini cart failling tests (https://github.com/woocommerce/woocommerce-blocks/pull/6006)
Set the correct "emptyCart" utility function

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-08 00:09:20 +01:00
Luigi Teschio 4b80f92c02 Add feature gate for enabling the global styles for Product Sale Badge block only for the feature plugin (https://github.com/woocommerce/woocommerce-blocks/pull/6008)
* Add feature gate for the global styles for Product Sale Badge block woocommerce/woocommerce-blocks#6007

Add feature gate for the global styles for Product Sale Badge block

* add a check for the spacing support
2022-03-07 18:39:11 +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
Saad Tarhi c122008d70 Test Google's "ndb" E2E testing tool (https://github.com/woocommerce/woocommerce-blocks/pull/5997)
* install ndb as a development dependency

* Add "debug" script to package.json to launch "ndb"

* Create a minimal test example

This test file is used as an example, we will add later a script in
package.json to call only this file

* Create a temporary npm script to run it from "ndb"

We want to be able to run only a selected file using "ndb", so we need to
create an npm script for it

* Clean up test file

* Clean up & ready PR to merge

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-07 17:10:17 +01:00
Saad Tarhi dee5032d41 Shopper → Cart → Can proceed to checkout (https://github.com/woocommerce/woocommerce-blocks/pull/5901)
* Shopper → Cart → Can proceed to checkout

* Refactor the code for E2E testing

Introduce some discussed solution to structure and optimize the code

* Resolve some conflicts with the trunk branch

* Remove method overriding and refactor code

We are trying to avoid overriding exiting E2E Woo's utility functions

Instead we can use our own "shopper.block"

* Use a consistent constant naming convention

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-07 16:23:31 +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
Alex Florisca e14448e151 Update testing instructions for 6.8.0 and 6.9.0 releases (https://github.com/woocommerce/woocommerce-blocks/pull/5855)
* Update testing instructions for 6.9.0 release

* Edit 6.8.0 testing notes

* Update 6.8.0 testing docs
2022-03-07 12:06:50 +00:00
Thomas Roberts 6b8ef2773a Try move shipping related dat to a `@wordpress/data` store (https://github.com/woocommerce/woocommerce-blocks/pull/5896)
* Add address-related items to wc/store/cart data store

* Add useUpdateCustomerData hook

This allows us to have a single hook responsible for updating the customer information on the server.

* Add useUpdateCustomerData hook in Checkout block

* Remove shippingAsBilling from previousCustomerData ref type

* Add useShippingAsBillingCheckbox hook

* Remove checkbox handling from useCheckoutAddress

* Merge with woocommerce/woocommerce-blocks#5810 changes

* Move shipping as billing to checkout state context provider

* Subscribe to changes

* Cache customerDataToUpdate

* Combine customerDataType and customerDataContextType

* Fix notice context

* Clean up inline docs for push changes

* Add useShippingData hook

* Add shipping related selectors to cart store

* Update useShippingDataContext to useCustomerData hook

* Update uses of useShippingDataContext to get data from hook instead

* Remove rogue linebreak

* Re-add linebreak

* Re-add linebreak, remove shippingAsBilling

* Re-add linebreak

* Use useShippingData and useCustomerData instead of context

* Fix fromEntriesPolyfill to use number or undefined as an index option

* Convert derive-selected-shipping-rates to TS

* Add SelectShippingRateType

* Get needsShipping from new hook and not context

* Get address data from useCustomerData instead of useShippingDataContext

* Move selectedRates, selectShippingRate and isSelectingRate

* Remove items from ShippingDatacontext that are available in data stores

* Get shipping data from stores, not context in payment method interface

* Consider shipping rates to be loading if customer data is updating

* Get rates from useShippingData hook instead of context

* Fix incorrect TypeScript types and incorrectly named destructure

* Move useShippingData into shipping folder

* Update tests to mock useShippingData instead of context

* Remove empty string fallback from shipping phone

* Get types from Cart declaration instead of Picking them

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-03-04 17:43:45 +00:00
Thomas Roberts 719c7f7c23 [Experiment] Try to memoize/cache filter results so that we don't call third party filters too often (https://github.com/woocommerce/woocommerce-blocks/pull/5143)
* Add memoized/cached filter runs

* Add function to check equality of object's members

* Add function to check equality of arg and extensions vs prev values for a filter name

* Memoize/Cache values of previously run filters

* Add docs and null check to shallow equality check

* Update packages/checkout/filter-registry/index.ts

Co-authored-by: Raluca Stan <ralucastn@gmail.com>

Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2022-03-04 14:42:38 +00:00
Thomas Roberts db1989aefb Remove `fromEntriesPolyfill` (https://github.com/woocommerce/woocommerce-blocks/pull/5981)
* Remove fromEntriesPolyfill

* Remove further instances of fromEntriesPolyfill
2022-03-04 14:42:16 +00:00
Mike Jolley 9157930349 Remove v1 from Store Keys (https://github.com/woocommerce/woocommerce-blocks/pull/5987) 2022-03-04 14:03:52 +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
Mike Jolley c612b28e46 Remove lodash forEach usage (https://github.com/woocommerce/woocommerce-blocks/pull/5965)
* Remove lodash forEach usage

* Store built parents rather than deleting them
2022-03-04 12:04:15 +00:00
Tung Du 892d7c268d Shopper → Mini Cart → Can update product quantity (https://github.com/woocommerce/woocommerce-blocks/pull/5963) 2022-03-04 17:40:13 +07:00
Tung Du 43529e5735 Shopper → Mini Cart → Can go to Cart page (https://github.com/woocommerce/woocommerce-blocks/pull/5977) 2022-03-04 16:57:34 +07:00
Luigi Teschio 31b179eb49 Revert "Add wc-block-mini-cart__contents class for the Mini Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/5800)" (https://github.com/woocommerce/woocommerce-blocks/pull/5984)
This reverts commit 54ce880762.
2022-03-03 09:52:51 +01:00
Tung Du 33ac2d5f4b Shopper → Mini Cart → Can proceed to checkout (https://github.com/woocommerce/woocommerce-blocks/pull/5978) 2022-03-03 08:24:30 +07:00
Lucio Giannotta 08a99165ca Add mock theme with Woo Templates for E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/5920)
This PR adds a block-enabled theme with templates for WooCommerce
which is intended to be used when testing the more complex scenarios
such as template fallbacks.

Additionally, since theme-dependent logic seems to be becoming more
and more useful (see woocommerce/woocommerce-blocks#5913), this PR also adds a utility function used to
explicitly declare theme dependencies of a test (`useTheme`).

Said function will activate the theme before running a given suite and then
reactivate the previous theme, as to make sure to not have any side-effects
(such as the ones described in woocommerce/woocommerce-blocks#5913 above).

Closes woocommerce/woocommerce-blocks#5660
2022-03-02 15:49:00 +01: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
renovate[bot] 78a4c060a3 Update dependency @types/lodash to v4.14.179 (https://github.com/woocommerce/woocommerce-blocks/pull/5976)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-02 11:37:57 +00:00
Tom Cafferkey e8855a5af3 Full Store Editing: Technical documentation (https://github.com/woocommerce/woocommerce-blocks/pull/5939)
* templates README and block-template-controller README

* Add execution scenario to block template controller readme

* Amend return value to block template controller readme

* Add source file link to block template controller docs

* LegacyTemplate.php overview

* Legacy Template JavaScript block README

* Update requirements of templates feature

* Doc updates based on feedback, and change Legacy Template references to Classic Template in anticipation of naming convention updates

* Update classic-template.md README

* Reword part of the add_block_templates section

* Update assets/js/blocks/legacy-template/README.md

Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>

* Update docs/readme.md

Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>

* Update docs/templates/README.md

Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>

* Update docs/templates/README.md

Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>

* Update README for blocktemplatecontroller

* Review feedback for Woo FSE technical documentation

Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
2022-03-02 08:57:53 +00:00
renovate[bot] d54383b417 Update dependency @types/jquery to v3.5.14 (https://github.com/woocommerce/woocommerce-blocks/pull/5975)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-02 04:39:06 +00:00
dependabot[bot] 6bdd1e648b Bump url-parse from 1.5.3 to 1.5.10 (https://github.com/woocommerce/woocommerce-blocks/pull/5955)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.3 to 1.5.10.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.3...1.5.10)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 17:19:47 +01: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
Tung Du 22eccc8614 Shopper → Mini Cart → Can view filled mini cart contents block (https://github.com/woocommerce/woocommerce-blocks/pull/5923) 2022-03-01 18:25:13 +07: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
Mike Jolley 4927605129 Use text indent in input fields instead of padding (https://github.com/woocommerce/woocommerce-blocks/pull/5947) 2022-02-28 17:16:31 +00: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
Tomasz Tunik 61427b9e60 Change label from Remove to Reset (https://github.com/woocommerce/woocommerce-blocks/pull/5951)
This is to reflect how we agreed it would be best
  when working on Featured Product block
2022-02-28 11:39:52 +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
Thomas Roberts 7915a793fa Await expectations in checkout frontend test (https://github.com/woocommerce/woocommerce-blocks/pull/5942) 2022-02-25 18:21:10 +00: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
Tarun Vijwani 55c3ec201f Add Testing Details In Contributors Guide (https://github.com/woocommerce/woocommerce-blocks/pull/5879)
* Add testing details in contributors guide
2022-02-25 18:51:58 +04:00