feat(integrations): add Bookly action integration with setup UI#165
feat(integrations): add Bookly action integration with setup UI#165RishadAlam wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new integration for Bookly, providing both backend logic and a frontend configuration interface. The backend includes a controller for managing staff, services, and statuses, along with an API helper to execute actions like creating or updating appointments and customers. The frontend implementation covers authorization, field mapping, and integration layout. Feedback provided focuses on ensuring that methods called statically in the routes are correctly declared as static in the controller and improving PHP 8 compatibility by validating potential WP_Error responses before accessing them as arrays.
| wp_send_json_success(true); | ||
| } | ||
|
|
||
| public function refreshStaff() |
There was a problem hiding this comment.
Fixed. Changed refreshStaff to static for consistency with other methods in this class.
public static function refreshStaff()Note: the router (Route::action()) uses ReflectionMethod::isStatic() to handle both static and instance methods, so this was not causing a runtime error — but making it static is correct since the method doesn't use $this.
| wp_send_json_success(['staff' => $staff], 200); | ||
| } | ||
|
|
||
| public function refreshServices() |
There was a problem hiding this comment.
Fixed. Changed refreshServices to static for consistency with other methods in this class.
public static function refreshServices()| wp_send_json_success(['services' => $services], 200); | ||
| } | ||
|
|
||
| public function refreshStatuses() |
There was a problem hiding this comment.
Fixed. Changed refreshStatuses to static for consistency with other methods in this class.
public static function refreshStatuses()| break; | ||
| } | ||
|
|
||
| $responseType = isset($response['success']) && $response['success'] ? 'success' : 'error'; |
There was a problem hiding this comment.
In PHP 8.0+, accessing an array offset on an object that does not implement ArrayAccess (like WP_Error) will throw a fatal error. Since Hooks::apply might return a WP_Error, you should validate the response using is_wp_error() before checking for the success key.
$responseType = !is_wp_error($response) && isset($response['success']) && $response['success'] ? 'success' : 'error';References
- In PHP, when handling responses that may return a WP_Error object, always use the is_wp_error() function to validate the response before accessing it as an array or object. This prevents fatal errors in PHP 8.0+.
There was a problem hiding this comment.
Fixed. Added is_wp_error() check before accessing $response as an array to prevent fatal errors in PHP 8.0+ if a filter callback returns a WP_Error.
$responseType = !is_wp_error($response) && isset($response['success']) && $response['success'] ? 'success' : 'error';
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
…dling in RecordApiHelper
Description
This PR adds a new Bookly action integration to Bit Integrations with end-to-end backend and frontend support. Users can now configure Bookly actions in the flow builder, map trigger fields, and use dynamic/staff/service/status data during setup.
Motivation & Context
Bookly users need a native action connector so they can automate appointment and customer management workflows directly from Bit Integrations. This closes that gap by introducing Bookly action configuration, authorization checks, and execution routing.
Related Links: (if applicable)
Type of Change
Key Changes
Backend (Bookly Action Engine)
Frontend (Integration Setup UI)
Assets
Checklist
Changelog