@@ -24,14 +24,14 @@ export default function WebHooksIntegration({
2424 const [ isLoading , setIsLoading ] = useState ( false )
2525 const [ tab , setTab ] = useState ( 1 )
2626 const method = [ 'GET' , 'POST' , 'PUT' , 'PATCH' , 'OPTION' , 'DELETE' , 'TRACE' , 'CONNECT' ]
27- const handleInput = ( e ) => {
27+ const handleInput = e => {
2828 const tmpConfConf = { ...webHooks }
2929 tmpConfConf [ e . target . name ] = e . target . value
3030 setWebHooks ( { ...tmpConfConf } )
3131 }
32- const testWebHook = ( webHooksDetails ) => {
32+ const testWebHook = webHooksDetails => {
3333 setIsLoading ( true )
34- bitsFetch ( { hookDetails : webHooksDetails } , 'test_webhook' ) . then ( ( response ) => {
34+ bitsFetch ( { hookDetails : webHooksDetails } , 'test_webhook' ) . then ( response => {
3535 if ( response && response . success ) {
3636 setSnackbar ( { show : true , msg : `${ response . data } ` } )
3737 setIsLoading ( false )
@@ -88,7 +88,7 @@ export default function WebHooksIntegration({
8888 < div className = "f-m" > { __ ( 'Integration Name' , 'bit-integrations' ) } </ div >
8989 < input
9090 name = "name"
91- onChange = { ( e ) => handleInput ( e , webHooks , setWebHooks ) }
91+ onChange = { e => handleInput ( e , webHooks , setWebHooks ) }
9292 className = "btcd-paper-inp mt-1"
9393 type = "text"
9494 value = { webHooks . name }
@@ -102,7 +102,7 @@ export default function WebHooksIntegration({
102102 < div className = "f-m" > { __ ( 'Link:' , 'bit-integrations' ) } </ div >
103103 < input
104104 name = "url"
105- onChange = { ( e ) => handleInput ( e , webHooks , setWebHooks ) }
105+ onChange = { e => handleInput ( e , webHooks , setWebHooks ) }
106106 className = "btcd-paper-inp mt-1"
107107 type = "text"
108108 value = { webHooks . url }
@@ -113,7 +113,7 @@ export default function WebHooksIntegration({
113113 < div className = "f-m" > { __ ( 'Method:' , 'bit-integrations' ) } </ div >
114114 < select
115115 name = "method"
116- onChange = { ( e ) => handleInput ( e , webHooks , setWebHooks ) }
116+ onChange = { e => handleInput ( e , webHooks , setWebHooks ) }
117117 defaultValue = { webHooks . method }
118118 className = "btcd-paper-inp mt-1"
119119 disabled = { isInfo } >
@@ -134,96 +134,98 @@ export default function WebHooksIntegration({
134134 </ small >
135135 ) }
136136 { ! isInfo && (
137- < Button
138- onClick = { ( ) => testWebHook ( webHooks , setIsLoading , setSnackbar ) }
139- className = "btn btcd-btn-o-purple" >
140- { __ ( 'Test Webhook' , 'bit-integrations' ) }
141- { isLoading && < LoaderSm size = { 14 } clr = "#022217" className = "ml-2" /> }
142- </ Button >
143- ) }
144- < br />
145- < br />
146- < Tabs >
147- < div className = "flx mt-2" >
148- < Tab >
149- < button className = { `btcd-s-tab-link ${ tab === 1 && 's-t-l-active' } ` } type = "button" >
150- { __ ( 'Params' , 'bit-integrations' ) }
151- </ button >
152- </ Tab >
153- < Tab >
154- < button className = { `btcd-s-tab-link ${ tab === 2 && 's-t-l-active' } ` } type = "button" >
155- { __ ( 'Headers' , 'bit-integrations' ) }
156- </ button >
157- </ Tab >
158- < Tab >
159- < button className = { `btcd-s-tab-link ${ tab === 3 && 's-t-l-active' } ` } type = "button" >
160- { __ ( 'Body' , 'bit-integrations' ) }
161- </ button >
162- </ Tab >
163- </ div >
164- < div className = "btcd-hr" />
165- < Panel >
166- < Params
167- webHooks = { webHooks }
168- setWebHooks = { setWebHooks }
169- formFields = { formFields }
170- isInfo = { isInfo }
171- setTab = { setTab }
172- />
173- </ Panel >
174- < Panel >
175- < RequestHeaders
176- webHooks = { webHooks }
177- setWebHooks = { setWebHooks }
178- formFields = { formFields }
179- isInfo = { isInfo }
180- setTab = { setTab }
181- />
182- </ Panel >
183- < Panel >
184- < Body
185- webHooks = { webHooks }
186- setWebHooks = { setWebHooks }
187- formFields = { formFields }
188- isInfo = { isInfo }
189- setTab = { setTab }
190- />
191- </ Panel >
192- </ Tabs >
193-
194- { webHooks ?. condition && (
195137 < >
196- < div className = "flx" >
197- < TableCheckBox
198- onChange = { ( e ) => checkedCondition ( e . target . value , e . target . checked ) }
199- checked = { webHooks ?. condition ?. action_behavior === 'cond' }
200- className = "wdt-200 mt-4 mr-2"
201- value = "cond"
202- title = { __ ( 'Conditional Logics' , 'bit_integration' ) }
203- isInfo = { isInfo }
204- />
205- </ div >
138+ < Button
139+ onClick = { ( ) => testWebHook ( webHooks , setIsLoading , setSnackbar ) }
140+ className = "btn btcd-btn-o-purple" >
141+ { __ ( 'Test Webhook' , 'bit-integrations' ) }
142+ { isLoading && < LoaderSm size = { 14 } clr = "#022217" className = "ml-2" /> }
143+ </ Button >
144+
206145 < br />
207- { webHooks ?. condition ?. action_behavior === 'cond' && (
208- < ConditionalLogic
209- formFields = { formFields }
210- dataConf = { webHooks }
211- setDataConf = { setWebHooks }
212- />
146+ < br />
147+ < Tabs >
148+ < div className = "flx mt-2" >
149+ < Tab >
150+ < button className = { `btcd-s-tab-link ${ tab === 1 && 's-t-l-active' } ` } type = "button" >
151+ { __ ( 'Params' , 'bit-integrations' ) }
152+ </ button >
153+ </ Tab >
154+ < Tab >
155+ < button className = { `btcd-s-tab-link ${ tab === 2 && 's-t-l-active' } ` } type = "button" >
156+ { __ ( 'Headers' , 'bit-integrations' ) }
157+ </ button >
158+ </ Tab >
159+ < Tab >
160+ < button className = { `btcd-s-tab-link ${ tab === 3 && 's-t-l-active' } ` } type = "button" >
161+ { __ ( 'Body' , 'bit-integrations' ) }
162+ </ button >
163+ </ Tab >
164+ </ div >
165+ < div className = "btcd-hr" />
166+ < Panel >
167+ < Params
168+ webHooks = { webHooks }
169+ setWebHooks = { setWebHooks }
170+ formFields = { formFields }
171+ isInfo = { isInfo }
172+ setTab = { setTab }
173+ />
174+ </ Panel >
175+ < Panel >
176+ < RequestHeaders
177+ webHooks = { webHooks }
178+ setWebHooks = { setWebHooks }
179+ formFields = { formFields }
180+ isInfo = { isInfo }
181+ setTab = { setTab }
182+ />
183+ </ Panel >
184+ < Panel >
185+ < Body
186+ webHooks = { webHooks }
187+ setWebHooks = { setWebHooks }
188+ formFields = { formFields }
189+ isInfo = { isInfo }
190+ setTab = { setTab }
191+ />
192+ </ Panel >
193+ </ Tabs >
194+
195+ { webHooks ?. condition && (
196+ < >
197+ < div className = "flx" >
198+ < TableCheckBox
199+ onChange = { e => checkedCondition ( e . target . value , e . target . checked ) }
200+ checked = { webHooks ?. condition ?. action_behavior === 'cond' }
201+ className = "wdt-200 mt-4 mr-2"
202+ value = "cond"
203+ title = { __ ( 'Conditional Logics' , 'bit_integration' ) }
204+ isInfo = { isInfo }
205+ />
206+ </ div >
207+ < br />
208+ { webHooks ?. condition ?. action_behavior === 'cond' && (
209+ < ConditionalLogic
210+ formFields = { formFields }
211+ dataConf = { webHooks }
212+ setDataConf = { setWebHooks }
213+ />
214+ ) }
215+ </ >
213216 ) }
217+ { create && (
218+ < button
219+ onClick = { ( ) => nextPage ( ) }
220+ className = "btn btcd-btn-lg purple sh-sm flx"
221+ type = "button" >
222+ { __ ( 'Next' , 'bit-integrations' ) }
223+ < BackIcn className = "ml-1 rev-icn" />
224+ </ button >
225+ ) }
226+ < Note note = { info } />
214227 </ >
215228 ) }
216- { create && (
217- < button
218- onClick = { ( ) => nextPage ( ) }
219- className = "btn btcd-btn-lg purple sh-sm flx"
220- type = "button" >
221- { __ ( 'Next' , 'bit-integrations' ) }
222- < BackIcn className = "ml-1 rev-icn" />
223- </ button >
224- ) }
225-
226- < Note note = { info } />
227229 </ div >
228230 )
229231}
0 commit comments