=== Bepolis Connect ===
Tags: municipalities, public services, gutenberg, government, appointments
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Publish municipal services, procedures, appointments, projects, and news managed in Bepolis.

== Description ==

Bepolis Connect brings the public information managed by a municipality in Bepolis into its existing WordPress website.

The plugin provides ten dynamic Gutenberg blocks for:

* Municipal identity and contact details.
* Public services.
* Procedures and procedure details.
* Appointment directories.
* Municipal projects and project details.
* News, notices, and full publication details.
* Page navigation generated from the Bepolis blocks present on the page.

Bepolis remains the municipal back office and the source of truth. WordPress displays approved public content and lets a site administrator choose which published services, procedures, appointments, projects, and news appear on that specific website.

Citizen actions continue in the municipality's Bepolis My Account portal. WordPress does not receive or store citizen accounts, case files, submitted forms, private documents, or appointment records.

= Key features =

* Server-rendered Gutenberg blocks that inherit the active theme's typography, colours, and spacing.
* Per-site publication controls without duplicating or modifying municipal records.
* Accessible filters and server-side pagination.
* A five-minute cache and a last-known-good response for up to 24 hours.
* ETag revalidation to avoid unnecessary data transfers.
* A Site Health integration for connection diagnostics.
* A server-side API credential that is never exposed to the browser.

Learn more at [Bepolis Connect](https://www.bepolis.com/wordpress).

== Installation ==

1. Install and activate Bepolis Connect.
2. In the Bepolis municipal account, open **WordPress** and create a production credential for this website with the `publicacion:read` scope.
3. In WordPress, open **Bepolis**, paste the credential, and save the connection.
4. Choose whether this website displays the complete public catalogue or a selection for each content type.
5. Add the Bepolis blocks in the WordPress editor.

To keep the credential outside the WordPress database, define it in `wp-config.php`:

`define( 'BEPOLIS_CONNECT_API_KEY', 'bep_live_...' );`

== Frequently Asked Questions ==

= Does this plugin replace Bepolis? =

No. Bepolis remains the municipal management system and source of truth. The plugin is the public presentation layer for an existing WordPress website.

= Does WordPress store citizen or case-file data? =

No. The plugin requests public publication data only. Authenticated actions, citizen accounts, forms, files, case records, and appointments remain in Bepolis.

= Which credential does the plugin require? =

It requires a dedicated production credential created for the municipality and website with the read-only `publicacion:read` scope. A credential can be revoked from Bepolis at any time.

= Can each WordPress site choose what it displays? =

Yes. Bepolis supplies the current public catalogue, and the WordPress administrator can display all items or maintain a local allowlist for services, procedures, appointments, projects, and news. This choice affects only that WordPress site.

= Does Bepolis Connect work with any theme? =

The blocks use WordPress block supports and CSS custom properties so they inherit the active theme. Card, list, compact, and uncontained styles are available where relevant.

= What happens if the API is temporarily unavailable? =

The plugin serves its last valid cached publication for up to 24 hours and identifies that state in the rendered output. It never replaces a valid response with an error response.

== Screenshots ==

1. Bepolis Connect explains the publication flow and displays the municipality connection status.
2. Per-site controls select which public content appears on this WordPress installation.
3. Gutenberg previews use real public Bepolis data without exposing the API credential.
4. Public blocks inherit the active WordPress theme and include filters and pagination.

== External services ==

Bepolis Connect connects to the Bepolis Public API at `https://api.bepolis.com/v1/` after a WordPress administrator configures a Bepolis publication credential.

The connection is required to retrieve the municipality's approved public content. Each request sends:

* The Bepolis publication credential in the HTTPS `Authorization` header.
* The requested public resource and optional pagination or category filters in the URL.
* The Bepolis Connect version in the technical `User-Agent` header.
* An ETag previously returned by Bepolis when the cached response is revalidated.

The website address, WordPress user details, visitor details, citizen accounts, form submissions, case files, private documents, and cookies are not sent by this plugin. The credential remains on the WordPress server and is not included in public HTML or browser requests.

The Bepolis API returns only the public publication projection associated with the municipality that owns the credential. Bepolis processes technical request metadata for authentication, security, rate limiting, and operational audit.

Use of the service is governed by the [Bepolis Terms and Conditions](https://www.bepolis.com/legal/terminos-condiciones) and [Bepolis Privacy Policy](https://www.bepolis.com/legal/politica-privacidad).

== Privacy ==

Bepolis Connect does not set cookies, add tracking code, or collect visitor analytics. It stores the administrator-provided API credential and local publication choices in WordPress options, and stores public API responses in WordPress transients for performance and resilience.

Uninstalling the plugin removes its saved credential, publication choices, and cache generation value. Previously cached public responses expire automatically within 24 hours.

== Changelog ==

= 1.0.0 =
* Prepares Bepolis Connect for the WordPress.org Plugin Directory.
* Documents the external Bepolis API and plugin privacy behaviour in full.
* Removes the website address from the technical API User-Agent.
* Adds per-site publication controls for services, procedures, appointments, projects, and news.
* Provides ten dynamic blocks, editor previews, accessible filters, pagination, caching, and Site Health diagnostics.

= 0.7.0 =
* Added per-site publication controls while keeping Bepolis as the source of truth.

== Upgrade Notice ==

= 1.0.0 =
This directory-ready release improves privacy disclosure and removes the WordPress site URL from API requests.
