@automattic/newspack-blocks
Advanced tools
Comparing version 4.3.0-epic-ras-acc.16 to 4.3.0-epic-ras-acc.17
{ | ||
"name": "@automattic/newspack-blocks", | ||
"version": "4.3.0-epic-ras-acc.16", | ||
"version": "4.3.0-epic-ras-acc.17", | ||
"author": "Automattic", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
@@ -95,2 +95,3 @@ /* eslint-disable @wordpress/no-unsafe-wp-apis */ | ||
const [ isChanging, setIsChanging ] = useState( false ); | ||
function fetchSuggestions( search ) { | ||
@@ -104,3 +105,3 @@ setInFlight( true ); | ||
products.forEach( product => { | ||
if ( product.purchasable ) { | ||
if ( '' !== product.price || getNYP( product ).isNYP ) { // Variable products will populate price with one of the variations prices. | ||
_suggestions[ product.id ] = `${ product.id }: ${ product.name }`; | ||
@@ -205,3 +206,2 @@ } | ||
setProductData( data ); | ||
// Handle product variation data. | ||
@@ -211,3 +211,12 @@ if ( data?.variations?.length ) { | ||
apiFetch( { path: `/wc/v2/products/${ data.id }/variations?per_page=100` } ) | ||
.then( res => setVariations( res ) ) | ||
.then( res => { | ||
// Remove any variations without prices set. | ||
const priced_variations = []; | ||
res.forEach( re => { | ||
if ( '' !== re.price || getNYP( re ).isNYP ) { | ||
priced_variations.push( re ); | ||
} | ||
} ); | ||
setVariations( priced_variations ); | ||
} ) | ||
.catch( () => setVariations( [] ) ); | ||
@@ -214,0 +223,0 @@ } else { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4063386
15667