Add old option back with depreciated notice for backwards compatibility (https://github.com/woocommerce/woocommerce-admin/pull/7688)

* Add old option back with depreciated notice for backwards compatibility

* Add changelog

* Update depreciation message
This commit is contained in:
louwie17 2021-09-23 16:14:45 -03:00 committed by GitHub
parent c0ea027afa
commit 114069a06e
4 changed files with 49 additions and 2 deletions

View File

@ -10901,12 +10901,36 @@
"@wordpress/core-data": "3.0.0",
"@wordpress/data": "5.0.0",
"@wordpress/data-controls": "2.0.0",
"@wordpress/deprecated": "^3.1.1",
"@wordpress/element": "2.19.0",
"@wordpress/hooks": "2.11.0",
"@wordpress/i18n": "3.17.0",
"@wordpress/url": "2.21.0",
"md5": "^2.3.0",
"rememo": "^3.0.0"
},
"dependencies": {
"@wordpress/deprecated": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.2.1.tgz",
"integrity": "sha512-+mSpxeu0za9cNw30x9n0kZY/IUhmd9vhEzjZzLfT92lY3dDPXCEaE4IOSdPevcLpWTcKd7RhRMj2zXmaU5MA2g==",
"dev": true,
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/hooks": "^3.2.0"
},
"dependencies": {
"@wordpress/hooks": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.2.0.tgz",
"integrity": "sha512-nVR6V9kPxl8+aYQzQJdoDt+aKBKHHD0zplcYZbu2MHxjmHMvppAeL9mjzVhQZj/3n10NR2Ftk94mHQzHWfhCCg==",
"dev": true,
"requires": {
"@babel/runtime": "^7.13.10"
}
}
}
}
}
},
"@woocommerce/date": {

View File

@ -1,6 +1,7 @@
# Unreleased
- Fix the batch fetch logic for the options data store. #7587
- Add backwards compability for old function format. #7688
# 1.4.0

View File

@ -30,6 +30,7 @@
"@wordpress/hooks": "2.11.0",
"@wordpress/data": "5.0.0",
"@wordpress/data-controls": "2.0.0",
"@wordpress/deprecated": "^3.1.1",
"@wordpress/i18n": "3.17.0",
"@wordpress/url": "2.21.0",
"md5": "^2.3.0",

View File

@ -13,6 +13,7 @@ import {
getActiveFiltersFromQuery,
getQueryFromActiveFilters,
} from '@woocommerce/navigation';
import deprecated from '@wordpress/deprecated';
/**
* Internal dependencies
@ -343,17 +344,27 @@ const getReportChartDataResponse = memoize(
* @param {string} options.dataType 'primary' or 'secondary'
* @param {Object} options.query Query parameters in the url
* @param {Object} options.selector Instance of @wordpress/select response
* @param {Object} options.select (Depreciated) Instance of @wordpress/select
* @param {Array} options.limitBy Properties used to limit the results. It will be used in the API call to send the IDs.
* @param {string} options.defaultDateRange User specified default date range.
* @return {Object} Object containing API request information (response, fetching, and error details)
*/
export function getReportChartData( options ) {
const { endpoint } = options;
let reportSelectors = options.selector;
if ( options.select && ! options.selector ) {
deprecated( 'option.select', {
version: '1.7.0',
hint:
'You can pass the report selectors through option.selector now.',
} );
reportSelectors = options.select( STORE_NAME );
}
const {
getReportStats,
getReportStatsError,
isResolving,
} = options.selector;
} = reportSelectors;
const requestQuery = getRequestQuery( options );
// Disable eslint rule requiring `stats` to be defined below because the next two if statements
@ -492,17 +503,27 @@ export function getReportTableQuery( options ) {
* @param {string} options.endpoint Report API Endpoint
* @param {Object} options.query Query parameters in the url
* @param {Object} options.selector Instance of @wordpress/select response
* @param {Object} options.select (depreciated) Instance of @wordpress/select
* @param {Object} options.tableQuery Query parameters specific for that endpoint
* @param {string} options.defaultDateRange User specified default date range.
* @return {Object} Object Table data response
*/
export function getReportTableData( options ) {
const { endpoint } = options;
let reportSelectors = options.selector;
if ( options.select && ! options.selector ) {
deprecated( 'option.select', {
version: '1.7.0',
hint:
'You can pass the report selectors through option.selector now.',
} );
reportSelectors = options.select( STORE_NAME );
}
const {
getReportItems,
getReportItemsError,
hasFinishedResolution,
} = options.selector;
} = reportSelectors;
const tableQuery = reportsUtils.getReportTableQuery( options );
const response = {