Example #1
0
export const enhanceWithLocationCounts = ( action, getState ) => {
	const siteId = getSelectedSiteId( getState() );

	if ( siteId !== null ) {
		const locations = getGoogleMyBusinessLocations( getState(), siteId );

		const verifiedLocationCount = locations.filter( location =>
			get( location, 'meta.state.isVerified', false )
		).length;

		return merge( action, {
			meta: {
				analytics: [
					{
						payload: {
							properties: {
								location_count: locations.length,
								verified_location_count: verifiedLocationCount,
							},
						},
					},
				],
			},
		} );
	}

	return action;
};
Example #2
0
	state => {
		const siteId = getSelectedSiteId( state );
		const locations = getGoogleMyBusinessLocations( state, siteId );

		return {
			locations,
			siteId,
			siteSlug: getSelectedSiteSlug( state ),
		};
	},