* 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>
* 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>
* 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>
* Pass context information about containing block to the existing Slots
* Fix images added to the Slots docs
* Use the parent's block name for the context prop passed to Slot fills
* Fix All Products block pagination not showing up (https://github.com/woocommerce/woocommerce-blocks/pull/5850)
* Fix regression for Twenty Twenty-Two theme with sale prices being underlined (https://github.com/woocommerce/woocommerce-blocks/pull/5851)
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
When output with php the block had correct accessibility on
the frontend but in the editor or when rendered as block
the correct aria label was missing because of misspelled
aria-label attribute.
Also fixed wrong value type provided for tabIndex in editor
while at it.
* Add links to single routes in main index woocommerce/woocommerce-blocks#4473
* Footer
* Feedback template
* Remove footer from existing MD files
* Add doc footer script
* Apply script to all docs
* Fix examples
* Empty commit for release pull request
* Update readme.txt with 6.8.0 changelog
* initialize_session if it does not yet exist before calling the session class (https://github.com/woocommerce/woocommerce-blocks/pull/5577)
* Add testing notes for 6.8.0
* update testing release notes
* update testing notes
* Fix default `stockStatusOptions` in tag and attribute blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5590)
* Fix default stockStatusOptions in tag and attribute blocks
These should be an array of keys, not objects.
* Fix stockStatus definition on PHP side
* Swap state to debounce.
* Improve presentation of stock filters
* Remove state usage for display options
* Remove debounce
* Consistent panel titles
* Fix global style for Product Summary block, Product Stock Indicator block, and Product Title block (https://github.com/woocommerce/woocommerce-blocks/pull/5595)
* Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block
Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block
* add feature flag
* fix lint errors
* fix global style bugs on Product Title block
* update testing release notes
* update new build with fixes
* Restore correct font style when the block is loaded in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/5600)
* Restore correct font style when the block is loaded in the editor
Restore correct font style when the block is loaded in the editor
* fix style on Twenty Twenty theme
* update link for download the zip of the new release
* update readme.txt
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* add min and step to Store API
* add min and step support
* typo
* Update assets/js/base/components/quantity-selector/index.tsx
* Update assets/js/base/components/quantity-selector/index.tsx
* Fix debounce callback
* Style qty input to show steps
* Implement quantity_limits in API
* Quantity validation
* Update product API
* Normalize on + -
* Separate add to cart events from cart item events in regards to limits
* Prevent qty change for editable line items
* Unify filters
* Remove step number indicator from buttons ¯\_(ツ)_/¯
* Normalize on mount
* Update docs
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Force a string token property for the activePaymentMethod
* Empty commit for release pull request
* Update readme.txt with 6.7.1 info
* Add testing notes for 6.7.1
* Bumping version strings to new version.
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>
* Update wp-hooks-generator
* Update inline hook documentation into consistent format
1. Hook docs for the same hook should be identical
2. Prefix with `Hook: ` so the case of the hook is not changed.
3. Use `@see` instead of `@hooked`. Hooked is not a standard PHP Doc tag.
cc @Aljullu
* Update hook doc script to support duplicate hooks across files
* Remove unused variables in function
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Empty commit for release pull request
* Update readme.txt with 6.7.0 changelog
* Add testing notes for the 6.7.0 release
* Fix typo in testing notes
* Update Testing Notes
* Remove item from testing notes for 6.7.0
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* Add clear and fill input test util
* Add tests for Filter Products by Price
* Add class name to filter products by price block in editor
* Update wp-env
* Fix formatting
* Update lock
* Revert "Update lock"
This reverts commit f4e809e000430eea3972c94fd2aea0a19ba6961b.
* Create product attributes during setup
* Remove product attributes during teardown
* Add attributes in fixture-data
* Add two new products, for attribute testing
* Load attributes into store and apply them to products
* Add class to Filter by Attribute when editing
This is so it can be targeted in E2E tests more easily.
* Add tests for Filter Product by Attribute
* Fix formatting in attribute-filter.test.js
* Add tests for active filters block
* Add doc block for ensuteCleanAttributes
* Update wording of title test in all filter block E2E
* Update test wording to read better
* Update snapshots
* Use pptr-testing-library selectors to click elements
This makes the tests easier to reason with, and lets us take a step back from the implementation details (classnames etc.)
* Add saveOrPublish test util
* Use pptr-testing-library selectors to click elements in attribute filter
* Use pptr-testing-library selectors to click elements in price filter
* Add `puppeteer-testing-library`
* Use puppeteer-testing-library API to look for H6 button
* Use correct argument in jest-puppeteer.dev.config
* Update package.json & package-lock.json
* remove tests for 5.3
* remove snapshots
* Remove ensureCleanAttributes
* Remove puppeteer-testing-library, install missing expect-puppeteer package and update tests
The puppeteer-testing-library, although added by gutenberg is not actively used.
I have removed it and realised that the added functionality can be easily replaced by expect-puppeteer.
This is a package that we specify in the jest configuration but it was not part of our package.json.
The selectors from puppeteer-testing-library have been replaced with .toClick and the utility clearAndFillInput with .toFill
The Filter by Attribute block has been skiped until tests are fixed.
* Add back setupPageSettings to jest setup
* Fix filter by attribute block test
* Fix linting error
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* Empty commit for release pull request
* Add changelog and version info
* 6.6.0 testing notes
* Remove mini cart from testing instructions
* Clarify testing instructions
* Remove experimental feature from changelog
* fix not found template for the template editor
* update zip
* Remove test instructions for icon
* Testing steps for 5425
* Link order controller to cart routes
* Remove order controller from checkout route
* Fix PHP warnings in abstract schema
* Fix PHP warnings in abstract route
* Update shipping phone handling
* Includes are handled in core now
* Remove maybe_update_order_from_customer
* Add cart_updated routine to all cart routes
* Remove abstract method
* Remove test for woocommerce_blocks_cart_update_order_from_customer_request
* Remove do_order_callback
* Update readme
* Update tests
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Luigi <gigitux@gmail.com>
* Link order controller to cart routes
* Remove order controller from checkout route
* Fix PHP warnings in abstract schema
* Fix PHP warnings in abstract route
* Update shipping phone handling
* Includes are handled in core now
* Remove maybe_update_order_from_customer
* Add cart_updated routine to all cart routes
* Remove abstract method
* Remove test for woocommerce_blocks_cart_update_order_from_customer_request
* Remove do_order_callback
* Clarify docs for STARTED
* Clarify docs for setActivePaymentMethod
* Remove useActivePaymentMethod hook (this held state for active methods and tokens)
* Update type defs
* Enhance setActivePaymentMethod action to accept method data
* SET_ACTIVE_PAYMENT_METHOD action
* Add setActivePaymentMethod dispatcher and make "started" status only
* Update setActivePaymentMethod usage in express methods
* Set radio control defaults
* Consolodate tokens and methods
* Update assets/js/base/context/providers/cart-checkout/payment-methods/reducer.ts
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Spacing
* Split saved cards tests from regular, since saved cards are checked by default
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Typedefs and cartData for the payment interface
* fix case on noticeContexts
* typeof for enums
* immutable note
* Add cartData to docs table
* Rebase docs
* Empty commit for release pull request
* Update readme.txt with release changelog
* Add testing instructions for 6.3.0 release
* Update testing instructions as MD tables didn't work
* Update testing instructions
* Update testing instructions
* Update testing instructions
* Update readme.txt
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update docs/testing/releases/630.md
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update readme.txt
* Update release zip in testing note
* Update testing instructions
* Remove feature gate condition for Legacy Template block (https://github.com/woocommerce/woocommerce-blocks/pull/5158)
* Update testing instructions
* Update testing instructions
* Update testing instructions
* Update readme.txt
* Update testing instructions
* Update testing instructions
* Update release zip in testing note
* Update testing instructions for SE templates
* Update testing instructions for SE templates II
* Update testing instructions
* Bumping version strings to new version.
* Empty commit for release pull request
* Fix state validation to compare state codes, and only validate if a country is given (https://github.com/woocommerce/woocommerce-blocks/pull/5132)
* Only get valid states from wc if there is a country
* Shared validation logic which uses keys
* Fix 'Country is required' error on the Cart block when updating shipping address (https://github.com/woocommerce/woocommerce-blocks/pull/5129)
* Fix error on the Cart block
* Created a cartIsHydrated variable in useStoreCart hook and used this to update the billing address in the internal state of the useCustomerData hook
* Fix the country is required error on the Cart page using refs
* Separate api calls to update shipping and billingUpdate billing and shipping addresses only when needed in API calls
* Remove redundant check for customerDataToUpdate
* remove use of refs in initial values
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Make order note block removable (https://github.com/woocommerce/woocommerce-blocks/pull/5139)
* unforce order note
* show block in inserter
* Mini Cart block fatal error caused by append_script_and_deps_src (https://github.com/woocommerce/woocommerce-blocks/pull/5142)
* Remove unused use statements
* Fix types for $script
* `get_script_from_handle` might return null so handle this case to prevent errors
* Missing escaping
* Replace do_action_deprecated with the WC equivalent (https://github.com/woocommerce/woocommerce-blocks/pull/5151)
* Remove feature gate condition for Legacy Template block (https://github.com/woocommerce/woocommerce-blocks/pull/5158)
* Update readme.txt
* Update testing instructions
* Bumping version strings to new version.
* Empty commit for release pull request
* Update readme.txt
* Add testing instructions
* Add testing notes to README.md
* Hide WooCommmerce block templates from Edit Post template dropdown (https://github.com/woocommerce/woocommerce-blocks/pull/5167)
* Hide WooCommmerce block templates from Edit Post template dropdown
* Add empty post_types value to template and update comments.
* Legacy Template Block: Remove the deletion lock (https://github.com/woocommerce/woocommerce-blocks/pull/5166)
Previously, our legacy template block was locked to prevent the users from
removing it. The block could however be removed by erasing the parent, so
this change allows the user to directly remove the block itself.
Also:
Closeswoocommerce/woocommerce-blocks#5163Closeswoocommerce/woocommerce-blocks#5109
* Update release zip
* Update release zip
* Update testing instructions
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Michael P. Pfeiffer <michael@cssconf.eu>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Alex Florisca <alexflorisca@gmail.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
* Empty commit for release pull request
* Update readme.txt with release changelog
* Add testing instructions for 6.3.0 release
* Update testing instructions as MD tables didn't work
* Update testing instructions
* Update testing instructions
* Update testing instructions
* Update readme.txt
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update docs/testing/releases/630.md
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update readme.txt
* Update release zip in testing note
* Update testing instructions
* Remove feature gate condition for Legacy Template block (https://github.com/woocommerce/woocommerce-blocks/pull/5158)
* Update testing instructions
* Update testing instructions
* Update testing instructions
* Update readme.txt
* Update testing instructions
* Update testing instructions
* Update release zip in testing note
* Update testing instructions for SE templates
* Update testing instructions for SE templates II
* Update testing instructions
* Bumping version strings to new version.
* Release: 6.3.1 (https://github.com/woocommerce/woocommerce-blocks/pull/5169)
* Empty commit for release pull request
* Fix state validation to compare state codes, and only validate if a country is given (https://github.com/woocommerce/woocommerce-blocks/pull/5132)
* Only get valid states from wc if there is a country
* Shared validation logic which uses keys
* Fix 'Country is required' error on the Cart block when updating shipping address (https://github.com/woocommerce/woocommerce-blocks/pull/5129)
* Fix error on the Cart block
* Created a cartIsHydrated variable in useStoreCart hook and used this to update the billing address in the internal state of the useCustomerData hook
* Fix the country is required error on the Cart page using refs
* Separate api calls to update shipping and billingUpdate billing and shipping addresses only when needed in API calls
* Remove redundant check for customerDataToUpdate
* remove use of refs in initial values
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Make order note block removable (https://github.com/woocommerce/woocommerce-blocks/pull/5139)
* unforce order note
* show block in inserter
* Mini Cart block fatal error caused by append_script_and_deps_src (https://github.com/woocommerce/woocommerce-blocks/pull/5142)
* Remove unused use statements
* Fix types for $script
* `get_script_from_handle` might return null so handle this case to prevent errors
* Missing escaping
* Replace do_action_deprecated with the WC equivalent (https://github.com/woocommerce/woocommerce-blocks/pull/5151)
* Remove feature gate condition for Legacy Template block (https://github.com/woocommerce/woocommerce-blocks/pull/5158)
* Update readme.txt
* Update testing instructions
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Alex Florisca <alexflorisca@gmail.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Michael P. Pfeiffer <michael@cssconf.eu>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Alex Florisca <alexflorisca@gmail.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Add cartItemClass filter for cart line items
* Add cartItemClass, originally implemented in 96f18443bc
* add filter to order summary items
Co-authored-by: Manos Psychogyiopoulos <psyx@somewherewarm.net>
* Deprecate __experimental_woocommerce_blocks_checkout_update_order_meta
* Update docs to show new action and remove deprecated one
* Amend deprecated tag and add version numbers
* Resolve conflict where old hook name was included in example docs
* Deprecate __experimental_woocommerce_blocks_checkout_update_order_from_request
* Update docs to show new action and remove deprecated one
* Ensure correct args are passed to deprecated hook and update message
* Amend deprecated tag and add version numbers
* Remove incorrectly updated file from this PR