* Reference the WooCommerce DEWP instead of WPDEWP
* Apply suggestions from code review
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Format with decimal and thousands, with tests
* Update packages/prices/utils/price.ts
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Fix wrong event prefix in doc comment
* Make className prop in CartLineItemsTableProps optional
* Mini Cart as template part
* Remove BlockTemplatePartsController and instead use BlockTemplatesController
* Remove old code
* Clean up frontend rendering
* Update tests
* Improve if clause
* Fix wrong tests title
* Fix wrong variable name
* Make sure Mini Cart contents block is unmounted whem mini cart closes or unmounts
* Remove unnecessary waitFor
* Fix PaymentMethodDataProvider wrong children type
* TypeScript fixes
* Make comment shorter
* Remove test code
* Fix contant unmounts of Mini Cart contents block
* Fix wrong template_type passed
* Set Template part area to 'uncategorized'
* Set Template part area to the correct value
* Move template dir check outside loop
* 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>
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
* 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>
* Remove unused use statements
* Fix types for $script
* `get_script_from_handle` might return null so handle this case to prevent errors
* Missing escaping
* 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>
* Added a placeholder to the product search block editor to indicate that the user can change the placeholder on the front end
* Changed the placeholder to be translatable
* Improve title for edit button woocommerce/woocommerce-blocks#1689
Improve title for edit button
* fix edit title for Product By Attribute and All Products blocks
* 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>
* Bump dependencies to fix e2e on m1 macs
* Disable welcome guide more reliably - see 3da717b8d0/packages/e2e-test-utils/src/create-new-post.js
* Update selectors and fixture data for cart block
* unused dep
* Remove duplicate block wrapper
* Remove unused jest configuration files
* More robust click in view switcher test
* Revert fixture data change
* Add hydration for product data for single product block woocommerce/woocommerce-blocks#2698
Add hydration for product data for single product block
* cast product_id variable
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update taxonomy templates so Legacy Template blocks don't take all available width
* Add closing comments for Group block
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Ensure $template is object before accessing properties
This is necessary because the gutenberg helper functions sometimes turn it into a WP_Block_Template object, and other times it's an array. Because of this it's safer to normalise them both as objects.
* Add Gutenberg utils for processing templates based on a post from the db
When a template is saved it gets saved to the database, we need to handle processing these WooCommerce templates that have been saved in the db and we need to use the gutenberg utils that are private, this is why they've been copied over.
* Force theme to always be WooCommerce
This is because the templates we're dealing with here should always belong to WooCommerce, not the currently selected theme
* Add maybe_return_blocks_template and get_single_block_template funcs
These are needed to get the template from either the DB or the filesystem when saving/retrieving the template.
* Set theme to always be woocommerce when making templates from files
This will ensure the correct slug is used in the gutenberg editor.
* Check if template has been customised and saved in the database first
* Prevent filesystem templates being used if a custom database one exists
* Fix syntax error from rebase
* Remove unnecessary code from BlockTemplateUtils
* Ensure template item is an object containing correct properties
* Prevent warnings from appearing
* Ensure title is added to the template when saving
* Filter templates that don't match the queried slug.
* Remove unused code
* Check if a saved version of the template exists when trying to render
* Rename default_block_template_is_available to block_template_is_available
* Re-hook pre_get_block_template before returning from maybe_return_blocks_template
* Make comment easier to read
* Look for template in woocommerce theme or real theme taxonomy
* Remove duplicated title assignment
* Prevent template being added twice when loading from the db
* Filter templates before returning if slugs are supplied
* Simplify `get_block_templates` function into two functions
* Add function to stop theme templates that are added after db ones showing
* Fix typographical errors
* Fix sanitization callback
* Add test case to confirm sanitization callbacks work for nested properties
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Remove withRestApiHydration
* Preload checkout data via setting - server data is required for this block
* Handle cart hydration using createPreloadingMiddleware which removes the need for HOCs
* Rename variable
* Remove withStoreCartApiHydration and timestamp checking
* Empty test file
* Add the Archive Product block template
* Use template slug if no template title is set
* Add page icon as per design
* Add the basic archive product block template
* Copy logic from Gutenberg to ensure the correct templates are being included in the get_block_templates query
* Utility function to convert template slugs to template titles
* i18n strings for template names
* 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
* Deprecate __experimental_woocommerce_blocks_checkout_order_processed
* Update docs to reflect new hook name
I also mentioned this hook is deprecated in the experimental interfaces doc.
* Update deprecated tag in docblock
* Fix typo in deprecated docblock
* Send args to do_action_deprecated in an array
* Amend deprecated tag and add version numbers
* Add render logic to BlockTemplatesController
* Comment out action to test e2e tests
* Add add_action back into initialise render method
* Check function exists before using it
* Change hook from wp to template_redirect
* Update src/BlockTemplatesController.php
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Legacy Template block
* Return render_single_product value
* Make placeholder text translatable
* Don't allow removing the block
* Update block title
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Empty commit for release pull request
* Update readme.txt with release changelog
* Add testing instructions for 6.2.0 release
* Return an element instead of a component in useViewSwitcher (https://github.com/woocommerce/woocommerce-blocks/pull/5016)
* return element instead of component in viewSwitcher
* use ToolbarGroup instead of Toolbar
(cherry picked from commit ad133ba901)
* Update release zip in testing note
* 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: Seghir Nadir <nadir.seghir@gmail.com>
* Add inline note around displayWithTax to clarify why prices change
* update snaps
* Snap update
* Clarify docs further for displayCartPricesIncludingTax
* Update assets/js/previews/cart.ts
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
* Make Mini Cart block react to removed_from_cart events
* Move listening to add to cart and remove from cart events to the useStoreCart hook
* Add tests
* move empty cart
* remove Cart and rename Cart i2 to Cart
* graduate blocks
* setup template migration from Cart i1 to Cart i2
* back to js so we have a good diff
* add migration
* fix bug in empty cart template
* add useForceLayout hook to edit
* migrate from old block to new block
* migrate styles
* respect align
* add tests
* Include latest cart line item improvements from cart-i1
* Missing changes from cart-i1
* Line items table should be disabled
* Fix e2e tests for cart i2
* update tests to adapt for inner blocks
* update select to resolveSelect to remove warning checker
* rename test/block to test/index
* move blocks to their own file
* undo rename to keep diff clean
* remove .tsx and update jest config
* Revert "update select to resolveSelect to remove warning checker"
This reverts commit 79d55de30edcfe36bbdfe7506df7a09460824f03.
* revert resolveControl
* Fix empty cart editor E2E test by scrolling to the view switch
* parse attributes for order summary block
* migrate attributes when resaving
* Update documentation
Automatic update after running npm run build:docs
* add classname support to accepted payment methods block
* add classname support to express payment methods block
* add classname support to cart items block
* add classname support to cart line items block
* add classname support to order summary block
* add classname support to totals block
* add classname support to empty cart block
* add classname support to filled cart block
* add classname support to proceed to checkout block
* type edit
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* move empty cart
* remove Cart and rename Cart i2 to Cart
* graduate blocks
* setup template migration from Cart i1 to Cart i2
* back to js so we have a good diff
* add migration
* fix bug in empty cart template
* add useForceLayout hook to edit
* migrate from old block to new block
* migrate styles
* respect align
* add tests
* Include latest cart line item improvements from cart-i1
* Missing changes from cart-i1
* Line items table should be disabled
* Fix e2e tests for cart i2
* update tests to adapt for inner blocks
* update select to resolveSelect to remove warning checker
* rename test/block to test/index
* move blocks to their own file
* undo rename to keep diff clean
* remove .tsx and update jest config
* Revert "update select to resolveSelect to remove warning checker"
This reverts commit 79d55de30edcfe36bbdfe7506df7a09460824f03.
* revert resolveControl
* Fix empty cart editor E2E test by scrolling to the view switch
* parse attributes for order summary block
* migrate attributes when resaving
* Update documentation
Automatic update after running npm run build:docs
* add align options to filled cart and empty cart
* append instead of replcae
* import style.scss in frontend
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* wip: add product on sale test
* test: add fixture for product on sale test
* try: permission
* Revert "try: permission"
This reverts commit f8eb09c0152a567383e93c18f61e91fdadd13c40.
* test: basic e2e test for products by category block
* test: basic e2e test for products by tag block
* add basic test for products by attribute block
* trigger build
* fix: slug
* Convert sharedConfig and Title blockConfig to TS
* Convert constants.tsx to TS
* Convert attributes.js to TS
* Amend attributes.ts record type
* Convert title component edit.js to TS
* Convert title component block.js to TS
* Amend product name index.tsx to prevent TS errors in product title block.tsx
* Amend product-name and base tsconfig
* Add rel to ProductName component element
* Replace ReactElement with JSX.Element
* Move TagName component to outside of the main component
* Add HTMLAttributes import
* WIP: Add props to TagName component
* Fix TagName typing
* Update TagName interface
* Replace ReactElement typing with JSX.Element
* Code review feedback amends
* Replace return type undefined to void
Co-authored-by: Michael P. Pfeiffer <michael@cssconf.eu>
* Pass classname from DOM to react components
* Actions Block ClassName support
* Form step field classname support
* Payment block className support
* Classname support for fields and totals
* Order summary classname support
* Classname support for order note block
* Express payment classname support
* Terms block custom class
* Let useBlockProps handle class in actions block
* add handleMap
* remove useValidation from cart blocks
* add namespace options to docs
* Update packages/checkout/blocks-registry/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* expand on the docblock
* Update packages/checkout/blocks-registry/README.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Remove icons from checkout button
* Add new block type
* Register new block
* Remove unused attribute
* Add to new template
* Remove duplicate attributes
* Update Inner Block handling to use consistent appender and unlock payment methods
* Add dark mode inputs toggle to top level block
* Remove top level attributes which moved to inner blocks
* Remove unused components
* Pass down hasDarkControls and currentView via context props
* Update default empty template on server side
* template->registeredBlocks wording
* useForcedLayout: insert in correct place
* Remove test div
* Clarify inline docs
* Apply changes to cart block
* Empty commit for release pull request
* Update readme.txt with release changelog
* Add testing instructions for 6.1.0 release
* Update readme.txt with release changelog
* woocommerce/woocommerce-blocks#4625 product categories list block hierarchy display fix (https://github.com/woocommerce/woocommerce-blocks/pull/4920)
* Update link to testing zip
* Remove mini cart testing from instructions
This is because mini-cart is only in experimental builds.
* Update changelog and testing notes
* Correct typo in testing instructions
* Update testing instructions
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Ovidiu Liuta <ovidiu.liuta@automattic.com>