Begin migration off withapidata

This commit is contained in:
claudiulodro 2018-09-05 11:30:46 -07:00
parent 66aa3b52a9
commit 6cde5409a1
8 changed files with 9146 additions and 752 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,8 @@ const { __ } = wp.i18n;
const { RawHTML } = wp.element;
const { registerBlockType } = wp.blocks;
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 { 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.
*/
const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
/*const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
const { columns, rows, display, display_setting, orderby } = attributes;
@ -422,12 +423,27 @@ const ProductsBlockPreview = withAPIData( ( { attributes } ) => {
) ) }
</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.
*/
const ProductsBlockSidebarInfo = withAPIData( ( { attributes } ) => {
/*const ProductsBlockSidebarInfo = withAPIData( ( { attributes } ) => {
const { display, display_setting } = attributes;
@ -496,7 +512,19 @@ const ProductsBlockSidebarInfo = withAPIData( ( { attributes } ) => {
) ) }
</div>
);
} );
} );*/
class ProductsBlockSidebarInfo extends React.Component {
constructor( props ) {
super( props );
}
render() {
return (
"sidebar"
);
}
};
/**
* The main products block UI.

View File

@ -1,5 +1,6 @@
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
@ -158,7 +159,7 @@ const ProductAttributeFilter = ( props ) => {
/**
* List of attributes.
*/
const ProductAttributeList = withAPIData( ( props ) => {
/*const ProductAttributeList = withAPIData( ( props ) => {
return {
attributes: '/wc/v2/products/attributes'
};
@ -198,7 +199,8 @@ const ProductAttributeList = withAPIData( ( props ) => {
</div>
);
}
);
);*/
const ProductAttributeList = null;
/**
* One product attribute.
@ -277,7 +279,7 @@ class ProductAttributeElement extends React.Component {
/**
* The list of terms in an attribute.
*/
const AttributeTerms = withAPIData( ( props ) => {
/*const AttributeTerms = withAPIData( ( props ) => {
return {
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> );
}
/**
* Add or remove selected terms.
*
* @param evt Event object
*/
function handleTermChange( evt ) {
if ( evt.target.checked ) {
addTerm( evt.target.value );
@ -321,4 +318,5 @@ const AttributeTerms = withAPIData( ( props ) => {
</ul>
);
}
);
);*/
const AttributeTerms = null;

View File

@ -1,5 +1,6 @@
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.
@ -124,7 +125,7 @@ const ProductCategoryFilter = ( { filterResults } ) => {
/**
* Fetch and build a tree of product categories.
*/
const ProductCategoryList = withAPIData( ( props ) => {
/*const ProductCategoryList = withAPIData( ( props ) => {
return {
categories: '/wc/v2/products/categories'
};
@ -259,4 +260,5 @@ const ProductCategoryList = withAPIData( ( props ) => {
</div>
);
}
);
);*/
const ProductCategoryList = null;

View File

@ -1,5 +1,6 @@
const { __ } = wp.i18n;
const { Toolbar, withAPIData, Dropdown, Dashicon } = wp.components;
const { Toolbar, Dropdown, Dashicon } = wp.components;
const { apiFetch } = wp;
/**
* Product data cache.
@ -176,7 +177,7 @@ class ProductsSpecificSearchField extends React.Component {
/**
* Render product search results based on the text entered into the textbox.
*/
const ProductSpecificSearchResults = withAPIData( ( props ) => {
/*const ProductSpecificSearchResults = withAPIData( ( props ) => {
if ( ! props.searchString.length ) {
return {
@ -208,7 +209,8 @@ const ProductSpecificSearchResults = withAPIData( ( props ) => {
isDropdownOpenCallback={ isDropdownOpenCallback }
/>
}
);
);*/
const ProductSpecificSearchResults = null;
/**
* The dropdown of search results.
@ -298,7 +300,7 @@ class ProductSpecificSearchResultsDropdownElement extends React.Component {
/**
* List preview of selected products.
*/
const ProductSpecificSelectedProducts = withAPIData( ( props ) => {
/*const ProductSpecificSelectedProducts = withAPIData( ( props ) => {
if ( ! props.productIds.length ) {
return {
products: []
@ -365,4 +367,5 @@ const ProductSpecificSelectedProducts = withAPIData( ( props ) => {
</div>
);
}
);
);*/
const ProductSpecificSelectedProducts = null;

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
defined( 'ABSPATH' ) || die();
define( 'WGPB_VERSION', '1.1.1' );
define( 'WGPB_VERSION', rand().'1.1.1' );
/**
* Load up the assets if Gutenberg is active.