Merge a product into the products list

@param  {Array}  products A list of products
@param  {Object} product  A single product to update or add to the products list
@return {Array}         Updated product list
function updateCachedProduct( products, product ) {
	let found = false;
	const updatedProduct = { ...product, name: decodeEntities( product.name ) };
	const newProducts = products.map( p => {
		if ( p.id === product.id ) {
			found = true;
			return updatedProduct;
		}
		return p;
	} );

	if ( ! found ) {
		newProducts.push( updatedProduct );
	}

	return newProducts;
}