woocommerce/plugins/woocommerce-blocks/assets/js/blocks/classic-template/single-product.ts

124 lines
3.4 KiB
TypeScript
Raw Normal View History

[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
/**
* External dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
import { isWpVersion } from '@woocommerce/settings';
import { BlockInstance, createBlock } from '@wordpress/blocks';
import { VARIATION_NAME as PRODUCT_TITLE_VARIATION_NAME } from '@woocommerce/blocks/product-query/variations/elements/product-title';
import { VARIATION_NAME as PRODUCT_SUMMARY_VARIATION_NAME } from '@woocommerce/blocks/product-query/variations/elements/product-summary';
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
/**
* Internal dependencies
*/
import { OnClickCallbackParameter } from './types';
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
const getBlockifiedTemplate = () =>
[
createBlock( 'woocommerce/breadcrumbs' ),
Single Product Template: add the Store Notice block to the template (https://github.com/woocommerce/woocommerce-blocks/pull/8833) * 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>
2023-03-26 19:19:28 +00:00
createBlock( 'woocommerce/store-notices' ),
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
createBlock(
'core/columns',
{
align: 'wide',
},
[
createBlock(
'core/column',
{
type: 'constrained',
justifyContent: 'right',
},
[ createBlock( 'woocommerce/product-image-gallery' ) ]
),
createBlock( 'core/column', {}, [
createBlock( 'core/post-title', {
__woocommerceNamespace: PRODUCT_TITLE_VARIATION_NAME,
level: 1,
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
} ),
createBlock( 'woocommerce/product-rating' ),
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
createBlock( 'woocommerce/product-price', {
fontSize: 'large',
} ),
createBlock( 'core/post-excerpt', {
__woocommerceNamespace: PRODUCT_SUMMARY_VARIATION_NAME,
} ),
createBlock( 'woocommerce/add-to-cart-form' ),
createBlock( 'woocommerce/product-meta' ),
] ),
]
),
createBlock( 'woocommerce/product-details', {
align: 'wide',
} ),
createBlock( 'woocommerce/related-products', {
align: 'wide',
} ),
].filter( Boolean ) as BlockInstance[];
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
const isConversionPossible = () => {
// Blockification is possible for the WP version 6.1 and above,
// which are the versions the Products block supports.
return isWpVersion( '6.1', '>=' );
};
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
const getDescriptionAllowingConversion = ( templateTitle: string ) =>
sprintf(
/* translators: %s is the template title */
__(
'Transform this template into multiple blocks so you can add, remove, reorder, and customize your %s template.',
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
'woo-gutenberg-products-block'
),
templateTitle
);
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
const getDescriptionDisallowingConversion = ( templateTitle: string ) =>
sprintf(
/* translators: %s is the template title */
__(
'This block serves as a placeholder for your %s. It will display the actual product image, title, price in your store. You can move this placeholder around and add more blocks around to customize the template.',
'woo-gutenberg-products-block'
),
templateTitle
);
const getDescription = ( templateTitle: string, canConvert: boolean ) => {
if ( canConvert ) {
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
return getDescriptionAllowingConversion( templateTitle );
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
}
return getDescriptionDisallowingConversion( templateTitle );
};
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
const getButtonLabel = () =>
__( 'Transform into blocks', 'woo-gutenberg-products-block' );
const onClickCallback = ( {
clientId,
getBlocks,
replaceBlock,
selectBlock,
}: OnClickCallbackParameter ) => {
replaceBlock( clientId, getBlockifiedTemplate() );
const blocks = getBlocks();
const groupBlock = blocks.find(
( block ) =>
block.name === 'core/group' &&
block.innerBlocks.some(
( innerBlock ) => innerBlock.name === 'woocommerce/breadcrumbs'
)
Provide a way to switch to the blockified Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/8324) * 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>
2023-03-23 16:59:59 +00:00
);
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
if ( groupBlock ) {
selectBlock( groupBlock.clientId );
}
};
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
export {
getBlockifiedTemplate,
isConversionPossible,
getDescription,
getButtonLabel,
onClickCallback,
[Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248) * 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)
2023-02-27 14:34:18 +00:00
};