Skip to content

Commit dd8c7b3

Browse files
authored
Merge pull request #41 from Bit-Apps-Pro/rishad-dev-tmp
Demo link added
2 parents 63244f3 + 2f17bf1 commit dd8c7b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1049
-430
lines changed

bitwpfi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: Bit Integrations
55
* Plugin URI: https://bitapps.pro/bit-integrations
66
* Description: Bit Integrations is a platform that integrates with over 200+ different platforms to help with various tasks on your WordPress site, like WooCommerce, Form builder, Page builder, LMS, Sales funnels, Bookings, CRM, Webhooks, Email marketing, Social media and Spreadsheets, etc
7-
* Version: 2.2.6
7+
* Version: 2.2.7
88
* Author: Automation & Integration Plugin - Bit Apps
99
* Author URI: https://bitapps.pro
1010
* Text Domain: bit-integrations
@@ -23,7 +23,7 @@
2323
$btcbi_db_version = '1.0';
2424

2525
// Define most essential constants.
26-
define('BTCBI_VERSION', '2.2.6');
26+
define('BTCBI_VERSION', '2.2.7');
2727
define('BTCBI_PLUGIN_MAIN_FILE', __FILE__);
2828

2929
require_once plugin_dir_path(__FILE__) . 'includes/loader.php';

frontend-dev/src/App.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import ChangelogToggle from './pages/ChangelogToggle'
2323
import CashbackModal from './pages/CashbackModal'
2424
import { useRecoilValue } from 'recoil'
2525
import 'regenerator-runtime/runtime.js'
26+
import AnnouncementModal from './pages/AnnouncementModal'
2627
const AllIntegrations = lazy(() => import('./pages/AllIntegrations'))
2728
const Error404 = lazy(() => import('./pages/Error404'))
2829

@@ -73,6 +74,7 @@ function App() {
7374
{/* <span className="ml-2 mr-2 ">Bit Integrations</span> */}
7475
{/* </Link> */}
7576
</div>
77+
7678
<nav className="top-nav ml-2">
7779
<a
7880
target="_blank"
@@ -82,6 +84,9 @@ function App() {
8284
{__('Review us', 'bit-integrations')}
8385
</a>
8486
</nav>
87+
<nav className='top-nav ml-5'>
88+
<AnnouncementModal />
89+
</nav>
8590
<div className="flx flx-center" style={{ marginLeft: 'auto' }}>
8691
<CashbackModal />
8792
<ChangelogToggle />

frontend-dev/src/Utils/StaticData/webhookIntegrations.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ export const customFormIntegrations = [
1717
'SiteOriginWidgets',
1818
'Bricksforge',
1919
'PopupMaker',
20-
'DiviFormBuilder'
20+
'DiviFormBuilder',
21+
'Bricks',
22+
'Bricksforge',
23+
'Brizy',
24+
'GutenaForms'
2125
]
26+
2227
export const actionHookIntegrations = ['ActionHook']
28+
export const customTriggerIntegrations = ['CustomTrigger']
2329
export const freeTriggers = ['BitForm', 'CF7', 'CustomTrigger', 'Elementor', 'WC', 'WPF']

frontend-dev/src/components/AllIntegrations/EditActionHook.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-param-reassign */
22

33
import { create } from 'mutative'
4-
import { useEffect, useRef, useState } from 'react'
4+
import { useRef, useState } from 'react'
55
import MultiSelect from 'react-multiple-select-dropdown-lite'
66
import 'react-multiple-select-dropdown-lite/dist/index.css'
77
import { useRecoilState, useSetRecoilState } from 'recoil'
Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
/* eslint-disable no-param-reassign */
2+
3+
import { create } from 'mutative'
4+
import { useRef, useState } from 'react'
5+
import 'react-multiple-select-dropdown-lite/dist/index.css'
6+
import { useRecoilState, useSetRecoilState } from 'recoil'
7+
import { $actionConf, $formFields, $newFlow } from '../../GlobalStates'
8+
import CloseIcn from '../../Icons/CloseIcn'
9+
import bitsFetch from '../../Utils/bitsFetch'
10+
import { __ } from '../../Utils/i18nwrap'
11+
import LoaderSm from '../Loaders/LoaderSm'
12+
import CopyTextTrigger from '../Utilities/CopyTextTrigger'
13+
import EyeIcn from '../Utilities/EyeIcn'
14+
import EyeOffIcn from '../Utilities/EyeOffIcn'
15+
import SnackMsg from '../Utilities/SnackMsg'
16+
import TreeViewer from '../Utilities/treeViewer/TreeViewer'
17+
import FieldContainer from '../Utilities/FieldContainer'
18+
19+
function EditCustomTrigger() {
20+
const [actionConf, setActionConf] = useRecoilState($actionConf)
21+
const [flow, setFlow] = useRecoilState($newFlow)
22+
const setFormFields = useSetRecoilState($formFields)
23+
const [isLoading, setIsLoading] = useState(false)
24+
const [snack, setSnackbar] = useState({ show: false })
25+
const [showResponse, setShowResponse] = useState(false)
26+
const [showSelectedFields, setShowSelectedFields] = useState(false)
27+
const fetchIntervalRef = useRef(0)
28+
let controller = new AbortController()
29+
const signal = controller.signal
30+
31+
const triggerAbeleHook = `do_action(
32+
'bit_integrations_custom_trigger',
33+
'${flow?.triggered_entity_id}',
34+
array()
35+
);`
36+
37+
const setSelectedFieldsData = (value = null, remove = false, index = null) => {
38+
if (remove) {
39+
index = index ? index : flow.flow_details.fields.findIndex((field) => field.name === value)
40+
41+
if (index !== -1) {
42+
removeSelectedField(index)
43+
}
44+
return
45+
}
46+
addSelectedField(value)
47+
}
48+
49+
const addSelectedField = (value) => {
50+
setFlow((prevFlow) =>
51+
create(prevFlow, (draftFlow) => {
52+
if (draftFlow.flow_details.fields.findIndex((field) => field.name === value) === -1) {
53+
draftFlow.flow_details['fields'].push({ label: value, name: value })
54+
}
55+
})
56+
)
57+
setActionConf((prevConf) =>
58+
create(prevConf, (draftConf) => {
59+
if (draftConf.fields.findIndex((field) => field.name === value) === -1) {
60+
draftConf['fields'].push({ label: value, name: value })
61+
}
62+
})
63+
)
64+
setFormFields((prevFields) =>
65+
create(prevFields, (draftFields) => {
66+
if (draftFields.findIndex((field) => field.name === value) === -1) {
67+
draftFields.push({ label: value, name: value })
68+
}
69+
})
70+
)
71+
}
72+
73+
const removeSelectedField = (index) => {
74+
setFormFields((prevFields) =>
75+
create(prevFields, (draftFields) => {
76+
index = draftFields.findIndex(
77+
(field) => field.name === flow.flow_details.fields[index].name
78+
)
79+
draftFields.splice(index, 1)
80+
})
81+
)
82+
setFlow((prevFlow) =>
83+
create(prevFlow, (draftFlow) => {
84+
draftFlow.flow_details.fields.splice(index, 1)
85+
})
86+
)
87+
setActionConf((prevConf) =>
88+
create(prevConf, (draftConf) => {
89+
draftConf.fields.splice(index, 1)
90+
})
91+
)
92+
}
93+
94+
const removeTestData = (hookID, reset = false) => {
95+
bitsFetch({ hook_id: hookID, reset: reset }, 'custom_trigger/test/remove').then((resp) => {
96+
delete window.hook_id
97+
fetchIntervalRef.current && clearInterval(fetchIntervalRef.current)
98+
})
99+
}
100+
101+
const handleFetch = () => {
102+
if (isLoading) {
103+
fetchIntervalRef.current && clearInterval(fetchIntervalRef.current)
104+
controller.abort()
105+
removeTestData(flow?.triggered_entity_id)
106+
setIsLoading(false)
107+
return
108+
}
109+
110+
setIsLoading(true)
111+
setShowResponse(false)
112+
setFlow((prevFlow) =>
113+
create(prevFlow, (draftFlow) => {
114+
delete draftFlow.flow_details?.tmp
115+
delete draftFlow.flow_details?.rawData
116+
})
117+
)
118+
fetchIntervalRef.current = setInterval(() => {
119+
bitsFetch({ hook_id: flow?.triggered_entity_id }, 'custom_trigger/test', null, 'post', signal)
120+
.then((resp) => {
121+
if (resp.success) {
122+
controller.abort()
123+
clearInterval(fetchIntervalRef.current)
124+
setFlow((prevFlow) =>
125+
create(prevFlow, (draftFlow) => {
126+
draftFlow.flow_details.rawData = resp.data.custom_trigger
127+
draftFlow.flow_details.fields = []
128+
129+
if (draftFlow.flow_details?.body?.data) {
130+
draftFlow.flow_details.body.data = []
131+
} else {
132+
draftFlow.flow_details.field_map = []
133+
}
134+
})
135+
)
136+
setActionConf((prevConf) =>
137+
create(prevConf, (draftConf) => {
138+
draftConf.rawData = resp.data.custom_trigger
139+
draftConf.fields = []
140+
141+
if (draftConf?.body?.data) {
142+
draftConf.body.data = []
143+
} else {
144+
draftConf.field_map = []
145+
}
146+
})
147+
)
148+
149+
setFormFields([])
150+
setIsLoading(false)
151+
setShowResponse(true)
152+
setShowSelectedFields(true)
153+
removeTestData(flow?.triggered_entity_id, true)
154+
}
155+
})
156+
.catch((err) => {
157+
if (err.name === 'AbortError') {
158+
console.log(__('AbortError: Fetch request aborted', 'bit-integrations'))
159+
}
160+
})
161+
}, 1500)
162+
}
163+
164+
const showResponseTable = () => {
165+
setShowResponse((prevState) => !prevState)
166+
}
167+
168+
const onUpdateField = (value, index, key) => {
169+
setFlow((prevFlow) =>
170+
create(prevFlow, (draftFlow) => {
171+
draftFlow.flow_details.fields[index][key] = value
172+
})
173+
)
174+
setActionConf((prevConf) =>
175+
create(prevConf, (draftConf) => {
176+
draftConf.fields[index][key] = value
177+
})
178+
)
179+
setFormFields((prevFields) =>
180+
create(prevFields, (draftFields) => {
181+
draftFields[index][key] = value
182+
})
183+
)
184+
}
185+
186+
return (
187+
<div className="trigger-custom-width">
188+
<SnackMsg snack={snack} setSnackbar={setSnackbar} />
189+
<div className="mt-3">
190+
<b>{__('Custom action trigger:', 'bit-integrations')}</b>
191+
</div>
192+
<CopyTextTrigger
193+
value={triggerAbeleHook}
194+
className="flx mt-2"
195+
setSnackbar={setSnackbar}
196+
readOnly
197+
/>
198+
199+
<div className="flx flx-between">
200+
<button
201+
onClick={handleFetch}
202+
className={`btn btcd-btn-lg sh-sm flx ${isLoading ? 'red' : 'purple'}`}
203+
type="button"
204+
disabled={isLoading}>
205+
{isLoading
206+
? __('Stop', 'bit-integrations')
207+
: flow.flow_details?.rawData
208+
? __('Fetched ✔', 'bit-integrations')
209+
: __('Fetch', 'bit-integrations')}
210+
{isLoading && <LoaderSm size="20" clr="#022217" className="ml-2" />}
211+
</button>
212+
</div>
213+
214+
{flow.flow_details?.rawData && (
215+
<>
216+
<div className="my-3">
217+
<b>{__('Selected Fields:', 'bit-integrations')}</b>
218+
</div>
219+
220+
{showSelectedFields && (
221+
<FieldContainer
222+
data={flow.flow_details.fields}
223+
onUpdateField={onUpdateField}
224+
onRemoveField={removeSelectedField}
225+
/>
226+
)}
227+
<button
228+
onClick={() => setShowSelectedFields((prev) => !prev)}
229+
className="btn btcd-btn-md sh-sm flx gray">
230+
<span className="txt-actionHook-resbtn font-inter-500">
231+
{showSelectedFields ? 'Hide Selected Fields' : 'View Selected Fields'}
232+
</span>
233+
&nbsp;
234+
{!showSelectedFields ? (
235+
<EyeIcn width="20" height="20" strokeColor="#000000" />
236+
) : (
237+
<EyeOffIcn width="20" height="20" strokeColor="#000000" />
238+
)}
239+
</button>
240+
</>
241+
)}
242+
243+
{flow.flow_details?.rawData && (
244+
<>
245+
<div className="mt-5">
246+
<b>{__('Select Fields:', 'bit-integrations')}</b>
247+
</div>
248+
249+
{showResponse && (
250+
<TreeViewer data={flow?.flow_details?.rawData} onChange={setSelectedFieldsData} />
251+
)}
252+
</>
253+
)}
254+
255+
{flow.flow_details?.rawData && (
256+
<div className="flx flx-between">
257+
<button onClick={showResponseTable} className="btn btcd-btn-md sh-sm flx gray">
258+
<span className="txt-actionHook-resbtn font-inter-500">
259+
{showResponse
260+
? __('Hide Response', 'bit-integrations')
261+
: __('View Response', 'bit-integrations')}
262+
</span>
263+
&nbsp;
264+
{!showResponse ? (
265+
<EyeIcn width="20" height="20" strokeColor="#000000" />
266+
) : (
267+
<EyeOffIcn width="20" height="20" strokeColor="#000000" />
268+
)}
269+
</button>
270+
</div>
271+
)}
272+
</div>
273+
)
274+
}
275+
276+
export default EditCustomTrigger

frontend-dev/src/components/AllIntegrations/EditInteg.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ const IntegType = memo(({ allIntegURL, flow }) => {
540540
return <EditDokan allIntegURL={allIntegURL} />
541541
case 'JetEngine':
542542
return <EditJetEngine allIntegURL={allIntegURL} />
543-
case 'High Level':
543+
case 'GoHighLevel':
544544
return <EditHighLevel allIntegURL={allIntegURL} />
545545
default:
546546
return <Loader style={loaderStyle} />

frontend-dev/src/components/AllIntegrations/HighLevel/HighLevel.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function HighLevel({ formFields, setFlow, flow, allIntegURL }) {
3030
})
3131

3232
const [highLevelConf, setHighLevelConf] = useState({
33-
name: 'High Level',
34-
type: 'High Level',
33+
name: 'GoHighLevel',
34+
type: 'GoHighLevel',
3535
api_key:
3636
process.env.NODE_ENV === 'development'
3737
? 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2NhdGlvbl9pZCI6IlBqM1lwWkE2bHZTcmhBYlZ4dDRWIiwidmVyc2lvbiI6MSwiaWF0IjoxNzI2MzkxMjM1NTQwLCJzdWIiOiJORHFMUmNBT1ZSU2xPbTFrTUlLZiJ9.N8u68mUJxmmFHIozCtJCoIgCnxq9D-uipGIZFDYMe1w'

frontend-dev/src/components/AllIntegrations/HighLevel/HighLevelAuthorization.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ export default function HighLevelAuthorization({
4141
}
4242

4343
const ActiveInstructions = `
44-
<h4>${__('Get High Level Api Key', 'bit-integrations')}</h4>
44+
<h4>${__('Get GoHighLevel Api Key', 'bit-integrations')}</h4>
4545
<ul>
46-
<li>${__('First go to your High Level sub account settings then business profile tab', 'bit-integrations')}.</li>
46+
<li>${__('First go to your GoHighLevel sub account settings then business profile tab', 'bit-integrations')}.</li>
4747
<li>${__('Copy the the API key.', 'bit-integrations')}</li>
4848
<li>${__('You can also get the API key from Agency view. Navigate to settings then API keys tab.', 'bit-integrations')}</li>
4949
</ul>`
@@ -72,15 +72,15 @@ export default function HighLevelAuthorization({
7272
<div style={{ color: 'red', fontSize: '15px' }}>{error.name}</div>
7373

7474
<div className="mt-3 wdt-250">
75-
<b>{__('High Level Api Key:', 'bit-integrations')}</b>
75+
<b>{__('GoHighLevel Api Key:', 'bit-integrations')}</b>
7676
</div>
7777
<input
7878
className="btcd-paper-inp w-6 mt-1"
7979
onChange={handleInput}
8080
name="api_key"
8181
value={highLevelConf.api_key}
8282
type="text"
83-
placeholder={__('High Level Api Key...', 'bit-integrations')}
83+
placeholder={__('GoHighLevel Api Key...', 'bit-integrations')}
8484
disabled={isInfo}
8585
/>
8686
<div style={{ color: 'red', fontSize: '15px' }}>{error.api_key}</div>

0 commit comments

Comments
 (0)