2018-02-13 19:03:53 +00:00
/******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , {
/******/ configurable : false ,
/******/ enumerable : true ,
/******/ get : getter
/******/ } ) ;
/******/ }
/******/ } ;
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
/******/
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "" ;
/******/
/******/ // Load entry module and return exports
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = 0 ) ;
/******/ } )
/************************************************************************/
/******/ ( [
/* 0 */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _slicedToArray = function ( ) { function sliceIterator ( arr , i ) { var _arr = [ ] ; var _n = true ; var _d = false ; var _e = undefined ; try { for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; } return function ( arr , i ) { if ( Array . isArray ( arr ) ) { return arr ; } else if ( Symbol . iterator in Object ( arr ) ) { return sliceIterator ( arr , i ) ; } else { throw new TypeError ( "Invalid attempt to destructure non-iterable instance" ) ; } } ; } ( ) ;
var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
2018-02-15 18:16:14 +00:00
var _specificSelect = _ _webpack _require _ _ ( 1 ) ;
var _categorySelect = _ _webpack _require _ _ ( 2 ) ;
var _attributeSelect = _ _webpack _require _ _ ( 3 ) ;
2018-02-13 19:03:53 +00:00
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; }
var _ _ = wp . i18n . _ _ ;
var _wp$blocks = wp . blocks ,
registerBlockType = _wp$blocks . registerBlockType ,
InspectorControls = _wp$blocks . InspectorControls ,
BlockControls = _wp$blocks . BlockControls ;
var _wp$components = wp . components ,
Toolbar = _wp$components . Toolbar ,
withAPIData = _wp$components . withAPIData ,
Dropdown = _wp$components . Dropdown ;
var RangeControl = InspectorControls . RangeControl ,
ToggleControl = InspectorControls . ToggleControl ,
SelectControl = InspectorControls . SelectControl ;
2018-02-15 18:16:14 +00:00
2018-02-15 17:42:24 +00:00
/ * *
* A setting has the following properties :
* title - Display title of the setting .
* description - Display description of the setting .
* value - Display setting slug to set when selected .
* group _container - ( optional ) If set the setting is a parent container .
* /
var PRODUCTS _BLOCK _DISPLAY _SETTINGS = {
'specific' : {
title : _ _ ( 'Individual products' ) ,
description : _ _ ( 'Hand-pick which products to display' ) ,
value : 'specific'
} ,
'category' : {
title : _ _ ( 'Product category' ) ,
description : _ _ ( 'Display products from a specific category or multiple categories' ) ,
value : 'category'
} ,
'filter' : {
title : _ _ ( 'Filter products' ) ,
description : _ _ ( 'E.g. featured products, or products with a specific attribute like size or color' ) ,
value : 'filter' ,
group _container : 'filter'
} ,
'featured' : {
title : _ _ ( 'Featured products' ) ,
description : '' ,
value : 'featured'
} ,
'best_sellers' : {
title : _ _ ( 'Best sellers' ) ,
description : '' ,
value : 'best_sellers'
} ,
'best_rated' : {
title : _ _ ( 'Best rated' ) ,
description : '' ,
value : 'best_rated'
} ,
'on_sale' : {
title : _ _ ( 'On sale' ) ,
description : '' ,
value : 'on_sale'
} ,
'attribute' : {
title : _ _ ( 'Attribute' ) ,
description : '' ,
value : 'attribute'
} ,
'all' : {
title : _ _ ( 'All products' ) ,
description : _ _ ( 'Display all products ordered chronologically' ) ,
value : 'all'
}
} ;
2018-02-13 19:03:53 +00:00
/ * *
2018-02-15 18:16:14 +00:00
* One option from the list of all available ways to display products .
2018-02-13 19:03:53 +00:00
* /
2018-02-15 18:16:14 +00:00
var ProductsBlockSettingsEditorDisplayOption = function ( _React$Component ) {
_inherits ( ProductsBlockSettingsEditorDisplayOption , _React$Component ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
function ProductsBlockSettingsEditorDisplayOption ( ) {
_classCallCheck ( this , ProductsBlockSettingsEditorDisplayOption ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
return _possibleConstructorReturn ( this , ( ProductsBlockSettingsEditorDisplayOption . _ _proto _ _ || Object . getPrototypeOf ( ProductsBlockSettingsEditorDisplayOption ) ) . apply ( this , arguments ) ) ;
2018-02-13 19:03:53 +00:00
}
2018-02-15 18:16:14 +00:00
_createClass ( ProductsBlockSettingsEditorDisplayOption , [ {
2018-02-15 17:42:24 +00:00
key : 'render' ,
2018-02-13 19:03:53 +00:00
value : function render ( ) {
2018-02-15 18:16:14 +00:00
var _this2 = this ;
2018-02-13 19:03:53 +00:00
return wp . element . createElement (
2018-02-15 17:42:24 +00:00
'div' ,
2018-02-15 18:16:14 +00:00
{ className : 'wc-products-display-option value-' + this . props . value , onClick : function onClick ( ) {
_this2 . props . update _display _callback ( _this2 . props . value ) ;
} } ,
2018-02-13 19:03:53 +00:00
wp . element . createElement (
2018-02-15 18:16:14 +00:00
'h4' ,
null ,
this . props . title
2018-02-13 19:03:53 +00:00
) ,
2018-02-15 18:16:14 +00:00
wp . element . createElement (
'p' ,
null ,
this . props . description
)
2018-02-13 19:03:53 +00:00
) ;
}
} ] ) ;
2018-02-15 18:16:14 +00:00
return ProductsBlockSettingsEditorDisplayOption ;
2018-02-13 19:03:53 +00:00
} ( React . Component ) ;
2018-02-15 18:16:14 +00:00
/ * *
* A list of all available ways to display products .
* /
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var ProductsBlockSettingsEditorDisplayOptions = function ( _React$Component2 ) {
_inherits ( ProductsBlockSettingsEditorDisplayOptions , _React$Component2 ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
function ProductsBlockSettingsEditorDisplayOptions ( ) {
_classCallCheck ( this , ProductsBlockSettingsEditorDisplayOptions ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
return _possibleConstructorReturn ( this , ( ProductsBlockSettingsEditorDisplayOptions . _ _proto _ _ || Object . getPrototypeOf ( ProductsBlockSettingsEditorDisplayOptions ) ) . apply ( this , arguments ) ) ;
}
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
_createClass ( ProductsBlockSettingsEditorDisplayOptions , [ {
key : 'render' ,
value : function render ( ) {
var classes = 'display-settings-container' ;
if ( this . props . existing ) {
classes += ' existing' ;
}
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var display _settings = [ ] ;
for ( var setting _key in PRODUCTS _BLOCK _DISPLAY _SETTINGS ) {
display _settings . push ( wp . element . createElement ( ProductsBlockSettingsEditorDisplayOption , _extends ( { } , PRODUCTS _BLOCK _DISPLAY _SETTINGS [ setting _key ] , { update _display _callback : this . props . update _display _callback } ) ) ) ;
}
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var description = null ;
if ( ! this . props . existing ) {
description = wp . element . createElement (
'p' ,
null ,
_ _ ( 'Choose which products you\'d like to display:' )
) ;
}
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
return wp . element . createElement (
'div' ,
{ className : classes } ,
description ,
display _settings
) ;
}
} ] ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
return ProductsBlockSettingsEditorDisplayOptions ;
} ( React . Component ) ;
2018-02-13 19:03:53 +00:00
/ * *
2018-02-15 18:16:14 +00:00
* The products block when in Edit mode .
2018-02-13 19:03:53 +00:00
* /
2018-02-15 18:16:14 +00:00
var ProductsBlockSettingsEditor = function ( _React$Component3 ) {
_inherits ( ProductsBlockSettingsEditor , _React$Component3 ) ;
2018-02-13 19:03:53 +00:00
/ * *
* Constructor .
* /
2018-02-15 18:16:14 +00:00
function ProductsBlockSettingsEditor ( props ) {
_classCallCheck ( this , ProductsBlockSettingsEditor ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var _this4 = _possibleConstructorReturn ( this , ( ProductsBlockSettingsEditor . _ _proto _ _ || Object . getPrototypeOf ( ProductsBlockSettingsEditor ) ) . call ( this , props ) ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
_this4 . state = {
display : props . selected _display ,
menu _visible : props . selected _display ? false : true ,
expanded _group : ''
2018-02-13 19:03:53 +00:00
} ;
2018-02-15 18:16:14 +00:00
_this4 . updateDisplay = _this4 . updateDisplay . bind ( _this4 ) ;
return _this4 ;
2018-02-13 19:03:53 +00:00
}
/ * *
2018-02-15 18:16:14 +00:00
* Update the display settings for the block .
2018-02-13 19:03:53 +00:00
*
2018-02-15 18:16:14 +00:00
* @ param value String
2018-02-13 19:03:53 +00:00
* /
2018-02-15 18:16:14 +00:00
_createClass ( ProductsBlockSettingsEditor , [ {
key : 'updateDisplay' ,
value : function updateDisplay ( value ) {
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
// If not a group update display.
var new _state = {
display : value ,
menu _visible : false ,
expanded _group : ''
} ;
2018-02-13 19:03:53 +00:00
2018-02-15 19:54:03 +00:00
var is _group = 'undefined' !== PRODUCTS _BLOCK _DISPLAY _SETTINGS [ value ] . group _container && PRODUCTS _BLOCK _DISPLAY _SETTINGS [ value ] . group _container ;
if ( is _group ) {
2018-02-19 19:57:37 +00:00
// If the group has not been expanded, expand it.
2018-02-15 18:16:14 +00:00
new _state = {
menu _visible : true ,
expanded _group : value
2018-02-15 19:54:03 +00:00
2018-02-19 19:57:37 +00:00
// If the group has already been expanded, collapse it.
2018-02-15 19:54:03 +00:00
} ; if ( this . state . expanded _group === PRODUCTS _BLOCK _DISPLAY _SETTINGS [ value ] . group _container ) {
new _state . expanded _group = '' ;
}
2018-02-15 18:16:14 +00:00
}
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
this . setState ( new _state ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
// Only update the display setting if a non-group setting was selected.
2018-02-15 19:54:03 +00:00
if ( ! is _group ) {
2018-02-15 18:16:14 +00:00
this . props . update _display _callback ( value ) ;
}
2018-02-13 19:03:53 +00:00
}
/ * *
2018-02-15 18:16:14 +00:00
* Render the display settings dropdown and any extra contextual settings .
2018-02-13 19:03:53 +00:00
* /
} , {
2018-02-15 17:42:24 +00:00
key : 'render' ,
2018-02-13 19:03:53 +00:00
value : function render ( ) {
2018-02-15 18:16:14 +00:00
var _this5 = this ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var extra _settings = null ;
if ( 'specific' === this . state . display ) {
extra _settings = wp . element . createElement ( _specificSelect . ProductsSpecificSelect , null ) ;
} else if ( 'category' === this . state . display ) {
extra _settings = wp . element . createElement ( _categorySelect . ProductsCategorySelect , this . props ) ;
} else if ( 'attribute' === this . state . display ) {
extra _settings = wp . element . createElement ( _attributeSelect . ProductsAttributeSelect , null ) ;
}
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var menu = this . state . menu _visible ? wp . element . createElement ( ProductsBlockSettingsEditorDisplayOptions , { existing : this . state . display ? true : false , update _display _callback : this . updateDisplay } ) : null ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var heading = null ;
if ( this . state . display ) {
var menu _link = wp . element . createElement (
'a' ,
{ onClick : function onClick ( ) {
_this5 . setState ( { menu _visible : true } ) ;
} } ,
_ _ ( 'Display different products' )
) ;
if ( this . state . menu _visible ) {
menu _link = wp . element . createElement (
'a' ,
{ onClick : function onClick ( ) {
_this5 . setState ( { menu _visible : false } ) ;
} } ,
_ _ ( 'Cancel' )
) ;
}
2018-02-15 17:42:24 +00:00
heading = wp . element . createElement (
'div' ,
{ className : 'settings-heading' } ,
wp . element . createElement (
'div' ,
{ className : 'currently-displayed' } ,
_ _ ( 'Displaying ' ) ,
wp . element . createElement (
'strong' ,
null ,
_ _ ( PRODUCTS _BLOCK _DISPLAY _SETTINGS [ this . state . display ] . title )
)
) ,
wp . element . createElement (
'div' ,
{ className : 'change-display' } ,
menu _link
2018-02-13 19:03:53 +00:00
)
) ;
}
return wp . element . createElement (
2018-02-15 17:42:24 +00:00
'div' ,
{ className : 'wc-product-display-settings ' + ( this . state . expanded _group ? 'expanded-group-' + this . state . expanded _group : '' ) } ,
wp . element . createElement (
'h4' ,
null ,
_ _ ( 'Products' )
) ,
2018-02-13 19:03:53 +00:00
heading ,
menu ,
extra _settings ,
wp . element . createElement (
2018-02-15 17:42:24 +00:00
'div' ,
{ className : 'block-footer' } ,
2018-02-13 19:03:53 +00:00
wp . element . createElement (
2018-02-15 17:42:24 +00:00
'button' ,
{ type : 'button' , className : 'button button-large' , onClick : this . props . done _callback } ,
2018-02-13 19:03:53 +00:00
_ _ ( 'Done' )
)
)
) ;
}
} ] ) ;
return ProductsBlockSettingsEditor ;
} ( React . Component ) ;
/ * *
* One product in the product block preview .
* /
2018-02-15 18:16:14 +00:00
var ProductPreview = function ( _React$Component4 ) {
_inherits ( ProductPreview , _React$Component4 ) ;
2018-02-13 19:03:53 +00:00
function ProductPreview ( ) {
_classCallCheck ( this , ProductPreview ) ;
return _possibleConstructorReturn ( this , ( ProductPreview . _ _proto _ _ || Object . getPrototypeOf ( ProductPreview ) ) . apply ( this , arguments ) ) ;
}
_createClass ( ProductPreview , [ {
2018-02-15 17:42:24 +00:00
key : 'render' ,
2018-02-13 19:03:53 +00:00
value : function render ( ) {
var _props = this . props ,
attributes = _props . attributes ,
product = _props . product ;
var image = null ;
if ( product . images . length ) {
2018-02-15 17:42:24 +00:00
image = wp . element . createElement ( 'img' , { src : product . images [ 0 ] . src } ) ;
2018-02-13 19:03:53 +00:00
}
var title = null ;
if ( attributes . display _title ) {
title = wp . element . createElement (
2018-02-15 17:42:24 +00:00
'div' ,
{ className : 'product-title' } ,
2018-02-13 19:03:53 +00:00
product . name
) ;
}
var price = null ;
if ( attributes . display _price ) {
price = wp . element . createElement (
2018-02-15 17:42:24 +00:00
'div' ,
{ className : 'product-price' } ,
2018-02-13 19:03:53 +00:00
product . price
) ;
}
var add _to _cart = null ;
if ( attributes . display _add _to _cart ) {
add _to _cart = wp . element . createElement (
2018-02-15 17:42:24 +00:00
'span' ,
{ className : 'product-add-to-cart' } ,
2018-02-13 19:03:53 +00:00
_ _ ( 'Add to cart' )
) ;
}
return wp . element . createElement (
2018-02-15 17:42:24 +00:00
'div' ,
{ className : 'product-preview' } ,
2018-02-13 19:03:53 +00:00
image ,
title ,
price ,
add _to _cart
) ;
}
} ] ) ;
return ProductPreview ;
} ( React . Component ) ;
/ * *
* Renders a preview of what the block will look like with current settings .
* /
2018-02-15 18:16:14 +00:00
var ProductsBlockPreview = withAPIData ( function ( _ref ) {
var attributes = _ref . attributes ;
2018-02-13 19:03:53 +00:00
var columns = attributes . columns ,
rows = attributes . rows ,
order = attributes . order ,
display = attributes . display ,
display _setting = attributes . display _setting ,
layout = attributes . layout ;
var query = {
per _page : 'list' === layout ? rows : rows * columns ,
orderby : order
} ;
// @todo These will likely need to be modified to work with the final version of the category/product picker attributes.
if ( 'specific' === display ) {
query . include = JSON . stringify ( display _setting ) ;
query . orderby = 'include' ;
} else if ( 'category' === display ) {
query . category = display _setting . join ( ',' ) ;
}
var query _string = '?' ;
var _iteratorNormalCompletion = true ;
var _didIteratorError = false ;
var _iteratorError = undefined ;
try {
for ( var _iterator = Object . keys ( query ) [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) {
var key = _step . value ;
query _string += key + '=' + query [ key ] + '&' ;
}
} catch ( err ) {
_didIteratorError = true ;
_iteratorError = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion && _iterator . return ) {
_iterator . return ( ) ;
}
} finally {
if ( _didIteratorError ) {
throw _iteratorError ;
}
}
}
return {
products : '/wc/v2/products' + query _string
} ;
2018-02-15 18:16:14 +00:00
} ) ( function ( _ref2 ) {
var products = _ref2 . products ,
attributes = _ref2 . attributes ;
2018-02-13 19:03:53 +00:00
if ( ! products . data ) {
return _ _ ( 'Loading' ) ;
}
if ( 0 === products . data . length ) {
return _ _ ( 'No products found' ) ;
}
var classes = "wc-products-block-preview " + attributes . layout + " cols-" + attributes . columns ;
return wp . element . createElement (
2018-02-15 17:42:24 +00:00
'div' ,
2018-02-13 19:03:53 +00:00
{ className : classes } ,
products . data . map ( function ( product ) {
return wp . element . createElement ( ProductPreview , { key : product . id , product : product , attributes : attributes } ) ;
} )
) ;
} ) ;
/ * *
* Register and run the products block .
* /
registerBlockType ( 'woocommerce/products' , {
title : _ _ ( 'Products' ) ,
icon : 'universal-access-alt' , // @todo Needs a good icon.
category : 'widgets' ,
attributes : {
/ * *
* Layout to use . 'grid' or 'list' .
* /
layout : {
type : 'string' ,
default : 'grid'
} ,
/ * *
* Number of columns .
* /
columns : {
type : 'number' ,
default : 3
} ,
/ * *
* Number of rows .
* /
rows : {
type : 'number' ,
default : 1
} ,
/ * *
* Whether to display product titles .
* /
display _title : {
type : 'boolean' ,
default : true
} ,
/ * *
* Whether to display prices .
* /
display _price : {
type : 'boolean' ,
default : true
} ,
/ * *
* Whether to display Add to Cart buttons .
* /
display _add _to _cart : {
type : 'boolean' ,
default : false
} ,
/ * *
* Order to use for products . 'date' , or 'title' .
* /
order : {
type : 'string' ,
default : 'date'
} ,
/ * *
* What types of products to display . 'all' , 'specific' , or 'category' .
* /
display : {
type : 'string' ,
default : ''
} ,
/ * *
* Which products to display if 'display' is 'specific' or 'category' . Array of product ids or category slugs depending on setting .
* /
display _setting : {
type : 'array' ,
default : [ ]
} ,
/ * *
* Whether the block is in edit or preview mode .
* /
edit _mode : {
type : 'boolean' ,
default : true
}
} ,
/ * *
* Renders and manages the block .
* /
edit : function edit ( props ) {
var attributes = props . attributes ,
className = props . className ,
focus = props . focus ,
setAttributes = props . setAttributes ,
setFocus = props . setFocus ;
var layout = attributes . layout ,
rows = attributes . rows ,
columns = attributes . columns ,
display _title = attributes . display _title ,
display _price = attributes . display _price ,
display _add _to _cart = attributes . display _add _to _cart ,
order = attributes . order ,
display = attributes . display ,
display _setting = attributes . display _setting ,
edit _mode = attributes . edit _mode ;
/ * *
* Get the components for the sidebar settings area that is rendered while focused on a Products block .
*
* @ return Component
* /
function getInspectorControls ( ) {
return wp . element . createElement (
InspectorControls ,
2018-02-15 17:42:24 +00:00
{ key : 'inspector' } ,
2018-02-13 19:03:53 +00:00
wp . element . createElement (
2018-02-15 17:42:24 +00:00
'h3' ,
2018-02-13 19:03:53 +00:00
null ,
_ _ ( 'Layout' )
) ,
wp . element . createElement ( RangeControl , {
label : _ _ ( 'Columns' ) ,
value : columns ,
onChange : function onChange ( value ) {
return setAttributes ( { columns : value } ) ;
} ,
min : 1 ,
max : 6
} ) ,
wp . element . createElement ( RangeControl , {
label : _ _ ( 'Rows' ) ,
value : rows ,
onChange : function onChange ( value ) {
return setAttributes ( { rows : value } ) ;
} ,
min : 1 ,
max : 6
} ) ,
wp . element . createElement ( ToggleControl , {
label : _ _ ( 'Display title' ) ,
checked : display _title ,
onChange : function onChange ( ) {
return setAttributes ( { display _title : ! display _title } ) ;
}
} ) ,
wp . element . createElement ( ToggleControl , {
label : _ _ ( 'Display price' ) ,
checked : display _price ,
onChange : function onChange ( ) {
return setAttributes ( { display _price : ! display _price } ) ;
}
} ) ,
wp . element . createElement ( ToggleControl , {
label : _ _ ( 'Display add to cart button' ) ,
checked : display _add _to _cart ,
onChange : function onChange ( ) {
return setAttributes ( { display _add _to _cart : ! display _add _to _cart } ) ;
}
} ) ,
wp . element . createElement ( SelectControl , {
2018-02-15 17:42:24 +00:00
key : 'query-panel-select' ,
2018-02-13 19:03:53 +00:00
label : _ _ ( 'Order' ) ,
value : order ,
options : [ {
label : _ _ ( 'Newness' ) ,
value : 'date'
} , {
label : _ _ ( 'Title' ) ,
value : 'title'
} ] ,
onChange : function onChange ( value ) {
return setAttributes ( { order : value } ) ;
}
} )
) ;
} ;
/ * *
* Get the components for the toolbar area that appears on top of the block when focused .
*
* @ return Component
* /
function getToolbarControls ( ) {
var layoutControls = [ {
icon : 'list-view' ,
title : _ _ ( 'List View' ) ,
onClick : function onClick ( ) {
return setAttributes ( { layout : 'list' } ) ;
} ,
isActive : layout === 'list'
} , {
icon : 'grid-view' ,
title : _ _ ( 'Grid View' ) ,
onClick : function onClick ( ) {
return setAttributes ( { layout : 'grid' } ) ;
} ,
isActive : layout === 'grid'
} ] ;
var editButton = [ {
icon : 'edit' ,
title : _ _ ( 'Edit' ) ,
onClick : function onClick ( ) {
return setAttributes ( { edit _mode : ! edit _mode } ) ;
} ,
isActive : edit _mode
} ] ;
return wp . element . createElement (
BlockControls ,
2018-02-15 17:42:24 +00:00
{ key : 'controls' } ,
2018-02-13 19:03:53 +00:00
wp . element . createElement ( Toolbar , { controls : layoutControls } ) ,
wp . element . createElement ( Toolbar , { controls : editButton } )
) ;
}
/ * *
* Get the block preview component for preview mode .
*
* @ return Component
* /
function getPreview ( ) {
return wp . element . createElement ( ProductsBlockPreview , { attributes : attributes } ) ;
}
/ * *
* Get the block edit component for edit mode .
*
* @ return Component
* /
function getSettingsEditor ( ) {
return wp . element . createElement ( ProductsBlockSettingsEditor , {
selected _display : display ,
selected _display _setting : display _setting ,
update _display _callback : function update _display _callback ( value ) {
return setAttributes ( { display : value } ) ;
} ,
update _display _setting _callback : function update _display _setting _callback ( value ) {
return setAttributes ( { display _setting : value } ) ;
} ,
done _callback : function done _callback ( ) {
return setAttributes ( { edit _mode : false } ) ;
}
} ) ;
}
return [ ! ! focus ? getInspectorControls ( ) : null , ! ! focus ? getToolbarControls ( ) : null , edit _mode ? getSettingsEditor ( ) : getPreview ( ) ] ;
} ,
/ * *
* Save the block content in the post content . Block content is saved as a products shortcode .
*
* @ return string
* /
save : function save ( props ) {
var _props$attributes = props . attributes ,
layout = _props$attributes . layout ,
rows = _props$attributes . rows ,
columns = _props$attributes . columns ,
display _title = _props$attributes . display _title ,
display _price = _props$attributes . display _price ,
display _add _to _cart = _props$attributes . display _add _to _cart ,
order = _props$attributes . order ,
display = _props$attributes . display ,
display _setting = _props$attributes . display _setting ,
className = _props$attributes . className ;
var shortcode _atts = new Map ( ) ;
shortcode _atts . set ( 'orderby' , order ) ;
shortcode _atts . set ( 'limit' , 'grid' === layout ? rows * columns : rows ) ;
shortcode _atts . set ( 'class' , 'list' === layout ? className + ' list-layout' : className ) ;
if ( 'grid' === layout ) {
shortcode _atts . set ( 'columns' , columns ) ;
}
if ( ! display _title ) {
shortcode _atts . set ( 'show_title' , 0 ) ;
}
if ( ! display _price ) {
shortcode _atts . set ( 'show_price' , 0 ) ;
}
if ( ! display _add _to _cart ) {
shortcode _atts . set ( 'show_add_to_cart' , 0 ) ;
}
if ( 'specific' === display ) {
shortcode _atts . set ( 'include' , display _setting . join ( ',' ) ) ;
}
if ( 'category' === display ) {
shortcode _atts . set ( 'category' , display _setting . join ( ',' ) ) ;
}
// Build the shortcode string out of the set shortcode attributes.
var shortcode = '[products' ;
var _iteratorNormalCompletion2 = true ;
var _didIteratorError2 = false ;
var _iteratorError2 = undefined ;
try {
for ( var _iterator2 = shortcode _atts [ Symbol . iterator ] ( ) , _step2 ; ! ( _iteratorNormalCompletion2 = ( _step2 = _iterator2 . next ( ) ) . done ) ; _iteratorNormalCompletion2 = true ) {
2018-02-15 18:16:14 +00:00
var _ref3 = _step2 . value ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var _ref4 = _slicedToArray ( _ref3 , 2 ) ;
2018-02-13 19:03:53 +00:00
2018-02-15 18:16:14 +00:00
var key = _ref4 [ 0 ] ;
var value = _ref4 [ 1 ] ;
2018-02-13 19:03:53 +00:00
shortcode += ' ' + key + '="' + value + '"' ;
}
} catch ( err ) {
_didIteratorError2 = true ;
_iteratorError2 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion2 && _iterator2 . return ) {
_iterator2 . return ( ) ;
}
} finally {
if ( _didIteratorError2 ) {
throw _iteratorError2 ;
}
}
}
shortcode += ']' ;
return shortcode ;
}
} ) ;
2018-02-15 18:16:14 +00:00
/***/ } ) ,
/* 1 */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; }
var _ _ = wp . i18n . _ _ ;
var _wp$components = wp . components ,
Toolbar = _wp$components . Toolbar ,
withAPIData = _wp$components . withAPIData ,
Dropdown = _wp$components . Dropdown ;
/ * *
* When the display mode is 'Specific products' search for and add products to the block .
*
* @ todo Add the functionality and everything .
* /
var ProductsSpecificSelect = exports . ProductsSpecificSelect = function ( _React$Component ) {
_inherits ( ProductsSpecificSelect , _React$Component ) ;
/ * *
* Constructor .
* /
function ProductsSpecificSelect ( props ) {
_classCallCheck ( this , ProductsSpecificSelect ) ;
var _this = _possibleConstructorReturn ( this , ( ProductsSpecificSelect . _ _proto _ _ || Object . getPrototypeOf ( ProductsSpecificSelect ) ) . call ( this , props ) ) ;
_this . state = {
selectedProducts : props . selected _display _setting
} ;
return _this ;
}
_createClass ( ProductsSpecificSelect , [ {
key : "selectProduct" ,
value : function selectProduct ( evt ) {
evt . preventDefault ( ) ;
var selectProduct = this . state . selectProduct ;
this . setState ( {
selectProduct : selectProduct
} ) ;
}
} , {
key : "render" ,
value : function render ( ) {
return wp . element . createElement (
"div" ,
{ className : "product-specific-select" } ,
wp . element . createElement (
"div" ,
{ className : "add-new" } ,
wp . element . createElement ( Dropdown , {
className : "my-container-class-name" ,
contentClassName : "my-popover-content-classname" ,
position : "bottom right" ,
renderToggle : function renderToggle ( _ref ) {
var isOpen = _ref . isOpen ,
onToggle = _ref . onToggle ;
return wp . element . createElement (
"button" ,
{ className : "button button-large" , onClick : onToggle , "aria-expanded" : isOpen } ,
_ _ ( 'Add product' )
) ;
} ,
renderContent : function renderContent ( ) {
return wp . element . createElement (
"div" ,
null ,
wp . element . createElement ( ProductSpecifcSearch , null )
) ;
}
} )
) ,
wp . element . createElement ( ProductsSpecificList , { selectedProducts : this . state . selectedProducts } )
) ;
}
} ] ) ;
return ProductsSpecificSelect ;
} ( React . Component ) ;
var ProductSpecifcSearch = withAPIData ( function ( props ) {
return {
products : '/wc/v2/products?per_page=10'
} ;
} ) ( function ( _ref2 ) {
var products = _ref2 . products ;
if ( ! products . data ) {
return _ _ ( 'Loading' ) ;
}
if ( 0 === products . data . length ) {
return _ _ ( 'No products found' ) ;
}
var ProductsList = function ProductsList ( _ref3 ) {
var products = _ref3 . products ;
return products . length > 0 && wp . element . createElement (
"ul" ,
null ,
products . map ( function ( product ) {
return wp . element . createElement (
"li" ,
null ,
wp . element . createElement (
"button" ,
{ type : "button" , className : "components-button" , id : 'product-' + product . id } ,
wp . element . createElement ( "img" , { src : product . images [ 0 ] . src , width : "30px" } ) ,
" " ,
product . name
)
) ;
} )
) ;
} ;
var productsData = products . data ;
return wp . element . createElement (
"div" ,
{ role : "menu" , "aria-orientation" : "vertical" , "aria-label" : "{ __( 'Products list' ) }" } ,
wp . element . createElement ( ProductsList , { products : productsData } )
) ;
} ) ;
var ProductsSpecificList = function ProductsSpecificList ( _ref4 ) {
var selectedProducts = _ref4 . selectedProducts ;
if ( ! selectedProducts || 0 === selectedProducts . length ) {
return _ _ ( 'No products selected found' ) ;
}
var classes = "wc-products-block-preview" ;
var attributes = { } ;
return wp . element . createElement (
"div" ,
{ className : classes } ,
selectedProducts . data . map ( function ( product ) {
return wp . element . createElement ( ProductPreview , { product : product , attributes : attributes } ) ;
} )
) ;
} ;
/***/ } ) ,
/* 2 */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; }
var _ _ = wp . i18n . _ _ ;
var _wp$components = wp . components ,
Toolbar = _wp$components . Toolbar ,
withAPIData = _wp$components . withAPIData ,
2018-02-19 19:57:37 +00:00
Dropdown = _wp$components . Dropdown ,
Dashicon = _wp$components . Dashicon ;
2018-02-15 18:16:14 +00:00
/ * *
* When the display mode is 'Product category' search for and select product categories to pull products from .
* /
var ProductsCategorySelect = exports . ProductsCategorySelect = function ( _React$Component ) {
_inherits ( ProductsCategorySelect , _React$Component ) ;
/ * *
* Constructor .
* /
function ProductsCategorySelect ( props ) {
_classCallCheck ( this , ProductsCategorySelect ) ;
var _this = _possibleConstructorReturn ( this , ( ProductsCategorySelect . _ _proto _ _ || Object . getPrototypeOf ( ProductsCategorySelect ) ) . call ( this , props ) ) ;
_this . state = {
selectedCategories : props . selected _display _setting ,
2018-02-19 19:57:37 +00:00
openAccordion : null ,
2018-02-15 18:16:14 +00:00
filterQuery : ''
} ;
_this . checkboxChange = _this . checkboxChange . bind ( _this ) ;
2018-02-19 19:57:37 +00:00
_this . accordionToggle = _this . accordionToggle . bind ( _this ) ;
2018-02-15 18:16:14 +00:00
_this . filterResults = _this . filterResults . bind ( _this ) ;
return _this ;
}
/ * *
* Handle checkbox toggle .
*
* @ param Event object evt
* /
_createClass ( ProductsCategorySelect , [ {
key : "checkboxChange" ,
value : function checkboxChange ( evt ) {
var selectedCategories = this . state . selectedCategories ;
if ( evt . target . checked && ! selectedCategories . includes ( parseInt ( evt . target . value , 10 ) ) ) {
selectedCategories . push ( parseInt ( evt . target . value , 10 ) ) ;
} else if ( ! evt . target . checked ) {
selectedCategories = selectedCategories . filter ( function ( category ) {
return category !== parseInt ( evt . target . value , 10 ) ;
} ) ;
}
this . setState ( {
selectedCategories : selectedCategories
} ) ;
this . props . update _display _setting _callback ( selectedCategories ) ;
}
2018-02-19 19:57:37 +00:00
} , {
key : "accordionToggle" ,
value : function accordionToggle ( category ) {
var value = category ;
if ( value === this . state . openAccordion ) {
value = null ;
}
this . setState ( {
openAccordion : value
} ) ;
}
2018-02-15 18:16:14 +00:00
/ * *
* Filter categories .
*
* @ param Event object evt
* /
} , {
key : "filterResults" ,
value : function filterResults ( evt ) {
this . setState ( {
filterQuery : evt . target . value
} ) ;
}
/ * *
* Render the list of categories and the search input .
* /
} , {
key : "render" ,
value : function render ( ) {
return wp . element . createElement (
"div" ,
{ className : "product-category-select" } ,
wp . element . createElement ( ProductCategoryFilter , { filterResults : this . filterResults } ) ,
2018-02-19 19:57:37 +00:00
wp . element . createElement ( ProductCategoryList , {
filterQuery : this . state . filterQuery ,
selectedCategories : this . state . selectedCategories ,
checkboxChange : this . checkboxChange ,
accordionToggle : this . accordionToggle ,
openAccordion : this . state . openAccordion
} )
2018-02-15 18:16:14 +00:00
) ;
}
} ] ) ;
return ProductsCategorySelect ;
} ( React . Component ) ;
/ * *
* The category search input .
* /
var ProductCategoryFilter = function ProductCategoryFilter ( _ref ) {
var filterResults = _ref . filterResults ;
return wp . element . createElement (
"div" ,
null ,
wp . element . createElement ( "input" , { id : "product-category-search" , type : "search" , placeholder : _ _ ( 'Search for categories' ) , onChange : filterResults } )
) ;
} ;
/ * *
* Fetch and build a tree of product categories .
* /
var ProductCategoryList = withAPIData ( function ( props ) {
return {
categories : '/wc/v2/products/categories'
} ;
} ) ( function ( _ref2 ) {
var categories = _ref2 . categories ,
filterQuery = _ref2 . filterQuery ,
selectedCategories = _ref2 . selectedCategories ,
2018-02-19 19:57:37 +00:00
checkboxChange = _ref2 . checkboxChange ,
accordionToggle = _ref2 . accordionToggle ,
openAccordion = _ref2 . openAccordion ;
2018-02-15 18:16:14 +00:00
if ( ! categories . data ) {
return _ _ ( 'Loading' ) ;
}
if ( 0 === categories . data . length ) {
return _ _ ( 'No categories found' ) ;
}
2018-02-19 19:57:37 +00:00
var AccordionButton = function AccordionButton ( _ref3 ) {
2018-02-19 20:05:59 +00:00
var category = _ref3 . category ;
2018-02-19 19:57:37 +00:00
var icon = 'arrow-down-alt2' ;
2018-02-19 20:05:59 +00:00
if ( openAccordion === category ) {
2018-02-19 19:57:37 +00:00
icon = 'arrow-up-alt2' ;
}
return wp . element . createElement (
"button" ,
{ onClick : function onClick ( ) {
return accordionToggle ( category ) ;
} , type : "button" , className : "product-category-accordion-toggle" } ,
wp . element . createElement ( Dashicon , { icon : icon } )
) ;
} ;
var CategoryTree = function CategoryTree ( _ref4 ) {
var categories = _ref4 . categories ,
parent = _ref4 . parent ;
2018-02-15 18:16:14 +00:00
var filteredCategories = categories . filter ( function ( category ) {
return category . parent === parent ;
} ) ;
return filteredCategories . length > 0 && wp . element . createElement (
"ul" ,
null ,
filteredCategories . map ( function ( category ) {
return wp . element . createElement (
"li" ,
2018-02-19 19:57:37 +00:00
{ key : category . id , className : openAccordion === category . id ? 'product-category-accordion-open' : '' } ,
2018-02-15 18:16:14 +00:00
wp . element . createElement (
"label" ,
{ htmlFor : 'product-category-' + category . id } ,
wp . element . createElement ( "input" , { type : "checkbox" ,
id : 'product-category-' + category . id ,
value : category . id ,
checked : selectedCategories . includes ( category . id ) ,
onChange : checkboxChange
} ) ,
" " ,
2018-02-19 19:57:37 +00:00
category . name ,
wp . element . createElement (
"span" ,
{ className : "product-category-count" } ,
category . count
) ,
2018-02-19 20:05:59 +00:00
0 === category . parent && wp . element . createElement ( AccordionButton , { category : category . id } )
2018-02-15 18:16:14 +00:00
) ,
wp . element . createElement ( CategoryTree , { categories : categories , parent : category . id } )
) ;
} )
) ;
} ;
var categoriesData = categories . data ;
if ( '' !== filterQuery ) {
categoriesData = categoriesData . filter ( function ( category ) {
return category . slug . includes ( filterQuery . toLowerCase ( ) ) ;
} ) ;
}
return wp . element . createElement (
"div" ,
2018-02-19 19:57:37 +00:00
{ className : "product-categories-list" } ,
2018-02-15 18:16:14 +00:00
wp . element . createElement ( CategoryTree , { categories : categoriesData , parent : 0 } )
) ;
} ) ;
/***/ } ) ,
/* 3 */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; }
var _ _ = wp . i18n . _ _ ;
var _wp$components = wp . components ,
Toolbar = _wp$components . Toolbar ,
withAPIData = _wp$components . withAPIData ,
Dropdown = _wp$components . Dropdown ;
/ * *
* When the display mode is 'Attribute' search for and select product attributes to pull products from .
* /
var ProductsAttributeSelect = exports . ProductsAttributeSelect = function ( _React$Component ) {
_inherits ( ProductsAttributeSelect , _React$Component ) ;
function ProductsAttributeSelect ( ) {
_classCallCheck ( this , ProductsAttributeSelect ) ;
return _possibleConstructorReturn ( this , ( ProductsAttributeSelect . _ _proto _ _ || Object . getPrototypeOf ( ProductsAttributeSelect ) ) . apply ( this , arguments ) ) ;
}
_createClass ( ProductsAttributeSelect , [ {
key : "render" ,
value : function render ( ) {
return wp . element . createElement (
"div" ,
{ className : "product-attribute-select" } ,
"TODO: Attribute select screen"
) ;
}
} ] ) ;
return ProductsAttributeSelect ;
} ( React . Component ) ;
2018-02-13 19:03:53 +00:00
/***/ } )
/******/ ] ) ;