=== CampSuite Booking ===
Contributors: campsuite
Tags: booking, availability, campsite, reservations, holiday park
Requires at least: 6.3
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.4.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show live availability from your CampSuite account on your own WordPress site and let guests book in seconds on your secure CampSuite portal.

== Description ==

**CampSuite Booking** brings your real-time availability straight onto your WordPress pages. Guests choose their dates, party size and what they're bringing, see exactly what's available with live pricing, then tap **Book** to finish securely on your CampSuite booking portal - with everything they chose already filled in.

Sensitive details such as payment are only ever entered on your CampSuite portal, so this plugin keeps your site simple and out of scope for payment handling.

= Why you'll love it =

* **60-second setup.** Paste your CampSuite API key, hit *Test connection*, and the plugin automatically pulls in your park name, logo and brand colour.
* **Beautiful by default.** A warm, modern, mobile-first widget that matches the CampSuite look and tints itself to your brand colour - or your theme's.
* **Ten blocks + shortcodes.** Availability search (with a new full-width *Hero* layout), a featured-units grid, a swipeable **photo gallery** with lightbox, a live **price-list** table, an **extras & add-ons** showcase, a privacy-first **map**, a **park-info** card, a **sticky booking bar**, a "from £X / night" badge and a Book button - every one a block *and* a shortcode for any page builder.
* **Gorgeous result cards.** Photo carousels, a tap-to-open lightbox, "Only 1 left" urgency badges and a clear total for the stay make availability genuinely tempting.
* **Secure handoff.** Browsing happens on your site; payment and personal details happen only on your CampSuite portal.
* **Fast & kind.** Availability is cached briefly and served through your own site, so your API key is never exposed to visitors.
* **Lightweight & privacy-first.** Fonts, styles and scripts are all bundled (no CDNs) and the map only loads when a visitor taps it. The plugin adds no analytics or third-party trackers - the only external content is your own park's photos and logo, loaded from CampSuite (see *External services* below).

= How it works =

