Skip to content

feat(integrations): add Sensei LMS action integration#188

Open
RishadAlam wants to merge 5 commits into
mainfrom
feat/senseilms
Open

feat(integrations): add Sensei LMS action integration#188
RishadAlam wants to merge 5 commits into
mainfrom
feat/senseilms

Conversation

@RishadAlam

Copy link
Copy Markdown
Member

Description

Adds Sensei LMS as an action integration in the free plugin: a 3-step UI (authorize → configure → save) exposing 12 write actions whose logic runs in the Pro add-on via bit_integrations_sensei_lms_* hooks.

Motivation & Context

Sensei LMS could already be used as a trigger but not as an action target. This lets flows drive Sensei — enrol learners, drive course/lesson/quiz progress, and create courses/lessons/certificates — from any trigger.

Type of Change

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

Key Changes

Integrations — Sensei LMS (action)

  • Added 12 write actions: enrol/withdraw user, start/complete/reset course, start/update/reset lesson, grade quiz, create course/lesson/certificate (all Pro).
  • Added course/lesson/quiz pickers as fetched dropdowns, and the fixed-choice fields (post status, mark complete, grade type, lesson status) as Utilities dropdowns — the field map carries only free-form inputs.

Backend

  • Added Actions/SenseiLMS/ — Controller (authorize + course/lesson/quiz refresh endpoints), RecordApiHelper (per-action switch dispatch to the Pro hooks), Routes.

Frontend

  • Added the Sensei LMS React UI (authorization, action select with Pro gating, resource + Utilities dropdowns, field map, create + edit wizards) and registered it in NewInteg, EditInteg, IntegInfo, and SelectAction.
  • Reformatted frontend files with Prettier.

Checklist

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

Changelog

  • New Integration: Sensei LMS as an action — 12 actions (enrol/withdraw, start/complete/reset course & lesson, grade quiz, create course/lesson/certificate)

Add the Sensei LMS action integration (Free side): controller with plugin
authorize check and course/lesson/quiz refresh endpoints, RecordApiHelper that
dispatches each of the 12 write actions to the Pro plugin via
bit_integrations_sensei_lms_* hooks, routes, and the React UI (authorization,
action select, course/lesson/quiz dropdowns, field map, wizard + edit). Register
the integration in NewInteg, EditInteg, IntegInfo and SelectAction.
…ispatch

Move the fixed-choice fields (post status, mark complete, grade type, lesson
status) out of the field map into Utilities dropdowns stored on the config
(selectedStatus / selectedMarkComplete / selectedGradeType /
selectedLessonStatus), so the field map carries only free-form inputs.

Replace the action-map lookup in RecordApiHelper::execute with an explicit
switch-case per action, matching the FluentCart convention.
The Sensei action filters never use the utilities argument, so stop passing it
through Hooks::apply — each filter now receives only the default response, the
field data and the integration details.

@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 Sensei LMS, adding backend helpers, controllers, and routes alongside frontend components for authorization, configuration, and field mapping. The feedback suggests adding error handling to the authorization API request, rebuilding non-persisted configuration fields on mount when editing the integration, and explicitly declaring several PHP methods as static since they do not access instance state.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread frontend/src/components/AllIntegrations/SenseiLMS/SenseiLMSAuthorization.jsx Outdated
Comment thread frontend/src/components/AllIntegrations/SenseiLMS/EditSenseiLMS.jsx Outdated
Comment thread frontend/src/components/AllIntegrations/SenseiLMS/EditSenseiLMS.jsx
Comment thread backend/Actions/SenseiLMS/SenseiLMSController.php Outdated
Comment thread backend/Actions/SenseiLMS/SenseiLMSController.php Outdated
Comment thread backend/Actions/SenseiLMS/SenseiLMSController.php Outdated
Comment thread backend/Actions/SenseiLMS/RecordApiHelper.php Outdated
@github-actions

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

…lbacks

EditSenseiLMS now rebuilds the non-persisted senseiLMSFields from the saved
action and repopulates the course/lesson/quiz dropdowns on mount, leaving the
saved field_map untouched. Add a .catch to the authorize request so the loading
state resets and an error is shown on failure. Declare the refresh* route
callbacks and generateReqDataFromFieldMap static to match how they are invoked.
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.

1 participant