=== SCP Dynamics ESI Bridge ===
Contributors: scprojectsgr
Tags: cache, performance, forms, booking
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.3.41
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Keep supported JetFormBuilder booking forms live through LiteSpeed ESI while the parent page remains cached.

== Description ==

SCP Dynamics ESI Bridge helps performance-focused WordPress sites keep dynamic JetFormBuilder forms working inside cached pages.

It is built for workflows that use JetFormBuilder forms with LiteSpeed Cache ESI, Bricks Builder pages, and booking or appointment fields that need fresh availability, valid nonces, live calculated totals, and native AJAX submissions.

Main features:

* LiteSpeed ESI shortcode for JetFormBuilder forms.
* Bricks Builder element with form selection and style controls.
* Server-rendered accessible names for JetFormBuilder checkbox and radio fields.
* Always-fresh ESI mode for booking forms while the parent page stays cacheable.
* JetBooking datepicker and calculated-price compatibility for ESI-rendered forms.
* Optional no-cache handling for booking availability AJAX/REST requests.
* Optional frontend behavior controls for user info, messages, mobile terms layout, and diagnostics.
* Admin page with discovered JetFormBuilder forms and copy-ready shortcodes.

== Source Code ==

All custom PHP, JavaScript, and CSS distributed with this plugin is included in human-readable form. The plugin does not use a build process and does not bundle third-party libraries. The files in `assets/js/` are the directly maintained source files loaded by WordPress.

This plugin is not affiliated with, endorsed by, or sponsored by Crocoblock, Bricks Builder, or LiteSpeed Technologies. Product names are used only to describe compatibility.

== Requirements ==

Required:

* WordPress 6.0 or newer.
* PHP 7.4 or newer.
* JetFormBuilder.

Optional but recommended:

* LiteSpeed Cache with ESI support enabled for dynamic ESI fragments.

Supported integrations:

* Bricks Builder for the custom element and visual styling controls.
* JetBooking for booking availability, check-in/check-out fields, and advanced price calculated fields.
* JetAppointments for appointment-oriented JetFormBuilder workflows.

The plugin avoids fatal errors when optional integrations are missing. If LiteSpeed Cache is not active, forms use direct rendering instead of ESI.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install the ZIP from Plugins > Add New > Upload Plugin.
2. Activate `SCP Dynamics ESI Bridge`.
3. For ESI caching, make sure LiteSpeed Cache ESI is enabled. Without LiteSpeed, the plugin falls back to direct rendering.
4. Go to Settings > SCP Dynamics ESI.
5. Copy a generated shortcode, or add the `SCP ESI JetForm` element inside Bricks.

Recommended booking setup:

* Submit type: AJAX.
* Cache type: Private.
* ESI mode: Always fresh / no-cache.
* Asset loading mode: Enqueue only.
* Booking AJAX bypass: ON.
* Debug log: OFF after troubleshooting.

== Frequently Asked Questions ==

= Does this disable the LiteSpeed cache for the whole page? =

No. The goal is to keep the parent page cacheable while the form fragment stays dynamic through LiteSpeed ESI.

= Why should booking forms use Always fresh / no-cache? =

Booking availability and calculated prices can change after each reservation. Always fresh mode keeps the ESI form fragment current without forcing no-cache on the parent page.

= Can I use this without Bricks Builder? =

Yes. You can use the shortcode `[scp_jetform_esi form_id="123"]`. The Bricks element is optional.

= Can I use Public cache for forms? =

Only for fully static forms. Private cache is recommended for forms with nonces, booking fields, availability, appointment data, or user-specific output.

= Does this replace JetFormBuilder, JetBooking, or LiteSpeed Cache? =

No. It bridges their frontend behavior for cached pages and ESI fragments.

= How does the language option work? =

The admin screen can follow the WordPress site language automatically, or you can force English or Greek from the plugin settings.

== Screenshots ==

1. Plugin settings, integration status, recommended production configuration, and discovered JetFormBuilder forms.
2. Bricks Builder element controls for form selection, ESI cache, asset loading, and frontend behavior.
3. Accessible field labels for checkbox and radio options configured directly in the Bricks element.
4. SCP Dynamics ESI Form available in the Bricks Builder element picker.
5. SCP Dynamics ESI Form placed inside the Bricks Builder structure panel.

== Changelog ==

= 0.3.41 =
* Prevented the restored native checkbox from overriding a hidden mobile form wrapper outside the popup.

= 0.3.40 =
* Prevented duplicate JetBooking calendars when an initialized ESI form is moved into a mobile popup.
* Made picker detection resilient when JetBooking does not expose its instance through jQuery data.
* Prevented duplicate parent-owned jQuery, wp-hooks, and wp-i18n scripts inside ESI output.
* Added server-rendered checkbox/radio accessible labels to the Bricks element.
* Isolated accessibility mappings through the ESI configuration and cache identity.
* Removed the optimizer compatibility guide and promoted JetFormBuilder Forms into the main admin layout.
* Preserved synchronous ESI dependency order for wp-hooks, wp-i18n, JetFormBuilder checkbox, and calculated-field scripts without duplicate parent copies.
* Preserved Bricks accessibility labels through the complete ESI encode/decode round-trip.

