=== Holdstyring Class Booking Widgets ===
Contributors: nahbo
Tags: booking, class schedule, yoga, fitness, scheduling
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show your schedule, prices, instructors and booking from your Class Booking studio on your WordPress site. Connect once with your API key.

== Description ==

Class Booking lets your yoga, pilates or fitness studio show live booking content directly on your WordPress site. Connect once with your API key, then use the "Class Booking" block or a shortcode to embed your schedule, prices, instructors, class types, reviews, contact form and more.

Features:

* **Connect once** — paste your API key under Settings → Class Booking and click "Connect and check". The plugin confirms which studio you are connected to.
* **One-click domain request** — if your WordPress domain is missing from the key's allowed domains, the plugin sends it to your studio for approval with one click. The studio approves it under Widgets → API keys, and the widgets work as soon as it is approved.
* **The loader cannot be stripped** — the script is enqueued automatically in the footer, so page builders do not remove it (the most common manual-setup mistake).
* **Native Gutenberg block** with a live preview in the editor.
* **Shortcode** for the classic editor and page builders: `[class_booking type="schedule"]`.
* **Follows your brand** — widgets inherit your colors, and `theme-mode="auto"` follows the visitor's light or dark mode.

Booking, login and payment all happen inside the widget.

**Requires a Class Booking account.** This plugin is a client for the Class Booking (Holdstyring) booking service. Without an account and an API key, most widgets cannot load any data.

== External services ==

This plugin connects to Class Booking / Holdstyring to display your studio's live booking data. The connection is required for the plugin to work at all.

What is sent, and when:

* **The widget loader** (`https://widgets.holdstyring.dk/v1/holdstyring-widgets.min.js`) is loaded on the pages where you use a widget, so the widgets can render in the visitor's browser.
* **On "Connect and check"** the plugin sends your API key and your WordPress domain to your studio address (`/api/widget/connect`) to confirm the connection. Nothing is stored beyond what you enter yourself.
* **On "Send the domain for approval"** the plugin sends your WordPress domain to `/api/widget/allow-origin`. The domain then waits for the studio's approval in its Class Booking admin; only an approved domain can display the widgets.
* **When a visitor views a widget**, the widget fetches public studio content (schedule, prices and so on) from your studio address.

This service is provided by Nahbo ApS (Class Booking / Holdstyring).
Terms of service: https://class-booking.com/terms
Privacy policy: https://class-booking.com/privacy

== Installation ==

1. Install and activate the plugin.
2. Go to Settings → Class Booking, paste your API key and base URL (both are found under Widgets in your Class Booking admin), and click "Connect and check".
3. Add the "Class Booking" block to a page, or use the shortcode `[class_booking type="schedule"]`.

== Frequently Asked Questions ==

= Where do I find my API key? =

Under Widgets in your Class Booking / Holdstyring admin. Create a key and copy the full key.

= Do I have to add my domain myself? =

No. Click "Connect and check"; if the domain is missing, click "Send the domain for approval". The studio then approves it under Widgets → API keys in its Class Booking admin. You can also add the domain there yourself.

= Does it work with page builders (Elementor, Divi)? =

Yes. The plugin enqueues the loader in the footer itself, so it is not stripped. Insert the block or the shortcode where the widget should appear.

= Does the plugin cost anything? =

No. The plugin is free. Most widgets need data from a Class Booking account (API key), so real-world use requires an active studio.

== Screenshots ==

1. The settings page: connect with your API key and check that the domain is approved.
2. The Class Booking block in the editor with a live preview.
3. A schedule rendered on a page.

== Changelog ==

= 0.1.0 =
* First release: settings page, loader enqueue, shortcode and server-rendered Gutenberg block.
* "Connect and check" button: validates the key and base URL against the studio and shows the connection status.
* Domain request: send your WordPress domain to the studio for approval with one click.
