diff --git a/.env b/.env
index 5afc927..9e38faf 100644
--- a/.env
+++ b/.env
@@ -1 +1,2 @@
REACT_APP_API_BASE_URL=http://127.0.0.1:3002/v1
+GENERATE_SOURCEMAP=false
\ No newline at end of file
diff --git a/src/components/forms/SpeechForm.js b/src/components/forms/SpeechForm.js
index c9f0198..11d1fe0 100644
--- a/src/components/forms/SpeechForm.js
+++ b/src/components/forms/SpeechForm.js
@@ -21,6 +21,7 @@ import Button from '../elements/Button';
import Loader from '../blocks/Loader';
import { ServiceProviderValueContext } from '../../contexts/ServiceProviderContext';
+import AwsRegions from '../../data/AwsRegions';
import MicrosoftAzureRegions from '../../data/MicrosoftAzureRegions';
import { APP_API_BASE_URL } from "../../constants";
@@ -78,39 +79,42 @@ const SpeechServicesAddEdit = (props) => {
const refUseForStt = useRef(null);
const refApiKey = useRef(null);
const refRegion = useRef(null);
+ const refAwsRegion = useRef(null);
// Form inputs
- const [ vendor, setVendor ] = useState('');
- const [ serviceKey, setServiceKey ] = useState('');
- const [ displayedServiceKey, setDisplayedServiceKey ] = useState('');
- const [ accessKeyId, setAccessKeyId ] = useState('');
- const [ secretAccessKey, setSecretAccessKey ] = useState('');
- const [ useForTts, setUseForTts ] = useState(false);
- const [ useForStt, setUseForStt ] = useState(false);
- const [ accounts, setAccounts ] = useState([]);
- const [ accountSid, setAccountSid ] = useState('');
- const [ apiKey, setApiKey ] = useState('');
- const [ region, setRegion ] = useState('');
+ const [vendor, setVendor] = useState('');
+ const [serviceKey, setServiceKey] = useState('');
+ const [displayedServiceKey, setDisplayedServiceKey] = useState('');
+ const [accessKeyId, setAccessKeyId] = useState('');
+ const [secretAccessKey, setSecretAccessKey] = useState('');
+ const [useForTts, setUseForTts] = useState(false);
+ const [useForStt, setUseForStt] = useState(false);
+ const [accounts, setAccounts] = useState([]);
+ const [accountSid, setAccountSid] = useState('');
+ const [apiKey, setApiKey] = useState('');
+ const [region, setRegion] = useState('');
+ const [awsregion, setAwsRegion] = useState('');
// Invalid form inputs
- const [ invalidVendorGoogle, setInvalidVendorGoogle ] = useState(false);
- const [ invalidVendorAws, setInvalidVendorAws ] = useState(false);
- const [ invalidVendorMs, setInvalidVendorMs ] = useState(false);
- const [ invalidVendorWellSaid, setInvalidVendorWellSaid ] = useState(false);
- const [ invalidAccessKeyId, setInvalidAccessKeyId ] = useState(false);
- const [ invalidSecretAccessKey, setInvalidSecretAccessKey ] = useState(false);
- const [ invalidUseForTts, setInvalidUseForTts ] = useState(false);
- const [ invalidUseForStt, setInvalidUseForStt ] = useState(false);
- const [ invalidApiKey, setInvalidApiKey ] = useState(false);
- const [ invalidRegion, setInvalidRegion ] = useState(false);
+ const [invalidVendorGoogle, setInvalidVendorGoogle] = useState(false);
+ const [invalidVendorAws, setInvalidVendorAws] = useState(false);
+ const [invalidVendorMs, setInvalidVendorMs] = useState(false);
+ const [invalidVendorWellSaid, setInvalidVendorWellSaid] = useState(false);
+ const [invalidAccessKeyId, setInvalidAccessKeyId] = useState(false);
+ const [invalidSecretAccessKey, setInvalidSecretAccessKey] = useState(false);
+ const [invalidUseForTts, setInvalidUseForTts] = useState(false);
+ const [invalidUseForStt, setInvalidUseForStt] = useState(false);
+ const [invalidApiKey, setInvalidApiKey] = useState(false);
+ const [invalidRegion, setInvalidRegion] = useState(false);
+ const [invalidAwsRegion, setInvalidAwsRegion] = useState(false);
- const [ originalTtsValue, setOriginalTtsValue ] = useState(null);
- const [ originalSttValue, setOriginalSttValue ] = useState(null);
+ const [originalTtsValue, setOriginalTtsValue] = useState(null);
+ const [originalSttValue, setOriginalSttValue] = useState(null);
- const [ validServiceKey, setValidServiceKey ] = useState(false);
+ const [validServiceKey, setValidServiceKey] = useState(false);
- const [ showLoader, setShowLoader ] = useState(true);
- const [ errorMessage, setErrorMessage ] = useState('');
+ const [showLoader, setShowLoader] = useState(true);
+ const [errorMessage, setErrorMessage] = useState('');
useEffect(() => {
const getAPIData = async () => {
@@ -146,18 +150,19 @@ const SpeechServicesAddEdit = (props) => {
} catch (err) {
}
- setAccountSid( speechCredential.data.account_sid || '');
- setVendor( speechCredential.data.vendor || undefined);
- setServiceKey( serviceKeyJson || '');
- setDisplayedServiceKey( displayedServiceKeyJson || '');
- setAccessKeyId( speechCredential.data.access_key_id || '');
- setSecretAccessKey( speechCredential.data.secret_access_key || '');
- setApiKey( speechCredential.data.api_key || '');
- setRegion( speechCredential.data.region || '');
- setUseForTts( speechCredential.data.use_for_tts || false);
- setUseForStt( speechCredential.data.use_for_stt || false);
- setOriginalTtsValue( speechCredential.data.use_for_tts || false);
- setOriginalSttValue( speechCredential.data.use_for_stt || false);
+ setAccountSid(speechCredential.data.account_sid || '');
+ setVendor(speechCredential.data.vendor || undefined);
+ setServiceKey(serviceKeyJson || '');
+ setDisplayedServiceKey(displayedServiceKeyJson || '');
+ setAccessKeyId(speechCredential.data.access_key_id || '');
+ setSecretAccessKey(speechCredential.data.secret_access_key || '');
+ setApiKey(speechCredential.data.api_key || '');
+ setRegion(speechCredential.data.region || '');
+ setAwsRegion(speechCredential.data.aws_region || '');
+ setUseForTts(speechCredential.data.use_for_tts || false);
+ setUseForStt(speechCredential.data.use_for_stt || false);
+ setOriginalTtsValue(speechCredential.data.use_for_tts || false);
+ setOriginalSttValue(speechCredential.data.use_for_stt || false);
}
setShowLoader(false);
} catch (err) {
@@ -265,6 +270,15 @@ const SpeechServicesAddEdit = (props) => {
}
}
+ if (vendor === 'aws' && !awsregion) {
+ errorMessages.push('Please select a region.');
+ setInvalidAwsRegion(true);
+ if (!focusHasBeenSet) {
+ refAwsRegion.current.focus();
+ focusHasBeenSet = true;
+ }
+ }
+
if (vendor === 'microsoft' && !apiKey) {
errorMessages.push('Please provide an API key.');
setInvalidApiKey(true);
@@ -323,6 +337,7 @@ const SpeechServicesAddEdit = (props) => {
service_key: vendor === 'google' ? JSON.stringify(serviceKey) : null,
access_key_id: vendor === 'aws' ? accessKeyId : null,
secret_access_key: vendor === 'aws' ? secretAccessKey : null,
+ aws_region: vendor === 'aws' ? awsregion : null,
api_key: ['microsoft', 'wellsaid'].includes(vendor) ? apiKey : null,
region: vendor === 'microsoft' ? region : null,
use_for_tts: useForTts,
@@ -463,7 +478,7 @@ const SpeechServicesAddEdit = (props) => {
return (
showLoader ? (
-