feat(integrations): add B2BKing action integration#164
Conversation
There was a problem hiding this comment.
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.
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
There was a problem hiding this comment.
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
setSnackbaris declared as a prop but never used in this component. With the repo’s ESLint config (includesno-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.
…andling, and UI improvements
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
Key Changes
Backend
B2BKingControllerauthorization, existence checks, action execution, and group refresh endpoint handling.RecordApiHelperexecution logic for:LogHandler.B2BKingaction availability.Frontend
Checklist
Changelog