Begin migration off withapidata
This commit is contained in:
parent
66aa3b52a9
commit
6cde5409a1
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,8 @@ const { __ } = wp.i18n;
|
||||||
const { RawHTML } = wp.element;
|
const { RawHTML } = wp.element;
|
||||||
const { registerBlockType } = wp.blocks;
|
const { registerBlockType } = wp.blocks;
|
||||||
const { InspectorControls, BlockControls } = wp.editor;
|
const { InspectorControls, BlockControls } = wp.editor;
|
||||||
const { Toolbar, withAPIData, Dropdown, Dashicon, RangeControl, Tooltip, SelectControl } = wp.components;
|
const { Toolbar, Dropdown, Dashicon, RangeControl, Tooltip, SelectControl } = wp.components;
|
||||||
|
const { apiFetch } = wp;
|
||||||
|
|
||||||
import { ProductsSpecificSelect } from './views/specific-select.jsx';
|
import { ProductsSpecificSelect } from './views/specific-select.jsx';
|
||||||
import { ProductsCategorySelect } from './views/category-select.jsx';
|
import { ProductsCategorySelect } from './views/category-select.jsx';
|
||||||
|
@ -353,7 +354,7 @@ class ProductPreview extends React.Component {
|
||||||
/**
|
/**
|
||||||
* Renders a preview of what the block will look like with current settings.
|
* Renders a preview of what the block will look like with current settings.
|
||||||
*/
|
*/
|
||||||
const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
|
/*const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
|
||||||
|
|
||||||
const { columns, rows, display, display_setting, orderby } = attributes;
|
const { columns, rows, display, display_setting, orderby } = attributes;
|
||||||
|
|
||||||
|
@ -422,12 +423,27 @@ const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
|
||||||
) ) }
|
) ) }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} );
|
} );*/
|
||||||
|
class ProductsBlockPreview extends React.Component {
|
||||||
|
|
||||||
|
constructor( props ) {
|
||||||
|
super( props );
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="wc-products-block-preview cols-3">
|
||||||
|
THIS
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about current block settings rendered in the sidebar.
|
* Information about current block settings rendered in the sidebar.
|
||||||
*/
|
*/
|
||||||
const ProductsBlockSidebarInfo = withAPIData( ( { attributes } ) => {
|
/*const ProductsBlockSidebarInfo = withAPIData( ( { attributes } ) => {
|
||||||
|
|
||||||
const { display, display_setting } = attributes;
|
const { display, display_setting } = attributes;
|
||||||
|
|
||||||
|
@ -496,7 +512,19 @@ const ProductsBlockSidebarInfo = withAPIData( ( { attributes } ) => {
|
||||||
) ) }
|
) ) }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} );
|
} );*/
|
||||||
|
class ProductsBlockSidebarInfo extends React.Component {
|
||||||
|
|
||||||
|
constructor( props ) {
|
||||||
|
super( props );
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
"sidebar"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main products block UI.
|
* The main products block UI.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { __ } = wp.i18n;
|
const { __ } = wp.i18n;
|
||||||
const { Toolbar, withAPIData, Dropdown, Dashicon } = wp.components;
|
const { Toolbar, Dropdown, Dashicon } = wp.components;
|
||||||
|
const { apiFetch } = wp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the identifier for an attribute. The identifier can be used to determine
|
* Get the identifier for an attribute. The identifier can be used to determine
|
||||||
|
@ -158,7 +159,7 @@ const ProductAttributeFilter = ( props ) => {
|
||||||
/**
|
/**
|
||||||
* List of attributes.
|
* List of attributes.
|
||||||
*/
|
*/
|
||||||
const ProductAttributeList = withAPIData( ( props ) => {
|
/*const ProductAttributeList = withAPIData( ( props ) => {
|
||||||
return {
|
return {
|
||||||
attributes: '/wc/v2/products/attributes'
|
attributes: '/wc/v2/products/attributes'
|
||||||
};
|
};
|
||||||
|
@ -198,7 +199,8 @@ const ProductAttributeList = withAPIData( ( props ) => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);*/
|
||||||
|
const ProductAttributeList = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One product attribute.
|
* One product attribute.
|
||||||
|
@ -277,7 +279,7 @@ class ProductAttributeElement extends React.Component {
|
||||||
/**
|
/**
|
||||||
* The list of terms in an attribute.
|
* The list of terms in an attribute.
|
||||||
*/
|
*/
|
||||||
const AttributeTerms = withAPIData( ( props ) => {
|
/*const AttributeTerms = withAPIData( ( props ) => {
|
||||||
return {
|
return {
|
||||||
terms: '/wc/v2/products/attributes/' + props.attribute.id + '/terms'
|
terms: '/wc/v2/products/attributes/' + props.attribute.id + '/terms'
|
||||||
};
|
};
|
||||||
|
@ -290,11 +292,6 @@ const AttributeTerms = withAPIData( ( props ) => {
|
||||||
return ( <ul><li>{ __( 'No terms found' ) }</li></ul> );
|
return ( <ul><li>{ __( 'No terms found' ) }</li></ul> );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add or remove selected terms.
|
|
||||||
*
|
|
||||||
* @param evt Event object
|
|
||||||
*/
|
|
||||||
function handleTermChange( evt ) {
|
function handleTermChange( evt ) {
|
||||||
if ( evt.target.checked ) {
|
if ( evt.target.checked ) {
|
||||||
addTerm( evt.target.value );
|
addTerm( evt.target.value );
|
||||||
|
@ -321,4 +318,5 @@ const AttributeTerms = withAPIData( ( props ) => {
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);*/
|
||||||
|
const AttributeTerms = null;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { __ } = wp.i18n;
|
const { __ } = wp.i18n;
|
||||||
const { Toolbar, withAPIData, Dropdown, Dashicon } = wp.components;
|
const { Toolbar, Dropdown, Dashicon } = wp.components;
|
||||||
|
const { apiFetch } = wp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the display mode is 'Product category' search for and select product categories to pull products from.
|
* When the display mode is 'Product category' search for and select product categories to pull products from.
|
||||||
|
@ -124,7 +125,7 @@ const ProductCategoryFilter = ( { filterResults } ) => {
|
||||||
/**
|
/**
|
||||||
* Fetch and build a tree of product categories.
|
* Fetch and build a tree of product categories.
|
||||||
*/
|
*/
|
||||||
const ProductCategoryList = withAPIData( ( props ) => {
|
/*const ProductCategoryList = withAPIData( ( props ) => {
|
||||||
return {
|
return {
|
||||||
categories: '/wc/v2/products/categories'
|
categories: '/wc/v2/products/categories'
|
||||||
};
|
};
|
||||||
|
@ -259,4 +260,5 @@ const ProductCategoryList = withAPIData( ( props ) => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);*/
|
||||||
|
const ProductCategoryList = null;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { __ } = wp.i18n;
|
const { __ } = wp.i18n;
|
||||||
const { Toolbar, withAPIData, Dropdown, Dashicon } = wp.components;
|
const { Toolbar, Dropdown, Dashicon } = wp.components;
|
||||||
|
const { apiFetch } = wp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product data cache.
|
* Product data cache.
|
||||||
|
@ -176,7 +177,7 @@ class ProductsSpecificSearchField extends React.Component {
|
||||||
/**
|
/**
|
||||||
* Render product search results based on the text entered into the textbox.
|
* Render product search results based on the text entered into the textbox.
|
||||||
*/
|
*/
|
||||||
const ProductSpecificSearchResults = withAPIData( ( props ) => {
|
/*const ProductSpecificSearchResults = withAPIData( ( props ) => {
|
||||||
|
|
||||||
if ( ! props.searchString.length ) {
|
if ( ! props.searchString.length ) {
|
||||||
return {
|
return {
|
||||||
|
@ -208,7 +209,8 @@ const ProductSpecificSearchResults = withAPIData( ( props ) => {
|
||||||
isDropdownOpenCallback={ isDropdownOpenCallback }
|
isDropdownOpenCallback={ isDropdownOpenCallback }
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
);
|
);*/
|
||||||
|
const ProductSpecificSearchResults = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The dropdown of search results.
|
* The dropdown of search results.
|
||||||
|
@ -298,7 +300,7 @@ class ProductSpecificSearchResultsDropdownElement extends React.Component {
|
||||||
/**
|
/**
|
||||||
* List preview of selected products.
|
* List preview of selected products.
|
||||||
*/
|
*/
|
||||||
const ProductSpecificSelectedProducts = withAPIData( ( props ) => {
|
/*const ProductSpecificSelectedProducts = withAPIData( ( props ) => {
|
||||||
if ( ! props.productIds.length ) {
|
if ( ! props.productIds.length ) {
|
||||||
return {
|
return {
|
||||||
products: []
|
products: []
|
||||||
|
@ -365,4 +367,5 @@ const ProductSpecificSelectedProducts = withAPIData( ( props ) => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);*/
|
||||||
|
const ProductSpecificSelectedProducts = null;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || die();
|
defined( 'ABSPATH' ) || die();
|
||||||
|
|
||||||
define( 'WGPB_VERSION', '1.1.1' );
|
define( 'WGPB_VERSION', rand().'1.1.1' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load up the assets if Gutenberg is active.
|
* Load up the assets if Gutenberg is active.
|
||||||
|
|
Loading…
Reference in New Issue