* Mini Cart Contents block: set minimum width
* Mini Cart Contents block: allow changing the width only in the feature plugin
* Allow resetting the Mini Cart Contents width to the default
* Update assets/js/blocks/mini-cart/mini-cart-contents/edit.tsx
Co-authored-by: Karol Manijak <karol.manijak@automattic.com>
---------
Co-authored-by: Karol Manijak <karol.manijak@automattic.com>
* Add class property to track local pickup enabled
* Force shipping enabled only when local pickup is also enabled
Otherwise, skip filtering and leave it to the current value
* Disabled and add text to WC Core hide shipping option
* Skip forcing shipping to be enabled in all cases
* Remove WC Core setting changes for hidden shipping rates option
* Add warning to local pickup UI about hidden rates setting in core
* Add local_pickup_enabled util function
* Revert "Skip forcing shipping to be enabled in all cases"
This reverts commit 0bf1886e73d791f7828ac86988f681cdce808b12.
* Check if local pickup is enabled before force enabling shipping
* Show correct shipping placeholder if rates hidden until address entered
* Remove tests for removed functionality
* Remove shippingCostRequiresAddress prop
* Update tests for shipping settings
* Remove irrelevant tests and fix existing ones
* Fix typo in comment
* Disable local pickup after each test
* Get shipping data from useCustomerData hook
* Change div in help prop to span
This prevents a DOM Nesting error, div cannot appear as a descendant of p
* Prevent hide shipping notice showing if the setting was originally off
* Use body background color as the Cart block sticky footer background color
* Reduce the opacity of box-shadow.
* Fix the Proceed to Checkout button cut off.
* Fix infinite loop (range error) on subscribe callback.
* Replace getEditedPostContext with getEditedPostId to retrieve the templateId from the Site Editor for 6.1.1 compatibility
---------
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
* Don't use withProductDataContext in Sale Badge block
There was no information about product passed to the block, so it fetched information about all products which then wasn't even used
* Pass necessary props to the Sale Badge so it doesn't overfetch unnecessary data
* Move the import to the previous place
* Add color, typography, and spacing support to Product SKU block
This commit introduces a new file `supports.ts` for the Product SKU block in the WooCommerce Blocks plugin, which adds color, typography, and spacing support. The following configuration has been added:
1. In `assets/js/atomic/blocks/product-elements/sku/supports.ts`, a new `supports` object is created, which extends the shared configuration and adds support for the following properties:
- `text` and `background` color
- `fontSize`, `lineHeight`, `__experimentalFontWeight`, `__experimentalFontFamily`, `__experimentalFontStyle`, `__experimentalTextTransform`, `__experimentalTextDecoration`, and `__experimentalLetterSpacing` for typography
- `margin` and `padding` for spacing
* Add color, typography, and spacing support for Product SKU block in All Products block
This commit extends the support for color, typography, and spacing to the Product SKU block when used within the All Products block. The following changes have been made:
1. In `assets/js/atomic/blocks/product-elements/sku/block.tsx`, the `useColorProps`, `useSpacingProps`, and `useTypographyProps` hooks are imported and used to add the appropriate className and style properties to the rendered SKU element.
2. In `assets/js/atomic/blocks/product-elements/sku/edit.tsx`, the `style` property is separated from `useBlockProps()` and used directly on the `div` element for the SKU block.
* Add server-side rendering class for Product SKU Gutenberg block
This commit adds the ".wp-block-woocommerce-product-sku" class to the Product SKU Gutenberg block for server-side rendering purposes. The inclusion of this class ensures consistent styling between the editor and the front-end view of the block, providing a seamless experience for users.
The class name is generated based on the Gutenberg block prefix "wp-block", the namespace "woocommerce", and the block name "product-sku", creating a unique and identifiable class for the block. This class enables developers to target the block specifically in both the editor and front-end styles, maintaining the integrity of the block's appearance and functionality across different environments.
By adding this class to the server-side rendered version of the block, we ensure a unified and coherent styling experience throughout the block's usage.
* Fix minor issues
* Gate only experimental features behind isFeaturePluginBuild flag
This commit refactors the Product SKU block supports to enable color, typography, and spacing features for all builds, while keeping experimental features specific to the feature plugin build. It also adds necessary lint and TypeScript error handling for the experimental spacing API.
* Add overflow-wrap to Product SKU block and update comment
This commit adds the overflow-wrap property to the Product SKU block styles to handle long SKU values gracefully.
It also updates the comment for the experimental spacing API to better reflect the usage check.
* Refactor Product SKU block classname and style handling
This commit refactors the Product SKU block classname and style handling. It combines classnames for better readability and removes the hardcoded textTransform style in favor of default styles.
This also fix the issue where textTransform style was not working as expected.
* Add support for color, typography and spacing to stock indicator block
This commit updates the stock-indicator block support in the woocommerce-blocks repository. It includes the following changes:
- Added support for background color, line height, and various experimental typography features.
- Conditionally included support for margin and padding based on the availability of the __experimentalGetSpacingClassesAndStyles function from the @wordpress/block-editor package.
These updates provide more customization options for the stock-indicator block, allowing users to better match the appearance of this element to their site's design.
* Refactor stock text generation and apply minor style adjustments
This commit introduces a new function, `getTextBasedOnStock`, which handles the generation of stock text based on the stock information provided. It replaces the previous `lowStockText` and `stockText` functions, making the code more readable and maintainable.
In addition, minor adjustments to the class name handling have been made to simplify the code and ensure consistent styling when used inside the All Products block.
In the `edit.tsx` file, the `useBlockProps` function call has been updated to include the default `wc-block-components-product-stock-indicator` class name, ensuring it is always applied.
* Remove redundant block type supports in ProductStockIndicator
This commit removes the redundant get_block_type_supports() method from the ProductStockIndicator.php file, as it is no longer needed. The block type supports are now handled in the frontend.
* Create the counter block and the header pattern
* Change the pattern to an inner block
* Allow customizing item counter block
* Rename block
* Allow removing the items counter block
* Add padding controls
* Preload new blocks
* Add title block back from the inserter
* Move h2 tag to the parent title
* Align items at the bottom
* Unify styles
* Add title class in the editor
* Prevent removing title blocks
* Disallow unlocking and inserter
* Disallowing moving blocks
* Introduce the new get_attribute_and_meta_counts method.
* Ensure that if no term_slug or term_id is found for counting, the default list with all terms (with count equal zero) is returned instead.
* update conditional for the slug, the empty state for requests without filter attributes and the condition query for 'and'
* Introduce the get_terms_list method.
* Remove the legacy get_attribute_counts method and update its calls to rely on the new get_attribute_and_meta_counts method instead.
* Update the query to ensure that if a parent product has multiple identical attributes, they are counted once.
* Update to start relying on the get_product_by_metas method for counting product metas
* Add a new where_clause to only include product metas and attributes in the macro query if they are not empty.
* Add wpdb->prepare to the macro query and the get_terms_list method.
* Replace the raw atomic query for fetching the filtered terms with the new get_product_by_filtered_terms method.
* Update the request params for the get_attribute_and_meta_counts method.
* Update the request params for the product metas (min and max price).
* Update the query and returned value on get_terms_list.
* Update the validation for returning the default counts when no values are filtered.
* Update the query on get_terms_list to use ->prefix
* Update the variable for the query to rely on the filtered one. Update the min_price and max_price format on get_product_by_metas.
* Ensure the get_product_by_filtered_terms method is triggered for each one of the filtered terms and update the macro query to include those term ids on the WHERE clause.
* Make adjustments for the 'and' condition to work as expected.
* Ensure the queryState.attributes is properly added as a param to the API request to correctly fetch the attribute count data.
* Ensure the get_product_by_metas method is only triggered when at least one of the metas in the request is not empty.
* Join type update: for the 'and' (all) filter condition, items with the count zero are not displayed.
* wpdb prepare the where clauses
* Update the get_product_by_filtered_terms query wpdb prepare params
* update the get_product_by_metas method's where clause preparation.
* Update the where clause preparation for get_attribute_and_meta_counts so we don't rely on interpolated variables anymore.
* Adjust the get_attribute_and_meta_counts method for usage alongside the rating filter.
* Adjust the query for fetching the attribute counts for filtered ratings.
* Add support for the filter by stock.
* Ensure the product attribute counts are correct if the parent product receives a rating.
* Ensure product_or_parent_id is used only when the filter by rating is used, not affecting price or stock filters.
* Add the missing else condition.
* Enable caching.
* Address CR
* Update query for average rating.
* remove file accidentally commited.
* When multiple ratings are selected, make sure the where clause is updated accordingly for each one of them.
* Start updating the stock_status logic to account for when multiple options are selected by the user.
* Ensure the counts are properly updated when more than one stock status is selected.
* Ditch the is_array condition for the average_rating counts as is always an array.
* Deprecate the second param attributes for the get_attribute_counts method.
* Add the filtered_attribute to the transient_key
* Bypass cache if WP_DEBUG is enabled.
* Update formatting for macro query.
* Fix mixed tabs spaces on query
* Update spacing/formatting for SQL queries.
* Minor: update indentation for the main SQL query
---------
Co-authored-by: roykho <roykho77@gmail.com>
* Add block minimal structure
* Add Single Product block icon
* Add usesContext to block.json
* Add Save function to Single Product Block registration settings
* Add InnerBlocks template to Editor for Single Product Block
* Add Product selector to Single Product block
* Add withProduct HOC to the block editor
* Add save function to the Single Product block
* Add renderOnServerSide attribute to Product image
This attribute is used to determine if the product image should be rendered on the server side or not. This is needed because the product image is not rendered on the server side by default, but we want to render it on the server side when it is inside the Single Product block.
* Add renderOnServerSide attribute to Product Category List block
* Add renderOnServerSide attribute to Product Price block
* Add renderOnServerSide attribute to Product Rating block
* Add renderOnServerSide attribute to Product Stock Indicator block
* Add renderOnServerSide attribute to Product Summary block
* Add renderOnServerSide attribute to Product Tag List block
* Add renderOnServerSide attribute to Product Title block
* Add renderOnServerSide attribute to Product Add to Cart, Sales Badge and Sku block
* Reuse editor code for Single Product block
* Add Props interface to Single Product Server Side Editor
* Add render_block_context hook to SingleProductServerSide block
* Fix Single Product Server Side block that was not appearing in the block inserter
* Fix bug where the correct product was not being displayed on the frontend
* Remove Single Product Block
* Add Product title and product summary variations
* Add Add To Cart Form and Product Meta blocks to the Single Product Block
* remove more files that belong the Single Product block
* fix php linter error
* wrap up Single Product Block
* Fix issue preventing the block from working on the Single Product Template
* Fix update context function for Single Product block
* Replace Single Product block title
* Replace global $post only for Single Product inner blocks
* Remove unnecessary var_dump statement
* Improve documentation for the Single Product block
* fix registration: add-to-cart-form and product-meta blocks
* Improve documentation for Single Product block
* Fix lint error related to imports
* Remove query monitor debug code
* Remove unnecessary `renderOnServerSide` attribute from product elements
* Fix return type for the Save function of the Product Elements blocks
* Fix return type for the Save function of the Product Title block
* Add scss file for Single Product block
* Fix PHP coding standards
* Fix php coding standards
* Remove internal dependencies section duplication
* Replace .wc-block with .wc-block-editor- styles
According to the naming convention for this project (https://github.com/woocommerce/woocommerce-blocks/blob/trunk/docs/contributors/contributing/coding-guidelines.md#naming) we should be using the `.wc-block-editor-` prefix for styles that are only used in the editor.
* Solve style for the Edit card component in the Single Product block
* Fix error preventing Block Control from being displayed
* Make the Product title to be a link by default
* Fix PHP Coding Standards
* Fix PHP Code Standards
* Fix php cs issues
* Fix issue with php cs
* Remove unnecessary comment
* Remove unused Icon import
* Remove unnecessary dot from the className attributes in the Single Product Block
* Replace metadata.name with metadata.title in the Editor file
* Ignore phpcs rule
* Add new attributes to the Attributes interface of the Price block
* Fix typescript errors on the Product Meta block
* Fix ts errors on Single Product editor
* Fix ts errors on layout-editor.tsx
* Fix ts errors in Single Product index file
* Fix ts errors on add to cart form index file
* Fix unsupported block error when using inner blocks outside the Single Product template
* Fix unsupported block error for the Single Product block when editing Posts/Pages
* Remove unnecessary JSDoc types
* Remove unnecessary APIError component
* Replace global $post only when rendering a `core/post-excerpt` block
* Fix php cs errors
* Put the Single Product block behind an experimental flag
* Enable Single Product block preview
---------
Co-authored-by: Luigi <gigitux@gmail.com>
* Add block minimal structure
* Add Single Product block icon
* Add usesContext to block.json
* Add Save function to Single Product Block registration settings
* Add InnerBlocks template to Editor for Single Product Block
* Add Product selector to Single Product block
* Add withProduct HOC to the block editor
* Add save function to the Single Product block
* Add renderOnServerSide attribute to Product image
This attribute is used to determine if the product image should be rendered on the server side or not. This is needed because the product image is not rendered on the server side by default, but we want to render it on the server side when it is inside the Single Product block.
* Add renderOnServerSide attribute to Product Category List block
* Add renderOnServerSide attribute to Product Price block
* Add renderOnServerSide attribute to Product Rating block
* Add renderOnServerSide attribute to Product Stock Indicator block
* Add renderOnServerSide attribute to Product Summary block
* Add renderOnServerSide attribute to Product Tag List block
* Add renderOnServerSide attribute to Product Title block
* Add renderOnServerSide attribute to Product Add to Cart, Sales Badge and Sku block
* Reuse editor code for Single Product block
* Add Props interface to Single Product Server Side Editor
* Add render_block_context hook to SingleProductServerSide block
* Fix Single Product Server Side block that was not appearing in the block inserter
* Fix bug where the correct product was not being displayed on the frontend
* Remove Single Product Block
* Add Product title and product summary variations
* Add Add To Cart Form and Product Meta blocks to the Single Product Block
* remove more files that belong the Single Product block
* fix php linter error
* wrap up Single Product Block
* Fix issue preventing the block from working on the Single Product Template
* Fix update context function for Single Product block
* Replace Single Product block title
* Replace global $post only for Single Product inner blocks
* Remove unnecessary var_dump statement
* Improve documentation for the Single Product block
* fix registration: add-to-cart-form and product-meta blocks
* Improve documentation for Single Product block
* Fix lint error related to imports
* Remove query monitor debug code
* Remove unnecessary `renderOnServerSide` attribute from product elements
* Fix return type for the Save function of the Product Elements blocks
* Fix return type for the Save function of the Product Title block
* Add scss file for Single Product block
* Fix PHP coding standards
* Fix php coding standards
* Remove internal dependencies section duplication
* Replace .wc-block with .wc-block-editor- styles
According to the naming convention for this project (https://github.com/woocommerce/woocommerce-blocks/blob/trunk/docs/contributors/contributing/coding-guidelines.md#naming) we should be using the `.wc-block-editor-` prefix for styles that are only used in the editor.
* Solve style for the Edit card component in the Single Product block
* Fix error preventing Block Control from being displayed
* Make the Product title to be a link by default
* Fix PHP Coding Standards
* Fix PHP Code Standards
* Fix php cs issues
* Fix issue with php cs
* Remove unnecessary comment
* Remove unused Icon import
* Remove unnecessary dot from the className attributes in the Single Product Block
* Replace metadata.name with metadata.title in the Editor file
* Ignore phpcs rule
* Add new attributes to the Attributes interface of the Price block
* Fix typescript errors on the Product Meta block
* Fix ts errors on Single Product editor
* Fix ts errors on layout-editor.tsx
* Fix ts errors in Single Product index file
* Fix ts errors on add to cart form index file
* Fix unsupported block error when using inner blocks outside the Single Product template
* Fix unsupported block error for the Single Product block when editing Posts/Pages
* Remove unnecessary JSDoc types
* Remove unnecessary APIError component
* Replace global $post only when rendering a `core/post-excerpt` block
* Fix php cs errors
* Put the Single Product block behind an experimental flag
* Fix error occurring when trying to access ancestor of an undefined block settings
* Fix Product Image appearing with different size on the Frontend
* Fix PHP Code Standards errors
* Remove JS Doc from shared-product-control.tsx
* Fix single-product-frontend.js 404 error
* Fix error 'Block names must be string' when adding Single Product block
* Add todo comment to state the temporary solution used in the Single Product block
* Set imageSizing attribute on Product Query and Single Product blocks
* Rename values for image size options in the product image block
The previous allowed values were 'cropped' and 'full-size'. The new values are 'thumbnail' and 'single' which are similar to the values used in WooCoomerce.
WooCommerce uses 'woocommerce_thumbnail', 'woocommerce_gallery_thumbnail' and 'woocommerce_single' for images sizes. The 'woocommerce_single' size is used for the Single Product page and the 'woocommerce_thumbnail' size is used for the product grid.
* Fix Related Products image to show as a thumbnail instead of the full size
* Fix PHP CS error
---------
Co-authored-by: Luigi <gigitux@gmail.com>
* Add validateOnFirstFocus prop
* Only run validation on first focus if validateOnFirstFocus is true
* Rename validateOnFirstFocus to validateOnMount
* Set TotalsCoupon to not validate when the input is mounted
* Add tests for validation error handling
* Fix test that was not making a good assertion
* Add tests for validateOnMount functionality
* Clean up validateOnMount logic, make the code more readable & efficient
* Add block minimal structure
* Add Single Product block icon
* Add usesContext to block.json
* Add Save function to Single Product Block registration settings
* Add InnerBlocks template to Editor for Single Product Block
* Add Product selector to Single Product block
* Add withProduct HOC to the block editor
* Add save function to the Single Product block
* Add renderOnServerSide attribute to Product image
This attribute is used to determine if the product image should be rendered on the server side or not. This is needed because the product image is not rendered on the server side by default, but we want to render it on the server side when it is inside the Single Product block.
* Add renderOnServerSide attribute to Product Category List block
* Add renderOnServerSide attribute to Product Price block
* Add renderOnServerSide attribute to Product Rating block
* Add renderOnServerSide attribute to Product Stock Indicator block
* Add renderOnServerSide attribute to Product Summary block
* Add renderOnServerSide attribute to Product Tag List block
* Add renderOnServerSide attribute to Product Title block
* Add renderOnServerSide attribute to Product Add to Cart, Sales Badge and Sku block
* Reuse editor code for Single Product block
* Add Props interface to Single Product Server Side Editor
* Add render_block_context hook to SingleProductServerSide block
* Fix Single Product Server Side block that was not appearing in the block inserter
* Fix bug where the correct product was not being displayed on the frontend
* Remove Single Product Block
* Add Product title and product summary variations
* Add Add To Cart Form and Product Meta blocks to the Single Product Block
* remove more files that belong the Single Product block
* fix php linter error
* wrap up Single Product Block
* Fix issue preventing the block from working on the Single Product Template
* Fix update context function for Single Product block
* Replace Single Product block title
* Replace global $post only for Single Product inner blocks
* Remove unnecessary var_dump statement
* Improve documentation for the Single Product block
* fix registration: add-to-cart-form and product-meta blocks
* Improve documentation for Single Product block
* Fix lint error related to imports
* Remove query monitor debug code
* Remove unnecessary `renderOnServerSide` attribute from product elements
* Fix return type for the Save function of the Product Elements blocks
* Fix return type for the Save function of the Product Title block
* Add scss file for Single Product block
* Fix PHP coding standards
* Fix php coding standards
* Remove internal dependencies section duplication
* Replace .wc-block with .wc-block-editor- styles
According to the naming convention for this project (https://github.com/woocommerce/woocommerce-blocks/blob/trunk/docs/contributors/contributing/coding-guidelines.md#naming) we should be using the `.wc-block-editor-` prefix for styles that are only used in the editor.
* Solve style for the Edit card component in the Single Product block
* Fix error preventing Block Control from being displayed
* Make the Product title to be a link by default
* Fix PHP Coding Standards
* Fix PHP Code Standards
* Fix php cs issues
* Fix issue with php cs
* Remove unnecessary comment
* Remove unused Icon import
* Remove unnecessary dot from the className attributes in the Single Product Block
* Replace metadata.name with metadata.title in the Editor file
* Ignore phpcs rule
* Add new attributes to the Attributes interface of the Price block
* Fix typescript errors on the Product Meta block
* Fix ts errors on Single Product editor
* Fix ts errors on layout-editor.tsx
* Fix ts errors in Single Product index file
* Fix ts errors on add to cart form index file
* Fix unsupported block error when using inner blocks outside the Single Product template
* Fix unsupported block error for the Single Product block when editing Posts/Pages
* Remove unnecessary JSDoc types
* Remove unnecessary APIError component
* Replace global $post only when rendering a `core/post-excerpt` block
* Fix php cs errors
* Put the Single Product block behind an experimental flag
* Fix error occurring when trying to access ancestor of an undefined block settings
* Remove JS Doc from shared-product-control.tsx
* Fix single-product-frontend.js 404 error
* Fix error 'Block names must be string' when adding Single Product block
* Add todo comment to state the temporary solution used in the Single Product block
* Move the wp_reset_postdata outside the block name check condition
* Add comments about why we need to unregister the block on Single Product template
---------
Co-authored-by: Luigi <gigitux@gmail.com>
* Add default align attribute value for Cart block
* Add default align attribute value for Checkout block
* Update cart tests
* Check for not disabled insert button
* Add get_collectible_method_ids function
* Add collectibleMethodIds to asset data registry
* Remove unnecessary pluck and add pickup_location to returned array
* Add hasSelectedLocalPickup to shipping types
* show shipping address even if collecting
* Make checkout store set prefersCollection based on IDs from settings
* Move areRatesCollectible outside of hook
* Add pickup location component
* Show pickup location if user prefers collection
* Move prefersCollection check into ShippingAddress component
* Remove spread for collectibleMethodIds
Not needed now since pickup_location is included in the setting by default
* Check address metadata has a value before displaying it
* Add tests for ShippingAddress component
* Move PickupLocation specific tests to new file
* Ensure TotalsShipping shows only one package rate if local pickup chosen
* Update prefersCollection selector to use typeof check
* Use isPackageRateCollectible rather than checking against settings
* Do not show calculator button if local pickup rate is selected
* Update test to mock correct setting
* Remove unused method from ShippingController
* Check isPackageRateCollectable rather than checking settings array
* Update test to mock correct setting
* Change spelling of collectible to collectable
* Improve mocked useSelect function
Old one returned incorrect data shape for prefersCollection
* Remove duplicate import
* Remove express payment placeholders when there are no express payment methods
* Only use one instance of CartCheckoutFeedbackPrompt
* Show NoPaymentMethods notice in the inspector instead of the block
* Move privacy notices to inspector
* Unused hook
* Update tests to use mocks
* Add color, typography, and spacing support to Product SKU block
This commit introduces a new file `supports.ts` for the Product SKU block in the WooCommerce Blocks plugin, which adds color, typography, and spacing support. The following configuration has been added:
1. In `assets/js/atomic/blocks/product-elements/sku/supports.ts`, a new `supports` object is created, which extends the shared configuration and adds support for the following properties:
- `text` and `background` color
- `fontSize`, `lineHeight`, `__experimentalFontWeight`, `__experimentalFontFamily`, `__experimentalFontStyle`, `__experimentalTextTransform`, `__experimentalTextDecoration`, and `__experimentalLetterSpacing` for typography
- `margin` and `padding` for spacing
* Add color, typography, and spacing support for Product SKU block in All Products block
This commit extends the support for color, typography, and spacing to the Product SKU block when used within the All Products block. The following changes have been made:
1. In `assets/js/atomic/blocks/product-elements/sku/block.tsx`, the `useColorProps`, `useSpacingProps`, and `useTypographyProps` hooks are imported and used to add the appropriate className and style properties to the rendered SKU element.
2. In `assets/js/atomic/blocks/product-elements/sku/edit.tsx`, the `style` property is separated from `useBlockProps()` and used directly on the `div` element for the SKU block.
* Add server-side rendering class for Product SKU Gutenberg block
This commit adds the ".wp-block-woocommerce-product-sku" class to the Product SKU Gutenberg block for server-side rendering purposes. The inclusion of this class ensures consistent styling between the editor and the front-end view of the block, providing a seamless experience for users.
The class name is generated based on the Gutenberg block prefix "wp-block", the namespace "woocommerce", and the block name "product-sku", creating a unique and identifiable class for the block. This class enables developers to target the block specifically in both the editor and front-end styles, maintaining the integrity of the block's appearance and functionality across different environments.
By adding this class to the server-side rendered version of the block, we ensure a unified and coherent styling experience throughout the block's usage.
* Fix minor issues
* Gate only experimental features behind isFeaturePluginBuild flag
This commit refactors the Product SKU block supports to enable color, typography, and spacing features for all builds, while keeping experimental features specific to the feature plugin build. It also adds necessary lint and TypeScript error handling for the experimental spacing API.
* Add overflow-wrap to Product SKU block and update comment
This commit adds the overflow-wrap property to the Product SKU block styles to handle long SKU values gracefully.
It also updates the comment for the experimental spacing API to better reflect the usage check.
* Refactor Product SKU block classname and style handling
This commit refactors the Product SKU block classname and style handling. It combines classnames for better readability and removes the hardcoded textTransform style in favor of default styles.
This also fix the issue where textTransform style was not working as expected.
* Notice banner component
* Snackbar support
* Switch to new components
* Finish snackbar implementation
* Summary notice
* Styling issues
* Fix text wrap in shipping calculator
* Storybook entries
* Docs and tests for NoticeBanner
* Framer motion to avoid components dependency
* Snackbar list stories
* Docs for snackbar list
* Update assets/js/base/components/notice-banner/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update assets/js/base/components/notice-banner/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update assets/js/base/components/notice-banner/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update assets/js/base/components/notice-banner/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update assets/js/base/components/notice-banner/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Types/docblocks
* Docs
* Update notice type
* Use NoticeBannerProps for type of noticeProps
* Raw html to fix notice encoding
* getClassNameFromStatus is unused
* Update position text
* Clarify notice text
* Fix hover style in whisper TT3 theme
* remove div styles
* Add new templates for legacy buyer notices in WooCommerce core (https://github.com/woocommerce/woocommerce-blocks/pull/8732)
* Add templates for legacy core notices
* Update src/Domain/Services/Notices.php
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Remove debugging code
* DRY get_notices_template
* Simplify error template
* Fix padding
* Only include new notices if using block cart/checkout
---------
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Fix view box tag
* Hover and focus styles
* Styling when notices added via ajax
* Remove margin change
* Implement react-transition-group instead of framer (https://github.com/woocommerce/woocommerce-blocks/pull/8920)
* Add screenshots to docs
---------
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Add typography and spacing support to Product Price block
This commit adds additional typography and spacing support to the Product Price block. The following changes have been made:
1. In `assets/js/atomic/blocks/product-elements/price/block.tsx`, the `typographyProps.className` has been added to the `classNames` function to apply the typography styles.
2. In `assets/js/atomic/blocks/product-elements/price/supports.ts`, the following support attributes have been added to the `typography` object:
- `lineHeight`
- `__experimentalFontFamily`
- `__experimentalLetterSpacing`
Additionally, the `padding` attribute has been added to the `spacing` object.
3. In `src/BlockTypes/ProductPrice.php`, the `StyleAttributesUtils::get_classes_and_styles_by_attributes` function has been updated to receive all attributes instead of a predefined list.
* Enable background color support for Product Price block
This commit enables the background color support for the Product Price block in the WooCommerce Blocks plugin. The following change has been made:
1. In `assets/js/atomic/blocks/product-elements/price/supports.ts`, the `background` property within the `color` object has been changed from `false` to `true`, allowing users to set the background color for the Product Price block.
* Move blocks outside of Products block when convering Propduct Archive to the blockified version
* Move blocks outside of Products block when convering Product Search Result to the blockified version
* Move blocks outside of Products block in blockified templates
* Make sure Term description is still removed from Product Catalog template
* Remove isExperimentalBuild checks.
By removing the `isExperimentalBuild` conditional checks in the Classic
Template block, we can ensure the features added in woocommerce/woocommerce-blocks#8324 will land in
WooCommerce Core and are not limited to the feature plugin.
See p1680000654295729-slack-C02UBB1EPEF for additional context.
* Revert isExperimentalBuild removal on registration
The conditional `isExperimentalBuild` conditional check that was
wrapping some conditional registration of the classic template
block seems to be unrelated to the template conversion/migration.
This is something we can revisit and test separately but should not be
included in this changeset.
* Refactor import and add padding support in image block
In this commit, the import statement for __experimentalGetSpacingClassesAndStyles has been refactored to use an alias getSpacingClassesAndStyles for better readability. Additionally, padding support has been added to the image block's spacing configuration.
* Refactor ProductImage to use consolidated style classes and attributes
This commit refactors the ProductImage block by using the consolidated classes and styles provided by the StyleAttributesUtils::get_classes_and_styles_by_attributes() function. This change simplifies the code, improves readability, and ensures consistent handling of styles across different block elements.
* Add filter to change allowed blocks in Cart and Checkout blocks
* Add documentation for allowedBlockTypes
* Add test to check the filters work for the Checkout block
* Rename filter to additionalCartCheckoutInnerBlockTypes
* Update docs to reflect new name
* Add tests for additionalCartCheckoutInnerBlockTypes in Cart block
* Update Checkout test to reflect new filter name
* Update docs TOC to add example link
This adds the $schema property to all block.json files. This is required for the block.json files to be valid according to the JSON schema. I noticed that this property was not set for some of the block.json files.
* Add minimum structure for Single Product Details block
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* First try to render Product Arhcive template as blocks
* First iteration of the whole blockified product archive template
* Add tests for Single Product Details block
* Extract a blockified Product Archive Template to the templates
* Add templates to tsconfig.json so the files are resolved as part of the core code
* Add a encouragement note to use blockified version IF migration is available
* Add a Row block wrapping Product Results Count and Catalog Sorting blocks
* Move blockified product-archive from templates/ to assets/ directory
* Remove unnecessary margin from Product Results Count block
When used in a Row block in a blockified Archive Product template, Product Results Count had additional unnecessary margin which caused misalignment with the Catalog Sorting block
* Fix TypeScript error
* Update the description of the Classic Template Editor placeholder
* Remove unnecessary entry in tsconfig.json to include templates directory
It was added couple of commits earlier, since the template was kept there, but it was decided to move it to assets directory, so entry is no longer necessary
* Move the to
* Differentiate the Classic Template placeholder description depending on the availability to convert to Products block
* Add the initial basis for the Add to Cart button
* Add E2E test that the Classic Template can be replaced with the blockified version
* Abandon writing E2E tests for now, as there's a problem to run them locally
* Trigger the single product add to cart action for each product type.
* Syntax improvement
* Set margin for Catalog Sorting to 0, so it aligns properly when used in blockified Archive Product template
* Make the blockification config, so it covers the Product Archive as well as Single Product templates
* Move the product-archive specific functions from classic-template/index.tsx to the product-archive.ts
* wip: create block structure and add initial styles
* Add alignment option to the Store Notices block and make the blockified template blocks aligned wide
That is required, so the Classic Template layout is preserved
* Create single-product.ts file which is a placeholder for the blockified Single Product template
* Add block details to the SingleProductDetails.php file
* Make Blockified Product Archive template inherit the align attibute
* Simplify the interface of blockified templates
Expose function instead of two functions for allowing and disallowing conversion
* Add a BlockifiedTemplate type
* Rename and simplify the function checking if conversion of classic template to block version is possible
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Align the variable naming to use instead of
* Implement the skeleton for the editor preview.
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Add Product Image Gallery block
* Pass the Classic Template attributes to the blockified template instead of getting it from data store
* Include Breadcrumbs block in the Blockified Product Archive Template
* Consume alignment attributes of Catalog Sorting in the PHP render function
* Consume alignment attributes of Breadcrumbs in the PHP render function
* Show conversion button with label and description
* Add conversion placeholder (until we have all the blocks implemented)
* Remove align support from Catalog Sorting and add to Store Notices block
* remove support global styles
* remove support global styles
* Update the button CSS.
* Remove customizations for the Single Product Details block
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* Extend the get_classes_and_styles_by_attributes method with align and text_align attributes
* address CSS feedback
* Add Archive Title block to the Blockified Classic Template
* Minor getRowBlock function refactor
* add support for the custom classname
* remove save function
* Add property to the classic templates and base the config on it instead of placeholder
* Add separate blockified template for a Product Search Results
* Pass attribute from classic template to No Results block in Product Search Results
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* Extract the common functions between blockified archive-template and product-search-results to utils
* Enable 'Inherit query from template' in Products block by default when converting the Classic Template to blockified one
* add second parameter to the subscribe function
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* wrap the Single Product Template in a div with the product class
* Fix PHP Coding Standards warnings
* Improve the naming of BlockifiedTemplateConfig type
* Differentiate Product Catalog and Products By * templates. The latter include Term Description block
* improve logic and increase coverage of unit test
* Change unclear ProductsBy to ProductTaxonomy in regards to classic template conversion
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* update block name
* fix SCSS linter error
* address feedback
* create SingleProductTemplateCompatibility class
* Revert the margin fix which was added already on trunk
* Add Hooks compatibility
* remove not used file
* remove not used files
* Add compatibility layer for the Single Product template
* fix check
* implement Product meta template header
* Add default Single Product HTML template
* Fix style issues when adding blocks inside group/stack/columns blocks
* Add Related Products to the default single product template HTML file
* Product Price Block: Add support Single Product Template
* fix missing import
* add comment
* return a value
* improve comment
* fix import
* Add Product Meta block
* wrap up default single product html
* remove classname
* add blocks
* improve code
* Remove !important statement from Product Image Gallery block css
* Change width of Product Image Gallery block to initial instead of unset
* Wrap up default single product html template (https://github.com/woocommerce/woocommerce-blocks/pull/8632)
* Add minimum structure for Single Product Details block
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* Add tests for Single Product Details block
* Add the initial basis for the Add to Cart button
* Trigger the single product add to cart action for each product type.
* wip: create block structure and add initial styles
* Add block details to the SingleProductDetails.php file
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Implement the skeleton for the editor preview.
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Add Product Image Gallery block
* remove support global styles
* remove support global styles
* Update the button CSS.
* Remove customizations for the Single Product Details block
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* address CSS feedback
* add support for the custom classname
* remove save function
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* add second parameter to the subscribe function
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* wrap the Single Product Template in a div with the product class
* Fix PHP Coding Standards warnings
* improve logic and increase coverage of unit test
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* update block name
* fix SCSS linter error
* address feedback
* create SingleProductTemplateCompatibility class
* Add Hooks compatibility
* remove not used file
* remove not used files
* Add compatibility layer for the Single Product template
* fix check
* implement Product meta template header
* Product Price Block: Add support Single Product Template
* fix missing import
* add comment
* return a value
* improve comment
* fix import
* Add Product Meta block
* wrap up default single product html
* fix: related products and grouped products result woocommerce/woocommerce-blocks#8589
* remove classname
* fix crash
* update template
---------
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Fix images width in the Single Product page
* Remove the !important attribute from the Product Image Gallery block
* fix sku block
* improve layout
* improve layout
* improve layout
* improve layout
* improve layout
* update label
* Single Product Template: add store notice block
---------
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Karol Manijak <karol.manijak@automattic.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
* Add Notice component to the Inspector Controls section of the Related Products block
* Change margin css attribute to use the short syntax
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
---------
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Render inner buttons on the frontend
* Add deprecation to the buttons
* Fix lint and inline save
* Remove commented out code and fix condition
* Change migrate condition
* Add styles outline and fill styles to cart and checkout buttons
* Add fill and outline styles to the start shopping button
* Refactor variants
* Remove imports
* Add classname default value
---------
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Add Fill & Outline styles to Product button
This commit adds the Fill & Outline styles to the Product button block.
You can see new Styles section in Inspector Controls where you will be able to change between Fill & Outline styles.
* Add width setting to product button
The button block now has a width selector, which allows the user to
set the button to 25%, 50%, 75%, or 100% of the parent container.
By default, a button's width is determined by the size of its content.
You can find this setting in the button block's sidebar.
* Enable all typography controls
Now following typography controls are also available:
- Font Family
- Appearance
- Line height
- Letter spacing
- Decoration
- Letter case
* Fix width settings not working
* Fix align doesn't work with Width settings
* Fix width setting not working in Single product block
* Fix - Default button is shorter on the frontend
In Editor default and outlined button has the same height. Outlined button in the frontend as well. But default button on the frontend is shorter (smaller padding)
More info: https://github.com/woocommerce/woocommerce-blocks/pull/8781#issuecomment-1477527049
* Fix - background color not matching when GB is enabled
* Fix - 100% width button exceeds the container
Fix following issues:
- "Select Options" or "View products" for variable and grouped products don't respect the container max width
- Also, for small width (25%) they are wider
More info: https://github.com/woocommerce/woocommerce-blocks/pull/8781#issuecomment-1477527049
* Fix: Width setting not working in All Products block
This commit fixes the width setting not working in the All Products block.
* Keep other classes along with Width setting classes
`block.attributes.className` should be kept along with the width setting classes.
```
className: classnames( block.attributes.className, {
[ `has-custom-width wp-block-button__width-${ block.attributes?.width }` ]:
block.attributes?.width,
} )
```
* Translate styles label in block configuration
* Fix _n usage to use plural and singular correctly
* Replace switch condition with if else
- Replace switch condition with if else for better readability.
* Add packageCount in LocalPickupSelect component
- packageCount prop was missing from LocalPickupSelect component. Add packageCount in LocalPickupSelect component.
---------
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Niels Lange <info@nielslange.de>
* Add minimum structure for Single Product Details block
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* First try to render Product Arhcive template as blocks
* First iteration of the whole blockified product archive template
* Add tests for Single Product Details block
* Extract a blockified Product Archive Template to the templates
* Add templates to tsconfig.json so the files are resolved as part of the core code
* Add a encouragement note to use blockified version IF migration is available
* Add a Row block wrapping Product Results Count and Catalog Sorting blocks
* Move blockified product-archive from templates/ to assets/ directory
* Remove unnecessary margin from Product Results Count block
When used in a Row block in a blockified Archive Product template, Product Results Count had additional unnecessary margin which caused misalignment with the Catalog Sorting block
* Fix TypeScript error
* Update the description of the Classic Template Editor placeholder
* Remove unnecessary entry in tsconfig.json to include templates directory
It was added couple of commits earlier, since the template was kept there, but it was decided to move it to assets directory, so entry is no longer necessary
* Move the to
* Differentiate the Classic Template placeholder description depending on the availability to convert to Products block
* Add the initial basis for the Add to Cart button
* Add E2E test that the Classic Template can be replaced with the blockified version
* Abandon writing E2E tests for now, as there's a problem to run them locally
* Trigger the single product add to cart action for each product type.
* Syntax improvement
* Set margin for Catalog Sorting to 0, so it aligns properly when used in blockified Archive Product template
* Make the blockification config, so it covers the Product Archive as well as Single Product templates
* Move the product-archive specific functions from classic-template/index.tsx to the product-archive.ts
* wip: create block structure and add initial styles
* Add alignment option to the Store Notices block and make the blockified template blocks aligned wide
That is required, so the Classic Template layout is preserved
* Create single-product.ts file which is a placeholder for the blockified Single Product template
* Add block details to the SingleProductDetails.php file
* Make Blockified Product Archive template inherit the align attibute
* Simplify the interface of blockified templates
Expose function instead of two functions for allowing and disallowing conversion
* Add a BlockifiedTemplate type
* Rename and simplify the function checking if conversion of classic template to block version is possible
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Align the variable naming to use instead of
* Implement the skeleton for the editor preview.
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Add Product Image Gallery block
* Pass the Classic Template attributes to the blockified template instead of getting it from data store
* Include Breadcrumbs block in the Blockified Product Archive Template
* Consume alignment attributes of Catalog Sorting in the PHP render function
* Consume alignment attributes of Breadcrumbs in the PHP render function
* Show conversion button with label and description
* Add conversion placeholder (until we have all the blocks implemented)
* Remove align support from Catalog Sorting and add to Store Notices block
* remove support global styles
* remove support global styles
* Update the button CSS.
* Remove customizations for the Single Product Details block
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* Extend the get_classes_and_styles_by_attributes method with align and text_align attributes
* address CSS feedback
* Add Archive Title block to the Blockified Classic Template
* Minor getRowBlock function refactor
* add support for the custom classname
* remove save function
* Add property to the classic templates and base the config on it instead of placeholder
* Add separate blockified template for a Product Search Results
* Pass attribute from classic template to No Results block in Product Search Results
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* Extract the common functions between blockified archive-template and product-search-results to utils
* Enable 'Inherit query from template' in Products block by default when converting the Classic Template to blockified one
* add second parameter to the subscribe function
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* wrap the Single Product Template in a div with the product class
* Fix PHP Coding Standards warnings
* Improve the naming of BlockifiedTemplateConfig type
* Differentiate Product Catalog and Products By * templates. The latter include Term Description block
* improve logic and increase coverage of unit test
* Change unclear ProductsBy to ProductTaxonomy in regards to classic template conversion
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* update block name
* fix SCSS linter error
* address feedback
* create SingleProductTemplateCompatibility class
* Revert the margin fix which was added already on trunk
* Add Hooks compatibility
* remove not used file
* remove not used files
* Add compatibility layer for the Single Product template
* fix check
* implement Product meta template header
* Add default Single Product HTML template
* Fix style issues when adding blocks inside group/stack/columns blocks
* Add Related Products to the default single product template HTML file
* Product Price Block: Add support Single Product Template
* fix missing import
* add comment
* return a value
* improve comment
* fix import
* Add Product Meta block
* wrap up default single product html
* remove classname
* add blocks
* improve code
* Remove !important statement from Product Image Gallery block css
* Change width of Product Image Gallery block to initial instead of unset
* Wrap up default single product html template (https://github.com/woocommerce/woocommerce-blocks/pull/8632)
* Add minimum structure for Single Product Details block
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* Add tests for Single Product Details block
* Add the initial basis for the Add to Cart button
* Trigger the single product add to cart action for each product type.
* wip: create block structure and add initial styles
* Add block details to the SingleProductDetails.php file
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Implement the skeleton for the editor preview.
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Add Product Image Gallery block
* remove support global styles
* remove support global styles
* Update the button CSS.
* Remove customizations for the Single Product Details block
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* address CSS feedback
* add support for the custom classname
* remove save function
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* add second parameter to the subscribe function
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* wrap the Single Product Template in a div with the product class
* Fix PHP Coding Standards warnings
* improve logic and increase coverage of unit test
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* update block name
* fix SCSS linter error
* address feedback
* create SingleProductTemplateCompatibility class
* Add Hooks compatibility
* remove not used file
* remove not used files
* Add compatibility layer for the Single Product template
* fix check
* implement Product meta template header
* Product Price Block: Add support Single Product Template
* fix missing import
* add comment
* return a value
* improve comment
* fix import
* Add Product Meta block
* wrap up default single product html
* fix: related products and grouped products result woocommerce/woocommerce-blocks#8589
* remove classname
* fix crash
* update template
---------
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Fix images width in the Single Product page
* Remove the !important attribute from the Product Image Gallery block
* fix sku block
* improve layout
* improve layout
* improve layout
* improve layout
* improve layout
* update label
---------
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Karol Manijak <karol.manijak@automattic.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Replace single quote with the encoded version %27 for URL comparison
This is required as as removeQueryArgs() function uses decodeURIcomponent method which doesn't encode single quotes (') while it was still encoded in the original URL (%27). So when the single quote was in a query param, for example as a search term, it caused endless redirection loop.
* Replace single quote with the encoded version %27 for URL comparison in Filter by Rating
* refactor the solution so it encodes the href rather than decode the newly created URL
* Refactor the normalisation
* Add tests to normalisation function
* Add default Single Product HTML template
* Fix style issues when adding blocks inside group/stack/columns blocks
* Add Related Products to the default single product template HTML file
* Remove !important statement from Product Image Gallery block css
* Change width of Product Image Gallery block to initial instead of unset
* Wrap up default single product html template (https://github.com/woocommerce/woocommerce-blocks/pull/8632)
* Add minimum structure for Single Product Details block
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* Add tests for Single Product Details block
* Add the initial basis for the Add to Cart button
* Trigger the single product add to cart action for each product type.
* wip: create block structure and add initial styles
* Add block details to the SingleProductDetails.php file
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Implement the skeleton for the editor preview.
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Add Product Image Gallery block
* remove support global styles
* remove support global styles
* Update the button CSS.
* Remove customizations for the Single Product Details block
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* address CSS feedback
* add support for the custom classname
* remove save function
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* add second parameter to the subscribe function
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* wrap the Single Product Template in a div with the product class
* Fix PHP Coding Standards warnings
* improve logic and increase coverage of unit test
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* update block name
* fix SCSS linter error
* address feedback
* create SingleProductTemplateCompatibility class
* Add Hooks compatibility
* remove not used file
* remove not used files
* Add compatibility layer for the Single Product template
* fix check
* implement Product meta template header
* Product Price Block: Add support Single Product Template
* fix missing import
* add comment
* return a value
* improve comment
* fix import
* Add Product Meta block
* wrap up default single product html
* fix: related products and grouped products result woocommerce/woocommerce-blocks#8589
* remove classname
* fix crash
* update template
---------
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Fix images width in the Single Product page
* Remove the !important attribute from the Product Image Gallery block
* fix sku block
* improve layout
* fix header and footer template parts declaration
---------
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Use attributes provided to save function in product-price block
* remove save function and use the shared one
* fix import
---------
Co-authored-by: Luigi <gigitux@gmail.com>
* Remove Single Product Block
* remove more files that belong the Single Product block
* fix php linter error
* remove Product Tag List and Product Category List blocks
* Prevent checkout when no shipping rates available
- Add the validation error in ShippingSelector to prevent checkout when no shipping rates available.
- Add notice to Checkout processor so that notice appears after clicking on place order button.
* Fix TypeScript error in checkout shipping method block
- Make multiple prop as optional in RatePrice component to fix TypeScript error.
* Product Search Results: fix the preview when the Inherit Query option is enabled
* create a component to make the code more readable
---------
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Fix local pickup price in the shipping type selector
- While calculating min and max value for local pickup, if the rate is not for local pickup, it will take already calculated lowest value instead of comparing it with the value of other shipping rate.
* Add the typecasting for price and tax to fix tax calculation
- We were concatenating the two strings instead of adding the integers. Add the typecasting for price and tax to fix it in local pickup.
---------
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Add `renderInCartAndCheckout` attribute and toggle
* Show setting only when inserted in a template
* Don't render the mini-cart if the setting is disabled
* Stop rendering the mini-cart if the setting is false
* method to snakecase
* Make the attribute a string
In the future we may want to add more rendering styles, so a boolean wasn't the
best option, a string will allowed us more than two options
* Change toggle copy
* Get the default store state
We are merging the Country & State fields. So, we should get both
default values
* Merge the Country & State fields
We merged both fields in the Pickup Location form modal
We can see a similar example in `WooCommerce -> Settings -> General`
* Clean up the code
* Show the state text field above the country select
* Create some util functions
* Refactor the Form component
* Display a user friendly country and state in admin
* Fix country defaulting to "Afghan" bug
* Add client side postcode validation
* Prevent server-side validation
* Adjust translation
* Only validate postcode if country is available
* Specify return type of isPostcode()
* Convert function to static variable set
* Refactor <ValidatedTextInput> for postcode validation
* Refactor customValidationHandler
* Use customValidationHandler as intermediate function
* Hyphenate file names
* Update packages/checkout/utils/validation/is-postcode.ts
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Normalise postcode on input
* Fix usage of out of date value from input field
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add ExperimentalOrderLocalPickupPackages slot fill
* Render ExperimentalOrderLocalPickupPackages in local pickup block
* Update docs to include ExperimentalOrderLocalPickupPackages
* Use LocalPickupSelect component when rendering local pickup options
* Add CartCheckoutUtils class
This class will store reusable methods relating to Cart/Checkout Blocks, i.e. whether they are used on the Cart/Checkout page.
* Update ShippingController to use the new CartCheckoutUtils function
This will reduce code duplication when checking if the Cart/Checkout blocks are in use on the Cart/Checkout page.
* Add filter to remove shipping settings when Cart/Checkout are default
* Ensure setting displays correctly if cart is default but not checkout
* Add tests to ensure core shipping settings update correctly
* Add setCartCheckoutPages function to update set the cart/checkout page
* Force shipping to be enabled if the Checkout block is in use.
* Add filter to override cost requires address option
* Add shippingCostRequiresAddress option
* Check if the address is required before showing rates
* Show shipping rates in editor
* Add shippingCostRequiresAddress attribute to shipping methods block
* Update frontend type to show shippingCostRequiresAddress is a prop
* Add control to toggle shippingCostRequiresAddress option
* Show address notice in the correct scenario
* Send shippingCostRequiresAddress to Block in front end context
* Add e2e test for editor control
* Add e2e tests for shipping options on the front end
* Add updateAttributeInSiblingBlock function
* Add shippingCostRequiresAddress to shipping method block
* Ensure attribute is updated in both blocks when editing
* In Shipping Methods Block, show correct component based on block setting
* Show correct block in editor
* Remove broken test from PR
* Clean up updateAttributeInSiblingBlock
* Add setCartCheckoutPages function to update set the cart/checkout page
* Add tests to ensure core shipping settings update correctly
* Add isAddressComplete function
Borrowed from woocommerce/woocommerce-blocks#8141
* Check if the address is required before showing rates
* Show shipping rates in editor
* Show address notice in the correct scenario
* Add e2e tests for shipping options on the front end
* Ensure errorId is passed to StateInput
* Add fullShippingAddressPushed action to wc/store/cart
* Add fullShippingAddressPushed case to reducer
* Ensure fullShippingAddressPushed is set when initialising cart store
* Add fullShippingAddressPushed selector and default state entry
* Add shippingAddressHasValidationErrors util function
* Do not overwrite addresses when selecting a rate
* Set whether full address has been pushed when saving address changes
* In Shipping Methods Block, show correct component based on block setting
* Don't show from price if rates should be hidden until address entered
* Check city validation errors to assert if shipping address is valid
* Rename merchant.js to merchant.ts
* Move local pickup functions to common merchant util
* Update local pickup tests to use common merchant utils
* Add test to ensure setting toggles in both blocks
* Add navigating to settings and saving in merchant util
* Create addPickupLocation merchant util
* Add test for local pickup and require full address
* Make sure correct conditions are met to show shipping options
* Ensure checkbox is checked during local pickup tests
* Unset the checkbox when tests are finished running
* Update checkout block fixture
* Prevent error in unit tests
* Import validation store key from constants
Required because importing from the index causes the validation data store to register twice
* Update checkout terms test to wait for button not to be disabled
* Revert "Add isAddressComplete function"
This reverts commit 9967dc0d4f10cf638859ae085e6f4cc2901dd299.
* Fix up typescript of checkout filters
* Clear cached values when adding new filters
* Allow href on WPButton type
* Specify generic type of getSetting for checkout page link
* Apply filters to Proceed to Checkout button
* Add unit tests for proceed to checkout button and link filters
* Make cart extend a plain object
* Pass cart in args for proceed to checkout filters
* Add documentation for proceed to checkout filters
* Add unit test for multiple filter registration
* Change word to bump stuck GitHub actions
* Apply consistent casing to test names
* Add third party local pickup method to woo-test-helper plugin
* Add test to check for checkout with local pickup
* Ensure local pickup is disabled when done with tests
* Add a more reliable selector for the "use same address for billing" box
* Prevent local pickup rates showing if local pickup is not enabled
* Check billing details after placing local pickup order
* Change local pickup unit test so rates dont show if localPickup disabled
* Use existing const instead of getSetting
* Update tests to mock constant from @woocommerce/block-settings
---------
Co-authored-by: Niels Lange <info@nielslange.de>
* Add LocalPickupSelect component
This will be used to render the local pickup options and also display a title if there are more than one package (e.g. if WC subs adds them)
* Add tests for LocalPickupSelect component
* Make title optional
* Add packageCount as an option to LocalPickupSelect
* Revert "Add packageCount as an option to LocalPickupSelect"
This reverts commit 10b1dc9497aa6c4329aee7e74e1404cb9645c3b9.
* Add ackage count to LocalPickupSelect
* Add package count and remove unused variable from renderPickupLocation
* Add border support to mini cart contents
* Fix buttons in firefox when logged out
* Fix mini cart in all browsers
* Fix border not visible on mobile because of the admin bar
* Add feature flag to the experimental border
---------
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Product Rating: Normalize the height of rating icons and the Add review link
* Products: Update inner blocks margins.
* Product Rating: Remove css changes from this PR.
* Products patterns: Remove px values and update the default pattern template.
---------
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Add minimum structure for Single Product Details block
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* Add tests for Single Product Details block
* Add the initial basis for the Add to Cart button
* Trigger the single product add to cart action for each product type.
* wip: create block structure and add initial styles
* Add block details to the SingleProductDetails.php file
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Implement the skeleton for the editor preview.
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Add Product Image Gallery block
* remove support global styles
* remove support global styles
* Update the button CSS.
* Remove customizations for the Single Product Details block
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* address CSS feedback
* add support for the custom classname
* remove save function
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* add second parameter to the subscribe function
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* wrap the Single Product Template in a div with the product class
* Fix PHP Coding Standards warnings
* improve logic and increase coverage of unit test
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* update block name
* fix SCSS linter error
* address feedback
* create SingleProductTemplateCompatibility class
* Add Hooks compatibility
* remove not used file
* remove not used files
* Add compatibility layer for the Single Product template
* fix check
* implement Product meta template header
* Product Price Block: Add support Single Product Template
* fix missing import
* add comment
* return a value
* improve comment
* fix import
* Add Product Meta block
* remove unnecessary change
* fix compatibility layer when the Single Product template has the classic block
---------
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Make Mini Cart drawer close button inherit the color
* Fix Mini Cart drawer close button alignment
* Increase opacity when Mini Cart drawer close icon is hover, focused or active
This PR is meant to improve the UI and UX behind the Attributes filter
within the Inspector Controls of the “Products (Beta)“ block.
Also included:
* Refactor `useProductAttributes` hook
* Move it into the shared hooks.
* Fetch both terms AND attributes via the API (previously,
we got the attributes from the settings, but we'd get
partial objects compared to the API? Maybe a follow-up
to this could be to check why the attributes stored in
the settings are incomplete?)
* Make sure the return values match the ones expected
from search items.
* Remove attribute-related types from PQ directory
* Improve functionality of `SearchListControl`
* Allow the search input to be a Token based input.
* Allow for search input to search even collapsed properties.
* Use core `CheckboxControl` instead of radio buttons for
items having children (includes undeterminated state).
* Enable removal of tokens from the input
* Improve styles:
* Refactor classnames for `SearchItem`.
* Add more semantic classes.
* Align count label and caret to the right.
* Make caret switch direction on expanded.
* `cursor: pointer` on collapsible items.
* Indent children of collapsible items.
* Correctly pass through class names to search item
* Enable keyboard navigation for collapsible items
* Add link to manage attributes
* Change label inside the inspector controls
* Make search list attached when token type
* Implement more sophisticated behavior of parent checkbox
* If indeterminate or unchecked, it will check all children.
* If checked, it will uncheck all children.
* Remove hardcoded `isSingle` from `expandableSearchListItem`
* Remove old view switcher component (not used)
* Switch in list view
* useSelect
* Optional selection of parent block on changing view
---------
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add tests for pushChanges and dirty props
* Update assets/js/data/cart/test/push-changes.ts
Co-authored-by: Mike Jolley <mike.jolley@me.com>
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Make the customer account icon bigger to match the mini-cart one
* Add variation to increase the icon size for new blocks
* Improve class name
* Add variation explanation
* Add default attributes
* Update the editor styles for the add to cart form button so it is properly displayed with the Gutenberg plugin disabled.
* update for the input height.
* update the min-height
* Update Interactivity API
* Change `wp` prefixes to `woo`
* Use `woo` prefix for the directives runtime bundle
* Update Interactivity API runtime
* Hardcode php from interactivity API
* Temporarily add gutenberg plugin as dependency
* Exclude Interactivity API files from phpcs checks
* Update Interactivity API js files
* Update Interactivity API php files
* Remove gutenberg from wp-env plugins
* Fix registered runtime paths
* Fix prefixes when getting attributes in directives
* Fix directive prefix in constants
* Avoid a Fatal error when importing `wp-html`
* Remove TODO comments from Interactivity API files
* Add missing prefix to some global functions
* Use true as value for boolean attributes
* Add `wp-html` file
* Change requires in `wp-html` with includes
* Extract a blockified Product Archive Template to the templates
* Add templates to tsconfig.json so the files are resolved as part of the core code
* Add a encouragement note to use blockified version IF migration is available
* Add a Row block wrapping Product Results Count and Catalog Sorting blocks
* Move blockified product-archive from templates/ to assets/ directory
* Remove unnecessary margin from Product Results Count block
When used in a Row block in a blockified Archive Product template, Product Results Count had additional unnecessary margin which caused misalignment with the Catalog Sorting block
* Update the description of the Classic Template Editor placeholder
* Remove unnecessary entry in tsconfig.json to include templates directory
It was added couple of commits earlier, since the template was kept there, but it was decided to move it to assets directory, so entry is no longer necessary
* Differentiate the Classic Template placeholder description depending on the availability to convert to Products block
* Set margin for Catalog Sorting to 0, so it aligns properly when used in blockified Archive Product template
* Make the blockification config, so it covers the Product Archive as well as Single Product templates
* Move the product-archive specific functions from classic-template/index.tsx to the product-archive.ts
* Add alignment option to the Store Notices block and make the blockified template blocks aligned wide
That is required, so the Classic Template layout is preserved
* Create single-product.ts file which is a placeholder for the blockified Single Product template
* Make Blockified Product Archive template inherit the align attibute
* Simplify the interface of blockified templates
Expose function instead of two functions for allowing and disallowing conversion
* Add a BlockifiedTemplate type
* Rename and simplify the function checking if conversion of classic template to block version is possible
* Align the variable naming to use instead of
* Pass the Classic Template attributes to the blockified template instead of getting it from data store
* Include Breadcrumbs block in the Blockified Product Archive Template
* Consume alignment attributes of Catalog Sorting in the PHP render function
* Consume alignment attributes of Breadcrumbs in the PHP render function
* Remove align support from Catalog Sorting and add to Store Notices block
* Extend the get_classes_and_styles_by_attributes method with align and text_align attributes
* Add Archive Title block to the Blockified Classic Template
* Minor getRowBlock function refactor
* Add property to the classic templates and base the config on it instead of placeholder
* Add separate blockified template for a Product Search Results
* Pass attribute from classic template to No Results block in Product Search Results
* Extract the common functions between blockified archive-template and product-search-results to utils
* Enable 'Inherit query from template' in Products block by default when converting the Classic Template to blockified one
* Improve the naming of BlockifiedTemplateConfig type
* Differentiate Product Catalog and Products By * templates. The latter include Term Description block
* Change unclear ProductsBy to ProductTaxonomy in regards to classic template conversion
* Revert the margin fix which was added already on trunk
* Move the surrounding blocks as inner blocks of Products
* Hide the conversion behind the experimental build flag (as it was before)
* Restrict usage to the single product template.
* Update class prefix from wc to wp
* Move the add-to-cart-form block to atomic blocks so it is aligned with the updated structure adopted for single product related blocks.
* Address CR
* ditch woocommerce class.
* remove attributes key
* Add new styles to account for the removal of the .summary and .entry-summary selectors
* Narrow down the styles to the add-to-cart-form class.
* Fix notice persistence after dismissal
- This fix applied to the `incompatible payment gateway notice`.
- We used the same dismissal logic in the `sidebar compatibility notice`
* Get incompatible payments when initialized
We initially get the list of `globalPaymentMethods` shared from
the back-end as incompatible payments, because the front-end
`availablePaymentMethods` is empty before the
`paymentMethodsInitialized` state
* Introduce advanced notice dismissal handling
We want to display a dismissed incompatible gateways notice, when the
list of incompatible gateways is updated (e.g., a new incompatible
gateway is enabled)
* Use the full block name for the `Cart` & `Checkout`
* Update variable name for comprehension
* Fix TS errors
* Remove unused imports
* wip: update blockified archive templates
* Update product archive title to Shop
* Update product search template to blockified version
* new default templates, all blocks are Products block inner blocks
* revert change to fallack eligible archive templates
* remove unneccessary translated strings
* only filter the archive title on the shop page
* add missing categories header for patterns
* remove the term description block on the fly
* explain the reason for removing the term description block
---------
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Product Rating and Price: Re-add alignment controls in the All Products context.
* Add default values to align attributes for price and rating product elements
---------
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
* WIP
* Deprecate isPaymentPristine and undeprecate isPaymentStarted
* Set payment status to FAILED or SUCCESS when the storeAPI fetch returns
* Remove FINISHED as a status
* Remove ready status
* Revert "Remove FINISHED as a status"
This reverts commit 38d66ed1d9565756d2373533c7a7c5b107a68ddd.
* Add payment status READY
* Removed payment statuses pristine, failed and success
* Remove deprecated selectors and update docs
* Rename the checkout events
* Merge conflicts
* Update test observer
* Update deprecation notice
* deprecation versions
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add the initial basis for the Add to Cart button
* Trigger the single product add to cart action for each product type.
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Implement the skeleton for the editor preview.
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Update the button CSS.
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* Update the icon for the block to match the core icon button
* Add minimum structure for Single Product Details block
* Add tests for Single Product Details block
* wip: create block structure and add initial styles
* Add block details to the SingleProductDetails.php file
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Remove customizations for the Single Product Details block
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* Fix PHP Coding Standards warnings
* update block name
* fix SCSS linter error
* move blocks into product-elements folder and rename to product-details
* avoid 404 error
* disable js asset enqueue
---------
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Support partial push without country field
* Increase timeout to prevent excessive pushes
* Push on focusout
* Only flush inputs
* change debounce timer to 1s
---------
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* Add Product Image Gallery block
* remove support global styles
* remove support global styles
* address CSS feedback
* add support for the custom classname
* remove save function
* add second parameter to the subscribe function
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* WIP
* Change payment status from pristine to idle
* Deprecate isPaymentStarted and isPaymentFinished
* Correct comments
* Deprecate isPaymentPristine and undeprecate isPaymentStarted
* Set payment status to FAILED or SUCCESS when the storeAPI fetch returns
* Remove FINISHED as a status
* Remove ready status
* Revert "Remove FINISHED as a status"
This reverts commit 38d66ed1d9565756d2373533c7a7c5b107a68ddd.
* Add payment status READY
* Update use-payment-interface
* Removed payment statuses pristine, failed and success
* Remove deprecated selectors and update docs
* Deprecate isPaymentStarted in favour of isExpressPaymentStarted
* Fix tests
* Update assets/js/base/context/providers/cart-checkout/payment-events/index.tsx
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Mikes suggestions
* Change since version
* Fix tests
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Reset margin on result count block
* Reset margin for catalog sort block
* reset margin and other fixes for breadcrumb block.
* Move styles to relevant files
* Set inherit default to true when products is inserted on archive products templates
* Create new query attributes object
Co-authored-by: kmanijak <karol.manijak@automattic.com>
* Extract the products registration to a separate function
* Bring back variation name
* Move variation name
* Unregister the block before registering it again
* Use subscribe only on the site editor
* Undo change
* Try fixing tests
* Fix test
* Revert test only
---------
Co-authored-by: kmanijak <karol.manijak@automattic.com>
* Allow observers to set billingAddress by returning billingData
This is required since we didn't correctly deprecate billingData when we changed the name to billingAddress
* Add tests for shippingAddress and paymentMethodData
* Add mocked __internalSetPaymentMethodData to correct object
It was in registry, but should be in dispatch as the action is on the same store as the thunk. Registry is used for actions on other stores.
* Re-add FieldValidationStatus type
* Add FieldValidationStatus back
* Remove empty file
* Import FieldValidationStatus from correct place
* Remove import of deleted types file
* Add isObserverResponse type guard
* Use error constant instead of magic string in event emitter
* Remove composite project tsconfig
* Add ObserverResponse type
* Add types to emitEventWithAbort
* Check if paymentmethod data is an object before dispatching
* Set types on observer responses
* Add validationErrors type guards
* Add tests for validation typeguards
* Add validation errors as option on observer response
* Add more granular observer response types
* Check observer response has correct types before dispatching actions
* Force type on deprecated billingData and shippingData
* Remove unnecessary comment
* Add wrapper for __experimentalRegisterCheckoutFilters and deprecate it
* Update internal references from __experimentalRegisterCheckoutFilters
* Add wrapper for deprecated __experimentalApplyCheckoutFilter
* Update references from `__experimentalApplyCheckoutFilter`
With WordPress 6.2, the inspector controls are going to be
tabbed into a “Styles” and “Setting” section (where applicable).
Previously, in order to display our Feedback Prompt at the bottom
of the controls, we had hooked it into the “Colors” section
as a temporary/hacky solution to the problem.
Now that the styles sections are all moved, the problem
doesn't really exist anymore, and we can just place it
at the bottom of the controls.
- Revert the label change to "Add a coupon" so that it will be merged to WC Core and translation for the new string will be available.
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Capture notices from hidden block into siblings block
* switch to using a single context
* make change bwc
* add tests
* support context as array in StoreNotice
* move filter logic to Notice component
* Fix the alert icon's name
* Add "status" to the Alert's API
* Update the incompatible gateways notice's design
* Set the list's bullet points from CSS
Currently, the Cart block doesn't fully support Global Styles,
so, in orderto avoid providing the users with a confusing
or broken experience, we have decided to remove it
for the time being, until proper support has been added.
* Add get_collectible_method_ids function
* Add collectibleMethodIds to asset data registry
* Check whether method id is pickup_location/in collectibleMethodIds
* Allow selectShippingRate to be called without a package id
* Prevent collectible methods showing in the main shipping area
* Remove unnecessary pluck and add pickup_location to returned array
* No longer insert pickup_location in collectibleMethodIds
* Allow third party methods to influence low/high collection price
* Update useShippingData to consider any collectible method
* Add hasSelectedLocalPickup to shipping types
* Add dependency to selectShippingRate in useShippingData
* Register collectibleMethodIds as a callback
This is so the shipping methods get change to register before this is called. Passing a callback to `add` means it won't be called until just before it is output.
* Update supports key to 'local_pickup'
* Rename utils/shipping-rates to TS
* Convert to TS, add isPackageRateCollectible & hasCollectableRate
* Add tests for hasCollectableRate and isPackageRateCollectible
* Update shipping controller to output only method names
* Make PickupLocation shipping method support local_pickup
* Set prefersCollection based on rate ID being collectible
* Remove need to retrieve settings and use helper function instead
* rename hasCollectableRate to hasCollectibleRate
* Use array_reduce and update comments in get_local_pickup_method_ids
* Switch order of array_unique and array_values
* Remove unneeded dependency
* Hyphenate local-pickup so it follows the same format as other features
* Update use of collectible to collectable
* Change supports feature to be hyphenated
* Update __internalSetExtensionData to require namespaces
* Test coverage for __internalSetExtensionData
* Rename of select is no longer needed
* Update doc
* Global Styles: Add support for text settings
* StyleAttributesUtils: Change function order
* Global Styles: Remove redundant isFeaturePluginBuild() from useTypographyProps().
* Add max-height to Mini Cart drawer.
By giving the Mini Cart contents a max height with the
-webkit-fill-available property, we can ensure that the browser chrome
is accounted for on mobile devices.
* Add `dvh` and keep `vh` as a fallback for height.
By adding `dvh`, we also account for non-webkit mobile browsers that
have the same hidden button issue.
See
https://github.com/woocommerce/woocommerce-blocks/pull/8351#pullrequestreview-1278867767
Keeping `vh` as a fallback, along with `-webkit-fill-available` gives us
the widest range of support.
* Store breadcrumbs block: Gate global styles added via experimental flags to the feature plugin.
* Rename the const to featurePluginSupport and invoke it on block registration.
* Address CR
* Initial structure for the breadcrumbs block
* ditch inline comment
* Fine-tune the store breadcrumbs
* Disable the breadcrumbs block for regular posts & pages
* Update the breadcrumbs block details.
* Add tests
* rely on sprintf to render the breadcrumb
* Ditch usesContext.
* Add a link to the breadcrumb editor preview
* Disable all pointer-events for the breadcrumb link in the editor preview
* Add the align attribute
* Use the Disabled component to prevent interactions and update the copy for the block description.
* Subscribe only to changes on core/block-editor
* Improve performance of useForcedLayou
This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way.
* Check if templates synced before doing it again in useForcedLayout
* Style Book: Fix Featured Product and Featured Category Blocks
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Subscribe only to changes on core/block-editor
* Improve performance of useForcedLayou
This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way.
* Check if templates synced before doing it again in useForcedLayout
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Add Interactivity API scripts
* Enqueue scripts if Products exists for testing
* Test client-side transitions
* Remove script enqueue
* Remove hpq dependency
* Update Interactivity scripts to latest version
* Remove interactivity scripts from core entries
* Create webpack config for interactivity api
A plugin for optional chaining is required as the repo uses Webpack 4 for now.
* Enqueue the directives runtime
* Updated wp directives code
* Use a filter to enque the directives runtime
* Remove base-interactivity alias for now
* Add path for modules inside base-interactivity
* Revert "Remove base-interactivity alias for now"
This reverts commit 7c6cbee372c65e430590d98c1819b6b4b0a97d93.
* Remove unnecessary filter and enqueue
* Update router code
* Update Interactivity location and alias
* Use hook `init` for script registering
Co-authored-by: Mario Santos <santosguillamot@gmail.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
* Refresh on back
* Move refresh code to a hook in useStoreCart
* Load mini cart scripts when page is invalid
* Update code comments
* refreshDataIfPersisted->refreshCachedCartData
* Avoid deprecated code
* Only notify if cart resolution has finished
* Fix tests to check for cart resolution
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Make Notice component color black
The Notice component text is not legible in dark themes since the background color
is light and and the text color is too. With this change we are setting the color
always to black for our blocks, so it's always legible.
* Make the text black for notices displayed on the editor
* Import editor.scss
* support partial updates
* revised error ids to reference in validation class
* Validate before push
* Fix logic + TS
* Avoid need for PUT by delaying validation/sanitization
* $cart change was not needed
* Revert changes in schema - fix is handled at route level
* Put back wc_do_deprecated_action
* Extra validation is not needed
* No need to export isValidAddressKey - its not used anywhere
* No longer using RouteException in customer update route
* Fix setting shipping to billing with changes
* Update error ids
* Only validate posted props
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Updated package-lock.json
* fixed method sig
* PHP versions matrix
* removed extra space
* renamed step
* Update E2E and coding standards to use PHP 8.0
* Un-linted unit-tests.yml. Github flows use 4 spaces indent, while our .editorconfig file enforces 2 spaces.
* Refactor unit-tests.yml
* Linted unit-tests.yml to proper 2 space indents
* Removed composer caching
* Test without hacky permissions step
* Concurrency disable.
Jobs renaming.
* Add step to install wp-env for PHP unit tests.
* Another try at fixing perms for wp-env
* Another try at fixing perms for wp-env
* Restore missing steps
* Move notices to corresponding context
* Change `errorMessageContext` to `context`
* Fix MD lint errors
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
* Allow observers to set billingAddress by returning billingData
This is required since we didn't correctly deprecate billingData when we changed the name to billingAddress
* Add link to original PR
* Set billingAddress when observer errors
* Rename shippingData to shippingAddress
* Add isBillingAddress and isShippingAddress type guards
* Add tests for new type guards
* Only set billing and shipping if they are valid objects
* Add tests for __internalEmitPaymentProcessingEvent thunk
* Update deprecated version
* Return promise from this function to aid with testability
* Add tests for shippingAddress and paymentMethodData
* Ensure correct value is used to set shipping address
* Move test data out of tests to aid with reusability
* Improve success callback name
* Add mocked __internalSetPaymentMethodData to correct object
It was in registry, but should be in dispatch as the action is on the same store as the thunk. Registry is used for actions on other stores.
* Add test for failed observers
* Add test for mixed observers
* Add comments explaining the destructure & deprecation
The "Coupon code" text was changed to "Add a coupon" and it resulted in the failing of an e2e test as it couldn't find the translated text for "Coupon code". The translation for "Add a coupon" is not available so changing the text to "Apply a coupon code" until the next WC Core release since the translation for the text "Apply a coupon code" is already available.
* Product Rating: Transition from using CSS margin to Global Styles
* Product Rating: Re-add css margins for Product Rating inside of the All Products block.
* Product Rating: Change bottom margin to 1rem
* Product Rating: Re-add the Classic Template fix.
* Product Rating: Remove the Classic Template fix.
* Product Price: Transition from using CSS margin to Global Styles
* Product Price: Re-add css margins for Product Price inside of the All Products block.
* Product Price: Change bottom margin to 1rem
* Product Price: Fix the margin typescript declaration.
* Scroll to errors when interacting with radio buttons
* Fix full stop wrapping in checkout
* Make type guard for api response reusable
* Merge useShippingData and useSelectShippingRate
Overlapping functionality and responsibility easily merged into a single hook.
* ShippingDataProvider Typescript
* Create errors when receiving errors via thunk
* Update DEFAULT_ERROR_MESSAGE
* Update tests since all errors are set via new action
* Correct SET_ERROR_DATA
* Update json error text and allow it to be dismissed
* Add back missing comment in types
* Put back typedef
* Allow Store Notice Containers to display subContexts without changing original context
* receiveError handles cart
* Update assets/js/data/cart/notify-errors.ts
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update assets/js/base/context/hooks/shipping/types.ts
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Remove debug
* Revise type (remove as)
* rename to unregisteredSubContexts
* getNoticeContexts comment
* Add test for unregistered errors
* Update comment
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Allow the context to be overridden when processing errors
* Export all error functions
* Allow customer data update if not editing fields
* removeNoticesWithContext Helper
* Hide rates when editing the address
* New update address logic
* Handle cancel for the form
* Block scaffolding
* Rename to store notices
* Register only in the site editor
* Update description
* Add woocommerce class
* Add tests
* Delete old test file
* Update notices message in the editor
* Remove customization
* Disable the block server side
* Fix TS error
* Add custom classes
* Reprashed test description
* Escape notices
* Remove unnecessary disabled component
* Only allow to insert the block once
* Improve class name
* Merge edit and block files
* Fix copy
* Simplify test case
* Remove align support
* Remove attributes
* Change editor markup
* Use the Notice component to display the notice placeholder on the editor
* Use sprintf to improve readability
* Inline component
* Remove styles and unregister scripts
* Use ordered placeholders
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Use info as the notices status
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix php lint error
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* WIP
* Render in editor and add styles
* Simplify select
* Undo change
* Update titles and description
* Wrapped text for translation
* Remove from products inner blocks
* Allow the block in the inserter
* Rename test file and add new tests for catalog-sorting block
* Register on the site editor only
* Fix tests
* Disable block server side
* Override the `enqueue_assets`
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix TS error
* Simplify edit
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Disable background color
* Add custom classes
* Remove alignment
* Inherit color and font properties
* Merge edit and block files
* Use sprintf to improve code readability
* Make fontsize small by default
* Add order placeholders and woocommerce class
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix floating issue
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add woocommerce class
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Init setup to add a new block Results Count
* Render template part as a content of ResultsCount block
* Switch to template part rendering
* Rename the block to ProductResultsCount
* Fix typo in BlockTypesController
* Change the ProductResultsCount class name
* Remove Product Results Count block from Product Query template
* Improve the way Product Results Count is rendered in the editor
* Add prefix to places that missed renaming from ResultsCount to ProductResultsCount
* Remove unnecessary frontend.tsx file for ProductResultsCount
* Make sure global styles are applied and respected by Product Results Count block
* Make sure the Product Results Count is available inly in Product Catalog template
* Add basic tests to Product Results Count
* Remove empty line in style file
* Fix TS issue in Product Results Count
* Fix typo
* Override the enqueue_assets method to prevent unnecessary enqueue and 404 error on the frontend
* Add necessary property to block's metadata
* Address code review feedback
* Update description
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Remove disabled component
* Improve test description
* Merge edit and block files
* Remove align support
* Remove background support
* Simplify edit component
* Improve readability with sprintf and add custom class
* Simplify test case
* Add styles and order placeholders
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix markup to match with the frontend
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add coupon link instead of dropdown in Cart and Checkout blocks
* Fix state names used for displaying the link and coupon form
* Fix storybook for coupon block
* Fix unit test for coupon block
* Fix css and accessibility
* Fix coupon block position on Checkout
* Update e2e test cases for coupon block (https://github.com/woocommerce/woocommerce-blocks/pull/8022)
* Update e2e test cases for coupon block
* Fix perfomance test for coupon block
* Fix double await typo
* Fix perfomance test for coupon block
* Remove CSS
* Use classnames to add and remove classes
Improved the code to use classnames to add and remove classes. Also, moved the logic to handle click and submit to separate functions.
* Remove unused action and type action
* Derive the incompatible payment methods with selector
Instead of adding the incompatiblePaymentMethods to the payment state.
Let's simply derive it using a selector to keep a minimal state.
* Check compatibility with express payments
* Custom validation strings using a new function named getValidityMessageForInput
* getValidityMessageForInput tests
* Added integration test for error message
* Clear value
* update test strings
* Shipping and collection method block package support (https://github.com/woocommerce/woocommerce-blocks/pull/7383)
* Shipment wordage
* Hide panel if collection is not available for an item
* Update selection when displayed
* Register a global local pickup method for the block based checkout (https://github.com/woocommerce/woocommerce-blocks/pull/7414)
* Register a blocks local pickup method globally
* Remove local pickup plucking from store api
* Multiple pickup locations
* Unused code
* Translate meta data
* Update UI to match zones table
* Description
* Handle new shipping method in client
* Improve location rendering
* Only split out pickup location methods
* Fix enabled toggle
* Show and hide shipping text in sidebar based on pickup
* No need for "from" when min and max are the same price
* Update sample data for the editor
* fix errors
* Force method/pickup in the checkout layout (https://github.com/woocommerce/woocommerce-blocks/pull/7910)
* Split up ShippingRatesControl for readability
* Alignment styling
* Split tidy packages for readability
* Combine hooks to prevent circular dependency
* Notice styling
* Conflict
* Hide notice with 1 package
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>