# speechkit/4.0.0/src/Component/Post/BlockAttributes/check.js

BeyondWords – AI audio for publishers, version 4.0.0. 38 lines.

- Page: https://pluginprobe.com/plugins/speechkit/4.0.0/code/src/Component/Post/BlockAttributes/check.js
- Raw: https://pluginprobe.com/plugins/speechkit/4.0.0/raw/src/Component/Post/BlockAttributes/check.js
- Modified: 2023-07-26T14:25:00+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/speechkit/4.0.0/code/src/Component/Post/BlockAttributes/check.js#L10-L20`.

```javascript
/**
 * WordPress dependencies
 */
import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';

export function BlockAttributesCheck( { hasAudioAction, children } ) {
	if ( ! hasAudioAction ) {
		return null;
	}

	return children;
}

export default compose( [
	withSelect( ( select ) => {
		const { getEditedPostAttribute } = select( 'core/editor' );

		// TODO simplify checks for whether audio exists, this is copied across the codebase
		const beyondwordsGenerateAudio =
			getEditedPostAttribute( 'meta' ).beyondwords_generate_audio === '1';
		const beyondwordsContentId =
			getEditedPostAttribute( 'meta' ).beyondwords_content_id;
		const beyondwordsPodcastId =
			getEditedPostAttribute( 'meta' ).beyondwords_podcast_id;
		const speechkitPodcastId =
			getEditedPostAttribute( 'meta' ).speechkit_podcast_id;

		return {
			hasAudioAction:
				!! beyondwordsGenerateAudio ||
				!! beyondwordsContentId ||
				!! beyondwordsPodcastId ||
				!! speechkitPodcastId,
		};
	} ),
] )( BlockAttributesCheck );

```
