feat(booking-calendar): add free integration shell - #193
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new integration for the Booking Calendar plugin, adding backend controllers, helpers, and routes, alongside frontend components for authorization, action mapping, and configuration editing. The review feedback highlights two important improvements: preventing a potential undefined array key warning in BookingCalendarController.php when $formFields is empty, and adding a .catch block to the asynchronous authorization request in BookingCalendarAuthorization.jsx to ensure robust error handling and proper resetting of loading states.
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.
| if (!empty($formFields[0]['value'])) { | ||
| $label .= ' - ' . $formFields[0]['value']; | ||
| } |
There was a problem hiding this comment.
If $formFields is empty, attempting to access $formFields[0]['value'] will trigger an undefined array key warning in PHP 8.0+. Verify that $formFields is not empty before accessing its elements.
if (!empty($formFields) && !empty($formFields[0]['value'])) {
$label .= ' - ' . $formFields[0]['value'];
}There was a problem hiding this comment.
Implemented. The booking label now checks that parsed form fields are non-empty before reading the first value.
| const authorizeHandler = () => { | ||
| setIsLoading('auth') | ||
| bitsFetch({}, 'booking_calendar_authorize').then(result => { | ||
| if (result?.success) { | ||
| setIsAuthorized(true) | ||
| setSnackbar?.({ | ||
| show: true, | ||
| msg: __('Connected with Booking Calendar Successfully', 'bit-integrations') | ||
| }) | ||
| } | ||
| setIsLoading(false) | ||
| setShowAuthMsg(true) | ||
| }) | ||
| } |
There was a problem hiding this comment.
When handling asynchronous API requests, always append a .catch block to ensure that loading states are reset and error messages are displayed if the request fails or encounters a network error.
| const authorizeHandler = () => { | |
| setIsLoading('auth') | |
| bitsFetch({}, 'booking_calendar_authorize').then(result => { | |
| if (result?.success) { | |
| setIsAuthorized(true) | |
| setSnackbar?.({ | |
| show: true, | |
| msg: __('Connected with Booking Calendar Successfully', 'bit-integrations') | |
| }) | |
| } | |
| setIsLoading(false) | |
| setShowAuthMsg(true) | |
| }) | |
| } | |
| const authorizeHandler = () => { | |
| setIsLoading('auth') | |
| bitsFetch({}, 'booking_calendar_authorize') | |
| .then(result => { | |
| if (result?.success) { | |
| setIsAuthorized(true) | |
| setSnackbar?.({ | |
| show: true, | |
| msg: __('Connected with Booking Calendar Successfully', 'bit-integrations') | |
| }) | |
| } | |
| setIsLoading(false) | |
| setShowAuthMsg(true) | |
| }) | |
| .catch(() => { | |
| setIsLoading(false) | |
| setShowAuthMsg(true) | |
| }) | |
| } |
References
- When handling asynchronous API requests, always append a
.catchblock to ensure that loading states are reset and error messages are displayed if the request fails or encounters a network error.
There was a problem hiding this comment.
Implemented. Authorization now has a catch handler and a finally block so loading/message state is reset on request failure as well.
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
36 |
WordPress.DB.PreparedSQL.InterpolatedNotPrepared | Use placeholders and $wpdb->prepare(); found interpolated variable {$table} at "SELECT booking_id, form FROM {$table} ORDER BY booking_id DESC LIMIT 500" |
119 |
WordPress.DB.PreparedSQL.InterpolatedNotPrepared | Use placeholders and $wpdb->prepare(); found interpolated variable {$table} at "SELECT * FROM {$table} ORDER BY title ASC, booking_type_id ASC" |
📁 readme.txt (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "Bit integrations - Form Integration, Webhook, Spreadsheets, CRM, LMS & Email Automation" is different from the name declared in plugin header "Bit Integrations". |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
…G with WEBP format
Description
Adds the Booking Calendar integration shell to Bit Integrations Free, including setup UI, registration, logo, and backend dispatch routes. It also adds booking/resource refresh endpoints and keeps boolean options in the Utilities section.
Motivation & Context
This lets users configure Booking Calendar create/update booking actions from the Free UI while keeping actual execution Pro-only. Fetchable IDs are handled with dropdowns instead of field mapping.
Related Links: (if applicable)
Type of Change
Key Changes
Integration
Frontend
Backend
Checklist
Changelog