* Migrate Storybook to 6.4.0 and enable auto-detection of controls (https://github.com/woocommerce/woocommerce-blocks/pull/5249)
Previously our Babel configuration conflicted with the one provided by
default by Storybook, making us unable to leverage the automatic
detection of properties from both JS and TS components to create
controls (formerly known as knobs).
Upgrading to 6.4.0 fixes a bug that makes it easier to work with
Babel configurations. Also done here:
* Removed a few deprecated addons in favor of the replacement ones
bundled within Storybook Essentials.
* Add auto-detection of certain control types depending on the property names
* Add support for TS stories
More context: https://github.com/storybookjs/storybook/issues/12292
* Use `react-docgen` only in development environments
This should reduce production bundle size dramatically. The only
problem here is that Storybook runs its `build` command with the
`NODE_ENV` set to `production`. For this reason, we change the
script to provide `BABEL_ENV` set to `development` to still make sure
the correct configuration is loaded, while trying to reduce any
side-effects on changing the whole `NODE_ENV`.
* Add global style for product categories list block woocommerce/woocommerce-blocks#4965
Add global style for product categories list block
* add support for link color
* add feature flag
* fix code style and PHP warning
* update doc comment
* remove empty space
* refactor StyleAttributesUtils (https://github.com/woocommerce/woocommerce-blocks/pull/5277)
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Mini Cart Block: add link to edit template part from sidebar woocommerce/woocommerce-blocks#5186
Mini Cart Block: add link to edit template part from sidebar
* fix e2e tests
* Product details metadata now accepts as a default prop, with as an optional alternative
* Updated product details test snapshot
* Don't overwrite key prop
* One of key or value must be entered in ProductItemResponseData type
* Convert ReturnToCartButton component to TS
* Convert FormStep component to TS
* Remoe proptypes from FormStep and AddressFormn components
* Converted order-summary component to TS
* Convert product-price component to TS
* alias path to type-defs
* Fix errors
* Changes from Thomas feedback
* Change minPrice maxPrice logic to be more robust
* Changed types from inline to interface in ReturnToCartButton component
* Check for string type in order-summary-item
* add missing isString check
On the front-end, checkboxes with labels would look squished when the labels wrapped
on a second line. That was due to the flex container taking too much space for the label
as the checkbox minimum dimensions was set in `px` rather than `em`, making it work
differently depending on the relative font size.
* Fix Mini Cart block when Gutenberg is not enabled
* Escape Mini Cart template part
* Avoid creating $part variable
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Within the editor, the checkbox appeared aligned at the bottom of the paragraph, while
on the front-end it would appear aligned at the top. The alignment was actually correct
but a top margin was assigned to checkboxes in the backend.
Instead of removing that globally, this commit resets it for checkboxes within the checkout
block.
* 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>
* Add file and folder structure documentation
* Update docs/contributors/folder-structure.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update docs/contributors/folder-structure.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update docs/contributors/folder-structure.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update description for atomic blocks in folder documentation
* Update description for base blocks in folder documentation
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add test environment to catch errors
* Add jest-circus and jest-html-reporters
This is so we can log the screenshots and errors that happen during E2E tests.
* Use the jest reporters and jest-circus to run the E2E tests
* Force cart test to break
Revert this!
* Upload jest report artifact when tests fail
* Run artifact upload on failure
* Upload entire report directory to artifact
* Revert "Force cart test to break"
This reverts commit c57f2c5ab1d7b60d8824d854c1cb9a8281a71c4b.
* Update .gitignore and jest.config
* Force cart test to break
* Force cart test to break
* Remove <rootDir> from jest-html-reporter path
This was causing the artefact not to upload.
* Revert "Force cart test to break"
Co-authored-by: Niels Lange <info@nielslange.de>
* Add documentation guidelines
* Link to Automattic Writing Style Guide
* Adjust section for heading usage
* Update docs/contributors/documentation-guidelines.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Convert product elements shared config to TypeScript
* Limit import to type
* Convert deprecated empty save function
* Add comment explaining omitted attributes and title properties
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
This is a better representation of the node and npm version support for Woo Blocks (more notably the NPM 7 exclusion) which can help new contributors coming into the repository.
* Document DOM events used in WC Blocks
* Update docs/extensibility/dom-events.md
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Calculate human readable price values for the purpose of screen readers and set them as the aria values
* Calculate human readable price values for the purpose of screen readers and set them as the aria values
* Update API to add default boolean to attribute values and use this within the component to set the default attributes.
* Modify and add unit tests for isObject and getDefaultAttributes
* Sanitize attribute name to accommodate for custom attributes being default values.
* Comments for sanitized_attribute_name variable
* Remove second argument from getAttributes
* Replace context with __experimentalShareWithChildBlocks
* Switch to parent block when changing views
* Swap order of views
* Drop default, use first view
* Improve block selection after changing views
* WIP getting to work on frontend
* restore frontend.tsx
* fix layout
* support emtpy cart in frontend
* add cart tital to correct place and move useEffect
* Improve the type for callbacks registered by extensions
The previous type was CanMakePaymentCallback, used for the payment methods's own canMakePayment callbacks, which could also return Promises. In order to eliminate the confusion, a new type has been created that defines callbacks that only return true or false.
* Document registerPaymentMethodExtensionCallbacks
* Update docs/extensibility/filtering-payment-methods.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Add information about payment method name in documentation
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* WIP getting to work on frontend
* restore frontend.tsx
* fix layout
* remove unit tests living where they shouldn't be living
* remove skeleton
* support emtpy cart in frontend
* remove extra todo
* use fragment instead of div
* Add empty cart event
* Remove extra fragment
* Add cartCoupons to canMakePayment argument
* Add cart to the paymentMethodArgument and improve the dependencies for the effect calling refreshCanMakePayments
* Debounce refreshCanMakePayments
The initial approach was to debounce billingData and use this value as a dependency for the useEffect that runs refreshCanMakePayments.
But because the depencies array can always change we decided to debounce the callback instead, ensuring this way that callback is not called multiple times: for example when typing a field in the billing address. Debounced was chosen instead of throttle because we want to call refreshCanMakePayments once the change event has stopped, with the final value.
* Update types and docs related to canMakePaymentArgument
* Mock the /cart call when testing payment methods
* Remove unused cartCoupons key in canMakePaymentArguments' interface
* woocommerce/woocommerce-blocks#3906 screen reader fix for order summary block
* removing tabIndex and extra accesibility text
* adding aria-hidden to total price and translation comments change order
* Support express payment methods filtering by extensions
* Add tests for getCanMakePayment and fix payment tests' TS errors
* Add comments for payment-method-config-helper test