Skip to content

Commit 6293b51

Browse files
authored
Merge pull request #109 from Bit-Apps-Pro/rishad-dev-tmp
Version updated to v2.6.4
2 parents 2921e79 + c2c5e75 commit 6293b51

File tree

20 files changed

+598
-356
lines changed

20 files changed

+598
-356
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 290+ 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.6.3
7+
* Version: 2.6.4
88
* Author: Automation & Integration Plugin - Bit Apps
99
* Author URI: https://bitapps.pro
1010
* Text Domain: bit-integrations
@@ -24,7 +24,7 @@
2424
$btcbi_db_version = '1.1';
2525

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

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

frontend-dev/src/components/AllIntegrations/MailerLite/EditMailerLite.jsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-param-reassign */
22

3-
import { useState } from 'react'
3+
import { useEffect, useState } from 'react'
44
import { useNavigate, useParams } from 'react-router-dom'
55
import { useRecoilState, useRecoilValue } from 'recoil'
66
import { $actionConf, $formFields, $newFlow } from '../../../GlobalStates'
@@ -13,6 +13,7 @@ import { saveActionConf } from '../IntegrationHelpers/IntegrationHelpers'
1313
import IntegrationStepThree from '../IntegrationHelpers/IntegrationStepThree'
1414
import { checkMappedFields, handleInput } from './MailerLiteCommonFunc'
1515
import MailerLiteIntegLayout from './MailerLiteIntegLayout'
16+
import { create } from 'mutative'
1617

1718
function EditMailerLite({ allIntegURL }) {
1819
const navigate = useNavigate()
@@ -45,6 +46,16 @@ function EditMailerLite({ allIntegURL }) {
4546
})
4647
}
4748