1. The plugin talks to the CampSuite API **server-side** using your API key.
2. For data, the browser only calls your own site (`/wp-json/campsuite/v1/…`), so your API key stays private. (Your park's photos and logo are loaded directly from CampSuite - see *External services*.)
3. When a guest taps **Book** on a result, they're sent to `your-portal/your-park/availability` with the dates, guests, unit type **and the exact pitch or lodge they tapped** pre-selected - so they land right on it.

== External services ==

This plugin is a companion to CampSuite and connects to the external services below. It does not contact any of them until you connect a CampSuite account (and, for the map, not until a visitor taps to load it).

= CampSuite booking platform =

CampSuite (https://www.campsuite.net) is the booking platform this plugin shows availability from and hands bookings off to. A CampSuite account and API key are required for the plugin to display anything.

What is sent, and when:

* Your site makes server-to-server requests to the CampSuite API (https://api.campsuite.net) authenticated with your API key. This happens when an administrator clicks **Test connection**, and when a page containing a CampSuite block or shortcode is viewed - to load your park profile and, when a visitor runs an availability search, the filters they chose (arrival and departure dates, the number of adults, children and dogs, and the unit / stay type). Your API key is stored on your server and is never sent to the visitor's browser.
* When a page shows CampSuite images - your park logo and unit photos - the visitor's browser loads those images directly from CampSuite's servers (the image URLs are returned by the API). As with loading any remote image, this sends the visitor's IP address and browser user-agent to CampSuite; no other personal data is sent.
* When a visitor taps **Book**, their browser is sent to your CampSuite booking portal (https://bookings.campsuite.net) with the chosen dates, party size and unit pre-filled in the link. Payment and personal details are only ever entered on the CampSuite portal, never on your WordPress site.
* If you switch on dev / sandbox mode for testing, the equivalent test endpoints (https://dev.api.campsuite.net and https://dev.bookings.campsuite.net) are used instead.

CampSuite terms of service: https://www.campsuite.net/terms.htm
CampSuite privacy policy: https://www.campsuite.net/privacy.htm

= OpenStreetMap =

The optional Map block / `[campsuite_map]` shortcode uses OpenStreetMap (https://www.openstreetmap.org) to show your park's location and offer directions. Nothing loads from OpenStreetMap until a visitor explicitly taps to load the map (privacy-first); at that point their browser requests an embedded map of your park's coordinates from openstreetmap.org, and the "Get directions" link opens openstreetmap.org. The plugin sends no personal data. If you don't use the Map block, no requests are made to OpenStreetMap.

OpenStreetMap Foundation terms of use: https://osmfoundation.org/wiki/Terms_of_Use
OpenStreetMap Foundation privacy policy: https://osmfoundation.org/wiki/Privacy_Policy

== Installation ==

1. Upload the plugin to `/wp-content/plugins/campsuite-booking`, or install it from the Plugins screen.
2. Activate it.
3. Go to **Settings → CampSuite Booking** and paste your API key (find it in CampSuite under Settings → API keys).
4. Click **Test connection** - you should see "Connected to {your park}".
5. Add the **CampSuite Booking** block to a page, or use the `[campsuite_booking]` shortcode.

== Frequently Asked Questions ==

= Where do guests pay? =
On your secure CampSuite booking portal. This plugin only displays availability and hands the booking off - it never collects payment or personal details.

= Is my API key safe? =
Yes. The key is stored on your server and used only for server-to-server calls. It is never sent to the browser.

= Can I use it with Elementor / Divi / the classic editor? =
Yes - every block has a matching shortcode:

* `[campsuite_booking layout="inline|compact|hero" heading="…"]` - availability search + live results.
* `[campsuite_featured kind="all|pitch|accommodation|space" count="3" heading="…"]` - a merchandising grid of units.
* `[campsuite_gallery kind="all|pitch|accommodation|space" count="12" columns="3" heading="…"]` - a photo wall with lightbox.
* `[campsuite_pricelist kind="all|pitch|accommodation|space" heading="…"]` - a live tariff table.
* `[campsuite_extras count="8" heading="…"]` - a showcase of bookable add-ons.
* `[campsuite_map height="320" heading="…"]` - a privacy-first location map + directions.
* `[campsuite_info heading="…"]` - an address / contact / check-in card.
* `[campsuite_sticky_bar text="…" label="Check availability"]` - a floating booking bar.
* `[campsuite_price kind="all|pitch|accommodation|space"]` - a live "from £X / night" badge.
* `[campsuite_book_button label="Book now" kind="pitch|accommodation|space"]` - a CTA button.

= Does it match my brand? =
By default it uses your park's brand colour from CampSuite. You can override it with any colour on the settings screen.

== Screenshots ==

1. The booking search and live availability results on a published page.
2. The one-screen settings page with connection status.
3. The CampSuite Booking block in the editor.

= Developer-friendly =

A small, documented SDK (`window.CampSuiteBooking`), WordPress filters/actions, and full developer documentation make it easy to extend, theme and integrate.

== Changelog ==

= 1.4.3 =
* Code-quality pass to satisfy WordPress Plugin Check: escape the park-info card fields and skeleton placeholders at output, remove the no-longer-needed load_plugin_textdomain() call (WordPress loads translations automatically), and annotate the uninstall transient cleanup. No functional changes.

= 1.4.2 =
* Housekeeping: the Plugin URI and Author URI headers are now distinct - campsuite.net is kept as the Author URI and no longer duplicated as the Plugin URI.

= 1.4.1 =
* Hardening and housekeeping for the WordPress.org listing: the accent colour is now always validated as a hex value before it is used, image URLs are safely escaped for CSS, one remaining results-summary string is now translatable, and the External services / privacy notes have been clarified to reflect that your park's images load directly from CampSuite.

= 1.4.0 =
* **A proper date-range picker.** The two native date fields are replaced by a self-contained two-month calendar with range selection, hover preview, month navigation and a live nights count - matching the booking-portal look, with no dependencies and still no build step.
* **Accommodation is a first-class choice.** A new "Type of stay" selector (Camping & touring · Glamping & lodges · Spaces) shows whatever your park offers, filters results and pre-selects on the portal. The "what are you bringing?" vehicle field hides itself for accommodation.
* **Themeable design tokens.** The whole widget is scoped under `.csb-root` and driven by CSS custom properties (`--csb-accent`, `--csb-radius`, `--csb-font`, …), so developers can re-tint or restyle it from their own theme or **Appearance → Additional CSS** - no plugin files to edit.
* **Optional "Powered by CampSuite" backlink.** A small, tasteful credit link back to campsuite.net on the search and featured widgets - **off by default**; tick the box in settings to opt in.

= 1.3.0 =
* **A far sexier widget.** Result and featured cards now have swipeable photo carousels, a tap-to-open lightbox quick-view (photos, description and add-ons), "Only 1 left" urgency badges and a clear total for the whole stay - not just a nightly rate.
* **Six new blocks & shortcodes**, each designed for a great-looking camping site:
    * **Photo Gallery** (`[campsuite_gallery]`) - a masonry photo wall of your pitches, lodges and spaces with a full-screen lightbox.
    * **Price List** (`[campsuite_pricelist]`) - a live tariff table with a Book button on every row.
    * **Extras** (`[campsuite_extras]`) - showcase your add-ons (hot tubs, breakfast, firewood…) with icons and prices.
    * **Map** (`[campsuite_map]`) - a privacy-first location map that only loads when a visitor taps it, plus one-tap directions.
    * **Park Info** (`[campsuite_info]`) - a tidy address / contact / check-in-out card with at-a-glance badges.
    * **Sticky Bar** (`[campsuite_sticky_bar]`) - a floating "Check availability" bar that slides up as visitors scroll.
* **New Hero layout** for the booking search - a full-width, on-brand banner with the search front and centre.
* **Uses the photos you've already uploaded.** Every captioned image on a pitch, lodge or space now appears in the carousels, lightbox and gallery automatically.
* Still no third-party trackers or CDNs and no build step - the code and fonts are bundled and ship as authored (your park's images load from CampSuite).

= 1.2.1 =
* **Fix: "Test connection" now checks the key you just typed.** Previously it only verified the *saved* key, so pasting a key and clicking Test connection before saving wrongly reported "CampSuite is not connected yet." It now tests exactly what's on screen (production or dev key, honouring the dev toggle).
* **Fix: connecting on the very first save.** The first time you saved a valid key the park details weren't cached, so the site could stay "not connected" until you saved or tested again. The key is now verified as it's saved.

= 1.2.0 =
* **Dev / sandbox environment switch.** Test against CampSuite's dev environment without typing URLs: tick *Use the CampSuite dev / sandbox environment* under Advanced, define `CAMPSUITE_BOOKING_DEV` in `wp-config.php`, or add `?campsuite_dev=1` to a wp-admin URL to switch just your own browser (so live visitors keep seeing production). `?campsuite_dev=0` switches back.
* **Separate dev API key.** Store a `cs_test_…` key alongside your live key and flip between environments without re-pasting. Dev and production each keep their own cached park, so park name, slug and brand colour stay correct per environment.
* **New developer hooks.** `campsuite_booking_is_dev`, `campsuite_booking_api_base` and `campsuite_booking_portal_base` filters for full control over environment selection and endpoints.

= 1.1.0 =
* **Specific pitch/type pre-selection.** Tapping a result now opens that exact pitch type, lodge type or space on the portal - not just the broad category.
* **Bundled fonts.** DM Sans & Fraunces are now bundled as woff2 and served from your own site; the Google Fonts CDN dependency is gone. No third-party fonts or trackers.
* **Developer SDK & hooks.** New `window.CampSuiteBooking` JS SDK (build deep links, intercept the `campsuite:book` event), PHP filters (`campsuite_booking_portal_args`, `campsuite_booking_client_config`, `campsuite_booking_api_request_args`, `campsuite_booking_cache_ttl`) and a `campsuite_booking_connected` action, plus full developer documentation.
* The Book button block/shortcode gained an optional `type` for deep-linking to one specific unit.

= 1.0.0 =
* Initial release: availability search, featured-units grid, price badge and Book button (each a block + shortcode), server-side API proxy, and a secure pre-filled handoff to the CampSuite portal.

== Upgrade Notice ==

= 1.4.3 =
Plugin Check code-quality fixes; no functional changes.

= 1.4.2 =
Minor plugin-header housekeeping.

= 1.4.1 =
Security hardening and clearer external-services documentation.

= 1.4.0 =
A self-contained two-month date-range picker, a new "Type of stay" accommodation selector, themeable design tokens, and an optional (off-by-default) "Powered by CampSuite" backlink.

= 1.3.0 =
A major glow-up: photo carousels and a lightbox on every card, plus six new blocks/shortcodes - photo gallery, price list, extras, map, park info and a sticky booking bar - and a new full-width Hero search layout.

= 1.2.1 =
Fixes "Test connection" so it verifies the key you've just typed, and makes a valid key connect on the first save.

= 1.2.0 =
Test against the CampSuite dev/sandbox environment with one click, a wp-config constant, or a ?campsuite_dev=1 link - with a separate dev API key so you can flip back and forth safely.

= 1.1.0 =
Sharper handoff (lands on the exact pitch tapped), a fully offline footprint (bundled fonts, no CDN), and a new developer SDK + hooks.

= 1.0.0 =
First release of CampSuite Booking.
