# speechkit/4.0.3/src/Component/Post/PlayAudio/check.js

BeyondWords – AI audio for publishers, version 4.0.3. 36 lines.

- Page: https://pluginprobe.com/plugins/speechkit/4.0.3/code/src/Component/Post/PlayAudio/check.js
- Raw: https://pluginprobe.com/plugins/speechkit/4.0.3/raw/src/Component/Post/PlayAudio/check.js
- Modified: 2023-08-04T14:26:52+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.3/code/src/Component/Post/PlayAudio/check.js#L10-L20`.

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

export function PlayAudioCheck( { hasPlayAudioAction, children } ) {
	if ( ! hasPlayAudioAction ) {
		return null;
	}

	return children;
}

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

		const beyondwordsContentId =
			getEditedPostAttribute( 'meta' ).beyondwords_content_id;
		const beyondwordsPodcastId =
			getEditedPostAttribute( 'meta' ).beyondwords_podcast_id;
		const speechkitPodcastId =
			getEditedPostAttribute( 'meta' ).speechkit_podcast_id;
		const status = getEditedPostAttribute( 'status' );

		return {
			hasPlayAudioAction:
				status !== 'pending' &&
				( !! beyondwordsContentId ||
					!! beyondwordsPodcastId ||
					!! speechkitPodcastId ),
		};
	} ),
] )( PlayAudioCheck );

```
