Skip to content

feat(integrations): add B2BKing action integration#164

Merged
RishadAlam merged 2 commits into
mainfrom
feat/b2bking
May 23, 2026
Merged

feat(integrations): add B2BKing action integration#164
RishadAlam merged 2 commits into
mainfrom
feat/b2bking

Conversation

@RishadAlam

Copy link
Copy Markdown
Member

Description

This PR adds a new B2BKing action integration in Bit Integrations, including backend execution and frontend configuration flows. Users can now approve customers, enable B2B for users, and update customer groups through mapped form data.

Motivation & Context

This change enables automation workflows to manage B2BKing user state directly from Bit Integrations actions. It reduces manual account/group management work for stores using B2BKing.

Related Links: (if applicable)

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • ⚡ Improvement
  • 🔄 Code refactor

Key Changes

Backend

  • Added B2BKingController authorization, existence checks, action execution, and group refresh endpoint handling.
  • Added RecordApiHelper execution logic for:
    • approving customers
    • enabling B2B for users
    • updating customer groups
  • Added field-map based payload generation with support for custom values.
  • Added integration action logging through LogHandler.
  • Added B2BKing routes for authorization and group refresh.
  • Updated integration registry to include B2BKing action availability.

Frontend

  • Added full B2BKing integration UI set:
    • integration setup
    • authorization
    • field mapping
    • edit flow
    • common utility functions
    • static action/field data
  • Added dynamic action-based field mapping behavior for all supported B2BKing actions.
  • Added group selection and group refresh UI for customer group updates.
  • Updated action selectors and integration loaders to register and render B2BKing.
  • Added B2BKing integration icon asset.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Tests added/updated
  • Documentation updated if needed
  • README updated if needed

Changelog

    • Feature: Added a new B2BKing action integration to automate customer approval, B2B enablement, and group updates from workflow data.
    • New Actions: Added B2BKing actions for approving customers, enabling B2B users, and updating customer group assignments.
    • Improvement: Added a dedicated group refresh and selection flow to keep B2BKing customer group mapping accurate during integration setup.

Copilot AI review requested due to automatic review settings May 16, 2026 10:24

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new integration for B2BKing, including backend controllers, API helpers, and a comprehensive frontend UI for configuration and field mapping. Key feedback includes fixing potential PHP warnings by ensuring $utilities is an object and validating the return value of get_user_by. Additionally, it is recommended to declare refreshGroups as a static method to match its usage, validate user emails before processing actions, and improve the robustness of the frontend MultiSelect component when handling group data.

Comment thread backend/Actions/B2BKing/B2BKingController.php Outdated
Comment thread backend/Core/Util/User.php
Comment thread backend/Actions/B2BKing/B2BKingController.php Outdated
Comment thread backend/Actions/B2BKing/RecordApiHelper.php
Comment thread frontend/src/components/AllIntegrations/B2BKing/B2BKingIntegLayout.jsx Outdated
@github-actions

github-actions Bot commented May 16, 2026

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

Copilot AI left a comment

Copy link
Copy Markdown

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 introduces a new B2BKing action integration to Bit Integrations, adding backend endpoints/execution plumbing and a frontend configuration + field-mapping flow so users can automate B2BKing customer approval, B2B enablement, and customer group updates.

Changes:

  • Added B2BKing integration to frontend action selection, new/edit integration renderers, and integration info authorization rendering.
  • Implemented new frontend B2BKing setup UI (authorization, action selection, group refresh/select, field mapping, edit flow).
  • Added backend B2BKing action routes/controller + execution helper, plus a utility user lookup helper.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
frontend/src/components/Flow/New/SelectAction.jsx Registers B2BKing as an available action integration type in the action picker.
frontend/src/components/AllIntegrations/NewInteg.jsx Lazy-loads and renders the new B2BKing integration setup flow.
frontend/src/components/AllIntegrations/IntegInfo.jsx Adds B2BKing authorization/info view rendering in the Integration Info screen.
frontend/src/components/AllIntegrations/EditInteg.jsx Hooks up edit-screen rendering for existing B2BKing integrations.
frontend/src/components/AllIntegrations/B2BKing/staticData.js Defines supported B2BKing actions and required fields.
frontend/src/components/AllIntegrations/B2BKing/B2BKing.jsx Implements the 3-step “new integration” UI flow for B2BKing.
frontend/src/components/AllIntegrations/B2BKing/B2BKingAuthorization.jsx Implements “authorization” / plugin-existence check UI for B2BKing.
frontend/src/components/AllIntegrations/B2BKing/B2BKingIntegLayout.jsx Implements action selection, group selection/refresh, and field map rendering.
frontend/src/components/AllIntegrations/B2BKing/B2BKingFieldMap.jsx Implements individual field-mapping row UI including custom values and smart tags.
frontend/src/components/AllIntegrations/B2BKing/B2BKingCommonFunc.js Shared UI helpers: input handling, group refresh, mapping validation, required-map generation.
frontend/src/components/AllIntegrations/B2BKing/EditB2BKing.jsx Implements the edit-integration configuration screen for B2BKing.
backend/Actions/B2BKing/Routes.php Registers AJAX routes for B2BKing authorize + group refresh.
backend/Actions/B2BKing/B2BKingController.php Adds existence checks, group refresh endpoint, and action execution entrypoint.
backend/Actions/B2BKing/RecordApiHelper.php Implements action execution + mapped payload generation + logging for B2BKing actions.
backend/Core/Util/User.php Adds getUserByField() helper for user lookup.
backend/Core/Util/AllTriggersName.php Adds a B2BKing entry to the “Pro triggers list” (currently appears mismatched).
Comments suppressed due to low confidence (1)

frontend/src/components/AllIntegrations/B2BKing/B2BKingIntegLayout.jsx:25

  • setSnackbar is declared as a prop but never used in this component. With the repo’s ESLint config (includes no-unused-vars), this will be flagged. Remove the unused prop or use it for feedback messaging.
export default function B2BKingIntegLayout({
  formFields,
  b2bKingConf,
  setB2BKingConf,
  isLoading,
  setIsLoading,
  setSnackbar
}) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/Core/Util/User.php
Comment thread backend/Core/Util/AllTriggersName.php
Comment thread backend/Actions/B2BKing/RecordApiHelper.php
Comment thread backend/Actions/B2BKing/B2BKingController.php Outdated
Comment thread frontend/src/components/AllIntegrations/B2BKing/EditB2BKing.jsx Outdated
Comment thread frontend/src/components/AllIntegrations/B2BKing/B2BKingAuthorization.jsx Outdated
Comment thread frontend/src/components/AllIntegrations/B2BKing/B2BKingFieldMap.jsx Outdated
Comment thread frontend/src/components/AllIntegrations/IntegInfo.jsx
@RishadAlam RishadAlam merged commit 649aca0 into main May 23, 2026
1 check passed
@RishadAlam RishadAlam deleted the feat/b2bking branch May 23, 2026 06:14
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.

3 participants