-
Couldn't load subscription status.
- Fork 1
Feat/fabman-action #116
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
base: main
Are you sure you want to change the base?
Feat/fabman-action #116
Conversation
This reverts commit e4b0bfc.
frontend-dev/src/components/AllIntegrations/Fabman/EditFabman.jsx
Outdated
Show resolved
Hide resolved
frontend-dev/src/components/AllIntegrations/Fabman/EditFabman.jsx
Outdated
Show resolved
Hide resolved
frontend-dev/src/components/AllIntegrations/Fabman/EditFabman.jsx
Outdated
Show resolved
Hide resolved
frontend-dev/src/components/AllIntegrations/Fabman/IntegrationHelpers.jsx
Outdated
Show resolved
Hide resolved
frontend-dev/src/components/AllIntegrations/Fabman/IntegrationHelpers.jsx
Outdated
Show resolved
Hide resolved
frontend-dev/src/components/AllIntegrations/Fabman/IntegrationHelpers.jsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new Fabman integration to the system, enabling users to manage members and spaces through the Fabman API.
- Introduces comprehensive Fabman API integration with authentication, workspace management, and CRUD operations for members and spaces
- Adds complete frontend UI components for configuration, field mapping, and workflow management
- Implements backend API routes and controllers for Fabman operations with proper error handling
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| includes/Actions/Fabman/Routes.php | Defines API routes for Fabman authorization and workspace fetching |
| includes/Actions/Fabman/RecordApiHelper.php | Core API helper class handling all Fabman API operations and data mapping |
| includes/Actions/Fabman/FabmanController.php | Main controller managing authentication, workspace fetching, and integration execution |
| frontend-dev/src/components/Flow/New/SelectAction.jsx | Adds Fabman to the list of available integrations |
| frontend-dev/src/components/AllIntegrations/NewInteg.jsx | Registers Fabman component for new integration flow |
| frontend-dev/src/components/AllIntegrations/IntegInfo.jsx | Adds Fabman authorization component to integration info |
| frontend-dev/src/components/AllIntegrations/Fabman/* | Complete frontend implementation including authorization, field mapping, and configuration components |
| frontend-dev/src/components/AllIntegrations/EditInteg.jsx | Adds Fabman to the edit integration flow |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| export const isConfigInvalid = (fabmanConf, formField) => { | ||
| if (!fabmanConf.actionName) return true | ||
|
|
||
| if (['update_member', 'delete_member'].includes(fabmanConf.actionName)) { | ||
| // isEmailMappingInvalid needs to be passed or imported | ||
| if (isEmailMappingInvalid(fabmanConf, formField)) return true |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function isEmailMappingInvalid is called but not imported or defined in this file. This will cause a runtime error.
| export const isConfigInvalid = (fabmanConf, formField) => { | |
| if (!fabmanConf.actionName) return true | |
| if (['update_member', 'delete_member'].includes(fabmanConf.actionName)) { | |
| // isEmailMappingInvalid needs to be passed or imported | |
| if (isEmailMappingInvalid(fabmanConf, formField)) return true | |
| export const isConfigInvalid = (fabmanConf, formFields, checkValidEmail) => { | |
| if (!fabmanConf.actionName) return true | |
| if (['update_member', 'delete_member'].includes(fabmanConf.actionName)) { | |
| // isEmailMappingInvalid needs to be passed or imported | |
| if (isEmailMappingInvalid(fabmanConf, formFields, checkValidEmail)) return true |
| const hasEmailType = selectedField.type && String(selectedField.type).toLowerCase() === 'email' | ||
| const looksLikeEmailField = | ||
| /email/i.test(selectedField.name || '') || /email/i.test(selectedField.label || '') | ||
| return !(hasEmailType || !selectedField.type || looksLikeEmailField) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use !hasEmailType || selectedField.type || !looksLikeEmailField
| logics: [{ field: '', logic: '', val: '' }, 'or', { field: '', logic: '', val: '' }] | ||
| }, | ||
| trigger_type: '', | ||
| pro_integ_v: '2.5.4', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this trigger_type & pro_integ_v property and its purpose?
| } | ||
|
|
||
| const nextPage = () => { | ||
| if (isConfigInvalid()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use early return on !isConfigInvalid()
| import { fabmanAuthentication } from './FabmanCommonFunc' | ||
| import Note from '../../Utilities/Note' | ||
| import tutorialLinks from '../../../Utils/StaticData/tutorialLinks' | ||
| import TutorialLink from '../../Utilities/TutorialLink' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add Fabeman documentation link to TutorialLink file
| setStep(2) | ||
| }, [setStep]) | ||
|
|
||
| const handleInput = useCallback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain why you using callback here
| if ($actionName === 'delete_member' || empty($memberId)) { | ||
| $email = self::getMappedValue($integrationDetails->field_map, 'emailAddress', $fieldValues); | ||
| if ($email) { | ||
| $memberData = self::fetchMemberByEmailInternal($apiKey, $email); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename fetchMemberByEmailInternal function
| $apiEndpoint = 'https://fabman.io/api/v1/members?q=' . urlencode($email); | ||
| $apiResponse = HttpHelper::get($apiEndpoint, null, $header); | ||
|
|
||
| if (is_wp_error($apiResponse) || empty($apiResponse) || isset($apiResponse->error) || !\is_array($apiResponse)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimize those conditions
|
|
||
| private $lockVersion; | ||
|
|
||
| public function __construct($apiKey, $workspaceId, $accountId, $integrationID = null, $memberId = null, $lockVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use required params at first, and the not required are last position
| $finalData['memberId'] = $this->memberId; | ||
| } | ||
|
|
||
| if (!empty($integrationDetails->field_map)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimize the generated field mappings data conditions
| foreach ($integrationDetails->field_map as $fieldMap) { | ||
| if (!empty($fieldMap->formField) && !empty($fieldMap->fabmanFormField)) { | ||
| $finalData[$fieldMap->fabmanFormField] = $fieldMap->formField === 'custom' | ||
| ? $fieldMap->customValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the Common::replaceFieldWithValue function for getting custom field variable data
No description provided.