Skip to content

Commit 190f3c8

Browse files
authored
Merge pull request #25 from Bit-Apps-Pro/niloy-dev
Version updated to 2.1.5
2 parents cc96a8e + 65cf25b commit 190f3c8

File tree

12 files changed

+81
-22
lines changed

12 files changed

+81
-22
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.1.4
7+
* Version: 2.1.5
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.1.4');
26+
define('BTCBI_VERSION', '2.1.5');
2727
define('BTCBI_PLUGIN_MAIN_FILE', __FILE__);
2828

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

frontend-dev/src/components/AllIntegrations/FreshSales/FreshSalesActions.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { $btcbi } from '../../../GlobalStates'
99

1010
export default function FreshSalesActions({ freshSalesConf, setFreshSalesConf }) {
1111
const btcbi = useRecoilValue($btcbi)
12-
const { isPro } = btcbi
12+
const { isPro, version } = btcbi
1313

1414
const actionHandler = (e, type) => {
1515
const newConf = { ...freshSalesConf }
@@ -27,7 +27,7 @@ export default function FreshSalesActions({ freshSalesConf, setFreshSalesConf })
2727
return (
2828
<>
2929
<div className="pos-rel d-flx w-8">
30-
{'Product' !== freshSalesConf.moduleData.module && (
30+
{'Product' !== freshSalesConf.moduleData.module && isPro && version > '2.1.0' && (
3131
<TableCheckBox
3232
onChange={(e) => actionHandler(e, 'upsert')}
3333
checked={freshSalesConf?.actions?.upsert || false}

frontend-dev/src/pages/ChangelogToggle.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default function ChangelogToggle() {
8888
<div className='changelog'>
8989
<div className="flx flx-col flx-center whats-new">
9090
<h3>What's New in {btcbi.version}?</h3>
91-
<small className='date'> <b>8th July 2024</b></small>
91+
<small className='date'>Updated at: <b>11th July 2024</b></small>
9292
</div>
9393
<div className='changelog-content'>
9494
{/* <span className='new-integration' ><b>New Features</b></span>
@@ -99,13 +99,11 @@ export default function ChangelogToggle() {
9999
</ul>
100100
</div> */}
101101

102-
<span className='new-feature' ><b>New Improvements</b></span>
102+
<span className='new-feature' ><b>New Fixes</b></span>
103103

104104
<div className='integration-list'>
105105
<ul>
106-
<li>WooCommerce: Product create trigger Improved </li>
107-
<li>Salesforce: Case Status action dynamically functioned </li>
108-
<li>Webhook: Fetch Api improved </li>
106+
<li>Webhook: Test Webhook execute issue fixed </li>
109107
</ul>
110108
</div>
111109
<div>

includes/Actions/FreshSales/RecordApiHelper.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
namespace BitCode\FI\Actions\FreshSales;
88

9+
use BitCode\FI\Log\LogHandler;
910
use BitCode\FI\Core\Util\Common;
1011
use BitCode\FI\Core\Util\Helper;
1112
use BitCode\FI\Core\Util\HttpHelper;
12-
use BitCode\FI\Log\LogHandler;
13+
use BitApps\BTCBI_PRO\Actions\FreshSales\FreshSalesRecordApiHelper;
1314

1415
/**
1516
* Provide functionality for Record insert, upsert
@@ -65,8 +66,8 @@ public function insertRecord(
6566

6667
public function upsertRecord($module, $finalData)
6768
{
68-
if (Helper::isProActivate()) {
69-
return \BitApps\BTCBI_PRO\Actions\FreshSales\FreshSalesRecordApiHelper::upsertRecord($module, $finalData, $this->_integrationDetails, $this->_defaultHeader, $this->baseUrl);
69+
if (Helper::pro_action_feat_exists('FreshSales', 'upsertRecord')) {
70+
return FreshSalesRecordApiHelper::upsertRecord($module, $finalData, $this->_integrationDetails, $this->_defaultHeader, $this->baseUrl);
7071
}
7172

7273
return $this->insertRecord($module, $finalData);

includes/Actions/MailChimp/RecordApiHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use BitCode\FI\Log\LogHandler;
1010
use BitCode\FI\Core\Util\Helper;
1111
use BitCode\FI\Core\Util\HttpHelper;
12+
use BitApps\BTCBI_PRO\Actions\MailChimp\MailChimpRecordHelper;
1213

1314
/**
1415
* Provide functionality for Record insert,upsert
@@ -38,11 +39,11 @@ public function insertRecord($listId, $data)
3839

3940
public function addRemoveTag($module, $listId, $data)
4041
{
41-
if (Helper::isProActivate()) {
42+
if (Helper::pro_action_feat_exists('MailChimp', 'addRemoveTag')) {
4243
$subscriber_hash = md5(strtolower(trim($data['email_address'])));
4344
$endpoint = $this->_apiEndPoint() . "/lists/{$listId}/members/{$subscriber_hash}/tags";
4445

45-
return \BitApps\BTCBI_PRO\Actions\MailChimp\MailChimpRecordHelper::addRemoveTag($module, $data, $endpoint, $this->_defaultHeader);
46+
return MailChimpRecordHelper::addRemoveTag($module, $data, $endpoint, $this->_defaultHeader);
4647
}
4748
LogHandler::save($this->_integrationID, ['type' => 'record', 'type_name' => $module], 'error', 'Bit Integration Pro plugin is not installed or activate');
4849

includes/Actions/WebHooks/WebHooksController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace BitCode\FI\Actions\WebHooks;
88

9+
use BitCode\FI\Log\LogHandler;
910
use BitCode\FI\Core\Util\Common;
1011
use BitCode\FI\Core\Util\HttpHelper;
11-
use BitCode\FI\Log\LogHandler;
1212

1313
/**
1414
* Provide functionality for webhooks
@@ -25,7 +25,7 @@ public static function testWebhook($webhookDetails)
2525
400
2626
);
2727
}
28-
wp_send_json_success(__('webhook executed succcessfully', 'bit-integrations'), 200);
28+
wp_send_json_success(__('Test webhook executed succcessfully', 'bit-integrations'), 200);
2929
}
3030

3131
public static function execute($integrationDetails, $fieldValues)

includes/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Config
2121

2222
public const VAR_PREFIX = 'btcbi_';
2323

24-
public const VERSION = '2.1.4';
24+
public const VERSION = '2.1.5';
2525

2626
public const DB_VERSION = '1.0';
2727

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace BitCode\FI\Core\Util;
4+
5+
// All Pro Action Features
6+
final class AllProActionFeat
7+
{
8+
public static $features = [
9+
'MailChimp' => [
10+
['feat_name' => 'addRemoveTag', 'class' => '\BitApps\BTCBI_PRO\Actions\MailChimp\MailChimpRecordHelper', 'pro_init_v' => '2.0.9']
11+
],
12+
'FreshSales' => [
13+
['feat_name' => 'upsertRecord', 'class' => '\BitApps\BTCBI_PRO\Actions\FreshSales\FreshSalesRecordApiHelper', 'pro_init_v' => '2.1.1']
14+
]
15+
];
16+
}

includes/Core/Util/Helper.php

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace BitCode\FI\Core\Util;
44

5-
use BitCode\FI\Triggers\TriggerController;
65
use DateTime;
7-
use Exception;
86
use stdClass;
97
use WP_Error;
8+
use Exception;
9+
use BitCode\FI\Triggers\TriggerController;
1010

1111
/**
1212
* bit-integration helper class
@@ -169,6 +169,35 @@ public static function isProActivate()
169169
return \function_exists('btcbi_pro_activate_plugin');
170170
}
171171

172+
public static function pro_action_feat_exists($keyName, $featName)
173+
{
174+
$feature = static::findFeature($keyName, $featName);
175+
176+
if (empty($feature)) {
177+
return false;
178+
}
179+
180+
return (bool) (!empty($feature) && static::isProActivate() && \defined('BTCBI_PRO_VERSION') && (BTCBI_PRO_VERSION >= $feature['pro_init_v']) && class_exists($feature['class']));
181+
}
182+
183+
public static function findFeature($keyName, $featName)
184+
{
185+
$features = AllProActionFeat::$features;
186+
187+
if (!isset($features[$keyName])) {
188+
return;
189+
}
190+
191+
$featNames = array_column($features[$keyName], 'feat_name');
192+
$index = array_search($featName, $featNames);
193+
194+
if ($index !== false) {
195+
return $features[$keyName][$index];
196+
}
197+
198+
return [];
199+
}
200+
172201
public static function isUserLoggedIn()
173202
{
174203
return is_user_logged_in();

includes/Flow/Flow.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ public function authorizationStatusChange($data, $status)
260260
'flow_details',
261261
]
262262
);
263-
$integration = $integration = $integrations[0];
263+
if (is_wp_error($integrations)) {
264+
wp_send_json_error($integrations->get_error_message());
265+
}
266+
267+
$integration = $integrations[0];
264268
$flowDetails = json_decode($integration->flow_details);
265269

266270
$flowDetails->isAuthorized = $status;

0 commit comments

Comments
 (0)