Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: capture hook data http request #87

Merged
merged 19 commits into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bitwpfi.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* Plugin Name: Bit Integrations
* Plugin URI: https://bitapps.pro/bit-integrations
* 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
* Version: 2.4.7
* Version: 2.4.8
* Author: Automation & Integration Plugin - Bit Apps
* Author URI: https://bitapps.pro
* Text Domain: bit-integrations
* Requires PHP: 7.4
* Requires at least: 5.1
* Tested up to: 6.7.1
* Tested up to: 6.7.2
* Domain Path: /languages
* License: GPLv2 or later
*/
Expand All @@ -24,7 +24,7 @@
$btcbi_db_version = '1.1';

// Define most essential constants.
define('BTCBI_VERSION', '2.4.7');
define('BTCBI_VERSION', '2.4.8');
define('BTCBI_PLUGIN_MAIN_FILE', __FILE__);

require_once plugin_dir_path(__FILE__) . 'includes/loader.php';
Expand Down
14 changes: 6 additions & 8 deletions frontend-dev/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"semi": false,
"bracketSpacing": true,
"printWidth": 105,
"useTabs": false,
"tabWidth": 2,
"printWidth": 105,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true,
"useTabs": false,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"bracketSameLine": false,
"endOfLine": "lf",
"trailingComma": "none",
"arrowParens": "avoid",
"plugins": ["prettier-plugin-tailwindcss"]
"bracketSameLine": true,
"arrowParens": "avoid"
}
66 changes: 66 additions & 0 deletions frontend-dev/src/Utils/CustomFetcherHelper.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { create } from 'mutative'
import bitsFetch from './bitsFetch'

export default function CustomFetcherHelper(
isLoadingRef,
entityId,
controller,
setIsLoading,
removeAction,
removeMethod = 'POST',
key = 'triggered_entity_id'
) {
const removeTestData = () => {
if (!entityId) {
return
}

bitsFetch({ [key]: entityId }, removeAction, null, removeMethod)
}

const stopFetching = () => {
controller.abort()
setIsLoading(false)
isLoadingRef.current = false

removeTestData()
}

return { stopFetching }
}

const resetActionHookFlowData = setFlow => {
setFlow(prevFlow =>
create(prevFlow, draftFlow => {
delete draftFlow?.triggerDetail?.tmp
delete draftFlow?.triggerDetail?.data
})
)
}

const startFetching = (
isLoadingRef,
setShowResponse,
setPrimaryKey,
setFlow,
setIsLoading,
isEdit = false
) => {
setIsLoading(true)
isLoadingRef.current = true
setShowResponse(false)
setPrimaryKey(undefined)
resetFlowData(setFlow, isEdit)
}

const resetFlowData = (setFlow, isEdit = false) => {
setFlow(prevFlow =>
create(prevFlow, draftFlow => {
const property = isEdit ? 'flow_details' : 'triggerDetail'

delete draftFlow[property].data
})
)
}

export { startFetching, resetFlowData, resetActionHookFlowData }
1 change: 1 addition & 0 deletions frontend-dev/src/Utils/StaticData/webhookIntegrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const customFormIntegrations = [
'BetterMessages',
'ConvertPro',
'FunnelKitAutomations',
'CalculatedFieldsForm',
]

export const actionHookIntegrations = ['ActionHook']
Expand Down
Loading