49+
useEffect(() => {
50+
if (!mailerLiteConf?.action) {
51+
setMailerLiteConf(prev =>
52+
create(prev, draftConf => {
53+
draftConf.action = 'add_subscriber'
54+
})
55+
)
56+
}
57+
}, [])
58+
4859
return (
4960
<div style={{ width: 900 }}>
5061
<SnackMsg snack={snack} setSnackbar={setSnackbar} />
@@ -53,7 +64,7 @@ function EditMailerLite({ allIntegURL }) {
5364
<b className="wdt-200 d-in-b">{__('Integration Name:', 'bit-integrations')}</b>
5465
<input
5566
className="btcd-paper-inp w-5"
56-
onChange={(e) => handleInput(e, mailerLiteConf, setMailerLiteConf)}
67+
onChange={e => handleInput(e, mailerLiteConf, setMailerLiteConf, loading, setLoading)}
5768
name="name"
5869
value={mailerLiteConf.name}
5970
type="text"
@@ -66,9 +77,7 @@ function EditMailerLite({ allIntegURL }) {
6677
<MailerLiteIntegLayout
6778
formID={flow.triggered_entity_id}
6879
formFields={formField}
69-
handleInput={(e) =>
70-
handleInput(e, mailerLiteConf, setMailerLiteConf, setLoading, setSnackbar)
71-
}
80+
handleInput={e => handleInput(e, mailerLiteConf, setMailerLiteConf, loading, setLoading)}
7281
mailerLiteConf={mailerLiteConf}
7382
setMailerLiteConf={setMailerLiteConf}
7483
loading={loading}

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ function MailerLite({ formFields, setFlow, flow, allIntegURL }) {
3535
mailerLiteFields: [],
3636
groups: [],
3737
group_ids: [],
38-
actions: {}
38+
actions: {},
39+
action: ''
3940
})
4041

4142
const saveConfig = () => {
@@ -96,22 +97,24 @@ function MailerLite({ formFields, setFlow, flow, allIntegURL }) {
9697
style={{ ...(step === 2 && { width: 900, height: 'auto', overflow: 'visible' }) }}>
9798
<MailerLiteIntegLayout
9899
formFields={formFields}
99-
handleInput={e => handleInput(e, mailerLiteConf, setMailerLiteConf, setLoading, setSnackbar)}
100+
handleInput={e => handleInput(e, mailerLiteConf, setMailerLiteConf, loading, setLoading)}
100101
mailerLiteConf={mailerLiteConf}
101102
setMailerLiteConf={setMailerLiteConf}
102103
loading={loading}
103104
setLoading={setLoading}
104105
setSnackbar={setSnackbar}
105106
/>
106107

107-
<button
108-
onClick={() => nextPage(3)}
109-
// disabled={!mailerLiteConf?.recipient_id}
110-
className="btn f-right btcd-btn-lg purple sh-sm flx"
111-
type="button">
112-
{__('Next', 'bit-integrations')} &nbsp;
113-
<div className="btcd-icn icn-arrow_back rev-icn d-in-b" />
114-
</button>
108+
{mailerLiteConf?.action && (
109+
<button
110+
onClick={() => nextPage(3)}
111+
disabled={!checkMappedFields(mailerLiteConf)}
112+
className="btn f-right btcd-btn-lg purple sh-sm flx"
113+
type="button">
114+
{__('Next', 'bit-integrations')} &nbsp;
115+
<div className="btcd-icn icn-arrow_back rev-icn d-in-b" />
116+
</button>
117+
)}
115118
</div>
116119

117120
{/* STEP 3 */}

frontend-dev/src/components/AllIntegrations/MailerLite/MailerLiteActions.jsx

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,23 @@ import TableCheckBox from '../../Utilities/TableCheckBox'
1010
import 'react-multiple-select-dropdown-lite/dist/index.css'
1111
import { getAllGroups } from './MailerLiteCommonFunc'
1212

13-
export default function MailerLiteActions({
14-
mailerLiteConf,
15-
setMailerLiteConf,
16-
loading,
17-
setLoading
18-
}) {
13+
export default function MailerLiteActions({ mailerLiteConf, setMailerLiteConf, loading, setLoading }) {
1914
const [actionMdl, setActionMdl] = useState({ show: false, action: () => {} })
15+
2016
const actionHandler = (e, type) => {
2117
const newConf = { ...mailerLiteConf }
18+
2219
if (type === 'group') {
2320
getAllGroups(mailerLiteConf, setMailerLiteConf, loading, setLoading)
24-
if (e.target.checked) {
25-
newConf.actions.group = true
26-
} else {
27-
delete newConf.actions.group
28-
}
29-
setActionMdl({ show: type })
30-
}
31-
if (type === 'mailer_lite_type') {
32-
if (e.target.checked) {
33-
newConf.actions.mailer_lite_type = true
34-
} else {
35-
delete newConf.actions.mailer_lite_type
36-
}
37-
setActionMdl({ show: type })
3821
}
39-
if (type === 'update') {
40-
if (e.target.checked) {
41-
newConf.actions.update = true
42-
} else {
43-
delete newConf.actions.update
44-
}
45-
}
46-
if (type === 'double_opt_in') {
47-
if (e.target.checked) {
48-
newConf.actions.double_opt_in = true
49-
} else {
50-
delete newConf.actions.double_opt_in
51-
}
22+
23+
if (e.target.checked) {
24+
newConf.actions[type] = true
25+
} else {
26+
delete newConf.actions[type]
5227
}
5328

29+
setActionMdl({ show: type })
5430
setMailerLiteConf({ ...newConf })
5531
}
5632
const clsActionMdl = () => {
@@ -61,7 +37,6 @@ export default function MailerLiteActions({
6137
const newConf = { ...mailerLiteConf }
6238
if (type === 'group_ids' && val.length) {
6339
newConf.actions.group = true
64-
newConf.actions.update = true
6540
} else if (type === 'group_ids' && val.length < 1) {
6641
delete newConf.actions.group
6742
}
@@ -103,23 +78,23 @@ export default function MailerLiteActions({
10378
<div className="pos-rel d-flx w-8">
10479
<TableCheckBox
10580
checked={mailerLiteConf?.group_ids.length || false}
106-
onChange={(e) => actionHandler(e, 'group')}
81+
onChange={e => actionHandler(e, 'group')}
10782
className="wdt-200 mt-4 mr-2"
10883
value="group"
10984
title={__('Groups', 'bit-integrations')}
11085
subTitle={__('Add Groups', 'bit-integrations')}
11186
/>
11287
<TableCheckBox
11388
checked={mailerLiteConf?.mailer_lite_type || false}
114-
onChange={(e) => actionHandler(e, 'mailer_lite_type')}
89+
onChange={e => actionHandler(e, 'mailer_lite_type')}
11590
className="wdt-200 mt-4 mr-2"
11691
value="type"
11792
title={__('Type', 'bit-integrations')}
11893
subTitle={__('Add Type', 'bit-integrations')}
11994
/>
12095
<TableCheckBox
12196
checked={mailerLiteConf.actions?.double_opt_in || false}
122-
onChange={(e) => actionHandler(e, 'double_opt_in')}
97+
onChange={e => actionHandler(e, 'double_opt_in')}
12398
className="wdt-200 mt-4 mr-2"
12499
value="double_opt_in"
125100
title={__('Double Opt-in', 'bit-integrations')}
@@ -128,7 +103,7 @@ export default function MailerLiteActions({
128103
<TableCheckBox
129104
checked={mailerLiteConf.actions?.update || false}
130105
isInfo={mailerLiteConf?.group_ids.length}
131-
onChange={(e) => actionHandler(e, 'update')}
106+
onChange={e => actionHandler(e, 'update')}
132107
className="wdt-200 mt-4 mr-2"
133108
value="user_share"
134109
title={__('Update subscriber', 'bit-integrations')}
@@ -161,11 +136,11 @@ export default function MailerLiteActions({
161136
<MultiSelect
162137
className="msl-wrp-options"
163138
defaultValue={mailerLiteConf?.group_ids}
164-
options={mailerLiteConf?.groups?.map((group) => ({
139+
options={mailerLiteConf?.groups?.map(group => ({
165140
label: group.name,
166141
value: group.group_id
167142
}))}
168-
onChange={(val) => setChanges(val, 'group_ids')}
143+
onChange={val => setChanges(val, 'group_ids')}
169144
customValue
170145
/>
171146
<button
@@ -194,8 +169,8 @@ export default function MailerLiteActions({
194169
<MultiSelect
195170
className="msl-wrp-options"
196171
defaultValue={mailerLiteConf?.mailer_lite_type}
197-
options={mailerLiteTypes.map((type) => ({ label: type.label, value: type.value }))}
198-
onChange={(val) => setChanges(val, 'mailer_lite_type')}
172+
options={mailerLiteTypes.map(type => ({ label: type.label, value: type.value }))}
173+
onChange={val => setChanges(val, 'mailer_lite_type')}
199174
customValue
200175
singleSelect
201176
/>

frontend-dev/src/components/AllIntegrations/MailerLite/MailerLiteAuthorization.jsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable no-unused-expressions */
22
import { useState } from 'react'
33
import { __ } from '../../../Utils/i18nwrap'
4+
import tutorialLinks from '../../../Utils/StaticData/tutorialLinks'
45
import LoaderSm from '../../Loaders/LoaderSm'
56
import Note from '../../Utilities/Note'
6-
import { mailerliteRefreshFields } from './MailerLiteCommonFunc'
7-
import tutorialLinks from '../../../Utils/StaticData/tutorialLinks'
87
import TutorialLink from '../../Utilities/TutorialLink'
8+
import { authorization } from './MailerLiteCommonFunc'
99

1010
export default function MailerLiteAuthorization({
1111
mailerLiteConf,
@@ -17,7 +17,7 @@ export default function MailerLiteAuthorization({
1717
setSnackbar,
1818
isInfo
1919
}) {
20-
const [isAuthorized, setisAuthorized] = useState(false)
20+
const [isAuthorized, setIsAuthorized] = useState(false)
2121
const [error, setError] = useState({ name: '', auth_token: '' })
2222
const { mailerLite } = tutorialLinks
2323

@@ -34,14 +34,15 @@ export default function MailerLiteAuthorization({
3434
!mailerLiteConf?.default
3535
setstep(2)
3636
}
37-
const handleInput = (e) => {
37+
const handleInput = e => {
3838
const newConf = { ...mailerLiteConf }
3939
const rmError = { ...error }
4040
rmError[e.target.name] = ''
4141
newConf[e.target.name] = e.target.value
4242
setError(rmError)
4343
setMailerLiteConf(newConf)
4444
}
45+
4546
const note = `
4647
<h4>${__('Step of generate API token:', 'bit-integrations')}</h4>
4748
<ul>
@@ -135,17 +136,7 @@ export default function MailerLiteAuthorization({
135136
{!isInfo && (
136137
<div>
137138
<button
138-
onClick={() =>
139-
mailerliteRefreshFields(
140-
mailerLiteConf,
141-
setMailerLiteConf,
142-
setError,
143-
setisAuthorized,
144-
loading,
145-
setLoading,
146-
'authorization'
147-
)
148-
}
139+
onClick={() => authorization(mailerLiteConf, setIsAuthorized, loading, setLoading)}
149140
className="btn btcd-btn-lg purple sh-sm flx"
150141
type="button"
151142
disabled={

0 commit comments

Comments
 (0)