= 0.3.39 =
* Made all custom JavaScript and CSS assets human-readable and documented the source layout.
* Escaped shortcode and ESI-rendered form markup with a JetFormBuilder-specific HTML allowlist.
* Enabled LiteSpeed's preserved ESI mode so security filtering cannot remove the ESI include.
* Applied WordPress Coding Standards formatting and completed a plugin-wide prefix audit.

= 0.3.38 =
* Preserved the configured JetFormBuilder WooCommerce Price Field through JetBooking checkout recalculation.
* Rejected submitted calculated totals below JetBooking's server-calculated base price.

= 0.3.37 =
* Moved admin page styling and copy helper script to properly enqueued assets for WordPress.org compliance.
* Removed WordPress.org directory assets from the plugin package.

= 0.3.36 =
* Removed UTF-8 byte order marks and normalized line endings in PHP files flagged by Plugin Check.
* Replaced admin utility request inspection with filter_input() helpers to avoid nonce warnings for read-only context detection.

= 0.3.35 =
* Scoped Bricks element registration away from WordPress admin utility screens such as Plugin Check and Site Health.
* Reduced admin-side runtime footprint to avoid interfering with JSON-based admin tools.

= 0.3.34 =
* Prevented SCP Dynamics ESI Bridge frontend compatibility hooks from running during WordPress admin AJAX requests.
* Tightened JetBooking availability bypass detection so Plugin Check and other admin tools receive clean JSON responses.

= 0.3.33 =
* Hardened admin isolation so frontend optimization markers are not attached on normal WordPress admin pages.
* Tightened plugin dashboard CSS scoping.

= 0.3.32 =
* Scoped all frontend form CSS to the plugin wrapper to prevent WordPress admin UI leakage.
* Scoped optional frontend inline CSS to the plugin wrapper.
* Prevented critical optimization markers from being added to normal admin page assets.

= 0.3.31 =
* Cleaned readme metadata for WordPress.org validation.
* Kept optional integrations optional so clean installs can activate and run Plugin Check.
* Rebuilt the distribution ZIP without a hard Requires Plugins dependency header.

= 0.3.30 =
* Improved official WordPress i18n coverage for admin and Bricks UI strings.
* Replaced a writable-directory check with safer filesystem handling for Plugin Check compatibility.
* Sanitized booking availability request probing without reading unsanitized raw request data.
* Cleaned up admin status output and Bricks placeholder escaping.

= 0.3.29 =
* Added nonce verification to the frontend debug AJAX endpoint.
* Moved debug logs to a non-predictable protected filename and stopped showing full server paths in the admin UI.
* Reduced logged request data to the request path only, without query strings.
* Sanitized booking availability request detection instead of scanning the full raw request payload.
* Kept Perfmatters diagnostic URLs on the real ESI render path for more accurate compatibility testing.

= 0.3.28 =
* Kept JetBooking datepicker initialization owned by the ESI bootstrap only.
* Prevented duplicate picker popups after date selection.
* Improved picker instance detection across both JetBooking wrapper and date input nodes.
* Avoided full JetPlugins re-init when the ESI form block is already initialized.

= 0.3.27 =
* Removed forced full JetPlugins re-init from the calculated bridge.
* Kept the native advanced price fallback that updates the visible total and hidden calculated value.

= 0.3.26 =
* Fixed the JetBooking advanced price macro scope so calculated fields can see the ESI form date field.
* Forced one scoped calculated-field re-init after the booking macro filters are registered.
* Added a native JetBooking price fallback that updates both the visible total and hidden calculated value.

== Upgrade Notice ==

= 0.3.41 =
Keeps the restored native checkbox hidden with its mobile form wrapper until the form is moved into the popup.

= 0.3.40 =
Prevents duplicate booking calendars and ESI core dependencies, and adds server-rendered accessible field labels.

= 0.3.39 =
WordPress.org review hardening for readable source, escaped form output, preserved LiteSpeed ESI, and coding standards.

= 0.3.38 =
Keeps valid JetFormBuilder calculated totals, including optional extras, in JetBooking WooCommerce checkout.

= 0.3.37 =
Admin asset loading cleanup for WordPress.org compliance.

= 0.3.36 =
* Removed UTF-8 byte order marks and normalized line endings in PHP files flagged by Plugin Check.
* Replaced admin utility request inspection with filter_input() helpers to avoid nonce warnings for read-only context detection.

= 0.3.35 =
Admin utility isolation update that keeps Bricks element registration out of Plugin Check and Site Health requests.

= 0.3.34 =
Admin AJAX isolation update that prevents frontend booking/optimizer compatibility hooks from affecting Plugin Check responses.

= 0.3.33 =
Admin-isolation update that prevents frontend asset compatibility markers from touching normal WordPress admin screens.

= 0.3.32 =
Admin-isolation update that prevents frontend form styles from affecting WordPress admin screens.

= 0.3.31 =
Readme and distribution metadata cleanup for WordPress.org submission checks.

= 0.3.30 =
Release-readiness update with improved translation coverage and Plugin Check compatibility fixes.

= 0.3.29 =
Recommended security and release-readiness update for public distribution.
