@@ -11,7 +11,7 @@ import EditWebhookInteg from '../EditWebhookInteg'
1111import { saveActionConf } from '../IntegrationHelpers/IntegrationHelpers'
1212import IntegrationStepThree from '../IntegrationHelpers/IntegrationStepThree'
1313import MailMintIntegLayout from './MailMintIntegLayout'
14- import { handleInput } from './MailMintCommonFunc'
14+ import { checkMappedFields , handleInput } from './MailMintCommonFunc'
1515
1616function EditMailMint ( { allIntegURL } ) {
1717 const navigate = useNavigate ( )
@@ -23,6 +23,34 @@ function EditMailMint({ allIntegURL }) {
2323 const [ isLoading , setIsLoading ] = useState ( false )
2424 const [ snack , setSnackbar ] = useState ( { show : false } )
2525
26+ const saveConfig = ( ) => {
27+ if ( ! checkMappedFields ( mailMintConf ) ) {
28+ setSnackbar ( {
29+ show : true ,
30+ msg : __ ( 'Please map all required fields to continue.' , 'bit-integrations' )
31+ } )
32+ return
33+ }
34+
35+ if ( ! mailMintConf ?. name ) {
36+ setSnackbar ( {
37+ show : true ,
38+ msg : __ ( 'Please integrations name is required.' , 'bit-integrations' )
39+ } )
40+ return
41+ }
42+
43+ saveActionConf ( {
44+ flow,
45+ allIntegURL,
46+ conf : mailMintConf ,
47+ navigate,
48+ edit : 1 ,
49+ setIsLoading,
50+ setSnackbar
51+ } )
52+ }
53+
2654 return (
2755 < div style = { { width : 900 } } >
2856 < SnackMsg snack = { snack } setSnackbar = { setSnackbar } />
@@ -31,7 +59,7 @@ function EditMailMint({ allIntegURL }) {
3159 < b className = "wdt-200 d-in-b" > { __ ( 'Integration Name:' , 'bit-integrations' ) } </ b >
3260 < input
3361 className = "btcd-paper-inp w-5"
34- onChange = { ( e ) => handleInput ( e , mailMintConf , setMailMintConf ) }
62+ onChange = { e => handleInput ( e , mailMintConf , setMailMintConf ) }
3563 name = "name"
3664 value = { mailMintConf . name }
3765 type = "text"
@@ -45,9 +73,7 @@ function EditMailMint({ allIntegURL }) {
4573 < MailMintIntegLayout
4674 formID = { formID }
4775 formFields = { formFields }
48- handleInput = { ( e ) =>
49- handleInput ( e , mailMintConf , setMailMintConf , setIsLoading , setSnackbar )
50- }
76+ handleInput = { e => handleInput ( e , mailMintConf , setMailMintConf , setIsLoading , setSnackbar ) }
5177 mailMintConf = { mailMintConf }
5278 setMailMintConf = { setMailMintConf }
5379 isLoading = { isLoading }
@@ -57,18 +83,8 @@ function EditMailMint({ allIntegURL }) {
5783
5884 < IntegrationStepThree
5985 edit
60- saveConfig = { ( ) =>
61- saveActionConf ( {
62- flow,
63- allIntegURL,
64- conf : mailMintConf ,
65- navigate,
66- edit : 1 ,
67- setIsLoading,
68- setSnackbar
69- } )
70- }
71- disabled = { ! mailMintConf . mainAction || isLoading }
86+ saveConfig = { saveConfig }
87+ disabled = { ! mailMintConf ?. mainAction || ! mailMintConf ?. name || isLoading }
7288 isLoading = { isLoading }
7389 dataConf = { mailMintConf }
7490 setDataConf = { setMailMintConf }
0 commit comments