Add util to packages to fix build. (https://github.com/woocommerce/woocommerce-admin/pull/1079)
This commit is contained in:
parent
2dbbc39071
commit
19b209fca4
|
@ -12,8 +12,7 @@ import { stringifyQuery } from '@woocommerce/navigation';
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
import { computeSuggestionMatch } from './utils';
|
import { computeSuggestionMatch, getTaxCode } from './utils';
|
||||||
import { getTaxCode } from 'analytics/report/taxes/utils';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A tax completer.
|
* A tax completer.
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
/** @format */
|
/** @format */
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a string suggestion, split apart by where the first matching query is.
|
* Parse a string suggestion, split apart by where the first matching query is.
|
||||||
* Used to display matched partial in bold.
|
* Used to display matched partial in bold.
|
||||||
|
@ -19,3 +24,15 @@ export function computeSuggestionMatch( suggestion, query ) {
|
||||||
suggestionAfterMatch: suggestion.substring( indexOfMatch + query.length ),
|
suggestionAfterMatch: suggestion.substring( indexOfMatch + query.length ),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTaxCode( tax ) {
|
||||||
|
return [ tax.country, tax.state, tax.name || __( 'TAX', 'wc-admin' ), tax.priority ]
|
||||||
|
.map( item =>
|
||||||
|
item
|
||||||
|
.toString()
|
||||||
|
.toUpperCase()
|
||||||
|
.trim()
|
||||||
|
)
|
||||||
|
.filter( Boolean )
|
||||||
|
.join( '-' );
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue