Skip to content

Commit 300f157

Browse files
authored
Merge pull request #87 from Bit-Apps-Pro/refactor/capture-hook-data-api-req
Refactor: capture hook data http request
2 parents 0b74414 + 424366f commit 300f157

File tree

23 files changed

+802
-658
lines changed

23 files changed

+802
-658
lines changed

bitwpfi.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* Plugin Name: Bit Integrations
55
* Plugin URI: https://bitapps.pro/bit-integrations
66
* Description: Bit Integrations is a platform that integrates with over 250+ 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.4.7
7+
* Version: 2.4.8
88
* Author: Automation & Integration Plugin - Bit Apps
99
* Author URI: https://bitapps.pro
1010
* Text Domain: bit-integrations
1111
* Requires PHP: 7.4
1212
* Requires at least: 5.1
13-
* Tested up to: 6.7.1
13+
* Tested up to: 6.7.2
1414
* Domain Path: /languages
1515
* License: GPLv2 or later
1616
*/
@@ -24,7 +24,7 @@
2424
$btcbi_db_version = '1.1';
2525

2626
// Define most essential constants.
27-
define('BTCBI_VERSION', '2.4.7');
27+
define('BTCBI_VERSION', '2.4.8');
2828
define('BTCBI_PLUGIN_MAIN_FILE', __FILE__);
2929

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

frontend-dev/.prettierrc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
{
22
"semi": false,
3-
"bracketSpacing": true,
4-
"printWidth": 105,
5-
"useTabs": false,
63
"tabWidth": 2,
4+
"printWidth": 105,
75
"singleQuote": true,
6+
"trailingComma": "none",
7+
"jsxBracketSameLine": true,
8+
"useTabs": false,
89
"quoteProps": "as-needed",
910
"jsxSingleQuote": false,
10-
"bracketSameLine": false,
11-
"endOfLine": "lf",
12-
"trailingComma": "none",
13-
"arrowParens": "avoid",
14-
"plugins": ["prettier-plugin-tailwindcss"]
11+
"bracketSameLine": true,
12+
"arrowParens": "avoid"
1513
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { create } from 'mutative'
2+
import bitsFetch from './bitsFetch'
3+
4+
export default function CustomFetcherHelper(
5+
isLoadingRef,
6+
entityId,
7+
controller,
8+
setIsLoading,
9+
removeAction,
10+
removeMethod = 'POST',
11+
key = 'triggered_entity_id'
12+
) {
13+
const removeTestData = () => {
14+
if (!entityId) {
15+
return
16+
}
17+
18+
bitsFetch({ [key]: entityId }, removeAction, null, removeMethod)
19+
}
20+
21+
const stopFetching = () => {
22+
controller.abort()
23+
setIsLoading(false)
24+
isLoadingRef.current = false
25+
26+
removeTestData()
27+
}
28+
29+
return { stopFetching }
30+
}
31+
32+
const resetActionHookFlowData = setFlow => {
33+
setFlow(prevFlow =>
34+
create(prevFlow, draftFlow => {
35+
delete draftFlow?.triggerDetail?.tmp
36+
delete draftFlow?.triggerDetail?.data
37+
})
38+
)
39+
}
40+
41+
const startFetching = (
42+
isLoadingRef,
43+
setShowResponse,
44+
setPrimaryKey,
45+
setFlow,
46+
setIsLoading,
47+
isEdit = false
48+
) => {
49+
setIsLoading(true)
50+
isLoadingRef.current = true
51+
setShowResponse(false)
52+
setPrimaryKey(undefined)
53+
resetFlowData(setFlow, isEdit)
54+
}
55+
56+
const resetFlowData = (setFlow, isEdit = false) => {
57+
setFlow(prevFlow =>
58+
create(prevFlow, draftFlow => {
59+
const property = isEdit ? 'flow_details' : 'triggerDetail'
60+
61+
delete draftFlow[property].data
62+
})
63+
)
64+
}
65+
66+
export { startFetching, resetFlowData, resetActionHookFlowData }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const customFormIntegrations = [
3434
'BetterMessages',
3535
'ConvertPro',
3636
'FunnelKitAutomations',
37+
'CalculatedFieldsForm',
3738
]
3839

3940
export const actionHookIntegrations = ['ActionHook']

0 commit comments

Comments
 (0)