Skip to content

Conversation

@Md-Abed-Hossen
Copy link
Contributor

No description provided.

@RishadAlam RishadAlam requested a review from Copilot October 7, 2025 06:25
Copy link

Copilot AI left a 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.

Comment on lines +129 to +134
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
Copy link

Copilot AI Oct 7, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
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)
Copy link
Member

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',
Copy link
Member

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()) {
Copy link
Member

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'
Copy link
Member

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(
Copy link
Member

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);
Copy link
Member

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)) {
Copy link
Member

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)
Copy link
Member

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)) {
Copy link
Member

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants