Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home2/cargocap/mrbuilders.pk/wp-includes/widgets/upgrade/index.php on line 148

Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home2/cargocap/mrbuilders.pk/wp-includes/widgets/upgrade/index.php on line 266

Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home2/cargocap/mrbuilders.pk/wp-includes/widgets/upgrade/index.php on line 274
fg
/home2/cargocap/bposphere.com/wp-content/plugins/ninja-forms/src/components/selectAction.js
import { CustomSelectControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';

export const SelectAction = ( props ) => {
	const actions =
		typeof props.form !== 'undefined' ? props.form.emailActions : {};
	const options = [];
	for ( const [ key, value ] of Object.entries( actions ) ) {
		options.push( {
			value: key,
			name: value.label,
			key,
		} );
	}

	return (
		<CustomSelectControl
			label={ __( 'Select Email Action:', 'ninja-forms' ) }
			options={ options }
			onChange={ ( { selectedItem } ) => {
				actions[ selectedItem.value ].value = selectedItem.value;
				props.setAction( "action", actions[ selectedItem.value ] );
			} }
		/>
	);
};

SelectAction.propTypes = {
	form:  PropTypes.object,
	setAction: PropTypes.func.isRequired
}