Merge pull request #23977 from woocommerce/remove/gutenberg-blocks

Remove existing Gutenberg Blocks code
This commit is contained in:
Mike Jolley 2019-06-26 11:52:40 +01:00 committed by GitHub
commit b0d043752d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 0 additions and 1118 deletions

View File

@ -297,13 +297,6 @@ module.exports = function( grunt ) {
clean: { clean: {
apidocs: { apidocs: {
src: [ 'wc-apidocs' ] src: [ 'wc-apidocs' ]
},
blocks: {
src: [
'<%= dirs.js %>/blocks',
'<%= dirs.css %>/blocks',
'<%= dirs.php %>/blocks'
]
} }
}, },
@ -344,52 +337,6 @@ module.exports = function( grunt ) {
'<%= dirs.css %>/*.css' '<%= dirs.css %>/*.css'
] ]
} }
},
// Copy block files from npm package.
copy: {
js: {
expand: true,
cwd: 'node_modules/@woocommerce/block-library/build',
src: '*.js',
dest: '<%= dirs.js %>/blocks/',
options: {
process: ( content ) => content.replace( /'woo-gutenberg-products-block'/g, "'woocommerce'" )
}
},
css: {
expand: true,
cwd: 'node_modules/@woocommerce/block-library/build',
src: '*.css',
dest: '<%= dirs.css %>/blocks/'
},
php: {
expand: true,
cwd: 'node_modules/@woocommerce/block-library/assets/php',
src: '*.php',
dest: '<%= dirs.php %>/blocks/',
rename: ( dest, src ) => dest + '/' + src.replace( '-wgpb-', '-wc-' ),
options: {
process: ( content ) => content
// Replace textdomain.
.replace( /'woo-gutenberg-products-block'/g, "'woocommerce'" )
// Replace source for JS files.
.replace(
/plugins_url\( 'build\/([\w-]*)\.js', WGPB_PLUGIN_FILE \)/g,
"WC()->plugin_url() . '/assets/js/blocks/$1.js'"
)
// Replace source for CSS files.
.replace(
/plugins_url\( 'build\/([\w-]*)\.css', WGPB_PLUGIN_FILE \)/g,
"WC()->plugin_url() . '/assets/css/blocks/$1.css'"
)
// Replace class & constant prefixes.
.replace( /WGPB_/g, 'WC_' )
.replace( /FP_VERSION/g, 'WGPB_VERSION' )
// Replace file imports
.replace( /-wgpb-/g, '-wc-' )
}
}
} }
}); });
@ -415,7 +362,6 @@ module.exports = function( grunt ) {
grunt.registerTask( 'default', [ grunt.registerTask( 'default', [
'js', 'js',
'css', 'css',
'blocks',
'i18n' 'i18n'
]); ]);
@ -434,11 +380,6 @@ module.exports = function( grunt ) {
'concat' 'concat'
]); ]);
grunt.registerTask( 'blocks', [
'clean:blocks',
'copy'
]);
grunt.registerTask( 'docs', [ grunt.registerTask( 'docs', [
'clean:apidocs', 'clean:apidocs',
'shell:apidocs' 'shell:apidocs'

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
.wc-block-featured-product{position:relative;background-color:#24292d;background-size:cover;background-position:50%;width:100%;margin:0 0 1.5em}.wc-block-featured-product,.wc-block-featured-product .wc-block-featured-product__wrapper{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;align-content:center}.wc-block-featured-product .wc-block-featured-product__wrapper{overflow:hidden;height:100%}.wc-block-featured-product.has-left-content{justify-content:flex-start}.wc-block-featured-product.has-left-content .wc-block-featured-product__description,.wc-block-featured-product.has-left-content .wc-block-featured-product__price,.wc-block-featured-product.has-left-content .wc-block-featured-product__title{margin-left:0;text-align:left}.wc-block-featured-product.has-right-content{justify-content:flex-end}.wc-block-featured-product.has-right-content .wc-block-featured-product__description,.wc-block-featured-product.has-right-content .wc-block-featured-product__price,.wc-block-featured-product.has-right-content .wc-block-featured-product__title{margin-right:0;text-align:right}.wc-block-featured-product .wc-block-featured-product__description,.wc-block-featured-product .wc-block-featured-product__price,.wc-block-featured-product .wc-block-featured-product__title{color:#fff;line-height:1.25;margin-bottom:0;text-align:center}.wc-block-featured-product .wc-block-featured-product__description a,.wc-block-featured-product .wc-block-featured-product__description a:active,.wc-block-featured-product .wc-block-featured-product__description a:focus,.wc-block-featured-product .wc-block-featured-product__description a:hover,.wc-block-featured-product .wc-block-featured-product__price a,.wc-block-featured-product .wc-block-featured-product__price a:active,.wc-block-featured-product .wc-block-featured-product__price a:focus,.wc-block-featured-product .wc-block-featured-product__price a:hover,.wc-block-featured-product .wc-block-featured-product__title a,.wc-block-featured-product .wc-block-featured-product__title a:active,.wc-block-featured-product .wc-block-featured-product__title a:focus,.wc-block-featured-product .wc-block-featured-product__title a:hover{color:#fff}.wc-block-featured-product .wc-block-featured-product__description,.wc-block-featured-product .wc-block-featured-product__link,.wc-block-featured-product .wc-block-featured-product__price,.wc-block-featured-product .wc-block-featured-product__title{width:100%;padding:0 48px 16px;z-index:1}.wc-block-featured-product .wc-block-featured-product__title{margin-top:0}.wc-block-featured-product .wc-block-featured-product__title:before{display:none}.wc-block-featured-product .wc-block-featured-product__description p{margin:0}.wc-block-featured-product.has-background-dim:before{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-color:inherit;opacity:.5;z-index:1}.wc-block-featured-product.has-background-dim.has-background-dim-10:before{opacity:.1}.wc-block-featured-product.has-background-dim.has-background-dim-20:before{opacity:.2}.wc-block-featured-product.has-background-dim.has-background-dim-30:before{opacity:.3}.wc-block-featured-product.has-background-dim.has-background-dim-40:before{opacity:.4}.wc-block-featured-product.has-background-dim.has-background-dim-50:before{opacity:.5}.wc-block-featured-product.has-background-dim.has-background-dim-60:before{opacity:.6}.wc-block-featured-product.has-background-dim.has-background-dim-70:before{opacity:.7}.wc-block-featured-product.has-background-dim.has-background-dim-80:before{opacity:.8}.wc-block-featured-product.has-background-dim.has-background-dim-90:before{opacity:.9}.wc-block-featured-product.has-background-dim.has-background-dim-100:before{opacity:1}.wc-block-featured-product.alignleft,.wc-block-featured-product.alignright{max-width:305px;width:100%}.wc-block-featured-product:after{display:block;content:"";font-size:0;min-height:inherit}@supports ((position:-webkit-sticky) or (position:sticky)){.wc-block-featured-product:after{content:none}}.wc-block-featured-product.aligncenter,.wc-block-featured-product.alignleft,.wc-block-featured-product.alignright{display:flex}
.wp-block-woocommerce-handpicked-products.is-hidden-price .price,.wp-block-woocommerce-handpicked-products.is-hidden-title .woocommerce-loop-product__title,.wp-block-woocommerce-product-best-sellers.is-hidden-price .price,.wp-block-woocommerce-product-best-sellers.is-hidden-title .woocommerce-loop-product__title,.wp-block-woocommerce-product-category.is-hidden-price .price,.wp-block-woocommerce-product-category.is-hidden-title .woocommerce-loop-product__title,.wp-block-woocommerce-product-new.is-hidden-price .price,.wp-block-woocommerce-product-new.is-hidden-title .woocommerce-loop-product__title,.wp-block-woocommerce-product-on-sale.is-hidden-price .price,.wp-block-woocommerce-product-on-sale.is-hidden-title .woocommerce-loop-product__title,.wp-block-woocommerce-product-top-rated.is-hidden-price .price,.wp-block-woocommerce-product-top-rated.is-hidden-title .woocommerce-loop-product__title,.wp-block-woocommerce-products-by-attribute.is-hidden-price .price,.wp-block-woocommerce-products-by-attribute.is-hidden-title .woocommerce-loop-product__title{display:none!important}.wp-block-woocommerce-handpicked-products.is-hidden-rating .star-rating,.wp-block-woocommerce-product-best-sellers.is-hidden-rating .star-rating,.wp-block-woocommerce-product-category.is-hidden-rating .star-rating,.wp-block-woocommerce-product-new.is-hidden-rating .star-rating,.wp-block-woocommerce-product-on-sale.is-hidden-rating .star-rating,.wp-block-woocommerce-product-top-rated.is-hidden-rating .star-rating,.wp-block-woocommerce-products-by-attribute.is-hidden-rating .star-rating{display:none}.wp-block-woocommerce-handpicked-products.is-hidden-button .button[data-product_sku],.wp-block-woocommerce-product-best-sellers.is-hidden-button .button[data-product_sku],.wp-block-woocommerce-product-category.is-hidden-button .button[data-product_sku],.wp-block-woocommerce-product-new.is-hidden-button .button[data-product_sku],.wp-block-woocommerce-product-on-sale.is-hidden-button .button[data-product_sku],.wp-block-woocommerce-product-top-rated.is-hidden-button .button[data-product_sku],.wp-block-woocommerce-products-by-attribute.is-hidden-button .button[data-product_sku]{display:none!important}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,176 +0,0 @@
<?php
/**
* Display the featured product block in the content.
* NOTE: DO NOT edit this file in WooCommerce core, this is generated from woocommerce-gutenberg-products-block.
*
* @package WooCommerce\Blocks
* @version 1.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Wrapper class for Featured Product callback.
*/
class WC_Block_Featured_Product {
/**
* Block name.
*
* @var string
*/
protected static $block_name = 'featured-product';
/**
* Default attribute values, should match what's set in JS `registerBlockType`.
*
* @var array
*/
protected static $defaults = array(
'align' => 'none',
'contentAlign' => 'center',
'dimRatio' => 50,
'height' => false,
'mediaId' => 0,
'mediaSrc' => '',
'showDesc' => true,
'showPrice' => true,
);
/**
* Render the Featured Product block.
*
* @param array $attributes Block attributes. Default empty array.
* @param string $content Block content. Default empty string.
* @return string Rendered block type output.
*/
public static function render( $attributes, $content ) {
$id = isset( $attributes['productId'] ) ? (int) $attributes['productId'] : 0;
$product = wc_get_product( $id );
if ( ! $product ) {
return '';
}
$attributes = wp_parse_args( $attributes, self::$defaults );
if ( ! $attributes['height'] ) {
$attributes['height'] = wc_get_theme_support( 'featured_block::default_height', 500 );
}
$title = sprintf(
'<h2 class="wc-block-featured-product__title">%s</h2>',
wp_kses_post( $product->get_title() )
);
$desc_str = sprintf(
'<div class="wc-block-featured-product__description">%s</div>',
apply_filters( 'woocommerce_short_description', $product->get_short_description() )
);
$price_str = sprintf(
'<div class="wc-block-featured-product__price">%s</div>',
$product->get_price_html()
);
$output = sprintf( '<div class="%1$s" style="%2$s">', self::get_classes( $attributes ), self::get_styles( $attributes, $product ) );
$output .= $title;
if ( $attributes['showDesc'] ) {
$output .= $desc_str;
}
if ( $attributes['showPrice'] ) {
$output .= $price_str;
}
$output .= '<div class="wc-block-featured-product__link">' . $content . '</div>';
$output .= '</div>';
return $output;
}
/**
* Get the styles for the wrapper element (background image, color).
*
* @param array $attributes Block attributes. Default empty array.
* @param WC_Product $product Product object.
* @return string
*/
public static function get_styles( $attributes, $product ) {
$style = '';
$image_size = 'large';
if ( 'none' !== $attributes['align'] || $attributes['height'] > 800 ) {
$image_size = 'full';
}
if ( $attributes['mediaId'] ) {
$image = wp_get_attachment_image_url( $attributes['mediaId'], $image_size );
} else {
$image = self::get_image( $product, $image_size );
}
if ( ! empty( $image ) ) {
$style .= sprintf( 'background-image:url(%s);', esc_url( $image ) );
}
if ( isset( $attributes['customOverlayColor'] ) ) {
$style .= sprintf( 'background-color:%s;', esc_attr( $attributes['customOverlayColor'] ) );
}
if ( isset( $attributes['height'] ) ) {
$style .= sprintf( 'min-height:%dpx;', intval( $attributes['height'] ) );
}
return $style;
}
/**
* Get class names for the block container.
*
* @param array $attributes Block attributes. Default empty array.
* @return string
*/
public static function get_classes( $attributes ) {
$classes = array( 'wc-block-' . self::$block_name );
if ( isset( $attributes['align'] ) ) {
$classes[] = "align{$attributes['align']}";
}
if ( isset( $attributes['dimRatio'] ) && ( 0 !== $attributes['dimRatio'] ) ) {
$classes[] = 'has-background-dim';
if ( 50 !== $attributes['dimRatio'] ) {
$classes[] = 'has-background-dim-' . 10 * round( $attributes['dimRatio'] / 10 );
}
}
if ( isset( $attributes['contentAlign'] ) && 'center' !== $attributes['contentAlign'] ) {
$classes[] = "has-{$attributes['contentAlign']}-content";
}
if ( isset( $attributes['overlayColor'] ) ) {
$classes[] = "has-{$attributes['overlayColor']}-background-color";
}
return implode( $classes, ' ' );
}
/**
* Returns the main product image URL.
*
* @param WC_Product $product Product object.
* @param string $size Image size, defaults to 'full'.
* @return string
*/
public static function get_image( $product, $size = 'full' ) {
$image = '';
if ( $product->get_image_id() ) {
$image = wp_get_attachment_image_url( $product->get_image_id(), $size );
} elseif ( $product->get_parent_id() ) {
$parent_product = wc_get_product( $product->get_parent_id() );
if ( $parent_product ) {
$image = wp_get_attachment_image_url( $parent_product->get_image_id(), $size );
}
}
return $image;
}
}

View File

@ -1,303 +0,0 @@
<?php
/**
* Register the scripts, styles, and blocks needed for the block editor.
* NOTE: DO NOT edit this file in WooCommerce core, this is generated from woocommerce-gutenberg-products-block.
*
* @package WooCommerce\Blocks
* @version 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Block_Library Class.
*/
class WC_Block_Library {
/**
* Class instance.
*
* @var WC_Block_Library instance
*/
protected static $instance = null;
/**
* Get class instance
*/
public static function get_instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
if ( function_exists( 'register_block_type' ) ) {
add_action( 'init', array( 'WC_Block_Library', 'init' ) );
}
}
/**
* Initialize block library features.
*/
public static function init() {
// Shortcut out if we see the feature plugin, v1.4 or below.
// note: `WGPB_VERSION` is transformed to `WC_VERSION` in the grunt copy task.
if ( defined( 'WGPB_VERSION' ) && version_compare( WGPB_VERSION, '1.4.0', '<=' ) ) {
return;
}
self::register_blocks();
self::register_assets();
add_filter( 'block_categories', array( 'WC_Block_Library', 'add_block_category' ) );
add_action( 'admin_print_footer_scripts', array( 'WC_Block_Library', 'print_script_settings' ), 1 );
}
/**
* Get the file modified time as a cache buster if we're in dev mode.
*
* @param string $file Local path to the file.
* @return string The cache buster value to use for the given file.
*/
protected static function get_file_version( $file ) {
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
$file = trim( $file, '/' );
return filemtime( WC_ABSPATH . $file );
}
return WC_VERSION;
}
/**
* Registers a script according to `wp_register_script`, additionally loading the translations for the file.
*
* @since 2.0.0
*
* @param string $handle Name of the script. Should be unique.
* @param string $src Full URL of the script, or path of the script relative to the WordPress root directory.
* @param array $deps Optional. An array of registered script handles this script depends on. Default empty array.
* @param bool $has_i18n Optional. Whether to add a script translation call to this file. Default 'true'.
*/
protected static function register_script( $handle, $src, $deps = array(), $has_i18n = true ) {
$filename = str_replace( plugins_url( '/', WC_PLUGIN_FILE ), '', $src );
$ver = self::get_file_version( $filename );
wp_register_script( $handle, $src, $deps, $ver, true );
if ( $has_i18n && function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( $handle, 'woocommerce', WC_ABSPATH . 'languages' );
}
}
/**
* Registers a style according to `wp_register_style`.
*
* @since 2.0.0
*
* @param string $handle Name of the stylesheet. Should be unique.
* @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
* @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
* @param string $media Optional. The media for which this stylesheet has been defined. Default 'all'. Accepts media types like
* 'all', 'print' and 'screen', or media queries like '(orientation: portrait)' and '(max-width: 640px)'.
*/
protected static function register_style( $handle, $src, $deps = array(), $media = 'all' ) {
$filename = str_replace( plugins_url( '/', WC_PLUGIN_FILE ), '', $src );
$ver = self::get_file_version( $filename );
wp_register_style( $handle, $src, $deps, $ver, $media );
}
/**
* Register block scripts & styles.
*
* @since 2.0.0
*/
public static function register_assets() {
self::register_style( 'wc-block-editor', WC()->plugin_url() . '/assets/css/blocks/editor.css', array( 'wp-edit-blocks' ) );
self::register_style( 'wc-block-style', WC()->plugin_url() . '/assets/css/blocks/style.css', array() );
// Shared libraries and components across all blocks.
self::register_script( 'wc-vendors', WC()->plugin_url() . '/assets/js/blocks/vendors.js', array(), false );
$block_dependencies = array(
'wp-api-fetch',
'wp-blocks',
'wp-components',
'wp-compose',
'wp-data',
'wp-element',
'wp-editor',
'wp-i18n',
'wp-url',
'lodash',
'wc-vendors',
);
self::register_script( 'wc-handpicked-products', WC()->plugin_url() . '/assets/js/blocks/handpicked-products.js', $block_dependencies );
self::register_script( 'wc-product-best-sellers', WC()->plugin_url() . '/assets/js/blocks/product-best-sellers.js', $block_dependencies );
self::register_script( 'wc-product-category', WC()->plugin_url() . '/assets/js/blocks/product-category.js', $block_dependencies );
self::register_script( 'wc-product-new', WC()->plugin_url() . '/assets/js/blocks/product-new.js', $block_dependencies );
self::register_script( 'wc-product-on-sale', WC()->plugin_url() . '/assets/js/blocks/product-on-sale.js', $block_dependencies );
self::register_script( 'wc-product-top-rated', WC()->plugin_url() . '/assets/js/blocks/product-top-rated.js', $block_dependencies );
self::register_script( 'wc-products-attribute', WC()->plugin_url() . '/assets/js/blocks/products-attribute.js', $block_dependencies );
self::register_script( 'wc-featured-product', WC()->plugin_url() . '/assets/js/blocks/featured-product.js', $block_dependencies );
}
/**
* Register blocks, hooking up assets and render functions as needed.
*
* @since 2.0.0
*/
public static function register_blocks() {
require_once dirname( __FILE__ ) . '/class-wc-block-featured-product.php';
register_block_type(
'woocommerce/handpicked-products',
array(
'editor_script' => 'wc-handpicked-products',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
register_block_type(
'woocommerce/product-best-sellers',
array(
'editor_script' => 'wc-product-best-sellers',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
register_block_type(
'woocommerce/product-category',
array(
'editor_script' => 'wc-product-category',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
register_block_type(
'woocommerce/product-new',
array(
'editor_script' => 'wc-product-new',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
register_block_type(
'woocommerce/product-on-sale',
array(
'editor_script' => 'wc-product-on-sale',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
register_block_type(
'woocommerce/product-top-rated',
array(
'editor_script' => 'wc-product-top-rated',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
register_block_type(
'woocommerce/products-by-attribute',
array(
'editor_script' => 'wc-products-attribute',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
register_block_type(
'woocommerce/featured-product',
array(
'render_callback' => array( 'WC_Block_Featured_Product', 'render' ),
'editor_script' => 'wc-featured-product',
'editor_style' => 'wc-block-editor',
'style' => 'wc-block-style',
)
);
}
/**
* Adds a WooCommerce category to the block inserter.
*
* @since 2.0.0
*
* @param array $categories Array of categories.
* @return array Array of block categories.
*/
public static function add_block_category( $categories ) {
return array_merge(
$categories,
array(
array(
'slug' => 'woocommerce',
'title' => __( 'WooCommerce', 'woocommerce' ),
'icon' => 'woocommerce',
),
)
);
}
/**
* Output useful globals before printing any script tags.
*
* These are used by @woocommerce/components & the block library to set up defaults
* based on user-controlled settings from WordPress.
*
* @since 2.0.0
*/
public static function print_script_settings() {
global $wp_locale;
$code = get_woocommerce_currency();
// NOTE: wcSettings is not used directly, it's only for @woocommerce/components
//
// Settings and variables can be passed here for access in the app.
// Will need `wcAdminAssetUrl` if the ImageAsset component is used.
// Will need `dataEndpoints.countries` if Search component is used with 'country' type.
// Will need `orderStatuses` if the OrderStatus component is used.
// Deliberately excluding: `embedBreadcrumbs`, `trackingEnabled`.
$settings = array(
'adminUrl' => admin_url(),
'wcAssetUrl' => plugins_url( 'assets/', WC_PLUGIN_FILE ),
'siteLocale' => esc_attr( get_bloginfo( 'language' ) ),
'currency' => array(
'code' => $code,
'precision' => wc_get_price_decimals(),
'symbol' => get_woocommerce_currency_symbol( $code ),
'position' => get_option( 'woocommerce_currency_pos' ),
),
'stockStatuses' => wc_get_product_stock_status_options(),
'siteTitle' => get_bloginfo( 'name' ),
'dataEndpoints' => array(),
'l10n' => array(
'userLocale' => get_user_locale(),
'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
),
);
// NOTE: wcSettings is not used directly, it's only for @woocommerce/components.
$settings = apply_filters( 'woocommerce_components_settings', $settings );
// Global settings used in each block.
$block_settings = array(
'min_columns' => wc_get_theme_support( 'product_blocks::min_columns', 1 ),
'max_columns' => wc_get_theme_support( 'product_blocks::max_columns', 6 ),
'default_columns' => wc_get_theme_support( 'product_blocks::default_columns', 3 ),
'min_rows' => wc_get_theme_support( 'product_blocks::min_rows', 1 ),
'max_rows' => wc_get_theme_support( 'product_blocks::max_rows', 6 ),
'default_rows' => wc_get_theme_support( 'product_blocks::default_rows', 1 ),
'thumbnail_size' => wc_get_theme_support( 'thumbnail_image_width', 300 ),
'placeholderImgSrc' => wc_placeholder_img_src(),
'min_height' => wc_get_theme_support( 'featured_block::min_height', 500 ),
'default_height' => wc_get_theme_support( 'featured_block::default_height', 500 ),
);
?>
<script type="text/javascript">
var wcSettings = wcSettings || JSON.parse( decodeURIComponent( '<?php echo rawurlencode( wp_json_encode( $settings ) ); ?>' ) );
var wc_product_block_data = JSON.parse( decodeURIComponent( '<?php echo rawurlencode( wp_json_encode( $block_settings ) ); ?>' ) );
</script>
<?php
}
}
WC_Block_Library::get_instance();

View File

@ -430,13 +430,6 @@ final class WooCommerce {
include_once WC_ABSPATH . 'includes/class-wc-auth.php'; include_once WC_ABSPATH . 'includes/class-wc-auth.php';
include_once WC_ABSPATH . 'includes/class-wc-register-wp-admin-settings.php'; include_once WC_ABSPATH . 'includes/class-wc-register-wp-admin-settings.php';
/**
* Blocks.
*/
if ( file_exists( WC_ABSPATH . 'includes/blocks/class-wc-block-library.php' ) ) {
include_once WC_ABSPATH . 'includes/blocks/class-wc-block-library.php';
}
/** /**
* Libraries * Libraries
*/ */

View File

@ -19,9 +19,6 @@
"test:single": "cross-env NODE_CONFIG_DIR='./tests/e2e-tests/config' BABEL_ENV=commonjs mocha --require babel-register", "test:single": "cross-env NODE_CONFIG_DIR='./tests/e2e-tests/config' BABEL_ENV=commonjs mocha --require babel-register",
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && node ./node_modules/husky/husky.js install" "git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && node ./node_modules/husky/husky.js install"
}, },
"dependencies": {
"@woocommerce/block-library": "2.0.1"
},
"devDependencies": { "devDependencies": {
"autoprefixer": "9.6.0", "autoprefixer": "9.6.0",
"babel": "6.23.0", "babel": "6.23.0",