diff --git a/backend/Actions/MainWP/MainWPController.php b/backend/Actions/MainWP/MainWPController.php new file mode 100644 index 000000000..066080ecf --- /dev/null +++ b/backend/Actions/MainWP/MainWPController.php @@ -0,0 +1,60 @@ +get_sites(); + $sites = []; + + if (!empty($websites)) { + foreach ($websites as $website) { + $website = (array) $website; + if (empty($website['id'])) { + continue; + } + $sites[] = [ + 'value' => (string) $website['id'], + 'label' => ($website['name'] ?? 'Site') . ' (' . ($website['url'] ?? '') . ')', + ]; + } + } + + wp_send_json_success(['sites' => $sites], 200); + } + + public function execute($integrationData, $fieldValues) + { + $integrationDetails = $integrationData->flow_details; + $integId = $integrationData->id; + $fieldMap = $integrationDetails->field_map; + + $RecordApiHelper = new RecordApiHelper($integrationDetails, $integId); + + return $RecordApiHelper->execute($fieldValues, $fieldMap); + } +} diff --git a/backend/Actions/MainWP/RecordApiHelper.php b/backend/Actions/MainWP/RecordApiHelper.php new file mode 100644 index 000000000..ca44333e2 --- /dev/null +++ b/backend/Actions/MainWP/RecordApiHelper.php @@ -0,0 +1,151 @@ +_integrationDetails = $integrationDetails; + $this->_integrationID = $integId; + } + + public function execute($fieldValues, $fieldMap) + { + if (!class_exists('\MainWP\Dashboard\MainWP_DB')) { + return [ + 'success' => false, + 'message' => __('MainWP Dashboard is not installed or activated', 'bit-integrations'), + ]; + } + + if (empty($this->_integrationDetails)) { + return [ + 'success' => false, + 'message' => __('Integration details are missing', 'bit-integrations'), + ]; + } + + $fieldData = static::generateReqDataFromFieldMap($fieldMap, $fieldValues); + $mainAction = $this->_integrationDetails->mainAction ?? 'sync_site'; + + if (!empty($this->_integrationDetails->selectedSite)) { + $fieldData['site_id'] = (int) $this->_integrationDetails->selectedSite; + } + + if (in_array($mainAction, ['create_post', 'update_post'], true)) { + $utils = (array) ($this->_integrationDetails->utilities ?? []); + if (!empty($utils['post_type'])) { + $fieldData['post_type'] = sanitize_text_field($utils['post_type']); + } + if (!empty($utils['post_status'])) { + $fieldData['post_status'] = sanitize_text_field($utils['post_status']); + } + } + + $defaultResponse = [ + 'success' => false, + 'message' => wp_sprintf(__('%s plugin is not installed or activated', 'bit-integrations'), 'Bit Integrations Pro'), + ]; + + switch ($mainAction) { + case 'sync_site': + $response = Hooks::apply(Config::withPrefix('main_wp_sync_site'), $defaultResponse, $fieldData); + $actionType = 'sync_site'; + + break; + + case 'sync_all_sites': + $response = Hooks::apply(Config::withPrefix('main_wp_sync_all_sites'), $defaultResponse); + $actionType = 'sync_all_sites'; + + break; + + case 'create_post': + $response = Hooks::apply(Config::withPrefix('main_wp_create_post'), $defaultResponse, $fieldData); + $actionType = 'create_post'; + + break; + + case 'update_post': + $response = Hooks::apply(Config::withPrefix('main_wp_update_post'), $defaultResponse, $fieldData); + $actionType = 'update_post'; + + break; + + case 'delete_post': + $response = Hooks::apply(Config::withPrefix('main_wp_delete_post'), $defaultResponse, $fieldData); + $actionType = 'delete_post'; + + break; + + case 'activate_plugin': + $response = Hooks::apply(Config::withPrefix('main_wp_activate_plugin'), $defaultResponse, $fieldData); + $actionType = 'activate_plugin'; + + break; + + case 'deactivate_plugin': + $response = Hooks::apply(Config::withPrefix('main_wp_deactivate_plugin'), $defaultResponse, $fieldData); + $actionType = 'deactivate_plugin'; + + break; + + case 'create_user': + $response = Hooks::apply(Config::withPrefix('main_wp_create_user'), $defaultResponse, $fieldData); + $actionType = 'create_user'; + + break; + + default: + $response = ['success' => false, 'message' => __('Invalid action', 'bit-integrations')]; + $actionType = 'unknown'; + + break; + } + + if (is_wp_error($response)) { + $response = [ + 'success' => false, + 'message' => $response->get_error_message(), + ]; + } + + $responseType = isset($response['success']) && $response['success'] ? 'success' : 'error'; + LogHandler::save($this->_integrationID, ['type' => 'MainWP', 'type_name' => $actionType], $responseType, $response); + + return $response; + } + + private static function generateReqDataFromFieldMap($fieldMap, $fieldValues): array + { + $data = []; + foreach ($fieldMap as $item) { + $triggerValue = $item->formField; + $actionValue = $item->mainWPField; + + if (empty($actionValue) || (empty($triggerValue) && $triggerValue !== 'custom')) { + continue; + } + + $data[$actionValue] = $triggerValue === 'custom' && isset($item->customValue) + ? Common::replaceFieldWithValue($item->customValue, $fieldValues) + : $fieldValues[$triggerValue] ?? ''; + } + + return $data; + } +} diff --git a/backend/Actions/MainWP/Routes.php b/backend/Actions/MainWP/Routes.php new file mode 100644 index 000000000..bdead431e --- /dev/null +++ b/backend/Actions/MainWP/Routes.php @@ -0,0 +1,11 @@ + ['name' => 'MailPoet', 'isPro' => true, 'is_active' => false], 'MailMint' => ['name' => 'Mail Mint', 'isPro' => true, 'is_active' => false], 'Mailster' => ['name' => 'Mailster', 'isPro' => true, 'is_active' => false], + 'MainWP' => ['name' => 'MainWP', 'isPro' => true, 'is_active' => false], 'MasterStudyLms' => ['name' => 'MasterStudyLms', 'isPro' => true, 'is_active' => false], 'MasteriyoLMS' => ['name' => 'Masteriyo LMS', 'isPro' => true, 'is_active' => false], 'MyCred' => ['name' => 'myCred', 'isPro' => true, 'is_active' => false], diff --git a/frontend/src/Utils/StaticData/webhookIntegrations.js b/frontend/src/Utils/StaticData/webhookIntegrations.js index cc893d017..8c23fe4a7 100644 --- a/frontend/src/Utils/StaticData/webhookIntegrations.js +++ b/frontend/src/Utils/StaticData/webhookIntegrations.js @@ -19,7 +19,6 @@ export const customFormIntegrations = [ 'PopupMaker', 'DiviFormBuilder', 'Bricks', - 'Bricksforge', 'Brizy', 'GutenaForms', 'PieForms', @@ -100,9 +99,16 @@ export const customFormIntegrations = [ 'Registration', 'Post', 'WordPress', - 'FluentPdfGenerator', 'BookingPress', - 'FluentPdfGenerator' + "FluentPdfGenerator", + "B2BKing", + "FormyChat", + "MainWP", + "SureDash", + "WpErp", + "WpDataTables", + "GiveWp", + "SenseiLMS" ] export const actionHookIntegrations = ['ActionHook'] diff --git a/frontend/src/components/AllIntegrations/EditInteg.jsx b/frontend/src/components/AllIntegrations/EditInteg.jsx index cdde72975..995763b19 100644 --- a/frontend/src/components/AllIntegrations/EditInteg.jsx +++ b/frontend/src/components/AllIntegrations/EditInteg.jsx @@ -161,6 +161,7 @@ const EditNewsletter = lazy(() => import('./Newsletter/EditNewsletter')) const EditSureDash = lazy(() => import('./SureDash/EditSureDash')) const EditSureMembers = lazy(() => import('./SureMembers/EditSureMembers')) const EditMailster = lazy(() => import('./Mailster/EditMailster')) +const EditMainWP = lazy(() => import('./MainWP/EditMainWP')) const EditWPForo = lazy(() => import('./WPForo/EditWPForo')) const EditDokan = lazy(() => import('./Dokan/EditDokan')) const EditJetEngine = lazy(() => import('./JetEngine/EditJetEngine')) @@ -587,6 +588,8 @@ const IntegType = memo(({ allIntegURL, flow }) => { return case 'Mailster': return + case 'MainWP': + return case 'WPForo': return case 'Dokan': diff --git a/frontend/src/components/AllIntegrations/IntegInfo.jsx b/frontend/src/components/AllIntegrations/IntegInfo.jsx index 2a7f15131..9624114c9 100644 --- a/frontend/src/components/AllIntegrations/IntegInfo.jsx +++ b/frontend/src/components/AllIntegrations/IntegInfo.jsx @@ -159,6 +159,7 @@ const NewsletterAuthorization = lazy(() => import('./Newsletter/NewsletterAuthor const SureDashAuthorization = lazy(() => import('./SureDash/SureDashAuthorization')) const SureMembersAuthorization = lazy(() => import('./SureMembers/SureMembersAuthorization')) const MailsterAuthentication = lazy(() => import('./Mailster/MailsterAuthorization')) +const MainWPAuthorization = lazy(() => import('./MainWP/MainWPAuthorization')) const WPForoAuthorization = lazy(() => import('./WPForo/WPForoAuthorization')) const DokanAuthorization = lazy(() => import('./Dokan/DokanAuthorization')) const JetEngineAuthorization = lazy(() => import('./JetEngine/JetEngineAuthorization')) @@ -626,6 +627,8 @@ export default function IntegInfo() { return case 'Mailster': return + case 'MainWP': + return case 'WPForo': return case 'Dokan': diff --git a/frontend/src/components/AllIntegrations/MainWP/EditMainWP.jsx b/frontend/src/components/AllIntegrations/MainWP/EditMainWP.jsx new file mode 100644 index 000000000..dcddc794c --- /dev/null +++ b/frontend/src/components/AllIntegrations/MainWP/EditMainWP.jsx @@ -0,0 +1,76 @@ +import { useState } from 'react' +import { useNavigate, useParams } from 'react-router' +import { useRecoilState, useRecoilValue } from 'recoil' +import { $actionConf, $formFields, $newFlow } from '../../../GlobalStates' +import { __ } from '../../../Utils/i18nwrap' +import SnackMsg from '../../Utilities/SnackMsg' +import { saveActionConf } from '../IntegrationHelpers/IntegrationHelpers' +import IntegrationStepThree from '../IntegrationHelpers/IntegrationStepThree' +import SetEditIntegComponents from '../IntegrationHelpers/SetEditIntegComponents' +import { checkMappedFields, handleInput } from './MainWPCommonFunc' +import MainWPIntegLayout from './MainWPIntegLayout' + +export default function EditMainWP({ allIntegURL }) { + const navigate = useNavigate() + const { id, formID } = useParams() + + const [mainWPConf, setMainWPConf] = useRecoilState($actionConf) + const [flow, setFlow] = useRecoilState($newFlow) + const formFields = useRecoilValue($formFields) + const [isLoading, setIsLoading] = useState(false) + const [snack, setSnackbar] = useState({ show: false }) + + return ( +
+ + +
+ {__('Integration Name:', 'bit-integrations')} + handleInput(e, mainWPConf, setMainWPConf)} + name="name" + value={mainWPConf.name} + type="text" + placeholder={__('Integration Name...', 'bit-integrations')} + /> +
+
+ + + + + + + saveActionConf({ + flow, + setFlow, + allIntegURL, + conf: mainWPConf, + navigate, + id, + edit: 1, + setIsLoading, + setSnackbar + }) + } + disabled={!checkMappedFields(mainWPConf)} + isLoading={isLoading} + dataConf={mainWPConf} + setDataConf={setMainWPConf} + formFields={formFields} + /> +
+
+ ) +} diff --git a/frontend/src/components/AllIntegrations/MainWP/MainWP.jsx b/frontend/src/components/AllIntegrations/MainWP/MainWP.jsx new file mode 100644 index 000000000..93830854c --- /dev/null +++ b/frontend/src/components/AllIntegrations/MainWP/MainWP.jsx @@ -0,0 +1,110 @@ +import { useState } from 'react' +import 'react-multiple-select-dropdown-lite/dist/index.css' +import { useNavigate, useParams } from 'react-router' +import BackIcn from '../../../Icons/BackIcn' +import { __ } from '../../../Utils/i18nwrap' +import SnackMsg from '../../Utilities/SnackMsg' +import { saveIntegConfig } from '../IntegrationHelpers/IntegrationHelpers' +import IntegrationStepThree from '../IntegrationHelpers/IntegrationStepThree' +import MainWPAuthorization from './MainWPAuthorization' +import { checkMappedFields } from './MainWPCommonFunc' +import MainWPIntegLayout from './MainWPIntegLayout' + +export default function MainWP({ formFields, setFlow, flow, allIntegURL }) { + const navigate = useNavigate() + const { formID } = useParams() + const [isLoading, setIsLoading] = useState(false) + const [step, setStep] = useState(1) + const [snack, setSnackbar] = useState({ show: false }) + const [mainWPConf, setMainWPConf] = useState({ + name: 'MainWP', + type: 'MainWP', + field_map: [], + actions: {}, + mainAction: '', + mainWPFields: [], + selectedSite: '', + allSites: [], + utilities: {} + }) + + const nextPage = val => { + setTimeout(() => { + document.getElementById('btcd-settings-wrp').scrollTop = 0 + }, 300) + + if (val === 3) { + if (!checkMappedFields(mainWPConf)) { + setSnackbar({ + show: true, + msg: __('Please map all required fields to continue.', 'bit-integrations') + }) + return + } + + if (mainWPConf.name !== '') { + setStep(val) + } + } else { + setStep(val) + } + } + + return ( +
+ +
+ + {/* STEP 1 */} + + + {/* STEP 2 */} +
+ +
+
+
+ +
+ + {/* STEP 3 */} + + saveIntegConfig(flow, setFlow, allIntegURL, mainWPConf, navigate, '', '', setIsLoading) + } + isLoading={isLoading} + /> +
+ ) +} diff --git a/frontend/src/components/AllIntegrations/MainWP/MainWPAuthorization.jsx b/frontend/src/components/AllIntegrations/MainWP/MainWPAuthorization.jsx new file mode 100644 index 000000000..ef9bb09ff --- /dev/null +++ b/frontend/src/components/AllIntegrations/MainWP/MainWPAuthorization.jsx @@ -0,0 +1,110 @@ +import { useState } from 'react' +import BackIcn from '../../../Icons/BackIcn' +import bitsFetch from '../../../Utils/bitsFetch' +import { __ } from '../../../Utils/i18nwrap' +import LoaderSm from '../../Loaders/LoaderSm' +import { handleInput } from './MainWPCommonFunc' + +export default function MainWPAuthorization({ + formID, + mainWPConf, + setMainWPConf, + step, + nextPage, + isLoading, + setIsLoading, + setSnackbar +}) { + const [isAuthorized, setIsAuthorized] = useState(false) + const [showAuthMsg, setShowAuthMsg] = useState(false) + + const authorizeHandler = () => { + setIsLoading('auth') + bitsFetch({}, 'main_wp_authorize') + .then(result => { + if (result?.success) { + setIsAuthorized(true) + setSnackbar({ + show: true, + msg: __('Connected with MainWP Dashboard Successfully', 'bit-integrations') + }) + } + setIsLoading(false) + setShowAuthMsg(true) + }) + .catch(() => { + setIsLoading(false) + setShowAuthMsg(true) + }) + } + + return ( +
+
+ {__('Integration Name:', 'bit-integrations')} +
+ handleInput(e, mainWPConf, setMainWPConf)} + name="name" + value={mainWPConf.name} + type="text" + placeholder={__('Integration Name...', 'bit-integrations')} + /> + + {isLoading === 'auth' && ( +
+ + {__('Checking if MainWP Dashboard is active...', 'bit-integrations')} +
+ )} + + {showAuthMsg && !isAuthorized && !isLoading && ( +
+
+
+ +
+
+ {__('MainWP Dashboard is not activated or not installed', 'bit-integrations')} +
+
+
+ )} + + {showAuthMsg && isAuthorized && !isLoading && ( +
+
+ +
+
{__('MainWP Dashboard is activated', 'bit-integrations')}
+
+ )} + + +
+ +
+ ) +} diff --git a/frontend/src/components/AllIntegrations/MainWP/MainWPCommonFunc.js b/frontend/src/components/AllIntegrations/MainWP/MainWPCommonFunc.js new file mode 100644 index 000000000..27bd1ae4b --- /dev/null +++ b/frontend/src/components/AllIntegrations/MainWP/MainWPCommonFunc.js @@ -0,0 +1,59 @@ +import { create } from 'mutative' +import toast from 'react-hot-toast' +import bitsFetch from '../../../Utils/bitsFetch' +import { __ } from '../../../Utils/i18nwrap' + +export const handleInput = (e, mainWPConf, setMainWPConf) => { + const { name, value } = e.target + + setMainWPConf(prevConf => + create(prevConf, draftConf => { + draftConf[name] = value + }) + ) +} + +export const checkMappedFields = conf => { + if (!conf?.mainAction) return false + + if (conf.mainAction !== 'sync_all_sites' && !conf?.selectedSite) return false + + if (conf.mainAction === 'create_post' && !conf?.utilities?.post_type) return false + + const requiredFields = conf?.mainWPFields?.filter(f => f.required) || [] + + if (!requiredFields.length) return true + + return requiredFields.every((_, i) => { + const mapItem = conf?.field_map?.[i] + return mapItem?.formField && mapItem?.mainWPField + }) +} + +export const generateMappedField = fields => { + if (!fields?.length) return [] + const required = fields.filter(f => f.required) + const hasOptional = fields.some(f => !f.required) + const map = required.map(f => ({ formField: '', mainWPField: f.key })) + if (hasOptional) map.push({ formField: '', mainWPField: '' }) + return map +} + +export const refreshMainWPSites = (setMainWPConf, setIsLoading) => { + setIsLoading('sites') + bitsFetch(null, 'refresh_main_wp_sites') + .then(result => { + if (result?.success && result?.data?.sites) { + setMainWPConf(prevConf => + create(prevConf, draftConf => { + draftConf.allSites = result.data.sites + }) + ) + toast.success(__('Sites fetched successfully', 'bit-integrations')) + } else { + toast.error(__('Failed to fetch sites. Please try again.', 'bit-integrations')) + } + setIsLoading(false) + }) + .catch(() => setIsLoading(false)) +} diff --git a/frontend/src/components/AllIntegrations/MainWP/MainWPFieldMap.jsx b/frontend/src/components/AllIntegrations/MainWP/MainWPFieldMap.jsx new file mode 100644 index 000000000..a442cf492 --- /dev/null +++ b/frontend/src/components/AllIntegrations/MainWP/MainWPFieldMap.jsx @@ -0,0 +1,104 @@ +import { useRecoilValue } from 'recoil' +import { $appConfigState } from '../../../GlobalStates' +import { __, sprintf } from '../../../Utils/i18nwrap' +import { SmartTagField } from '../../../Utils/StaticData/SmartTagField' +import TagifyInput from '../../Utilities/TagifyInput' +import { + addFieldMap, + delFieldMap, + handleCustomValue, + handleFieldMapping +} from '../GlobalIntegrationHelper' + +export default function MainWPFieldMap({ i, formFields, field, mainWPConf, setMainWPConf }) { + const btcbi = useRecoilValue($appConfigState) + const { isPro } = btcbi + + const requiredFlds = mainWPConf?.mainWPFields?.filter(fld => fld.required === true) || [] + const nonRequiredFlds = mainWPConf?.mainWPFields?.filter(fld => fld.required === false) || [] + + return ( +
+
+
+ + + {field.formField === 'custom' && ( + handleCustomValue(e, i, mainWPConf, setMainWPConf)} + label={__('Custom Value', 'bit-integrations')} + className="mr-2" + type="text" + value={field.customValue} + placeholder={__('Custom Value', 'bit-integrations')} + formFields={formFields} + /> + )} + + +
+
+ + {i >= requiredFlds.length && ( + <> + + + + )} +
+ ) +} diff --git a/frontend/src/components/AllIntegrations/MainWP/MainWPIntegLayout.jsx b/frontend/src/components/AllIntegrations/MainWP/MainWPIntegLayout.jsx new file mode 100644 index 000000000..5991b3cce --- /dev/null +++ b/frontend/src/components/AllIntegrations/MainWP/MainWPIntegLayout.jsx @@ -0,0 +1,218 @@ +import { create } from 'mutative' +import MultiSelect from 'react-multiple-select-dropdown-lite' +import { useRecoilValue } from 'recoil' +import { $appConfigState } from '../../../GlobalStates' +import { __ } from '../../../Utils/i18nwrap' +import { checkIsPro, getProLabel } from '../../Utilities/ProUtilHelpers' +import { addFieldMap } from '../IntegrationHelpers/IntegrationHelpers' +import { + CreatePostFields, + CreateUserFields, + DeletePostFields, + modules, + PluginActionFields, + postStatusOptions, + postTypeOptions, + SyncAllSitesFields, + SyncSiteFields, + UpdatePostFields +} from './staticData' +import { generateMappedField, refreshMainWPSites } from './MainWPCommonFunc' +import MainWPFieldMap from './MainWPFieldMap' + +export default function MainWPIntegLayout({ + formID, + formFields, + mainWPConf, + setMainWPConf, + setSnackbar, + isLoading, + setIsLoading +}) { + const btcbi = useRecoilValue($appConfigState) + const { isPro } = btcbi + + const setUtility = (key, val) => + setMainWPConf(prev => + create(prev, draft => { + draft.utilities = { ...(draft.utilities || {}), [key]: val } + }) + ) + + const handleMainAction = value => { + setMainWPConf(prevConf => + create(prevConf, draftConf => { + draftConf.mainAction = value + draftConf.selectedSite = '' + draftConf.utilities = {} + + switch (value) { + case 'sync_site': + draftConf.mainWPFields = SyncSiteFields + break + case 'sync_all_sites': + draftConf.mainWPFields = SyncAllSitesFields + break + case 'create_post': + draftConf.mainWPFields = CreatePostFields + break + case 'update_post': + draftConf.mainWPFields = UpdatePostFields + break + case 'delete_post': + draftConf.mainWPFields = DeletePostFields + break + case 'activate_plugin': + case 'deactivate_plugin': + draftConf.mainWPFields = PluginActionFields + break + case 'create_user': + draftConf.mainWPFields = CreateUserFields + break + default: + draftConf.mainWPFields = [] + } + + draftConf.field_map = generateMappedField(draftConf.mainWPFields) + }) + ) + } + + const needsSite = mainWPConf?.mainAction && mainWPConf.mainAction !== 'sync_all_sites' + + return ( + <> +
+
+ {__('Action:', 'bit-integrations')} + handleMainAction(value)} + options={modules?.map(action => ({ + label: checkIsPro(isPro, action.is_pro) ? action.label : getProLabel(action.label), + value: action.name, + disabled: !checkIsPro(isPro, action.is_pro) + }))} + singleSelect + closeOnSelect + /> +
+ + {needsSite && ( + <> +
+
+ {__('Site:', 'bit-integrations')} + ({ + label: site.label, + value: site.value + })) || [] + } + onChange={val => + setMainWPConf(prevConf => + create(prevConf, draftConf => { + draftConf.selectedSite = val + }) + ) + } + singleSelect + closeOnSelect + /> + +
+ + )} + + {mainWPConf?.mainAction === 'create_post' && ( + <> +
+
+ {__('Post Type:', 'bit-integrations')} + +
+ + )} + + {['create_post', 'update_post'].includes(mainWPConf?.mainAction) && ( + <> +
+
+ {__('Post Status:', 'bit-integrations')} + +
+ + )} + + {mainWPConf?.mainAction && mainWPConf?.mainWPFields?.length > 0 && ( +
+ {__('Map Fields', 'bit-integrations')} +
+
+
+ {__('Form Fields', 'bit-integrations')} +
+
+ {__('MainWP Fields', 'bit-integrations')} +
+
+ + {mainWPConf?.field_map?.map((field, i) => ( + + ))} + +
+ +
+
+
+
+ )} + + ) +} diff --git a/frontend/src/components/AllIntegrations/MainWP/staticData.js b/frontend/src/components/AllIntegrations/MainWP/staticData.js new file mode 100644 index 000000000..0a10b6937 --- /dev/null +++ b/frontend/src/components/AllIntegrations/MainWP/staticData.js @@ -0,0 +1,61 @@ +import { __ } from '../../../Utils/i18nwrap' + +export const modules = [ + { name: 'sync_site', label: __('Sync Site', 'bit-integrations'), is_pro: true }, + { name: 'sync_all_sites', label: __('Sync All Sites', 'bit-integrations'), is_pro: true }, + { name: 'create_post', label: __('Create Post', 'bit-integrations'), is_pro: true }, + { name: 'update_post', label: __('Update Post', 'bit-integrations'), is_pro: true }, + { name: 'delete_post', label: __('Delete Post', 'bit-integrations'), is_pro: true }, + { name: 'activate_plugin', label: __('Activate Plugin', 'bit-integrations'), is_pro: true }, + { name: 'deactivate_plugin', label: __('Deactivate Plugin', 'bit-integrations'), is_pro: true }, + { name: 'create_user', label: __('Create User', 'bit-integrations'), is_pro: true } +] + +export const SyncSiteFields = [] + +export const SyncAllSitesFields = [] + +export const postTypeOptions = [ + { label: __('Post', 'bit-integrations'), value: 'post' }, + { label: __('Page', 'bit-integrations'), value: 'page' } +] + +export const postStatusOptions = [ + { label: __('Publish', 'bit-integrations'), value: 'publish' }, + { label: __('Draft', 'bit-integrations'), value: 'draft' }, + { label: __('Pending', 'bit-integrations'), value: 'pending' }, + { label: __('Private', 'bit-integrations'), value: 'private' } +] + +export const CreatePostFields = [ + { key: 'post_title', label: __('Post Title', 'bit-integrations'), required: true }, + { key: 'post_content', label: __('Post Content', 'bit-integrations'), required: false }, + { key: 'post_excerpt', label: __('Post Excerpt', 'bit-integrations'), required: false }, + { key: 'post_author', label: __('Post Author ID', 'bit-integrations'), required: false }, + { key: 'post_date', label: __('Post Date', 'bit-integrations'), required: false }, + { key: 'comment_status', label: __('Comment Status', 'bit-integrations'), required: false } +] + +export const UpdatePostFields = [ + { key: 'post_id', label: __('Post ID', 'bit-integrations'), required: true }, + { key: 'post_title', label: __('Post Title', 'bit-integrations'), required: false }, + { key: 'post_content', label: __('Post Content', 'bit-integrations'), required: false }, + { key: 'post_excerpt', label: __('Post Excerpt', 'bit-integrations'), required: false } +] + +export const DeletePostFields = [ + { key: 'post_id', label: __('Post ID', 'bit-integrations'), required: true } +] + +export const PluginActionFields = [ + { key: 'plugin_slug', label: __('Plugin Slug', 'bit-integrations'), required: true } +] + +export const CreateUserFields = [ + { key: 'user_login', label: __('Username', 'bit-integrations'), required: true }, + { key: 'user_email', label: __('User Email', 'bit-integrations'), required: true }, + { key: 'user_pass', label: __('Password', 'bit-integrations'), required: false }, + { key: 'first_name', label: __('First Name', 'bit-integrations'), required: false }, + { key: 'last_name', label: __('Last Name', 'bit-integrations'), required: false }, + { key: 'role', label: __('User Role', 'bit-integrations'), required: false } +] diff --git a/frontend/src/components/AllIntegrations/NewInteg.jsx b/frontend/src/components/AllIntegrations/NewInteg.jsx index b6d931852..f11913e2c 100644 --- a/frontend/src/components/AllIntegrations/NewInteg.jsx +++ b/frontend/src/components/AllIntegrations/NewInteg.jsx @@ -160,6 +160,7 @@ const Newsletter = lazy(() => import('./Newsletter/Newsletter')) const SureDash = lazy(() => import('./SureDash/SureDash')) const SureMembers = lazy(() => import('./SureMembers/SureMembers')) const Mailster = lazy(() => import('./Mailster/Mailster')) +const MainWP = lazy(() => import('./MainWP/MainWP')) const WPForo = lazy(() => import('./WPForo/WPForo')) const Dokan = lazy(() => import('./Dokan/Dokan')) const JetEngine = lazy(() => import('./JetEngine/JetEngine')) @@ -1585,6 +1586,15 @@ export default function NewInteg({ allIntegURL }) { setFlow={setFlow} /> ) + case 'MainWP': + return ( + + ) case 'WPForo': return (